@xyne/workflow-sdk 3.2.61 → 3.2.62

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.
Files changed (112) hide show
  1. package/dist/agents/compaction.d.ts +62 -0
  2. package/dist/agents/compaction.d.ts.map +1 -0
  3. package/dist/agents/compaction.js +153 -0
  4. package/dist/agents/compaction.js.map +1 -0
  5. package/dist/agents/host-agent-step.d.ts +2 -2
  6. package/dist/agents/llm-call-policy.d.ts +48 -0
  7. package/dist/agents/llm-call-policy.d.ts.map +1 -0
  8. package/dist/agents/llm-call-policy.js +140 -0
  9. package/dist/agents/llm-call-policy.js.map +1 -0
  10. package/dist/builder/index.d.ts +1 -1
  11. package/dist/builder/index.d.ts.map +1 -1
  12. package/dist/builder/index.js.map +1 -1
  13. package/dist/client/index.d.ts +1 -1
  14. package/dist/client/index.d.ts.map +1 -1
  15. package/dist/client/types.d.ts +10 -2
  16. package/dist/client/types.d.ts.map +1 -1
  17. package/dist/client/workflow-client.d.ts.map +1 -1
  18. package/dist/client/workflow-client.js +8 -0
  19. package/dist/client/workflow-client.js.map +1 -1
  20. package/dist/connectors/builtin/steps/parallel.step.d.ts +4 -4
  21. package/dist/connectors/builtin/steps/wait-for-human.step.d.ts +7 -0
  22. package/dist/connectors/builtin/steps/wait-for-human.step.d.ts.map +1 -1
  23. package/dist/connectors/builtin/steps/wait-for-human.step.js +15 -0
  24. package/dist/connectors/builtin/steps/wait-for-human.step.js.map +1 -1
  25. package/dist/engine/workflow-executor.d.ts.map +1 -1
  26. package/dist/engine/workflow-executor.js +6 -0
  27. package/dist/engine/workflow-executor.js.map +1 -1
  28. package/dist/expression/recalc.d.ts +26 -0
  29. package/dist/expression/recalc.d.ts.map +1 -0
  30. package/dist/expression/recalc.js +62 -0
  31. package/dist/expression/recalc.js.map +1 -0
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/persistence/in-memory-adapter.d.ts +7 -0
  37. package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
  38. package/dist/persistence/in-memory-adapter.js +35 -2
  39. package/dist/persistence/in-memory-adapter.js.map +1 -1
  40. package/dist/persistence/types.d.ts +32 -1
  41. package/dist/persistence/types.d.ts.map +1 -1
  42. package/dist/router/workflow-router.d.ts.map +1 -1
  43. package/dist/router/workflow-router.js +19 -1
  44. package/dist/router/workflow-router.js.map +1 -1
  45. package/dist/runtime/workflow-runtime.d.ts +89 -4
  46. package/dist/runtime/workflow-runtime.d.ts.map +1 -1
  47. package/dist/runtime/workflow-runtime.js +176 -13
  48. package/dist/runtime/workflow-runtime.js.map +1 -1
  49. package/dist/types/audit-log.d.ts +55 -0
  50. package/dist/types/audit-log.d.ts.map +1 -0
  51. package/dist/types/audit-log.js +2 -0
  52. package/dist/types/audit-log.js.map +1 -0
  53. package/dist/types/index.d.ts +1 -1
  54. package/dist/types/index.d.ts.map +1 -1
  55. package/dist/types/index.js.map +1 -1
  56. package/dist/types/workflow-config.d.ts +56 -0
  57. package/dist/types/workflow-config.d.ts.map +1 -1
  58. package/dist/types/workflow-config.js +16 -0
  59. package/dist/types/workflow-config.js.map +1 -1
  60. package/dist/util/gate-assignees.d.ts +2 -0
  61. package/dist/util/gate-assignees.d.ts.map +1 -0
  62. package/dist/util/gate-assignees.js +14 -0
  63. package/dist/util/gate-assignees.js.map +1 -0
  64. package/dist/util/variable-ref.d.ts +3 -1
  65. package/dist/util/variable-ref.d.ts.map +1 -1
  66. package/dist/util/variable-ref.js +1 -1
  67. package/dist/util/variable-ref.js.map +1 -1
  68. package/dist/util/wait-audit.d.ts +9 -0
  69. package/dist/util/wait-audit.d.ts.map +1 -0
  70. package/dist/util/wait-audit.js +75 -0
  71. package/dist/util/wait-audit.js.map +1 -0
  72. package/package.json +1 -1
  73. package/dist/connectors/builtin/steps/compute.step.d.ts +0 -56
  74. package/dist/connectors/builtin/steps/compute.step.d.ts.map +0 -1
  75. package/dist/connectors/builtin/steps/compute.step.js +0 -48
  76. package/dist/connectors/builtin/steps/compute.step.js.map +0 -1
  77. package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts +0 -80
  78. package/dist/connectors/builtin/steps/wait-for-api-call.step.d.ts.map +0 -1
  79. package/dist/connectors/builtin/steps/wait-for-api-call.step.js +0 -104
  80. package/dist/connectors/builtin/steps/wait-for-api-call.step.js.map +0 -1
  81. package/dist/connectors/builtin/steps/wait.step.d.ts +0 -1087
  82. package/dist/connectors/builtin/steps/wait.step.d.ts.map +0 -1
  83. package/dist/connectors/builtin/steps/wait.step.js +0 -252
  84. package/dist/connectors/builtin/steps/wait.step.js.map +0 -1
  85. package/dist/conversational-flow/edit/followups.d.ts +0 -28
  86. package/dist/conversational-flow/edit/followups.d.ts.map +0 -1
  87. package/dist/conversational-flow/edit/followups.js +0 -103
  88. package/dist/conversational-flow/edit/followups.js.map +0 -1
  89. package/dist/util/computed-value.d.ts +0 -103
  90. package/dist/util/computed-value.d.ts.map +0 -1
  91. package/dist/util/computed-value.js +0 -453
  92. package/dist/util/computed-value.js.map +0 -1
  93. package/dist/util/expression-format.d.ts +0 -41
  94. package/dist/util/expression-format.d.ts.map +0 -1
  95. package/dist/util/expression-format.js +0 -84
  96. package/dist/util/expression-format.js.map +0 -1
  97. package/dist/util/expression-functions.d.ts +0 -35
  98. package/dist/util/expression-functions.d.ts.map +0 -1
  99. package/dist/util/expression-functions.js +0 -82
  100. package/dist/util/expression-functions.js.map +0 -1
  101. package/dist/util/expression.d.ts +0 -98
  102. package/dist/util/expression.d.ts.map +0 -1
  103. package/dist/util/expression.js +0 -395
  104. package/dist/util/expression.js.map +0 -1
  105. package/dist/util/jsonata-signatures.d.ts +0 -45
  106. package/dist/util/jsonata-signatures.d.ts.map +0 -1
  107. package/dist/util/jsonata-signatures.js +0 -113
  108. package/dist/util/jsonata-signatures.js.map +0 -1
  109. package/dist/util/signature.d.ts +0 -41
  110. package/dist/util/signature.d.ts.map +0 -1
  111. package/dist/util/signature.js +0 -124
  112. package/dist/util/signature.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"expression-functions.d.ts","sourceRoot":"","sources":["../../src/util/expression-functions.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,KAAK,EAAE,QAAQ,CAAC;IAChB;;;;OAIG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAkED,eAAO,MAAM,oBAAoB,EAAE,SAAS,kBAAkB,EAQ5D,CAAC;AAEH,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,EAAE,EAAE,kBAAkB,GAAG,QAAQ,CAExD;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAK/E"}
@@ -1,82 +0,0 @@
1
- /**
2
- * The operations a menu offers: a name, how to say it in plain language, and
3
- * the signature JSONata declares for it.
4
- *
5
- * `offer` is editorial — which kind of field an entry is *offered* for — and
6
- * may only narrow a menu, never refuse an expression. Checking is `signature`'s
7
- * job alone, and a test asserts the containment.
8
- *
9
- * No `jsonata` import: data plus a string parser.
10
- */
11
- import { builtinSignature } from './jsonata-signatures.js';
12
- import { paramAt, parseSignature } from './signature.js';
13
- /** Arithmetic, which JSONata writes as operators rather than functions. */
14
- const ARITHMETIC = [
15
- { name: 'add', infix: '+', declared: '<nn:n>', offer: 'number', label: 'Add', help: 'Add two numbers together.', template: '… + …' },
16
- { name: 'subtract', infix: '-', declared: '<nn:n>', offer: 'number', label: 'Subtract', help: 'Take one number off another.', template: '… - …' },
17
- { name: 'multiply', infix: '*', declared: '<nn:n>', offer: 'number', label: 'Multiply', help: 'Multiply two numbers.', template: '… * …' },
18
- { name: 'divide', infix: '/', declared: '<nn:n>', offer: 'number', label: 'Divide', help: 'Divide one number by another.', template: '… / …' },
19
- { name: 'remainder', infix: '%', declared: '<nn:n>', offer: 'number', label: 'Remainder', help: 'What is left over after dividing.', template: '… % …' },
20
- ];
21
- const DESCRIBED = [
22
- // ── Numbers ──
23
- { name: '$sum', offer: 'number', label: 'Sum', help: 'Add up a list of numbers.', template: '$sum(…)' },
24
- { name: '$count', offer: 'number', label: 'Count', help: 'How many items are in a list.', template: '$count(…)' },
25
- { name: '$average', offer: 'number', label: 'Average', help: 'The mean of a list of numbers.', template: '$average(…)' },
26
- { name: '$max', offer: 'number', label: 'Largest', help: 'The biggest number in a list.', template: '$max(…)' },
27
- { name: '$min', offer: 'number', label: 'Smallest', help: 'The smallest number in a list.', template: '$min(…)' },
28
- { name: '$round', offer: 'number', label: 'Round', help: 'Round to a number of decimal places.', template: '$round(…, 2)' },
29
- { name: '$floor', offer: 'number', label: 'Round down', help: 'Round down to a whole number.', template: '$floor(…)' },
30
- { name: '$ceil', offer: 'number', label: 'Round up', help: 'Round up to a whole number.', template: '$ceil(…)' },
31
- { name: '$abs', offer: 'number', label: 'Absolute', help: 'Drop the minus sign.', template: '$abs(…)' },
32
- // Really `string | number`, which this vocabulary cannot say — so `unknown`,
33
- { name: '$number', offer: 'number', label: 'As a number', help: 'Read text as a number.', template: '$number(…)' },
34
- { name: '$length', offer: 'number', label: 'Length', help: 'How many characters are in some text.', template: '$length(…)' },
35
- // ── Text ──
36
- { name: '$uppercase', offer: 'string', label: 'UPPERCASE', help: 'Put text in capitals.', template: '$uppercase(…)' },
37
- { name: '$lowercase', offer: 'string', label: 'lowercase', help: 'Put text in lower case.', template: '$lowercase(…)' },
38
- { name: '$trim', offer: 'string', label: 'Trim', help: 'Remove spaces from both ends.', template: '$trim(…)' },
39
- { name: '$join', offer: 'string', label: 'Join', help: 'Join a list into one piece of text.', template: '$join(…, ", ")' },
40
- { name: '$replace', offer: 'string', label: 'Replace', help: 'Swap one piece of text for another.', template: '$replace(…, "old", "new")' },
41
- { name: '$string', offer: 'string', label: 'As text', help: 'Turn any value into text.', template: '$string(…)' },
42
- // ── Lists ──
43
- { name: '$filter', offer: 'array', label: 'Keep only', help: 'Keep the items that match a test.', template: '$filter(…, function($item){ $item.amount > 0 })' },
44
- { name: '$map', offer: 'array', label: 'For each', help: 'Work out a value for every item.', template: '$map(…, function($item){ $item.amount })' },
45
- { name: '$sort', offer: 'array', label: 'Sort', help: 'Put a list in order.', template: '$sort(…)' },
46
- { name: '$reverse', offer: 'array', label: 'Reverse', help: 'Flip the order of a list.', template: '$reverse(…)' },
47
- { name: '$distinct', offer: 'array', label: 'Unique', help: 'Remove repeated items.', template: '$distinct(…)' },
48
- { name: '$append', offer: 'array', label: 'Add together', help: 'Join two lists into one.', template: '$append(…, …)' },
49
- { name: '$split', offer: 'array', label: 'Split', help: 'Break text into a list.', template: '$split(…, ", ")' },
50
- // ── Objects ──
51
- { name: '$keys', offer: 'array', label: 'Field names', help: 'The names of the fields on an object.', template: '$keys(…)' },
52
- { name: '$lookup', offer: 'unknown', label: 'Field value', help: 'Read one named field from an object.', template: '$lookup(…, "field")' },
53
- { name: '$merge', offer: 'object', label: 'Merge', help: 'Combine a list of objects into one.', template: '$merge(…)' },
54
- // ── True / false ──
55
- { name: '$exists', offer: 'boolean', label: 'Has a value', help: 'True when something is present.', template: '$exists(…)' },
56
- { name: '$contains', offer: 'boolean', label: 'Contains', help: 'True when text contains other text.', template: '$contains(…, "text")' },
57
- { name: '$not', offer: 'boolean', label: 'Not', help: 'Flip true to false and back.', template: '$not(…)' },
58
- ];
59
- /** A signature that checks nothing, for a name the table does not describe. */
60
- const UNCHECKED = { params: [], returns: 'unknown' };
61
- export const EXPRESSION_FUNCTIONS = [
62
- ...ARITHMETIC,
63
- ...DESCRIBED,
64
- ].map((entry) => {
65
- // A real builtin's own signature wins; `declared` covers the operators, which
66
- const definition = builtinSignature(entry.name) ?? entry.declared;
67
- const signature = definition === undefined ? null : parseSignature(definition);
68
- return { ...entry, signature: signature ?? UNCHECKED };
69
- });
70
- /** What this function's first argument takes — what a picker should offer. */
71
- export function takesOf(fn) {
72
- return paramAt(fn.signature, 0)?.type ?? 'unknown';
73
- }
74
- /** Look one up by call name (with or without the leading `$`). */
75
- export function expressionFunction(name) {
76
- const direct = EXPRESSION_FUNCTIONS.find((fn) => fn.name === name);
77
- if (direct)
78
- return direct;
79
- const withSigil = name.startsWith('$') ? name : `$${name}`;
80
- return EXPRESSION_FUNCTIONS.find((fn) => fn.name === withSigil);
81
- }
82
- //# sourceMappingURL=expression-functions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expression-functions.js","sourceRoot":"","sources":["../../src/util/expression-functions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAC;AAuCzE,2EAA2E;AAC3E,MAAM,UAAU,GAAyB;IACvC,EAAE,IAAI,EAAE,KAAK,EAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAQ,IAAI,EAAE,2BAA2B,EAAS,QAAQ,EAAE,OAAO,EAAE;IACtJ,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAA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at.js';
3
- /** Evaluation limits, applied at compile time and enforced by JSONata while evaluating. */
4
- export declare const EXPRESSION_LIMITS: {
5
- readonly timeout: 1000;
6
- readonly stack: 200;
7
- };
8
- /** Compile an expression source, memoized. */
9
- export declare function compileExpression(source: string): Expression;
10
- /** The parsed form of an expression, or null when it does not compile. */
11
- export declare function expressionAst(source: string): ExprNode | null;
12
- /** Drop every cached expression. For tests and long-idle hosts. */
13
- export declare function clearExpressionCache(): void;
14
- export type ExpressionFaultKind = 'syntax' | 'namedFunction' | 'eval' | 'unknownFunction';
15
- export interface ExpressionFault {
16
- kind: ExpressionFaultKind;
17
- /** Author-facing, already specific enough to show as-is. */
18
- message: string;
19
- /** 0-based offset into the expression source, when the parser gave one. */
20
- position?: number;
21
- }
22
- /**
23
- * Check an expression for anything that must never run, without evaluating it.
24
- * Returns the first fault, or null when the expression is safe to keep.
25
- *
26
- * Two things are refused:
27
- *
28
- * **Naming a function.** A `lambda` is allowed only as a direct argument to a
29
- * call — `$filter(xs, function($x){ ... })` — and nowhere else. That one rule is
30
- * what makes evaluation terminate: an expression can only loop by calling
31
- * itself, calling itself needs a name to call, and the only ways to get a name
32
- * are to bind a lambda (`$f := function…`), to stash one in an array or object,
33
- * or to apply a lambda literal to itself. Every one of those puts a `lambda`
34
- * somewhere other than an argument slot, so all of them are caught — verified
35
- * against each form. Inline predicates, which is what the list functions
36
- * actually need, are untouched, and so is naming a plain *value*
37
- * (`$total := $sum(…)`), which cannot recurse.
38
- *
39
- * **`$eval`.** It compiles a string as a new expression, which is the one hole
40
- * through which everything above could be re-introduced. Matched on the
41
- * variable name wherever it appears, so an alias (`$g := $eval`) or a reference
42
- * (`$map(xs, $eval)`) is caught too, not just a direct call. AWS blocks it in
43
- * their JSONata support for the same reason.
44
- *
45
- * **Unknown functions.** A name JSONata does not have, so that a typo is caught
46
- * while writing rather than at `T1006`. This was skipped at first on the belief
47
- * that the builtins could not be enumerated — they can: every name JSONata binds
48
- * resolves to an object carrying its own signature, and
49
- * `jsonata-signatures.ts` is generated from them. Checked after the two bans so
50
- * that `$f(0)` beside a named function reports the named function, which is the
51
- * more useful of the two complaints.
52
- *
53
- * Note this assumes nothing is registered beyond the builtins. If the engine
54
- * ever calls `registerFunction`, those names have to be known here too, or
55
- * correct expressions will be refused.
56
- */
57
- export declare function inspectExpression(source: string): ExpressionFault | null;
58
- /** Dotted context paths an expression reads, e.g. */
59
- export declare function refsInExpression(source: string): string[];
60
- export interface TypeFault {
61
- /** Author-facing, specific enough to show as-is. */
62
- message: string;
63
- /** 0-based offset into the expression source, when the parser gave one. */
64
- position?: number;
65
- }
66
- export interface InferredExpression {
67
- /** What the whole expression produces — `unknown` wherever it cannot be read. */
68
- type: ExprType;
69
- /** Arguments passed something their function cannot accept. */
70
- faults: TypeFault[];
71
- }
72
- /**
73
- * Work out what an expression produces, and what it misuses on the way.
74
- *
75
- * This is what makes the typing claim true *before* a run. Without it the
76
- * engine leans entirely on JSONata's own signature checks (`T0410`, `T0412`) and
77
- * on zod rejecting the result — both correct, both too late, and neither
78
- * visible while the workflow is being written.
79
- *
80
- * ## It is only ever allowed to be silent, never wrong
81
- *
82
- * Every node it cannot read yields `unknown`, which {@link assignableToArgument}
83
- * and {@link assignableToField} treat as compatible at any depth. A relative
84
- * path inside a predicate, a lambda parameter, a `$$`, a regex, an unrecognised
85
- * node from a future JSONata — all `unknown`. That asymmetry is deliberate: a
86
- * missed mistake costs a runtime error the author would have had anyway, while a
87
- * false one blocks a correct workflow from being saved. Expression typing is a
88
- * courtesy on top of a dynamically-checked language, not a gate.
89
- *
90
- * ## Where the types come from
91
- *
92
- * References resolve through `lookup`, which the caller supplies — the validator
93
- * reads JSON Schema, a test can hand over a map. This module never sees a
94
- * schema, for the same reason `type-compat` does not: the two schema worlds
95
- * (Zod here, JSON Schema across the wire) must not leak into the rule.
96
- */
97
- export declare function inferExpressionType(source: string, lookup: (path: string) => ExprType | undefined): InferredExpression;
98
- //# sourceMappingURL=expression.d.ts.map
@@ -1 +0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;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,GAC7C,kBAAkB,CAgJpB"}
@@ -1,395 +0,0 @@
1
- /**
2
- * The expression language: parse, inspect, type. The only module that imports
3
- * JSONata.
4
- *
5
- * Safety rests on two things. A `function(){}` literal is legal only as a
6
- * direct call argument, which removes every route to recursion, and `$eval` is
7
- * refused by name. `EXPRESSION_LIMITS` is the runtime guarantee behind both —
8
- * measured, not assumed: a long expression throws D1012 at the timeout.
9
- *
10
- * Typing is silent rather than wrong: anything unreadable is `unknown`, which
11
- * is a wildcard everywhere, so the checker never refuses a valid expression.
12
- */
13
- import jsonata from 'jsonata';
14
- import { EXPRESSION_ROOTS } from './expression-format.js';
15
- import { builtinSignature, isBuiltin } from './jsonata-signatures.js';
16
- import { paramAt, parseSignature } from './signature.js';
17
- import { assignableToArgument, baseKind, elementType, sayType, unify, } from './type-compat.js';
18
- // ─── Runtime limits ───
19
- /** Evaluation limits, applied at compile time and enforced by JSONata while evaluating. */
20
- export const EXPRESSION_LIMITS = { timeout: 1000, stack: 200 };
21
- // ─── Compilation (cached) ───
22
- /** Compiled-expression cache. */
23
- const CACHE_MAX = 500;
24
- const cache = new Map();
25
- /** Compile an expression source, memoized. */
26
- export function compileExpression(source) {
27
- const hit = cache.get(source);
28
- if (hit !== undefined) {
29
- // Re-insert so iteration order stays least-recently-used first.
30
- cache.delete(source);
31
- cache.set(source, hit);
32
- return hit;
33
- }
34
- const compiled = jsonata(source, EXPRESSION_LIMITS);
35
- if (cache.size >= CACHE_MAX) {
36
- const oldest = cache.keys().next();
37
- if (!oldest.done)
38
- cache.delete(oldest.value);
39
- }
40
- cache.set(source, compiled);
41
- return compiled;
42
- }
43
- /** The parsed form of an expression, or null when it does not compile. */
44
- export function expressionAst(source) {
45
- try {
46
- return compileExpression(source).ast();
47
- }
48
- catch {
49
- return null;
50
- }
51
- }
52
- /** Drop every cached expression. For tests and long-idle hosts. */
53
- export function clearExpressionCache() {
54
- cache.clear();
55
- }
56
- /**
57
- * Walk every node of an AST, flagging which ones sit directly in a call's argument list.
58
- */
59
- function walkAst(node, inArgumentList, visit) {
60
- if (node === null || typeof node !== 'object')
61
- return;
62
- if (Array.isArray(node)) {
63
- for (const item of node)
64
- walkAst(item, false, visit);
65
- return;
66
- }
67
- const record = node;
68
- visit(record, inArgumentList);
69
- const type = record['type'];
70
- for (const [key, value] of Object.entries(record)) {
71
- const isCallArguments = key === 'arguments' &&
72
- (type === 'function' || type === 'apply') &&
73
- Array.isArray(value);
74
- if (isCallArguments) {
75
- for (const argument of value)
76
- walkAst(argument, true, visit);
77
- }
78
- else {
79
- walkAst(value, false, visit);
80
- }
81
- }
82
- }
83
- /**
84
- * Check an expression for anything that must never run, without evaluating it.
85
- * Returns the first fault, or null when the expression is safe to keep.
86
- *
87
- * Two things are refused:
88
- *
89
- * **Naming a function.** A `lambda` is allowed only as a direct argument to a
90
- * call — `$filter(xs, function($x){ ... })` — and nowhere else. That one rule is
91
- * what makes evaluation terminate: an expression can only loop by calling
92
- * itself, calling itself needs a name to call, and the only ways to get a name
93
- * are to bind a lambda (`$f := function…`), to stash one in an array or object,
94
- * or to apply a lambda literal to itself. Every one of those puts a `lambda`
95
- * somewhere other than an argument slot, so all of them are caught — verified
96
- * against each form. Inline predicates, which is what the list functions
97
- * actually need, are untouched, and so is naming a plain *value*
98
- * (`$total := $sum(…)`), which cannot recurse.
99
- *
100
- * **`$eval`.** It compiles a string as a new expression, which is the one hole
101
- * through which everything above could be re-introduced. Matched on the
102
- * variable name wherever it appears, so an alias (`$g := $eval`) or a reference
103
- * (`$map(xs, $eval)`) is caught too, not just a direct call. AWS blocks it in
104
- * their JSONata support for the same reason.
105
- *
106
- * **Unknown functions.** A name JSONata does not have, so that a typo is caught
107
- * while writing rather than at `T1006`. This was skipped at first on the belief
108
- * that the builtins could not be enumerated — they can: every name JSONata binds
109
- * resolves to an object carrying its own signature, and
110
- * `jsonata-signatures.ts` is generated from them. Checked after the two bans so
111
- * that `$f(0)` beside a named function reports the named function, which is the
112
- * more useful of the two complaints.
113
- *
114
- * Note this assumes nothing is registered beyond the builtins. If the engine
115
- * ever calls `registerFunction`, those names have to be known here too, or
116
- * correct expressions will be refused.
117
- */
118
- export function inspectExpression(source) {
119
- let ast;
120
- try {
121
- ast = compileExpression(source).ast();
122
- }
123
- catch (err) {
124
- const error = err;
125
- return {
126
- kind: 'syntax',
127
- message: error.message ?? 'This expression could not be read.',
128
- ...(typeof error.position === 'number' ? { position: error.position } : {}),
129
- };
130
- }
131
- let fault = null;
132
- walkAst(ast, false, (node, inArgumentList) => {
133
- if (fault)
134
- return;
135
- const position = node['position'];
136
- const at = typeof position === 'number' ? { position } : {};
137
- if (node['type'] === 'variable' && node['value'] === 'eval') {
138
- fault = { kind: 'eval', message: '$eval is not available in expressions.', ...at };
139
- return;
140
- }
141
- if (node['type'] === 'lambda' && !inArgumentList) {
142
- fault = {
143
- kind: 'namedFunction',
144
- message: 'An expression cannot define a named function. Write the function directly where it is used, as in $filter(items, function($i){ $i.amount > 10 }).',
145
- ...at,
146
- };
147
- }
148
- });
149
- if (fault)
150
- return fault;
151
- // A second pass, so a banned construct is reported before a name that only
152
- walkAst(ast, false, (node) => {
153
- if (fault || node['type'] !== 'function')
154
- return;
155
- const procedure = node['procedure'];
156
- if (procedure === null || typeof procedure !== 'object')
157
- return;
158
- const name = procedure['value'];
159
- if (typeof name !== 'string' || isBuiltin(name))
160
- return;
161
- const position = procedure['position'];
162
- fault = {
163
- kind: 'unknownFunction',
164
- message: `$${name} is not a function.`,
165
- ...(typeof position === 'number' ? { position } : {}),
166
- };
167
- });
168
- return fault;
169
- }
170
- // ─── References inside an expression ───
171
- const ROOTS = new Set(EXPRESSION_ROOTS);
172
- /** Dotted context paths an expression reads, e.g. */
173
- export function refsInExpression(source) {
174
- let ast;
175
- try {
176
- ast = compileExpression(source).ast();
177
- }
178
- catch {
179
- return [];
180
- }
181
- const found = [];
182
- walkAst(ast, false, (node) => {
183
- if (node['type'] !== 'path')
184
- return;
185
- const steps = node['steps'];
186
- if (!Array.isArray(steps) || steps.length === 0)
187
- return;
188
- const names = [];
189
- for (const step of steps) {
190
- if (step === null || typeof step !== 'object')
191
- return;
192
- const record = step;
193
- if (record['type'] !== 'name' || typeof record['value'] !== 'string')
194
- return;
195
- names.push(record['value']);
196
- }
197
- if (!ROOTS.has(names[0]))
198
- return;
199
- const path = names.join('.');
200
- if (!found.includes(path))
201
- found.push(path);
202
- });
203
- return found;
204
- }
205
- /** Arithmetic that only makes sense on numbers. */
206
- const NUMERIC_OPERATORS = new Set(['+', '-', '*', '/', '%']);
207
- /** Comparisons and tests, whatever they are given. */
208
- const BOOLEAN_OPERATORS = new Set(['=', '!=', '<', '<=', '>', '>=', 'in', 'and', 'or']);
209
- function at(node) {
210
- const position = node['position'];
211
- return typeof position === 'number' ? { position } : {};
212
- }
213
- /** The dotted path a `path` node names, or null when it is not a plain one. */
214
- function dottedPath(node) {
215
- const steps = node['steps'];
216
- if (!Array.isArray(steps) || steps.length === 0)
217
- return null;
218
- const names = [];
219
- for (const step of steps) {
220
- if (step === null || typeof step !== 'object')
221
- return null;
222
- const record = step;
223
- if (record['type'] !== 'name' || typeof record['value'] !== 'string')
224
- return null;
225
- names.push(record['value']);
226
- }
227
- return ROOTS.has(names[0]) ? names.join('.') : null;
228
- }
229
- /**
230
- * Work out what an expression produces, and what it misuses on the way.
231
- *
232
- * This is what makes the typing claim true *before* a run. Without it the
233
- * engine leans entirely on JSONata's own signature checks (`T0410`, `T0412`) and
234
- * on zod rejecting the result — both correct, both too late, and neither
235
- * visible while the workflow is being written.
236
- *
237
- * ## It is only ever allowed to be silent, never wrong
238
- *
239
- * Every node it cannot read yields `unknown`, which {@link assignableToArgument}
240
- * and {@link assignableToField} treat as compatible at any depth. A relative
241
- * path inside a predicate, a lambda parameter, a `$$`, a regex, an unrecognised
242
- * node from a future JSONata — all `unknown`. That asymmetry is deliberate: a
243
- * missed mistake costs a runtime error the author would have had anyway, while a
244
- * false one blocks a correct workflow from being saved. Expression typing is a
245
- * courtesy on top of a dynamically-checked language, not a gate.
246
- *
247
- * ## Where the types come from
248
- *
249
- * References resolve through `lookup`, which the caller supplies — the validator
250
- * reads JSON Schema, a test can hand over a map. This module never sees a
251
- * schema, for the same reason `type-compat` does not: the two schema worlds
252
- * (Zod here, JSON Schema across the wire) must not leak into the rule.
253
- */
254
- export function inferExpressionType(source, lookup) {
255
- let ast;
256
- try {
257
- ast = compileExpression(source).ast();
258
- }
259
- catch {
260
- return { type: 'unknown', faults: [] };
261
- }
262
- const faults = [];
263
- const infer = (value) => {
264
- if (value === null || typeof value !== 'object' || Array.isArray(value))
265
- return 'unknown';
266
- const node = value;
267
- switch (node['type']) {
268
- case 'number':
269
- return 'number';
270
- case 'string':
271
- return 'string';
272
- case 'value':
273
- // `true` / `false` / `null`; only the first two have a type worth saying.
274
- return node['value'] === null ? 'unknown' : 'boolean';
275
- case 'path': {
276
- const path = dottedPath(node);
277
- return path === null ? 'unknown' : (lookup(path) ?? 'unknown');
278
- }
279
- case 'unary': {
280
- if (node['value'] === '[') {
281
- const items = node['expressions'];
282
- if (!Array.isArray(items))
283
- return 'array';
284
- // JSONata flattens: `[theList]` is `theList`, and `[1..5]` is a flat
285
- const inner = unify(items.map((item) => {
286
- const type = infer(item);
287
- return baseKind(type) === 'array' ? elementType(type) : type;
288
- }));
289
- return inner === 'unknown' ? 'array' : { array: inner };
290
- }
291
- if (node['value'] === '{')
292
- return 'object';
293
- if (node['value'] === '-')
294
- return 'number';
295
- return 'unknown';
296
- }
297
- case 'binary': {
298
- const op = node['value'];
299
- if (typeof op !== 'string')
300
- return 'unknown';
301
- if (op === '..')
302
- return { array: 'number' };
303
- if (op === '&')
304
- return 'string';
305
- if (BOOLEAN_OPERATORS.has(op)) {
306
- infer(node['lhs']);
307
- infer(node['rhs']);
308
- return 'boolean';
309
- }
310
- if (NUMERIC_OPERATORS.has(op)) {
311
- for (const side of ['lhs', 'rhs']) {
312
- const operand = infer(node[side]);
313
- if (!assignableToArgument(operand, 'number')) {
314
- faults.push({
315
- message: `"${op}" needs numbers, but one side is ${sayType(operand)}.`,
316
- ...at(node),
317
- });
318
- }
319
- }
320
- return 'number';
321
- }
322
- return 'unknown';
323
- }
324
- case 'condition':
325
- return unify([infer(node['then']), infer(node['else'])]);
326
- case 'block': {
327
- const parts = node['expressions'];
328
- if (!Array.isArray(parts) || parts.length === 0)
329
- return 'unknown';
330
- // Every part runs, but only the last one is the answer.
331
- for (const part of parts.slice(0, -1))
332
- infer(part);
333
- return infer(parts[parts.length - 1]);
334
- }
335
- case 'apply': {
336
- // `a ~> $sum()` — the left side becomes the call's first argument.
337
- const rhs = node['rhs'];
338
- const piped = infer(node['lhs']);
339
- if (rhs === null || typeof rhs !== 'object')
340
- return 'unknown';
341
- const record = rhs;
342
- if (record['type'] === 'variable') {
343
- return callType({ procedure: record, arguments: [] }, piped);
344
- }
345
- return callType(record, piped);
346
- }
347
- case 'function':
348
- case 'partial':
349
- return callType(node, undefined);
350
- default:
351
- // `lambda`, `variable`, `bind`, `regex`, `wildcard`, `descendant`,
352
- return 'unknown';
353
- }
354
- };
355
- /**
356
- * A call's result, with every argument checked against the signature JSONata publishes for it.
357
- */
358
- const callType = (node, piped) => {
359
- const procedure = node['procedure'];
360
- const name = procedure !== null && typeof procedure === 'object'
361
- ? procedure['value']
362
- : undefined;
363
- if (typeof name !== 'string')
364
- return 'unknown';
365
- const args = Array.isArray(node['arguments']) ? node['arguments'] : [];
366
- // Walk every argument so faults inside them are still reported, but give a
367
- const argTypes = args.map((argument) => {
368
- const record = argument;
369
- if (record !== null && typeof record === 'object' && record['type'] === 'lambda') {
370
- return 'unknown';
371
- }
372
- return infer(argument);
373
- });
374
- const definition = builtinSignature(name);
375
- const signature = definition === undefined ? null : parseSignature(definition);
376
- if (signature === null)
377
- return 'unknown'; // unknown name, or notation we cannot read
378
- const supplied = piped === undefined ? argTypes : [piped, ...argTypes];
379
- supplied.forEach((type, index) => {
380
- const param = paramAt(signature, index);
381
- if (param === undefined)
382
- return;
383
- if (assignableToArgument(type, param.type))
384
- return;
385
- const which = supplied.length > 1 ? ` for argument ${String(index + 1)}` : '';
386
- faults.push({
387
- message: `$${name} needs ${sayType(param.type)}${which}, but this is ${sayType(type)}.`,
388
- ...at(node),
389
- });
390
- });
391
- return signature.returns;
392
- };
393
- return { type: infer(ast), faults };
394
- }
395
- //# sourceMappingURL=expression.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expression.js","sourceRoot":"","sources":["../../src/util/expression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,OAAO,EACP,KAAK,GAEN,MAAM,kBAAkB,CAAC;AAE1B,yBAAyB;AAEzB,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAW,CAAC;AAExE,+BAA+B;AAE/B,iCAAiC;AACjC,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE5C,8CAA8C;AAC9C,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,gEAAgE;QAChE,KAAK,CAAC,MAAM,CAAC,M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