UNPKG

altair-graphql-core

Version:

Several of the core logic for altair graphql client

219 lines 7.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.altairConfigOptionsSchema = exports.altairWindowOptionsSchema = void 0; const v4_1 = require("zod/v4"); const schemas_1 = require("../request/schemas"); const query_schema_1 = require("../types/state/query.schema"); const input_1 = require("../authorization/input"); const environments_schema_1 = require("../types/state/environments.schema"); const settings_schema_1 = require("../types/state/settings.schema"); exports.altairWindowOptionsSchema = (0, v4_1.object)({ /** * Initial name of the window */ initialName: (0, v4_1.string)() .meta({ description: 'Initial name of the window' }) .optional(), /** * URL to set as the server endpoint */ endpointURL: (0, v4_1.string)() .meta({ description: 'URL to set as the server endpoint' }) .optional(), /** * URL to set as the subscription endpoint. This can be relative or absolute. */ subscriptionsEndpoint: (0, v4_1.string)() .meta({ description: 'URL to set as the subscription endpoint. This can be relative or absolute.', }) .optional(), /** * URL protocol for the subscription endpoint. This is used if the specified subscriptions endpoint is relative. e.g. wss */ subscriptionsProtocol: (0, v4_1.string)() .meta({ description: 'URL protocol for the subscription endpoint. This is used if the specified subscriptions endpoint is relative. e.g. wss', }) .optional(), /** * Initial query to be added */ initialQuery: (0, v4_1.string)() .meta({ description: 'Initial query to be added' }) .optional(), /** * Initial variables to be added */ initialVariables: (0, v4_1.string)() .meta({ description: 'Initial variables to be added' }) .optional(), /** * Initial pre-request script to be added */ initialPreRequestScript: (0, v4_1.string)() .meta({ description: 'Initial pre-request script to be added' }) .optional(), /** * Initial post-request script to be added */ initialPostRequestScript: (0, v4_1.string)() .meta({ description: 'Initial post-request script to be added' }) .optional(), /** * Initial headers object to be added * @example * { * 'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4' * } */ initialHeaders: (0, v4_1.record)((0, v4_1.string)(), (0, v4_1.unknown)()) .meta({ description: 'Initial headers object to be added', example: ` { "X-GraphQL-Token": "asd7-237s-2bdk-nsdk4" } `, }) .optional(), /** * Initial subscriptions provider * * @default "websocket" */ initialSubscriptionRequestHandlerId: schemas_1.requestHandlerIdsSchema .meta({ description: 'Initial subscriptions provider' }) .optional(), /** * Initial subscriptions connection params */ initialSubscriptionsPayload: (0, v4_1.record)((0, v4_1.string)(), (0, v4_1.unknown)()) .meta({ description: 'Initial subscriptions connection params' }) .optional() .nullable(), /** * Initial request handler id * @default "http" */ initialRequestHandlerId: schemas_1.requestHandlerIdsSchema .meta({ description: 'Initial request handler id', }) .optional(), /** * Additional params to be passed to the request handler */ initialRequestHandlerAdditionalParams: (0, v4_1.record)((0, v4_1.string)(), (0, v4_1.unknown)()) .meta({ description: 'Additional params to be passed to the request handler' }) .optional(), /** * Initial HTTP method to use for making requests */ initialHttpMethod: query_schema_1.httpVerbSchema .meta({ description: 'HTTP method to use for making requests' }) .optional(), /** * Initial authorization type and data */ initialAuthorization: input_1.authorizationProviderInputSchemas .meta({ description: 'Initial authorization type and data' }) .optional(), }); exports.altairConfigOptionsSchema = exports.altairWindowOptionsSchema.extend({ /** * Initial Environments to be added * @example * { * activeSubEnvironment: 'sub-1' * base: { * title: 'Environment', * variables: {} * }, * subEnvironments: [ * { * title: 'sub-1', * variables: {} * } * ] * } */ initialEnvironments: environments_schema_1.initialEnvironmentsSchema .meta({ description: 'Initial Environments to be added', example: ` { activeSubEnvironment: 'sub-1' base: { title: 'Environment', variables: {} }, subEnvironments: [ { title: 'sub-1', variables: {} } ] } `, }) .optional(), /** * Namespace for storing the data for the altair instance. * Use this when you have multiple altair instances running on the same domain. * @example * instanceStorageNamespace: 'altair_dev_' */ instanceStorageNamespace: (0, v4_1.string)() .meta({ description: 'Namespace for storing the data for the altair instance. Use this when you have multiple altair instances running on the same domain.', }) .optional(), /** * Initial app settings to use */ initialSettings: settings_schema_1.settingsSchema .partial() .meta({ description: 'Initial app settings to use' }) .optional() .nullable(), /** * Indicates if the state should be preserved for subsequent app loads * * @default true */ preserveState: (0, v4_1.boolean)() .meta({ description: 'Indicates if the state should be preserved for subsequent app loads', }) .optional(), /** * List of options for windows to be loaded */ initialWindows: (0, v4_1.array)(exports.altairWindowOptionsSchema) .meta({ description: 'List of options for windows to be loaded' }) .optional(), /** * Persisted settings for the app. The settings will be merged with the app settings. */ persistedSettings: settings_schema_1.partialSettingsSchema .meta({ description: 'Persisted settings for the app. The settings will be merged with the app settings.', }) .optional(), /** * Disable the account and remote syncing functionality */ disableAccount: (0, v4_1.boolean)() .meta({ description: 'Disable the account and remote syncing functionality', }) .optional(), /** * CSP nonce value to be used in Altair */ cspNonce: (0, v4_1.string)() .meta({ description: 'CSP nonce value to be used in Altair' }) .optional(), }); //# sourceMappingURL=options.schema.js.map