UNPKG

@scalar/api-client

Version:

the open source API testing client

956 lines 265 kB
import { type ClientLayout } from '../hooks/useLayout.js'; import { type WorkspaceStore } from '../store/store.js'; 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'; export type OpenClientPayload = ({ path: string; method: OpenAPI.HttpMethod | Lowercase<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; cookies: (string & import("zod").BRAND<"cookie">)[]; collections: (string & import("zod").BRAND<"collection">)[]; environments: Record<string, string>; activeEnvironmentId: string; 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<"" | "0" | "Space" | "Backspace" | "Tab" | "Enter" | "Escape" | "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp" | "End" | "Home" | "PageDown" | "PageUp" | "Delete" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "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" | "*" | "+" | "-" | "." | "/" | "F1" | "F2" | "F3" | "F4" | "F5" | "F6" | "F7" | "F8" | "F9" | "F10" | "F11" | "F12" | ";" | "=" | "," | "`" | "[" | "\\" | "]", { 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, { uid: string & import("zod").BRAND<"collection">; type: "collection"; children: ((string & import("zod").BRAND<"tag">) | (string & import("zod").BRAND<"operation">))[]; openapi: string; info: { title: string; version: string; description?: string | undefined; summary?: 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; description?: string | undefined; source?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; 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">)[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; externalDocs?: { url: string; description?: string | undefined; } | undefined; jsonSchemaDialect?: string | 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; }>; color?: string | undefined; description?: 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, { uid: string & import("zod").BRAND<"tag">; name: string; type: "tag"; children: ((string & import("zod").BRAND<"tag">) | (string & import("zod").BRAND<"operation">))[]; 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; value: string; color: string; isDefault?: boolean | undefined; }>; requestExamples: Record<string, { uid: string & import("zod").BRAND<"example">; name: string; type: "requestExample"; parameters: { path: { value: string; key: string; enabled: boolean; minimum?: number | undefined; type?: string | string[] | undefined; maximum?: number | undefined; description?: string | undefined; default?: any; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; nullable?: boolean | undefined; format?: string | undefined; file?: any; }[]; headers: { value: string; key: string; enabled: boolean; minimum?: number | undefined; type?: string | string[] | undefined; maximum?: number | undefined; description?: string | undefined; default?: any; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; nullable?: boolean | undefined; format?: string | undefined; file?: any; }[]; query: { value: string; key: string; enabled: boolean; minimum?: number | undefined; type?: string | string[] | undefined; maximum?: number | undefined; description?: string | undefined; default?: any; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; nullable?: boolean | undefined; format?: string | undefined; file?: any; }[]; cookies: { value: string; key: string; enabled: boolean; minimum?: number | undefined; type?: string | string[] | undefined; maximum?: number | undefined; description?: string | undefined; default?: any; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; nullable?: boolean | undefined; format?: string | undefined; file?: any; }[]; }; body: { activeBody: "binary" | "formData" | "raw"; binary?: Blob | undefined; formData?: { value: { value: string; key: string; enabled: boolean; minimum?: number | undefined; type?: string | string[] | undefined; maximum?: number | undefined; description?: string | undefined; default?: any; required?: boolean | undefined; enum?: string[] | undefined; examples?: any[] | undefined; nullable?: boolean | undefined; format?: string | undefined; file?: any; }[]; encoding: "form-data" | "urlencoded"; } | undefined; raw?: { value: string; encoding: "xml" | "json" | "html" | "text" | "javascript" | "yaml" | "edn"; mimeType?: string | undefined; } | undefined; }; requestUid?: (string & import("zod").BRAND<"operation">) | undefined; serverVariables?: Record<string, string[]> | undefined; }>; requests: Record<string, { uid: string & import("zod").BRAND<"operation">; path: string; type: "request"; selectedSecuritySchemeUids: ((string & import("zod").BRAND<"securityScheme">) | (string & import("zod").BRAND<"securityScheme">)[])[]; selectedServerUid: (string & import("zod").BRAND<"server">) | null; servers: (string & import("zod").BRAND<"server">)[]; examples: (string & import("zod").BRAND<"example">)[]; method: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace"; 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?: { name: string; required: boolean; deprecated: boolean; in: "cookie" | "path" | "query" | "header"; description?: string | undefined; example?: unknown; content?: unknown; schema?: unknown; examples?: unknown[] | Record<string, { value?: unknown; summary?: string | undefined; externalValue?: string | undefined; }> | undefined; style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined; explode?: boolean | undefined; }[] | undefined; responses?: Record<string, any> | undefined; callbacks?: Record<string, Record<string, Record<string, any>>> | undefined; 'x-codeSamples'?: { source: string; label?: string | undefined; lang?: string | undefined; }[] | undefined; 'x-code-samples'?: { source: string; label?: string | undefined; lang?: string | undefined; }[] | undefined; 'x-custom-examples'?: { source: string; label?: string | undefined; lang?: string | undefined; }[] | undefined; 'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined; 'x-post-response'?: string | undefined; }>; servers: Record<string, { uid: string & import("zod").BRAND<"server">; url: string; description?: string | undefined; variables?: Record<string, { value?: string | undefined; description?: string | undefined; default?: string | undefined; enum?: string[] | undefined; }> | undefined; }>; securitySchemes: Record<string, { type: "apiKey"; value: string; name: string; uid: string & import("zod").BRAND<"securityScheme">; nameKey: string; in: "cookie" | "query" | "header"; description?: string | undefined; } | { type: "http"; uid: string & import("zod").BRAND<"securityScheme">; nameKey: string; scheme: "basic" | "bearer"; bearerFormat: string; username: string; password: string; token: string; description?: string | undefined; } | { type: "openIdConnect"; uid: string & import("zod").BRAND<"securityScheme">; nameKey: string; openIdConnectUrl: string; description?: string | undefined; } | { type: "oauth2"; uid: string & import("zod").BRAND<"securityScheme">; nameKey: string; flows: { password?: { type: "password"; username: string; password: string; token: string; refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": 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; implicit?: { type: "implicit"; token: string; refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": string; 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; clientCredentials?: { type: "clientCredentials"; token: string; refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": 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; authorizationCode?: { type: "authorizationCode"; token: string; refreshUrl: string; scopes: Record<string, string>; selectedScopes: string[]; "x-scalar-client-id": string; authorizationUrl: string; "x-scalar-redirect-uri": string; tokenUrl: string; clientSecret: string; "x-usePkce": "SHA-256" | "plain" | "no"; "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; }; description?: string | undefined; 'x-default-scopes'?: string | 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" | "go" | "rust" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "svelte" | "vue" | null | undefined; importSpecFile: (_spec: string | Record<string, any> | undefined, workspaceUid: string, options?: Pick<{ uid?: string | undefined; type?: "collection" | undefined; externalDocs?: unknown; children?: string[] | undefined; openapi?: string | undefined; jsonSchemaDialect?: string | undefined; info?: unknown; security?: Record<string, 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; }>; color?: string | undefined; description?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; securitySchemes?: string[] | undefined; selectedSecuritySchemeUids?: (string | string[])[] | undefined; selectedServerUid?: string | undefined; servers?: string[] | undefined; requests?: string[] | undefined; tags?: string[] | undefined; documentUrl?: string | undefined; watchMode?: boolean | undefined; integration?: string | null | undefined; useCollectionSecurity?: boolean | undefined; watchModeStatus?: "IDLE" | "WATCHING" | "ERROR" | undefined; }, "watchMode" | "documentUrl"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "slug" | "authentication" | "baseServerURL" | "servers"> & { 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<{ uid?: string | undefined; type?: "collection" | undefined; externalDocs?: unknown; children?: string[] | undefined; openapi?: string | undefined; jsonSchemaDialect?: string | undefined; info?: unknown; security?: Record<string, 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; }>; color?: string | undefined; description?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; securitySchemes?: string[] | undefined; selectedSecuritySchemeUids?: (string | string[])[] | undefined; selectedServerUid?: string | undefined; servers?: string[] | undefined; requests?: string[] | undefined; tags?: string[] | undefined; documentUrl?: string | undefined; watchMode?: boolean | undefined; integration?: string | null | undefined; useCollectionSecurity?: boolean | undefined; watchModeStatus?: "IDLE" | "WATCHING" | "ERROR" | undefined; }, "watchMode" | "documentUrl"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "slug" | "authentication" | "baseServerURL" | "servers"> & { 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<{ uid?: string | undefined; type?: "collection" | undefined; externalDocs?: unknown; children?: string[] | undefined; openapi?: string | undefined; jsonSchemaDialect?: string | undefined; info?: unknown; security?: Record<string, 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; }>; color?: string | undefined; description?: string | undefined; }> | undefined; 'x-scalar-secrets'?: Record<string, { description?: string | undefined; example?: string | undefined; }> | undefined; securitySchemes?: string[] | undefined; selectedSecuritySchemeUids?: (string | string[])[] | undefined; selectedServerUid?: string | undefined; servers?: string[] | undefined; requests?: string[] | undefined; tags?: string[] | undefined; documentUrl?: string | undefined; watchMode?: boolean | undefined; integration?: string | null | undefined; useCollectionSecurity?: boolean | undefined; watchModeStatus?: "IDLE" | "WATCHING" | "ERROR" | undefined; }, "watchMode" | "documentUrl"> & Pick<import("@scalar/types").ApiReferenceConfiguration, "slug" | "authentication" | "baseServerURL" | "servers"> & { 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: { uid: string & import("zod").BRAND<"collection">; type: "collection"; children: ((string & import("zod").BRAND<"tag">) | (string & import("zod").BRAND<"operation">))[]; openapi: string; info: { title: string; version: string; description?: string | undefined; summary?: 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; description?: string | undefined; source?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; 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">)[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; externalDocs?: { url: string; description?: string | undefined; } | undefined; jsonSchemaDialect?: string | 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; }>; color?: string | undefined; description?: 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"]) => { uid: string & import("zod").BRAND<"collection">; type: "collection"; children: ((string & import("zod").BRAND<"tag">) | (string & import("zod").BRAND<"operation">))[]; openapi: string; info: { title: string; version: string; description?: string | undefined; summary?: 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; description?: string | undefined; source?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; 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">)[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; externalDocs?: { url: string; description?: string | undefined; } | undefined; jsonSchemaDialect?: string | 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; }>; color?: string | undefined; description?: 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: { uid: string & import("zod").BRAND<"collection">; type: "collection"; children: ((string & import("zod").BRAND<"tag">) | (string & import("zod").BRAND<"operation">))[]; openapi: string; info: { title: string; version: string; description?: string | undefined; summary?: 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; description?: string | undefined; source?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; 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">)[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; externalDocs?: { url: string; description?: string | undefined; } | undefined; jsonSchemaDialect?: string | 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; }>; color?: string | undefined; description?: 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" | "tags" | "security" | "externalDocs" | "type" | "uid" | "selectedServerUid" | "selectedSecuritySchemeUids" | "requests" | "x-scalar-environments" | "children" | "openapi" | "info" | "x-scalar-icon" | "securitySchemes" | "watchMode" | "useCollectionSecurity" | "watchModeStatus" | "jsonSchemaDialect" | "components" | "webhooks" | "x-scalar-active-environment" | "x-scalar-secrets" | "documentUrl" | "integration" | `servers.${number}` | `tags.${number}` | `security.${number}` | `security.${number}.${string}` | "externalDocs.url" | "externalDocs.description" | `selectedSecuritySchemeUids.${number}` | `selectedSecuritySchemeUids.${number}.${number}` | `requests.${number}` | `x-scalar-environments.${string}` | `children.${number}` | "info.title" | "info.summary" | "info.description" | "info.version" | "info.termsOfService" | "info.contact" | "info.license" | "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` | `securitySchemes.${number}` | `components.${string}` | `webhooks.${string}` | `x-scalar-secrets.${string}`>(uid: (string & import("zod").BRAND<"collection">) | null | undefined, path: P, value: P extends "servers" | "tags" | "security" | "externalDocs" | "type" | "uid" | "selectedServerUid" | "selectedSecuritySchemeUids" | "requests" | "x-scalar-environments" | "children" | "openapi" | "info" | "x-scalar-icon" | "securitySchemes" | "watchMode" | "useCollectionSecurity" | "watchModeStatus" | "jsonSchemaDialect" | "components" | "webhooks" | "x-scalar-active-environment" | "x-scalar-secrets" | "documentUrl" | "integration" ? { uid: string & import("zod").BRAND<"collection">; type: "collection"; children: ((string & import("zod").BRAND<"tag">) | (string & import("zod").BRAND<"operation">))[]; openapi: string; info: { title: string; version: string; description?: string | undefined; summary?: 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; description?: string | undefined; source?: string | undefined; }[] | undefined; }; security: Record<string, string[]>[]; 'x-scalar-icon': string; 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">)[]; watchMode: boolean; useCollectionSecurity: boolean; watchModeStatus: "IDLE" | "WATCHING" | "ERROR"; externalDocs?: { url: string; description?: string | undefined; } | undefined; jsonSchemaDialect?: string | 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; }>; color?: string | undefined; description?: 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; }[P] : P extends `${infer K}.${infer R}` ? K extends "servers" | "tags" | "security" | "externalDocs" | "type" | "uid" | "selectedServerUid" | "selectedSecuritySchemeUids" | "requests" | "x-scalar-environments" | "children" | "openapi" | "info" | "x-scalar-icon" | "securitySchemes" | "watchMode" | "useCollectionSecurity" | "watchModeStatus" | "jsonSchemaDialect" | "components" | "webhooks" | "x-scalar-active-environment" | "x-scalar-secrets" | "documentUrl" | "integration" ? R extends Path<{ uid: string & import("zod").BRAND<"collection">; type: "collection"; children: ((string & import("zod").BR