UNPKG

2.81 kBTypeScriptView Raw
1import { ParsedConfig, BaseVisitor, EnumValuesMap } from '@graphql-codegen/visitor-plugin-common';
2import { CSharpResolversPluginRawConfig } from './config';
3import { GraphQLSchema, EnumTypeDefinitionNode, EnumValueDefinitionNode, InterfaceTypeDefinitionNode, InputObjectTypeDefinitionNode, ObjectTypeDefinitionNode, FieldDefinitionNode, InputValueDefinitionNode, TypeNode, DirectiveNode, StringValueNode, NamedTypeNode } from 'graphql';
4import { CSharpFieldType } from '../../common/common';
5export interface CSharpResolverParsedConfig extends ParsedConfig {
6 namespaceName: string;
7 className: string;
8 listType: string;
9 enumValues: EnumValuesMap;
10}
11export declare class CSharpResolversVisitor extends BaseVisitor<CSharpResolversPluginRawConfig, CSharpResolverParsedConfig> {
12 private _schema;
13 private readonly keywords;
14 constructor(rawConfig: CSharpResolversPluginRawConfig, _schema: GraphQLSchema, defaultPackageName: string);
15 /**
16 * Checks name against list of keywords. If it is, will prefix value with @
17 *
18 * Note:
19 * This class should first invoke the convertName from base-visitor to convert the string or node
20 * value according the naming configuration, eg upper or lower case. Then resulting string checked
21 * against the list or keywords.
22 * However the generated C# code is not yet able to handle fields that are in a different case so
23 * the invocation of convertName is omitted purposely.
24 */
25 private convertSafeName;
26 getImports(): string;
27 wrapWithNamespace(content: string): string;
28 wrapWithClass(content: string): string;
29 protected getEnumValue(enumName: string, enumOption: string): string;
30 EnumValueDefinition(node: EnumValueDefinitionNode): (enumName: string) => string;
31 EnumTypeDefinition(node: EnumTypeDefinitionNode): string;
32 getFieldHeader(node: InputValueDefinitionNode | FieldDefinitionNode | EnumValueDefinitionNode, fieldType?: CSharpFieldType): string;
33 getDeprecationReason(directive: DirectiveNode): string;
34 protected resolveInputFieldType(typeNode: TypeNode, hasDefaultValue?: Boolean): CSharpFieldType;
35 protected buildClass(name: string, description: StringValueNode, inputValueArray: ReadonlyArray<FieldDefinitionNode>, interfaces?: ReadonlyArray<NamedTypeNode>): string;
36 protected buildInterface(name: string, description: StringValueNode, inputValueArray: ReadonlyArray<FieldDefinitionNode>): string;
37 protected buildInputTransformer(name: string, description: StringValueNode, inputValueArray: ReadonlyArray<InputValueDefinitionNode>): string;
38 InputObjectTypeDefinition(node: InputObjectTypeDefinitionNode): string;
39 ObjectTypeDefinition(node: ObjectTypeDefinitionNode): string;
40 InterfaceTypeDefinition(node: InterfaceTypeDefinitionNode): string;
41}