UNPKG

chrono-forge

Version:

A comprehensive framework for building resilient Temporal workflows, advanced state management, and real-time streaming activities in TypeScript. Designed for a seamless developer experience with powerful abstractions, dynamic orchestration, and full cont

16 lines (15 loc) 616 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMemo = getMemo; const limitRecursion_1 = require("./limitRecursion"); const unflatten_1 = require("./unflatten"); async function getMemo(handle) { const { memo } = await handle.describe(); const [entityName, entityId] = handle.workflowId.split(/-(.*)/s).slice(0, 2); if (!memo) { throw new Error(`Memo is undefined`); } const memoState = (0, unflatten_1.unflatten)(memo); memoState.data = (0, limitRecursion_1.limitRecursion)(entityId, entityName, memoState.state ?? {}); return memoState; }