donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
81 lines • 3.21 kB
TypeScript
import type { EnvPersistenceRegistry } from '../persistence/env/EnvPersistenceRegistry';
/**
* Business-logic layer over the {@link EnvPersistenceRegistry} for Donobu flow
* environment data - the user-managed key-value store that supplies
* configuration values (API keys, base URLs, etc.) to flows at runtime.
*
* Responsibilities:
* - **Validation** - enforces key format, max key length, and max value size.
* - **Multi-layer orchestration** - writes fan out to every persistence layer;
* reads resolve from the first layer that holds a value.
* - **Selective hydration** - {@link getByNames} fetches only the variables a
* flow has declared in its allow-list, keeping the runtime env minimal.
*
* Exposed via REST at `/api/env` (see `EnvDataApi`) and consumed internally by
* `PageAi` and `DonobuFlowsManager` during flow execution.
*/
export declare class EnvDataManager {
private readonly envPersistenceFactory;
readonly maxKeyLength: number;
readonly maxValueLength: number;
/**
* Maximum length allowed for an environment data key.
*/
static readonly DEFAULT_MAX_KEY_LENGTH = 128;
/**
* Maximum length allowed for environment data value
*/
static readonly DEFAULT_MAX_VALUE_LENGTH: number;
constructor(envPersistenceFactory: EnvPersistenceRegistry, maxKeyLength?: number, maxValueLength?: number);
/**
* Stores an environment datum with validation.
*
* @param key The key for the environment datum
* @param value The value to store
* @throws InvalidParamValueException if the key or value is invalid
*/
setEnvironmentDatum(key: string, value: string): Promise<void>;
/**
* Deletes an environment datum by key.
*
* @param key The key of the datum to delete
*/
deleteEnvironmentDatum(key: string): Promise<void>;
/**
* Retrieves an environment datum by key.
*
* @param key The key of the datum to retrieve
* @returns The environment datum value or undefined if not found
*/
getEnvironmentDatum(key: string): Promise<string | undefined>;
/**
* Retrieves all environment data.
*
* @returns A record of all environment data where keys are datum keys and values are datum values
*/
getEnvironmentData(): Promise<Record<string, string>>;
/**
* Returns a dictionary of environment variable values for the provided names.
* Missing variables are simply omitted so callers can pass optional names
* without extra guards. Used by flows to hydrate runtime env data from the
* persisted allow-list.
*
* @example
* await getByNames(["API_KEY", "BASE_URL", "MISSING_VAR"]);
* // => { API_KEY: "abc123", BASE_URL: "https://example.com" }
*/
getByNames(envVarNames: string[]): Promise<Record<string, string>>;
/**
* Validates an environment data key against business rules.
*
* @param key The key to validate
*/
private validateKey;
/**
* Validates an environment data value against business rules.
*
* @param value The value to validate
*/
private validateValue;
}
//# sourceMappingURL=EnvDataManager.d.ts.map