@xyne/workflow-sdk 3.2.53 → 3.2.55
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/agents/host-agent-step.d.ts.map +1 -1
- package/dist/agents/host-agent-step.js +3 -0
- package/dist/agents/host-agent-step.js.map +1 -1
- package/dist/builder/index.d.ts +19 -2
- package/dist/builder/index.d.ts.map +1 -1
- package/dist/builder/index.js +17 -1
- package/dist/builder/index.js.map +1 -1
- package/dist/common/attachment.d.ts +9 -0
- package/dist/common/attachment.d.ts.map +1 -1
- package/dist/common/attachment.js +20 -0
- package/dist/common/attachment.js.map +1 -1
- package/dist/common/citation-ref.d.ts +4 -4
- package/dist/completion/address.d.ts +27 -0
- package/dist/completion/address.d.ts.map +1 -0
- package/dist/completion/address.js +62 -0
- package/dist/completion/address.js.map +1 -0
- package/dist/completion/attach.d.ts +32 -0
- package/dist/completion/attach.d.ts.map +1 -0
- package/dist/completion/attach.js +92 -0
- package/dist/completion/attach.js.map +1 -0
- package/dist/completion/index.d.ts +6 -0
- package/dist/completion/index.d.ts.map +1 -0
- package/dist/completion/index.js +4 -0
- package/dist/completion/index.js.map +1 -0
- package/dist/completion/types.d.ts +107 -0
- package/dist/completion/types.d.ts.map +1 -0
- package/dist/completion/types.js +35 -0
- package/dist/completion/types.js.map +1 -0
- package/dist/connectors/builtin/builtin-connector.d.ts.map +1 -1
- package/dist/connectors/builtin/builtin-connector.js +6 -2
- package/dist/connectors/builtin/builtin-connector.js.map +1 -1
- package/dist/connectors/builtin/steps/compute.step.d.ts +56 -0
- package/dist/connectors/builtin/steps/compute.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/compute.step.js +48 -0
- package/dist/connectors/builtin/steps/compute.step.js.map +1 -0
- package/dist/connectors/builtin/steps/conditional.step.d.ts +2 -2
- package/dist/connectors/builtin/steps/conditional.step.js +1 -1
- package/dist/connectors/builtin/steps/conditional.step.js.map +1 -1
- package/dist/connectors/builtin/steps/cycle.step.d.ts +36 -7
- package/dist/connectors/builtin/steps/cycle.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/cycle.step.js +89 -8
- package/dist/connectors/builtin/steps/cycle.step.js.map +1 -1
- package/dist/connectors/builtin/steps/dedup.step.js +2 -2
- package/dist/connectors/builtin/steps/dedup.step.js.map +1 -1
- package/dist/connectors/builtin/steps/delay.step.d.ts +49 -0
- package/dist/connectors/builtin/steps/delay.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/delay.step.js +40 -0
- package/dist/connectors/builtin/steps/delay.step.js.map +1 -0
- package/dist/connectors/builtin/steps/loop.step.d.ts +6 -6
- package/dist/connectors/builtin/steps/loop.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/loop.step.js +4 -2
- package/dist/connectors/builtin/steps/loop.step.js.map +1 -1
- package/dist/connectors/builtin/steps/map.step.d.ts +4 -4
- package/dist/connectors/builtin/steps/map.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/map.step.js +13 -4
- package/dist/connectors/builtin/steps/map.step.js.map +1 -1
- package/dist/connectors/builtin/steps/parallel.step.d.ts +2 -2
- package/dist/connectors/builtin/steps/parallel.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/parallel.step.js +9 -2
- package/dist/connectors/builtin/steps/parallel.step.js.map +1 -1
- package/dist/connectors/builtin/steps/switch.step.js +1 -1
- package/dist/connectors/builtin/steps/switch.step.js.map +1 -1
- package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts +80 -0
- package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-api-call.step.js +104 -0
- package/dist/connectors/builtin/steps/wait-for-api-call.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.d.ts +1057 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.js +222 -0
- package/dist/connectors/builtin/steps/wait-for-human.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.d.ts +80 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.d.ts.map +1 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.js +104 -0
- package/dist/connectors/builtin/steps/wait-for-webhook.step.js.map +1 -0
- package/dist/connectors/builtin/steps/wait.step.d.ts +40 -59
- package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/wait.step.js +29 -63
- package/dist/connectors/builtin/steps/wait.step.js.map +1 -1
- package/dist/conversational-flow/calls.d.ts +2 -2
- package/dist/conversational-flow/calls.d.ts.map +1 -1
- package/dist/conversational-flow/calls.js +40 -5
- package/dist/conversational-flow/calls.js.map +1 -1
- package/dist/conversational-flow/create.d.ts +2 -1
- package/dist/conversational-flow/create.d.ts.map +1 -1
- package/dist/conversational-flow/create.js +2 -2
- package/dist/conversational-flow/create.js.map +1 -1
- package/dist/conversational-flow/edit/build.js +1 -1
- package/dist/conversational-flow/edit/build.js.map +1 -1
- package/dist/conversational-flow/edit/calls.d.ts.map +1 -1
- package/dist/conversational-flow/edit/calls.js +8 -5
- package/dist/conversational-flow/edit/calls.js.map +1 -1
- package/dist/conversational-flow/edit/endings.d.ts +8 -3
- package/dist/conversational-flow/edit/endings.d.ts.map +1 -1
- package/dist/conversational-flow/edit/endings.js +17 -9
- package/dist/conversational-flow/edit/endings.js.map +1 -1
- package/dist/conversational-flow/edit/questions.d.ts +35 -0
- package/dist/conversational-flow/edit/questions.d.ts.map +1 -0
- package/dist/conversational-flow/edit/questions.js +188 -0
- package/dist/conversational-flow/edit/questions.js.map +1 -0
- package/dist/conversational-flow/edit/versions.d.ts.map +1 -1
- package/dist/conversational-flow/edit/versions.js +6 -7
- package/dist/conversational-flow/edit/versions.js.map +1 -1
- package/dist/conversational-flow/index.d.ts +2 -1
- package/dist/conversational-flow/index.d.ts.map +1 -1
- package/dist/conversational-flow/index.js +4 -0
- package/dist/conversational-flow/index.js.map +1 -1
- package/dist/conversational-flow/questions.d.ts +32 -0
- package/dist/conversational-flow/questions.d.ts.map +1 -0
- package/dist/conversational-flow/questions.js +122 -0
- package/dist/conversational-flow/questions.js.map +1 -0
- package/dist/conversational-flow/read.d.ts.map +1 -1
- package/dist/conversational-flow/read.js +20 -4
- package/dist/conversational-flow/read.js.map +1 -1
- package/dist/conversational-flow/settle.js +4 -7
- package/dist/conversational-flow/settle.js.map +1 -1
- package/dist/conversational-flow/types.d.ts +31 -8
- package/dist/conversational-flow/types.d.ts.map +1 -1
- package/dist/conversational-flow/types.js.map +1 -1
- package/dist/engine/condition-evaluator.d.ts +10 -2
- package/dist/engine/condition-evaluator.d.ts.map +1 -1
- package/dist/engine/condition-evaluator.js +36 -14
- package/dist/engine/condition-evaluator.js.map +1 -1
- package/dist/engine/config-validator.d.ts +64 -0
- package/dist/engine/config-validator.d.ts.map +1 -1
- package/dist/engine/config-validator.js +400 -30
- package/dist/engine/config-validator.js.map +1 -1
- package/dist/engine/pause-step.d.ts +21 -4
- package/dist/engine/pause-step.d.ts.map +1 -1
- package/dist/engine/pause-step.js +11 -2
- package/dist/engine/pause-step.js.map +1 -1
- package/dist/engine/read-config.d.ts +12 -0
- package/dist/engine/read-config.d.ts.map +1 -0
- package/dist/engine/read-config.js +50 -0
- package/dist/engine/read-config.js.map +1 -0
- package/dist/engine/resolve-expressions.d.ts +40 -0
- package/dist/engine/resolve-expressions.d.ts.map +1 -0
- package/dist/engine/resolve-expressions.js +186 -0
- package/dist/engine/resolve-expressions.js.map +1 -0
- package/dist/engine/variable-resolver.d.ts +27 -0
- package/dist/engine/variable-resolver.d.ts.map +1 -1
- package/dist/engine/variable-resolver.js +20 -3
- package/dist/engine/variable-resolver.js.map +1 -1
- package/dist/engine/workflow-executor.d.ts.map +1 -1
- package/dist/engine/workflow-executor.js +66 -56
- package/dist/engine/workflow-executor.js.map +1 -1
- package/dist/expression/catalogue.d.ts +36 -0
- package/dist/expression/catalogue.d.ts.map +1 -0
- package/dist/expression/catalogue.js +82 -0
- package/dist/expression/catalogue.js.map +1 -0
- package/dist/expression/form/model.d.ts +115 -0
- package/dist/expression/form/model.d.ts.map +1 -0
- package/dist/expression/form/model.js +61 -0
- package/dist/expression/form/model.js.map +1 -0
- package/dist/expression/form/read.d.ts +4 -0
- package/dist/expression/form/read.d.ts.map +1 -0
- package/dist/expression/form/read.js +283 -0
- package/dist/expression/form/read.js.map +1 -0
- package/dist/expression/form/write.d.ts +8 -0
- package/dist/expression/form/write.d.ts.map +1 -0
- package/dist/expression/form/write.js +124 -0
- package/dist/expression/form/write.js.map +1 -0
- package/dist/expression/format.d.ts +41 -0
- package/dist/expression/format.d.ts.map +1 -0
- package/dist/expression/format.js +84 -0
- package/dist/expression/format.js.map +1 -0
- package/dist/expression/index.d.ts +40 -0
- package/dist/expression/index.d.ts.map +1 -0
- package/dist/expression/index.js +35 -0
- package/dist/expression/index.js.map +1 -0
- package/dist/expression/infer.d.ts +40 -0
- package/dist/expression/infer.d.ts.map +1 -0
- package/dist/expression/infer.js +195 -0
- package/dist/expression/infer.js.map +1 -0
- package/dist/expression/parse.d.ts +60 -0
- package/dist/expression/parse.d.ts.map +1 -0
- package/dist/expression/parse.js +201 -0
- package/dist/expression/parse.js.map +1 -0
- package/dist/expression/signature.d.ts +41 -0
- package/dist/expression/signature.d.ts.map +1 -0
- package/dist/expression/signature.js +124 -0
- package/dist/expression/signature.js.map +1 -0
- package/dist/expression/signatures.d.ts +45 -0
- package/dist/expression/signatures.d.ts.map +1 -0
- package/dist/expression/signatures.js +113 -0
- package/dist/expression/signatures.js.map +1 -0
- package/dist/expression/types.d.ts +71 -0
- package/dist/expression/types.d.ts.map +1 -0
- package/dist/expression/types.js +139 -0
- package/dist/expression/types.js.map +1 -0
- package/dist/index.d.ts +32 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -3
- package/dist/index.js.map +1 -1
- package/dist/ingest/filter.d.ts +8 -2
- package/dist/ingest/filter.d.ts.map +1 -1
- package/dist/ingest/filter.js +8 -2
- package/dist/ingest/filter.js.map +1 -1
- package/dist/ingest/start-policy.d.ts +1 -1
- package/dist/ingest/start-policy.d.ts.map +1 -1
- package/dist/ingest/start-policy.js +12 -5
- package/dist/ingest/start-policy.js.map +1 -1
- package/dist/persistence/in-memory-adapter.d.ts +3 -18
- package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
- package/dist/persistence/in-memory-adapter.js +9 -61
- package/dist/persistence/in-memory-adapter.js.map +1 -1
- package/dist/persistence/types.d.ts +29 -58
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/router/workflow-router.d.ts.map +1 -1
- package/dist/router/workflow-router.js +70 -28
- package/dist/router/workflow-router.js.map +1 -1
- package/dist/runtime/workflow-runtime.d.ts +22 -45
- package/dist/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +157 -125
- package/dist/runtime/workflow-runtime.js.map +1 -1
- package/dist/steps/base-step.d.ts +2 -4
- package/dist/steps/base-step.d.ts.map +1 -1
- package/dist/steps/base-step.js.map +1 -1
- package/dist/testing/test-connector.d.ts +1 -1
- package/dist/testing/test-connector.js +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/known-types.d.ts +51 -1
- package/dist/types/known-types.d.ts.map +1 -1
- package/dist/types/known-types.js +54 -1
- package/dist/types/known-types.js.map +1 -1
- package/dist/types/operators.d.ts +22 -0
- package/dist/types/operators.d.ts.map +1 -1
- package/dist/types/operators.js +6 -6
- package/dist/types/operators.js.map +1 -1
- package/dist/types/pause-state.d.ts +0 -8
- package/dist/types/pause-state.d.ts.map +1 -1
- package/dist/types/pause-state.js.map +1 -1
- package/dist/types/validation.d.ts +10 -1
- package/dist/types/validation.d.ts.map +1 -1
- package/dist/types/validation.js +9 -0
- package/dist/types/validation.js.map +1 -1
- package/dist/types/workflow-config.d.ts +4 -3
- package/dist/types/workflow-config.d.ts.map +1 -1
- package/dist/types/workflow-config.js +23 -8
- package/dist/types/workflow-config.js.map +1 -1
- package/dist/util/computed-value.d.ts +103 -0
- package/dist/util/computed-value.d.ts.map +1 -0
- package/dist/util/computed-value.js +453 -0
- package/dist/util/computed-value.js.map +1 -0
- package/dist/util/expression-format.d.ts +41 -0
- package/dist/util/expression-format.d.ts.map +1 -0
- package/dist/util/expression-format.js +84 -0
- package/dist/util/expression-format.js.map +1 -0
- package/dist/util/expression-functions.d.ts +35 -0
- package/dist/util/expression-functions.d.ts.map +1 -0
- package/dist/util/expression-functions.js +82 -0
- package/dist/util/expression-functions.js.map +1 -0
- package/dist/util/expression.d.ts +98 -0
- package/dist/util/expression.d.ts.map +1 -0
- package/dist/util/expression.js +395 -0
- package/dist/util/expression.js.map +1 -0
- package/dist/util/jsonata-signatures.d.ts +45 -0
- package/dist/util/jsonata-signatures.d.ts.map +1 -0
- package/dist/util/jsonata-signatures.js +113 -0
- package/dist/util/jsonata-signatures.js.map +1 -0
- package/dist/util/signature.d.ts +41 -0
- package/dist/util/signature.d.ts.map +1 -0
- package/dist/util/signature.js +124 -0
- package/dist/util/signature.js.map +1 -0
- package/dist/util/type-compat.d.ts +8 -28
- package/dist/util/type-compat.d.ts.map +1 -1
- package/dist/util/type-compat.js +22 -29
- package/dist/util/type-compat.js.map +1 -1
- package/dist/util/variable-ref.d.ts +24 -0
- package/dist/util/variable-ref.d.ts.map +1 -1
- package/dist/util/variable-ref.js +34 -9
- package/dist/util/variable-ref.js.map +1 -1
- package/package.json +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-evaluator.js","sourceRoot":"","sources":["../../src/engine/condition-evaluator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"condition-evaluator.js","sourceRoot":"","sources":["../../src/engine/condition-evaluator.ts"],"names":[],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;;;;;;;;GAcG;AACH,MAAM,OAAO,kBAAkB;IAC7B,KAAK,CAAC,QAAQ,CAAC,SAAoB,EAAE,OAAwB;QAC3D,IAAI,UAAU,IAAI,SAAS,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;YACvD,OAAO,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC;QACD,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;YACvB,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,GAAG,EAAE,CAAC;gBAClC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;oBAAE,OAAO,KAAK,CAAC;YAC3D,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;YACvB,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,GAAG,EAAE,CAAC;gBAClC,IAAI,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;oBAAE,OAAO,IAAI,CAAC;YACvD,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,IAAI,KAAK,CACb,iCAAiC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAC7D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -65,6 +65,70 @@ export declare class ConfigValidator {
|
|
|
65
65
|
*/
|
|
66
66
|
private validateCitations;
|
|
67
67
|
private validateRefs;
|
|
68
|
+
/**
|
|
69
|
+
* Expressions in a step's own config: can they be read, may they run, and do
|
|
70
|
+
* the references inside them lead anywhere.
|
|
71
|
+
*
|
|
72
|
+
* Three checks, in the order that makes the *first* message the useful one —
|
|
73
|
+
* there is no point reporting an unknown reference inside an expression that
|
|
74
|
+
* does not parse.
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* A reference's type, as an expression sees it.
|
|
78
|
+
*
|
|
79
|
+
* Only the explicit roots: inside `{% … %}` there is no bare-step shorthand,
|
|
80
|
+
* which is what makes a leading name unambiguous there. `workflow` and
|
|
81
|
+
* `execution` describe nothing, so they read as unknown — same as a `{{ref}}`
|
|
82
|
+
* into them is left unchecked.
|
|
83
|
+
*/
|
|
84
|
+
private expressionTypes;
|
|
85
|
+
/**
|
|
86
|
+
* Every check that applies to one expression, wherever it sits.
|
|
87
|
+
*
|
|
88
|
+
* One method rather than one per surface, because "is this expression valid"
|
|
89
|
+
* must not have two answers. It was a per-step walk first, which left the
|
|
90
|
+
* trigger's filter and its delayed-start anchor evaluating expressions that
|
|
91
|
+
* nothing had read — no syntax check, no ban on naming a function, no types.
|
|
92
|
+
*
|
|
93
|
+
* `consumer` is the Zod schema the result is bound into, or null where there
|
|
94
|
+
* is nothing to bind to (a condition's own slot, a reference inside another
|
|
95
|
+
* expression).
|
|
96
|
+
*
|
|
97
|
+
* Returns what the expression produces, so a caller with a rule of its own can
|
|
98
|
+
* apply it — a delayed start, for instance, knows that a list can never be a
|
|
99
|
+
* moment in time, which no schema of `z.string()` will ever say.
|
|
100
|
+
*/
|
|
101
|
+
private checkExpression;
|
|
102
|
+
/** Every expression in a step's own config, checked where it sits. */
|
|
103
|
+
private validateExpressions;
|
|
104
|
+
/**
|
|
105
|
+
* What a condition's left side will produce, as far as can be told.
|
|
106
|
+
*
|
|
107
|
+
* An expression's type is computed; a reference's is read from the schema. A
|
|
108
|
+
* literal cannot appear here — the schema accepts only the two.
|
|
109
|
+
*/
|
|
110
|
+
private conditionVariableType;
|
|
111
|
+
/**
|
|
112
|
+
* One condition leaf: can its operator hold against what is on the left?
|
|
113
|
+
*
|
|
114
|
+
* Only where the operator is unambiguous about it — see `needs` on
|
|
115
|
+
* `OperatorDescriptor`. "is greater than" against text, or "starts with"
|
|
116
|
+
* against a number, is not a near miss: the comparison can never be true, so
|
|
117
|
+
* the branch is unreachable and the author almost certainly meant something
|
|
118
|
+
* else.
|
|
119
|
+
*
|
|
120
|
+
* Deliberately *not* checked: the comparison value against the left side.
|
|
121
|
+
* `looseEquals` coerces on purpose — `5` equals `"5"` here — so refusing a
|
|
122
|
+
* number against text would refuse something that works.
|
|
123
|
+
*/
|
|
124
|
+
private checkConditionLeaf;
|
|
125
|
+
/**
|
|
126
|
+
* Every condition leaf reachable in a value.
|
|
127
|
+
*
|
|
128
|
+
* Conditions are found structurally, by the same predicate the resolver and
|
|
129
|
+
* the expression pre-pass use, so the three cannot disagree about what one is.
|
|
130
|
+
*/
|
|
131
|
+
private validateConditions;
|
|
68
132
|
private checkRef;
|
|
69
133
|
private getConsumerInnerSchema;
|
|
70
134
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../../src/engine/config-validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,
|
|
1
|
+
{"version":3,"file":"config-validator.d.ts","sourceRoot":"","sources":["../../src/engine/config-validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,6BAA6B,CAAC;AASrC,OAAO,KAAK,EAGV,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAElF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA2W9D;;;;;;;;;GASG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAV,UAAU,EAAE,iBAAiB;IAGhD;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,EAAE;IAclD,OAAO,CAAC,YAAY;IAiCpB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB;IA8DlD,OAAO,CAAC,SAAS;IA+JjB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA2B5B;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAmG5B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IA0F7B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IA0CpB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IA8CzB,OAAO,CAAC,YAAY;IA4BpB;;;;;;;OAOG;IACH;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IA6BvB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,eAAe;IAkEvB,sEAAsE;IACtE,OAAO,CAAC,mBAAmB;IAuB3B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,kBAAkB;IAqB1B;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB;IAyC1B,OAAO,CAAC,QAAQ;IAiHhB,OAAO,CAAC,sBAAsB;CAmB/B"}
|
|
@@ -4,13 +4,31 @@ import { AnchorValueSchema, TriggerStartSchema } from '../ingest/start-policy.js
|
|
|
4
4
|
import { extractRefPath } from '../util/variable-ref.js';
|
|
5
5
|
import { resolveCitationPath } from '../util/citation-path.js';
|
|
6
6
|
import { ValidationIssueCode } from '../types/validation.js';
|
|
7
|
+
import { BuiltinStepType } from '../types/known-types.js';
|
|
7
8
|
import { BaseControlFlowStep } from '../steps/base-step.js';
|
|
8
9
|
import { isJumpingStep } from './branch-signal.js';
|
|
9
10
|
import { collectRefs, isPureRef } from '../util/variable-ref.js';
|
|
11
|
+
import { OPERATOR_DESCRIPTORS } from '../types/operators.js';
|
|
12
|
+
import { isCondition } from './variable-resolver.js';
|
|
13
|
+
import { inspectExpression, refsInExpression } from '../expression/parse.js';
|
|
14
|
+
import { inferExpressionType } from '../expression/infer.js';
|
|
15
|
+
import { collectExpressions, extractExpressionSource } from '../expression/format.js';
|
|
10
16
|
import { zodToJsonSchemaRecord } from '../util/schema-convert.js';
|
|
11
|
-
import { kindsCompatible } from '../util/type-compat.js';
|
|
17
|
+
import { kindOfJsonType, kindsCompatible } from '../util/type-compat.js';
|
|
18
|
+
import { assignableToArgument, assignableToField, baseKind, sayType } from '../expression/types.js';
|
|
12
19
|
import { resolveOutputJsonSchemaOf } from './available-context.js';
|
|
13
20
|
import { varsJsonSchema } from '../types/workflow-variable.js';
|
|
21
|
+
/**
|
|
22
|
+
* Control steps that park several copies of one step id *at the same time*.
|
|
23
|
+
*
|
|
24
|
+
* Only MAP: it walks its body over every item at once, so three items means
|
|
25
|
+
* three open gates under one id and a caller naming that id means all three.
|
|
26
|
+
* LOOP and CYCLE run their rounds one after another — a round's gate is
|
|
27
|
+
* answered and completed before the next one opens, so only ever one is open.
|
|
28
|
+
* PARALLEL branches do run together, but step ids are unique across the whole
|
|
29
|
+
* config, so its branches cannot hold two copies of the same id.
|
|
30
|
+
*/
|
|
31
|
+
const FANS_OUT = new Set([BuiltinStepType.MAP]);
|
|
14
32
|
const FORBIDDEN_KEYS = new Set([
|
|
15
33
|
'__proto__',
|
|
16
34
|
'constructor',
|
|
@@ -133,11 +151,25 @@ function unwrapJsonSchema(schema) {
|
|
|
133
151
|
* `additionalProperties`) — those can't be statically known and resolve
|
|
134
152
|
* dynamically at runtime (e.g. an HTTP `body` with no author-declared shape).
|
|
135
153
|
*/
|
|
136
|
-
function walkJsonSchemaPath(schema, segments
|
|
154
|
+
function walkJsonSchemaPath(schema, segments,
|
|
155
|
+
/**
|
|
156
|
+
* Treat a property access on an array as reading that property from each
|
|
157
|
+
* element — JSONata's rule, and NOT the `{{ref}}` rule, so it is off by
|
|
158
|
+
* default.
|
|
159
|
+
*
|
|
160
|
+
* `{{steps.a.output.items.amount}}` really is wrong: `resolvePath` does a
|
|
161
|
+
* property lookup on the array itself and finds nothing. The same path inside
|
|
162
|
+
* an expression is right, and is how anyone would write "the amounts" before
|
|
163
|
+
* summing them. The two grammars genuinely differ here, so the walk has to be
|
|
164
|
+
* told which one it is serving — otherwise the validator rejects every
|
|
165
|
+
* correct `$sum` over a list.
|
|
166
|
+
*/
|
|
167
|
+
mapArrays = false) {
|
|
137
168
|
if (segments.some((s) => FORBIDDEN_KEYS.has(s)))
|
|
138
169
|
return null;
|
|
139
170
|
let current = schema;
|
|
140
|
-
for (
|
|
171
|
+
for (let i = 0; i < segments.length; i++) {
|
|
172
|
+
const segment = segments[i];
|
|
141
173
|
current = unwrapJsonSchema(current);
|
|
142
174
|
const type = current['type'];
|
|
143
175
|
const props = current['properties'];
|
|
@@ -167,6 +199,11 @@ function walkJsonSchemaPath(schema, segments) {
|
|
|
167
199
|
current = items ?? {};
|
|
168
200
|
continue;
|
|
169
201
|
}
|
|
202
|
+
// Re-read this same segment against the element schema; an array with no
|
|
203
|
+
// declared `items` has unknown elements, so the rest is unverifiable.
|
|
204
|
+
if (mapArrays) {
|
|
205
|
+
return items ? walkJsonSchemaPath(items, segments.slice(i), true) : {};
|
|
206
|
+
}
|
|
170
207
|
return null;
|
|
171
208
|
}
|
|
172
209
|
// Scalar with a further segment — can't index into it.
|
|
@@ -174,15 +211,66 @@ function walkJsonSchemaPath(schema, segments) {
|
|
|
174
211
|
}
|
|
175
212
|
return unwrapJsonSchema(current);
|
|
176
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* What a reference inside an expression evaluates to, including whether it is a
|
|
216
|
+
* *list* of that thing.
|
|
217
|
+
*
|
|
218
|
+
* Separate from {@link walkJsonSchemaPath} because the two answer different
|
|
219
|
+
* questions. That one asks "does this path exist", and returns the leaf. This
|
|
220
|
+
* asks "what will JSONata hand back", and the difference is the array step:
|
|
221
|
+
* `items.amount` over a list of objects does not give a number, it gives a
|
|
222
|
+
* number for *each* item — so the type is a list of numbers, which is exactly
|
|
223
|
+
* what makes `$sum` of it legal and `$round` of it not.
|
|
224
|
+
*
|
|
225
|
+
* `undefined` means "cannot be read", never "wrong": a freeform node, an
|
|
226
|
+
* undeclared property, a path through something scalar. The caller turns that
|
|
227
|
+
* into `unknown`, which checks nothing.
|
|
228
|
+
*/
|
|
229
|
+
/** How many nested lists a single path step will be followed through. */
|
|
230
|
+
const MAX_SCHEMA_DEPTH = 10;
|
|
231
|
+
function expressionPathType(schema, segments) {
|
|
232
|
+
if (segments.some((segment) => FORBIDDEN_KEYS.has(segment)))
|
|
233
|
+
return undefined;
|
|
234
|
+
let current = schema;
|
|
235
|
+
/** Set once the path steps through a list, because results then come as one. */
|
|
236
|
+
let mapped = false;
|
|
237
|
+
for (const segment of segments) {
|
|
238
|
+
// Step through any number of nested lists before looking for the segment:
|
|
239
|
+
// in JSONata a property access reaches the elements, however deep the
|
|
240
|
+
// nesting goes. Bounded so that a self-referential schema cannot spin.
|
|
241
|
+
for (let unwrapped = 0; unwrapped < MAX_SCHEMA_DEPTH; unwrapped++) {
|
|
242
|
+
current = unwrapJsonSchema(current);
|
|
243
|
+
if (current['type'] !== 'array')
|
|
244
|
+
break;
|
|
245
|
+
const items = current['items'];
|
|
246
|
+
if (!items)
|
|
247
|
+
return undefined; // elements never declared
|
|
248
|
+
mapped = true;
|
|
249
|
+
current = items;
|
|
250
|
+
}
|
|
251
|
+
const props = current['properties'];
|
|
252
|
+
if (!props || !Object.prototype.hasOwnProperty.call(props, segment)) {
|
|
253
|
+
return undefined; // freeform, open record, or simply not declared
|
|
254
|
+
}
|
|
255
|
+
current = props[segment];
|
|
256
|
+
}
|
|
257
|
+
const leaf = unwrapJsonSchema(current);
|
|
258
|
+
const leafItems = leaf['items'];
|
|
259
|
+
const type = jsonSchemaKind(leaf) === 'array'
|
|
260
|
+
? { array: leafItems ? jsonSchemaKind(unwrapJsonSchema(leafItems)) : 'unknown' }
|
|
261
|
+
: jsonSchemaKind(leaf);
|
|
262
|
+
// A list of lists is flattened by JSONata, so mapping an already-list leaf
|
|
263
|
+
// changes nothing.
|
|
264
|
+
return mapped && baseKind(type) !== 'array' ? { array: type } : type;
|
|
265
|
+
}
|
|
177
266
|
/** Coarse kind of a JSON-schema leaf, for loose type compatibility. */
|
|
267
|
+
/**
|
|
268
|
+
* A schema node's kind. The rule lives in {@link kindOfJsonType}; this is the
|
|
269
|
+
* node-shaped way to ask it, which is what a schema walk has in hand.
|
|
270
|
+
*/
|
|
178
271
|
function jsonSchemaKind(schema) {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
return 'number';
|
|
182
|
-
if (t === 'string' || t === 'number' || t === 'boolean' || t === 'array' || t === 'object') {
|
|
183
|
-
return t;
|
|
184
|
-
}
|
|
185
|
-
return 'unknown'; // no type / union / freeform
|
|
272
|
+
const declared = schema['type'];
|
|
273
|
+
return kindOfJsonType(typeof declared === 'string' ? declared : undefined);
|
|
186
274
|
}
|
|
187
275
|
const JSON_HUMAN_TYPE = {
|
|
188
276
|
string: 'text',
|
|
@@ -342,7 +430,7 @@ export class ConfigValidator {
|
|
|
342
430
|
this.checkCredentialSlots(triggerImpl.credentialSlots, config.trigger.config, 'trigger.config', { scope: 'trigger' }, issues);
|
|
343
431
|
outputSchemas.set('trigger', resolveOutputJsonSchemaOf(triggerImpl, (config.trigger.config ?? {})));
|
|
344
432
|
}
|
|
345
|
-
this.validateTriggerFilter(config.trigger.filter, issues);
|
|
433
|
+
this.validateTriggerFilter(config.trigger.filter, outputSchemas, issues);
|
|
346
434
|
this.validateTriggerStart(config.trigger.start, outputSchemas, issues);
|
|
347
435
|
}
|
|
348
436
|
// --- Steps validation ---
|
|
@@ -364,6 +452,23 @@ export class ConfigValidator {
|
|
|
364
452
|
});
|
|
365
453
|
}
|
|
366
454
|
seenIds.add(step.id);
|
|
455
|
+
// An API call is addressed by the author's step id, and a MAP parks one
|
|
456
|
+
// node per item under that id — so the caller could not say which it
|
|
457
|
+
// meant. Said here, at authoring time, rather than as an ambiguous
|
|
458
|
+
// delivery when the callback finally arrives.
|
|
459
|
+
if (step.type === BuiltinStepType.WAIT_FOR_WEBHOOK) {
|
|
460
|
+
const fan = enclosing.find((e) => FANS_OUT.has(e.type));
|
|
461
|
+
if (fan) {
|
|
462
|
+
issues.push({
|
|
463
|
+
path: `${stepPath}.type`,
|
|
464
|
+
code: ValidationIssueCode.MISCONFIGURED,
|
|
465
|
+
message: `"${step.id}" waits for a webhook inside "${fan.id}" (${fan.type}), which runs its steps for every item at once. `
|
|
466
|
+
+ 'The caller addresses this wait by its step id, and that would name one waiting copy per item. '
|
|
467
|
+
+ 'Move the wait outside, or start a run per item so each has a wait of its own.',
|
|
468
|
+
location: { scope: 'step', stepId: step.id },
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
}
|
|
367
472
|
if (!this.connectors.hasStep(step.type)) {
|
|
368
473
|
issues.push({
|
|
369
474
|
path: `${stepPath}.type`,
|
|
@@ -392,8 +497,15 @@ export class ConfigValidator {
|
|
|
392
497
|
const branches = stepImpl instanceof BaseControlFlowStep && stepImpl.getBranches
|
|
393
498
|
? stepImpl.getBranches(stepConfig)
|
|
394
499
|
: undefined;
|
|
395
|
-
// Ref validation for the step's own config
|
|
396
|
-
|
|
500
|
+
// Ref and expression validation for the step's own config. A control
|
|
501
|
+
// step's branch arrays are left out of both — their steps are checked in
|
|
502
|
+
// their own scope, where the refs visible to them are known.
|
|
503
|
+
const ownScopeOnly = branches
|
|
504
|
+
? new Set(Object.values(branches))
|
|
505
|
+
: undefined;
|
|
506
|
+
this.validateRefs(stepConfig, `${stepPath}.config`, stepImpl.configSchema, outputSchemas, issues, step.id, ownScopeOnly);
|
|
507
|
+
this.validateExpressions(stepConfig, `${stepPath}.config`, stepImpl.configSchema, outputSchemas, issues, step.id, ownScopeOnly);
|
|
508
|
+
this.validateConditions(stepConfig, `${stepPath}.config`, { scope: 'step', stepId: step.id }, outputSchemas, issues, ownScopeOnly);
|
|
397
509
|
if (isJumpingStep(stepImpl)) {
|
|
398
510
|
this.validateJump(step, stepPath, stepImpl.jumpKind, enclosing, issues);
|
|
399
511
|
}
|
|
@@ -470,6 +582,41 @@ export class ConfigValidator {
|
|
|
470
582
|
}
|
|
471
583
|
if (parsed.data.kind !== 'at')
|
|
472
584
|
return;
|
|
585
|
+
// Worked out rather than read. `readAnchor` resolves an expression here, so
|
|
586
|
+
// it gets the same reading as one anywhere else — including whether what it
|
|
587
|
+
// produces can be a moment in time.
|
|
588
|
+
const computed = extractExpressionSource(parsed.data.anchor);
|
|
589
|
+
if (computed !== null) {
|
|
590
|
+
// No consumer schema: the anchor is declared `z.string()`, and text is the
|
|
591
|
+
// universal sink, so a generic field check here would accept everything.
|
|
592
|
+
// The real rule is the one below, which is the same one the reference
|
|
593
|
+
// branch applies.
|
|
594
|
+
const produced = this.checkExpression(computed, 'trigger.start.anchor', location, outputSchemas, issues, null);
|
|
595
|
+
const kind = baseKind(produced);
|
|
596
|
+
if (kind === 'boolean' || kind === 'object' || kind === 'array') {
|
|
597
|
+
issues.push({
|
|
598
|
+
path: 'trigger.start.anchor',
|
|
599
|
+
code: ValidationIssueCode.TYPE_MISMATCH,
|
|
600
|
+
message: `{% ${computed} %} gives ${sayType(produced)}, which cannot be a date and time.`,
|
|
601
|
+
location,
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
// The same confinement the schema puts on a plain reference, extended to
|
|
605
|
+
// every reference inside the expression: before a run there is nothing
|
|
606
|
+
// but the event and the workflow's variables.
|
|
607
|
+
for (const refPath of refsInExpression(computed)) {
|
|
608
|
+
const head = refPath.split('.')[0];
|
|
609
|
+
if (head !== 'trigger' && head !== 'vars') {
|
|
610
|
+
issues.push({
|
|
611
|
+
path: 'trigger.start.anchor',
|
|
612
|
+
code: ValidationIssueCode.SHAPE,
|
|
613
|
+
message: `An anchor can only read trigger data or a workflow variable, not "${refPath}"`,
|
|
614
|
+
location,
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
473
620
|
// A literal timestamp passes the schema above and has nothing to resolve;
|
|
474
621
|
// checkRef ignores anything that is not a reference.
|
|
475
622
|
const before = issues.length;
|
|
@@ -503,7 +650,7 @@ export class ConfigValidator {
|
|
|
503
650
|
* A trigger filter must be well formed, and may only read what exists before
|
|
504
651
|
* a run: the trigger's output and workflow variables.
|
|
505
652
|
*/
|
|
506
|
-
validateTriggerFilter(filter, issues) {
|
|
653
|
+
validateTriggerFilter(filter, outputSchemas, issues) {
|
|
507
654
|
if (filter === undefined)
|
|
508
655
|
return;
|
|
509
656
|
const location = { scope: 'trigger', field: 'filter' };
|
|
@@ -528,6 +675,34 @@ export class ConfigValidator {
|
|
|
528
675
|
condition.any.forEach((child, i) => visit(child, `${path}.any[${i}]`));
|
|
529
676
|
return;
|
|
530
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* A filter may only read what exists before a run — the event's payload
|
|
680
|
+
* and the workflow's variables. There are no step outputs yet.
|
|
681
|
+
*
|
|
682
|
+
* Enforced over *every* reference rather than just the leading one, so
|
|
683
|
+
* that an expression cannot reach further than a plain reference can.
|
|
684
|
+
*/
|
|
685
|
+
const confine = (refPath, said) => {
|
|
686
|
+
const head = refPath.split('.')[0];
|
|
687
|
+
if (head !== 'trigger' && head !== 'vars') {
|
|
688
|
+
issues.push({
|
|
689
|
+
path: `${path}.variable`,
|
|
690
|
+
code: ValidationIssueCode.INVALID_FILTER,
|
|
691
|
+
message: `Filters can only use trigger data and workflow variables, not "${said}"`,
|
|
692
|
+
location,
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
// Something worked out, rather than read. The schema accepts one here and
|
|
697
|
+
// `ConditionEvaluator` evaluates it, so refusing it as "no value chosen"
|
|
698
|
+
// — which is what reading it as a reference used to do — was wrong.
|
|
699
|
+
const computed = extractExpressionSource(condition.variable);
|
|
700
|
+
if (computed !== null) {
|
|
701
|
+
this.checkExpression(computed, `${path}.variable`, location, outputSchemas, issues, null);
|
|
702
|
+
for (const refPath of refsInExpression(computed))
|
|
703
|
+
confine(refPath, refPath);
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
531
706
|
const refPath = extractRefPath(condition.variable);
|
|
532
707
|
if (!refPath) {
|
|
533
708
|
issues.push({
|
|
@@ -538,18 +713,14 @@ export class ConfigValidator {
|
|
|
538
713
|
});
|
|
539
714
|
return;
|
|
540
715
|
}
|
|
541
|
-
|
|
542
|
-
if (head !== 'trigger' && head !== 'vars') {
|
|
543
|
-
issues.push({
|
|
544
|
-
path: `${path}.variable`,
|
|
545
|
-
code: ValidationIssueCode.INVALID_FILTER,
|
|
546
|
-
message: `Filters can only use trigger data and workflow variables, not "{{${refPath}}}"`,
|
|
547
|
-
location,
|
|
548
|
-
});
|
|
549
|
-
}
|
|
716
|
+
confine(refPath, `{{${refPath}}}`);
|
|
550
717
|
};
|
|
551
|
-
if (parsed.data.conditions)
|
|
718
|
+
if (parsed.data.conditions) {
|
|
552
719
|
visit(parsed.data.conditions, 'trigger.filter.conditions');
|
|
720
|
+
// The same reading a step's conditions get: an operator that can never
|
|
721
|
+
// hold is a filter that can never admit anything.
|
|
722
|
+
this.validateConditions(parsed.data.conditions, 'trigger.filter.conditions', location, outputSchemas, issues);
|
|
723
|
+
}
|
|
553
724
|
}
|
|
554
725
|
/**
|
|
555
726
|
* A GO_TO/FINISH must name a step around it that catches jumps
|
|
@@ -637,11 +808,210 @@ export class ConfigValidator {
|
|
|
637
808
|
stepRefLocation(stepId, prefix, location));
|
|
638
809
|
}
|
|
639
810
|
}
|
|
640
|
-
|
|
811
|
+
/**
|
|
812
|
+
* Expressions in a step's own config: can they be read, may they run, and do
|
|
813
|
+
* the references inside them lead anywhere.
|
|
814
|
+
*
|
|
815
|
+
* Three checks, in the order that makes the *first* message the useful one —
|
|
816
|
+
* there is no point reporting an unknown reference inside an expression that
|
|
817
|
+
* does not parse.
|
|
818
|
+
*/
|
|
819
|
+
/**
|
|
820
|
+
* A reference's type, as an expression sees it.
|
|
821
|
+
*
|
|
822
|
+
* Only the explicit roots: inside `{% … %}` there is no bare-step shorthand,
|
|
823
|
+
* which is what makes a leading name unambiguous there. `workflow` and
|
|
824
|
+
* `execution` describe nothing, so they read as unknown — same as a `{{ref}}`
|
|
825
|
+
* into them is left unchecked.
|
|
826
|
+
*/
|
|
827
|
+
expressionTypes(outputSchemas) {
|
|
828
|
+
return (path) => {
|
|
829
|
+
const segments = path.split('.').filter((segment) => segment.length > 0);
|
|
830
|
+
const head = segments[0];
|
|
831
|
+
if (head === 'trigger') {
|
|
832
|
+
const schema = outputSchemas.get('trigger');
|
|
833
|
+
return schema ? expressionPathType(schema, segments.slice(1)) : undefined;
|
|
834
|
+
}
|
|
835
|
+
if (head === 'vars') {
|
|
836
|
+
const schema = outputSchemas.get('vars');
|
|
837
|
+
return schema ? expressionPathType(schema, segments.slice(1)) : undefined;
|
|
838
|
+
}
|
|
839
|
+
if (head === 'steps') {
|
|
840
|
+
const stepId = segments[1];
|
|
841
|
+
if (!stepId)
|
|
842
|
+
return undefined;
|
|
843
|
+
const role = segments[2];
|
|
844
|
+
const addressed = role === 'input' || role === 'output';
|
|
845
|
+
const schema = outputSchemas.get(addressed ? `${stepId}.${role}` : `${stepId}.output`);
|
|
846
|
+
return schema
|
|
847
|
+
? expressionPathType(schema, segments.slice(addressed ? 3 : 2))
|
|
848
|
+
: undefined;
|
|
849
|
+
}
|
|
850
|
+
return undefined;
|
|
851
|
+
};
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Every check that applies to one expression, wherever it sits.
|
|
855
|
+
*
|
|
856
|
+
* One method rather than one per surface, because "is this expression valid"
|
|
857
|
+
* must not have two answers. It was a per-step walk first, which left the
|
|
858
|
+
* trigger's filter and its delayed-start anchor evaluating expressions that
|
|
859
|
+
* nothing had read — no syntax check, no ban on naming a function, no types.
|
|
860
|
+
*
|
|
861
|
+
* `consumer` is the Zod schema the result is bound into, or null where there
|
|
862
|
+
* is nothing to bind to (a condition's own slot, a reference inside another
|
|
863
|
+
* expression).
|
|
864
|
+
*
|
|
865
|
+
* Returns what the expression produces, so a caller with a rule of its own can
|
|
866
|
+
* apply it — a delayed start, for instance, knows that a list can never be a
|
|
867
|
+
* moment in time, which no schema of `z.string()` will ever say.
|
|
868
|
+
*/
|
|
869
|
+
checkExpression(source, path, location, outputSchemas, issues, consumer) {
|
|
870
|
+
const fault = inspectExpression(source);
|
|
871
|
+
if (fault) {
|
|
872
|
+
issues.push({
|
|
873
|
+
path,
|
|
874
|
+
code: ValidationIssueCode.INVALID_EXPRESSION,
|
|
875
|
+
message: `{% ${source} %} — ${fault.message}`,
|
|
876
|
+
location,
|
|
877
|
+
});
|
|
878
|
+
return 'unknown';
|
|
879
|
+
}
|
|
880
|
+
// Existence and ordering of each reference — note the `null` consumer
|
|
881
|
+
// schema passed on. A reference inside an expression is NOT bound to the
|
|
882
|
+
// field: the expression transforms it, so `$sum` over a list of numbers
|
|
883
|
+
// belongs in a number field even though the list does not. Whether the
|
|
884
|
+
// *result* fits is a separate question, answered below.
|
|
885
|
+
for (const refPath of refsInExpression(source)) {
|
|
886
|
+
this.checkRef(`{{context.${refPath}}}`, path, outputSchemas, issues, null, location, source);
|
|
887
|
+
}
|
|
888
|
+
// What the expression produces, and what it misuses getting there. This is
|
|
889
|
+
// what makes the typing promise hold *before* a run: without it the engine
|
|
890
|
+
// leans on JSONata's own signature errors and on zod rejecting the result,
|
|
891
|
+
// which are both correct and both too late to help anyone writing.
|
|
892
|
+
const { type, faults } = inferExpressionType(source, this.expressionTypes(outputSchemas));
|
|
893
|
+
for (const typeFault of faults) {
|
|
894
|
+
issues.push({
|
|
895
|
+
path,
|
|
896
|
+
code: ValidationIssueCode.TYPE_MISMATCH,
|
|
897
|
+
message: `{% ${source} %} — ${typeFault.message}`,
|
|
898
|
+
location,
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
// Only when the inside is sound: one mistake should be reported once, and a
|
|
902
|
+
// bad argument already explains the wrong result.
|
|
903
|
+
if (faults.length === 0 && consumer !== null) {
|
|
904
|
+
if (!assignableToField(type, zodConsumerKind(consumer))) {
|
|
905
|
+
issues.push({
|
|
906
|
+
path,
|
|
907
|
+
code: ValidationIssueCode.TYPE_MISMATCH,
|
|
908
|
+
message: `{% ${source} %} gives ${sayType(type)}, but this field expects a ${humanZodType(consumer)}.`,
|
|
909
|
+
location,
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
return type;
|
|
914
|
+
}
|
|
915
|
+
/** Every expression in a step's own config, checked where it sits. */
|
|
916
|
+
validateExpressions(config, prefix, configSchema, outputSchemas, issues, stepId, skip) {
|
|
917
|
+
// Conditions included — a condition's own slots accept an expression, which
|
|
918
|
+
// `ConditionEvaluator` resolves.
|
|
919
|
+
for (const { source, location } of collectExpressions(config, prefix, skip)) {
|
|
920
|
+
this.checkExpression(source, location, stepRefLocation(stepId, prefix, location), outputSchemas, issues, this.getConsumerInnerSchema(configSchema, location, prefix));
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* What a condition's left side will produce, as far as can be told.
|
|
925
|
+
*
|
|
926
|
+
* An expression's type is computed; a reference's is read from the schema. A
|
|
927
|
+
* literal cannot appear here — the schema accepts only the two.
|
|
928
|
+
*/
|
|
929
|
+
conditionVariableType(variable, outputSchemas) {
|
|
930
|
+
const lookup = this.expressionTypes(outputSchemas);
|
|
931
|
+
const computed = extractExpressionSource(variable);
|
|
932
|
+
if (computed !== null)
|
|
933
|
+
return inferExpressionType(computed, lookup).type;
|
|
934
|
+
const refPath = extractRefPath(variable);
|
|
935
|
+
return refPath === null ? 'unknown' : (lookup(refPath) ?? 'unknown');
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* One condition leaf: can its operator hold against what is on the left?
|
|
939
|
+
*
|
|
940
|
+
* Only where the operator is unambiguous about it — see `needs` on
|
|
941
|
+
* `OperatorDescriptor`. "is greater than" against text, or "starts with"
|
|
942
|
+
* against a number, is not a near miss: the comparison can never be true, so
|
|
943
|
+
* the branch is unreachable and the author almost certainly meant something
|
|
944
|
+
* else.
|
|
945
|
+
*
|
|
946
|
+
* Deliberately *not* checked: the comparison value against the left side.
|
|
947
|
+
* `looseEquals` coerces on purpose — `5` equals `"5"` here — so refusing a
|
|
948
|
+
* number against text would refuse something that works.
|
|
949
|
+
*/
|
|
950
|
+
checkConditionLeaf(leaf, path, location, outputSchemas, issues) {
|
|
951
|
+
const descriptor = OPERATOR_DESCRIPTORS.find((entry) => entry.value === leaf.operator);
|
|
952
|
+
const needs = descriptor?.needs;
|
|
953
|
+
if (descriptor === undefined || needs === undefined)
|
|
954
|
+
return;
|
|
955
|
+
const type = this.conditionVariableType(leaf.variable, outputSchemas);
|
|
956
|
+
if (assignableToArgument(type, needs))
|
|
957
|
+
return;
|
|
958
|
+
issues.push({
|
|
959
|
+
path: `${path}.variable`,
|
|
960
|
+
code: ValidationIssueCode.TYPE_MISMATCH,
|
|
961
|
+
message: `"${descriptor.label}" needs ${sayType(needs)}, but this is ${sayType(type)} — the condition can never be true.`,
|
|
962
|
+
location,
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* Every condition leaf reachable in a value.
|
|
967
|
+
*
|
|
968
|
+
* Conditions are found structurally, by the same predicate the resolver and
|
|
969
|
+
* the expression pre-pass use, so the three cannot disagree about what one is.
|
|
970
|
+
*/
|
|
971
|
+
validateConditions(value, prefix, location, outputSchemas, issues, skip) {
|
|
972
|
+
const walk = (node, path) => {
|
|
973
|
+
if (skip?.has(node))
|
|
974
|
+
return;
|
|
975
|
+
if (Array.isArray(node)) {
|
|
976
|
+
node.forEach((item, index) => walk(item, `${path}[${index}]`));
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
if (node === null || typeof node !== 'object')
|
|
980
|
+
return;
|
|
981
|
+
const record = node;
|
|
982
|
+
if (isCondition(record)) {
|
|
983
|
+
for (const join of ['all', 'any']) {
|
|
984
|
+
const parts = record[join];
|
|
985
|
+
if (Array.isArray(parts)) {
|
|
986
|
+
parts.forEach((part, index) => walk(part, `${path}.${join}[${index}]`));
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
this.checkConditionLeaf(record, path, location, outputSchemas, issues);
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
for (const [key, child] of Object.entries(record)) {
|
|
994
|
+
walk(child, path ? `${path}.${key}` : key);
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
walk(value, prefix);
|
|
998
|
+
}
|
|
999
|
+
checkRef(refString, location, outputSchemas, issues, consumerInnerSchema, issueLocation,
|
|
1000
|
+
/**
|
|
1001
|
+
* The expression this reference came out of, when it did.
|
|
1002
|
+
*
|
|
1003
|
+
* One parameter rather than two flags, because both differences it causes
|
|
1004
|
+
* have the same cause: a path inside an expression maps over arrays, and
|
|
1005
|
+
* the author never wrote `{{context....}}`, so quoting it back at them
|
|
1006
|
+
* would be a riddle. Callers pass the reference in `{{...}}` form either
|
|
1007
|
+
* way so that the parsing below stays single-form.
|
|
1008
|
+
*/
|
|
1009
|
+
expression) {
|
|
641
1010
|
const inner = refString.match(/^\{\{(?:context\.)?([^}]+)\}\}$/);
|
|
642
1011
|
if (!inner?.[1])
|
|
643
1012
|
return;
|
|
644
1013
|
const refPath = inner[1];
|
|
1014
|
+
const display = expression !== undefined ? `"${refPath}" in {% ${expression} %}` : `"${refString}"`;
|
|
645
1015
|
const segments = refPath.split('.');
|
|
646
1016
|
const sourceKey = segments[0];
|
|
647
1017
|
if (!sourceKey)
|
|
@@ -682,7 +1052,7 @@ export class ConfigValidator {
|
|
|
682
1052
|
issues.push({
|
|
683
1053
|
path: location,
|
|
684
1054
|
code: ValidationIssueCode.UNKNOWN_REFERENCE,
|
|
685
|
-
message:
|
|
1055
|
+
message: `${display} references an undeclared workflow variable "vars.${key ?? ''}". Declare it in the workflow's Variables.`,
|
|
686
1056
|
location: issueLocation,
|
|
687
1057
|
});
|
|
688
1058
|
}
|
|
@@ -704,18 +1074,18 @@ export class ConfigValidator {
|
|
|
704
1074
|
issues.push({
|
|
705
1075
|
path: location,
|
|
706
1076
|
code: ValidationIssueCode.FORWARD_REFERENCE,
|
|
707
|
-
message:
|
|
1077
|
+
message: `${display} references "${sourceKey}" which is not yet available at this point in the workflow (forward reference, or unknown step / trigger ID).`,
|
|
708
1078
|
location: issueLocation,
|
|
709
1079
|
});
|
|
710
1080
|
return;
|
|
711
1081
|
}
|
|
712
1082
|
const sourceSchema = outputSchemas.get(resolverKey);
|
|
713
|
-
const leafSchema = walkJsonSchemaPath(sourceSchema, pathSegments);
|
|
1083
|
+
const leafSchema = walkJsonSchemaPath(sourceSchema, pathSegments, expression !== undefined);
|
|
714
1084
|
if (leafSchema === null) {
|
|
715
1085
|
issues.push({
|
|
716
1086
|
path: location,
|
|
717
1087
|
code: ValidationIssueCode.UNKNOWN_REFERENCE,
|
|
718
|
-
message:
|
|
1088
|
+
message: `${display} — path "${pathSegments.join('.')}" does not exist in the schema of "${resolverKey}".`,
|
|
719
1089
|
location: issueLocation,
|
|
720
1090
|
});
|
|
721
1091
|
return;
|
|
@@ -725,7 +1095,7 @@ export class ConfigValidator {
|
|
|
725
1095
|
issues.push({
|
|
726
1096
|
path: location,
|
|
727
1097
|
code: ValidationIssueCode.TYPE_MISMATCH,
|
|
728
|
-
message:
|
|
1098
|
+
message: `${display} is a ${humanJsonType(leafSchema)} but this field expects a ${humanZodType(consumerInnerSchema)}.`,
|
|
729
1099
|
location: issueLocation,
|
|
730
1100
|
});
|
|
731
1101
|
}
|