UNPKG

altair-static

Version:

Static package for altair graphql client

563 lines (559 loc) 14.8 kB
// Generated by dts-bundle-generator v9.5.1 export function getAltairHtml(): string; export type IDictionary<V = any> = Record<string, V>; export interface BaseAuthorizationProviderInput { type: string; data: unknown; } export interface ApiKeyAuthorizationProviderInput extends BaseAuthorizationProviderInput { type: "api-key"; data: { headerName: string; headerValue: string; }; } export interface BasicAuthorizationProviderInput { type: "basic"; data: { username: string; password: string; }; } export interface BearerAuthorizationProviderInput { type: "bearer"; data: { token: string; }; } export interface AccessTokenResponse { /** * The access token issued by the authorization server */ access_token: string; /** * The type of the token issued */ token_type: string; /** * The exact value of the state parameter passed by the client in the authorization request */ state: string; /** * The lifetime in seconds of the access token */ expires_in?: number; refresh_token?: string; id_token?: string; scope?: string; } export interface OAuth2AuthorizationProviderInput { type: "oauth2"; data: { accessTokenResponse: AccessTokenResponse; }; } export interface NoneAuthorizationProviderInput { type: "none"; data?: undefined; } export type AuthorizationProviderInput = NoneAuthorizationProviderInput | ApiKeyAuthorizationProviderInput | BasicAuthorizationProviderInput | BearerAuthorizationProviderInput | OAuth2AuthorizationProviderInput; declare const HTTP_VERBS: readonly [ "POST", "GET", "PUT", "DELETE" ]; export type HttpVerb = (typeof HTTP_VERBS)[number]; declare enum MultiResponseStrategy { /** * Automatically determine the strategy based on the response */ AUTO = "auto", /** * Concatenate all responses */ CONCATENATE = "concatenate", /** * Append responses as a list */ APPEND = "append", /** * Patch the responses together following the GraphQL spec */ PATCH = "patch" } declare const REQUEST_HANDLER_IDS: { readonly HTTP: "http"; readonly WEBSOCKET: "websocket"; readonly GRAPHQL_WS: "graphql-ws"; readonly APP_SYNC: "app-sync"; readonly ACTION_CABLE: "action-cable"; readonly GRAPHQL_SSE: "graphql-sse"; }; export type RequestHandlerIds = (typeof REQUEST_HANDLER_IDS)[keyof typeof REQUEST_HANDLER_IDS]; export interface InitialBaseEnvironmentState { id?: string; title?: string; variables?: IDictionary; } export interface InitialEnvironmentState { id?: string; title?: string; variables?: IDictionary; } export interface IInitialEnvironments { activeSubEnvironment?: string; base?: InitialBaseEnvironmentState; subEnvironments?: InitialEnvironmentState[]; } export interface ITheme { easing: string; colors: { black: string; darkGray: string; gray: string; lightGray: string; white: string; green: string; blue: string; rose: string; cerise: string; red: string; orange: string; yellow: string; lightRed: string; darkPurple: string; primary: string; secondary: string; tertiary: string; bg: string; offBg: string; font: string; offFont: string; border: string; offBorder: string; headerBg: string; }; type: { fontSize: { base: number; remBase: number; body: number; bodySmaller: number; }; fontFamily: { default: string; }; }; isSystem: boolean; shadow: { color: string; opacity: number; }; editor: { fontFamily: { default: string; }; fontSize: number; colors: { comment: string; string: string; number: string; variable: string; keyword: string; atom: string; attribute: string; property: string; punctuation: string; definition: string; builtin: string; cursor: string; }; }; } export type RecursivePartial<T> = { [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P]; }; export type ICustomTheme = RecursivePartial<ITheme>; export type ConfigEnvironment = "development" | "production" | "testing"; export interface UrlConfig { api: string; loginClient: string; sandbox: string; docs: string; } declare class AltairConfig { private localSandboxUrl; private useLocalSandboxUrl; donation: { url: string; action_count_threshold: number; }; ga: string; add_query_depth_limit: number; tab_size: number; max_windows: number; default_language: string; languages: { "en-US": string; "fr-FR": string; "es-ES": string; "cs-CZ": string; "de-DE": string; "pt-BR": string; "ru-RU": string; "uk-UA": string; "zh-CN": string; "ja-JP": string; "sr-SP": string; "it-IT": string; "pl-PL": string; "ko-KR": string; "ro-RO": string; "vi-VN": string; }; query_history_depth: number; disableLineNumbers: boolean; defaultTheme: string; themes: string[]; isTranslateMode: any; isWebApp: any; initialData: { url: string; subscriptionsEndpoint: string; subscriptionsProtocol: string; query: string; variables: string; headers: IDictionary; environments: IInitialEnvironments; preRequestScript: string; postRequestScript: string; instanceStorageNamespace: string; settings: AltairConfigOptions["initialSettings"]; persistedSettings: AltairConfigOptions["persistedSettings"]; initialSubscriptionRequestHandlerId: AltairConfigOptions["initialSubscriptionRequestHandlerId"]; initialSubscriptionsPayload: IDictionary; initialRequestHandlerId: RequestHandlerIds; initialRequestHandlerAdditionalParams: Record<string, unknown>; initialHttpMethod: HttpVerb; preserveState: boolean; windows: AltairWindowOptions[]; disableAccount: boolean; initialAuthorization: AltairConfigOptions["initialAuthorization"]; }; constructor({ endpointURL, subscriptionsEndpoint, subscriptionsProtocol, initialQuery, initialHeaders, initialEnvironments, initialVariables, initialPreRequestScript, initialPostRequestScript, instanceStorageNamespace, initialSettings, persistedSettings, initialRequestHandlerId, initialRequestHandlerAdditionalParams, initialSubscriptionRequestHandlerId, initialSubscriptionsPayload, initialHttpMethod, preserveState, initialWindows, disableAccount, initialAuthorization, }?: AltairConfigOptions); private getPossibleLocalSandBoxUrl; private getLocalSandBoxUrl; getUrlConfig(environment?: ConfigEnvironment): UrlConfig; getUrlConfigWithLocal(environment?: ConfigEnvironment): Promise<UrlConfig>; getUrl(name: keyof UrlConfig, environment?: ConfigEnvironment): Promise<string>; } declare const config: AltairConfig; export type SettingsLanguage = keyof typeof config.languages; export interface SettingsState { /** * Specifies the theme. Themes available by default are 'light', 'dark', 'system', 'dracula'. * Additional themes can be added via plugins. * @default 'system' */ theme: string; /** * Specifies the theme for dark mode */ "theme.dark"?: string; /** * Specifies the language */ language: SettingsLanguage; /** * Specifies how deep the 'Add query' functionality should go. You can specify any valid positive integer. */ addQueryDepthLimit: number; /** * Specifies the tab size for the editor */ tabSize: number; /** * Enable experimental features. * Note: The features might be unstable * @default false */ enableExperimental?: boolean; /** * Specifies the base font size * @default 24 */ "theme.fontsize"?: number; /** * Specifies the font family for the editors. Any valid CSS font family combination can be used here */ "theme.editorFontFamily"?: string; /** * Specifies the font size for the editors */ "theme.editorFontSize"?: number; /** * Specifies if native push notifications should be disabled * @default false */ disablePushNotification?: boolean; /** * Specifies a list of enabled plugins. * * Plugins are specified in a string format `<plugin-source>:<plugin-name>@<version>::[<opt>]->[<opt-value>]`: * - `<plugin-source>`: The source of the plugin. Can be 'npm', 'url' or 'github' * - `<plugin-name>` (required): The name of the plugin. Plugin names must begin with `altair-graphql-plugin-` * - `<version>`: The version of the plugin. If not specified, the latest version will be used * - `[<opt>]->[<opt-value>]`: Additional configuration for the plugin. This is used when you specify the source as 'url'. In this case, you can specify the URL where the plugin is hosted. * * @example ['altair-graphql-plugin-some-plugin', 'npm:altair-graphql-plugin-some-plugin', 'npm:altair-graphql-plugin-some-plugin@0.3.4', 'url:altair-graphql-plugin-some-plugin@0.3.4::[url]->[http://example.com/some-plugin]'] * @default [] */ "plugin.list"?: string[]; /** * Send requests with credentials (cookies) */ "request.withCredentials"?: boolean; /** * Reload schema on app start */ "schema.reloadOnStart"?: boolean; /** * Reload schema when switching environments */ "schema.reload.onEnvChange"?: boolean; /** * Disable update notification */ "alert.disableUpdateNotification"?: boolean; /** * Disable warning alerts */ "alert.disableWarnings"?: boolean; /** * Number of items allowed in history pane */ historyDepth?: number; /** * Disable line numbers */ disableLineNumbers?: boolean; /** * Hides deprecated Doc items */ "doc.hideDeprecatedItems"?: boolean; /** * Specify custom theme config to override the specified theme values */ themeConfig?: ICustomTheme; /** * Theme config object for dark mode */ "themeConfig.dark"?: ICustomTheme; /** * Hides extensions object */ "response.hideExtensions"?: boolean; /** * Determine the handling strategy for multiple responses */ "response.stream.strategy"?: MultiResponseStrategy; /** * Contains shortcut to action mapping */ "editor.shortcuts"?: Record<string, string>; /** * Disable new editor beta */ "beta.disable.newEditor"?: boolean; /** * Disable new script beta */ "beta.disable.newScript"?: boolean; /** * List of cookies to be accessible in the pre-request script * @example ['cookie1', 'cookie2'] * @default [] */ "script.allowedCookies"?: string[]; /** * Enable the scrollbar in the tab list */ enableTablistScrollbar?: boolean; /** * Whether to include descriptions in the introspection result */ "introspection.options.description"?: boolean; /** * Whether to include `specifiedByUrl` in the introspection result */ "introspection.options.specifiedByUrl"?: boolean; /** * Whether to include `isRepeatable` flag on directives */ "introspection.options.directiveIsRepeatable"?: boolean; /** * Whether to include `description` field on schema */ "introspection.options.schemaDescription"?: boolean; /** * Whether target GraphQL server supports deprecation of input values */ "introspection.options.inputValueDeprecation"?: boolean; } export interface AltairWindowOptions { /** * Initial name of the window */ initialName?: string; /** * URL to set as the server endpoint */ endpointURL?: string; /** * URL to set as the subscription endpoint. This can be relative or absolute. */ subscriptionsEndpoint?: string; /** * URL protocol for the subscription endpoint. This is used if the specified subscriptions endpoint is relative. * e.g. wss */ subscriptionsProtocol?: string; /** * Initial query to be added */ initialQuery?: string; /** * Initial variables to be added */ initialVariables?: string; /** * Initial pre-request script to be added */ initialPreRequestScript?: string; /** * Initial post-request script to be added */ initialPostRequestScript?: string; /** * Initial headers object to be added * @example * { * 'X-GraphQL-Token': 'asd7-237s-2bdk-nsdk4' * } */ initialHeaders?: IDictionary; /** * Initial subscriptions provider * * @default "websocket" */ initialSubscriptionRequestHandlerId?: RequestHandlerIds; /** * Initial subscriptions connection params */ initialSubscriptionsPayload?: IDictionary; /** * Initial request handler id * * @default "http" */ initialRequestHandlerId?: RequestHandlerIds; /** * Additional params to be passed to the request handler */ initialRequestHandlerAdditionalParams?: Record<string, unknown>; /** * HTTP method to use for making requests */ initialHttpMethod?: HttpVerb; /** * Initial authorization type and data */ initialAuthorization?: AuthorizationProviderInput; } export interface AltairConfigOptions extends AltairWindowOptions { /** * Initial Environments to be added * @example * { * activeSubEnvironment: 'sub-1' * base: { * title: 'Environment', * variables: {} * }, * subEnvironments: [ * { * title: 'sub-1', * variables: {} * } * ] * } */ initialEnvironments?: IInitialEnvironments; /** * 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?: string; /** * Initial app settings to use */ initialSettings?: Partial<SettingsState>; /** * Indicates if the state should be preserved for subsequent app loads * * @default true */ preserveState?: boolean; /** * List of options for windows to be loaded */ initialWindows?: AltairWindowOptions[]; /** * Persisted settings for the app. The settings will be merged with the app settings. */ persistedSettings?: Partial<SettingsState>; /** * Disable the account and remote syncing functionality */ disableAccount?: boolean; } /** * Returns the path to Altair assets, for resolving the assets when rendering Altair */ export declare const getDistDirectory: () => string; export interface RenderOptions extends AltairConfigOptions { /** * URL to be used as a base for relative URLs */ baseURL?: string; /** * Whether to render the initial options in a seperate javascript file or not. * Use this to be able to enforce strict CSP rules. * @default false */ serveInitialOptionsInSeperateRequest?: boolean | string; } /** * Render Altair Initial options as a string using the provided renderOptions * @param renderOptions * @deprecated Use renderInitSnippet instead */ export declare const renderInitialOptions: (options?: RenderOptions) => string; /** * Render Altair init JS snippet as a string using the provided renderOptions * @param renderOptions */ export declare const renderInitSnippet: (options?: RenderOptions) => string; /** * Render Altair as a string using the provided renderOptions * @param renderOptions */ export declare const renderAltair: (options?: RenderOptions) => string; export { renderAltair as default, }; export {};