@telorun/templating 0.20.1 → 0.21.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.
Files changed (40) hide show
  1. package/dist/cel/analyze.d.ts +26 -0
  2. package/dist/cel/analyze.d.ts.map +1 -1
  3. package/dist/cel/analyze.js +114 -8
  4. package/dist/cel/catalog.d.ts.map +1 -1
  5. package/dist/cel/catalog.js +10 -0
  6. package/dist/cel/compile.d.ts +9 -3
  7. package/dist/cel/compile.d.ts.map +1 -1
  8. package/dist/cel/compile.js +52 -11
  9. package/dist/cel/diagnose.d.ts +10 -1
  10. package/dist/cel/diagnose.d.ts.map +1 -1
  11. package/dist/cel/diagnose.js +42 -6
  12. package/dist/cel/environment.d.ts.map +1 -1
  13. package/dist/cel/environment.js +2 -0
  14. package/dist/cel/module-call.d.ts +108 -0
  15. package/dist/cel/module-call.d.ts.map +1 -0
  16. package/dist/cel/module-call.js +245 -0
  17. package/dist/cel/value-identity.d.ts +18 -0
  18. package/dist/cel/value-identity.d.ts.map +1 -0
  19. package/dist/cel/value-identity.js +25 -0
  20. package/dist/engine.d.ts +66 -0
  21. package/dist/engine.d.ts.map +1 -1
  22. package/dist/engines/cel.d.ts.map +1 -1
  23. package/dist/engines/cel.js +87 -6
  24. package/dist/engines/sql.d.ts.map +1 -1
  25. package/dist/engines/sql.js +5 -1
  26. package/dist/index.d.ts +3 -2
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +7 -1
  29. package/package.json +3 -3
  30. package/src/cel/analyze.ts +131 -9
  31. package/src/cel/catalog.ts +10 -0
  32. package/src/cel/compile.ts +59 -12
  33. package/src/cel/diagnose.ts +56 -6
  34. package/src/cel/environment.ts +3 -0
  35. package/src/cel/module-call.ts +369 -0
  36. package/src/cel/value-identity.ts +34 -0
  37. package/src/engine.ts +72 -0
  38. package/src/engines/cel.ts +104 -6
  39. package/src/engines/sql.ts +5 -1
  40. package/src/index.ts +20 -1
@@ -4,12 +4,38 @@ import type { ASTNode } from "@marcbachmann/cel-js";
4
4
  * Returns arrays like ["request", "query", "name"] for `request.query.name`.
5
5
  * Chains that start with a call or non-identifier root are ignored.
6
6
  * Bound variables in comprehension macros (filter, map, exists, all, exists_one) are excluded.
7
+ *
8
+ * A RESOLVED module call contributes no chain for its receiver: `Billing` in
9
+ * `Billing.format(x)` names a module, not a value, so reading it as a root
10
+ * would invent a dependency, an undeclared identifier and a `resources` read
11
+ * that the expression never states. Resolution is `resolveModuleCalls`, on the
12
+ * tree, before this walk — an unresolved tree still reports the receiver, which
13
+ * is the right answer for a caller that supplied no module names.
7
14
  */
8
15
  export declare function extractAccessChains(node: ASTNode): string[][];
16
+ /**
17
+ * Each resolved module call's arguments as plain member chains, keyed by the
18
+ * call's node — `null` for an argument that is not one, or that is rooted at a
19
+ * name the expression itself binds (`xs.map(item, Billing.total(item))`), which
20
+ * no context schema describes.
21
+ */
22
+ export declare function moduleCallArgumentChains(node: ASTNode): Map<ASTNode, Array<string[] | null>>;
9
23
  /** Sentinel chain segment emitted for index access (`obj[expr]`) — a dynamic
10
24
  * member that can't be resolved to a static name. Consumers that attribute
11
25
  * chains to declared names treat this as "unknown member". */
12
26
  export declare const INDEX_SEGMENT = "[*]";
27
+ /** A member access on a module call's result: the call, and the members read
28
+ * off it in order (`Billing.total(xs).amount` → `amount`). */
29
+ export interface CallResultAccess {
30
+ readonly qualified: string;
31
+ readonly members: readonly string[];
32
+ }
33
+ /**
34
+ * Every member access whose base is a module call, longest first — the chains
35
+ * {@link extractAccessChains} deliberately skips, since their root is a value
36
+ * no context schema describes. The caller supplies the call's result schema.
37
+ */
38
+ export declare function extractCallResultAccesses(node: ASTNode): CallResultAccess[];
13
39
  interface NullableIssue {
14
40
  /** Dotted path of the nullable value being dereferenced (e.g. "error"). */
15
41
  path: string;
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/cel/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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B,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAI3E;AAqCD,UAAU,aAAa;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB;AAoFD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,aAAa,EAAE,CAIjB;AA4GD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,MAAM,GAAG,IAAI,CAwCf"}
@@ -1,15 +1,36 @@
1
1
  import { isLiveSlot } from "@telorun/sdk";
2
+ import { moduleCallOf } from "./module-call.js";
2
3
  /**
3
4
  * Extract all member-access chains from a CEL AST.
4
5
  * Returns arrays like ["request", "query", "name"] for `request.query.name`.
5
6
  * Chains that start with a call or non-identifier root are ignored.
6
7
  * Bound variables in comprehension macros (filter, map, exists, all, exists_one) are excluded.
8
+ *
9
+ * A RESOLVED module call contributes no chain for its receiver: `Billing` in
10
+ * `Billing.format(x)` names a module, not a value, so reading it as a root
11
+ * would invent a dependency, an undeclared identifier and a `resources` read
12
+ * that the expression never states. Resolution is `resolveModuleCalls`, on the
13
+ * tree, before this walk — an unresolved tree still reports the receiver, which
14
+ * is the right answer for a caller that supplied no module names.
7
15
  */
8
16
  export function extractAccessChains(node) {
9
17
  const chains = [];
10
18
  visitNode(node, chains, new Set());
11
19
  return chains;
12
20
  }
21
+ /**
22
+ * Each resolved module call's arguments as plain member chains, keyed by the
23
+ * call's node — `null` for an argument that is not one, or that is rooted at a
24
+ * name the expression itself binds (`xs.map(item, Billing.total(item))`), which
25
+ * no context schema describes.
26
+ */
27
+ export function moduleCallArgumentChains(node) {
28
+ const out = new Map();
29
+ visitNode(node, [], new Set(), (call, callNode, boundVars) => {
30
+ out.set(callNode, call.args.map((arg) => extractChain(arg, boundVars)));
31
+ });
32
+ return out;
33
+ }
13
34
  const COMPREHENSION_METHODS = new Set(["filter", "map", "exists", "all", "exists_one"]);
14
35
  /** `cel.bind(name, init, body)` — CEL's only binding form, and the one the
15
36
  * parser expands rather than dispatching, so it appears as a receiver call on a
@@ -35,18 +56,25 @@ function bindCall(node) {
35
56
  return null;
36
57
  return { name: nameNode.args, init, body };
37
58
  }
38
- function visitNode(node, chains, boundVars) {
59
+ function visitNode(node, chains, boundVars, onModuleCall) {
39
60
  const chain = extractChain(node, boundVars);
40
61
  if (chain !== null) {
41
62
  chains.push(chain);
42
63
  return;
43
64
  }
65
+ const moduleCall = moduleCallOf(node);
66
+ if (moduleCall) {
67
+ onModuleCall?.(moduleCall, node, boundVars);
68
+ for (const arg of moduleCall.args)
69
+ visitNode(arg, chains, boundVars, onModuleCall);
70
+ return;
71
+ }
44
72
  // The bound name is in scope for the body ONLY; `init` is evaluated in the
45
73
  // enclosing scope, so a name used there still has to resolve there.
46
74
  const bind = bindCall(node);
47
75
  if (bind) {
48
- visitNode(bind.init, chains, boundVars);
49
- visitNode(bind.body, chains, new Set(boundVars).add(bind.name));
76
+ visitNode(bind.init, chains, boundVars, onModuleCall);
77
+ visitNode(bind.body, chains, new Set(boundVars).add(bind.name), onModuleCall);
50
78
  return;
51
79
  }
52
80
  if (node.op === "rcall" &&
@@ -56,7 +84,7 @@ function visitNode(node, chains, boundVars) {
56
84
  const receiver = node.args[1];
57
85
  const comprehensionArgs = node.args[2];
58
86
  if (isASTNode(receiver))
59
- visitNode(receiver, chains, boundVars);
87
+ visitNode(receiver, chains, boundVars, onModuleCall);
60
88
  if (Array.isArray(comprehensionArgs) &&
61
89
  comprehensionArgs.length >= 2 &&
62
90
  isASTNode(comprehensionArgs[0]) &&
@@ -66,7 +94,7 @@ function visitNode(node, chains, boundVars) {
66
94
  for (let i = 1; i < comprehensionArgs.length; i++) {
67
95
  const arg = comprehensionArgs[i];
68
96
  if (isASTNode(arg))
69
- visitNode(arg, chains, newBoundVars);
97
+ visitNode(arg, chains, newBoundVars, onModuleCall);
70
98
  }
71
99
  }
72
100
  return;
@@ -75,12 +103,12 @@ function visitNode(node, chains, boundVars) {
75
103
  if (Array.isArray(args)) {
76
104
  for (const arg of args) {
77
105
  if (isASTNode(arg)) {
78
- visitNode(arg, chains, boundVars);
106
+ visitNode(arg, chains, boundVars, onModuleCall);
79
107
  }
80
108
  else if (Array.isArray(arg)) {
81
109
  for (const item of arg) {
82
110
  if (isASTNode(item))
83
- visitNode(item, chains, boundVars);
111
+ visitNode(item, chains, boundVars, onModuleCall);
84
112
  }
85
113
  }
86
114
  }
@@ -88,7 +116,7 @@ function visitNode(node, chains, boundVars) {
88
116
  else if (isASTNode(args)) {
89
117
  // Unary operators (`!_`, `-_`) carry their operand as a single node
90
118
  // rather than a one-element array, so descend into it directly.
91
- visitNode(args, chains, boundVars);
119
+ visitNode(args, chains, boundVars, onModuleCall);
92
120
  }
93
121
  }
94
122
  function isASTNode(v) {
@@ -119,6 +147,58 @@ function extractChain(node, boundVars) {
119
147
  }
120
148
  return null;
121
149
  }
150
+ /**
151
+ * Every member access whose base is a module call, longest first — the chains
152
+ * {@link extractAccessChains} deliberately skips, since their root is a value
153
+ * no context schema describes. The caller supplies the call's result schema.
154
+ */
155
+ export function extractCallResultAccesses(node) {
156
+ const out = [];
157
+ visitAccess(node, out);
158
+ return out;
159
+ }
160
+ function visitAccess(node, out) {
161
+ if (node.op === "." || node.op === "[]") {
162
+ const members = [];
163
+ let base = node;
164
+ while (base.op === "." || base.op === "[]") {
165
+ const [obj, field] = base.args;
166
+ members.unshift(base.op === "." ? String(field) : INDEX_SEGMENT);
167
+ if (base.op === "[]" && isASTNode(field))
168
+ visitAccess(field, out);
169
+ base = obj;
170
+ }
171
+ const call = moduleCallOf(base);
172
+ if (call) {
173
+ out.push({ qualified: call.qualified, members });
174
+ for (const arg of call.args)
175
+ visitAccess(arg, out);
176
+ return;
177
+ }
178
+ visitAccess(base, out);
179
+ return;
180
+ }
181
+ const moduleCall = moduleCallOf(node);
182
+ if (moduleCall) {
183
+ for (const arg of moduleCall.args)
184
+ visitAccess(arg, out);
185
+ return;
186
+ }
187
+ const args = node.args;
188
+ if (Array.isArray(args)) {
189
+ for (const arg of args) {
190
+ if (isASTNode(arg))
191
+ visitAccess(arg, out);
192
+ else if (Array.isArray(arg))
193
+ for (const item of arg)
194
+ if (isASTNode(item))
195
+ visitAccess(item, out);
196
+ }
197
+ }
198
+ else if (isASTNode(args)) {
199
+ visitAccess(args, out);
200
+ }
201
+ }
122
202
  /** True when a JSON Schema admits `null` — `type: "null"` or a union that
123
203
  * includes it (e.g. `["object", "null"]`). */
124
204
  function schemaIsNullable(schema) {
@@ -242,6 +322,14 @@ function walkNullable(node, nonNull, boundVars, issues, schema) {
242
322
  walkNullable(b, union(nonNull, carried), boundVars, issues, schema);
243
323
  return;
244
324
  }
325
+ // A module call's receiver is a module name, not a value; mirror
326
+ // extractAccessChains so it is never read as a nullable context field.
327
+ const moduleCall = moduleCallOf(node);
328
+ if (moduleCall) {
329
+ for (const arg of moduleCall.args)
330
+ walkNullable(arg, nonNull, boundVars, issues, schema);
331
+ return;
332
+ }
245
333
  // `cel.bind` binds a name for its body; mirror extractAccessChains so a bound
246
334
  // name is never read as a nullable context field.
247
335
  const bind = bindCall(node);
@@ -305,6 +393,24 @@ export function validateChainAgainstSchema(chain, schema) {
305
393
  const key = chain[i];
306
394
  if (!current || typeof current !== "object")
307
395
  return null;
396
+ // An index reads an ELEMENT: an array's `items`, or a map's value schema. What
397
+ // is below it is checked like any member access, which is what reaches a
398
+ // typo inside a list of records (`items[0].amont`). An object that also
399
+ // declares `properties` may be indexed by one of those names, which the
400
+ // chain does not record, so nothing below it is judged.
401
+ if (key === INDEX_SEGMENT) {
402
+ const element = current.items && typeof current.items === "object" && !Array.isArray(current.items)
403
+ ? current.items
404
+ : !current.properties &&
405
+ current.additionalProperties &&
406
+ typeof current.additionalProperties === "object"
407
+ ? current.additionalProperties
408
+ : undefined;
409
+ if (!element)
410
+ return null;
411
+ current = element;
412
+ continue;
413
+ }
308
414
  const props = current.properties;
309
415
  if (!props)
310
416
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/cel/catalog.ts"],"names":[],"mappings":"AAIA;;;0DAG0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9B,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9B,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAClE,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CAClC;AA2CD,MAAM,MAAM,mBAAmB,GAC3B,YAAY,GACZ,MAAM,GACN,MAAM,GACN,QAAQ,GACR,MAAM,GACN,YAAY,GACZ,MAAM,GACN,UAAU,GACV,SAAS,GACT,YAAY,GACZ,MAAM,CAAC;AAEX;;;qBAGqB;AACrB,MAAM,WAAW,cAAc;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;0EACsE;IACtE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;;yDAIqD;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAA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). `nowIso`/`today` take an optional IANA timezone
917
917
  // (default "UTC"); epoch values are absolute and take none.
918
+ {
919
+ name: "now",
920
+ signature: "now(): timestamp",
921
+ register: ["now(): google.protobuf.Timestamp"],
922
+ category: "time",
923
+ summary: "Current instant as a native timestamp, for comparison and duration arithmetic.",
924
+ deterministic: false,
925
+ hostBacked: false,
926
+ build: () => () => new Date(),
927
+ },
918
928
  {
919
929
  name: "nowIso",
920
930
  signature: "nowIso(string?): string",
@@ -4,14 +4,20 @@ export declare const TEMPLATE_REGEX: RegExp;
4
4
  export declare const EXACT_TEMPLATE_REGEX: RegExp;
5
5
  /** Compile a single CEL expression (no `${{ }}` wrapping) into a CompiledValue.
6
6
  * Throws on syntax errors. Used by the `!cel` engine where the entire tagged
7
- * scalar is treated as one expression. */
8
- export declare function compileExpression(expr: string, env: Environment): CompiledValue;
7
+ * scalar is treated as one expression.
8
+ *
9
+ * `moduleNames` are the declaring module's own names; a call whose receiver is
10
+ * one of them resolves to a late-bound module call HERE, on the parsed tree, so
11
+ * every later reader — the root references below, the analyzer's passes, the
12
+ * kernel's dependency walk — sees the resolved shape rather than re-deriving
13
+ * it from the source text. */
14
+ export declare function compileExpression(expr: string, env: Environment, moduleNames?: ReadonlySet<string>): CompiledValue;
9
15
  /** Compile a string that may contain `${{ }}`-delimited CEL segments. If the
10
16
  * string is exactly one expression, returns a single CompiledValue. If it
11
17
  * contains interpolations, returns a CompiledValue that joins literal parts
12
18
  * with stringified expression results. If no expressions are present, returns
13
19
  * the input string unchanged. Throws on CEL syntax errors. */
14
- export declare function compileString(s: string, env: Environment): unknown;
20
+ export declare function compileString(s: string, env: Environment, moduleNames?: ReadonlySet<string>): unknown;
15
21
  /** Split an interpolated value into literal fragments and the evaluated values
16
22
  * of its embedded expressions, instead of joining them into one string. Lets a
17
23
  * consumer emit its own placeholders between fragments and bind the values
@@ -1 +1 @@
1
- {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/cel/compile.ts"],"names":[],"mappings":"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AAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,OAAO,EAAE,CAAA;CAAE,CAsB5C"}
@@ -1,15 +1,14 @@
1
1
  import { isCompiledValue } from "@telorun/sdk";
2
2
  import { extractAccessChains } from "./analyze.js";
3
+ import { CEL_FUNCTIONS } from "./catalog.js";
4
+ import { resolveModuleCalls } from "./module-call.js";
3
5
  export const TEMPLATE_REGEX = /\$\{\{\s*([^}]+?)\s*\}\}/g;
4
6
  export const EXACT_TEMPLATE_REGEX = /^\s*\$\{\{\s*([^}]+?)\s*\}\}\s*$/;
5
7
  /** Root variable identifiers an expression reads, from its parsed AST — the
6
8
  * first element of every member-access chain (`self.table` → `self`). Returns
7
9
  * undefined when the parse result carries no AST so consumers can tell "no
8
10
  * refs" from "unknown". */
9
- function rootRefs(parsed) {
10
- const ast = parsed.ast;
11
- if (!ast)
12
- return undefined;
11
+ function rootRefs(ast) {
13
12
  const roots = new Set();
14
13
  for (const chain of extractAccessChains(ast)) {
15
14
  if (chain.length > 0)
@@ -17,15 +16,46 @@ function rootRefs(parsed) {
17
16
  }
18
17
  return [...roots];
19
18
  }
19
+ const NON_DETERMINISTIC = new Set(CEL_FUNCTIONS.filter((f) => !f.deterministic).map((f) => f.name));
20
+ /** True when the expression calls a catalog function whose result differs per
21
+ * call (`uuidv4()`, `nowMillis()`), so evaluating it once and reusing the value
22
+ * would change what it means. */
23
+ function callsNonDeterministic(root) {
24
+ const visit = (node) => {
25
+ if (Array.isArray(node))
26
+ return node.some(visit);
27
+ if (!node || typeof node !== "object" || !("op" in node))
28
+ return false;
29
+ const n = node;
30
+ if ((n.op === "call" || n.op === "rcall") && Array.isArray(n.args)) {
31
+ const name = n.args[0];
32
+ if (typeof name === "string" && NON_DETERMINISTIC.has(name))
33
+ return true;
34
+ }
35
+ const args = n.args;
36
+ return Array.isArray(args) ? args.some(visit) : visit(args);
37
+ };
38
+ return visit(root);
39
+ }
20
40
  /** Compile a single CEL expression (no `${{ }}` wrapping) into a CompiledValue.
21
41
  * Throws on syntax errors. Used by the `!cel` engine where the entire tagged
22
- * scalar is treated as one expression. */
23
- export function compileExpression(expr, env) {
42
+ * scalar is treated as one expression.
43
+ *
44
+ * `moduleNames` are the declaring module's own names; a call whose receiver is
45
+ * one of them resolves to a late-bound module call HERE, on the parsed tree, so
46
+ * every later reader — the root references below, the analyzer's passes, the
47
+ * kernel's dependency walk — sees the resolved shape rather than re-deriving
48
+ * it from the source text. */
49
+ export function compileExpression(expr, env, moduleNames) {
24
50
  const fn = env.parse(expr);
51
+ const ast = fn.ast;
52
+ const calls = resolveModuleCalls(ast, moduleNames);
25
53
  return {
26
54
  __compiled: true,
27
55
  source: expr,
28
- refs: rootRefs(fn),
56
+ refs: rootRefs(ast),
57
+ calls,
58
+ ...(callsNonDeterministic(ast) ? { volatile: true } : {}),
29
59
  call: (ctx) => fn(ctx),
30
60
  };
31
61
  }
@@ -34,34 +64,45 @@ export function compileExpression(expr, env) {
34
64
  * contains interpolations, returns a CompiledValue that joins literal parts
35
65
  * with stringified expression results. If no expressions are present, returns
36
66
  * the input string unchanged. Throws on CEL syntax errors. */
37
- export function compileString(s, env) {
67
+ export function compileString(s, env, moduleNames) {
38
68
  if (!s.includes("${{"))
39
69
  return s;
40
70
  const exact = s.match(EXACT_TEMPLATE_REGEX);
41
71
  if (exact) {
42
- return compileExpression(exact[1].trim(), env);
72
+ return compileExpression(exact[1].trim(), env, moduleNames);
43
73
  }
44
74
  const parts = [];
45
75
  let last = 0;
46
76
  for (const m of s.matchAll(TEMPLATE_REGEX)) {
47
77
  if (m.index > last)
48
78
  parts.push(s.slice(last, m.index));
49
- parts.push(compileExpression(m[1].trim(), env));
79
+ parts.push(compileExpression(m[1].trim(), env, moduleNames));
50
80
  last = m.index + m[0].length;
51
81
  }
52
82
  if (last < s.length)
53
83
  parts.push(s.slice(last));
54
84
  const refs = new Set();
85
+ const calls = new Set();
86
+ let volatile = false;
55
87
  for (const p of parts) {
56
- if (typeof p !== "string" && p.refs)
88
+ if (typeof p === "string")
89
+ continue;
90
+ if (p.refs)
57
91
  for (const r of p.refs)
58
92
  refs.add(r);
93
+ if (p.calls)
94
+ for (const c of p.calls)
95
+ calls.add(c);
96
+ if (p.volatile)
97
+ volatile = true;
59
98
  }
60
99
  return {
61
100
  __compiled: true,
62
101
  source: s,
63
102
  parts,
64
103
  refs: [...refs],
104
+ calls: [...calls],
105
+ ...(volatile ? { volatile: true } : {}),
65
106
  call: (ctx) => parts.map((p) => (typeof p === "string" ? p : String(p.call(ctx) ?? ""))).join(""),
66
107
  };
67
108
  }
@@ -26,6 +26,12 @@ interface FnEntry {
26
26
  export interface FunctionIndex {
27
27
  readonly byName: ReadonlyMap<string, readonly FnEntry[]>;
28
28
  }
29
+ /** The flags a module function carries, as the host that resolves it derives
30
+ * them — or undefined where the name reaches no function. */
31
+ export type ModuleCallFlags = (qualified: string) => {
32
+ readonly deterministic: boolean;
33
+ readonly hostBacked: boolean;
34
+ } | undefined;
29
35
  /** Registry view of an environment, memoized: environments are rebuilt per
30
36
  * analysis path, but each is immutable once built. */
31
37
  export declare function functionIndex(env: Environment): FunctionIndex;
@@ -46,7 +52,10 @@ export interface CallAudit {
46
52
  * failed type-check, because a type-check reports its first error and stops:
47
53
  * an expression with two bad calls would otherwise fix one, re-run, and
48
54
  * discover the next. */
49
- export declare function auditCalls(source: string, ast: ASTNode, env: Environment): CallAudit;
55
+ export declare function auditCalls(source: string, ast: ASTNode, env: Environment,
56
+ /** The flags of the module functions the expression calls, from whoever
57
+ * resolves them. */
58
+ moduleCallFlags?: ModuleCallFlags): CallAudit;
50
59
  /** Registered signatures for names a type-check failure mentions, so the
51
60
  * residual says what the function actually accepts rather than only echoing
52
61
  * what the author wrote. */
@@ -1 +1 @@
1
- {"version":3,"file":"diagnose.d.ts","sourceRoot":"","sources":["../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,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,WAAW,GAAG,MAAM,CAIpF"}
@@ -1,8 +1,10 @@
1
1
  import { CEL_FUNCTIONS } from "./catalog.js";
2
+ import { moduleCallOf } from "./module-call.js";
2
3
  /** Determinism is Telo catalog metadata; cel-js builtins carry none. Absent
3
4
  * means "no signal", never "deterministic" — consumers of
4
5
  * `CallSite.deterministic` must not read undefined as a guarantee. */
5
6
  const DETERMINISM = new Map(CEL_FUNCTIONS.map((f) => [f.name, f.deterministic]));
7
+ const HOST_BACKED = new Map(CEL_FUNCTIONS.map((f) => [f.name, f.hostBacked === true]));
6
8
  const INDEX_CACHE = new WeakMap();
7
9
  /** Registry view of an environment, memoized: environments are rebuilt per
8
10
  * analysis path, but each is immutable once built. */
@@ -38,12 +40,36 @@ function isNode(v) {
38
40
  return typeof v === "object" && v !== null && "op" in v;
39
41
  }
40
42
  /** Every non-macro call in the expression, in source order. */
41
- function collectCalls(root, index) {
43
+ function collectCalls(root, index, moduleCallFlags) {
42
44
  const out = [];
43
45
  visit(root);
44
46
  return out.sort((a, b) => a.start - b.start);
45
47
  function visit(node) {
46
48
  const args = node.args;
49
+ // A RESOLVED module call is reported under its QUALIFIED name and is never
50
+ // looked up in the catalog: the two namespaces are disjoint by construction
51
+ // (a bare name is always the catalog), so classifying it here would report
52
+ // `there is no function 'format'` for a call that names a module's own, and
53
+ // attaching the catalog's determinism to it would be a flag about a
54
+ // different function entirely. What a module call's flags are is the
55
+ // resolving host's answer, carried when it gives one.
56
+ const moduleCall = moduleCallOf(node);
57
+ if (moduleCall) {
58
+ const flags = moduleCallFlags?.(moduleCall.qualified);
59
+ out.push({
60
+ name: moduleCall.qualified,
61
+ form: "receiver",
62
+ moduleCall: true,
63
+ arity: moduleCall.args.length,
64
+ start: node.start,
65
+ end: node.end,
66
+ ...(flags ? { deterministic: flags.deterministic, hostBacked: flags.hostBacked } : {}),
67
+ args: moduleCall.args,
68
+ });
69
+ for (const arg of moduleCall.args)
70
+ visit(arg);
71
+ return;
72
+ }
47
73
  if (node.op === "call" || node.op === "rcall") {
48
74
  const tuple = args;
49
75
  const name = tuple[0];
@@ -57,7 +83,9 @@ function collectCalls(root, index) {
57
83
  arity: callArgs.length,
58
84
  start: node.start,
59
85
  end: node.end,
60
- ...(index.byName.has(name) ? { deterministic: DETERMINISM.get(name) } : {}),
86
+ ...(index.byName.has(name)
87
+ ? { deterministic: DETERMINISM.get(name), hostBacked: HOST_BACKED.get(name) }
88
+ : {}),
61
89
  ...(isNode(receiver) ? { receiver } : {}),
62
90
  args: callArgs,
63
91
  });
@@ -128,8 +156,8 @@ function accepts(entries, form, arity) {
128
156
  const listOf = (names) => [...new Set(names)].sort().join(", ");
129
157
  /** Names registered in exactly the form and arity the author wrote — the only
130
158
  * ones that could replace this call with no further edits. Ranked by shared
131
- * prefix, which is what reaches `nowIso` from `now`; edit distance never
132
- * would (3 characters against a 3-character name). Returns [] when nothing
159
+ * prefix, which is what reaches `nowIso` from `no`; edit distance never
160
+ * would (4 characters against a 2-character name). Returns [] when nothing
133
161
  * shares a prefix, so the caller lists what is legal here instead of
134
162
  * guessing. */
135
163
  function candidates(call, index) {
@@ -183,12 +211,20 @@ const ARG_CHECKS = new Map(CEL_FUNCTIONS.flatMap((f) => (f.checkArgs ? [[f.name,
183
211
  * failed type-check, because a type-check reports its first error and stops:
184
212
  * an expression with two bad calls would otherwise fix one, re-run, and
185
213
  * discover the next. */
186
- export function auditCalls(source, ast, env) {
214
+ export function auditCalls(source, ast, env,
215
+ /** The flags of the module functions the expression calls, from whoever
216
+ * resolves them. */
217
+ moduleCallFlags) {
187
218
  const index = functionIndex(env);
188
219
  const diagnostics = [];
189
220
  const unresolved = [];
190
- const calls = collectCalls(ast, index);
221
+ const calls = collectCalls(ast, index, moduleCallFlags);
191
222
  for (const call of calls) {
223
+ // Resolution already decided what a module call names. The catalog has
224
+ // nothing to say about it, and saying it anyway would be a refusal of valid
225
+ // CEL.
226
+ if (call.moduleCall)
227
+ continue;
192
228
  const entries = index.byName.get(call.name);
193
229
  const noun = call.form === "receiver" ? "method" : "function";
194
230
  if (!entries) {
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/cel/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAE/D,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAoBhD;;;;;;;;;;;;;;;yDAeyD;AACzD;;;;;wBAKwB;AACxB,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAyB5D;AAYD;;;;;yCAKyC;AACzC,wBAAgB,mBAAmB,IAAI,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC,CAE5F;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAcpF"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/cel/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAG/D,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAsBhD;;;;;;;;;;;;;;;yDAeyD;AACzD;;;;;wBAKwB;AACxB,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAyB5D;AAYD;;;;;yCAKyC;AACzC,wBAAgB,mBAAmB,IAAI,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,CAAC,CAE5F;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAcpF"}
@@ -1,6 +1,8 @@
1
1
  import { Environment } from "@marcbachmann/cel-js";
2
2
  import { Stream } from "@telorun/sdk";
3
3
  import { CEL_FUNCTIONS } from "./catalog.js";
4
+ import { assertCelValueIdentity, SDK_CEL_VALUE_CLASSES } from "./value-identity.js";
5
+ assertCelValueIdentity(SDK_CEL_VALUE_CLASSES);
4
6
  const stub = (name) => () => {
5
7
  throw new Error(`${name}() is not available in this environment. ` +
6
8
  `Construct StaticAnalyzer or Loader with celHandlers to enable it.`);