UNPKG

4.81 kBTypeScriptView Raw
1/**
2 * Defines an Ingester as per automation-api
3 *
4 * An Ingester is a collection of GraphQL types and a pointer to the root type in the
5 * root_type field.
6 *
7 * @Deprecated use the SDL (GraphQL Schema definition language) ingester definition.
8 */
9export interface Ingester {
10 root_type: any | string;
11 types: Array<ObjectType | EnumType>;
12}
13/**
14 * Describes root level GraphQL types
15 */
16export interface ObjectType {
17 kind: "OBJECT";
18 name: string;
19 description?: string;
20 fields: FieldType[];
21}
22/**
23 * Describes root level GraphQL enums
24 */
25export interface EnumType {
26 kind: "ENUM";
27 name: string;
28 description?: string;
29 enumValues: Array<{
30 name: string;
31 }>;
32}
33/**
34 * Describes fields of ObjectType root level GraphQL types
35 */
36export 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 * Builder to construct Ingester instances fluently
55 * @Deprecated use the SDL (GraphQL Schema definition language) ingester definition.
56 */
57export declare class IngesterBuilder {
58 rootType: string | TypeBuilder;
59 /**
60 * @Deprecated do not use
61 * Public to prevent type errors. This whole class will be removed in the future
62 * @type {any[]}
63 */
64 types: ObjectType[];
65 /**
66 * @Deprecated do not use
67 * Public to prevent type errors. This whole class will be removed in the future
68 * @type {any[]}
69 */
70 enums: EnumType[];
71 /**
72 * @Deprecated do not use
73 * Public to prevent type errors. This whole class will be removed in the future
74 * @type {any[]}
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 */
86export declare class TypeBuilder {
87 name: string;
88 description?: string;
89 /**
90 * do not use! This is public only to prevent compiler errors when the location of automation-client is not
91 * identical for dependencies within an SDM.
92 *
93 * @Deprecated
94 * @type {any[]}
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 */
112export 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 */
127export declare function buildIngester(rootType: string | TypeBuilder): IngesterBuilder;
128/**
129 * Create a TypeBuilder for the provided name
130 * @param {string} name
131 * @returns {TypeBuilder}
132 */
133export declare function buildType(name: string): TypeBuilder;
134/**
135 * Create a EnumBuilder for the provided name, description and values
136 * @param {string} name
137 * @param {string[]} values
138 * @param {string} description
139 * @returns {EnumBuilder}
140 */
141export declare function buildEnum(name: string, values: string[], description?: string): EnumBuilder;
142//# sourceMappingURL=ingesters.d.ts.map
\No newline at end of file