@onlineapps/conn-orch-orchestrator 1.0.29 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-orch-orchestrator",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Workflow orchestration connector for OA Drive - handles message routing and workflow execution",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -22,13 +22,14 @@
22
22
  "dependencies": {
23
23
  "@onlineapps/conn-base-monitoring": "^1.0.0",
24
24
  "@onlineapps/conn-infra-mq": "^1.1.0",
25
- "@onlineapps/conn-orch-registry": "^1.1.4",
25
+ "@onlineapps/conn-orch-api-mapper": "^1.0.8",
26
26
  "@onlineapps/conn-orch-cookbook": "^2.0.0",
27
- "@onlineapps/conn-orch-api-mapper": "^1.0.8"
27
+ "@onlineapps/conn-orch-registry": "^1.1.4",
28
+ "@onlineapps/cookbook-core": "^2.1.2"
28
29
  },
29
30
  "devDependencies": {
30
- "jest": "^29.5.0",
31
31
  "eslint": "^8.30.0",
32
+ "jest": "^29.5.0",
32
33
  "jsdoc-to-markdown": "^8.0.0"
33
34
  },
34
35
  "jest": {
@@ -75,12 +75,11 @@ class WorkflowOrchestrator {
75
75
  const { workflow_id, cookbook: cookbookDef, current_step, context } = message;
76
76
 
77
77
  try {
78
- // FAIL-FAST: Validate V2 format BEFORE anything else
79
- // This replaces the old cookbook.validateCookbook() which only supports V1 (array steps)
78
+ // FAIL-FAST: Validate V2 format
80
79
  this._validateV2Format(cookbookDef);
81
80
 
82
- // NOTE: Skip cookbook.validateCookbook() - it uses V1 schema (steps as array)
83
- // V2 validation is done by _validateV2Format() above
81
+ // Validate against JSON Schema (V2 schema - steps as object)
82
+ this.cookbook.validateCookbook(cookbookDef);
84
83
 
85
84
  // Ensure delivery configuration is preserved in context (required by Delivery Dispatcher)
86
85
  // Delivery comes from cookbook.delivery (set by Gateway) and must be passed through to workflow.completed
@@ -391,15 +390,36 @@ class WorkflowOrchestrator {
391
390
 
392
391
  const resolveValue = (value) => {
393
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
+
394
414
  let result = value;
395
415
 
396
- // Replace {{...}} references (V2 preferred syntax)
416
+ // Replace {{...}} references embedded in strings (V2 preferred syntax)
397
417
  if (result.includes('{{')) {
398
418
  result = result.replace(/\{\{([^}]+)\}\}/g, (match, path) => {
399
419
  const resolved = this._getValueFromPath(path.trim(), context);
400
420
  if (resolved !== undefined) {
401
- // If resolved value is an object, stringify it for embedding in strings
402
- if (typeof resolved === 'object' && result !== match) {
421
+ // Stringify objects when embedded in larger strings
422
+ if (typeof resolved === 'object') {
403
423
  return JSON.stringify(resolved);
404
424
  }
405
425
  return resolved;
@@ -408,12 +428,12 @@ class WorkflowOrchestrator {
408
428
  });
409
429
  }
410
430
 
411
- // Replace ${...} references (legacy syntax)
431
+ // Replace ${...} references embedded in strings (legacy syntax)
412
432
  if (result.includes('${')) {
413
433
  result = result.replace(/\$\{([^}]+)\}/g, (match, path) => {
414
434
  const resolved = this._getValueFromPath(path.trim(), context);
415
435
  if (resolved !== undefined) {
416
- if (typeof resolved === 'object' && result !== match) {
436
+ if (typeof resolved === 'object') {
417
437
  return JSON.stringify(resolved);
418
438
  }
419
439
  return resolved;