1 | import { DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InputValueDefinitionNode, InterfaceTypeDefinitionNode, InterfaceTypeExtensionNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeDefinitionNode, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, TypeNode, TypeSystemDefinitionNode, TypeSystemExtensionNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql';
|
2 | import type { ClassDeclarationStructure, EnumDeclarationStructure, InterfaceDeclarationStructure, MethodDeclarationStructure, MethodSignatureStructure, OptionalKind, ParameterDeclarationStructure, PropertyDeclarationStructure, PropertySignatureStructure, SourceFile, TypeAliasDeclarationStructure } from 'ts-morph';
|
3 | export interface DefinitionsGeneratorOptions {
|
4 | |
5 |
|
6 |
|
7 |
|
8 | emitTypenameField?: boolean;
|
9 | |
10 |
|
11 |
|
12 |
|
13 | skipResolverArgs?: boolean;
|
14 | |
15 |
|
16 |
|
17 |
|
18 | defaultScalarType?: string;
|
19 | |
20 |
|
21 |
|
22 |
|
23 | customScalarTypeMapping?: Record<string, string | {
|
24 | name: string;
|
25 | }>;
|
26 | |
27 |
|
28 |
|
29 |
|
30 | defaultTypeMapping?: Partial<Record<'ID' | 'Boolean' | 'Float' | 'String' | 'Int', string>>;
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 | additionalHeader?: string;
|
37 | |
38 |
|
39 |
|
40 |
|
41 | enumsAsTypes?: boolean;
|
42 | }
|
43 | export declare class GraphQLAstExplorer {
|
44 | private readonly root;
|
45 | explore(documentNode: DocumentNode, outputPath: string, mode: 'class' | 'interface', options?: DefinitionsGeneratorOptions): Promise<SourceFile>;
|
46 | toDefinitionStructures(item: Readonly<TypeSystemDefinitionNode | TypeSystemExtensionNode>, mode: 'class' | 'interface', options: DefinitionsGeneratorOptions): ClassDeclarationStructure | EnumDeclarationStructure | InterfaceDeclarationStructure | TypeAliasDeclarationStructure;
|
47 | toRootSchemaDefinitionStructure(operationTypes: ReadonlyArray<OperationTypeDefinitionNode>, mode: 'class' | 'interface'): ClassDeclarationStructure | InterfaceDeclarationStructure;
|
48 | toObjectTypeDefinitionStructure(item: ObjectTypeDefinitionNode | ObjectTypeExtensionNode | InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode | InterfaceTypeDefinitionNode | InterfaceTypeExtensionNode, mode: 'class' | 'interface', options: DefinitionsGeneratorOptions): ClassDeclarationStructure | InterfaceDeclarationStructure;
|
49 | toPropertyDeclarationStructure(item: FieldDefinitionNode | InputValueDefinitionNode, options: DefinitionsGeneratorOptions): OptionalKind<PropertyDeclarationStructure> & OptionalKind<PropertySignatureStructure>;
|
50 | toMethodDeclarationStructure(item: FieldDefinitionNode | InputValueDefinitionNode, mode: 'class' | 'interface', options: DefinitionsGeneratorOptions): OptionalKind<MethodDeclarationStructure> & OptionalKind<MethodSignatureStructure>;
|
51 | getFieldTypeDefinition(typeNode: TypeNode, options: DefinitionsGeneratorOptions): {
|
52 | name: string;
|
53 | required: boolean;
|
54 | };
|
55 | unwrapTypeIfNonNull(type: TypeNode): {
|
56 | type: TypeNode;
|
57 | required: boolean;
|
58 | };
|
59 | getType(typeName: string, options: DefinitionsGeneratorOptions): string;
|
60 | getDefaultTypes(options: DefinitionsGeneratorOptions): {
|
61 | [type: string]: string;
|
62 | };
|
63 | getFunctionParameters(inputs: ReadonlyArray<InputValueDefinitionNode>, options: DefinitionsGeneratorOptions): ParameterDeclarationStructure[];
|
64 | toScalarDefinitionStructure(item: ScalarTypeDefinitionNode | ScalarTypeExtensionNode, options: DefinitionsGeneratorOptions): TypeAliasDeclarationStructure;
|
65 | toEnumDefinitionStructure(item: EnumTypeDefinitionNode | EnumTypeExtensionNode, options: DefinitionsGeneratorOptions): TypeAliasDeclarationStructure | EnumDeclarationStructure;
|
66 | toUnionDefinitionStructure(item: UnionTypeDefinitionNode | UnionTypeExtensionNode): TypeAliasDeclarationStructure;
|
67 | addSymbolIfRoot(name: string): string;
|
68 | isRoot(name: string): boolean;
|
69 | }
|
70 |
|
\ | No newline at end of file |