@decaf-ts/integrations 0.10.5 → 0.10.8
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/dist/integrations.cjs +1 -1
- package/lib/cjs/graph/engine/catalog/GraphBuiltInRegistrations.cjs +12 -73
- package/lib/cjs/graph/engine/catalog/GraphBuiltInRegistrations.cjs.map +1 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs +5 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs.map +1 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs +66 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionFrame.cjs +16 -0
- package/lib/cjs/graph/engine/execution/GraphExecutionFrame.cjs.map +1 -1
- package/lib/cjs/graph/engine/execution/index.cjs +0 -4
- package/lib/cjs/graph/engine/execution/index.cjs.map +1 -1
- package/lib/cjs/graph/engine/index.cjs +0 -7
- package/lib/cjs/graph/engine/index.cjs.map +1 -1
- package/lib/cjs/graph/engine/loops/index.cjs +0 -3
- package/lib/cjs/graph/engine/loops/index.cjs.map +1 -1
- package/lib/cjs/graph/engine/validation/GraphLooseNodeValidation.cjs +36 -0
- package/lib/cjs/graph/engine/validation/GraphLooseNodeValidation.cjs.map +1 -0
- package/lib/cjs/graph/engine/validation/GraphParameterValidator.cjs +36 -3
- package/lib/cjs/graph/engine/validation/GraphParameterValidator.cjs.map +1 -1
- package/lib/cjs/graph/engine/validation/GraphWorkflowDocumentValidator.cjs +32 -1
- package/lib/cjs/graph/engine/validation/GraphWorkflowDocumentValidator.cjs.map +1 -1
- package/lib/cjs/graph/engine/validation/index.cjs +1 -0
- package/lib/cjs/graph/engine/validation/index.cjs.map +1 -1
- package/lib/cjs/graph/nodes/agents/agent.cjs +118 -0
- package/lib/cjs/graph/nodes/agents/agent.cjs.map +1 -0
- package/lib/cjs/graph/nodes/base.cjs +61 -0
- package/lib/cjs/graph/nodes/base.cjs.map +1 -0
- package/lib/cjs/graph/nodes/boundary/input-value.cjs +59 -0
- package/lib/cjs/graph/nodes/boundary/input-value.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/break.cjs +71 -0
- package/lib/cjs/graph/nodes/flow-control/break.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/error-boundary.cjs +72 -0
- package/lib/cjs/graph/nodes/flow-control/error-boundary.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/human-approval.cjs +80 -0
- package/lib/cjs/graph/nodes/flow-control/human-approval.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/if.cjs +82 -0
- package/lib/cjs/graph/nodes/flow-control/if.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/parallel.cjs +69 -0
- package/lib/cjs/graph/nodes/flow-control/parallel.cjs.map +1 -0
- package/lib/cjs/graph/nodes/flow-control/switch.cjs +190 -0
- package/lib/cjs/graph/nodes/flow-control/switch.cjs.map +1 -0
- package/lib/cjs/graph/nodes/index.cjs +162 -0
- package/lib/cjs/graph/nodes/index.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/foreach.cjs +189 -0
- package/lib/cjs/graph/nodes/loops/foreach.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/loop-metadata.cjs +48 -0
- package/lib/cjs/graph/nodes/loops/loop-metadata.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/until.cjs +136 -0
- package/lib/cjs/graph/nodes/loops/until.cjs.map +1 -0
- package/lib/cjs/graph/nodes/loops/while.cjs +133 -0
- package/lib/cjs/graph/nodes/loops/while.cjs.map +1 -0
- package/lib/cjs/graph/nodes/manifests.cjs +342 -0
- package/lib/cjs/graph/nodes/manifests.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/chat.cjs +82 -0
- package/lib/cjs/graph/nodes/triggers/chat.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/event.cjs +63 -0
- package/lib/cjs/graph/nodes/triggers/event.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/form.cjs +64 -0
- package/lib/cjs/graph/nodes/triggers/form.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/manual.cjs +65 -0
- package/lib/cjs/graph/nodes/triggers/manual.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/schedule.cjs +65 -0
- package/lib/cjs/graph/nodes/triggers/schedule.cjs.map +1 -0
- package/lib/cjs/graph/nodes/triggers/webhook.cjs +67 -0
- package/lib/cjs/graph/nodes/triggers/webhook.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/code.cjs +139 -0
- package/lib/cjs/graph/nodes/utility/code.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/delay.cjs +66 -0
- package/lib/cjs/graph/nodes/utility/delay.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/log.cjs +70 -0
- package/lib/cjs/graph/nodes/utility/log.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/map.cjs +69 -0
- package/lib/cjs/graph/nodes/utility/map.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/merge.cjs +67 -0
- package/lib/cjs/graph/nodes/utility/merge.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/return.cjs +69 -0
- package/lib/cjs/graph/nodes/utility/return.cjs.map +1 -0
- package/lib/cjs/graph/nodes/utility/utility-log.cjs +77 -0
- package/lib/cjs/graph/nodes/utility/utility-log.cjs.map +1 -0
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs +8 -4
- package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowBoundaryValidation.cjs +2 -0
- package/lib/cjs/nest/graph/GraphWorkflowBoundaryValidation.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowService.cjs +1 -13
- package/lib/cjs/nest/graph/GraphWorkflowService.cjs.map +1 -1
- package/lib/esm/graph/engine/catalog/GraphBuiltInRegistrations.js +11 -72
- package/lib/esm/graph/engine/catalog/GraphBuiltInRegistrations.js.map +1 -1
- package/lib/esm/graph/engine/execution/GraphExecutionContext.js +5 -1
- package/lib/esm/graph/engine/execution/GraphExecutionContext.js.map +1 -1
- package/lib/esm/graph/engine/execution/GraphExecutionEngine.js +66 -1
- package/lib/esm/graph/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/graph/engine/execution/GraphExecutionFrame.js +16 -0
- package/lib/esm/graph/engine/execution/GraphExecutionFrame.js.map +1 -1
- package/lib/esm/graph/engine/execution/index.js +0 -4
- package/lib/esm/graph/engine/execution/index.js.map +1 -1
- package/lib/esm/graph/engine/index.js +0 -7
- package/lib/esm/graph/engine/index.js.map +1 -1
- package/lib/esm/graph/engine/loops/index.js +0 -3
- package/lib/esm/graph/engine/loops/index.js.map +1 -1
- package/lib/esm/graph/engine/validation/GraphLooseNodeValidation.js +32 -0
- package/lib/esm/graph/engine/validation/GraphLooseNodeValidation.js.map +1 -0
- package/lib/esm/graph/engine/validation/GraphParameterValidator.js +36 -3
- package/lib/esm/graph/engine/validation/GraphParameterValidator.js.map +1 -1
- package/lib/esm/graph/engine/validation/GraphWorkflowDocumentValidator.js +32 -1
- package/lib/esm/graph/engine/validation/GraphWorkflowDocumentValidator.js.map +1 -1
- package/lib/esm/graph/engine/validation/index.js +1 -0
- package/lib/esm/graph/engine/validation/index.js.map +1 -1
- package/lib/esm/graph/nodes/agents/agent.js +109 -0
- package/lib/esm/graph/nodes/agents/agent.js.map +1 -0
- package/lib/esm/graph/nodes/base.js +56 -0
- package/lib/esm/graph/nodes/base.js.map +1 -0
- package/lib/esm/graph/nodes/boundary/input-value.js +50 -0
- package/lib/esm/graph/nodes/boundary/input-value.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/break.js +62 -0
- package/lib/esm/graph/nodes/flow-control/break.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/error-boundary.js +63 -0
- package/lib/esm/graph/nodes/flow-control/error-boundary.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/human-approval.js +71 -0
- package/lib/esm/graph/nodes/flow-control/human-approval.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/if.js +73 -0
- package/lib/esm/graph/nodes/flow-control/if.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/parallel.js +60 -0
- package/lib/esm/graph/nodes/flow-control/parallel.js.map +1 -0
- package/lib/esm/graph/nodes/flow-control/switch.js +181 -0
- package/lib/esm/graph/nodes/flow-control/switch.js.map +1 -0
- package/lib/esm/graph/nodes/index.js +144 -0
- package/lib/esm/graph/nodes/index.js.map +1 -0
- package/lib/esm/graph/nodes/loops/foreach.js +180 -0
- package/lib/esm/graph/nodes/loops/foreach.js.map +1 -0
- package/lib/esm/graph/nodes/loops/loop-metadata.js +44 -0
- package/lib/esm/graph/nodes/loops/loop-metadata.js.map +1 -0
- package/lib/esm/graph/nodes/loops/until.js +127 -0
- package/lib/esm/graph/nodes/loops/until.js.map +1 -0
- package/lib/esm/graph/nodes/loops/while.js +124 -0
- package/lib/esm/graph/nodes/loops/while.js.map +1 -0
- package/lib/esm/graph/nodes/manifests.js +338 -0
- package/lib/esm/graph/nodes/manifests.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/chat.js +73 -0
- package/lib/esm/graph/nodes/triggers/chat.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/event.js +54 -0
- package/lib/esm/graph/nodes/triggers/event.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/form.js +55 -0
- package/lib/esm/graph/nodes/triggers/form.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/manual.js +56 -0
- package/lib/esm/graph/nodes/triggers/manual.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/schedule.js +56 -0
- package/lib/esm/graph/nodes/triggers/schedule.js.map +1 -0
- package/lib/esm/graph/nodes/triggers/webhook.js +58 -0
- package/lib/esm/graph/nodes/triggers/webhook.js.map +1 -0
- package/lib/esm/graph/nodes/utility/code.js +130 -0
- package/lib/esm/graph/nodes/utility/code.js.map +1 -0
- package/lib/esm/graph/nodes/utility/delay.js +57 -0
- package/lib/esm/graph/nodes/utility/delay.js.map +1 -0
- package/lib/esm/graph/nodes/utility/log.js +61 -0
- package/lib/esm/graph/nodes/utility/log.js.map +1 -0
- package/lib/esm/graph/nodes/utility/map.js +60 -0
- package/lib/esm/graph/nodes/utility/map.js.map +1 -0
- package/lib/esm/graph/nodes/utility/merge.js +58 -0
- package/lib/esm/graph/nodes/utility/merge.js.map +1 -0
- package/lib/esm/graph/nodes/utility/return.js +60 -0
- package/lib/esm/graph/nodes/utility/return.js.map +1 -0
- package/lib/esm/graph/nodes/utility/utility-log.js +68 -0
- package/lib/esm/graph/nodes/utility/utility-log.js.map +1 -0
- package/lib/esm/index.js +3 -3
- package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js +8 -4
- package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowBoundaryValidation.js +2 -0
- package/lib/esm/nest/graph/GraphWorkflowBoundaryValidation.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowService.js +2 -14
- package/lib/esm/nest/graph/GraphWorkflowService.js.map +1 -1
- package/lib/types/graph/engine/catalog/GraphBuiltInRegistrations.d.cts +4 -7
- package/lib/types/graph/engine/catalog/GraphBuiltInRegistrations.d.mts +4 -7
- package/lib/types/graph/engine/execution/GraphExecutionContext.d.cts +6 -1
- package/lib/types/graph/engine/execution/GraphExecutionContext.d.mts +6 -1
- package/lib/types/graph/engine/execution/GraphExecutionEngine.d.cts +27 -0
- package/lib/types/graph/engine/execution/GraphExecutionEngine.d.mts +27 -0
- package/lib/types/graph/engine/execution/GraphExecutionFrame.d.cts +12 -0
- package/lib/types/graph/engine/execution/GraphExecutionFrame.d.mts +12 -0
- package/lib/types/graph/engine/execution/index.d.cts +0 -4
- package/lib/types/graph/engine/execution/index.d.mts +0 -4
- package/lib/types/graph/engine/index.d.cts +0 -7
- package/lib/types/graph/engine/index.d.mts +0 -7
- package/lib/types/graph/engine/loops/index.d.cts +0 -3
- package/lib/types/graph/engine/loops/index.d.mts +0 -3
- package/lib/types/graph/engine/validation/GraphLooseNodeValidation.d.cts +21 -0
- package/lib/types/graph/engine/validation/GraphLooseNodeValidation.d.mts +21 -0
- package/lib/types/graph/engine/validation/GraphParameterValidator.d.cts +25 -1
- package/lib/types/graph/engine/validation/GraphParameterValidator.d.mts +25 -1
- package/lib/types/graph/engine/validation/index.d.cts +1 -0
- package/lib/types/graph/engine/validation/index.d.mts +1 -0
- package/lib/types/graph/nodes/agents/agent.d.cts +31 -0
- package/lib/types/graph/nodes/agents/agent.d.mts +31 -0
- package/lib/types/graph/nodes/base.d.cts +58 -0
- package/lib/types/graph/nodes/base.d.mts +58 -0
- package/lib/types/graph/nodes/boundary/input-value.d.cts +6 -0
- package/lib/types/graph/nodes/boundary/input-value.d.mts +6 -0
- package/lib/types/graph/nodes/flow-control/break.d.cts +8 -0
- package/lib/types/graph/nodes/flow-control/break.d.mts +8 -0
- package/lib/types/graph/nodes/flow-control/error-boundary.d.cts +8 -0
- package/lib/types/graph/nodes/flow-control/error-boundary.d.mts +8 -0
- package/lib/types/graph/nodes/flow-control/human-approval.d.cts +8 -0
- package/lib/types/graph/nodes/flow-control/human-approval.d.mts +8 -0
- package/lib/types/graph/nodes/flow-control/if.d.cts +8 -0
- package/lib/types/graph/nodes/flow-control/if.d.mts +8 -0
- package/lib/types/graph/nodes/flow-control/parallel.d.cts +7 -0
- package/lib/types/graph/nodes/flow-control/parallel.d.mts +7 -0
- package/lib/types/graph/nodes/flow-control/switch.d.cts +23 -0
- package/lib/types/graph/nodes/flow-control/switch.d.mts +23 -0
- package/lib/types/graph/nodes/index.d.cts +93 -0
- package/lib/types/graph/nodes/index.d.mts +93 -0
- package/lib/types/graph/nodes/loops/foreach.d.cts +11 -0
- package/lib/types/graph/nodes/loops/foreach.d.mts +11 -0
- package/lib/types/graph/nodes/loops/loop-metadata.d.cts +20 -0
- package/lib/types/graph/nodes/loops/loop-metadata.d.mts +20 -0
- package/lib/types/graph/nodes/loops/until.d.cts +8 -0
- package/lib/types/graph/nodes/loops/until.d.mts +8 -0
- package/lib/types/graph/nodes/loops/while.d.cts +8 -0
- package/lib/types/graph/nodes/loops/while.d.mts +8 -0
- package/lib/types/graph/nodes/manifests.d.cts +62 -0
- package/lib/types/graph/nodes/manifests.d.mts +62 -0
- package/lib/types/graph/nodes/triggers/chat.d.cts +8 -0
- package/lib/types/graph/nodes/triggers/chat.d.mts +8 -0
- package/lib/types/graph/nodes/triggers/event.d.cts +6 -0
- package/lib/types/graph/nodes/triggers/event.d.mts +6 -0
- package/lib/types/graph/nodes/triggers/form.d.cts +6 -0
- package/lib/types/graph/nodes/triggers/form.d.mts +6 -0
- package/lib/types/graph/nodes/triggers/manual.d.cts +6 -0
- package/lib/types/graph/nodes/triggers/manual.d.mts +6 -0
- package/lib/types/graph/nodes/triggers/schedule.d.cts +6 -0
- package/lib/types/graph/nodes/triggers/schedule.d.mts +6 -0
- package/lib/types/graph/nodes/triggers/webhook.d.cts +6 -0
- package/lib/types/graph/nodes/triggers/webhook.d.mts +6 -0
- package/lib/types/graph/nodes/utility/code.d.cts +36 -0
- package/lib/types/graph/nodes/utility/code.d.mts +36 -0
- package/lib/types/graph/nodes/utility/delay.d.cts +7 -0
- package/lib/types/graph/nodes/utility/delay.d.mts +7 -0
- package/lib/types/graph/nodes/utility/log.d.cts +8 -0
- package/lib/types/graph/nodes/utility/log.d.mts +8 -0
- package/lib/types/graph/nodes/utility/map.d.cts +7 -0
- package/lib/types/graph/nodes/utility/map.d.mts +7 -0
- package/lib/types/graph/nodes/utility/merge.d.cts +7 -0
- package/lib/types/graph/nodes/utility/merge.d.mts +7 -0
- package/lib/types/graph/nodes/utility/return.d.cts +7 -0
- package/lib/types/graph/nodes/utility/return.d.mts +7 -0
- package/lib/types/graph/nodes/utility/utility-log.d.cts +10 -0
- package/lib/types/graph/nodes/utility/utility-log.d.mts +10 -0
- package/lib/types/index.d.cts +2 -2
- package/lib/types/index.d.mts +2 -2
- package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.cts +5 -3
- package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.mts +5 -3
- package/package.json +1 -1
- package/lib/cjs/graph/engine/execution/BreakGraphNodeExecutor.cjs +0 -24
- package/lib/cjs/graph/engine/execution/BreakGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs +0 -103
- package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs +0 -47
- package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs +0 -121
- package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs +0 -146
- package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/UntilGraphNodeExecutor.cjs +0 -102
- package/lib/cjs/graph/engine/loops/UntilGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/WhileGraphNodeExecutor.cjs +0 -103
- package/lib/cjs/graph/engine/loops/WhileGraphNodeExecutor.cjs.map +0 -1
- package/lib/esm/graph/engine/execution/BreakGraphNodeExecutor.js +0 -19
- package/lib/esm/graph/engine/execution/BreakGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js +0 -98
- package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js +0 -42
- package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js +0 -116
- package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js +0 -141
- package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/loops/UntilGraphNodeExecutor.js +0 -97
- package/lib/esm/graph/engine/loops/UntilGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/loops/WhileGraphNodeExecutor.js +0 -98
- package/lib/esm/graph/engine/loops/WhileGraphNodeExecutor.js.map +0 -1
- package/lib/types/graph/engine/execution/BreakGraphNodeExecutor.d.cts +0 -22
- package/lib/types/graph/engine/execution/BreakGraphNodeExecutor.d.mts +0 -22
- package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.cts +0 -65
- package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.mts +0 -65
- package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.cts +0 -25
- package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.mts +0 -25
- package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.cts +0 -43
- package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.mts +0 -43
- package/lib/types/graph/engine/loops/ForeachGraphNodeExecutor.d.cts +0 -35
- package/lib/types/graph/engine/loops/ForeachGraphNodeExecutor.d.mts +0 -35
- package/lib/types/graph/engine/loops/UntilGraphNodeExecutor.d.cts +0 -22
- package/lib/types/graph/engine/loops/UntilGraphNodeExecutor.d.mts +0 -22
- package/lib/types/graph/engine/loops/WhileGraphNodeExecutor.d.cts +0 -26
- package/lib/types/graph/engine/loops/WhileGraphNodeExecutor.d.mts +0 -26
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @module integrations/graph/nodes/flow-control/switch
|
|
12
|
+
* @summary Switch flow-control node declaration (DECAF-32 §22.2.2).
|
|
13
|
+
* @description Switch — multi-branch. Routes the input to one of the case
|
|
14
|
+
* output ports or `default` based on matching conditions. Each case defines
|
|
15
|
+
* a `SwitchCaseCondition` (graphical or code mode) and a dedicated output
|
|
16
|
+
* port. Cases are stored in `metadata.switch.cases` and the renderer creates
|
|
17
|
+
* dynamic output ports from them (DECAF-32 §22.2.2).
|
|
18
|
+
*
|
|
19
|
+
* The node grows in height as cases are added. Each case gets its own
|
|
20
|
+
* output port on the right side, labeled with the case label.
|
|
21
|
+
*/
|
|
22
|
+
import { model, required } from "@decaf-ts/decorator-validation";
|
|
23
|
+
import { uielement } from "@decaf-ts/ui-decorators";
|
|
24
|
+
import { input, node, output, } from "@decaf-ts/ui-decorators/graph";
|
|
25
|
+
import { PortDirection, graphNodeSizeOf, } from "@decaf-ts/ui-decorators/graph";
|
|
26
|
+
import { graphDefinitionOf } from "@decaf-ts/ui-decorators/graph";
|
|
27
|
+
import { GraphNode } from "./../base.js";
|
|
28
|
+
import { GraphExecutionError } from "./../../engine/errors/GraphExecutionError.js";
|
|
29
|
+
import { ConditionExpressionEvaluator } from "./../../engine/loops/ConditionExpressionEvaluator.js";
|
|
30
|
+
function readSwitchMetadata(context) {
|
|
31
|
+
const parameters = (context.node.parameters ?? {});
|
|
32
|
+
const metadata = context.node.metadata;
|
|
33
|
+
const raw = parameters["switch"] ?? metadata?.["switch"];
|
|
34
|
+
const switchMeta = raw;
|
|
35
|
+
if (!switchMeta || !Array.isArray(switchMeta.cases)) {
|
|
36
|
+
return { cases: [], defaultPort: "default", hasDefault: false };
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
cases: switchMeta.cases,
|
|
40
|
+
defaultPort: switchMeta.defaultPort ?? "default",
|
|
41
|
+
hasDefault: switchMeta.hasDefault === true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function isCodeCondition(cond) {
|
|
45
|
+
return (typeof cond === "object" && cond !== null && "type" in cond && cond.type === "code");
|
|
46
|
+
}
|
|
47
|
+
function isConditionExpression(cond) {
|
|
48
|
+
return (typeof cond === "object" && cond !== null && "op" in cond && typeof cond.op === "string");
|
|
49
|
+
}
|
|
50
|
+
async function evaluateSwitchCondition(condition, inputValue, fullInput, context) {
|
|
51
|
+
if (isCodeCondition(condition)) {
|
|
52
|
+
const evaluator = context.engine?.codeSandboxEvaluator;
|
|
53
|
+
if (!evaluator) {
|
|
54
|
+
throw new GraphExecutionError("Code conditions require a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator", "GRAPH_CODE_SANDBOX_NOT_CONFIGURED", { code: condition.code });
|
|
55
|
+
}
|
|
56
|
+
await context.log("Evaluating code condition", {
|
|
57
|
+
language: condition.language ?? "javascript",
|
|
58
|
+
});
|
|
59
|
+
const md = context.metadata;
|
|
60
|
+
const result = await evaluator.evaluate({
|
|
61
|
+
code: condition.code,
|
|
62
|
+
language: condition.language,
|
|
63
|
+
input: fullInput,
|
|
64
|
+
vars: md?.vars ?? undefined,
|
|
65
|
+
item: md?.item,
|
|
66
|
+
index: md?.index,
|
|
67
|
+
nodes: md?.nodes ??
|
|
68
|
+
undefined,
|
|
69
|
+
logger: context.logger,
|
|
70
|
+
});
|
|
71
|
+
return !!result;
|
|
72
|
+
}
|
|
73
|
+
if (isConditionExpression(condition)) {
|
|
74
|
+
return new ConditionExpressionEvaluator().evaluate(condition, inputValue);
|
|
75
|
+
}
|
|
76
|
+
throw new GraphExecutionError("Unknown switch case condition type — must be ConditionExpression (op) or CodeCondition (type: 'code')", "GRAPH_UNKNOWN_SWITCH_CONDITION", { condition });
|
|
77
|
+
}
|
|
78
|
+
let SwitchFlowNode = class SwitchFlowNode extends GraphNode {
|
|
79
|
+
static async execute(request, context) {
|
|
80
|
+
const meta = readSwitchMetadata(context);
|
|
81
|
+
const input = request.inputs;
|
|
82
|
+
const inputValue = input["value"] ?? input;
|
|
83
|
+
for (const switchCase of meta.cases) {
|
|
84
|
+
const matches = await evaluateSwitchCondition(switchCase.condition, inputValue, input, context);
|
|
85
|
+
if (matches) {
|
|
86
|
+
return { [switchCase.outputPort]: inputValue };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (meta.hasDefault !== true) {
|
|
90
|
+
throw new GraphExecutionError("No switch case matched and default port is not enabled", "GRAPH_SWITCH_NO_MATCH", { cases: meta.cases.map((c) => c.id) });
|
|
91
|
+
}
|
|
92
|
+
const defaultPort = meta.defaultPort ?? "default";
|
|
93
|
+
return { [defaultPort]: inputValue };
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Computes the node's ports, size, and data patch from the given switch
|
|
97
|
+
* metadata. Each case gets its own output port on the right side; the
|
|
98
|
+
* `default` port always renders **last** (DECAF-32 §21 port-ordering rule,
|
|
99
|
+
* DECAF-34 §6.2). When `hasDefault` is `false`, the `default` output port
|
|
100
|
+
* is omitted entirely. The node grows in height as cases are added.
|
|
101
|
+
*
|
|
102
|
+
* @param meta - The switch metadata patch (`metadata.switch`), carrying
|
|
103
|
+
* the cases and the optional default-port configuration.
|
|
104
|
+
* @returns The computed {@link NodeMetadataChange}: reordered ports
|
|
105
|
+
* (case outputs inserted before the optional default), the grown size,
|
|
106
|
+
* and the `switchMetadata` data patch.
|
|
107
|
+
*/
|
|
108
|
+
static applyMetadata(meta) {
|
|
109
|
+
const definition = graphDefinitionOf(this);
|
|
110
|
+
const defaultPortName = meta.defaultPort ?? "default";
|
|
111
|
+
const hasDefault = meta.hasDefault === true;
|
|
112
|
+
// Base ports excluding any port that collides with a case output port.
|
|
113
|
+
const basePorts = definition.ports.filter((p) => !meta.cases.some((c) => c.outputPort === p.property));
|
|
114
|
+
// Separate the default output port so it can be placed last (or omitted).
|
|
115
|
+
const nonDefaultPorts = basePorts.filter((p) => p.property !== defaultPortName);
|
|
116
|
+
const defaultPort = basePorts.find((p) => p.property === defaultPortName);
|
|
117
|
+
const casePorts = meta.cases.map((c) => ({
|
|
118
|
+
property: c.outputPort,
|
|
119
|
+
name: c.label,
|
|
120
|
+
direction: PortDirection.OUTPUT,
|
|
121
|
+
label: c.label,
|
|
122
|
+
required: false,
|
|
123
|
+
hidden: false,
|
|
124
|
+
path: c.outputPort,
|
|
125
|
+
}));
|
|
126
|
+
// Port order: inputs/non-default outputs first, case outputs next, default last.
|
|
127
|
+
const ports = [...nonDefaultPorts, ...casePorts];
|
|
128
|
+
if (hasDefault && defaultPort) {
|
|
129
|
+
ports.push(defaultPort);
|
|
130
|
+
}
|
|
131
|
+
const caseCount = meta.cases.length;
|
|
132
|
+
return {
|
|
133
|
+
ports,
|
|
134
|
+
size: graphNodeSizeOf(definition, { cases: caseCount }),
|
|
135
|
+
dataPatch: { switchMetadata: meta },
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
__decorate([
|
|
140
|
+
required(),
|
|
141
|
+
uielement("textarea", { label: "Input value", placeholder: "Value to switch on" }),
|
|
142
|
+
input({ handle: "value" }),
|
|
143
|
+
__metadata("design:type", Object)
|
|
144
|
+
], SwitchFlowNode.prototype, "value", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
required(),
|
|
147
|
+
uielement("input", { label: "Default", placeholder: "Default output when no case matches" }),
|
|
148
|
+
output({ handle: "default" }),
|
|
149
|
+
__metadata("design:type", Object)
|
|
150
|
+
], SwitchFlowNode.prototype, "default", void 0);
|
|
151
|
+
SwitchFlowNode = __decorate([
|
|
152
|
+
node("core.flow.switch", {
|
|
153
|
+
kind: "core.flow.switch",
|
|
154
|
+
category: "Flow Control",
|
|
155
|
+
color: "#f59e0b",
|
|
156
|
+
icon: "ti-arrows-shuffle",
|
|
157
|
+
width: 120,
|
|
158
|
+
height: 140,
|
|
159
|
+
sizeRules: [
|
|
160
|
+
{
|
|
161
|
+
type: "parameterCount",
|
|
162
|
+
parameter: "cases",
|
|
163
|
+
dimension: "height",
|
|
164
|
+
perItem: 24,
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
labels: ["flow", "switch", "multi-branch"],
|
|
168
|
+
metadata: {
|
|
169
|
+
title: "Switch",
|
|
170
|
+
description: "Multi-branch switch. Routes the input to the first matching case output, or the default output.",
|
|
171
|
+
switch: {
|
|
172
|
+
cases: [],
|
|
173
|
+
defaultPort: "default",
|
|
174
|
+
hasDefault: false,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
}),
|
|
178
|
+
model()
|
|
179
|
+
], SwitchFlowNode);
|
|
180
|
+
export { SwitchFlowNode };
|
|
181
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../../../src/graph/nodes/flow-control/switch.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EACL,KAAK,EACL,IAAI,EACJ,MAAM,GACP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,eAAe,GAEhB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQlE,OAAO,EA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E,aAAa,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAClF,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;;6CACX;AAKhB;IAHC,QAAQ,EAAE;IACV,SAAS,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAC5F,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;;+CACZ;AAxCP,cAAc;IA3B1B,IAAI,CAAC,kBAAkB,EAAE;QACxB,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,cAAc;QACxB,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,mBAAmB;QACzB,KAAK,EAAE,GAAG;QACV,MAAM,EAAE,GAAG;QACX,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,gBAAgB;gBACtB,SAAS,EAAE,OAAO;gBAClB,SAAS,EAAE,QAAQ;gBACnB,OAAO,EAAE,EAAE;aACZ;SACF;QACD,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC;QAC1C,QAAQ,EAAE;YACR,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,iGAAiG;YAC9G,MAAM,EAAE;gBACN,KAAK,EAAE,EAAE;gBACT,WAAW,EAAE,SAAS;gBACtB,UAAU,EAAE,KAAK;aAClB;SACF;KACF,CAAC;IACD,KAAK,EAAE;GACK,cAAc,CA6F1B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module integrations/graph/nodes
|
|
3
|
+
* @summary Shared node kind declarations (DECAF-32 §22.2, DECAF-50 Phase A).
|
|
4
|
+
* @description Canonical `@node`-decorated classes for the ALFRED-5 node kind
|
|
5
|
+
* taxonomy, laid out one node per file under `nodes/<category>/<node>.ts`:
|
|
6
|
+
* triggers (§22.2.1), flow-control and utility nodes (§22.2.2–22.2.3), the
|
|
7
|
+
* Agent node (§21.3), the three loop kinds (`core.loop.foreach/while/until`,
|
|
8
|
+
* §5.9), and the workflow input-value boundary node. Shared non-node support
|
|
9
|
+
* (the base class and manifests) lives in sibling files under the same tree;
|
|
10
|
+
* category styles remain in `@decaf-ts/ui-decorators` (`graph/category-styles`).
|
|
11
|
+
* Consumers (for-angular, ALFRED, etc.) import these declarations
|
|
12
|
+
* to populate node palettes, registries, and reference snapshots.
|
|
13
|
+
*/
|
|
14
|
+
export * from "./base.js";
|
|
15
|
+
export * from "./flow-control/break.js";
|
|
16
|
+
export * from "./flow-control/error-boundary.js";
|
|
17
|
+
export * from "./flow-control/human-approval.js";
|
|
18
|
+
export * from "./flow-control/if.js";
|
|
19
|
+
export * from "./flow-control/parallel.js";
|
|
20
|
+
export * from "./flow-control/switch.js";
|
|
21
|
+
export * from "./utility/code.js";
|
|
22
|
+
export * from "./utility/delay.js";
|
|
23
|
+
export * from "./utility/log.js";
|
|
24
|
+
export * from "./utility/map.js";
|
|
25
|
+
export * from "./utility/merge.js";
|
|
26
|
+
export * from "./utility/return.js";
|
|
27
|
+
export * from "./utility/utility-log.js";
|
|
28
|
+
export * from "./triggers/chat.js";
|
|
29
|
+
export * from "./triggers/event.js";
|
|
30
|
+
export * from "./triggers/form.js";
|
|
31
|
+
export * from "./triggers/manual.js";
|
|
32
|
+
export * from "./triggers/schedule.js";
|
|
33
|
+
export * from "./triggers/webhook.js";
|
|
34
|
+
export * from "./agents/agent.js";
|
|
35
|
+
export * from "./loops/foreach.js";
|
|
36
|
+
export * from "./loops/until.js";
|
|
37
|
+
export * from "./loops/while.js";
|
|
38
|
+
import { AgentNode } from "./agents/agent.js";
|
|
39
|
+
export * from "./boundary/input-value.js";
|
|
40
|
+
export * from "./manifests.js";
|
|
41
|
+
import { BreakFlowNode } from "./flow-control/break.js";
|
|
42
|
+
import { ErrorBoundaryFlowNode } from "./flow-control/error-boundary.js";
|
|
43
|
+
import { HumanApprovalFlowNode } from "./flow-control/human-approval.js";
|
|
44
|
+
import { IfFlowNode } from "./flow-control/if.js";
|
|
45
|
+
import { ParallelFlowNode } from "./flow-control/parallel.js";
|
|
46
|
+
import { SwitchFlowNode } from "./flow-control/switch.js";
|
|
47
|
+
import { CodeNode } from "./utility/code.js";
|
|
48
|
+
import { DelayFlowNode } from "./utility/delay.js";
|
|
49
|
+
import { LogFlowNode } from "./utility/log.js";
|
|
50
|
+
import { MapNode } from "./utility/map.js";
|
|
51
|
+
import { MergeFlowNode } from "./utility/merge.js";
|
|
52
|
+
import { ReturnFlowNode } from "./utility/return.js";
|
|
53
|
+
import { UtilityLogNode } from "./utility/utility-log.js";
|
|
54
|
+
import { ChatTriggerNode } from "./triggers/chat.js";
|
|
55
|
+
import { EventTriggerNode } from "./triggers/event.js";
|
|
56
|
+
import { FormTriggerNode } from "./triggers/form.js";
|
|
57
|
+
import { ManualTriggerNode } from "./triggers/manual.js";
|
|
58
|
+
import { ScheduleTriggerNode } from "./triggers/schedule.js";
|
|
59
|
+
import { WebhookTriggerNode } from "./triggers/webhook.js";
|
|
60
|
+
import { GraphForeachLoopNode } from "./loops/foreach.js";
|
|
61
|
+
import { GraphUntilLoopNode } from "./loops/until.js";
|
|
62
|
+
import { GraphWhileLoopNode } from "./loops/while.js";
|
|
63
|
+
import { GraphInputValueNode } from "./boundary/input-value.js";
|
|
64
|
+
/**
|
|
65
|
+
* All built-in trigger node constructors.
|
|
66
|
+
*/
|
|
67
|
+
export const GRAPH_TRIGGER_NODES = [
|
|
68
|
+
ManualTriggerNode,
|
|
69
|
+
WebhookTriggerNode,
|
|
70
|
+
ScheduleTriggerNode,
|
|
71
|
+
EventTriggerNode,
|
|
72
|
+
FormTriggerNode,
|
|
73
|
+
ChatTriggerNode,
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* All built-in flow-control node constructors (branching/routing/looping/
|
|
77
|
+
* termination semantics).
|
|
78
|
+
*/
|
|
79
|
+
export const GRAPH_FLOW_CONTROL_NODES = [
|
|
80
|
+
IfFlowNode,
|
|
81
|
+
SwitchFlowNode,
|
|
82
|
+
ParallelFlowNode,
|
|
83
|
+
MergeFlowNode,
|
|
84
|
+
DelayFlowNode,
|
|
85
|
+
ErrorBoundaryFlowNode,
|
|
86
|
+
HumanApprovalFlowNode,
|
|
87
|
+
ReturnFlowNode,
|
|
88
|
+
LogFlowNode,
|
|
89
|
+
BreakFlowNode,
|
|
90
|
+
];
|
|
91
|
+
/**
|
|
92
|
+
* All built-in utility node constructors (side-effect/data-transformation
|
|
93
|
+
* semantics — no branching).
|
|
94
|
+
*/
|
|
95
|
+
export const GRAPH_UTILITY_NODES = [
|
|
96
|
+
CodeNode,
|
|
97
|
+
MapNode,
|
|
98
|
+
UtilityLogNode,
|
|
99
|
+
];
|
|
100
|
+
/**
|
|
101
|
+
* All built-in loop node constructors (shared declarations of the
|
|
102
|
+
* `core.loop.*` system kinds).
|
|
103
|
+
*/
|
|
104
|
+
export const GRAPH_LOOP_NODES = [
|
|
105
|
+
GraphForeachLoopNode,
|
|
106
|
+
GraphWhileLoopNode,
|
|
107
|
+
GraphUntilLoopNode,
|
|
108
|
+
];
|
|
109
|
+
/**
|
|
110
|
+
* All built-in boundary node constructors.
|
|
111
|
+
*/
|
|
112
|
+
export const GRAPH_BOUNDARY_NODES = [GraphInputValueNode];
|
|
113
|
+
/**
|
|
114
|
+
* Kind→class map for every built-in node kind the backend executes
|
|
115
|
+
* (DECAF-50 §4.26 R2-1). The catalogue derives each registration's
|
|
116
|
+
* manifest and executor from the class, so this is the single authority for
|
|
117
|
+
* built-in node behaviour.
|
|
118
|
+
*/
|
|
119
|
+
export const GRAPH_BUILT_IN_NODE_CLASSES_BY_KIND = {
|
|
120
|
+
"core.trigger.manual": ManualTriggerNode,
|
|
121
|
+
"core.trigger.webhook": WebhookTriggerNode,
|
|
122
|
+
"core.trigger.schedule": ScheduleTriggerNode,
|
|
123
|
+
"core.trigger.event": EventTriggerNode,
|
|
124
|
+
"core.trigger.form": FormTriggerNode,
|
|
125
|
+
"core.trigger.chat": ChatTriggerNode,
|
|
126
|
+
"core.flow.if": IfFlowNode,
|
|
127
|
+
"core.flow.switch": SwitchFlowNode,
|
|
128
|
+
"core.flow.parallel": ParallelFlowNode,
|
|
129
|
+
"core.flow.merge": MergeFlowNode,
|
|
130
|
+
"core.utility.map": MapNode,
|
|
131
|
+
"core.flow.delay": DelayFlowNode,
|
|
132
|
+
"core.flow.errorBoundary": ErrorBoundaryFlowNode,
|
|
133
|
+
"core.flow.humanApproval": HumanApprovalFlowNode,
|
|
134
|
+
"core.flow.return": ReturnFlowNode,
|
|
135
|
+
"core.utility.code": CodeNode,
|
|
136
|
+
"core.flow.log": LogFlowNode,
|
|
137
|
+
"core.utility.log": UtilityLogNode,
|
|
138
|
+
"core.flow.break": BreakFlowNode,
|
|
139
|
+
"core.agent": AgentNode,
|
|
140
|
+
"core.loop.foreach": GraphForeachLoopNode,
|
|
141
|
+
"core.loop.while": GraphWhileLoopNode,
|
|
142
|
+
"core.loop.until": GraphUntilLoopNode,
|
|
143
|
+
};
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/graph/nodes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,0BAAuB;AACvB,wCAAqC;AACrC,iDAA8C;AAC9C,iDAA8C;AAC9C,qCAAkC;AAClC,2CAAwC;AACxC,yCAAsC;AACtC,kCAA+B;AAC/B,mCAAgC;AAChC,iCAA8B;AAC9B,iCAA8B;AAC9B,mCAAgC;AAChC,oCAAiC;AACjC,yCAAsC;AACtC,mCAAgC;AAChC,oCAAiC;AACjC,mCAAgC;AAChC,qCAAkC;AAClC,uCAAoC;AACpC,sCAAmC;AACnC,kCAA+B;AAC/B,mCAAgC;AAChC,iCAA8B;AAC9B,iCAA8B;AAC9B,OAAO,EAAE,SAAS,EAAE,0BAAuB;AAC3C,0CAAuC;AACvC,+BAA4B;AAG5B,OAAO,EAAE,aAAa,E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G;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,QAAQ;IACR,OAAO;IACP,cAAc;CACN,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,oBAAoB;IACpB,kBAAkB;IAClB,kBAAkB;CACV,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,mBAAmB,CAAU,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAmC;IACjF,qBAAqB,EAAE,iBAAiB;IACxC,sBAAsB,EAAE,kBAAkB;IAC1C,uBAAuB,EAAE,mBAAmB;IAC5C,oBAAoB,EAAE,gBAAgB;IACtC,mBAAmB,EAAE,eAAe;IACpC,mBAAmB,EAAE,eAAe;IACpC,cAAc,EAAE,UAAU;IAC1B,kBAAkB,EAAE,cAAc;IAClC,oBAAoB,EAAE,gBAAgB;IACtC,iBAAiB,EAAE,aAAa;IAChC,kBAAkB,EAAE,OAAO;IAC3B,iBAAiB,EAAE,aAAa;IAChC,yBAAyB,EAAE,qBAAqB;IAChD,yBAAyB,EAAE,qBAAqB;IAChD,kBAAkB,EAAE,cAAc;IAClC,mBAAmB,EAAE,QAAQ;IAC7B,eAAe,EAAE,WAAW;IAC5B,kBAAkB,EAAE,cAAc;IAClC,iBAAiB,EAAE,aAAa;IAChC,YAAY,EAAE,SAAS;IACvB,mBAAmB,EAAE,oBAAoB;IACzC,iBAAiB,EAAE,kBAAkB;IACrC,iBAAiB,EAAE,kBAAkB;CACtC,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @module integrations/graph/nodes/loops/foreach
|
|
12
|
+
* @summary Foreach loop node declaration.
|
|
13
|
+
* @description Shared declaration for the `core.loop.foreach` system node
|
|
14
|
+
* kind (decorator id `graph-foreach-loop-node`), ported from the for-angular
|
|
15
|
+
* demo app so the loop kinds become shared canvas nodes. The class's own
|
|
16
|
+
* `static execute` is the only implementation of the kind, derived by
|
|
17
|
+
* `GraphBuiltInRegistrations`, and reaches engine services through
|
|
18
|
+
* `GraphExecutionContext.engine`. The loop-body workflow is demo/app-side
|
|
19
|
+
* content and is not part of the shared declaration — the shared class
|
|
20
|
+
* carries the port/metadata shape only.
|
|
21
|
+
*/
|
|
22
|
+
import { model, required } from "@decaf-ts/decorator-validation";
|
|
23
|
+
import { uielement } from "@decaf-ts/ui-decorators";
|
|
24
|
+
import { connection, input, node, output } from "@decaf-ts/ui-decorators/graph";
|
|
25
|
+
import { GraphNode } from "./../base.js";
|
|
26
|
+
import { GraphExecutionEventType } from "@decaf-ts/ui-decorators/graph";
|
|
27
|
+
import { GraphExecutionError } from "./../../engine/errors/GraphExecutionError.js";
|
|
28
|
+
import { GraphInputError } from "./../../engine/errors/GraphInputError.js";
|
|
29
|
+
import { GraphLoopLimitError } from "./../../engine/errors/GraphLoopLimitError.js";
|
|
30
|
+
import { extractLoopMetadata } from "./loop-metadata.js";
|
|
31
|
+
import { GRAPH_DEFAULT_MAX_FOREACH_ITERATIONS } from "./../../engine/constants.js";
|
|
32
|
+
import { GraphBreakSignal } from "./../../engine/errors/GraphBreakSignal.js";
|
|
33
|
+
let GraphForeachLoopNode = class GraphForeachLoopNode extends GraphNode {
|
|
34
|
+
static async execute(request, context) {
|
|
35
|
+
const metadata = extractLoopMetadata(context, "foreach");
|
|
36
|
+
const input = request.inputs;
|
|
37
|
+
const items = input.items;
|
|
38
|
+
const maxIterations = metadata.maxIterations ?? GRAPH_DEFAULT_MAX_FOREACH_ITERATIONS;
|
|
39
|
+
if (!Array.isArray(items)) {
|
|
40
|
+
throw new GraphInputError("foreach input 'items' must be an array");
|
|
41
|
+
}
|
|
42
|
+
const engine = context.engine;
|
|
43
|
+
if (!engine) {
|
|
44
|
+
throw new GraphExecutionError("foreach node requires engine access", "GRAPH_ENGINE_NOT_AVAILABLE");
|
|
45
|
+
}
|
|
46
|
+
const sliceRaw = Number(input.slice ?? metadata.slice ?? 1);
|
|
47
|
+
const slice = Number.isFinite(sliceRaw) && sliceRaw > 0 ? Math.floor(sliceRaw) : 1;
|
|
48
|
+
const iterations = slice > 1 ? Math.ceil(items.length / slice) : items.length;
|
|
49
|
+
if (iterations > maxIterations) {
|
|
50
|
+
throw new GraphLoopLimitError(`foreach exceeded max iterations (${iterations} > ${maxIterations})`);
|
|
51
|
+
}
|
|
52
|
+
const itemPort = metadata.itemPort ?? "item";
|
|
53
|
+
const resultPort = metadata.resultPort ?? "result";
|
|
54
|
+
const statePort = metadata.statePort ?? "state";
|
|
55
|
+
const bodyWorkflow = metadata.body;
|
|
56
|
+
const results = [];
|
|
57
|
+
let state = input.state;
|
|
58
|
+
let broken = false;
|
|
59
|
+
await context.emit({ type: GraphExecutionEventType.LOOP_STARTED });
|
|
60
|
+
for (let i = 0; i < iterations; i++) {
|
|
61
|
+
await context.emit({
|
|
62
|
+
type: GraphExecutionEventType.LOOP_ITERATION_STARTED,
|
|
63
|
+
iteration: i,
|
|
64
|
+
});
|
|
65
|
+
const sliceItems = slice > 1 ? items.slice(i * slice, i * slice + slice) : items[i];
|
|
66
|
+
const childInputs = {
|
|
67
|
+
[itemPort]: sliceItems,
|
|
68
|
+
index: i,
|
|
69
|
+
};
|
|
70
|
+
if (slice > 1)
|
|
71
|
+
childInputs["slice"] = sliceItems;
|
|
72
|
+
if (state !== undefined)
|
|
73
|
+
childInputs[statePort] = state;
|
|
74
|
+
try {
|
|
75
|
+
const childResult = await engine.execute(bodyWorkflow, childInputs, {
|
|
76
|
+
parentRunId: context.runId,
|
|
77
|
+
path: [...context.path, `iteration:${i}`],
|
|
78
|
+
metadata: { item: sliceItems, index: i, slice },
|
|
79
|
+
});
|
|
80
|
+
results.push(childResult.outputs[resultPort]);
|
|
81
|
+
if (childResult.outputs[statePort] !== undefined) {
|
|
82
|
+
state = childResult.outputs[statePort];
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
if (err instanceof GraphBreakSignal) {
|
|
87
|
+
const carried = err.details
|
|
88
|
+
?.value;
|
|
89
|
+
if (carried !== undefined)
|
|
90
|
+
results.push(carried);
|
|
91
|
+
broken = true;
|
|
92
|
+
await context.emit({
|
|
93
|
+
type: GraphExecutionEventType.LOOP_ITERATION_COMPLETED,
|
|
94
|
+
iteration: i,
|
|
95
|
+
metadata: { broken: true },
|
|
96
|
+
});
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
101
|
+
await context.emit({
|
|
102
|
+
type: GraphExecutionEventType.LOOP_ITERATION_COMPLETED,
|
|
103
|
+
iteration: i,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
await context.emit({
|
|
107
|
+
type: GraphExecutionEventType.LOOP_COMPLETED,
|
|
108
|
+
metadata: { broken },
|
|
109
|
+
});
|
|
110
|
+
const output = {
|
|
111
|
+
results,
|
|
112
|
+
completed: results,
|
|
113
|
+
iterations: results.length,
|
|
114
|
+
broken,
|
|
115
|
+
};
|
|
116
|
+
if (state !== undefined)
|
|
117
|
+
output[statePort] = state;
|
|
118
|
+
return output;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
__decorate([
|
|
122
|
+
required(),
|
|
123
|
+
uielement("textarea", {
|
|
124
|
+
label: "Items",
|
|
125
|
+
placeholder: "Array to iterate over",
|
|
126
|
+
}),
|
|
127
|
+
input({ handle: "items" }),
|
|
128
|
+
__metadata("design:type", Array)
|
|
129
|
+
], GraphForeachLoopNode.prototype, "items", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
required(),
|
|
132
|
+
uielement("input", {
|
|
133
|
+
label: "Slice size",
|
|
134
|
+
placeholder: "Items per iteration (default 1)",
|
|
135
|
+
}),
|
|
136
|
+
input({ handle: "slice" }),
|
|
137
|
+
__metadata("design:type", Number)
|
|
138
|
+
], GraphForeachLoopNode.prototype, "slice", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
required(),
|
|
141
|
+
output({ handle: "item" }),
|
|
142
|
+
__metadata("design:type", Object)
|
|
143
|
+
], GraphForeachLoopNode.prototype, "item", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
required(),
|
|
146
|
+
connection({
|
|
147
|
+
handle: "loop",
|
|
148
|
+
connectionRules: { allowSelf: true, maxConnections: 1 },
|
|
149
|
+
}),
|
|
150
|
+
__metadata("design:type", Object)
|
|
151
|
+
], GraphForeachLoopNode.prototype, "loop", void 0);
|
|
152
|
+
__decorate([
|
|
153
|
+
required(),
|
|
154
|
+
output({ handle: "completed" }),
|
|
155
|
+
__metadata("design:type", Array)
|
|
156
|
+
], GraphForeachLoopNode.prototype, "completed", void 0);
|
|
157
|
+
GraphForeachLoopNode = __decorate([
|
|
158
|
+
node("graph-foreach-loop-node", {
|
|
159
|
+
kind: "core.loop.foreach",
|
|
160
|
+
category: "Loop",
|
|
161
|
+
color: "#eab308",
|
|
162
|
+
icon: "ti-repeat",
|
|
163
|
+
width: 120,
|
|
164
|
+
height: 140,
|
|
165
|
+
labels: ["loop", "iteration", "foreach"],
|
|
166
|
+
metadata: {
|
|
167
|
+
title: "Foreach loop",
|
|
168
|
+
description: "Iterates over an array input and executes the body once per item (or per slice of items).",
|
|
169
|
+
loop: {
|
|
170
|
+
maxIterations: 100,
|
|
171
|
+
itemPort: "item",
|
|
172
|
+
resultPort: "result",
|
|
173
|
+
slice: 1,
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
177
|
+
model()
|
|
178
|
+
], GraphForeachLoopNode);
|
|
179
|
+
export { GraphForeachLoopNode };
|
|
180
|
+
//# sourceMappingURL=foreach.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"foreach.js","sourceRoot":"","sources":["../../../../../src/graph/nodes/loops/foreach.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,qBAAgB;AAMpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,qDAAgD;AAC9E,OAAO,EAAE,eAAe,EAAE,iDAA4C;AACtE,OAAO,EAAE,mBAAmB,EAAE,qDAAgD;AAC9E,OAAO,EAAE,mBAAmB,EAAE,2BAAwB;AACtD,OAAO,EAAE,oCAAoC,EAAE,oCAA+B;AAC9E,OAAO,EAAE,gBAAgB,EAAE,kDAA6C;AAuBjE,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,SAAS;IACjD,MAAM,CAAC,KAAK,CAAC,OAAO,CAClB,OAAkC,EAClC,OAA8B;QAE9B,MAAM,QAAQ,GAAG,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,MAAM,KAAK,GAAG,KA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metadata for the executing loop node.
|
|
4
|
+
*
|
|
5
|
+
* @param context - The run-scoped execution context for the loop node.
|
|
6
|
+
* @param label - The loop kind label used in error messages.
|
|
7
|
+
* @returns The effective loop metadata (body, limits, ports, condition).
|
|
8
|
+
* @throws {GraphInputError} when the node carries no loop body configuration.
|
|
9
|
+
*/
|
|
10
|
+
export function extractLoopMetadata(context, label) {
|
|
11
|
+
const instance = context.node;
|
|
12
|
+
const parameters = (instance.parameters ?? {});
|
|
13
|
+
const loop = instance.loop;
|
|
14
|
+
const fallback = context.metadata?.["loop"];
|
|
15
|
+
if (!loop?.body && !fallback?.["body"]) {
|
|
16
|
+
throw new GraphInputError(`${label} node is missing loop configuration (instance.loop.body)`);
|
|
17
|
+
}
|
|
18
|
+
const body = (loop?.body ?? fallback?.["body"]);
|
|
19
|
+
const number = (key) => {
|
|
20
|
+
const raw = parameters[key] ??
|
|
21
|
+
loop?.[key] ??
|
|
22
|
+
fallback?.[key];
|
|
23
|
+
const value = Number(raw);
|
|
24
|
+
return raw !== undefined && Number.isFinite(value) ? value : undefined;
|
|
25
|
+
};
|
|
26
|
+
const string = (key) => {
|
|
27
|
+
const raw = parameters[key] ?? fallback?.[key];
|
|
28
|
+
return typeof raw === "string" ? raw : undefined;
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
body,
|
|
32
|
+
maxIterations: number("maxIterations"),
|
|
33
|
+
timeoutMs: number("timeoutMs"),
|
|
34
|
+
concurrency: number("concurrency"),
|
|
35
|
+
condition: (parameters["condition"] ?? fallback?.["condition"]),
|
|
36
|
+
inputPort: string("inputPort"),
|
|
37
|
+
outputPort: string("outputPort"),
|
|
38
|
+
itemPort: string("itemPort"),
|
|
39
|
+
resultPort: string("resultPort"),
|
|
40
|
+
statePort: string("statePort"),
|
|
41
|
+
slice: number("slice"),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=loop-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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