1 | /**
|
2 | * This file was automatically generated by json-schema-to-typescript.
|
3 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
4 | * and run json-schema-to-typescript to regenerate this file.
|
5 | */
|
6 | export interface Config {
|
7 | serve?: ServeConfig;
|
8 | require?: string[];
|
9 | /**
|
10 | * Defines the list of your external data sources for your API mesh
|
11 | */
|
12 | sources: Source[];
|
13 | /**
|
14 | * Transform to apply to the unified mesh schema
|
15 | */
|
16 | transforms?: Transform[];
|
17 | /**
|
18 | * Additional type definitions, or type definitions overrides you wish to add to the schema mesh
|
19 | */
|
20 | additionalTypeDefs?: string;
|
21 | /**
|
22 | * Additional resolvers, or resolvers overrides you wish to add to the schema mesh (Any of: String, AdditionalStitchingResolverObject, AdditionalSubscriptionObject)
|
23 | */
|
24 | additionalResolvers?: (string | AdditionalStitchingResolverObject | AdditionalSubscriptionObject)[];
|
25 | cache?: Cache;
|
26 | /**
|
27 | * Merge method
|
28 | */
|
29 | merger?: string;
|
30 | /**
|
31 | * PubSub Implementation (Any of: String, PubSubConfig)
|
32 | */
|
33 | pubsub?: string | PubSubConfig;
|
34 | }
|
35 | export interface ServeConfig {
|
36 | /**
|
37 | * Spawn multiple server instances as node clusters (default: `1`) (Any of: Int, Boolean)
|
38 | */
|
39 | fork?: number | boolean;
|
40 | /**
|
41 | * TCP Port to listen (default: `3000`) (Any of: Int, String)
|
42 | */
|
43 | port?: number | string;
|
44 | /**
|
45 | * Provide an example query or queries for GraphQL Playground
|
46 | */
|
47 | exampleQuery?: string;
|
48 | cors?: CorsConfig;
|
49 | /**
|
50 | * Any of: WebhookHandler, ExpressHandler
|
51 | */
|
52 | handlers?: (WebhookHandler | ExpressHandler)[];
|
53 | staticFiles?: string;
|
54 | }
|
55 | export interface CorsConfig {
|
56 | origin?: string[];
|
57 | allowedHeaders?: string[];
|
58 | exposedHeaders?: string[];
|
59 | credentials?: boolean;
|
60 | maxAge?: number;
|
61 | preflightContinue?: boolean;
|
62 | optionsSuccessStatus?: number;
|
63 | }
|
64 | export interface WebhookHandler {
|
65 | path: string;
|
66 | pubsubTopic: string;
|
67 | payload?: string;
|
68 | }
|
69 | export interface ExpressHandler {
|
70 | path: string;
|
71 | handler: string;
|
72 | /**
|
73 | * Allowed values: GET, POST, DELETE, PATCH
|
74 | */
|
75 | method?: 'GET' | 'POST' | 'DELETE' | 'PATCH';
|
76 | }
|
77 | export interface Source {
|
78 | /**
|
79 | * The name you wish to set to your remote API, this will be used for building the GraphQL context
|
80 | */
|
81 | name: string;
|
82 | handler: Handler;
|
83 | /**
|
84 | * List of transforms to apply to the current API source, before unifying it with the rest of the sources
|
85 | */
|
86 | transforms?: Transform[];
|
87 | }
|
88 | /**
|
89 | * Point to the handler you wish to use, it can either be a predefined handler, or a custom
|
90 | */
|
91 | export interface Handler {
|
92 | graphql?: GraphQLHandler;
|
93 | grpc?: GrpcHandler;
|
94 | jsonSchema?: JsonSchemaHandler;
|
95 | mongoose?: MongooseHandler;
|
96 | mysql?: MySQLHandler;
|
97 | neo4j?: Neo4JHandler;
|
98 | odata?: ODataHandler;
|
99 | openapi?: OpenapiHandler;
|
100 | postgraphile?: PostGraphileHandler;
|
101 | soap?: SoapHandler;
|
102 | thrift?: ThriftHandler;
|
103 | tuql?: TuqlHandler;
|
104 | [k: string]: any;
|
105 | }
|
106 | /**
|
107 | * Handler for remote/local/third-party GraphQL schema
|
108 | */
|
109 | export interface GraphQLHandler {
|
110 | /**
|
111 | * A url to your remote GraphQL endpoint
|
112 | */
|
113 | endpoint: string;
|
114 | /**
|
115 | * JSON object representing the Headers to add to the runtime of the API calls only for schema introspection
|
116 | */
|
117 | schemaHeaders?: {
|
118 | [k: string]: any;
|
119 | };
|
120 | /**
|
121 | * JSON object representing the Headers to add to the runtime of the API calls only for operation during runtime
|
122 | */
|
123 | operationHeaders?: {
|
124 | [k: string]: any;
|
125 | };
|
126 | /**
|
127 | * Use HTTP GET for Query operations
|
128 | */
|
129 | useGETForQueries?: boolean;
|
130 | /**
|
131 | * HTTP method used for GraphQL operations (Allowed values: GET, POST)
|
132 | */
|
133 | method?: 'GET' | 'POST';
|
134 | /**
|
135 | * Enable GraphQL Subscriptions using WebSocket
|
136 | */
|
137 | enableSubscriptions?: boolean;
|
138 | /**
|
139 | * Path to a custom W3 Compatible Fetch Implementation
|
140 | */
|
141 | customFetch?: any;
|
142 | /**
|
143 | * Path to a custom W3 Compatible WebSocket Implementation
|
144 | */
|
145 | webSocketImpl?: string;
|
146 | /**
|
147 | * Path to the introspection
|
148 | * You can seperately give schema introspection
|
149 | */
|
150 | introspection?: string;
|
151 | /**
|
152 | * Cache Introspection (Any of: GraphQLIntrospectionCachingOptions, Boolean)
|
153 | */
|
154 | cacheIntrospection?: GraphQLIntrospectionCachingOptions | boolean;
|
155 | }
|
156 | export interface GraphQLIntrospectionCachingOptions {
|
157 | /**
|
158 | * Time to live of introspection cache
|
159 | */
|
160 | ttl?: number;
|
161 | /**
|
162 | * Path to Introspection JSON File
|
163 | */
|
164 | path?: string;
|
165 | }
|
166 | /**
|
167 | * Handler for gRPC and Protobuf schemas
|
168 | */
|
169 | export interface GrpcHandler {
|
170 | /**
|
171 | * gRPC Endpoint
|
172 | */
|
173 | endpoint: string;
|
174 | /**
|
175 | * gRPC Proto file that contains your protobuf schema (Any of: ProtoFilePath, String)
|
176 | */
|
177 | protoFilePath: ProtoFilePath | string;
|
178 | /**
|
179 | * Your base service name
|
180 | * Used for naming only
|
181 | */
|
182 | serviceName?: string;
|
183 | /**
|
184 | * Your base package name
|
185 | * Used for naming only
|
186 | */
|
187 | packageName?: string;
|
188 | /**
|
189 | * Request timeout in milliseconds
|
190 | * Default: 200000
|
191 | */
|
192 | requestTimeout?: number;
|
193 | credentialsSsl?: GrpcCredentialsSsl;
|
194 | /**
|
195 | * Use https instead of http for gRPC connection
|
196 | */
|
197 | useHTTPS?: boolean;
|
198 | /**
|
199 | * MetaData
|
200 | */
|
201 | metaData?: {
|
202 | [k: string]: any;
|
203 | };
|
204 | }
|
205 | export interface ProtoFilePath {
|
206 | file: string;
|
207 | load?: LoadOptions;
|
208 | }
|
209 | export interface LoadOptions {
|
210 | includeDirs?: string[];
|
211 | }
|
212 | /**
|
213 | * SSL Credentials
|
214 | */
|
215 | export interface GrpcCredentialsSsl {
|
216 | rootCA?: string;
|
217 | certChain?: string;
|
218 | privateKey?: string;
|
219 | }
|
220 | /**
|
221 | * Handler for JSON Schema specification. Source could be a local json file, or a url to it.
|
222 | */
|
223 | export interface JsonSchemaHandler {
|
224 | baseUrl: string;
|
225 | operationHeaders?: {
|
226 | [k: string]: any;
|
227 | };
|
228 | schemaHeaders?: {
|
229 | [k: string]: any;
|
230 | };
|
231 | operations: JsonSchemaOperation[];
|
232 | disableTimestampScalar?: boolean;
|
233 | baseSchema?: any;
|
234 | }
|
235 | export interface JsonSchemaOperation {
|
236 | field: string;
|
237 | path?: string;
|
238 | pubsubTopic?: string;
|
239 | description?: string;
|
240 | /**
|
241 | * Allowed values: Query, Mutation, Subscription
|
242 | */
|
243 | type: 'Query' | 'Mutation' | 'Subscription';
|
244 | /**
|
245 | * Allowed values: GET, DELETE, POST, PUT, PATCH
|
246 | */
|
247 | method: 'GET' | 'DELETE' | 'POST' | 'PUT' | 'PATCH';
|
248 | requestSchema?: any;
|
249 | requestSample?: any;
|
250 | requestTypeName?: string;
|
251 | responseSample?: any;
|
252 | responseSchema?: any;
|
253 | responseTypeName?: string;
|
254 | argTypeMap?: {
|
255 | [k: string]: any;
|
256 | };
|
257 | headers?: {
|
258 | [k: string]: any;
|
259 | };
|
260 | }
|
261 | export interface MongooseHandler {
|
262 | connectionString?: string;
|
263 | models?: MongooseModel[];
|
264 | discriminators?: MongooseModel[];
|
265 | }
|
266 | export interface MongooseModel {
|
267 | name: string;
|
268 | path: string;
|
269 | options?: ComposeWithMongooseOpts;
|
270 | }
|
271 | export interface ComposeWithMongooseOpts {
|
272 | name?: string;
|
273 | description?: string;
|
274 | fields?: ComposeWithMongooseFieldsOpts;
|
275 | inputType?: ComposeMongooseInputType;
|
276 | resolvers?: TypeConverterResolversOpts1;
|
277 | }
|
278 | export interface ComposeWithMongooseFieldsOpts {
|
279 | only?: string[];
|
280 | remove?: string[];
|
281 | required?: string[];
|
282 | }
|
283 | export interface ComposeMongooseInputType {
|
284 | name?: string;
|
285 | description?: string;
|
286 | fields?: ComposeWithMongooseFieldsOpts1;
|
287 | resolvers?: TypeConverterResolversOpts;
|
288 | }
|
289 | export interface ComposeWithMongooseFieldsOpts1 {
|
290 | only?: string[];
|
291 | remove?: string[];
|
292 | required?: string[];
|
293 | }
|
294 | export interface TypeConverterResolversOpts {
|
295 | /**
|
296 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
297 | */
|
298 | findById?: boolean | ComposeWithMongooseResolverOpts;
|
299 | /**
|
300 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
301 | */
|
302 | findByIds?: boolean | ComposeWithMongooseResolverOpts;
|
303 | /**
|
304 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
305 | */
|
306 | findOne?: boolean | ComposeWithMongooseResolverOpts;
|
307 | /**
|
308 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
309 | */
|
310 | findMany?: boolean | ComposeWithMongooseResolverOpts;
|
311 | /**
|
312 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
313 | */
|
314 | updateById?: boolean | ComposeWithMongooseResolverOpts;
|
315 | /**
|
316 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
317 | */
|
318 | updateOne?: boolean | ComposeWithMongooseResolverOpts;
|
319 | /**
|
320 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
321 | */
|
322 | updateMany?: boolean | ComposeWithMongooseResolverOpts;
|
323 | /**
|
324 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
325 | */
|
326 | removeById?: boolean | ComposeWithMongooseResolverOpts;
|
327 | /**
|
328 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
329 | */
|
330 | removeOne?: boolean | ComposeWithMongooseResolverOpts;
|
331 | /**
|
332 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
333 | */
|
334 | removeMany?: boolean | ComposeWithMongooseResolverOpts;
|
335 | /**
|
336 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
337 | */
|
338 | createOne?: boolean | ComposeWithMongooseResolverOpts;
|
339 | /**
|
340 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
341 | */
|
342 | createMany?: boolean | ComposeWithMongooseResolverOpts;
|
343 | /**
|
344 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
345 | */
|
346 | count?: boolean | ComposeWithMongooseResolverOpts;
|
347 | /**
|
348 | * Any of: Boolean, JSON
|
349 | */
|
350 | connection?: boolean | {
|
351 | [k: string]: any;
|
352 | };
|
353 | /**
|
354 | * Any of: Boolean, PaginationResolverOpts
|
355 | */
|
356 | pagination?: boolean | PaginationResolverOpts;
|
357 | }
|
358 | export interface ComposeWithMongooseResolverOpts {
|
359 | filter?: FilterHelperArgsOpts;
|
360 | sort?: SortHelperArgsOpts;
|
361 | limit?: LimitHelperArgsOpts;
|
362 | record?: RecordHelperArgsOpts;
|
363 | skip?: boolean;
|
364 | }
|
365 | export interface FilterHelperArgsOpts {
|
366 | filterTypeName?: string;
|
367 | isRequired?: boolean;
|
368 | onlyIndexed?: boolean;
|
369 | requiredFields?: string[];
|
370 | /**
|
371 | * Any of: Boolean, JSON
|
372 | */
|
373 | operators?: boolean | {
|
374 | [k: string]: any;
|
375 | };
|
376 | removeFields?: string[];
|
377 | }
|
378 | export interface SortHelperArgsOpts {
|
379 | sortTypeName?: string;
|
380 | }
|
381 | export interface LimitHelperArgsOpts {
|
382 | defaultValue?: number;
|
383 | }
|
384 | export interface RecordHelperArgsOpts {
|
385 | recordTypeName?: string;
|
386 | isRequired?: boolean;
|
387 | removeFields?: string[];
|
388 | requiredFields?: string[];
|
389 | }
|
390 | export interface PaginationResolverOpts {
|
391 | perPage?: number;
|
392 | }
|
393 | export interface TypeConverterResolversOpts1 {
|
394 | /**
|
395 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
396 | */
|
397 | findById?: boolean | ComposeWithMongooseResolverOpts;
|
398 | /**
|
399 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
400 | */
|
401 | findByIds?: boolean | ComposeWithMongooseResolverOpts;
|
402 | /**
|
403 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
404 | */
|
405 | findOne?: boolean | ComposeWithMongooseResolverOpts;
|
406 | /**
|
407 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
408 | */
|
409 | findMany?: boolean | ComposeWithMongooseResolverOpts;
|
410 | /**
|
411 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
412 | */
|
413 | updateById?: boolean | ComposeWithMongooseResolverOpts;
|
414 | /**
|
415 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
416 | */
|
417 | updateOne?: boolean | ComposeWithMongooseResolverOpts;
|
418 | /**
|
419 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
420 | */
|
421 | updateMany?: boolean | ComposeWithMongooseResolverOpts;
|
422 | /**
|
423 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
424 | */
|
425 | removeById?: boolean | ComposeWithMongooseResolverOpts;
|
426 | /**
|
427 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
428 | */
|
429 | removeOne?: boolean | ComposeWithMongooseResolverOpts;
|
430 | /**
|
431 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
432 | */
|
433 | removeMany?: boolean | ComposeWithMongooseResolverOpts;
|
434 | /**
|
435 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
436 | */
|
437 | createOne?: boolean | ComposeWithMongooseResolverOpts;
|
438 | /**
|
439 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
440 | */
|
441 | createMany?: boolean | ComposeWithMongooseResolverOpts;
|
442 | /**
|
443 | * Any of: Boolean, ComposeWithMongooseResolverOpts
|
444 | */
|
445 | count?: boolean | ComposeWithMongooseResolverOpts;
|
446 | /**
|
447 | * Any of: Boolean, JSON
|
448 | */
|
449 | connection?: boolean | {
|
450 | [k: string]: any;
|
451 | };
|
452 | /**
|
453 | * Any of: Boolean, PaginationResolverOpts
|
454 | */
|
455 | pagination?: boolean | PaginationResolverOpts;
|
456 | }
|
457 | export interface MySQLHandler {
|
458 | host: string;
|
459 | port: number;
|
460 | user: string;
|
461 | password?: string;
|
462 | database: string;
|
463 | }
|
464 | /**
|
465 | * Handler for Neo4j
|
466 | */
|
467 | export interface Neo4JHandler {
|
468 | /**
|
469 | * URL for the Neo4j Instance e.g. neo4j://localhost
|
470 | */
|
471 | url: string;
|
472 | /**
|
473 | * Username for basic authentication
|
474 | */
|
475 | username: string;
|
476 | /**
|
477 | * Password for basic authentication
|
478 | */
|
479 | password: string;
|
480 | /**
|
481 | * Specifies whether relationships should always be included in the type definitions as [relationship](https://grandstack.io/docs/neo4j-graphql-js.html#relationship-types) types, even if the relationships do not have properties.
|
482 | */
|
483 | alwaysIncludeRelationships?: boolean;
|
484 | /**
|
485 | * Specifies database name
|
486 | */
|
487 | database?: string;
|
488 | /**
|
489 | * Provide GraphQL Type Definitions instead of inferring
|
490 | */
|
491 | typeDefs?: string;
|
492 | /**
|
493 | * Cache Introspection (Any of: Neo4jIntrospectionCachingOptions, Boolean)
|
494 | */
|
495 | cacheIntrospection?: Neo4JIntrospectionCachingOptions | boolean;
|
496 | }
|
497 | export interface Neo4JIntrospectionCachingOptions {
|
498 | /**
|
499 | * Time to live of introspection cache
|
500 | */
|
501 | ttl?: number;
|
502 | }
|
503 | /**
|
504 | * Handler for OData
|
505 | */
|
506 | export interface ODataHandler {
|
507 | /**
|
508 | * Base URL for OData API
|
509 | */
|
510 | baseUrl: string;
|
511 | /**
|
512 | * Custom $metadata File or URL
|
513 | */
|
514 | metadata?: string;
|
515 | /**
|
516 | * Headers to be used with the operation requests
|
517 | */
|
518 | operationHeaders?: {
|
519 | [k: string]: any;
|
520 | };
|
521 | /**
|
522 | * Headers to be used with the $metadata requests
|
523 | */
|
524 | schemaHeaders?: {
|
525 | [k: string]: any;
|
526 | };
|
527 | /**
|
528 | * Enable batching (Allowed values: multipart, json)
|
529 | */
|
530 | batch?: 'multipart' | 'json';
|
531 | /**
|
532 | * Use $expand for navigation props instead of seperate HTTP requests (Default: false)
|
533 | */
|
534 | expandNavProps?: boolean;
|
535 | }
|
536 | /**
|
537 | * Handler for Swagger / OpenAPI 2/3 specification. Source could be a local json/swagger file, or a url to it.
|
538 | */
|
539 | export interface OpenapiHandler {
|
540 | /**
|
541 | * A pointer to your API source - could be a local file, remote file or url endpoint
|
542 | */
|
543 | source: string;
|
544 | /**
|
545 | * Format of the source file (Allowed values: json, yaml)
|
546 | */
|
547 | sourceFormat?: 'json' | 'yaml';
|
548 | /**
|
549 | * JSON object representing the Headers to add to the runtime of the API calls
|
550 | */
|
551 | operationHeaders?: {
|
552 | [k: string]: any;
|
553 | };
|
554 | /**
|
555 | * If you are using a remote URL endpoint to fetch your schema, you can set headers for the HTTP request to fetch your schema.
|
556 | */
|
557 | schemaHeaders?: {
|
558 | [k: string]: any;
|
559 | };
|
560 | /**
|
561 | * Specifies the URL on which all paths will be based on.
|
562 | * Overrides the server object in the OAS.
|
563 | */
|
564 | baseUrl?: string;
|
565 | /**
|
566 | * JSON object representing the query search parameters to add to the API calls
|
567 | */
|
568 | qs?: {
|
569 | [k: string]: any;
|
570 | };
|
571 | /**
|
572 | * W3 Compatible Fetch Implementation
|
573 | */
|
574 | customFetch?: any;
|
575 | /**
|
576 | * Include HTTP Response details to the result object
|
577 | */
|
578 | includeHttpDetails?: boolean;
|
579 | /**
|
580 | * Auto-generate a 'limit' argument for all fields that return lists of objects, including ones produced by links
|
581 | */
|
582 | addLimitArgument?: boolean;
|
583 | }
|
584 | /**
|
585 | * Handler for Postgres database, based on `postgraphile`
|
586 | */
|
587 | export interface PostGraphileHandler {
|
588 | /**
|
589 | * A connection string to your Postgres database
|
590 | */
|
591 | connectionString?: string;
|
592 | /**
|
593 | * An array of strings which specifies the PostgreSQL schemas that PostGraphile will use to create a GraphQL schema. The default schema is the public schema.
|
594 | */
|
595 | schemaName?: string[];
|
596 | /**
|
597 | * Connection Pool settings
|
598 | */
|
599 | pool?: {
|
600 | [k: string]: any;
|
601 | };
|
602 | /**
|
603 | * Extra Postgraphile Plugins to append
|
604 | */
|
605 | appendPlugins?: string[];
|
606 | /**
|
607 | * Postgraphile Plugins to skip (e.g. "graphile-build#NodePlugin")
|
608 | */
|
609 | skipPlugins?: string[];
|
610 | /**
|
611 | * Extra Postgraphile options that will be added to the postgraphile constructor. It can either be an object or a string pointing to the object's path (e.g. "./my-config#options"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-library/) for more information. (Any of: JSON, String)
|
612 | */
|
613 | options?: {
|
614 | [k: string]: any;
|
615 | } | string;
|
616 | /**
|
617 | * Cache Introspection (Any of: GraphQLIntrospectionCachingOptions, Boolean)
|
618 | */
|
619 | cacheIntrospection?: GraphQLIntrospectionCachingOptions | boolean;
|
620 | }
|
621 | /**
|
622 | * Handler for SOAP
|
623 | */
|
624 | export interface SoapHandler {
|
625 | /**
|
626 | * A url to your WSDL
|
627 | */
|
628 | wsdl: string;
|
629 | basicAuth?: SoapSecurityBasicAuthConfig;
|
630 | securityCert?: SoapSecurityCertificateConfig;
|
631 | }
|
632 | /**
|
633 | * Basic Authentication Configuration
|
634 | * Including username and password fields
|
635 | */
|
636 | export interface SoapSecurityBasicAuthConfig {
|
637 | /**
|
638 | * Username for Basic Authentication
|
639 | */
|
640 | username: string;
|
641 | /**
|
642 | * Password for Basic Authentication
|
643 | */
|
644 | password: string;
|
645 | }
|
646 | /**
|
647 | * SSL Certificate Based Authentication Configuration
|
648 | * Including public key, private key and password fields
|
649 | */
|
650 | export interface SoapSecurityCertificateConfig {
|
651 | /**
|
652 | * Your public key
|
653 | */
|
654 | publicKey?: string;
|
655 | /**
|
656 | * Your private key
|
657 | */
|
658 | privateKey?: string;
|
659 | /**
|
660 | * Password
|
661 | */
|
662 | password?: string;
|
663 | /**
|
664 | * Path to the file or URL contains your public key
|
665 | */
|
666 | publicKeyPath?: string;
|
667 | /**
|
668 | * Path to the file or URL contains your private key
|
669 | */
|
670 | privateKeyPath?: string;
|
671 | /**
|
672 | * Path to the file or URL contains your password
|
673 | */
|
674 | passwordPath?: string;
|
675 | }
|
676 | /**
|
677 | * Handler for OData
|
678 | */
|
679 | export interface ThriftHandler {
|
680 | /**
|
681 | * The name of the host to connect to.
|
682 | */
|
683 | hostName: string;
|
684 | /**
|
685 | * The port number to attach to on the host.
|
686 | */
|
687 | port: number;
|
688 | /**
|
689 | * The path on which the Thrift service is listening. Defaults to '/thrift'.
|
690 | */
|
691 | path?: string;
|
692 | /**
|
693 | * Boolean value indicating whether to use https. Defaults to false.
|
694 | */
|
695 | https?: boolean;
|
696 | /**
|
697 | * Name of the Thrift protocol type to use. Defaults to 'binary'. (Allowed values: binary, compact, json)
|
698 | */
|
699 | protocol?: 'binary' | 'compact' | 'json';
|
700 | /**
|
701 | * The name of your service. Used for logging.
|
702 | */
|
703 | serviceName: string;
|
704 | /**
|
705 | * JSON object representing the Headers to add to the runtime of the API calls
|
706 | */
|
707 | operationHeaders?: {
|
708 | [k: string]: any;
|
709 | };
|
710 | /**
|
711 | * If you are using a remote URL endpoint to fetch your schema, you can set headers for the HTTP request to fetch your schema.
|
712 | */
|
713 | schemaHeaders?: {
|
714 | [k: string]: any;
|
715 | };
|
716 | /**
|
717 | * Path to IDL file
|
718 | */
|
719 | idl: string;
|
720 | }
|
721 | /**
|
722 | * Handler for SQLite database, based on `tuql`
|
723 | */
|
724 | export interface TuqlHandler {
|
725 | /**
|
726 | * Pointer to your SQLite database
|
727 | */
|
728 | db?: string;
|
729 | /**
|
730 | * Path to the SQL Dump file if you want to build a in-memory database
|
731 | */
|
732 | infile?: string;
|
733 | }
|
734 | export interface Transform {
|
735 | /**
|
736 | * Transformer to apply caching for your data sources
|
737 | */
|
738 | cache?: CacheTransformConfig[];
|
739 | federation?: FederationTransform;
|
740 | filterSchema?: string[];
|
741 | mock?: MockingConfig;
|
742 | namingConvention?: NamingConventionTransformConfig;
|
743 | prefix?: PrefixTransformConfig;
|
744 | /**
|
745 | * Transformer to apply rename of a GraphQL type
|
746 | */
|
747 | rename?: RenameTransformObject[];
|
748 | /**
|
749 | * Transformer to apply composition to resolvers
|
750 | */
|
751 | resolversComposition?: ResolversCompositionTransformObject[];
|
752 | snapshot?: SnapshotTransformConfig;
|
753 | [k: string]: any;
|
754 | }
|
755 | export interface CacheTransformConfig {
|
756 | /**
|
757 | * The type and field to apply cache to, you can use wild cards as well, for example: `Query.*`
|
758 | */
|
759 | field: string;
|
760 | /**
|
761 | * Cache key to use to store your resolvers responses.
|
762 | * The defualt is: {typeName}-{fieldName}-{argsHash}-{fieldNamesHash}
|
763 | *
|
764 | * Available variables:
|
765 | * - {args.argName} - use resolver argument
|
766 | * - {typeName} - use name of the type
|
767 | * - {fieldName} - use name of the field
|
768 | * - {argsHash} - a hash based on the 'args' object
|
769 | * - {fieldNamesHash} - a hash based on the field names selected by the client
|
770 | * - {info} - the GraphQLResolveInfo of the resolver
|
771 | *
|
772 | * Available interpolations:
|
773 | * - {format|date} - returns the current date with a specific format
|
774 | */
|
775 | cacheKey?: string;
|
776 | invalidate?: CacheInvalidateConfig;
|
777 | }
|
778 | /**
|
779 | * Invalidation rules
|
780 | */
|
781 | export interface CacheInvalidateConfig {
|
782 | /**
|
783 | * Invalidate the cache when a specific operation is done without an error
|
784 | */
|
785 | effectingOperations?: CacheEffectingOperationConfig[];
|
786 | /**
|
787 | * Specified in seconds, the time-to-live (TTL) value limits the lifespan
|
788 | */
|
789 | ttl?: number;
|
790 | }
|
791 | export interface CacheEffectingOperationConfig {
|
792 | /**
|
793 | * Path to the operation that could effect it. In a form: Mutation.something. Note that wildcard is not supported in this field.
|
794 | */
|
795 | operation: string;
|
796 | /**
|
797 | * Cache key to invalidate on sucessful resolver (no error), see `cacheKey` for list of available options in this field.
|
798 | */
|
799 | matchKey?: string;
|
800 | }
|
801 | export interface FederationTransform {
|
802 | types?: FederationTransformType[];
|
803 | }
|
804 | export interface FederationTransformType {
|
805 | name: string;
|
806 | config?: FederationObjectConfig;
|
807 | }
|
808 | export interface FederationObjectConfig {
|
809 | keyFields?: string[];
|
810 | extend?: boolean;
|
811 | fields?: FederationField[];
|
812 | /**
|
813 | * Any of: String, ResolveReferenceObject
|
814 | */
|
815 | resolveReference?: string | ResolveReferenceObject;
|
816 | }
|
817 | export interface FederationField {
|
818 | name: string;
|
819 | config: FederationFieldConfig;
|
820 | }
|
821 | export interface FederationFieldConfig {
|
822 | external?: boolean;
|
823 | provides?: string;
|
824 | required?: string;
|
825 | }
|
826 | export interface ResolveReferenceObject {
|
827 | targetSource: string;
|
828 | targetMethod: string;
|
829 | args: {
|
830 | [k: string]: any;
|
831 | };
|
832 | returnData?: string;
|
833 | resultSelectedFields?: {
|
834 | [k: string]: any;
|
835 | };
|
836 | resultSelectionSet?: string;
|
837 | resultDepth?: number;
|
838 | }
|
839 | /**
|
840 | * Mock configuration for your source
|
841 | */
|
842 | export interface MockingConfig {
|
843 | /**
|
844 | * If this expression is truthy, mocking would be enabled
|
845 | * You can use environment variables expression, for example: `${MOCKING_ENABLED}`
|
846 | */
|
847 | if?: boolean;
|
848 | /**
|
849 | * Do not mock any other resolvers other than defined in `mocks`.
|
850 | * For example, you can enable this if you don't want to mock entire schema but partially.
|
851 | */
|
852 | preserveResolvers?: boolean;
|
853 | /**
|
854 | * Mock configurations
|
855 | */
|
856 | mocks?: MockingFieldConfig[];
|
857 | }
|
858 | export interface MockingFieldConfig {
|
859 | /**
|
860 | * Resolver path
|
861 | * Example: User.firstName
|
862 | */
|
863 | apply: string;
|
864 | /**
|
865 | * If this expression is truthy, mocking would be enabled
|
866 | * You can use environment variables expression, for example: `${MOCKING_ENABLED}`
|
867 | */
|
868 | if?: boolean;
|
869 | /**
|
870 | * Faker.js expression or function
|
871 | * Read more (https://github.com/marak/Faker.js/#fakerfake)
|
872 | * Example;
|
873 | * faker: name.firstName
|
874 | * faker: "{{ name.firstName }} {{ name.lastName }}"
|
875 | */
|
876 | faker?: string;
|
877 | /**
|
878 | * Custom mocking
|
879 | * It can be a module or json file.
|
880 | * Both "moduleName#exportName" or only "moduleName" would work
|
881 | */
|
882 | custom?: string;
|
883 | }
|
884 | /**
|
885 | * Transformer to apply naming convention to GraphQL Types
|
886 | */
|
887 | export interface NamingConventionTransformConfig {
|
888 | /**
|
889 | * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase
|
890 | */
|
891 | typeNames?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase';
|
892 | /**
|
893 | * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase
|
894 | */
|
895 | fieldNames?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase';
|
896 | /**
|
897 | * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase
|
898 | */
|
899 | enumValues?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase';
|
900 | }
|
901 | /**
|
902 | * Prefix transform
|
903 | */
|
904 | export interface PrefixTransformConfig {
|
905 | /**
|
906 | * The prefix to apply to the schema types. By default it's the API name.
|
907 | */
|
908 | value?: string;
|
909 | /**
|
910 | * List of ignored types
|
911 | */
|
912 | ignore?: string[];
|
913 | /**
|
914 | * Changes root types and changes the field names
|
915 | */
|
916 | includeRootOperations?: boolean;
|
917 | }
|
918 | export interface RenameTransformObject {
|
919 | /**
|
920 | * The GraphQL type to rename
|
921 | */
|
922 | from: string;
|
923 | /**
|
924 | * The new name
|
925 | */
|
926 | to: string;
|
927 | }
|
928 | export interface ResolversCompositionTransformObject {
|
929 | /**
|
930 | * The GraphQL Resolver path
|
931 | * Example: Query.users
|
932 | */
|
933 | resolver: string;
|
934 | /**
|
935 | * Path to the composer function
|
936 | * Example: ./src/auth.js#authComposer
|
937 | */
|
938 | composer: any;
|
939 | }
|
940 | /**
|
941 | * Configuration for Snapshot extension
|
942 | */
|
943 | export interface SnapshotTransformConfig {
|
944 | /**
|
945 | * Expression for when to activate this extension.
|
946 | * Value can be a valid JS expression string or a boolean (Any of: String, Boolean)
|
947 | */
|
948 | if?: string | boolean;
|
949 | /**
|
950 | * Resolver to be applied
|
951 | * For example;
|
952 | * apply:
|
953 | * - Query.* <- * will apply this extension to all fields of Query type
|
954 | * - Mutation.someMutationButProbablyYouWontNeedIt
|
955 | */
|
956 | apply: string[];
|
957 | /**
|
958 | * Path to the directory of the generated snapshot files
|
959 | */
|
960 | outputDir: string;
|
961 | }
|
962 | export interface AdditionalStitchingResolverObject {
|
963 | type: string;
|
964 | field: string;
|
965 | requiredSelectionSet?: string;
|
966 | targetSource: string;
|
967 | targetMethod: string;
|
968 | args?: {
|
969 | [k: string]: any;
|
970 | };
|
971 | returnData?: string;
|
972 | resultSelectedFields?: {
|
973 | [k: string]: any;
|
974 | };
|
975 | resultSelectionSet?: string;
|
976 | resultDepth?: number;
|
977 | }
|
978 | export interface AdditionalSubscriptionObject {
|
979 | type: string;
|
980 | field: string;
|
981 | pubsubTopic: string;
|
982 | returnData?: string;
|
983 | filterBy?: string;
|
984 | }
|
985 | /**
|
986 | * Backend cache
|
987 | */
|
988 | export interface Cache {
|
989 | file?: FileCacheConfig;
|
990 | inmemoryLRU?: InMemoryLRUConfig;
|
991 | localforage?: LocalforageConfig;
|
992 | redis?: RedisConfig;
|
993 | [k: string]: any;
|
994 | }
|
995 | export interface FileCacheConfig {
|
996 | path?: string;
|
997 | }
|
998 | export interface InMemoryLRUConfig {
|
999 | max?: number;
|
1000 | }
|
1001 | export interface LocalforageConfig {
|
1002 | /**
|
1003 | * Allowed values: WEBSQL, INDEXEDDB, LOCALSTORAGE
|
1004 | */
|
1005 | driver?: ('WEBSQL' | 'INDEXEDDB' | 'LOCALSTORAGE')[];
|
1006 | name?: string;
|
1007 | version?: number;
|
1008 | size?: number;
|
1009 | storeName?: string;
|
1010 | description?: string;
|
1011 | }
|
1012 | export interface RedisConfig {
|
1013 | host?: string;
|
1014 | port?: number;
|
1015 | password?: string;
|
1016 | }
|
1017 | export interface PubSubConfig {
|
1018 | name: string;
|
1019 | config?: any;
|
1020 | }
|