UNPKG

@scalar/api-client

Version:

the open source API testing client

984 lines (983 loc) 268 kB
import type { SecurityScheme } from '@scalar/oas-utils/entities/spec'; import { type Workspace } from '@scalar/oas-utils/entities/workspace'; import type { Path, PathValue } from '@scalar/object-utils/nested'; import { type ApiClientConfiguration } from '@scalar/types/api-reference'; import type { OpenAPI } from '@scalar/types/legacy'; import { type Component } from 'vue'; import type { Router } from 'vue-router'; import { type ClientLayout } from '../hooks/useLayout.js'; import { type WorkspaceStore } from '../store/store.js'; export type OpenClientPayload = ({ path: string; method: OpenAPI.HttpMethod | Uppercase<OpenAPI.HttpMethod>; requestUid?: never; } | { path?: never; method?: never; requestUid: string; }) & { _source?: 'api-reference' | 'gitbook'; }; export type CreateApiClientParams = { /** Element to mount the references to */ el: HTMLElement | null; /** Main vue app component to create the vue app */ appComponent: Component; /** Configuration object for API client */ configuration?: Partial<ApiClientConfiguration>; /** Read only version of the client app */ isReadOnly?: boolean; /** Persist the workspace to localStoragfe */ persistData?: boolean; /** * Will attempt to mount the references immediately * For SSR this may need to be blocked and done client side */ mountOnInitialize?: boolean; /** Instance of a vue router */ router: Router; /** In case the store has been instantiated beforehand */ store?: WorkspaceStore | undefined; /** * The layout of the client * @see {@link ClientLayout} */ layout?: ClientLayout; }; /** * ApiClient type * * We need to do this due to some typescript type propogation errors * This is pretty much add properties as they are needed */ export type ApiClient = Omit<Awaited<ReturnType<typeof createApiClient>>, 'app' | 'store'> & { /** Add properties as they are needed, see above */ app: { unmount: () => void; }; /** * The main workspace store from the client * These refs don't wanna play nice with typescript, if we need them we can de-reference them */ store: Omit<WorkspaceStore, 'router' | 'events' | 'sidebarWidth' | 'proxyUrl' | 'requestHistory'>; }; /** * Sync method to create the api client vue app and store * * This method will NOT import the spec, just create the modal so you must use update/updateConfig before opening */ export declare const createApiClient: ({ el, appComponent, configuration: _configuration, isReadOnly, store: _store, persistData, mountOnInitialize, layout, router, }: CreateApiClientParams) => { /** The vue app instance for the modal, be careful with this */ app: import("vue").App<Element>; resetStore: () => void; /** * Update the API client config * * Deletes the current store before importing again for now, in the future will Diff and only update what is needed */ updateConfig: (_newConfig: Partial<ApiClientConfiguration>) => Promise<void>; /** Update the currently selected server via URL */ updateServer: (serverUrl: string) => void; /** Update the currently selected server via URL */ onUpdateServer: (callback: (url: string) => void) => void; /** * Update the auth values, we currently don't change the auth selection */ updateAuth: <P extends Path<SecurityScheme>>({ nameKey, propertyKey, value, }: { nameKey: string; propertyKey: P; value: NonNullable<PathValue<SecurityScheme, P>>; }) => void; /** Route to a method + path */ route: (payload?: OpenClientPayload) => void; /** Open the API client modal and optionally route to a request */ open: (payload?: OpenClientPayload) => void; /** Mount the references to a given element */ mount: (mountingEl?: HTMLElement | null) => void; /** State for controlling the modal */ modalState: { open: boolean; show: () => void; hide: () => void; }; store: { workspaces: Record<string, { uid: string & import("zod").$brand<"workspace">; name: string; description: string; collections: (string & import("zod").$brand<"collection">)[]; environments: Record<string, string>; activeEnvironmentId: string; cookies: (string & import("zod").$brand<"cookie">)[]; themeId: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "laserwave" | "none"; selectedHttpClient: { targetKey: string; clientKey: string; }; hotKeyConfig?: { modifiers: ("default" | "Meta" | "Control" | "Shift" | "Alt")[]; hotKeys?: Partial<Record<"" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "*" | "+" | "-" | "." | "/" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]" | "4" | "1" | "2" | "3" | "5" | "6" | "7" | "8" | "9", { event: "addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar"; modifiers?: ("default" | "Meta" | "Control" | "Shift" | "Alt")[] | undefined; }>> | undefined; } | undefined; proxyUrl?: string | undefined; }>; collections: Record<string, { type: "collection"; openapi: string; info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; uid: string & import("zod").$brand<"collection">; securitySchemes: string[]; selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[]; servers: (string & import("zod").$brand<"server">)[]; requests: (string & import("zod").$brand<"operation">)[]; tags: (string & import("zod").$brand<"tag">)[]; children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; jsonSchemaDialect?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { default: string; description?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; selectedServerUid?: (string & import("zod").$brand<"server">) | undefined; documentUrl?: string | undefined; integration?: string | null | undefined; }>; tags: Record<string, { type: "tag"; name: string; uid: string & import("zod").$brand<"tag">; children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[]; description?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; 'x-scalar-children'?: { tagName: string; }[] | undefined; 'x-internal'?: boolean | undefined; 'x-scalar-ignore'?: boolean | undefined; }>; cookies: Record<string, { uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }>; environments: Record<string, { uid: string & import("zod").$brand<"environment">; name: string; color: string; value: string; isDefault?: boolean | undefined; }>; requestExamples: Record<string, { uid: string & import("zod").$brand<"example">; type: "requestExample"; name: string; body: { activeBody: "raw" | "formData" | "binary"; raw?: { encoding: "html" | "xml" | "json" | "text" | "javascript" | "yaml" | "edn"; value: string; mimeType?: string | undefined; } | undefined; formData?: { encoding: "form-data" | "urlencoded"; value: { key: string; value: string; enabled: boolean; file?: any; description?: string | undefined; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; type?: string | string[] | undefined; format?: string | undefined; minimum?: number | undefined; maximum?: number | undefined; default?: any; nullable?: boolean | undefined; }[]; } | undefined; binary?: Blob | undefined; }; parameters: { path: { key: string; value: string; enabled: boolean; file?: any; description?: string | undefined; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; type?: string | string[] | undefined; format?: string | undefined; minimum?: number | undefined; maximum?: number | undefined; default?: any; nullable?: boolean | undefined; }[]; query: { key: string; value: string; enabled: boolean; file?: any; description?: string | undefined; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; type?: string | string[] | undefined; format?: string | undefined; minimum?: number | undefined; maximum?: number | undefined; default?: any; nullable?: boolean | undefined; }[]; headers: { key: string; value: string; enabled: boolean; file?: any; description?: string | undefined; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; type?: string | string[] | undefined; format?: string | undefined; minimum?: number | undefined; maximum?: number | undefined; default?: any; nullable?: boolean | undefined; }[]; cookies: { key: string; value: string; enabled: boolean; file?: any; description?: string | undefined; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; type?: string | string[] | undefined; format?: string | undefined; minimum?: number | undefined; maximum?: number | undefined; default?: any; nullable?: boolean | undefined; }[]; }; requestUid?: (string & import("zod").$brand<"operation">) | undefined; serverVariables?: Record<string, string[]> | undefined; }>; requests: Record<string, { type: "request"; uid: string & import("zod").$brand<"operation">; path: string; method: "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"; servers: (string & import("zod").$brand<"server">)[]; selectedServerUid: (string & import("zod").$brand<"server">) | null; examples: (string & import("zod").$brand<"example">)[]; selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[]; description?: string | undefined; summary?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; 'x-internal'?: boolean | undefined; 'x-scalar-ignore'?: boolean | undefined; security?: Record<string, string[]>[] | undefined; tags?: string[] | undefined; deprecated?: boolean | undefined; operationId?: string | undefined; requestBody?: any; parameters?: { in: "path" | "cookie" | "query" | "header"; name: string; required: boolean; deprecated: boolean; description?: string | undefined; schema?: unknown; content?: unknown; style?: "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined; explode?: boolean | undefined; example?: unknown; examples?: Record<string, { value?: unknown; summary?: string | undefined; externalValue?: string | undefined; }> | unknown[] | undefined; }[] | undefined; responses?: Record<string, any> | undefined; callbacks?: Record<string, Record<string, Record<string, any>>> | undefined; 'x-codeSamples'?: { source: string; lang?: string | undefined; label?: string | undefined; }[] | undefined; 'x-code-samples'?: { source: string; lang?: string | undefined; label?: string | undefined; }[] | undefined; 'x-custom-examples'?: { source: string; lang?: string | undefined; label?: string | undefined; }[] | undefined; 'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined; 'x-post-response'?: string | undefined; }>; servers: Record<string, { url: string; uid: string & import("zod").$brand<"server">; description?: string | undefined; variables?: Record<string, { enum?: string[] | undefined; default?: string | undefined; description?: string | undefined; value?: string | undefined; }> | undefined; }>; securitySchemes: Record<string, { type: "apiKey"; name: string; in: "cookie" | "query" | "header"; uid: string & import("zod").$brand<"securityScheme">; nameKey: string; value: string; description?: string | undefined; } | { type: "http"; scheme: "basic" | "bearer"; bearerFormat: string; uid: string & import("zod").$brand<"securityScheme">; nameKey: string; username: string; password: string; token: string; description?: string | undefined; } | { type: "openIdConnect"; openIdConnectUrl: string; uid: string & import("zod").$brand<"securityScheme">; nameKey: string; description?: string | undefined; } | { type: "oauth2"; flows: { implicit?: { refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": string; token: string; type: "implicit"; authorizationUrl: string; "x-scalar-redirect-uri": string; "x-scalar-security-query"?: Record<string, string> | undefined; "x-scalar-security-body"?: Record<string, string> | undefined; "x-tokenName"?: string | undefined; } | undefined; password?: { refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": string; token: string; type: "password"; tokenUrl: string; clientSecret: string; username: string; password: string; "x-scalar-security-query"?: Record<string, string> | undefined; "x-scalar-security-body"?: Record<string, string> | undefined; "x-tokenName"?: string | undefined; "x-scalar-credentials-location"?: "header" | "body" | undefined; } | undefined; clientCredentials?: { refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": string; token: string; type: "clientCredentials"; tokenUrl: string; clientSecret: string; "x-scalar-security-query"?: Record<string, string> | undefined; "x-scalar-security-body"?: Record<string, string> | undefined; "x-tokenName"?: string | undefined; "x-scalar-credentials-location"?: "header" | "body" | undefined; } | undefined; authorizationCode?: { refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": string; token: string; type: "authorizationCode"; authorizationUrl: string; "x-usePkce": "SHA-256" | "plain" | "no"; "x-scalar-redirect-uri": string; tokenUrl: string; clientSecret: string; "x-scalar-security-query"?: Record<string, string> | undefined; "x-scalar-security-body"?: Record<string, string> | undefined; "x-tokenName"?: string | undefined; "x-scalar-credentials-location"?: "header" | "body" | undefined; } | undefined; }; uid: string & import("zod").$brand<"securityScheme">; nameKey: string; description?: string | undefined; 'x-default-scopes'?: string[] | undefined; }>; modalState: { open: boolean; show: () => void; hide: () => void; }; events: { executeRequest: import("./event-bus.js").EventBus<{ requestUid?: string; }>; focusAddressBar: import("./event-bus.js").EventBus<any>; cancelRequest: import("./event-bus.js").EventBus<any>; requestStatus: import("./event-bus.js").EventBus<import("./send-request/index.js").RequestStatus>; commandPalette: import("./event-bus.js").EventBus<import("../components/CommandPalette/TheCommandPalette.vue.js").CommandPaletteEvent>; hotKeys: import("./event-bus.js").EventBus<Partial<Record<"addTopNav" | "closeModal" | "closeTopNav" | "createNew" | "executeRequest" | "focusAddressBar" | "focusRequestSearch" | "jumpToLastTab" | "jumpToTab" | "navigateSearchResultsDown" | "navigateSearchResultsUp" | "navigateTopNavLeft" | "navigateTopNavRight" | "openCommandPalette" | "selectSearchResult" | "toggleSidebar", KeyboardEvent>>>; }; sidebarWidth: import("vue").Ref<string, string>; setSidebarWidth: (width: string) => void; proxyUrl: string | undefined; hideClientButton: boolean; showSidebar: boolean; integration: "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "go" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "svelte" | "vue" | null | undefined; importSpecFile: (_spec: string | Record<string, any> | undefined, workspaceUid: string, options?: Pick<{ info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; type?: "collection" | undefined; openapi?: string | undefined; jsonSchemaDialect?: string | undefined; security?: Record<string, string[] | undefined>[] | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-icon'?: string | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { description?: string | undefined; default?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; uid?: string | undefined; securitySchemes?: string[] | undefined; selectedSecuritySchemeUids?: (string | string[])[] | undefined; selectedServerUid?: string | undefined; servers?: string[] | undefined; requests?: string[] | undefined; tags?: string[] | undefined; children?: string[] | undefined; documentUrl?: string | undefined; watchMode?: boolean | undefined; integration?: string | null | undefined; useCollectionSecurity?: boolean | undefined; watchModeStatus?: "IDLE" | "WATCHING" | "ERROR" | undefined; }, "documentUrl" | "watchMode"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "authentication" | "baseServerURL" | "servers" | "slug"> & { dereferencedDocument?: import("@scalar/openapi-types").OpenAPIV3_1.Document; useCollectionSecurity?: boolean; shouldLoad?: boolean; } & Pick<import("@scalar/types").ApiReferenceConfiguration, "servers"> & { dereferencedDocument?: import("@scalar/openapi-types").OpenAPIV3_1.Document; }) => Promise<{ error: false; collection: import("@scalar/oas-utils/entities/spec").Collection; requests: import("@scalar/oas-utils/entities/spec").Request[]; schema: import("@scalar/openapi-types").OpenAPIV3_1.Document; examples: import("@scalar/oas-utils/entities/spec").RequestExample[]; servers: import("@scalar/oas-utils/entities/spec").Server[]; tags: import("@scalar/oas-utils/entities/spec").Tag[]; securitySchemes: SecurityScheme[]; } | undefined>; importSpecFromUrl: (url: string, workspaceUid: string, { proxyUrl, ...options }?: Omit<Pick<{ info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; type?: "collection" | undefined; openapi?: string | undefined; jsonSchemaDialect?: string | undefined; security?: Record<string, string[] | undefined>[] | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-icon'?: string | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { description?: string | undefined; default?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; uid?: string | undefined; securitySchemes?: string[] | undefined; selectedSecuritySchemeUids?: (string | string[])[] | undefined; selectedServerUid?: string | undefined; servers?: string[] | undefined; requests?: string[] | undefined; tags?: string[] | undefined; children?: string[] | undefined; documentUrl?: string | undefined; watchMode?: boolean | undefined; integration?: string | null | undefined; useCollectionSecurity?: boolean | undefined; watchModeStatus?: "IDLE" | "WATCHING" | "ERROR" | undefined; }, "documentUrl" | "watchMode"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "authentication" | "baseServerURL" | "servers" | "slug"> & { dereferencedDocument?: import("@scalar/openapi-types").OpenAPIV3_1.Document; useCollectionSecurity?: boolean; shouldLoad?: boolean; } & Pick<import("@scalar/types").ApiReferenceConfiguration, "servers"> & { dereferencedDocument?: import("@scalar/openapi-types").OpenAPIV3_1.Document; }, "documentUrl"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "proxyUrl">) => Promise<import("./errors.js").ErrorResponse<Awaited<ReturnType<(_spec: string | Record<string, any> | undefined, workspaceUid: string, options?: Pick<{ info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; type?: "collection" | undefined; openapi?: string | undefined; jsonSchemaDialect?: string | undefined; security?: Record<string, string[] | undefined>[] | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-icon'?: string | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { description?: string | undefined; default?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; uid?: string | undefined; securitySchemes?: string[] | undefined; selectedSecuritySchemeUids?: (string | string[])[] | undefined; selectedServerUid?: string | undefined; servers?: string[] | undefined; requests?: string[] | undefined; tags?: string[] | undefined; children?: string[] | undefined; documentUrl?: string | undefined; watchMode?: boolean | undefined; integration?: string | null | undefined; useCollectionSecurity?: boolean | undefined; watchModeStatus?: "IDLE" | "WATCHING" | "ERROR" | undefined; }, "documentUrl" | "watchMode"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "authentication" | "baseServerURL" | "servers" | "slug"> & { dereferencedDocument?: import("@scalar/openapi-types").OpenAPIV3_1.Document; useCollectionSecurity?: boolean; shouldLoad?: boolean; } & Pick<import("@scalar/types").ApiReferenceConfiguration, "servers"> & { dereferencedDocument?: import("@scalar/openapi-types").OpenAPIV3_1.Document; }) => Promise<{ error: false; collection: import("@scalar/oas-utils/entities/spec").Collection; requests: import("@scalar/oas-utils/entities/spec").Request[]; schema: import("@scalar/openapi-types").OpenAPIV3_1.Document; examples: import("@scalar/oas-utils/entities/spec").RequestExample[]; servers: import("@scalar/oas-utils/entities/spec").Server[]; tags: import("@scalar/oas-utils/entities/spec").Tag[]; securitySchemes: SecurityScheme[]; } | undefined>>>>>; cookieMutators: { add: (item: { uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }) => void; delete: (uid: (string & import("zod").$brand<"cookie">) | null | undefined) => void; set: (item: { uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }) => void; edit: <P extends "path" | "value" | "uid" | "name" | "domain">(uid: (string & import("zod").$brand<"cookie">) | null | undefined, path: P, value: P extends "path" | "value" | "uid" | "name" | "domain" ? { uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }[P] : P extends `${infer K}.${infer R}` ? K extends "path" | "value" | "uid" | "name" | "domain" ? R extends Path<{ uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }[K]> ? PathValue<{ uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }[K], R> : never : K extends `${number}` ? never : never : P extends `${number}` ? never : never) => void; untrackedEdit: <P extends "path" | "value" | "uid" | "name" | "domain">(uid: string & import("zod").$brand<"cookie">, path: P, value: P extends "path" | "value" | "uid" | "name" | "domain" ? { uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }[P] : P extends `${infer K}.${infer R}` ? K extends "path" | "value" | "uid" | "name" | "domain" ? R extends Path<{ uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }[K]> ? PathValue<{ uid: string & import("zod").$brand<"cookie">; name: string; value: string; domain?: string | undefined; path?: string | undefined; }[K], R> : never : K extends `${number}` ? never : never : P extends `${number}` ? never : never) => void; undo: (uid: string & import("zod").$brand<"cookie">) => void; redo: (uid: string & import("zod").$brand<"cookie">) => void; reset: () => void; }; collectionMutators: { rawAdd: (item: { type: "collection"; openapi: string; info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; uid: string & import("zod").$brand<"collection">; securitySchemes: string[]; selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[]; servers: (string & import("zod").$brand<"server">)[]; requests: (string & import("zod").$brand<"operation">)[]; tags: (string & import("zod").$brand<"tag">)[]; children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; jsonSchemaDialect?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { default: string; description?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; selectedServerUid?: (string & import("zod").$brand<"server">) | undefined; documentUrl?: string | undefined; integration?: string | null | undefined; }) => void; add: (payload: import("@scalar/oas-utils/entities/spec").CollectionPayload, workspaceUid: Workspace["uid"]) => { type: "collection"; openapi: string; info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; uid: string & import("zod").$brand<"collection">; securitySchemes: string[]; selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[]; servers: (string & import("zod").$brand<"server">)[]; requests: (string & import("zod").$brand<"operation">)[]; tags: (string & import("zod").$brand<"tag">)[]; children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; jsonSchemaDialect?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { default: string; description?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; selectedServerUid?: (string & import("zod").$brand<"server">) | undefined; documentUrl?: string | undefined; integration?: string | null | undefined; }; delete: (collection: import("@scalar/oas-utils/entities/spec").Collection, workspace: Workspace) => void; addEnvironment: (environmentName: string, environment: import("@scalar/oas-utils/entities/spec").XScalarEnvironment, collectionUid: import("@scalar/oas-utils/entities/spec").Collection["uid"]) => void; removeEnvironment: (environmentName: string, collectionUid: import("@scalar/oas-utils/entities/spec").Collection["uid"]) => void; set: (item: { type: "collection"; openapi: string; info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined; 'x-scalar-sdk-installation'?: { lang: string; source?: string | undefined; description?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; uid: string & import("zod").$brand<"collection">; securitySchemes: string[]; selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[]; servers: (string & import("zod").$brand<"server">)[]; requests: (string & import("zod").$brand<"operation">)[]; tags: (string & import("zod").$brand<"tag">)[]; children: ((string & import("zod").$brand<"operation">) | (string & import("zod").$brand<"tag">))[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; jsonSchemaDialect?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; components?: Record<string, unknown> | undefined; webhooks?: Record<string, unknown> | undefined; 'x-scalar-active-environment'?: string | undefined; 'x-scalar-environments'?: Record<string, { variables: Record<string, string | { default: string; description?: string | undefined; }>; description?: string | undefined; color?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; selectedServerUid?: (string & import("zod").$brand<"server">) | undefined; documentUrl?: string | undefined; integration?: string | null | undefined; }) => void; edit: <P extends "servers" | "externalDocs" | "security" | "tags" | "type" | "uid" | "selectedServerUid" | "selectedSecuritySchemeUids" | "openapi" | "jsonSchemaDialect" | "info" | "components" | "webhooks" | "x-scalar-icon" | "x-scalar-active-environment" | "x-scalar-environments" | "x-scalar-secrets" | "securitySchemes" | "requests" | "children" | "documentUrl" | "watchMode" | "integration" | "useCollectionSecurity" | "watchModeStatus" | `servers.${number}` | "externalDocs.url" | "externalDocs.description" | `security.${number}` | `security.${number}.${string}` | `tags.${number}` | `selectedSecuritySchemeUids.${number}` | `selectedSecuritySchemeUids.${number}.${number}` | "info.title" | "info.summary" | "info.description" | "info.termsOfService" | "info.contact" | "info.license" | "info.version" | "info.x-scalar-sdk-installation" | "info.contact.url" | "info.contact.name" | "info.contact.email" | "info.license.url" | "info.license.name" | "info.license.identifier" | `info.x-scalar-sdk-installation.${number}` | `info.x-scalar-sdk-installation.${number}.description` | `info.x-scalar-sdk-installation.${number}.lang` | `info.x-scalar-sdk-installation.${number}.source` | `components.${string}` | `webhooks.${string}` | `x-scalar-environments.${string}` | `x-scalar-secrets.${string}` | `securitySchemes.${number}` | `requests.${number}` | `children.${number}`>(uid: (string & import("zod").$brand<"collection">) | null | undefined, path: P, value: P extends "servers" | "externalDocs" | "security" | "tags" | "type" | "uid" | "selectedServerUid" | "selectedSecuritySchemeUids" | "openapi" | "jsonSchemaDialect" | "info" | "components" | "webhooks" | "x-scalar-icon" | "x-scalar-active-environment" | "x-scalar-environments" | "x-scalar-secrets" | "securitySchemes" | "requests" | "children" | "documentUrl" | "watchMode" | "integration" | "useCollectionSecurity" | "watchModeStatus" ? { type: "collection"; openapi: string; info: { title: string; version: string; summary?: string | undefined; description?: string | undefined; termsOfService?: string | undefined; contact?: { name?: string | undefined; url?: string | undefined; email?: string | undefined; } | undefined; license?: { name?: string | null | undefined; identifier?: string | undefined; url?: string | undefined; } | undefined;