chrono-forge
Advanced tools
Comparing version 0.5.6 to 0.5.7
@@ -411,2 +411,3 @@ "use strict"; | ||
this.log.info(`[${this.constructor.name}]: Condition returned false, not starting child.`); | ||
return; | ||
} | ||
@@ -462,3 +463,3 @@ } | ||
const workflowId = `${entityName}-${id}`; | ||
const data = (0, limitRecursion_1.limitRecursion)((0, normalizr_1.denormalize)(state, entitySchema, newState), entitySchema); | ||
const rawData = (0, limitRecursion_1.limitRecursion)((0, normalizr_1.denormalize)(state, entitySchema, newState), entitySchema); | ||
if (this.ancestorWorkflowIds.includes(workflowId)) { | ||
@@ -468,2 +469,10 @@ this.log.warn(`[${this.constructor.name}] Circular update detected for workflowId: ${workflowId}. Skipping child workflow update.`); | ||
} | ||
if (typeof config.condition === 'function') { | ||
this.log.info(`[${this.constructor.name}]: Calling condition function before starting child...`); | ||
if (!config.condition.apply(this, [rawData, this])) { | ||
this.log.info(`[${this.constructor.name}]: Condition returned false, not starting child.`); | ||
return; | ||
} | ||
} | ||
const data = typeof config.processData === 'function' ? config.processData(rawData, this) : rawData; | ||
await handle.signal('update', { data, entityName: config.entityName, strategy: '$merge' }); | ||
@@ -470,0 +479,0 @@ this.emit(`childUpdated:${config.workflowType}`, handle.workflowId, data); |
{ | ||
"name": "chrono-forge", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"description": "A powerful framework for temporal workflows, state management, and streaming activities, designed for seamless developer experience.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
242305
2842