import type { PathMethodHistory } from '../entities/history/schema.js'; import type { InMemoryWorkspace } from '../schemas/inmemory-workspace.js'; import type { WorkspaceMeta } from '../schemas/workspace.js'; type WorkspaceKey = { namespace?: string; slug: string; }; type WorkspaceStoreShape = { teamUid: string; name: string; workspace: InMemoryWorkspace; }; /** Generates a workspace ID from namespace and slug. */ export declare const getWorkspaceId: (namespace: string, slug: string) => string; /** * Creates the persistence layer for the workspace store using IndexedDB. * This sets up all the required tables for storing workspace chunk information, * such as workspace meta, documents, original documents, intermediate documents, overrides, etc. * Each logical group (meta, documents, etc) gets its own table keyed appropriately for efficient sub-document access. * Returns an object containing `meta`, `documents`, `originalDocuments`, `intermediateDocuments`, `overrides`, * `documentMeta`, `documentConfigs`, and `workspace` sections, each exposing a `setItem` method * for upsetting records, and in the case of `workspace`, also `getItem` and `deleteItem`. */ export declare const createWorkspaceStorePersistence: () => Promise<{ close: () => void; meta: { /** * Set meta data for a workspace. */ setItem: (workspaceId: string, data: WorkspaceMeta) => Promise; }; documents: { /** * Set (persist) a workspace document using workspaceId and documentName as composite key. */ setItem: (workspaceId: string, documentName: string, data: InMemoryWorkspace["documents"][string]) => Promise; }; originalDocuments: { /** * Set an original (raw) document for a workspace/document pair. */ setItem: (workspaceId: string, documentName: string, data: InMemoryWorkspace["originalDocuments"][string]) => Promise; }; intermediateDocuments: { /** * Set an intermediate (transformed) document for a workspace/document pair. */ setItem: (workspaceId: string, documentName: string, data: InMemoryWorkspace["intermediateDocuments"][string]) => Promise; }; overrides: { /** * Set document overrides for a workspace/document pair. */ setItem: (workspaceId: string, documentName: string, data: InMemoryWorkspace["overrides"][string]) => Promise; }; history: { /** * Set history for a document. */ setItem: (workspaceId: string, documentName: string, data: PathMethodHistory) => Promise; }; auth: { /** * Set auth for a document. */ setItem: (workspaceId: string, documentName: string, data: InMemoryWorkspace["auth"][string]) => Promise; }; workspace: { /** * Retrieves a workspace by its ID. * Returns undefined if the workspace does not exist. * Gathers all workspace 'chunk' tables and assembles a full workspace shape. */ getItem: ({ namespace, slug, }: Required) => Promise<(WorkspaceStoreShape & Required) | undefined>; /** * Retrieves all workspaces from the database. * Returns only the workspace ID and name for each workspace. * To get the full workspace data including documents and metadata, use getItem() with a specific ID. * Returns an empty array if no workspaces exist. */ getAll: () => Promise<{ name: string; namespace: string; slug: string; teamUid: string; }[]>; /** * Retrieves all workspaces for a given team UID. */ getAllByTeamUid: (teamUid: string) => Promise<{ name: string; namespace: string; slug: string; teamUid: string; }[]>; /** * Saves a workspace to the database. * All chunks (meta, documents, configs, etc.) are upsert in their respective tables. * If a workspace with the same ID already exists, it will be replaced. */ setItem: ({ namespace, slug }: WorkspaceKey, value: Omit & Partial>) => Promise<{ name: string; namespace: string; slug: string; teamUid: string; }>; /** * Deletes an entire workspace and all associated chunk records from all tables by ID. */ deleteItem: ({ namespace, slug }: Required) => Promise; /** * Deletes a single document and all related records (overrides, history, auth, etc.) * for the given workspace and document name from all relevant tables. */ deleteDocument: (workspaceId: string, documentName: string) => Promise; /** * Updates the name of an existing workspace. * Returns the updated workspace object, or undefined if the workspace does not exist. */ updateName: ({ namespace, slug }: Required, name: string) => Promise<{ name: string; namespace: string; slug: string; teamUid: string; } | undefined>; /** * Checks if a workspace with the given ID exists in the store. */ has: ({ namespace, slug }: Required) => Promise; }; clear: () => Promise; }>; export {}; //# sourceMappingURL=index.d.ts.map