diff --git a/src/lib/graphql/category/CategoryMutation.ts b/src/lib/graphql/category/CategoryMutation.ts index 192d6036..95bd964e 100644 --- a/src/lib/graphql/category/CategoryMutation.ts +++ b/src/lib/graphql/category/CategoryMutation.ts @@ -30,30 +30,6 @@ export const DELETE_CATEGORY = gql` } `; -export const DELETE_CATEGORY_METADATA = gql` - ${CATEGORY_META_FIELDS} - - mutation DELETE_CATEGORY_METADATA($input: DeleteCategoryMetasInput!) { - deleteCategoryMetas(input: $input) { - metas { - ...CATEGORY_META_FIELDS - } - } - } -`; - -export const SET_CATEGORY_METADATA = gql` - ${CATEGORY_META_FIELDS} - - mutation SET_CATEGORY_METADATA($input: SetCategoryMetasInput!) { - setCategoryMetas(input: $input) { - metas { - ...CATEGORY_META_FIELDS - } - } - } -`; - export const UPDATE_CATEGORY = gql` mutation UPDATE_CATEGORY( $input: UpdateCategoryInput! diff --git a/src/lib/graphql/chapter/ChapterMutation.ts b/src/lib/graphql/chapter/ChapterMutation.ts index 7c8f5b0f..ce86e6d6 100644 --- a/src/lib/graphql/chapter/ChapterMutation.ts +++ b/src/lib/graphql/chapter/ChapterMutation.ts @@ -11,18 +11,6 @@ import { CHAPTER_LIST_FIELDS, CHAPTER_META_FIELDS } from '@/lib/graphql/chapter/ import { TRACK_RECORD_BIND_FIELDS } from '@/lib/graphql/tracker/TrackRecordFragments.ts'; import { MANGA_CHAPTER_NODE_FIELDS, MANGA_CHAPTER_STAT_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts'; -export const DELETE_CHAPTER_METADATA = gql` - ${CHAPTER_META_FIELDS} - - mutation DELETE_CHAPTER_METADATA($input: DeleteChapterMetasInput!) { - deleteChapterMetas(input: $input) { - metas { - ...CHAPTER_META_FIELDS - } - } - } -`; - // makes the server fetch and return the pages of a chapter export const GET_CHAPTER_PAGES_FETCH = gql` mutation GET_CHAPTER_PAGES_FETCH($input: FetchChapterPagesInput!) { @@ -56,18 +44,6 @@ export const GET_MANGA_CHAPTERS_FETCH = gql` } `; -export const SET_CHAPTER_METADATA = gql` - ${CHAPTER_META_FIELDS} - - mutation SET_CHAPTER_METADATA($input: SetChapterMetasInput!) { - setChapterMetas(input: $input) { - metas { - ...CHAPTER_META_FIELDS - } - } - } -`; - export const UPDATE_CHAPTER = gql` ${TRACK_RECORD_BIND_FIELDS} diff --git a/src/lib/graphql/generated/graphql.ts b/src/lib/graphql/generated/graphql.ts index ecbf187f..0ad6572d 100644 --- a/src/lib/graphql/generated/graphql.ts +++ b/src/lib/graphql/generated/graphql.ts @@ -3509,20 +3509,6 @@ export type DeleteCategoryMutationVariables = Exact<{ export type DeleteCategoryMutation = { __typename?: 'Mutation', deleteCategory?: { __typename?: 'DeleteCategoryPayload', category?: { __typename?: 'CategoryType', id: number } | null } | null }; -export type DeleteCategoryMetadataMutationVariables = Exact<{ - input: DeleteCategoryMetasInput; -}>; - - -export type DeleteCategoryMetadataMutation = { __typename?: 'Mutation', deleteCategoryMetas?: { __typename?: 'DeleteCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null }; - -export type SetCategoryMetadataMutationVariables = Exact<{ - input: SetCategoryMetasInput; -}>; - - -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; getDefault: Scalars['Boolean']['input']; @@ -3627,13 +3613,6 @@ 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: DeleteChapterMetasInput; -}>; - - -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; }>; @@ -3648,13 +3627,6 @@ 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: SetChapterMetasInput; -}>; - - -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; getBookmarked: Scalars['Boolean']['input']; @@ -3948,13 +3920,6 @@ 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: DeleteMangaMetasInput; -}>; - - -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; }>; @@ -3972,13 +3937,6 @@ 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: SetMangaMetasInput; -}>; - - -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; updateCategoryInput: UpdateMangaCategoriesInput; @@ -4115,20 +4073,6 @@ export type GetLibraryMangaCountQueryVariables = Exact<{ [key: string]: never; } export type GetLibraryMangaCountQuery = { __typename?: 'Query', mangas: { __typename?: 'MangaNodeList', totalCount: number } }; -export type DeleteGlobalMetadataMutationVariables = Exact<{ - input: DeleteGlobalMetasInput; -}>; - - -export type DeleteGlobalMetadataMutation = { __typename?: 'Mutation', deleteGlobalMetas?: { __typename?: 'DeleteGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null }; - -export type SetGlobalMetadataMutationVariables = Exact<{ - input: SetGlobalMetasInput; -}>; - - -export type SetGlobalMetadataMutation = { __typename?: 'Mutation', setGlobalMetas?: { __typename?: 'SetGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null }; - export type UpdateGlobalMetadataMutationVariables = Exact<{ updateInput: SetGlobalMetasInput; hasUpdates: Scalars['Boolean']['input']; @@ -4254,20 +4198,6 @@ 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: SetSourceMetasInput; -}>; - - -export type SetSourceMetadataMutation = { __typename?: 'Mutation', setSourceMetas?: { __typename?: 'SetSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null }; - -export type DeleteSourceMetadataMutationVariables = Exact<{ - input: DeleteSourceMetasInput; -}>; - - -export type DeleteSourceMetadataMutation = { __typename?: 'Mutation', deleteSourceMetas?: { __typename?: 'DeleteSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null }; - export type UpdateSourceMetadataMutationVariables = Exact<{ updateInput: SetSourceMetasInput; hasUpdates: Scalars['Boolean']['input']; diff --git a/src/lib/graphql/manga/MangaMutation.ts b/src/lib/graphql/manga/MangaMutation.ts index 60a2677e..cd408030 100644 --- a/src/lib/graphql/manga/MangaMutation.ts +++ b/src/lib/graphql/manga/MangaMutation.ts @@ -9,18 +9,6 @@ import gql from 'graphql-tag'; import { MANGA_META_FIELDS, MANGA_SCREEN_FIELDS } from '@/lib/graphql/manga/MangaFragments.ts'; -export const DELETE_MANGA_METADATA = gql` - ${MANGA_META_FIELDS} - - mutation DELETE_MANGA_METADATA($input: DeleteMangaMetasInput!) { - deleteMangaMetas(input: $input) { - metas { - ...MANGA_META_FIELDS - } - } - } -`; - // makes the server fetch and return the manga export const GET_MANGA_FETCH = gql` ${MANGA_SCREEN_FIELDS} @@ -76,18 +64,6 @@ export const GET_MANGA_TO_MIGRATE_TO_FETCH = gql` } `; -export const SET_MANGA_METADATA = gql` - ${MANGA_META_FIELDS} - - mutation SET_MANGA_METADATA($input: SetMangaMetasInput!) { - setMangaMetas(input: $input) { - metas { - ...MANGA_META_FIELDS - } - } - } -`; - export const UPDATE_MANGA = gql` mutation UPDATE_MANGA( $input: UpdateMangaInput! diff --git a/src/lib/graphql/metadata/GlobalMetadataMutation.ts b/src/lib/graphql/metadata/GlobalMetadataMutation.ts index 51a0781a..127783ea 100644 --- a/src/lib/graphql/metadata/GlobalMetadataMutation.ts +++ b/src/lib/graphql/metadata/GlobalMetadataMutation.ts @@ -9,28 +9,6 @@ import gql from 'graphql-tag'; import { GLOBAL_METADATA } from '@/lib/graphql/common/Fragments.ts'; -export const DELETE_GLOBAL_METADATA = gql` - ${GLOBAL_METADATA} - mutation DELETE_GLOBAL_METADATA($input: DeleteGlobalMetasInput!) { - deleteGlobalMetas(input: $input) { - metas { - ...GLOBAL_METADATA - } - } - } -`; - -export const SET_GLOBAL_METADATA = gql` - ${GLOBAL_METADATA} - mutation SET_GLOBAL_METADATA($input: SetGlobalMetasInput!) { - setGlobalMetas(input: $input) { - metas { - ...GLOBAL_METADATA - } - } - } -`; - export const UPDATE_GLOBAL_METADATA = gql` ${GLOBAL_METADATA} mutation UPDATE_GLOBAL_METADATA( diff --git a/src/lib/graphql/source/SourceMutation.ts b/src/lib/graphql/source/SourceMutation.ts index 8978660a..09b03838 100644 --- a/src/lib/graphql/source/SourceMutation.ts +++ b/src/lib/graphql/source/SourceMutation.ts @@ -35,30 +35,6 @@ export const UPDATE_SOURCE_PREFERENCES = gql` } `; -export const SET_SOURCE_METADATA = gql` - ${SOURCE_META_FIELDS} - - mutation SET_SOURCE_METADATA($input: SetSourceMetasInput!) { - setSourceMetas(input: $input) { - metas { - ...SOURCE_META_FIELDS - } - } - } -`; - -export const DELETE_SOURCE_METADATA = gql` - ${SOURCE_META_FIELDS} - - mutation DELETE_SOURCE_METADATA($input: DeleteSourceMetasInput!) { - deleteSourceMetas(input: $input) { - metas { - ...SOURCE_META_FIELDS - } - } - } -`; - export const UPDATE_SOURCE_METADATA = gql` ${SOURCE_META_FIELDS} diff --git a/src/lib/requests/RequestManager.ts b/src/lib/requests/RequestManager.ts index 62b71900..66afe48d 100644 --- a/src/lib/requests/RequestManager.ts +++ b/src/lib/requests/RequestManager.ts @@ -47,22 +47,12 @@ import { CreateCategoryInput, CreateCategoryMutation, CreateCategoryMutationVariables, - DeleteCategoryMetadataMutation, - DeleteCategoryMetadataMutationVariables, DeleteCategoryMutation, DeleteCategoryMutationVariables, - DeleteChapterMetadataMutation, - DeleteChapterMetadataMutationVariables, DeleteDownloadedChapterMutation, DeleteDownloadedChapterMutationVariables, DeleteDownloadedChaptersMutation, DeleteDownloadedChaptersMutationVariables, - DeleteGlobalMetadataMutation, - DeleteGlobalMetadataMutationVariables, - DeleteMangaMetadataMutation, - DeleteMangaMetadataMutationVariables, - DeleteSourceMetadataMutation, - DeleteSourceMetadataMutationVariables, DequeueChapterDownloadMutation, DequeueChapterDownloadMutationVariables, DequeueChapterDownloadsMutation, @@ -137,26 +127,8 @@ import { ResetWebuiUpdateStatusMutationVariables, RestoreBackupMutation, RestoreBackupMutationVariables, - SetCategoryMetadataMutation, - SetCategoryMetadataMutationVariables, - SetCategoryMetasInput, - SetChapterMetadataMutation, - SetChapterMetadataMutationVariables, - SetChapterMetasInput, - SetGlobalMetadataMutation, - SetGlobalMetadataMutationVariables, SetGlobalMetasInput, - SetMangaMetadataMutation, - SetMangaMetadataMutationVariables, - SetMangaMetasInput, - SetSourceMetadataMutation, - SetSourceMetadataMutationVariables, - SetSourceMetasInput, - DeleteCategoryMetasInput, - DeleteChapterMetasInput, DeleteGlobalMetasInput, - DeleteMangaMetasInput, - DeleteSourceMetasInput, SettingsType, SortOrder, SourcePreferenceChangeInput, @@ -258,11 +230,7 @@ import { DeleteChapterMetasItemInput, } from '@/lib/graphql/generated/graphql.ts'; import { GET_GLOBAL_METADATAS } from '@/lib/graphql/metadata/GlobalMetadataQuery.ts'; -import { - DELETE_GLOBAL_METADATA, - SET_GLOBAL_METADATA, - UPDATE_GLOBAL_METADATA, -} from '@/lib/graphql/metadata/GlobalMetadataMutation.ts'; +import { UPDATE_GLOBAL_METADATA } from '@/lib/graphql/metadata/GlobalMetadataMutation.ts'; import { CHECK_FOR_SERVER_UPDATES, CHECK_FOR_WEBUI_UPDATE, @@ -278,10 +246,8 @@ import { } from '@/lib/graphql/extension/ExtensionMutation.ts'; import { GET_MIGRATABLE_SOURCES, GET_SOURCES_LIST } from '@/lib/graphql/source/SourceQuery.ts'; import { - DELETE_MANGA_METADATA, GET_MANGA_FETCH, GET_MANGA_TO_MIGRATE_TO_FETCH, - SET_MANGA_METADATA, UPDATE_MANGA, UPDATE_MANGA_CATEGORIES, UPDATE_MANGA_METADATA, @@ -301,9 +267,7 @@ import { GET_CATEGORY_MANGAS, } from '@/lib/graphql/category/CategoryQuery.ts'; import { - DELETE_SOURCE_METADATA, GET_SOURCE_MANGAS_FETCH, - SET_SOURCE_METADATA, UPDATE_SOURCE_METADATA, UPDATE_SOURCE_PREFERENCES, } from '@/lib/graphql/source/SourceMutation.ts'; @@ -326,10 +290,8 @@ import { GET_MANGAS_CHAPTER_IDS_WITH_STATE, } from '@/lib/graphql/chapter/ChapterQuery.ts'; import { - DELETE_CHAPTER_METADATA, GET_CHAPTER_PAGES_FETCH, GET_MANGA_CHAPTERS_FETCH, - SET_CHAPTER_METADATA, UPDATE_CHAPTER, UPDATE_CHAPTER_METADATA, UPDATE_CHAPTERS, @@ -337,8 +299,6 @@ import { import { CREATE_CATEGORY, DELETE_CATEGORY, - DELETE_CATEGORY_METADATA, - SET_CATEGORY_METADATA, UPDATE_CATEGORY, UPDATE_CATEGORY_METADATA, UPDATE_CATEGORY_ORDER, @@ -1328,93 +1288,6 @@ export class RequestManager { return this.doRequest(GQLMethod.USE_QUERY, GET_GLOBAL_METADATAS, {}, options); } - public setGlobalMetadata( - input: SetGlobalMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - SET_GLOBAL_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - setGlobalMetas: { - __typename: 'SetGlobalMetasPayload', - metas: input.metas.map((meta) => ({ - __typename: 'GlobalMetaType', - key: meta.key, - value: meta.value, - })), - }, - }, - update(cache, { data }) { - cache.modify({ - fields: { - metas(existingMetas, { readField }) { - if (!existingMetas) { - return existingMetas; - } - - if (!data?.setGlobalMetas) { - return existingMetas; - } - - 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, - }), - ); - - return { - ...existingMetas, - nodes: [...existingMetas.nodes, ...newMetaRefs], - }; - }, - }, - }); - }, - ...options, - }, - ); - } - - public deleteGlobalMeta( - input: DeleteGlobalMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - DELETE_GLOBAL_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - deleteGlobalMetas: { - __typename: 'DeleteGlobalMetasPayload', - metas: (input.keys ?? []).map((key) => ({ - __typename: 'GlobalMetaType' as const, - key, - value: '', - })), - }, - }, - update(cache) { - input.keys?.forEach((key) => { - cache.evict({ id: cache.identify({ __typename: 'GlobalMetaType', key }) }); - }); - }, - ...options, - }, - ); - } - public updateGlobalMeta( { updateInput = { metas: [] }, @@ -1840,102 +1713,6 @@ export class RequestManager { return this.doRequest(GQLMethod.USE_QUERY, document, { id } as unknown as Variables, options); } - public setSourceMeta( - input: SetSourceMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - SET_SOURCE_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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 }) { - 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, - }, - ); - } - - public deleteSourceMeta( - input: DeleteSourceMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - DELETE_SOURCE_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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) { - input.items.forEach((item) => - item.sourceIds.forEach((sourceId) => { - item.keys?.forEach((key) => { - cache.evict({ id: cache.identify({ __typename: 'SourceMetaType', sourceId, key }) }); - }); - }), - ); - }, - ...options, - }, - ); - } - public updateSourceMeta( sourceIds: SourceIdInfo['id'][], { @@ -2483,102 +2260,6 @@ export class RequestManager { return result; } - public setMangaMeta( - input: SetMangaMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - SET_MANGA_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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 }) { - 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, - }, - ); - } - - public deleteMangaMeta( - input: DeleteMangaMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - DELETE_MANGA_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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) { - input.items.forEach((item) => - item.mangaIds.forEach((mangaId) => { - item.keys?.forEach((key) => { - cache.evict({ id: cache.identify({ __typename: 'MangaMetaType', mangaId, key }) }); - }); - }), - ); - }, - ...options, - }, - ); - } - public updateMangaMeta( mangaIds: MangaIdInfo['id'][], { @@ -2832,102 +2513,6 @@ export class RequestManager { ); } - public setChapterMeta( - input: SetChapterMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - SET_CHAPTER_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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 }) { - 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, - }, - ); - } - - public deleteChapterMeta( - input: DeleteChapterMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - DELETE_CHAPTER_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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) { - input.items.forEach((item) => - item.chapterIds.forEach((chapterId) => { - item.keys?.forEach((key) => { - cache.evict({ id: cache.identify({ __typename: 'ChapterMetaType', chapterId, key }) }); - }); - }), - ); - }, - ...options, - }, - ); - } - public updateChapterMeta( chapterIds: ChapterIdInfo['id'][], { @@ -3232,104 +2817,6 @@ export class RequestManager { ); } - public setCategoryMeta( - input: SetCategoryMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - SET_CATEGORY_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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 }) { - 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, - }, - ); - } - - public deleteCategoryMeta( - input: DeleteCategoryMetasInput, - options?: MutationOptions, - ): AbortableApolloMutationResponse { - return this.doRequest( - GQLMethod.MUTATION, - DELETE_CATEGORY_METADATA, - { input }, - { - optimisticResponse: { - __typename: 'Mutation', - 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) { - input.items.flatMap((item) => - item.categoryIds.forEach((categoryId) => { - item.keys?.forEach((key) => { - cache.evict({ - id: cache.identify({ __typename: 'CategoryMetaType', categoryId, key }), - }); - }); - }), - ); - }, - ...options, - }, - ); - } - public updateCategoryMeta( categoryIds: CategoryIdInfo['id'][], {