@telorun/cel 0.107.0 → 0.109.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 (78) hide show
  1. package/dist/backend-runtime.d.ts +46 -8
  2. package/dist/backend-runtime.d.ts.map +1 -1
  3. package/dist/backend-runtime.js +133 -30
  4. package/dist/catalog-runtime.d.ts.map +1 -1
  5. package/dist/catalog-runtime.js +110 -109
  6. package/dist/cel-map-value.d.ts +20 -7
  7. package/dist/cel-map-value.d.ts.map +1 -1
  8. package/dist/cel-map-value.js +29 -18
  9. package/dist/cel-value.d.ts +10 -3
  10. package/dist/cel-value.d.ts.map +1 -1
  11. package/dist/check-diagnostic.d.ts +3 -2
  12. package/dist/check-diagnostic.d.ts.map +1 -1
  13. package/dist/checker.d.ts +9 -0
  14. package/dist/checker.d.ts.map +1 -1
  15. package/dist/checker.js +98 -13
  16. package/dist/closure-backend.js +66 -15
  17. package/dist/duration-value.d.ts +11 -0
  18. package/dist/duration-value.d.ts.map +1 -1
  19. package/dist/duration-value.js +17 -3
  20. package/dist/emitted-module.d.ts +1 -1
  21. package/dist/emitted-module.js +1 -1
  22. package/dist/engine-version.d.ts +1 -1
  23. package/dist/engine-version.js +1 -1
  24. package/dist/environment.d.ts +8 -0
  25. package/dist/environment.d.ts.map +1 -1
  26. package/dist/environment.js +20 -5
  27. package/dist/function-registry.d.ts +40 -0
  28. package/dist/function-registry.d.ts.map +1 -1
  29. package/dist/function-registry.js +105 -2
  30. package/dist/index.d.ts +10 -8
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +12 -6
  33. package/dist/js-emitter.d.ts +3 -2
  34. package/dist/js-emitter.d.ts.map +1 -1
  35. package/dist/js-emitter.js +11 -5
  36. package/dist/macro-check.d.ts +8 -0
  37. package/dist/macro-check.d.ts.map +1 -1
  38. package/dist/macro-check.js +1 -1
  39. package/dist/member-read.d.ts +42 -5
  40. package/dist/member-read.d.ts.map +1 -1
  41. package/dist/member-read.js +47 -6
  42. package/dist/resolved-call.d.ts +13 -0
  43. package/dist/resolved-call.d.ts.map +1 -1
  44. package/dist/runtime-library.d.ts +13 -2
  45. package/dist/runtime-library.d.ts.map +1 -1
  46. package/dist/runtime-library.js +134 -125
  47. package/dist/serializer.d.ts.map +1 -1
  48. package/dist/serializer.js +20 -4
  49. package/dist/timestamp-value.d.ts +9 -0
  50. package/dist/timestamp-value.d.ts.map +1 -1
  51. package/dist/timestamp-value.js +15 -0
  52. package/dist/type-expression.d.ts +18 -2
  53. package/dist/type-expression.d.ts.map +1 -1
  54. package/dist/type-expression.js +23 -3
  55. package/dist/value-equality.d.ts.map +1 -1
  56. package/package.json +1 -1
  57. package/src/backend-runtime.ts +180 -30
  58. package/src/catalog-runtime.ts +133 -133
  59. package/src/cel-map-value.ts +31 -20
  60. package/src/cel-value.ts +11 -3
  61. package/src/check-diagnostic.ts +4 -2
  62. package/src/checker.ts +123 -10
  63. package/src/closure-backend.ts +59 -14
  64. package/src/duration-value.ts +18 -3
  65. package/src/emitted-module.ts +1 -1
  66. package/src/engine-version.ts +1 -1
  67. package/src/environment.ts +26 -5
  68. package/src/function-registry.ts +114 -2
  69. package/src/index.ts +24 -3
  70. package/src/js-emitter.ts +13 -5
  71. package/src/macro-check.ts +7 -1
  72. package/src/member-read.ts +48 -7
  73. package/src/resolved-call.ts +13 -0
  74. package/src/runtime-library.ts +167 -143
  75. package/src/serializer.ts +19 -3
  76. package/src/timestamp-value.ts +16 -0
  77. package/src/type-expression.ts +25 -3
  78. package/src/value-equality.ts +3 -3
@@ -14,8 +14,20 @@
14
14
  * classifier had to re-derive the cause after the fact. The checker decides it here,
15
15
  * once, with the candidates it considered.
16
16
  */
17
- import { assignable, DYN, formatType, isDyn } from "./cel-type.js";
17
+ import { CelEngineError } from "./check-diagnostic.js";
18
+ import { assignable, DYN, formatType, isDyn, typesEqual } from "./cel-type.js";
18
19
  import { formatSignature, signatureKey } from "./signature.js";
20
+ import { CALL_SITE_DIRECT_ARITY } from "./runtime-library.js";
21
+ import { isIdentifierSpelling, isReservedWord } from "./reserved-words.js";
22
+ /**
23
+ * How many names a refused call may name as candidates.
24
+ *
25
+ * It is **declared** rather than left to a message's taste, because the conformance
26
+ * vectors pin that message byte for byte: a bound and an order a second engine cannot
27
+ * reproduce would be a row no port can pass. The order is edit distance then name, both
28
+ * over the name exactly as it was written.
29
+ */
30
+ export const UNKNOWN_FUNCTION_CANDIDATES = 5;
19
31
  export class FunctionRegistry {
20
32
  byName;
21
33
  constructor(inherited) {
@@ -27,6 +39,13 @@ export class FunctionRegistry {
27
39
  }
28
40
  /** Registers a function, replacing any registration answering the same call. */
29
41
  register(signature, metadata = {}) {
42
+ // An implementation receives its arguments positionally, up to the bound, so a wider
43
+ // signature is refused HERE rather than resolved and then called with its tail dropped.
44
+ // A declared bound nothing enforces is the silent wrong answer it exists to prevent.
45
+ const arity = signature.parameters.length + (signature.form === "receiver" ? 1 : 0);
46
+ if (arity > CALL_SITE_DIRECT_ARITY) {
47
+ throw new CelEngineError("signature_too_wide", `${formatSignature(signature)} takes ${arity} values and an implementation receives at most ${CALL_SITE_DIRECT_ARITY}`);
48
+ }
30
49
  const entries = this.byName.get(signature.name) ?? [];
31
50
  const key = signatureKey(signature);
32
51
  const at = entries.findIndex((entry) => signatureKey(entry.signature) === key);
@@ -69,6 +88,38 @@ export class FunctionRegistry {
69
88
  named(name) {
70
89
  return this.byName.get(name) ?? [];
71
90
  }
91
+ /**
92
+ * The names this environment registers that would accept a call of that form and
93
+ * arity, nearest first — what a call on a name nothing registers is offered instead.
94
+ *
95
+ * **Form and arity are a filter rather than a ranking**, because a nearer name a call
96
+ * cannot be written on is not a repair: `'a'.size()` is not helped by `size`. A name
97
+ * that is not a name is filtered for the same reason — the operators register under
98
+ * their own symbols (`!`, `-`, `+`), and `no(1)` offered `!` and `-` as its two
99
+ * nearest spellings, neither of which can be written as a call at all. Among what
100
+ * passes the filter the order is edit distance then name, and the list is cut at
101
+ * {@link UNKNOWN_FUNCTION_CANDIDATES} — a declared bound and a declared order, so the
102
+ * message is the same text on every engine. Distance is counted over the name as
103
+ * written, with no case folding: a port reproduces one rule and not a host language's
104
+ * notion of lower case.
105
+ */
106
+ candidateNames(wanted, form, arity) {
107
+ const matching = [];
108
+ for (const [name, entries] of this.byName) {
109
+ if (name === wanted)
110
+ continue;
111
+ if (!isIdentifierSpelling(name) || isReservedWord(name))
112
+ continue;
113
+ const accepts = entries.some((entry) => entry.signature.form === form && entry.signature.parameters.length === arity);
114
+ if (accepts)
115
+ matching.push(name);
116
+ }
117
+ return matching
118
+ .map((name) => ({ name, distance: editDistance(wanted, name) }))
119
+ .sort((left, right) => left.distance - right.distance || compareNames(left.name, right.name))
120
+ .slice(0, UNKNOWN_FUNCTION_CANDIDATES)
121
+ .map((candidate) => candidate.name);
122
+ }
72
123
  /**
73
124
  * The function a call resolves to. `receiver` is the type the call is written on,
74
125
  * absent for a global call.
@@ -87,11 +138,38 @@ export class FunctionRegistry {
87
138
  const exact = this.match(viable, args, receiver, false);
88
139
  if (exact)
89
140
  return exact;
90
- const loose = this.match(viable, args, receiver, true);
141
+ const loose = this.matchLoosely(viable, args, receiver);
91
142
  if (loose)
92
143
  return loose;
93
144
  return { reason: "no-overload", candidates: inForm };
94
145
  }
146
+ /**
147
+ * The loose pass: a `dyn` argument makes a candidate viable, and **where several become
148
+ * viable and they do not agree on a return type, the call answers `dyn`.**
149
+ *
150
+ * Taking the first one instead is a concrete type nothing established. `dyn('a') +
151
+ * dyn('b')` answered `int` — the first `+` overload — so a host that declares nothing
152
+ * about a name had `a + b` typed `int`, and a consumer comparing that against a declared
153
+ * `string` slot refused a manifest that runs correctly. The honest answer is the one the
154
+ * engine's own design already states: overloads are resolved per call site on the VALUES'
155
+ * own types, so a `dyn` operand is exactly the case where the static answer is unknown.
156
+ *
157
+ * The candidate is still carried for the caller that wants one (a listing, a flag), and a
158
+ * single viable overload still answers its own return type — `dyn` only where they differ.
159
+ */
160
+ matchLoosely(candidates, args, receiver) {
161
+ const viable = [];
162
+ for (const candidate of candidates) {
163
+ const held = this.match([candidate], args, receiver, true);
164
+ if (held)
165
+ viable.push(held);
166
+ }
167
+ const first = viable[0];
168
+ if (!first)
169
+ return undefined;
170
+ const agree = viable.every((held) => typesEqual(held.returns, first.returns));
171
+ return agree ? first : { resolved: first.resolved, returns: DYN };
172
+ }
95
173
  match(candidates, args, receiver, allowDyn) {
96
174
  for (const candidate of candidates) {
97
175
  const { signature } = candidate;
@@ -180,6 +258,31 @@ export function substitute(type, bindings) {
180
258
  return type;
181
259
  }
182
260
  }
261
+ /** Code-unit order, so a port orders two names without a locale. */
262
+ function compareNames(left, right) {
263
+ return left < right ? -1 : left > right ? 1 : 0;
264
+ }
265
+ /**
266
+ * Levenshtein distance in UTF-16 code units — one insertion, deletion or substitution
267
+ * each costing one, which is the whole rule a port needs to reproduce.
268
+ *
269
+ * Code units rather than code points for the same reason every range in this package is
270
+ * in them: it is the one unit both ends of the engine already count in, and a name is
271
+ * compared against a name rather than cut.
272
+ */
273
+ function editDistance(from, to) {
274
+ let previous = Array.from({ length: to.length + 1 }, (ignored, at) => at);
275
+ for (let left = 1; left <= from.length; left += 1) {
276
+ const row = new Array(to.length + 1);
277
+ row[0] = left;
278
+ for (let right = 1; right <= to.length; right += 1) {
279
+ const substitution = previous[right - 1] + (from[left - 1] === to[right - 1] ? 0 : 1);
280
+ row[right] = Math.min(substitution, previous[right] + 1, row[right - 1] + 1);
281
+ }
282
+ previous = row;
283
+ }
284
+ return previous[to.length];
285
+ }
183
286
  /** How a resolution failure names what it looked at, for a message a human reads. */
184
287
  export function describeCandidates(candidates) {
185
288
  return candidates.map((candidate) => formatSignature(candidate.signature)).join(", ");
package/dist/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export type { CelCheckCode, CelCheckDiagnostic, CelDiagnosticFix, CelEngineError
36
36
  export type { CheckResult, NamespaceFunction } from "./checker.js";
37
37
  export { CelEnvironment, DEFAULT_COMPILED_CACHE_CAPACITY } from "./environment.js";
38
38
  export type { CelEnvironmentOptions, Definitions, FunctionDefinition, NamespaceFunctionDeclaration, NamespaceListing, NamespaceOptions, SchemaRegistrationReport, TypeDeclaration, TypeDefinitionListing, VariableDefinition, } from "./environment.js";
39
- export { FunctionRegistry } from "./function-registry.js";
39
+ export { FunctionRegistry, UNKNOWN_FUNCTION_CANDIDATES } from "./function-registry.js";
40
40
  export type { RegisteredFunction, Resolution, ResolutionFailure } from "./function-registry.js";
41
41
  export { fieldMapType, schemaType, TYPE_CONSTRAINING_KEYWORDS, TYPE_KEYWORDS_READ, UNJUDGED_REASONS, } from "./json-schema-type.js";
42
42
  export type { FieldDeclaration, JsonSchemaDocument, JsonSchemaNode, NamedTypeLookup, RecursiveSchemaReference, SchemaConversion, SchemaTypeAnswer, SchemaTypeResolver, SchemaTypeResult, UnjudgedReason, UnjudgedSchemaNode, } from "./json-schema-type.js";
@@ -55,11 +55,11 @@ export { scanJsonPrefix } from "./json-text-scan.js";
55
55
  export type { JsonRefusal } from "./json-text-scan.js";
56
56
  export { civilTimeIn, dateTextIn, daysInMonth, instantOfCivilTime, isoTextIn, knownTimeZone, } from "./zoned-calendar.js";
57
57
  export type { CivilTime } from "./zoned-calendar.js";
58
- export { CelTypeExpressionError, parseTypeExpression } from "./type-expression.js";
58
+ export { CelTypeExpressionError, CelUnknownTypeNameError, parseTypeExpression, } from "./type-expression.js";
59
59
  export type { NominalResolver } from "./type-expression.js";
60
60
  export type { CelActivation } from "./activation.js";
61
61
  export { BoundedCache } from "./bounded-cache.js";
62
- export { celMapFromEntries, celMapKeys, mapKeyIdentity } from "./cel-map-value.js";
62
+ export { celMapFromEntries, celMapKeys } from "./cel-map-value.js";
63
63
  export { CelEvaluationError, programOfStep } from "./cel-program.js";
64
64
  export type { CelProgram, EvaluateOptions } from "./cel-program.js";
65
65
  export { ENGINE_VERSION } from "./engine-version.js";
@@ -71,21 +71,23 @@ export type { DigestedEnvironment } from "./environment-digest.js";
71
71
  export { RUNTIME_BINDINGS } from "./js-emitter.js";
72
72
  export type { RuntimeBinding } from "./js-emitter.js";
73
73
  export { CEL_EVALUATION_CODES, CEL_VALUE_KEYS, CEL_VALUE_TYPE, celError, celNone, celSome, celTypeNameOf, celTypeValue, celUint, isCelBytes, isCelDuration, isCelError, isCelMap, isCelOptional, isCelRecord, isCelTimestamp, isCelTypeValue, isCelUint, literalValue, } from "./cel-value.js";
74
- export type { CelDuration, CelError, CelEvaluationCode, CelHostValue, CelMap, CelMapValueEntry, CelOptional, CelRecord, CelTimestamp, CelTypeValue, CelUint, CelValue, CelValueKey, } from "./cel-value.js";
74
+ export type { CelDuration, CelError, CelEvaluationCode, CelHostValue, CelMap, CelMapKey, CelMapValueEntry, CelOptional, CelRecord, CelTimestamp, CelTypeValue, CelUint, CelValue, CelValueKey, } from "./cel-value.js";
75
75
  export { compileTree } from "./closure-backend.js";
76
76
  export type { CompiledTree } from "./closure-backend.js";
77
77
  export { CALL_SITE_CACHE_CAPACITY, CelCompileError } from "./backend-runtime.js";
78
- export type { CelStep, CompileTarget, EvaluationFrame, NamespaceDispatch, } from "./backend-runtime.js";
78
+ export type { CelStep, CompileTarget, EvaluationFrame, NamespaceDispatch, NamespaceImplementation, } from "./backend-runtime.js";
79
79
  export { celAll, celExists, celExistsOne, celFilter, celMapComprehension, } from "./comprehension-runtime.js";
80
80
  export type { ComprehensionBody } from "./comprehension-runtime.js";
81
- export { celDurationFromNanos, durationField, durationNanos, durationOutOfRange, formatDuration, MAX_DURATION_NANOS, MIN_DURATION_NANOS, parseDuration, } from "./duration-value.js";
82
- export { celHas, celIterable, celLookup, celRead, lookupError, MISSING, OUT_OF_RANGE, UNSUPPORTED_CONTAINER, UNSUPPORTED_KEY, } from "./member-read.js";
81
+ export { celDurationFromNanos, durationField, durationNanos, durationNanosFromText, durationOutOfRange, formatDuration, MAX_DURATION_NANOS, MIN_DURATION_NANOS, parseDuration, } from "./duration-value.js";
82
+ export { celHas, celIterable, celLookup, celRead, lookupAbsence, lookupError, MISSING, OUT_OF_RANGE, UNSUPPORTED_CONTAINER, UNSUPPORTED_KEY, } from "./member-read.js";
83
83
  export type { Lookup } from "./member-read.js";
84
84
  export { celMatches, PATTERN_CACHE_CAPACITY, RE2_FLAG_LETTERS, RE2_PATTERN_ERROR_KINDS, re2Pattern, } from "./regular-expression.js";
85
85
  export type { RE2Compiled, RE2PatternRefusal } from "./regular-expression.js";
86
86
  export { base64Text, celTypeValueOf, implementationOf, jsonAsCelValue, implementedKeys, optionalOfNonZero, standardConstantValues, typeValueName, } from "./runtime-library.js";
87
87
  export type { CelCallContext, CelImplementation } from "./runtime-library.js";
88
- export { celTimestamp, formatTimestamp, MAX_TIMESTAMP_SECONDS, MIN_TIMESTAMP_SECONDS, parseTimestamp, timestampField, timestampNanos, zonedFields, } from "./timestamp-value.js";
88
+ export { CALL_SITE_DIRECT_ARITY } from "./runtime-library.js";
89
+ export { celTimestamp, celTimestampFromMillis, formatTimestamp, MAX_TIMESTAMP_SECONDS, MIN_TIMESTAMP_SECONDS, parseTimestamp, timestampField, timestampNanos, zonedFields, } from "./timestamp-value.js";
89
90
  export { celCompare, celEqual } from "./value-equality.js";
90
91
  export { bytesToText, doubleText, textToBytes } from "./value-text.js";
92
+ export { BINDING_FORMS, namespaceMacroBinding, receiverMacroBinding, type ComprehensionBinding, } from "./comprehension-bindings.js";
91
93
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,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EACb,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,MAAM,EACN,WAAW,EACX,SAAS,EACT,OAAO,EACP,aAAa,EACb,WAAW,EACX,OAAO,EACP,YAAY,EACZ,qBAAqB,EACrB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EACL,UAAU,EACV,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EACvB,UAAU,GACX,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE9E,OAAO,EACL,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ export { treesEqual } from "./tree-equality.js";
26
26
  export { admitsNull, assignable, BOOL, BYTES, DOUBLE, DURATION, DYN, formatType, INT, isDyn, isNumeric, listOf, mapOf, NULL, optionalOf, parameterOf, STRING, TIMESTAMP, TYPE, typesEqual, UINT, unify, unionOf, WELL_KNOWN_TYPE_NAMES, withoutNull, withoutParameters, } from "./cel-type.js";
27
27
  export { CEL_CHECK_CODES, CelEngineError } from "./check-diagnostic.js";
28
28
  export { CelEnvironment, DEFAULT_COMPILED_CACHE_CAPACITY } from "./environment.js";
29
- export { FunctionRegistry } from "./function-registry.js";
29
+ export { FunctionRegistry, UNKNOWN_FUNCTION_CANDIDATES } from "./function-registry.js";
30
30
  export { fieldMapType, schemaType, TYPE_CONSTRAINING_KEYWORDS, TYPE_KEYWORDS_READ, UNJUDGED_REASONS, } from "./json-schema-type.js";
31
31
  export { CelTypeRegistrationError } from "./nominal-type.js";
32
32
  export { formatSignature, parseSignature, signatureKey } from "./signature.js";
@@ -36,9 +36,12 @@ export { catalogCategories, catalogSignatures, FUNCTION_CATALOG_GENERATION, func
36
36
  export { catalogGuardedNames, catalogImplementation, catalogImplementedKeys, catalogLiteralCheck, } from "./catalog-runtime.js";
37
37
  export { scanJsonPrefix } from "./json-text-scan.js";
38
38
  export { civilTimeIn, dateTextIn, daysInMonth, instantOfCivilTime, isoTextIn, knownTimeZone, } from "./zoned-calendar.js";
39
- export { CelTypeExpressionError, parseTypeExpression } from "./type-expression.js";
39
+ export { CelTypeExpressionError, CelUnknownTypeNameError, parseTypeExpression, } from "./type-expression.js";
40
40
  export { BoundedCache } from "./bounded-cache.js";
41
- export { celMapFromEntries, celMapKeys, mapKeyIdentity } from "./cel-map-value.js";
41
+ // `mapKeyIdentity` is deliberately NOT exported: what identifies an entry is the entries
42
+ // map's own business, and publishing the rule is what let a consumer grow a second copy of
43
+ // it. A host reads a map through the member-read seam and walks `entries` for the pairs.
44
+ export { celMapFromEntries, celMapKeys } from "./cel-map-value.js";
42
45
  export { CelEvaluationError, programOfStep } from "./cel-program.js";
43
46
  // --- the emitter: JavaScript source, its key, and the one store seam --------
44
47
  export { ENGINE_VERSION } from "./engine-version.js";
@@ -50,10 +53,13 @@ export { CEL_EVALUATION_CODES, CEL_VALUE_KEYS, CEL_VALUE_TYPE, celError, celNone
50
53
  export { compileTree } from "./closure-backend.js";
51
54
  export { CALL_SITE_CACHE_CAPACITY, CelCompileError } from "./backend-runtime.js";
52
55
  export { celAll, celExists, celExistsOne, celFilter, celMapComprehension, } from "./comprehension-runtime.js";
53
- export { celDurationFromNanos, durationField, durationNanos, durationOutOfRange, formatDuration, MAX_DURATION_NANOS, MIN_DURATION_NANOS, parseDuration, } from "./duration-value.js";
54
- export { celHas, celIterable, celLookup, celRead, lookupError, MISSING, OUT_OF_RANGE, UNSUPPORTED_CONTAINER, UNSUPPORTED_KEY, } from "./member-read.js";
56
+ export { celDurationFromNanos, durationField, durationNanos, durationNanosFromText, durationOutOfRange, formatDuration, MAX_DURATION_NANOS, MIN_DURATION_NANOS, parseDuration, } from "./duration-value.js";
57
+ export { celHas, celIterable, celLookup, celRead, lookupAbsence, lookupError, MISSING, OUT_OF_RANGE, UNSUPPORTED_CONTAINER, UNSUPPORTED_KEY, } from "./member-read.js";
55
58
  export { celMatches, PATTERN_CACHE_CAPACITY, RE2_FLAG_LETTERS, RE2_PATTERN_ERROR_KINDS, re2Pattern, } from "./regular-expression.js";
56
59
  export { base64Text, celTypeValueOf, implementationOf, jsonAsCelValue, implementedKeys, optionalOfNonZero, standardConstantValues, typeValueName, } from "./runtime-library.js";
57
- export { celTimestamp, formatTimestamp, MAX_TIMESTAMP_SECONDS, MIN_TIMESTAMP_SECONDS, parseTimestamp, timestampField, timestampNanos, zonedFields, } from "./timestamp-value.js";
60
+ // The bound a host writing an implementation is held to, and what the refusal names.
61
+ export { CALL_SITE_DIRECT_ARITY } from "./runtime-library.js";
62
+ export { celTimestamp, celTimestampFromMillis, formatTimestamp, MAX_TIMESTAMP_SECONDS, MIN_TIMESTAMP_SECONDS, parseTimestamp, timestampField, timestampNanos, zonedFields, } from "./timestamp-value.js";
58
63
  export { celCompare, celEqual } from "./value-equality.js";
59
64
  export { bytesToText, doubleText, textToBytes } from "./value-text.js";
65
+ export { BINDING_FORMS, namespaceMacroBinding, receiverMacroBinding, } from "./comprehension-bindings.js";
@@ -93,8 +93,9 @@ export declare class ModuleEmitter {
93
93
  private anyCall;
94
94
  /**
95
95
  * One dispatch: evaluate the arguments, carry the first error out, then hand the values to
96
- * the site. The site is hoisted, so it is built once per loaded module and holds the
97
- * overloads it resolved — exactly as a compiled closure's does.
96
+ * the site **positionally**. The site is hoisted, so it is built once per loaded module and
97
+ * holds the overloads it resolved — exactly as a compiled closure's does. The arity is the
98
+ * dispatch key's, so the entry point is chosen here and no argument array is built.
98
99
  */
99
100
  private call;
100
101
  private qualifiedCall;
@@ -1 +1 @@
1
- {"version":3,"file":"js-emitter.d.ts","sourceRoot":"","sources":["../src/js-emitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAc,OAAO,EAA8B,MAAM,kBAAkB,CAAC;AAExF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,mYA0BnB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AA2C/D;;;;;GAKG;AACH,qBAAa,aAAa;IAMZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;IACxC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAC3D,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,QAAQ,CAAK;gBAEQ,MAAM,EAAE,aAAa;IAElD,sFAAsF;IACtF,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM;IAMnC,qFAAqF;IACrF,OAAO,CAAC,WAAW;IAQnB,4EAA4E;IAC5E,YAAY,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;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoB/C"}
@@ -30,6 +30,7 @@ import { CelCompileError, plainMemberChain, prefixCandidates, } from "./backend-
30
30
  import { namespaceMacroBinding, receiverMacroBinding } from "./comprehension-bindings.js";
31
31
  import { splitDeclaredChain } from "./declared-chain.js";
32
32
  import { isMacroCall } from "./macro-check.js";
33
+ import { CALL_SITE_DIRECT_ARITY } from "./runtime-library.js";
33
34
  /**
34
35
  * The names an emitted module destructures from the runtime it is handed, in the order it
35
36
  * destructures them. It is the module's whole contract with the engine: `emitterRuntime`
@@ -291,8 +292,8 @@ export class ModuleEmitter {
291
292
  const kept = entry.optional ? fn.next() : undefined;
292
293
  const written = kept
293
294
  ? `(${kept} = optionalEntry(${value}, ${at}), isCelError(${kept}) ? ${kept} : ` +
294
- `(${kept}.present && ${out}.push([${key}, ${kept}.held]), ${body}))`
295
- : `(${out}.push([${key}, ${value}]), ${body})`;
295
+ `(${kept}.present && ${out}.push(${key}, ${kept}.held), ${body}))`
296
+ : `(${out}.push(${key}, ${value}), ${body})`;
296
297
  body =
297
298
  `(${key} = ${entry.key}, isCelError(${key}) ? ${key} : ` +
298
299
  `(${value} = ${entry.value}, isCelError(${value}) ? ${value} : ${written}))`;
@@ -344,12 +345,17 @@ export class ModuleEmitter {
344
345
  }
345
346
  /**
346
347
  * One dispatch: evaluate the arguments, carry the first error out, then hand the values to
347
- * the site. The site is hoisted, so it is built once per loaded module and holds the
348
- * overloads it resolved — exactly as a compiled closure's does.
348
+ * the site **positionally**. The site is hoisted, so it is built once per loaded module and
349
+ * holds the overloads it resolved — exactly as a compiled closure's does. The arity is the
350
+ * dispatch key's, so the entry point is chosen here and no argument array is built.
349
351
  */
350
352
  call(name, form, args, range, fn) {
351
353
  const site = this.hoist(`callSite(${textSource(name)}, ${textSource(form)}, ${this.range(range)})`);
352
- return this.carrying(args, fn, (values) => `${site}.call([${values.join(", ")}])`);
354
+ // A call written wider than the bound takes the array form — the arity is the SOURCE's,
355
+ // so a width no signature can declare is still something an author may write.
356
+ return this.carrying(args, fn, (values) => values.length <= CALL_SITE_DIRECT_ARITY
357
+ ? `${site}.call${values.length}(${values.join(", ")})`
358
+ : `${site}.call([${values.join(", ")}])`);
353
359
  }
354
360
  qualifiedCall(node, scope, fn) {
355
361
  const args = node.args.map((argument) => this.node(argument, scope, fn));
@@ -21,6 +21,14 @@ export interface MacroHost {
21
21
  typeOf(node: CelNode): CelType;
22
22
  /** The type of a subexpression with extra names in scope. */
23
23
  typeOfBinding(node: CelNode, bindings: ReadonlyMap<string, CelType>): CelType;
24
+ /**
25
+ * The type of a select read as a question about PRESENCE — `has()`'s argument. It is
26
+ * the same reading `.?b` gets, which is what keeps the two forms of one question from
27
+ * answering differently about a union whose branches do not all hold the member.
28
+ */
29
+ typeOfPresence(node: Extract<CelNode, {
30
+ kind: "select";
31
+ }>): CelType;
24
32
  report(code: CelCheckCode, message: string, range: SourceRange): void;
25
33
  }
26
34
  /** Whether a call is a macro at all — asked before any overload is looked for. */
@@ -1 +1 @@
1
- {"version":3,"file":"macro-check.d.ts","sourceRoot":"","sources":["../src/macro-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7D,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAC/B,6DAA6D;IAC7D,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAC9E,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CACvE;AAWD,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAQlD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAalE"}
1
+ {"version":3,"file":"macro-check.d.ts","sourceRoot":"","sources":["../src/macro-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7D,mDAAmD;AACnD,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC;IAC/B,6DAA6D;IAC7D,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAC9E;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,GAAG,OAAO,CAAC;IACpE,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CACvE;AAWD,kFAAkF;AAClF,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAQlD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAalE"}
@@ -83,7 +83,7 @@ function checkOptionalBinding(node, host) {
83
83
  function checkHas(node, host) {
84
84
  const argument = node.args[0];
85
85
  if (argument.kind === "select")
86
- host.typeOf(argument);
86
+ host.typeOfPresence(argument);
87
87
  return BOOL;
88
88
  }
89
89
  /** `cel.bind(name, value, body)` — a name for one value, in scope in the body alone. */
@@ -16,6 +16,10 @@
16
16
  *
17
17
  * A key the value does not hold is the `no_such_key` **error value**, which
18
18
  * participates in short-circuit. Never `undefined` passed along.
19
+ *
20
+ * **What each of the four verdicts answers is written once here**, in `lookupAbsence`,
21
+ * and read by both presence callers — so the closure backend, the emitter and the
22
+ * `has()` macro cannot differ by construction.
19
23
  */
20
24
  import type { CelValue } from "./cel-value.js";
21
25
  import { type CelError } from "./cel-value.js";
@@ -39,14 +43,47 @@ export type Lookup = CelValue | typeof MISSING | typeof OUT_OF_RANGE | typeof UN
39
43
  export declare function celLookup(container: CelValue, key: CelValue): Lookup;
40
44
  /** The value at a key, or the error a failed lookup is. */
41
45
  export declare function celRead(container: CelValue, key: CelValue, range?: SourceRange): CelValue | CelError;
46
+ /**
47
+ * Whether a lookup that found nothing answers **absence** rather than an error. This is
48
+ * the seam's contract, in the one place both backends and the emitter read it: they all
49
+ * reach a member read through `backend-runtime.ts`, which reaches the four verdicts
50
+ * through here.
51
+ *
52
+ * - A **presence-shaped** read — `a.?b`, `a[?k]` and `has(a.b)` — answers absence for
53
+ * *missing*, *out of range* and *holds no members* alike, and the error only for an
54
+ * **unusable key**. It asks whether a member is THERE, and a value that cannot hold one
55
+ * has none to find. The authority is the optional library's own: it enters this engine
56
+ * from cel-go whole, and cel-go's attribute qualification answers "not found" for a
57
+ * receiver that is neither a mapper, a lister nor an indexer **whenever the read is a
58
+ * presence test**, erroring only otherwise — the error reading being an explicitly named
59
+ * opt-in (`EnableErrorOnBadPresenceTest`), which Telo does not carry, because a
60
+ * per-environment switch over what an expression MEANS would let the analyzer and a
61
+ * kernel disagree about one manifest.
62
+ * - A read **through a present optional, written in the ordinary form** — the `.c` of
63
+ * `a.?b.c` — is not a presence question about `c`. It answers absence for a key the held
64
+ * value does not hold (`optional.of({'c': {}}).c.missing` is absent, cel-spec's
65
+ * `optional_chaining_5`) and the error for a held value that holds no members at all
66
+ * (`{true: dyn(0)}[?true].absent` is cel-spec's error).
67
+ * - A **plain** read never asks: each of the four is the error `lookupError` words.
68
+ *
69
+ * An unusable key is the one refusal no form forgives: `[?3.1]` names an entry no
70
+ * container of that shape could hold, so it is a mistake in the READ rather than a member
71
+ * that happens to be absent.
72
+ */
73
+ export declare function lookupAbsence(found: symbol, presence: boolean): boolean;
42
74
  /** The error a refused lookup is. */
43
75
  export declare function lookupError(found: symbol, key: CelValue, range?: SourceRange): CelError;
44
76
  /**
45
- * Whether a key is there — `has(a.b)`. It asks about presence, so a missing key is
46
- * `false` rather than the error a read would be; a container that holds no members at
47
- * all is still a mistake in the question.
77
+ * Whether a key is there — `has(a.b)`. The question is presence-shaped, so a value that
78
+ * holds no members answers `false` exactly as a missing key does: it has no member to
79
+ * find. Only an unusable key is a mistake in the question itself.
48
80
  */
49
81
  export declare function celHas(container: CelValue, key: CelValue, range?: SourceRange): boolean | CelError;
50
- /** The elements a comprehension ranges over: a list's items, a map's keys. */
51
- export declare function celIterable(container: CelValue, range?: SourceRange): CelValue[] | CelError;
82
+ /**
83
+ * The elements a comprehension ranges over: a list's items, a map's keys. A list is handed
84
+ * over as it is — nothing in CEL mutates a value, and every comprehension reads its range —
85
+ * so copying it would cost the length of the list per comprehension to defend against a
86
+ * write no expression can perform.
87
+ */
88
+ export declare function celIterable(container: CelValue, range?: SourceRange): readonly CelValue[] | CelError;
52
89
  //# sourceMappingURL=member-read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"member-read.d.ts","sourceRoot":"","sources":["../src/member-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAA8C,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AA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uit. Never `undefined` passed along.
19
+ *
20
+ * **What each of the four verdicts answers is written once here**, in `lookupAbsence`,
21
+ * and read by both presence callers — so the closure backend, the emitter and the
22
+ * `has()` macro cannot differ by construction.
19
23
  */
20
24
  import { celMapKeys, mapKeyIdentity } from "./cel-map-value.js";
21
25
  import { celError, isCelMap, isCelRecord, isCelUint } from "./cel-value.js";
@@ -79,6 +83,38 @@ export function celRead(container, key, range) {
79
83
  return found;
80
84
  return lookupError(found, key, range);
81
85
  }
86
+ /**
87
+ * Whether a lookup that found nothing answers **absence** rather than an error. This is
88
+ * the seam's contract, in the one place both backends and the emitter read it: they all
89
+ * reach a member read through `backend-runtime.ts`, which reaches the four verdicts
90
+ * through here.
91
+ *
92
+ * - A **presence-shaped** read — `a.?b`, `a[?k]` and `has(a.b)` — answers absence for
93
+ * *missing*, *out of range* and *holds no members* alike, and the error only for an
94
+ * **unusable key**. It asks whether a member is THERE, and a value that cannot hold one
95
+ * has none to find. The authority is the optional library's own: it enters this engine
96
+ * from cel-go whole, and cel-go's attribute qualification answers "not found" for a
97
+ * receiver that is neither a mapper, a lister nor an indexer **whenever the read is a
98
+ * presence test**, erroring only otherwise — the error reading being an explicitly named
99
+ * opt-in (`EnableErrorOnBadPresenceTest`), which Telo does not carry, because a
100
+ * per-environment switch over what an expression MEANS would let the analyzer and a
101
+ * kernel disagree about one manifest.
102
+ * - A read **through a present optional, written in the ordinary form** — the `.c` of
103
+ * `a.?b.c` — is not a presence question about `c`. It answers absence for a key the held
104
+ * value does not hold (`optional.of({'c': {}}).c.missing` is absent, cel-spec's
105
+ * `optional_chaining_5`) and the error for a held value that holds no members at all
106
+ * (`{true: dyn(0)}[?true].absent` is cel-spec's error).
107
+ * - A **plain** read never asks: each of the four is the error `lookupError` words.
108
+ *
109
+ * An unusable key is the one refusal no form forgives: `[?3.1]` names an entry no
110
+ * container of that shape could hold, so it is a mistake in the READ rather than a member
111
+ * that happens to be absent.
112
+ */
113
+ export function lookupAbsence(found, presence) {
114
+ if (found === MISSING || found === OUT_OF_RANGE)
115
+ return true;
116
+ return presence && found === UNSUPPORTED_CONTAINER;
117
+ }
82
118
  /** The error a refused lookup is. */
83
119
  export function lookupError(found, key, range) {
84
120
  if (found === MISSING)
@@ -92,22 +128,27 @@ export function lookupError(found, key, range) {
92
128
  return celError("unsupported_container", "this value holds no members", range);
93
129
  }
94
130
  /**
95
- * Whether a key is there — `has(a.b)`. It asks about presence, so a missing key is
96
- * `false` rather than the error a read would be; a container that holds no members at
97
- * all is still a mistake in the question.
131
+ * Whether a key is there — `has(a.b)`. The question is presence-shaped, so a value that
132
+ * holds no members answers `false` exactly as a missing key does: it has no member to
133
+ * find. Only an unusable key is a mistake in the question itself.
98
134
  */
99
135
  export function celHas(container, key, range) {
100
136
  const found = celLookup(container, key);
101
137
  if (typeof found !== "symbol")
102
138
  return true;
103
- if (found === MISSING || found === OUT_OF_RANGE)
139
+ if (lookupAbsence(found, true))
104
140
  return false;
105
141
  return lookupError(found, key, range);
106
142
  }
107
- /** The elements a comprehension ranges over: a list's items, a map's keys. */
143
+ /**
144
+ * The elements a comprehension ranges over: a list's items, a map's keys. A list is handed
145
+ * over as it is — nothing in CEL mutates a value, and every comprehension reads its range —
146
+ * so copying it would cost the length of the list per comprehension to defend against a
147
+ * write no expression can perform.
148
+ */
108
149
  export function celIterable(container, range) {
109
150
  if (Array.isArray(container))
110
- return [...container];
151
+ return container;
111
152
  if (isCelMap(container))
112
153
  return celMapKeys(container);
113
154
  if (isCelRecord(container))
@@ -29,5 +29,18 @@ export interface ResolvedCall {
29
29
  readonly deterministic?: boolean;
30
30
  readonly hostBacked?: boolean;
31
31
  readonly throws?: readonly string[];
32
+ /**
33
+ * Each argument's own type, for a NAMESPACED call only.
34
+ *
35
+ * The host judges such a call against its own, richer signature grammar — a JSON Schema
36
+ * per parameter, an optional trailing parameter — so it needs what was actually passed.
37
+ * It cannot re-derive it: checking an argument's subtree on its own loses whatever the
38
+ * expression bound around it, so an argument inside a comprehension (`xs.map(i,
39
+ * Billing.total(i))`) would type as `dyn` and the host's argument check would silently
40
+ * stop asking. Here the types come from the same pass that typed the call.
41
+ *
42
+ * Absent for a call the registry resolved: its parameter types are the signature's.
43
+ */
44
+ readonly argumentTypes?: readonly string[];
32
45
  }
33
46
  //# sourceMappingURL=resolved-call.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolved-call.d.ts","sourceRoot":"","sources":["../src/resolved-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC"}
1
+ {"version":3,"file":"resolved-call.d.ts","sourceRoot":"","sources":["../src/resolved-call.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C"}
@@ -22,7 +22,18 @@ export interface CelCallContext {
22
22
  /** The span of the call, carried into any error value it produces. */
23
23
  readonly range?: SourceRange;
24
24
  }
25
- export type CelImplementation = (args: readonly CelValue[], ctx: CelCallContext) => CelValue;
25
+ /**
26
+ * What an implementation IS: its call context, then its arguments **positionally**.
27
+ *
28
+ * The dispatch key fixes each overload's arity, so there is never a count to carry and
29
+ * never an array to build — a call's cost is the call. `CALL_SITE_DIRECT_ARITY` is the
30
+ * bound, and it is the widest arity any registration declares; a trailing argument an
31
+ * overload does not take is `undefined`, which no CEL value ever is, so an absent one is
32
+ * unambiguous. In a port the same contract is a context plus a slice.
33
+ */
34
+ export type CelImplementation = (ctx: CelCallContext, a?: CelValue, b?: CelValue, c?: CelValue, d?: CelValue) => CelValue;
35
+ /** The widest arity a registration declares, and so the number of direct parameters. */
36
+ export declare const CALL_SITE_DIRECT_ARITY = 4;
26
37
  /** The name a type value carries. A null's type and an optional's are named apart. */
27
38
  export declare function typeValueName(typeName: string): string;
28
39
  /** The type value of any value — `type()` must answer for anything, including `dyn`. */
@@ -52,5 +63,5 @@ export declare function standardConstantValues(optionalTypes: boolean): Readonly
52
63
  * `optional.ofNonZeroValue(v)`: present unless the value is its type's zero — which is
53
64
  * what makes it different from `optional.of`, and what three of the vectors' rows read.
54
65
  */
55
- export declare function optionalOfNonZero(value: CelValue): CelOptional;
66
+ export declare function optionalOfNonZero(held: CelValue): CelOptional;
56
67
  //# sourceMappingURL=runtime-library.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-library.d.ts","sourceRoot":"","sources":["../src/runtime-library.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAGV,WAAW,EAEX,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAaL,KAAK,QAAQ,EACb,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAqBxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAYpD,mEAAmE;AACnE,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAC;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,EAAE,GAAG,EAAE,cAAc,KAAK,QAAQ,CAAC;AA6E7F,sFAAsF;AACtF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,QAAQ,CAM5F;AAMD,8DAA8D;AAC9D,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAYpD;AA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