2021-03-26 04:17:02 +04:30
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
2021-01-26 23:32:12 +03:30
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2023-05-18 13:17:41 +02:00
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
2021-01-26 23:32:12 +03:30
|
|
|
|
2024-10-05 22:53:22 +02:00
|
|
|
import { MetaType } from '@/lib/graphql/generated/graphql.ts';
|
2024-10-05 19:21:26 +02:00
|
|
|
import { MangaMetadataKeys } from '@/modules/manga/MangaCard.types.tsx';
|
2024-10-05 21:22:12 +02:00
|
|
|
import { SourceMetadataKeys } from '@/modules/source/Source.types.ts';
|
2024-10-05 21:39:58 +02:00
|
|
|
import { CategoryMetadataKeys } from '@/modules/category/Category.types.ts';
|
2024-10-05 22:53:22 +02:00
|
|
|
import { MetadataServerSettingKeys, SearchMetadataKeys } from '@/modules/settings/Settings.types.ts';
|
2024-09-17 03:40:55 +02:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export interface IMetadataMigration {
|
2023-02-06 10:06:33 +01:00
|
|
|
appKeyPrefix?: { oldPrefix: string; newPrefix: string };
|
2023-02-17 13:10:44 +01:00
|
|
|
values?: {
|
|
|
|
|
/**
|
|
|
|
|
* In case the migration should only be applied to a specific metadata key.
|
|
|
|
|
* Otherwise, all metadata keys will get migrated.
|
|
|
|
|
*/
|
|
|
|
|
key?: string;
|
|
|
|
|
oldValue: string;
|
|
|
|
|
newValue: string;
|
|
|
|
|
}[];
|
2023-02-06 10:06:33 +01:00
|
|
|
keys?: { oldKey: string; newKey: string }[];
|
2023-01-06 18:19:45 +01:00
|
|
|
}
|
|
|
|
|
|
2023-04-22 11:34:19 +02:00
|
|
|
export type Metadata<Keys extends string = string, Values = string> = {
|
|
|
|
|
[key in Keys]: Values;
|
|
|
|
|
};
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-09-08 00:44:01 +02:00
|
|
|
export type GqlMetaHolder = { meta?: MetaType[] };
|
|
|
|
|
|
2023-04-22 11:34:19 +02:00
|
|
|
export type MetadataHolder<Keys extends string = string, Values = string> = {
|
|
|
|
|
meta?: Metadata<Keys, Values>;
|
|
|
|
|
};
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2024-09-17 03:40:55 +02:00
|
|
|
export type AllowedMetadataValueTypes = string | boolean | number | undefined | null;
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2024-09-17 03:40:55 +02:00
|
|
|
export type AppMetadataKeys =
|
|
|
|
|
| MetadataServerSettingKeys
|
|
|
|
|
| MangaMetadataKeys
|
|
|
|
|
| SearchMetadataKeys
|
|
|
|
|
| SourceMetadataKeys
|
|
|
|
|
| CategoryMetadataKeys;
|
2023-01-06 17:15:29 +01:00
|
|
|
|
2023-02-24 16:40:37 +01:00
|
|
|
export type MetadataKeyValuePair = [AppMetadataKeys, AllowedMetadataValueTypes];
|