n8n-workflow 2.31.2 → 2.32.0
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/cjs/augment-object.js +136 -146
- package/dist/cjs/augment-object.js.map +1 -1
- package/dist/cjs/build.tsbuildinfo +1 -1
- package/dist/cjs/common/find-ai-root-node-names.js +36 -46
- package/dist/cjs/common/find-ai-root-node-names.js.map +1 -1
- package/dist/cjs/common/get-child-nodes.js +8 -18
- package/dist/cjs/common/get-child-nodes.js.map +1 -1
- package/dist/cjs/common/get-connected-nodes.js +84 -94
- package/dist/cjs/common/get-connected-nodes.js.map +1 -1
- package/dist/cjs/common/get-node-by-name.js +16 -26
- package/dist/cjs/common/get-node-by-name.js.map +1 -1
- package/dist/cjs/common/get-parent-nodes.js +14 -24
- package/dist/cjs/common/get-parent-nodes.js.map +1 -1
- package/dist/cjs/common/index.js +9 -19
- package/dist/cjs/common/index.js.map +1 -1
- package/dist/cjs/common/map-connections-by-destination.js +31 -41
- package/dist/cjs/common/map-connections-by-destination.js.map +1 -1
- package/dist/cjs/common/resolve-variables.d.ts +8 -0
- package/dist/cjs/common/resolve-variables.d.ts.map +1 -1
- package/dist/cjs/common/resolve-variables.js +46 -33
- package/dist/cjs/common/resolve-variables.js.map +1 -1
- package/dist/cjs/connections-diff.js +58 -68
- package/dist/cjs/connections-diff.js.map +1 -1
- package/dist/cjs/constants.d.ts +3 -3
- package/dist/cjs/constants.d.ts.map +1 -1
- package/dist/cjs/constants.js +157 -166
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/credential-domain-restrictions.js +153 -163
- package/dist/cjs/credential-domain-restrictions.js.map +1 -1
- package/dist/cjs/cron.d.ts.map +1 -1
- package/dist/cjs/cron.js +25 -35
- package/dist/cjs/cron.js.map +1 -1
- package/dist/cjs/data-table.types.js +10 -20
- package/dist/cjs/data-table.types.js.map +1 -1
- package/dist/cjs/dynamic-credentials-helpers.js +93 -103
- package/dist/cjs/dynamic-credentials-helpers.js.map +1 -1
- package/dist/cjs/errors/abstract/execution-base.error.d.ts.map +1 -1
- package/dist/cjs/errors/abstract/execution-base.error.js +41 -51
- package/dist/cjs/errors/abstract/execution-base.error.js.map +1 -1
- package/dist/cjs/errors/abstract/node.error.d.ts.map +1 -1
- package/dist/cjs/errors/abstract/node.error.js +142 -152
- package/dist/cjs/errors/abstract/node.error.js.map +1 -1
- package/dist/cjs/errors/base/base.error.d.ts.map +1 -1
- package/dist/cjs/errors/base/base.error.js +35 -45
- package/dist/cjs/errors/base/base.error.js.map +1 -1
- package/dist/cjs/errors/base/operational.error.d.ts.map +1 -1
- package/dist/cjs/errors/base/operational.error.js +17 -27
- package/dist/cjs/errors/base/operational.error.js.map +1 -1
- package/dist/cjs/errors/base/unexpected.error.d.ts.map +1 -1
- package/dist/cjs/errors/base/unexpected.error.js +17 -27
- package/dist/cjs/errors/base/unexpected.error.js.map +1 -1
- package/dist/cjs/errors/base/user.error.d.ts.map +1 -1
- package/dist/cjs/errors/base/user.error.js +17 -27
- package/dist/cjs/errors/base/user.error.js.map +1 -1
- package/dist/cjs/errors/cli-subworkflow-operation.error.js +7 -17
- package/dist/cjs/errors/cli-subworkflow-operation.error.js.map +1 -1
- package/dist/cjs/errors/db-connection-timeout-error.d.ts.map +1 -1
- package/dist/cjs/errors/db-connection-timeout-error.js +11 -21
- package/dist/cjs/errors/db-connection-timeout-error.js.map +1 -1
- package/dist/cjs/errors/execution-cancelled.error.d.ts.map +1 -1
- package/dist/cjs/errors/execution-cancelled.error.js +33 -43
- package/dist/cjs/errors/execution-cancelled.error.js.map +1 -1
- package/dist/cjs/errors/expression-class-extension.error.d.ts.map +1 -1
- package/dist/cjs/errors/expression-class-extension.error.js +9 -19
- package/dist/cjs/errors/expression-class-extension.error.js.map +1 -1
- package/dist/cjs/errors/expression-computed-destructuring.error.d.ts.map +1 -1
- package/dist/cjs/errors/expression-computed-destructuring.error.js +9 -19
- package/dist/cjs/errors/expression-computed-destructuring.error.js.map +1 -1
- package/dist/cjs/errors/expression-destructuring.error.d.ts.map +1 -1
- package/dist/cjs/errors/expression-destructuring.error.js +9 -19
- package/dist/cjs/errors/expression-destructuring.error.js.map +1 -1
- package/dist/cjs/errors/expression-extension.error.js +7 -17
- package/dist/cjs/errors/expression-extension.error.js.map +1 -1
- package/dist/cjs/errors/expression-reserved-variable.error.d.ts.map +1 -1
- package/dist/cjs/errors/expression-reserved-variable.error.js +9 -19
- package/dist/cjs/errors/expression-reserved-variable.error.js.map +1 -1
- package/dist/cjs/errors/expression-with-statement.error.d.ts.map +1 -1
- package/dist/cjs/errors/expression-with-statement.error.js +9 -19
- package/dist/cjs/errors/expression-with-statement.error.js.map +1 -1
- package/dist/cjs/errors/expression.error.d.ts.map +1 -1
- package/dist/cjs/errors/expression.error.js +33 -43
- package/dist/cjs/errors/expression.error.js.map +1 -1
- package/dist/cjs/errors/index.js +62 -72
- package/dist/cjs/errors/index.js.map +1 -1
- package/dist/cjs/errors/node-api.error.d.ts.map +1 -1
- package/dist/cjs/errors/node-api.error.js +227 -237
- package/dist/cjs/errors/node-api.error.js.map +1 -1
- package/dist/cjs/errors/node-operation.error.d.ts.map +1 -1
- package/dist/cjs/errors/node-operation.error.js +43 -53
- package/dist/cjs/errors/node-operation.error.js.map +1 -1
- package/dist/cjs/errors/node-ssl.error.d.ts.map +1 -1
- package/dist/cjs/errors/node-ssl.error.js +9 -19
- package/dist/cjs/errors/node-ssl.error.js.map +1 -1
- package/dist/cjs/errors/subworkflow-operation.error.d.ts.map +1 -1
- package/dist/cjs/errors/subworkflow-operation.error.js +18 -28
- package/dist/cjs/errors/subworkflow-operation.error.js.map +1 -1
- package/dist/cjs/errors/trigger-close.error.d.ts.map +1 -1
- package/dist/cjs/errors/trigger-close.error.js +11 -21
- package/dist/cjs/errors/trigger-close.error.js.map +1 -1
- package/dist/cjs/errors/webhook-taken.error.d.ts.map +1 -1
- package/dist/cjs/errors/webhook-taken.error.js +9 -19
- package/dist/cjs/errors/webhook-taken.error.js.map +1 -1
- package/dist/cjs/errors/workflow-activation.error.d.ts.map +1 -1
- package/dist/cjs/errors/workflow-activation.error.js +54 -64
- package/dist/cjs/errors/workflow-activation.error.js.map +1 -1
- package/dist/cjs/errors/workflow-configuration.error.js +10 -20
- package/dist/cjs/errors/workflow-configuration.error.js.map +1 -1
- package/dist/cjs/errors/workflow-deactivation.error.js +7 -17
- package/dist/cjs/errors/workflow-deactivation.error.js.map +1 -1
- package/dist/cjs/errors/workflow-operation.error.d.ts.map +1 -1
- package/dist/cjs/errors/workflow-operation.error.js +20 -30
- package/dist/cjs/errors/workflow-operation.error.js.map +1 -1
- package/dist/cjs/evaluation-helpers.js +16 -26
- package/dist/cjs/evaluation-helpers.js.map +1 -1
- package/dist/cjs/execution-context-establishment-hooks.d.ts.map +1 -1
- package/dist/cjs/execution-context-establishment-hooks.js +43 -53
- package/dist/cjs/execution-context-establishment-hooks.js.map +1 -1
- package/dist/cjs/execution-context.d.ts +14 -14
- package/dist/cjs/execution-context.d.ts.map +1 -1
- package/dist/cjs/execution-context.js +203 -213
- package/dist/cjs/execution-context.js.map +1 -1
- package/dist/cjs/execution-status.d.ts +2 -2
- package/dist/cjs/execution-status.d.ts.map +1 -1
- package/dist/cjs/execution-status.js +27 -37
- package/dist/cjs/execution-status.js.map +1 -1
- package/dist/cjs/expression-evaluator-proxy.d.ts.map +1 -1
- package/dist/cjs/expression-evaluator-proxy.js +18 -28
- package/dist/cjs/expression-evaluator-proxy.js.map +1 -1
- package/dist/cjs/expression-sandboxing.d.ts.map +1 -1
- package/dist/cjs/expression-sandboxing.js +447 -457
- package/dist/cjs/expression-sandboxing.js.map +1 -1
- package/dist/cjs/expression.d.ts.map +1 -1
- package/dist/cjs/expression.js +535 -546
- package/dist/cjs/expression.js.map +1 -1
- package/dist/cjs/expressions/expression-helpers.d.ts.map +1 -1
- package/dist/cjs/expressions/expression-helpers.js +13 -23
- package/dist/cjs/expressions/expression-helpers.js.map +1 -1
- package/dist/cjs/extensions/array-extensions.js +591 -601
- package/dist/cjs/extensions/array-extensions.js.map +1 -1
- package/dist/cjs/extensions/boolean-extensions.d.ts +1 -1
- package/dist/cjs/extensions/boolean-extensions.js +38 -48
- package/dist/cjs/extensions/boolean-extensions.js.map +1 -1
- package/dist/cjs/extensions/date-extensions.js +507 -517
- package/dist/cjs/extensions/date-extensions.js.map +1 -1
- package/dist/cjs/extensions/expression-extension.d.ts.map +1 -1
- package/dist/cjs/extensions/expression-extension.js +455 -465
- package/dist/cjs/extensions/expression-extension.js.map +1 -1
- package/dist/cjs/extensions/expression-parser.d.ts.map +1 -1
- package/dist/cjs/extensions/expression-parser.js +82 -92
- package/dist/cjs/extensions/expression-parser.js.map +1 -1
- package/dist/cjs/extensions/extended-functions.d.ts +10 -18
- package/dist/cjs/extensions/extended-functions.d.ts.map +1 -1
- package/dist/cjs/extensions/extended-functions.js +80 -90
- package/dist/cjs/extensions/extended-functions.js.map +1 -1
- package/dist/cjs/extensions/extensions.js +2 -12
- package/dist/cjs/extensions/index.js +10 -20
- package/dist/cjs/extensions/index.js.map +1 -1
- package/dist/cjs/extensions/number-extensions.js +226 -236
- package/dist/cjs/extensions/number-extensions.js.map +1 -1
- package/dist/cjs/extensions/object-extensions.js +274 -284
- package/dist/cjs/extensions/object-extensions.js.map +1 -1
- package/dist/cjs/extensions/string-extensions.d.ts +1 -1
- package/dist/cjs/extensions/string-extensions.d.ts.map +1 -1
- package/dist/cjs/extensions/string-extensions.js +769 -779
- package/dist/cjs/extensions/string-extensions.js.map +1 -1
- package/dist/cjs/extensions/utils.d.ts.map +1 -1
- package/dist/cjs/extensions/utils.js +35 -45
- package/dist/cjs/extensions/utils.js.map +1 -1
- package/dist/cjs/from-ai-parse-utils.js +393 -403
- package/dist/cjs/from-ai-parse-utils.js.map +1 -1
- package/dist/cjs/global-state.js +12 -22
- package/dist/cjs/global-state.js.map +1 -1
- package/dist/cjs/graph/graph-utils.js +166 -176
- package/dist/cjs/graph/graph-utils.js.map +1 -1
- package/dist/cjs/highlighted-data.js +13 -23
- package/dist/cjs/highlighted-data.js.map +1 -1
- package/dist/cjs/index.js +105 -115
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces.d.ts +112 -22
- package/dist/cjs/interfaces.d.ts.map +1 -1
- package/dist/cjs/interfaces.js +62 -72
- package/dist/cjs/interfaces.js.map +1 -1
- package/dist/cjs/jmespath-query.js +26 -36
- package/dist/cjs/jmespath-query.js.map +1 -1
- package/dist/cjs/logger-proxy.d.ts.map +1 -1
- package/dist/cjs/logger-proxy.js +15 -25
- package/dist/cjs/logger-proxy.js.map +1 -1
- package/dist/cjs/mcp-helpers.js +10 -20
- package/dist/cjs/mcp-helpers.js.map +1 -1
- package/dist/cjs/message-event-bus.d.ts +184 -165
- package/dist/cjs/message-event-bus.d.ts.map +1 -1
- package/dist/cjs/message-event-bus.js +207 -217
- package/dist/cjs/message-event-bus.js.map +1 -1
- package/dist/cjs/metadata-utils.js +35 -45
- package/dist/cjs/metadata-utils.js.map +1 -1
- package/dist/cjs/native-methods/array.methods.js +527 -537
- package/dist/cjs/native-methods/array.methods.js.map +1 -1
- package/dist/cjs/native-methods/boolean.methods.js +18 -28
- package/dist/cjs/native-methods/boolean.methods.js.map +1 -1
- package/dist/cjs/native-methods/index.js +16 -26
- package/dist/cjs/native-methods/index.js.map +1 -1
- package/dist/cjs/native-methods/number.methods.js +79 -89
- package/dist/cjs/native-methods/number.methods.js.map +1 -1
- package/dist/cjs/native-methods/object.methods.js +7 -17
- package/dist/cjs/native-methods/object.methods.js.map +1 -1
- package/dist/cjs/native-methods/string.methods.js +474 -484
- package/dist/cjs/native-methods/string.methods.js.map +1 -1
- package/dist/cjs/node-grouping-validation.d.ts +6 -0
- package/dist/cjs/node-grouping-validation.d.ts.map +1 -1
- package/dist/cjs/node-grouping-validation.js +165 -144
- package/dist/cjs/node-grouping-validation.js.map +1 -1
- package/dist/cjs/node-helpers.d.ts.map +1 -1
- package/dist/cjs/node-helpers.js +1486 -1493
- package/dist/cjs/node-helpers.js.map +1 -1
- package/dist/cjs/node-parameters/filter-parameter.d.ts.map +1 -1
- package/dist/cjs/node-parameters/filter-parameter.js +315 -325
- package/dist/cjs/node-parameters/filter-parameter.js.map +1 -1
- package/dist/cjs/node-parameters/node-parameter-value-type-guard.js +105 -115
- package/dist/cjs/node-parameters/node-parameter-value-type-guard.js.map +1 -1
- package/dist/cjs/node-parameters/parameter-type-validation.js +120 -130
- package/dist/cjs/node-parameters/parameter-type-validation.js.map +1 -1
- package/dist/cjs/node-parameters/path-utils.js +21 -31
- package/dist/cjs/node-parameters/path-utils.js.map +1 -1
- package/dist/cjs/node-parameters/rename-node-utils.js +22 -32
- package/dist/cjs/node-parameters/rename-node-utils.js.map +1 -1
- package/dist/cjs/node-reference-parser-utils.js +472 -482
- package/dist/cjs/node-reference-parser-utils.js.map +1 -1
- package/dist/cjs/node-validation.js +59 -69
- package/dist/cjs/node-validation.js.map +1 -1
- package/dist/cjs/observable-object.js +56 -66
- package/dist/cjs/observable-object.js.map +1 -1
- package/dist/cjs/redaction-channels.js +36 -46
- package/dist/cjs/redaction-channels.js.map +1 -1
- package/dist/cjs/run-execution-data/run-execution-data.js +15 -25
- package/dist/cjs/run-execution-data/run-execution-data.js.map +1 -1
- package/dist/cjs/run-execution-data/run-execution-data.v0.js +2 -12
- package/dist/cjs/run-execution-data/run-execution-data.v1.js +26 -36
- package/dist/cjs/run-execution-data/run-execution-data.v1.js.map +1 -1
- package/dist/cjs/run-execution-data-factory.js +113 -123
- package/dist/cjs/run-execution-data-factory.js.map +1 -1
- package/dist/cjs/schemas.d.ts +13 -13
- package/dist/cjs/schemas.d.ts.map +1 -1
- package/dist/cjs/schemas.js +351 -360
- package/dist/cjs/schemas.js.map +1 -1
- package/dist/cjs/sub-workflow-output.js +10 -20
- package/dist/cjs/sub-workflow-output.js.map +1 -1
- package/dist/cjs/telemetry-helpers.d.ts.map +1 -1
- package/dist/cjs/telemetry-helpers.js +716 -726
- package/dist/cjs/telemetry-helpers.js.map +1 -1
- package/dist/cjs/tool-helpers.js +18 -28
- package/dist/cjs/tool-helpers.js.map +1 -1
- package/dist/cjs/trigger-identity.js +41 -51
- package/dist/cjs/trigger-identity.js.map +1 -1
- package/dist/cjs/trimmed-task-data.js +21 -31
- package/dist/cjs/trimmed-task-data.js.map +1 -1
- package/dist/cjs/type-guards.d.ts +3 -3
- package/dist/cjs/type-guards.d.ts.map +1 -1
- package/dist/cjs/type-guards.js +74 -84
- package/dist/cjs/type-guards.js.map +1 -1
- package/dist/cjs/type-validation.d.ts.map +1 -1
- package/dist/cjs/type-validation.js +383 -393
- package/dist/cjs/type-validation.js.map +1 -1
- package/dist/cjs/utils.d.ts +2 -2
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +430 -440
- package/dist/cjs/utils.js.map +1 -1
- package/dist/cjs/versioned-node-type.d.ts.map +1 -1
- package/dist/cjs/versioned-node-type.js +20 -30
- package/dist/cjs/versioned-node-type.js.map +1 -1
- package/dist/cjs/workflow-checksum.js +67 -77
- package/dist/cjs/workflow-checksum.js.map +1 -1
- package/dist/cjs/workflow-data-proxy-env-provider.js +58 -68
- package/dist/cjs/workflow-data-proxy-env-provider.js.map +1 -1
- package/dist/cjs/workflow-data-proxy-helpers.js +8 -18
- package/dist/cjs/workflow-data-proxy-helpers.js.map +1 -1
- package/dist/cjs/workflow-data-proxy.d.ts.map +1 -1
- package/dist/cjs/workflow-data-proxy.js +1162 -1172
- package/dist/cjs/workflow-data-proxy.js.map +1 -1
- package/dist/cjs/workflow-diff.d.ts +2 -1
- package/dist/cjs/workflow-diff.d.ts.map +1 -1
- package/dist/cjs/workflow-diff.js +292 -300
- package/dist/cjs/workflow-diff.js.map +1 -1
- package/dist/cjs/workflow-environments-helper.js +23 -33
- package/dist/cjs/workflow-environments-helper.js.map +1 -1
- package/dist/cjs/workflow-expression.d.ts.map +1 -1
- package/dist/cjs/workflow-expression.js +97 -107
- package/dist/cjs/workflow-expression.js.map +1 -1
- package/dist/cjs/workflow-structure-validation.d.ts.map +1 -1
- package/dist/cjs/workflow-structure-validation.js +140 -150
- package/dist/cjs/workflow-structure-validation.js.map +1 -1
- package/dist/cjs/workflow-validation.js +40 -50
- package/dist/cjs/workflow-validation.js.map +1 -1
- package/dist/cjs/workflow.d.ts.map +1 -1
- package/dist/cjs/workflow.js +612 -622
- package/dist/cjs/workflow.js.map +1 -1
- package/dist/esm/common/get-child-nodes.js.map +1 -1
- package/dist/esm/common/get-connected-nodes.js.map +1 -1
- package/dist/esm/common/get-parent-nodes.js.map +1 -1
- package/dist/esm/common/resolve-variables.d.ts +8 -0
- package/dist/esm/common/resolve-variables.d.ts.map +1 -1
- package/dist/esm/common/resolve-variables.js +22 -0
- package/dist/esm/common/resolve-variables.js.map +1 -1
- package/dist/esm/constants.d.ts +3 -3
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/cron.d.ts.map +1 -1
- package/dist/esm/errors/abstract/execution-base.error.d.ts.map +1 -1
- package/dist/esm/errors/abstract/execution-base.error.js.map +1 -1
- package/dist/esm/errors/abstract/node.error.d.ts.map +1 -1
- package/dist/esm/errors/abstract/node.error.js.map +1 -1
- package/dist/esm/errors/base/base.error.d.ts.map +1 -1
- package/dist/esm/errors/base/base.error.js.map +1 -1
- package/dist/esm/errors/base/operational.error.d.ts.map +1 -1
- package/dist/esm/errors/base/operational.error.js.map +1 -1
- package/dist/esm/errors/base/unexpected.error.d.ts.map +1 -1
- package/dist/esm/errors/base/unexpected.error.js.map +1 -1
- package/dist/esm/errors/base/user.error.d.ts.map +1 -1
- package/dist/esm/errors/base/user.error.js.map +1 -1
- package/dist/esm/errors/db-connection-timeout-error.d.ts.map +1 -1
- package/dist/esm/errors/execution-cancelled.error.d.ts.map +1 -1
- package/dist/esm/errors/expression-class-extension.error.d.ts.map +1 -1
- package/dist/esm/errors/expression-computed-destructuring.error.d.ts.map +1 -1
- package/dist/esm/errors/expression-destructuring.error.d.ts.map +1 -1
- package/dist/esm/errors/expression-reserved-variable.error.d.ts.map +1 -1
- package/dist/esm/errors/expression-with-statement.error.d.ts.map +1 -1
- package/dist/esm/errors/expression.error.d.ts.map +1 -1
- package/dist/esm/errors/node-api.error.d.ts.map +1 -1
- package/dist/esm/errors/node-api.error.js.map +1 -1
- package/dist/esm/errors/node-operation.error.d.ts.map +1 -1
- package/dist/esm/errors/node-operation.error.js.map +1 -1
- package/dist/esm/errors/node-ssl.error.d.ts.map +1 -1
- package/dist/esm/errors/subworkflow-operation.error.d.ts.map +1 -1
- package/dist/esm/errors/trigger-close.error.d.ts.map +1 -1
- package/dist/esm/errors/trigger-close.error.js.map +1 -1
- package/dist/esm/errors/webhook-taken.error.d.ts.map +1 -1
- package/dist/esm/errors/workflow-activation.error.d.ts.map +1 -1
- package/dist/esm/errors/workflow-activation.error.js.map +1 -1
- package/dist/esm/errors/workflow-operation.error.d.ts.map +1 -1
- package/dist/esm/execution-context-establishment-hooks.d.ts.map +1 -1
- package/dist/esm/execution-context.d.ts +14 -14
- package/dist/esm/execution-context.d.ts.map +1 -1
- package/dist/esm/execution-status.d.ts +2 -2
- package/dist/esm/execution-status.d.ts.map +1 -1
- package/dist/esm/expression-evaluator-proxy.d.ts.map +1 -1
- package/dist/esm/expression-sandboxing.d.ts.map +1 -1
- package/dist/esm/expression-sandboxing.js.map +1 -1
- package/dist/esm/expression.d.ts.map +1 -1
- package/dist/esm/expression.js.map +1 -1
- package/dist/esm/expressions/expression-helpers.d.ts.map +1 -1
- package/dist/esm/extensions/boolean-extensions.d.ts +1 -1
- package/dist/esm/extensions/expression-extension.d.ts.map +1 -1
- package/dist/esm/extensions/expression-parser.d.ts.map +1 -1
- package/dist/esm/extensions/extended-functions.d.ts +10 -18
- package/dist/esm/extensions/extended-functions.d.ts.map +1 -1
- package/dist/esm/extensions/number-extensions.js.map +1 -1
- package/dist/esm/extensions/string-extensions.d.ts +1 -1
- package/dist/esm/extensions/string-extensions.d.ts.map +1 -1
- package/dist/esm/extensions/string-extensions.js.map +1 -1
- package/dist/esm/extensions/utils.d.ts.map +1 -1
- package/dist/esm/from-ai-parse-utils.js.map +1 -1
- package/dist/esm/interfaces.d.ts +112 -22
- package/dist/esm/interfaces.d.ts.map +1 -1
- package/dist/esm/interfaces.js.map +1 -1
- package/dist/esm/logger-proxy.d.ts.map +1 -1
- package/dist/esm/message-event-bus.d.ts +184 -165
- package/dist/esm/message-event-bus.d.ts.map +1 -1
- package/dist/esm/message-event-bus.js +2 -2
- package/dist/esm/message-event-bus.js.map +1 -1
- package/dist/esm/node-grouping-validation.d.ts +6 -0
- package/dist/esm/node-grouping-validation.d.ts.map +1 -1
- package/dist/esm/node-grouping-validation.js +34 -5
- package/dist/esm/node-grouping-validation.js.map +1 -1
- package/dist/esm/node-helpers.d.ts.map +1 -1
- package/dist/esm/node-helpers.js +3 -0
- package/dist/esm/node-helpers.js.map +1 -1
- package/dist/esm/node-parameters/filter-parameter.d.ts.map +1 -1
- package/dist/esm/node-parameters/filter-parameter.js.map +1 -1
- package/dist/esm/node-reference-parser-utils.js.map +1 -1
- package/dist/esm/run-execution-data-factory.js.map +1 -1
- package/dist/esm/schemas.d.ts +13 -13
- package/dist/esm/schemas.d.ts.map +1 -1
- package/dist/esm/schemas.js +1 -0
- package/dist/esm/schemas.js.map +1 -1
- package/dist/esm/telemetry-helpers.d.ts.map +1 -1
- package/dist/esm/telemetry-helpers.js.map +1 -1
- package/dist/esm/type-guards.d.ts +3 -3
- package/dist/esm/type-guards.d.ts.map +1 -1
- package/dist/esm/type-validation.d.ts.map +1 -1
- package/dist/esm/type-validation.js.map +1 -1
- package/dist/esm/typecheck.tsbuildinfo +1 -1
- package/dist/esm/utils.d.ts +2 -2
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js.map +1 -1
- package/dist/esm/versioned-node-type.d.ts.map +1 -1
- package/dist/esm/workflow-data-proxy.d.ts.map +1 -1
- package/dist/esm/workflow-data-proxy.js.map +1 -1
- package/dist/esm/workflow-diff.d.ts +2 -1
- package/dist/esm/workflow-diff.d.ts.map +1 -1
- package/dist/esm/workflow-diff.js +3 -1
- package/dist/esm/workflow-diff.js.map +1 -1
- package/dist/esm/workflow-expression.d.ts.map +1 -1
- package/dist/esm/workflow-expression.js.map +1 -1
- package/dist/esm/workflow-structure-validation.d.ts.map +1 -1
- package/dist/esm/workflow-structure-validation.js.map +1 -1
- package/dist/esm/workflow.d.ts.map +1 -1
- package/dist/esm/workflow.js.map +1 -1
- package/package.json +10 -9
package/dist/cjs/workflow.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2
3
|
if (k2 === undefined) k2 = k;
|
|
3
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -31,685 +32,674 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
31
32
|
return result;
|
|
32
33
|
};
|
|
33
34
|
})();
|
|
34
|
-
(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// does not get used.
|
|
88
|
-
continue;
|
|
89
|
-
// throw new ApplicationError(`Node with unknown node type`, {
|
|
90
|
-
// tags: { nodeType: node.type },
|
|
91
|
-
// extra: { node },
|
|
92
|
-
// });
|
|
93
|
-
}
|
|
94
|
-
// Add default values
|
|
95
|
-
const nodeParameters = NodeHelpers.getNodeParameters(nodeType.description.properties, node.parameters, true, false, node, nodeType.description);
|
|
96
|
-
node.parameters = nodeParameters !== null ? nodeParameters : {};
|
|
97
|
-
}
|
|
98
|
-
this.setNodes(parameters.nodes);
|
|
99
|
-
this.setConnections(parameters.connections);
|
|
100
|
-
this.setPinData(parameters.pinData);
|
|
101
|
-
this.setSettings(parameters.settings ?? {});
|
|
102
|
-
this.active = parameters.active || false;
|
|
103
|
-
this.staticData = ObservableObject.create(parameters.staticData || {}, undefined, {
|
|
104
|
-
ignoreEmptyOnFirstChild: true,
|
|
105
|
-
});
|
|
106
|
-
this.timezone = this.settings.timezone ?? (0, global_state_1.getGlobalState)().defaultTimezone;
|
|
107
|
-
this.expression = new workflow_expression_1.WorkflowExpression(this);
|
|
108
|
-
}
|
|
109
|
-
// Save nodes in workflow as object to be able to get the nodes easily by their name.
|
|
110
|
-
setNodes(nodes) {
|
|
111
|
-
this.nodes = {};
|
|
112
|
-
for (const node of nodes) {
|
|
113
|
-
this.nodes[node.name] = node;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
setConnections(connections) {
|
|
117
|
-
this.connectionsBySourceNode = connections;
|
|
118
|
-
this.connectionsByDestinationNode = (0, common_1.mapConnectionsByDestination)(this.connectionsBySourceNode);
|
|
119
|
-
}
|
|
120
|
-
setPinData(pinData) {
|
|
121
|
-
this.pinData = pinData;
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Workflow = void 0;
|
|
37
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
38
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
39
|
+
/* eslint-disable @typescript-eslint/no-for-in-array */
|
|
40
|
+
const common_1 = require("./common");
|
|
41
|
+
const constants_1 = require("./constants");
|
|
42
|
+
const errors_1 = require("./errors");
|
|
43
|
+
const workflow_expression_1 = require("./workflow-expression");
|
|
44
|
+
const global_state_1 = require("./global-state");
|
|
45
|
+
const interfaces_1 = require("./interfaces");
|
|
46
|
+
const NodeHelpers = __importStar(require("./node-helpers"));
|
|
47
|
+
const rename_node_utils_1 = require("./node-parameters/rename-node-utils");
|
|
48
|
+
const node_reference_parser_utils_1 = require("./node-reference-parser-utils");
|
|
49
|
+
const ObservableObject = __importStar(require("./observable-object"));
|
|
50
|
+
const utils_1 = require("./utils");
|
|
51
|
+
class Workflow {
|
|
52
|
+
id;
|
|
53
|
+
name;
|
|
54
|
+
nodes = {};
|
|
55
|
+
connectionsBySourceNode = {};
|
|
56
|
+
connectionsByDestinationNode = {};
|
|
57
|
+
nodeTypes;
|
|
58
|
+
expression;
|
|
59
|
+
active;
|
|
60
|
+
settings = {};
|
|
61
|
+
timezone;
|
|
62
|
+
// To save workflow specific static data like for example
|
|
63
|
+
// ids of registered webhooks of nodes
|
|
64
|
+
staticData;
|
|
65
|
+
testStaticData;
|
|
66
|
+
pinData;
|
|
67
|
+
constructor(parameters) {
|
|
68
|
+
this.id = parameters.id; // @tech_debt Ensure this is not optional
|
|
69
|
+
this.name = parameters.name;
|
|
70
|
+
this.nodeTypes = parameters.nodeTypes;
|
|
71
|
+
let nodeType;
|
|
72
|
+
for (const node of parameters.nodes) {
|
|
73
|
+
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
74
|
+
if (nodeType === undefined) {
|
|
75
|
+
// Go on to next node when its type is not known.
|
|
76
|
+
// For now do not error because that causes problems with
|
|
77
|
+
// expression resolution also then when the unknown node
|
|
78
|
+
// does not get used.
|
|
79
|
+
continue;
|
|
80
|
+
// throw new ApplicationError(`Node with unknown node type`, {
|
|
81
|
+
// tags: { nodeType: node.type },
|
|
82
|
+
// extra: { node },
|
|
83
|
+
// });
|
|
84
|
+
}
|
|
85
|
+
// Add default values
|
|
86
|
+
const nodeParameters = NodeHelpers.getNodeParameters(nodeType.description.properties, node.parameters, true, false, node, nodeType.description);
|
|
87
|
+
node.parameters = nodeParameters !== null ? nodeParameters : {};
|
|
122
88
|
}
|
|
123
|
-
|
|
124
|
-
|
|
89
|
+
this.setNodes(parameters.nodes);
|
|
90
|
+
this.setConnections(parameters.connections);
|
|
91
|
+
this.setPinData(parameters.pinData);
|
|
92
|
+
this.setSettings(parameters.settings ?? {});
|
|
93
|
+
this.active = parameters.active || false;
|
|
94
|
+
this.staticData = ObservableObject.create(parameters.staticData || {}, undefined, {
|
|
95
|
+
ignoreEmptyOnFirstChild: true,
|
|
96
|
+
});
|
|
97
|
+
this.timezone = this.settings.timezone ?? (0, global_state_1.getGlobalState)().defaultTimezone;
|
|
98
|
+
this.expression = new workflow_expression_1.WorkflowExpression(this);
|
|
99
|
+
}
|
|
100
|
+
// Save nodes in workflow as object to be able to get the nodes easily by their name.
|
|
101
|
+
setNodes(nodes) {
|
|
102
|
+
this.nodes = {};
|
|
103
|
+
for (const node of nodes) {
|
|
104
|
+
this.nodes[node.name] = node;
|
|
125
105
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
106
|
+
}
|
|
107
|
+
setConnections(connections) {
|
|
108
|
+
this.connectionsBySourceNode = connections;
|
|
109
|
+
this.connectionsByDestinationNode = (0, common_1.mapConnectionsByDestination)(this.connectionsBySourceNode);
|
|
110
|
+
}
|
|
111
|
+
setPinData(pinData) {
|
|
112
|
+
this.pinData = pinData;
|
|
113
|
+
}
|
|
114
|
+
setSettings(settings) {
|
|
115
|
+
this.settings = settings;
|
|
116
|
+
}
|
|
117
|
+
overrideStaticData(staticData) {
|
|
118
|
+
this.staticData = ObservableObject.create(staticData || {}, undefined, {
|
|
119
|
+
ignoreEmptyOnFirstChild: true,
|
|
120
|
+
});
|
|
121
|
+
this.staticData.__dataChanged = true;
|
|
122
|
+
}
|
|
123
|
+
static getConnectionsByDestination(connections) {
|
|
124
|
+
const returnConnection = {};
|
|
125
|
+
let connectionInfo;
|
|
126
|
+
let maxIndex;
|
|
127
|
+
for (const sourceNode in connections) {
|
|
128
|
+
if (!connections.hasOwnProperty(sourceNode)) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
for (const type of Object.keys(connections[sourceNode])) {
|
|
132
|
+
if (!connections[sourceNode].hasOwnProperty(type)) {
|
|
138
133
|
continue;
|
|
139
134
|
}
|
|
140
|
-
for (const
|
|
141
|
-
if (!connections[sourceNode].hasOwnProperty(
|
|
135
|
+
for (const inputIndex in connections[sourceNode][type]) {
|
|
136
|
+
if (!connections[sourceNode][type].hasOwnProperty(inputIndex)) {
|
|
142
137
|
continue;
|
|
143
138
|
}
|
|
144
|
-
for (
|
|
145
|
-
if (!
|
|
146
|
-
|
|
139
|
+
for (connectionInfo of connections[sourceNode][type][inputIndex] ?? []) {
|
|
140
|
+
if (!returnConnection.hasOwnProperty(connectionInfo.node)) {
|
|
141
|
+
returnConnection[connectionInfo.node] = {};
|
|
142
|
+
}
|
|
143
|
+
if (!returnConnection[connectionInfo.node].hasOwnProperty(connectionInfo.type)) {
|
|
144
|
+
returnConnection[connectionInfo.node][connectionInfo.type] = [];
|
|
147
145
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
if (!returnConnection[connectionInfo.node].hasOwnProperty(connectionInfo.type)) {
|
|
153
|
-
returnConnection[connectionInfo.node][connectionInfo.type] = [];
|
|
154
|
-
}
|
|
155
|
-
maxIndex = returnConnection[connectionInfo.node][connectionInfo.type].length - 1;
|
|
156
|
-
for (let j = maxIndex; j < connectionInfo.index; j++) {
|
|
157
|
-
returnConnection[connectionInfo.node][connectionInfo.type].push([]);
|
|
158
|
-
}
|
|
159
|
-
returnConnection[connectionInfo.node][connectionInfo.type][connectionInfo.index]?.push({
|
|
160
|
-
node: sourceNode,
|
|
161
|
-
type,
|
|
162
|
-
index: parseInt(inputIndex, 10),
|
|
163
|
-
});
|
|
146
|
+
maxIndex = returnConnection[connectionInfo.node][connectionInfo.type].length - 1;
|
|
147
|
+
for (let j = maxIndex; j < connectionInfo.index; j++) {
|
|
148
|
+
returnConnection[connectionInfo.node][connectionInfo.type].push([]);
|
|
164
149
|
}
|
|
150
|
+
returnConnection[connectionInfo.node][connectionInfo.type][connectionInfo.index]?.push({
|
|
151
|
+
node: sourceNode,
|
|
152
|
+
type,
|
|
153
|
+
index: parseInt(inputIndex, 10),
|
|
154
|
+
});
|
|
165
155
|
}
|
|
166
156
|
}
|
|
167
157
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
key = `node:${node.name}`;
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
throw new errors_1.UnexpectedError('Unknown context type. Only `global` and `node` are supported.', {
|
|
191
|
-
extra: { contextType: type },
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (this.testStaticData?.[key])
|
|
195
|
-
return this.testStaticData[key];
|
|
196
|
-
if (this.staticData[key] === undefined) {
|
|
197
|
-
// Create it as ObservableObject that we can easily check if the data changed
|
|
198
|
-
// to know if the workflow with its data has to be saved afterwards or not.
|
|
199
|
-
this.staticData[key] = ObservableObject.create({}, this.staticData);
|
|
200
|
-
}
|
|
201
|
-
return this.staticData[key];
|
|
202
|
-
}
|
|
203
|
-
setTestStaticData(testStaticData) {
|
|
204
|
-
this.testStaticData = testStaticData;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Returns all the trigger nodes in the workflow.
|
|
208
|
-
*
|
|
209
|
-
*/
|
|
210
|
-
getTriggerNodes() {
|
|
211
|
-
return this.queryNodes((nodeType) => !!nodeType.trigger);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Returns all the poll nodes in the workflow
|
|
215
|
-
*
|
|
216
|
-
*/
|
|
217
|
-
getPollNodes() {
|
|
218
|
-
return this.queryNodes((nodeType) => !!nodeType.poll);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Returns all the nodes in the workflow for which the given
|
|
222
|
-
* checkFunction return true
|
|
223
|
-
*
|
|
224
|
-
* @param {(nodeType: INodeType) => boolean} checkFunction
|
|
225
|
-
*/
|
|
226
|
-
queryNodes(checkFunction) {
|
|
227
|
-
const returnNodes = [];
|
|
228
|
-
// Check if it has any of them
|
|
229
|
-
let node;
|
|
230
|
-
let nodeType;
|
|
231
|
-
for (const nodeName of Object.keys(this.nodes)) {
|
|
232
|
-
node = this.nodes[nodeName];
|
|
233
|
-
if (node.disabled === true) {
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
237
|
-
if (nodeType !== undefined && checkFunction(nodeType)) {
|
|
238
|
-
returnNodes.push(node);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return returnNodes;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Returns the node with the given name if it exists else null
|
|
245
|
-
*
|
|
246
|
-
* @param {string} nodeName Name of the node to return
|
|
247
|
-
*/
|
|
248
|
-
getNode(nodeName) {
|
|
249
|
-
return this.nodes[nodeName] ?? null;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Returns the nodes with the given names if they exist.
|
|
253
|
-
* If a node cannot be found it will be ignored, meaning the returned array
|
|
254
|
-
* of nodes can be smaller than the array of names.
|
|
255
|
-
*/
|
|
256
|
-
getNodes(nodeNames) {
|
|
257
|
-
const nodes = [];
|
|
258
|
-
for (const name of nodeNames) {
|
|
259
|
-
const node = this.getNode(name);
|
|
260
|
-
if (!node) {
|
|
261
|
-
console.warn(`Could not find a node with the name ${name} in the workflow. This was passed in as a dirty node name.`);
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
nodes.push(node);
|
|
265
|
-
}
|
|
266
|
-
return nodes;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Returns the pinData of the node with the given name if it exists
|
|
270
|
-
*
|
|
271
|
-
* @param {string} nodeName Name of the node to return the pinData of
|
|
272
|
-
*/
|
|
273
|
-
getPinDataOfNode(nodeName) {
|
|
274
|
-
return this.pinData ? this.pinData[nodeName] : undefined;
|
|
275
|
-
}
|
|
276
|
-
renameNodeInParameterValue(parameterValue, currentName, newName, { hasRenamableContent } = { hasRenamableContent: false }) {
|
|
277
|
-
if (typeof parameterValue !== 'object') {
|
|
278
|
-
// Reached the actual value
|
|
279
|
-
if (typeof parameterValue === 'string' &&
|
|
280
|
-
(parameterValue.charAt(0) === '=' || hasRenamableContent)) {
|
|
281
|
-
parameterValue = (0, node_reference_parser_utils_1.applyAccessPatterns)(parameterValue, currentName, newName);
|
|
282
|
-
}
|
|
283
|
-
return parameterValue;
|
|
158
|
+
}
|
|
159
|
+
return returnConnection;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Returns the static data of the workflow.
|
|
163
|
+
* It gets saved with the workflow and will be the same for
|
|
164
|
+
* all workflow-executions.
|
|
165
|
+
*
|
|
166
|
+
* @param {string} type The type of data to return ("global"|"node")
|
|
167
|
+
* @param {INode} [node] If type is set to "node" then the node has to be provided
|
|
168
|
+
*/
|
|
169
|
+
getStaticData(type, node) {
|
|
170
|
+
let key;
|
|
171
|
+
if (type === 'global') {
|
|
172
|
+
key = 'global';
|
|
173
|
+
}
|
|
174
|
+
else if (type === 'node') {
|
|
175
|
+
if (node === undefined) {
|
|
176
|
+
throw new errors_1.UnexpectedError('The request data of context type "node" the node parameter has to be set!');
|
|
284
177
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
178
|
+
key = `node:${node.name}`;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
throw new errors_1.UnexpectedError('Unknown context type. Only `global` and `node` are supported.', {
|
|
182
|
+
extra: { contextType: type },
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
if (this.testStaticData?.[key])
|
|
186
|
+
return this.testStaticData[key];
|
|
187
|
+
if (this.staticData[key] === undefined) {
|
|
188
|
+
// Create it as ObservableObject that we can easily check if the data changed
|
|
189
|
+
// to know if the workflow with its data has to be saved afterwards or not.
|
|
190
|
+
this.staticData[key] = ObservableObject.create({}, this.staticData);
|
|
191
|
+
}
|
|
192
|
+
return this.staticData[key];
|
|
193
|
+
}
|
|
194
|
+
setTestStaticData(testStaticData) {
|
|
195
|
+
this.testStaticData = testStaticData;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Returns all the trigger nodes in the workflow.
|
|
199
|
+
*
|
|
200
|
+
*/
|
|
201
|
+
getTriggerNodes() {
|
|
202
|
+
return this.queryNodes((nodeType) => !!nodeType.trigger);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Returns all the poll nodes in the workflow
|
|
206
|
+
*
|
|
207
|
+
*/
|
|
208
|
+
getPollNodes() {
|
|
209
|
+
return this.queryNodes((nodeType) => !!nodeType.poll);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Returns all the nodes in the workflow for which the given
|
|
213
|
+
* checkFunction return true
|
|
214
|
+
*
|
|
215
|
+
* @param {(nodeType: INodeType) => boolean} checkFunction
|
|
216
|
+
*/
|
|
217
|
+
queryNodes(checkFunction) {
|
|
218
|
+
const returnNodes = [];
|
|
219
|
+
// Check if it has any of them
|
|
220
|
+
let node;
|
|
221
|
+
let nodeType;
|
|
222
|
+
for (const nodeName of Object.keys(this.nodes)) {
|
|
223
|
+
node = this.nodes[nodeName];
|
|
224
|
+
if (node.disabled === true) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
228
|
+
if (nodeType !== undefined && checkFunction(nodeType)) {
|
|
229
|
+
returnNodes.push(node);
|
|
292
230
|
}
|
|
231
|
+
}
|
|
232
|
+
return returnNodes;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Returns the node with the given name if it exists else null
|
|
236
|
+
*
|
|
237
|
+
* @param {string} nodeName Name of the node to return
|
|
238
|
+
*/
|
|
239
|
+
getNode(nodeName) {
|
|
240
|
+
return this.nodes[nodeName] ?? null;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Returns the nodes with the given names if they exist.
|
|
244
|
+
* If a node cannot be found it will be ignored, meaning the returned array
|
|
245
|
+
* of nodes can be smaller than the array of names.
|
|
246
|
+
*/
|
|
247
|
+
getNodes(nodeNames) {
|
|
248
|
+
const nodes = [];
|
|
249
|
+
for (const name of nodeNames) {
|
|
250
|
+
const node = this.getNode(name);
|
|
251
|
+
if (!node) {
|
|
252
|
+
console.warn(`Could not find a node with the name ${name} in the workflow. This was passed in as a dirty node name.`);
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
255
|
+
nodes.push(node);
|
|
256
|
+
}
|
|
257
|
+
return nodes;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Returns the pinData of the node with the given name if it exists
|
|
261
|
+
*
|
|
262
|
+
* @param {string} nodeName Name of the node to return the pinData of
|
|
263
|
+
*/
|
|
264
|
+
getPinDataOfNode(nodeName) {
|
|
265
|
+
return this.pinData ? this.pinData[nodeName] : undefined;
|
|
266
|
+
}
|
|
267
|
+
renameNodeInParameterValue(parameterValue, currentName, newName, { hasRenamableContent } = { hasRenamableContent: false }) {
|
|
268
|
+
if (typeof parameterValue !== 'object') {
|
|
269
|
+
// Reached the actual value
|
|
270
|
+
if (typeof parameterValue === 'string' &&
|
|
271
|
+
(parameterValue.charAt(0) === '=' || hasRenamableContent)) {
|
|
272
|
+
parameterValue = (0, node_reference_parser_utils_1.applyAccessPatterns)(parameterValue, currentName, newName);
|
|
273
|
+
}
|
|
274
|
+
return parameterValue;
|
|
275
|
+
}
|
|
276
|
+
if (Array.isArray(parameterValue)) {
|
|
293
277
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
294
|
-
const
|
|
295
|
-
for (const
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
return returnData;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Rename a node in the workflow
|
|
302
|
-
*
|
|
303
|
-
* @param {string} currentName The current name of the node
|
|
304
|
-
* @param {string} newName The new name
|
|
305
|
-
*/
|
|
306
|
-
renameNode(currentName, newName) {
|
|
307
|
-
// These keys are excluded to prevent accidental modification of inherited properties and
|
|
308
|
-
// to avoid any issues related to JavaScript's built-in methods that can cause unexpected behavior
|
|
309
|
-
const restrictedKeys = [
|
|
310
|
-
'hasOwnProperty',
|
|
311
|
-
'isPrototypeOf',
|
|
312
|
-
'propertyIsEnumerable',
|
|
313
|
-
'toLocaleString',
|
|
314
|
-
'toString',
|
|
315
|
-
'valueOf',
|
|
316
|
-
'constructor',
|
|
317
|
-
'prototype',
|
|
318
|
-
'__proto__',
|
|
319
|
-
'__defineGetter__',
|
|
320
|
-
'__defineSetter__',
|
|
321
|
-
'__lookupGetter__',
|
|
322
|
-
'__lookupSetter__',
|
|
323
|
-
];
|
|
324
|
-
if (restrictedKeys.map((k) => k.toLowerCase()).includes(newName.toLowerCase())) {
|
|
325
|
-
throw new errors_1.UserError(`Node name "${newName}" is a restricted name.`, {
|
|
326
|
-
description: `Node names cannot be any of the following: ${restrictedKeys.join(', ')}`,
|
|
327
|
-
});
|
|
278
|
+
const returnArray = [];
|
|
279
|
+
for (const currentValue of parameterValue) {
|
|
280
|
+
returnArray.push(this.renameNodeInParameterValue(currentValue, currentName, newName));
|
|
328
281
|
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
282
|
+
return returnArray;
|
|
283
|
+
}
|
|
284
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
|
+
const returnData = {};
|
|
286
|
+
for (const parameterName of Object.keys(parameterValue || {})) {
|
|
287
|
+
returnData[parameterName] = this.renameNodeInParameterValue(parameterValue[parameterName], currentName, newName, { hasRenamableContent });
|
|
288
|
+
}
|
|
289
|
+
return returnData;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Rename a node in the workflow
|
|
293
|
+
*
|
|
294
|
+
* @param {string} currentName The current name of the node
|
|
295
|
+
* @param {string} newName The new name
|
|
296
|
+
*/
|
|
297
|
+
renameNode(currentName, newName) {
|
|
298
|
+
// These keys are excluded to prevent accidental modification of inherited properties and
|
|
299
|
+
// to avoid any issues related to JavaScript's built-in methods that can cause unexpected behavior
|
|
300
|
+
const restrictedKeys = [
|
|
301
|
+
'hasOwnProperty',
|
|
302
|
+
'isPrototypeOf',
|
|
303
|
+
'propertyIsEnumerable',
|
|
304
|
+
'toLocaleString',
|
|
305
|
+
'toString',
|
|
306
|
+
'valueOf',
|
|
307
|
+
'constructor',
|
|
308
|
+
'prototype',
|
|
309
|
+
'__proto__',
|
|
310
|
+
'__defineGetter__',
|
|
311
|
+
'__defineSetter__',
|
|
312
|
+
'__lookupGetter__',
|
|
313
|
+
'__lookupSetter__',
|
|
314
|
+
];
|
|
315
|
+
if (restrictedKeys.map((k) => k.toLowerCase()).includes(newName.toLowerCase())) {
|
|
316
|
+
throw new errors_1.UserError(`Node name "${newName}" is a restricted name.`, {
|
|
317
|
+
description: `Node names cannot be any of the following: ${restrictedKeys.join(', ')}`,
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
// Rename the node itself
|
|
321
|
+
if (this.nodes[currentName] !== undefined) {
|
|
322
|
+
this.nodes[newName] = this.nodes[currentName];
|
|
323
|
+
this.nodes[newName].name = newName;
|
|
324
|
+
delete this.nodes[currentName];
|
|
325
|
+
}
|
|
326
|
+
// Update the expressions which reference the node
|
|
327
|
+
// with its old name
|
|
328
|
+
for (const node of Object.values(this.nodes)) {
|
|
329
|
+
node.parameters = this.renameNodeInParameterValue(node.parameters, currentName, newName);
|
|
330
|
+
if (constants_1.NODES_WITH_RENAMABLE_CONTENT.has(node.type)) {
|
|
331
|
+
node.parameters.jsCode = this.renameNodeInParameterValue(node.parameters.jsCode, currentName, newName, { hasRenamableContent: true });
|
|
334
332
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
for (const node of Object.values(this.nodes)) {
|
|
338
|
-
node.parameters = this.renameNodeInParameterValue(node.parameters, currentName, newName);
|
|
339
|
-
if (constants_1.NODES_WITH_RENAMABLE_CONTENT.has(node.type)) {
|
|
340
|
-
node.parameters.jsCode = this.renameNodeInParameterValue(node.parameters.jsCode, currentName, newName, { hasRenamableContent: true });
|
|
341
|
-
}
|
|
342
|
-
if (constants_1.NODES_WITH_RENAMEABLE_TOPLEVEL_HTML_CONTENT.has(node.type)) {
|
|
343
|
-
node.parameters.html = this.renameNodeInParameterValue(node.parameters.html, currentName, newName, { hasRenamableContent: true });
|
|
344
|
-
}
|
|
345
|
-
if (constants_1.NODES_WITH_RENAMABLE_FORM_HTML_CONTENT.has(node.type)) {
|
|
346
|
-
(0, rename_node_utils_1.renameFormFields)(node, (p) => this.renameNodeInParameterValue(p, currentName, newName, {
|
|
347
|
-
hasRenamableContent: true,
|
|
348
|
-
}));
|
|
349
|
-
}
|
|
333
|
+
if (constants_1.NODES_WITH_RENAMEABLE_TOPLEVEL_HTML_CONTENT.has(node.type)) {
|
|
334
|
+
node.parameters.html = this.renameNodeInParameterValue(node.parameters.html, currentName, newName, { hasRenamableContent: true });
|
|
350
335
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
336
|
+
if (constants_1.NODES_WITH_RENAMABLE_FORM_HTML_CONTENT.has(node.type)) {
|
|
337
|
+
(0, rename_node_utils_1.renameFormFields)(node, (p) => this.renameNodeInParameterValue(p, currentName, newName, {
|
|
338
|
+
hasRenamableContent: true,
|
|
339
|
+
}));
|
|
355
340
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
341
|
+
}
|
|
342
|
+
// Change all source connections
|
|
343
|
+
if (this.connectionsBySourceNode.hasOwnProperty(currentName)) {
|
|
344
|
+
this.connectionsBySourceNode[newName] = this.connectionsBySourceNode[currentName];
|
|
345
|
+
delete this.connectionsBySourceNode[currentName];
|
|
346
|
+
}
|
|
347
|
+
// Change all destination connections
|
|
348
|
+
let sourceNode;
|
|
349
|
+
let type;
|
|
350
|
+
let sourceIndex;
|
|
351
|
+
let connectionIndex;
|
|
352
|
+
let connectionData;
|
|
353
|
+
for (sourceNode of Object.keys(this.connectionsBySourceNode)) {
|
|
354
|
+
for (type of Object.keys(this.connectionsBySourceNode[sourceNode])) {
|
|
355
|
+
for (sourceIndex of Object.keys(this.connectionsBySourceNode[sourceNode][type])) {
|
|
356
|
+
for (connectionIndex of Object.keys(this.connectionsBySourceNode[sourceNode][type][parseInt(sourceIndex, 10)] || [])) {
|
|
357
|
+
connectionData =
|
|
358
|
+
this.connectionsBySourceNode[sourceNode][type][parseInt(sourceIndex, 10)]?.[parseInt(connectionIndex, 10)];
|
|
359
|
+
if (connectionData?.node === currentName) {
|
|
360
|
+
connectionData.node = newName;
|
|
371
361
|
}
|
|
372
362
|
}
|
|
373
363
|
}
|
|
374
364
|
}
|
|
375
365
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Finds the highest parent nodes of the node with the given name
|
|
369
|
+
*
|
|
370
|
+
* @param {NodeConnectionType} [type='main']
|
|
371
|
+
*/
|
|
372
|
+
getHighestNode(nodeName, nodeConnectionIndex, checkedNodes) {
|
|
373
|
+
const currentHighest = [];
|
|
374
|
+
if (!(nodeName in this.nodes)) {
|
|
375
|
+
// Node is not in the workflow
|
|
376
|
+
return currentHighest;
|
|
377
|
+
}
|
|
378
|
+
if (this.nodes[nodeName].disabled === false) {
|
|
379
|
+
// If the current node is not disabled itself is the highest
|
|
380
|
+
currentHighest.push(nodeName);
|
|
381
|
+
}
|
|
382
|
+
if (!this.connectionsByDestinationNode.hasOwnProperty(nodeName)) {
|
|
383
|
+
// Node does not have incoming connections
|
|
384
|
+
return currentHighest;
|
|
385
|
+
}
|
|
386
|
+
if (!this.connectionsByDestinationNode[nodeName].hasOwnProperty(interfaces_1.NodeConnectionTypes.Main)) {
|
|
387
|
+
// Node does not have incoming connections of given type
|
|
388
|
+
return currentHighest;
|
|
389
|
+
}
|
|
390
|
+
checkedNodes = checkedNodes || [];
|
|
391
|
+
if (checkedNodes.includes(nodeName)) {
|
|
392
|
+
// Node got checked already before
|
|
393
|
+
return currentHighest;
|
|
394
|
+
}
|
|
395
|
+
checkedNodes.push(nodeName);
|
|
396
|
+
const returnNodes = [];
|
|
397
|
+
let addNodes;
|
|
398
|
+
let connectionsByIndex;
|
|
399
|
+
for (let connectionIndex = 0; connectionIndex <
|
|
400
|
+
this.connectionsByDestinationNode[nodeName][interfaces_1.NodeConnectionTypes.Main].length; connectionIndex++) {
|
|
401
|
+
if (nodeConnectionIndex !== undefined && nodeConnectionIndex !== connectionIndex) {
|
|
402
|
+
// If a connection-index is given ignore all other ones
|
|
403
|
+
continue;
|
|
404
|
+
}
|
|
405
|
+
connectionsByIndex =
|
|
406
|
+
this.connectionsByDestinationNode[nodeName][interfaces_1.NodeConnectionTypes.Main][connectionIndex];
|
|
407
|
+
connectionsByIndex?.forEach((connection) => {
|
|
408
|
+
if (checkedNodes.includes(connection.node)) {
|
|
409
|
+
// Node got checked already before
|
|
410
|
+
return;
|
|
413
411
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
412
|
+
// Ignore connections for nodes that don't exist in this workflow
|
|
413
|
+
if (!(connection.node in this.nodes))
|
|
414
|
+
return;
|
|
415
|
+
addNodes = this.getHighestNode(connection.node, undefined, checkedNodes);
|
|
416
|
+
if (addNodes.length === 0) {
|
|
417
|
+
// The checked node does not have any further parents so add it
|
|
418
|
+
// if it is not disabled
|
|
419
|
+
if (this.nodes[connection.node].disabled !== true) {
|
|
420
|
+
addNodes = [connection.node];
|
|
420
421
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
// The checked node does not have any further parents so add it
|
|
427
|
-
// if it is not disabled
|
|
428
|
-
if (this.nodes[connection.node].disabled !== true) {
|
|
429
|
-
addNodes = [connection.node];
|
|
430
|
-
}
|
|
422
|
+
}
|
|
423
|
+
addNodes.forEach((name) => {
|
|
424
|
+
// Only add if node is not on the list already anyway
|
|
425
|
+
if (returnNodes.indexOf(name) === -1) {
|
|
426
|
+
returnNodes.push(name);
|
|
431
427
|
}
|
|
432
|
-
addNodes.forEach((name) => {
|
|
433
|
-
// Only add if node is not on the list already anyway
|
|
434
|
-
if (returnNodes.indexOf(name) === -1) {
|
|
435
|
-
returnNodes.push(name);
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
428
|
});
|
|
439
|
-
}
|
|
440
|
-
return returnNodes;
|
|
441
|
-
}
|
|
442
|
-
/**
|
|
443
|
-
* Returns all the after the given one
|
|
444
|
-
*
|
|
445
|
-
* @param {string} [type='main']
|
|
446
|
-
* @param {*} [depth=-1]
|
|
447
|
-
*/
|
|
448
|
-
getChildNodes(nodeName, type = interfaces_1.NodeConnectionTypes.Main, depth = -1) {
|
|
449
|
-
return (0, common_1.getChildNodes)(this.connectionsBySourceNode, nodeName, type, depth);
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Returns all the nodes before the given one
|
|
453
|
-
*
|
|
454
|
-
* @param {NodeConnectionType} [type='main']
|
|
455
|
-
* @param {*} [depth=-1]
|
|
456
|
-
*/
|
|
457
|
-
getParentNodes(nodeName, type = interfaces_1.NodeConnectionTypes.Main, depth = -1) {
|
|
458
|
-
return (0, common_1.getParentNodes)(this.connectionsByDestinationNode, nodeName, type, depth);
|
|
459
|
-
}
|
|
460
|
-
/**
|
|
461
|
-
* Gets all the nodes which are connected nodes starting from
|
|
462
|
-
* the given one
|
|
463
|
-
*
|
|
464
|
-
* @param {NodeConnectionType} [type='main']
|
|
465
|
-
* @param {*} [depth=-1]
|
|
466
|
-
*/
|
|
467
|
-
getConnectedNodes(connections, nodeName, connectionType = interfaces_1.NodeConnectionTypes.Main, depth = -1) {
|
|
468
|
-
return (0, common_1.getConnectedNodes)(connections, nodeName, connectionType, depth);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Returns all the nodes before the given one
|
|
472
|
-
*
|
|
473
|
-
* @param {*} [maxDepth=-1]
|
|
474
|
-
*/
|
|
475
|
-
getParentNodesByDepth(nodeName, maxDepth = -1) {
|
|
476
|
-
return this.searchNodesBFS(this.connectionsByDestinationNode, nodeName, maxDepth);
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Gets all the nodes which are connected nodes starting from
|
|
480
|
-
* the given one
|
|
481
|
-
* Uses BFS traversal
|
|
482
|
-
*
|
|
483
|
-
* @param {*} [maxDepth=-1]
|
|
484
|
-
*/
|
|
485
|
-
searchNodesBFS(connections, sourceNode, maxDepth = -1) {
|
|
486
|
-
const returnConns = [];
|
|
487
|
-
const type = interfaces_1.NodeConnectionTypes.Main;
|
|
488
|
-
let queue = [];
|
|
489
|
-
queue.push({
|
|
490
|
-
name: sourceNode,
|
|
491
|
-
depth: 0,
|
|
492
|
-
indicies: [],
|
|
493
429
|
});
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
430
|
+
}
|
|
431
|
+
return returnNodes;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Returns all the after the given one
|
|
435
|
+
*
|
|
436
|
+
* @param {string} [type='main']
|
|
437
|
+
* @param {*} [depth=-1]
|
|
438
|
+
*/
|
|
439
|
+
getChildNodes(nodeName, type = interfaces_1.NodeConnectionTypes.Main, depth = -1) {
|
|
440
|
+
return (0, common_1.getChildNodes)(this.connectionsBySourceNode, nodeName, type, depth);
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Returns all the nodes before the given one
|
|
444
|
+
*
|
|
445
|
+
* @param {NodeConnectionType} [type='main']
|
|
446
|
+
* @param {*} [depth=-1]
|
|
447
|
+
*/
|
|
448
|
+
getParentNodes(nodeName, type = interfaces_1.NodeConnectionTypes.Main, depth = -1) {
|
|
449
|
+
return (0, common_1.getParentNodes)(this.connectionsByDestinationNode, nodeName, type, depth);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Gets all the nodes which are connected nodes starting from
|
|
453
|
+
* the given one
|
|
454
|
+
*
|
|
455
|
+
* @param {NodeConnectionType} [type='main']
|
|
456
|
+
* @param {*} [depth=-1]
|
|
457
|
+
*/
|
|
458
|
+
getConnectedNodes(connections, nodeName, connectionType = interfaces_1.NodeConnectionTypes.Main, depth = -1) {
|
|
459
|
+
return (0, common_1.getConnectedNodes)(connections, nodeName, connectionType, depth);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Returns all the nodes before the given one
|
|
463
|
+
*
|
|
464
|
+
* @param {*} [maxDepth=-1]
|
|
465
|
+
*/
|
|
466
|
+
getParentNodesByDepth(nodeName, maxDepth = -1) {
|
|
467
|
+
return this.searchNodesBFS(this.connectionsByDestinationNode, nodeName, maxDepth);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Gets all the nodes which are connected nodes starting from
|
|
471
|
+
* the given one
|
|
472
|
+
* Uses BFS traversal
|
|
473
|
+
*
|
|
474
|
+
* @param {*} [maxDepth=-1]
|
|
475
|
+
*/
|
|
476
|
+
searchNodesBFS(connections, sourceNode, maxDepth = -1) {
|
|
477
|
+
const returnConns = [];
|
|
478
|
+
const type = interfaces_1.NodeConnectionTypes.Main;
|
|
479
|
+
let queue = [];
|
|
480
|
+
queue.push({
|
|
481
|
+
name: sourceNode,
|
|
482
|
+
depth: 0,
|
|
483
|
+
indicies: [],
|
|
484
|
+
});
|
|
485
|
+
const visited = {};
|
|
486
|
+
let depth = 0;
|
|
487
|
+
while (queue.length > 0) {
|
|
488
|
+
if (maxDepth !== -1 && depth > maxDepth) {
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
depth++;
|
|
492
|
+
const toAdd = [...queue];
|
|
493
|
+
queue = [];
|
|
494
|
+
toAdd.forEach((curr) => {
|
|
495
|
+
if (visited[curr.name]) {
|
|
496
|
+
visited[curr.name].indicies = (0, utils_1.dedupe)(visited[curr.name].indicies.concat(curr.indicies));
|
|
497
|
+
return;
|
|
499
498
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
connections[curr.name][type].forEach((connectionsByIndex) => {
|
|
517
|
-
connectionsByIndex?.forEach((connection) => {
|
|
518
|
-
queue.push({
|
|
519
|
-
name: connection.node,
|
|
520
|
-
indicies: [connection.index],
|
|
521
|
-
depth,
|
|
522
|
-
});
|
|
499
|
+
visited[curr.name] = curr;
|
|
500
|
+
if (curr.name !== sourceNode) {
|
|
501
|
+
returnConns.push(curr);
|
|
502
|
+
}
|
|
503
|
+
if (!connections.hasOwnProperty(curr.name) ||
|
|
504
|
+
!connections[curr.name].hasOwnProperty(type)) {
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
connections[curr.name][type].forEach((connectionsByIndex) => {
|
|
508
|
+
connectionsByIndex?.forEach((connection) => {
|
|
509
|
+
queue.push({
|
|
510
|
+
name: connection.node,
|
|
511
|
+
indicies: [connection.index],
|
|
512
|
+
depth,
|
|
523
513
|
});
|
|
524
514
|
});
|
|
525
515
|
});
|
|
526
|
-
}
|
|
527
|
-
return returnConns;
|
|
516
|
+
});
|
|
528
517
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
518
|
+
return returnConns;
|
|
519
|
+
}
|
|
520
|
+
getParentMainInputNode(node) {
|
|
521
|
+
if (node) {
|
|
522
|
+
const nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
523
|
+
if (!nodeType?.description.outputs) {
|
|
524
|
+
return node;
|
|
525
|
+
}
|
|
526
|
+
const outputs = NodeHelpers.getNodeOutputs(this, node, nodeType.description);
|
|
527
|
+
const nonMainConnectionTypes = [];
|
|
528
|
+
for (const output of outputs) {
|
|
529
|
+
const type = typeof output === 'string' ? output : output.type;
|
|
530
|
+
if (type !== interfaces_1.NodeConnectionTypes.Main) {
|
|
531
|
+
nonMainConnectionTypes.push(type);
|
|
542
532
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
533
|
+
}
|
|
534
|
+
// Sort for deterministic behavior: prevents non-deterministic selection when multiple
|
|
535
|
+
// non-main outputs exist (AI agents with multiple tools). Object.keys() ordering
|
|
536
|
+
// can vary across runs, causing inconsistent first-choice selection.
|
|
537
|
+
nonMainConnectionTypes.sort();
|
|
538
|
+
if (nonMainConnectionTypes.length > 0) {
|
|
539
|
+
const nonMainNodesConnected = [];
|
|
540
|
+
const nodeConnections = this.connectionsBySourceNode[node.name];
|
|
541
|
+
for (const type of nonMainConnectionTypes) {
|
|
542
|
+
// Only include connection types that exist in actual execution data
|
|
543
|
+
if (nodeConnections?.[type]) {
|
|
544
|
+
const childNodes = this.getChildNodes(node.name, type);
|
|
545
|
+
if (childNodes.length > 0) {
|
|
546
|
+
nonMainNodesConnected.push(...childNodes);
|
|
557
547
|
}
|
|
558
548
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
}
|
|
566
|
-
return this.getParentMainInputNode(returnNode);
|
|
549
|
+
}
|
|
550
|
+
if (nonMainNodesConnected.length) {
|
|
551
|
+
// Sort for deterministic behavior, then get first node
|
|
552
|
+
nonMainNodesConnected.sort();
|
|
553
|
+
const returnNode = this.getNode(nonMainNodesConnected[0]);
|
|
554
|
+
if (!returnNode) {
|
|
555
|
+
throw new errors_1.UnexpectedError(`Node "${nonMainNodesConnected[0]}" not found`);
|
|
567
556
|
}
|
|
557
|
+
return this.getParentMainInputNode(returnNode);
|
|
568
558
|
}
|
|
569
559
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
560
|
+
}
|
|
561
|
+
return node;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Returns via which output of the parent-node and index the current node
|
|
565
|
+
* they are connected
|
|
566
|
+
*
|
|
567
|
+
* @param {string} nodeName The node to check how it is connected with parent node
|
|
568
|
+
* @param {string} parentNodeName The parent node to get the output index of
|
|
569
|
+
* @param {string} [type='main']
|
|
570
|
+
*/
|
|
571
|
+
getNodeConnectionIndexes(nodeName, parentNodeName, type = interfaces_1.NodeConnectionTypes.Main) {
|
|
572
|
+
// This method has been optimized for performance. If you make any changes to it,
|
|
573
|
+
// make sure the performance is not degraded.
|
|
574
|
+
const parentNode = this.getNode(parentNodeName);
|
|
575
|
+
if (parentNode === null) {
|
|
576
|
+
return undefined;
|
|
577
|
+
}
|
|
578
|
+
const visitedNodes = new Set();
|
|
579
|
+
const queue = [nodeName];
|
|
580
|
+
// Cache the connections by destination node to avoid reference lookups
|
|
581
|
+
const connectionsByDest = this.connectionsByDestinationNode;
|
|
582
|
+
while (queue.length > 0) {
|
|
583
|
+
const currentNodeName = queue.shift();
|
|
584
|
+
if (visitedNodes.has(currentNodeName)) {
|
|
585
|
+
continue;
|
|
586
|
+
}
|
|
587
|
+
visitedNodes.add(currentNodeName);
|
|
588
|
+
const typeConnections = connectionsByDest[currentNodeName]?.[type];
|
|
589
|
+
if (!typeConnections) {
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
for (let typedConnectionIdx = 0; typedConnectionIdx < typeConnections.length; typedConnectionIdx++) {
|
|
593
|
+
const connectionsByIndex = typeConnections[typedConnectionIdx];
|
|
594
|
+
if (!connectionsByIndex) {
|
|
599
595
|
continue;
|
|
600
596
|
}
|
|
601
|
-
for (let
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
604
|
-
|
|
597
|
+
for (let destinationIndex = 0; destinationIndex < connectionsByIndex.length; destinationIndex++) {
|
|
598
|
+
const connection = connectionsByIndex[destinationIndex];
|
|
599
|
+
if (parentNodeName === connection.node) {
|
|
600
|
+
return {
|
|
601
|
+
sourceIndex: connection.index,
|
|
602
|
+
destinationIndex,
|
|
603
|
+
};
|
|
605
604
|
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
if (parentNodeName === connection.node) {
|
|
609
|
-
return {
|
|
610
|
-
sourceIndex: connection.index,
|
|
611
|
-
destinationIndex,
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
if (!visitedNodes.has(connection.node)) {
|
|
615
|
-
queue.push(connection.node);
|
|
616
|
-
}
|
|
605
|
+
if (!visitedNodes.has(connection.node)) {
|
|
606
|
+
queue.push(connection.node);
|
|
617
607
|
}
|
|
618
608
|
}
|
|
619
609
|
}
|
|
620
|
-
return undefined;
|
|
621
610
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
611
|
+
return undefined;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Returns from which of the given nodes the workflow should get started from
|
|
615
|
+
*
|
|
616
|
+
* @param {string[]} nodeNames The potential start nodes
|
|
617
|
+
*/
|
|
618
|
+
__getStartNode(nodeNames) {
|
|
619
|
+
// Check if there are any trigger or poll nodes and then return the first one
|
|
620
|
+
let node;
|
|
621
|
+
let nodeType;
|
|
622
|
+
if (nodeNames.length === 1) {
|
|
623
|
+
node = this.nodes[nodeNames[0]];
|
|
624
|
+
if (node && !node.disabled) {
|
|
625
|
+
return node;
|
|
636
626
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
627
|
+
}
|
|
628
|
+
for (const nodeName of nodeNames) {
|
|
629
|
+
node = this.nodes[nodeName];
|
|
630
|
+
nodeType = this.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
|
|
631
|
+
// TODO: Identify later differently
|
|
632
|
+
if (nodeType.description.name === constants_1.MANUAL_CHAT_TRIGGER_LANGCHAIN_NODE_TYPE) {
|
|
633
|
+
continue;
|
|
634
|
+
}
|
|
635
|
+
if (nodeType && (nodeType.trigger !== undefined || nodeType.poll !== undefined)) {
|
|
636
|
+
if (node.disabled === true) {
|
|
642
637
|
continue;
|
|
643
638
|
}
|
|
644
|
-
|
|
645
|
-
if (node.disabled === true) {
|
|
646
|
-
continue;
|
|
647
|
-
}
|
|
648
|
-
return node;
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
const sortedNodeNames = Object.values(this.nodes)
|
|
652
|
-
.sort((a, b) => constants_1.STARTING_NODE_TYPES.indexOf(a.type) - constants_1.STARTING_NODE_TYPES.indexOf(b.type))
|
|
653
|
-
.map((n) => n.name);
|
|
654
|
-
for (const nodeName of sortedNodeNames) {
|
|
655
|
-
node = this.nodes[nodeName];
|
|
656
|
-
if (constants_1.STARTING_NODE_TYPES.includes(node.type)) {
|
|
657
|
-
if (node.disabled === true) {
|
|
658
|
-
continue;
|
|
659
|
-
}
|
|
660
|
-
return node;
|
|
661
|
-
}
|
|
639
|
+
return node;
|
|
662
640
|
}
|
|
663
|
-
return undefined;
|
|
664
641
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
if (
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
if (nodeNames.length === 0) {
|
|
674
|
-
// If no parent nodes have been found then only the destination-node
|
|
675
|
-
// is in the tree so add that one
|
|
676
|
-
nodeNames.push(destinationNode);
|
|
677
|
-
}
|
|
678
|
-
// Check which node to return as start node
|
|
679
|
-
const node = this.__getStartNode(nodeNames);
|
|
680
|
-
if (node !== undefined) {
|
|
681
|
-
return node;
|
|
642
|
+
const sortedNodeNames = Object.values(this.nodes)
|
|
643
|
+
.sort((a, b) => constants_1.STARTING_NODE_TYPES.indexOf(a.type) - constants_1.STARTING_NODE_TYPES.indexOf(b.type))
|
|
644
|
+
.map((n) => n.name);
|
|
645
|
+
for (const nodeName of sortedNodeNames) {
|
|
646
|
+
node = this.nodes[nodeName];
|
|
647
|
+
if (constants_1.STARTING_NODE_TYPES.includes(node.type)) {
|
|
648
|
+
if (node.disabled === true) {
|
|
649
|
+
continue;
|
|
682
650
|
}
|
|
683
|
-
|
|
684
|
-
// first parent node in the list
|
|
685
|
-
return this.nodes[nodeNames[0]];
|
|
651
|
+
return node;
|
|
686
652
|
}
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
653
|
+
}
|
|
654
|
+
return undefined;
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Returns the start node to start the workflow from
|
|
658
|
+
*
|
|
659
|
+
*/
|
|
660
|
+
getStartNode(destinationNode) {
|
|
661
|
+
if (destinationNode) {
|
|
662
|
+
// Find the highest parent nodes of the given one
|
|
663
|
+
const nodeNames = this.getHighestNode(destinationNode);
|
|
664
|
+
if (nodeNames.length === 0) {
|
|
665
|
+
// If no parent nodes have been found then only the destination-node
|
|
666
|
+
// is in the tree so add that one
|
|
667
|
+
nodeNames.push(destinationNode);
|
|
668
|
+
}
|
|
669
|
+
// Check which node to return as start node
|
|
670
|
+
const node = this.__getStartNode(nodeNames);
|
|
671
|
+
if (node !== undefined) {
|
|
672
|
+
return node;
|
|
673
|
+
}
|
|
674
|
+
// If none of the above did find anything simply return the
|
|
675
|
+
// first parent node in the list
|
|
676
|
+
return this.nodes[nodeNames[0]];
|
|
677
|
+
}
|
|
678
|
+
return this.__getStartNode(Object.keys(this.nodes));
|
|
679
|
+
}
|
|
680
|
+
getConnectionsBetweenNodes(sources, targets) {
|
|
681
|
+
const result = [];
|
|
682
|
+
for (const source of sources) {
|
|
683
|
+
for (const type of Object.keys(this.connectionsBySourceNode[source] ?? {})) {
|
|
684
|
+
for (const sourceIndex of Object.keys(this.connectionsBySourceNode[source][type])) {
|
|
685
|
+
for (const connectionIndex of Object.keys(this.connectionsBySourceNode[source][type][parseInt(sourceIndex, 10)] ?? [])) {
|
|
686
|
+
const targetConnectionData = this.connectionsBySourceNode[source][type][parseInt(sourceIndex, 10)]?.[parseInt(connectionIndex, 10)];
|
|
687
|
+
if (targetConnectionData && targets.includes(targetConnectionData?.node)) {
|
|
688
|
+
result.push([
|
|
689
|
+
{
|
|
690
|
+
node: source,
|
|
691
|
+
index: parseInt(sourceIndex, 10),
|
|
692
|
+
type: type,
|
|
693
|
+
},
|
|
694
|
+
targetConnectionData,
|
|
695
|
+
]);
|
|
706
696
|
}
|
|
707
697
|
}
|
|
708
698
|
}
|
|
709
699
|
}
|
|
710
|
-
return result;
|
|
711
700
|
}
|
|
701
|
+
return result;
|
|
712
702
|
}
|
|
713
|
-
|
|
714
|
-
|
|
703
|
+
}
|
|
704
|
+
exports.Workflow = Workflow;
|
|
715
705
|
//# sourceMappingURL=workflow.js.map
|