UNPKG

2.63 kBTypeScriptView Raw
1import { GraphQLSchema, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLInputField, GraphQLField, GraphQLInputType, GraphQLOutputType, GraphQLScalarType, GraphQLEnumType, GraphQLFieldMap, GraphQLObjectType } from 'graphql';
2import { Generator } from './Generator';
3import { Maybe } from './types';
4export declare class TypescriptGenerator extends Generator {
5 scalarMapping: {
6 Int: string;
7 String: string;
8 ID: string;
9 Float: string;
10 Boolean: string;
11 DateTime: string;
12 Json: string;
13 };
14 graphqlRenderers: {
15 GraphQLUnionType: (type: GraphQLUnionType) => string;
16 GraphQLObjectType: (type: GraphQLObjectType<any, any, {
17 [key: string]: any;
18 }> | GraphQLInterfaceType | GraphQLInputObjectType) => string;
19 GraphQLInterfaceType: (type: GraphQLObjectType<any, any, {
20 [key: string]: any;
21 }> | GraphQLInterfaceType | GraphQLInputObjectType) => string;
22 GraphQLInputObjectType: (type: GraphQLObjectType<any, any, {
23 [key: string]: any;
24 }> | GraphQLInterfaceType | GraphQLInputObjectType) => string;
25 GraphQLScalarType: (type: GraphQLScalarType) => string;
26 GraphQLIDType: (type: GraphQLScalarType) => string;
27 GraphQLEnumType: (type: GraphQLEnumType) => string;
28 };
29 constructor({ schema, inputSchemaPath, outputBindingPath, isDefaultExport, }: {
30 schema: GraphQLSchema;
31 inputSchemaPath: string;
32 outputBindingPath: string;
33 isDefaultExport: boolean;
34 });
35 render(): string;
36 renderExports(): string;
37 renderQueries(): string;
38 renderMutations(): string;
39 renderSubscriptions(): string;
40 getTypeNames(): string[];
41 renderTypes(): string;
42 renderMainMethodFields(operation: string, fields: GraphQLFieldMap<any, any>): string;
43 getPayloadType(operation: string, nonNullType: boolean): string;
44 renderInterfaceOrObject(type: GraphQLObjectType | GraphQLInputObjectType | GraphQLInterfaceType): string;
45 renderFieldName(field: GraphQLInputField | GraphQLField<any, any>): string;
46 renderFieldType(type: GraphQLInputType | GraphQLOutputType): string;
47 renderInputFieldType(type: GraphQLInputType | GraphQLOutputType): string;
48 renderTypeWrapper(typeName: string, typeDescription: Maybe<string>, fieldDefinition: string): string;
49 renderInterfaceWrapper(typeName: string, typeDescription: Maybe<string>, interfaces: GraphQLInterfaceType[], fieldDefinition: string): string;
50 renderDescription(description: Maybe<string>): string;
51 renderImports(): string;
52}