@xemahq/dsl 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/deliverable-spec/index.d.ts +3 -0
- package/dist/deliverable-spec/index.d.ts.map +1 -0
- package/dist/deliverable-spec/index.js +19 -0
- package/dist/deliverable-spec/index.js.map +1 -0
- package/dist/deliverable-spec/lib/schema.d.ts +151 -0
- package/dist/deliverable-spec/lib/schema.d.ts.map +1 -0
- package/dist/deliverable-spec/lib/schema.js +139 -0
- package/dist/deliverable-spec/lib/schema.js.map +1 -0
- package/dist/deliverable-spec/lib/types.d.ts +8 -0
- package/dist/deliverable-spec/lib/types.d.ts.map +1 -0
- package/dist/deliverable-spec/lib/types.js +3 -0
- package/dist/deliverable-spec/lib/types.js.map +1 -0
- package/dist/payload-codec/index.d.ts +8 -0
- package/dist/payload-codec/index.d.ts.map +1 -0
- package/dist/payload-codec/index.js +27 -0
- package/dist/payload-codec/index.js.map +1 -0
- package/dist/payload-codec/lib/blob-store.d.ts +37 -0
- package/dist/payload-codec/lib/blob-store.d.ts.map +1 -0
- package/dist/payload-codec/lib/blob-store.js +0 -0
- package/dist/payload-codec/lib/blob-store.js.map +1 -0
- package/dist/payload-codec/lib/codec-context.d.ts +6 -0
- package/dist/payload-codec/lib/codec-context.d.ts.map +1 -0
- package/dist/payload-codec/lib/codec-context.js +16 -0
- package/dist/payload-codec/lib/codec-context.js.map +1 -0
- package/dist/payload-codec/lib/codec.d.ts +51 -0
- package/dist/payload-codec/lib/codec.d.ts.map +1 -0
- package/dist/payload-codec/lib/codec.js +330 -0
- package/dist/payload-codec/lib/codec.js.map +1 -0
- package/dist/payload-codec/lib/enums.d.ts +18 -0
- package/dist/payload-codec/lib/enums.d.ts.map +1 -0
- package/dist/payload-codec/lib/enums.js +23 -0
- package/dist/payload-codec/lib/enums.js.map +1 -0
- package/dist/payload-codec/lib/errors.d.ts +18 -0
- package/dist/payload-codec/lib/errors.d.ts.map +1 -0
- package/dist/payload-codec/lib/errors.js +39 -0
- package/dist/payload-codec/lib/errors.js.map +1 -0
- package/dist/payload-codec/lib/http-blob-store.d.ts +21 -0
- package/dist/payload-codec/lib/http-blob-store.d.ts.map +1 -0
- package/dist/payload-codec/lib/http-blob-store.js +139 -0
- package/dist/payload-codec/lib/http-blob-store.js.map +1 -0
- package/dist/payload-codec/lib/lru-cache.d.ts +12 -0
- package/dist/payload-codec/lib/lru-cache.d.ts.map +1 -0
- package/dist/payload-codec/lib/lru-cache.js +59 -0
- package/dist/payload-codec/lib/lru-cache.js.map +1 -0
- package/dist/schema/action.schema.json +181 -0
- package/dist/schema/reusable-workflow.schema.json +46 -0
- package/dist/schema/workflow.schema.json +373 -0
- package/dist/workflow/index.d.ts +14 -0
- package/dist/workflow/index.d.ts.map +1 -0
- package/dist/workflow/index.js +49 -0
- package/dist/workflow/index.js.map +1 -0
- package/dist/workflow/lib/action-input-validator.d.ts +10 -0
- package/dist/workflow/lib/action-input-validator.d.ts.map +1 -0
- package/dist/workflow/lib/action-input-validator.js +69 -0
- package/dist/workflow/lib/action-input-validator.js.map +1 -0
- package/dist/workflow/lib/compiler/action-shape.d.ts +5 -0
- package/dist/workflow/lib/compiler/action-shape.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/action-shape.js +43 -0
- package/dist/workflow/lib/compiler/action-shape.js.map +1 -0
- package/dist/workflow/lib/compiler/canonical-json.d.ts +3 -0
- package/dist/workflow/lib/compiler/canonical-json.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/canonical-json.js +45 -0
- package/dist/workflow/lib/compiler/canonical-json.js.map +1 -0
- package/dist/workflow/lib/compiler/compile.d.ts +4 -0
- package/dist/workflow/lib/compiler/compile.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/compile.js +794 -0
- package/dist/workflow/lib/compiler/compile.js.map +1 -0
- package/dist/workflow/lib/compiler/concurrency.d.ts +5 -0
- package/dist/workflow/lib/compiler/concurrency.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/concurrency.js +104 -0
- package/dist/workflow/lib/compiler/concurrency.js.map +1 -0
- package/dist/workflow/lib/compiler/dag.d.ts +10 -0
- package/dist/workflow/lib/compiler/dag.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/dag.js +74 -0
- package/dist/workflow/lib/compiler/dag.js.map +1 -0
- package/dist/workflow/lib/compiler/index.d.ts +6 -0
- package/dist/workflow/lib/compiler/index.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/index.js +14 -0
- package/dist/workflow/lib/compiler/index.js.map +1 -0
- package/dist/workflow/lib/compiler/inputs.d.ts +4 -0
- package/dist/workflow/lib/compiler/inputs.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/inputs.js +108 -0
- package/dist/workflow/lib/compiler/inputs.js.map +1 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.d.ts +9 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.js +76 -0
- package/dist/workflow/lib/compiler/installation-resource-validator.js.map +1 -0
- package/dist/workflow/lib/compiler/manifest-source.d.ts +4 -0
- package/dist/workflow/lib/compiler/manifest-source.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/manifest-source.js +100 -0
- package/dist/workflow/lib/compiler/manifest-source.js.map +1 -0
- package/dist/workflow/lib/compiler/matrix.d.ts +4 -0
- package/dist/workflow/lib/compiler/matrix.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/matrix.js +76 -0
- package/dist/workflow/lib/compiler/matrix.js.map +1 -0
- package/dist/workflow/lib/compiler/mount-plan.d.ts +4 -0
- package/dist/workflow/lib/compiler/mount-plan.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/mount-plan.js +96 -0
- package/dist/workflow/lib/compiler/mount-plan.js.map +1 -0
- package/dist/workflow/lib/compiler/payload-reach-in.d.ts +14 -0
- package/dist/workflow/lib/compiler/payload-reach-in.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/payload-reach-in.js +273 -0
- package/dist/workflow/lib/compiler/payload-reach-in.js.map +1 -0
- package/dist/workflow/lib/compiler/permissions.d.ts +6 -0
- package/dist/workflow/lib/compiler/permissions.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/permissions.js +43 -0
- package/dist/workflow/lib/compiler/permissions.js.map +1 -0
- package/dist/workflow/lib/compiler/retry-timeout.d.ts +6 -0
- package/dist/workflow/lib/compiler/retry-timeout.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/retry-timeout.js +64 -0
- package/dist/workflow/lib/compiler/retry-timeout.js.map +1 -0
- package/dist/workflow/lib/compiler/review-step.d.ts +18 -0
- package/dist/workflow/lib/compiler/review-step.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/review-step.js +247 -0
- package/dist/workflow/lib/compiler/review-step.js.map +1 -0
- package/dist/workflow/lib/compiler/types.d.ts +42 -0
- package/dist/workflow/lib/compiler/types.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/types.js +3 -0
- package/dist/workflow/lib/compiler/types.js.map +1 -0
- package/dist/workflow/lib/compiler/variable-requirements.d.ts +5 -0
- package/dist/workflow/lib/compiler/variable-requirements.d.ts.map +1 -0
- package/dist/workflow/lib/compiler/variable-requirements.js +119 -0
- package/dist/workflow/lib/compiler/variable-requirements.js.map +1 -0
- package/dist/workflow/lib/deliverable-spec-keys.d.ts +3 -0
- package/dist/workflow/lib/deliverable-spec-keys.d.ts.map +1 -0
- package/dist/workflow/lib/deliverable-spec-keys.js +90 -0
- package/dist/workflow/lib/deliverable-spec-keys.js.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/index.d.ts +23 -0
- package/dist/workflow/lib/dispatch-inputs/index.d.ts.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/index.js +106 -0
- package/dist/workflow/lib/dispatch-inputs/index.js.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.d.ts +3 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.d.ts.map +1 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.js +43 -0
- package/dist/workflow/lib/dispatch-inputs/to-json-schema.js.map +1 -0
- package/dist/workflow/lib/duration.d.ts +2 -0
- package/dist/workflow/lib/duration.d.ts.map +1 -0
- package/dist/workflow/lib/duration.js +26 -0
- package/dist/workflow/lib/duration.js.map +1 -0
- package/dist/workflow/lib/errors.d.ts +9 -0
- package/dist/workflow/lib/errors.d.ts.map +1 -0
- package/dist/workflow/lib/errors.js +28 -0
- package/dist/workflow/lib/errors.js.map +1 -0
- package/dist/workflow/lib/expression/ast.d.ts +61 -0
- package/dist/workflow/lib/expression/ast.d.ts.map +1 -0
- package/dist/workflow/lib/expression/ast.js +34 -0
- package/dist/workflow/lib/expression/ast.js.map +1 -0
- package/dist/workflow/lib/expression/context.d.ts +63 -0
- package/dist/workflow/lib/expression/context.d.ts.map +1 -0
- package/dist/workflow/lib/expression/context.js +32 -0
- package/dist/workflow/lib/expression/context.js.map +1 -0
- package/dist/workflow/lib/expression/evaluator.d.ts +5 -0
- package/dist/workflow/lib/expression/evaluator.d.ts.map +1 -0
- package/dist/workflow/lib/expression/evaluator.js +291 -0
- package/dist/workflow/lib/expression/evaluator.js.map +1 -0
- package/dist/workflow/lib/expression/index.d.ts +9 -0
- package/dist/workflow/lib/expression/index.d.ts.map +1 -0
- package/dist/workflow/lib/expression/index.js +26 -0
- package/dist/workflow/lib/expression/index.js.map +1 -0
- package/dist/workflow/lib/expression/interpolation.d.ts +9 -0
- package/dist/workflow/lib/expression/interpolation.d.ts.map +1 -0
- package/dist/workflow/lib/expression/interpolation.js +51 -0
- package/dist/workflow/lib/expression/interpolation.js.map +1 -0
- package/dist/workflow/lib/expression/parser.d.ts +4 -0
- package/dist/workflow/lib/expression/parser.d.ts.map +1 -0
- package/dist/workflow/lib/expression/parser.js +203 -0
- package/dist/workflow/lib/expression/parser.js.map +1 -0
- package/dist/workflow/lib/expression/template.d.ts +18 -0
- package/dist/workflow/lib/expression/template.d.ts.map +1 -0
- package/dist/workflow/lib/expression/template.js +63 -0
- package/dist/workflow/lib/expression/template.js.map +1 -0
- package/dist/workflow/lib/expression/tokenizer.d.ts +3 -0
- package/dist/workflow/lib/expression/tokenizer.d.ts.map +1 -0
- package/dist/workflow/lib/expression/tokenizer.js +153 -0
- package/dist/workflow/lib/expression/tokenizer.js.map +1 -0
- package/dist/workflow/lib/expression/tokens.d.ts +25 -0
- package/dist/workflow/lib/expression/tokens.d.ts.map +1 -0
- package/dist/workflow/lib/expression/tokens.js +24 -0
- package/dist/workflow/lib/expression/tokens.js.map +1 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.d.ts +5 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.d.ts.map +1 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.js +138 -0
- package/dist/workflow/lib/expression/walk-artifact-refs.js.map +1 -0
- package/dist/workflow/lib/installation-resource-kind.d.ts +14 -0
- package/dist/workflow/lib/installation-resource-kind.d.ts.map +1 -0
- package/dist/workflow/lib/installation-resource-kind.js +59 -0
- package/dist/workflow/lib/installation-resource-kind.js.map +1 -0
- package/dist/workflow/lib/schemas-loader.d.ts +4 -0
- package/dist/workflow/lib/schemas-loader.d.ts.map +1 -0
- package/dist/workflow/lib/schemas-loader.js +36 -0
- package/dist/workflow/lib/schemas-loader.js.map +1 -0
- package/dist/workflow/lib/serializer.d.ts +3 -0
- package/dist/workflow/lib/serializer.d.ts.map +1 -0
- package/dist/workflow/lib/serializer.js +15 -0
- package/dist/workflow/lib/serializer.js.map +1 -0
- package/dist/workflow/lib/types.d.ts +179 -0
- package/dist/workflow/lib/types.d.ts.map +1 -0
- package/dist/workflow/lib/types.js +3 -0
- package/dist/workflow/lib/types.js.map +1 -0
- package/dist/workflow/lib/validate.d.ts +8 -0
- package/dist/workflow/lib/validate.d.ts.map +1 -0
- package/dist/workflow/lib/validate.js +119 -0
- package/dist/workflow/lib/validate.js.map +1 -0
- package/dist/workspace-manifest/index.d.ts +6 -0
- package/dist/workspace-manifest/index.d.ts.map +1 -0
- package/dist/workspace-manifest/index.js +22 -0
- package/dist/workspace-manifest/index.js.map +1 -0
- package/dist/workspace-manifest/lib/compile.d.ts +8 -0
- package/dist/workspace-manifest/lib/compile.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/compile.js +439 -0
- package/dist/workspace-manifest/lib/compile.js.map +1 -0
- package/dist/workspace-manifest/lib/interpolate.d.ts +12 -0
- package/dist/workspace-manifest/lib/interpolate.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/interpolate.js +81 -0
- package/dist/workspace-manifest/lib/interpolate.js.map +1 -0
- package/dist/workspace-manifest/lib/resolve-extends.d.ts +10 -0
- package/dist/workspace-manifest/lib/resolve-extends.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/resolve-extends.js +108 -0
- package/dist/workspace-manifest/lib/resolve-extends.js.map +1 -0
- package/dist/workspace-manifest/lib/schema.d.ts +710 -0
- package/dist/workspace-manifest/lib/schema.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/schema.js +355 -0
- package/dist/workspace-manifest/lib/schema.js.map +1 -0
- package/dist/workspace-manifest/lib/types.d.ts +153 -0
- package/dist/workspace-manifest/lib/types.d.ts.map +1 -0
- package/dist/workspace-manifest/lib/types.js +10 -0
- package/dist/workspace-manifest/lib/types.js.map +1 -0
- package/package.json +79 -0
- package/schema/action.schema.json +181 -0
- package/schema/reusable-workflow.schema.json +46 -0
- package/schema/workflow.schema.json +373 -0
- package/src/deliverable-spec/index.ts +19 -0
- package/src/deliverable-spec/lib/schema.ts +248 -0
- package/src/deliverable-spec/lib/types.ts +26 -0
- package/src/payload-codec/index.ts +40 -0
- package/src/payload-codec/lib/blob-store.ts +0 -0
- package/src/payload-codec/lib/codec-context.ts +38 -0
- package/src/payload-codec/lib/codec.ts +593 -0
- package/src/payload-codec/lib/enums.ts +58 -0
- package/src/payload-codec/lib/errors.ts +54 -0
- package/src/payload-codec/lib/http-blob-store.ts +257 -0
- package/src/payload-codec/lib/lru-cache.ts +81 -0
- package/src/workflow/index.ts +98 -0
- package/src/workflow/lib/action-input-validator.ts +160 -0
- package/src/workflow/lib/compiler/action-shape.ts +71 -0
- package/src/workflow/lib/compiler/canonical-json.ts +53 -0
- package/src/workflow/lib/compiler/compile.ts +1518 -0
- package/src/workflow/lib/compiler/concurrency.ts +223 -0
- package/src/workflow/lib/compiler/dag.ts +108 -0
- package/src/workflow/lib/compiler/index.ts +10 -0
- package/src/workflow/lib/compiler/inputs.ts +199 -0
- package/src/workflow/lib/compiler/installation-resource-validator.ts +114 -0
- package/src/workflow/lib/compiler/manifest-source.ts +176 -0
- package/src/workflow/lib/compiler/matrix.ts +135 -0
- package/src/workflow/lib/compiler/mount-plan.ts +202 -0
- package/src/workflow/lib/compiler/payload-reach-in.ts +497 -0
- package/src/workflow/lib/compiler/permissions.ts +64 -0
- package/src/workflow/lib/compiler/retry-timeout.ts +105 -0
- package/src/workflow/lib/compiler/review-step.ts +517 -0
- package/src/workflow/lib/compiler/types.ts +170 -0
- package/src/workflow/lib/compiler/variable-requirements.ts +208 -0
- package/src/workflow/lib/deliverable-spec-keys.ts +109 -0
- package/src/workflow/lib/dispatch-inputs/index.ts +160 -0
- package/src/workflow/lib/dispatch-inputs/to-json-schema.ts +60 -0
- package/src/workflow/lib/duration.ts +48 -0
- package/src/workflow/lib/errors.ts +37 -0
- package/src/workflow/lib/expression/ast.ts +108 -0
- package/src/workflow/lib/expression/context.ts +148 -0
- package/src/workflow/lib/expression/evaluator.ts +492 -0
- package/src/workflow/lib/expression/index.ts +28 -0
- package/src/workflow/lib/expression/interpolation.ts +84 -0
- package/src/workflow/lib/expression/parser.ts +264 -0
- package/src/workflow/lib/expression/template.ts +117 -0
- package/src/workflow/lib/expression/tokenizer.ts +200 -0
- package/src/workflow/lib/expression/tokens.ts +30 -0
- package/src/workflow/lib/expression/walk-artifact-refs.ts +232 -0
- package/src/workflow/lib/installation-resource-kind.ts +107 -0
- package/src/workflow/lib/schemas-loader.ts +64 -0
- package/src/workflow/lib/serializer.ts +30 -0
- package/src/workflow/lib/types.ts +361 -0
- package/src/workflow/lib/validate.ts +199 -0
- package/src/workspace-manifest/index.ts +27 -0
- package/src/workspace-manifest/lib/compile.ts +608 -0
- package/src/workspace-manifest/lib/interpolate.ts +140 -0
- package/src/workspace-manifest/lib/resolve-extends.ts +260 -0
- package/src/workspace-manifest/lib/schema.ts +612 -0
- package/src/workspace-manifest/lib/types.ts +392 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.compileExpression = compileExpression;
|
|
4
|
+
exports.evaluateExpression = evaluateExpression;
|
|
5
|
+
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const ast_1 = require("./ast");
|
|
8
|
+
const parser_1 = require("./parser");
|
|
9
|
+
const tokenizer_1 = require("./tokenizer");
|
|
10
|
+
function compileExpression(source) {
|
|
11
|
+
if (source.length === 0) {
|
|
12
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, 'Expression source must not be empty', { source });
|
|
13
|
+
}
|
|
14
|
+
const tokens = (0, tokenizer_1.tokenize)(source);
|
|
15
|
+
return (0, parser_1.parseExpression)(source, tokens);
|
|
16
|
+
}
|
|
17
|
+
function evaluateExpression(node, ctx) {
|
|
18
|
+
switch (node.kind) {
|
|
19
|
+
case ast_1.ExpressionNodeKind.LITERAL:
|
|
20
|
+
return evalLiteral(node);
|
|
21
|
+
case ast_1.ExpressionNodeKind.IDENTIFIER:
|
|
22
|
+
return evalIdentifier(node, ctx);
|
|
23
|
+
case ast_1.ExpressionNodeKind.MEMBER:
|
|
24
|
+
return evalMember(node, ctx);
|
|
25
|
+
case ast_1.ExpressionNodeKind.INDEX:
|
|
26
|
+
return evalIndex(node, ctx);
|
|
27
|
+
case ast_1.ExpressionNodeKind.CALL:
|
|
28
|
+
return evalCall(node, ctx);
|
|
29
|
+
case ast_1.ExpressionNodeKind.UNARY_NOT: {
|
|
30
|
+
const operand = evaluateExpression(node.operand, ctx);
|
|
31
|
+
return !toBool(operand);
|
|
32
|
+
}
|
|
33
|
+
case ast_1.ExpressionNodeKind.BINARY_EQ:
|
|
34
|
+
case ast_1.ExpressionNodeKind.BINARY_NEQ:
|
|
35
|
+
case ast_1.ExpressionNodeKind.BINARY_AND:
|
|
36
|
+
case ast_1.ExpressionNodeKind.BINARY_OR:
|
|
37
|
+
return evalBinary(node, ctx);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function evalLiteral(node) {
|
|
41
|
+
return node.value;
|
|
42
|
+
}
|
|
43
|
+
function evalIdentifier(node, ctx) {
|
|
44
|
+
switch (node.name) {
|
|
45
|
+
case ast_1.ExpressionRoot.NEEDS:
|
|
46
|
+
return ctx.needs;
|
|
47
|
+
case ast_1.ExpressionRoot.MATRIX:
|
|
48
|
+
return ctx.matrix;
|
|
49
|
+
case ast_1.ExpressionRoot.INPUTS:
|
|
50
|
+
return ctx.inputs;
|
|
51
|
+
case ast_1.ExpressionRoot.VARS:
|
|
52
|
+
return ctx.vars;
|
|
53
|
+
case ast_1.ExpressionRoot.SECRETS:
|
|
54
|
+
return ctx.secrets;
|
|
55
|
+
case ast_1.ExpressionRoot.TRIGGER:
|
|
56
|
+
return ctx.trigger;
|
|
57
|
+
case ast_1.ExpressionRoot.JOB:
|
|
58
|
+
return ctx.job;
|
|
59
|
+
case ast_1.ExpressionRoot.XEMA:
|
|
60
|
+
return ctx.xema;
|
|
61
|
+
default:
|
|
62
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Unknown identifier root '${node.name}'`, { name: node.name });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function evalMember(node, ctx) {
|
|
66
|
+
const target = evaluateExpression(node.target, ctx);
|
|
67
|
+
return readPropertyWithPayloadCache(target, node.property, ctx);
|
|
68
|
+
}
|
|
69
|
+
function evalIndex(node, ctx) {
|
|
70
|
+
const target = evaluateExpression(node.target, ctx);
|
|
71
|
+
const key = evaluateExpression(node.index, ctx);
|
|
72
|
+
if (Array.isArray(target)) {
|
|
73
|
+
if (typeof key !== 'number' || !Number.isInteger(key)) {
|
|
74
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Array index must be an integer, received ${typeof key}`, { key, targetKind: 'array' });
|
|
75
|
+
}
|
|
76
|
+
if (key < 0 || key >= target.length) {
|
|
77
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Array index out of range: ${key} (length ${target.length})`, { key, length: target.length });
|
|
78
|
+
}
|
|
79
|
+
return target[key];
|
|
80
|
+
}
|
|
81
|
+
if (typeof target === 'object' && target !== null) {
|
|
82
|
+
if (typeof key !== 'string') {
|
|
83
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Object index must be a string, received ${typeof key}`, { key, targetKind: 'object' });
|
|
84
|
+
}
|
|
85
|
+
return readPropertyWithPayloadCache(target, key, ctx);
|
|
86
|
+
}
|
|
87
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Indexing is only supported on arrays or objects. Target kind: ${typeof target}`, { targetKind: typeof target });
|
|
88
|
+
}
|
|
89
|
+
function evalCall(node, ctx) {
|
|
90
|
+
switch (node.callee) {
|
|
91
|
+
case ast_1.ExpressionFunction.FROM_JSON:
|
|
92
|
+
return evalFromJson(node, ctx);
|
|
93
|
+
case ast_1.ExpressionFunction.TO_JSON:
|
|
94
|
+
return evalToJson(node, ctx);
|
|
95
|
+
case ast_1.ExpressionFunction.FORMAT:
|
|
96
|
+
return evalFormat(node, ctx);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function evalFromJson(node, ctx) {
|
|
100
|
+
const argNode = singleArg(node, 'fromJSON');
|
|
101
|
+
const arg = evaluateExpression(argNode, ctx);
|
|
102
|
+
if (typeof arg === 'string') {
|
|
103
|
+
try {
|
|
104
|
+
return JSON.parse(arg);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `fromJSON failed to parse argument as JSON: ${err.message}`, { callee: node.callee });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if ((0, workflow_1.isArtifactRef)(arg)) {
|
|
111
|
+
const cached = ctx.payloadCache.get(arg.versionId);
|
|
112
|
+
if (cached === undefined) {
|
|
113
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_PAYLOAD_PARSE_ERROR, `fromJSON(<ArtifactRef>) called against versionId='${arg.versionId}' but the runtime did not pre-resolve its payload into the per-step cache. This is a runtime infra failure — the worker is expected to fetch and parse every referenced artifact before evaluating expressions.`, {
|
|
114
|
+
callee: node.callee,
|
|
115
|
+
artifactId: arg.artifactId,
|
|
116
|
+
versionId: arg.versionId,
|
|
117
|
+
type: arg.type,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return cached;
|
|
121
|
+
}
|
|
122
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `fromJSON requires a string or ArtifactRef argument, received ${typeof arg}`, { callee: node.callee, argKind: typeof arg });
|
|
123
|
+
}
|
|
124
|
+
function evalToJson(node, ctx) {
|
|
125
|
+
const argNode = singleArg(node, 'toJSON');
|
|
126
|
+
return JSON.stringify(evaluateExpression(argNode, ctx));
|
|
127
|
+
}
|
|
128
|
+
function evalFormat(node, ctx) {
|
|
129
|
+
if (node.args.length < 1) {
|
|
130
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format expects at least one argument (the template string)`, { callee: node.callee, arity: node.args.length });
|
|
131
|
+
}
|
|
132
|
+
const [templateNode, ...argNodes] = node.args;
|
|
133
|
+
if (!templateNode) {
|
|
134
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format template is missing from AST`, { callee: node.callee });
|
|
135
|
+
}
|
|
136
|
+
const template = evaluateExpression(templateNode, ctx);
|
|
137
|
+
if (typeof template !== 'string') {
|
|
138
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format template must be a string, received ${typeof template}`, { callee: node.callee, templateKind: typeof template });
|
|
139
|
+
}
|
|
140
|
+
const args = argNodes.map((argNode) => evaluateExpression(argNode, ctx));
|
|
141
|
+
return formatTemplate(template, args);
|
|
142
|
+
}
|
|
143
|
+
function singleArg(node, fnName) {
|
|
144
|
+
if (node.args.length !== 1) {
|
|
145
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `${fnName} expects exactly one argument, received ${node.args.length}`, { callee: node.callee, arity: node.args.length });
|
|
146
|
+
}
|
|
147
|
+
const [argNode] = node.args;
|
|
148
|
+
if (!argNode) {
|
|
149
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `${fnName} argument is missing from AST`, { callee: node.callee });
|
|
150
|
+
}
|
|
151
|
+
return argNode;
|
|
152
|
+
}
|
|
153
|
+
function formatTemplate(template, args) {
|
|
154
|
+
let out = '';
|
|
155
|
+
let i = 0;
|
|
156
|
+
while (i < template.length) {
|
|
157
|
+
const ch = template[i];
|
|
158
|
+
if (ch === '{') {
|
|
159
|
+
const advance = consumeOpenBrace(template, i, args);
|
|
160
|
+
out += advance.text;
|
|
161
|
+
i = advance.next;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (ch === '}') {
|
|
165
|
+
const advance = consumeCloseBrace(template, i);
|
|
166
|
+
out += advance.text;
|
|
167
|
+
i = advance.next;
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
out += ch;
|
|
171
|
+
i++;
|
|
172
|
+
}
|
|
173
|
+
return out;
|
|
174
|
+
}
|
|
175
|
+
function consumeOpenBrace(template, i, args) {
|
|
176
|
+
if (template[i + 1] === '{') {
|
|
177
|
+
return { text: '{', next: i + 2 };
|
|
178
|
+
}
|
|
179
|
+
const close = template.indexOf('}', i + 1);
|
|
180
|
+
if (close === -1) {
|
|
181
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format template has unclosed '{' starting at index ${i}: ${template}`, { template });
|
|
182
|
+
}
|
|
183
|
+
const indexLiteral = template.slice(i + 1, close);
|
|
184
|
+
const idx = parseFormatIndex(template, indexLiteral, args.length);
|
|
185
|
+
return { text: stringifyFormatArg(args[idx]), next: close + 1 };
|
|
186
|
+
}
|
|
187
|
+
function consumeCloseBrace(template, i) {
|
|
188
|
+
if (template[i + 1] === '}') {
|
|
189
|
+
return { text: '}', next: i + 2 };
|
|
190
|
+
}
|
|
191
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format template has unmatched '}' at index ${i}: ${template}`, { template });
|
|
192
|
+
}
|
|
193
|
+
function parseFormatIndex(template, indexLiteral, argCount) {
|
|
194
|
+
if (!/^\d+$/.test(indexLiteral)) {
|
|
195
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format placeholder '{${indexLiteral}}' is not a non-negative integer`, { template, placeholder: indexLiteral });
|
|
196
|
+
}
|
|
197
|
+
const idx = Number(indexLiteral);
|
|
198
|
+
if (idx >= argCount) {
|
|
199
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format placeholder '{${idx}}' has no matching argument (received ${argCount} arg(s))`, { template, placeholder: idx, argCount });
|
|
200
|
+
}
|
|
201
|
+
return idx;
|
|
202
|
+
}
|
|
203
|
+
function stringifyFormatArg(value) {
|
|
204
|
+
if (typeof value === 'string')
|
|
205
|
+
return value;
|
|
206
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
207
|
+
return String(value);
|
|
208
|
+
if (value === null)
|
|
209
|
+
return 'null';
|
|
210
|
+
if (value === undefined) {
|
|
211
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `format argument resolved to undefined; expressions must produce a defined value`, {});
|
|
212
|
+
}
|
|
213
|
+
return JSON.stringify(value);
|
|
214
|
+
}
|
|
215
|
+
function evalBinary(node, ctx) {
|
|
216
|
+
switch (node.kind) {
|
|
217
|
+
case ast_1.ExpressionNodeKind.BINARY_EQ: {
|
|
218
|
+
const left = evaluateExpression(node.left, ctx);
|
|
219
|
+
const right = evaluateExpression(node.right, ctx);
|
|
220
|
+
return strictEquals(left, right);
|
|
221
|
+
}
|
|
222
|
+
case ast_1.ExpressionNodeKind.BINARY_NEQ: {
|
|
223
|
+
const left = evaluateExpression(node.left, ctx);
|
|
224
|
+
const right = evaluateExpression(node.right, ctx);
|
|
225
|
+
return !strictEquals(left, right);
|
|
226
|
+
}
|
|
227
|
+
case ast_1.ExpressionNodeKind.BINARY_AND: {
|
|
228
|
+
const left = evaluateExpression(node.left, ctx);
|
|
229
|
+
if (!toBool(left))
|
|
230
|
+
return false;
|
|
231
|
+
return toBool(evaluateExpression(node.right, ctx));
|
|
232
|
+
}
|
|
233
|
+
case ast_1.ExpressionNodeKind.BINARY_OR: {
|
|
234
|
+
const left = evaluateExpression(node.left, ctx);
|
|
235
|
+
if (toBool(left))
|
|
236
|
+
return true;
|
|
237
|
+
return toBool(evaluateExpression(node.right, ctx));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function readPropertyWithPayloadCache(target, property, ctx) {
|
|
242
|
+
if ((0, workflow_1.isArtifactRef)(target) && !(0, workflow_1.isArtifactRefEnvelopeField)(property)) {
|
|
243
|
+
return readPayloadField(target, property, ctx);
|
|
244
|
+
}
|
|
245
|
+
return readProperty(target, property);
|
|
246
|
+
}
|
|
247
|
+
function readPayloadField(ref, property, ctx) {
|
|
248
|
+
if (!ctx.payloadCache.has(ref.versionId)) {
|
|
249
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_PAYLOAD_PARSE_ERROR, `Payload reach-in '${property}' on artifact '${ref.artifactId}' v${ref.version} ` +
|
|
250
|
+
`(versionId '${ref.versionId}') is not available — the per-step payloadCache ` +
|
|
251
|
+
`has no entry for this version. The runtime pre-fetch should have populated ` +
|
|
252
|
+
`the cache before this expression evaluated; this typically means the ref ` +
|
|
253
|
+
`surfaced from an indirection the pre-fetch walker can't trace (e.g. a ` +
|
|
254
|
+
`dynamically computed ref). Use 'fromJSON(<ref>)' as the documented ` +
|
|
255
|
+
`escape hatch when the runtime cannot statically pre-fetch.`, { artifactId: ref.artifactId, versionId: ref.versionId, version: ref.version, property });
|
|
256
|
+
}
|
|
257
|
+
const payload = ctx.payloadCache.get(ref.versionId);
|
|
258
|
+
if (payload === null || payload === undefined) {
|
|
259
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_PAYLOAD_PARSE_ERROR, `Payload reach-in '${property}' on artifact '${ref.artifactId}' v${ref.version} ` +
|
|
260
|
+
`failed: cached payload is ${payload === null ? 'null' : 'undefined'}.`, { artifactId: ref.artifactId, versionId: ref.versionId, property });
|
|
261
|
+
}
|
|
262
|
+
return readProperty(payload, property);
|
|
263
|
+
}
|
|
264
|
+
function readProperty(target, property) {
|
|
265
|
+
if (target === null || target === undefined) {
|
|
266
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Cannot read property '${property}' of ${target === null ? 'null' : 'undefined'}`, { property });
|
|
267
|
+
}
|
|
268
|
+
if (typeof target !== 'object' || Array.isArray(target)) {
|
|
269
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Member access '${property}' is not supported on ${Array.isArray(target) ? 'arrays' : typeof target}`, { property, targetKind: Array.isArray(target) ? 'array' : typeof target });
|
|
270
|
+
}
|
|
271
|
+
const record = target;
|
|
272
|
+
if (!Object.prototype.hasOwnProperty.call(record, property)) {
|
|
273
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Unknown property '${property}'. Available keys: ${Object.keys(record).sort().join(', ') || '(none)'}.`, { property, availableKeys: Object.keys(record) });
|
|
274
|
+
}
|
|
275
|
+
return record[property];
|
|
276
|
+
}
|
|
277
|
+
function toBool(value) {
|
|
278
|
+
if (typeof value === 'boolean')
|
|
279
|
+
return value;
|
|
280
|
+
if (value === null)
|
|
281
|
+
return false;
|
|
282
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Expected boolean, received ${typeof value}. Xema expressions do not implicitly coerce truthiness.`, { valueKind: value === null ? 'null' : typeof value });
|
|
283
|
+
}
|
|
284
|
+
function strictEquals(a, b) {
|
|
285
|
+
if (typeof a !== typeof b)
|
|
286
|
+
return false;
|
|
287
|
+
if (a === b)
|
|
288
|
+
return true;
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../../../../src/workflow/lib/expression/evaluator.ts"],"names":[],"mappings":";;AA6BA,8CAUC;AAWD,gDAsBC;AAxED,gEAK2C;AAC3C,sCAA6C;AAC7C,+BAWe;AAEf,qCAA2C;AAC3C,2CAAuC;AAQvC,SAAgB,iBAAiB,CAAC,MAAc;IAC9C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,yBAAgB,CACxB,4BAAiB,CA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E,CAC1E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAiC,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,yBAAgB,CACxB,4BAAiB,CAAC,sBAAsB,EACxC,qBAAqB,QAAQ,sBAAsB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,GAAG,EACvG,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACjD,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,MAAM,CAAC,KAAc;IAG5B,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,MAAM,IAAI,yBAAgB,CACxB,4BAAiB,CAAC,sBAAsB,EACxC,8BAA8B,OAAO,KAAK,yDAAyD,EACnG,EAAE,SAAS,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,EAAE,CACtD,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,CAAU,EAAE,CAAU;IAG1C,IAAI,OAAO,CAAC,KAAK,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { type ExpressionContext, type NeedsEntry, type PayloadCache, type XemaActor, type XemaContext, XemaActorKind, EMPTY_CONTEXT_SEEDS, } from './context';
|
|
2
|
+
export { compileExpression, evaluateExpression } from './evaluator';
|
|
3
|
+
export { ExpressionFunction, ExpressionNodeKind, ExpressionRoot } from './ast';
|
|
4
|
+
export type { ExpressionNode } from './ast';
|
|
5
|
+
export { extractInterpolations, isInterpolationWrapped, stripInterpolation } from './interpolation';
|
|
6
|
+
export { extractUpstreamJobKey, extractUpstreamOutputName, walkRuntimeArtifactRefTargets, } from './walk-artifact-refs';
|
|
7
|
+
export { parseTemplate, templateHasExpressions, TemplateSegmentKind, } from './template';
|
|
8
|
+
export type { TemplateExpressionSegment, TemplateLiteralSegment, TemplateSegment, } from './template';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workflow/lib/expression/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,aAAa,EACb,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC/E,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACpG,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,aAAa,EACb,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,GAChB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TemplateSegmentKind = exports.templateHasExpressions = exports.parseTemplate = exports.walkRuntimeArtifactRefTargets = exports.extractUpstreamOutputName = exports.extractUpstreamJobKey = exports.stripInterpolation = exports.isInterpolationWrapped = exports.extractInterpolations = exports.ExpressionRoot = exports.ExpressionNodeKind = exports.ExpressionFunction = exports.evaluateExpression = exports.compileExpression = exports.EMPTY_CONTEXT_SEEDS = exports.XemaActorKind = void 0;
|
|
4
|
+
var context_1 = require("./context");
|
|
5
|
+
Object.defineProperty(exports, "XemaActorKind", { enumerable: true, get: function () { return context_1.XemaActorKind; } });
|
|
6
|
+
Object.defineProperty(exports, "EMPTY_CONTEXT_SEEDS", { enumerable: true, get: function () { return context_1.EMPTY_CONTEXT_SEEDS; } });
|
|
7
|
+
var evaluator_1 = require("./evaluator");
|
|
8
|
+
Object.defineProperty(exports, "compileExpression", { enumerable: true, get: function () { return evaluator_1.compileExpression; } });
|
|
9
|
+
Object.defineProperty(exports, "evaluateExpression", { enumerable: true, get: function () { return evaluator_1.evaluateExpression; } });
|
|
10
|
+
var ast_1 = require("./ast");
|
|
11
|
+
Object.defineProperty(exports, "ExpressionFunction", { enumerable: true, get: function () { return ast_1.ExpressionFunction; } });
|
|
12
|
+
Object.defineProperty(exports, "ExpressionNodeKind", { enumerable: true, get: function () { return ast_1.ExpressionNodeKind; } });
|
|
13
|
+
Object.defineProperty(exports, "ExpressionRoot", { enumerable: true, get: function () { return ast_1.ExpressionRoot; } });
|
|
14
|
+
var interpolation_1 = require("./interpolation");
|
|
15
|
+
Object.defineProperty(exports, "extractInterpolations", { enumerable: true, get: function () { return interpolation_1.extractInterpolations; } });
|
|
16
|
+
Object.defineProperty(exports, "isInterpolationWrapped", { enumerable: true, get: function () { return interpolation_1.isInterpolationWrapped; } });
|
|
17
|
+
Object.defineProperty(exports, "stripInterpolation", { enumerable: true, get: function () { return interpolation_1.stripInterpolation; } });
|
|
18
|
+
var walk_artifact_refs_1 = require("./walk-artifact-refs");
|
|
19
|
+
Object.defineProperty(exports, "extractUpstreamJobKey", { enumerable: true, get: function () { return walk_artifact_refs_1.extractUpstreamJobKey; } });
|
|
20
|
+
Object.defineProperty(exports, "extractUpstreamOutputName", { enumerable: true, get: function () { return walk_artifact_refs_1.extractUpstreamOutputName; } });
|
|
21
|
+
Object.defineProperty(exports, "walkRuntimeArtifactRefTargets", { enumerable: true, get: function () { return walk_artifact_refs_1.walkRuntimeArtifactRefTargets; } });
|
|
22
|
+
var template_1 = require("./template");
|
|
23
|
+
Object.defineProperty(exports, "parseTemplate", { enumerable: true, get: function () { return template_1.parseTemplate; } });
|
|
24
|
+
Object.defineProperty(exports, "templateHasExpressions", { enumerable: true, get: function () { return template_1.templateHasExpressions; } });
|
|
25
|
+
Object.defineProperty(exports, "TemplateSegmentKind", { enumerable: true, get: function () { return template_1.TemplateSegmentKind; } });
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/workflow/lib/expression/index.ts"],"names":[],"mappings":";;;AAAA,qCAQmB;AAFjB,wGAAA,aAAa,OAAA;AACb,8GAAA,mBAAmB,OAAA;AAErB,yCAAoE;AAA3D,8GAAA,iBAAiB,OAAA;AAAE,+GAAA,kBAAkB,OAAA;AAC9C,6BAA+E;AAAtE,yGAAA,kBAAkB,OAAA;AAAE,yGAAA,kBAAkB,OAAA;AAAE,qGAAA,cAAc,OAAA;AAE/D,iDAAoG;AAA3F,sHAAA,qBAAqB,OAAA;AAAE,uHAAA,sBAAsB,OAAA;AAAE,mHAAA,kBAAkB,OAAA;AAC1E,2DAI8B;AAH5B,2HAAA,qBAAqB,OAAA;AACrB,+HAAA,yBAAyB,OAAA;AACzB,mIAAA,6BAA6B,OAAA;AAE/B,uCAIoB;AAHlB,yGAAA,aAAa,OAAA;AACb,kHAAA,sBAAsB,OAAA;AACtB,+GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const ANY_INTERPOLATION_RE: RegExp;
|
|
2
|
+
export declare function isInterpolationWrapped(raw: string): boolean;
|
|
3
|
+
export declare function stripInterpolation(raw: string): string;
|
|
4
|
+
export declare function extractInterpolations(node: unknown, path?: string[]): ExtractedExpression[];
|
|
5
|
+
export interface ExtractedExpression {
|
|
6
|
+
readonly path: readonly string[];
|
|
7
|
+
readonly source: string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=interpolation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../../../../src/workflow/lib/expression/interpolation.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,oBAAoB,QAAW,CAAC;AAG7C,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3D;AAMD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUtD;AAQD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,GAAE,MAAM,EAAO,GAAG,mBAAmB,EAAE,CAgC/F;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ANY_INTERPOLATION_RE = void 0;
|
|
4
|
+
exports.isInterpolationWrapped = isInterpolationWrapped;
|
|
5
|
+
exports.stripInterpolation = stripInterpolation;
|
|
6
|
+
exports.extractInterpolations = extractInterpolations;
|
|
7
|
+
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
8
|
+
const errors_1 = require("../errors");
|
|
9
|
+
const INTERPOLATION_RE = /^\s*\$\{\{\s*(?<body>[\s\S]+?)\s*\}\}\s*$/;
|
|
10
|
+
exports.ANY_INTERPOLATION_RE = /\$\{\{/;
|
|
11
|
+
function isInterpolationWrapped(raw) {
|
|
12
|
+
return INTERPOLATION_RE.test(raw);
|
|
13
|
+
}
|
|
14
|
+
function stripInterpolation(raw) {
|
|
15
|
+
const match = INTERPOLATION_RE.exec(raw);
|
|
16
|
+
if (!match) {
|
|
17
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Expression must be fully wrapped in \${{ ... }}: ${raw}`, { raw });
|
|
18
|
+
}
|
|
19
|
+
return match.groups?.['body'] ?? '';
|
|
20
|
+
}
|
|
21
|
+
function extractInterpolations(node, path = []) {
|
|
22
|
+
if (typeof node === 'string') {
|
|
23
|
+
if (isInterpolationWrapped(node)) {
|
|
24
|
+
return [{ path: [...path], source: stripInterpolation(node) }];
|
|
25
|
+
}
|
|
26
|
+
if (exports.ANY_INTERPOLATION_RE.test(node)) {
|
|
27
|
+
throw new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `Partial \${{ ... }} interpolation is not supported at ${pathLabel(path)}. Use a fully wrapped expression or plain text.`, { path });
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
if (Array.isArray(node)) {
|
|
32
|
+
const collected = [];
|
|
33
|
+
for (let i = 0; i < node.length; i++) {
|
|
34
|
+
collected.push(...extractInterpolations(node[i], [...path, String(i)]));
|
|
35
|
+
}
|
|
36
|
+
return collected;
|
|
37
|
+
}
|
|
38
|
+
if (node !== null && typeof node === 'object') {
|
|
39
|
+
const record = node;
|
|
40
|
+
const collected = [];
|
|
41
|
+
for (const key of Object.keys(record)) {
|
|
42
|
+
collected.push(...extractInterpolations(record[key], [...path, key]));
|
|
43
|
+
}
|
|
44
|
+
return collected;
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
function pathLabel(path) {
|
|
49
|
+
return path.length === 0 ? '<root>' : path.join('.');
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=interpolation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../../../../src/workflow/lib/expression/interpolation.ts"],"names":[],"mappings":";;;AAgBA,wDAEC;AAMD,gDAUC;AAQD,sDAgCC;AA1ED,gEAAsE;AACtE,sCAA6C;AAW7C,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AACxD,QAAA,oBAAoB,GAAG,QAAQ,CAAC;AAG7C,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpC,CAAC;AAMD,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,yBAAgB,CACxB,4BAAiB,CAAC,sBAAsB,EACxC,oDAAoD,GAAG,EAAE,EACzD,EAAE,GAAG,EAAE,CACR,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC;AAQD,SAAgB,qBAAqB,CAAC,IAAa,EAAE,OAAiB,EAAE;IACtE,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,IAAI,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,MAAM,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,IAAI,4BAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAGpC,MAAM,IAAI,yBAAgB,CACxB,4BAAiB,CAAC,sBAAsB,EACxC,yDAAyD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ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAQpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,UAAU,CAAC;AAqBjD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAKxF"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseExpression = parseExpression;
|
|
4
|
+
const workflow_1 = require("@xemahq/kernel-contracts/workflow");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const ast_1 = require("./ast");
|
|
7
|
+
const tokens_1 = require("./tokens");
|
|
8
|
+
function parseExpression(source, tokens) {
|
|
9
|
+
const parser = new Parser(source, tokens);
|
|
10
|
+
const node = parser.parseExpression();
|
|
11
|
+
parser.expect(tokens_1.TokenKind.EOF);
|
|
12
|
+
return node;
|
|
13
|
+
}
|
|
14
|
+
class Parser {
|
|
15
|
+
source;
|
|
16
|
+
tokens;
|
|
17
|
+
index = 0;
|
|
18
|
+
constructor(source, tokens) {
|
|
19
|
+
this.source = source;
|
|
20
|
+
this.tokens = tokens;
|
|
21
|
+
}
|
|
22
|
+
parseExpression() {
|
|
23
|
+
return this.parseOr();
|
|
24
|
+
}
|
|
25
|
+
expect(kind) {
|
|
26
|
+
const token = this.peek();
|
|
27
|
+
if (token.kind !== kind) {
|
|
28
|
+
throw this.error(`Expected ${kind} but found ${token.kind === tokens_1.TokenKind.EOF ? 'end of expression' : token.kind}`, token.column);
|
|
29
|
+
}
|
|
30
|
+
this.index++;
|
|
31
|
+
return token;
|
|
32
|
+
}
|
|
33
|
+
peek() {
|
|
34
|
+
const token = this.tokens[this.index];
|
|
35
|
+
if (!token) {
|
|
36
|
+
throw this.error('Parser consumed past end of token stream', this.source.length + 1);
|
|
37
|
+
}
|
|
38
|
+
return token;
|
|
39
|
+
}
|
|
40
|
+
consume() {
|
|
41
|
+
const token = this.peek();
|
|
42
|
+
this.index++;
|
|
43
|
+
return token;
|
|
44
|
+
}
|
|
45
|
+
match(kind) {
|
|
46
|
+
return this.peek().kind === kind;
|
|
47
|
+
}
|
|
48
|
+
parseOr() {
|
|
49
|
+
let left = this.parseAnd();
|
|
50
|
+
while (this.match(tokens_1.TokenKind.OR)) {
|
|
51
|
+
this.consume();
|
|
52
|
+
const right = this.parseAnd();
|
|
53
|
+
left = binary(ast_1.ExpressionNodeKind.BINARY_OR, left, right);
|
|
54
|
+
}
|
|
55
|
+
return left;
|
|
56
|
+
}
|
|
57
|
+
parseAnd() {
|
|
58
|
+
let left = this.parseEquality();
|
|
59
|
+
while (this.match(tokens_1.TokenKind.AND)) {
|
|
60
|
+
this.consume();
|
|
61
|
+
const right = this.parseEquality();
|
|
62
|
+
left = binary(ast_1.ExpressionNodeKind.BINARY_AND, left, right);
|
|
63
|
+
}
|
|
64
|
+
return left;
|
|
65
|
+
}
|
|
66
|
+
parseEquality() {
|
|
67
|
+
let left = this.parseUnary();
|
|
68
|
+
for (;;) {
|
|
69
|
+
if (this.match(tokens_1.TokenKind.EQ)) {
|
|
70
|
+
this.consume();
|
|
71
|
+
const right = this.parseUnary();
|
|
72
|
+
left = binary(ast_1.ExpressionNodeKind.BINARY_EQ, left, right);
|
|
73
|
+
}
|
|
74
|
+
else if (this.match(tokens_1.TokenKind.NEQ)) {
|
|
75
|
+
this.consume();
|
|
76
|
+
const right = this.parseUnary();
|
|
77
|
+
left = binary(ast_1.ExpressionNodeKind.BINARY_NEQ, left, right);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return left;
|
|
84
|
+
}
|
|
85
|
+
parseUnary() {
|
|
86
|
+
if (this.match(tokens_1.TokenKind.BANG)) {
|
|
87
|
+
this.consume();
|
|
88
|
+
const operand = this.parseUnary();
|
|
89
|
+
return { kind: ast_1.ExpressionNodeKind.UNARY_NOT, operand };
|
|
90
|
+
}
|
|
91
|
+
return this.parsePostfix();
|
|
92
|
+
}
|
|
93
|
+
parsePostfix() {
|
|
94
|
+
let node = this.parsePrimary();
|
|
95
|
+
for (;;) {
|
|
96
|
+
if (this.match(tokens_1.TokenKind.DOT)) {
|
|
97
|
+
this.consume();
|
|
98
|
+
const propertyToken = this.expect(tokens_1.TokenKind.IDENTIFIER);
|
|
99
|
+
const member = {
|
|
100
|
+
kind: ast_1.ExpressionNodeKind.MEMBER,
|
|
101
|
+
target: node,
|
|
102
|
+
property: propertyToken.value,
|
|
103
|
+
};
|
|
104
|
+
node = member;
|
|
105
|
+
}
|
|
106
|
+
else if (this.match(tokens_1.TokenKind.LBRACKET)) {
|
|
107
|
+
this.consume();
|
|
108
|
+
const indexExpr = this.parseExpression();
|
|
109
|
+
this.expect(tokens_1.TokenKind.RBRACKET);
|
|
110
|
+
const indexNode = {
|
|
111
|
+
kind: ast_1.ExpressionNodeKind.INDEX,
|
|
112
|
+
target: node,
|
|
113
|
+
index: indexExpr,
|
|
114
|
+
};
|
|
115
|
+
node = indexNode;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return node;
|
|
122
|
+
}
|
|
123
|
+
parsePrimary() {
|
|
124
|
+
const token = this.peek();
|
|
125
|
+
switch (token.kind) {
|
|
126
|
+
case tokens_1.TokenKind.LPAREN: {
|
|
127
|
+
this.consume();
|
|
128
|
+
const expr = this.parseExpression();
|
|
129
|
+
this.expect(tokens_1.TokenKind.RPAREN);
|
|
130
|
+
return expr;
|
|
131
|
+
}
|
|
132
|
+
case tokens_1.TokenKind.NUMBER: {
|
|
133
|
+
this.consume();
|
|
134
|
+
const literal = { kind: ast_1.ExpressionNodeKind.LITERAL, value: Number(token.value) };
|
|
135
|
+
return literal;
|
|
136
|
+
}
|
|
137
|
+
case tokens_1.TokenKind.STRING: {
|
|
138
|
+
this.consume();
|
|
139
|
+
const literal = { kind: ast_1.ExpressionNodeKind.LITERAL, value: token.value };
|
|
140
|
+
return literal;
|
|
141
|
+
}
|
|
142
|
+
case tokens_1.TokenKind.BOOLEAN: {
|
|
143
|
+
this.consume();
|
|
144
|
+
const literal = { kind: ast_1.ExpressionNodeKind.LITERAL, value: token.value === 'true' };
|
|
145
|
+
return literal;
|
|
146
|
+
}
|
|
147
|
+
case tokens_1.TokenKind.NULL: {
|
|
148
|
+
this.consume();
|
|
149
|
+
const literal = { kind: ast_1.ExpressionNodeKind.LITERAL, value: null };
|
|
150
|
+
return literal;
|
|
151
|
+
}
|
|
152
|
+
case tokens_1.TokenKind.IDENTIFIER: {
|
|
153
|
+
return this.parseIdentifierOrCall();
|
|
154
|
+
}
|
|
155
|
+
default:
|
|
156
|
+
throw this.error(`Unexpected token '${token.value}' at column ${token.column}`, token.column);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
parseIdentifierOrCall() {
|
|
160
|
+
const identifierToken = this.expect(tokens_1.TokenKind.IDENTIFIER);
|
|
161
|
+
const name = identifierToken.value;
|
|
162
|
+
if (this.match(tokens_1.TokenKind.LPAREN)) {
|
|
163
|
+
this.consume();
|
|
164
|
+
if (!isExpressionFunction(name)) {
|
|
165
|
+
throw this.error(`Unknown function '${name}' at column ${identifierToken.column}. Allowed: ${Object.values(ast_1.ExpressionFunction).join(', ')}.`, identifierToken.column);
|
|
166
|
+
}
|
|
167
|
+
const args = [];
|
|
168
|
+
if (!this.match(tokens_1.TokenKind.RPAREN)) {
|
|
169
|
+
args.push(this.parseExpression());
|
|
170
|
+
while (this.match(tokens_1.TokenKind.COMMA)) {
|
|
171
|
+
this.consume();
|
|
172
|
+
args.push(this.parseExpression());
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
this.expect(tokens_1.TokenKind.RPAREN);
|
|
176
|
+
return {
|
|
177
|
+
kind: ast_1.ExpressionNodeKind.CALL,
|
|
178
|
+
callee: name,
|
|
179
|
+
args,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (!isExpressionRoot(name)) {
|
|
183
|
+
throw this.error(`Unknown identifier '${name}' at column ${identifierToken.column}. Allowed roots: ${Object.values(ast_1.ExpressionRoot).join(', ')}.`, identifierToken.column);
|
|
184
|
+
}
|
|
185
|
+
const ident = { kind: ast_1.ExpressionNodeKind.IDENTIFIER, name };
|
|
186
|
+
return ident;
|
|
187
|
+
}
|
|
188
|
+
error(message, column) {
|
|
189
|
+
return new errors_1.WorkflowDslError(workflow_1.WorkflowErrorCode.DSL_EXPRESSION_INVALID, `${message} [expression: ${this.source}]`, { expression: this.source, column });
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function binary(kind, left, right) {
|
|
193
|
+
return { kind, left, right };
|
|
194
|
+
}
|
|
195
|
+
function isExpressionRoot(name) {
|
|
196
|
+
const roots = Object.values(ast_1.ExpressionRoot);
|
|
197
|
+
return roots.includes(name);
|
|
198
|
+
}
|
|
199
|
+
function isExpressionFunction(name) {
|
|
200
|
+
const fns = Object.values(ast_1.ExpressionFunction);
|
|
201
|
+
return fns.includes(name);
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=parser.js.map
|