UNPKG

@graphql-codegen/typescript-vue-apollo-smart-ops

Version:

GraphQL Code Generator plugin for generating typed Vue-Apollo Smart Query and mutation functions based on GraphQL operations

33 lines (32 loc) 1.79 kB
import { GraphQLSchema, OperationDefinitionNode } from 'graphql'; import { Types } from '@graphql-codegen/plugin-helpers'; import { ClientSideBasePluginConfig, ClientSideBaseVisitor, LoadedFragment } from '@graphql-codegen/visitor-plugin-common'; import { VueApolloSmartOpsRawPluginConfig } from './config.js'; export interface VueApolloSmartOpsPluginConfig extends ClientSideBasePluginConfig { withSmartOperationFunctions: boolean; vueApolloOperationFunctionsImportFrom: 'vue-apollo-smart-ops' | string; vueApolloErrorType: 'ApolloError' | string; vueApolloErrorTypeImportFrom: 'apollo-client' | string; vueApolloErrorHandlerFunction?: string; vueApolloErrorHandlerFunctionImportFrom?: string; vueAppType?: string; vueAppTypeImportFrom?: string; addDocBlocks: boolean; } type OperationTypeName = 'Query' | 'Mutation' | 'Subscription'; export declare class VueApolloVisitor extends ClientSideBaseVisitor<VueApolloSmartOpsRawPluginConfig, VueApolloSmartOpsPluginConfig> { private externalImportPrefix; private imports; constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: VueApolloSmartOpsRawPluginConfig, documents: Types.DocumentFile[]); private get vueApolloOperationFunctionsImport(); private get vueApolloErrorTypeImport(); private get vueApolloErrorHandlerFunctionImport(); private get vueAppTypeImport(); private getDocumentNodeVariable; getImports(): string[]; private buildOperationFunctionsJSDoc; private getOperationFunctionSuffix; protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: OperationTypeName, operationResultType: string, operationVariablesTypes: string): string; private buildOperationFunction; } export {};