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

23 lines (22 loc) 843 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Conditional = Conditional; function Conditional(condition) { return (target, propertyKey, descriptor) => { const originalMethod = descriptor.value; descriptor.value = async function (...args) { try { const shouldExecute = await condition.apply(this, [this, ...args]); if (shouldExecute) { return await originalMethod.apply(this, args); } else { this.log?.info?.(`Conditional: Skipping ${String(propertyKey)} as condition not met.`); } } catch (error) { console.error(`Error executing condition for ${String(propertyKey)}:`, error); } }; }; }