/** * Copyright (c) 2025 Elara AI Pty Ltd * Licensed under BSL 1.1. See LICENSE for details. */ import type { WorkspaceState } from '@elaraai/e3-types'; import type { StorageBackend, LockHandle } from './storage/interfaces.js'; /** * List workspace names. * * @param storage - Storage backend * @param repo - Repository identifier * @returns Array of workspace names */ export declare function workspaceList(storage: StorageBackend, repo: string): Promise; /** * Create an empty workspace. * * Creates an undeployed workspace (state file with null package info). * Use workspaceDeploy to deploy a package. * * @param storage - Storage backend * @param repo - Repository identifier * @param name - Workspace name * @throws {WorkspaceExistsError} If workspace already exists */ export declare function workspaceCreate(storage: StorageBackend, repo: string, name: string): Promise; /** * Options for workspace removal. */ export interface WorkspaceRemoveOptions { /** * External workspace lock to use. If provided, the caller is responsible * for releasing the lock after the operation. If not provided, workspaceRemove * will acquire and release a lock internally. */ lock?: LockHandle; } /** * Remove a workspace. * * Objects remain until repoGc is run. * * Acquires a workspace lock to prevent removing a workspace while a dataflow * is running. Throws WorkspaceLockError if the workspace is currently locked. * * @param storage - Storage backend * @param repo - Repository identifier * @param name - Workspace name * @param options - Optional settings including external lock * @throws {WorkspaceNotFoundError} If workspace doesn't exist * @throws {WorkspaceLockError} If workspace is locked by another process */ export declare function workspaceRemove(storage: StorageBackend, repo: string, name: string, options?: WorkspaceRemoveOptions): Promise; /** * Get the full state for a workspace. * * @param storage - Storage backend * @param repo - Repository identifier * @param name - Workspace name * @returns Workspace state, or null if workspace doesn't exist or is not deployed */ export declare function workspaceGetState(storage: StorageBackend, repo: string, name: string): Promise; /** * Get the deployed package for a workspace. * * @param storage - Storage backend * @param repo - Repository identifier * @param name - Workspace name * @returns Package name, version, and hash * @throws {WorkspaceNotFoundError} If workspace doesn't exist * @throws {WorkspaceNotDeployedError} If workspace exists but has no package deployed */ export declare function workspaceGetPackage(storage: StorageBackend, repo: string, name: string): Promise<{ name: string; version: string; hash: string; }>; /** * Options for workspace deployment. */ export interface WorkspaceDeployOptions { /** * External workspace lock to use. If provided, the caller is responsible * for releasing the lock after the operation. If not provided, workspaceDeploy * will acquire and release a lock internally. */ lock?: LockHandle; } /** * Deploy a package to a workspace. * * Creates the workspace if it doesn't exist. Writes state file atomically * containing deployment info. Initializes per-dataset ref files from the * package's data/ directory. * * Acquires a workspace lock to prevent conflicts with running dataflows * or concurrent deploys. Throws WorkspaceLockError if the workspace is * currently locked by another process. * * @param storage - Storage backend * @param repo - Repository identifier * @param name - Workspace name * @param pkgName - Package name * @param pkgVersion - Package version * @param options - Optional settings including external lock * @throws {WorkspaceLockError} If workspace is locked by another process */ export declare function workspaceDeploy(storage: StorageBackend, repo: string, name: string, pkgName: string, pkgVersion: string, options?: WorkspaceDeployOptions): Promise; /** * Result of exporting a workspace */ export interface WorkspaceExportResult { packageHash: string; objectCount: number; name: string; version: string; } /** * Options for workspace export */ export interface WorkspaceExportOptions { /** Called after each object is added. Can be used for progress reporting. */ onProgress?: (progress: { objectsProcessed: number; }) => Promise; /** External workspace lock. If not provided, an exclusive lock will be acquired internally. */ lock?: LockHandle; } /** * Export a workspace as a package. * * 1. Read workspace state * 2. Read deployed package structure using stored packageHash * 3. Create new PackageObject with current structure * 4. Collect all referenced objects from dataset refs * 5. Write per-dataset refs and objects to .zip * * @param storage - Storage backend * @param repo - Repository identifier * @param name - Workspace name * @param zipPath - Path to write the .zip file * @param outputName - Package name (default: deployed package name) * @param version - Package version (default: -) * @returns Export result with package info * @throws {WorkspaceNotFoundError} If workspace doesn't exist * @throws {WorkspaceNotDeployedError} If workspace exists but has no package deployed */ export declare function workspaceExport(storage: StorageBackend, repo: string, name: string, zipPath: string, outputName?: string, version?: string, options?: WorkspaceExportOptions): Promise; //# sourceMappingURL=workspaces.d.ts.map