1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export interface Ingester {
|
10 | root_type: any | string;
|
11 | types: Array<ObjectType | EnumType>;
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 | export interface ObjectType {
|
17 | kind: "OBJECT";
|
18 | name: string;
|
19 | description?: string;
|
20 | fields: FieldType[];
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 | export interface EnumType {
|
26 | kind: "ENUM";
|
27 | name: string;
|
28 | description?: string;
|
29 | enumValues: Array<{
|
30 | name: string;
|
31 | }>;
|
32 | }
|
33 |
|
34 |
|
35 |
|
36 | export interface FieldType {
|
37 | name: string;
|
38 | description?: string;
|
39 | args?: FieldType[];
|
40 | type: {
|
41 | kind: "SCALAR" | "LIST" | "OBJECT" | "ENUM";
|
42 | name?: string | "String" | "Int" | "Float" | "Boolean";
|
43 | ofType?: {
|
44 | kind: "OBJECT" | "SCALAR";
|
45 | name: string;
|
46 | };
|
47 | };
|
48 | directives?: Array<{
|
49 | name: string;
|
50 | }>;
|
51 | defaultValue?: any;
|
52 | }
|
53 |
|
54 |
|
55 |
|
56 |
|
57 | export declare class IngesterBuilder {
|
58 | rootType: string | TypeBuilder;
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 | types: ObjectType[];
|
65 | |
66 |
|
67 |
|
68 |
|
69 |
|
70 | enums: EnumType[];
|
71 | |
72 |
|
73 |
|
74 |
|
75 |
|
76 | name: string;
|
77 | constructor(rootType: string | TypeBuilder);
|
78 | withType(builder: TypeBuilder): IngesterBuilder;
|
79 | withEnum(builder: EnumBuilder): IngesterBuilder;
|
80 | build(): Ingester;
|
81 | }
|
82 | /**
|
83 | * Builder to construct TypeBuilder instances fluently
|
84 | * @Deprecated use the SDL (GraphQL Schema definition language) ingester definition.
|
85 | */
|
86 | export declare class TypeBuilder {
|
87 | name: string;
|
88 | description?: string;
|
89 | |
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 | readonly fields: FieldType[];
|
97 | constructor(name: string, description?: string);
|
98 | withScalarField(name: string, kind: "String" | "Int" | "Float" | "Boolean", description?: string, directives?: string[]): TypeBuilder;
|
99 | withObjectField(name: string, object: string | TypeBuilder, description?: string, args?: string[], directives?: string[]): TypeBuilder;
|
100 | withEnumField(name: string, object: string | EnumBuilder, description?: string, directives?: string[]): this;
|
101 | withStringField(name: string, description?: string, directives?: string[]): TypeBuilder;
|
102 | withBooleanField(name: string, description?: string, directives?: string[]): TypeBuilder;
|
103 | withFloatField(name: string, description?: string, directives?: string[]): TypeBuilder;
|
104 | withIntField(name: string, description?: string, directives?: string[]): TypeBuilder;
|
105 | withListScalarField(name: string, kind: "String" | "Int" | "Float" | "Boolean", description?: string): TypeBuilder;
|
106 | withListObjectField(name: string, object: string | TypeBuilder, description?: string, args?: string[]): TypeBuilder;
|
107 | build(types: ObjectType[]): ObjectType;
|
108 | }
|
109 | /**
|
110 | * Builder to construct EnumType instances fluently
|
111 | */
|
112 | export declare class EnumBuilder {
|
113 | name: string;
|
114 | values: string[];
|
115 | description?: string;
|
116 | constructor(name: string, values: string[], description?: string);
|
117 | build(): EnumType;
|
118 | }
|
119 | /**
|
120 | * Create an IngesterBuilder for the provided rootType
|
121 | *
|
122 | * If rootType is TypeBuilder instance, it is added to the types collection.
|
123 | * Therefore there is no need to call withType on the rootType.
|
124 | * @param {string | TypeBuilder} rootType
|
125 | * @returns {IngesterBuilder}
|
126 | */
|
127 | export declare function buildIngester(rootType: string | TypeBuilder): IngesterBuilder;
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 | export declare function buildType(name: string): TypeBuilder;
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 | export declare function buildEnum(name: string, values: string[], description?: string): EnumBuilder;
|
142 |
|
\ | No newline at end of file |