UNPKG

2.36 kBTypeScriptView Raw
1import { GraphQLEnumType, GraphQLInputObjectType } from "graphql";
2import { CompilerContext, Operation, Fragment } from "apollo-codegen-core/lib/compiler";
3import { BasicGeneratedFile } from "apollo-codegen-core/lib/utilities/CodeGenerator";
4import TypescriptGenerator from "./language";
5import Printer from "./printer";
6import { GraphQLType } from "graphql/type/definition";
7declare class TypescriptGeneratedFile implements BasicGeneratedFile {
8 fileContents: string;
9 constructor(fileContents: string);
10 get output(): string;
11}
12export declare function generateSource(context: CompilerContext): {
13 generatedFiles: {
14 sourcePath: string;
15 fileName: string;
16 content: TypescriptGeneratedFile;
17 }[];
18 common: string;
19};
20interface IGeneratedFileOptions {
21 outputPath?: string;
22 globalSourcePath?: string;
23}
24interface IGeneratedFile {
25 sourcePath: string;
26 fileName: string;
27 content: (options?: IGeneratedFileOptions) => TypescriptGeneratedFile;
28}
29export declare function generateLocalSource(context: CompilerContext): IGeneratedFile[];
30export declare function generateGlobalSource(context: CompilerContext): TypescriptGeneratedFile;
31export declare class TypescriptAPIGenerator extends TypescriptGenerator {
32 context: CompilerContext;
33 printer: Printer;
34 scopeStack: string[];
35 constructor(context: CompilerContext);
36 fileHeader(): void;
37 typeAliasForEnumType(enumType: GraphQLEnumType): void;
38 typeAliasForInputObjectType(inputObjectType: GraphQLInputObjectType): void;
39 interfacesForOperation(operation: Operation): void;
40 interfacesForFragment(fragment: Fragment): void;
41 getGlobalTypesUsedForOperation: (doc: Operation) => GraphQLType[];
42 getGlobalTypesUsedForFragment: (doc: Fragment) => GraphQLType[];
43 private reduceSelection;
44 private isGlobalType;
45 private getUnderlyingType;
46 getTypesUsedForOperation(doc: Operation | Fragment, context: CompilerContext): GraphQLType[];
47 private reduceTypesUsed;
48 private getVariantsForSelectionSet;
49 private getTypeCasesForSelectionSet;
50 private getPropertiesForVariant;
51 private handleFieldSelectionSetValue;
52 private handleFieldValue;
53 get output(): string;
54 scopeStackPush(name: string): void;
55 scopeStackPop(): string | undefined;
56}
57export {};
58//# sourceMappingURL=codeGeneration.d.ts.map
\No newline at end of file