@onlineapps/conn-orch-orchestrator 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/WorkflowOrchestrator.js +26 -5
package/package.json
CHANGED
|
@@ -390,15 +390,36 @@ class WorkflowOrchestrator {
|
|
|
390
390
|
|
|
391
391
|
const resolveValue = (value) => {
|
|
392
392
|
if (typeof value === 'string') {
|
|
393
|
+
// Special case: entire string is a single template reference
|
|
394
|
+
// Return the resolved value directly (preserves objects, arrays, etc.)
|
|
395
|
+
const singleRefMatch = value.match(/^\{\{([^}]+)\}\}$/);
|
|
396
|
+
if (singleRefMatch) {
|
|
397
|
+
const resolved = this._getValueFromPath(singleRefMatch[1].trim(), context);
|
|
398
|
+
if (resolved !== undefined) {
|
|
399
|
+
return resolved; // Return object/array directly
|
|
400
|
+
}
|
|
401
|
+
return value; // Return original if not resolved
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Legacy syntax: ${...}
|
|
405
|
+
const singleLegacyMatch = value.match(/^\$\{([^}]+)\}$/);
|
|
406
|
+
if (singleLegacyMatch) {
|
|
407
|
+
const resolved = this._getValueFromPath(singleLegacyMatch[1].trim(), context);
|
|
408
|
+
if (resolved !== undefined) {
|
|
409
|
+
return resolved; // Return object/array directly
|
|
410
|
+
}
|
|
411
|
+
return value; // Return original if not resolved
|
|
412
|
+
}
|
|
413
|
+
|
|
393
414
|
let result = value;
|
|
394
415
|
|
|
395
|
-
// Replace {{...}} references (V2 preferred syntax)
|
|
416
|
+
// Replace {{...}} references embedded in strings (V2 preferred syntax)
|
|
396
417
|
if (result.includes('{{')) {
|
|
397
418
|
result = result.replace(/\{\{([^}]+)\}\}/g, (match, path) => {
|
|
398
419
|
const resolved = this._getValueFromPath(path.trim(), context);
|
|
399
420
|
if (resolved !== undefined) {
|
|
400
|
-
//
|
|
401
|
-
if (typeof resolved === 'object'
|
|
421
|
+
// Stringify objects when embedded in larger strings
|
|
422
|
+
if (typeof resolved === 'object') {
|
|
402
423
|
return JSON.stringify(resolved);
|
|
403
424
|
}
|
|
404
425
|
return resolved;
|
|
@@ -407,12 +428,12 @@ class WorkflowOrchestrator {
|
|
|
407
428
|
});
|
|
408
429
|
}
|
|
409
430
|
|
|
410
|
-
// Replace ${...} references (legacy syntax)
|
|
431
|
+
// Replace ${...} references embedded in strings (legacy syntax)
|
|
411
432
|
if (result.includes('${')) {
|
|
412
433
|
result = result.replace(/\$\{([^}]+)\}/g, (match, path) => {
|
|
413
434
|
const resolved = this._getValueFromPath(path.trim(), context);
|
|
414
435
|
if (resolved !== undefined) {
|
|
415
|
-
if (typeof resolved === 'object'
|
|
436
|
+
if (typeof resolved === 'object') {
|
|
416
437
|
return JSON.stringify(resolved);
|
|
417
438
|
}
|
|
418
439
|
return resolved;
|