Reduce requested extension data in queries
This commit is contained in:
@@ -168,23 +168,6 @@ export const FULL_MANGA_FIELDS = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export const FULL_EXTENSION_FIELDS = gql`
|
||||
fragment FULL_EXTENSION_FIELDS on ExtensionType {
|
||||
apkName
|
||||
repo
|
||||
hasUpdate
|
||||
iconUrl
|
||||
isInstalled
|
||||
isNsfw
|
||||
isObsolete
|
||||
lang
|
||||
name
|
||||
pkgName
|
||||
versionCode
|
||||
versionName
|
||||
}
|
||||
`;
|
||||
|
||||
export const ABOUT_WEBUI = gql`
|
||||
fragment ABOUT_WEBUI on AboutWebUI {
|
||||
channel
|
||||
|
||||
25
src/lib/graphql/fragments/ExtensionFragments.ts
Normal file
25
src/lib/graphql/fragments/ExtensionFragments.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 EXTENSION_LIST_FIELDS = gql`
|
||||
fragment EXTENSION_LIST_FIELDS on ExtensionType {
|
||||
pkgName
|
||||
name
|
||||
lang
|
||||
versionCode
|
||||
versionName
|
||||
iconUrl
|
||||
repo
|
||||
isNsfw
|
||||
isInstalled
|
||||
isObsolete
|
||||
hasUpdate
|
||||
}
|
||||
`;
|
||||
@@ -1,6 +1,6 @@
|
||||
import {FieldPolicy, FieldReadFunction, Reference, TypePolicies, TypePolicy} from '@apollo/client/cache';
|
||||
import {
|
||||
GetChaptersMangaQuery, GetDownloadStatusQueryVariables, GetExtensionQueryVariables, GetGlobalMetadataQueryVariables,
|
||||
GetChaptersMangaQuery, GetDownloadStatusQueryVariables, GetGlobalMetadataQueryVariables,
|
||||
GetMangaQueryVariables, GetSourceBrowseQueryVariables, GetUpdateStatusQueryVariables, GetWebuiUpdateStatusQueryVariables,
|
||||
} from "@/lib/graphql/generated/graphql.ts";
|
||||
import {FieldFunctionOptions} from "@apollo/client/cache/inmemory/policies";
|
||||
@@ -579,7 +579,7 @@ export type QueryFieldPolicy = {
|
||||
checkForServerUpdates?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
checkForWebUIUpdate?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
downloadStatus?: FieldPolicy<Reference, Reference, Reference, FieldFunctionOptions<GetDownloadStatusQueryVariables>> | FieldReadFunction<Reference, Reference, FieldFunctionOptions<GetDownloadStatusQueryVariables>>,
|
||||
extension?: FieldPolicy<Reference, Reference, Reference, FieldFunctionOptions<GetExtensionQueryVariables>> | FieldReadFunction<Reference, Reference, FieldFunctionOptions<GetExtensionQueryVariables>>,
|
||||
extension?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
extensions?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
getWebUIUpdateStatus?: FieldPolicy<Reference, Reference, Reference, FieldFunctionOptions<GetWebuiUpdateStatusQueryVariables>> | FieldReadFunction<Reference, Reference, FieldFunctionOptions<GetWebuiUpdateStatusQueryVariables>>,
|
||||
lastUpdateTimestamp?: FieldPolicy<any> | FieldReadFunction<any>,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -7,64 +7,56 @@
|
||||
*/
|
||||
|
||||
import gql from 'graphql-tag';
|
||||
import { FULL_EXTENSION_FIELDS } from '@/lib/graphql/Fragments';
|
||||
import { EXTENSION_LIST_FIELDS } from '@/lib/graphql/fragments/ExtensionFragments.ts';
|
||||
|
||||
// makes the server fetch and return the latest extensions
|
||||
export const GET_EXTENSIONS_FETCH = gql`
|
||||
${FULL_EXTENSION_FIELDS}
|
||||
${EXTENSION_LIST_FIELDS}
|
||||
|
||||
mutation GET_EXTENSIONS_FETCH($input: FetchExtensionsInput = {}) {
|
||||
fetchExtensions(input: $input) {
|
||||
clientMutationId
|
||||
extensions {
|
||||
...FULL_EXTENSION_FIELDS
|
||||
...EXTENSION_LIST_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_EXTENSION = gql`
|
||||
${EXTENSION_LIST_FIELDS}
|
||||
|
||||
mutation UPDATE_EXTENSION($input: UpdateExtensionInput!) {
|
||||
updateExtension(input: $input) {
|
||||
clientMutationId
|
||||
extension {
|
||||
pkgName
|
||||
apkName
|
||||
repo
|
||||
versionName
|
||||
versionCode
|
||||
isInstalled
|
||||
isObsolete
|
||||
hasUpdate
|
||||
...EXTENSION_LIST_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_EXTENSIONS = gql`
|
||||
${EXTENSION_LIST_FIELDS}
|
||||
|
||||
mutation UPDATE_EXTENSIONS($input: UpdateExtensionsInput!) {
|
||||
updateExtensions(input: $input) {
|
||||
clientMutationId
|
||||
extensions {
|
||||
pkgName
|
||||
apkName
|
||||
repo
|
||||
versionName
|
||||
versionCode
|
||||
isInstalled
|
||||
isObsolete
|
||||
hasUpdate
|
||||
...EXTENSION_LIST_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const INSTALL_EXTERNAL_EXTENSION = gql`
|
||||
${FULL_EXTENSION_FIELDS}
|
||||
${EXTENSION_LIST_FIELDS}
|
||||
|
||||
mutation INSTALL_EXTERNAL_EXTENSION($file: Upload!) {
|
||||
installExternalExtension(input: { extensionFile: $file }) {
|
||||
clientMutationId
|
||||
extension {
|
||||
...FULL_EXTENSION_FIELDS
|
||||
...EXTENSION_LIST_FIELDS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,22 +7,14 @@
|
||||
*/
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
`;
|
||||
import { PAGE_INFO } from '@/lib/graphql/Fragments';
|
||||
import { EXTENSION_LIST_FIELDS } from '@/lib/graphql/fragments/ExtensionFragments.ts';
|
||||
|
||||
// returns the current extensions from the database
|
||||
export const GET_EXTENSIONS = gql`
|
||||
${FULL_EXTENSION_FIELDS}
|
||||
${EXTENSION_LIST_FIELDS}
|
||||
${PAGE_INFO}
|
||||
|
||||
query GET_EXTENSIONS(
|
||||
$after: Cursor
|
||||
$before: Cursor
|
||||
@@ -46,7 +38,7 @@ export const GET_EXTENSIONS = gql`
|
||||
orderByType: $orderByType
|
||||
) {
|
||||
nodes {
|
||||
...FULL_EXTENSION_FIELDS
|
||||
...EXTENSION_LIST_FIELDS
|
||||
}
|
||||
pageInfo {
|
||||
...PAGE_INFO
|
||||
|
||||
Reference in New Issue
Block a user