@shipfox/expression 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/dist/evaluator/errors.d.ts +8 -0
  4. package/dist/evaluator/errors.d.ts.map +1 -0
  5. package/dist/evaluator/errors.js +13 -0
  6. package/dist/evaluator/errors.js.map +1 -0
  7. package/dist/evaluator/evaluate-workflow-expression.d.ts +11 -0
  8. package/dist/evaluator/evaluate-workflow-expression.d.ts.map +1 -0
  9. package/dist/evaluator/evaluate-workflow-expression.js +30 -0
  10. package/dist/evaluator/evaluate-workflow-expression.js.map +1 -0
  11. package/dist/evaluator/index.d.ts +3 -0
  12. package/dist/evaluator/index.d.ts.map +1 -0
  13. package/dist/evaluator/index.js +4 -0
  14. package/dist/evaluator/index.js.map +1 -0
  15. package/dist/expression/create-workflow-expression.d.ts +7 -0
  16. package/dist/expression/create-workflow-expression.d.ts.map +1 -0
  17. package/dist/expression/create-workflow-expression.js +156 -0
  18. package/dist/expression/create-workflow-expression.js.map +1 -0
  19. package/dist/expression/errors.d.ts +12 -0
  20. package/dist/expression/errors.d.ts.map +1 -0
  21. package/dist/expression/errors.js +13 -0
  22. package/dist/expression/errors.js.map +1 -0
  23. package/dist/expression/index.d.ts +4 -0
  24. package/dist/expression/index.d.ts.map +1 -0
  25. package/dist/expression/index.js +4 -0
  26. package/dist/expression/index.js.map +1 -0
  27. package/dist/expression/workflow-expression.d.ts +33 -0
  28. package/dist/expression/workflow-expression.d.ts.map +1 -0
  29. package/dist/expression/workflow-expression.js +3 -0
  30. package/dist/expression/workflow-expression.js.map +1 -0
  31. package/dist/index.d.ts +27 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +25 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/outputs/index.d.ts +2 -0
  36. package/dist/outputs/index.d.ts.map +1 -0
  37. package/dist/outputs/index.js +3 -0
  38. package/dist/outputs/index.js.map +1 -0
  39. package/dist/outputs/output-declarations.d.ts +39 -0
  40. package/dist/outputs/output-declarations.d.ts.map +1 -0
  41. package/dist/outputs/output-declarations.js +295 -0
  42. package/dist/outputs/output-declarations.js.map +1 -0
  43. package/dist/plan/bare-reference.d.ts +2 -0
  44. package/dist/plan/bare-reference.d.ts.map +1 -0
  45. package/dist/plan/bare-reference.js +23 -0
  46. package/dist/plan/bare-reference.js.map +1 -0
  47. package/dist/plan/context-key-access.d.ts +25 -0
  48. package/dist/plan/context-key-access.d.ts.map +1 -0
  49. package/dist/plan/context-key-access.js +249 -0
  50. package/dist/plan/context-key-access.js.map +1 -0
  51. package/dist/plan/evaluate-planned-predicate.d.ts +14 -0
  52. package/dist/plan/evaluate-planned-predicate.d.ts.map +1 -0
  53. package/dist/plan/evaluate-planned-predicate.js +31 -0
  54. package/dist/plan/evaluate-planned-predicate.js.map +1 -0
  55. package/dist/plan/evaluation-trace.d.ts +44 -0
  56. package/dist/plan/evaluation-trace.d.ts.map +1 -0
  57. package/dist/plan/evaluation-trace.js +95 -0
  58. package/dist/plan/evaluation-trace.js.map +1 -0
  59. package/dist/plan/extract-exact-context-roots.d.ts +2 -0
  60. package/dist/plan/extract-exact-context-roots.d.ts.map +1 -0
  61. package/dist/plan/extract-exact-context-roots.js +114 -0
  62. package/dist/plan/extract-exact-context-roots.js.map +1 -0
  63. package/dist/plan/fill.d.ts +3 -0
  64. package/dist/plan/fill.d.ts.map +1 -0
  65. package/dist/plan/fill.js +8 -0
  66. package/dist/plan/fill.js.map +1 -0
  67. package/dist/plan/freeze-run-command.d.ts +17 -0
  68. package/dist/plan/freeze-run-command.d.ts.map +1 -0
  69. package/dist/plan/freeze-run-command.js +33 -0
  70. package/dist/plan/freeze-run-command.js.map +1 -0
  71. package/dist/plan/freeze.d.ts +48 -0
  72. package/dist/plan/freeze.d.ts.map +1 -0
  73. package/dist/plan/freeze.js +148 -0
  74. package/dist/plan/freeze.js.map +1 -0
  75. package/dist/plan/plan-field.d.ts +26 -0
  76. package/dist/plan/plan-field.d.ts.map +1 -0
  77. package/dist/plan/plan-field.js +63 -0
  78. package/dist/plan/plan-field.js.map +1 -0
  79. package/dist/plan/predicate-shape.d.ts +2 -0
  80. package/dist/plan/predicate-shape.d.ts.map +1 -0
  81. package/dist/plan/predicate-shape.js +45 -0
  82. package/dist/plan/predicate-shape.js.map +1 -0
  83. package/dist/plan/resolved-field.d.ts +17 -0
  84. package/dist/plan/resolved-field.d.ts.map +1 -0
  85. package/dist/plan/resolved-field.js +3 -0
  86. package/dist/plan/resolved-field.js.map +1 -0
  87. package/dist/plan/route-expression.d.ts +9 -0
  88. package/dist/plan/route-expression.d.ts.map +1 -0
  89. package/dist/plan/route-expression.js +46 -0
  90. package/dist/plan/route-expression.js.map +1 -0
  91. package/dist/plan/validate-server-evaluable.d.ts +14 -0
  92. package/dist/plan/validate-server-evaluable.d.ts.map +1 -0
  93. package/dist/plan/validate-server-evaluable.js +20 -0
  94. package/dist/plan/validate-server-evaluable.js.map +1 -0
  95. package/dist/resolver/coerce-workflow-value-to-string.d.ts +2 -0
  96. package/dist/resolver/coerce-workflow-value-to-string.d.ts.map +1 -0
  97. package/dist/resolver/coerce-workflow-value-to-string.js +16 -0
  98. package/dist/resolver/coerce-workflow-value-to-string.js.map +1 -0
  99. package/dist/resolver/errors.d.ts +10 -0
  100. package/dist/resolver/errors.d.ts.map +1 -0
  101. package/dist/resolver/errors.js +12 -0
  102. package/dist/resolver/errors.js.map +1 -0
  103. package/dist/run/hoist-run-command.d.ts +33 -0
  104. package/dist/run/hoist-run-command.d.ts.map +1 -0
  105. package/dist/run/hoist-run-command.js +79 -0
  106. package/dist/run/hoist-run-command.js.map +1 -0
  107. package/dist/run/shell-quoting.d.ts +24 -0
  108. package/dist/run/shell-quoting.d.ts.map +1 -0
  109. package/dist/run/shell-quoting.js +364 -0
  110. package/dist/run/shell-quoting.js.map +1 -0
  111. package/dist/template/errors.d.ts +14 -0
  112. package/dist/template/errors.d.ts.map +1 -0
  113. package/dist/template/errors.js +14 -0
  114. package/dist/template/errors.js.map +1 -0
  115. package/dist/template/extract-cel-context-roots.d.ts +2 -0
  116. package/dist/template/extract-cel-context-roots.d.ts.map +1 -0
  117. package/dist/template/extract-cel-context-roots.js +110 -0
  118. package/dist/template/extract-cel-context-roots.js.map +1 -0
  119. package/dist/template/extract-cel-untrusted-path-accesses.d.ts +5 -0
  120. package/dist/template/extract-cel-untrusted-path-accesses.d.ts.map +1 -0
  121. package/dist/template/extract-cel-untrusted-path-accesses.js +140 -0
  122. package/dist/template/extract-cel-untrusted-path-accesses.js.map +1 -0
  123. package/dist/template/parse-workflow-template.d.ts +3 -0
  124. package/dist/template/parse-workflow-template.d.ts.map +1 -0
  125. package/dist/template/parse-workflow-template.js +111 -0
  126. package/dist/template/parse-workflow-template.js.map +1 -0
  127. package/dist/template/scan-cel-token.d.ts +3 -0
  128. package/dist/template/scan-cel-token.d.ts.map +1 -0
  129. package/dist/template/scan-cel-token.js +55 -0
  130. package/dist/template/scan-cel-token.js.map +1 -0
  131. package/dist/template/template-segment.d.ts +12 -0
  132. package/dist/template/template-segment.d.ts.map +1 -0
  133. package/dist/template/template-segment.js +3 -0
  134. package/dist/template/template-segment.js.map +1 -0
  135. package/dist/tsconfig.test.tsbuildinfo +1 -0
  136. package/dist/workflow-context/workflow-context.d.ts +458 -0
  137. package/dist/workflow-context/workflow-context.d.ts.map +1 -0
  138. package/dist/workflow-context/workflow-context.js +664 -0
  139. package/dist/workflow-context/workflow-context.js.map +1 -0
  140. package/package.json +49 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shipfox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Expression
2
+
3
+ CEL checks and run-time evaluation for Shipfox workflow expressions.
4
+
5
+ ## What it does
6
+
7
+ - **`createWorkflowExpression`**: Checks source text in `syntax` or `typed`
8
+ mode.
9
+ - **`WorkflowExpression`**: Stores the CEL tag, source, and check level.
10
+ - **`ExpressionTypeEnvironment`**: Lists names and field types for typed checks.
11
+ - **`evaluateWorkflowExpression`**: Runs a checked value against caller data.
12
+ - **`evaluateWorkflowPredicate`**: Returns `true` only for the boolean `true`.
13
+ - **`parseWorkflowTemplate`**: Splits strings with `${{ ... }}` spans into
14
+ ordered literal and expression segments.
15
+ - **`extractCelContextRoots`**: Returns the sorted top-level CEL identifiers mentioned
16
+ by an expression for downstream context and trust checks.
17
+ - **Typed errors**: Reports bad text and run failures with stable error classes.
18
+ - **`workflowContextDefinitions`**: Names the workflow contexts (`run`,
19
+ `trigger`, `event`, `inputs`, `job`, `executions`, `execution`, `jobs`, `step`) and
20
+ gives each a shape, trust tier, availability site, sensitivity, and host.
21
+ Known-shape contexts ship a typed environment; open ones use `syntax`.
22
+ - **`workflowInterpolationFieldPolicies`**: Says which trust tier each
23
+ interpolatable field accepts, and whether its value needs sanitizing before
24
+ display. Use `workflowInterpolationFieldAcceptsContext` and
25
+ `workflowInterpolationFieldAcceptsTrustTier` to run those checks.
26
+
27
+ Use this package where workflow code accepts or runs expression text. It keeps
28
+ the CEL parser behind a Shipfox API. Other packages do not need to depend on the
29
+ vendor parser.
30
+
31
+ Call it near the place where a person, file, or tool gives us text. If the text
32
+ is wrong, stop there and show the error near that field. If the text is good,
33
+ save the small value this package returns. Later, pass that value and plain data
34
+ back to this package to get the result for one run.
35
+
36
+ ## Installation / Setup
37
+
38
+ ```sh
39
+ pnpm add @shipfox/expression
40
+ ```
41
+
42
+ ## Usage
43
+
44
+ ```ts
45
+ import {
46
+ createWorkflowExpression,
47
+ evaluateWorkflowPredicate,
48
+ } from '@shipfox/expression';
49
+
50
+ const expression = createWorkflowExpression({
51
+ source: 'event.conclusion == "success"',
52
+ check: {
53
+ mode: 'typed',
54
+ typeEnvironment: {
55
+ event: {kind: 'object', fields: {conclusion: 'string'}},
56
+ },
57
+ },
58
+ });
59
+
60
+ const passed = evaluateWorkflowPredicate(expression, {
61
+ event: {conclusion: 'success'},
62
+ });
63
+ ```
64
+
65
+ ## Behavior Notes
66
+
67
+ - Use `syntax` when fields are not known yet.
68
+ - Use `typed` when the caller knows the names and field types in scope.
69
+ - Treat the `event`, `inputs`, and open `jobs` contexts as untrusted.
70
+ Interpolation field policies decide what untrusted data may reach each field.
71
+ - Evaluation is deterministic and has no side effects.
72
+ - The caller must pass values that match the checked data shape.
73
+ - The evaluator does not read secrets, database rows, events, files, or external
74
+ services.
75
+ - Template parsing throws only `InvalidWorkflowTemplateError`. The error includes
76
+ the full source, the span `offset`, and a reason; invalid inner CEL is wrapped
77
+ with the inner expression error available as `cause`.
78
+ - Write a literal `${{` in template text as `$${{`. The escape is greedy from
79
+ left to right, so `$$${{` emits literal `$${{`; there is no separate way to
80
+ write literal `$$` immediately before a real expression opener.
81
+ Put the dollar inside the expression when it must be dynamic, such as
82
+ `${{ "$" + string(inputs.amount) }}`.
83
+ - Template closing scans are string-aware, line-comment-aware, and brace-aware,
84
+ so `}}` inside CEL strings, `//` comments, or map literals does not close the
85
+ expression span.
86
+ - Context root extraction fails closed for trust decisions. It skips only identifiers
87
+ that are provably not context roots and may over-include comprehension variables or
88
+ struct keys; downstream code maps context roots to the known workflow contexts.
89
+ - Run command interpolation hoists expression values into generated environment
90
+ variables and references them through double-quoted shell expansion. This keeps
91
+ interpolated values from being parsed as shell syntax, but it does not make
92
+ commands and shell positions that deliberately re-evaluate their arguments
93
+ safe, such as `eval`, `sh -c "$value"`, `let`, `declare -i`, arithmetic
94
+ expressions, or array subscripts like `array[$value]`.
95
+ Trigger filters can use `syntax` while integration event payloads are still open.
96
+ Gate expressions can use `typed` because their local fields are known.
97
+
98
+ The stored value does not include vendor ASTs, checked data, protobuf bytes, or
99
+ compiled objects. It stores only the CEL tag, source, and check level.
100
+
101
+ Keep this package free of state. Code that needs a database row, event payload,
102
+ secret, file, or network call must load that data first. Then it can pass the
103
+ data in one object. This keeps tests small and makes each run easy to reason
104
+ about.
105
+
106
+ ## Development
107
+
108
+ ```sh
109
+ turbo build --filter=@shipfox/expression
110
+ turbo check --filter=@shipfox/expression
111
+ turbo type --filter=@shipfox/expression
112
+ turbo test --filter=@shipfox/expression
113
+ ```
114
+
115
+ ## License
116
+
117
+ MIT
@@ -0,0 +1,8 @@
1
+ export declare const workflowExpressionEvaluationErrorCode = "workflow-expression-evaluation-failed";
2
+ export type WorkflowExpressionEvaluationFailureReason = 'missing-path' | 'evaluation-error';
3
+ export declare class WorkflowExpressionEvaluationError extends Error {
4
+ readonly code = "workflow-expression-evaluation-failed";
5
+ readonly reason: WorkflowExpressionEvaluationFailureReason;
6
+ constructor(cause: unknown);
7
+ }
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/evaluator/errors.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qCAAqC,0CAA0C,CAAC;AAE7F,MAAM,MAAM,yCAAyC,GAAG,cAAc,GAAG,kBAAkB,CAAC;AAE5F,qBAAa,iCAAkC,SAAQ,KAAK;IAC1D,QAAQ,CAAC,IAAI,2CAAyC;IACtD,QAAQ,CAAC,MAAM,EAAE,yCAAyC,CAAC;gBAE/C,KAAK,EAAE,OAAO;CAS3B"}
@@ -0,0 +1,13 @@
1
+ import { EvaluationError } from '@marcbachmann/cel-js';
2
+ export const workflowExpressionEvaluationErrorCode = 'workflow-expression-evaluation-failed';
3
+ export class WorkflowExpressionEvaluationError extends Error {
4
+ constructor(cause){
5
+ super('Workflow expression evaluation failed', {
6
+ cause
7
+ }), this.code = workflowExpressionEvaluationErrorCode;
8
+ this.name = 'WorkflowExpressionEvaluationError';
9
+ this.reason = cause instanceof EvaluationError && (cause.code === 'no_such_key' || cause.code === 'unknown_variable') ? 'missing-path' : 'evaluation-error';
10
+ }
11
+ }
12
+
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/evaluator/errors.ts"],"sourcesContent":["import {EvaluationError} from '@marcbachmann/cel-js';\n\nexport const workflowExpressionEvaluationErrorCode = 'workflow-expression-evaluation-failed';\n\nexport type WorkflowExpressionEvaluationFailureReason = 'missing-path' | 'evaluation-error';\n\nexport class WorkflowExpressionEvaluationError extends Error {\n readonly code = workflowExpressionEvaluationErrorCode;\n readonly reason: WorkflowExpressionEvaluationFailureReason;\n\n constructor(cause: unknown) {\n super('Workflow expression evaluation failed', {cause});\n this.name = 'WorkflowExpressionEvaluationError';\n this.reason =\n cause instanceof EvaluationError &&\n (cause.code === 'no_such_key' || cause.code === 'unknown_variable')\n ? 'missing-path'\n : 'evaluation-error';\n }\n}\n"],"names":["EvaluationError","workflowExpressionEvaluationErrorCode","WorkflowExpressionEvaluationError","Error","cause","code","name","reason"],"mappings":"AAAA,SAAQA,eAAe,QAAO,uBAAuB;AAErD,OAAO,MAAMC,wCAAwC,wCAAwC;AAI7F,OAAO,MAAMC,0CAA0CC;IAIrD,YAAYC,KAAc,CAAE;QAC1B,KAAK,CAAC,yCAAyC;YAACA;QAAK,SAJ9CC,OAAOJ;QAKd,IAAI,CAACK,IAAI,GAAG;QACZ,IAAI,CAACC,MAAM,GACTH,iBAAiBJ,mBAChBI,CAAAA,MAAMC,IAAI,KAAK,iBAAiBD,MAAMC,IAAI,KAAK,kBAAiB,IAC7D,iBACA;IACR;AACF"}
@@ -0,0 +1,11 @@
1
+ import type { WorkflowExpression } from '../expression/workflow-expression.js';
2
+ export type WorkflowExpressionEvaluationContext = Readonly<Record<string, unknown>>;
3
+ export type WorkflowExpressionEvaluationValue = unknown;
4
+ export declare function evaluateWorkflowExpression(expression: WorkflowExpression, context: WorkflowExpressionEvaluationContext): WorkflowExpressionEvaluationValue;
5
+ export declare function evaluateWorkflowPredicate(expression: WorkflowExpression, context: WorkflowExpressionEvaluationContext): boolean;
6
+ export interface FailClosedPredicateOutcome {
7
+ readonly value: boolean;
8
+ readonly evaluationFailed: boolean;
9
+ }
10
+ export declare function evaluateWorkflowPredicateFailClosed(expression: WorkflowExpression, context: WorkflowExpressionEvaluationContext): FailClosedPredicateOutcome;
11
+ //# sourceMappingURL=evaluate-workflow-expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate-workflow-expression.d.ts","sourceRoot":"","sources":["../../src/evaluator/evaluate-workflow-expression.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AAG7E,MAAM,MAAM,mCAAmC,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AACpF,MAAM,MAAM,iCAAiC,GAAG,OAAO,CAAC;AAExD,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,mCAAmC,GAC3C,iCAAiC,CAMnC;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAET;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;CACpC;AAED,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,kBAAkB,EAC9B,OAAO,EAAE,mCAAmC,GAC3C,0BAA0B,CAS5B"}
@@ -0,0 +1,30 @@
1
+ import { evaluate } from '@marcbachmann/cel-js';
2
+ import { WorkflowExpressionEvaluationError } from './errors.js';
3
+ export function evaluateWorkflowExpression(expression, context) {
4
+ try {
5
+ return evaluate(expression.source, context);
6
+ } catch (error) {
7
+ throw new WorkflowExpressionEvaluationError(error);
8
+ }
9
+ }
10
+ export function evaluateWorkflowPredicate(expression, context) {
11
+ return evaluateWorkflowExpression(expression, context) === true;
12
+ }
13
+ export function evaluateWorkflowPredicateFailClosed(expression, context) {
14
+ try {
15
+ return {
16
+ value: evaluateWorkflowPredicate(expression, context),
17
+ evaluationFailed: false
18
+ };
19
+ } catch (error) {
20
+ if (error instanceof WorkflowExpressionEvaluationError) {
21
+ return {
22
+ value: false,
23
+ evaluationFailed: true
24
+ };
25
+ }
26
+ throw error;
27
+ }
28
+ }
29
+
30
+ //# sourceMappingURL=evaluate-workflow-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/evaluator/evaluate-workflow-expression.ts"],"sourcesContent":["import {evaluate} from '@marcbachmann/cel-js';\nimport type {WorkflowExpression} from '../expression/workflow-expression.js';\nimport {WorkflowExpressionEvaluationError} from './errors.js';\n\nexport type WorkflowExpressionEvaluationContext = Readonly<Record<string, unknown>>;\nexport type WorkflowExpressionEvaluationValue = unknown;\n\nexport function evaluateWorkflowExpression(\n expression: WorkflowExpression,\n context: WorkflowExpressionEvaluationContext,\n): WorkflowExpressionEvaluationValue {\n try {\n return evaluate(expression.source, context);\n } catch (error) {\n throw new WorkflowExpressionEvaluationError(error);\n }\n}\n\nexport function evaluateWorkflowPredicate(\n expression: WorkflowExpression,\n context: WorkflowExpressionEvaluationContext,\n): boolean {\n return evaluateWorkflowExpression(expression, context) === true;\n}\n\nexport interface FailClosedPredicateOutcome {\n readonly value: boolean;\n readonly evaluationFailed: boolean;\n}\n\nexport function evaluateWorkflowPredicateFailClosed(\n expression: WorkflowExpression,\n context: WorkflowExpressionEvaluationContext,\n): FailClosedPredicateOutcome {\n try {\n return {value: evaluateWorkflowPredicate(expression, context), evaluationFailed: false};\n } catch (error) {\n if (error instanceof WorkflowExpressionEvaluationError) {\n return {value: false, evaluationFailed: true};\n }\n throw error;\n }\n}\n"],"names":["evaluate","WorkflowExpressionEvaluationError","evaluateWorkflowExpression","expression","context","source","error","evaluateWorkflowPredicate","evaluateWorkflowPredicateFailClosed","value","evaluationFailed"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,uBAAuB;AAE9C,SAAQC,iCAAiC,QAAO,cAAc;AAK9D,OAAO,SAASC,2BACdC,UAA8B,EAC9BC,OAA4C;IAE5C,IAAI;QACF,OAAOJ,SAASG,WAAWE,MAAM,EAAED;IACrC,EAAE,OAAOE,OAAO;QACd,MAAM,IAAIL,kCAAkCK;IAC9C;AACF;AAEA,OAAO,SAASC,0BACdJ,UAA8B,EAC9BC,OAA4C;IAE5C,OAAOF,2BAA2BC,YAAYC,aAAa;AAC7D;AAOA,OAAO,SAASI,oCACdL,UAA8B,EAC9BC,OAA4C;IAE5C,IAAI;QACF,OAAO;YAACK,OAAOF,0BAA0BJ,YAAYC;YAAUM,kBAAkB;QAAK;IACxF,EAAE,OAAOJ,OAAO;QACd,IAAIA,iBAAiBL,mCAAmC;YACtD,OAAO;gBAACQ,OAAO;gBAAOC,kBAAkB;YAAI;QAC9C;QACA,MAAMJ;IACR;AACF"}
@@ -0,0 +1,3 @@
1
+ export { WorkflowExpressionEvaluationError, type WorkflowExpressionEvaluationFailureReason, workflowExpressionEvaluationErrorCode, } from './errors.js';
2
+ export { evaluateWorkflowExpression, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed, type FailClosedPredicateOutcome, type WorkflowExpressionEvaluationContext, type WorkflowExpressionEvaluationValue, } from './evaluate-workflow-expression.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/evaluator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,KAAK,yCAAyC,EAC9C,qCAAqC,GACtC,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,mCAAmC,EACnC,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,GACvC,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { WorkflowExpressionEvaluationError, workflowExpressionEvaluationErrorCode } from './errors.js';
2
+ export { evaluateWorkflowExpression, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed } from './evaluate-workflow-expression.js';
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/evaluator/index.ts"],"sourcesContent":["export {\n WorkflowExpressionEvaluationError,\n type WorkflowExpressionEvaluationFailureReason,\n workflowExpressionEvaluationErrorCode,\n} from './errors.js';\nexport {\n evaluateWorkflowExpression,\n evaluateWorkflowPredicate,\n evaluateWorkflowPredicateFailClosed,\n type FailClosedPredicateOutcome,\n type WorkflowExpressionEvaluationContext,\n type WorkflowExpressionEvaluationValue,\n} from './evaluate-workflow-expression.js';\n"],"names":["WorkflowExpressionEvaluationError","workflowExpressionEvaluationErrorCode","evaluateWorkflowExpression","evaluateWorkflowPredicate","evaluateWorkflowPredicateFailClosed"],"mappings":"AAAA,SACEA,iCAAiC,EAEjCC,qCAAqC,QAChC,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,yBAAyB,EACzBC,mCAAmC,QAI9B,oCAAoC"}
@@ -0,0 +1,7 @@
1
+ import type { CreateWorkflowExpressionParams, WorkflowExpression } from './workflow-expression.js';
2
+ export declare function createWorkflowExpression(params: CreateWorkflowExpressionParams): WorkflowExpression;
3
+ export declare function unsafeWorkflowExpressionFromSource(params: {
4
+ source: string;
5
+ check: WorkflowExpression['check'];
6
+ }): WorkflowExpression;
7
+ //# sourceMappingURL=create-workflow-expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-workflow-expression.d.ts","sourceRoot":"","sources":["../../src/expression/create-workflow-expression.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,8BAA8B,EAI9B,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAelC,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,8BAA8B,GACrC,kBAAkB,CAuDpB;AAED,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,kBAAkB,CAOrB"}
@@ -0,0 +1,156 @@
1
+ import { Environment, parse as parseCel } from '@marcbachmann/cel-js';
2
+ import { InvalidWorkflowExpressionError } from './errors.js';
3
+ const scalarTypeToCelType = {
4
+ string: 'string',
5
+ int: 'int',
6
+ double: 'double',
7
+ bool: 'bool',
8
+ null: 'null',
9
+ timestamp: 'google.protobuf.Timestamp'
10
+ };
11
+ export function createWorkflowExpression(params) {
12
+ const source = params.source.trim();
13
+ let resultType;
14
+ if (source.length === 0) {
15
+ throw new InvalidWorkflowExpressionError({
16
+ source: params.source,
17
+ reason: 'Expression source must not be empty.'
18
+ });
19
+ }
20
+ try {
21
+ parseCel(source);
22
+ } catch (error) {
23
+ throw new InvalidWorkflowExpressionError({
24
+ source,
25
+ reason: error instanceof Error ? error.message : 'Expression source could not be parsed.'
26
+ });
27
+ }
28
+ if (params.check.mode === 'typed') {
29
+ const environment = new Environment({
30
+ unlistedVariablesAreDyn: false
31
+ });
32
+ for (const [name, type] of Object.entries(params.check.typeEnvironment ?? {})){
33
+ const celType = toCelType(type, environment, name);
34
+ if (typeof celType === 'string') {
35
+ environment.registerVariable(name, celType);
36
+ } else {
37
+ environment.registerVariable({
38
+ name,
39
+ schema: celType.schema
40
+ });
41
+ }
42
+ }
43
+ const typeCheckResult = environment.check(source);
44
+ if (!typeCheckResult.valid) {
45
+ throw new InvalidWorkflowExpressionError({
46
+ source,
47
+ reason: typeCheckResult.error?.message ?? 'Expression source did not type-check.'
48
+ });
49
+ }
50
+ if (params.check.expectedResultType !== undefined && typeCheckResult.type !== scalarTypeToCelType[params.check.expectedResultType]) {
51
+ throw new InvalidWorkflowExpressionError({
52
+ source,
53
+ reason: `Expression source must return ${scalarTypeToCelType[params.check.expectedResultType]}; got ${typeCheckResult.type ?? 'unknown'}.`
54
+ });
55
+ }
56
+ resultType = fromCelType(typeCheckResult.type);
57
+ }
58
+ return {
59
+ language: 'cel',
60
+ source: source,
61
+ check: params.check.mode,
62
+ ...resultType === undefined ? {} : {
63
+ resultType
64
+ }
65
+ };
66
+ }
67
+ export function unsafeWorkflowExpressionFromSource(params) {
68
+ // Use only when rehydrating a source that was already validated before storage.
69
+ return {
70
+ language: 'cel',
71
+ source: params.source,
72
+ check: params.check
73
+ };
74
+ }
75
+ function toCelType(type, environment, variableName) {
76
+ if (typeof type === 'string') return scalarTypeToCelType[type];
77
+ if (type.kind === 'list') {
78
+ return `list<${toCelListElementType(type.element, environment, variableName)}>`;
79
+ }
80
+ if (type.kind === 'map') return 'map';
81
+ return {
82
+ schema: Object.fromEntries(Object.entries(type.fields).map(([name, field])=>[
83
+ name,
84
+ toCelSchemaType(field)
85
+ ]))
86
+ };
87
+ }
88
+ function toCelSchemaType(type) {
89
+ if (typeof type === 'string') return scalarTypeToCelType[type];
90
+ if (type.kind === 'list') return `list<${toCelSchemaListElementType(type.element)}>`;
91
+ if (type.kind === 'map') return 'map';
92
+ return Object.fromEntries(Object.entries(type.fields).map(([name, field])=>[
93
+ name,
94
+ toCelSchemaType(field)
95
+ ]));
96
+ }
97
+ function toCelSchemaListElementType(type) {
98
+ if (typeof type === 'string') return scalarTypeToCelType[type];
99
+ if (type.kind === 'map') return 'map';
100
+ if (type.kind === 'object') return 'dyn';
101
+ return `list<${toCelSchemaListElementType(type.element)}>`;
102
+ }
103
+ function toCelListElementType(type, environment, variableName) {
104
+ if (typeof type === 'string') return scalarTypeToCelType[type];
105
+ if (type.kind === 'map') return 'map';
106
+ if (type.kind === 'object') {
107
+ const typeName = `$${variableName}.item`;
108
+ environment.registerType({
109
+ name: typeName,
110
+ schema: Object.fromEntries(Object.entries(type.fields).map(([name, field])=>[
111
+ name,
112
+ toCelSchemaType(field)
113
+ ]))
114
+ });
115
+ return typeName;
116
+ }
117
+ return 'dyn';
118
+ }
119
+ function fromCelType(type) {
120
+ if (type === undefined) return undefined;
121
+ switch(type){
122
+ case 'string':
123
+ return 'string';
124
+ case 'int':
125
+ return 'int';
126
+ case 'double':
127
+ return 'double';
128
+ case 'bool':
129
+ return 'bool';
130
+ case 'null':
131
+ return 'null';
132
+ case 'google.protobuf.Timestamp':
133
+ return 'timestamp';
134
+ case 'map':
135
+ return {
136
+ kind: 'map'
137
+ };
138
+ case 'dyn':
139
+ return 'string';
140
+ default:
141
+ // cel-js currently exposes custom/list element result types as opaque strings.
142
+ // Keep the outer list shape when present, but erase element detail rather than
143
+ // pretending we can round-trip the original schema.
144
+ if (type.startsWith('list<')) return {
145
+ kind: 'list',
146
+ element: {
147
+ kind: 'map'
148
+ }
149
+ };
150
+ return {
151
+ kind: 'map'
152
+ };
153
+ }
154
+ }
155
+
156
+ //# sourceMappingURL=create-workflow-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/expression/create-workflow-expression.ts"],"sourcesContent":["import {Environment, parse as parseCel} from '@marcbachmann/cel-js';\nimport {InvalidWorkflowExpressionError} from './errors.js';\nimport type {\n CreateWorkflowExpressionParams,\n ExpressionScalarType,\n ExpressionType,\n ValidCelExpression,\n WorkflowExpression,\n} from './workflow-expression.js';\n\nconst scalarTypeToCelType = {\n string: 'string',\n int: 'int',\n double: 'double',\n bool: 'bool',\n null: 'null',\n timestamp: 'google.protobuf.Timestamp',\n} satisfies Record<ExpressionScalarType, string>;\n\ntype CelSchema = {\n [field: string]: string | CelSchema;\n};\n\nexport function createWorkflowExpression(\n params: CreateWorkflowExpressionParams,\n): WorkflowExpression {\n const source = params.source.trim();\n let resultType: ExpressionType | undefined;\n if (source.length === 0) {\n throw new InvalidWorkflowExpressionError({\n source: params.source,\n reason: 'Expression source must not be empty.',\n });\n }\n\n try {\n parseCel(source);\n } catch (error) {\n throw new InvalidWorkflowExpressionError({\n source,\n reason: error instanceof Error ? error.message : 'Expression source could not be parsed.',\n });\n }\n\n if (params.check.mode === 'typed') {\n const environment = new Environment({unlistedVariablesAreDyn: false});\n for (const [name, type] of Object.entries(params.check.typeEnvironment ?? {})) {\n const celType = toCelType(type, environment, name);\n if (typeof celType === 'string') {\n environment.registerVariable(name, celType);\n } else {\n environment.registerVariable({name, schema: celType.schema});\n }\n }\n\n const typeCheckResult = environment.check(source);\n if (!typeCheckResult.valid) {\n throw new InvalidWorkflowExpressionError({\n source,\n reason: typeCheckResult.error?.message ?? 'Expression source did not type-check.',\n });\n }\n if (\n params.check.expectedResultType !== undefined &&\n typeCheckResult.type !== scalarTypeToCelType[params.check.expectedResultType]\n ) {\n throw new InvalidWorkflowExpressionError({\n source,\n reason: `Expression source must return ${scalarTypeToCelType[params.check.expectedResultType]}; got ${typeCheckResult.type ?? 'unknown'}.`,\n });\n }\n resultType = fromCelType(typeCheckResult.type);\n }\n\n return {\n language: 'cel',\n source: source as ValidCelExpression,\n check: params.check.mode,\n ...(resultType === undefined ? {} : {resultType}),\n };\n}\n\nexport function unsafeWorkflowExpressionFromSource(params: {\n source: string;\n check: WorkflowExpression['check'];\n}): WorkflowExpression {\n // Use only when rehydrating a source that was already validated before storage.\n return {\n language: 'cel',\n source: params.source as ValidCelExpression,\n check: params.check,\n };\n}\n\nfunction toCelType(\n type: ExpressionType,\n environment: Environment,\n variableName: string,\n): string | {schema: CelSchema} {\n if (typeof type === 'string') return scalarTypeToCelType[type];\n if (type.kind === 'list') {\n return `list<${toCelListElementType(type.element, environment, variableName)}>`;\n }\n if (type.kind === 'map') return 'map';\n\n return {\n schema: Object.fromEntries(\n Object.entries(type.fields).map(([name, field]) => [name, toCelSchemaType(field)]),\n ),\n };\n}\n\nfunction toCelSchemaType(type: ExpressionType): string | CelSchema {\n if (typeof type === 'string') return scalarTypeToCelType[type];\n if (type.kind === 'list') return `list<${toCelSchemaListElementType(type.element)}>`;\n if (type.kind === 'map') return 'map';\n return Object.fromEntries(\n Object.entries(type.fields).map(([name, field]) => [name, toCelSchemaType(field)]),\n );\n}\n\nfunction toCelSchemaListElementType(type: ExpressionType): string {\n if (typeof type === 'string') return scalarTypeToCelType[type];\n if (type.kind === 'map') return 'map';\n if (type.kind === 'object') return 'dyn';\n return `list<${toCelSchemaListElementType(type.element)}>`;\n}\n\nfunction toCelListElementType(\n type: ExpressionType,\n environment: Environment,\n variableName: string,\n): string {\n if (typeof type === 'string') return scalarTypeToCelType[type];\n if (type.kind === 'map') return 'map';\n if (type.kind === 'object') {\n const typeName = `$${variableName}.item`;\n environment.registerType({\n name: typeName,\n schema: Object.fromEntries(\n Object.entries(type.fields).map(([name, field]) => [name, toCelSchemaType(field)]),\n ),\n });\n return typeName;\n }\n return 'dyn';\n}\n\nfunction fromCelType(type: string | undefined): ExpressionType | undefined {\n if (type === undefined) return undefined;\n\n switch (type) {\n case 'string':\n return 'string';\n case 'int':\n return 'int';\n case 'double':\n return 'double';\n case 'bool':\n return 'bool';\n case 'null':\n return 'null';\n case 'google.protobuf.Timestamp':\n return 'timestamp';\n case 'map':\n return {kind: 'map'};\n case 'dyn':\n return 'string';\n default:\n // cel-js currently exposes custom/list element result types as opaque strings.\n // Keep the outer list shape when present, but erase element detail rather than\n // pretending we can round-trip the original schema.\n if (type.startsWith('list<')) return {kind: 'list', element: {kind: 'map'}};\n return {kind: 'map'};\n }\n}\n"],"names":["Environment","parse","parseCel","InvalidWorkflowExpressionError","scalarTypeToCelType","string","int","double","bool","null","timestamp","createWorkflowExpression","params","source","trim","resultType","length","reason","error","Error","message","check","mode","environment","unlistedVariablesAreDyn","name","type","Object","entries","typeEnvironment","celType","toCelType","registerVariable","schema","typeCheckResult","valid","expectedResultType","undefined","fromCelType","language","unsafeWorkflowExpressionFromSource","variableName","kind","toCelListElementType","element","fromEntries","fields","map","field","toCelSchemaType","toCelSchemaListElementType","typeName","registerType","startsWith"],"mappings":"AAAA,SAAQA,WAAW,EAAEC,SAASC,QAAQ,QAAO,uBAAuB;AACpE,SAAQC,8BAA8B,QAAO,cAAc;AAS3D,MAAMC,sBAAsB;IAC1BC,QAAQ;IACRC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,MAAM;IACNC,WAAW;AACb;AAMA,OAAO,SAASC,yBACdC,MAAsC;IAEtC,MAAMC,SAASD,OAAOC,MAAM,CAACC,IAAI;IACjC,IAAIC;IACJ,IAAIF,OAAOG,MAAM,KAAK,GAAG;QACvB,MAAM,IAAIb,+BAA+B;YACvCU,QAAQD,OAAOC,MAAM;YACrBI,QAAQ;QACV;IACF;IAEA,IAAI;QACFf,SAASW;IACX,EAAE,OAAOK,OAAO;QACd,MAAM,IAAIf,+BAA+B;YACvCU;YACAI,QAAQC,iBAAiBC,QAAQD,MAAME,OAAO,GAAG;QACnD;IACF;IAEA,IAAIR,OAAOS,KAAK,CAACC,IAAI,KAAK,SAAS;QACjC,MAAMC,cAAc,IAAIvB,YAAY;YAACwB,yBAAyB;QAAK;QACnE,KAAK,MAAM,CAACC,MAAMC,KAAK,IAAIC,OAAOC,OAAO,CAAChB,OAAOS,KAAK,CAACQ,eAAe,IAAI,CAAC,GAAI;YAC7E,MAAMC,UAAUC,UAAUL,MAAMH,aAAaE;YAC7C,IAAI,OAAOK,YAAY,UAAU;gBAC/BP,YAAYS,gBAAgB,CAACP,M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CAACF,KAAKoB,MAAM,EAAEC,GAAG,CAAC,CAAC,CAACtB,MAAMuB,MAAM,GAAK;oBAACvB;oBAAMwB,gBAAgBD;iBAAO;QAErF;QACA,OAAOG;IACT;IACA,OAAO;AACT;AAEA,SAASb,YAAYZ,IAAwB;IAC3C,IAAIA,SAASW,WAAW,OAAOA;IAE/B,OAAQX;QACN,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;QACT,KAAK;YACH,OAAO;gBAACgB,MAAM;YAAK;QACrB,KAAK;YACH,OAAO;QACT;YACE,+EAA+E;YAC/E,+EAA+E;YAC/E,oDAAoD;YACpD,IAAIhB,KAAK2B,UAAU,CAAC,UAAU,OAAO;gBAACX,MAAM;gBAAQE,SAAS;oBAACF,MAAM;gBAAK;YAAC;YAC1E,OAAO;gBAACA,MAAM;YAAK;IACvB;AACF"}
@@ -0,0 +1,12 @@
1
+ export declare const invalidWorkflowExpressionErrorCode = "invalid-workflow-expression";
2
+ export declare class InvalidWorkflowExpressionError extends Error {
3
+ readonly code = "invalid-workflow-expression";
4
+ readonly source: string;
5
+ readonly reason: string;
6
+ constructor(params: {
7
+ source: string;
8
+ reason: string;
9
+ cause?: unknown;
10
+ });
11
+ }
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/expression/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kCAAkC,gCAAgC,CAAC;AAEhF,qBAAa,8BAA+B,SAAQ,KAAK;IACvD,QAAQ,CAAC,IAAI,iCAAsC;IACnD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC;CAMtE"}
@@ -0,0 +1,13 @@
1
+ export const invalidWorkflowExpressionErrorCode = 'invalid-workflow-expression';
2
+ export class InvalidWorkflowExpressionError extends Error {
3
+ constructor(params){
4
+ super('Invalid workflow expression', {
5
+ cause: params.cause
6
+ }), this.code = invalidWorkflowExpressionErrorCode;
7
+ this.name = 'InvalidWorkflowExpressionError';
8
+ this.source = params.source;
9
+ this.reason = params.reason;
10
+ }
11
+ }
12
+
13
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/expression/errors.ts"],"sourcesContent":["export const invalidWorkflowExpressionErrorCode = 'invalid-workflow-expression';\n\nexport class InvalidWorkflowExpressionError extends Error {\n readonly code = invalidWorkflowExpressionErrorCode;\n readonly source: string;\n readonly reason: string;\n\n constructor(params: {source: string; reason: string; cause?: unknown}) {\n super('Invalid workflow expression', {cause: params.cause});\n this.name = 'InvalidWorkflowExpressionError';\n this.source = params.source;\n this.reason = params.reason;\n }\n}\n"],"names":["invalidWorkflowExpressionErrorCode","InvalidWorkflowExpressionError","Error","params","cause","code","name","source","reason"],"mappings":"AAAA,OAAO,MAAMA,qCAAqC,8BAA8B;AAEhF,OAAO,MAAMC,uCAAuCC;IAKlD,YAAYC,MAAyD,CAAE;QACrE,KAAK,CAAC,+BAA+B;YAACC,OAAOD,OAAOC,KAAK;QAAA,SALlDC,OAAOL;QAMd,IAAI,CAACM,IAAI,GAAG;QACZ,IAAI,CAACC,MAAM,GAAGJ,OAAOI,MAAM;QAC3B,IAAI,CAACC,MAAM,GAAGL,OAAOK,MAAM;IAC7B;AACF"}
@@ -0,0 +1,4 @@
1
+ export { createWorkflowExpression, unsafeWorkflowExpressionFromSource, } from './create-workflow-expression.js';
2
+ export { InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode } from './errors.js';
3
+ export type { CreateWorkflowExpressionParams, ExpressionScalarType, ExpressionType, ExpressionTypeEnvironment, ValidCelExpression, WorkflowExpression, WorkflowExpressionCheck, WorkflowExpressionCheckOptions, } from './workflow-expression.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/expression/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAC,8BAA8B,EAAE,kCAAkC,EAAC,MAAM,aAAa,CAAC;AAC/F,YAAY,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createWorkflowExpression, unsafeWorkflowExpressionFromSource } from './create-workflow-expression.js';
2
+ export { InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode } from './errors.js';
3
+
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/expression/index.ts"],"sourcesContent":["export {\n createWorkflowExpression,\n unsafeWorkflowExpressionFromSource,\n} from './create-workflow-expression.js';\nexport {InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode} from './errors.js';\nexport type {\n CreateWorkflowExpressionParams,\n ExpressionScalarType,\n ExpressionType,\n ExpressionTypeEnvironment,\n ValidCelExpression,\n WorkflowExpression,\n WorkflowExpressionCheck,\n WorkflowExpressionCheckOptions,\n} from './workflow-expression.js';\n"],"names":["createWorkflowExpression","unsafeWorkflowExpressionFromSource","InvalidWorkflowExpressionError","invalidWorkflowExpressionErrorCode"],"mappings":"AAAA,SACEA,wBAAwB,EACxBC,kCAAkC,QAC7B,kCAAkC;AACzC,SAAQC,8BAA8B,EAAEC,kCAAkC,QAAO,cAAc"}
@@ -0,0 +1,33 @@
1
+ export type ValidCelExpression = string & {
2
+ readonly __validCelExpression: unique symbol;
3
+ };
4
+ export interface WorkflowExpression {
5
+ language: 'cel';
6
+ source: ValidCelExpression;
7
+ check: WorkflowExpressionCheck;
8
+ resultType?: ExpressionType;
9
+ }
10
+ export type WorkflowExpressionCheck = 'syntax' | 'typed';
11
+ export type ExpressionScalarType = 'string' | 'int' | 'double' | 'bool' | 'null' | 'timestamp';
12
+ export type ExpressionType = ExpressionScalarType | {
13
+ kind: 'object';
14
+ fields: Readonly<Record<string, ExpressionType>>;
15
+ } | {
16
+ kind: 'map';
17
+ } | {
18
+ kind: 'list';
19
+ element: ExpressionType;
20
+ };
21
+ export type ExpressionTypeEnvironment = Readonly<Record<string, ExpressionType>>;
22
+ export type WorkflowExpressionCheckOptions = {
23
+ mode: 'syntax';
24
+ } | {
25
+ mode: 'typed';
26
+ typeEnvironment?: ExpressionTypeEnvironment;
27
+ expectedResultType?: ExpressionScalarType;
28
+ };
29
+ export interface CreateWorkflowExpressionParams {
30
+ source: string;
31
+ check: WorkflowExpressionCheckOptions;
32
+ }
33
+ //# sourceMappingURL=workflow-expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-expression.d.ts","sourceRoot":"","sources":["../../src/expression/workflow-expression.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAC,QAAQ,CAAC,oBAAoB,EAAE,OAAO,MAAM,CAAA;CAAC,CAAC;AAEzF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,KAAK,CAAC;IAChB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,uBAAuB,CAAC;IAC/B,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AAE/F,MAAM,MAAM,cAAc,GACtB,oBAAoB,GACpB;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;CAClD,GACD;IACE,IAAI,EAAE,KAAK,CAAC;CACb,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC;CACzB,CAAC;AAEN,MAAM,MAAM,yBAAyB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;AAEjF,MAAM,MAAM,8BAA8B,GACtC;IACE,IAAI,EAAE,QAAQ,CAAC;CAChB,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,eAAe,CAAC,EAAE,yBAAyB,CAAC;IAC5C,kBAAkB,CAAC,EAAE,oBAAoB,CAAC;CAC3C,CAAC;AAEN,MAAM,WAAW,8BAA8B;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,8BAA8B,CAAC;CACvC"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=workflow-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/expression/workflow-expression.ts"],"sourcesContent":["export type ValidCelExpression = string & {readonly __validCelExpression: unique symbol};\n\nexport interface WorkflowExpression {\n language: 'cel';\n source: ValidCelExpression;\n check: WorkflowExpressionCheck;\n resultType?: ExpressionType;\n}\n\nexport type WorkflowExpressionCheck = 'syntax' | 'typed';\n\nexport type ExpressionScalarType = 'string' | 'int' | 'double' | 'bool' | 'null' | 'timestamp';\n\nexport type ExpressionType =\n | ExpressionScalarType\n | {\n kind: 'object';\n fields: Readonly<Record<string, ExpressionType>>;\n }\n | {\n kind: 'map';\n }\n | {\n kind: 'list';\n element: ExpressionType;\n };\n\nexport type ExpressionTypeEnvironment = Readonly<Record<string, ExpressionType>>;\n\nexport type WorkflowExpressionCheckOptions =\n | {\n mode: 'syntax';\n }\n | {\n mode: 'typed';\n typeEnvironment?: ExpressionTypeEnvironment;\n expectedResultType?: ExpressionScalarType;\n };\n\nexport interface CreateWorkflowExpressionParams {\n source: string;\n check: WorkflowExpressionCheckOptions;\n}\n"],"names":[],"mappings":"AAuCA,WAGC"}
@@ -0,0 +1,27 @@
1
+ export { WorkflowExpressionEvaluationError, type WorkflowExpressionEvaluationFailureReason, workflowExpressionEvaluationErrorCode, } from './evaluator/errors.js';
2
+ export { evaluateWorkflowExpression, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed, type FailClosedPredicateOutcome, type WorkflowExpressionEvaluationContext, type WorkflowExpressionEvaluationValue, } from './evaluator/evaluate-workflow-expression.js';
3
+ export { createWorkflowExpression, unsafeWorkflowExpressionFromSource, } from './expression/create-workflow-expression.js';
4
+ export { InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode, } from './expression/errors.js';
5
+ export type { CreateWorkflowExpressionParams, ExpressionScalarType, ExpressionType, ExpressionTypeEnvironment, ValidCelExpression, WorkflowExpression, WorkflowExpressionCheck, WorkflowExpressionCheckOptions, } from './expression/workflow-expression.js';
6
+ export { type CoerceStepOutputsResult, coerceStepOutputs, type JsonSchemaValidationResult, jsonSchemaToExpressionType, type OutputDeclarations, type OutputType, type OutputTypeDeclaration, outputDeclarationsToExpressionFields, outputDeclarationToExpressionType, outputTypes, type StepOutputCoercionError, type StepOutputCoercionErrorReason, validateJsonSchema, } from './outputs/index.js';
7
+ export { isBareContextReference } from './plan/bare-reference.js';
8
+ export { analyzeContextKeyAccess, analyzeContextRootKeyAccess, type ContextKeyAccessAnalysis, type ContextKeyAccessReference, type ContextKeyAccessViolation, type ContextRootKeyAccessAnalysis, type ContextRootKeyAccessReference, } from './plan/context-key-access.js';
9
+ export { evaluatePlannedPredicateAtSite } from './plan/evaluate-planned-predicate.js';
10
+ export { capTraceEntries, capTraceValue, EVALUATION_TRACE_MAX_ENTRIES, EVALUATION_TRACE_VALUE_CAP_BYTES, type EvaluationTraceEntry, type EvaluationTraceLimitEntry, type EvaluationTraceRowEntry, evaluationTraceEntry, predicateTraceEntry, } from './plan/evaluation-trace.js';
11
+ export { extractExactContextRoots } from './plan/extract-exact-context-roots.js';
12
+ export { type FrozenResolvedField, freezeResolvedFieldAtSite, resolveFieldAtSite, type SiteResolvedField, type WorkflowTemplateDiagnostic, type WorkflowTemplateFailurePolicy, } from './plan/freeze.js';
13
+ export { type FrozenPlannedRunCommand, freezePlannedRunCommandAtSite, } from './plan/freeze-run-command.js';
14
+ export { type FieldPlan, type FieldPlanResult, type PlanViolation, planInterpolationField, } from './plan/plan-field.js';
15
+ export { predicateSourceIsBooleanShaped } from './plan/predicate-shape.js';
16
+ export type { ResolvedField, ResolvedFieldDeferredSegment, ResolvedFieldLiteralSegment, ResolvedFieldSegment, } from './plan/resolved-field.js';
17
+ export { type RoutedExpression, routeExpression } from './plan/route-expression.js';
18
+ export { type ServerEvaluabilityResult, type ServerEvaluabilityViolation, validateServerEvaluable, } from './plan/validate-server-evaluable.js';
19
+ export { WorkflowTemplateResolutionError, workflowTemplateResolutionErrorCode, } from './resolver/errors.js';
20
+ export { type HoistedPlannedRunCommand, hoistPlannedRunCommand, type PlannedRunCommandBinding, type RunCommandHoistOptions, UnsafeRunInterpolationError, unsafeRunInterpolationErrorCode, } from './run/hoist-run-command.js';
21
+ export { InvalidWorkflowTemplateError, invalidWorkflowTemplateErrorCode, } from './template/errors.js';
22
+ export { extractCelContextRoots } from './template/extract-cel-context-roots.js';
23
+ export { extractCelUntrustedPathAccesses } from './template/extract-cel-untrusted-path-accesses.js';
24
+ export { parseWorkflowTemplate } from './template/parse-workflow-template.js';
25
+ export type { WorkflowTemplateExprSegment, WorkflowTemplateLiteralSegment, WorkflowTemplateSegment, } from './template/template-segment.js';
26
+ export { type AvailabilitySite, availabilitySites, buildTypedRootsEnvironment, type FillTarget, getWorkflowContextAvailability, getWorkflowContextDefinition, getWorkflowContextHost, getWorkflowContextSensitivity, getWorkflowContextTypeEnvironment, getWorkflowContextUntrustedPaths, getWorkflowInterpolationFieldFailurePolicy, getWorkflowPredicateFieldMinimumFillTarget, type OpenWorkflowContextDefinition, type ReservedRootDefinition, type RunnerWorkflowContextDefinition, resolveContextRootAvailability, resolveContextRootHost, rootsAvailableAt, runnerFillTarget, type TypedWorkflowContextDefinition, unavailableRootsAt, type WorkflowContextAvailabilityReferenceEntry, type WorkflowContextDefinition, type WorkflowContextHost, type WorkflowContextName, type WorkflowContextReservedRoot, type WorkflowContextSensitivity, type WorkflowContextShape, type WorkflowContextTrustTier, type WorkflowFieldFailurePolicy, type WorkflowInterpolationFailurePolicy, type WorkflowInterpolationField, type WorkflowInterpolationFieldPolicy, type WorkflowJobTypeOverlay, type WorkflowPredicateField, type WorkflowStepTypeOverlay, workflowContextAvailabilityReference, workflowContextDefinitions, workflowContextHosts, workflowContextNames, workflowContextReservedRoots, workflowContextRootRequiresLiteralKey, workflowContextSensitivities, workflowContextTrustTiers, workflowFieldFailurePolicies, workflowInterpolationFieldAcceptsContext, workflowInterpolationFieldAcceptsHost, workflowInterpolationFieldAcceptsTrustTier, workflowInterpolationFieldPolicies, workflowInterpolationFields, workflowPredicateFieldFailurePolicy, workflowPredicateFields, } from './workflow-context/workflow-context.js';
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,KAAK,yCAAyC,EAC9C,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,mCAAmC,EACnC,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,GACvC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,8BAA8B,EAC9B,kCAAkC,GACnC,MAAM,wBAAwB,CAAC;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AClB,KAAK,yCAAyC,EAC9C,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,oCAAoC,EACpC,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,qCAAqC,EACrC,4BAA4B,EAC5B,yBAAyB,EACzB,4BAA4B,EAC5B,wCAAwC,EACxC,qCAAqC,EACrC,0CAA0C,EAC1C,kCAAkC,EAClC,2BAA2B,EAC3B,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,wCAAwC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ export { WorkflowExpressionEvaluationError, workflowExpressionEvaluationErrorCode } from './evaluator/errors.js';
2
+ export { evaluateWorkflowExpression, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed } from './evaluator/evaluate-workflow-expression.js';
3
+ export { createWorkflowExpression, unsafeWorkflowExpressionFromSource } from './expression/create-workflow-expression.js';
4
+ export { InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode } from './expression/errors.js';
5
+ export { coerceStepOutputs, jsonSchemaToExpressionType, outputDeclarationsToExpressionFields, outputDeclarationToExpressionType, outputTypes, validateJsonSchema } from './outputs/index.js';
6
+ export { isBareContextReference } from './plan/bare-reference.js';
7
+ export { analyzeContextKeyAccess, analyzeContextRootKeyAccess } from './plan/context-key-access.js';
8
+ export { evaluatePlannedPredicateAtSite } from './plan/evaluate-planned-predicate.js';
9
+ export { capTraceEntries, capTraceValue, EVALUATION_TRACE_MAX_ENTRIES, EVALUATION_TRACE_VALUE_CAP_BYTES, evaluationTraceEntry, predicateTraceEntry } from './plan/evaluation-trace.js';
10
+ export { extractExactContextRoots } from './plan/extract-exact-context-roots.js';
11
+ export { freezeResolvedFieldAtSite, resolveFieldAtSite } from './plan/freeze.js';
12
+ export { freezePlannedRunCommandAtSite } from './plan/freeze-run-command.js';
13
+ export { planInterpolationField } from './plan/plan-field.js';
14
+ export { predicateSourceIsBooleanShaped } from './plan/predicate-shape.js';
15
+ export { routeExpression } from './plan/route-expression.js';
16
+ export { validateServerEvaluable } from './plan/validate-server-evaluable.js';
17
+ export { WorkflowTemplateResolutionError, workflowTemplateResolutionErrorCode } from './resolver/errors.js';
18
+ export { hoistPlannedRunCommand, UnsafeRunInterpolationError, unsafeRunInterpolationErrorCode } from './run/hoist-run-command.js';
19
+ export { InvalidWorkflowTemplateError, invalidWorkflowTemplateErrorCode } from './template/errors.js';
20
+ export { extractCelContextRoots } from './template/extract-cel-context-roots.js';
21
+ export { extractCelUntrustedPathAccesses } from './template/extract-cel-untrusted-path-accesses.js';
22
+ export { parseWorkflowTemplate } from './template/parse-workflow-template.js';
23
+ export { availabilitySites, buildTypedRootsEnvironment, getWorkflowContextAvailability, getWorkflowContextDefinition, getWorkflowContextHost, getWorkflowContextSensitivity, getWorkflowContextTypeEnvironment, getWorkflowContextUntrustedPaths, getWorkflowInterpolationFieldFailurePolicy, getWorkflowPredicateFieldMinimumFillTarget, resolveContextRootAvailability, resolveContextRootHost, rootsAvailableAt, runnerFillTarget, unavailableRootsAt, workflowContextAvailabilityReference, workflowContextDefinitions, workflowContextHosts, workflowContextNames, workflowContextReservedRoots, workflowContextRootRequiresLiteralKey, workflowContextSensitivities, workflowContextTrustTiers, workflowFieldFailurePolicies, workflowInterpolationFieldAcceptsContext, workflowInterpolationFieldAcceptsHost, workflowInterpolationFieldAcceptsTrustTier, workflowInterpolationFieldPolicies, workflowInterpolationFields, workflowPredicateFieldFailurePolicy, workflowPredicateFields } from './workflow-context/workflow-context.js';
24
+
25
+ //# sourceMappingURL=index.js.map