@graphql-codegen/visitor-plugin-common
- Version 4.0.1
- Published
- 537 kB
- 10 dependencies
- MIT license
Install
npm i @graphql-codegen/visitor-plugin-common
yarn add @graphql-codegen/visitor-plugin-common
pnpm add @graphql-codegen/visitor-plugin-common
Overview
Overview not available.
Index
Variables
Functions
- block()
- breakLine()
- buildMapperImport()
- buildScalars()
- buildScalarsFromConfig()
- clearExtension()
- convertFactory()
- convertNameParts()
- fixLocalFilePath()
- flatten()
- generateFragmentImportStatement()
- generateImportStatement()
- getBaseTypeNode()
- getConfigValue()
- getFieldNodeNameValue()
- getPossibleTypes()
- getRootTypeNames()
- groupBy()
- hasConditionalDirectives()
- hasIncrementalDeliveryDirectives()
- indent()
- indentMultiline()
- isExternalMapper()
- isExternalMapperType()
- isOneOfInputObjectType()
- mergeSelectionSets()
- normalizeAvoidOptionals()
- normalizeDeclarationKind()
- optimizeOperations()
- parseEnumValues()
- parseMapper()
- quoteIfNeeded()
- removeDescription()
- resolveImportSource()
- resolveRelativeImport()
- separateSelectionSet()
- stripMapperTypeInterpolation()
- transformComment()
- transformDirectiveArgumentAndInputFieldMappings()
- transformMappers()
- unique()
- wrapTypeNodeWithModifiers()
- wrapTypeWithModifiers()
- wrapWithSingleQuotes()
Classes
BaseResolversVisitor
- applyMaybe()
- applyOptionalFields()
- applyRequireFields()
- applyResolverTypeWrapper()
- buildEnumResolverContentBlock()
- buildEnumResolversExplicitMappedValues()
- buildResolversInterfaceTypes()
- buildResolversParentTypes()
- buildResolversTypes()
- buildResolversUnionTypes()
- clearMaybe()
- clearResolverTypeWrapper()
- convertName()
- createDirectivedContextType()
- createFieldContextTypeMap()
- createResolversFields()
- createResolversInterfaceTypes()
- createResolversUnionTypes()
- defaultMapperType
- DirectiveDefinition()
- EnumTypeDefinition()
- FieldDefinition()
- formatRootResolver()
- getAbstractMembersType()
- getAllDirectiveResolvers()
- getParentTypeForSignature()
- getParentTypeToUse()
- getResolverTypeWrapperSignature()
- getRootResolver()
- getTypeToUse()
- globalDeclarations
- hasFederation()
- hasScalars()
- InterfaceTypeDefinition()
- isMapperImported()
- ListType()
- mappersImports
- markMapperAsUsed()
- Name()
- NamedType()
- NonNullType()
- ObjectTypeDefinition()
- replaceFieldsInType()
- ScalarTypeDefinition()
- schema
- SchemaDefinition()
- setDeclarationBlockConfig()
- setVariablesTransformer()
- shouldMapType()
- transformParentGenericType()
- UnionTypeDefinition()
- unusedMappers
- wrapWithArray()
BaseTypesVisitor
- appendInterfacesAndFieldsToBlock()
- buildArgumentsBlock()
- buildEnumValuesBlock()
- directiveArgumentAndInputFieldMappingsDefinition
- DirectiveDefinition()
- EnumTypeDefinition()
- FieldDefinition()
- getArgumentsObjectDeclarationBlock()
- getArgumentsObjectTypeDefinition()
- getDeprecationReason()
- getDirectiveArgumentAndInputFieldMappingsImports()
- getEntireFieldWrapperValue()
- getEnumsImports()
- getExportPrefix()
- getFieldWrapperValue()
- getInputObjectDeclarationBlock()
- getInputObjectOneOfDeclarationBlock()
- getInterfaceTypeDeclarationBlock()
- getNodeComment()
- getObjectTypeDeclarationBlock()
- getScalarsImports()
- handleEnumValueMapper()
- InputObjectTypeDefinition()
- InputValueDefinition()
- InterfaceTypeDefinition()
- ListType()
- makeValidEnumIdentifier()
- mergeAllFields()
- mergeInterfaces()
- Name()
- NamedType()
- NonNullType()
- ObjectTypeDefinition()
- scalarsDefinition
- ScalarTypeDefinition()
- SchemaDefinition()
- setArgumentsTransformer()
- setDeclarationBlockConfig()
- StringValue()
- UnionTypeDefinition()
- wrapWithListType()
Interfaces
ClientSideBasePluginConfig
- dedupeOperationSuffix
- documentMode
- documentNodeImport
- documentVariablePrefix
- documentVariableSuffix
- experimentalFragmentVariables
- fragmentVariablePrefix
- fragmentVariableSuffix
- globalNamespace
- gqlImport
- importDocumentNodeExternallyFrom
- importOperationTypesFrom
- noExport
- omitOperationSuffix
- operationResultSuffix
- optimizeDocumentNode
- pureMagicComment
- unstable_omitDefinitions
- unstable_onExecutableDocumentNode
ParsedResolversConfig
- addUnderscoreToArgsType
- allResolversTypeName
- avoidOptionals
- contextType
- defaultMapper
- directiveContextTypes
- directiveResolverMappings
- enumPrefix
- enumSuffix
- enumValues
- federation
- fieldContextTypes
- immutableTypes
- internalResolversPrefix
- mappers
- namespacedImportName
- onlyResolveTypeForInterfaces
- optionalResolveType
- resolversNonOptionalTypename
- resolverTypeSuffix
- resolverTypeWrapperSignature
- rootValueType
RawClientSideBasePluginConfig
- dedupeOperationSuffix
- documentMode
- documentNodeImport
- documentVariablePrefix
- documentVariableSuffix
- experimentalFragmentVariables
- fragmentVariablePrefix
- fragmentVariableSuffix
- gqlImport
- importDocumentNodeExternallyFrom
- importOperationTypesFrom
- noExport
- noGraphQLTag
- omitOperationSuffix
- operationResultSuffix
- optimizeDocumentNode
- pureMagicComment
RawResolversConfig
- addUnderscoreToArgsType
- allResolversTypeName
- avoidOptionals
- contextType
- defaultMapper
- directiveContextTypes
- directiveResolverMappings
- enumPrefix
- enumSuffix
- enumValues
- federation
- fieldContextTypes
- immutableTypes
- internalResolversPrefix
- mappers
- mapperTypeSuffix
- namespacedImportName
- onlyResolveTypeForInterfaces
- optionalResolveType
- resolversNonOptionalTypename
- resolverTypeSuffix
- resolverTypeWrapperSignature
- rootValueType
- showUnusedMappers
Enums
Type Aliases
- ConvertFn
- ConvertNameFn
- DeclarationKind
- DirectiveArgumentAndInputFieldMappings
- EnumValuesMap
- FragmentDirectives
- FragmentImport
- GetFragmentSuffixFn
- GroupedMappers
- ImportDeclaration
- ImportSource
- InlineFragmentTypeOptions
- LinkField
- LoadedFragment
- NameAndType
- NamingConvention
- NamingConventionFn
- NamingConventionResolvePath
- NormalizedScalarsMap
- ParsedDirectiveArgumentAndInputFieldMappings
- ParsedEnumValuesMap
- ParsedMapper
- ParsedScalarsMap
- PrimitiveAliasedFields
- PrimitiveField
- ProcessResult
- ResolverParentTypes
- ResolverTypes
- ScalarsMap
- SelectionSetProcessorConfig
Variables
variable DEFAULT_AVOID_OPTIONALS
const DEFAULT_AVOID_OPTIONALS: AvoidOptionalsConfig;
variable DEFAULT_DECLARATION_KINDS
const DEFAULT_DECLARATION_KINDS: DeclarationKindConfig;
variable DEFAULT_SCALARS
const DEFAULT_SCALARS: NormalizedScalarsMap;
variable OMIT_TYPE
const OMIT_TYPE: string;
variable REQUIRE_FIELDS_TYPE
const REQUIRE_FIELDS_TYPE: string;
Functions
function block
block: (array: any) => string;
function breakLine
breakLine: (str: string) => string;
function buildMapperImport
buildMapperImport: ( source: string, types: { identifier: string; asDefault?: boolean }[], useTypeImports: boolean) => string | null;
function buildScalars
buildScalars: ( schema: GraphQLSchema | undefined, scalarsMapping: ScalarsMap, defaultScalarsMapping?: NormalizedScalarsMap, defaultScalarType?: string | null) => ParsedScalarsMap;
function buildScalarsFromConfig
buildScalarsFromConfig: ( schema: GraphQLSchema | undefined, config: RawConfig, defaultScalarsMapping?: NormalizedScalarsMap, defaultScalarType?: string) => ParsedScalarsMap;
function clearExtension
clearExtension: (path: string) => string;
function convertFactory
convertFactory: (config: { namingConvention?: NamingConvention }) => ConvertFn;
function convertNameParts
convertNameParts: ( str: string, func: (str: string) => string, removeUnderscore?: boolean) => string;
function fixLocalFilePath
fixLocalFilePath: (path: string) => string;
function flatten
flatten: <T>(array: Array<Array<T>>) => Array<T>;
function generateFragmentImportStatement
generateFragmentImportStatement: ( statement: ImportDeclaration<FragmentImport>, kind: 'type' | 'document' | 'both') => string;
function generateImportStatement
generateImportStatement: (statement: ImportDeclaration) => string;
function getBaseTypeNode
getBaseTypeNode: (typeNode: TypeNode) => NamedTypeNode;
function getConfigValue
getConfigValue: <T = any>(value: T, defaultValue: T) => T;
function getFieldNodeNameValue
getFieldNodeNameValue: (node: FieldNode) => string;
function getPossibleTypes
getPossibleTypes: ( schema: GraphQLSchema, type: GraphQLNamedType) => GraphQLObjectType[];
function getRootTypeNames
getRootTypeNames: (schema: GraphQLSchema) => string[];
function groupBy
groupBy: <T>( array: Array<T>, key: (item: T) => string | number) => { [key: string]: T[] };
function hasConditionalDirectives
hasConditionalDirectives: (field: FieldNode) => boolean;
function hasIncrementalDeliveryDirectives
hasIncrementalDeliveryDirectives: (directives: DirectiveNode[]) => boolean;
function indent
indent: (str: string, count?: number) => string;
function indentMultiline
indentMultiline: (str: string, count?: number) => string;
function isExternalMapper
isExternalMapper: (value: string) => boolean;
function isExternalMapperType
isExternalMapperType: (m: ParsedMapper) => m is ExternalParsedMapper;
function isOneOfInputObjectType
isOneOfInputObjectType: ( namedType: GraphQLNamedType | null | undefined) => namedType is GraphQLInputObjectType;
function mergeSelectionSets
mergeSelectionSets: ( selectionSet1: SelectionSetNode, selectionSet2: SelectionSetNode) => SelectionSetNode;
merge selection sets into a new selection set without mutating the inputs.
function normalizeAvoidOptionals
normalizeAvoidOptionals: ( avoidOptionals?: boolean | AvoidOptionalsConfig) => AvoidOptionalsConfig;
function normalizeDeclarationKind
normalizeDeclarationKind: ( declarationKind?: DeclarationKind | DeclarationKindConfig) => DeclarationKindConfig;
function optimizeOperations
optimizeOperations: ( schema: GraphQLSchema, documents: Types.DocumentFile[], options?: { includeFragments: boolean }) => Types.DocumentFile[];
function parseEnumValues
parseEnumValues: ({ schema, mapOrStr, ignoreEnumValuesFromSchema,}: { schema: GraphQLSchema; mapOrStr: EnumValuesMap; ignoreEnumValuesFromSchema?: boolean;}) => ParsedEnumValuesMap;
function parseMapper
parseMapper: ( mapper: string, gqlTypeName?: string | null, suffix?: string) => ParsedMapper;
function quoteIfNeeded
quoteIfNeeded: (array: string[], joinWith?: string) => string;
function removeDescription
removeDescription: <T extends { description?: StringValueNode }>( nodes: readonly T[]) => (T & { description: any })[];
function resolveImportSource
resolveImportSource: <T>(source: string | ImportSource<T>) => ImportSource<T>;
function resolveRelativeImport
resolveRelativeImport: (from: string, to: string) => string;
function separateSelectionSet
separateSelectionSet: (selections: ReadonlyArray<SelectionNode>) => { fields: (FieldNode & FragmentDirectives)[]; spreads: FragmentSpreadNode[]; inlines: InlineFragmentNode[];};
function stripMapperTypeInterpolation
stripMapperTypeInterpolation: (identifier: string) => string;
function transformComment
transformComment: ( comment: string | StringValueNode, indentLevel?: number, disabled?: boolean) => string;
function transformDirectiveArgumentAndInputFieldMappings
transformDirectiveArgumentAndInputFieldMappings: ( rawDirectiveArgumentAndInputFieldMappings: DirectiveArgumentAndInputFieldMappings, directiveArgumentAndInputFieldMappingTypeSuffix?: string) => ParsedDirectiveArgumentAndInputFieldMappings;
function transformMappers
transformMappers: ( rawMappers: RawResolversConfig['mappers'], mapperTypeSuffix?: string) => ParsedResolversConfig['mappers'];
function unique
unique: <T>(array: Array<T>, key?: (item: T) => string | number) => Array<T>;
function wrapTypeNodeWithModifiers
wrapTypeNodeWithModifiers: (baseType: string, typeNode: TypeNode) => string;
function wrapTypeWithModifiers
wrapTypeWithModifiers: ( baseType: string, type: GraphQLOutputType | GraphQLNamedType, options: WrapModifiersOptions) => string;
function wrapWithSingleQuotes
wrapWithSingleQuotes: ( value: string | number | NameNode, skipNumericCheck?: boolean) => string;
Classes
class BaseDocumentsVisitor
class BaseDocumentsVisitor< TRawConfig extends RawDocumentsConfig = RawDocumentsConfig, TPluginConfig extends ParsedDocumentsConfig = ParsedDocumentsConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {}
constructor
constructor( rawConfig: RawDocumentsConfig, additionalConfig: ParsedDocumentsConfig, _schema: GraphQLSchema, defaultScalars?: NormalizedScalarsMap);
property addTypename
readonly addTypename: boolean;
property schema
readonly schema: GraphQLSchema;
method applyVariablesWrapper
protected applyVariablesWrapper: (variablesBlock: string) => string;
method FragmentDefinition
FragmentDefinition: (node: FragmentDefinitionNode) => string;
method getGlobalDeclarations
getGlobalDeclarations: (noExport?: boolean) => string[];
method OperationDefinition
OperationDefinition: (node: OperationDefinitionNode) => string;
method setDeclarationBlockConfig
setDeclarationBlockConfig: (config: DeclarationBlockConfig) => void;
method setSelectionSetHandler
setSelectionSetHandler: (handler: SelectionSetToObject) => void;
method setVariablesTransformer
setVariablesTransformer: ( variablesTransfomer: OperationVariablesToObject) => void;
class BaseResolversVisitor
class BaseResolversVisitor< TRawConfig extends RawResolversConfig = RawResolversConfig, TPluginConfig extends ParsedResolversConfig = ParsedResolversConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {}
constructor
constructor( rawConfig: RawResolversConfig, additionalConfig: ParsedResolversConfig, _schema: GraphQLSchema, defaultScalars?: NormalizedScalarsMap);
property defaultMapperType
readonly defaultMapperType: string;
property globalDeclarations
readonly globalDeclarations: string[];
property mappersImports
readonly mappersImports: string[];
property schema
readonly schema: GraphQLSchema;
property unusedMappers
readonly unusedMappers: string[];
method applyMaybe
protected applyMaybe: (str: string) => string;
method applyOptionalFields
protected applyOptionalFields: ( argsType: string, _fields: readonly InputValueDefinitionNode[]) => string;
method applyRequireFields
protected applyRequireFields: ( argsType: string, fields: InputValueDefinitionNode[]) => string;
method applyResolverTypeWrapper
protected applyResolverTypeWrapper: (str: string) => string;
method buildEnumResolverContentBlock
protected buildEnumResolverContentBlock: ( _node: EnumTypeDefinitionNode, _mappedEnumType: string) => string;
method buildEnumResolversExplicitMappedValues
protected buildEnumResolversExplicitMappedValues: ( _node: EnumTypeDefinitionNode, _valuesMapping: { [valueName: string]: string | number }) => string;
method buildResolversInterfaceTypes
buildResolversInterfaceTypes: () => string;
method buildResolversParentTypes
buildResolversParentTypes: () => string;
method buildResolversTypes
buildResolversTypes: () => string;
method buildResolversUnionTypes
buildResolversUnionTypes: () => string;
method clearMaybe
protected clearMaybe: (str: string) => string;
method clearResolverTypeWrapper
protected clearResolverTypeWrapper: (str: string) => string;
method convertName
convertName: ( node: ASTNode | string, options?: BaseVisitorConvertOptions & ConvertOptions, applyNamespacedImport?: boolean) => string;
method createDirectivedContextType
protected createDirectivedContextType: () => FieldContextTypeMap;
method createFieldContextTypeMap
protected createFieldContextTypeMap: () => FieldContextTypeMap;
method createResolversFields
protected createResolversFields: ({ applyWrapper, clearWrapper, getTypeToUse, currentType, shouldInclude,}: { applyWrapper: (str: string) => string; clearWrapper: (str: string) => string; getTypeToUse: (str: string) => string; currentType: 'ResolversTypes' | 'ResolversParentTypes'; shouldInclude?: (type: GraphQLNamedType) => boolean;}) => ResolverTypes;
method createResolversInterfaceTypes
protected createResolversInterfaceTypes: () => Record<string, string>;
method createResolversUnionTypes
protected createResolversUnionTypes: () => Record<string, string>;
method DirectiveDefinition
DirectiveDefinition: ( node: DirectiveDefinitionNode, key: string | number, parent: any) => string;
method EnumTypeDefinition
EnumTypeDefinition: (node: EnumTypeDefinitionNode) => string;
method FieldDefinition
FieldDefinition: ( node: FieldDefinitionNode, key: string | number, parent: any) => (parentName: string) => string | null;
method formatRootResolver
protected formatRootResolver: ( schemaTypeName: string, resolverType: string, declarationKind: DeclarationKind) => string;
method getAbstractMembersType
getAbstractMembersType: ({ typeName, memberTypes, isTypenameNonOptional,}: { typeName: string; memberTypes: readonly GraphQLObjectType[] | GraphQLObjectType[]; isTypenameNonOptional: boolean;}) => string;
Function to generate the types of Abstract Type Members i.e. Union Members or Interface Implementing Types
method getAllDirectiveResolvers
getAllDirectiveResolvers: () => string;
method getParentTypeForSignature
protected getParentTypeForSignature: (_node: FieldDefinitionNode) => string;
method getParentTypeToUse
protected getParentTypeToUse: (name: string) => string;
method getResolverTypeWrapperSignature
getResolverTypeWrapperSignature: () => string;
method getRootResolver
getRootResolver: () => string;
method getTypeToUse
protected getTypeToUse: (name: string) => string;
method hasFederation
hasFederation: () => boolean;
method hasScalars
hasScalars: () => boolean;
method InterfaceTypeDefinition
InterfaceTypeDefinition: (node: InterfaceTypeDefinitionNode) => string;
method isMapperImported
protected isMapperImported: ( groupedMappers: GroupedMappers, identifier: string, source: string) => boolean;
method ListType
ListType: (node: ListTypeNode) => string;
method markMapperAsUsed
protected markMapperAsUsed: (name: string) => void;
method Name
Name: (node: NameNode) => string;
method NamedType
NamedType: (node: NamedTypeNode) => string;
method NonNullType
NonNullType: (node: NonNullTypeNode) => string;
method ObjectTypeDefinition
ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => string;
method replaceFieldsInType
protected replaceFieldsInType: ( typeName: string, relevantFields: ReturnType<typeof this.getRelevantFieldsToOmit>) => string;
method ScalarTypeDefinition
ScalarTypeDefinition: (node: ScalarTypeDefinitionNode) => string;
method SchemaDefinition
SchemaDefinition: () => any;
method setDeclarationBlockConfig
setDeclarationBlockConfig: (config: DeclarationBlockConfig) => void;
method setVariablesTransformer
setVariablesTransformer: ( variablesTransfomer: OperationVariablesToObject) => void;
method shouldMapType
protected shouldMapType: ( type: GraphQLNamedType, duringCheck?: string[]) => boolean;
method transformParentGenericType
protected transformParentGenericType: (parentType: string) => string;
method UnionTypeDefinition
UnionTypeDefinition: ( node: UnionTypeDefinitionNode, key: string | number, parent: any) => string;
method wrapWithArray
protected wrapWithArray: (t: string) => string;
class BaseSelectionSetProcessor
class BaseSelectionSetProcessor<Config extends SelectionSetProcessorConfig> {}
constructor
constructor(config: SelectionSetProcessorConfig);
property config
config: SelectionSetProcessorConfig;
method buildFieldsIntoObject
buildFieldsIntoObject: (allObjectsMerged: string[]) => string;
method buildSelectionSetFromStrings
buildSelectionSetFromStrings: (pieces: string[]) => string;
method transformAliasesPrimitiveFields
transformAliasesPrimitiveFields: ( _schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveAliasedFields[], _unsetTypes?: boolean) => (string | NameAndType)[];
method transformLinkFields
transformLinkFields: ( _fields: LinkField[], _unsetTypes?: boolean) => (string | NameAndType)[];
method transformPrimitiveFields
transformPrimitiveFields: ( _schemaType: GraphQLObjectType | GraphQLInterfaceType, _fields: PrimitiveField[], _unsetTypes?: boolean) => (string | NameAndType)[];
method transformTypenameField
transformTypenameField: ( _type: string, _name: string) => (string | NameAndType)[];
class BaseTypesVisitor
class BaseTypesVisitor< TRawConfig extends RawTypesConfig = RawTypesConfig, TPluginConfig extends ParsedTypesConfig = ParsedTypesConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {}
constructor
constructor( _schema: GraphQLSchema, rawConfig: RawTypesConfig, additionalConfig: ParsedTypesConfig, defaultScalars?: NormalizedScalarsMap);
property directiveArgumentAndInputFieldMappingsDefinition
readonly directiveArgumentAndInputFieldMappingsDefinition: string;
property scalarsDefinition
readonly scalarsDefinition: string;
method appendInterfacesAndFieldsToBlock
appendInterfacesAndFieldsToBlock: ( block: DeclarationBlock, interfaces: string[], fields: string[]) => void;
method buildArgumentsBlock
protected buildArgumentsBlock: ( node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode) => string;
method buildEnumValuesBlock
protected buildEnumValuesBlock: ( typeName: string, values: ReadonlyArray<EnumValueDefinitionNode>) => string;
method DirectiveDefinition
DirectiveDefinition: (_node: DirectiveDefinitionNode) => string;
method EnumTypeDefinition
EnumTypeDefinition: (node: EnumTypeDefinitionNode) => string;
method FieldDefinition
FieldDefinition: (node: FieldDefinitionNode) => string;
method getArgumentsObjectDeclarationBlock
getArgumentsObjectDeclarationBlock: ( node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode, name: string, field: FieldDefinitionNode) => DeclarationBlock;
method getArgumentsObjectTypeDefinition
getArgumentsObjectTypeDefinition: ( node: InterfaceTypeDefinitionNode | ObjectTypeDefinitionNode, name: string, field: FieldDefinitionNode) => string;
method getDeprecationReason
protected getDeprecationReason: (directive: DirectiveNode) => string | void;
method getDirectiveArgumentAndInputFieldMappingsImports
getDirectiveArgumentAndInputFieldMappingsImports: () => string[];
method getEntireFieldWrapperValue
getEntireFieldWrapperValue: () => string;
method getEnumsImports
getEnumsImports: () => string[];
method getExportPrefix
protected getExportPrefix: () => string;
method getFieldWrapperValue
getFieldWrapperValue: () => string;
method getInputObjectDeclarationBlock
getInputObjectDeclarationBlock: ( node: InputObjectTypeDefinitionNode) => DeclarationBlock;
method getInputObjectOneOfDeclarationBlock
getInputObjectOneOfDeclarationBlock: ( node: InputObjectTypeDefinitionNode) => DeclarationBlock;
method getInterfaceTypeDeclarationBlock
getInterfaceTypeDeclarationBlock: ( node: InterfaceTypeDefinitionNode, _originalNode: InterfaceTypeDefinitionNode) => DeclarationBlock;
method getNodeComment
getNodeComment: ( node: | FieldDefinitionNode | EnumValueDefinitionNode | InputValueDefinitionNode) => string;
method getObjectTypeDeclarationBlock
getObjectTypeDeclarationBlock: ( node: ObjectTypeDefinitionNode, originalNode: ObjectTypeDefinitionNode) => DeclarationBlock;
method getScalarsImports
getScalarsImports: () => string[];
method handleEnumValueMapper
protected handleEnumValueMapper: ( typeIdentifier: string, importIdentifier: string | null, sourceIdentifier: string | null, sourceFile: string | null) => string[];
method InputObjectTypeDefinition
InputObjectTypeDefinition: (node: InputObjectTypeDefinitionNode) => string;
method InputValueDefinition
InputValueDefinition: (node: InputValueDefinitionNode) => string;
method InterfaceTypeDefinition
InterfaceTypeDefinition: ( node: InterfaceTypeDefinitionNode, key: number | string, parent: any) => string;
method ListType
ListType: ( node: ListTypeNode, _key: any, _parent: any, _path: any, _ancestors: any) => string;
method makeValidEnumIdentifier
protected makeValidEnumIdentifier: (identifier: string) => string;
method mergeAllFields
protected mergeAllFields: ( allFields: string[], _hasInterfaces: boolean) => string;
method mergeInterfaces
protected mergeInterfaces: ( interfaces: string[], hasOtherFields: boolean) => string;
method Name
Name: (node: NameNode) => string;
method NamedType
NamedType: ( node: NamedTypeNode, key: any, parent: any, path: any, ancestors: any) => string;
method NonNullType
NonNullType: (node: NonNullTypeNode) => string;
method ObjectTypeDefinition
ObjectTypeDefinition: ( node: ObjectTypeDefinitionNode, key: number | string, parent: any) => string;
method ScalarTypeDefinition
ScalarTypeDefinition: (_node: ScalarTypeDefinitionNode) => string;
method SchemaDefinition
SchemaDefinition: () => any;
method setArgumentsTransformer
setArgumentsTransformer: ( argumentsTransfomer: OperationVariablesToObject) => void;
method setDeclarationBlockConfig
setDeclarationBlockConfig: (config: DeclarationBlockConfig) => void;
method StringValue
StringValue: (node: StringValueNode) => string;
method UnionTypeDefinition
UnionTypeDefinition: ( node: UnionTypeDefinitionNode, key: string | number | undefined, parent: any) => string;
method wrapWithListType
protected wrapWithListType: (str: string) => string;
class BaseVisitor
class BaseVisitor< TRawConfig extends RawConfig = RawConfig, TPluginConfig extends ParsedConfig = ParsedConfig> {}
constructor
constructor(rawConfig: RawConfig, additionalConfig: Partial<TPluginConfig>);
property config
readonly config: ParsedConfig;
property scalars
readonly scalars: NormalizedScalarsMap;
method convertName
convertName: ( node: ASTNode | string, options?: BaseVisitorConvertOptions & ConvertOptions) => string;
method getFragmentName
getFragmentName: (node: FragmentDefinitionNode | string) => string;
method getFragmentSuffix
getFragmentSuffix: (node: FragmentDefinitionNode | string) => string;
method getFragmentVariableName
getFragmentVariableName: (node: FragmentDefinitionNode | string) => string;
method getOperationSuffix
getOperationSuffix: ( node: FragmentDefinitionNode | OperationDefinitionNode | string, operationType: string) => string;
method getPunctuation
protected getPunctuation: (_declarationKind: DeclarationKind) => string;
method getVisitorKindContextFromAncestors
protected getVisitorKindContextFromAncestors: (ancestors: ASTNode[]) => string[];
class ClientSideBaseVisitor
class ClientSideBaseVisitor< TRawConfig extends RawClientSideBasePluginConfig = RawClientSideBasePluginConfig, TPluginConfig extends ClientSideBasePluginConfig = ClientSideBasePluginConfig> extends BaseVisitor<TRawConfig, TPluginConfig> {}
constructor
constructor( _schema: GraphQLSchema, fragments: { name: string; onType: string; node: FragmentDefinitionNode; isExternal: boolean; importFrom?: string; }[], rawConfig: RawClientSideBasePluginConfig, additionalConfig: Partial<TPluginConfig>, documents?: Types.DocumentFile[]);
property fragments
readonly fragments: string;
method buildOperation
protected buildOperation: ( _node: OperationDefinitionNode, _documentVariableName: string, _operationType: string, _operationResultType: string, _operationVariablesTypes: string, _hasRequiredVariables: boolean) => string;
method checkVariablesRequirements
protected checkVariablesRequirements: (node: OperationDefinitionNode) => boolean;
Checks if the specific operation has variables that are non-null (required), and also doesn't have default. This is useful for deciding of
variables
should be optional or not.Parameter node
method getDocumentNodeSignature
protected getDocumentNodeSignature: ( _resultType: string, _variablesTypes: string, _node: FragmentDefinitionNode | OperationDefinitionNode) => string;
method getImports
getImports: (options?: { excludeFragments?: boolean }) => string[];
method getOperationVariableName
getOperationVariableName: (node: OperationDefinitionNode) => string;
method OperationDefinition
OperationDefinition: (node: OperationDefinitionNode) => string;
class DeclarationBlock
class DeclarationBlock {}
constructor
constructor(_config: DeclarationBlockConfig);
property string
readonly string: string;
method asKind
asKind: (kind: string) => DeclarationBlock;
method export
export: (exp?: boolean) => DeclarationBlock;
method withBlock
withBlock: (block: string) => DeclarationBlock;
method withComment
withComment: ( comment: string | StringValueNode | null, disabled?: boolean) => DeclarationBlock;
method withContent
withContent: (content: string) => DeclarationBlock;
method withDecorator
withDecorator: (decorator: string) => DeclarationBlock;
method withMethodCall
withMethodCall: ( methodName: string, ignoreBlockWrapper?: boolean) => DeclarationBlock;
method withName
withName: ( name: string | NameNode, generics?: string | null) => DeclarationBlock;
class OperationVariablesToObject
class OperationVariablesToObject {}
constructor
constructor( _scalars: NormalizedScalarsMap, _convertName: ConvertNameFn<BaseVisitorConvertOptions>, _namespacedImportName?: string, _enumNames?: string[], _enumPrefix?: boolean, _enumSuffix?: boolean, _enumValues?: ParsedEnumValuesMap, _applyCoercion?: boolean, _directiveArgumentAndInputFieldMappings?: ParsedDirectiveArgumentAndInputFieldMappings);
method formatFieldString
protected formatFieldString: ( fieldName: string, _isNonNullType: boolean, _hasDefaultValue: boolean) => string;
method formatTypeString
protected formatTypeString: ( fieldType: string, isNonNullType: boolean, hasDefaultValue: boolean) => string;
method getDirectiveMapping
protected getDirectiveMapping: (name: string) => string;
method getDirectiveOverrideType
protected getDirectiveOverrideType: ( directives: ReadonlyArray<DirectiveNode>) => string | null;
method getName
getName: <TDefinitionType extends InterfaceOrVariable>( node: TDefinitionType) => string;
method getPunctuation
protected getPunctuation: () => string;
method getScalar
protected getScalar: (name: string) => string;
method transform
transform: <TDefinitionType extends InterfaceOrVariable>( variablesNode: ReadonlyArray<TDefinitionType>) => string;
method transformVariable
protected transformVariable: <TDefinitionType extends InterfaceOrVariable>( variable: TDefinitionType) => string;
method wrapAstTypeWithModifiers
wrapAstTypeWithModifiers: ( _baseType: string, _typeNode: TypeNode, _applyCoercion?: Boolean) => string;
class PreResolveTypesProcessor
class PreResolveTypesProcessor extends BaseSelectionSetProcessor<SelectionSetProcessorConfig> {}
method transformAliasesPrimitiveFields
transformAliasesPrimitiveFields: ( schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveAliasedFields[], unsetTypes?: boolean) => (string | NameAndType)[];
method transformLinkFields
transformLinkFields: ( fields: LinkField[], unsetTypes?: boolean) => (string | NameAndType)[];
method transformPrimitiveFields
transformPrimitiveFields: ( schemaType: GraphQLObjectType | GraphQLInterfaceType, fields: PrimitiveField[], unsetTypes?: boolean) => (string | NameAndType)[];
method transformTypenameField
transformTypenameField: (type: string, name: string) => (string | NameAndType)[];
class SelectionSetToObject
class SelectionSetToObject< Config extends ParsedDocumentsConfig = ParsedDocumentsConfig> {}
constructor
constructor( _processor: BaseSelectionSetProcessor<any>, _scalars: NormalizedScalarsMap, _schema: GraphQLSchema, _convertName: ConvertNameFn<BaseVisitorConvertOptions>, _getFragmentSuffix: GetFragmentSuffixFn, _loadedFragments: { name: string; onType: string; node: FragmentDefinitionNode; isExternal: boolean; importFrom?: string; }[], _config: ParsedDocumentsConfig, _parentSchemaType?: GraphQLNamedType, _selectionSet?: SelectionSetNode);
method buildFragmentSpreadsUsage
protected buildFragmentSpreadsUsage: ( spreads: FragmentSpreadNode[]) => Record<string, FragmentSpreadUsage[]>;
method buildFragmentTypeName
protected buildFragmentTypeName: ( name: string, suffix: string, typeName?: string) => string;
method buildSelectionSet
protected buildSelectionSet: ( parentSchemaType: GraphQLObjectType, selectionNodes: Array<SelectionNode | FragmentSpreadUsage | DirectiveNode>, options?: { unsetTypes: boolean }) => { typeInfo: { name: string; type: string }; fields: string[] };
method buildTypeNameField
protected buildTypeNameField: ( type: GraphQLObjectType, nonOptionalTypename?: boolean, addTypename?: boolean, queriedForTypename?: boolean, skipTypeNameForRoot?: boolean) => { name: string; type: string };
method createNext
createNext: ( parentSchemaType: GraphQLNamedType, selectionSet: SelectionSetNode) => SelectionSetToObject;
method flattenSelectionSet
protected flattenSelectionSet: ( selections: ReadonlyArray<SelectionNode>, parentSchemaType?: GraphQLObjectType<any, any>) => Map<string, Array<SelectionNode | FragmentSpreadUsage>>;
method getEmptyObjectType
protected getEmptyObjectType: () => string;
method getUnknownType
protected getUnknownType: () => string;
method selectionSetStringFromFields
protected selectionSetStringFromFields: ( fields: (string | NameAndType)[]) => string | null;
method transformFragmentSelectionSetToTypes
transformFragmentSelectionSetToTypes: ( fragmentName: string, fragmentSuffix: string, declarationBlockConfig: any) => string;
method transformSelectionSet
transformSelectionSet: () => string;
Interfaces
interface AvoidOptionalsConfig
interface AvoidOptionalsConfig {}
property defaultValue
defaultValue?: boolean;
property field
field?: boolean;
property inputValue
inputValue?: boolean;
property object
object?: boolean;
property resolvers
resolvers?: boolean;
interface BaseVisitorConvertOptions
interface BaseVisitorConvertOptions {}
property useTypesPrefix
useTypesPrefix?: boolean;
property useTypesSuffix
useTypesSuffix?: boolean;
interface ClientSideBasePluginConfig
interface ClientSideBasePluginConfig extends ParsedConfig {}
property dedupeOperationSuffix
dedupeOperationSuffix: boolean;
property documentMode
documentMode?: DocumentMode;
property documentNodeImport
documentNodeImport: string;
property documentVariablePrefix
documentVariablePrefix: string;
property documentVariableSuffix
documentVariableSuffix: string;
property experimentalFragmentVariables
experimentalFragmentVariables?: boolean;
property fragmentVariablePrefix
fragmentVariablePrefix: string;
property fragmentVariableSuffix
fragmentVariableSuffix: string;
property globalNamespace
globalNamespace?: boolean;
property gqlImport
gqlImport: string;
property importDocumentNodeExternallyFrom
importDocumentNodeExternallyFrom?: 'near-operation-file' | string;
property importOperationTypesFrom
importOperationTypesFrom?: string;
property noExport
noExport: boolean;
property omitOperationSuffix
omitOperationSuffix: boolean;
property operationResultSuffix
operationResultSuffix: string;
property optimizeDocumentNode
optimizeDocumentNode: boolean;
property pureMagicComment
pureMagicComment?: boolean;
property unstable_omitDefinitions
unstable_omitDefinitions?: boolean;
property unstable_onExecutableDocumentNode
unstable_onExecutableDocumentNode?: Unstable_OnExecutableDocumentNode;
interface ConvertOptions
interface ConvertOptions {}
property prefix
prefix?: string;
property suffix
suffix?: string;
property transformUnderscore
transformUnderscore?: boolean;
interface DeclarationBlockConfig
interface DeclarationBlockConfig {}
property blockTransformer
blockTransformer?: (block: string) => string;
property blockWrapper
blockWrapper?: string;
property enumNameValueSeparator
enumNameValueSeparator?: string;
property ignoreExport
ignoreExport?: boolean;
interface DeclarationKindConfig
interface DeclarationKindConfig {}
interface ExternalParsedMapper
interface ExternalParsedMapper {}
property default
default: boolean;
property import
import: string;
property isExternal
isExternal: true;
property source
source: string;
property type
type: string;
interface InterfaceOrVariable
interface InterfaceOrVariable {}
property defaultValue
defaultValue?: ValueNode;
property directives
directives?: ReadonlyArray<DirectiveNode>;
property name
name?: NameNode;
property type
type: TypeNode;
property variable
variable?: VariableNode;
interface InternalParsedMapper
interface InternalParsedMapper {}
property isExternal
isExternal: false;
property type
type: string;
interface NamingConventionMap
interface NamingConventionMap {}
false
property enumValues
enumValues?: 'keep' | NamingConventionResolvePath | NamingConventionFn;
property transformUnderscore
transformUnderscore?: boolean;
property typeNames
typeNames?: 'keep' | NamingConventionResolvePath | NamingConventionFn;
interface ParsedConfig
interface ParsedConfig {}
property addTypename
addTypename: boolean;
property allowEnumStringTypes
allowEnumStringTypes: boolean;
property convert
convert: ConvertFn;
property dedupeFragments
dedupeFragments: boolean;
property emitLegacyCommonJSImports
emitLegacyCommonJSImports: boolean;
property externalFragments
externalFragments: LoadedFragment[];
property fragmentImports
fragmentImports: ImportDeclaration<FragmentImport>[];
property immutableTypes
immutableTypes: boolean;
property inlineFragmentTypes
inlineFragmentTypes: InlineFragmentTypeOptions;
property nonOptionalTypename
nonOptionalTypename: boolean;
property scalars
scalars: ParsedScalarsMap;
property typesPrefix
typesPrefix: string;
property typesSuffix
typesSuffix: string;
property useTypeImports
useTypeImports: boolean;
interface ParsedDocumentsConfig
interface ParsedDocumentsConfig extends ParsedTypesConfig {}
property addTypename
addTypename: boolean;
property dedupeOperationSuffix
dedupeOperationSuffix: boolean;
property experimentalFragmentVariables
experimentalFragmentVariables: boolean;
property exportFragmentSpreadSubTypes
exportFragmentSpreadSubTypes: boolean;
property globalNamespace
globalNamespace: boolean;
property mergeFragmentTypes
mergeFragmentTypes: boolean;
property namespacedImportName
namespacedImportName: string | null;
property omitOperationSuffix
omitOperationSuffix: boolean;
property operationResultSuffix
operationResultSuffix: string;
property preResolveTypes
preResolveTypes: boolean;
property skipTypeNameForRoot
skipTypeNameForRoot: boolean;
interface ParsedImport
interface ParsedImport {}
property moduleName
moduleName: string | null;
property propName
propName: string;
interface ParsedResolversConfig
interface ParsedResolversConfig extends ParsedConfig {}
property addUnderscoreToArgsType
addUnderscoreToArgsType: boolean;
property allResolversTypeName
allResolversTypeName: string;
property avoidOptionals
avoidOptionals: AvoidOptionalsConfig | boolean;
property contextType
contextType: ParsedMapper;
property defaultMapper
defaultMapper: ParsedMapper | null;
property directiveContextTypes
directiveContextTypes: Array<string>;
property directiveResolverMappings
directiveResolverMappings: Record<string, string>;
property enumPrefix
enumPrefix: boolean;
property enumSuffix
enumSuffix: boolean;
property enumValues
enumValues: ParsedEnumValuesMap;
property federation
federation: boolean;
property fieldContextTypes
fieldContextTypes: Array<string>;
property immutableTypes
immutableTypes: boolean;
property internalResolversPrefix
internalResolversPrefix: string;
property mappers
mappers: { [typeName: string]: ParsedMapper;};
property namespacedImportName
namespacedImportName: string;
property onlyResolveTypeForInterfaces
onlyResolveTypeForInterfaces: boolean;
property optionalResolveType
optionalResolveType: boolean;
property resolversNonOptionalTypename
resolversNonOptionalTypename: ResolversNonOptionalTypenameConfig;
property resolverTypeSuffix
resolverTypeSuffix: string;
property resolverTypeWrapperSignature
resolverTypeWrapperSignature: string;
property rootValueType
rootValueType: ParsedMapper;
interface ParsedTypesConfig
interface ParsedTypesConfig extends ParsedConfig {}
property addUnderscoreToArgsType
addUnderscoreToArgsType: boolean;
property declarationKind
declarationKind: DeclarationKindConfig;
property directiveArgumentAndInputFieldMappings
directiveArgumentAndInputFieldMappings: ParsedDirectiveArgumentAndInputFieldMappings;
property entireFieldWrapperValue
entireFieldWrapperValue: string;
property enumPrefix
enumPrefix: boolean;
property enumSuffix
enumSuffix: boolean;
property enumValues
enumValues: ParsedEnumValuesMap;
property fieldWrapperValue
fieldWrapperValue: string;
property ignoreEnumValuesFromSchema
ignoreEnumValuesFromSchema: boolean;
property onlyEnums
onlyEnums: boolean;
property onlyOperationTypes
onlyOperationTypes: boolean;
property wrapEntireDefinitions
wrapEntireDefinitions: boolean;
property wrapFieldDefinitions
wrapFieldDefinitions: boolean;
interface RawClientSideBasePluginConfig
interface RawClientSideBasePluginConfig extends RawConfig {}
property dedupeOperationSuffix
dedupeOperationSuffix?: boolean;
false Set this configuration to
true
if you wish to make sure to remove duplicate operation name suffix.
property documentMode
documentMode?: DocumentMode;
graphQLTag Declares how DocumentNode are created:
-
graphQLTag
:graphql-tag
or other modules (checkgqlImport
) will be used to generate document nodes. If this is used, document nodes are generated on client side i.e. the module used to generate this will be shipped to the client -documentNode
: document nodes will be generated as objects when we generate the templates. -documentNodeImportFragments
: Similar to documentNode except it imports external fragments instead of embedding them. -external
: document nodes are imported from an external file. To be used withimportDocumentNodeExternallyFrom
Note that some plugins (like
typescript-graphql-request
) also supportsstring
for this parameter.
property documentNodeImport
documentNodeImport?: string;
graphql#DocumentNode Customize from which module will
DocumentNode
be imported from. This is useful if you want to use modules other thangraphql
, e.g.@graphql-typed-document-node
.
property documentVariablePrefix
documentVariablePrefix?: string;
"" Changes the GraphQL operations variables prefix.
property documentVariableSuffix
documentVariableSuffix?: string;
Document Changes the GraphQL operations variables suffix.
property experimentalFragmentVariables
experimentalFragmentVariables?: boolean;
false If set to true, it will enable support for parsing variables on fragments.
property fragmentVariablePrefix
fragmentVariablePrefix?: string;
"" Changes the GraphQL fragments variables prefix.
property fragmentVariableSuffix
fragmentVariableSuffix?: string;
FragmentDoc Changes the GraphQL fragments variables suffix.
property gqlImport
gqlImport?: string;
graphql-tag#gql Customize from which module will
gql
be imported from. This is useful if you want to use modules other thangraphql-tag
, e.g.graphql.macro
.## graphql.macro
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {gqlImport: 'graphql.macro#gql'},},},};export default config;## Gatsby
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {gqlImport: 'gatsby#graphql'},},},};export default config;
property importDocumentNodeExternallyFrom
importDocumentNodeExternallyFrom?: string;
"" This config should be used if
documentMode
isexternal
. This has 2 usage:- any string: This would be the path to import document nodes from. This can be used if we want to manually create the document nodes e.g. Use
graphql-tag
in a separate file and export the generated document - 'near-operation-file': This is a special mode that is intended to be used withnear-operation-file
preset to import document nodes from those files. If these files are.graphql
files, we make use of webpack loader.import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {documentMode: 'external',importDocumentNodeExternallyFrom: 'path/to/document-node-file',},},},};export default config;import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {documentMode: 'external',importDocumentNodeExternallyFrom: 'near-operation-file',},},},};export default config;
property importOperationTypesFrom
importOperationTypesFrom?: string;
"" This config is used internally by presets, but you can use it manually to tell codegen to prefix all base types that it's using. This is useful if you wish to generate base types from
typescript-operations
plugin into a different file, and import it from there.
property noExport
noExport?: boolean;
false Set this configuration to
true
if you wish to tell codegen to generate code with noexport
identifier.
property noGraphQLTag
noGraphQLTag?: boolean;
Deprecated. Changes the documentMode to
documentNode
. false
property omitOperationSuffix
omitOperationSuffix?: boolean;
false Set this configuration to
true
if you wish to disable auto add suffix of operation name, likeQuery
,Mutation
,Subscription
,Fragment
.
property operationResultSuffix
operationResultSuffix?: string;
"" Adds a suffix to generated operation result type names
property optimizeDocumentNode
optimizeDocumentNode?: boolean;
true If you are using
documentNode: documentMode | documentNodeImportFragments
, you can set this totrue
to apply document optimizations for your GraphQL document. This will remove all "loc" and "description" fields from the compiled document, and will remove all empty arrays (such asdirectives
,arguments
andvariableDefinitions
).
property pureMagicComment
pureMagicComment?: boolean;
false This config adds PURE magic comment to the static variables to enforce treeshaking for your bundler.
interface RawConfig
interface RawConfig {}
property allowEnumStringTypes
allowEnumStringTypes?: boolean;
property dedupeFragments
dedupeFragments?: boolean;
Removes fragment duplicates for reducing data transfer. It is done by removing sub-fragments imports from fragment definition Instead - all of them are imported to the Operation node. boolean false
Deprecated
This option is no longer needed. It will be removed in the next major version.
property defaultScalarType
defaultScalarType?: string;
Allows you to override the type that unknown scalars will have. any
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {defaultScalarType: 'unknown'},},},};export default config;
property emitLegacyCommonJSImports
emitLegacyCommonJSImports?: boolean;
true Emit legacy common js imports. Default it will be
true
this way it ensure that generated code works with [non-compliant bundlers](https://github.com/dotansimha/graphql-code-generator/issues/8065).
property externalFragments
externalFragments?: LoadedFragment[];
property fragmentImports
fragmentImports?: ImportDeclaration<FragmentImport>[];
property globalNamespace
globalNamespace?: boolean;
property inlineFragmentTypes
inlineFragmentTypes?: InlineFragmentTypeOptions;
Whether fragment types should be inlined into other operations. "inline" is the default behavior and will perform deep inlining fragment types within operation type definitions. "combine" is the previous behavior that uses fragment type references without inlining the types (and might cause issues with deeply nested fragment that uses list types).
string inline
property namingConvention
namingConvention?: NamingConvention;
change-case-all#pascalCase Allow you to override the naming convention of the output. You can either override all namings, or specify an object with specific custom naming convention per output. The format of the converter must be a valid
module#method
. Allowed values for specific output are:typeNames
,enumValues
. You can also use "keep" to keep all GraphQL names as-is. Additionally, you can settransformUnderscore
totrue
if you want to override the default behavior, which is to preserve underscores.Available case functions in
change-case-all
arecamelCase
,capitalCase
,constantCase
,dotCase
,headerCase
,noCase
,paramCase
,pascalCase
,pathCase
,sentenceCase
,snakeCase
,lowerCase
,localeLowerCase
,lowerCaseFirst
,spongeCase
,titleCase
,upperCase
,localeUpperCase
andupperCaseFirst
[See more](https://github.com/btxtiger/change-case-all)## Override All Names
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {namingConvention: 'change-case-all#lowerCase',},},},};export default config;## Upper-case enum values
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {namingConvention: {typeNames: 'change-case-all#pascalCase',enumValues: 'change-case-all#upperCase',}},},},};export default config;## Keep names as is
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {namingConvention: 'keep',},},},};export default config;## Remove Underscores
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {namingConvention: {typeNames: 'change-case-all#pascalCase',transformUnderscore: true}},},},};export default config;
property nonOptionalTypename
nonOptionalTypename?: boolean;
false Automatically adds
__typename
field to the generated types, even when they are not specified in the selection set, and makes it non-optionalimport type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {nonOptionalTypename: true},},},};export default config;
property scalars
scalars?: ScalarsMap;
Extends or overrides the built-in scalars and custom GraphQL scalars to a custom type.
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {scalars: {ID: {input: 'string',output: 'string | number'}DateTime: 'Date',JSON: '{ [key: string]: any }',}},},},};export default config;
property skipTypename
skipTypename?: boolean;
false Does not add
__typename
to the generated types, unless it was specified in the selection set.import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {skipTypename: true},},},};export default config;
property strictScalars
strictScalars?: boolean;
Makes scalars strict.
If scalars are found in the schema that are not defined in
scalars
an error will be thrown during codegen. falseimport type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {strictScalars: true,},},},};export default config;
property typesPrefix
typesPrefix?: string;
"" Prefixes all the generated types.
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {typesPrefix: 'I',},},},};export default config;
property typesSuffix
typesSuffix?: string;
"" Suffixes all the generated types.
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {typesSuffix: 'I',},},},};export default config;
property useTypeImports
useTypeImports?: boolean;
useTypeImports boolean false Will use
import type {}
rather thanimport {}
when importing only types. This gives compatibility with TypeScript's "importsNotUsedAsValues": "error" optionimport type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {useTypeImports: true},},},};export default config;
interface RawDocumentsConfig
interface RawDocumentsConfig extends RawTypesConfig {}
property dedupeOperationSuffix
dedupeOperationSuffix?: boolean;
false Set this configuration to
true
if you wish to make sure to remove duplicate operation name suffix.
property experimentalFragmentVariables
experimentalFragmentVariables?: boolean;
false If set to true, it will enable support for parsing variables on fragments.
property exportFragmentSpreadSubTypes
exportFragmentSpreadSubTypes?: boolean;
false If set to true, it will export the sub-types created in order to make it easier to access fields declared under fragment spread.
property globalNamespace
globalNamespace?: boolean;
false Puts all generated code under
global
namespace. Useful for Stencil integration.import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {globalNamespace: true},},},};export default config;
property mergeFragmentTypes
mergeFragmentTypes?: boolean;
false If set to true, merge equal fragment interfaces.
property namespacedImportName
namespacedImportName?: string;
property omitOperationSuffix
omitOperationSuffix?: boolean;
false Set this configuration to
true
if you wish to disable auto add suffix of operation name, likeQuery
,Mutation
,Subscription
,Fragment
.
property operationResultSuffix
operationResultSuffix?: string;
"" Adds a suffix to generated operation result type names
property preResolveTypes
preResolveTypes?: boolean;
true Uses primitive types where possible. Set to
false
in order to usePick
and take use the types generated bytypescript
plugin.import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {preResolveTypes: false},},},};export default config;
property skipTypeNameForRoot
skipTypeNameForRoot?: boolean;
false Avoid adding
__typename
for root types. This is ignored when a selection explicitly specifies__typename
.import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {skipTypeNameForRoot: true},},},};export default config;
interface RawResolversConfig
interface RawResolversConfig extends RawConfig {}
property addUnderscoreToArgsType
addUnderscoreToArgsType?: boolean;
Adds
_
to generatedArgs
types in order to avoid duplicate identifiers.import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {addUnderscoreToArgsType: true},},},};export default config;
property allResolversTypeName
allResolversTypeName?: string;
Resolvers The type name to use when exporting all resolvers signature as unified type.
property avoidOptionals
avoidOptionals?: boolean | AvoidOptionalsConfig;
This will cause the generator to avoid using optionals (
?
), so all field resolvers must be implemented in order to avoid compilation errors. false## Override all definition types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {avoidOptionals: true},},},};export default config;## Override only specific definition types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {avoidOptionals: {field: true,inputValue: true,object: true,defaultValue: true,}},},},};export default config;
property contextType
contextType?: string;
Use this configuration to set a custom type for your
context
, and it will affect all the resolvers, without the need to override it using generics each time. If you wish to use an external type and import it from another file, you can useadd
plugin and add the requiredimport
statement, or you can use amodule#type
syntax.## Custom Context Type
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {contextType: 'MyContext'},},},};export default config;## Custom Context Type by Path
Note that the path should be relative to the generated file.
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {contextType: './my-types#MyContext'},},},};export default config;
property defaultMapper
defaultMapper?: string;
Allow you to set the default mapper when it's not being override by
mappers
or generics. You can specify a type name, or specify a string inmodule#type
ormodule#namespace#type
format. The default value of mappers is the TypeScript type generated bytypescript
package.## Replace with any
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {defaultMapper: 'any',},},},};export default config;## Custom Base Object
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {defaultMapper: './my-file#BaseObject',},},},};export default config;## Wrap default types with Partial
You can also specify a custom wrapper for the original type, without overriding the original generated types, use
{T}
to specify the identifier. (for flow, use$Shape<{T}>
)import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {defaultMapper: 'Partial<{T}>',},},},};export default config;## Allow deep partial with
utility-types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver', { add: { content: "import { DeepPartial } from 'utility-types';" } }],config: {defaultMapper: 'DeepPartial<{T}>',},},},};export default config;
property directiveContextTypes
directiveContextTypes?: Array<string>;
Use this to set a custom type for a specific field
context
decorated by a directive. It will only affect the targeted resolvers. You can either useField.Path#ContextTypeName
orField.Path#ExternalFileName#ContextTypeName
ContextTypeName should by a generic Type that take the context or field context type as only type parameter.
## Directive Context Extender
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {directiveContextTypes: ['myCustomDirectiveName#./my-file#CustomContextExtender']},},},};export default config;
property directiveResolverMappings
directiveResolverMappings?: Record<string, string>;
property enumPrefix
enumPrefix?: boolean;
true Allow you to disable prefixing for generated enums, works in combination with
typesPrefix
.## Disable enum prefixes
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {typesPrefix: 'I',enumPrefix: false},},},};export default config;
property enumSuffix
enumSuffix?: boolean;
true Allow you to disable suffixing for generated enums, works in combination with
typesSuffix
.## Disable enum suffixes
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {typesSuffix: 'I',enumSuffix: false},},},};export default config;
property enumValues
enumValues?: EnumValuesMap;
Overrides the default value of enum values declared in your GraphQL schema, supported in this plugin because of the need for integration with
typescript
package. See documentation undertypescript
plugin for more information and examples.
property federation
federation?: boolean;
false Supports Apollo Federation
property fieldContextTypes
fieldContextTypes?: Array<string>;
Use this to set a custom type for a specific field
context
. It will only affect the targeted resolvers. You can either useField.Path#ContextTypeName
orField.Path#ExternalFileName#ContextTypeName
## Custom Field Context Types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {fieldContextTypes: ['MyType.foo#CustomContextType', 'MyType.bar#./my-file#ContextTypeOne']},},},};export default config;
property immutableTypes
immutableTypes?: boolean;
false Generates immutable types by adding
readonly
to properties and usesReadonlyArray
.
property internalResolversPrefix
internalResolversPrefix?: string;
string '__' Defines the prefix value used for
__resolveType
and__isTypeOf
resolvers. If you are usingmercurius-js
, please set this field to empty string for better compatibility.
property mappers
mappers?: { [typeName: string]: string;};
Replaces a GraphQL type usage with a custom type, allowing you to return custom object from your resolvers. You can use both
module#type
andmodule#namespace#type
syntax.## Custom Context Type
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {mappers: {User: './my-models#UserDbObject',Book: './my-models#Collections',}},},},};export default config;
property mapperTypeSuffix
mapperTypeSuffix?: string;
Adds a suffix to the imported names to prevent name clashes.
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {mapperTypeSuffix: 'Model'},},},};export default config;
property namespacedImportName
namespacedImportName?: string;
'' Prefixes all GraphQL related generated types with that value, as namespaces import. You can use this feature to allow separation of plugins to different files.
property onlyResolveTypeForInterfaces
onlyResolveTypeForInterfaces?: boolean;
boolean false Turning this flag to
true
will generate resolver signature that has onlyresolveType
for interfaces, forcing developers to write inherited type resolvers in the type itself.
property optionalResolveType
optionalResolveType?: boolean;
false Sets the
__resolveType
field as optional field.
property resolversNonOptionalTypename
resolversNonOptionalTypename?: boolean | ResolversNonOptionalTypenameConfig;
Makes
__typename
of resolver mappings non-optional without affecting the base types. false## Enable for all
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {resolversNonOptionalTypename: true // or { unionMember: true, interfaceImplementingType: true }},},},};export default config;## Enable except for some types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {resolversNonOptionalTypename: {unionMember: true,interfaceImplementingType: true,excludeTypes: ['MyType'],}},},},};export default config;
property resolverTypeSuffix
resolverTypeSuffix?: string;
Resolvers Suffix we add to each generated type resolver.
property resolverTypeWrapperSignature
resolverTypeWrapperSignature?: string;
Promise | T Allow you to override
resolverTypeWrapper
definition.
property rootValueType
rootValueType?: string;
Use this configuration to set a custom type for the
rootValue
, and it will affect resolvers of all root types (Query, Mutation and Subscription), without the need to override it using generics each time. If you wish to use an external type and import it from another file, you can useadd
plugin and add the requiredimport
statement, or you can use bothmodule#type
ormodule#namespace#type
syntax.## Custom RootValue Type
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {rootValueType: 'MyRootValue'},},},};export default config;## Custom RootValue Type
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {rootValueType: './my-types#MyRootValue'},},},};export default config;
property showUnusedMappers
showUnusedMappers?: boolean;
Warns about unused mappers. true
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {plugins: ['typescript', 'typescript-resolver'],config: {showUnusedMappers: true,},},},};export default config;
interface RawTypesConfig
interface RawTypesConfig extends RawConfig {}
property addUnderscoreToArgsType
addUnderscoreToArgsType?: boolean;
Adds
_
to generatedArgs
types in order to avoid duplicate identifiers.## With Custom Values
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {addUnderscoreToArgsType: true},},},};export default config;
property declarationKind
declarationKind?: DeclarationKind | DeclarationKindConfig;
Overrides the default output for various GraphQL elements.
## Override all declarations
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {declarationKind: 'interface'},},},};export default config;## Override only specific declarations
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {declarationKind: {type: 'interface',input: 'interface'}},},},};export default config;
property directiveArgumentAndInputFieldMappings
directiveArgumentAndInputFieldMappings?: DirectiveArgumentAndInputFieldMappings;
Replaces a GraphQL scalar with a custom type based on the applied directive on an argument or input field.
You can use both
module#type
andmodule#namespace#type
syntax. Will NOT work with introspected schemas since directives are not exported. Only works with directives on ARGUMENT_DEFINITION or INPUT_FIELD_DEFINITION.**WARNING:** Using this option does only change the type definitions.
For actually ensuring that a type is correct at runtime you will have to use schema transforms (e.g. with [@graphql-tools/utils mapSchema](https://graphql-tools.com/docs/schema-directives)) that apply those rules! Otherwise, you might end up with a runtime type mismatch which could cause unnoticed bugs or runtime errors.
Please use this configuration option with care!
## Custom Context Type\
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {directiveArgumentAndInputFieldMappings: {AsNumber: 'number',AsComplex: './my-models#Complex',}},},},};export default config;
property directiveArgumentAndInputFieldMappingTypeSuffix
directiveArgumentAndInputFieldMappingTypeSuffix?: string;
Adds a suffix to the imported names to prevent name clashes.
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {directiveArgumentAndInputFieldMappings: 'Model'},},},};export default config;
property entireFieldWrapperValue
entireFieldWrapperValue?: string;
entireFieldWrapperValue string Allow to override the type value of
EntireFieldWrapper
. This wrapper applies outside of Array and Maybe unlikefieldWrapperValue
, that will wrap the inner type. T | Promise | (() => T | Promise)Example 1
Only allow values
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {entireFieldWrapperValue: 'T',},},},};export default config;
property enumPrefix
enumPrefix?: boolean;
true Allow you to disable prefixing for generated enums, works in combination with
typesPrefix
.## Disable enum prefixes
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {typesPrefix: 'I',enumPrefix: false},},},};export default config;
property enumSuffix
enumSuffix?: boolean;
true Allow you to disable suffixing for generated enums, works in combination with
typesSuffix
.## Disable enum suffixes
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {typesSuffix: 'I',enumSuffix: false},},},};export default config;
property enumValues
enumValues?: EnumValuesMap;
Overrides the default value of enum values declared in your GraphQL schema. You can also map the entire enum to an external type by providing a string that of
module#type
.## With Custom Values
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {enumValues: {MyEnum: {A: 'foo'}}},},},};export default config;## With External Enum
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {enumValues: {MyEnum: './my-file#MyCustomEnum',}},},},};export default config;## Import All Enums from a file
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {enumValues: {MyEnum: './my-file',}},},},};export default config;
property fieldWrapperValue
fieldWrapperValue?: string;
Allow you to add wrapper for field type, use T as the generic value. Make sure to set
wrapFieldDefinitions
totrue
in order to make this flag work. T## Allow Promise
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {wrapFieldDefinitions: true,fieldWrapperValue: 'T | Promise<T>',},},},};export default config;
property ignoreEnumValuesFromSchema
ignoreEnumValuesFromSchema?: boolean;
This will cause the generator to ignore enum values defined in GraphQLSchema false
## Ignore enum values from schema
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {ignoreEnumValuesFromSchema: true,},},},};export default config;
property onlyEnums
onlyEnums?: boolean;
This will cause the generator to emit types for enums only false
## Override all definition types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {onlyEnums: true,},},},};export default config;
property onlyOperationTypes
onlyOperationTypes?: boolean;
This will cause the generator to emit types for operations only (basically only enums and scalars) false
## Override all definition types
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {onlyOperationTypes: true,},},},};export default config;
property wrapEntireFieldDefinitions
wrapEntireFieldDefinitions?: boolean;
wrapEntireFieldDefinitions boolean Set to
true
in order to wrap field definitions withEntireFieldWrapper
. This is useful to allow return types such as Promises and functions for fields. Differs fromwrapFieldDefinitions
in that this wraps the entire field definition if i.e. the field is an Array, whilewrapFieldDefinitions
will wrap every single value inside the array. trueExample 1
Enable wrapping entire fields
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {wrapEntireFieldDefinitions: false,},},},};export default config;
property wrapFieldDefinitions
wrapFieldDefinitions?: boolean;
Set to
true
in order to wrap field definitions withFieldWrapper
. This is useful to allow return types such as Promises and functions. false## Enable wrapping fields
import type { CodegenConfig } from '@graphql-codegen/cli';const config: CodegenConfig = {// ...generates: {'path/to/file': {// plugins...config: {wrapFieldDefinitions: true,},},},};export default config;
interface ResolversNonOptionalTypenameConfig
interface ResolversNonOptionalTypenameConfig {}
property excludeTypes
excludeTypes?: string[];
property interfaceImplementingType
interfaceImplementingType?: boolean;
property unionMember
unionMember?: boolean;
Enums
enum DocumentMode
enum DocumentMode { graphQLTag = 'graphQLTag', documentNode = 'documentNode', documentNodeImportFragments = 'documentNodeImportFragments', external = 'external', string = 'string',}
member documentNode
documentNode = 'documentNode'
member documentNodeImportFragments
documentNodeImportFragments = 'documentNodeImportFragments'
member external
external = 'external'
member graphQLTag
graphQLTag = 'graphQLTag'
member string
string = 'string'
Type Aliases
type ConvertFn
type ConvertFn<T = {}> = ( node: ASTNode | string, options?: ConvertOptions & T) => string;
type ConvertNameFn
type ConvertNameFn<T = {}> = ConvertFn<T>;
type DeclarationKind
type DeclarationKind = 'type' | 'interface' | 'class' | 'abstract class';
type DirectiveArgumentAndInputFieldMappings
type DirectiveArgumentAndInputFieldMappings = { [name: string]: string;};
A map between the GraphQL directive name and the identifier that should be used
type EnumValuesMap
type EnumValuesMap<AdditionalProps = {}> = | string | { [enumName: string]: | string | ({ [key: string]: string | number; } & AdditionalProps); };
A raw configuration for enumValues map - can be represented with a single string value for a file path, a map between enum name and a file path, or a map between enum name and an object with explicit enum values.
type FragmentDirectives
type FragmentDirectives = { fragmentDirectives?: Array<DirectiveNode>;};
type FragmentImport
type FragmentImport = { name: string; kind: 'type' | 'document';};
type GetFragmentSuffixFn
type GetFragmentSuffixFn = (node: FragmentDefinitionNode | string) => string;
type GroupedMappers
type GroupedMappers = Record< string, { identifier: string; asDefault?: boolean; }[]>;
type ImportDeclaration
type ImportDeclaration<T = string> = { outputPath: string; importSource: ImportSource<T>; baseOutputDir: string; baseDir: string; typesImport: boolean; emitLegacyCommonJSImports: boolean;};
type ImportSource
type ImportSource<T = string> = { /** * Source path, relative to the `baseOutputDir` */ path: string; /** * Namespace to import source as */ namespace?: string; /** * Entity names to import */ identifiers?: T[];};
type InlineFragmentTypeOptions
type InlineFragmentTypeOptions = 'inline' | 'combine' | 'mask';
type LinkField
type LinkField = { alias: string; name: string; type: string; selectionSet: string;};
type LoadedFragment
type LoadedFragment<AdditionalFields = {}> = { name: string; onType: string; node: FragmentDefinitionNode; isExternal: boolean; importFrom?: string | null;} & AdditionalFields;
type NameAndType
type NameAndType = { name: string; type: string;};
type NamingConvention
type NamingConvention = string | NamingConventionFn | NamingConventionMap;
type NamingConventionFn
type NamingConventionFn = (str: string) => string;
type NamingConventionResolvePath
type NamingConventionResolvePath = string;
type NormalizedScalarsMap
type NormalizedScalarsMap = { [name: string]: { input: string; output: string; };};
A normalized map between GraphQL scalar name and the identifier name
type ParsedDirectiveArgumentAndInputFieldMappings
type ParsedDirectiveArgumentAndInputFieldMappings = { [name: string]: ParsedMapper;};
Parsed directives map - a mapping between GraphQL directive name and the parsed mapper object, including all required information for generating code for that mapping.
type ParsedEnumValuesMap
type ParsedEnumValuesMap = { [enumName: string]: { mappedValues?: { [valueName: string]: string | number; }; typeIdentifier: string; sourceIdentifier?: string; sourceFile?: string; importIdentifier?: string; isDefault?: boolean; };