@telorun/templating 0.111.0 → 0.112.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.
@@ -24,6 +24,25 @@ export declare function moduleCallArgumentChains(node: CelNode): Map<CelNode, Ar
24
24
  * member that can't be resolved to a static name. Consumers that attribute
25
25
  * chains to declared names treat this as "unknown member". */
26
26
  export declare const INDEX_SEGMENT = "[*]";
27
+ /** Chain segment for "each element of the collection reached so far": what a
28
+ * comprehension's iteration variable stands for. */
29
+ export declare const EACH_SEGMENT = "[]";
30
+ /**
31
+ * What an expression READS of the values its roots name, as member chains —
32
+ * {@link extractAccessChains} with a comprehension's iteration variable followed
33
+ * instead of dropped.
34
+ *
35
+ * - A member read through the variable is a read of THAT member on each element
36
+ * of the range: `xs.all(x, x.path != "")` reads `xs.[].path`.
37
+ * - A range that is only iterated is read as a range — its own node, none of
38
+ * its elements: the chain ends in {@link EACH_SEGMENT}.
39
+ * - A bare use of the variable reads the element whole, so the range is read
40
+ * whole, as it is by any other use of the collection.
41
+ *
42
+ * A variable whose range is not a plain chain (a call's result, another macro's
43
+ * output) names nothing a root holds, and a read through it contributes nothing.
44
+ */
45
+ export declare function extractReadChains(node: CelNode): string[][];
27
46
  /** A member access on a module call's result: the call, and the members read
28
47
  * off it in order (`Billing.total(xs).amount` → `amount`). */
29
48
  export interface CallResultAccess {
@@ -1 +1 @@
1
- {"version":3,"file":"analyze.d.ts","sourceRoot":"","sources":["../../src/cel/analyze.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,OAAO,EACb,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,EAAE,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,OAAO,GAAG,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,IAAI,CAA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I,CAAC,CAAC,CAS5F;AA8FD;;+DAE+D;AAC/D,eAAO,MAAM,aAAa,QAAQ,CAAC;AA6BnC;qDACqD;AACrD,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,EAAE,EAAE,CAI3D;AA4DD;+DAC+D;AAC/D,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAAE,CAI3E;AA4BD,UAAU,aAAa;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;CAChB;AA0BD;;sBAEsB;AACtB,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,MAAM,GAAG,IAAI,CAIf;AA0DD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,aAAa,EAAE,CAIjB;AA2ED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,MAAM,GAAG,IAAI,CAwCf"}
@@ -149,6 +149,87 @@ function extractChain(node, boundVars) {
149
149
  }
150
150
  return null;
151
151
  }
152
+ /** Chain segment for "each element of the collection reached so far": what a
153
+ * comprehension's iteration variable stands for. */
154
+ export const EACH_SEGMENT = "[]";
155
+ /**
156
+ * What an expression READS of the values its roots name, as member chains —
157
+ * {@link extractAccessChains} with a comprehension's iteration variable followed
158
+ * instead of dropped.
159
+ *
160
+ * - A member read through the variable is a read of THAT member on each element
161
+ * of the range: `xs.all(x, x.path != "")` reads `xs.[].path`.
162
+ * - A range that is only iterated is read as a range — its own node, none of
163
+ * its elements: the chain ends in {@link EACH_SEGMENT}.
164
+ * - A bare use of the variable reads the element whole, so the range is read
165
+ * whole, as it is by any other use of the collection.
166
+ *
167
+ * A variable whose range is not a plain chain (a call's result, another macro's
168
+ * output) names nothing a root holds, and a read through it contributes nothing.
169
+ */
170
+ export function extractReadChains(node) {
171
+ const chains = [];
172
+ visitReads(node, chains, new Map());
173
+ return chains;
174
+ }
175
+ function readChainOf(node, bound) {
176
+ if (node.kind === "ident") {
177
+ if (!node.absolute && bound.has(node.name)) {
178
+ const range = bound.get(node.name);
179
+ return range ? [...range, EACH_SEGMENT] : null;
180
+ }
181
+ return [node.name];
182
+ }
183
+ if (node.kind === "select") {
184
+ if (node.optional)
185
+ return null;
186
+ const parent = readChainOf(node.operand, bound);
187
+ if (parent !== null)
188
+ return [...parent, node.field];
189
+ }
190
+ if (node.kind === "index") {
191
+ if (node.optional)
192
+ return null;
193
+ const parent = readChainOf(node.operand, bound);
194
+ if (parent !== null)
195
+ return [...parent, INDEX_SEGMENT];
196
+ }
197
+ return null;
198
+ }
199
+ function visitReads(node, chains, bound) {
200
+ const chain = readChainOf(node, bound);
201
+ if (chain !== null) {
202
+ // The variable itself, with no member read off it: the whole element.
203
+ chains.push(chain[chain.length - 1] === EACH_SEGMENT ? chain.slice(0, -1) : chain);
204
+ return;
205
+ }
206
+ const moduleCall = moduleCallOf(node);
207
+ if (moduleCall) {
208
+ for (const arg of moduleCall.args)
209
+ visitReads(arg, chains, bound);
210
+ return;
211
+ }
212
+ const bind = bindCall(node);
213
+ if (bind) {
214
+ visitReads(bind.init, chains, bound);
215
+ visitReads(bind.body, chains, new Map(bound).set(bind.name, null));
216
+ return;
217
+ }
218
+ const macro = comprehension(node);
219
+ if (macro) {
220
+ const range = readChainOf(macro.receiver, bound);
221
+ if (range !== null)
222
+ chains.push([...range, EACH_SEGMENT]);
223
+ else
224
+ visitReads(macro.receiver, chains, bound);
225
+ const inner = new Map(bound).set(macro.bound, range);
226
+ for (const arg of macro.scoped)
227
+ visitReads(arg, chains, inner);
228
+ return;
229
+ }
230
+ for (const child of childNodes(node))
231
+ visitReads(child, chains, bound);
232
+ }
152
233
  /**
153
234
  * Every member access whose base is a module call, longest first — the chains
154
235
  * {@link extractAccessChains} deliberately skips, since their root is a value
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { buildCelEnvironment, buildCelLanguageEnvironment, celBuiltinFunctions,
2
2
  export { compileExpression, namespaceDispatchOf } from "./cel/compile.js";
3
3
  export { registerValueBrands } from "./cel/value-brands.js";
4
4
  export { interpolationShape, literalFragments, readInterpolationHoles, type HoleReading, type InterpolationHole, type InterpolationShape, } from "./cel/interpolation-holes.js";
5
- export { extractAccessChains, findNullableAccessIssues, INDEX_SEGMENT, validateChainAgainstSchema, } from "./cel/analyze.js";
5
+ export { EACH_SEGMENT, extractAccessChains, extractReadChains, findNullableAccessIssues, INDEX_SEGMENT, validateChainAgainstSchema, } from "./cel/analyze.js";
6
6
  export { auditCalls, explainUnresolved, type CallAudit, type ModuleCallFlags, } from "./cel/diagnose.js";
7
7
  export { celNamespaceNames, MODULE_CALL_DISPATCH_KEY, moduleCallNames, moduleCallOf, type ModuleCallDispatch, type ModuleCallTypeResolver, } from "./cel/module-call.js";
8
8
  export { walkCelExpressions } from "./cel/walk.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC1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M,eAAe,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,qBAAqB,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAExF,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,kBAAkB,EAClB,YAAY,EACZ,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ export { buildCelEnvironment, buildCelLanguageEnvironment, celBuiltinFunctions,
6
6
  export { compileExpression, namespaceDispatchOf } from "./cel/compile.js";
7
7
  export { registerValueBrands } from "./cel/value-brands.js";
8
8
  export { interpolationShape, literalFragments, readInterpolationHoles, } from "./cel/interpolation-holes.js";
9
- export { extractAccessChains, findNullableAccessIssues, INDEX_SEGMENT, validateChainAgainstSchema, } from "./cel/analyze.js";
9
+ export { EACH_SEGMENT, extractAccessChains, extractReadChains, findNullableAccessIssues, INDEX_SEGMENT, validateChainAgainstSchema, } from "./cel/analyze.js";
10
10
  export { auditCalls, explainUnresolved, } from "./cel/diagnose.js";
11
11
  // The rewrite, its reader, and the activation key the kernel binds a scope's
12
12
  // dispatch table under. The unbound message and the receiver and bound-name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/templating",
3
- "version": "0.111.0",
3
+ "version": "0.112.0",
4
4
  "description": "Telo Templating - Engine registry and shared CEL core for Telo manifests.",
5
5
  "keywords": [
6
6
  "telo",
@@ -39,14 +39,14 @@
39
39
  "re2js": "2.8.3",
40
40
  "uuid": "14.0.1",
41
41
  "yaml": "^2.8.3",
42
- "@telorun/cel": "0.111.0"
42
+ "@telorun/cel": "0.112.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/d3-format": "^3.0.4",
46
46
  "@types/node": "^20.0.0",
47
47
  "typescript": "^5.0.0",
48
48
  "vitest": "^2.1.8",
49
- "@telorun/sdk": "0.111.0"
49
+ "@telorun/sdk": "0.112.0"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@telorun/sdk": "*"
@@ -167,6 +167,89 @@ function extractChain(node: CelNode, boundVars: ReadonlySet<string>): string[] |
167
167
  return null;
168
168
  }
169
169
 
170
+ /** Chain segment for "each element of the collection reached so far": what a
171
+ * comprehension's iteration variable stands for. */
172
+ export const EACH_SEGMENT = "[]";
173
+
174
+ /**
175
+ * What an expression READS of the values its roots name, as member chains —
176
+ * {@link extractAccessChains} with a comprehension's iteration variable followed
177
+ * instead of dropped.
178
+ *
179
+ * - A member read through the variable is a read of THAT member on each element
180
+ * of the range: `xs.all(x, x.path != "")` reads `xs.[].path`.
181
+ * - A range that is only iterated is read as a range — its own node, none of
182
+ * its elements: the chain ends in {@link EACH_SEGMENT}.
183
+ * - A bare use of the variable reads the element whole, so the range is read
184
+ * whole, as it is by any other use of the collection.
185
+ *
186
+ * A variable whose range is not a plain chain (a call's result, another macro's
187
+ * output) names nothing a root holds, and a read through it contributes nothing.
188
+ */
189
+ export function extractReadChains(node: CelNode): string[][] {
190
+ const chains: string[][] = [];
191
+ visitReads(node, chains, new Map());
192
+ return chains;
193
+ }
194
+
195
+ /** A bound name's range as a chain, or null where it has none. */
196
+ type BoundRanges = ReadonlyMap<string, readonly string[] | null>;
197
+
198
+ function readChainOf(node: CelNode, bound: BoundRanges): string[] | null {
199
+ if (node.kind === "ident") {
200
+ if (!node.absolute && bound.has(node.name)) {
201
+ const range = bound.get(node.name);
202
+ return range ? [...range, EACH_SEGMENT] : null;
203
+ }
204
+ return [node.name];
205
+ }
206
+ if (node.kind === "select") {
207
+ if (node.optional) return null;
208
+ const parent = readChainOf(node.operand, bound);
209
+ if (parent !== null) return [...parent, node.field];
210
+ }
211
+ if (node.kind === "index") {
212
+ if (node.optional) return null;
213
+ const parent = readChainOf(node.operand, bound);
214
+ if (parent !== null) return [...parent, INDEX_SEGMENT];
215
+ }
216
+ return null;
217
+ }
218
+
219
+ function visitReads(node: CelNode, chains: string[][], bound: BoundRanges): void {
220
+ const chain = readChainOf(node, bound);
221
+ if (chain !== null) {
222
+ // The variable itself, with no member read off it: the whole element.
223
+ chains.push(chain[chain.length - 1] === EACH_SEGMENT ? chain.slice(0, -1) : chain);
224
+ return;
225
+ }
226
+
227
+ const moduleCall = moduleCallOf(node);
228
+ if (moduleCall) {
229
+ for (const arg of moduleCall.args) visitReads(arg, chains, bound);
230
+ return;
231
+ }
232
+
233
+ const bind = bindCall(node);
234
+ if (bind) {
235
+ visitReads(bind.init, chains, bound);
236
+ visitReads(bind.body, chains, new Map(bound).set(bind.name, null));
237
+ return;
238
+ }
239
+
240
+ const macro = comprehension(node);
241
+ if (macro) {
242
+ const range = readChainOf(macro.receiver, bound);
243
+ if (range !== null) chains.push([...range, EACH_SEGMENT]);
244
+ else visitReads(macro.receiver, chains, bound);
245
+ const inner = new Map(bound).set(macro.bound, range);
246
+ for (const arg of macro.scoped) visitReads(arg, chains, inner);
247
+ return;
248
+ }
249
+
250
+ for (const child of childNodes(node)) visitReads(child, chains, bound);
251
+ }
252
+
170
253
  /** A member access on a module call's result: the call, and the members read
171
254
  * off it in order (`Billing.total(xs).amount` → `amount`). */
172
255
  export interface CallResultAccess {
package/src/index.ts CHANGED
@@ -20,7 +20,9 @@ export {
20
20
  type InterpolationShape,
21
21
  } from "./cel/interpolation-holes.js";
22
22
  export {
23
+ EACH_SEGMENT,
23
24
  extractAccessChains,
25
+ extractReadChains,
24
26
  findNullableAccessIssues,
25
27
  INDEX_SEGMENT,
26
28
  validateChainAgainstSchema,