selvedge
Version:
A type-safe, declarative DSL for building robust, composable LLM prompts and programs in TypeScript. Selvedge simplifies prompt engineering, structured output, and multi-model orchestration.
86 lines • 3 kB
TypeScript
/**
* Store class for managing versioned persistence
*/
export declare class Store {
private baseDir;
private idCounter;
/**
* Create a new Store instance
* @param storePath Optional custom path for storage (defaults to ~/.selvedge)
*/
constructor(storePath?: string);
/**
* Get the base path for storage
* @returns The base directory path
*/
getBasePath(): string;
/**
* Set the base path for storage (primarily for testing)
* @param path New base path
*/
setBasePath(path: string): void;
/**
* Generate a unique ID with timestamp for versioning
* @returns A unique version ID
*/
generateId(): string;
/**
* Ensure a directory exists
* @param dirPath Path to ensure exists
*/
private ensureDir;
/**
* Save an item with metadata
* @param type Type of item ('prompt' or 'program')
* @param name Name of the item
* @param data Data to save
* @returns The version ID of the saved item
*/
save(type: 'prompt' | 'program', name: string, data: any): Promise<string>;
/**
* Load the latest version of an item, or a specific version if provided
* @param type Type of item ('prompt' or 'program')
* @param name Name of the item
* @param version Optional version ID to load
* @returns The loaded item data
*/
load(type: 'prompt' | 'program', name: string, version?: string): Promise<any>;
/**
* Load a specific version of an item
* @param type Type of item ('prompt' or 'program')
* @param name Name of the item
* @param version Version ID to load
* @returns The loaded item data
*/
loadVersion(type: 'prompt' | 'program', name: string, version: string): Promise<any>;
/**
* List all versions of an item
* @param type Type of item ('prompt' or 'program')
* @param name Name of the item
* @returns Array of version IDs, sorted by creation time (newest first)
*/
listVersions(type: 'prompt' | 'program', name: string): Promise<string[]>;
/**
* List all items of a type
* @param type Type of item ('prompt' or 'program')
* @returns Array of item names
*/
list(type: 'prompt' | 'program'): Promise<string[]>;
/**
* Delete a specific version of an item
* @param type Type of item ('prompt' or 'program')
* @param name Name of the item
* @param version Version ID to delete
* @returns True if deleted successfully
*/
deleteVersion(type: 'prompt' | 'program', name: string, version: string): Promise<boolean>;
/**
* Delete an item and all its versions
* @param type Type of item ('prompt' or 'program')
* @param name Name of the item
* @returns True if deleted successfully, false if item doesn't exist
*/
delete(type: 'prompt' | 'program', name: string): Promise<boolean>;
}
export declare const store: Store;
//# sourceMappingURL=storage.d.ts.map