From 474b98abb54603474111d21a5cb1ddd515a6b480 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 24 Jan 2026 21:04:06 +0100 Subject: [PATCH] Use new "metas" mutations --- .../category/services/CategoryMetadata.ts | 4 +- src/features/manga/services/MangaMetadata.ts | 4 +- .../services/MetadataApolloCacheHandler.ts | 19 +- .../metadata/services/MetadataUpdater.ts | 174 ++++--- src/features/reader/services/ReaderService.ts | 23 +- .../reader/settings/ReaderSettingsMetadata.ts | 4 +- .../services/ServerSettingsMetadata.ts | 5 +- .../source/services/SourceMetadata.ts | 4 +- src/lib/graphql/category/CategoryMutation.ts | 12 +- src/lib/graphql/chapter/ChapterMutation.ts | 12 +- src/lib/graphql/generated/apollo-helpers.ts | 110 ++++- src/lib/graphql/generated/graphql.ts | 268 +++++++++- src/lib/graphql/manga/MangaMutation.ts | 12 +- .../metadata/GlobalMetadataMutation.ts | 12 +- src/lib/graphql/source/SourceMutation.ts | 12 +- src/lib/requests/RequestManager.ts | 463 +++++++++++------- 16 files changed, 791 insertions(+), 347 deletions(-) diff --git a/src/features/category/services/CategoryMetadata.ts b/src/features/category/services/CategoryMetadata.ts index 59c57b72..33aabe79 100644 --- a/src/features/category/services/CategoryMetadata.ts +++ b/src/features/category/services/CategoryMetadata.ts @@ -80,7 +80,7 @@ export const updateCategoryMetadata = async < category: CategoryIdInfo & GqlMetaHolder, metadataKey: MetadataKey, value: ICategoryMetadata[MetadataKey], -): Promise => +): Promise => requestUpdateCategoryMetadata(category, [ [metadataKey, convertAppMetadataToGqlMetadata({ [metadataKey]: value })[metadataKey]], ]); @@ -89,6 +89,6 @@ export const createUpdateCategoryMetadata = ( category: CategoryIdInfo & GqlMetaHolder, handleError: (error: any) => void = defaultPromiseErrorHandler('createUpdateCategoryMetadata'), - ): ((...args: OmitFirst>>) => Promise) => + ): ((...args: OmitFirst>>) => Promise) => (metadataKey, value) => updateCategoryMetadata(category, metadataKey, value).catch(handleError); diff --git a/src/features/manga/services/MangaMetadata.ts b/src/features/manga/services/MangaMetadata.ts index 9b7a5e77..43212cf4 100644 --- a/src/features/manga/services/MangaMetadata.ts +++ b/src/features/manga/services/MangaMetadata.ts @@ -68,7 +68,7 @@ export const updateMangaMetadata = async < manga: MangaIdInfo & GqlMetaHolder, metadataKey: MetadataKey, value: MangaMetadata[MetadataKey], -): Promise => +): Promise => requestUpdateMangaMetadata(manga, [ [metadataKey, convertAppMetadataToGqlMetadata({ [metadataKey]: value })[metadataKey]], ]); @@ -77,6 +77,6 @@ export const createUpdateMangaMetadata = ( manga: MangaIdInfo & GqlMetaHolder, handleError: (error: any) => void = defaultPromiseErrorHandler('createUpdateMangaMetadata'), - ): ((...args: OmitFirst>>) => Promise) => + ): ((...args: OmitFirst>>) => Promise) => (metadataKey, value) => updateMangaMetadata(manga, metadataKey, value).catch(handleError); diff --git a/src/features/metadata/services/MetadataApolloCacheHandler.ts b/src/features/metadata/services/MetadataApolloCacheHandler.ts index 8e2f7c88..d1fe7bed 100644 --- a/src/features/metadata/services/MetadataApolloCacheHandler.ts +++ b/src/features/metadata/services/MetadataApolloCacheHandler.ts @@ -8,26 +8,27 @@ import { ReadFieldFunction } from '@apollo/client/cache/core/types/common'; import { Reference } from '@apollo/client/utilities'; +import { MetaType } from '@/lib/graphql/generated/graphql.ts'; export const updateMetadataList = ( - key: string, + meta: MetaType[], existingMetas: Reference[] | undefined, readField: ReadFieldFunction, - createMetaRef: () => Reference | undefined, + createMetaRef: (meta: MetaType) => Reference | undefined, deleted: boolean = false, -): (Reference | undefined)[] | undefined => { +) => { if (!existingMetas) { return existingMetas; } if (deleted) { - return existingMetas.filter((metaRef: Reference) => readField('key', metaRef) !== key); + return existingMetas.filter((metaRef: Reference) => meta.some(({ key }) => key === readField('key', metaRef))); } - const exists = existingMetas.some((metaRef: Reference) => readField('key', metaRef) === key); - if (exists) { - return existingMetas; - } + const newMetas = meta.filter(({ key }) => + existingMetas.every((metaRef: Reference) => readField('key', metaRef) !== key), + ); + const newMetaRefs = newMetas.map(createMetaRef); - return [...existingMetas, createMetaRef()]; + return [...existingMetas, ...newMetaRefs]; }; diff --git a/src/features/metadata/services/MetadataUpdater.ts b/src/features/metadata/services/MetadataUpdater.ts index d9df4d66..8b2515fe 100644 --- a/src/features/metadata/services/MetadataUpdater.ts +++ b/src/features/metadata/services/MetadataUpdater.ts @@ -9,7 +9,6 @@ import { requestManager } from '@/lib/requests/RequestManager.ts'; import { CategoryIdInfo } from '@/features/category/Category.types.ts'; import { - AllowedMetadataValueTypes, AppMetadataKeys, GqlMetaHolder, MetadataHolder, @@ -22,83 +21,82 @@ import { convertToGqlMeta } from '@/features/metadata/services/MetadataConverter import { SourceIdInfo } from '@/features/source/Source.types.ts'; import { ChapterIdInfo } from '@/features/chapter/Chapter.types.ts'; -const requestUpdateMetadataValue = async ( - metadataHolder: GqlMetaHolder, - holderType: MetadataHolderType, - key: AppMetadataKeys, - value: AllowedMetadataValueTypes, - keyPrefixes?: string[], - isMetadataKey: boolean = false, -): Promise => { - const metadataKey = isMetadataKey ? key : getMetadataKey(key, keyPrefixes); - - switch (holderType) { - case 'category': - await requestManager.setCategoryMeta((metadataHolder as CategoryIdInfo).id, metadataKey, value).response; - break; - case 'chapter': - await requestManager.setChapterMeta((metadataHolder as ChapterIdInfo).id, metadataKey, value).response; - break; - case 'global': - await requestManager.setGlobalMetadata(metadataKey, value).response; - break; - case 'manga': - await requestManager.setMangaMeta((metadataHolder as MangaIdInfo).id, metadataKey, value).response; - break; - case 'source': - await requestManager.setSourceMeta((metadataHolder as SourceIdInfo).id, metadataKey, value).response; - break; - default: - throw new Error(`requestUpdateMetadataValue: unknown holderType "${holderType}"`); - } -}; - -const requestUpdateMetadata = async ( +const requestUpdateMetadataValues = async ( metadataHolder: GqlMetaHolder, holderType: MetadataHolderType, keysToValues: MetadataKeyValuePair[], keyPrefixes?: string[], - isMetadataKey?: boolean, -): Promise => - Promise.all( - keysToValues.map(([key, value]) => - requestUpdateMetadataValue(metadataHolder, holderType, key, value, keyPrefixes, isMetadataKey), - ), - ); + isMetadataKey: boolean = false, +): Promise => { + const metas = keysToValues.map(([key, value]) => ({ + key: isMetadataKey ? key : getMetadataKey(key, keyPrefixes), + value: `${value}`, + })); + + switch (holderType) { + case 'category': + await requestManager.setCategoryMeta({ + items: [{ categoryIds: [(metadataHolder as CategoryIdInfo).id], metas }], + }).response; + break; + case 'chapter': + await requestManager.setChapterMeta({ + items: [{ chapterIds: [(metadataHolder as ChapterIdInfo).id], metas }], + }).response; + break; + case 'global': + await requestManager.setGlobalMetadata({ + metas, + }).response; + break; + case 'manga': + await requestManager.setMangaMeta({ + items: [{ mangaIds: [(metadataHolder as MangaIdInfo).id], metas }], + }).response; + break; + case 'source': + await requestManager.setSourceMeta({ + items: [{ sourceIds: [(metadataHolder as SourceIdInfo).id], metas }], + }).response; + break; + default: + throw new Error(`requestUpdateMetadataValues: unknown holderType "${holderType}"`); + } +}; export const requestUpdateServerMetadata = async ( keysToValues: MetadataKeyValuePair[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestUpdateMetadata({}, 'global', keysToValues, keyPrefixes, isMetadataKey); +): Promise => requestUpdateMetadataValues({}, 'global', keysToValues, keyPrefixes, isMetadataKey); export const requestUpdateMangaMetadata = async ( manga: MangaIdInfo & GqlMetaHolder, keysToValues: MetadataKeyValuePair[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestUpdateMetadata(manga, 'manga', keysToValues, keyPrefixes, isMetadataKey); +): Promise => requestUpdateMetadataValues(manga, 'manga', keysToValues, keyPrefixes, isMetadataKey); export const requestUpdateChapterMetadata = async ( chapter: ChapterIdInfo & GqlMetaHolder, keysToValues: MetadataKeyValuePair[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestUpdateMetadata(chapter, 'chapter', keysToValues, keyPrefixes, isMetadataKey); +): Promise => requestUpdateMetadataValues(chapter, 'chapter', keysToValues, keyPrefixes, isMetadataKey); export const requestUpdateCategoryMetadata = async ( category: CategoryIdInfo & GqlMetaHolder, keysToValues: MetadataKeyValuePair[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestUpdateMetadata(category, 'category', keysToValues, keyPrefixes, isMetadataKey); +): Promise => requestUpdateMetadataValues(category, 'category', keysToValues, keyPrefixes, isMetadataKey); export const requestUpdateSourceMetadata = async ( source: SourceIdInfo & GqlMetaHolder, keysToValue: MetadataKeyValuePair[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestUpdateMetadata(source, 'source', keysToValue, keyPrefixes, isMetadataKey); +): Promise => requestUpdateMetadataValues(source, 'source', keysToValue, keyPrefixes, isMetadataKey); export const getMetadataUpdateFunction = ( type: MetadataHolderType, @@ -108,7 +106,7 @@ export const getMetadataUpdateFunction = ( | (ChapterIdInfo & MetadataHolder) | (CategoryIdInfo & MetadataHolder) | (SourceIdInfo & MetadataHolder), -): ((keyValuePair: MetadataKeyValuePair[], keyPrefixes?: string[], isMetadataKey?: boolean) => Promise) => { +): ((keyValuePair: MetadataKeyValuePair[], prefixes?: string[], isMetadataKey?: boolean) => Promise) => { switch (type) { case 'global': return (...args) => requestUpdateServerMetadata(...args); @@ -144,81 +142,79 @@ export const getMetadataUpdateFunction = ( } }; -export const requestDeleteMetadataValue = async ( - metadataHolder: GqlMetaHolder, - holderType: MetadataHolderType, - key: AppMetadataKeys, - keyPrefixes?: string[], - isMetadataKey: boolean = false, -): Promise => { - const metadataKey = isMetadataKey ? key : getMetadataKey(key, keyPrefixes); - - switch (holderType) { - case 'category': - await requestManager.deleteCategoryMeta((metadataHolder as CategoryIdInfo).id, metadataKey).response; - break; - case 'chapter': - await requestManager.deleteChapterMeta((metadataHolder as ChapterIdInfo).id, metadataKey).response; - break; - case 'global': - await requestManager.deleteGlobalMeta(metadataKey).response; - break; - case 'manga': - await requestManager.deleteMangaMeta((metadataHolder as MangaIdInfo).id, metadataKey).response; - break; - case 'source': - await requestManager.deleteSourceMeta((metadataHolder as SourceIdInfo).id, metadataKey).response; - break; - default: - throw new Error(`requestDeleteMetadataValue: unknown holderType "${holderType}"`); - } -}; - -async function requestDeleteMetadata( +const requestDeleteMetadataValues = async ( metadataHolder: GqlMetaHolder, holderType: MetadataHolderType, keys: AppMetadataKeys[], keyPrefixes?: string[], - isMetadataKey?: boolean, -): Promise { - return Promise.all( - keys.map((key) => requestDeleteMetadataValue(metadataHolder, holderType, key, keyPrefixes, isMetadataKey)), - ); -} + isMetadataKey: boolean = false, +): Promise => { + const metadataKeys = keys.map((key) => (isMetadataKey ? key : getMetadataKey(key, keyPrefixes))); + + switch (holderType) { + case 'category': + await requestManager.deleteCategoryMeta({ + items: [{ categoryIds: [(metadataHolder as CategoryIdInfo).id], keys: metadataKeys }], + }).response; + break; + case 'chapter': + await requestManager.deleteChapterMeta({ + items: [{ chapterIds: [(metadataHolder as ChapterIdInfo).id], keys: metadataKeys }], + }).response; + break; + case 'global': + await requestManager.deleteGlobalMeta({ + keys: metadataKeys, + }).response; + break; + case 'manga': + await requestManager.deleteMangaMeta({ + items: [{ mangaIds: [(metadataHolder as MangaIdInfo).id], keys: metadataKeys }], + }).response; + break; + case 'source': + await requestManager.deleteSourceMeta({ + items: [{ sourceIds: [(metadataHolder as SourceIdInfo).id], keys: metadataKeys }], + }).response; + break; + default: + throw new Error(`requestDeleteMetadataValues: unknown holderType "${holderType}"`); + } +}; export const requestDeleteServerMetadata = async ( keys: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestDeleteMetadata({}, 'global', keys, keyPrefixes, isMetadataKey); +): Promise => requestDeleteMetadataValues({}, 'global', keys, keyPrefixes, isMetadataKey); export const requestDeleteMangaMetadata = async ( manga: MangaIdInfo & GqlMetaHolder, keys: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestDeleteMetadata(manga, 'manga', keys, keyPrefixes, isMetadataKey); +): Promise => requestDeleteMetadataValues(manga, 'manga', keys, keyPrefixes, isMetadataKey); export const requestDeleteChapterMetadata = async ( chapter: ChapterIdInfo & GqlMetaHolder, keys: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestDeleteMetadata(chapter, 'chapter', keys, keyPrefixes, isMetadataKey); +): Promise => requestDeleteMetadataValues(chapter, 'chapter', keys, keyPrefixes, isMetadataKey); export const requestDeleteCategoryMetadata = async ( category: CategoryIdInfo & GqlMetaHolder, keys: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestDeleteMetadata(category, 'category', keys, keyPrefixes, isMetadataKey); +): Promise => requestDeleteMetadataValues(category, 'category', keys, keyPrefixes, isMetadataKey); export const requestDeleteSourceMetadata = async ( source: SourceIdInfo & GqlMetaHolder, keys: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean, -): Promise => requestDeleteMetadata(source, 'source', keys, keyPrefixes, isMetadataKey); +): Promise => requestDeleteMetadataValues(source, 'source', keys, keyPrefixes, isMetadataKey); export const getMetadataDeleteFunction = ( type: MetadataHolderType, @@ -228,7 +224,7 @@ export const getMetadataDeleteFunction = ( | (ChapterIdInfo & MetadataHolder) | (CategoryIdInfo & MetadataHolder) | (SourceIdInfo & MetadataHolder), -): ((metadataToDelete: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean) => Promise) => { +): ((metadataToDelete: AppMetadataKeys[], keyPrefixes?: string[], isMetadataKey?: boolean) => Promise) => { switch (type) { case 'global': return (...args) => requestDeleteServerMetadata(...args); diff --git a/src/features/reader/services/ReaderService.ts b/src/features/reader/services/ReaderService.ts index cfcb504b..560bb55d 100644 --- a/src/features/reader/services/ReaderService.ts +++ b/src/features/reader/services/ReaderService.ts @@ -289,6 +289,7 @@ export class ReaderService { return; } const key = getMetadataKey(setting, profile !== undefined ? [profile?.toString()] : undefined); + const metaValue = JSON.stringify(value); const { cache } = requestManager.graphQLClient.client; @@ -299,7 +300,7 @@ export class ReaderService { data: { __typename: 'GlobalMetaType', key, - value: JSON.stringify(value), + value: metaValue, }, }); cache.modify({ @@ -307,7 +308,12 @@ export class ReaderService { metas(existingMetas, { readField }) { return { ...existingMetas, - nodes: updateMetadataList(key, existingMetas?.nodes, readField, () => reference), + nodes: updateMetadataList( + [{ key, value: metaValue }], + existingMetas?.nodes, + readField, + () => reference, + ), }; }, }, @@ -319,14 +325,19 @@ export class ReaderService { __typename: 'MangaMetaType', mangaId: manga.id, key, - value: JSON.stringify(value), + value: metaValue, }, }); cache.modify({ id: cache.identify({ __typename: 'MangaType', id: manga.id }), fields: { meta(existingMetas, { readField }) { - return updateMetadataList(key, existingMetas, readField, () => reference); + return updateMetadataList( + [{ key, value: metaValue }], + existingMetas, + readField, + () => reference, + ); }, }, }); @@ -363,8 +374,8 @@ export class ReaderService { } const deleteSetting = isGlobalSetting - ? () => requestManager.deleteGlobalMeta(key).response - : () => requestManager.deleteMangaMeta(manga.id, key).response; + ? () => requestManager.deleteGlobalMeta({ keys: [key] }).response + : () => requestManager.deleteMangaMeta({ items: [{ mangaIds: [manga.id], keys: [key] }] }).response; deleteSetting().catch((e) => makeToast(t`Could not save the reader settings to the server`, 'error', getErrorMessage(e)), ); diff --git a/src/features/reader/settings/ReaderSettingsMetadata.ts b/src/features/reader/settings/ReaderSettingsMetadata.ts index 659419b5..4e431bf2 100644 --- a/src/features/reader/settings/ReaderSettingsMetadata.ts +++ b/src/features/reader/settings/ReaderSettingsMetadata.ts @@ -224,7 +224,7 @@ export const updateReaderSettings = async => { +): Promise => { const isGlobalSetting = isGlobal || GLOBAL_READER_SETTING_KEYS.includes(setting); if (isGlobalSetting) { return requestUpdateServerMetadata( @@ -244,6 +244,6 @@ export const createUpdateReaderSettings = manga: Pick & GqlMetaHolder, handleError: (error: any) => void = defaultPromiseErrorHandler('createUpdateReaderSettings'), profile?: ReadingMode, - ): ((...args: OmitFirst>>) => Promise) => + ): ((...args: OmitFirst>>) => Promise) => (setting, value, isGlobal) => updateReaderSettings(manga, setting, value, isGlobal, profile).catch(handleError); diff --git a/src/features/settings/services/ServerSettingsMetadata.ts b/src/features/settings/services/ServerSettingsMetadata.ts index f289d9ab..a39f1622 100644 --- a/src/features/settings/services/ServerSettingsMetadata.ts +++ b/src/features/settings/services/ServerSettingsMetadata.ts @@ -64,12 +64,11 @@ export const updateMetadataServerSettings = async < >( setting: Setting, value: MetadataServerSettings[Setting], -): Promise => - requestUpdateServerMetadata([[setting, convertSettingsToMetadata({ [setting]: value })[setting]]]); +): Promise => requestUpdateServerMetadata([[setting, convertSettingsToMetadata({ [setting]: value })[setting]]]); export const createUpdateMetadataServerSettings = ( handleError: (error: any) => void = defaultPromiseErrorHandler('createUpdateMetadataServerSettings'), - ): ((...args: Parameters>) => Promise) => + ): ((...args: Parameters>) => Promise) => (setting, value) => updateMetadataServerSettings(setting, value).catch(handleError); diff --git a/src/features/source/services/SourceMetadata.ts b/src/features/source/services/SourceMetadata.ts index 3048134b..ad8e6f77 100644 --- a/src/features/source/services/SourceMetadata.ts +++ b/src/features/source/services/SourceMetadata.ts @@ -50,7 +50,7 @@ export const updateSourceMetadata = async < source: SourceIdInfo & GqlMetaHolder, metadataKey: MetadataKey, value: ISourceMetadata[MetadataKey], -): Promise => +): Promise => requestUpdateSourceMetadata(source, [ [metadataKey, convertAppMetadataToGqlMetadata({ [metadataKey]: value })[metadataKey]], ]); @@ -59,6 +59,6 @@ export const createUpdateSourceMetadata = ( source: SourceIdInfo & GqlMetaHolder, handleError: (error: any) => void = defaultPromiseErrorHandler('createUpdateSourceMetadata'), - ): ((...args: OmitFirst>>) => Promise) => + ): ((...args: OmitFirst>>) => Promise) => (metadataKey, value) => updateSourceMetadata(source, metadataKey, value).catch(handleError); diff --git a/src/lib/graphql/category/CategoryMutation.ts b/src/lib/graphql/category/CategoryMutation.ts index 9f3dc8ba..ca44b563 100644 --- a/src/lib/graphql/category/CategoryMutation.ts +++ b/src/lib/graphql/category/CategoryMutation.ts @@ -33,9 +33,9 @@ export const DELETE_CATEGORY = gql` export const DELETE_CATEGORY_METADATA = gql` ${CATEGORY_META_FIELDS} - mutation DELETE_CATEGORY_METADATA($input: DeleteCategoryMetaInput!) { - deleteCategoryMeta(input: $input) { - meta { + mutation DELETE_CATEGORY_METADATA($input: DeleteCategoryMetasInput!) { + deleteCategoryMetas(input: $input) { + metas { ...CATEGORY_META_FIELDS } } @@ -45,9 +45,9 @@ export const DELETE_CATEGORY_METADATA = gql` export const SET_CATEGORY_METADATA = gql` ${CATEGORY_META_FIELDS} - mutation SET_CATEGORY_METADATA($input: SetCategoryMetaInput!) { - setCategoryMeta(input: $input) { - meta { + mutation SET_CATEGORY_METADATA($input: SetCategoryMetasInput!) { + setCategoryMetas(input: $input) { + metas { ...CATEGORY_META_FIELDS } } diff --git a/src/lib/graphql/chapter/ChapterMutation.ts b/src/lib/graphql/chapter/ChapterMutation.ts index 0138c688..1533b9fd 100644 --- a/src/lib/graphql/chapter/ChapterMutation.ts +++ b/src/lib/graphql/chapter/ChapterMutation.ts @@ -14,9 +14,9 @@ import { MANGA_CHAPTER_NODE_FIELDS, MANGA_CHAPTER_STAT_FIELDS } from '@/lib/grap export const DELETE_CHAPTER_METADATA = gql` ${CHAPTER_META_FIELDS} - mutation DELETE_CHAPTER_METADATA($input: DeleteChapterMetaInput!) { - deleteChapterMeta(input: $input) { - meta { + mutation DELETE_CHAPTER_METADATA($input: DeleteChapterMetasInput!) { + deleteChapterMetas(input: $input) { + metas { ...CHAPTER_META_FIELDS } } @@ -59,9 +59,9 @@ export const GET_MANGA_CHAPTERS_FETCH = gql` export const SET_CHAPTER_METADATA = gql` ${CHAPTER_META_FIELDS} - mutation SET_CHAPTER_METADATA($input: SetChapterMetaInput!) { - setChapterMeta(input: $input) { - meta { + mutation SET_CHAPTER_METADATA($input: SetChapterMetasInput!) { + setChapterMetas(input: $input) { + metas { ...CHAPTER_META_FIELDS } } diff --git a/src/lib/graphql/generated/apollo-helpers.ts b/src/lib/graphql/generated/apollo-helpers.ts index 69685b0c..9d168bd7 100644 --- a/src/lib/graphql/generated/apollo-helpers.ts +++ b/src/lib/graphql/generated/apollo-helpers.ts @@ -155,6 +155,12 @@ export type DeleteCategoryMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type DeleteCategoryMetasPayloadKeySpecifier = ('categories' | 'clientMutationId' | 'metas' | DeleteCategoryMetasPayloadKeySpecifier)[]; +export type DeleteCategoryMetasPayloadFieldPolicy = { + categories?: FieldPolicy | FieldReadFunction, + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type DeleteCategoryPayloadKeySpecifier = ('category' | 'clientMutationId' | 'mangas' | DeleteCategoryPayloadKeySpecifier)[]; export type DeleteCategoryPayloadFieldPolicy = { category?: FieldPolicy | FieldReadFunction, @@ -167,6 +173,12 @@ export type DeleteChapterMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type DeleteChapterMetasPayloadKeySpecifier = ('chapters' | 'clientMutationId' | 'metas' | DeleteChapterMetasPayloadKeySpecifier)[]; +export type DeleteChapterMetasPayloadFieldPolicy = { + chapters?: FieldPolicy | FieldReadFunction, + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type DeleteDownloadedChapterPayloadKeySpecifier = ('chapters' | 'clientMutationId' | DeleteDownloadedChapterPayloadKeySpecifier)[]; export type DeleteDownloadedChapterPayloadFieldPolicy = { chapters?: FieldPolicy | FieldReadFunction, @@ -182,18 +194,35 @@ export type DeleteGlobalMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type DeleteGlobalMetasPayloadKeySpecifier = ('clientMutationId' | 'metas' | DeleteGlobalMetasPayloadKeySpecifier)[]; +export type DeleteGlobalMetasPayloadFieldPolicy = { + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type DeleteMangaMetaPayloadKeySpecifier = ('clientMutationId' | 'manga' | 'meta' | DeleteMangaMetaPayloadKeySpecifier)[]; export type DeleteMangaMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, manga?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type DeleteMangaMetasPayloadKeySpecifier = ('clientMutationId' | 'mangas' | 'metas' | DeleteMangaMetasPayloadKeySpecifier)[]; +export type DeleteMangaMetasPayloadFieldPolicy = { + clientMutationId?: FieldPolicy | FieldReadFunction, + mangas?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type DeleteSourceMetaPayloadKeySpecifier = ('clientMutationId' | 'meta' | 'source' | DeleteSourceMetaPayloadKeySpecifier)[]; export type DeleteSourceMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction, source?: FieldPolicy | FieldReadFunction }; +export type DeleteSourceMetasPayloadKeySpecifier = ('clientMutationId' | 'metas' | 'sources' | DeleteSourceMetasPayloadKeySpecifier)[]; +export type DeleteSourceMetasPayloadFieldPolicy = { + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction, + sources?: FieldPolicy | FieldReadFunction +}; export type DequeueChapterDownloadPayloadKeySpecifier = ('clientMutationId' | 'downloadStatus' | DequeueChapterDownloadPayloadKeySpecifier)[]; export type DequeueChapterDownloadPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, @@ -506,7 +535,7 @@ export type MultiSelectListPreferenceFieldPolicy = { title?: FieldPolicy | FieldReadFunction, visible?: FieldPolicy | FieldReadFunction }; -export type MutationKeySpecifier = ('bindTrack' | 'clearCachedImages' | 'clearDownloader' | 'connectKoSyncAccount' | 'createBackup' | 'createCategory' | 'deleteCategory' | 'deleteCategoryMeta' | 'deleteChapterMeta' | 'deleteDownloadedChapter' | 'deleteDownloadedChapters' | 'deleteGlobalMeta' | 'deleteMangaMeta' | 'deleteSourceMeta' | 'dequeueChapterDownload' | 'dequeueChapterDownloads' | 'enqueueChapterDownload' | 'enqueueChapterDownloads' | 'fetchChapterPages' | 'fetchChapters' | 'fetchExtensions' | 'fetchManga' | 'fetchSourceManga' | 'fetchTrack' | 'installExternalExtension' | 'login' | 'loginTrackerCredentials' | 'loginTrackerOAuth' | 'logoutKoSyncAccount' | 'logoutTracker' | 'pullKoSyncProgress' | 'pushKoSyncProgress' | 'refreshToken' | 'reorderChapterDownload' | 'resetSettings' | 'resetWebUIUpdateStatus' | 'restoreBackup' | 'setCategoryMeta' | 'setChapterMeta' | 'setGlobalMeta' | 'setMangaMeta' | 'setSettings' | 'setSourceMeta' | 'startDownloader' | 'stopDownloader' | 'trackProgress' | 'unbindTrack' | 'updateCategories' | 'updateCategory' | 'updateCategoryManga' | 'updateCategoryOrder' | 'updateChapter' | 'updateChapters' | 'updateExtension' | 'updateExtensions' | 'updateLibrary' | 'updateLibraryManga' | 'updateManga' | 'updateMangaCategories' | 'updateMangas' | 'updateMangasCategories' | 'updateSourcePreference' | 'updateStop' | 'updateTrack' | 'updateWebUI' | MutationKeySpecifier)[]; +export type MutationKeySpecifier = ('bindTrack' | 'clearCachedImages' | 'clearDownloader' | 'connectKoSyncAccount' | 'createBackup' | 'createCategory' | 'deleteCategory' | 'deleteCategoryMeta' | 'deleteCategoryMetas' | 'deleteChapterMeta' | 'deleteChapterMetas' | 'deleteDownloadedChapter' | 'deleteDownloadedChapters' | 'deleteGlobalMeta' | 'deleteGlobalMetas' | 'deleteMangaMeta' | 'deleteMangaMetas' | 'deleteSourceMeta' | 'deleteSourceMetas' | 'dequeueChapterDownload' | 'dequeueChapterDownloads' | 'enqueueChapterDownload' | 'enqueueChapterDownloads' | 'fetchChapterPages' | 'fetchChapters' | 'fetchExtensions' | 'fetchManga' | 'fetchSourceManga' | 'fetchTrack' | 'installExternalExtension' | 'login' | 'loginTrackerCredentials' | 'loginTrackerOAuth' | 'logoutKoSyncAccount' | 'logoutTracker' | 'pullKoSyncProgress' | 'pushKoSyncProgress' | 'refreshToken' | 'reorderChapterDownload' | 'resetSettings' | 'resetWebUIUpdateStatus' | 'restoreBackup' | 'setCategoryMeta' | 'setCategoryMetas' | 'setChapterMeta' | 'setChapterMetas' | 'setGlobalMeta' | 'setGlobalMetas' | 'setMangaMeta' | 'setMangaMetas' | 'setSettings' | 'setSourceMeta' | 'setSourceMetas' | 'startDownloader' | 'stopDownloader' | 'trackProgress' | 'unbindTrack' | 'updateCategories' | 'updateCategory' | 'updateCategoryManga' | 'updateCategoryOrder' | 'updateChapter' | 'updateChapters' | 'updateExtension' | 'updateExtensions' | 'updateLibrary' | 'updateLibraryManga' | 'updateManga' | 'updateMangaCategories' | 'updateMangas' | 'updateMangasCategories' | 'updateSourcePreference' | 'updateStop' | 'updateTrack' | 'updateWebUI' | MutationKeySpecifier)[]; export type MutationFieldPolicy = { bindTrack?: FieldPolicy | FieldReadFunction, clearCachedImages?: FieldPolicy | FieldReadFunction, @@ -516,12 +545,17 @@ export type MutationFieldPolicy = { createCategory?: FieldPolicy | FieldReadFunction, deleteCategory?: FieldPolicy | FieldReadFunction, deleteCategoryMeta?: FieldPolicy | FieldReadFunction, + deleteCategoryMetas?: FieldPolicy | FieldReadFunction, deleteChapterMeta?: FieldPolicy | FieldReadFunction, + deleteChapterMetas?: FieldPolicy | FieldReadFunction, deleteDownloadedChapter?: FieldPolicy | FieldReadFunction, deleteDownloadedChapters?: FieldPolicy | FieldReadFunction, deleteGlobalMeta?: FieldPolicy | FieldReadFunction, + deleteGlobalMetas?: FieldPolicy | FieldReadFunction, deleteMangaMeta?: FieldPolicy | FieldReadFunction, + deleteMangaMetas?: FieldPolicy | FieldReadFunction, deleteSourceMeta?: FieldPolicy | FieldReadFunction, + deleteSourceMetas?: FieldPolicy | FieldReadFunction, dequeueChapterDownload?: FieldPolicy | FieldReadFunction, dequeueChapterDownloads?: FieldPolicy | FieldReadFunction, enqueueChapterDownload?: FieldPolicy | FieldReadFunction, @@ -546,11 +580,16 @@ export type MutationFieldPolicy = { resetWebUIUpdateStatus?: FieldPolicy | FieldReadFunction, restoreBackup?: FieldPolicy | FieldReadFunction, setCategoryMeta?: FieldPolicy | FieldReadFunction, + setCategoryMetas?: FieldPolicy | FieldReadFunction, setChapterMeta?: FieldPolicy | FieldReadFunction, + setChapterMetas?: FieldPolicy | FieldReadFunction, setGlobalMeta?: FieldPolicy | FieldReadFunction, + setGlobalMetas?: FieldPolicy | FieldReadFunction, setMangaMeta?: FieldPolicy | FieldReadFunction, + setMangaMetas?: FieldPolicy | FieldReadFunction, setSettings?: FieldPolicy | FieldReadFunction, setSourceMeta?: FieldPolicy | FieldReadFunction, + setSourceMetas?: FieldPolicy | FieldReadFunction, startDownloader?: FieldPolicy | FieldReadFunction, stopDownloader?: FieldPolicy | FieldReadFunction, trackProgress?: FieldPolicy | FieldReadFunction, @@ -761,21 +800,44 @@ export type SetCategoryMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type SetCategoryMetasPayloadKeySpecifier = ('categories' | 'clientMutationId' | 'metas' | SetCategoryMetasPayloadKeySpecifier)[]; +export type SetCategoryMetasPayloadFieldPolicy = { + categories?: FieldPolicy | FieldReadFunction, + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type SetChapterMetaPayloadKeySpecifier = ('clientMutationId' | 'meta' | SetChapterMetaPayloadKeySpecifier)[]; export type SetChapterMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type SetChapterMetasPayloadKeySpecifier = ('chapters' | 'clientMutationId' | 'metas' | SetChapterMetasPayloadKeySpecifier)[]; +export type SetChapterMetasPayloadFieldPolicy = { + chapters?: FieldPolicy | FieldReadFunction, + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type SetGlobalMetaPayloadKeySpecifier = ('clientMutationId' | 'meta' | SetGlobalMetaPayloadKeySpecifier)[]; export type SetGlobalMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type SetGlobalMetasPayloadKeySpecifier = ('clientMutationId' | 'metas' | SetGlobalMetasPayloadKeySpecifier)[]; +export type SetGlobalMetasPayloadFieldPolicy = { + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type SetMangaMetaPayloadKeySpecifier = ('clientMutationId' | 'meta' | SetMangaMetaPayloadKeySpecifier)[]; export type SetMangaMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type SetMangaMetasPayloadKeySpecifier = ('clientMutationId' | 'mangas' | 'metas' | SetMangaMetasPayloadKeySpecifier)[]; +export type SetMangaMetasPayloadFieldPolicy = { + clientMutationId?: FieldPolicy | FieldReadFunction, + mangas?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction +}; export type SetSettingsPayloadKeySpecifier = ('clientMutationId' | 'settings' | SetSettingsPayloadKeySpecifier)[]; export type SetSettingsPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, @@ -786,6 +848,12 @@ export type SetSourceMetaPayloadFieldPolicy = { clientMutationId?: FieldPolicy | FieldReadFunction, meta?: FieldPolicy | FieldReadFunction }; +export type SetSourceMetasPayloadKeySpecifier = ('clientMutationId' | 'metas' | 'sources' | SetSourceMetasPayloadKeySpecifier)[]; +export type SetSourceMetasPayloadFieldPolicy = { + clientMutationId?: FieldPolicy | FieldReadFunction, + metas?: FieldPolicy | FieldReadFunction, + sources?: FieldPolicy | FieldReadFunction +}; export type SettingsKeySpecifier = ('authMode' | 'authPassword' | 'authUsername' | 'autoBackupIncludeCategories' | 'autoBackupIncludeChapters' | 'autoBackupIncludeClientData' | 'autoBackupIncludeHistory' | 'autoBackupIncludeManga' | 'autoBackupIncludeServerSettings' | 'autoBackupIncludeTracking' | 'autoDownloadAheadLimit' | 'autoDownloadIgnoreReUploads' | 'autoDownloadNewChapters' | 'autoDownloadNewChaptersLimit' | 'backupInterval' | 'backupPath' | 'backupTTL' | 'backupTime' | 'basicAuthEnabled' | 'basicAuthPassword' | 'basicAuthUsername' | 'databasePassword' | 'databaseType' | 'databaseUrl' | 'databaseUsername' | 'debugLogsEnabled' | 'downloadAsCbz' | 'downloadConversions' | 'downloadsPath' | 'electronPath' | 'excludeCompleted' | 'excludeEntryWithUnreadChapters' | 'excludeNotStarted' | 'excludeUnreadChapters' | 'extensionRepos' | 'flareSolverrAsResponseFallback' | 'flareSolverrEnabled' | 'flareSolverrSessionName' | 'flareSolverrSessionTtl' | 'flareSolverrTimeout' | 'flareSolverrUrl' | 'globalUpdateInterval' | 'gqlDebugLogsEnabled' | 'initialOpenInBrowserEnabled' | 'ip' | 'jwtAudience' | 'jwtRefreshExpiry' | 'jwtTokenExpiry' | 'koreaderSyncChecksumMethod' | 'koreaderSyncDeviceId' | 'koreaderSyncPercentageTolerance' | 'koreaderSyncServerUrl' | 'koreaderSyncStrategy' | 'koreaderSyncStrategyBackward' | 'koreaderSyncStrategyForward' | 'koreaderSyncUserkey' | 'koreaderSyncUsername' | 'localSourcePath' | 'maxLogFileSize' | 'maxLogFiles' | 'maxLogFolderSize' | 'maxSourcesInParallel' | 'opdsCbzMimetype' | 'opdsChapterSortOrder' | 'opdsEnablePageReadProgress' | 'opdsItemsPerPage' | 'opdsMarkAsReadOnDownload' | 'opdsShowOnlyDownloadedChapters' | 'opdsShowOnlyUnreadChapters' | 'opdsUseBinaryFileSizes' | 'port' | 'serveConversions' | 'socksProxyEnabled' | 'socksProxyHost' | 'socksProxyPassword' | 'socksProxyPort' | 'socksProxyUsername' | 'socksProxyVersion' | 'systemTrayEnabled' | 'updateMangas' | 'useHikariConnectionPool' | 'webUIChannel' | 'webUIFlavor' | 'webUIInterface' | 'webUIUpdateCheckInterval' | SettingsKeySpecifier)[]; export type SettingsFieldPolicy = { authMode?: FieldPolicy | FieldReadFunction, @@ -1418,6 +1486,10 @@ export type StrictTypedTypePolicies = { keyFields?: false | DeleteCategoryMetaPayloadKeySpecifier | (() => undefined | DeleteCategoryMetaPayloadKeySpecifier), fields?: DeleteCategoryMetaPayloadFieldPolicy, }, + DeleteCategoryMetasPayload?: Omit & { + keyFields?: false | DeleteCategoryMetasPayloadKeySpecifier | (() => undefined | DeleteCategoryMetasPayloadKeySpecifier), + fields?: DeleteCategoryMetasPayloadFieldPolicy, + }, DeleteCategoryPayload?: Omit & { keyFields?: false | DeleteCategoryPayloadKeySpecifier | (() => undefined | DeleteCategoryPayloadKeySpecifier), fields?: DeleteCategoryPayloadFieldPolicy, @@ -1426,6 +1498,10 @@ export type StrictTypedTypePolicies = { keyFields?: false | DeleteChapterMetaPayloadKeySpecifier | (() => undefined | DeleteChapterMetaPayloadKeySpecifier), fields?: DeleteChapterMetaPayloadFieldPolicy, }, + DeleteChapterMetasPayload?: Omit & { + keyFields?: false | DeleteChapterMetasPayloadKeySpecifier | (() => undefined | DeleteChapterMetasPayloadKeySpecifier), + fields?: DeleteChapterMetasPayloadFieldPolicy, + }, DeleteDownloadedChapterPayload?: Omit & { keyFields?: false | DeleteDownloadedChapterPayloadKeySpecifier | (() => undefined | DeleteDownloadedChapterPayloadKeySpecifier), fields?: DeleteDownloadedChapterPayloadFieldPolicy, @@ -1438,14 +1514,26 @@ export type StrictTypedTypePolicies = { keyFields?: false | DeleteGlobalMetaPayloadKeySpecifier | (() => undefined | DeleteGlobalMetaPayloadKeySpecifier), fields?: DeleteGlobalMetaPayloadFieldPolicy, }, + DeleteGlobalMetasPayload?: Omit & { + keyFields?: false | DeleteGlobalMetasPayloadKeySpecifier | (() => undefined | DeleteGlobalMetasPayloadKeySpecifier), + fields?: DeleteGlobalMetasPayloadFieldPolicy, + }, DeleteMangaMetaPayload?: Omit & { keyFields?: false | DeleteMangaMetaPayloadKeySpecifier | (() => undefined | DeleteMangaMetaPayloadKeySpecifier), fields?: DeleteMangaMetaPayloadFieldPolicy, }, + DeleteMangaMetasPayload?: Omit & { + keyFields?: false | DeleteMangaMetasPayloadKeySpecifier | (() => undefined | DeleteMangaMetasPayloadKeySpecifier), + fields?: DeleteMangaMetasPayloadFieldPolicy, + }, DeleteSourceMetaPayload?: Omit & { keyFields?: false | DeleteSourceMetaPayloadKeySpecifier | (() => undefined | DeleteSourceMetaPayloadKeySpecifier), fields?: DeleteSourceMetaPayloadFieldPolicy, }, + DeleteSourceMetasPayload?: Omit & { + keyFields?: false | DeleteSourceMetasPayloadKeySpecifier | (() => undefined | DeleteSourceMetasPayloadKeySpecifier), + fields?: DeleteSourceMetasPayloadFieldPolicy, + }, DequeueChapterDownloadPayload?: Omit & { keyFields?: false | DequeueChapterDownloadPayloadKeySpecifier | (() => undefined | DequeueChapterDownloadPayloadKeySpecifier), fields?: DequeueChapterDownloadPayloadFieldPolicy, @@ -1682,18 +1770,34 @@ export type StrictTypedTypePolicies = { keyFields?: false | SetCategoryMetaPayloadKeySpecifier | (() => undefined | SetCategoryMetaPayloadKeySpecifier), fields?: SetCategoryMetaPayloadFieldPolicy, }, + SetCategoryMetasPayload?: Omit & { + keyFields?: false | SetCategoryMetasPayloadKeySpecifier | (() => undefined | SetCategoryMetasPayloadKeySpecifier), + fields?: SetCategoryMetasPayloadFieldPolicy, + }, SetChapterMetaPayload?: Omit & { keyFields?: false | SetChapterMetaPayloadKeySpecifier | (() => undefined | SetChapterMetaPayloadKeySpecifier), fields?: SetChapterMetaPayloadFieldPolicy, }, + SetChapterMetasPayload?: Omit & { + keyFields?: false | SetChapterMetasPayloadKeySpecifier | (() => undefined | SetChapterMetasPayloadKeySpecifier), + fields?: SetChapterMetasPayloadFieldPolicy, + }, SetGlobalMetaPayload?: Omit & { keyFields?: false | SetGlobalMetaPayloadKeySpecifier | (() => undefined | SetGlobalMetaPayloadKeySpecifier), fields?: SetGlobalMetaPayloadFieldPolicy, }, + SetGlobalMetasPayload?: Omit & { + keyFields?: false | SetGlobalMetasPayloadKeySpecifier | (() => undefined | SetGlobalMetasPayloadKeySpecifier), + fields?: SetGlobalMetasPayloadFieldPolicy, + }, SetMangaMetaPayload?: Omit & { keyFields?: false | SetMangaMetaPayloadKeySpecifier | (() => undefined | SetMangaMetaPayloadKeySpecifier), fields?: SetMangaMetaPayloadFieldPolicy, }, + SetMangaMetasPayload?: Omit & { + keyFields?: false | SetMangaMetasPayloadKeySpecifier | (() => undefined | SetMangaMetasPayloadKeySpecifier), + fields?: SetMangaMetasPayloadFieldPolicy, + }, SetSettingsPayload?: Omit & { keyFields?: false | SetSettingsPayloadKeySpecifier | (() => undefined | SetSettingsPayloadKeySpecifier), fields?: SetSettingsPayloadFieldPolicy, @@ -1702,6 +1806,10 @@ export type StrictTypedTypePolicies = { keyFields?: false | SetSourceMetaPayloadKeySpecifier | (() => undefined | SetSourceMetaPayloadKeySpecifier), fields?: SetSourceMetaPayloadFieldPolicy, }, + SetSourceMetasPayload?: Omit & { + keyFields?: false | SetSourceMetasPayloadKeySpecifier | (() => undefined | SetSourceMetasPayloadKeySpecifier), + fields?: SetSourceMetasPayloadFieldPolicy, + }, Settings?: Omit & { keyFields?: false | SettingsKeySpecifier | (() => undefined | SettingsKeySpecifier), fields?: SettingsFieldPolicy, diff --git a/src/lib/graphql/generated/graphql.ts b/src/lib/graphql/generated/graphql.ts index 09056f53..0d7fac1c 100644 --- a/src/lib/graphql/generated/graphql.ts +++ b/src/lib/graphql/generated/graphql.ts @@ -391,6 +391,24 @@ export type DeleteCategoryMetaPayload = { meta?: Maybe; }; +export type DeleteCategoryMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type DeleteCategoryMetasItemInput = { + categoryIds: Array; + keys?: InputMaybe>; + prefixes?: InputMaybe>; +}; + +export type DeleteCategoryMetasPayload = { + __typename?: 'DeleteCategoryMetasPayload'; + categories: Array; + clientMutationId?: Maybe; + metas: Array; +}; + export type DeleteCategoryPayload = { __typename?: 'DeleteCategoryPayload'; category?: Maybe; @@ -411,6 +429,24 @@ export type DeleteChapterMetaPayload = { meta?: Maybe; }; +export type DeleteChapterMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type DeleteChapterMetasItemInput = { + chapterIds: Array; + keys?: InputMaybe>; + prefixes?: InputMaybe>; +}; + +export type DeleteChapterMetasPayload = { + __typename?: 'DeleteChapterMetasPayload'; + chapters: Array; + clientMutationId?: Maybe; + metas: Array; +}; + export type DeleteDownloadedChapterInput = { clientMutationId?: InputMaybe; id: Scalars['Int']['input']; @@ -444,6 +480,18 @@ export type DeleteGlobalMetaPayload = { meta?: Maybe; }; +export type DeleteGlobalMetasInput = { + clientMutationId?: InputMaybe; + keys?: InputMaybe>; + prefixes?: InputMaybe>; +}; + +export type DeleteGlobalMetasPayload = { + __typename?: 'DeleteGlobalMetasPayload'; + clientMutationId?: Maybe; + metas: Array; +}; + export type DeleteMangaMetaInput = { clientMutationId?: InputMaybe; key: Scalars['String']['input']; @@ -457,6 +505,24 @@ export type DeleteMangaMetaPayload = { meta?: Maybe; }; +export type DeleteMangaMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type DeleteMangaMetasItemInput = { + keys?: InputMaybe>; + mangaIds: Array; + prefixes?: InputMaybe>; +}; + +export type DeleteMangaMetasPayload = { + __typename?: 'DeleteMangaMetasPayload'; + clientMutationId?: Maybe; + mangas: Array; + metas: Array; +}; + export type DeleteSourceMetaInput = { clientMutationId?: InputMaybe; key: Scalars['String']['input']; @@ -470,6 +536,24 @@ export type DeleteSourceMetaPayload = { source?: Maybe; }; +export type DeleteSourceMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type DeleteSourceMetasItemInput = { + keys?: InputMaybe>; + prefixes?: InputMaybe>; + sourceIds: Array; +}; + +export type DeleteSourceMetasPayload = { + __typename?: 'DeleteSourceMetasPayload'; + clientMutationId?: Maybe; + metas: Array; + sources: Array; +}; + export type DequeueChapterDownloadInput = { clientMutationId?: InputMaybe; id: Scalars['Int']['input']; @@ -1185,6 +1269,11 @@ export type MetaFilterInput = { value?: InputMaybe; }; +export type MetaInput = { + key: Scalars['String']['input']; + value: Scalars['String']['input']; +}; + export enum MetaOrderBy { Key = 'KEY', Value = 'VALUE' @@ -1225,12 +1314,17 @@ export type Mutation = { createCategory?: Maybe; deleteCategory?: Maybe; deleteCategoryMeta?: Maybe; + deleteCategoryMetas?: Maybe; deleteChapterMeta?: Maybe; + deleteChapterMetas?: Maybe; deleteDownloadedChapter?: Maybe; deleteDownloadedChapters?: Maybe; deleteGlobalMeta?: Maybe; + deleteGlobalMetas?: Maybe; deleteMangaMeta?: Maybe; + deleteMangaMetas?: Maybe; deleteSourceMeta?: Maybe; + deleteSourceMetas?: Maybe; dequeueChapterDownload?: Maybe; dequeueChapterDownloads?: Maybe; enqueueChapterDownload?: Maybe; @@ -1255,11 +1349,16 @@ export type Mutation = { resetWebUIUpdateStatus?: Maybe; restoreBackup: RestoreBackupPayload; setCategoryMeta?: Maybe; + setCategoryMetas?: Maybe; setChapterMeta?: Maybe; + setChapterMetas?: Maybe; setGlobalMeta?: Maybe; + setGlobalMetas?: Maybe; setMangaMeta?: Maybe; + setMangaMetas?: Maybe; setSettings: SetSettingsPayload; setSourceMeta?: Maybe; + setSourceMetas?: Maybe; startDownloader?: Maybe; stopDownloader?: Maybe; trackProgress?: Maybe; @@ -1325,11 +1424,21 @@ export type MutationDeleteCategoryMetaArgs = { }; +export type MutationDeleteCategoryMetasArgs = { + input: DeleteCategoryMetasInput; +}; + + export type MutationDeleteChapterMetaArgs = { input: DeleteChapterMetaInput; }; +export type MutationDeleteChapterMetasArgs = { + input: DeleteChapterMetasInput; +}; + + export type MutationDeleteDownloadedChapterArgs = { input: DeleteDownloadedChapterInput; }; @@ -1345,16 +1454,31 @@ export type MutationDeleteGlobalMetaArgs = { }; +export type MutationDeleteGlobalMetasArgs = { + input: DeleteGlobalMetasInput; +}; + + export type MutationDeleteMangaMetaArgs = { input: DeleteMangaMetaInput; }; +export type MutationDeleteMangaMetasArgs = { + input: DeleteMangaMetasInput; +}; + + export type MutationDeleteSourceMetaArgs = { input: DeleteSourceMetaInput; }; +export type MutationDeleteSourceMetasArgs = { + input: DeleteSourceMetasInput; +}; + + export type MutationDequeueChapterDownloadArgs = { input: DequeueChapterDownloadInput; }; @@ -1470,21 +1594,41 @@ export type MutationSetCategoryMetaArgs = { }; +export type MutationSetCategoryMetasArgs = { + input: SetCategoryMetasInput; +}; + + export type MutationSetChapterMetaArgs = { input: SetChapterMetaInput; }; +export type MutationSetChapterMetasArgs = { + input: SetChapterMetasInput; +}; + + export type MutationSetGlobalMetaArgs = { input: SetGlobalMetaInput; }; +export type MutationSetGlobalMetasArgs = { + input: SetGlobalMetasInput; +}; + + export type MutationSetMangaMetaArgs = { input: SetMangaMetaInput; }; +export type MutationSetMangaMetasArgs = { + input: SetMangaMetasInput; +}; + + export type MutationSetSettingsArgs = { input: SetSettingsInput; }; @@ -1495,6 +1639,11 @@ export type MutationSetSourceMetaArgs = { }; +export type MutationSetSourceMetasArgs = { + input: SetSourceMetasInput; +}; + + export type MutationStartDownloaderArgs = { input: StartDownloaderInput; }; @@ -2122,6 +2271,23 @@ export type SetCategoryMetaPayload = { meta: CategoryMetaType; }; +export type SetCategoryMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type SetCategoryMetasItemInput = { + categoryIds: Array; + metas: Array; +}; + +export type SetCategoryMetasPayload = { + __typename?: 'SetCategoryMetasPayload'; + categories: Array; + clientMutationId?: Maybe; + metas: Array; +}; + export type SetChapterMetaInput = { clientMutationId?: InputMaybe; meta: ChapterMetaTypeInput; @@ -2133,6 +2299,23 @@ export type SetChapterMetaPayload = { meta: ChapterMetaType; }; +export type SetChapterMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type SetChapterMetasItemInput = { + chapterIds: Array; + metas: Array; +}; + +export type SetChapterMetasPayload = { + __typename?: 'SetChapterMetasPayload'; + chapters: Array; + clientMutationId?: Maybe; + metas: Array; +}; + export type SetGlobalMetaInput = { clientMutationId?: InputMaybe; meta: GlobalMetaTypeInput; @@ -2144,6 +2327,17 @@ export type SetGlobalMetaPayload = { meta: GlobalMetaType; }; +export type SetGlobalMetasInput = { + clientMutationId?: InputMaybe; + metas: Array; +}; + +export type SetGlobalMetasPayload = { + __typename?: 'SetGlobalMetasPayload'; + clientMutationId?: Maybe; + metas: Array; +}; + export type SetMangaMetaInput = { clientMutationId?: InputMaybe; meta: MangaMetaTypeInput; @@ -2155,6 +2349,23 @@ export type SetMangaMetaPayload = { meta: MangaMetaType; }; +export type SetMangaMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type SetMangaMetasItemInput = { + mangaIds: Array; + metas: Array; +}; + +export type SetMangaMetasPayload = { + __typename?: 'SetMangaMetasPayload'; + clientMutationId?: Maybe; + mangas: Array; + metas: Array; +}; + export type SetSettingsInput = { clientMutationId?: InputMaybe; settings: PartialSettingsTypeInput; @@ -2177,6 +2388,23 @@ export type SetSourceMetaPayload = { meta: SourceMetaType; }; +export type SetSourceMetasInput = { + clientMutationId?: InputMaybe; + items: Array; +}; + +export type SetSourceMetasItemInput = { + metas: Array; + sourceIds: Array; +}; + +export type SetSourceMetasPayload = { + __typename?: 'SetSourceMetasPayload'; + clientMutationId?: Maybe; + metas: Array; + sources: Array; +}; + export type Settings = { authMode?: Maybe; authPassword?: Maybe; @@ -3282,18 +3510,18 @@ export type DeleteCategoryMutationVariables = Exact<{ export type DeleteCategoryMutation = { __typename?: 'Mutation', deleteCategory?: { __typename?: 'DeleteCategoryPayload', category?: { __typename?: 'CategoryType', id: number } | null } | null }; export type DeleteCategoryMetadataMutationVariables = Exact<{ - input: DeleteCategoryMetaInput; + input: DeleteCategoryMetasInput; }>; -export type DeleteCategoryMetadataMutation = { __typename?: 'Mutation', deleteCategoryMeta?: { __typename?: 'DeleteCategoryMetaPayload', meta?: { __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string } | null } | null }; +export type DeleteCategoryMetadataMutation = { __typename?: 'Mutation', deleteCategoryMetas?: { __typename?: 'DeleteCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null }; export type SetCategoryMetadataMutationVariables = Exact<{ - input: SetCategoryMetaInput; + input: SetCategoryMetasInput; }>; -export type SetCategoryMetadataMutation = { __typename?: 'Mutation', setCategoryMeta?: { __typename?: 'SetCategoryMetaPayload', meta: { __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string } } | null }; +export type SetCategoryMetadataMutation = { __typename?: 'Mutation', setCategoryMetas?: { __typename?: 'SetCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null }; export type UpdateCategoryMutationVariables = Exact<{ input: UpdateCategoryInput; @@ -3388,11 +3616,11 @@ export type ChapterUpdateListFieldsFragment = { __typename?: 'ChapterType', fetc export type ChapterHistoryListFieldsFragment = { __typename?: 'ChapterType', fetchedAt: string, uploadDate: string, lastReadAt: string, id: number, name: string, mangaId: number, scanlator?: string | null, realUrl?: string | null, sourceOrder: number, chapterNumber: number, isRead: boolean, isDownloaded: boolean, isBookmarked: boolean, manga: { __typename?: 'MangaType', id: number, title: string, thumbnailUrl?: string | null, thumbnailUrlLastFetched?: string | null, inLibrary: boolean, initialized: boolean, sourceId: string } }; export type DeleteChapterMetadataMutationVariables = Exact<{ - input: DeleteChapterMetaInput; + input: DeleteChapterMetasInput; }>; -export type DeleteChapterMetadataMutation = { __typename?: 'Mutation', deleteChapterMeta?: { __typename?: 'DeleteChapterMetaPayload', meta?: { __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string } | null } | null }; +export type DeleteChapterMetadataMutation = { __typename?: 'Mutation', deleteChapterMetas?: { __typename?: 'DeleteChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null }; export type GetChapterPagesFetchMutationVariables = Exact<{ input: FetchChapterPagesInput; @@ -3409,11 +3637,11 @@ export type GetMangaChaptersFetchMutationVariables = Exact<{ export type GetMangaChaptersFetchMutation = { __typename?: 'Mutation', fetchChapters?: { __typename?: 'FetchChaptersPayload', chapters: Array<{ __typename?: 'ChapterType', fetchedAt: string, uploadDate: string, lastReadAt: string, id: number, name: string, mangaId: number, scanlator?: string | null, realUrl?: string | null, sourceOrder: number, chapterNumber: number, isRead: boolean, isDownloaded: boolean, isBookmarked: boolean, manga: { __typename?: 'MangaType', id: number, unreadCount: number, downloadCount: number, bookmarkCount: number, hasDuplicateChapters: boolean, chapters: { __typename?: 'ChapterNodeList', totalCount: number }, firstUnreadChapter?: { __typename?: 'ChapterType', id: number, sourceOrder: number, isRead: boolean, mangaId: number, chapterNumber: number, name: string, scanlator?: string | null } | null, lastReadChapter?: { __typename?: 'ChapterType', id: number, sourceOrder: number, lastReadAt: string } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number, sourceOrder: number, lastReadAt: string } | null, latestFetchedChapter?: { __typename?: 'ChapterType', id: number, fetchedAt: string } | null, latestUploadedChapter?: { __typename?: 'ChapterType', id: number, uploadDate: string } | null } }> } | null }; export type SetChapterMetadataMutationVariables = Exact<{ - input: SetChapterMetaInput; + input: SetChapterMetasInput; }>; -export type SetChapterMetadataMutation = { __typename?: 'Mutation', setChapterMeta?: { __typename?: 'SetChapterMetaPayload', meta: { __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string } } | null }; +export type SetChapterMetadataMutation = { __typename?: 'Mutation', setChapterMetas?: { __typename?: 'SetChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null }; export type UpdateChapterMutationVariables = Exact<{ input: UpdateChapterInput; @@ -3697,11 +3925,11 @@ export type MangaScreenFieldsFragment = { __typename?: 'MangaType', artist?: str export type MangaLibraryDuplicateScreenFieldsFragment = { __typename?: 'MangaType', description?: string | null, id: number, title: string, thumbnailUrl?: string | null, thumbnailUrlLastFetched?: string | null, inLibrary: boolean, initialized: boolean, sourceId: string, unreadCount: number, downloadCount: number, bookmarkCount: number, hasDuplicateChapters: boolean, chapters: { __typename?: 'ChapterNodeList', totalCount: number } }; export type DeleteMangaMetadataMutationVariables = Exact<{ - input: DeleteMangaMetaInput; + input: DeleteMangaMetasInput; }>; -export type DeleteMangaMetadataMutation = { __typename?: 'Mutation', deleteMangaMeta?: { __typename?: 'DeleteMangaMetaPayload', meta?: { __typename?: 'MangaMetaType', mangaId: number, key: string, value: string } | null } | null }; +export type DeleteMangaMetadataMutation = { __typename?: 'Mutation', deleteMangaMetas?: { __typename?: 'DeleteMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null }; export type GetMangaFetchMutationVariables = Exact<{ input: FetchMangaInput; @@ -3721,11 +3949,11 @@ export type GetMangaToMigrateToFetchMutationVariables = Exact<{ export type GetMangaToMigrateToFetchMutation = { __typename?: 'Mutation', fetchManga?: { __typename?: 'FetchMangaPayload', manga: { __typename?: 'MangaType', id: number, title: string, inLibrary: boolean, categories?: { __typename?: 'CategoryNodeList', nodes: Array<{ __typename?: 'CategoryType', id: number }> }, trackRecords?: { __typename?: 'TrackRecordNodeList', nodes: Array<{ __typename?: 'TrackRecordType', id: number, remoteId: string, trackerId: number }> } } } | null, fetchChapters?: { __typename?: 'FetchChaptersPayload', chapters: Array<{ __typename?: 'ChapterType', id: number, chapterNumber: number, isRead: boolean, isDownloaded: boolean, isBookmarked: boolean, manga: { __typename?: 'MangaType', id: number } }> } | null }; export type SetMangaMetadataMutationVariables = Exact<{ - input: SetMangaMetaInput; + input: SetMangaMetasInput; }>; -export type SetMangaMetadataMutation = { __typename?: 'Mutation', setMangaMeta?: { __typename?: 'SetMangaMetaPayload', meta: { __typename?: 'MangaMetaType', mangaId: number, key: string, value: string } } | null }; +export type SetMangaMetadataMutation = { __typename?: 'Mutation', setMangaMetas?: { __typename?: 'SetMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null }; export type UpdateMangaMutationVariables = Exact<{ input: UpdateMangaInput; @@ -3852,18 +4080,18 @@ export type GetLibraryMangaCountQueryVariables = Exact<{ [key: string]: never; } export type GetLibraryMangaCountQuery = { __typename?: 'Query', mangas: { __typename?: 'MangaNodeList', totalCount: number } }; export type DeleteGlobalMetadataMutationVariables = Exact<{ - input: DeleteGlobalMetaInput; + input: DeleteGlobalMetasInput; }>; -export type DeleteGlobalMetadataMutation = { __typename?: 'Mutation', deleteGlobalMeta?: { __typename?: 'DeleteGlobalMetaPayload', meta?: { __typename?: 'GlobalMetaType', key: string, value: string } | null } | null }; +export type DeleteGlobalMetadataMutation = { __typename?: 'Mutation', deleteGlobalMetas?: { __typename?: 'DeleteGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null }; export type SetGlobalMetadataMutationVariables = Exact<{ - input: SetGlobalMetaInput; + input: SetGlobalMetasInput; }>; -export type SetGlobalMetadataMutation = { __typename?: 'Mutation', setGlobalMeta?: { __typename?: 'SetGlobalMetaPayload', meta: { __typename?: 'GlobalMetaType', key: string, value: string } } | null }; +export type SetGlobalMetadataMutation = { __typename?: 'Mutation', setGlobalMetas?: { __typename?: 'SetGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null }; export type GetGlobalMetadataQueryVariables = Exact<{ key: Scalars['String']['input']; @@ -3979,18 +4207,18 @@ export type UpdateSourcePreferencesMutationVariables = Exact<{ export type UpdateSourcePreferencesMutation = { __typename?: 'Mutation', updateSourcePreference?: { __typename?: 'UpdateSourcePreferencePayload', source: { __typename?: 'SourceType', id: string, name: string, displayName: string, lang: string, preferences: Array<{ __typename?: 'CheckBoxPreference', summary?: string | null, key?: string | null, type: 'CheckBoxPreference', CheckBoxCheckBoxCurrentValue?: boolean | null, CheckBoxDefault: boolean, CheckBoxTitle?: string | null } | { __typename?: 'EditTextPreference', text?: string | null, summary?: string | null, key?: string | null, dialogTitle?: string | null, dialogMessage?: string | null, type: 'EditTextPreference', EditTextPreferenceCurrentValue?: string | null, EditTextPreferenceDefault?: string | null, EditTextPreferenceTitle?: string | null } | { __typename?: 'ListPreference', summary?: string | null, key?: string | null, entryValues: Array, entries: Array, type: 'ListPreference', ListPreferenceCurrentValue?: string | null, ListPreferenceDefault?: string | null, ListPreferenceTitle?: string | null } | { __typename?: 'MultiSelectListPreference', dialogMessage?: string | null, dialogTitle?: string | null, summary?: string | null, key?: string | null, entryValues: Array, entries: Array, type: 'MultiSelectListPreference', MultiSelectListPreferenceTitle?: string | null, MultiSelectListPreferenceDefault?: Array | null, MultiSelectListPreferenceCurrentValue?: Array | null } | { __typename?: 'SwitchPreference', summary?: string | null, key?: string | null, type: 'SwitchPreference', SwitchPreferenceCurrentValue?: boolean | null, SwitchPreferenceDefault: boolean, SwitchPreferenceTitle?: string | null }> } } | null }; export type SetSourceMetadataMutationVariables = Exact<{ - input: SetSourceMetaInput; + input: SetSourceMetasInput; }>; -export type SetSourceMetadataMutation = { __typename?: 'Mutation', setSourceMeta?: { __typename?: 'SetSourceMetaPayload', meta: { __typename?: 'SourceMetaType', sourceId: string, key: string, value: string } } | null }; +export type SetSourceMetadataMutation = { __typename?: 'Mutation', setSourceMetas?: { __typename?: 'SetSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null }; export type DeleteSourceMetadataMutationVariables = Exact<{ - input: DeleteSourceMetaInput; + input: DeleteSourceMetasInput; }>; -export type DeleteSourceMetadataMutation = { __typename?: 'Mutation', deleteSourceMeta?: { __typename?: 'DeleteSourceMetaPayload', meta?: { __typename?: 'SourceMetaType', sourceId: string, key: string, value: string } | null } | null }; +export type DeleteSourceMetadataMutation = { __typename?: 'Mutation', deleteSourceMetas?: { __typename?: 'DeleteSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null }; export type GetSourceBrowseQueryVariables = Exact<{ id: Scalars['LongString']['input']; diff --git a/src/lib/graphql/manga/MangaMutation.ts b/src/lib/graphql/manga/MangaMutation.ts index 04d14eb3..041c5217 100644 --- a/src/lib/graphql/manga/MangaMutation.ts +++ b/src/lib/graphql/manga/MangaMutation.ts @@ -12,9 +12,9 @@ import { MANGA_META_FIELDS, MANGA_SCREEN_FIELDS } from '@/lib/graphql/manga/Mang export const DELETE_MANGA_METADATA = gql` ${MANGA_META_FIELDS} - mutation DELETE_MANGA_METADATA($input: DeleteMangaMetaInput!) { - deleteMangaMeta(input: $input) { - meta { + mutation DELETE_MANGA_METADATA($input: DeleteMangaMetasInput!) { + deleteMangaMetas(input: $input) { + metas { ...MANGA_META_FIELDS } } @@ -79,9 +79,9 @@ export const GET_MANGA_TO_MIGRATE_TO_FETCH = gql` export const SET_MANGA_METADATA = gql` ${MANGA_META_FIELDS} - mutation SET_MANGA_METADATA($input: SetMangaMetaInput!) { - setMangaMeta(input: $input) { - meta { + mutation SET_MANGA_METADATA($input: SetMangaMetasInput!) { + setMangaMetas(input: $input) { + metas { ...MANGA_META_FIELDS } } diff --git a/src/lib/graphql/metadata/GlobalMetadataMutation.ts b/src/lib/graphql/metadata/GlobalMetadataMutation.ts index c76ffb35..37e78d47 100644 --- a/src/lib/graphql/metadata/GlobalMetadataMutation.ts +++ b/src/lib/graphql/metadata/GlobalMetadataMutation.ts @@ -11,9 +11,9 @@ import { GLOBAL_METADATA } from '@/lib/graphql/common/Fragments.ts'; export const DELETE_GLOBAL_METADATA = gql` ${GLOBAL_METADATA} - mutation DELETE_GLOBAL_METADATA($input: DeleteGlobalMetaInput!) { - deleteGlobalMeta(input: $input) { - meta { + mutation DELETE_GLOBAL_METADATA($input: DeleteGlobalMetasInput!) { + deleteGlobalMetas(input: $input) { + metas { ...GLOBAL_METADATA } } @@ -22,9 +22,9 @@ export const DELETE_GLOBAL_METADATA = gql` export const SET_GLOBAL_METADATA = gql` ${GLOBAL_METADATA} - mutation SET_GLOBAL_METADATA($input: SetGlobalMetaInput!) { - setGlobalMeta(input: $input) { - meta { + mutation SET_GLOBAL_METADATA($input: SetGlobalMetasInput!) { + setGlobalMetas(input: $input) { + metas { ...GLOBAL_METADATA } } diff --git a/src/lib/graphql/source/SourceMutation.ts b/src/lib/graphql/source/SourceMutation.ts index ca4b5234..f966d22a 100644 --- a/src/lib/graphql/source/SourceMutation.ts +++ b/src/lib/graphql/source/SourceMutation.ts @@ -38,9 +38,9 @@ export const UPDATE_SOURCE_PREFERENCES = gql` export const SET_SOURCE_METADATA = gql` ${SOURCE_META_FIELDS} - mutation SET_SOURCE_METADATA($input: SetSourceMetaInput!) { - setSourceMeta(input: $input) { - meta { + mutation SET_SOURCE_METADATA($input: SetSourceMetasInput!) { + setSourceMetas(input: $input) { + metas { ...SOURCE_META_FIELDS } } @@ -50,9 +50,9 @@ export const SET_SOURCE_METADATA = gql` export const DELETE_SOURCE_METADATA = gql` ${SOURCE_META_FIELDS} - mutation DELETE_SOURCE_METADATA($input: DeleteSourceMetaInput!) { - deleteSourceMeta(input: $input) { - meta { + mutation DELETE_SOURCE_METADATA($input: DeleteSourceMetasInput!) { + deleteSourceMetas(input: $input) { + metas { ...SOURCE_META_FIELDS } } diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index 505f3dbd..020619fb 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -139,14 +139,24 @@ import { RestoreBackupMutationVariables, SetCategoryMetadataMutation, SetCategoryMetadataMutationVariables, + SetCategoryMetasInput, SetChapterMetadataMutation, SetChapterMetadataMutationVariables, + SetChapterMetasInput, SetGlobalMetadataMutation, SetGlobalMetadataMutationVariables, + SetGlobalMetasInput, SetMangaMetadataMutation, SetMangaMetadataMutationVariables, + SetMangaMetasInput, SetSourceMetadataMutation, SetSourceMetadataMutationVariables, + SetSourceMetasInput, + DeleteCategoryMetasInput, + DeleteChapterMetasInput, + DeleteGlobalMetasInput, + DeleteMangaMetasInput, + DeleteSourceMetasInput, SettingsType, SortOrder, SourcePreferenceChangeInput, @@ -1290,24 +1300,23 @@ export class RequestManager { } public setGlobalMetadata( - key: string, - value: any, + input: SetGlobalMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, SET_GLOBAL_METADATA, - { input: { meta: { key, value: `${value}` } } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - setGlobalMeta: { - __typename: 'SetGlobalMetaPayload', - meta: { + setGlobalMetas: { + __typename: 'SetGlobalMetasPayload', + metas: input.metas.map((meta) => ({ __typename: 'GlobalMetaType', - key, - value: `${value}`, - }, + key: meta.key, + value: meta.value, + })), }, }, update(cache, { data }) { @@ -1318,25 +1327,25 @@ export class RequestManager { return existingMetas; } - if (!data?.setGlobalMeta) { + if (!data?.setGlobalMetas) { return existingMetas; } - const exists = existingMetas.nodes.some( - (meta: Reference) => readField('key', meta) === key, + const newMetas = data.setGlobalMetas.metas.filter((meta) => + existingMetas.nodes.every( + (existingMeta: Reference) => readField('key', existingMeta) !== meta.key, + ), + ); + const newMetaRefs = newMetas.map((meta) => + cache.writeFragment({ + data: meta, + fragment: GLOBAL_METADATA, + }), ); - if (exists) { - return existingMetas; - } - - const newMetaRef = cache.writeFragment({ - data: data!.setGlobalMeta.meta, - fragment: GLOBAL_METADATA, - }); return { ...existingMetas, - nodes: [...existingMetas.nodes, newMetaRef], + nodes: [...existingMetas.nodes, ...newMetaRefs], }; }, }, @@ -1348,27 +1357,29 @@ export class RequestManager { } public deleteGlobalMeta( - key: string, + input: DeleteGlobalMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, DELETE_GLOBAL_METADATA, - { input: { key } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - deleteGlobalMeta: { - __typename: 'DeleteGlobalMetaPayload', - meta: { - __typename: 'GlobalMetaType', + deleteGlobalMetas: { + __typename: 'DeleteGlobalMetasPayload', + metas: (input.keys ?? []).map((key) => ({ + __typename: 'GlobalMetaType' as const, key, value: '', - }, + })), }, }, update(cache) { - cache.evict({ id: cache.identify({ __typename: 'GlobalMetaType', key }) }); + input.keys?.forEach((key) => { + cache.evict({ id: cache.identify({ __typename: 'GlobalMetaType', key }) }); + }); }, ...options, }, @@ -1704,44 +1715,56 @@ export class RequestManager { } public setSourceMeta( - sourceId: string, - key: string, - value: any, + input: SetSourceMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, SET_SOURCE_METADATA, - { - input: { meta: { sourceId, key, value: `${value}` } }, - }, + { input }, { optimisticResponse: { __typename: 'Mutation', - setSourceMeta: { - __typename: 'SetSourceMetaPayload', - meta: { - __typename: 'SourceMetaType', - sourceId, - key, - value: `${value}`, - }, + setSourceMetas: { + __typename: 'SetSourceMetasPayload', + metas: input.items.flatMap((item) => + item.sourceIds.flatMap((sourceId) => + item.metas.map((meta) => ({ + __typename: 'SourceMetaType' as const, + sourceId, + key: meta.key, + value: meta.value, + })), + ), + ), }, }, update(cache, { data }) { - cache.modify({ - id: cache.identify({ __typename: 'SourceType', id: sourceId }), - fields: { - meta(existingMetas, { readField }) { - return updateMetadataList(key, existingMetas, readField, () => - cache.writeFragment({ - data: data!.setSourceMeta!.meta, - fragment: SOURCE_META_FIELDS, - }), - ); - }, - }, - }); + input.items.forEach((item) => + item.sourceIds.forEach((sourceId) => { + cache.modify({ + id: cache.identify({ __typename: 'SourceType', id: sourceId }), + fields: { + meta(existingMetas, { readField }) { + if (!data?.setSourceMetas) { + return existingMetas; + } + + return updateMetadataList( + data.setSourceMetas.metas, + existingMetas, + readField, + (meta) => + cache.writeFragment({ + data: meta, + fragment: SOURCE_META_FIELDS, + }), + ); + }, + }, + }); + }), + ); }, ...options, }, @@ -1749,29 +1772,38 @@ export class RequestManager { } public deleteSourceMeta( - sourceId: string, - key: string, + input: DeleteSourceMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, DELETE_SOURCE_METADATA, - { input: { sourceId, key } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - deleteSourceMeta: { - __typename: 'DeleteSourceMetaPayload', - meta: { - __typename: 'SourceMetaType', - sourceId, - key, - value: '', - }, + deleteSourceMetas: { + __typename: 'DeleteSourceMetasPayload', + metas: input.items.flatMap((item) => + item.sourceIds.flatMap((sourceId) => + (item.keys ?? []).map((key) => ({ + __typename: 'SourceMetaType' as const, + sourceId, + key, + value: '', + })), + ), + ), }, }, update(cache) { - cache.evict({ id: cache.identify({ __typename: 'SourceMetaType', sourceId, key }) }); + input.items.forEach((item) => + item.sourceIds.forEach((sourceId) => { + item.keys?.forEach((key) => { + cache.evict({ id: cache.identify({ __typename: 'SourceMetaType', sourceId, key }) }); + }); + }), + ); }, ...options, }, @@ -2228,44 +2260,56 @@ export class RequestManager { } public setMangaMeta( - mangaId: number, - key: string, - value: any, + input: SetMangaMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, SET_MANGA_METADATA, - { - input: { meta: { mangaId, key, value: `${value}` } }, - }, + { input }, { optimisticResponse: { __typename: 'Mutation', - setMangaMeta: { - __typename: 'SetMangaMetaPayload', - meta: { - __typename: 'MangaMetaType', - mangaId, - key, - value: `${value}`, - }, + setMangaMetas: { + __typename: 'SetMangaMetasPayload', + metas: input.items.flatMap((item) => + item.mangaIds.flatMap((mangaId) => + item.metas.map((meta) => ({ + __typename: 'MangaMetaType' as const, + mangaId, + key: meta.key, + value: meta.value, + })), + ), + ), }, }, update(cache, { data }) { - cache.modify({ - id: cache.identify({ __typename: 'MangaType', id: mangaId }), - fields: { - meta(existingMetas, { readField }) { - return updateMetadataList(key, existingMetas, readField, () => - cache.writeFragment({ - data: data!.setMangaMeta!.meta, - fragment: MANGA_META_FIELDS, - }), - ); - }, - }, - }); + input.items.forEach((item) => + item.mangaIds.forEach((mangaId) => { + cache.modify({ + id: cache.identify({ __typename: 'MangaType', id: mangaId }), + fields: { + meta(existingMetas, { readField }) { + if (!data?.setMangaMetas) { + return existingMetas; + } + + return updateMetadataList( + data.setMangaMetas.metas, + existingMetas, + readField, + (meta) => + cache.writeFragment({ + data: meta, + fragment: MANGA_META_FIELDS, + }), + ); + }, + }, + }); + }), + ); }, ...options, }, @@ -2273,29 +2317,38 @@ export class RequestManager { } public deleteMangaMeta( - mangaId: number, - key: string, + input: DeleteMangaMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, DELETE_MANGA_METADATA, - { input: { mangaId, key } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - deleteMangaMeta: { - __typename: 'DeleteMangaMetaPayload', - meta: { - __typename: 'MangaMetaType', - mangaId, - key, - value: '', - }, + deleteMangaMetas: { + __typename: 'DeleteMangaMetasPayload', + metas: input.items.flatMap((item) => + item.mangaIds.flatMap((mangaId) => + (item.keys ?? []).map((key) => ({ + __typename: 'MangaMetaType' as const, + mangaId, + key, + value: '', + })), + ), + ), }, }, update(cache) { - cache.evict({ id: cache.identify({ __typename: 'MangaMetaType', mangaId, key }) }); + input.items.forEach((item) => + item.mangaIds.forEach((mangaId) => { + item.keys?.forEach((key) => { + cache.evict({ id: cache.identify({ __typename: 'MangaMetaType', mangaId, key }) }); + }); + }), + ); }, ...options, }, @@ -2458,42 +2511,56 @@ export class RequestManager { } public setChapterMeta( - chapterId: number, - key: string, - value: any, + input: SetChapterMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, SET_CHAPTER_METADATA, - { input: { meta: { chapterId, key, value: `${value}` } } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - setChapterMeta: { - __typename: 'SetChapterMetaPayload', - meta: { - __typename: 'ChapterMetaType', - chapterId, - key, - value: `${value}`, - }, + setChapterMetas: { + __typename: 'SetChapterMetasPayload', + metas: input.items.flatMap((item) => + item.chapterIds.flatMap((chapterId) => + item.metas.map((meta) => ({ + __typename: 'ChapterMetaType' as const, + chapterId, + key: meta.key, + value: meta.value, + })), + ), + ), }, }, update(cache, { data }) { - cache.modify({ - id: cache.identify({ __typename: 'ChapterType', id: chapterId }), - fields: { - meta(existingMetas, { readField }) { - return updateMetadataList(key, existingMetas, readField, () => - cache.writeFragment({ - data: data!.setChapterMeta!.meta, - fragment: CHAPTER_META_FIELDS, - }), - ); - }, - }, - }); + input.items.forEach((item) => + item.chapterIds.forEach((chapterId) => { + cache.modify({ + id: cache.identify({ __typename: 'ChapterType', id: chapterId }), + fields: { + meta(existingMetas, { readField }) { + if (!data?.setChapterMetas) { + return existingMetas; + } + + return updateMetadataList( + data.setChapterMetas.metas, + existingMetas, + readField, + (meta) => + cache.writeFragment({ + data: meta, + fragment: CHAPTER_META_FIELDS, + }), + ); + }, + }, + }); + }), + ); }, ...options, }, @@ -2501,29 +2568,38 @@ export class RequestManager { } public deleteChapterMeta( - chapterId: number, - key: string, + input: DeleteChapterMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, DELETE_CHAPTER_METADATA, - { input: { chapterId, key } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - deleteChapterMeta: { - __typename: 'DeleteChapterMetaPayload', - meta: { - __typename: 'ChapterMetaType', - chapterId, - key, - value: '', - }, + deleteChapterMetas: { + __typename: 'DeleteChapterMetasPayload', + metas: input.items.flatMap((item) => + item.chapterIds.flatMap((chapterId) => + (item.keys ?? []).map((key) => ({ + __typename: 'ChapterMetaType' as const, + chapterId, + key, + value: '', + })), + ), + ), }, }, update(cache) { - cache.evict({ id: cache.identify({ __typename: 'ChapterMetaType', chapterId, key }) }); + input.items.forEach((item) => + item.chapterIds.forEach((chapterId) => { + item.keys?.forEach((key) => { + cache.evict({ id: cache.identify({ __typename: 'ChapterMetaType', chapterId, key }) }); + }); + }), + ); }, ...options, }, @@ -2737,42 +2813,56 @@ export class RequestManager { } public setCategoryMeta( - categoryId: number, - key: string, - value: any, + input: SetCategoryMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, SET_CATEGORY_METADATA, - { input: { meta: { categoryId, key, value: `${value}` } } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - setCategoryMeta: { - __typename: 'SetCategoryMetaPayload', - meta: { - __typename: 'CategoryMetaType', - categoryId, - key, - value: `${value}`, - }, + setCategoryMetas: { + __typename: 'SetCategoryMetasPayload', + metas: input.items.flatMap((item) => + item.categoryIds.flatMap((categoryId) => + item.metas.map((meta) => ({ + __typename: 'CategoryMetaType' as const, + categoryId, + key: meta.key, + value: meta.value, + })), + ), + ), }, }, update(cache, { data }) { - cache.modify({ - id: cache.identify({ __typename: 'CategoryType', id: categoryId }), - fields: { - meta(existingMetas, { readField }) { - return updateMetadataList(key, existingMetas, readField, () => - cache.writeFragment({ - data: data!.setCategoryMeta!.meta, - fragment: CATEGORY_META_FIELDS, - }), - ); - }, - }, - }); + input.items.forEach((item) => + item.categoryIds.forEach((categoryId) => { + cache.modify({ + id: cache.identify({ __typename: 'CategoryType', id: categoryId }), + fields: { + meta(existingMetas, { readField }) { + if (!data?.setCategoryMetas) { + return existingMetas; + } + + return updateMetadataList( + data.setCategoryMetas.metas, + existingMetas, + readField, + (meta) => + cache.writeFragment({ + data: meta, + fragment: CATEGORY_META_FIELDS, + }), + ); + }, + }, + }); + }), + ); }, ...options, }, @@ -2780,29 +2870,40 @@ export class RequestManager { } public deleteCategoryMeta( - categoryId: number, - key: string, + input: DeleteCategoryMetasInput, options?: MutationOptions, ): AbortableApolloMutationResponse { return this.doRequest( GQLMethod.MUTATION, DELETE_CATEGORY_METADATA, - { input: { categoryId, key } }, + { input }, { optimisticResponse: { __typename: 'Mutation', - deleteCategoryMeta: { - __typename: 'DeleteCategoryMetaPayload', - meta: { - __typename: 'CategoryMetaType', - categoryId, - key, - value: '', - }, + deleteCategoryMetas: { + __typename: 'DeleteCategoryMetasPayload', + metas: input.items.flatMap((item) => + item.categoryIds.flatMap((categoryId) => + (item.keys ?? []).map((key) => ({ + __typename: 'CategoryMetaType' as const, + categoryId, + key, + value: '', + })), + ), + ), }, }, update(cache) { - cache.evict({ id: cache.identify({ __typename: 'CategoryMetaType', categoryId, key }) }); + input.items.flatMap((item) => + item.categoryIds.forEach((categoryId) => { + item.keys?.forEach((key) => { + cache.evict({ + id: cache.identify({ __typename: 'CategoryMetaType', categoryId, key }), + }); + }); + }), + ); }, ...options, },