@shipfox/expression 2.0.0 → 2.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.
@@ -1 +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"}
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;IAE3D,YAAY,KAAK,EAAE,OAAO,EAQzB;CACF"}
@@ -1,4 +1,5 @@
1
1
  export { WorkflowExpressionEvaluationError, type WorkflowExpressionEvaluationFailureReason, workflowExpressionEvaluationErrorCode, } from './errors.js';
2
2
  export { evaluateWorkflowExpression, evaluateWorkflowExpressionWithEnvironment, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed, type FailClosedPredicateOutcome, type WorkflowExpressionEnvironment, type WorkflowExpressionEvaluationContext, type WorkflowExpressionEvaluationValue, } from './evaluate-workflow-expression.js';
3
3
  export { createRangeEnvironment, MAX_RANGE_ELEMENTS } from './range.js';
4
+ export { rehydrateJsonExpressionRecord, rehydrateJsonExpressionValue, } from './rehydrate-json-expression.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,yCAAyC,EACzC,yBAAyB,EACzB,mCAAmC,EACnC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,GACvC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC"}
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,yCAAyC,EACzC,yBAAyB,EACzB,mCAAmC,EACnC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,GACvC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,GAC7B,MAAM,gCAAgC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export { WorkflowExpressionEvaluationError, workflowExpressionEvaluationErrorCode } from './errors.js';
2
2
  export { evaluateWorkflowExpression, evaluateWorkflowExpressionWithEnvironment, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed } from './evaluate-workflow-expression.js';
3
3
  export { createRangeEnvironment, MAX_RANGE_ELEMENTS } from './range.js';
4
+ export { rehydrateJsonExpressionRecord, rehydrateJsonExpressionValue } from './rehydrate-json-expression.js';
4
5
 
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +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 evaluateWorkflowExpressionWithEnvironment,\n evaluateWorkflowPredicate,\n evaluateWorkflowPredicateFailClosed,\n type FailClosedPredicateOutcome,\n type WorkflowExpressionEnvironment,\n type WorkflowExpressionEvaluationContext,\n type WorkflowExpressionEvaluationValue,\n} from './evaluate-workflow-expression.js';\nexport {createRangeEnvironment, MAX_RANGE_ELEMENTS} from './range.js';\n"],"names":["WorkflowExpressionEvaluationError","workflowExpressionEvaluationErrorCode","evaluateWorkflowExpression","evaluateWorkflowExpressionWithEnvironment","evaluateWorkflowPredicate","evaluateWorkflowPredicateFailClosed","createRangeEnvironment","MAX_RANGE_ELEMENTS"],"mappings":"AAAA,SACEA,iCAAiC,EAEjCC,qCAAqC,QAChC,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,yCAAyC,EACzCC,yBAAyB,EACzBC,mCAAmC,QAK9B,oCAAoC;AAC3C,SAAQC,sBAAsB,EAAEC,kBAAkB,QAAO,aAAa"}
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 evaluateWorkflowExpressionWithEnvironment,\n evaluateWorkflowPredicate,\n evaluateWorkflowPredicateFailClosed,\n type FailClosedPredicateOutcome,\n type WorkflowExpressionEnvironment,\n type WorkflowExpressionEvaluationContext,\n type WorkflowExpressionEvaluationValue,\n} from './evaluate-workflow-expression.js';\nexport {createRangeEnvironment, MAX_RANGE_ELEMENTS} from './range.js';\nexport {\n rehydrateJsonExpressionRecord,\n rehydrateJsonExpressionValue,\n} from './rehydrate-json-expression.js';\n"],"names":["WorkflowExpressionEvaluationError","workflowExpressionEvaluationErrorCode","evaluateWorkflowExpression","evaluateWorkflowExpressionWithEnvironment","evaluateWorkflowPredicate","evaluateWorkflowPredicateFailClosed","createRangeEnvironment","MAX_RANGE_ELEMENTS","rehydrateJsonExpressionRecord","rehydrateJsonExpressionValue"],"mappings":"AAAA,SACEA,iCAAiC,EAEjCC,qCAAqC,QAChC,cAAc;AACrB,SACEC,0BAA0B,EAC1BC,yCAAyC,EACzCC,yBAAyB,EACzBC,mCAAmC,QAK9B,oCAAoC;AAC3C,SAAQC,sBAAsB,EAAEC,kBAAkB,QAAO,aAAa;AACtE,SACEC,6BAA6B,EAC7BC,4BAA4B,QACvB,iCAAiC"}
@@ -0,0 +1,4 @@
1
+ import type { ExpressionType } from '../expression/workflow-expression.js';
2
+ export declare function rehydrateJsonExpressionRecord(values: Readonly<Record<string, unknown>> | null | undefined, types: Readonly<Record<string, ExpressionType>> | undefined): Record<string, unknown>;
3
+ export declare function rehydrateJsonExpressionValue(value: unknown, type: ExpressionType | undefined): unknown;
4
+ //# sourceMappingURL=rehydrate-json-expression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rehydrate-json-expression.d.ts","sourceRoot":"","sources":["../../src/evaluator/rehydrate-json-expression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAIzE,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAC5D,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,GAAG,SAAS,GAC1D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB;AAGD,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,cAAc,GAAG,SAAS,GAC/B,OAAO,CAuBT"}
@@ -0,0 +1,44 @@
1
+ const decimalIntegerPattern = /^-?(?:0|[1-9]\d*)$/;
2
+ export function rehydrateJsonExpressionRecord(values, types) {
3
+ if (values === null || values === undefined) return {};
4
+ if (types === undefined) return {
5
+ ...values
6
+ };
7
+ return Object.fromEntries(Object.entries(values).map(([key, value])=>[
8
+ key,
9
+ rehydrateJsonExpressionValue(value, types[key])
10
+ ]));
11
+ }
12
+ // JSON persistence stores CEL ints and timestamps as numbers/strings, but CEL evaluates them as BigInt/Date.
13
+ export function rehydrateJsonExpressionValue(value, type) {
14
+ if (value === null || type === undefined) return value;
15
+ if (type === 'int') return rehydrateInteger(value);
16
+ if (type === 'timestamp') return rehydrateTimestamp(value);
17
+ if (typeof type !== 'object') return value;
18
+ if (type.kind === 'list') {
19
+ return Array.isArray(value) ? value.map((item)=>rehydrateJsonExpressionValue(item, type.element)) : value;
20
+ }
21
+ if (type.kind === 'object' && isRecord(value)) {
22
+ return Object.fromEntries(Object.entries(value).map(([key, item])=>[
23
+ key,
24
+ rehydrateJsonExpressionValue(item, type.fields[key])
25
+ ]));
26
+ }
27
+ return value;
28
+ }
29
+ function rehydrateInteger(value) {
30
+ if (typeof value === 'bigint') return value;
31
+ if (typeof value === 'number') return Number.isSafeInteger(value) ? BigInt(value) : value;
32
+ if (typeof value !== 'string' || !decimalIntegerPattern.test(value)) return value;
33
+ return BigInt(value);
34
+ }
35
+ function rehydrateTimestamp(value) {
36
+ if (value instanceof Date || typeof value !== 'string' || !value.endsWith('Z')) return value;
37
+ const timestamp = new Date(value);
38
+ return Number.isNaN(timestamp.getTime()) ? value : timestamp;
39
+ }
40
+ function isRecord(value) {
41
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
42
+ }
43
+
44
+ //# sourceMappingURL=rehydrate-json-expression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/evaluator/rehydrate-json-expression.ts"],"sourcesContent":["import type {ExpressionType} from '../expression/workflow-expression.js';\n\nconst decimalIntegerPattern = /^-?(?:0|[1-9]\\d*)$/;\n\nexport function rehydrateJsonExpressionRecord(\n values: Readonly<Record<string, unknown>> | null | undefined,\n types: Readonly<Record<string, ExpressionType>> | undefined,\n): Record<string, unknown> {\n if (values === null || values === undefined) return {};\n if (types === undefined) return {...values};\n\n return Object.fromEntries(\n Object.entries(values).map(([key, value]) => [\n key,\n rehydrateJsonExpressionValue(value, types[key]),\n ]),\n );\n}\n\n// JSON persistence stores CEL ints and timestamps as numbers/strings, but CEL evaluates them as BigInt/Date.\nexport function rehydrateJsonExpressionValue(\n value: unknown,\n type: ExpressionType | undefined,\n): unknown {\n if (value === null || type === undefined) return value;\n\n if (type === 'int') return rehydrateInteger(value);\n if (type === 'timestamp') return rehydrateTimestamp(value);\n if (typeof type !== 'object') return value;\n\n if (type.kind === 'list') {\n return Array.isArray(value)\n ? value.map((item) => rehydrateJsonExpressionValue(item, type.element))\n : value;\n }\n\n if (type.kind === 'object' && isRecord(value)) {\n return Object.fromEntries(\n Object.entries(value).map(([key, item]) => [\n key,\n rehydrateJsonExpressionValue(item, type.fields[key]),\n ]),\n );\n }\n\n return value;\n}\n\nfunction rehydrateInteger(value: unknown): unknown {\n if (typeof value === 'bigint') return value;\n if (typeof value === 'number') return Number.isSafeInteger(value) ? BigInt(value) : value;\n if (typeof value !== 'string' || !decimalIntegerPattern.test(value)) return value;\n return BigInt(value);\n}\n\nfunction rehydrateTimestamp(value: unknown): unknown {\n if (value instanceof Date || typeof value !== 'string' || !value.endsWith('Z')) return value;\n const timestamp = new Date(value);\n return Number.isNaN(timestamp.getTime()) ? value : timestamp;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n"],"names":["decimalIntegerPattern","rehydrateJsonExpressionRecord","values","types","undefined","Object","fromEntries","entries","map","key","value","rehydrateJsonExpressionValue","type","rehydrateInteger","rehydrateTimestamp","kind","Array","isArray","item","element","isRecord","fields","Number","isSafeInteger","BigInt","test","Date","endsWith","timestamp","isNaN","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ChB;AAEA,SAASI,mBAAmBJ,KAAc;IACxC,IAAIA,iBAAiBgB,QAAQ,OAAOhB,UAAU,YAAY,CAACA,MAAMiB,QAAQ,CAAC,MAAM,OAAOjB;IACvF,MAAMkB,YAAY,IAAIF,KAAKhB;IAC3B,OAAOY,OAAOO,KAAK,CAACD,UAAUE,OAAO,MAAMpB,QAAQkB;AACrD;AAEA,SAASR,SAASV,KAAc;IAC9B,OAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQ,CAACM,MAAMC,OAAO,CAACP;AACvE"}
@@ -1 +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;AAoBD,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,kBAAkB,CAOrB"}
1
+ {"version":3,"file":"create-workflow-expression.d.ts","sourceRoot":"","sources":["../../src/expression/create-workflow-expression.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,8BAA8B,EAK9B,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAiBlC,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,8BAA8B,GACrC,kBAAkB,CAyDpB;AA0CD,wBAAgB,kCAAkC,CAAC,MAAM,EAAE;IACzD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACpC,GAAG,kBAAkB,CAOrB"}
@@ -8,6 +8,7 @@ const scalarTypeToCelType = {
8
8
  null: 'null',
9
9
  timestamp: 'google.protobuf.Timestamp'
10
10
  };
11
+ const directPathPattern = /^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)*$/;
11
12
  export function createWorkflowExpression(params) {
12
13
  const source = params.source.trim();
13
14
  let resultType;
@@ -51,7 +52,7 @@ export function createWorkflowExpression(params) {
51
52
  reason: `Expression source must return ${scalarTypeToCelType[params.check.expectedResultType]}; got ${typeCheckResult.type ?? 'unknown'}.`
52
53
  });
53
54
  }
54
- resultType = fromCelType(typeCheckResult.type);
55
+ resultType = resolveKnownPathType(source, params.check.typeEnvironment) ?? fromCelType(typeCheckResult.type);
55
56
  }
56
57
  return {
57
58
  language: 'cel',
@@ -62,6 +63,22 @@ export function createWorkflowExpression(params) {
62
63
  }
63
64
  };
64
65
  }
66
+ function resolveKnownPathType(source, typeEnvironment) {
67
+ // cel-js erases list element detail from custom result type strings, so recover
68
+ // known direct paths before falling back to its lossy result type conversion.
69
+ if (typeEnvironment === undefined || !directPathPattern.test(source)) {
70
+ return undefined;
71
+ }
72
+ const [root, ...path] = source.split('.');
73
+ let current = root === undefined ? undefined : typeEnvironment[root];
74
+ for (const segment of path){
75
+ if (current === undefined || typeof current === 'string' || current.kind !== 'object') {
76
+ return undefined;
77
+ }
78
+ current = current.fields[segment];
79
+ }
80
+ return current;
81
+ }
65
82
  function createTypeCheckingEnvironment() {
66
83
  const environment = new Environment({
67
84
  unlistedVariablesAreDyn: false
@@ -1 +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 = createTypeCheckingEnvironment();\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\nfunction createTypeCheckingEnvironment(): Environment {\n const environment = new Environment({unlistedVariablesAreDyn: false});\n\n // CEL evaluates numeric equality across types, but its static checker normally\n // rejects the same expression. Match validation to the runtime contract.\n environment.registerOperator('double == int', (left: number, right: bigint) => {\n return Number.isInteger(left) && BigInt(left) === right;\n });\n\n // Typed context fields may be absent at runtime while still exposing their\n // known shape when present. CEL's built-in equality overloads do not allow a\n // declared object type to compare with null, so keep null checks aligned with\n // the runtime context contract.\n environment.registerOperator('dyn != null', (left: unknown, right: null) => left !== right);\n\n return environment;\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","createTypeCheckingEnvironment","name","type","Object","entries","typeEnvironment","celType","toCelType","registerVariable","schema","typeCheckResult","valid","expectedResultType","undefined","fromCelType","language","unlistedVariablesAreDyn","registerOperator","left","right","Number","isInteger","BigInt","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,cAAcC;QACpB,KAAK,MAAM,CAACC,MAAMC,KAAK,IAAIC,OAAOC,O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IAAIA,KAAKuB,IAAI,KAAK,OAAO,OAAO;IAChC,IAAIvB,KAAKuB,IAAI,KAAK,UAAU,OAAO;IACnC,OAAO,CAAC,KAAK,EAAEQ,2BAA2B/B,KAAKyB,OAAO,EAAE,CAAC,CAAC;AAC5D;AAEA,SAASD,qBACPxB,IAAoB,EACpBH,WAAwB,EACxByB,YAAoB;IAEpB,IAAI,OAAOtB,SAAS,UAAU,OAAOtB,mBAAmB,CAACsB,KAAK;IAC9D,IAAIA,KAAKuB,IAAI,KAAK,OAAO,OAAO;IAChC,IAAIvB,KAAKuB,IAAI,KAAK,UAAU;QAC1B,MAAMS,WAAW,CAAC,CAAC,EAAEV,aAAa,KAAK,CAAC;QACxCzB,YAAYoC,YAAY,CAAC;YACvBlC,MAAMiC;YACNzB,QAAQN,OAAOyB,WAAW,CACxBzB,OAAOC,OAAO,CAACF,KAAK2B,MAAM,EAAEC,GAAG,CAAC,CAAC,CAAC7B,MAAM8B,MAAM,GAAK;oBAAC9B;oBAAM+B,gBAAgBD;iBAAO;QAErF;QACA,OAAOG;IACT;IACA,OAAO;AACT;AAEA,SAASpB,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;gBAACuB,MAAM;YAAK;QACrB,KAAK;YACH,OAAO;QACT;YACE,+EAA+E;YAC/E,+EAA+E;YAC/E,oDAAoD;YACpD,IAAIvB,KAAKkC,UAAU,CAAC,UAAU,OAAO;gBAACX,MAAM;gBAAQE,SAAS;oBAACF,MAAM;gBAAK;YAAC;YAC1E,OAAO;gBAACA,MAAM;YAAK;IACvB;AACF"}
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 ExpressionTypeEnvironment,\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\nconst directPathPattern = /^[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$/;\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 = createTypeCheckingEnvironment();\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 =\n resolveKnownPathType(source, params.check.typeEnvironment) ??\n 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\nfunction resolveKnownPathType(\n source: string,\n typeEnvironment: ExpressionTypeEnvironment | undefined,\n): ExpressionType | undefined {\n // cel-js erases list element detail from custom result type strings, so recover\n // known direct paths before falling back to its lossy result type conversion.\n if (typeEnvironment === undefined || !directPathPattern.test(source)) {\n return undefined;\n }\n\n const [root, ...path] = source.split('.');\n let current = root === undefined ? undefined : typeEnvironment[root];\n for (const segment of path) {\n if (current === undefined || typeof current === 'string' || current.kind !== 'object') {\n return undefined;\n }\n current = current.fields[segment];\n }\n\n return current;\n}\n\nfunction createTypeCheckingEnvironment(): Environment {\n const environment = new Environment({unlistedVariablesAreDyn: false});\n\n // CEL evaluates numeric equality across types, but its static checker normally\n // rejects the same expression. Match validation to the runtime contract.\n environment.registerOperator('double == int', (left: number, right: bigint) => {\n return Number.isInteger(left) && BigInt(left) === right;\n });\n\n // Typed context fields may be absent at runtime while still exposing their\n // known shape when present. CEL's built-in equality overloads do not allow a\n // declared object type to compare with null, so keep null checks aligned with\n // the runtime context contract.\n environment.registerOperator('dyn != null', (left: unknown, right: null) => left !== right);\n\n return environment;\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","directPathPattern","createWorkflowExpression","params","source","trim","resultType","length","reason","error","Error","message","check","mode","environment","createTypeCheckingEnvironment","name","type","Object","entries","typeEnvironment","celType","toCelType","registerVariable","schema","typeCheckResult","valid","expectedResultType","undefined","resolveKnownPathType","fromCelType","language","test","root","path","split","current","segment","kind","fields","unlistedVariablesAreDyn","registerOperator","left","right","Number","isInteger","BigInt","unsafeWorkflowExpressionFromSource","variableName","toCelListElementType","element","fromEntries","map","field","toCelSchemaType","toCelSchemaListElementType","typeName","registerType","startsWith"],"mappings":"AAAA,SAAQA,WAAW,EAAEC,SAASC,QAAQ,QAAO,uBAAuB;AACpE,SAAQC,8BAA8B,QAAO,cAAc;AAU3D,MAAMC,sBAAsB;IAC1BC,QAAQ;IACRC,KAAK;IACLC,QAAQ;IACRC,MAAM;IACNC,MAAM;IACNC,WAAW;AACb;AAMA,MAAMC,oBAAoB;AAE1B,OAAO,SAASC,yBACdC,MAAsC;IAEtC,MAAMC,SAASD,OAAOC,MAAM,CAACC,IAAI;IACjC,IAAIC;IACJ,IAAIF,OAAOG,MAAM,KAAK,GAAG;QACvB,MAAM,IAAId,+BAA+B;YACvCW,QAAQD,OAAOC,MAAM;YACrBI,QAAQ;QACV;IACF;IAEA,IAAI;QACFhB,SAASY;IACX,EAAE,OAAOK,OAAO;QACd,MAAM,IAAIhB,+BAA+B;YACvCW;YACAI,QAAQC,iBAAiBC,QAAQD,MAAME,OAAO,GAAG;QACnD;IACF;IAEA,IAAIR,OAAOS,KAAK,CAACC,IAAI,KAAK,SAAS;QACjC,MAAMC,cAAcC;QACpB,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,MAAMK;YACrC,OAAO;gBACLP,YAAYS,gBAAgB,CAAC;oBAACP;oBAAMQ,QAAQH,QAAQG,MAAM;gBAAA;YAC5D;QACF;QAEA,MAAMC,kBAAkBX,YAAYF,KAAK,CAACR;QAC1C,IAAI,CAACqB,gBAAgBC,KAAK,EAAE;YAC1B,MAAM,IAAIjC,+BAA+B;gBACvCW;gBACAI,QAAQiB,gBAA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A,MAAM;YAAK;IACvB;AACF"}
@@ -1 +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"}
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;IAExB,YAAY,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC,EAKpE;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { WorkflowExpressionEvaluationError, type WorkflowExpressionEvaluationFailureReason, workflowExpressionEvaluationErrorCode, } from './evaluator/errors.js';
2
2
  export { evaluateWorkflowExpression, evaluateWorkflowExpressionWithEnvironment, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed, type FailClosedPredicateOutcome, type WorkflowExpressionEnvironment, type WorkflowExpressionEvaluationContext, type WorkflowExpressionEvaluationValue, } from './evaluator/evaluate-workflow-expression.js';
3
3
  export { createRangeEnvironment, MAX_RANGE_ELEMENTS } from './evaluator/range.js';
4
+ export { rehydrateJsonExpressionRecord, rehydrateJsonExpressionValue, } from './evaluator/rehydrate-json-expression.js';
4
5
  export { createWorkflowExpression, unsafeWorkflowExpressionFromSource, } from './expression/create-workflow-expression.js';
5
6
  export { InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode, } from './expression/errors.js';
6
7
  export type { CreateWorkflowExpressionParams, ExpressionScalarType, ExpressionType, ExpressionTypeEnvironment, ValidCelExpression, WorkflowExpression, WorkflowExpressionCheck, WorkflowExpressionCheckOptions, } from './expression/workflow-expression.js';
@@ -1 +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,yCAAyC,EACzC,yBAAyB,EACzB,mCAAmC,EACnC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,mCAAmC,EACxC,KAAK,iCAAiC,GACvC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAC,sBAAsB,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAChF,OAAO,EACL,wBAAwB,EACxB,kCAAkC,GACnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,8BAA8B,EAC9B,kCAAkC,GACnC,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,8BAA8B,EAC9B,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,8BAA8B,GAC/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACL,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,0BAA0B,EAC1B,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,qBAAqB,EAC1B,oCAAoC,EACpC,iCAAiC,EACjC,WAAW,EACX,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AAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,oCAAoC,EACpC,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,qCAAqC,EACrC,4BAA4B,EAC5B,4BAA4B,EAC5B,qCAAqC,EACrC,kCAAkC,EAClC,2BAA2B,EAC3B,6BAA6B,EAC7B,mCAAmC,EACnC,uBAAuB,GACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,KAAK,kBAAkB,EACvB,mBAAmB,GACpB,MAAM,6CAA6C,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { WorkflowExpressionEvaluationError, workflowExpressionEvaluationErrorCode } from './evaluator/errors.js';
2
2
  export { evaluateWorkflowExpression, evaluateWorkflowExpressionWithEnvironment, evaluateWorkflowPredicate, evaluateWorkflowPredicateFailClosed } from './evaluator/evaluate-workflow-expression.js';
3
3
  export { createRangeEnvironment, MAX_RANGE_ELEMENTS } from './evaluator/range.js';
4
+ export { rehydrateJsonExpressionRecord, rehydrateJsonExpressionValue } from './evaluator/rehydrate-json-expression.js';
4
5
  export { createWorkflowExpression, unsafeWorkflowExpressionFromSource } from './expression/create-workflow-expression.js';
5
6
  export { InvalidWorkflowExpressionError, invalidWorkflowExpressionErrorCode } from './expression/errors.js';
6
7
  export { coerceStepOutputs, jsonSchemaToExpressionType, outputDeclarationsToExpressionFields, outputDeclarationToExpressionType, outputTypes, validateJsonSchema } from './outputs/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n WorkflowExpressionEvaluationError,\n type WorkflowExpressionEvaluationFailureReason,\n workflowExpressionEvaluationErrorCode,\n} from './evaluator/errors.js';\nexport {\n evaluateWorkflowExpression,\n evaluateWorkflowExpressionWithEnvironment,\n evaluateWorkflowPredicate,\n evaluateWorkflowPredicateFailClosed,\n type FailClosedPredicateOutcome,\n type WorkflowExpressionEnvironment,\n type WorkflowExpressionEvaluationContext,\n type WorkflowExpressionEvaluationValue,\n} from './evaluator/evaluate-workflow-expression.js';\nexport {createRangeEnvironment, MAX_RANGE_ELEMENTS} from './evaluator/range.js';\nexport {\n createWorkflowExpression,\n unsafeWorkflowExpressionFromSource,\n} from './expression/create-workflow-expression.js';\nexport {\n InvalidWorkflowExpressionError,\n invalidWorkflowExpressionErrorCode,\n} from './expression/errors.js';\nexport type {\n CreateWorkflowExpressionParams,\n ExpressionScalarType,\n ExpressionType,\n ExpressionTypeEnvironment,\n ValidCelExpression,\n WorkflowExpression,\n WorkflowExpressionCheck,\n WorkflowExpressionCheckOptions,\n} from './expression/workflow-expression.js';\nexport {\n type CoerceStepOutputsResult,\n coerceStepOutputs,\n type JsonSchemaValidationResult,\n jsonSchemaToExpressionType,\n type OutputDeclarations,\n type OutputType,\n type OutputTypeDeclaration,\n outputDeclarationsToExpressionFields,\n outputDeclarationToExpressionType,\n outputTypes,\n type StepOutputCoercionError,\n type StepOutputCoercionErrorReason,\n validateJsonSchema,\n} from './outputs/index.js';\nexport {isBareContextReference} from './plan/bare-reference.js';\nexport {\n analyzeContextKeyAccess,\n analyzeContextRootKeyAccess,\n type ContextKeyAccessAnalysis,\n type ContextKeyAccessReference,\n type ContextKeyAccessViolation,\n type ContextRootKeyAccessAnalysis,\n type ContextRootKeyAccessReference,\n} from './plan/context-key-access.js';\nexport {evaluatePlannedPredicateAtSite} from './plan/evaluate-planned-predicate.js';\nexport {\n capTraceEntries,\n capTraceValue,\n EVALUATION_TRACE_MAX_ENTRIES,\n EVALUATION_TRACE_VALUE_CAP_BYTES,\n type EvaluationTraceEntry,\n type EvaluationTraceLimitEntry,\n type EvaluationTraceRowEntry,\n evaluationTraceEntry,\n predicateTraceEntry,\n} from './plan/evaluation-trace.js';\nexport {extractExactContextRoots} from './plan/extract-exact-context-roots.js';\nexport {\n type FrozenResolvedField,\n freezeResolvedFieldAtSite,\n resolveFieldAtSite,\n type SiteResolvedField,\n type WorkflowTemplateDiagnostic,\n type WorkflowTemplateFailurePolicy,\n} from './plan/freeze.js';\nexport {\n type FrozenPlannedRunCommand,\n freezePlannedRunCommandAtSite,\n} from './plan/freeze-run-command.js';\nexport {\n type FieldPlan,\n type FieldPlanResult,\n type PlanViolation,\n planInterpolationField,\n} from './plan/plan-field.js';\nexport {predicateSourceIsBooleanShaped} from './plan/predicate-shape.js';\nexport type {\n ResolvedField,\n ResolvedFieldDeferredSegment,\n ResolvedFieldLiteralSegment,\n ResolvedFieldSegment,\n} from './plan/resolved-field.js';\nexport {type RoutedExpression, routeExpression} from './plan/route-expression.js';\nexport {\n type ServerEvaluabilityResult,\n type ServerEvaluabilityViolation,\n validateServerEvaluable,\n} from './plan/validate-server-evaluable.js';\nexport {\n WorkflowTemplateResolutionError,\n workflowTemplateResolutionErrorCode,\n} from './resolver/errors.js';\nexport {\n type HoistedPlannedRunCommand,\n hoistPlannedRunCommand,\n type PlannedRunCommandBinding,\n type RunCommandHoistOptions,\n type UnsafeRunInterpolation,\n UnsafeRunInterpolationError,\n unsafeRunInterpolationErrorCode,\n} from './run/hoist-run-command.js';\nexport {\n classifyShellCodePosition,\n type ShellCodePositionAnalysis,\n type ShellCodePositionMatch,\n type ShellReevaluatingConstruct,\n} from './run/shell-code-position.js';\nexport {\n InvalidWorkflowTemplateError,\n invalidWorkflowTemplateErrorCode,\n} from './template/errors.js';\nexport {extractCelContextRoots} from './template/extract-cel-context-roots.js';\nexport {parseWorkflowTemplate} from './template/parse-workflow-template.js';\nexport type {\n WorkflowTemplateExprSegment,\n WorkflowTemplateLiteralSegment,\n WorkflowTemplateSegment,\n} from './template/template-segment.js';\nexport {\n type AvailabilitySite,\n availabilitySites,\n buildTypedRootsEnvironment,\n contextRootsForField,\n type FillTarget,\n getWorkflowContextAvailability,\n getWorkflowContextDefinition,\n getWorkflowContextHost,\n getWorkflowContextSensitivity,\n getWorkflowContextTypeEnvironment,\n getWorkflowInterpolationFieldFailurePolicy,\n getWorkflowInterpolationFieldSelfReference,\n getWorkflowPredicateContextRoots,\n getWorkflowPredicateFieldMinimumFillTarget,\n getWorkflowPredicateFieldTypeEnvironment,\n isWorkflowPredicateField,\n type OpenWorkflowContextDefinition,\n projectWorkflowPredicateContext,\n type ReservedRootDefinition,\n type RunnerWorkflowContextDefinition,\n resolveContextRootAvailability,\n resolveContextRootHost,\n rootsAvailableAt,\n runnerFillTarget,\n type TypedWorkflowContextDefinition,\n unavailableRootsAt,\n type WorkflowContextAvailabilityReferenceEntry,\n type WorkflowContextDefinition,\n type WorkflowContextHost,\n type WorkflowContextName,\n type WorkflowContextReservedRoot,\n type WorkflowContextSensitivity,\n type WorkflowContextShape,\n type WorkflowFieldFailurePolicy,\n type WorkflowInterpolationFailurePolicy,\n type WorkflowInterpolationField,\n type WorkflowInterpolationFieldPolicy,\n type WorkflowJobTypeOverlay,\n type WorkflowPredicateContextRoot,\n type WorkflowPredicateField,\n type WorkflowStepTypeOverlay,\n workflowContextAvailabilityReference,\n workflowContextDefinitions,\n workflowContextHosts,\n workflowContextNames,\n workflowContextReservedRoots,\n workflowContextRootRequiresLiteralKey,\n workflowContextSensitivities,\n workflowFieldFailurePolicies,\n workflowInterpolationFieldAcceptsHost,\n workflowInterpolationFieldPolicies,\n workflowInterpolationFields,\n workflowPredicateContextRoots,\n workflowPredicateFieldFailurePolicy,\n workflowPredicateFields,\n} from './workflow-context/workflow-context.js';\nexport {\n type WorkflowContextDoc,\n workflowContextDocs,\n} from './workflow-context/workflow-context-docs.js';\n"],"names":["WorkflowExpressionEvaluationError","workflowExpressionEvaluationErrorCode","evaluateWorkflowExpression","evaluateWorkflowExpressionWithEnvironment","evaluateWorkflowPredicate","evaluateWorkflowPredicateFailClosed","createRangeEnvironment","MAX_RANGE_ELEMENTS","createWorkflowExpression","unsafeWorkflowExpressionFromSource","InvalidWorkflowExpressionError","invalidWorkflowExpressionErrorCode","coerceStepOutputs","jsonSchemaToExpressionType","outputDeclarationsToExpressionFields","outputDeclarationToExpressionType","outputTypes","validateJsonSchema","isBareContextReference","analyzeContextKeyAccess","analyzeContextRootKeyAccess","evaluatePlannedPredicateAtSite","capTraceEntries","capTraceValue","EVALUATION_TRACE_MAX_ENTRIES","EVALUATION_TRACE_VALUE_CAP_BYTES","evaluationTraceEntry","predicateTraceEntry","extractExactContextRoots","freezeResolvedFieldAtSite","resolveFieldAtSite","freezePlannedRunCommandAtSite","planInterpolationField","predicateSourceIsBooleanShaped","routeExpression","validateServerEvaluable","WorkflowTemplateResolutionError","workflowTemplateResolutionErrorCode","hoistPlannedRunCommand","UnsafeRunInterpolationError","unsafeRunInterpolationErrorCode","classifyShellCodePosition","InvalidWorkflowTemplateError","invalidWorkflowTemplateErrorCode","extractCelContextRoots","parseWorkflowTemplate","availabilitySites","buildTypedRootsEnvironment","contextRootsForField","getWorkflowContextAvailability","getWorkflowContextDefinition","getWorkflowContextHost","getWorkflowContextSensitivity","getWorkflowContextTypeEnvironment","getWorkflowInterpolationFieldFailurePolicy","getWorkflowInterpolationFieldSelfReference","getWorkflowPredicateContextRoots","getWorkflowPredicateFieldMinimumFillTarget","getWorkflowPredicateFieldTypeEnvironment","isWorkflowPredicateField","projectWorkflowPredicateContext","resolveContextRootAvailability","resolveContextRootHost","rootsAvailableAt","runnerFillTarget","unavailableRootsAt","workflowContextAvailabilityReference","workflowContextDefinitions","workflowContextHosts","workflowContextNames","workflowContextReservedRoots","workflowContextRootRequiresLiteralKey","workflowContextSensitivities","workflowFieldFailurePolicies","workflowInterpolationFieldAcceptsHost","workflowInterpolationFieldPolicies","workflowInterpolationFields","workflowPredicateContextRoots","workflowPred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,QAAO,wCAAwC;AAM5E,SAEEC,iBAAiB,EACjBC,0BAA0B,EAC1BC,oBAAoB,EAEpBC,8BAA8B,EAC9BC,4BAA4B,EAC5BC,sBAAsB,EACtBC,6BAA6B,EAC7BC,iCAAiC,EACjCC,0CAA0C,EAC1CC,0CAA0C,EAC1CC,gCAAgC,EAChCC,0CAA0C,EAC1CC,wCAAwC,EACxCC,wBAAwB,EAExBC,+BAA+B,EAG/BC,8BAA8B,EAC9BC,sBAAsB,EACtBC,gBAAgB,EAChBC,gBAAgB,EAEhBC,kBAAkB,EAgBlBC,oCAAoC,EACpCC,0BAA0B,EAC1BC,oBAAoB,EACpBC,oBAAoB,EACpBC,4BAA4B,EAC5BC,qCAAqC,EACrCC,4BAA4B,EAC5BC,4BAA4B,EAC5BC,qCAAqC,EACrCC,kCAAkC,EAClCC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,mCAAmC,EACnCC,uBAAuB,QAClB,yCAAyC;AAChD,SAEEC,mBAAmB,QACd,8CAA8C"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n WorkflowExpressionEvaluationError,\n type WorkflowExpressionEvaluationFailureReason,\n workflowExpressionEvaluationErrorCode,\n} from './evaluator/errors.js';\nexport {\n evaluateWorkflowExpression,\n evaluateWorkflowExpressionWithEnvironment,\n evaluateWorkflowPredicate,\n evaluateWorkflowPredicateFailClosed,\n type FailClosedPredicateOutcome,\n type WorkflowExpressionEnvironment,\n type WorkflowExpressionEvaluationContext,\n type WorkflowExpressionEvaluationValue,\n} from './evaluator/evaluate-workflow-expression.js';\nexport {createRangeEnvironment, MAX_RANGE_ELEMENTS} from './evaluator/range.js';\nexport {\n rehydrateJsonExpressionRecord,\n rehydrateJsonExpressionValue,\n} from './evaluator/rehydrate-json-expression.js';\nexport {\n createWorkflowExpression,\n unsafeWorkflowExpressionFromSource,\n} from './expression/create-workflow-expression.js';\nexport {\n InvalidWorkflowExpressionError,\n invalidWorkflowExpressionErrorCode,\n} from './expression/errors.js';\nexport type {\n CreateWorkflowExpressionParams,\n ExpressionScalarType,\n ExpressionType,\n ExpressionTypeEnvironment,\n ValidCelExpression,\n WorkflowExpression,\n WorkflowExpressionCheck,\n WorkflowExpressionCheckOptions,\n} from './expression/workflow-expression.js';\nexport {\n type CoerceStepOutputsResult,\n coerceStepOutputs,\n type JsonSchemaValidationResult,\n jsonSchemaToExpressionType,\n type OutputDeclarations,\n type OutputType,\n type OutputTypeDeclaration,\n outputDeclarationsToExpressionFields,\n outputDeclarationToExpressionType,\n outputTypes,\n type StepOutputCoercionError,\n type StepOutputCoercionErrorReason,\n validateJsonSchema,\n} from './outputs/index.js';\nexport {isBareContextReference} from './plan/bare-reference.js';\nexport {\n analyzeContextKeyAccess,\n analyzeContextRootKeyAccess,\n type ContextKeyAccessAnalysis,\n type ContextKeyAccessReference,\n type ContextKeyAccessViolation,\n type ContextRootKeyAccessAnalysis,\n type ContextRootKeyAccessReference,\n} from './plan/context-key-access.js';\nexport {evaluatePlannedPredicateAtSite} from './plan/evaluate-planned-predicate.js';\nexport {\n capTraceEntries,\n capTraceValue,\n EVALUATION_TRACE_MAX_ENTRIES,\n EVALUATION_TRACE_VALUE_CAP_BYTES,\n type EvaluationTraceEntry,\n type EvaluationTraceLimitEntry,\n type EvaluationTraceRowEntry,\n evaluationTraceEntry,\n predicateTraceEntry,\n} from './plan/evaluation-trace.js';\nexport {extractExactContextRoots} from './plan/extract-exact-context-roots.js';\nexport {\n type FrozenResolvedField,\n freezeResolvedFieldAtSite,\n resolveFieldAtSite,\n type SiteResolvedField,\n type WorkflowTemplateDiagnostic,\n type WorkflowTemplateFailurePolicy,\n} from './plan/freeze.js';\nexport {\n type FrozenPlannedRunCommand,\n freezePlannedRunCommandAtSite,\n} from './plan/freeze-run-command.js';\nexport {\n type FieldPlan,\n type FieldPlanResult,\n type PlanViolation,\n planInterpolationField,\n} from './plan/plan-field.js';\nexport {predicateSourceIsBooleanShaped} from './plan/predicate-shape.js';\nexport type {\n ResolvedField,\n ResolvedFieldDeferredSegment,\n ResolvedFieldLiteralSegment,\n ResolvedFieldSegment,\n} from './plan/resolved-field.js';\nexport {type RoutedExpression, routeExpression} from './plan/route-expression.js';\nexport {\n type ServerEvaluabilityResult,\n type ServerEvaluabilityViolation,\n validateServerEvaluable,\n} from './plan/validate-server-evaluable.js';\nexport {\n WorkflowTemplateResolutionError,\n workflowTemplateResolutionErrorCode,\n} from './resolver/errors.js';\nexport {\n type HoistedPlannedRunCommand,\n hoistPlannedRunCommand,\n type PlannedRunCommandBinding,\n type RunCommandHoistOptions,\n type UnsafeRunInterpolation,\n UnsafeRunInterpolationError,\n unsafeRunInterpolationErrorCode,\n} from './run/hoist-run-command.js';\nexport {\n classifyShellCodePosition,\n type ShellCodePositionAnalysis,\n type ShellCodePositionMatch,\n type ShellReevaluatingConstruct,\n} from './run/shell-code-position.js';\nexport {\n InvalidWorkflowTemplateError,\n invalidWorkflowTemplateErrorCode,\n} from './template/errors.js';\nexport {extractCelContextRoots} from './template/extract-cel-context-roots.js';\nexport {parseWorkflowTemplate} from './template/parse-workflow-template.js';\nexport type {\n WorkflowTemplateExprSegment,\n WorkflowTemplateLiteralSegment,\n WorkflowTemplateSegment,\n} from './template/template-segment.js';\nexport {\n type AvailabilitySite,\n availabilitySites,\n buildTypedRootsEnvironment,\n contextRootsForField,\n type FillTarget,\n getWorkflowContextAvailability,\n getWorkflowContextDefinition,\n getWorkflowContextHost,\n getWorkflowContextSensitivity,\n getWorkflowContextTypeEnvironment,\n getWorkflowInterpolationFieldFailurePolicy,\n getWorkflowInterpolationFieldSelfReference,\n getWorkflowPredicateContextRoots,\n getWorkflowPredicateFieldMinimumFillTarget,\n getWorkflowPredicateFieldTypeEnvironment,\n isWorkflowPredicateField,\n type OpenWorkflowContextDefinition,\n projectWorkflowPredicateContext,\n type ReservedRootDefinition,\n type RunnerWorkflowContextDefinition,\n resolveContextRootAvailability,\n resolveContextRootHost,\n rootsAvailableAt,\n runnerFillTarget,\n type TypedWorkflowContextDefinition,\n unavailableRootsAt,\n type WorkflowContextAvailabilityReferenceEntry,\n type WorkflowContextDefinition,\n type WorkflowContextHost,\n type WorkflowContextName,\n type WorkflowContextReservedRoot,\n type WorkflowContextSensitivity,\n type WorkflowContextShape,\n type WorkflowFieldFailurePolicy,\n type WorkflowInterpolationFailurePolicy,\n type WorkflowInterpolationField,\n type WorkflowInterpolationFieldPolicy,\n type WorkflowJobTypeOverlay,\n type WorkflowPredicateContextRoot,\n type WorkflowPredicateField,\n type WorkflowStepTypeOverlay,\n workflowContextAvailabilityReference,\n workflowContextDefinitions,\n workflowContextHosts,\n workflowContextNames,\n workflowContextReservedRoots,\n workflowContextRootRequiresLiteralKey,\n workflowContextSensitivities,\n workflowFieldFailurePolicies,\n workflowInterpolationFieldAcceptsHost,\n workflowInterpolationFieldPolicies,\n workflowInterpolationFields,\n workflowPredicateContextRoots,\n workflowPredicateFieldFailurePolicy,\n workflowPredicateFields,\n} from './workflow-context/workflow-context.js';\nexport {\n type WorkflowContextDoc,\n workflowContextDocs,\n} from './workflow-context/workflow-context-docs.js';\n"],"names":["WorkflowExpressionEvaluationError","workflowExpressionEvaluationErrorCode","evaluateWorkflowExpression","evaluateWorkflowExpressionWithEnvironment","evaluateWorkflowPredicate","evaluateWorkflowPredicateFailClosed","createRangeEnvironment","MAX_RANGE_ELEMENTS","rehydrateJsonExpressionRecord","rehydrateJsonExpressionValue","createWorkflowExpression","unsafeWorkflowExpressionFromSource","InvalidWorkflowExpressionError","invalidWorkflowExpressionErrorCode","coerceStepOutputs","jsonSchemaToExpressionType","outputDeclarationsToExpressionFields","outputDeclarationToExpressionType","outputTypes","validateJsonSchema","isBareContextReference","analyzeContextKeyAccess","analyzeContextRootKeyAccess","evaluatePlannedPredicateAtSite","capTraceEntries","capTraceValue","EVALUATION_TRACE_MAX_ENTRIES","EVALUATION_TRACE_VALUE_CAP_BYTES","evaluationTraceEntry","predicateTraceEntry","extractExactContextRoots","freezeResolvedFieldAtSite","resolveFieldAtSite","freezePlannedRunCommandAtSite","planInterpolationField","predicateSourceIsBooleanShaped","routeExpression","validateServerEvaluable","WorkflowTemplateResolutionError","workflowTemplateResolutionErrorCode","hoistPlannedRunCommand","UnsafeRunInterpolationError","unsafeRunInterpolationErrorCode","classifyShellCodePosition","InvalidWorkflowTemplateError","invalidWorkflowTemplateErrorCode","extractCelContextRoots","parseWorkflowTemplate","availabilitySites","buildTypedRootsEnvironment","contextRootsForField","getWorkflowContextAvailability","getWorkflowContextDefinition","getWorkflowContextHost","getWorkflowContextSensitivity","getWorkflowContextTypeEnvironment","getWorkflowInterpolationFieldFailurePolicy","getWorkflowInterpolationFieldSelfReference","getWorkflowPredicateContextRoots","getWorkflowPredicateFieldMinimumFillTarget","getWorkflowPredicateFieldTypeEnvironment","isWorkflowPredicateField","projectWorkflowPredicateContext","resolveContextRootAvailability","resolveContextRootHost","rootsAvailableAt","runnerFillTarget","unavailableRootsAt","workflowContextAvailabilityReference","workflowContextDefinitions","workflowContextHosts","workflowContextNames","workflowContextReservedRoots","workflowContextRootRequiresLiteralKey","workflowContextSensitivities","workflowFieldFailurePolicies","workflowInterpolationFieldAcceptsHost","workflowInterpolationFieldPolicies","workflowInterpolationFields","workflowPredicateContextRoots","workflowPredicateFieldFailurePolicy","workflowPredicateFields","workflowContextDocs"],"mappings":"AAAA,SACEA,iCAAiC,EAEjCC,qCAAqC,QAChC,wBAAwB;AAC/B,SACEC,0BAA0B,EAC1BC,yCAAyC,EACzCC,yBAAyB,EACzBC,mCAAmC,QAK9B,8CAA8C;AACrD,SAAQC,sBAAsB,EAAEC,kBAAkB,QAAO,uBAAuB;AAChF,SACEC,6BAA6B,EAC7BC,4BAA4B,QACvB,2CAA2C;AAClD,SACEC,wBAAwB,EACxBC,kCAAkC,QAC7B,6CAA6C;AACpD,SACEC,8BAA8B,EAC9BC,kCAAkC,QAC7B,yBAAyB;AAWhC,SAEEC,iBAAiB,EAEjBC,0BAA0B,EAI1BC,oCAAoC,EACpCC,iC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,4BAA4B,CAa9B"}
@@ -160,7 +160,7 @@ function recordLiteralKeyRootAccess(chain, source, references, violations) {
160
160
  }
161
161
  function recordContextRootKeyAccess(chain, source, references, violations) {
162
162
  const [key] = chain.segments;
163
- if (chain.computed || key === undefined) {
163
+ if (chain.rootKeyComputed || key === undefined) {
164
164
  violations.push({
165
165
  root: chain.root,
166
166
  ...key === undefined ? {} : {
@@ -181,7 +181,8 @@ function accessChain(node, scopedIdentifiers) {
181
181
  return scopedIdentifiers.has(node.args) ? undefined : {
182
182
  root: node.args,
183
183
  segments: [],
184
- computed: false
184
+ computed: false,
185
+ rootKeyComputed: false
185
186
  };
186
187
  case '.':
187
188
  {
@@ -205,7 +206,8 @@ function accessChain(node, scopedIdentifiers) {
205
206
  ...target.segments,
206
207
  node.args[1]
207
208
  ],
208
- computed: true
209
+ computed: true,
210
+ rootKeyComputed: target.segments.length === 0 || target.rootKeyComputed
209
211
  };
210
212
  }
211
213
  case '[]':
@@ -220,7 +222,8 @@ function accessChain(node, scopedIdentifiers) {
220
222
  ...target.segments,
221
223
  literalSegment
222
224
  ],
223
- computed: true
225
+ computed: true,
226
+ rootKeyComputed: target.segments.length === 0 || target.rootKeyComputed
224
227
  };
225
228
  }
226
229
  default:
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plan/context-key-access.ts"],"sourcesContent":["import {type ASTNode, type BinaryOperator, parse as parseCel} from '@marcbachmann/cel-js';\nimport type {WorkflowExpression} from '../expression/workflow-expression.js';\nimport {workflowContextRootRequiresLiteralKey} from '../workflow-context/workflow-context.js';\n\nconst binaryOperators = new Set<BinaryOperator>([\n '!=',\n '==',\n 'in',\n '+',\n '-',\n '*',\n '/',\n '%',\n '<',\n '<=',\n '>',\n '>=',\n]);\n\nconst comprehensionMethods = new Set(['all', 'exists', 'exists_one', 'filter', 'map']);\n\nexport interface ContextKeyAccessReference {\n readonly root: 'vars' | 'secrets';\n readonly store?: string;\n readonly key: string;\n}\n\nexport interface ContextKeyAccessViolation {\n readonly root: string;\n /** First key when a computed access still uses a literal string key. */\n readonly key?: string;\n readonly source: string;\n}\n\nexport interface ContextKeyAccessAnalysis {\n readonly references: readonly ContextKeyAccessReference[];\n readonly violations: readonly ContextKeyAccessViolation[];\n}\n\nexport interface ContextRootKeyAccessReference {\n readonly root: string;\n readonly key: string;\n}\n\nexport interface ContextRootKeyAccessAnalysis {\n readonly references: readonly ContextRootKeyAccessReference[];\n readonly violations: readonly ContextKeyAccessViolation[];\n}\n\ninterface AccessChain {\n readonly root: string;\n readonly segments: readonly string[];\n readonly computed: boolean;\n}\n\ninterface ContextAccessVisitor {\n readonly shouldRecord: (chain: AccessChain) => boolean;\n readonly record: (chain: AccessChain, source: string) => void;\n}\n\nexport function analyzeContextKeyAccess(\n expression: WorkflowExpression | string,\n): ContextKeyAccessAnalysis {\n const source = typeof expression === 'string' ? expression : expression.source;\n const references: ContextKeyAccessReference[] = [];\n const violations: ContextKeyAccessViolation[] = [];\n\n collectContextAccesses(parseCel(source).ast, source, new Set(), {\n shouldRecord: (chain) => workflowContextRootRequiresLiteralKey(chain.root),\n record: (chain, expressionSource) =>\n recordLiteralKeyRootAccess(chain, expressionSource, references, violations),\n });\n\n return {references, violations};\n}\n\nexport function analyzeContextRootKeyAccess(\n expression: WorkflowExpression | string,\n roots: readonly string[],\n): ContextRootKeyAccessAnalysis {\n const source = typeof expression === 'string' ? expression : expression.source;\n const references: ContextRootKeyAccessReference[] = [];\n const violations: ContextKeyAccessViolation[] = [];\n const selectedRoots = new Set(roots);\n\n collectContextAccesses(parseCel(source).ast, source, new Set(), {\n shouldRecord: (chain) => selectedRoots.has(chain.root),\n record: (chain, expressionSource) =>\n recordContextRootKeyAccess(chain, expressionSource, references, violations),\n });\n\n return {references, violations};\n}\n\nfunction collectContextAccesses(\n node: ASTNode,\n source: string,\n scopedIdentifiers: ReadonlySet<string>,\n visitor: ContextAccessVisitor,\n): void {\n if (binaryOperators.has(node.op as BinaryOperator) || node.op === '||' || node.op === '&&') {\n collectBinaryContextAccesses(\n node.args as [ASTNode, ASTNode],\n source,\n scopedIdentifiers,\n visitor,\n );\n return;\n }\n\n const chain = accessChain(node, scopedIdentifiers);\n if (chain && visitor.shouldRecord(chain)) {\n visitor.record(chain, source);\n return;\n }\n\n switch (node.op) {\n case 'id':\n case 'value':\n return;\n case '.':\n case '.?':\n collectContextAccesses(node.args[0], source, scopedIdentifiers, visitor);\n return;\n case '[]':\n case '[?]':\n collectBinaryContextAccesses(node.args, source, scopedIdentifiers, visitor);\n return;\n case 'call':\n for (const argument of node.args[1]) {\n collectContextAccesses(argument, source, scopedIdentifiers, visitor);\n }\n return;\n case 'rcall': {\n const [method, receiver, args] = node.args as [string, ASTNode, ASTNode[]];\n collectContextAccesses(receiver, source, scopedIdentifiers, visitor);\n const binding = bindComprehensionAlias(method, args, scopedIdentifiers);\n for (const argument of args.slice(binding.skipArgs)) {\n collectContextAccesses(argument, source, binding.scopedIdentifiers, visitor);\n }\n return;\n }\n case 'list':\n for (const element of node.args) {\n collectContextAccesses(element, source, scopedIdentifiers, visitor);\n }\n return;\n case 'map':\n for (const [key, value] of node.args) {\n if (key.op !== 'id') {\n collectContextAccesses(key, source, scopedIdentifiers, visitor);\n }\n collectContextAccesses(value, source, scopedIdentifiers, visitor);\n }\n return;\n case '?:':\n collectContextAccesses(node.args[0], source, scopedIdentifiers, visitor);\n collectContextAccesses(node.args[1], source, scopedIdentifiers, visitor);\n collectContextAccesses(node.args[2], source, scopedIdentifiers, visitor);\n return;\n case '!_':\n case '-_':\n collectContextAccesses(node.args, source, scopedIdentifiers, visitor);\n return;\n }\n\n throw new Error(`Unsupported CEL AST operator: ${(node as {op: string}).op}`);\n}\n\nfunction collectBinaryContextAccesses(\n [left, right]: [ASTNode, ASTNode],\n source: string,\n scopedIdentifiers: ReadonlySet<string>,\n visitor: ContextAccessVisitor,\n): void {\n collectContextAccesses(left, source, scopedIdentifiers, visitor);\n collectContextAccesses(right, source, scopedIdentifiers, visitor);\n}\n\nfunction recordLiteralKeyRootAccess(\n chain: AccessChain,\n source: string,\n references: ContextKeyAccessReference[],\n violations: ContextKeyAccessViolation[],\n): void {\n if (chain.computed) {\n violations.push({root: chain.root, source});\n return;\n }\n\n if (chain.root === 'vars' && chain.segments.length === 1) {\n const key = chain.segments[0];\n if (key === undefined) throw new Error('Expected vars key segment');\n references.push({root: chain.root, key});\n return;\n }\n\n if (chain.root === 'secrets' && chain.segments.length === 1) {\n const key = chain.segments[0];\n if (key === undefined) throw new Error('Expected secret key segment');\n references.push({root: chain.root, key});\n return;\n }\n\n if (chain.root === 'secrets' && chain.segments.length === 2) {\n const store = chain.segments[0];\n const key = chain.segments[1];\n if (store === undefined || key === undefined) {\n throw new Error('Expected secret store and key segments');\n }\n references.push({root: chain.root, store, key});\n return;\n }\n\n violations.push({root: chain.root, source});\n}\n\nfunction recordContextRootKeyAccess(\n chain: AccessChain,\n source: string,\n references: ContextRootKeyAccessReference[],\n violations: ContextKeyAccessViolation[],\n): void {\n const [key] = chain.segments;\n if (chain.computed || key === undefined) {\n violations.push({root: chain.root, ...(key === undefined ? {} : {key}), source});\n return;\n }\n\n references.push({root: chain.root, key});\n}\n\nfunction accessChain(\n node: ASTNode,\n scopedIdentifiers: ReadonlySet<string>,\n): AccessChain | undefined {\n switch (node.op) {\n case 'id':\n return scopedIdentifiers.has(node.args)\n ? undefined\n : {root: node.args, segments: [], computed: false};\n case '.': {\n const target = accessChain(node.args[0], scopedIdentifiers);\n if (target === undefined) return undefined;\n return {...target, segments: [...target.segments, node.args[1]]};\n }\n case '.?': {\n const target = accessChain(node.args[0], scopedIdentifiers);\n if (target === undefined) return undefined;\n return {...target, segments: [...target.segments, node.args[1]], computed: true};\n }\n case '[]':\n case '[?]': {\n const target = accessChain(node.args[0], scopedIdentifiers);\n if (target === undefined) return undefined;\n const literalSegment = literalStringValue(node.args[1]);\n return {\n ...target,\n segments:\n literalSegment === undefined ? target.segments : [...target.segments, literalSegment],\n computed: true,\n };\n }\n default:\n return undefined;\n }\n}\n\nfunction literalStringValue(node: ASTNode): string | undefined {\n return node.op === 'value' && typeof node.args === 'string' ? node.args : undefined;\n}\n\nfunction bindComprehensionAlias(\n method: string,\n args: readonly ASTNode[],\n scopedIdentifiers: ReadonlySet<string>,\n): {readonly scopedIdentifiers: ReadonlySet<string>; readonly skipArgs: number} {\n if (!comprehensionMethods.has(method)) return {scopedIdentifiers, skipArgs: 0};\n\n const [alias] = args;\n if (alias?.op !== 'id') return {scopedIdentifiers, skipArgs: 0};\n\n return {\n scopedIdentifiers: new Set([...scopedIdentifiers, alias.args]),\n skipArgs: 1,\n };\n}\n"],"names":["parse","parseCel","workflowContextRootRequiresLiteralKey","binaryOperators","Set","comprehensionMethods","analyzeContextKeyAccess","expression","source","references","violations","collectContextAccesses","ast","shouldRecord","chain","root","record","expressionSource","recordLiteralKeyRootAccess","analyzeContextRootKeyAccess","roots","selectedRoots","has","recordContextRootKeyAccess","node","scopedIdentifiers","visitor","op","collectBinaryContextAccesses","args","accessChain","argument","method","receiver","binding","bindComprehensionAlias","slice","skipArgs","element","key","value","Error","left","right","computed","push","segments","length","undefined","store","target","literalSegment","literalStringValue","alias"],"mappings":"AAAA,SAA2CA,SAASC,QAAQ,QAAO,uBAAuB;AAE1F,SAAQC,qCAAqC,QAAO,0CAA0C;AAE9F,MAAMC,kBAAkB,IAAIC,IAAoB;IAC9C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,uBAAuB,IAAID,IAAI;IAAC;IAAO;IAAU;IAAc;IAAU;CAAM;AAyCrF,OAAO,SAASE,wBACdC,UAAuC;IAEvC,MAAMC,SAAS,OAAOD,eAAe,WAAWA,aAAaA,WAAWC,MAAM;IAC9E,MAAMC,aAA0C,EAAE;IAClD,MAAMC,aAA0C,EAAE;IAElDC,uBAAuBV,SAASO,QAAQI,GAAG,EAAEJ,QAAQ,IAAIJ,OAAO;QAC9DS,cAAc,CAACC,QAAUZ,sCAAsCY,MAAM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,EAAE;gBACtD,OAAO;oBACL,GAAGqB,MAAM;oBACTJ,UACEK,mBAAmBH,YAAYE,OAAOJ,QAAQ,GAAG;2BAAII,OAAOJ,QAAQ;wBAAEK;qBAAe;oBACvFP,UAAU;gBACZ;YACF;QACA;YACE,OAAOI;IACX;AACF;AAEA,SAASI,mBAAmB5B,IAAa;IACvC,OAAOA,KAAKG,EAAE,KAAK,WAAW,OAAOH,KAAKK,IAAI,KAAK,WAAWL,KAAKK,IAAI,GAAGmB;AAC5E;AAEA,SAASb,uBACPH,MAAc,EACdH,IAAwB,EACxBJ,iBAAsC;IAEtC,IAAI,CAACpB,qBAAqBiB,GAAG,CAACU,SAAS,OAAO;QAACP;QAAmBY,UAAU;IAAC;IAE7E,MAAM,CAACgB,MAAM,GAAGxB;IAChB,IAAIwB,OAAO1B,OAAO,MAAM,OAAO;QAACF;QAAmBY,UAAU;IAAC;IAE9D,OAAO;QACLZ,mBAAmB,IAAIrB,IAAI;eAAIqB;YAAmB4B,MAAMxB,IAAI;SAAC;QAC7DQ,UAAU;IACZ;AACF"}
1
+ {"version":3,"sources":["../../src/plan/context-key-access.ts"],"sourcesContent":["import {type ASTNode, type BinaryOperator, parse as parseCel} from '@marcbachmann/cel-js';\nimport type {WorkflowExpression} from '../expression/workflow-expression.js';\nimport {workflowContextRootRequiresLiteralKey} from '../workflow-context/workflow-context.js';\n\nconst binaryOperators = new Set<BinaryOperator>([\n '!=',\n '==',\n 'in',\n '+',\n '-',\n '*',\n '/',\n '%',\n '<',\n '<=',\n '>',\n '>=',\n]);\n\nconst comprehensionMethods = new Set(['all', 'exists', 'exists_one', 'filter', 'map']);\n\nexport interface ContextKeyAccessReference {\n readonly root: 'vars' | 'secrets';\n readonly store?: string;\n readonly key: string;\n}\n\nexport interface ContextKeyAccessViolation {\n readonly root: string;\n /** First key when a computed access still uses a literal string key. */\n readonly key?: string;\n readonly source: string;\n}\n\nexport interface ContextKeyAccessAnalysis {\n readonly references: readonly ContextKeyAccessReference[];\n readonly violations: readonly ContextKeyAccessViolation[];\n}\n\nexport interface ContextRootKeyAccessReference {\n readonly root: string;\n readonly key: string;\n}\n\nexport interface ContextRootKeyAccessAnalysis {\n readonly references: readonly ContextRootKeyAccessReference[];\n readonly violations: readonly ContextKeyAccessViolation[];\n}\n\ninterface AccessChain {\n readonly root: string;\n readonly segments: readonly string[];\n readonly computed: boolean;\n readonly rootKeyComputed: boolean;\n}\n\ninterface ContextAccessVisitor {\n readonly shouldRecord: (chain: AccessChain) => boolean;\n readonly record: (chain: AccessChain, source: string) => void;\n}\n\nexport function analyzeContextKeyAccess(\n expression: WorkflowExpression | string,\n): ContextKeyAccessAnalysis {\n const source = typeof expression === 'string' ? expression : expression.source;\n const references: ContextKeyAccessReference[] = [];\n const violations: ContextKeyAccessViolation[] = [];\n\n collectContextAccesses(parseCel(source).ast, source, new Set(), {\n shouldRecord: (chain) => workflowContextRootRequiresLiteralKey(chain.root),\n record: (chain, expressionSource) =>\n recordLiteralKeyRootAccess(chain, expressionSource, references, violations),\n });\n\n return {references, violations};\n}\n\nexport function analyzeContextRootKeyAccess(\n expression: WorkflowExpression | string,\n roots: readonly string[],\n): ContextRootKeyAccessAnalysis {\n const source = typeof expression === 'string' ? expression : expression.source;\n const references: ContextRootKeyAccessReference[] = [];\n const violations: ContextKeyAccessViolation[] = [];\n const selectedRoots = new Set(roots);\n\n collectContextAccesses(parseCel(source).ast, source, new Set(), {\n shouldRecord: (chain) => selectedRoots.has(chain.root),\n record: (chain, expressionSource) =>\n recordContextRootKeyAccess(chain, expressionSource, references, violations),\n });\n\n return {references, violations};\n}\n\nfunction collectContextAccesses(\n node: ASTNode,\n source: string,\n scopedIdentifiers: ReadonlySet<string>,\n visitor: ContextAccessVisitor,\n): void {\n if (binaryOperators.has(node.op as BinaryOperator) || node.op === '||' || node.op === '&&') {\n collectBinaryContextAccesses(\n node.args as [ASTNode, ASTNode],\n source,\n scopedIdentifiers,\n visitor,\n );\n return;\n }\n\n const chain = accessChain(node, scopedIdentifiers);\n if (chain && visitor.shouldRecord(chain)) {\n visitor.record(chain, source);\n return;\n }\n\n switch (node.op) {\n case 'id':\n case 'value':\n return;\n case '.':\n case '.?':\n collectContextAccesses(node.args[0], source, scopedIdentifiers, visitor);\n return;\n case '[]':\n case '[?]':\n collectBinaryContextAccesses(node.args, source, scopedIdentifiers, visitor);\n return;\n case 'call':\n for (const argument of node.args[1]) {\n collectContextAccesses(argument, source, scopedIdentifiers, visitor);\n }\n return;\n case 'rcall': {\n const [method, receiver, args] = node.args as [string, ASTNode, ASTNode[]];\n collectContextAccesses(receiver, source, scopedIdentifiers, visitor);\n const binding = bindComprehensionAlias(method, args, scopedIdentifiers);\n for (const argument of args.slice(binding.skipArgs)) {\n collectContextAccesses(argument, source, binding.scopedIdentifiers, visitor);\n }\n return;\n }\n case 'list':\n for (const element of node.args) {\n collectContextAccesses(element, source, scopedIdentifiers, visitor);\n }\n return;\n case 'map':\n for (const [key, value] of node.args) {\n if (key.op !== 'id') {\n collectContextAccesses(key, source, scopedIdentifiers, visitor);\n }\n collectContextAccesses(value, source, scopedIdentifiers, visitor);\n }\n return;\n case '?:':\n collectContextAccesses(node.args[0], source, scopedIdentifiers, visitor);\n collectContextAccesses(node.args[1], source, scopedIdentifiers, visitor);\n collectContextAccesses(node.args[2], source, scopedIdentifiers, visitor);\n return;\n case '!_':\n case '-_':\n collectContextAccesses(node.args, source, scopedIdentifiers, visitor);\n return;\n }\n\n throw new Error(`Unsupported CEL AST operator: ${(node as {op: string}).op}`);\n}\n\nfunction collectBinaryContextAccesses(\n [left, right]: [ASTNode, ASTNode],\n source: string,\n scopedIdentifiers: ReadonlySet<string>,\n visitor: ContextAccessVisitor,\n): void {\n collectContextAccesses(left, source, scopedIdentifiers, visitor);\n collectContextAccesses(right, source, scopedIdentifiers, visitor);\n}\n\nfunction recordLiteralKeyRootAccess(\n chain: AccessChain,\n source: string,\n references: ContextKeyAccessReference[],\n violations: ContextKeyAccessViolation[],\n): void {\n if (chain.computed) {\n violations.push({root: chain.root, source});\n return;\n }\n\n if (chain.root === 'vars' && chain.segments.length === 1) {\n const key = chain.segments[0];\n if (key === undefined) throw new Error('Expected vars key segment');\n references.push({root: chain.root, key});\n return;\n }\n\n if (chain.root === 'secrets' && chain.segments.length === 1) {\n const key = chain.segments[0];\n if (key === undefined) throw new Error('Expected secret key segment');\n references.push({root: chain.root, key});\n return;\n }\n\n if (chain.root === 'secrets' && chain.segments.length === 2) {\n const store = chain.segments[0];\n const key = chain.segments[1];\n if (store === undefined || key === undefined) {\n throw new Error('Expected secret store and key segments');\n }\n references.push({root: chain.root, store, key});\n return;\n }\n\n violations.push({root: chain.root, source});\n}\n\nfunction recordContextRootKeyAccess(\n chain: AccessChain,\n source: string,\n references: ContextRootKeyAccessReference[],\n violations: ContextKeyAccessViolation[],\n): void {\n const [key] = chain.segments;\n if (chain.rootKeyComputed || key === undefined) {\n violations.push({root: chain.root, ...(key === undefined ? {} : {key}), source});\n return;\n }\n\n references.push({root: chain.root, key});\n}\n\nfunction accessChain(\n node: ASTNode,\n scopedIdentifiers: ReadonlySet<string>,\n): AccessChain | undefined {\n switch (node.op) {\n case 'id':\n return scopedIdentifiers.has(node.args)\n ? undefined\n : {root: node.args, segments: [], computed: false, rootKeyComputed: false};\n case '.': {\n const target = accessChain(node.args[0], scopedIdentifiers);\n if (target === undefined) return undefined;\n return {...target, segments: [...target.segments, node.args[1]]};\n }\n case '.?': {\n const target = accessChain(node.args[0], scopedIdentifiers);\n if (target === undefined) return undefined;\n return {\n ...target,\n segments: [...target.segments, node.args[1]],\n computed: true,\n rootKeyComputed: target.segments.length === 0 || target.rootKeyComputed,\n };\n }\n case '[]':\n case '[?]': {\n const target = accessChain(node.args[0], scopedIdentifiers);\n if (target === undefined) return undefined;\n const literalSegment = literalStringValue(node.args[1]);\n return {\n ...target,\n segments:\n literalSegment === undefined ? target.segments : [...target.segments, literalSegment],\n computed: true,\n rootKeyComputed: target.segments.length === 0 || target.rootKeyComputed,\n };\n }\n default:\n return undefined;\n }\n}\n\nfunction literalStringValue(node: ASTNode): string | undefined {\n return node.op === 'value' && typeof node.args === 'string' ? node.args : undefined;\n}\n\nfunction bindComprehensionAlias(\n method: string,\n args: readonly ASTNode[],\n scopedIdentifiers: ReadonlySet<string>,\n): {readonly scopedIdentifiers: ReadonlySet<string>; readonly skipArgs: number} {\n if (!comprehensionMethods.has(method)) return {scopedIdentifiers, skipArgs: 0};\n\n const [alias] = args;\n if (alias?.op !== 'id') return {scopedIdentifiers, skipArgs: 0};\n\n return {\n scopedIdentifiers: new Set([...scopedIdentifiers, alias.args]),\n skipArgs: 1,\n };\n}\n"],"names":["parse","parseCel","workflowContextRootRequiresLiteralKey","binaryOperators","Set","comprehensionMethods","analyzeContextKeyAccess","expression","source","references","violations","collectContextAccesses","ast","shouldRecord","chain","root","record","expressionSource","recordLiteralKeyRootAccess","analyzeContextRootKeyAccess","roots","selectedRoots","has","recordContextRootKeyAccess","node","scopedIdentifiers","visitor","op","collectBinaryContextAccesses","args","accessChain","argument","method","receiver","binding","bindComprehensionAlias","slice","skipArgs","element","key","value","Error","left","right","computed","push","segments","length","undefined","store","rootKeyComputed","target","literalSegment","literalStringValue","alias"],"mappings":"AAAA,SAA2CA,SAASC,QAAQ,QAAO,uBAAuB;AAE1F,SAAQC,qCAAqC,QAAO,0CAA0C;AAE9F,MAAMC,kBAAkB,IAAIC,IAAoB;IAC9C;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,uBAAuB,IAAID,IAAI;IAAC;IAAO;IAAU;IAAc;IAAU;CAAM;AA0CrF,OAAO,SAASE,wBACdC,UAAuC;IAEvC,MAAMC,SAAS,OAAOD,eAAe,WAAWA,aAAaA,WAAWC,MAAM;IAC9E,MAAMC,aAA0C,EAAE;IAClD,MAAMC,aAA0C,EAAE;IAElDC,uBAAuBV,SAASO,QAAQI,GAAG,EAAEJ,QAAQ,IAAIJ,OAAO;QAC9DS,cAAc,C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I,CAAC,EAAE,EAAEJ;gBACzC,IAAI0B,WAAWH,WAAW,OAAOA;gBACjC,MAAMI,iBAAiBC,mBAAmB7B,KAAKK,IAAI,CAAC,EAAE;gBACtD,OAAO;oBACL,GAAGsB,MAAM;oBACTL,UACEM,mBAAmBJ,YAAYG,OAAOL,QAAQ,GAAG;2BAAIK,OAAOL,QAAQ;wBAAEM;qBAAe;oBACvFR,UAAU;oBACVM,iBAAiBC,OAAOL,QAAQ,CAACC,MAAM,KAAK,KAAKI,OAAOD,eAAe;gBACzE;YACF;QACA;YACE,OAAOF;IACX;AACF;AAEA,SAASK,mBAAmB7B,IAAa;IACvC,OAAOA,KAAKG,EAAE,KAAK,WAAW,OAAOH,KAAKK,IAAI,KAAK,WAAWL,KAAKK,IAAI,GAAGmB;AAC5E;AAEA,SAASb,uBACPH,MAAc,EACdH,IAAwB,EACxBJ,iBAAsC;IAEtC,IAAI,CAACpB,qBAAqBiB,GAAG,CAACU,SAAS,OAAO;QAACP;QAAmBY,UAAU;IAAC;IAE7E,MAAM,CAACiB,MAAM,GAAGzB;IAChB,IAAIyB,OAAO3B,OAAO,MAAM,OAAO;QAACF;QAAmBY,UAAU;IAAC;IAE9D,OAAO;QACLZ,mBAAmB,IAAIrB,IAAI;eAAIqB;YAAmB6B,MAAMzB,IAAI;SAAC;QAC7DQ,UAAU;IACZ;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/resolver/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,wCAAwC,CAAC;AAEzF,qBAAa,+BAAgC,SAAQ,KAAK;IACxD,QAAQ,CAAC,IAAI,yCAAuC;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAC;CAKrD"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/resol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":"errors.d.ts","sourceRoot":"","sources":["../../src/template/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gCAAgC,8BAA8B,CAAC;AAE5E,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,+BAAoC;IACjD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAC,EAMpF;CACF"}