@telorun/templating 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +25 -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 +32 -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
@@ -21,10 +21,14 @@ export const sqlEngine: TemplatingEngine = {
21
21
  language: "sql",
22
22
 
23
23
  compile(source, env) {
24
- const inner = compileString(source, env.celEnv);
24
+ const inner = compileString(source, env.celEnv, env.moduleNames);
25
25
  return {
26
26
  __compiled: true,
27
27
  source,
28
+ // The qualified module calls of every interpolation, for the reason
29
+ // `refs` are carried: a consumer asking what an expression CALLS cannot
30
+ // re-derive it from the text without the declaring module's names.
31
+ calls: typeof inner === "string" ? [] : ((inner as CompiledValue).calls ?? []),
28
32
  // The AST-derived root identifiers of every interpolation, carried through
29
33
  // rather than dropped. `compileString` has already computed them one line
30
34
  // above, and a consumer that asks a compiled value what it READS —
package/src/index.ts CHANGED
@@ -24,7 +24,25 @@ export {
24
24
  INDEX_SEGMENT,
25
25
  validateChainAgainstSchema,
26
26
  } from "./cel/analyze.js";
27
- export { auditCalls, explainUnresolved, functionIndex, type CallAudit } from "./cel/diagnose.js";
27
+ export {
28
+ auditCalls,
29
+ explainUnresolved,
30
+ functionIndex,
31
+ type CallAudit,
32
+ type ModuleCallFlags,
33
+ } from "./cel/diagnose.js";
34
+ // The rewrite, its reader, and the activation key the kernel binds a scope's
35
+ // dispatch table under. The unbound message and the receiver and bound-name
36
+ // walks are read inside this package only.
37
+ // `ModuleCallTypeResolver` is here because `AnalyzeEnv` names it: an exported
38
+ // interface whose field type cannot be named is not usable from outside.
39
+ export {
40
+ MODULE_CALL_DISPATCH_KEY,
41
+ moduleCallOf,
42
+ resolveModuleCalls,
43
+ type ModuleCallDispatch,
44
+ type ModuleCallTypeResolver,
45
+ } from "./cel/module-call.js";
28
46
  export { walkCelExpressions, type CelSurface } from "./cel/walk.js";
29
47
 
30
48
  export { celEngine } from "./engines/cel.js";
@@ -48,6 +66,7 @@ export {
48
66
  export type {
49
67
  AnalyzeEnv,
50
68
  AnalyzeResult,
69
+ CallArgument,
51
70
  CallSite,
52
71
  CompileEnv,
53
72
  DiagnosticFix,