donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
59 lines • 2.64 kB
TypeScript
import type { EnvPick } from 'env-struct';
import type { env } from '../../envVars';
import { PersistencePluginRegistry } from '../PersistencePlugin';
import type { FlowsPersistence } from './FlowsPersistence';
/**
* A persistence layer paired with the `PERSISTENCE_PRIORITY` key it was
* created from. The key is shared across the flows/tests/suites registries:
* the same key in each registry refers to the same logical store, which is
* how cross-entity foreign keys are kept aligned (e.g. a flow's `testId`
* resolves to a test that lives in the same layer).
*/
export interface FlowsPersistenceLayer {
key: string;
persistence: FlowsPersistence;
}
export interface FlowsPersistenceRegistry {
/**
* Returns the primary persistence layer.
*/
get(): Promise<FlowsPersistence>;
/** Returns a list of all valid persistence layers. Guaranteed to be non-empty. */
getAll(): Promise<FlowsPersistence[]>;
/**
* Returns all valid layers paired with their `PERSISTENCE_PRIORITY` key.
* Used by callers that need to align writes across registries (e.g. write
* a flow into the same layer as the test it references).
*/
getEntries(): Promise<FlowsPersistenceLayer[]>;
/**
* Returns the persistence layer registered under the given
* `PERSISTENCE_PRIORITY` key, or undefined if no such layer exists.
*/
getByKey(key: string): Promise<FlowsPersistence | undefined>;
}
/**
* A factory class for creating FlowsPersistence instances. Persistence layers are constructed
* eagerly at creation time and reused across all subsequent calls.
*/
export declare class FlowsPersistenceRegistryImpl implements FlowsPersistenceRegistry {
private readonly layers;
/**
* Creates an instance with pre-built persistence layers.
*/
constructor(layers: FlowsPersistenceLayer[]);
/**
* Creates an instance by reading environment variables and eagerly constructing
* all applicable persistence layers.
*/
static fromEnvironment(environ: EnvPick<typeof env, 'DONOBU_API_BASE_URL' | 'DONOBU_API_KEY' | 'DONOBU_PERSISTENCE_API_KEY' | 'PERSISTENCE_PRIORITY'>, persistencePlugins?: PersistencePluginRegistry): Promise<FlowsPersistenceRegistryImpl>;
/**
* Returns the primary persistence layer.
*/
get(): Promise<FlowsPersistence>;
/** Returns all persistence layers. Guaranteed to be non-empty. */
getAll(): Promise<FlowsPersistence[]>;
getEntries(): Promise<FlowsPersistenceLayer[]>;
getByKey(key: string): Promise<FlowsPersistence | undefined>;
}
//# sourceMappingURL=FlowsPersistenceRegistry.d.ts.map