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
22 lines (21 loc) • 792 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Condition = void 0;
const workflow_1 = require("@temporalio/workflow");
const Condition = (conditionFn, timeout) => {
return (target, propertyKey, descriptor) => {
const originalMethod = descriptor.value;
descriptor.value = async function (...args) {
return await workflow_1.CancellationScope.cancellable(async () => {
if (timeout) {
await (0, workflow_1.condition)(conditionFn, timeout);
}
else {
await (0, workflow_1.condition)(conditionFn);
}
return originalMethod.apply(this, args);
});
};
};
};
exports.Condition = Condition;