UNPKG

@graphql-mesh/types

Version:
1,646 lines • 77.7 kB
/** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ export interface Config { serve?: ServeConfig; sdk?: SDKConfig; /** * Codegen Configuration */ codegen?: any; require?: string[]; /** * Defines the list of your external data sources for your API mesh */ sources: Source[]; /** * Transform to apply to the unified mesh schema */ transforms?: Transform[]; /** * Additional type definitions, or type definitions overrides you wish to add to the schema mesh */ additionalTypeDefs?: any; /** * Additional resolvers, or resolvers overrides you wish to add to the schema mesh (Any of: String, AdditionalStitchingResolverObject, AdditionalStitchingBatchResolverObject, AdditionalSubscriptionObject) */ additionalResolvers?: (string | AdditionalStitchingResolverObject | AdditionalStitchingBatchResolverObject | AdditionalSubscriptionObject)[]; cache?: Cache; /** * Merge method */ merger?: string; /** * PubSub Implementation (Any of: String, PubSubConfig) */ pubsub?: string | PubSubConfig; /** * Provide a query or queries for GraphQL Playground, validation and SDK Generation * The value can be the file path, glob expression for the file paths or the SDL. * (.js, .jsx, .graphql, .gql, .ts and .tsx files are supported. */ documents?: string[]; persistedOperations?: PersistedOperationsConfig; /** * Path to a file exporting a logger instance compatible with the `Logger` type from `@graphql-mesh/types` */ logger?: string; /** * Path to a custom W3 Compatible Fetch Implementation */ customFetch?: any; /** * Allow connections to an SSL endpoint without certificates */ skipSSLValidation?: boolean; /** * Path to a JavaScript file with a default export of Envelop plugins */ additionalEnvelopPlugins?: string; plugins?: Plugin[]; /** * If you are using a CDN for a source (e.g. Federation Supergraph), this will be the polling interval in milliseconds for the CDN without a downtime */ pollingInterval?: number; } /** * Configuration for `mesh start` or `mesh dev` command. * Those commands won't be available in programmatic usage. */ export interface ServeConfig { /** * Spawn multiple server instances as node clusters (default: `1`) (Any of: Int, Boolean) */ fork?: number | boolean; /** * TCP Port to listen (default: `4000`) (Any of: Int, String) */ port?: number | string; /** * The binding hostname (default: `localhost`) */ hostname?: string; cors?: CorsConfig; /** * Path to your static files you want to be served with GraphQL Mesh HTTP Server */ staticFiles?: string; /** * Show GraphiQL Playground. * * Pass `true` or `false` to toggle GraphiQL. Pass an object (`playground.offline: true`) to enable GraphiQL with assets bundled inline for air-gapped environments. (Any of: Boolean, PlaygroundConfig) */ playground?: boolean | PlaygroundConfig; sslCredentials?: HTTPSConfig; /** * Path to GraphQL Endpoint (default: /graphql) */ endpoint?: string; /** * Path to the browser that will be used by `mesh serve` to open a playground window in development mode * This feature can be disabled by passing `false` (Any of: String, Boolean) */ browser?: string | boolean; /** * Title of GraphiQL Playground */ playgroundTitle?: string; /** * Enable and define a limit for [Request Batching](https://github.com/graphql/graphql-over-http/blob/main/rfcs/Batching.md) */ batchingLimit?: number; /** * Endpoint for [Health Check](https://the-guild.dev/graphql/yoga-server/docs/features/health-check) */ healthCheckEndpoint?: string; /** * By default, GraphQL Mesh does not allow parameters in the request body except `query`, `variables`, `extensions`, and `operationName`. * * This option allows you to specify additional parameters that are allowed in the request body. * * @default [] * * @example ['doc_id', 'id'] */ extraParamNames?: string[]; } /** * Configuration for CORS */ export interface CorsConfig { origin?: any; allowedHeaders?: string[]; exposedHeaders?: string[]; credentials?: boolean; maxAge?: number; preflightContinue?: boolean; optionsSuccessStatus?: number; } export interface PlaygroundConfig { /** * Use an offline GraphiQL that bundles JS, CSS and fonts inline instead of loading them from a CDN. * Useful for air-gapped or on-premise environments with no internet access. * * Requires `@graphql-yoga/render-graphiql` in the same project (install it yourself; `mesh serve` and generated `createBuiltMeshHTTPHandler` artifacts import it directly). */ offline?: boolean; } /** * SSL Credentials for HTTPS Server * If this is provided, Mesh will be served via HTTPS */ export interface HTTPSConfig { key: string; cert: string; } /** * SDK Configuration */ export interface SDKConfig { generateOperations?: GenerateOperationsConfig; } /** * Use this only if you don't want to use `documents` for SDK, * and let Mesh generate them for you */ export interface GenerateOperationsConfig { selectionSetDepth?: number; } export interface Source { /** * The name you wish to set to your remote API, this will be used for building the GraphQL context */ name: string; handler: Handler; /** * List of transforms to apply to the current API source, before unifying it with the rest of the sources */ transforms?: Transform[]; } /** * Point to the handler you wish to use, it can either be a predefined handler, or a custom */ export interface Handler { /** * Handler for remote/local/third-party GraphQL schema (Any of: GraphQLHandlerHTTPConfiguration, GraphQLHandlerCodeFirstConfiguration, GraphQLHandlerMultipleHTTPConfiguration) */ graphql?: GraphQLHandlerHTTPConfiguration | GraphQLHandlerCodeFirstConfiguration | GraphQLHandlerMultipleHTTPConfiguration; grpc?: GrpcHandler; jsonSchema?: JsonSchemaHandler; mongoose?: MongooseHandler; mysql?: MySQLHandler; neo4j?: Neo4JHandler; odata?: ODataHandler; openapi?: OpenapiHandler; postgraphile?: PostGraphileHandler; raml?: RAMLHandler; soap?: SoapHandler; supergraph?: SupergraphHandler; thrift?: ThriftHandler; tuql?: TuqlHandler; [k: string]: any; } export interface GraphQLHandlerHTTPConfiguration { /** * A url or file path to your remote GraphQL endpoint. * If you provide a path to a code file(js or ts), * other options will be ignored and the schema exported from the file will be used directly. */ endpoint: string; /** * JSON object representing the Headers to add to the runtime of the API calls only for schema introspection */ schemaHeaders?: any; /** * JSON object representing the Headers to add to the runtime of the API calls only for operation during runtime */ operationHeaders?: { [k: string]: any; }; /** * Use HTTP GET for Query operations */ useGETForQueries?: boolean; /** * HTTP method used for GraphQL operations (Allowed values: GET, POST) */ method?: 'GET' | 'POST'; /** * Request Credentials if your environment supports it. * [See more](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials) * * @default "same-origin" (Allowed values: omit, include) */ credentials?: 'omit' | 'include'; /** * Path to a custom W3 Compatible WebSocket Implementation */ webSocketImpl?: string; /** * Path to the introspection * You can separately give schema introspection or SDL */ source?: string; /** * SSE - Server Sent Events * WS - New graphql-ws * LEGACY_WS - Legacy subscriptions-transport-ws (Allowed values: SSE, WS, LEGACY_WS) */ subscriptionsProtocol?: 'SSE' | 'WS' | 'LEGACY_WS'; /** * URL to your endpoint serving all subscription queries for this source */ subscriptionsEndpoint?: string; /** * Retry attempts if fails */ retry?: number; /** * Timeout in milliseconds */ timeout?: number; /** * Enable/Disable automatic query batching */ batch?: boolean; /** * JSON object representing the `connectionParams` from a WebSocket connection to add to the runtime of the API calls only for operation during runtime. * More information about the WebSocket `connectionParams`: * - When using `subscriptionsProtocol=WS` (graphql-ws): https://github.com/enisdenjo/graphql-ws/blob/master/docs/interfaces/client.ClientOptions.md#connectionparams * - When using `subscriptionsProtocol=LEGACY_WS` (subscriptions-transport-ws): https://github.com/apollographql/subscriptions-transport-ws/blob/51270cc7dbaf09c7b9aa67368f1de58148c7d334/README.md#subscriptionclient */ connectionParams?: { [k: string]: any; }; } export interface GraphQLHandlerCodeFirstConfiguration { /** * A file path to your GraphQL Schema * If you provide a path to a code file(js or ts), * other options will be ignored and the schema exported from the file will be used directly. */ source: any; } export interface GraphQLHandlerMultipleHTTPConfiguration { /** * HTTP Source Configurations */ sources: GraphQLHandlerHTTPConfiguration[]; /** * Handling strategy (default: fallback) (Allowed values: fallback, race, highestValue) */ strategy?: 'fallback' | 'race' | 'highestValue'; strategyConfig?: GraphQLHandlerhighestValueStrategyConfig; } /** * Handling strategy configuration */ export interface GraphQLHandlerhighestValueStrategyConfig { selectionSet: string; value: string; } /** * Handler for gRPC and Protobuf schemas */ export interface GrpcHandler { /** * gRPC Endpoint */ endpoint: string; /** * gRPC Proto file that contains your protobuf schema * OR * Use a binary-encoded or JSON file descriptor set file (Any of: ProtoFilePath, String) */ source?: ProtoFilePath | string; /** * Request timeout in milliseconds * Default: 200000 */ requestTimeout?: number; credentialsSsl?: GrpcCredentialsSsl; /** * Use https instead of http for gRPC connection */ useHTTPS?: boolean; /** * MetaData */ metaData?: { [k: string]: any; }; /** * prefix to collect Query method default: list, get */ prefixQueryMethod?: string[]; /** * Allows to explicitly override the default operation (Query or Mutation) for any gRPC operation */ selectQueryOrMutationField?: SelectQueryOrMutationFieldConfig[]; schemaHeaders?: { [k: string]: any; }; } export interface ProtoFilePath { file: string; load?: LoadOptions; } export interface LoadOptions { defaults?: boolean; includeDirs?: string[]; } /** * SSL Credentials */ export interface GrpcCredentialsSsl { rootCA?: string; certChain?: string; privateKey?: string; } export interface SelectQueryOrMutationFieldConfig { /** * Allowed values: query, mutation, Query, Mutation */ type: 'query' | 'mutation' | 'Query' | 'Mutation'; fieldName: string; } /** * Handler for JSON Schema specification. * Source could be a local json file, or a url to it. */ export interface JsonSchemaHandler { source?: string; endpoint?: string; operationHeaders?: { [k: string]: any; }; schemaHeaders?: { [k: string]: any; }; /** * Any of: JsonSchemaHTTPOperation, JsonSchemaPubSubOperation */ operations?: (JsonSchemaHTTPOperation | JsonSchemaPubSubOperation)[]; ignoreErrorResponses?: boolean; queryParams?: any; queryStringOptions?: QueryStringOptions; /** * Timeout for the HTTP request in milliseconds */ timeout?: number; } export interface JsonSchemaHTTPOperation { /** * This Field based on the field name of the URL path. * Example: "https://MyAPIURL.com/FieldNameHere/", * so we will set the "field: FieldNameHere". */ field: string; /** * Your chance to describe the operation! * Make sure the description is clear and concise. */ description?: string; /** * Type field is set the opertion type: Query, Mutation or Subscription. (Allowed values: Query, Mutation, Subscription) */ type: 'Query' | 'Mutation' | 'Subscription'; /** * Your chance to provide request schema name. */ requestSchema?: any; /** * The path definition of the JSON Schema sample. * Example: "./jsons/questions.response.json". */ requestSample?: any; /** * Inset any name for the type of the request body. */ requestTypeName?: string; /** * This body will be merged with the request body sent with * the underlying HTTP request */ requestBaseBody?: any; /** * Yay! Now you can provide the response schema name. */ responseSchema?: any; /** * Did you use Sample? Provide the response sample path. */ responseSample?: any; /** * Inset any name for the type of the response body. */ responseTypeName?: string; /** * You can define your response schemas by status codes; * ```yaml filename=".meshrc.yaml" * responseByStatusCode: * 200: * responseSchema: ./someschema.json#/somepath * 404: * responseSample: ./error-sample.json * responseTypeName: MyError * ``` */ responseByStatusCode?: any; /** * Expose response details done to the upstream API * When you enable this, you will see a new field in the response type; * ```graphql * type MyResponseType { * myFooField: String * _response: ResponseMetadata * } * * # And a new type for the response metadata object * type ResponseMetadata { * url: URL * status: Int * method: String * headers: JSON * body: String * } * ``` */ exposeResponseMetadata?: boolean; /** * Mapping the JSON Schema and define the arguments of the operation. * * # Example: * argTypeMap: * user_id: * type: string */ argTypeMap?: { [k: string]: any; }; /** * JSON object representing the mapping of query search parameters (added to the route path) and the matching argument. * * # Example: * queryParamArgMap: * id: user_id */ queryParamArgMap?: { [k: string]: any; }; path: string; /** * Allowed values: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE, PATCH */ method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; headers?: { [k: string]: any; }; /** * If true, this operation cannot have requestSchema or requestSample * And the request body will be passed as binary with its mime type * unless you define an explicit Content-Type header */ binary?: boolean; /** * If true, `@deprecated` will be added to the field definition */ deprecated?: boolean; } export interface JsonSchemaPubSubOperation { field: string; description?: string; /** * Allowed values: Query, Mutation, Subscription */ type: 'Query' | 'Mutation' | 'Subscription'; requestSchema?: any; requestSample?: any; requestTypeName?: string; /** * This body will be merged with the request body sent with * the underlying HTTP request */ requestBaseBody?: any; responseSchema?: any; responseSample?: any; responseTypeName?: string; argTypeMap?: { [k: string]: any; }; pubsubTopic: string; /** * If true, `@deprecated` will be added to the field definition */ deprecated?: boolean; } export interface QueryStringOptions { /** * When arrays are stringified, by default they are not given explicit indices: * `a=b&a=c&a=d` * You may override this by setting the indices option to true: * `a[0]=b&a[1]=c&a[2]=d` */ indices?: boolean; /** * You can configure how to format arrays in the query strings. * * Note: when using arrayFormat set to 'comma', you can also pass the commaRoundTrip option set to true or false, to append [] on single-item arrays, so that they can round trip through a parse. (Allowed values: indices, brackets, repeat, comma) */ arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma'; /** * Even if there is a single item in an array, this option treats them as arrays * (default: false) */ commaRoundTrip?: boolean; /** * Stringify the nested objects as JSON * (default: false) */ jsonStringify?: boolean; } export interface MongooseHandler { connectionString?: string; models?: MongooseModel[]; discriminators?: MongooseModel[]; } export interface MongooseModel { name: string; path: string; options?: ComposeWithMongooseOpts; } export interface ComposeWithMongooseOpts { name?: string; description?: string; fields?: ComposeWithMongooseFieldsOpts; inputType?: ComposeMongooseInputType; resolvers?: TypeConverterResolversOpts1; } export interface ComposeWithMongooseFieldsOpts { only?: string[]; remove?: string[]; required?: string[]; } export interface ComposeMongooseInputType { name?: string; description?: string; fields?: ComposeWithMongooseFieldsOpts1; resolvers?: TypeConverterResolversOpts; } export interface ComposeWithMongooseFieldsOpts1 { only?: string[]; remove?: string[]; required?: string[]; } export interface TypeConverterResolversOpts { /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findById?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findByIds?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ updateById?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ updateOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ updateMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ removeById?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ removeOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ removeMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ createOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ createMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ count?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, JSON */ connection?: boolean | { [k: string]: any; }; /** * Any of: Boolean, PaginationResolverOpts */ pagination?: boolean | PaginationResolverOpts; } export interface ComposeWithMongooseResolverOpts { filter?: FilterHelperArgsOpts; sort?: SortHelperArgsOpts; limit?: LimitHelperArgsOpts; record?: RecordHelperArgsOpts; skip?: boolean; } export interface FilterHelperArgsOpts { filterTypeName?: string; isRequired?: boolean; onlyIndexed?: boolean; requiredFields?: string[]; /** * Any of: Boolean, JSON */ operators?: boolean | { [k: string]: any; }; removeFields?: string[]; } export interface SortHelperArgsOpts { sortTypeName?: string; } export interface LimitHelperArgsOpts { defaultValue?: number; } export interface RecordHelperArgsOpts { recordTypeName?: string; isRequired?: boolean; removeFields?: string[]; requiredFields?: string[]; } export interface PaginationResolverOpts { perPage?: number; } export interface TypeConverterResolversOpts1 { /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findById?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findByIds?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ findMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ updateById?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ updateOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ updateMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ removeById?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ removeOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ removeMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ createOne?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ createMany?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, ComposeWithMongooseResolverOpts */ count?: boolean | ComposeWithMongooseResolverOpts; /** * Any of: Boolean, JSON */ connection?: boolean | { [k: string]: any; }; /** * Any of: Boolean, PaginationResolverOpts */ pagination?: boolean | PaginationResolverOpts; } export interface MySQLHandler { /** * The hostname of the database you are connecting to. (Default: localhost) */ host?: string; /** * The port number to connect to. (Default: 3306) */ port?: number; /** * The source IP address to use for TCP connection */ localAddress?: string; /** * The MySQL user to authenticate as */ user?: string; /** * The password of that MySQL user */ password?: string; /** * Name of the database to use for this connection */ database?: string; ssl?: MySQLSSLOptions; /** * Use existing `Pool` instance * Format: modulePath#exportName */ pool?: any; /** * Use specific tables for your schema */ tables?: string[]; /** * Use specific fields of specific tables */ tableFields?: TableField[]; } /** * SSL Options for your MySQL connection */ export interface MySQLSSLOptions { /** * Default: true */ rejectUnauthorized?: boolean; /** * Path to your CA */ ca?: string; } export interface TableField { table: string; fields: string[]; } /** * Handler for Neo4j */ export interface Neo4JHandler { /** * URL for the Neo4j Instance e.g. neo4j://localhost */ endpoint: string; /** * Provide GraphQL Type Definitions instead of inferring */ source?: string; /** * Username for basic authentication */ username: string; /** * Password for basic authentication */ password: string; /** * 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. */ alwaysIncludeRelationships?: boolean; /** * Specifies database name */ database?: string; } /** * Handler for OData */ export interface ODataHandler { /** * Base URL for OData API */ endpoint: string; /** * Custom $metadata File or URL */ source?: string; /** * Headers to be used with the $metadata requests */ schemaHeaders?: { [k: string]: any; }; /** * Headers to be used with the operation requests */ operationHeaders?: { [k: string]: any; }; /** * Enable batching (Allowed values: multipart, json) */ batch?: 'multipart' | 'json'; /** * Use $expand for navigation props instead of seperate HTTP requests (Default: false) */ expandNavProps?: boolean; } /** * Handler for Swagger / OpenAPI 2/3 specification. Source could be a local json/swagger file, or a url to it. */ export interface OpenapiHandler { /** * A pointer to your API source (Support both JSON and YAML) - could be a local file, remote file or url endpoint */ source: string; /** * Format of the files referenced from the source file, for cases content type isn't detected automatically (Allowed values: json, yaml, js, ts) */ fallbackFormat?: 'json' | 'yaml' | 'js' | 'ts'; /** * Specifies the URL on which all paths will be based on. * Overrides the server object in the OAS. */ endpoint?: string; /** * If you are using a remote URL endpoint to fetch your schema, you can set headers for the HTTP request to fetch your schema. */ schemaHeaders?: { [k: string]: any; }; /** * JSON object representing the Headers to add to the runtime of the API calls */ operationHeaders?: { [k: string]: any; }; /** * Responses are converted to a Union type grouping all possible responses. * Applying this will ignore all responses with status code other than 2xx, resulting in simpler response types, usualy regular object type instead of union. * Default: false */ ignoreErrorResponses?: boolean; /** * Allows to explicitly override the default operation (Query or Mutation) for any OAS operation */ selectQueryOrMutationField?: SelectQueryOrMutationFieldConfig[]; /** * JSON object representing the query search parameters to add to the API calls */ queryParams?: { [k: string]: any; }; /** * Timeout for the HTTP request in milliseconds */ timeout?: number; } /** * Handler for Postgres database, based on `postgraphile` */ export interface PostGraphileHandler { /** * A connection string to your Postgres database */ connectionString?: string; /** * 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. */ schemaName?: string[]; /** * Connection Pool instance or settings or you can provide the path of a code file that exports any of those */ pool?: any; /** * Extra Postgraphile Plugins to append */ appendPlugins?: string[]; /** * Postgraphile Plugins to skip (e.g. "graphile-build#NodePlugin") */ skipPlugins?: string[]; /** * 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) */ options?: { [k: string]: any; } | string; /** * Enable GraphQL websocket transport support for subscriptions (default: true) */ subscriptions?: boolean; /** * Enables live-query support via GraphQL subscriptions (sends updated payload any time nested collections/records change) (default: true) */ live?: boolean; /** * A file that exports a function which takes context as a paramter and returns postgraphile context options (e.g. "./my-function#pgSettings"). See the [postgraphile docs](https://www.graphile.org/postgraphile/usage-schema/) for more information. */ contextOptions?: any; } export interface RAMLHandler { source: string; endpoint?: string; schemaHeaders?: { [k: string]: any; }; operationHeaders?: { [k: string]: any; }; ignoreErrorResponses?: boolean; selectQueryOrMutationField?: SelectQueryOrMutationFieldConfig[]; queryParams?: any; /** * Timeout for the HTTP request in milliseconds */ timeout?: number; } /** * Handler for SOAP */ export interface SoapHandler { /** * A url to your WSDL or generated SDL with annotations */ source: string; /** * JSON object representing the Headers to add to the runtime of the API calls only for schema introspection * You can also provide `.js` or `.ts` file path that exports schemaHeaders as an object */ schemaHeaders?: any; /** * JSON object representing the Headers to add to the runtime of the API calls only for operation during runtime */ operationHeaders?: { [k: string]: any; }; /** * The name of the alias to be used in the envelope for body components * * default: `body` */ bodyAlias?: string; soapHeaders?: SOAPHeaders; /** * The namespace of the SOAP envelope * By default, SOAP handler detects the SOAP version and if SOAP version is 1.1, * it uses `http://schemas.xmlsoap.org/soap/envelope/` namespace * If SOAP version is 1.2, it uses `http://www.w3.org/2003/05/soap-envelope` namespace */ soapNamespace?: string; } /** * SOAP Headers to be added to the request */ export interface SOAPHeaders { /** * The name of the alias to be used in the envelope * * default: `header` */ alias?: string; /** * The namespace of the SOAP Header * For example: `http://www.example.com/namespace` */ namespace: string; /** * The content of the SOAP Header * For example: { "key": "value" } then the content will be `<key>value</key>` */ headers: { [k: string]: any; }; } export interface SupergraphHandler { /** * A file path to your Supergraph Schema * If you provide a path to a code file(js or ts), * other options will be ignored and the schema exported from the file will be used directly. */ source: string; schemaHeaders?: any; operationHeaders?: any; batch?: boolean; subgraphs?: SubgraphConfiguration[]; } export interface SubgraphConfiguration { /** * The name of the subgraph you want to configure */ name: string; /** * A url or file path to your remote GraphQL endpoint. * If you provide a path to a code file(js or ts), * other options will be ignored and the schema exported from the file will be used directly. */ endpoint?: string; /** * JSON object representing the Headers to add to the runtime of the API calls only for operation during runtime */ operationHeaders?: { [k: string]: any; }; /** * Use HTTP GET for Query operations */ useGETForQueries?: boolean; /** * HTTP method used for GraphQL operations (Allowed values: GET, POST) */ method?: 'GET' | 'POST'; /** * Request Credentials if your environment supports it. * [See more](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials) * * @default "same-origin" (Allowed values: omit, include) */ credentials?: 'omit' | 'include'; /** * Path to a custom W3 Compatible WebSocket Implementation */ webSocketImpl?: string; /** * Path to the introspection * You can separately give schema introspection or SDL */ source?: string; /** * SSE - Server Sent Events * WS - New graphql-ws * LEGACY_WS - Legacy subscriptions-transport-ws (Allowed values: SSE, WS, LEGACY_WS) */ subscriptionsProtocol?: 'SSE' | 'WS' | 'LEGACY_WS'; /** * URL to your endpoint serving all subscription queries for this source */ subscriptionsEndpoint?: string; /** * Retry attempts if fails */ retry?: number; /** * Timeout in milliseconds */ timeout?: number; /** * JSON object representing the `connectionParams` from a WebSocket connection to add to the runtime of the API calls only for operation during runtime. * More information about the WebSocket `connectionParams`: * - When using `subscriptionsProtocol=WS` (graphql-ws): https://github.com/enisdenjo/graphql-ws/blob/master/docs/interfaces/client.ClientOptions.md#connectionparams * - When using `subscriptionsProtocol=LEGACY_WS` (subscriptions-transport-ws): https://github.com/apollographql/subscriptions-transport-ws/blob/51270cc7dbaf09c7b9aa67368f1de58148c7d334/README.md#subscriptionclient */ connectionParams?: { [k: string]: any; }; } /** * Handler for OData */ export interface ThriftHandler { /** * The name of the host to connect to. */ hostName: string; /** * The port number to attach to on the host. */ port: number; /** * The path on which the Thrift service is listening. Defaults to '/thrift'. */ path?: string; /** * Boolean value indicating whether to use https. Defaults to false. */ https?: boolean; /** * Name of the Thrift protocol type to use. Defaults to 'binary'. (Allowed values: binary, compact, json) */ protocol?: 'binary' | 'compact' | 'json'; /** * The name of your service. Used for logging. */ serviceName: string; /** * JSON object representing the Headers to add to the runtime of the API calls */ operationHeaders?: { [k: string]: any; }; /** * If you are using a remote URL endpoint to fetch your schema, you can set headers for the HTTP request to fetch your schema. */ schemaHeaders?: { [k: string]: any; }; /** * Path to IDL file */ idl: string; } /** * Handler for SQLite database, based on `tuql` */ export interface TuqlHandler { /** * Pointer to your SQLite database */ db?: string; /** * Path to the SQL Dump file if you want to build a in-memory database */ infile?: string; } export interface Transform { /** * Transformer to apply caching for your data sources */ cache?: CacheTransformConfig[]; encapsulate?: EncapsulateTransformObject; extend?: ExtendTransform; federation?: FederationTransform; /** * Transformer to filter (white/black list) GraphQL types, fields and arguments (Any of: FilterSchemaTransform, Any) */ filterSchema?: FilterSchemaTransform | any; /** * Transformer to hoist GraphQL fields */ hoistField?: HoistFieldTransformConfig[]; namingConvention?: NamingConventionTransformConfig; prefix?: PrefixTransformConfig; prune?: PruneTransformConfig; /** * RateLimit transform */ rateLimit?: RateLimitTransformConfig[]; /** * Transformer to rename GraphQL types and fields (Any of: RenameTransform, Any) */ rename?: RenameTransform | any; replaceField?: ReplaceFieldTransformConfig; /** * Transformer to apply composition to resolvers (Any of: ResolversCompositionTransform, Any) */ resolversComposition?: ResolversCompositionTransform | any; transferSchema?: TransferSchemaTransformConfig; typeMerging?: TypeMergingConfig; [k: string]: any; } export interface CacheTransformConfig { /** * The type and field to apply cache to, you can use wild cards as well, for example: `Query.*` */ field: string; /** * Cache key to use to store your resolvers responses. * The default is: `{typeName}-{fieldName}-{argsHash}-{fieldNamesHash}` * * Available variables: * - `{args.argName}` - use resolver argument * - `{typeName}` - use name of the type * - `{fieldName}` - use name of the field * - `{argsHash}` - a hash based on the 'args' object * - `{fieldNamesHash}` - a hash based on the field names selected by the client * - `{info}` - the GraphQLResolveInfo of the resolver * * Available interpolations: * - `{format|date}` - returns the current date with a specific format */ cacheKey?: string; invalidate?: CacheInvalidateConfig; } /** * Invalidation rules */ export interface CacheInvalidateConfig { /** * Invalidate the cache when a specific operation is done without an error */ effectingOperations?: CacheEffectingOperationConfig[]; /** * Specified in seconds, the time-to-live (TTL) value limits the lifespan */ ttl?: number; } export interface CacheEffectingOperationConfig { /** * Path to the operation that could effect it. In a form: Mutation.something. Note that wildcard is not supported in this field. */ operation: string; /** * Cache key to invalidate on successful resolver (no error), see `cacheKey` for list of available options in this field. */ matchKey?: string; } /** * Transformer to apply encapsulation to the API source, by creating a field for it under the root query */ export interface EncapsulateTransformObject { /** * Optional, name to use for grouping under the root types. If not specific, the API name is used. */ name?: string; applyTo?: EncapsulateTransformApplyTo; } /** * Allow you to choose which root operations you would like to apply. By default, it's applied to all root types. */ export interface EncapsulateTransformApplyTo { query?: boolean; mutation?: boolean; subscription?: boolean; } export interface ExtendTransform { typeDefs?: any; resolvers?: any; } export interface FederationTransform { types?: FederationTransformType[]; /** * Version of the federation spec * Default: v2.0 */ version?: string; } export interface FederationTransformType { name: string; config?: FederationObjectConfig; } export interface FederationObjectConfig { key?: FederationObjectKeyConfig[]; shareable?: boolean; extends?: boolean; fields?: FederationField[]; /** * Any of: String, ResolveReferenceObject */ resolveReference?: string | ResolveReferenceObject; } export interface FederationObjectKeyConfig { fields?: string; } export interface FederationField { name: string; config: FederationFieldConfig; } export interface FederationFieldConfig { external?: boolean; provides?: FederationFieldProvidesConfig; requires?: FederationFieldRequiresConfig; tag?: FederationFieldTagConfig; inaccessible?: boolean; override?: FederationFieldOverrideConfig; } export interface FederationFieldProvidesConfig { fields?: string; } export interface FederationFieldRequiresConfig { fields?: string; } export interface FederationFieldTagConfig { name?: string; } export interface FederationFieldOverrideConfig { from?: string; } export interface ResolveReferenceObject { /** * Name of root field name that resolves the reference */ queryFieldName: string; /** * You need configure the arguments for that field; * ```yaml * args: * someArg: "{root.someKeyValue}" * ``` */ args?: { [k: string]: any; }; } export interface FilterSchemaTransform { /** * Specify to apply filter-schema transforms to bare schema or by wrapping original schema (Allowed values: bare, wrap) */ mode?: 'bare' | 'wrap'; /** * Array of filter rules */ filters: string[]; /** * Filter deprecated types */ filterDeprecatedTypes?: boolean; /** * Filter deprecated fields */ filterDeprecatedFields?: boolean; } export interface HoistFieldTransformConfig { /** * Type name that defines where field should be hoisted to */ typeName: string; /** * Array of fieldsNames to reach the field to be hoisted (Any of: String, HoistFieldTransformFieldPathConfigObject) */ pathConfig: (string | HoistFieldTransformFieldPathConfigObject)[]; /** * Name the hoisted field should have when hoisted to the type specified in typeName */ newFieldName: string; alias?: string; /** * Defines if args in path are filtered (default = false) */ filterArgsInPath?: boolean; } export interface HoistFieldTransformFieldPathConfigObject { /** * Field name */ fieldName: string; /** * Match fields based on argument, needs to implement `(arg: GraphQLArgument) => boolean`; */ filterArgs: string[]; } /** * Transformer to apply naming convention to GraphQL Types */ export interface NamingConventionTransformConfig { /** * Specify to apply naming-convention transforms to bare schema or by wrapping original schema (Allowed values: bare, wrap) */ mode?: 'bare' | 'wrap'; /** * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase */ typeNames?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase'; /** * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase */ fieldNames?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase'; /** * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase */ enumValues?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase'; /** * Allowed values: camelCase, capitalCase, constantCase, dotCase, headerCase, noCase, paramCase, pascalCase, pathCase, sentenceCase, snakeCase, upperCase, lowerCase */ fieldArgumentNames?: 'camelCase' | 'capitalCase' | 'constantCase' | 'dotCase' | 'headerCase' | 'noCase' | 'paramCase' | 'pascalCase' | 'pathCase' | 'sentenceCase' | 'snakeCase' | 'upperCase' | 'lowerCase'; } /** * Prefix transform */ export interface PrefixTransformConfig { /** * Specify to apply prefix transform to bare schema or by wrapping original schema (Allowed values: bare, wrap) */ mode?: 'bare' | 'wrap'; /** * The prefix to apply to the schema types. By default it's the API name. */ value?: string; /** * List of ignored types */ ignore?: string[]; /** * Changes root types and changes the field names (default: false) */ includeRootOperations?: boolean; /** * Changes types (default: true) */ includeTypes?: boolean; /** * Protected custom scalars (e.g. from graphql-scalars) to still prefix. * GraphQL specified scalars (Int, Float, String, Boolean, ID) always stay unprefixed. */ force?: string[]; } /** * Prune transform */ export interface PruneTransformConfig { /** * Types to skip pruning */ skipPruning?: string[]; /** * Set to `true` to skip pruning object types or interfaces with no fields */ skipEmptyCompositeTypePruning?: boolean; /** * Set to `true` to skip pruning interfaces that are not implemented by any other types */ skipUnimplementedInterfacesPruning?: boolean; /** * Set to `true` to skip pruning empty unions */ skipEmptyUnionPruning?: boolean; /** * Set to `true` to skip pruning unused types */ skipUnusedTypesPruning?: boolean; } export interface RateLimitTransformConfig { /** * The type name that the following field belongs to */ type: string; /** * The field of the type that the rate limit is applied to */ field: string; /** * The maximum number of requests that can be made in a given time period */ max: number; /** * The time period in which the rate limit is applied */ ttl: number; /** * The identifier expression that determines the identity of the request (e.g. `{context.req.socket.remoteAddress}`) */ identifier: string; } export interface RenameTransform { /** * Specify to apply rename transforms to bare schema or by wrapping original schema (Allowed values: bare, wrap) */ mode?: 'bare' | 'wrap'; /** * Array of rename rules */ renames: RenameTransformObject[]; } export interface RenameTransformObject { from: RenameConfig; to: RenameConfig1; /** * Use Regular Expression for type names */ useRegExpForTypes?: boolean; /** * Use Regular Expression for field names */ useRegExpForFields?: boolean; /** * Use Regular Expression for field names */ useRegExpForArguments?: boolean; /** * Flags to use in the Regular Expression */ regExpFlags?: string; /** * Flag to indicate whether certain default types (built-ins, scalars and other types specified an exclusion list) should be renamed or not. * * @default: false */ includeDefaults?: boolean; } export interface RenameConfig { type?: string; field?: string; argument?: string; } export interface RenameConfig1 { type?: string; field?: string; argument?: string; } /** * Transformer to replace GraphQL field with partial of full config from a different field */ export interface ReplaceFieldTransformConfig { /** * Additional type definition to used to replace field types */ typeDefs?: any; /** * Array of rules to replace fields */ replacements: ReplaceFieldTransformObject[]; } export interface ReplaceFieldTransformObject { from: ReplaceFieldConfig; to: ReplaceFieldConfig1; /** * Allowed values: config, hoistValue */ scope?: 'config' | 'hoistValue'; composer?: any; name?: string; } export interface ReplaceFieldConfig { type: string; field: string; } export interface ReplaceFieldConfig1 { type: string; field: string; } export interface ResolversCompositionTransform { /** * Specify to apply resolvers-composition transforms to bare schema or by wrapping original schema (Allowed values: bare, wrap) */ mode?: 'bare' | 'wrap'; /** * Array of resolver/composer to apply */ compositions: ResolversCompositionTransformObject[]; } export interface ResolversCompositionTransformObject { /** * The GraphQL Resolver path * Example: Query.users */ resolver: string; /** * Path to the composer function * Example: ./src/auth.js#authComposer */ composer: any; } /** * Transformer to transfer (move or copy) GraphQL parts of GraphQL schema across Types and Fields */ export interface TransferSchemaTransformConfig { /** * Array of rules to transfer fields or args */ transfers: TransferSchemaTransformObject[]; } export interface TransferSchemaTransformObject { from: string; to: string; /** * Allowed values: move, copy */ action?: 'move' | 'copy'; } /** * [Type Merging](https://www.graphql-tools.com/docs/stitch-type-merging) Configuration */ export interface TypeMergingConfig { types?: MergedTypeConfig[]; /** * Denotes a root field used to query a merged type across services. * The marked field's name is analogous * to the fieldName setting in * [merged type configuration](https://www.graphql-tools.com/docs/stitch-type-merging#basic-example), * while the field's arguments and return type are used to infer merge configuration. * Directive arguments tune the merge behavior */ queryFields?: MergedRootFieldConfig[]; /** * The path to a code file that has additional type merging configuration */ additionalConfiguration?: any; } export interface MergedTypeConfig { /** * Name of the type (Query by default) */ typeName?: string; key?: KeyAnnotation; /** * Specifies types and fields * that provide a [canonical definition](https://www.graphql-tools.com/docs/stitch-type-merging#canonical-definitions) to be