UNPKG

2.4 kBTypeScriptView Raw
1import { GraphQLSchema, OperationDefinitionNode } from 'graphql';
2import { Types } from '@graphql-codegen/plugin-helpers';
3import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
4import { ReactApolloPluginConfigDefaultBaseOptions, ReactApolloRawPluginConfig } from './config.js';
5export interface ReactApolloPluginConfig extends ClientSideBasePluginConfig {
6 withComponent: boolean;
7 withHOC: boolean;
8 withHooks: boolean;
9 withMutationFn: boolean;
10 withRefetchFn: boolean;
11 withFragmentHooks?: boolean;
12 apolloReactCommonImportFrom: string;
13 apolloReactComponentsImportFrom: string;
14 apolloReactHocImportFrom: string;
15 apolloReactHooksImportFrom: string;
16 componentSuffix: string;
17 reactApolloVersion: 2 | 3;
18 withResultType: boolean;
19 withMutationOptionsType: boolean;
20 addDocBlocks: boolean;
21 defaultBaseOptions: ReactApolloPluginConfigDefaultBaseOptions;
22 hooksSuffix: string;
23}
24export declare class ReactApolloVisitor extends ClientSideBaseVisitor<ReactApolloRawPluginConfig, ReactApolloPluginConfig> {
25 protected rawConfig: ReactApolloRawPluginConfig;
26 private _externalImportPrefix;
27 private imports;
28 constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: ReactApolloRawPluginConfig, documents: Types.DocumentFile[]);
29 private getImportStatement;
30 private getReactImport;
31 private getApolloReactCommonIdentifier;
32 private getApolloReactHooksIdentifier;
33 private usesExternalHooksOnly;
34 private getApolloReactCommonImport;
35 private getApolloReactComponentsImport;
36 private getApolloReactHocImport;
37 private getApolloReactHooksImport;
38 private getOmitDeclaration;
39 private getDefaultOptions;
40 private getDocumentNodeVariable;
41 getImports(): string[];
42 private _buildHocProps;
43 private _buildMutationFn;
44 private _buildOperationHoc;
45 private _buildComponent;
46 private _buildHooksJSDoc;
47 private _buildHooks;
48 private _getHookSuffix;
49 private _buildResultType;
50 private _buildWithMutationOptionsType;
51 private _buildRefetchFn;
52 protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string, hasRequiredVariables: boolean): string;
53 get fragments(): string;
54}