From 55c1c51edd03f3e7559b32face8dd3e78301cd92 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 5 Aug 2023 01:03:40 +0200 Subject: [PATCH] Create queries, mutations and subscriptions --- src/lib/graphql/Fragments.ts | 439 ++++++++++++++++++ src/lib/graphql/mutations/BackupMutation.ts | 31 ++ src/lib/graphql/mutations/CategoryMutation.ts | 105 +++++ src/lib/graphql/mutations/ChapterMutation.ts | 96 ++++ .../graphql/mutations/DownloaderMutation.ts | 130 ++++++ .../graphql/mutations/ExtensionMutation.ts | 59 +++ .../mutations/GlobalMetadataMutation.ts | 34 ++ src/lib/graphql/mutations/MangaMutation.ts | 106 +++++ .../graphql/mutations/ServerInfoMutation.ts | 23 + src/lib/graphql/mutations/SettingsMutation.ts | 34 ++ src/lib/graphql/mutations/SourceMutation.ts | 35 ++ src/lib/graphql/mutations/UpdaterMutation.ts | 42 ++ src/lib/graphql/queries/BackupQuery.ts | 30 ++ src/lib/graphql/queries/CategoryQuery.ts | 73 +++ src/lib/graphql/queries/ChapterQuery.ts | 57 +++ src/lib/graphql/queries/DownloaderQuery.ts | 20 + src/lib/graphql/queries/ExtensionQuery.ts | 57 +++ .../graphql/queries/GlobalMetadataQuery.ts | 55 +++ src/lib/graphql/queries/MangaQuery.ts | 59 +++ src/lib/graphql/queries/ServerInfoQuery.ts | 52 +++ src/lib/graphql/queries/SettingsQuery.ts | 20 + src/lib/graphql/queries/SourceQuery.ts | 30 ++ src/lib/graphql/queries/UpdaterQuery.ts | 28 ++ .../subscriptions/DownloaderSubscription.ts | 20 + .../subscriptions/ServerInfoSubscription.ts | 20 + .../subscriptions/UpdaterSubscription.ts | 20 + 26 files changed, 1675 insertions(+) create mode 100644 src/lib/graphql/Fragments.ts create mode 100644 src/lib/graphql/mutations/BackupMutation.ts create mode 100644 src/lib/graphql/mutations/CategoryMutation.ts create mode 100644 src/lib/graphql/mutations/ChapterMutation.ts create mode 100644 src/lib/graphql/mutations/DownloaderMutation.ts create mode 100644 src/lib/graphql/mutations/ExtensionMutation.ts create mode 100644 src/lib/graphql/mutations/GlobalMetadataMutation.ts create mode 100644 src/lib/graphql/mutations/MangaMutation.ts create mode 100644 src/lib/graphql/mutations/ServerInfoMutation.ts create mode 100644 src/lib/graphql/mutations/SettingsMutation.ts create mode 100644 src/lib/graphql/mutations/SourceMutation.ts create mode 100644 src/lib/graphql/mutations/UpdaterMutation.ts create mode 100644 src/lib/graphql/queries/BackupQuery.ts create mode 100644 src/lib/graphql/queries/CategoryQuery.ts create mode 100644 src/lib/graphql/queries/ChapterQuery.ts create mode 100644 src/lib/graphql/queries/DownloaderQuery.ts create mode 100644 src/lib/graphql/queries/ExtensionQuery.ts create mode 100644 src/lib/graphql/queries/GlobalMetadataQuery.ts create mode 100644 src/lib/graphql/queries/MangaQuery.ts create mode 100644 src/lib/graphql/queries/ServerInfoQuery.ts create mode 100644 src/lib/graphql/queries/SettingsQuery.ts create mode 100644 src/lib/graphql/queries/SourceQuery.ts create mode 100644 src/lib/graphql/queries/UpdaterQuery.ts create mode 100644 src/lib/graphql/subscriptions/DownloaderSubscription.ts create mode 100644 src/lib/graphql/subscriptions/ServerInfoSubscription.ts create mode 100644 src/lib/graphql/subscriptions/UpdaterSubscription.ts diff --git a/src/lib/graphql/Fragments.ts b/src/lib/graphql/Fragments.ts new file mode 100644 index 0000000000..e801d2da7c --- /dev/null +++ b/src/lib/graphql/Fragments.ts @@ -0,0 +1,439 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; + +export const PAGE_INFO = gql` + fragment PAGE_INFO on PageInfo { + endCursor + hasNextPage + hasPreviousPage + startCursor + } +`; + +export const GLOBAL_METADATA = gql` + fragment GLOBAL_METADATA on GlobalMetaType { + key + value + } +`; + +export const FULL_CATEGORY_FIELDS = gql` + fragment FULL_CATEGORY_FIELDS on CategoryType { + default + id + includeInUpdate + name + order + meta { + key + value + } + mangas { + totalCount + } + } +`; + +export const PARTIAL_SOURCE_FIELDS = gql` + fragment PARTIAL_SOURCE_FIELDS on SourceType { + displayName + iconUrl + id + isConfigurable + isNsfw + lang + name + supportsLatest + } +`; + +export const FULL_SOURCE_FIELDS = gql` + ${PARTIAL_SOURCE_FIELDS} + fragment FULL_SOURCE_FIELDS on SourceType { + ...PARTIAL_SOURCE_FIELDS + preferences { + ... on CheckBoxPreference { + type: __typename + CheckBoxCheckBoxCurrentValue: currentValue + summary + CheckBoxDefault: default + key + CheckBoxTitle: title + } + ... on EditTextPreference { + type: __typename + EditTextPreferenceCurrentValue: currentValue + EditTextPreferenceDefault: default + EditTextPreferenceTitle: title + text + summary + key + dialogTitle + dialogMessage + } + ... on SwitchPreference { + type: __typename + SwitchPreferenceCurrentValue: currentValue + summary + key + SwitchPreferenceDefault: default + SwitchPreferenceTitle: title + } + ... on MultiSelectListPreference { + type: __typename + dialogMessage + dialogTitle + MultiSelectListPreferenceTitle: title + summary + key + entryValues + entries + MultiSelectListPreferenceDefault: default + MultiSelectListPreferenceCurrentValue: currentValue + } + ... on ListPreference { + type: __typename + ListPreferenceCurrentValue: currentValue + ListPreferenceDefault: default + ListPreferenceTitle: title + summary + key + entryValues + entries + } + } + filters { + ... on TriStateFilter { + type: __typename + name + TriStateFilterDefault: default + } + ... on CheckBoxFilter { + type: __typename + CheckBoxFilterDefault: default + name + } + ... on TextFilter { + type: __typename + name + TextFilterDefault: default + } + ... on SortFilter { + type: __typename + values + name + SortFilterDefault: default { + ascending + index + } + } + ... on SeparatorFilter { + type: __typename + name + } + ... on SelectFilter { + type: __typename + values + name + SelectFilterDefault: default + } + ... on HeaderFilter { + type: __typename + name + } + ... on GroupFilter { + type: __typename + name + filters { + ... on CheckBoxFilter { + type: __typename + CheckBoxFilterDefault: default + name + } + ... on HeaderFilter { + type: __typename + name + } + ... on SelectFilter { + type: __typename + SelectFilterDefault: default + name + values + } + ... on TriStateFilter { + type: __typename + TriStateFilterDefault: default + name + } + ... on TextFilter { + type: __typename + TextFilterDefault: default + name + } + ... on SortFilter { + type: __typename + SorSortFilterDefault: default { + ascending + index + } + name + values + } + ... on SeparatorFilter { + type: __typename + name + } + } + } + } + } +`; + +export const BASE_MANGA_FIELDS = gql` + ${PARTIAL_SOURCE_FIELDS} + fragment BASE_MANGA_FIELDS on MangaType { + artist + author + chaptersLastFetchedAt + description + genre + id + inLibrary + inLibraryAt + initialized + lastFetchedAt + meta { + key + value + } + realUrl + source { + ...PARTIAL_SOURCE_FIELDS + } + status + thumbnailUrl + title + url + } +`; + +export const PARTIAL_MANGA_FIELDS = gql` + ${BASE_MANGA_FIELDS} + ${FULL_CATEGORY_FIELDS} + ${PARTIAL_SOURCE_FIELDS} + fragment PARTIAL_MANGA_FIELDS on MangaType { + ...BASE_MANGA_FIELDS + unreadCount + downloadCount + categories { + nodes { + ...FULL_CATEGORY_FIELDS + } + totalCount + } + chapters { + totalCount + } + } +`; + +export const FULL_CHAPTER_FIELDS = gql` + ${PARTIAL_MANGA_FIELDS} + fragment FULL_CHAPTER_FIELDS on ChapterType { + chapterNumber + fetchedAt + id + isBookmarked + isDownloaded + isRead + lastPageRead + lastReadAt + manga { + ...PARTIAL_MANGA_FIELDS + } + meta { + key + value + } + name + pageCount + realUrl + scanlator + sourceOrder + uploadDate + url + } +`; + +export const FULL_MANGA_FIELDS = gql` + ${PARTIAL_MANGA_FIELDS} + ${FULL_CHAPTER_FIELDS} + fragment FULL_MANGA_FIELDS on MangaType { + ...PARTIAL_MANGA_FIELDS + lastReadChapter { + ...FULL_CHAPTER_FIELDS + } + } +`; + +export const FULL_EXTENSION_FIELDS = gql` + fragment FULL_EXTENSION_FIELDS on ExtensionType { + apkName + hasUpdate + iconUrl + isInstalled + isNsfw + isObsolete + lang + name + pkgName + versionCode + versionName + } +`; + +export const FULL_DOWNLOAD_STATUS = gql` + ${FULL_CHAPTER_FIELDS} + fragment FULL_DOWNLOAD_STATUS on DownloadStatus { + queue { + chapter { + ...FULL_CHAPTER_FIELDS + } + progress + state + tries + } + state + } +`; + +export const PARTIAL_UPDATER_STATUS = gql` + fragment PARTIAL_UPDATER_STATUS on UpdateStatus { + isRunning + } +`; + +export const FULL_UPDATER_STATUS = gql` + ${FULL_MANGA_FIELDS} + ${PARTIAL_UPDATER_STATUS} + ${FULL_CATEGORY_FIELDS} + fragment FULL_UPDATER_STATUS on UpdateStatus { + ...PARTIAL_UPDATER_STATUS + completeJobs { + mangas { + nodes { + ...FULL_MANGA_FIELDS + } + totalCount + } + } + failedJobs { + mangas { + nodes { + ...FULL_MANGA_FIELDS + } + totalCount + } + } + pendingJobs { + mangas { + nodes { + ...FULL_MANGA_FIELDS + } + totalCount + } + } + runningJobs { + mangas { + nodes { + ...FULL_MANGA_FIELDS + } + totalCount + } + } + skippedJobs { + mangas { + nodes { + ...FULL_MANGA_FIELDS + } + totalCount + } + } + updatingCategories { + categories { + nodes { + ...FULL_CATEGORY_FIELDS + } + totalCount + } + } + skippedCategories { + categories { + nodes { + ...FULL_CATEGORY_FIELDS + } + totalCount + } + } + } +`; + +export const WEBUI_UPDATE_INFO = gql` + fragment WEBUI_UPDATE_INFO on WebUIUpdateInfo { + channel + tag + updateAvailable + } +`; + +export const WEBUI_UPDATE_STATUS = gql` + ${WEBUI_UPDATE_INFO} + fragment WEBUI_UPDATE_STATUS on WebUIUpdateStatus { + info { + ...WEBUI_UPDATE_INFO + } + progress + state + } +`; + +export const SERVER_SETTINGS = gql` + fragment SERVER_SETTINGS on SettingsType { + autoDownloadNewChapters + backupInterval + backupPath + backupTTL + backupTime + basicAuthEnabled + basicAuthPassword + basicAuthUsername + debugLogsEnabled + downloadAsCbz + downloadsPath + electronPath + excludeCompleted + excludeNotStarted + excludeUnreadChapters + globalUpdateInterval + initialOpenInBrowserEnabled + ip + localSourcePath + maxSourcesInParallel + port + socksProxyEnabled + socksProxyHost + socksProxyPort + systemTrayEnabled + webUIChannel + webUIFlavor + webUIInterface + webUIUpdateCheckInterval + } +`; diff --git a/src/lib/graphql/mutations/BackupMutation.ts b/src/lib/graphql/mutations/BackupMutation.ts new file mode 100644 index 0000000000..dc4c1d5a32 --- /dev/null +++ b/src/lib/graphql/mutations/BackupMutation.ts @@ -0,0 +1,31 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; + +export const CREATE_BACKUP = gql` + mutation CREATE_BACKUP($input: CreateBackupInput!) { + createBackup(input: $input) { + clientMutationId + url + } + } +`; + +export const RESTORE_BACKUP = gql` + mutation RESTORE_BACKUP($input: RestoreBackupInput!) { + restoreBackup(input: $input) { + clientMutationId + status { + mangaProgress + state + totalManga + } + } + } +`; diff --git a/src/lib/graphql/mutations/CategoryMutation.ts b/src/lib/graphql/mutations/CategoryMutation.ts new file mode 100644 index 0000000000..4081829ea4 --- /dev/null +++ b/src/lib/graphql/mutations/CategoryMutation.ts @@ -0,0 +1,105 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_CATEGORY_FIELDS } from '@/lib/graphql/Fragments'; + +export const CREATE_CATEGORY = gql` + ${FULL_CATEGORY_FIELDS} + mutation CREATE_CATEGORY($input: CreateCategoryInput!) { + createCategory(input: $input) { + clientMutationId + category { + ...FULL_CATEGORY_FIELDS + } + } + } +`; + +export const DELETE_CATEGORY = gql` + ${FULL_CATEGORY_FIELDS} + mutation DELETE_CATEGORY($input: DeleteCategoryInput!) { + deleteCategory(input: $input) { + clientMutationId + category { + ...FULL_CATEGORY_FIELDS + } + } + } +`; + +export const DELETE_CATEGORY_METADATA = gql` + ${FULL_CATEGORY_FIELDS} + mutation DELETE_CATEGORY_METADATA($input: DeleteCategoryMetaInput!) { + deleteCategoryMeta(input: $input) { + clientMutationId + meta { + key + value + category { + ...FULL_CATEGORY_FIELDS + } + } + category { + ...FULL_CATEGORY_FIELDS + } + } + } +`; + +export const SET_CATEGORY_METADATA = gql` + ${FULL_CATEGORY_FIELDS} + mutation SET_CATEGORY_METADATA($input: SetCategoryMetaInput!) { + setCategoryMeta(input: $input) { + clientMutationId + meta { + key + value + category { + ...FULL_CATEGORY_FIELDS + } + } + } + } +`; + +export const UPDATE_CATEGORY = gql` + ${FULL_CATEGORY_FIELDS} + mutation UPDATE_CATEGORY($input: UpdateCategoryInput!) { + updateCategory(input: $input) { + clientMutationId + category { + ...FULL_CATEGORY_FIELDS + } + } + } +`; + +export const UPDATE_CATEGORIES = gql` + ${FULL_CATEGORY_FIELDS} + mutation UPDATE_CATEGORIES($input: UpdateCategoriesInput!) { + updateCategories(input: $input) { + clientMutationId + categories { + ...FULL_CATEGORY_FIELDS + } + } + } +`; + +export const UPDATE_CATEGORY_ORDER = gql` + ${FULL_CATEGORY_FIELDS} + mutation UPDATE_CATEGORY_ORDER($input: UpdateCategoryOrderInput!) { + updateCategoryOrder(input: $input) { + clientMutationId + categories { + ...FULL_CATEGORY_FIELDS + } + } + } +`; diff --git a/src/lib/graphql/mutations/ChapterMutation.ts b/src/lib/graphql/mutations/ChapterMutation.ts new file mode 100644 index 0000000000..ecf2129263 --- /dev/null +++ b/src/lib/graphql/mutations/ChapterMutation.ts @@ -0,0 +1,96 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_CHAPTER_FIELDS } from '@/lib/graphql/Fragments'; + +export const DELETE_CHAPTER_METADATA = gql` + ${FULL_CHAPTER_FIELDS} + mutation DELETE_CHAPTER_METADATA($input: DeleteChapterMetaInput!) { + deleteChapterMeta(input: $input) { + clientMutationId + meta { + key + value + chapter { + ...FULL_CHAPTER_FIELDS + } + } + chapter { + ...FULL_CHAPTER_FIELDS + } + } + } +`; + +// makes the server fetch and return the pages of a chapter +export const GET_CHAPTER_PAGES_FETCH = gql` + ${FULL_CHAPTER_FIELDS} + mutation GET_CHAPTER_PAGES_FETCH($input: FetchChapterPagesInput!) { + fetchChapterPages(input: $input) { + clientMutationId + chapter { + ...FULL_CHAPTER_FIELDS + } + pages + } + } +`; + +// makes the server fetch and return the chapters of the manga +export const GET_MANGA_CHAPTERS_FETCH = gql` + ${FULL_CHAPTER_FIELDS} + mutation GET_MANGA_CHAPTERS_FETCH($input: FetchChaptersInput!) { + fetchChapters(input: $input) { + clientMutationId + chapters { + ...FULL_CHAPTER_FIELDS + } + } + } +`; + +export const SET_CHAPTER_METADATA = gql` + ${FULL_CHAPTER_FIELDS} + mutation SET_CHAPTER_METADATA($input: SetChapterMetaInput!) { + setChapterMeta(input: $input) { + clientMutationId + meta { + key + value + chapter { + ...FULL_CHAPTER_FIELDS + } + } + } + } +`; + +export const UPDATE_CHAPTER = gql` + ${FULL_CHAPTER_FIELDS} + mutation UPDATE_CHAPTER($input: UpdateChapterInput!) { + updateChapter(input: $input) { + clientMutationId + chapter { + ...FULL_CHAPTER_FIELDS + } + } + } +`; + +export const UPDATE_CHAPTERS = gql` + ${FULL_CHAPTER_FIELDS} + mutation UPDATE_CHAPTERS($input: UpdateChaptersInput!) { + updateChapters(input: $input) { + clientMutationId + chapters { + ...FULL_CHAPTER_FIELDS + } + } + } +`; diff --git a/src/lib/graphql/mutations/DownloaderMutation.ts b/src/lib/graphql/mutations/DownloaderMutation.ts new file mode 100644 index 0000000000..1a8e31c527 --- /dev/null +++ b/src/lib/graphql/mutations/DownloaderMutation.ts @@ -0,0 +1,130 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_CHAPTER_FIELDS, FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments'; + +export const CLEAR_DOWNLOADER = gql` + ${FULL_DOWNLOAD_STATUS} + mutation CLEAR_DOWNLOADER($input: ClearDownloaderInput = {}) { + clearDownloader(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const DELETE_DOWNLOADED_CHAPTER = gql` + ${FULL_CHAPTER_FIELDS} + mutation DELETE_DOWNLOADED_CHAPTER($input: DeleteDownloadedChapterInput!) { + deleteDownloadedChapter(input: $input) { + clientMutationId + chapters { + ...FULL_CHAPTER_FIELDS + } + } + } +`; + +export const DELETE_DOWNLOADED_CHAPTERS = gql` + ${FULL_CHAPTER_FIELDS} + mutation DELETE_DOWNLOADED_CHAPTERS($input: DeleteDownloadedChaptersInput!) { + deleteDownloadedChapters(input: $input) { + clientMutationId + chapters { + ...FULL_CHAPTER_FIELDS + } + } + } +`; + +export const DEQUEUE_CHAPTER_DOWNLOAD = gql` + ${FULL_DOWNLOAD_STATUS} + mutation DEQUEUE_CHAPTER_DOWNLOAD($input: DequeueChapterDownloadInput!) { + dequeueChapterDownload(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const DEQUEUE_CHAPTER_DOWNLOADS = gql` + ${FULL_DOWNLOAD_STATUS} + mutation DEQUEUE_CHAPTER_DOWNLOADS($input: DequeueChapterDownloadsInput!) { + dequeueChapterDownloads(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const ENQUEUE_CHAPTER_DOWNLOAD = gql` + ${FULL_DOWNLOAD_STATUS} + mutation ENQUEUE_CHAPTER_DOWNLOAD($input: EnqueueChapterDownloadInput!) { + enqueueChapterDownload(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const ENQUEUE_CHAPTER_DOWNLOADS = gql` + ${FULL_DOWNLOAD_STATUS} + mutation ENQUEUE_CHAPTER_DOWNLOADS($input: EnqueueChapterDownloadsInput!) { + enqueueChapterDownloads(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const REORDER_CHAPTER_DOWNLOAD = gql` + ${FULL_DOWNLOAD_STATUS} + mutation REORDER_CHAPTER_DOWNLOAD($input: ReorderChapterDownloadInput!) { + reorderChapterDownload(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const START_DOWNLOADER = gql` + ${FULL_DOWNLOAD_STATUS} + mutation START_DOWNLOADER($input: StartDownloaderInput = {}) { + startDownloader(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; + +export const STOP_DOWNLOADER = gql` + ${FULL_DOWNLOAD_STATUS} + mutation STOP_DOWNLOADER($input: StopDownloaderInput = {}) { + stopDownloader(input: $input) { + clientMutationId + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } + } +`; diff --git a/src/lib/graphql/mutations/ExtensionMutation.ts b/src/lib/graphql/mutations/ExtensionMutation.ts new file mode 100644 index 0000000000..0277a2555b --- /dev/null +++ b/src/lib/graphql/mutations/ExtensionMutation.ts @@ -0,0 +1,59 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_EXTENSION_FIELDS } from '@/lib/graphql/Fragments'; + +// makes the server fetch and return the latest extensions +export const GET_EXTENSIONS_FETCH = gql` + ${FULL_EXTENSION_FIELDS} + mutation GET_EXTENSIONS_FETCH($input: FetchExtensionsInput = {}) { + fetchExtensions(input: $input) { + clientMutationId + extensions { + ...FULL_EXTENSION_FIELDS + } + } + } +`; + +export const UPDATE_EXTENSION = gql` + ${FULL_EXTENSION_FIELDS} + mutation UPDATE_EXTENSION($input: UpdateExtensionInput!) { + updateExtension(input: $input) { + clientMutationId + extension { + ...FULL_EXTENSION_FIELDS + } + } + } +`; + +export const UPDATE_EXTENSIONS = gql` + ${FULL_EXTENSION_FIELDS} + mutation UPDATE_EXTENSIONS($input: UpdateExtensionsInput!) { + updateExtensions(input: $input) { + clientMutationId + extensions { + ...FULL_EXTENSION_FIELDS + } + } + } +`; + +export const INSTALL_EXTERNAL_EXTENSION = gql` + ${FULL_EXTENSION_FIELDS} + mutation INSTALL_EXTERNAL_EXTENSION($file: Upload!) { + installExternalExtension(input: { extensionFile: $file }) { + extension { + ...FULL_EXTENSION_FIELDS + } + clientMutationId + } + } +`; diff --git a/src/lib/graphql/mutations/GlobalMetadataMutation.ts b/src/lib/graphql/mutations/GlobalMetadataMutation.ts new file mode 100644 index 0000000000..c02f72bafc --- /dev/null +++ b/src/lib/graphql/mutations/GlobalMetadataMutation.ts @@ -0,0 +1,34 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { GLOBAL_METADATA } from '@/lib/graphql/Fragments'; + +export const DELETE_GLOBAL_METADATA = gql` + ${GLOBAL_METADATA} + mutation DELETE_GLOBAL_METADATA($input: DeleteGlobalMetaInput!) { + deleteGlobalMeta(input: $input) { + clientMutationId + meta { + ...GLOBAL_METADATA + } + } + } +`; + +export const SET_GLOBAL_METADATA = gql` + ${GLOBAL_METADATA} + mutation SET_GLOBAL_METADATA($input: SetGlobalMetaInput!) { + setGlobalMeta(input: $input) { + clientMutationId + meta { + ...GLOBAL_METADATA + } + } + } +`; diff --git a/src/lib/graphql/mutations/MangaMutation.ts b/src/lib/graphql/mutations/MangaMutation.ts new file mode 100644 index 0000000000..8ff59d2c46 --- /dev/null +++ b/src/lib/graphql/mutations/MangaMutation.ts @@ -0,0 +1,106 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_MANGA_FIELDS } from '@/lib/graphql/Fragments'; + +export const DELETE_MANGA_METADATA = gql` + ${FULL_MANGA_FIELDS} + mutation DELETE_MANGA_METADATA($input: DeleteMangaMetaInput!) { + deleteMangaMeta(input: $input) { + clientMutationId + meta { + key + value + manga { + ...FULL_MANGA_FIELDS + } + } + manga { + ...FULL_MANGA_FIELDS + } + } + } +`; + +// makes the server fetch and return the manga +export const GET_MANGA_FETCH = gql` + ${FULL_MANGA_FIELDS} + mutation GET_MANGA_FETCH($input: FetchMangaInput!) { + fetchManga(input: $input) { + clientMutationId + manga { + ...FULL_MANGA_FIELDS + } + } + } +`; + +export const SET_MANGA_METADATA = gql` + ${FULL_MANGA_FIELDS} + mutation SET_MANGA_METADATA($input: SetMangaMetaInput!) { + setMangaMeta(input: $input) { + clientMutationId + meta { + key + value + manga { + ...FULL_MANGA_FIELDS + } + } + } + } +`; + +export const UPDATE_MANGA = gql` + ${FULL_MANGA_FIELDS} + mutation UPDATE_MANGA($input: UpdateMangaInput!) { + updateManga(input: $input) { + clientMutationId + manga { + ...FULL_MANGA_FIELDS + } + } + } +`; + +export const UPDATE_MANGA_CATEGORIES = gql` + ${FULL_MANGA_FIELDS} + mutation UPDATE_MANGA_CATEGORIES($input: UpdateMangaCategoriesInput!) { + updateMangaCategories(input: $input) { + clientMutationId + manga { + ...FULL_MANGA_FIELDS + } + } + } +`; + +export const UPDATE_MANGAS = gql` + ${FULL_MANGA_FIELDS} + mutation UPDATE_MANGAS($input: UpdateMangasInput!) { + updateMangas(input: $input) { + clientMutationId + mangas { + ...FULL_MANGA_FIELDS + } + } + } +`; + +export const UPDATE_MANGAS_CATEGORIES = gql` + ${FULL_MANGA_FIELDS} + mutation UPDATE_MANGAS_CATEGORIES($input: UpdateMangasCategoriesInput!) { + updateMangasCategories(input: $input) { + clientMutationId + mangas { + ...FULL_MANGA_FIELDS + } + } + } +`; diff --git a/src/lib/graphql/mutations/ServerInfoMutation.ts b/src/lib/graphql/mutations/ServerInfoMutation.ts new file mode 100644 index 0000000000..c040069b4a --- /dev/null +++ b/src/lib/graphql/mutations/ServerInfoMutation.ts @@ -0,0 +1,23 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { WEBUI_UPDATE_STATUS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const UPDATE_WEBUI = gql` + ${WEBUI_UPDATE_STATUS} + mutation UPDATE_WEBUI($input: WebUIUpdateInput = {}) { + updateWebUI(input: $input) { + clientMutationId + updateStatus { + ...WEBUI_UPDATE_STATUS + } + } + } +`; diff --git a/src/lib/graphql/mutations/SettingsMutation.ts b/src/lib/graphql/mutations/SettingsMutation.ts new file mode 100644 index 0000000000..df1210561f --- /dev/null +++ b/src/lib/graphql/mutations/SettingsMutation.ts @@ -0,0 +1,34 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { SERVER_SETTINGS } from '@/lib/graphql/Fragments'; + +export const RESET_SERVER_SETTINGS = gql` + ${SERVER_SETTINGS} + mutation RESET_SERVER_SETTINGS($input: ResetSettingsInput!) { + resetSettings(input: $input) { + clientMutationId + settings { + ...SERVER_SETTINGS + } + } + } +`; + +export const UPDATE_SERVER_SETTINGS = gql` + ${SERVER_SETTINGS} + mutation UPDATE_SERVER_SETTINGS($input: SetSettingsInput!) { + setSettings(input: $input) { + clientMutationId + settings { + ...SERVER_SETTINGS + } + } + } +`; diff --git a/src/lib/graphql/mutations/SourceMutation.ts b/src/lib/graphql/mutations/SourceMutation.ts new file mode 100644 index 0000000000..f8a8a1e3fa --- /dev/null +++ b/src/lib/graphql/mutations/SourceMutation.ts @@ -0,0 +1,35 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_MANGA_FIELDS, FULL_SOURCE_FIELDS } from '@/lib/graphql/Fragments'; + +export const GET_SOURCE_MANGAS_FETCH = gql` + ${FULL_MANGA_FIELDS} + mutation GET_SOURCE_MANGAS_FETCH($input: FetchSourceMangaInput!) { + fetchSourceManga(input: $input) { + clientMutationId + hasNextPage + mangas { + ...FULL_MANGA_FIELDS + } + } + } +`; + +export const UPDATE_SOURCE_PREFERENCES = gql` + ${FULL_SOURCE_FIELDS} + mutation UPDATE_SOURCE_PREFERENCES($input: UpdateSourcePreferenceInput!) { + updateSourcePreference(input: $input) { + clientMutationId + source { + ...FULL_SOURCE_FIELDS + } + } + } +`; diff --git a/src/lib/graphql/mutations/UpdaterMutation.ts b/src/lib/graphql/mutations/UpdaterMutation.ts new file mode 100644 index 0000000000..c4011433d1 --- /dev/null +++ b/src/lib/graphql/mutations/UpdaterMutation.ts @@ -0,0 +1,42 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { PARTIAL_UPDATER_STATUS } from '@/lib/graphql/Fragments'; + +export const UPDATE_CATEGORY_MANGAS = gql` + ${PARTIAL_UPDATER_STATUS} + mutation UPDATE_CATEGORY_MANGAS($input: UpdateCategoryMangaInput!) { + updateCategoryManga(input: $input) { + clientMutationId + updateStatus { + ...PARTIAL_UPDATER_STATUS + } + } + } +`; + +export const UPDATE_LIBRARY_MANGAS = gql` + ${PARTIAL_UPDATER_STATUS} + mutation UPDATE_LIBRARY_MANGAS($input: UpdateLibraryMangaInput = {}) { + updateLibraryManga(input: $input) { + clientMutationId + updateStatus { + ...PARTIAL_UPDATER_STATUS + } + } + } +`; + +export const STOP_UPDATER = gql` + mutation STOP_UPDATER($input: UpdateStopInput = {}) { + updateStop(input: $input) { + clientMutationId + } + } +`; diff --git a/src/lib/graphql/queries/BackupQuery.ts b/src/lib/graphql/queries/BackupQuery.ts new file mode 100644 index 0000000000..8d09c94c9c --- /dev/null +++ b/src/lib/graphql/queries/BackupQuery.ts @@ -0,0 +1,30 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; + +export const VALIDATE_BACKUP = gql` + query VALIDATE_BACKUP($input: ValidateBackupInput!) { + validateBackup(input: $input) { + missingSources { + id + name + } + } + } +`; + +export const GET_RESTORE_STATUS = gql` + query GET_RESTORE_STATUS { + restoreStatus { + mangaProgress + state + totalManga + } + } +`; diff --git a/src/lib/graphql/queries/CategoryQuery.ts b/src/lib/graphql/queries/CategoryQuery.ts new file mode 100644 index 0000000000..8398cc8d3d --- /dev/null +++ b/src/lib/graphql/queries/CategoryQuery.ts @@ -0,0 +1,73 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_CATEGORY_FIELDS, FULL_MANGA_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments'; + +export const GET_CATEGORIES = gql` + ${FULL_CATEGORY_FIELDS} + ${PAGE_INFO} + query GET_CATEGORIES( + $after: Cursor + $before: Cursor + $condition: CategoryConditionInput + $filter: CategoryFilterInput + $first: Int + $last: Int + $offset: Int + $orderBy: CategoryOrderBy + $orderByType: SortOrder + ) { + categories( + after: $after + before: $before + condition: $condition + filter: $filter + first: $first + last: $last + offset: $offset + orderBy: $orderBy + orderByType: $orderByType + ) { + nodes { + ...FULL_CATEGORY_FIELDS + } + pageInfo { + ...PAGE_INFO + } + totalCount + } + } +`; + +export const GET_CATEGORY = gql` + ${FULL_CATEGORY_FIELDS} + query GET_CATEGORY($id: Int!) { + category(id: $id) { + ...FULL_CATEGORY_FIELDS + } + } +`; + +export const GET_CATEGORY_MANGAS = gql` + ${FULL_MANGA_FIELDS} + ${PAGE_INFO} + query GET_CATEGORY_MANGAS($id: Int!) { + category(id: $id) { + mangas { + nodes { + ...FULL_MANGA_FIELDS + } + pageInfo { + ...PAGE_INFO + } + totalCount + } + } + } +`; diff --git a/src/lib/graphql/queries/ChapterQuery.ts b/src/lib/graphql/queries/ChapterQuery.ts new file mode 100644 index 0000000000..89e88917f7 --- /dev/null +++ b/src/lib/graphql/queries/ChapterQuery.ts @@ -0,0 +1,57 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_CHAPTER_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments'; + +// returns the current chapter from the database +export const GET_CHAPTER = gql` + ${FULL_CHAPTER_FIELDS} + query GET_CHAPTER($id: Int!) { + chapter(id: $id) { + ...FULL_CHAPTER_FIELDS + } + } +`; + +// returns the current chapters from the database +export const GET_CHAPTERS = gql` + ${FULL_CHAPTER_FIELDS} + ${PAGE_INFO} + query GET_CHAPTERS( + $after: Cursor + $before: Cursor + $condition: ChapterConditionInput + $filter: ChapterFilterInput + $first: Int + $last: Int + $offset: Int + $orderBy: ChapterOrderBy + $orderByType: SortOrder + ) { + chapters( + after: $after + before: $before + condition: $condition + filter: $filter + first: $first + last: $last + offset: $offset + orderBy: $orderBy + orderByType: $orderByType + ) { + nodes { + ...FULL_CHAPTER_FIELDS + } + pageInfo { + ...PAGE_INFO + } + totalCount + } + } +`; diff --git a/src/lib/graphql/queries/DownloaderQuery.ts b/src/lib/graphql/queries/DownloaderQuery.ts new file mode 100644 index 0000000000..d67cb9a608 --- /dev/null +++ b/src/lib/graphql/queries/DownloaderQuery.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const GET_DOWNLOAD_STATUS = gql` + ${FULL_DOWNLOAD_STATUS} + query GET_DOWNLOAD_STATUS { + downloadStatus { + ...FULL_DOWNLOAD_STATUS + } + } +`; diff --git a/src/lib/graphql/queries/ExtensionQuery.ts b/src/lib/graphql/queries/ExtensionQuery.ts new file mode 100644 index 0000000000..16d4184dc4 --- /dev/null +++ b/src/lib/graphql/queries/ExtensionQuery.ts @@ -0,0 +1,57 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_EXTENSION_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments'; + +// returns the current extension from the database +export const GET_EXTENSION = gql` + ${FULL_EXTENSION_FIELDS} + query GET_EXTENSION($pkgName: String!) { + extension(pkgName: $pkgName) { + ...FULL_EXTENSION_FIELDS + } + } +`; + +// returns the current extensions from the database +export const GET_EXTENSIONS = gql` + ${FULL_EXTENSION_FIELDS} + ${PAGE_INFO} + query GET_EXTENSIONS( + $after: Cursor + $before: Cursor + $condition: ExtensionConditionInput + $filter: ExtensionFilterInput + $first: Int + $last: Int + $offset: Int + $orderBy: ExtensionOrderBy + $orderByType: SortOrder + ) { + extensions( + after: $after + before: $before + condition: $condition + filter: $filter + first: $first + last: $last + offset: $offset + orderBy: $orderBy + orderByType: $orderByType + ) { + nodes { + ...FULL_EXTENSION_FIELDS + } + pageInfo { + ...PAGE_INFO + } + totalCount + } + } +`; diff --git a/src/lib/graphql/queries/GlobalMetadataQuery.ts b/src/lib/graphql/queries/GlobalMetadataQuery.ts new file mode 100644 index 0000000000..cc3b69c45a --- /dev/null +++ b/src/lib/graphql/queries/GlobalMetadataQuery.ts @@ -0,0 +1,55 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { GLOBAL_METADATA, PAGE_INFO } from '@/lib/graphql/Fragments.ts'; + +export const GET_GLOBAL_METADATA = gql` + ${GLOBAL_METADATA} + query GET_GLOBAL_METADATA($key: String!) { + meta(key: $key) { + ...GLOBAL_METADATA + } + } +`; + +export const GET_GLOBAL_METADATAS = gql` + ${GLOBAL_METADATA} + ${PAGE_INFO} + query GET_GLOBAL_METADATAS( + $after: Cursor + $before: Cursor + $condition: MetaConditionInput + $filter: MetaFilterInput + $first: Int + $last: Int + $offset: Int + $orderBy: MetaOrderBy + $orderByType: SortOrder + ) { + metas( + after: $after + before: $before + condition: $condition + filter: $filter + first: $first + last: $last + offset: $offset + orderBy: $orderBy + orderByType: $orderByType + ) { + nodes { + ...GLOBAL_METADATA + } + pageInfo { + ...PAGE_INFO + } + totalCount + } + } +`; diff --git a/src/lib/graphql/queries/MangaQuery.ts b/src/lib/graphql/queries/MangaQuery.ts new file mode 100644 index 0000000000..f4d73e3936 --- /dev/null +++ b/src/lib/graphql/queries/MangaQuery.ts @@ -0,0 +1,59 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_CHAPTER_FIELDS, FULL_MANGA_FIELDS, PAGE_INFO } from '@/lib/graphql/Fragments'; + +// returns the current manga from the database +export const GET_MANGA = gql` + ${FULL_MANGA_FIELDS} + ${FULL_CHAPTER_FIELDS} + query GET_MANGA($id: Int!) { + manga(id: $id) { + ...FULL_MANGA_FIELDS + } + } +`; + +// returns the current manga from the database +export const GET_MANGAS = gql` + ${FULL_MANGA_FIELDS} + ${FULL_CHAPTER_FIELDS} + ${PAGE_INFO} + query GET_MANGAS( + $after: Cursor + $before: Cursor + $condition: MangaConditionInput + $filter: MangaFilterInput + $first: Int + $last: Int + $offset: Int + $orderBy: MangaOrderBy + $orderByType: SortOrder + ) { + mangas( + after: $after + before: $before + condition: $condition + filter: $filter + first: $first + last: $last + offset: $offset + orderBy: $orderBy + orderByType: $orderByType + ) { + nodes { + ...FULL_MANGA_FIELDS + } + pageInfo { + ...PAGE_INFO + } + totalCount + } + } +`; diff --git a/src/lib/graphql/queries/ServerInfoQuery.ts b/src/lib/graphql/queries/ServerInfoQuery.ts new file mode 100644 index 0000000000..8d10ea2f8b --- /dev/null +++ b/src/lib/graphql/queries/ServerInfoQuery.ts @@ -0,0 +1,52 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { WEBUI_UPDATE_INFO, WEBUI_UPDATE_STATUS } from '@/lib/graphql/Fragments'; + +export const GET_ABOUT = gql` + query GET_ABOUT { + about { + buildTime + buildType + discord + github + name + revision + version + } + } +`; + +export const CHECK_FOR_SERVER_UPDATES = gql` + query CHECK_FOR_SERVER_UPDATES { + checkForServerUpdates { + channel + tag + url + } + } +`; + +export const CHECK_FOR_WEBUI_UPDATE = gql` + ${WEBUI_UPDATE_INFO} + query CHECK_FOR_WEBUI_UPDATE { + checkForWebUIUpdate { + ...WEBUI_UPDATE_INFO + } + } +`; + +export const GET_WEBUI_UPDATE_STATUS = gql` + ${WEBUI_UPDATE_STATUS} + query GET_WEBUI_UPDATE_STATUS { + getWebUIUpdateStatus { + ...WEBUI_UPDATE_STATUS + } + } +`; diff --git a/src/lib/graphql/queries/SettingsQuery.ts b/src/lib/graphql/queries/SettingsQuery.ts new file mode 100644 index 0000000000..227f798e31 --- /dev/null +++ b/src/lib/graphql/queries/SettingsQuery.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { SERVER_SETTINGS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const GET_SERVER_SETTINGS = gql` + ${SERVER_SETTINGS} + query GET_SERVER_SETTINGS { + settings { + ...SERVER_SETTINGS + } + } +`; diff --git a/src/lib/graphql/queries/SourceQuery.ts b/src/lib/graphql/queries/SourceQuery.ts new file mode 100644 index 0000000000..6d5792119c --- /dev/null +++ b/src/lib/graphql/queries/SourceQuery.ts @@ -0,0 +1,30 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_SOURCE_FIELDS, PARTIAL_SOURCE_FIELDS } from '@/lib/graphql/Fragments'; + +export const GET_SOURCE = gql` + ${FULL_SOURCE_FIELDS} + query GET_SOURCE($id: LongString!) { + source(id: $id) { + ...FULL_SOURCE_FIELDS + } + } +`; + +export const GET_SOURCES = gql` + ${PARTIAL_SOURCE_FIELDS} + query GET_SOURCES { + sources { + nodes { + ...PARTIAL_SOURCE_FIELDS + } + } + } +`; diff --git a/src/lib/graphql/queries/UpdaterQuery.ts b/src/lib/graphql/queries/UpdaterQuery.ts new file mode 100644 index 0000000000..3662551907 --- /dev/null +++ b/src/lib/graphql/queries/UpdaterQuery.ts @@ -0,0 +1,28 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_UPDATER_STATUS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const GET_UPDATE_STATUS = gql` + ${FULL_UPDATER_STATUS} + query GET_UPDATE_STATUS { + updateStatus { + ...FULL_UPDATER_STATUS + } + } +`; + +export const GET_LAST_UPDATE_TIMESTAMP = gql` + query GET_LAST_UPDATE_TIMESTAMP { + lastUpdateTimestamp { + timestamp + } + } +`; diff --git a/src/lib/graphql/subscriptions/DownloaderSubscription.ts b/src/lib/graphql/subscriptions/DownloaderSubscription.ts new file mode 100644 index 0000000000..af92bcfe58 --- /dev/null +++ b/src/lib/graphql/subscriptions/DownloaderSubscription.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const DOWNLOAD_STATUS_SUBSCRIPTION = gql` + ${FULL_DOWNLOAD_STATUS} + subscription DOWNLOAD_STATUS_SUBSCRIPTION { + downloadChanged { + ...FULL_DOWNLOAD_STATUS + } + } +`; diff --git a/src/lib/graphql/subscriptions/ServerInfoSubscription.ts b/src/lib/graphql/subscriptions/ServerInfoSubscription.ts new file mode 100644 index 0000000000..e95f400fd7 --- /dev/null +++ b/src/lib/graphql/subscriptions/ServerInfoSubscription.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { WEBUI_UPDATE_STATUS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const WEBUI_UPDATE_SUBSCRIPTION = gql` + ${WEBUI_UPDATE_STATUS} + subscription WEBUI_UPDATE_SUBSCRIPTION { + webUIUpdateStatusChange { + ...WEBUI_UPDATE_STATUS + } + } +`; diff --git a/src/lib/graphql/subscriptions/UpdaterSubscription.ts b/src/lib/graphql/subscriptions/UpdaterSubscription.ts new file mode 100644 index 0000000000..d16d657a40 --- /dev/null +++ b/src/lib/graphql/subscriptions/UpdaterSubscription.ts @@ -0,0 +1,20 @@ +/* + * Copyright (C) Contributors to the Suwayomi project + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +import gql from 'graphql-tag'; +import { FULL_UPDATER_STATUS } from '@/lib/graphql/Fragments'; + +// eslint-disable-next-line import/prefer-default-export +export const UPDATER_SUBSCRIPTION = gql` + ${FULL_UPDATER_STATUS} + subscription UPDATER_SUBSCRIPTION { + updateStatusChanged { + ...FULL_UPDATER_STATUS + } + } +`;