UNPKG

n8n

Version:

n8n Workflow Automation Tool

30 lines 902 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CallbackStore = void 0; const node_crypto_1 = require("node:crypto"); const ttl_map_1 = require("../../../utils/ttl-map"); class CallbackStore { constructor(ttlMs = 60 * 60 * 1000) { this.entries = new ttl_map_1.TtlMap(ttlMs); } async store(actionId, value) { let key; do { key = (0, node_crypto_1.randomBytes)(4).toString('hex'); } while (this.entries.has(key)); this.entries.set(key, { actionId, value }); return key; } async resolve(key) { const entry = this.entries.get(key); if (!entry) return undefined; this.entries.delete(key); return entry; } dispose() { this.entries.dispose(); } } exports.CallbackStore = CallbackStore; //# sourceMappingURL=callback-store.js.map