Optionally include client data during manga migration

This commit is contained in:
schroda
2026-03-07 03:07:40 +01:00
parent 57e05bf20d
commit 00d6350cee
17 changed files with 382 additions and 97 deletions

View File

@@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- (**Theme**) Add an option to save the dynamic color theme on the manga page as a custom theme - (**Theme**) Add an option to save the dynamic color theme on the manga page as a custom theme
- (**WebUI Update**) Add an option to (partially) disable showing information when the webUI got updated - (**WebUI Update**) Add an option to (partially) disable showing information when the webUI got updated
- (**Server Update**) Add an option to disable showing information when the server got updated - (**Server Update**) Add an option to disable showing information when the server got updated
- (**Manga**) Add an option to include client data during migration
### Changed ### Changed
- (**General**) Preserve refresh token (UI Login) over sessions - (**General**) Preserve refresh token (UI Login) over sessions

View File

@@ -172,10 +172,10 @@ export class Chapters {
return chapters.filter((chapter) => !Chapters.isRead(chapter)); return chapters.filter((chapter) => !Chapters.isRead(chapter));
} }
static getMatchingChapterNumberChapters<Chapter extends ChapterNumberInfo>( static getMatchingChapterNumberChapters<ChapterA extends ChapterNumberInfo, ChapterB extends ChapterNumberInfo>(
chaptersA: Chapter[], chaptersA: ChapterA[],
chaptersB: Chapter[], chaptersB: ChapterB[],
): [ChapterA: Chapter, ChapterB: Chapter][] { ): [ChapterA: ChapterA, ChapterB: ChapterB][] {
return chaptersA return chaptersA
.map((chapterA) => { .map((chapterA) => {
const matchingChapter = chaptersB.find((chapterB) => chapterA.chapterNumber === chapterB.chapterNumber); const matchingChapter = chaptersB.find((chapterB) => chapterA.chapterNumber === chapterB.chapterNumber);
@@ -186,7 +186,7 @@ export class Chapters {
return [chapterA, matchingChapter]; return [chapterA, matchingChapter];
}) })
.filter((matchingChapters): matchingChapters is [Chapter, Chapter] => matchingChapters !== null); .filter((matchingChapters): matchingChapters is [ChapterA, ChapterB] => matchingChapters !== null);
} }
static async download(chapterIds: number[], disableConfirmation?: boolean): Promise<void> { static async download(chapterIds: number[], disableConfirmation?: boolean): Promise<void> {

View File

@@ -18,6 +18,7 @@ import {
GetMangaToMigrateQuery, GetMangaToMigrateQuery,
GetMangaToMigrateToFetchMutation, GetMangaToMigrateToFetchMutation,
MangaBaseFieldsFragment, MangaBaseFieldsFragment,
SetChapterMetasItemInput,
UpdateMangaCategoriesPatchInput, UpdateMangaCategoriesPatchInput,
} from '@/lib/graphql/generated/graphql.ts'; } from '@/lib/graphql/generated/graphql.ts';
import { Chapters } from '@/features/chapter/services/Chapters.ts'; import { Chapters } from '@/features/chapter/services/Chapters.ts';
@@ -52,6 +53,7 @@ import { getErrorMessage } from '@/lib/HelperFunctions.ts';
import { assertIsDefined } from '@/base/Asserts.ts'; import { assertIsDefined } from '@/base/Asserts.ts';
import { Confirmation } from '@/base/AppAwaitableComponent.ts'; import { Confirmation } from '@/base/AppAwaitableComponent.ts';
import { UrlUtil } from '@/lib/UrlUtil.ts'; import { UrlUtil } from '@/lib/UrlUtil.ts';
import { ALL_APP_METADATA_KEY_PREFIXES } from '@/features/metadata/Metadata.constants.ts';
type MangaToMigrate = NonNullable<GetMangaToMigrateQuery['manga']>; type MangaToMigrate = NonNullable<GetMangaToMigrateQuery['manga']>;
type MangaToMigrateTo = NonNullable<GetMangaToMigrateToFetchMutation['fetchManga']>['manga']; type MangaToMigrateTo = NonNullable<GetMangaToMigrateToFetchMutation['fetchManga']>['manga'];
@@ -317,6 +319,7 @@ export class Mangas {
mangaToMigrate: GetMangaToMigrateQuery['manga'], mangaToMigrate: GetMangaToMigrateQuery['manga'],
mangaToMigrateToInfo: GetMangaToMigrateToFetchMutation, mangaToMigrateToInfo: GetMangaToMigrateToFetchMutation,
deleteChapters: boolean, deleteChapters: boolean,
migrateMetadata: boolean,
): MigrateAction { ): MigrateAction {
if (!mangaToMigrate.chapters || !mangaToMigrateToInfo.fetchChapters?.chapters) { if (!mangaToMigrate.chapters || !mangaToMigrateToInfo.fetchChapters?.chapters) {
throw new Error('Chapters are missing'); throw new Error('Chapters are missing');
@@ -330,8 +333,11 @@ export class Mangas {
const readChapters: number[] = []; const readChapters: number[] = [];
const bookmarkedChapters: number[] = []; const bookmarkedChapters: number[] = [];
const chapterPreDeleteIds: number[] = [];
const chapterUpdateItems: SetChapterMetasItemInput[] = [];
migratableChapters.forEach(([chapterToMigrate, chapterToMigrateTo]) => { migratableChapters.forEach(([chapterToMigrate, chapterToMigrateTo]) => {
const { isRead, isBookmarked } = chapterToMigrate; const { isRead, isBookmarked, meta } = chapterToMigrate;
if (isRead) { if (isRead) {
readChapters.push(chapterToMigrateTo.id); readChapters.push(chapterToMigrateTo.id);
@@ -340,6 +346,14 @@ export class Mangas {
if (isBookmarked) { if (isBookmarked) {
bookmarkedChapters.push(chapterToMigrateTo.id); bookmarkedChapters.push(chapterToMigrateTo.id);
} }
if (migrateMetadata && meta?.length) {
chapterPreDeleteIds.push(chapterToMigrateTo.id);
chapterUpdateItems.push({
chapterIds: [chapterToMigrateTo.id],
metas: meta.map(({ key, value }) => ({ key, value })),
});
}
}); });
return { return {
@@ -348,6 +362,18 @@ export class Mangas {
readChapters.length && requestManager.updateChapters(readChapters, { isRead: true }).response, readChapters.length && requestManager.updateChapters(readChapters, { isRead: true }).response,
bookmarkedChapters.length && bookmarkedChapters.length &&
requestManager.updateChapters(bookmarkedChapters, { isBookmarked: true }).response, requestManager.updateChapters(bookmarkedChapters, { isBookmarked: true }).response,
chapterUpdateItems.length &&
requestManager.updateChapterMeta({
preUpdateDeleteInput: {
items: [
{
chapterIds: chapterPreDeleteIds,
prefixes: ALL_APP_METADATA_KEY_PREFIXES,
},
],
},
updateInput: { items: chapterUpdateItems },
}).response,
].filter((promise) => !!promise), ].filter((promise) => !!promise),
cleanup: () => cleanup: () =>
mode === 'migrate' mode === 'migrate'
@@ -407,22 +433,45 @@ export class Mangas {
mangaToMigrateTo: MangaToMigrateTo, mangaToMigrateTo: MangaToMigrateTo,
migrateCategories: boolean, migrateCategories: boolean,
removeMangaFromCategories: boolean, removeMangaFromCategories: boolean,
migrateMetadata: boolean,
): MigrateAction { ): MigrateAction {
if (migrateCategories && !mangaToMigrateFrom?.categories) { if (migrateCategories && !mangaToMigrateFrom?.categories) {
throw new Error('Categories are missing'); throw new Error('Categories are missing');
} }
const mangaMeta = migrateMetadata ? mangaToMigrateFrom.meta : undefined;
return { return {
copy: () => [ copy: () =>
requestManager.updateManga(mangaToMigrateTo.id, { [
updateManga: { inLibrary: true }, requestManager.updateManga(mangaToMigrateTo.id, {
updateMangaCategories: migrateCategories updateManga: { inLibrary: true },
? { updateMangaCategories: migrateCategories
addToCategories: mangaToMigrateFrom.categories?.nodes.map((category) => category.id), ? {
} addToCategories: mangaToMigrateFrom.categories?.nodes.map((category) => category.id),
: undefined, }
}).response, : undefined,
], }).response,
mangaMeta?.length &&
requestManager.updateMangaMeta({
preUpdateDeleteInput: {
items: [
{
mangaIds: [mangaToMigrateTo.id],
prefixes: ALL_APP_METADATA_KEY_PREFIXES,
},
],
},
updateInput: {
items: [
{
mangaIds: [mangaToMigrateTo.id],
metas: mangaMeta.map(({ key, value }) => ({ key, value })),
},
],
},
}).response,
].filter((promise) => !!promise),
cleanup: () => cleanup: () =>
mode === 'migrate' mode === 'migrate'
? [ ? [
@@ -444,6 +493,7 @@ export class Mangas {
migrateCategories, migrateCategories,
migrateTracking, migrateTracking,
deleteChapters, deleteChapters,
migrateMetadata,
}: Omit<MigrateOptions, 'mangaIdToMigrateTo'>, }: Omit<MigrateOptions, 'mangaIdToMigrateTo'>,
disableConfirmation?: boolean, disableConfirmation?: boolean,
): Promise<void> { ): Promise<void> {
@@ -458,6 +508,7 @@ export class Mangas {
migrateCategories, migrateCategories,
migrateTracking, migrateTracking,
deleteChapters, deleteChapters,
migrateMetadata,
}).response, }).response,
requestManager.getMangaToMigrateToFetch(mangaIdToMigrateTo, { requestManager.getMangaToMigrateToFetch(mangaIdToMigrateTo, {
migrateChapters, migrateChapters,
@@ -511,6 +562,7 @@ export class Mangas {
mangaToMigrateData.manga, mangaToMigrateData.manga,
mangaToMigrateToData, mangaToMigrateToData,
!!deleteChapters, !!deleteChapters,
!!migrateMetadata,
), ),
], ],
[ [
@@ -531,6 +583,7 @@ export class Mangas {
mangaToMigrateToData.fetchManga!.manga, mangaToMigrateToData.fetchManga!.manga,
!!migrateCategories, !!migrateCategories,
removeMangaFromCategories, removeMangaFromCategories,
!!migrateMetadata,
), ),
], ],
); );

View File

@@ -120,6 +120,9 @@ export const APP_METADATA: Record<
deleteChapters: { deleteChapters: {
convert: convertToBoolean, convert: convertToBoolean,
}, },
migrateMetadata: {
convert: convertToBoolean,
},
migrateSortSettings: { migrateSortSettings: {
convert: convertToObject<SortSettings>, convert: convertToObject<SortSettings>,
}, },
@@ -437,6 +440,7 @@ export const GLOBAL_METADATA_KEYS: AppMetadataKeys[] = [
'migrateCategories', 'migrateCategories',
'migrateTracking', 'migrateTracking',
'deleteChapters', 'deleteChapters',
'migrateMetadata',
'migrateSortSettings', 'migrateSortSettings',
// browse // browse
@@ -696,3 +700,13 @@ export const METADATA_MIGRATIONS: IMetadataMigration[] = [
deleteKeys: ['sourceLanguages', 'extensionLanguages'], deleteKeys: ['sourceLanguages', 'extensionLanguages'],
}, },
]; ];
export const ALL_APP_METADATA_KEY_PREFIXES: string[] = [
...METADATA_MIGRATIONS.reduce<Set<string>>((acc, migration) => {
if (migration.appKeyPrefix?.oldPrefix) {
acc.add(migration.appKeyPrefix.oldPrefix);
}
return acc;
}, new Set()),
APP_METADATA_KEY_PREFIX,
];

View File

@@ -39,7 +39,7 @@ type MetadataUpdateOptions = {
type ProcessedEntityMetadata = { type ProcessedEntityMetadata = {
updateMetas: MetaInput[]; updateMetas: MetaInput[];
deleteKeys: string[]; postUpdateDeleteKeys: string[];
migrateMetas: MetaInput[]; migrateMetas: MetaInput[];
}; };
@@ -98,7 +98,7 @@ const processEntityMetadata = (
value: `${value}`, value: `${value}`,
})); }));
return { updateMetas: allUpdateMetas, deleteKeys: uniqueDeleteKeys, migrateMetas }; return { updateMetas: allUpdateMetas, postUpdateDeleteKeys: uniqueDeleteKeys, migrateMetas };
}; };
type ProcessedEntry = ProcessedEntityMetadata & { metadataHolder: GqlMetaHolder }; type ProcessedEntry = ProcessedEntityMetadata & { metadataHolder: GqlMetaHolder };
@@ -107,11 +107,11 @@ const groupByIdenticalMetas = <Id extends number | string>(
processed: Array<ProcessedEntry & { metadataHolder: { id: Id } }>, processed: Array<ProcessedEntry & { metadataHolder: { id: Id } }>,
): { ): {
updateGroups: Array<{ ids: Id[]; metas: MetaInput[] }>; updateGroups: Array<{ ids: Id[]; metas: MetaInput[] }>;
deleteGroups: Array<{ ids: Id[]; keys: string[] }>; postUpdateDeleteGroups: Array<{ ids: Id[]; keys: string[] }>;
migrateGroups: Array<{ ids: Id[]; metas: MetaInput[] }>; migrateGroups: Array<{ ids: Id[]; metas: MetaInput[] }>;
} => { } => {
const updateMap = new Map<string, { ids: Id[]; metas: MetaInput[] }>(); const updateMap = new Map<string, { ids: Id[]; metas: MetaInput[] }>();
const deleteMap = new Map<string, { ids: Id[]; keys: string[] }>(); const postUpdateDeleteMap = new Map<string, { ids: Id[]; keys: string[] }>();
const migrateMap = new Map<string, { ids: Id[]; metas: MetaInput[] }>(); const migrateMap = new Map<string, { ids: Id[]; metas: MetaInput[] }>();
for (const entry of processed) { for (const entry of processed) {
@@ -127,13 +127,13 @@ const groupByIdenticalMetas = <Id extends number | string>(
} }
} }
if (entry.deleteKeys.length > 0) { if (entry.postUpdateDeleteKeys.length > 0) {
const key = JSON.stringify(entry.deleteKeys); const key = JSON.stringify(entry.postUpdateDeleteKeys);
const existing = deleteMap.get(key); const existing = postUpdateDeleteMap.get(key);
if (existing) { if (existing) {
existing.ids.push(id); existing.ids.push(id);
} else { } else {
deleteMap.set(key, { ids: [id], keys: entry.deleteKeys }); postUpdateDeleteMap.set(key, { ids: [id], keys: entry.postUpdateDeleteKeys });
} }
} }
@@ -150,7 +150,7 @@ const groupByIdenticalMetas = <Id extends number | string>(
return { return {
updateGroups: [...updateMap.values()], updateGroups: [...updateMap.values()],
deleteGroups: [...deleteMap.values()], postUpdateDeleteGroups: [...postUpdateDeleteMap.values()],
migrateGroups: [...migrateMap.values()], migrateGroups: [...migrateMap.values()],
}; };
}; };
@@ -159,18 +159,21 @@ const createEntityMetaInput = <Key extends string, Id extends number | string>(
processed: ProcessedEntry[], processed: ProcessedEntry[],
idKey: Key, idKey: Key,
) => { ) => {
const { updateGroups, deleteGroups, migrateGroups } = groupByIdenticalMetas( const { updateGroups, postUpdateDeleteGroups, migrateGroups } = groupByIdenticalMetas(
processed as Array<ProcessedEntry & { metadataHolder: { id: Id } }>, processed as Array<ProcessedEntry & { metadataHolder: { id: Id } }>,
); );
return { return {
preUpdateDeleteInput: {
items: [],
},
updateInput: { updateInput: {
items: updateGroups.map( items: updateGroups.map(
({ ids, metas }) => ({ [idKey]: ids, metas }) as Record<Key, Id[]> & { metas: MetaInput[] }, ({ ids, metas }) => ({ [idKey]: ids, metas }) as Record<Key, Id[]> & { metas: MetaInput[] },
), ),
}, },
deleteInput: { postUpdateDeleteInput: {
items: deleteGroups.map( items: postUpdateDeleteGroups.map(
({ ids, keys }) => ({ [idKey]: ids, keys }) as Record<Key, Id[]> & { keys: string[] }, ({ ids, keys }) => ({ [idKey]: ids, keys }) as Record<Key, Id[]> & { keys: string[] },
), ),
}, },
@@ -198,12 +201,15 @@ const requestBatchMetadataUpdate = async (
switch (holderType) { switch (holderType) {
case 'global': { case 'global': {
const withUpdates = processed.filter(({ updateMetas }) => updateMetas.length > 0); const withUpdates = processed.filter(({ updateMetas }) => updateMetas.length > 0);
const withDeletes = processed.filter(({ deleteKeys }) => deleteKeys.length > 0); const withDeletes = processed.filter(({ postUpdateDeleteKeys }) => postUpdateDeleteKeys.length > 0);
const withMigrations = processed.filter(({ migrateMetas }) => migrateMetas.length > 0); const withMigrations = processed.filter(({ migrateMetas }) => migrateMetas.length > 0);
await requestManager.updateGlobalMeta({ await requestManager.updateGlobalMeta({
preUpdateDeleteInput: { keys: [] },
updateInput: { metas: withUpdates.flatMap(({ updateMetas }) => updateMetas) }, updateInput: { metas: withUpdates.flatMap(({ updateMetas }) => updateMetas) },
deleteInput: { keys: withDeletes.flatMap(({ deleteKeys }) => deleteKeys) }, postUpdateDeleteInput: {
keys: withDeletes.flatMap(({ postUpdateDeleteKeys }) => postUpdateDeleteKeys),
},
migrateInput: { metas: withMigrations.flatMap(({ migrateMetas }) => migrateMetas) }, migrateInput: { metas: withMigrations.flatMap(({ migrateMetas }) => migrateMetas) },
}).response; }).response;
break; break;

View File

@@ -30,5 +30,6 @@ export type MetadataMigrationSettings = {
migrateCategories: boolean; migrateCategories: boolean;
migrateTracking: boolean; migrateTracking: boolean;
deleteChapters: boolean; deleteChapters: boolean;
migrateMetadata: boolean;
migrateSortSettings: SortSettings; migrateSortSettings: SortSettings;
}; };

View File

@@ -37,7 +37,7 @@ export const MigrateDialog = ({ mangaIdToMigrateTo, onClose }: { mangaIdToMigrat
const mangaId = Number(mangaIdAsString); const mangaId = Number(mangaIdAsString);
const { const {
settings: { migrateChapters, migrateCategories, migrateTracking, deleteChapters }, settings: { migrateChapters, migrateCategories, migrateTracking, deleteChapters, migrateMetadata },
} = useMetadataServerSettings(); } = useMetadataServerSettings();
const [isMigrationInProcess, setIsMigrationInProcess] = useState(false); const [isMigrationInProcess, setIsMigrationInProcess] = useState(false);
@@ -62,6 +62,7 @@ export const MigrateDialog = ({ mangaIdToMigrateTo, onClose }: { mangaIdToMigrat
migrateCategories, migrateCategories,
migrateTracking, migrateTracking,
deleteChapters, deleteChapters,
migrateMetadata,
}); });
navigate(AppRoutes.manga.path(mangaIdToMigrateTo), { replace: true }); navigate(AppRoutes.manga.path(mangaIdToMigrateTo), { replace: true });
@@ -93,6 +94,12 @@ export const MigrateDialog = ({ mangaIdToMigrateTo, onClose }: { mangaIdToMigrat
checked={migrateTracking} checked={migrateTracking}
onChange={(_, checked) => setMigrationFlag('migrateTracking', checked)} onChange={(_, checked) => setMigrationFlag('migrateTracking', checked)}
/> />
<CheckboxInput
disabled={isMigrationInProcess}
label={t`Client data`}
checked={migrateMetadata}
onChange={(_, checked) => setMigrationFlag('migrateMetadata', checked)}
/>
<CheckboxInput <CheckboxInput
disabled={isMigrationInProcess} disabled={isMigrationInProcess}
label={t`Delete downloaded`} label={t`Delete downloaded`}

View File

@@ -64,6 +64,7 @@ export const SERVER_SETTINGS_METADATA_DEFAULT: MetadataServerSettings = {
migrateCategories: true, migrateCategories: true,
migrateTracking: true, migrateTracking: true,
deleteChapters: true, deleteChapters: true,
migrateMetadata: true,
migrateSortSettings: DEFAULT_SORT_SETTINGS, migrateSortSettings: DEFAULT_SORT_SETTINGS,
// browse // browse

View File

@@ -752,6 +752,7 @@ msgid "Client"
msgstr "Client" msgstr "Client"
#: src/features/backup/Backup.constants.ts #: src/features/backup/Backup.constants.ts
#: src/features/migration/components/MigrateDialog.tsx
msgid "Client data" msgid "Client data"
msgstr "Client data" msgstr "Client data"

View File

@@ -85,19 +85,26 @@ export const UPDATE_CATEGORY_METADATA = gql`
${CATEGORY_META_FIELDS} ${CATEGORY_META_FIELDS}
mutation UPDATE_CATEGORY_METADATA( mutation UPDATE_CATEGORY_METADATA(
$preUpdateDeleteInput: DeleteCategoryMetasInput!
$hasPreUpdateDeletions: Boolean!
$updateInput: SetCategoryMetasInput! $updateInput: SetCategoryMetasInput!
$hasUpdates: Boolean! $hasUpdates: Boolean!
$deleteInput: DeleteCategoryMetasInput! $postUpdateDeleteInput: DeleteCategoryMetasInput!
$hasDeletions: Boolean! $hasPostUpdateDeletions: Boolean!
$migrateInput: SetCategoryMetasInput! $migrateInput: SetCategoryMetasInput!
$isMigration: Boolean! $isMigration: Boolean!
) { ) {
preUpdateDeletedMeta: deleteCategoryMetas(input: $preUpdateDeleteInput) @include(if: $hasPreUpdateDeletions) {
metas {
...CATEGORY_META_FIELDS
}
}
updatedMeta: setCategoryMetas(input: $updateInput) @include(if: $hasUpdates) { updatedMeta: setCategoryMetas(input: $updateInput) @include(if: $hasUpdates) {
metas { metas {
...CATEGORY_META_FIELDS ...CATEGORY_META_FIELDS
} }
} }
deletedMeta: deleteCategoryMetas(input: $deleteInput) @include(if: $hasDeletions) { postUpdateDeletedMeta: deleteCategoryMetas(input: $postUpdateDeleteInput) @include(if: $hasPostUpdateDeletions) {
metas { metas {
...CATEGORY_META_FIELDS ...CATEGORY_META_FIELDS
} }

View File

@@ -162,19 +162,26 @@ export const UPDATE_CHAPTER_METADATA = gql`
${CHAPTER_META_FIELDS} ${CHAPTER_META_FIELDS}
mutation UPDATE_CHAPTER_METADATA( mutation UPDATE_CHAPTER_METADATA(
$preUpdateDeleteInput: DeleteChapterMetasInput!
$hasPreUpdateDeletions: Boolean!
$updateInput: SetChapterMetasInput! $updateInput: SetChapterMetasInput!
$hasUpdates: Boolean! $hasUpdates: Boolean!
$deleteInput: DeleteChapterMetasInput! $postUpdateDeleteInput: DeleteChapterMetasInput!
$hasDeletions: Boolean! $hasPostUpdateDeletions: Boolean!
$migrateInput: SetChapterMetasInput! $migrateInput: SetChapterMetasInput!
$isMigration: Boolean! $isMigration: Boolean!
) { ) {
preUpdateDeletedMeta: deleteChapterMetas(input: $preUpdateDeleteInput) @include(if: $hasPreUpdateDeletions) {
metas {
...CHAPTER_META_FIELDS
}
}
updatedMeta: setChapterMetas(input: $updateInput) @include(if: $hasUpdates) { updatedMeta: setChapterMetas(input: $updateInput) @include(if: $hasUpdates) {
metas { metas {
...CHAPTER_META_FIELDS ...CHAPTER_META_FIELDS
} }
} }
deletedMeta: deleteChapterMetas(input: $deleteInput) @include(if: $hasDeletions) { postUpdateDeletedMeta: deleteChapterMetas(input: $postUpdateDeleteInput) @include(if: $hasPostUpdateDeletions) {
metas { metas {
...CHAPTER_META_FIELDS ...CHAPTER_META_FIELDS
} }

View File

@@ -3539,16 +3539,18 @@ export type UpdateCategoryOrderMutationVariables = Exact<{
export type UpdateCategoryOrderMutation = { __typename?: 'Mutation', updateCategoryOrder?: { __typename?: 'UpdateCategoryOrderPayload', categories: Array<{ __typename?: 'CategoryType', id: number, order: number }> } | null }; export type UpdateCategoryOrderMutation = { __typename?: 'Mutation', updateCategoryOrder?: { __typename?: 'UpdateCategoryOrderPayload', categories: Array<{ __typename?: 'CategoryType', id: number, order: number }> } | null };
export type UpdateCategoryMetadataMutationVariables = Exact<{ export type UpdateCategoryMetadataMutationVariables = Exact<{
preUpdateDeleteInput: DeleteCategoryMetasInput;
hasPreUpdateDeletions: Scalars['Boolean']['input'];
updateInput: SetCategoryMetasInput; updateInput: SetCategoryMetasInput;
hasUpdates: Scalars['Boolean']['input']; hasUpdates: Scalars['Boolean']['input'];
deleteInput: DeleteCategoryMetasInput; postUpdateDeleteInput: DeleteCategoryMetasInput;
hasDeletions: Scalars['Boolean']['input']; hasPostUpdateDeletions: Scalars['Boolean']['input'];
migrateInput: SetCategoryMetasInput; migrateInput: SetCategoryMetasInput;
isMigration: Scalars['Boolean']['input']; isMigration: Scalars['Boolean']['input'];
}>; }>;
export type UpdateCategoryMetadataMutation = { __typename?: 'Mutation', updatedMeta?: { __typename?: 'SetCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null, deletedMeta?: { __typename?: 'DeleteCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null }; export type UpdateCategoryMetadataMutation = { __typename?: 'Mutation', preUpdateDeletedMeta?: { __typename?: 'DeleteCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null, updatedMeta?: { __typename?: 'SetCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null, postUpdateDeletedMeta?: { __typename?: 'DeleteCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetCategoryMetasPayload', metas: Array<{ __typename?: 'CategoryMetaType', categoryId: number, key: string, value: string }> } | null };
export type GetCategoriesBaseQueryVariables = Exact<{ export type GetCategoriesBaseQueryVariables = Exact<{
after?: InputMaybe<Scalars['Cursor']['input']>; after?: InputMaybe<Scalars['Cursor']['input']>;
@@ -3656,16 +3658,18 @@ export type UpdateChaptersMutationVariables = Exact<{
export type UpdateChaptersMutation = { __typename?: 'Mutation', updateChapters?: { __typename?: 'UpdateChaptersPayload', chapters: Array<{ __typename?: 'ChapterType', id: number, isBookmarked?: boolean, isRead?: boolean, lastReadAt?: string, lastPageRead?: number, manga?: { __typename?: 'MangaType', id: number, unreadCount: number, bookmarkCount: number, lastReadChapter?: { __typename?: 'ChapterType', id: number } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number } | null, firstUnreadChapter?: { __typename?: 'ChapterType', id: number } | null } }> } | null, deleteDownloadedChapters?: { __typename?: 'DeleteDownloadedChaptersPayload', chapters: Array<{ __typename?: 'ChapterType', id: number, isDownloaded: boolean, manga: { __typename?: 'MangaType', id: number, downloadCount: number } }> } | null, trackProgress?: { __typename?: 'TrackProgressPayload', trackRecords: Array<{ __typename?: 'TrackRecordType', id: number, remoteId: string, trackerId: number, remoteUrl: string, title: string, status: number, lastChapterRead: number, totalChapters: number, score: number, displayScore: string, startDate: string, finishDate: string, private: boolean }> } | null }; export type UpdateChaptersMutation = { __typename?: 'Mutation', updateChapters?: { __typename?: 'UpdateChaptersPayload', chapters: Array<{ __typename?: 'ChapterType', id: number, isBookmarked?: boolean, isRead?: boolean, lastReadAt?: string, lastPageRead?: number, manga?: { __typename?: 'MangaType', id: number, unreadCount: number, bookmarkCount: number, lastReadChapter?: { __typename?: 'ChapterType', id: number } | null, latestReadChapter?: { __typename?: 'ChapterType', id: number } | null, firstUnreadChapter?: { __typename?: 'ChapterType', id: number } | null } }> } | null, deleteDownloadedChapters?: { __typename?: 'DeleteDownloadedChaptersPayload', chapters: Array<{ __typename?: 'ChapterType', id: number, isDownloaded: boolean, manga: { __typename?: 'MangaType', id: number, downloadCount: number } }> } | null, trackProgress?: { __typename?: 'TrackProgressPayload', trackRecords: Array<{ __typename?: 'TrackRecordType', id: number, remoteId: string, trackerId: number, remoteUrl: string, title: string, status: number, lastChapterRead: number, totalChapters: number, score: number, displayScore: string, startDate: string, finishDate: string, private: boolean }> } | null };
export type UpdateChapterMetadataMutationVariables = Exact<{ export type UpdateChapterMetadataMutationVariables = Exact<{
preUpdateDeleteInput: DeleteChapterMetasInput;
hasPreUpdateDeletions: Scalars['Boolean']['input'];
updateInput: SetChapterMetasInput; updateInput: SetChapterMetasInput;
hasUpdates: Scalars['Boolean']['input']; hasUpdates: Scalars['Boolean']['input'];
deleteInput: DeleteChapterMetasInput; postUpdateDeleteInput: DeleteChapterMetasInput;
hasDeletions: Scalars['Boolean']['input']; hasPostUpdateDeletions: Scalars['Boolean']['input'];
migrateInput: SetChapterMetasInput; migrateInput: SetChapterMetasInput;
isMigration: Scalars['Boolean']['input']; isMigration: Scalars['Boolean']['input'];
}>; }>;
export type UpdateChapterMetadataMutation = { __typename?: 'Mutation', updatedMeta?: { __typename?: 'SetChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null, deletedMeta?: { __typename?: 'DeleteChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null }; export type UpdateChapterMetadataMutation = { __typename?: 'Mutation', preUpdateDeletedMeta?: { __typename?: 'DeleteChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null, updatedMeta?: { __typename?: 'SetChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null, postUpdateDeletedMeta?: { __typename?: 'DeleteChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetChapterMetasPayload', metas: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> } | null };
export type GetChaptersReaderQueryVariables = Exact<{ export type GetChaptersReaderQueryVariables = Exact<{
after?: InputMaybe<Scalars['Cursor']['input']>; after?: InputMaybe<Scalars['Cursor']['input']>;
@@ -3970,16 +3974,18 @@ export type UpdateMangasCategoriesMutationVariables = Exact<{
export type UpdateMangasCategoriesMutation = { __typename?: 'Mutation', updateMangasCategories?: { __typename?: 'UpdateMangasCategoriesPayload', mangas: Array<{ __typename?: 'MangaType', id: number, categories: { __typename?: 'CategoryNodeList', totalCount: number, nodes: Array<{ __typename?: 'CategoryType', id: number, mangas: { __typename?: 'MangaNodeList', totalCount: number } }> } }> } | null }; export type UpdateMangasCategoriesMutation = { __typename?: 'Mutation', updateMangasCategories?: { __typename?: 'UpdateMangasCategoriesPayload', mangas: Array<{ __typename?: 'MangaType', id: number, categories: { __typename?: 'CategoryNodeList', totalCount: number, nodes: Array<{ __typename?: 'CategoryType', id: number, mangas: { __typename?: 'MangaNodeList', totalCount: number } }> } }> } | null };
export type UpdateMangaMetadataMutationVariables = Exact<{ export type UpdateMangaMetadataMutationVariables = Exact<{
preUpdateDeleteInput: DeleteMangaMetasInput;
hasPreUpdateDeletions: Scalars['Boolean']['input'];
updateInput: SetMangaMetasInput; updateInput: SetMangaMetasInput;
hasUpdates: Scalars['Boolean']['input']; hasUpdates: Scalars['Boolean']['input'];
deleteInput: DeleteMangaMetasInput; postUpdateDeleteInput: DeleteMangaMetasInput;
hasDeletions: Scalars['Boolean']['input']; hasPostUpdateDeletions: Scalars['Boolean']['input'];
migrateInput: SetMangaMetasInput; migrateInput: SetMangaMetasInput;
isMigration: Scalars['Boolean']['input']; isMigration: Scalars['Boolean']['input'];
}>; }>;
export type UpdateMangaMetadataMutation = { __typename?: 'Mutation', updatedMeta?: { __typename?: 'SetMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null, deletedMeta?: { __typename?: 'DeleteMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null }; export type UpdateMangaMetadataMutation = { __typename?: 'Mutation', preUpdateDeletedMeta?: { __typename?: 'DeleteMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null, updatedMeta?: { __typename?: 'SetMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null, postUpdateDeletedMeta?: { __typename?: 'DeleteMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetMangaMetasPayload', metas: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } | null };
export type GetMangaScreenQueryVariables = Exact<{ export type GetMangaScreenQueryVariables = Exact<{
id: Scalars['Int']['input']; id: Scalars['Int']['input'];
@@ -4014,10 +4020,11 @@ export type GetMangaToMigrateQueryVariables = Exact<{
getChapterData: Scalars['Boolean']['input']; getChapterData: Scalars['Boolean']['input'];
migrateCategories: Scalars['Boolean']['input']; migrateCategories: Scalars['Boolean']['input'];
migrateTracking: Scalars['Boolean']['input']; migrateTracking: Scalars['Boolean']['input'];
migrateMetadata: Scalars['Boolean']['input'];
}>; }>;
export type GetMangaToMigrateQuery = { __typename?: 'Query', manga: { __typename?: 'MangaType', id: number, inLibrary: boolean, title: string, chapters?: { __typename?: 'ChapterNodeList', totalCount: number, nodes: Array<{ __typename?: 'ChapterType', id: number, chapterNumber: number, isRead: boolean, isDownloaded: boolean, isBookmarked: boolean, manga: { __typename?: 'MangaType', id: number } }> }, categories?: { __typename?: 'CategoryNodeList', nodes: Array<{ __typename?: 'CategoryType', id: number }> }, trackRecords?: { __typename?: 'TrackRecordNodeList', nodes: Array<{ __typename?: 'TrackRecordType', id: number, remoteId: string, trackerId: number, private: boolean }> } } }; export type GetMangaToMigrateQuery = { __typename?: 'Query', manga: { __typename?: 'MangaType', id: number, inLibrary: boolean, title: string, chapters?: { __typename?: 'ChapterNodeList', totalCount: number, nodes: Array<{ __typename?: 'ChapterType', id: number, chapterNumber: number, isRead: boolean, isDownloaded: boolean, isBookmarked: boolean, manga: { __typename?: 'MangaType', id: number }, meta?: Array<{ __typename?: 'ChapterMetaType', chapterId: number, key: string, value: string }> }> }, categories?: { __typename?: 'CategoryNodeList', nodes: Array<{ __typename?: 'CategoryType', id: number }> }, trackRecords?: { __typename?: 'TrackRecordNodeList', nodes: Array<{ __typename?: 'TrackRecordType', id: number, remoteId: string, trackerId: number, private: boolean }> }, meta?: Array<{ __typename?: 'MangaMetaType', mangaId: number, key: string, value: string }> } };
export type GetMangasBaseQueryVariables = Exact<{ export type GetMangasBaseQueryVariables = Exact<{
after?: InputMaybe<Scalars['Cursor']['input']>; after?: InputMaybe<Scalars['Cursor']['input']>;
@@ -4074,16 +4081,18 @@ export type GetLibraryMangaCountQueryVariables = Exact<{ [key: string]: never; }
export type GetLibraryMangaCountQuery = { __typename?: 'Query', mangas: { __typename?: 'MangaNodeList', totalCount: number } }; export type GetLibraryMangaCountQuery = { __typename?: 'Query', mangas: { __typename?: 'MangaNodeList', totalCount: number } };
export type UpdateGlobalMetadataMutationVariables = Exact<{ export type UpdateGlobalMetadataMutationVariables = Exact<{
preUpdateDeleteInput: DeleteGlobalMetasInput;
hasPreUpdateDeletions: Scalars['Boolean']['input'];
updateInput: SetGlobalMetasInput; updateInput: SetGlobalMetasInput;
hasUpdates: Scalars['Boolean']['input']; hasUpdates: Scalars['Boolean']['input'];
deleteInput: DeleteGlobalMetasInput; postUpdateDeleteInput: DeleteGlobalMetasInput;
hasDeletions: Scalars['Boolean']['input']; hasPostUpdateDeletions: Scalars['Boolean']['input'];
migrateInput: SetGlobalMetasInput; migrateInput: SetGlobalMetasInput;
isMigration: Scalars['Boolean']['input']; isMigration: Scalars['Boolean']['input'];
}>; }>;
export type UpdateGlobalMetadataMutation = { __typename?: 'Mutation', updatedMeta?: { __typename?: 'SetGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null, deletedMeta?: { __typename?: 'DeleteGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null }; export type UpdateGlobalMetadataMutation = { __typename?: 'Mutation', preUpdateDeletedMeta?: { __typename?: 'DeleteGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null, updatedMeta?: { __typename?: 'SetGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null, postUpdateDeletedMeta?: { __typename?: 'DeleteGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetGlobalMetasPayload', metas: Array<{ __typename?: 'GlobalMetaType', key: string, value: string }> } | null };
export type GetGlobalMetadataQueryVariables = Exact<{ export type GetGlobalMetadataQueryVariables = Exact<{
key: Scalars['String']['input']; key: Scalars['String']['input'];
@@ -4199,16 +4208,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<string>, entries: Array<string>, 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<string>, entries: Array<string>, type: 'MultiSelectListPreference', MultiSelectListPreferenceTitle?: string | null, MultiSelectListPreferenceDefault?: Array<string> | null, MultiSelectListPreferenceCurrentValue?: Array<string> | null } | { __typename?: 'SwitchPreference', summary?: string | null, key?: string | null, type: 'SwitchPreference', SwitchPreferenceCurrentValue?: boolean | null, SwitchPreferenceDefault: boolean, SwitchPreferenceTitle?: string | null }> } } | null }; 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<string>, entries: Array<string>, 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<string>, entries: Array<string>, type: 'MultiSelectListPreference', MultiSelectListPreferenceTitle?: string | null, MultiSelectListPreferenceDefault?: Array<string> | null, MultiSelectListPreferenceCurrentValue?: Array<string> | null } | { __typename?: 'SwitchPreference', summary?: string | null, key?: string | null, type: 'SwitchPreference', SwitchPreferenceCurrentValue?: boolean | null, SwitchPreferenceDefault: boolean, SwitchPreferenceTitle?: string | null }> } } | null };
export type UpdateSourceMetadataMutationVariables = Exact<{ export type UpdateSourceMetadataMutationVariables = Exact<{
preUpdateDeleteInput: DeleteSourceMetasInput;
hasPreUpdateDeletions: Scalars['Boolean']['input'];
updateInput: SetSourceMetasInput; updateInput: SetSourceMetasInput;
hasUpdates: Scalars['Boolean']['input']; hasUpdates: Scalars['Boolean']['input'];
deleteInput: DeleteSourceMetasInput; postUpdateDeleteInput: DeleteSourceMetasInput;
hasDeletions: Scalars['Boolean']['input']; hasPostUpdateDeletions: Scalars['Boolean']['input'];
migrateInput: SetSourceMetasInput; migrateInput: SetSourceMetasInput;
isMigration: Scalars['Boolean']['input']; isMigration: Scalars['Boolean']['input'];
}>; }>;
export type UpdateSourceMetadataMutation = { __typename?: 'Mutation', updatedMeta?: { __typename?: 'SetSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null, deletedMeta?: { __typename?: 'DeleteSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null }; export type UpdateSourceMetadataMutation = { __typename?: 'Mutation', preUpdateDeletedMeta?: { __typename?: 'DeleteSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null, updatedMeta?: { __typename?: 'SetSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null, postUpdateDeletedMeta?: { __typename?: 'DeleteSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null, migrationMeta?: { __typename?: 'SetSourceMetasPayload', metas: Array<{ __typename?: 'SourceMetaType', sourceId: string, key: string, value: string }> } | null };
export type GetSourceBrowseQueryVariables = Exact<{ export type GetSourceBrowseQueryVariables = Exact<{
id: Scalars['LongString']['input']; id: Scalars['LongString']['input'];

View File

@@ -175,19 +175,26 @@ export const UPDATE_MANGA_METADATA = gql`
${MANGA_META_FIELDS} ${MANGA_META_FIELDS}
mutation UPDATE_MANGA_METADATA( mutation UPDATE_MANGA_METADATA(
$preUpdateDeleteInput: DeleteMangaMetasInput!
$hasPreUpdateDeletions: Boolean!
$updateInput: SetMangaMetasInput! $updateInput: SetMangaMetasInput!
$hasUpdates: Boolean! $hasUpdates: Boolean!
$deleteInput: DeleteMangaMetasInput! $postUpdateDeleteInput: DeleteMangaMetasInput!
$hasDeletions: Boolean! $hasPostUpdateDeletions: Boolean!
$migrateInput: SetMangaMetasInput! $migrateInput: SetMangaMetasInput!
$isMigration: Boolean! $isMigration: Boolean!
) { ) {
preUpdateDeletedMeta: deleteMangaMetas(input: $preUpdateDeleteInput) @include(if: $hasPreUpdateDeletions) {
metas {
...MANGA_META_FIELDS
}
}
updatedMeta: setMangaMetas(input: $updateInput) @include(if: $hasUpdates) { updatedMeta: setMangaMetas(input: $updateInput) @include(if: $hasUpdates) {
metas { metas {
...MANGA_META_FIELDS ...MANGA_META_FIELDS
} }
} }
deletedMeta: deleteMangaMetas(input: $deleteInput) @include(if: $hasDeletions) { postUpdateDeletedMeta: deleteMangaMetas(input: $postUpdateDeleteInput) @include(if: $hasPostUpdateDeletions) {
metas { metas {
...MANGA_META_FIELDS ...MANGA_META_FIELDS
} }

View File

@@ -12,9 +12,11 @@ import {
MANGA_BASE_FIELDS, MANGA_BASE_FIELDS,
MANGA_LIBRARY_DUPLICATE_SCREEN_FIELDS, MANGA_LIBRARY_DUPLICATE_SCREEN_FIELDS,
MANGA_LIBRARY_FIELDS, MANGA_LIBRARY_FIELDS,
MANGA_META_FIELDS,
MANGA_READER_FIELDS, MANGA_READER_FIELDS,
MANGA_SCREEN_FIELDS, MANGA_SCREEN_FIELDS,
} from '@/lib/graphql/manga/MangaFragments.ts'; } from '@/lib/graphql/manga/MangaFragments.ts';
import { CHAPTER_META_FIELDS } from '@/lib/graphql/chapter/ChapterFragments.ts';
import { TRACK_RECORD_BIND_FIELDS } from '@/lib/graphql/tracker/TrackRecordFragments.ts'; import { TRACK_RECORD_BIND_FIELDS } from '@/lib/graphql/tracker/TrackRecordFragments.ts';
// returns the current manga from the database // returns the current manga from the database
@@ -75,11 +77,15 @@ export const GET_MANGA_CATEGORIES = gql`
// returns the current manga from the database // returns the current manga from the database
export const GET_MANGA_TO_MIGRATE = gql` export const GET_MANGA_TO_MIGRATE = gql`
${MANGA_META_FIELDS}
${CHAPTER_META_FIELDS}
query GET_MANGA_TO_MIGRATE( query GET_MANGA_TO_MIGRATE(
$id: Int! $id: Int!
$getChapterData: Boolean! $getChapterData: Boolean!
$migrateCategories: Boolean! $migrateCategories: Boolean!
$migrateTracking: Boolean! $migrateTracking: Boolean!
$migrateMetadata: Boolean!
) { ) {
manga(id: $id) { manga(id: $id) {
id id
@@ -95,6 +101,9 @@ export const GET_MANGA_TO_MIGRATE = gql`
isRead isRead
isDownloaded isDownloaded
isBookmarked isBookmarked
meta @include(if: $migrateMetadata) {
...CHAPTER_META_FIELDS
}
} }
totalCount totalCount
} }
@@ -111,6 +120,9 @@ export const GET_MANGA_TO_MIGRATE = gql`
private private
} }
} }
meta @include(if: $migrateMetadata) {
...MANGA_META_FIELDS
}
} }
} }
`; `;

View File

@@ -12,19 +12,26 @@ import { GLOBAL_METADATA } from '@/lib/graphql/common/Fragments.ts';
export const UPDATE_GLOBAL_METADATA = gql` export const UPDATE_GLOBAL_METADATA = gql`
${GLOBAL_METADATA} ${GLOBAL_METADATA}
mutation UPDATE_GLOBAL_METADATA( mutation UPDATE_GLOBAL_METADATA(
$preUpdateDeleteInput: DeleteGlobalMetasInput!
$hasPreUpdateDeletions: Boolean!
$updateInput: SetGlobalMetasInput! $updateInput: SetGlobalMetasInput!
$hasUpdates: Boolean! $hasUpdates: Boolean!
$deleteInput: DeleteGlobalMetasInput! $postUpdateDeleteInput: DeleteGlobalMetasInput!
$hasDeletions: Boolean! $hasPostUpdateDeletions: Boolean!
$migrateInput: SetGlobalMetasInput! $migrateInput: SetGlobalMetasInput!
$isMigration: Boolean! $isMigration: Boolean!
) { ) {
preUpdateDeletedMeta: deleteGlobalMetas(input: $preUpdateDeleteInput) @include(if: $hasPreUpdateDeletions) {
metas {
...GLOBAL_METADATA
}
}
updatedMeta: setGlobalMetas(input: $updateInput) @include(if: $hasUpdates) { updatedMeta: setGlobalMetas(input: $updateInput) @include(if: $hasUpdates) {
metas { metas {
...GLOBAL_METADATA ...GLOBAL_METADATA
} }
} }
deletedMeta: deleteGlobalMetas(input: $deleteInput) @include(if: $hasDeletions) { postUpdateDeletedMeta: deleteGlobalMetas(input: $postUpdateDeleteInput) @include(if: $hasPostUpdateDeletions) {
metas { metas {
...GLOBAL_METADATA ...GLOBAL_METADATA
} }

View File

@@ -39,19 +39,26 @@ export const UPDATE_SOURCE_METADATA = gql`
${SOURCE_META_FIELDS} ${SOURCE_META_FIELDS}
mutation UPDATE_SOURCE_METADATA( mutation UPDATE_SOURCE_METADATA(
$preUpdateDeleteInput: DeleteSourceMetasInput!
$hasPreUpdateDeletions: Boolean!
$updateInput: SetSourceMetasInput! $updateInput: SetSourceMetasInput!
$hasUpdates: Boolean! $hasUpdates: Boolean!
$deleteInput: DeleteSourceMetasInput! $postUpdateDeleteInput: DeleteSourceMetasInput!
$hasDeletions: Boolean! $hasPostUpdateDeletions: Boolean!
$migrateInput: SetSourceMetasInput! $migrateInput: SetSourceMetasInput!
$isMigration: Boolean! $isMigration: Boolean!
) { ) {
preUpdateDeletedMeta: deleteSourceMetas(input: $preUpdateDeleteInput) @include(if: $hasPreUpdateDeletions) {
metas {
...SOURCE_META_FIELDS
}
}
updatedMeta: setSourceMetas(input: $updateInput) @include(if: $hasUpdates) { updatedMeta: setSourceMetas(input: $updateInput) @include(if: $hasUpdates) {
metas { metas {
...SOURCE_META_FIELDS ...SOURCE_META_FIELDS
} }
} }
deletedMeta: deleteSourceMetas(input: $deleteInput) @include(if: $hasDeletions) { postUpdateDeletedMeta: deleteSourceMetas(input: $postUpdateDeleteInput) @include(if: $hasPostUpdateDeletions) {
metas { metas {
...SOURCE_META_FIELDS ...SOURCE_META_FIELDS
} }

View File

@@ -1287,12 +1287,14 @@ export class RequestManager {
public updateGlobalMeta( public updateGlobalMeta(
{ {
preUpdateDeleteInput = { keys: [] },
updateInput = { metas: [] }, updateInput = { metas: [] },
deleteInput = { keys: [] }, postUpdateDeleteInput = { keys: [] },
migrateInput = { metas: [] }, migrateInput = { metas: [] },
}: { }: {
preUpdateDeleteInput?: DeleteGlobalMetasInput;
updateInput?: SetGlobalMetasInput; updateInput?: SetGlobalMetasInput;
deleteInput?: DeleteGlobalMetasInput; postUpdateDeleteInput?: DeleteGlobalMetasInput;
migrateInput?: SetGlobalMetasInput; migrateInput?: SetGlobalMetasInput;
}, },
options?: MutationOptions<UpdateGlobalMetadataMutation, UpdateGlobalMetadataMutationVariables>, options?: MutationOptions<UpdateGlobalMetadataMutation, UpdateGlobalMetadataMutationVariables>,
@@ -1301,16 +1303,27 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_GLOBAL_METADATA, UPDATE_GLOBAL_METADATA,
{ {
preUpdateDeleteInput,
hasPreUpdateDeletions: !!preUpdateDeleteInput.keys?.length || !!preUpdateDeleteInput.prefixes?.length,
updateInput, updateInput,
hasUpdates: !!updateInput.metas.length, hasUpdates: !!updateInput.metas.length,
deleteInput, postUpdateDeleteInput,
hasDeletions: !!deleteInput.keys?.length || !!deleteInput.prefixes?.length, hasPostUpdateDeletions:
!!postUpdateDeleteInput.keys?.length || !!postUpdateDeleteInput.prefixes?.length,
migrateInput, migrateInput,
isMigration: !!updateInput.metas.length, isMigration: !!updateInput.metas.length,
}, },
{ {
optimisticResponse: { optimisticResponse: {
__typename: 'Mutation', __typename: 'Mutation',
preUpdateDeletedMeta: {
__typename: 'DeleteGlobalMetasPayload',
metas: (preUpdateDeleteInput?.keys ?? []).map((key) => ({
__typename: 'GlobalMetaType' as const,
key,
value: '',
})),
},
updatedMeta: { updatedMeta: {
__typename: 'SetGlobalMetasPayload', __typename: 'SetGlobalMetasPayload',
metas: (updateInput?.metas ?? []).map((meta) => ({ metas: (updateInput?.metas ?? []).map((meta) => ({
@@ -1319,9 +1332,9 @@ export class RequestManager {
value: meta.value, value: meta.value,
})), })),
}, },
deletedMeta: { postUpdateDeletedMeta: {
__typename: 'DeleteGlobalMetasPayload', __typename: 'DeleteGlobalMetasPayload',
metas: (deleteInput?.keys ?? []).map((key) => ({ metas: (postUpdateDeleteInput?.keys ?? []).map((key) => ({
__typename: 'GlobalMetaType' as const, __typename: 'GlobalMetaType' as const,
key, key,
value: '', value: '',
@@ -1337,7 +1350,11 @@ export class RequestManager {
}, },
}, },
update(cache, { data }) { update(cache, { data }) {
deleteInput?.keys?.forEach((key) => { preUpdateDeleteInput?.keys?.forEach((key) => {
cache.evict({ id: cache.identify({ __typename: 'GlobalMetaType', key }) });
});
postUpdateDeleteInput?.keys?.forEach((key) => {
cache.evict({ id: cache.identify({ __typename: 'GlobalMetaType', key }) }); cache.evict({ id: cache.identify({ __typename: 'GlobalMetaType', key }) });
}); });
@@ -1712,12 +1729,14 @@ export class RequestManager {
public updateSourceMeta( public updateSourceMeta(
{ {
preUpdateDeleteInput = { items: [] },
updateInput = { items: [] }, updateInput = { items: [] },
deleteInput = { items: [] }, postUpdateDeleteInput = { items: [] },
migrateInput = { items: [] }, migrateInput = { items: [] },
}: { }: {
preUpdateDeleteInput?: DeleteSourceMetasInput;
updateInput?: SetSourceMetasInput; updateInput?: SetSourceMetasInput;
deleteInput?: DeleteSourceMetasInput; postUpdateDeleteInput?: DeleteSourceMetasInput;
migrateInput?: SetSourceMetasInput; migrateInput?: SetSourceMetasInput;
}, },
options?: MutationOptions<UpdateSourceMetadataMutation, UpdateSourceMetadataMutationVariables>, options?: MutationOptions<UpdateSourceMetadataMutation, UpdateSourceMetadataMutationVariables>,
@@ -1726,16 +1745,35 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_SOURCE_METADATA, UPDATE_SOURCE_METADATA,
{ {
preUpdateDeleteInput,
hasPreUpdateDeletions: preUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
updateInput, updateInput,
hasUpdates: updateInput.items.some((item) => !!item.metas?.length), hasUpdates: updateInput.items.some((item) => !!item.metas?.length),
deleteInput, postUpdateDeleteInput,
hasDeletions: deleteInput.items.some((item) => !!item.keys?.length || !!item.prefixes?.length), hasPostUpdateDeletions: postUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
migrateInput, migrateInput,
isMigration: migrateInput.items.some((item) => !!item.metas?.length), isMigration: migrateInput.items.some((item) => !!item.metas?.length),
}, },
{ {
optimisticResponse: { optimisticResponse: {
__typename: 'Mutation', __typename: 'Mutation',
preUpdateDeletedMeta: {
__typename: 'DeleteSourceMetasPayload',
metas: (preUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.sourceIds.flatMap((sourceId) =>
(item.keys ?? []).map((key) => ({
__typename: 'SourceMetaType' as const,
sourceId,
key,
value: '',
})),
),
),
},
updatedMeta: { updatedMeta: {
__typename: 'SetSourceMetasPayload', __typename: 'SetSourceMetasPayload',
metas: (updateInput?.items ?? []).flatMap((item) => metas: (updateInput?.items ?? []).flatMap((item) =>
@@ -1749,9 +1787,9 @@ export class RequestManager {
), ),
), ),
}, },
deletedMeta: { postUpdateDeletedMeta: {
__typename: 'DeleteSourceMetasPayload', __typename: 'DeleteSourceMetasPayload',
metas: (deleteInput?.items ?? []).flatMap((item) => metas: (postUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.sourceIds.flatMap((sourceId) => item.sourceIds.flatMap((sourceId) =>
(item.keys ?? []).map((key) => ({ (item.keys ?? []).map((key) => ({
__typename: 'SourceMetaType' as const, __typename: 'SourceMetaType' as const,
@@ -1777,7 +1815,17 @@ export class RequestManager {
}, },
}, },
update(cache, { data }) { update(cache, { data }) {
deleteInput?.items.forEach((item) => preUpdateDeleteInput?.items.forEach((item) =>
item.sourceIds.forEach((sourceId) =>
item.keys?.forEach((key) => {
cache.evict({
id: cache.identify({ __typename: 'SourceMetaType', sourceId, key }),
});
}),
),
);
postUpdateDeleteInput?.items.forEach((item) =>
item.sourceIds.forEach((sourceId) => item.sourceIds.forEach((sourceId) =>
item.keys?.forEach((key) => { item.keys?.forEach((key) => {
cache.evict({ cache.evict({
@@ -2103,6 +2151,7 @@ export class RequestManager {
migrateCategories = false, migrateCategories = false,
migrateTracking = false, migrateTracking = false,
deleteChapters = false, deleteChapters = false,
migrateMetadata = false,
apolloOptions: options, apolloOptions: options,
}: Partial<MetadataMigrationSettings> & { }: Partial<MetadataMigrationSettings> & {
apolloOptions?: QueryOptions<GetMangaToMigrateQueryVariables, GetMangaToMigrateQuery>; apolloOptions?: QueryOptions<GetMangaToMigrateQueryVariables, GetMangaToMigrateQuery>;
@@ -2116,6 +2165,7 @@ export class RequestManager {
getChapterData: migrateChapters || deleteChapters, getChapterData: migrateChapters || deleteChapters,
migrateCategories, migrateCategories,
migrateTracking, migrateTracking,
migrateMetadata,
}, },
options, options,
); );
@@ -2275,12 +2325,14 @@ export class RequestManager {
public updateMangaMeta( public updateMangaMeta(
{ {
preUpdateDeleteInput = { items: [] },
updateInput = { items: [] }, updateInput = { items: [] },
deleteInput = { items: [] }, postUpdateDeleteInput = { items: [] },
migrateInput = { items: [] }, migrateInput = { items: [] },
}: { }: {
preUpdateDeleteInput?: DeleteMangaMetasInput;
updateInput?: SetMangaMetasInput; updateInput?: SetMangaMetasInput;
deleteInput?: DeleteMangaMetasInput; postUpdateDeleteInput?: DeleteMangaMetasInput;
migrateInput?: SetMangaMetasInput; migrateInput?: SetMangaMetasInput;
}, },
options?: MutationOptions<UpdateMangaMetadataMutation, UpdateMangaMetadataMutationVariables>, options?: MutationOptions<UpdateMangaMetadataMutation, UpdateMangaMetadataMutationVariables>,
@@ -2289,16 +2341,35 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_MANGA_METADATA, UPDATE_MANGA_METADATA,
{ {
preUpdateDeleteInput,
hasPreUpdateDeletions: preUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
updateInput, updateInput,
hasUpdates: updateInput.items.some((item) => !!item.metas?.length), hasUpdates: updateInput.items.some((item) => !!item.metas?.length),
deleteInput, postUpdateDeleteInput,
hasDeletions: deleteInput.items.some((item) => !!item.keys?.length || !!item.prefixes?.length), hasPostUpdateDeletions: postUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
migrateInput, migrateInput,
isMigration: migrateInput.items.some((item) => !!item.metas?.length), isMigration: migrateInput.items.some((item) => !!item.metas?.length),
}, },
{ {
optimisticResponse: { optimisticResponse: {
__typename: 'Mutation', __typename: 'Mutation',
preUpdateDeletedMeta: {
__typename: 'DeleteMangaMetasPayload',
metas: (preUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.mangaIds.flatMap((mangaId) =>
(item.keys ?? []).map((key) => ({
__typename: 'MangaMetaType' as const,
mangaId,
key,
value: '',
})),
),
),
},
updatedMeta: { updatedMeta: {
__typename: 'SetMangaMetasPayload', __typename: 'SetMangaMetasPayload',
metas: (updateInput?.items ?? []).flatMap((item) => metas: (updateInput?.items ?? []).flatMap((item) =>
@@ -2312,9 +2383,9 @@ export class RequestManager {
), ),
), ),
}, },
deletedMeta: { postUpdateDeletedMeta: {
__typename: 'DeleteMangaMetasPayload', __typename: 'DeleteMangaMetasPayload',
metas: (deleteInput?.items ?? []).flatMap((item) => metas: (postUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.mangaIds.flatMap((mangaId) => item.mangaIds.flatMap((mangaId) =>
(item.keys ?? []).map((key) => ({ (item.keys ?? []).map((key) => ({
__typename: 'MangaMetaType' as const, __typename: 'MangaMetaType' as const,
@@ -2340,7 +2411,17 @@ export class RequestManager {
}, },
}, },
update(cache, { data }) { update(cache, { data }) {
deleteInput?.items.forEach((item) => preUpdateDeleteInput?.items.forEach((item) =>
item.mangaIds.forEach((mangaId) =>
item.keys?.forEach((key) => {
cache.evict({
id: cache.identify({ __typename: 'MangaMetaType', mangaId, key }),
});
}),
),
);
postUpdateDeleteInput?.items.forEach((item) =>
item.mangaIds.forEach((mangaId) => item.mangaIds.forEach((mangaId) =>
item.keys?.forEach((key) => { item.keys?.forEach((key) => {
cache.evict({ cache.evict({
@@ -2543,12 +2624,14 @@ export class RequestManager {
public updateChapterMeta( public updateChapterMeta(
{ {
preUpdateDeleteInput = { items: [] },
updateInput = { items: [] }, updateInput = { items: [] },
deleteInput = { items: [] }, postUpdateDeleteInput = { items: [] },
migrateInput = { items: [] }, migrateInput = { items: [] },
}: { }: {
preUpdateDeleteInput?: DeleteChapterMetasInput;
updateInput?: SetChapterMetasInput; updateInput?: SetChapterMetasInput;
deleteInput?: DeleteChapterMetasInput; postUpdateDeleteInput?: DeleteChapterMetasInput;
migrateInput?: SetChapterMetasInput; migrateInput?: SetChapterMetasInput;
}, },
options?: MutationOptions<UpdateChapterMetadataMutation, UpdateChapterMetadataMutationVariables>, options?: MutationOptions<UpdateChapterMetadataMutation, UpdateChapterMetadataMutationVariables>,
@@ -2557,16 +2640,35 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CHAPTER_METADATA, UPDATE_CHAPTER_METADATA,
{ {
preUpdateDeleteInput,
hasPreUpdateDeletions: preUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
updateInput, updateInput,
hasUpdates: updateInput.items.some((item) => !!item.metas?.length), hasUpdates: updateInput.items.some((item) => !!item.metas?.length),
deleteInput, postUpdateDeleteInput,
hasDeletions: deleteInput.items.some((item) => !!item.keys?.length || !!item.prefixes?.length), hasPostUpdateDeletions: postUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
migrateInput, migrateInput,
isMigration: migrateInput.items.some((item) => !!item.metas?.length), isMigration: migrateInput.items.some((item) => !!item.metas?.length),
}, },
{ {
optimisticResponse: { optimisticResponse: {
__typename: 'Mutation', __typename: 'Mutation',
preUpdateDeletedMeta: {
__typename: 'DeleteChapterMetasPayload',
metas: (preUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.chapterIds.flatMap((chapterId) =>
(item.keys ?? []).map((key) => ({
__typename: 'ChapterMetaType' as const,
chapterId,
key,
value: '',
})),
),
),
},
updatedMeta: { updatedMeta: {
__typename: 'SetChapterMetasPayload', __typename: 'SetChapterMetasPayload',
metas: (updateInput?.items ?? []).flatMap((item) => metas: (updateInput?.items ?? []).flatMap((item) =>
@@ -2580,9 +2682,9 @@ export class RequestManager {
), ),
), ),
}, },
deletedMeta: { postUpdateDeletedMeta: {
__typename: 'DeleteChapterMetasPayload', __typename: 'DeleteChapterMetasPayload',
metas: (deleteInput?.items ?? []).flatMap((item) => metas: (postUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.chapterIds.flatMap((chapterId) => item.chapterIds.flatMap((chapterId) =>
(item.keys ?? []).map((key) => ({ (item.keys ?? []).map((key) => ({
__typename: 'ChapterMetaType' as const, __typename: 'ChapterMetaType' as const,
@@ -2608,7 +2710,17 @@ export class RequestManager {
}, },
}, },
update(cache, { data }) { update(cache, { data }) {
deleteInput?.items.forEach((item) => preUpdateDeleteInput?.items.forEach((item) =>
item.chapterIds.forEach((chapterId) =>
item.keys?.forEach((key) => {
cache.evict({
id: cache.identify({ __typename: 'ChapterMetaType', chapterId, key }),
});
}),
),
);
postUpdateDeleteInput?.items.forEach((item) =>
item.chapterIds.forEach((chapterId) => item.chapterIds.forEach((chapterId) =>
item.keys?.forEach((key) => { item.keys?.forEach((key) => {
cache.evict({ cache.evict({
@@ -2863,12 +2975,14 @@ export class RequestManager {
public updateCategoryMeta( public updateCategoryMeta(
{ {
preUpdateDeleteInput = { items: [] },
updateInput = { items: [] }, updateInput = { items: [] },
deleteInput = { items: [] }, postUpdateDeleteInput = { items: [] },
migrateInput = { items: [] }, migrateInput = { items: [] },
}: { }: {
preUpdateDeleteInput?: DeleteCategoryMetasInput;
updateInput?: SetCategoryMetasInput; updateInput?: SetCategoryMetasInput;
deleteInput?: DeleteCategoryMetasInput; postUpdateDeleteInput?: DeleteCategoryMetasInput;
migrateInput?: SetCategoryMetasInput; migrateInput?: SetCategoryMetasInput;
}, },
options?: MutationOptions<UpdateCategoryMetadataMutation, UpdateCategoryMetadataMutationVariables>, options?: MutationOptions<UpdateCategoryMetadataMutation, UpdateCategoryMetadataMutationVariables>,
@@ -2877,16 +2991,35 @@ export class RequestManager {
GQLMethod.MUTATION, GQLMethod.MUTATION,
UPDATE_CATEGORY_METADATA, UPDATE_CATEGORY_METADATA,
{ {
preUpdateDeleteInput,
hasPreUpdateDeletions: preUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
updateInput, updateInput,
hasUpdates: updateInput.items.some((item) => !!item.metas?.length), hasUpdates: updateInput.items.some((item) => !!item.metas?.length),
deleteInput, postUpdateDeleteInput,
hasDeletions: deleteInput.items.some((item) => !!item.keys?.length || !!item.prefixes?.length), hasPostUpdateDeletions: postUpdateDeleteInput.items.some(
(item) => !!item.keys?.length || !!item.prefixes?.length,
),
migrateInput, migrateInput,
isMigration: migrateInput.items.some((item) => !!item.metas?.length), isMigration: migrateInput.items.some((item) => !!item.metas?.length),
}, },
{ {
optimisticResponse: { optimisticResponse: {
__typename: 'Mutation', __typename: 'Mutation',
preUpdateDeletedMeta: {
__typename: 'DeleteCategoryMetasPayload',
metas: (preUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.categoryIds.flatMap((categoryId) =>
(item.keys ?? []).map((key) => ({
__typename: 'CategoryMetaType' as const,
categoryId,
key,
value: '',
})),
),
),
},
updatedMeta: { updatedMeta: {
__typename: 'SetCategoryMetasPayload', __typename: 'SetCategoryMetasPayload',
metas: (updateInput?.items ?? []).flatMap((item) => metas: (updateInput?.items ?? []).flatMap((item) =>
@@ -2900,9 +3033,9 @@ export class RequestManager {
), ),
), ),
}, },
deletedMeta: { postUpdateDeletedMeta: {
__typename: 'DeleteCategoryMetasPayload', __typename: 'DeleteCategoryMetasPayload',
metas: (deleteInput?.items ?? []).flatMap((item) => metas: (postUpdateDeleteInput?.items ?? []).flatMap((item) =>
item.categoryIds.flatMap((categoryId) => item.categoryIds.flatMap((categoryId) =>
(item.keys ?? []).map((key) => ({ (item.keys ?? []).map((key) => ({
__typename: 'CategoryMetaType' as const, __typename: 'CategoryMetaType' as const,
@@ -2928,7 +3061,17 @@ export class RequestManager {
}, },
}, },
update(cache, { data }) { update(cache, { data }) {
deleteInput?.items.forEach((item) => preUpdateDeleteInput?.items.forEach((item) =>
item.categoryIds.forEach((categoryId) =>
item.keys?.forEach((key) => {
cache.evict({
id: cache.identify({ __typename: 'CategoryMetaType', categoryId, key }),
});
}),
),
);
postUpdateDeleteInput?.items.forEach((item) =>
item.categoryIds.forEach((categoryId) => item.categoryIds.forEach((categoryId) =>
item.keys?.forEach((key) => { item.keys?.forEach((key) => {
cache.evict({ cache.evict({