/** * weave-provider — Core type definitions * * IWeaveProvider is the single storage contract that all provider * implementations must satisfy. It follows a simple key-value model with * optional namespace prefixes so that different subsystems (graph, sessions, * vectors, paths) can share a single provider instance without colliding. */ /** * Storage-agnostic key-value provider used by WeaveGraph, SessionLifecycle, * VectorStore and WeavePath for all persistence needs. * * @typeParam T The value type stored under each key. In practice this will be * a serialisable plain object (JSON-compatible). */ export interface IWeaveProvider { /** * Retrieve a single record by its full key. * Returns `null` if the key does not exist. */ get(key: string): Promise; /** * Persist a record under the given key, overwriting any previous value. */ set(key: string, value: T): Promise; /** * Remove the record associated with the given key. * A no-op if the key does not exist (must NOT throw). */ delete(key: string): Promise; /** * List all keys that start with the given prefix. * If prefix is omitted, return every key in the store. * * @param prefix Optional key prefix filter (e.g. `"graph:"`, `"session:"`). */ list(prefix?: string): Promise; /** * Delete all records whose keys start with the given prefix. * If prefix is omitted, the entire store is wiped. * * @param prefix Optional key prefix filter. */ clear(prefix?: string): Promise; /** * Release any resources held by this provider (file handles, DB connections * etc.). After `close()` is called the provider must not accept further * operations. */ close(): Promise; } /** * A zero-argument async factory that resolves to a ready-to-use provider. * Used by the registry when building providers from a connection string. */ export type ProviderFactory = () => Promise>; /** * Environment variable that controls which provider the registry resolves. * * Accepted values (case-insensitive): * - `"json"` (default) → JsonProvider * - `"memory"` → MemoryProvider * - `"sqlite"` / a file path → weave-provider-sqlite (separate package) * - `"mongodb"` / a URI → weave-provider-mongodb (separate package) * - `"postgres"` / a URI → weave-provider-postgres (separate package) * - `"mysql"` / a URI → weave-provider-mysql (separate package) */ export declare const WEAVE_PROVIDER_ENV = "WEAVE_PROVIDER"; /** * Environment variable that controls the root data directory used by the * JsonProvider (and, conventionally, any file-based provider). */ export declare const WEAVE_DATA_DIR_ENV = "WEAVE_DATA_DIR"; /** * Default data directory value when WEAVE_DATA_DIR is not set. */ export declare const DEFAULT_DATA_DIR = "./weave-data"; /** * Thrown when a provider operation is invoked after `close()` has been called. */ export declare class ProviderClosedError extends Error { constructor(providerName: string); } /** * Thrown when the registry cannot resolve a provider from the current * environment configuration. */ export declare class UnknownProviderError extends Error { constructor(value: string); } //# sourceMappingURL=types.d.ts.map