@xyne/workflow-sdk 3.2.52 → 3.2.54
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/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/citation-ref.d.ts +4 -4
- 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.map +1 -1
- package/dist/connectors/builtin/steps/cycle.step.js +5 -2
- 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/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 +4 -2
- 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/switch.step.js +1 -1
- package/dist/connectors/builtin/steps/switch.step.js.map +1 -1
- package/dist/connectors/builtin/steps/wait.step.d.ts +30 -24
- package/dist/connectors/builtin/steps/wait.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/wait.step.js +18 -6
- 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/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/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/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 +371 -30
- package/dist/engine/config-validator.js.map +1 -1
- 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 +33 -1
- 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 +21 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -1
- 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/runtime/workflow-runtime.d.ts.map +1 -1
- package/dist/runtime/workflow-runtime.js +4 -2
- package/dist/runtime/workflow-runtime.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/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,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import type { TypeKind } from '../util/type-compat.js';
|
|
2
3
|
/**
|
|
3
4
|
* What a condition can ask of a value.
|
|
4
5
|
*
|
|
@@ -28,7 +29,28 @@ export declare const VALUE_LESS_OPERATORS: ReadonlySet<ConditionOperator>;
|
|
|
28
29
|
export interface OperatorDescriptor {
|
|
29
30
|
readonly value: ConditionOperator;
|
|
30
31
|
readonly label: string;
|
|
32
|
+
/**
|
|
33
|
+
* What kind of control the *comparison value* gets. A UI concern: `EQ` is
|
|
34
|
+
* `'string'` because you type into a box, not because it compares text.
|
|
35
|
+
*/
|
|
31
36
|
readonly valueType: 'string' | 'number' | 'boolean' | 'none';
|
|
37
|
+
/**
|
|
38
|
+
* What the **left side** has to be for this operator to be able to hold at
|
|
39
|
+
* all, when that is unambiguous. Undefined means "anything", which is most of
|
|
40
|
+
* them, and the absence is as deliberate as the presence:
|
|
41
|
+
*
|
|
42
|
+
* - `EQ`/`NEQ` compare anything, because `looseEquals` coerces on purpose —
|
|
43
|
+
* `5` equals `"5"` in this engine, so refusing a number against text would
|
|
44
|
+
* refuse something that works.
|
|
45
|
+
* - `CONTAINS` holds for a substring *or* a list member, and a union is not
|
|
46
|
+
* something this vocabulary can say.
|
|
47
|
+
* - `EXISTS`/`IS_EMPTY` are about presence, whatever the thing is.
|
|
48
|
+
*
|
|
49
|
+
* So only the four comparisons that are arithmetic, and the two that are
|
|
50
|
+
* really about text, say anything here — and those are the ones where a wrong
|
|
51
|
+
* left side means the condition can never be true.
|
|
52
|
+
*/
|
|
53
|
+
readonly needs?: TypeKind;
|
|
32
54
|
}
|
|
33
55
|
export declare const OPERATOR_DESCRIPTORS: readonly OperatorDescriptor[];
|
|
34
56
|
//# sourceMappingURL=operators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;;;GAQG;AACH,oBAAY,iBAAiB;IAC3B,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,QAAQ,aAAa;IACrB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,EAAE,OAAO;IACT,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,UAAU,eAAe;IACzB,QAAQ,aAAa;CACtB;AAED,eAAO,MAAM,uBAAuB,2CAAkC,CAAC;AAEvE,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,iBAAiB,CAI9D,CAAC;AAIH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;IAC7D;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAED,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAc7D,CAAC"}
|
package/dist/types/operators.js
CHANGED
|
@@ -35,12 +35,12 @@ export const OPERATOR_DESCRIPTORS = [
|
|
|
35
35
|
{ value: ConditionOperator.NEQ, label: 'does not equal', valueType: 'string' },
|
|
36
36
|
{ value: ConditionOperator.CONTAINS, label: 'contains', valueType: 'string' },
|
|
37
37
|
{ value: ConditionOperator.NOT_CONTAINS, label: 'does not contain', valueType: 'string' },
|
|
38
|
-
{ value: ConditionOperator.STARTS_WITH, label: 'starts with', valueType: 'string' },
|
|
39
|
-
{ value: ConditionOperator.ENDS_WITH, label: 'ends with', valueType: 'string' },
|
|
40
|
-
{ value: ConditionOperator.GT, label: 'is greater than', valueType: 'number' },
|
|
41
|
-
{ value: ConditionOperator.GTE, label: 'is greater than or equal to', valueType: 'number' },
|
|
42
|
-
{ value: ConditionOperator.LT, label: 'is less than', valueType: 'number' },
|
|
43
|
-
{ value: ConditionOperator.LTE, label: 'is less than or equal to', valueType: 'number' },
|
|
38
|
+
{ value: ConditionOperator.STARTS_WITH, label: 'starts with', valueType: 'string', needs: 'string' },
|
|
39
|
+
{ value: ConditionOperator.ENDS_WITH, label: 'ends with', valueType: 'string', needs: 'string' },
|
|
40
|
+
{ value: ConditionOperator.GT, label: 'is greater than', valueType: 'number', needs: 'number' },
|
|
41
|
+
{ value: ConditionOperator.GTE, label: 'is greater than or equal to', valueType: 'number', needs: 'number' },
|
|
42
|
+
{ value: ConditionOperator.LT, label: 'is less than', valueType: 'number', needs: 'number' },
|
|
43
|
+
{ value: ConditionOperator.LTE, label: 'is less than or equal to', valueType: 'number', needs: 'number' },
|
|
44
44
|
{ value: ConditionOperator.EXISTS, label: 'exists', valueType: 'none' },
|
|
45
45
|
{ value: ConditionOperator.NOT_EXISTS, label: 'does not exist', valueType: 'none' },
|
|
46
46
|
{ value: ConditionOperator.IS_EMPTY, label: 'is empty', valueType: 'none' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"operators.js","sourceRoot":"","sources":["../../src/types/operators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AACH,MAAM,CAAN,IAAY,iBAcX;AAdD,WAAY,iBAAiB;IAC3B,8BAAS,CAAA;IACT,gCAAW,CAAA;IACX,0CAAqB,CAAA;IACrB,kDAA6B,CAAA;IAC7B,gDAA2B,CAAA;IAC3B,4CAAuB,CAAA;IACvB,8BAAS,CAAA;IACT,gCAAW,CAAA;IACX,8BAAS,CAAA;IACT,gCAAW,CAAA;IACX,sCAAiB,CAAA;IACjB,8CAAyB,CAAA;IACzB,0CAAqB,CAAA;AACvB,CAAC,EAdW,iBAAiB,KAAjB,iBAAiB,QAc5B;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,oBAAoB,GAAmC,IAAI,GAAG,CAAC;IAC1E,iBAAiB,CAAC,MAAM;IACxB,iBAAiB,CAAC,UAAU;IAC5B,iBAAiB,CAAC,QAAQ;CAC3B,CAAC,CAAC;AA+BH,MAAM,CAAC,MAAM,oBAAoB,GAAkC;IACjE,EAAE,KAAK,EAAE,iBAAiB,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;IACrE,EAAE,KAAK,EAAE,iBAAiB,CA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AE;IACnF,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE;CAC5E,CAAC"}
|
|
@@ -22,7 +22,16 @@ export declare enum ValidationIssueCode {
|
|
|
22
22
|
* please try again") rather than accusing the author of a mistake that may not
|
|
23
23
|
* exist; the code is shared because nothing branches on it.
|
|
24
24
|
*/
|
|
25
|
-
MISCONFIGURED = "misconfigured"
|
|
25
|
+
MISCONFIGURED = "misconfigured",
|
|
26
|
+
/**
|
|
27
|
+
* A `{% ... %}` expression that cannot be read, may not run, or sits where
|
|
28
|
+
* expressions are not evaluated.
|
|
29
|
+
*
|
|
30
|
+
* Separate from SHAPE because the config *is* well-shaped — the field holds a
|
|
31
|
+
* string, and a string is what the schema asked for. The fault is inside the
|
|
32
|
+
* string, and only something that parses the expression language can see it.
|
|
33
|
+
*/
|
|
34
|
+
INVALID_EXPRESSION = "invalidExpression"
|
|
26
35
|
}
|
|
27
36
|
export declare const ValidationIssueCodeSchema: z.ZodNativeEnum<typeof ValidationIssueCode>;
|
|
28
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/types/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,iBAAiB,qBAAqB;IACtC,iBAAiB,qBAAqB;IACtC,aAAa,iBAAiB;IAC9B,iBAAiB,oBAAoB;IACrC,kBAAkB,sBAAsB;IACxC,cAAc,kBAAkB;IAChC,YAAY,gBAAgB;IAC5B;;;;;;;;;;;;;OAaG;IACH,aAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/types/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,iBAAiB,qBAAqB;IACtC,iBAAiB,qBAAqB;IACtC,aAAa,iBAAiB;IAC9B,iBAAiB,oBAAoB;IACrC,kBAAkB,sBAAsB;IACxC,cAAc,kBAAkB;IAChC,YAAY,gBAAgB;IAC5B;;;;;;;;;;;;;OAaG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;OAOG;IACH,kBAAkB,sBAAsB;CACzC;AAED,eAAO,MAAM,yBAAyB,6CAAoC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qHAAqH;IACrH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,uBAAuB,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B"}
|
package/dist/types/validation.js
CHANGED
|
@@ -24,6 +24,15 @@ export var ValidationIssueCode;
|
|
|
24
24
|
* exist; the code is shared because nothing branches on it.
|
|
25
25
|
*/
|
|
26
26
|
ValidationIssueCode["MISCONFIGURED"] = "misconfigured";
|
|
27
|
+
/**
|
|
28
|
+
* A `{% ... %}` expression that cannot be read, may not run, or sits where
|
|
29
|
+
* expressions are not evaluated.
|
|
30
|
+
*
|
|
31
|
+
* Separate from SHAPE because the config *is* well-shaped — the field holds a
|
|
32
|
+
* string, and a string is what the schema asked for. The fault is inside the
|
|
33
|
+
* string, and only something that parses the expression language can see it.
|
|
34
|
+
*/
|
|
35
|
+
ValidationIssueCode["INVALID_EXPRESSION"] = "invalidExpression";
|
|
27
36
|
})(ValidationIssueCode || (ValidationIssueCode = {}));
|
|
28
37
|
export const ValidationIssueCodeSchema = z.nativeEnum(ValidationIssueCode);
|
|
29
38
|
//# sourceMappingURL=validation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/types/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/types/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAN,IAAY,mBAiCX;AAjCD,WAAY,mBAAmB;IAC7B,sCAAe,CAAA;IACf,6DAAsC,CAAA;IACtC,6DAAsC,CAAA;IACtC,qDAA8B,CAAA;IAC9B,4DAAqC,CAAA;IACrC,+DAAwC,CAAA;IACxC,uDAAgC,CAAA;IAChC,mDAA4B,CAAA;IAC5B;;;;;;;;;;;;;OAaG;IACH,sDAA+B,CAAA;IAC/B;;;;;;;OAOG;IACH,+DAAwC,CAAA;AAC1C,CAAC,EAjCW,mBAAmB,KAAnB,mBAAmB,QAiC9B;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -7,9 +7,10 @@ import type { ControlFlowStepType } from './known-types.js';
|
|
|
7
7
|
import type { ConditionOperator } from './operators.js';
|
|
8
8
|
import type { WorkflowVariable } from './workflow-variable.js';
|
|
9
9
|
/**
|
|
10
|
-
* Wraps a Zod schema to also accept a `{{...}}` variable reference
|
|
11
|
-
* Used in step config schemas — e.g.
|
|
12
|
-
*
|
|
10
|
+
* Wraps a Zod schema to also accept a `{{...}}` variable reference or a
|
|
11
|
+
* `{% ... %}` expression. Used in step config schemas — e.g.
|
|
12
|
+
* `variableRef(z.number())` accepts a literal number, a `{{trigger.count}}`
|
|
13
|
+
* reference, or `{% $sum(steps.a.output.items.amount) %}`.
|
|
13
14
|
*
|
|
14
15
|
* The union is marked rather than described: a reference being legal is a fact
|
|
15
16
|
* about the field, not a sentence about it, and `description` belongs to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-config.d.ts","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-config.d.ts","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBA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1,16 +1,31 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { BuiltinStepType } from './known-types.js';
|
|
3
3
|
import { ConditionOperatorSchema } from './operators.js';
|
|
4
|
-
import {
|
|
4
|
+
import { REF_OR_EXPRESSION_REGEX } from '../expression/format.js';
|
|
5
5
|
import { isMarked, markSchema } from '../util/schema-marks.js';
|
|
6
6
|
// ─── Variable Reference Helpers ───
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* A pure `{{ref}}` **or** a pure `{% expression %}` — the one spelling for every
|
|
9
|
+
* slot that takes a reference instead of a literal.
|
|
10
|
+
*
|
|
11
|
+
* This is what lets expressions reach anywhere worth having them. A
|
|
12
|
+
* `variableRef(z.number())` field is a union of "a number" and "a string that
|
|
13
|
+
* is a reference"; without widening that string branch an expression is
|
|
14
|
+
* rejected as a shape error, and `{% $sum(…) %}` would only ever work in fields
|
|
15
|
+
* that happen to be plain text. {@link LeafConditionSchema}'s `variable` takes
|
|
16
|
+
* the same schema, so a condition can test something computed.
|
|
17
|
+
*
|
|
18
|
+
* A regex rather than a refinement, so `zod-to-json-schema` keeps emitting a
|
|
19
|
+
* `pattern` for the field and the editor's picture of it does not change shape.
|
|
20
|
+
*/
|
|
21
|
+
const bindableStringSchema = z
|
|
8
22
|
.string()
|
|
9
|
-
.regex(
|
|
23
|
+
.regex(REF_OR_EXPRESSION_REGEX, 'Must be a {{context.<path>}} reference or a {% expression %}');
|
|
10
24
|
/**
|
|
11
|
-
* Wraps a Zod schema to also accept a `{{...}}` variable reference
|
|
12
|
-
* Used in step config schemas — e.g.
|
|
13
|
-
*
|
|
25
|
+
* Wraps a Zod schema to also accept a `{{...}}` variable reference or a
|
|
26
|
+
* `{% ... %}` expression. Used in step config schemas — e.g.
|
|
27
|
+
* `variableRef(z.number())` accepts a literal number, a `{{trigger.count}}`
|
|
28
|
+
* reference, or `{% $sum(steps.a.output.items.amount) %}`.
|
|
14
29
|
*
|
|
15
30
|
* The union is marked rather than described: a reference being legal is a fact
|
|
16
31
|
* about the field, not a sentence about it, and `description` belongs to the
|
|
@@ -18,7 +33,7 @@ const variableRefStringSchema = z
|
|
|
18
33
|
* reads it from.
|
|
19
34
|
*/
|
|
20
35
|
export function variableRef(inner) {
|
|
21
|
-
return markSchema(z.union([inner,
|
|
36
|
+
return markSchema(z.union([inner, bindableStringSchema]), 'isVariableRef');
|
|
22
37
|
}
|
|
23
38
|
/**
|
|
24
39
|
* Given a schema that may be a variableRef union, extract the inner (non-ref) schema.
|
|
@@ -33,7 +48,7 @@ export function getVariableRefInnerSchema(schema) {
|
|
|
33
48
|
return null;
|
|
34
49
|
}
|
|
35
50
|
export const LeafConditionSchema = z.object({
|
|
36
|
-
variable:
|
|
51
|
+
variable: bindableStringSchema,
|
|
37
52
|
operator: ConditionOperatorSchema,
|
|
38
53
|
value: z.unknown().optional(),
|
|
39
54
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-config.js","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"workflow-config.js","sourceRoot":"","sources":["../../src/types/workflow-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG/D,qCAAqC;AAErC;;;;;;;;;;;;;GAaG;AACH,MAAM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AAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACrD,KAAK,EAAE,CAAC;SACL,MAAM,CAAC;QACN,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC;KACvC,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC;AA4DH,MAAM,CAAC,MAAM,mBAAmB,GAA6B,CAAC;KAC3D,MAAM,CAAC,EAAE,UAAU,EAAE,eAAe,CAAC,QAAQ,EAAE,EAAE,CAAC;KAClD,MAAM,EAA8B,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAE/C,kBAAkB;AAElB;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAgC,EAChC,IAAY;IAEZ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,OAAO,GAAY,OAAO,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IACE,OAAO,KAAK,IAAI;YAChB,OAAO,KAAK,SAAS;YACrB,OAAO,OAAO,KAAK,QAAQ,EAC3B,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,GAAI,OAAmC,CAAC,IAAI,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { type ExpressionFunction } from './expression-functions.js';
|
|
2
|
+
import { type ExprType } from './type-compat.js';
|
|
3
|
+
/** How a predicate compares. */
|
|
4
|
+
export declare const COMPARISON_OPS: readonly [{
|
|
5
|
+
readonly op: "=";
|
|
6
|
+
readonly said: "is";
|
|
7
|
+
}, {
|
|
8
|
+
readonly op: "!=";
|
|
9
|
+
readonly said: "is not";
|
|
10
|
+
}, {
|
|
11
|
+
readonly op: ">";
|
|
12
|
+
readonly said: "is more than";
|
|
13
|
+
}, {
|
|
14
|
+
readonly op: ">=";
|
|
15
|
+
readonly said: "is at least";
|
|
16
|
+
}, {
|
|
17
|
+
readonly op: "<";
|
|
18
|
+
readonly said: "is less than";
|
|
19
|
+
}, {
|
|
20
|
+
readonly op: "<=";
|
|
21
|
+
readonly said: "is at most";
|
|
22
|
+
}];
|
|
23
|
+
export type ComparisonOp = (typeof COMPARISON_OPS)[number]['op'];
|
|
24
|
+
/** Keep only the items whose `field` compares this way against `value`. */
|
|
25
|
+
export interface ItemFilter {
|
|
26
|
+
field: string;
|
|
27
|
+
op: ComparisonOp;
|
|
28
|
+
/** As the author typed it. */
|
|
29
|
+
value: string;
|
|
30
|
+
/**
|
|
31
|
+
* What the field being tested is declared to be, when anything declares it.
|
|
32
|
+
*
|
|
33
|
+
* Without it the value is spelled from its own shape, and a text field tested
|
|
34
|
+
* against `10` becomes `[code = 10]` — which matches nothing, silently,
|
|
35
|
+
* because `"10" = 10` is false. The form knows the field's type; this is how
|
|
36
|
+
* it says so. Read back from how the literal was spelled, so the round trip
|
|
37
|
+
* holds without the reader having to know the schema.
|
|
38
|
+
*/
|
|
39
|
+
type?: ExprType | undefined;
|
|
40
|
+
}
|
|
41
|
+
/** One value going into a computation: where it is, narrowed, and read. */
|
|
42
|
+
export interface ValueSelection {
|
|
43
|
+
/** A dotted path, with an explicit root. */
|
|
44
|
+
path: string;
|
|
45
|
+
/** Only some of the items. */
|
|
46
|
+
filter?: ItemFilter | undefined;
|
|
47
|
+
/** One field of each item, rather than the whole item. */
|
|
48
|
+
field?: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
/** One argument: data the author pointed at, or text they typed. */
|
|
51
|
+
export type Argument = ({
|
|
52
|
+
kind: 'value';
|
|
53
|
+
} & ValueSelection) | {
|
|
54
|
+
kind: 'fixed';
|
|
55
|
+
raw: string;
|
|
56
|
+
}
|
|
57
|
+
/** Several things where a list is wanted, written `[a, b]`. */
|
|
58
|
+
| {
|
|
59
|
+
kind: 'list';
|
|
60
|
+
of: Argument[];
|
|
61
|
+
};
|
|
62
|
+
/** One catalogue entry over some arguments: `$sum([a, b])`, `a * b`. */
|
|
63
|
+
export interface Call {
|
|
64
|
+
kind: 'call';
|
|
65
|
+
/** A catalogue name — `$sum`, or `multiply` for an operator. */
|
|
66
|
+
fn: string;
|
|
67
|
+
args: Argument[];
|
|
68
|
+
}
|
|
69
|
+
/** Every item of a list, rendered as one piece of text. */
|
|
70
|
+
export interface ListFormat {
|
|
71
|
+
kind: 'list';
|
|
72
|
+
/** The list, optionally narrowed by a filter. */
|
|
73
|
+
source: ValueSelection;
|
|
74
|
+
/** What one item reads, with `{{field}}` standing for a field of that item. */
|
|
75
|
+
template: string;
|
|
76
|
+
/** Between one item and the next. */
|
|
77
|
+
separator: string;
|
|
78
|
+
/** What to say when the list is empty. */
|
|
79
|
+
empty?: string | undefined;
|
|
80
|
+
}
|
|
81
|
+
/** A computation a form can describe. */
|
|
82
|
+
export type Computation = Call | ListFormat;
|
|
83
|
+
/** A literal for inside a predicate, typed from what the author typed. */
|
|
84
|
+
export declare function writeLiteral(raw: string): string;
|
|
85
|
+
/** One selection as expression text: the list, narrowed, then read. */
|
|
86
|
+
export declare function writeSelection(selection: ValueSelection): string;
|
|
87
|
+
/** The functions a form can describe. */
|
|
88
|
+
export declare const FORMABLE_FUNCTIONS: readonly ExpressionFunction[];
|
|
89
|
+
/** Whether a form can describe this function at all. */
|
|
90
|
+
export declare function isFormable(fn: string): boolean;
|
|
91
|
+
/** The expression a computation describes, or null when it is not yet complete. */
|
|
92
|
+
export declare function writeComputation(computation: Computation): string | null;
|
|
93
|
+
/** How many arguments an entry takes, and whether it will keep taking them. */
|
|
94
|
+
export declare function argumentSlots(fn: string): {
|
|
95
|
+
count: number;
|
|
96
|
+
} | null;
|
|
97
|
+
/** What the nth argument has to be. */
|
|
98
|
+
export declare function wantsAt(fn: string, at: number): ExprType;
|
|
99
|
+
/** Whether the nth argument is a list, and so takes as many entries as you like. */
|
|
100
|
+
export declare function takesSeveral(fn: string, at: number): boolean;
|
|
101
|
+
/** Recover a computation from an expression this could have written. */
|
|
102
|
+
export declare function readComputation(expression: string, isList: (path: string) => boolean): Computation | null;
|
|
103
|
+
//# sourceMappingURL=computed-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computed-value.d.ts","sourceRoot":"","sources":["../../src/util/computed-value.ts"],"names":[],"mappings":"AAgBA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAyC,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExF,gCAAgC;AAChC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;EAOjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;AAEjE,2EAA2E;AAC3E,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,YAAY,CAAC;IACjB,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CAC7B;AAED,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAChC,0DAA0D;IAC1D,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,oEAAoE;AACpE,MAAM,MAAM,QAAQ,GAChB,CAAC;IAAE,IAAI,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