donobu
Version:
Create browser automations with an LLM agent and replay them as Playwright scripts.
38 lines • 1.31 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvPersistenceVolatile = void 0;
/**
* In-memory implementation of {@link EnvPersistence}.
*
* Used as the `"RAM"` persistence layer. When created with an initial data
* snapshot (e.g. a subset of `process.env` captured at startup), it bridges
* host-process environment variables into the Donobu flow environment system
* so that flows can access them without a durable store.
*
* Also useful in tests where no database or cloud backend is needed.
*/
class EnvPersistenceVolatile {
constructor(initialData = {}) {
this.environmentData = { ...initialData };
}
async setEnvironmentDatum(key, value) {
if (!key) {
throw new Error('Key cannot be empty');
}
this.environmentData[key] = value;
}
async deleteEnvironmentDatum(key) {
if (key) {
delete this.environmentData[key];
}
}
async getEnvironmentDatum(key) {
return this.environmentData[key];
}
async getEnvironmentData() {
// Return a copy to prevent direct mutation of internal state
return { ...this.environmentData };
}
}
exports.EnvPersistenceVolatile = EnvPersistenceVolatile;
//# sourceMappingURL=EnvPersistenceVolatile.js.map