import { z } from '../zod.js'; import type { AuthenticationConfiguration } from './authentication-configuration.js'; import { type SourceConfiguration } from './source-configuration.js'; import type { ApiReferenceLocalization } from './types.js'; /** * Standard configuration for the Api Reference. * * This is used internally to the configure the applications and does not include the sources. * * Sources should only be specified in the user facing configurations. * * In the the future it is likely sources will be removed completely from the configuration and instead * specified through a separate addDocument interface. */ export declare const apiReferenceConfigurationSchema: z.ZodObject<{ title: z.ZodOptional; slug: z.ZodOptional; authentication: z.ZodOptional; baseServerURL: z.ZodOptional; hideClientButton: z.ZodCatch>>; proxyUrl: z.ZodOptional; oauth2RedirectUri: z.ZodOptional; searchHotKey: z.ZodOptional>; servers: z.ZodOptional>; showSidebar: z.ZodCatch>>; showDeveloperTools: z.ZodCatch>>>; showToolbar: z.ZodCatch>>>; operationTitleSource: z.ZodCatch>>>; theme: z.ZodCatch>>>; _integration: z.ZodOptional>>; onRequestSent: z.ZodOptional, z.ZodVoid>>; persistAuth: z.ZodCatch>>; telemetry: z.ZodDefault>; externalUrls: z.ZodPrefault; registryUrl: z.ZodPrefault; proxyUrl: z.ZodPrefault; apiBaseUrl: z.ZodPrefault; }, z.core.$strip>>; layout: z.ZodCatch>>>; proxy: z.ZodOptional; fetch: z.ZodOptional Promise, (input: string | URL | Request, init?: RequestInit) => Promise>>; customFetch: z.ZodOptional Promise, (input: string | URL | Request, init?: RequestInit) => Promise>>; plugins: z.ZodOptional, z.ZodObject<{ name: z.ZodString; extensions: z.ZodArray; }, z.core.$strip>>; views: z.ZodOptional; props: z.ZodOptional>; sidebar: z.ZodOptional; label: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>>>; 'content.end': z.ZodOptional; props: z.ZodOptional>; sidebar: z.ZodOptional; label: z.ZodString; }, z.core.$strip>>; }, z.core.$strip>>>; }, z.core.$strip>>; documentTypes: z.ZodOptional) => boolean, (document: Record) => boolean>; ingest: z.ZodOptional, context: { documentName: string; }) => Record | Promise>, (document: Record, context: { documentName: string; }) => Record | Promise>>>; bundle: z.ZodOptional; traverse: z.ZodCustom<(context: { documentName: string; documentId: string; document: Record; }) => import("./api-reference-plugin.js").PluginNavigationEntry[], (context: { documentName: string; documentId: string; document: Record; }) => import("./api-reference-plugin.js").PluginNavigationEntry[]>; content: z.ZodObject<{ component: z.ZodUnknown; renderer: z.ZodOptional; props: z.ZodOptional>; }, z.core.$strip>; }, z.core.$strip>>>; markdown: z.ZodOptional>; hooks: z.ZodOptional>; slug: z.ZodOptional>; authentication: z.ZodOptional>; baseServerURL: z.ZodOptional>; hideClientButton: z.ZodOptional>>>; proxyUrl: z.ZodOptional>; oauth2RedirectUri: z.ZodOptional>; searchHotKey: z.ZodOptional>>; servers: z.ZodOptional>>; showSidebar: z.ZodOptional>>>; showDeveloperTools: z.ZodOptional>>>>; showToolbar: z.ZodOptional>>>>; operationTitleSource: z.ZodOptional>>>>; theme: z.ZodOptional>>>>; _integration: z.ZodOptional>>>; onRequestSent: z.ZodOptional, z.ZodVoid>>>; persistAuth: z.ZodOptional>>>; plugins: z.ZodOptional, z.ZodObject<{ name: z.ZodString; views: z.ZodOptional; component: z.ZodUnknown; props: z.ZodOptional>; }, z.core.$strip>>>; 'response.section': z.ZodOptional; component: z.ZodUnknown; props: z.ZodOptional>; }, z.core.$strip>>>; }, z.core.$strip>>; hooks: z.ZodOptional], null>, z.core.$ZodFunctionOut>>; onResponseReceived: z.ZodOptional; operation: z.ZodRecord; }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>; }, z.core.$strip>>; }, z.core.$strip>>>>>; telemetry: z.ZodOptional>>; externalUrls: z.ZodOptional; registryUrl: z.ZodPrefault; proxyUrl: z.ZodPrefault; apiBaseUrl: z.ZodPrefault; }, z.core.$strip>>>; }, z.core.$strip>; auth: z.ZodCustom; }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>; onConfigChange: z.ZodOptional>; slug: z.ZodOptional>; authentication: z.ZodOptional>; baseServerURL: z.ZodOptional>; hideClientButton: z.ZodOptional>>>; proxyUrl: z.ZodOptional>; oauth2RedirectUri: z.ZodOptional>; searchHotKey: z.ZodOptional>>; servers: z.ZodOptional>>; showSidebar: z.ZodOptional>>>; showDeveloperTools: z.ZodOptional>>>>; showToolbar: z.ZodOptional>>>>; operationTitleSource: z.ZodOptional>>>>; theme: z.ZodOptional>>>>; _integration: z.ZodOptional>>>; onRequestSent: z.ZodOptional, z.ZodVoid>>>; persistAuth: z.ZodOptional>>>; plugins: z.ZodOptional, z.ZodObject<{ name: z.ZodString; views: z.ZodOptional; component: z.ZodUnknown; props: z.ZodOptional>; }, z.core.$strip>>>; 'response.section': z.ZodOptional; component: z.ZodUnknown; props: z.ZodOptional>; }, z.core.$strip>>>; }, z.core.$strip>>; hooks: z.ZodOptional], null>, z.core.$ZodFunctionOut>>; onResponseReceived: z.ZodOptional; operation: z.ZodRecord; }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>; }, z.core.$strip>>; }, z.core.$strip>>>>>; telemetry: z.ZodOptional>>; externalUrls: z.ZodOptional; registryUrl: z.ZodPrefault; proxyUrl: z.ZodPrefault; apiBaseUrl: z.ZodPrefault; }, z.core.$strip>>>; }, z.core.$strip>; auth: z.ZodCustom; }, z.core.$strip>], null>, z.core.$ZodFunctionOut>>; onDestroy: z.ZodOptional, z.core.$ZodFunctionOut>>; }, z.core.$strip>>; apiClientPlugins: z.ZodOptional>; }, z.core.$strip>>>>; pluginUrls: z.ZodOptional>; isEditable: z.ZodCatch>>; hideModels: z.ZodCatch>>; hideModelNames: z.ZodCatch>>; modelsSectionLabel: z.ZodCatch, z.ZodLiteral<"Schemas">, z.ZodString]>>>>; localization: z.ZodType>; documentDownloadType: z.ZodCatch>>>; hideDownloadButton: z.ZodOptional; hideTestRequestButton: z.ZodCatch>>; hideSearch: z.ZodCatch>>; showOperationId: z.ZodCatch>>; showBadgesInSidebar: z.ZodCatch>>; showExtensions: z.ZodOptional>; darkMode: z.ZodOptional; forceDarkModeState: z.ZodOptional>; hideDarkModeToggle: z.ZodCatch>>; metaData: z.ZodOptional; favicon: z.ZodOptional; hiddenClients: z.ZodOptional>]>>, z.ZodArray>, z.ZodLiteral]>>; persistSelectedClient: z.ZodCatch>>; defaultHttpClient: z.ZodOptional; clientKey: z.ZodCustom<"laravel" | "libcurl" | "clj_http" | "httpclient" | "restsharp" | "http" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "aiohttp" | "httpx_sync" | "httpx_async" | "httr2" | "reqwest" | "httpie" | "wget", "laravel" | "libcurl" | "clj_http" | "httpclient" | "restsharp" | "http" | "native" | "http1.1" | "asynchttp" | "nethttp" | "okhttp" | "unirest" | "axios" | "fetch" | "jquery" | "ofetch" | "xhr" | "undici" | "nsurlsession" | "cohttp" | "curl" | "guzzle" | "restmethod" | "webrequest" | "python3" | "requests" | "aiohttp" | "httpx_sync" | "httpx_async" | "httr2" | "reqwest" | "httpie" | "wget">; }, z.core.$strip>, z.ZodObject<{ targetKey: z.ZodLiteral<"custom">; clientKey: z.ZodString; }, z.core.$strip>]>>; featuredClients: z.ZodOptional>>; showDefaultClientsWithSdkInstallation: z.ZodOptional; defaultRequestBodyView: z.ZodOptional>; multipartNaming: z.ZodOptional>; customCss: z.ZodOptional; onServerChange: z.ZodOptional, z.ZodVoid>>; onDocumentSelect: z.ZodType<(() => Promise | void) | undefined>; onLoaded: z.ZodType<((slug: string) => Promise | void) | undefined>; onBeforeRequest: z.ZodType<((a: { request: Request; requestBuilder: any; envVariables: Record; }) => Promise | void) | undefined>; onRequestBuilt: z.ZodType<((a: { request: Request; requestBuilder: any; envVariables: Record; }) => Promise | void) | undefined>; onResponseReceived: z.ZodType<((input: { response: Response; request: Request; }) => Response | void | Promise) | undefined>; onShowMore: z.ZodType<((a: string) => Promise | void) | undefined>; onSidebarClick: z.ZodType<((a: string) => Promise | void) | undefined>; urlRouting: z.ZodOptional; pathRouting: z.ZodOptional>; mcp: z.ZodOptional; url: z.ZodOptional; disabled: z.ZodOptional; }, z.core.$strip>>; generateHeadingSlug: z.ZodOptional; }, z.core.$strip>], null>, z.ZodString>>; generateModelSlug: z.ZodOptional; }, z.core.$strip>], null>, z.ZodString>>; generateTagSlug: z.ZodOptional; }, z.core.$strip>], null>, z.ZodString>>; generateOperationSlug: z.ZodOptional; method: z.ZodString; summary: z.ZodOptional; }, z.core.$strip>], null>, z.ZodString>>; generateWebhookSlug: z.ZodOptional; }, z.core.$strip>], null>, z.ZodString>>; setPageTitle: z.ZodOptional; }, z.core.$strip>], null>, z.ZodString>>; redirect: z.ZodOptional, z.ZodOptional>>>; withDefaultFonts: z.ZodCatch>>; defaultOpenFirstTag: z.ZodCatch>>; defaultOpenAllTags: z.ZodCatch>>; expandAllModelSections: z.ZodCatch>>; expandAllParameters: z.ZodCatch>>; expandAllResponses: z.ZodCatch>>; expandAllSchemaProperties: z.ZodCatch>>; maxVisibleRequestBodyProperties: z.ZodCatch>>; tagsSorter: z.ZodOptional, z.ZodFunction, z.ZodNumber>]>>; operationsSorter: z.ZodOptional, z.ZodLiteral<"method">, z.ZodFunction, z.ZodNumber>]>>; orderSchemaPropertiesBy: z.ZodCatch, z.ZodLiteral<"preserve">]>>>>; schemaKeyboardNav: z.ZodCatch>>; orderRequiredPropertiesFirst: z.ZodCatch>>; }, z.core.$strip>; /** * Pure configuration without the sources * * @deprecated Remove this once the types have been fully migrated */ export type ApiReferenceConfigurationRaw = Omit, // Remove deprecated attributes // Remove deprecated attributes 'proxy' | 'spec' | 'authentication' | 'showToolbar'> & { authentication?: AuthenticationConfiguration; }; /** * Configuration for the Scalar Api Reference integrations * * See the type `ApiReferenceConfigurationWithSource` or `AnyApiReferenceConfiguration`\ * for the configuration that includes the sources for you OpenAPI documents */ export type ApiReferenceConfiguration = ApiReferenceConfigurationRaw & { /** @deprecated * This type now refers to the base configuration that does not include the sources. * Use the type `ApiReferenceConfigurationWithSource` instead. */ url?: SourceConfiguration['url']; /** @deprecated * This type now refers to the base configuration that does not include the sources. * Use the type `ApiReferenceConfigurationWithSource` instead. */ content?: SourceConfiguration['content']; /** * Fired before the outbound request is built and sent. Mutate the **request builder** so the eventual fetch call * reflects your changes (method, path, headers, body, and related fields). * * The `request` passed here is **not** the object sent over the wire; the actual request is rebuilt from the builder * afterwards. Use `onRequestBuilt` instead when you need the exact outgoing request (for example, to hash a * `multipart/form-data` body for request signing). * * **Experimental:** The builder matches {@link https://github.com/scalar/scalar/blob/main/packages/workspace-store/src/request-example/builder/request-factory.ts RequestFactory} * (`import type { RequestFactory } from '@scalar/workspace-store/request-example'`). That shape is still experimental and may change in minor releases. * * @param input - Hook argument from the integration layer. * @param input.request - **Deprecated** when treated as a fetch API `Request`. Prefer thinking of this value as the * mutable builder ({@link https://github.com/scalar/scalar/blob/main/packages/workspace-store/src/request-example/builder/request-factory.ts RequestFactory}). * Some call sites only pass this property. * @param input.requestBuilder - The same builder when exposed under this name; **prefer** mutating this when your integration provides it. * @returns void or a promise that resolves when the hook finishes * @example * ```ts * onBeforeRequest: ({ request: builder }) => { * builder.headers.set('Authorization', 'Bearer ') * } * ``` */ onBeforeRequest?: (input: { request: Request; requestBuilder: any; envVariables: Record; }) => void | Promise | undefined; /** * Fired before response processing. Return a Response to replace the body, status, or headers * used by the client, or return nothing to keep the current response. Receives a clone so * reading the body does not consume the client response. Avoid reading unbounded streams. */ onResponseReceived?: (input: { response: Response; request: Request; }) => Response | void | Promise; /** * Fired after the outbound fetch `Request` has been built, right before it is sent. The `request` is the exact * object handed to fetch: mutating its headers modifies the outgoing request, and hashing its body produces a * hash that matches what the server receives (useful for request signing — a rebuilt `multipart/form-data` body * would get a different boundary). * * Use `onBeforeRequest` instead when you need to mutate the request builder (method, path, query, body, * security); those mutations have no effect at this stage because the request is already built. * * **Experimental:** This API may change in minor releases. * * @param input - Hook argument from the integration layer. * @param input.request - The exact fetch API `Request` that will be sent. Mutate its headers to modify the outgoing request. * @param input.requestBuilder - The builder the request was built from, for inspection. Mutating it has no effect at this stage. * @param input.envVariables - Resolved environment variables for the active environment. * @returns void or a promise that resolves when the hook finishes * @example * ```ts * onRequestBuilt: async ({ request }) => { * const bodyHash = await hash(await request.clone().arrayBuffer()) * request.headers.set('X-Body-Hash', bodyHash) * } * ``` */ onRequestBuilt?: (input: { request: Request; requestBuilder: any; envVariables: Record; }) => void | Promise | undefined; }; /** Migrate the configuration through a transform */ /** Configuration for the Api Reference */ export declare const apiReferenceConfigurationWithSourceSchema: z.ZodType & SourceConfiguration>; /** * User facing configuration that includes the document source configuration */ export type ApiReferenceConfigurationWithSource = Omit, 'proxy' | 'spec' | 'authentication' | 'showToolbar'> & { authentication?: AuthenticationConfiguration; }; /** * Configuration for a single config with multiple sources * The configuration will be shared between the documents */ export type ApiReferenceConfigurationWithMultipleSources = ApiReferenceConfigurationWithSource & { sources: SourceConfiguration[]; }; /** Configuration for multiple Api References */ export type AnyApiReferenceConfiguration = Partial | Partial | Partial[] | Partial[]; //# sourceMappingURL=api-reference-configuration.d.ts.map