@rs-box/ez-flow
Version:
Library for a workflow engine
42 lines (41 loc) • 977 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorkContext = void 0;
class WorkContext {
constructor(map) {
this.map = map ? map : new Map();
}
get(key) {
return this.map.get(key);
}
set(key, value) {
this.map.set(key, value);
}
delete(key) {
this.map.delete(key);
}
has(key) {
return this.map.has(key);
}
clear() {
this.map.clear();
}
forEach(callbackFn) {
this.map.forEach(callbackFn);
}
asMap() {
return this.map;
}
hasResult() {
return (this.map.has(WorkContext.CTX_RESULT) ||
this.map.has(WorkContext.CTX_RESULT_LIST));
}
isResultSingle() {
if (!this.hasResult())
return undefined;
return this.map.has(WorkContext.CTX_RESULT);
}
}
exports.WorkContext = WorkContext;
WorkContext.CTX_RESULT = 'RESULT';
WorkContext.CTX_RESULT_LIST = 'RESULTS';