@bjornpagen/bumbledb 0.1.0 → 0.3.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 (112) hide show
  1. package/COOKBOOK.md +1450 -0
  2. package/README.md +69 -30
  3. package/dist/closed.d.ts +157 -38
  4. package/dist/closed.d.ts.map +1 -1
  5. package/dist/closed.js +232 -47
  6. package/dist/closed.js.map +1 -1
  7. package/dist/count.d.ts +64 -17
  8. package/dist/count.d.ts.map +1 -1
  9. package/dist/count.js +37 -14
  10. package/dist/count.js.map +1 -1
  11. package/dist/db.d.ts +27 -8
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +33 -10
  14. package/dist/db.js.map +1 -1
  15. package/dist/exhume.d.ts +12 -11
  16. package/dist/exhume.d.ts.map +1 -1
  17. package/dist/exhume.js +7 -6
  18. package/dist/exhume.js.map +1 -1
  19. package/dist/face.d.ts +135 -30
  20. package/dist/face.d.ts.map +1 -1
  21. package/dist/face.js +44 -19
  22. package/dist/face.js.map +1 -1
  23. package/dist/fields.d.ts +130 -130
  24. package/dist/fields.d.ts.map +1 -1
  25. package/dist/fields.js +60 -94
  26. package/dist/fields.js.map +1 -1
  27. package/dist/index.d.ts +29 -24
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +19 -14
  30. package/dist/index.js.map +1 -1
  31. package/dist/law.d.ts +224 -0
  32. package/dist/law.d.ts.map +1 -0
  33. package/dist/law.js +224 -0
  34. package/dist/law.js.map +1 -0
  35. package/dist/lower.d.ts +17 -7
  36. package/dist/lower.d.ts.map +1 -1
  37. package/dist/lower.js +66 -24
  38. package/dist/lower.js.map +1 -1
  39. package/dist/marshal.d.ts +36 -21
  40. package/dist/marshal.d.ts.map +1 -1
  41. package/dist/marshal.js +41 -25
  42. package/dist/marshal.js.map +1 -1
  43. package/dist/native.d.ts +6 -2
  44. package/dist/native.d.ts.map +1 -1
  45. package/dist/native.js +2 -2
  46. package/dist/native.js.map +1 -1
  47. package/dist/query/atom.d.ts +370 -174
  48. package/dist/query/atom.d.ts.map +1 -1
  49. package/dist/query/atom.js +75 -172
  50. package/dist/query/atom.js.map +1 -1
  51. package/dist/query/lower.d.ts +312 -109
  52. package/dist/query/lower.d.ts.map +1 -1
  53. package/dist/query/lower.js +906 -387
  54. package/dist/query/lower.js.map +1 -1
  55. package/dist/query/predicate.d.ts +70 -88
  56. package/dist/query/predicate.d.ts.map +1 -1
  57. package/dist/query/predicate.js +118 -72
  58. package/dist/query/predicate.js.map +1 -1
  59. package/dist/query/run.d.ts +19 -16
  60. package/dist/query/run.d.ts.map +1 -1
  61. package/dist/query/run.js +31 -24
  62. package/dist/query/run.js.map +1 -1
  63. package/dist/query/scope.d.ts +178 -127
  64. package/dist/query/scope.d.ts.map +1 -1
  65. package/dist/query/scope.js +111 -108
  66. package/dist/query/scope.js.map +1 -1
  67. package/dist/query/select.d.ts +102 -80
  68. package/dist/query/select.d.ts.map +1 -1
  69. package/dist/query/select.js +39 -34
  70. package/dist/query/select.js.map +1 -1
  71. package/dist/relation.d.ts +48 -38
  72. package/dist/relation.d.ts.map +1 -1
  73. package/dist/relation.js +24 -19
  74. package/dist/relation.js.map +1 -1
  75. package/dist/schema.d.ts +41 -3
  76. package/dist/schema.d.ts.map +1 -1
  77. package/dist/schema.js +34 -9
  78. package/dist/schema.js.map +1 -1
  79. package/dist/spec.d.ts +7 -5
  80. package/dist/spec.d.ts.map +1 -1
  81. package/dist/spec.js.map +1 -1
  82. package/dist/statements.d.ts +91 -36
  83. package/dist/statements.d.ts.map +1 -1
  84. package/dist/statements.js +42 -12
  85. package/dist/statements.js.map +1 -1
  86. package/package.json +4 -3
  87. package/src/closed.ts +448 -95
  88. package/src/count.ts +112 -18
  89. package/src/db.ts +45 -17
  90. package/src/exhume.ts +12 -11
  91. package/src/face.ts +211 -41
  92. package/src/fields.ts +199 -234
  93. package/src/index.ts +78 -61
  94. package/src/law.ts +519 -0
  95. package/src/lower.ts +82 -27
  96. package/src/marshal.ts +48 -30
  97. package/src/native.ts +8 -4
  98. package/src/query/atom.ts +525 -374
  99. package/src/query/lower.ts +1469 -538
  100. package/src/query/predicate.ts +208 -161
  101. package/src/query/run.ts +35 -25
  102. package/src/query/scope.ts +264 -218
  103. package/src/query/select.ts +168 -93
  104. package/src/relation.ts +47 -47
  105. package/src/schema.ts +69 -18
  106. package/src/spec.ts +7 -5
  107. package/src/statements.ts +124 -41
  108. package/dist/brand.d.ts +0 -59
  109. package/dist/brand.d.ts.map +0 -1
  110. package/dist/brand.js +0 -47
  111. package/dist/brand.js.map +0 -1
  112. package/src/brand.ts +0 -82
@@ -1,29 +1,32 @@
1
1
  /**
2
- * Prepared-query marshaling seams (PRD-08), the two rides every execution
3
- * takes — the typed params object down to the bridge's positional
4
- * `QueryParam[]` (declaration order = dense `ParamId`s, values tagged by
5
- * each param's declaring field), and answer rows (positional, head order)
6
- * back up to plain objects with branded values (the store is the proof
7
- * carrier: the engine computed the answer, so readback asserts the brand,
8
- * the same trust direction as fact readback in `#marshal.ts`). Answers are
9
- * SETS no order or limit exists anywhere; hosts sort. The `Prepared`
10
- * VALUE itself (no lifecycle, GC-reclaimed plan) lives in `#db.ts`.
2
+ * Prepared-query marshaling seams, the two rides every execution takes —
3
+ * the typed params object down to the bridge's positional `QueryParam[]`
4
+ * (registry order = dense `ParamId`s, values tagged by each param's
5
+ * ANCHORING use: the field position or comparison sibling that typed it,
6
+ * op-aware exactly as comparison literals tag), and answer rows
7
+ * (positional, head order) back up to plain objects of BARE structural
8
+ * values — the marshal boundary is pure both ways: the engine computed
9
+ * the answer under the prepared head, so a decoded row that carries every
10
+ * select column IS a row (the trusted read seam), and nothing is asserted
11
+ * on any value. Answers are SETS — no order or limit exists anywhere;
12
+ * hosts sort. The `Prepared` VALUE itself (no lifecycle, GC-reclaimed
13
+ * plan) lives in `#db.ts`.
11
14
  */
12
15
  import type { FactValue, QueryParam } from "#native.ts";
13
- import type { SelectColumn } from "#query/lower.ts";
16
+ import type { SelectColumn } from "#query/atom.ts";
14
17
  import type { ParamEntry } from "#query/scope.ts";
15
18
  /**
16
19
  * Marshals the typed params object to the bridge's positional arguments,
17
- * in param declaration order (= the lowering's dense `ParamId`s). A
18
- * missing entry is a typed error naming the param; values tag by the
19
- * declaring field's structural type; a set param takes a readonly array
20
- * (the empty set is legal and matches nothing — the engine's rule).
20
+ * in registry order (= the lowering's dense `ParamId`s). A missing entry
21
+ * is a typed error naming the param; values tag by the anchoring use's
22
+ * structural type; a set param takes a readonly array (the empty set is
23
+ * legal and matches nothing — the engine's rule).
21
24
  */
22
25
  declare function wireParams(entries: readonly ParamEntry[], supplied: Readonly<Record<string, unknown>>): QueryParam[];
23
26
  /**
24
27
  * Decodes positional answer rows (column order = the program's head order
25
- * = the select record's written order) to named, branded, frozen row
26
- * objects.
28
+ * = the select's written order) to named, frozen row objects of bare
29
+ * structural values.
27
30
  */
28
31
  declare function decodeAnswers<Row>(select: readonly SelectColumn[], rows: FactValue[][]): Row[];
29
32
  export { decodeAnswers, wireParams };
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/query/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAajD;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,EAAE,CA0B7G;AAiBD;;;;GAIG;AACH,iBAAS,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,GAAG,EAAE,CAmBvF;AAED,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/query/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAe,MAAM,YAAY,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAuBjD;;;;;;GAMG;AACH,iBAAS,UAAU,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,EAAE,CAsB7G;AAkBD;;;;GAIG;AACH,iBAAS,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,YAAY,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,GAAG,EAAE,CAmBvF;AAED,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAA"}
package/dist/query/run.js CHANGED
@@ -1,16 +1,19 @@
1
1
  /**
2
- * Prepared-query marshaling seams (PRD-08), the two rides every execution
3
- * takes — the typed params object down to the bridge's positional
4
- * `QueryParam[]` (declaration order = dense `ParamId`s, values tagged by
5
- * each param's declaring field), and answer rows (positional, head order)
6
- * back up to plain objects with branded values (the store is the proof
7
- * carrier: the engine computed the answer, so readback asserts the brand,
8
- * the same trust direction as fact readback in `#marshal.ts`). Answers are
9
- * SETS no order or limit exists anywhere; hosts sort. The `Prepared`
10
- * VALUE itself (no lifecycle, GC-reclaimed plan) lives in `#db.ts`.
2
+ * Prepared-query marshaling seams, the two rides every execution takes —
3
+ * the typed params object down to the bridge's positional `QueryParam[]`
4
+ * (registry order = dense `ParamId`s, values tagged by each param's
5
+ * ANCHORING use: the field position or comparison sibling that typed it,
6
+ * op-aware exactly as comparison literals tag), and answer rows
7
+ * (positional, head order) back up to plain objects of BARE structural
8
+ * values — the marshal boundary is pure both ways: the engine computed
9
+ * the answer under the prepared head, so a decoded row that carries every
10
+ * select column IS a row (the trusted read seam), and nothing is asserted
11
+ * on any value. Answers are SETS — no order or limit exists anywhere;
12
+ * hosts sort. The `Prepared` VALUE itself (no lifecycle, GC-reclaimed
13
+ * plan) lives in `#db.ts`.
11
14
  */
12
15
  import * as errors from "@superbuilders/errors";
13
- import { taggedLiteral } from "#query/lower.ts";
16
+ import { taggedCmpLiteral } from "#query/lower.ts";
14
17
  /** The 13-bit Allen mask ceiling (`bumbledb/crates/bumbledb/src/allen.rs`: bits above the low 13 are unrepresentable). */
15
18
  const ALLEN_ALL_BITS = (1 << 13) - 1;
16
19
  /** Tags one supplied mask-param value. */
@@ -20,12 +23,19 @@ function wireMask(name, value) {
20
23
  }
21
24
  return { kind: "allenMask", mask: value };
22
25
  }
26
+ /** Tags one supplied value-param cell by its anchoring use. */
27
+ function wireValue(entry, context, value) {
28
+ if (entry.anchor === undefined) {
29
+ throw errors.new(`param ${entry.name} has no field-anchored use — bind it in an atom or compare it against a bound variable`);
30
+ }
31
+ return taggedCmpLiteral(context, entry.anchor, value, entry.op);
32
+ }
23
33
  /**
24
34
  * Marshals the typed params object to the bridge's positional arguments,
25
- * in param declaration order (= the lowering's dense `ParamId`s). A
26
- * missing entry is a typed error naming the param; values tag by the
27
- * declaring field's structural type; a set param takes a readonly array
28
- * (the empty set is legal and matches nothing — the engine's rule).
35
+ * in registry order (= the lowering's dense `ParamId`s). A missing entry
36
+ * is a typed error naming the param; values tag by the anchoring use's
37
+ * structural type; a set param takes a readonly array (the empty set is
38
+ * legal and matches nothing — the engine's rule).
29
39
  */
30
40
  function wireParams(entries, supplied) {
31
41
  return entries.map(function wireOne(entry) {
@@ -36,29 +46,26 @@ function wireParams(entries, supplied) {
36
46
  if (entry.shape === "mask") {
37
47
  return wireMask(entry.name, value);
38
48
  }
39
- if (entry.data === undefined) {
40
- throw errors.new(`param ${entry.name}: registry entry carries no declaring field`);
41
- }
42
49
  if (entry.shape === "set") {
43
50
  if (!Array.isArray(value)) {
44
51
  throw errors.new(`param ${entry.name}: a set param binds a readonly array of values`);
45
52
  }
46
- const data = entry.data;
47
53
  return {
48
54
  kind: "set",
49
55
  values: value.map(function wireElement(element, index) {
50
- return taggedLiteral(`param ${entry.name}[${index}]`, data, element);
56
+ return wireValue(entry, `param ${entry.name}[${index}]`, element);
51
57
  })
52
58
  };
53
59
  }
54
- return taggedLiteral(`param ${entry.name}`, entry.data, value);
60
+ return wireValue(entry, `param ${entry.name}`, value);
55
61
  });
56
62
  }
57
63
  /**
58
64
  * The read-side trusted seam of answers: a decoded row carrying every
59
65
  * select column IS a `Row` — the engine computed it under the prepared
60
- * head, so the brands are asserted, not re-derived (the `#marshal.ts`
61
- * trust direction).
66
+ * head, and the values are BARE structural values, so nothing is asserted
67
+ * beyond presence (the store is the proof carrier; no brand exists to
68
+ * re-derive).
62
69
  */
63
70
  function isAnswerRow(select, decoded) {
64
71
  return select.every(function present(column) {
@@ -67,8 +74,8 @@ function isAnswerRow(select, decoded) {
67
74
  }
68
75
  /**
69
76
  * Decodes positional answer rows (column order = the program's head order
70
- * = the select record's written order) to named, branded, frozen row
71
- * objects.
77
+ * = the select's written order) to named, frozen row objects of bare
78
+ * structural values.
72
79
  */
73
80
  function decodeAnswers(select, rows) {
74
81
  return rows.map(function decodeRow(row) {
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/query/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAG/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,0HAA0H;AAC1H,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA;AAEpC,0CAA0C;AAC1C,SAAS,QAAQ,CA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KAAK,CAAC,SAAS,OAAO,CAAC,MAAM;QAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,CAAA;IAC1C,CAAC,CAAC,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAM,MAA+B,EAAE,IAAmB;IAC/E,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,SAAS,CAAC,GAAG;QACrC,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;YAClC,MAAM,MAAM,CAAC,GAAG,CAAC,sBAAsB,GAAG,CAAC,MAAM,uBAAuB,MAAM,CAAC,MAAM,iBAAiB,CAAC,CAAA;QACxG,CAAC;QACD,MAAM,OAAO,GAA8B,EAAE,CAAA;QAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,UAAU,CAAC,MAAM,EAAE,OAAO;YACjD,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,CAAA;YACzB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,OAAO,KAAK,MAAM,CAAC,IAAI,aAAa,CAAC,CAAA;YAC5E,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;QAC5B,CAAC,CAAC,CAAA;QACF,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACtB,IAAI,CAAC,WAAW,CAAM,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;YACxC,MAAM,MAAM,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;QACrE,CAAC;QACD,OAAO,OAAO,CAAA;IACf,CAAC,CAAC,CAAA;AACH,CAAC;AAED,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,CAAA"}
@@ -1,87 +1,138 @@
1
1
  /**
2
- * Query scope terms (PRD-08): typed variables and parameters, declared
3
- * inside a `query()` scope callback so identity is lexical. A `Var` is
4
- * typed by the field it is declared from and joins are brand-equal by
5
- * construction (the nominal join discipline); var identity is OBJECT
6
- * identity two `$.var` calls are two variables even from the same field,
7
- * and no name-collision machinery exists. Params are query-global, carry a
8
- * mandatory literal name (the key of `execute`'s params object), and lower
9
- * to dense positional `ParamId`s in declaration order. This module also
10
- * owns the type-level params extraction: every atom and condition value
11
- * carries its contributed params object in a phantom, and the query's
12
- * `Params` type is the flattened intersection over the returned rules
13
- * inference rides the return value, never a mutable type accumulator.
14
- */
15
- import { phantom } from "#brand.ts";
16
- import type { FieldData } from "#fields.ts";
17
- import type { PredicateData } from "#query/predicate.ts";
18
- import type { AnySchema } from "#schema.ts";
2
+ * Query scope terms, LAW-TYPED edition: string-named variables and
3
+ * parameters as plain frozen values. A `Var` is a NAME it is typed by the
4
+ * field slot it first binds (the descriptor AND the slot's law-computed
5
+ * CLASS, read off the schema's class map through the rule builder's
6
+ * environment), reuse of the name within one rule IS the join, and a
7
+ * class-mismatched reuse is a compile error: a var joins only class-equal
8
+ * slots, and BARE PAIRS ONLY WITH BARE (ruling 3 a slot in no law has no
9
+ * class and never joins a classed slot; the deliberate sum-domain pointer
10
+ * stays legal against other bare slots). Params are query-global by name
11
+ * and typed BY USE: the field position or comparison sibling that anchors
12
+ * a param types it, the query's inferred `Params` object is exactly the
13
+ * params the rules use, and a param value that no rule uses simply never
14
+ * registers — the query executes under its own inferred type (the
15
+ * bug-hunt law). This module also owns the environment/typing utilities
16
+ * the whole surface shares: the env shape (var name → classed slot), the
17
+ * class-equality judgment {@link JoinOk} with its runtime twin
18
+ * {@link fieldJoins}, and the record-folding helpers `Params` and `Row`
19
+ * inference ride.
20
+ */
21
+ import type { AnyField, Infer } from "#fields.ts";
19
22
  /**
20
23
  * The runtime discriminant of query term values. Host literals (bigints,
21
- * strings, interval objects, `oneOf` sets) never carry it, so "is this
22
- * binding a term or a literal" is one property probe, never a guess.
24
+ * strings, interval objects) never carry it, so "is this position a term
25
+ * or a literal" is one property probe, never a guess.
23
26
  */
24
27
  declare const term: unique symbol;
25
28
  /**
26
- * A query variable, typed by the field it was declared from
27
- * (`$.var(Holder.fields.id)` `Var<Brand<bigint, "HolderId">>`). Usable in
28
- * any atom position whose field carries the same brand; a brand-mismatched
29
- * placement is a TYPE error. Identity is object identity.
29
+ * The carrier of a value's INFERRED types (a rule's row/params, a query's
30
+ * row/params, a rec's params). The property is never present at runtime —
31
+ * it exists so inference rides plain values without any brand on any
32
+ * field value.
33
+ */
34
+ declare const inferred: unique symbol;
35
+ /**
36
+ * A query variable — a NAME. Its type comes from the field it first binds
37
+ * in the rule (the builder's environment); reusing the name joins, and a
38
+ * cross-domain reuse is a compile error. Identity is the name, strictly
39
+ * rule-scoped: the same name in two rules names two unrelated variables
40
+ * (exactly as the IR scopes `VarId`).
30
41
  */
31
- interface Var<V> {
42
+ interface Var<Name extends string = string> {
32
43
  readonly [term]: "var";
33
- readonly relation: string;
34
- readonly field: string;
35
- readonly data: FieldData;
36
- readonly [phantom]?: V;
44
+ readonly name: Name;
37
45
  }
38
46
  /**
39
- * A scalar query parameter — `$.param("root", Holder.fields.id)`. The name
40
- * literal is the key of the typed params object `execute` takes; the value
41
- * is marshaled by the declaring field's structural type at bind.
47
+ * A scalar query parameter — `r.param("root")`. The name is the key of the
48
+ * typed params object `execute` takes; the type is the element type of the
49
+ * position that anchors it (a field binding, or the bound-variable side of
50
+ * a comparison).
42
51
  */
43
- interface Param<Name extends string, V> {
52
+ interface Param<Name extends string = string> {
44
53
  readonly [term]: "param";
45
54
  readonly name: Name;
46
- readonly relation: string;
47
- readonly field: string;
48
- readonly data: FieldData;
49
- readonly [phantom]?: V;
50
55
  }
51
56
  /**
52
- * A set-valued query parameter (the IR's `ParamSet` term): bound at
53
- * execution to an ARRAY of values of the declaring field's type; a binding
54
- * position matches iff the field value is in the set. Legal in atom
55
- * bindings (positive and negated) and as the right side of `is` — nowhere
56
- * else, exactly as the IR rules it.
57
+ * A set-valued query parameter (the IR's `ParamSet` term) `r.inSet("frontier")`:
58
+ * bound at execution to a readonly ARRAY of values of the anchoring field's
59
+ * type; a binding position matches iff the field value is in the set. Legal
60
+ * in atom bindings (positive and negated) and as the right side of `eq` —
61
+ * nowhere else, exactly as the IR rules it.
57
62
  */
58
- interface ParamSet<Name extends string, V> {
59
- readonly [term]: "paramSet";
63
+ interface SetParam<Name extends string = string> {
64
+ readonly [term]: "setParam";
60
65
  readonly name: Name;
61
- readonly relation: string;
62
- readonly field: string;
63
- readonly data: FieldData;
64
- readonly [phantom]?: V;
65
66
  }
66
67
  /**
67
- * An Allen-mask parameter (the IR's `MaskTerm::Param`): the temporal
68
- * relation as a bind-time argument one prepared query answers any of the
68
+ * An Allen-mask parameter (the IR's `MaskTerm::Param`) the temporal
69
+ * relation as a bind-time argument: one prepared query answers any of the
69
70
  * mask questions per execution. Bound to a 13-bit mask number built from
70
71
  * the `ALLEN` constants.
71
72
  */
72
- interface MaskParam<Name extends string> {
73
+ interface MaskParam<Name extends string = string> {
73
74
  readonly [term]: "maskParam";
74
75
  readonly name: Name;
75
76
  }
76
- /** Any query variable, whatever its brand. */
77
- type AnyVar = Var<unknown>;
78
- /** Any parameter term of the scope, whatever its name and brand. */
79
- type AnyParamTerm = Param<string, unknown> | ParamSet<string, unknown> | MaskParam<string>;
77
+ /**
78
+ * The measure of an interval-typed variable (`ir::Term::Measure`):
79
+ * `|[s, e)| = e s`, u64 legal as one side of an order comparison, as a
80
+ * select entry, and as the input of `sum`/`min`/`max`; every other position
81
+ * is unwritable, exactly as the IR rejects it typed. A ray has no finite
82
+ * measure — the engine's `MeasureOfRay` execution error; exclude rays first
83
+ * (`allen` against a bounded window).
84
+ */
85
+ interface Duration<Name extends string = string> {
86
+ readonly [term]: "duration";
87
+ readonly name: Name;
88
+ }
80
89
  /** Any scope term value. */
81
- type AnyTerm = AnyVar | AnyParamTerm;
82
- /** Narrows an unknown binding value to a scope term (vs a host literal). */
90
+ type AnyTerm = Var | Param | SetParam | MaskParam | Duration;
91
+ /** Narrows an unknown position value to a scope term (vs a host literal). */
83
92
  declare function isTerm(value: unknown): value is AnyTerm;
84
- /** A params object type — what `execute` takes and the phantoms carry. */
93
+ /** Builds one variable term. */
94
+ declare function makeVar<const Name extends string>(name: Name): Var<Name>;
95
+ /** The record `makeVars` mints: one own frozen `Var<Name>` per requested name, each typed exactly. */
96
+ type VarsRecord<Names extends string> = {
97
+ readonly [N in Names]: Var<N>;
98
+ };
99
+ /**
100
+ * Mints several variables at once — `const { service, w } = r.vars("service",
101
+ * "w")`: tuple-to-object, each name typed exactly (`Var<"service">`),
102
+ * inference identical to the one-at-a-time `r.var` spelling (one lowering,
103
+ * two entry flavors). Each key is defined as an OWN property (a name like
104
+ * `"__proto__"` is a record key like any other, never a prototype write),
105
+ * and a duplicate name in one call is a construction error: each name mints
106
+ * one variable — write it once and reuse the binding.
107
+ */
108
+ declare function makeVars<const Names extends readonly string[]>(...names: Names): VarsRecord<Names[number]>;
109
+ /** Builds one scalar-parameter term. */
110
+ declare function makeParam<const Name extends string>(name: Name): Param<Name>;
111
+ /** Builds one set-parameter term. */
112
+ declare function makeSetParam<const Name extends string>(name: Name): SetParam<Name>;
113
+ /** Builds one Allen-mask-parameter term. */
114
+ declare function makeMaskParam<const Name extends string>(name: Name): MaskParam<Name>;
115
+ /** Builds one measure term over an interval-typed variable's name. */
116
+ declare function makeDuration<const Name extends string>(name: Name): Duration<Name>;
117
+ /**
118
+ * One bound field slot: the field's descriptor plus the slot's
119
+ * law-computed CLASS (`undefined` = bare — the slot is in no law). The one
120
+ * shape the rule environment carries per variable, at the TYPE level (env
121
+ * entries hold the schema type's class-map lookups) and at RUNTIME alike
122
+ * (the rule's `varFields` record holds exactly this shape, read off the
123
+ * schema value's frozen class map) — one shape, two tiers, one walk.
124
+ */
125
+ interface ClassedField {
126
+ readonly field: AnyField;
127
+ readonly class: string | undefined;
128
+ }
129
+ /**
130
+ * A rule's typing environment: variable name → the classed slot it first
131
+ * bound. Purely a TYPE — the runtime twin is the rule's `varFields`
132
+ * record, and the two are built by the same walk.
133
+ */
134
+ type EnvShape = Record<string, ClassedField>;
135
+ /** A params object type — what `execute` takes and inference carries. */
85
136
  type ParamsRecord = Readonly<Record<string, unknown>>;
86
137
  /** Flattens an intersection into one displayed object type (hover legibility). */
87
138
  type Flatten<T> = {
@@ -90,79 +141,79 @@ type Flatten<T> = {
90
141
  /** The standard union-to-intersection fold (distributes over `U`). */
91
142
  type UnionToIntersection<U> = (U extends unknown ? (member: U) => void : never) extends (member: infer I) => void ? I : never;
92
143
  /**
93
- * One term's contribution to the query's params object type: a `Param`
94
- * contributes its value type under its name, a `ParamSet` the readonly
95
- * array of it, a `MaskParam` a mask number; everything else contributes
96
- * nothing.
144
+ * Folds a union of per-position record fragments into one flattened record
145
+ * (the machinery both `Params` and `Row` inference ride).
146
+ */
147
+ type ShapeOf<U> = [U] extends [never] ? Record<never, never> : Flatten<UnionToIntersection<U>>;
148
+ /** Reads a field descriptor's width label (`bytes<N>`, `interval<E, W>`); `undefined` when the kind carries none. */
149
+ type WidthOf<F extends AnyField> = F extends {
150
+ readonly width: infer W;
151
+ } ? W : undefined;
152
+ /** Reads an interval descriptor's element kind; `undefined` on scalar kinds. */
153
+ type ElementOf<F extends AnyField> = F extends {
154
+ readonly element: infer E;
155
+ } ? E : undefined;
156
+ /**
157
+ * The join judgment: two bound slots join iff their descriptors' structure
158
+ * agrees (kind, width label, interval element) AND their law-computed
159
+ * classes agree — same class name joins, and bare (`undefined`) pairs only
160
+ * with bare (ruling 3: a field in no law has no class; a bare↔classed
161
+ * pairing refuses). The class names come off the SCHEMA type's class map —
162
+ * the statements are the typing; no descriptor label exists to compare.
163
+ */
164
+ type JoinOk<A extends ClassedField, B extends ClassedField> = [
165
+ A["field"]["kind"],
166
+ A["class"],
167
+ WidthOf<A["field"]>,
168
+ ElementOf<A["field"]>
169
+ ] extends [B["field"]["kind"], B["class"], WidthOf<B["field"]>, ElementOf<B["field"]>] ? [B["field"]["kind"], B["class"], WidthOf<B["field"]>, ElementOf<B["field"]>] extends [
170
+ A["field"]["kind"],
171
+ A["class"],
172
+ WidthOf<A["field"]>,
173
+ ElementOf<A["field"]>
174
+ ] ? true : false : false;
175
+ /**
176
+ * The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
177
+ * structure and class agree — the same comparison the type tier makes,
178
+ * judged on the honest runtime values (the descriptor and the schema
179
+ * value's frozen class map). The rule builders throw through this on a
180
+ * class-unequal variable reuse, so the wall holds for untyped callers too,
181
+ * not only where the compiler can see.
182
+ */
183
+ declare function fieldJoins(a: ClassedField, b: ClassedField): boolean;
184
+ /**
185
+ * Renders one bound slot for join-mismatch diagnostics — the structural
186
+ * kind in the schema grammar's spelling plus the slot's law-computed class
187
+ * (`u64 in class Holder.id`; a lawless slot renders `bare`).
188
+ */
189
+ declare function renderFieldKind(slot: ClassedField): string;
190
+ /**
191
+ * What a PARAM anchored at field `F` accepts at execution: the field's
192
+ * bare value type, exactly. At an interval field the engine resolves the
193
+ * bivalent anchor to the INTERVAL reading (value equality) — the point
194
+ * reading of a param is spelled `pointIn(r.param(...), w)`, whose sibling
195
+ * anchors it element-typed.
196
+ */
197
+ type ParamValueAt<F extends AnyField> = Infer<F>;
198
+ /** Reads a value's inferred-types carrier (rules, queries, recs). */
199
+ type InferredOf<T> = T extends {
200
+ readonly [inferred]?: infer S;
201
+ } ? Exclude<S, undefined> : never;
202
+ /**
203
+ * One registered parameter of a query, as the wire marshal reads it: the
204
+ * name, the wire shape, the field descriptor (or the measure) that anchored
205
+ * it, and the comparison op the anchor came from (`"binding"` for atom
206
+ * positions) — the op keeps literal tagging op-aware at `pointIn`
207
+ * (the bug-hunt fix, preserved). `anchor` is `undefined` only on a query
208
+ * built but not yet anchored by any rule; lowering and the wire both refuse
209
+ * that state typed.
97
210
  */
98
- type TermContribution<T> = T extends {
99
- readonly [term]: "param";
100
- readonly name: infer N extends string;
101
- readonly [phantom]?: infer V;
102
- } ? {
103
- readonly [K in N]: Exclude<V, undefined>;
104
- } : T extends {
105
- readonly [term]: "paramSet";
106
- readonly name: infer N extends string;
107
- readonly [phantom]?: infer V;
108
- } ? {
109
- readonly [K in N]: readonly Exclude<V, undefined>[];
110
- } : T extends {
111
- readonly [term]: "maskParam";
112
- readonly name: infer N extends string;
113
- } ? {
114
- readonly [K in N]: number;
115
- } : Record<never, never>;
116
- /**
117
- * Folds a union of per-term/per-item params objects into the one flattened
118
- * params record (the query's `Params` type).
119
- */
120
- type ParamsShape<U> = [U] extends [never] ? Record<never, never> : Flatten<UnionToIntersection<U>>;
121
- /** Reads an atom's/condition's contributed params object off its phantom. */
122
- type ItemParams<T> = T extends {
123
- readonly [phantom]?: infer P;
124
- } ? Exclude<P, undefined> : Record<never, never>;
125
- /** One registered parameter: name, wire shape, and the declaring field. */
126
211
  interface ParamEntry {
127
212
  readonly name: string;
128
213
  readonly shape: "value" | "set" | "mask";
129
- readonly data: FieldData | undefined;
130
- }
131
- /**
132
- * The mutable build-time registry one `query()` scope owns: declared vars
133
- * (membership polices cross-scope smuggling), params in declaration order
134
- * (= dense `ParamId`s), and declared predicates in declaration order
135
- * (= dense `PredId`s; the output predicate is appended by lowering).
136
- */
137
- interface QueryRegistry {
138
- readonly theory: AnySchema;
139
- readonly vars: Set<AnyVar>;
140
- readonly params: ParamEntry[];
141
- readonly paramIndex: Map<AnyTerm, number>;
142
- readonly predicates: PredicateData[];
143
- }
144
- /** Creates one empty scope registry over the query's theory. */
145
- declare function createRegistry(theory: AnySchema): QueryRegistry;
146
- /**
147
- * Resolves a field reference's runtime description through the schema —
148
- * the seam that types `$.var`/`$.param` declarations at runtime (the type
149
- * level already carries the brand; this recovers the structural type the
150
- * lowering and the param marshaler direct by).
151
- */
152
- declare function resolveFieldData(theory: AnySchema, relationName: string, fieldName: string): FieldData;
153
- /** A field reference's runtime half, as the scope factories consume it. */
154
- interface RefNames {
155
- readonly relation: string;
156
- readonly field: string;
214
+ readonly anchor: AnyField | "measure" | undefined;
215
+ readonly op: "binding" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "pointIn" | "allen";
157
216
  }
158
- /** Declares one variable in the scope (the `$.var` implementation). */
159
- declare function scopeVar<V>(registry: QueryRegistry, ref: RefNames): Var<V>;
160
- /** Declares one scalar parameter (the `$.param` implementation). */
161
- declare function scopeParam<Name extends string, V>(registry: QueryRegistry, name: Name, ref: RefNames): Param<Name, V>;
162
- /** Declares one set parameter (the `$.paramSet` implementation). */
163
- declare function scopeParamSet<Name extends string, V>(registry: QueryRegistry, name: Name, ref: RefNames): ParamSet<Name, V>;
164
- /** Declares one Allen-mask parameter (the `$.allenParam` implementation). */
165
- declare function scopeAllenParam<Name extends string>(registry: QueryRegistry, name: Name): MaskParam<Name>;
166
- export type { AnyParamTerm, AnyTerm, AnyVar, Flatten, ItemParams, MaskParam, Param, ParamEntry, ParamSet, ParamsRecord, ParamsShape, QueryRegistry, TermContribution, UnionToIntersection, Var };
167
- export { createRegistry, isTerm, resolveFieldData, scopeAllenParam, scopeParam, scopeParamSet, scopeVar, term };
217
+ export type { AnyTerm, ClassedField, Duration, EnvShape, Flatten, InferredOf, JoinOk, MaskParam, Param, ParamEntry, ParamsRecord, ParamValueAt, SetParam, ShapeOf, UnionToIntersection, Var, VarsRecord };
218
+ export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, makeVar, makeVars, renderFieldKind, term };
168
219
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAA;AAE3D;;;;GAIG;AACH,QAAA,MAAM,IAAI,E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