UNPKG

1.81 kBTypeScriptView Raw
1import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
2import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
3import { FetcherRenderer } from './fetcher.js';
4import { ReactQueryRawPluginConfig } from './config.js';
5import { Types } from '@graphql-codegen/plugin-helpers';
6export interface ReactQueryPluginConfig extends ClientSideBasePluginConfig {
7 errorType: string;
8 exposeDocument: boolean;
9 exposeQueryKeys: boolean;
10 exposeMutationKeys: boolean;
11 exposeFetcher: boolean;
12 addInfiniteQuery: boolean;
13 legacyMode: boolean;
14}
15export interface ReactQueryMethodMap {
16 infiniteQuery: {
17 hook: string;
18 options: string;
19 };
20 query: {
21 hook: string;
22 options: string;
23 };
24 mutation: {
25 hook: string;
26 options: string;
27 };
28}
29export declare class ReactQueryVisitor extends ClientSideBaseVisitor<ReactQueryRawPluginConfig, ReactQueryPluginConfig> {
30 protected rawConfig: ReactQueryRawPluginConfig;
31 private _externalImportPrefix;
32 fetcher: FetcherRenderer;
33 reactQueryHookIdentifiersInUse: Set<string>;
34 reactQueryOptionsIdentifiersInUse: Set<string>;
35 queryMethodMap: ReactQueryMethodMap;
36 constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: ReactQueryRawPluginConfig, documents: Types.DocumentFile[]);
37 get imports(): Set<string>;
38 private createFetcher;
39 get hasOperations(): boolean;
40 getImports(): string[];
41 getFetcherImplementation(): string;
42 private _getHookSuffix;
43 protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string, hasRequiredVariables: boolean): string;
44}