import type { NavigationOptions } from './navigation/get-navigation-options.js'; import { extensions } from './schemas/extensions.js'; import type { TraversedDocument } from './schemas/navigation.js'; import { type OpenApiDocument, type OperationObject, type PathsObject } from './schemas/v3.1/strict/openapi-document.js'; import type { WorkspaceDocumentMeta, WorkspaceMeta } from './schemas/workspace.js'; export declare const WORKSPACE_FILE_NAME = "scalar-workspace.json"; type WorkspaceDocumentMetaInput = { name: string; meta?: WorkspaceDocumentMeta; }; type UrlDoc = { url: string; } & WorkspaceDocumentMetaInput; type FileDoc = { path: string; } & WorkspaceDocumentMetaInput; type ObjectDoc = { document: Record; } & WorkspaceDocumentMetaInput; type WorkspaceDocumentInput = UrlDoc | ObjectDoc | FileDoc; type CreateServerWorkspaceStoreBase = { documents: WorkspaceDocumentInput[]; meta?: WorkspaceMeta; navigationOptions?: NavigationOptions; }; type CreateServerWorkspaceStore = ({ directory?: string; mode: 'static'; } & CreateServerWorkspaceStoreBase) | ({ baseUrl: string; mode: 'ssr'; } & CreateServerWorkspaceStoreBase); /** * Filters an OpenAPI PathsObject to only include standard HTTP methods. * Removes any vendor extensions or other non-HTTP properties. * * @param paths - The OpenAPI PathsObject to filter * @returns A new PathsObject containing only standard HTTP methods * * @example * Input: { * "/users": { * "get": {...}, * "x-custom": {...}, * "post": {...} * } * } * Output: { * "/users": { * "get": {...}, * "post": {...} * } * } */ export declare function filterHttpMethodsOnly(paths: PathsObject): Record>; /** * Escapes path keys in an OpenAPI PathsObject to be JSON Pointer compatible. * This is necessary because OpenAPI paths can contain characters that need to be escaped * when used as JSON Pointer references (like '/' and '~'). * * @example * Input: { "/users/{id}": { ... } } * Output: { "/users~1{id}": { ... } } */ export declare function escapePaths(paths: Record>): Record>; /** * Externalizes components by turning them into refs. */ export declare function externalizeComponentReferences(document: OpenApiDocument, meta: { mode: 'ssr'; name: string; baseUrl: string; } | { mode: 'static'; name: string; directory: string; }): Record; /** * Externalizes paths operations by turning them into refs. */ export declare function externalizePathReferences(document: OpenApiDocument, meta: { mode: 'ssr'; name: string; baseUrl: string; } | { mode: 'static'; name: string; directory: string; }): Record; /** * Create server state workspace store */ export declare function createServerWorkspaceStore(workspaceProps: CreateServerWorkspaceStore): Promise<{ /** * Generates workspace chunks by writing components and operations to the filesystem. * * This method is only available in static mode. It creates a directory structure containing: * - A workspace file with metadata and document references * - Component chunks split by type (schemas, parameters, etc) * - Operation chunks split by path and HTTP method * * The generated workspace references will be relative file paths pointing to these chunks. * * @throws {Error} If called when mode is not 'static' */ generateWorkspaceChunks: () => Promise; /** * Returns the workspace document containing metadata and all sparse documents. * * The workspace document includes: * - Global workspace metadata (theme, active document, etc) * - Document metadata and sparse document * - In SSR mode: References point to in-memory chunks * - In static mode: References point to filesystem chunks * * @returns The complete workspace document */ getWorkspace: () => { documents: Record; "x-scalar-color-mode"?: import("./schemas/workspace.js").ColorMode; "x-scalar-default-client"?: import("@scalar/snippetz").AvailableClients[number]; "x-scalar-active-document"?: string; "x-scalar-theme"?: string; "x-scalar-sidebar-width"?: number; 'x-scalar-active-proxy'?: string | null; }; /** * Retrieves a chunk of data from the workspace using a JSON Pointer * * A JSON Pointer is a string that references a specific location in a JSON document. * Only components and operations chunks can be retrieved. * * @example * ```ts * // Get a component * get('#/document-name/components/schemas/User') * * // Get an operation * get('#/document-name/operations/pets/get') * ``` * * @param pointer - The JSON Pointer string to locate the chunk * @returns The chunk data if found, undefined otherwise */ get: (pointer: string) => unknown; /** * Adds a new document to the workspace asynchronously. * * This function: * 1. Loads the document using the provided input * 2. Checks if the document loaded successfully * 3. If successful, adds the document to the workspace using addDocumentSync * * @param input - The document input containing the document source and metadata */ addDocument: (input: WorkspaceDocumentInput) => Promise; }>; export {}; //# sourceMappingURL=server.d.ts.map