@hotmeshio/hotmesh
Version:
Serverless Workflow
46 lines (45 loc) • 1.48 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getContext = void 0;
const common_1 = require("./common");
/**
* Returns the current workflow context, restored from storage.
* @returns {WorkflowContext} The current workflow context.
*/
function getContext() {
const store = common_1.asyncLocalStorage.getStore();
const workflowId = store.get('workflowId');
const replay = store.get('replay');
const cursor = store.get('cursor');
const interruptionRegistry = store.get('interruptionRegistry');
const workflowDimension = store.get('workflowDimension') ?? '';
const workflowTopic = store.get('workflowTopic');
const connection = store.get('connection');
const namespace = store.get('namespace');
const originJobId = store.get('originJobId');
const workflowTrace = store.get('workflowTrace');
const canRetry = store.get('canRetry');
const workflowSpan = store.get('workflowSpan');
const expire = store.get('expire');
const COUNTER = store.get('counter');
const raw = store.get('raw');
return {
canRetry,
COUNTER,
counter: COUNTER.counter,
cursor,
interruptionRegistry,
connection,
expire,
namespace,
originJobId,
raw,
replay,
workflowId,
workflowDimension,
workflowTopic,
workflowTrace,
workflowSpan,
};
}
exports.getContext = getContext;