@bjornpagen/bumbledb 0.14.0 → 0.17.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 (108) hide show
  1. package/COOKBOOK.md +58 -62
  2. package/README.md +82 -56
  3. package/dist/capacity.d.ts +24 -136
  4. package/dist/capacity.d.ts.map +1 -1
  5. package/dist/capacity.js +18 -40
  6. package/dist/capacity.js.map +1 -1
  7. package/dist/closed.d.ts +0 -156
  8. package/dist/closed.d.ts.map +1 -1
  9. package/dist/closed.js +0 -104
  10. package/dist/closed.js.map +1 -1
  11. package/dist/db.d.ts +93 -290
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +713 -556
  14. package/dist/db.js.map +1 -1
  15. package/dist/face.d.ts +0 -133
  16. package/dist/face.d.ts.map +1 -1
  17. package/dist/face.js +0 -33
  18. package/dist/face.js.map +1 -1
  19. package/dist/fields.d.ts +1 -145
  20. package/dist/fields.d.ts.map +1 -1
  21. package/dist/fields.js +2 -91
  22. package/dist/fields.js.map +1 -1
  23. package/dist/index.d.ts +13 -23
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +11 -20
  26. package/dist/index.js.map +1 -1
  27. package/dist/law.d.ts +111 -93
  28. package/dist/law.d.ts.map +1 -1
  29. package/dist/law.js +23 -27
  30. package/dist/law.js.map +1 -1
  31. package/dist/lower.d.ts +9 -35
  32. package/dist/lower.d.ts.map +1 -1
  33. package/dist/lower.js +8 -53
  34. package/dist/lower.js.map +1 -1
  35. package/dist/marshal.d.ts +0 -65
  36. package/dist/marshal.d.ts.map +1 -1
  37. package/dist/marshal.js +0 -72
  38. package/dist/marshal.js.map +1 -1
  39. package/dist/native.d.ts +97 -390
  40. package/dist/native.d.ts.map +1 -1
  41. package/dist/native.js +39 -61
  42. package/dist/native.js.map +1 -1
  43. package/dist/query/atom.d.ts +10 -276
  44. package/dist/query/atom.d.ts.map +1 -1
  45. package/dist/query/atom.js +1 -96
  46. package/dist/query/atom.js.map +1 -1
  47. package/dist/query/find.d.ts +10 -76
  48. package/dist/query/find.d.ts.map +1 -1
  49. package/dist/query/find.js +0 -30
  50. package/dist/query/find.js.map +1 -1
  51. package/dist/query/lower.d.ts +64 -146
  52. package/dist/query/lower.d.ts.map +1 -1
  53. package/dist/query/lower.js +19 -256
  54. package/dist/query/lower.js.map +1 -1
  55. package/dist/query/parse-ir.d.ts +0 -7
  56. package/dist/query/parse-ir.d.ts.map +1 -1
  57. package/dist/query/parse-ir.js +1 -13
  58. package/dist/query/parse-ir.js.map +1 -1
  59. package/dist/query/run.d.ts +0 -36
  60. package/dist/query/run.d.ts.map +1 -1
  61. package/dist/query/run.js +0 -44
  62. package/dist/query/run.js.map +1 -1
  63. package/dist/query/scope.d.ts +24 -180
  64. package/dist/query/scope.d.ts.map +1 -1
  65. package/dist/query/scope.js +2 -66
  66. package/dist/query/scope.js.map +1 -1
  67. package/dist/relation.d.ts +2 -50
  68. package/dist/relation.d.ts.map +1 -1
  69. package/dist/relation.js +2 -37
  70. package/dist/relation.js.map +1 -1
  71. package/dist/schema.d.ts +13 -63
  72. package/dist/schema.d.ts.map +1 -1
  73. package/dist/schema.js +118 -92
  74. package/dist/schema.js.map +1 -1
  75. package/dist/spec.d.ts +1 -140
  76. package/dist/spec.d.ts.map +1 -1
  77. package/dist/spec.js +1 -68
  78. package/dist/spec.js.map +1 -1
  79. package/dist/statements.d.ts +6 -137
  80. package/dist/statements.d.ts.map +1 -1
  81. package/dist/statements.js +16 -119
  82. package/dist/statements.js.map +1 -1
  83. package/package.json +3 -3
  84. package/src/capacity.ts +26 -140
  85. package/src/closed.ts +5 -206
  86. package/src/db.ts +997 -854
  87. package/src/face.ts +0 -142
  88. package/src/fields.ts +4 -172
  89. package/src/index.ts +32 -35
  90. package/src/law.ts +201 -129
  91. package/src/lower.ts +8 -53
  92. package/src/marshal.ts +1 -85
  93. package/src/native.ts +192 -413
  94. package/src/query/atom.ts +26 -313
  95. package/src/query/find.ts +24 -110
  96. package/src/query/lower.ts +132 -377
  97. package/src/query/parse-ir.ts +1 -14
  98. package/src/query/run.ts +0 -45
  99. package/src/query/scope.ts +25 -186
  100. package/src/relation.ts +2 -66
  101. package/src/schema.ts +143 -122
  102. package/src/spec.ts +1 -160
  103. package/src/statements.ts +22 -174
  104. package/dist/exhume.d.ts +0 -143
  105. package/dist/exhume.d.ts.map +0 -1
  106. package/dist/exhume.js +0 -166
  107. package/dist/exhume.js.map +0 -1
  108. package/src/exhume.ts +0 -267
@@ -1,79 +1,14 @@
1
- /**
2
- * Query scope terms, REFERENCE-IDENTITY edition: a query variable is an
3
- * OBJECT, minted fresh by {@link v} over a relation's statically-known
4
- * columns. `v(relation)` returns a record of fresh variables — one per
5
- * column, each typed at mint by its column's descriptor AND the mint
6
- * coordinate (the owner relation name and the column name), so
7
- * destructuring preserves every literal and every class
8
- * (`const { id, holder } = v(Account)`). Variable IDENTITY is the object
9
- * reference: reusing the same var value across binding positions IS the
10
- * join, and a name-collision join is unrepresentable (two `v()` calls mint
11
- * two distinct batches, so two same-named vars are two variables). Params
12
- * stay STRING-named — their names are the execute() params object's runtime
13
- * keys, an honest load-bearing channel, not a lie.
14
- *
15
- * THE DESIGN THEOREM. {@link JoinOk} is an EQUALITY (kind, class, width,
16
- * element, roster), so judging every binding position against the
17
- * variable's MINT slot ({@link MintSlotOf}) makes all cross-binding joins
18
- * mutually class-equal by transitivity — the env/sibling checks the
19
- * name-keyed edition needed are subsumed, deleted rather than ported. The
20
- * one check representation cannot carry is BOUNDNESS (is this var positively
21
- * bound in this rule): TypeScript types cannot see object identity, so
22
- * boundness moves from the type tier to construction-time walls only — an
23
- * explicit essential-vs-accidental concession; every runtime twin is
24
- * preserved.
25
- *
26
- * This module also owns the environment/typing utilities the whole surface
27
- * shares: the join descriptor {@link ClassedField}, the mint-slot machinery
28
- * ({@link MintSlotOf}/{@link MintClassOf}), the class-equality judgment
29
- * {@link JoinOk} with its runtime twin {@link fieldJoins}, and the
30
- * record-folding helpers `Params` and `Row` inference ride.
31
- */
32
1
  import type { AnyClosed } from "../closed.js";
33
2
  import type { AnyField, Infer } from "../fields.js";
34
3
  import type { ClassLookup, ClassRecordOf, SchemaClasses } from "../law.js";
35
4
  import type { QueryParam } from "../native.js";
36
5
  import type { AnyRelation, RelationFields } from "../relation.js";
37
- /**
38
- * The runtime discriminant of query term values. Host literals (bigints,
39
- * strings, interval objects) never carry it, so "is this position a term
40
- * or a literal" is one property probe, never a guess.
41
- */
42
6
  declare const term: unique symbol;
43
- /**
44
- * The carrier of a value's INFERRED types (a rule's row/params, a query's
45
- * row/params, a rec's params). The property is never present at runtime —
46
- * it exists so inference rides plain values without any brand on any
47
- * field value.
48
- */
49
7
  declare const inferred: unique symbol;
50
- /**
51
- * What a query atom matches over: an ordinary relation or a CLOSED
52
- * vocabulary (ψ query atoms — the engine folds a resolvable closed atom
53
- * into a plan-constant member set at prepare, or joins the L1-resident
54
- * virtual image when the shape does not fold; the SDK never pre-folds and
55
- * never knows which — transparency is the contract).
56
- */
57
8
  type MatchOwner = AnyRelation | AnyClosed;
58
- /**
59
- * The matchable field block of an atom owner: a relation's declared
60
- * fields; a closed relation's SEALED shape — the synthetic `id` (the
61
- * value's OWN roster-carrying descriptor, at its precise type) first, then
62
- * the declared payload columns read through the typed `columns` carrier.
63
- * The runtime twin is `sealedFieldsOf` in `#closed.ts`.
64
- */
65
9
  type MatchFields<R extends MatchOwner> = R extends AnyClosed ? {
66
10
  readonly id: R["id"];
67
11
  } & R["columns"] : R extends AnyRelation ? RelationFields<R> : never;
68
- /**
69
- * A query variable — an OBJECT minted by {@link v}. Identity is the object
70
- * reference: reuse of the same value across binding positions is the join,
71
- * strictly rule-scoped (each rule numbers its own dense `VarId`s). The type
72
- * carries the mint COORDINATE — `RN` the owner relation name literal, `K`
73
- * the column name literal — and `F` the mint descriptor, so the mint slot
74
- * (descriptor + law-computed class) is recoverable at every binding
75
- * position for the join judgment.
76
- */
77
12
  interface Var<F extends AnyField = AnyField, RN extends string = string, K extends string = string> {
78
13
  readonly [term]: "var";
79
14
  readonly owner: MatchOwner & {
@@ -83,57 +18,45 @@ interface Var<F extends AnyField = AnyField, RN extends string = string, K exten
83
18
  readonly field: F;
84
19
  readonly label: string;
85
20
  }
86
- /** Any query variable, whatever its descriptor and mint coordinate. */
87
21
  type AnyVar = Var;
88
- /**
89
- * A scalar query parameter — `r.param("root")`. The name is the key of the
90
- * typed params object `execute` takes; the type is the element type of the
91
- * position that anchors it (a field binding, or the bound-variable side of
92
- * a comparison).
93
- */
94
22
  interface Param<Name extends string = string> {
95
23
  readonly [term]: "param";
96
24
  readonly name: Name;
97
25
  }
98
- /**
99
- * A set-valued query parameter (the IR's `ParamSet` term) — `r.inSet("frontier")`:
100
- * bound at execution to a readonly ARRAY of values of the anchoring field's
101
- * type; a binding position matches iff the field value is in the set. Legal
102
- * in atom bindings (positive and negated) and as the right side of `eq` —
103
- * nowhere else, exactly as the IR rules it.
104
- */
105
26
  interface SetParam<Name extends string = string> {
106
27
  readonly [term]: "setParam";
107
28
  readonly name: Name;
108
29
  }
109
- /**
110
- * The measure of an interval-typed variable (`ir::Term::Measure`):
111
- * `|[s, e)| = e − s`, u64 — legal as one side of an order comparison, as a
112
- * find entry, and as the input of `sum`/`min`/`max`; every other position
113
- * is unwritable, exactly as the IR rejects it typed. Carries the interval
114
- * variable it measures BY REFERENCE.
115
- */
116
- interface Duration<V extends AnyVar = AnyVar> {
117
- readonly [term]: "duration";
118
- readonly over: V;
119
- }
120
- /** Any scope term value. */
121
- type AnyTerm = Var | Param | SetParam | Duration;
122
- /** Narrows an unknown position value to a scope term (vs a host literal). */
30
+ type AnyTerm = Var | Param | SetParam;
123
31
  declare function isTerm(value: unknown): value is AnyTerm;
124
- /**
125
- * The record of fresh variables `v(owner)` mints — one per statically-known
126
- * column, each typed by its column's descriptor and mint coordinate.
127
- */
128
32
  type VarsOf<R extends MatchOwner> = {
129
33
  readonly [K in keyof MatchFields<R> & string]: Var<MatchFields<R>[K], R["name"], K>;
130
34
  };
35
+ /**
36
+ * The exactness judgment of the six full-binding `match` forms (`#query/
37
+ * lower.ts` intersects it into the `bindings` parameter): a mapped type
38
+ * over the INFERRED record `B` requiring every entry to be a variable
39
+ * whose mint COLUMN is the entry's own key restricted to `R`'s matchable
40
+ * fields — for a column of `R` that is just the {@link VarsOf} entry's own
41
+ * shape, and for a FOREIGN key the column type is `never`, which no
42
+ * mintable variable inhabits. So an aliased or function-returned record
43
+ * carrying an extra key (`{...v(Account), extra: otherVar }` — shapes
44
+ * excess-property checking never sees, it covers inline literals only)
45
+ * fails the intersection and falls to the general form's judgment: the
46
+ * pre-0.16.0 compile refusal, restored. The identity record `v(rel)` still
47
+ * unifies for GENERIC `R` — the judgment is intersections and index
48
+ * constraints only, no deferred conditional anywhere, so the full-binding
49
+ * law (50-generic-binding.md, "The ruling") stands untouched.
50
+ */
51
+ type ExactVars<R extends MatchOwner, B> = {
52
+ readonly [K in keyof B]: Var<AnyField, R["name"], K & keyof MatchFields<R> & string>;
53
+ };
131
54
  /**
132
55
  * Mints a FRESH batch of query variables over an atom owner's
133
56
  * statically-known columns — one variable per sealed column
134
57
  * (`sealedFieldsOf`: a closed owner mints `id` first, then payload columns),
135
58
  * each frozen and each defined by OWN-property definition (object-protocol
136
- * column names must work, the `closed()` precedent). Every `v()` call mints
59
+ * column names must work, the `closed` precedent). Every `v` call mints
137
60
  * new objects, so two batches are two variables; property access within one
138
61
  * batch is stable by construction (the record is an eager frozen record,
139
62
  * never a Proxy). Variable identity is the object reference: destructure
@@ -141,82 +64,35 @@ type VarsOf<R extends MatchOwner> = {
141
64
  * across binding positions to join.
142
65
  */
143
66
  declare function v<R extends MatchOwner>(owner: R): VarsOf<R>;
144
- /** Builds one scalar-parameter term. */
145
67
  declare function makeParam<const Name extends string>(name: Name): Param<Name>;
146
- /** Builds one set-parameter term. */
147
68
  declare function makeSetParam<const Name extends string>(name: Name): SetParam<Name>;
148
- /** Builds one measure term over an interval-typed variable reference. */
149
- declare function makeDuration<const V extends AnyVar>(over: V): Duration<V>;
150
- /**
151
- * One bound field slot: the field's descriptor plus the slot's
152
- * law-computed CLASS (`undefined` = bare — the slot is in no law). The one
153
- * shape every join judgment compares, at the TYPE level (a variable's mint
154
- * slot, a binding position's slot) and at RUNTIME alike.
155
- */
156
69
  interface ClassedField {
157
70
  readonly field: AnyField;
158
71
  readonly class: string | undefined;
159
72
  }
160
- /**
161
- * A variable's law-computed CLASS at the TYPE level: its column's class,
162
- * read off the schema type's class map through the mint coordinate the
163
- * variable carries (`RN.K`). `undefined` = bare.
164
- */
165
73
  type MintClassOf<Classes extends SchemaClasses, V> = V extends Var<AnyField, infer RN extends string, infer K extends string> ? ClassLookup<ClassRecordOf<Classes, RN>, K> : never;
166
- /**
167
- * A variable's MINT slot: the descriptor it was minted at plus its
168
- * law-computed class. The one slot every binding position judges against —
169
- * because {@link JoinOk} is an equality, judging each position against the
170
- * mint slot makes every cross-binding join transitively class-equal.
171
- */
172
74
  type MintSlotOf<Classes extends SchemaClasses, V extends AnyVar> = {
173
75
  readonly field: V["field"];
174
76
  readonly class: MintClassOf<Classes, V>;
175
77
  };
176
- /** A params object type — what `execute` takes and inference carries. */
177
78
  type ParamsRecord = Readonly<Record<string, unknown>>;
178
- /** Flattens an intersection into one displayed object type (hover legibility). */
179
79
  type Flatten<T> = {
180
80
  [K in keyof T]: T[K];
181
81
  };
182
- /** The standard union-to-intersection fold (distributes over `U`). */
183
82
  type UnionToIntersection<U> = (U extends unknown ? (member: U) => void : never) extends (member: infer I) => void ? I : never;
184
- /**
185
- * Folds a union of per-position record fragments into one flattened record
186
- * (the machinery both `Params` and `Row` inference ride).
187
- */
188
83
  type ShapeOf<U> = [U] extends [never] ? Record<never, never> : Flatten<UnionToIntersection<U>>;
189
- /** Reads a field descriptor's width label (`bytes<N>`, `interval<E, W>`); `undefined` when the kind carries none. */
190
84
  type WidthOf<F extends AnyField> = F extends {
191
85
  readonly width: infer W;
192
86
  } ? W : undefined;
193
- /** Reads an interval descriptor's element kind; `undefined` on scalar kinds. */
194
87
  type ElementOf<F extends AnyField> = F extends {
195
88
  readonly element: infer E;
196
89
  } ? E : undefined;
197
- /**
198
- * Reads a closed reference's vocabulary name literal paired with its handle
199
- * union; `undefined` on every non-closed kind (the roster IS descriptor
200
- * structure). The name literal is the type-tier encoding of the runtime's
201
- * roster VALUE-IDENTITY judgment ({@link fieldJoins}): two same-shaped
202
- * vocabularies are distinct rosters, so they mismatch here exactly as they
203
- * refuse at runtime.
204
- */
205
90
  type RosterOf<F extends AnyField> = F extends {
206
91
  readonly closed: {
207
92
  readonly name: infer N extends string;
208
93
  readonly handles: readonly (infer H extends string)[];
209
94
  };
210
95
  } ? readonly [N, H] : undefined;
211
- /**
212
- * The join judgment: two bound slots join iff their descriptors' structure
213
- * agrees (kind, width label, interval element, and the closed ROSTER — a
214
- * closed reference pairs only with the same vocabulary, never with a bare
215
- * u64) AND their law-computed classes agree — same class name joins, and
216
- * bare (`undefined`) pairs only with bare (ruling 3). The class names come
217
- * off the SCHEMA type's class map; no descriptor label beyond the roster
218
- * exists to compare.
219
- */
220
96
  type JoinOk<A extends ClassedField, B extends ClassedField> = [
221
97
  A["field"]["kind"],
222
98
  A["class"],
@@ -230,51 +106,19 @@ type JoinOk<A extends ClassedField, B extends ClassedField> = [
230
106
  ElementOf<A["field"]>,
231
107
  RosterOf<A["field"]>
232
108
  ] ? true : false : false;
233
- /**
234
- * The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
235
- * structure and class agree — the same comparison the type tier makes,
236
- * judged on the honest runtime values (the descriptor, the roster by VALUE
237
- * IDENTITY, and the schema value's frozen class map). The rule builders
238
- * throw through this on a class-unequal reuse, so the wall holds for untyped
239
- * callers too.
240
- */
241
109
  declare function fieldJoins(a: ClassedField, b: ClassedField): boolean;
242
- /**
243
- * Renders one bound slot for join-mismatch diagnostics — the structural
244
- * kind in the schema grammar's spelling (a closed reference names its
245
- * vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
246
- * a lawless slot renders `bare`).
247
- */
248
110
  declare function renderFieldKind(slot: ClassedField): string;
249
- /**
250
- * What a PARAM anchored at field `F` accepts at execution: the field's
251
- * bare value type, exactly — at a CLOSED-reference field that is the
252
- * handle-name union (`"DirectPass" | "Failed"`), translated name → row id
253
- * at execute through the one roster-verification point (`taggedHandleId`).
254
- */
255
111
  type ParamValueAt<F extends AnyField> = Infer<F>;
256
- /** Reads a value's inferred-types carrier (rules, queries, recs). */
257
112
  type InferredOf<T> = T extends {
258
113
  readonly [inferred]?: infer S;
259
114
  } ? Exclude<S, undefined> : never;
260
- /**
261
- * One registered parameter of a query, as the wire marshal reads it: the
262
- * name, the wire shape, the field descriptor (or the measure) that anchored
263
- * it, and the comparison op the anchor came from (`"binding"` for atom
264
- * positions). `anchor` is `undefined` only on a query built but not yet
265
- * anchored by any rule. `membership` is present exactly on a
266
- * MEMBERSHIP-ARRAY entry: the FROZEN wire param, already resolved through
267
- * the one roster-verification point at BUILD time (the entry stores the
268
- * image, never the pre-image — no per-execute re-translation exists, and an
269
- * out-of-roster handle name fails where the mistake was made).
270
- */
271
115
  interface ParamEntry {
272
116
  readonly name: string;
273
117
  readonly shape: "value" | "set";
274
- readonly anchor: AnyField | "measure" | undefined;
118
+ readonly anchor: AnyField | undefined;
275
119
  readonly op: "binding" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "pointIn" | "allen";
276
120
  readonly membership: QueryParam | undefined;
277
121
  }
278
- export type { AnyTerm, AnyVar, ClassedField, Duration, Flatten, InferredOf, JoinOk, MatchFields, MatchOwner, MintClassOf, MintSlotOf, Param, ParamEntry, ParamsRecord, ParamValueAt, SetParam, ShapeOf, UnionToIntersection, Var, VarsOf };
279
- export { fieldJoins, inferred, isTerm, makeDuration, makeParam, makeSetParam, renderFieldKind, term, v };
122
+ export type { AnyTerm, AnyVar, ClassedField, ExactVars, Flatten, InferredOf, JoinOk, MatchFields, MatchOwner, MintClassOf, MintSlotOf, Param, ParamEntry, ParamsRecord, ParamValueAt, SetParam, ShapeOf, UnionToIntersection, Var, VarsOf };
123
+ export { fieldJoins, inferred, isTerm, makeParam, makeSetParam, renderFieldKind, term, v };
280
124
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE/D;;;;GAIG;AACH,QAAA,MAAM,IAAI,EAAE,OAAO,MAAsC,CAAA;AAEzD;;;;;GAKG;AACH,QAAA,MAAM,QAAQ,EAAE,OAAO,MAA0C,CAAA;AAEjE;;;;;;GAMG;AACH,KAAK,UAAU,GAAG,WAAW,GAAG,SAAS,CAAA;AAEzC;;;;;;GAMG;AACH,KAAK,WAAW,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,SAAS,SAAS,GACzD;IAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;CAAE,GAAG,CAAC,CAAC,SAAS,CAAC,GACvC,CAAC,SAAS,WAAW,GACpB,cAAc,CAAC,CAAC,CAAC,GACjB,KAAK,CAAA;AAET;;;;;;;;GAQG;AACH,UAAU,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IACjG,QAAQ,CAAC,CAAC,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M,EACN,WAAW,EACX,UAAU,EACV,WAAW,EACX,UAAU,EACV,KAAK,EACL,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,GAAG,EACH,MAAM,EACN,CAAA;AACD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA"}
@@ -1,51 +1,8 @@
1
- /**
2
- * Query scope terms, REFERENCE-IDENTITY edition: a query variable is an
3
- * OBJECT, minted fresh by {@link v} over a relation's statically-known
4
- * columns. `v(relation)` returns a record of fresh variables — one per
5
- * column, each typed at mint by its column's descriptor AND the mint
6
- * coordinate (the owner relation name and the column name), so
7
- * destructuring preserves every literal and every class
8
- * (`const { id, holder } = v(Account)`). Variable IDENTITY is the object
9
- * reference: reusing the same var value across binding positions IS the
10
- * join, and a name-collision join is unrepresentable (two `v()` calls mint
11
- * two distinct batches, so two same-named vars are two variables). Params
12
- * stay STRING-named — their names are the execute() params object's runtime
13
- * keys, an honest load-bearing channel, not a lie.
14
- *
15
- * THE DESIGN THEOREM. {@link JoinOk} is an EQUALITY (kind, class, width,
16
- * element, roster), so judging every binding position against the
17
- * variable's MINT slot ({@link MintSlotOf}) makes all cross-binding joins
18
- * mutually class-equal by transitivity — the env/sibling checks the
19
- * name-keyed edition needed are subsumed, deleted rather than ported. The
20
- * one check representation cannot carry is BOUNDNESS (is this var positively
21
- * bound in this rule): TypeScript types cannot see object identity, so
22
- * boundness moves from the type tier to construction-time walls only — an
23
- * explicit essential-vs-accidental concession; every runtime twin is
24
- * preserved.
25
- *
26
- * This module also owns the environment/typing utilities the whole surface
27
- * shares: the join descriptor {@link ClassedField}, the mint-slot machinery
28
- * ({@link MintSlotOf}/{@link MintClassOf}), the class-equality judgment
29
- * {@link JoinOk} with its runtime twin {@link fieldJoins}, and the
30
- * record-folding helpers `Params` and `Row` inference ride.
31
- */
32
1
  import * as errors from "@superbuilders/errors";
33
2
  import { sealedFieldsOf } from "#closed.ts";
34
3
  import { rosterOf } from "#fields.ts";
35
- /**
36
- * The runtime discriminant of query term values. Host literals (bigints,
37
- * strings, interval objects) never carry it, so "is this position a term
38
- * or a literal" is one property probe, never a guess.
39
- */
40
4
  const term = Symbol("bumbledb.query.term");
41
- /**
42
- * The carrier of a value's INFERRED types (a rule's row/params, a query's
43
- * row/params, a rec's params). The property is never present at runtime —
44
- * it exists so inference rides plain values without any brand on any
45
- * field value.
46
- */
47
5
  const inferred = Symbol("bumbledb.query.inferred");
48
- /** Narrows an unknown position value to a scope term (vs a host literal). */
49
6
  function isTerm(value) {
50
7
  return typeof value === "object" && value !== null && term in value;
51
8
  }
@@ -65,7 +22,7 @@ function varsMinted(owner, record) {
65
22
  * statically-known columns — one variable per sealed column
66
23
  * (`sealedFieldsOf`: a closed owner mints `id` first, then payload columns),
67
24
  * each frozen and each defined by OWN-property definition (object-protocol
68
- * column names must work, the `closed()` precedent). Every `v()` call mints
25
+ * column names must work, the `closed` precedent). Every `v` call mints
69
26
  * new objects, so two batches are two variables; property access within one
70
27
  * batch is stable by construction (the record is an eager frozen record,
71
28
  * never a Proxy). Variable identity is the object reference: destructure
@@ -90,29 +47,14 @@ function v(owner) {
90
47
  }
91
48
  return record;
92
49
  }
93
- /** Builds one scalar-parameter term. */
94
50
  function makeParam(name) {
95
51
  const value = { [term]: "param", name };
96
52
  return Object.freeze(value);
97
53
  }
98
- /** Builds one set-parameter term. */
99
54
  function makeSetParam(name) {
100
55
  const value = { [term]: "setParam", name };
101
56
  return Object.freeze(value);
102
57
  }
103
- /** Builds one measure term over an interval-typed variable reference. */
104
- function makeDuration(over) {
105
- const value = { [term]: "duration", over };
106
- return Object.freeze(value);
107
- }
108
- /**
109
- * The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
110
- * structure and class agree — the same comparison the type tier makes,
111
- * judged on the honest runtime values (the descriptor, the roster by VALUE
112
- * IDENTITY, and the schema value's frozen class map). The rule builders
113
- * throw through this on a class-unequal reuse, so the wall holds for untyped
114
- * callers too.
115
- */
116
58
  function fieldJoins(a, b) {
117
59
  const widthA = "width" in a.field ? a.field.width : undefined;
118
60
  const widthB = "width" in b.field ? b.field.width : undefined;
@@ -126,12 +68,6 @@ function fieldJoins(a, b) {
126
68
  elementA === elementB &&
127
69
  rosterA === rosterB);
128
70
  }
129
- /**
130
- * Renders one bound slot for join-mismatch diagnostics — the structural
131
- * kind in the schema grammar's spelling (a closed reference names its
132
- * vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
133
- * a lawless slot renders `bare`).
134
- */
135
71
  function renderFieldKind(slot) {
136
72
  const field = slot.field;
137
73
  let base = field.kind;
@@ -147,5 +83,5 @@ function renderFieldKind(slot) {
147
83
  }
148
84
  return slot.class === undefined ? `${base} (bare)` : `${base} in class ${slot.class}`;
149
85
  }
150
- export { fieldJoins, inferred, isTerm, makeDuration, makeParam, makeSetParam, renderFieldKind, term, v };
86
+ export { fieldJoins, inferred, isTerm, makeParam, makeSetParam, renderFieldKind, term, v };
151
87
  //# sourceMappingURL=scope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAKrC;;;;GAIG;AACH,MAAM,IAAI,GAAkB,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,QAAQ,GAAkB,MAAM,CAAC,yBAAyB,CAAC,CAAA;AAkFjE,6EAA6E;AAC7E,SAAS,MAAM,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,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E,CAAC,EAAE,CAAA"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * `relation()` — the ordinary-relation half of the theory's signature. A
2
+ * `relation` — the ordinary-relation half of the theory's signature. A
3
3
  * relation value is a frozen plain object carrying its name, its ordered
4
4
  * field descriptors (declaration order = ordinal ids, the macro's law),
5
- * and — since selections are the relation's own vocabulary — `where()`,
5
+ * and — since selections are the relation's own vocabulary — `where`,
6
6
  * which resolves a selection into lowered bindings eagerly (handles
7
7
  * verified against their roster at construction). Fields are addressed by
8
8
  * NAME everywhere — statements (`on(R, "holder")`), selections, and match
@@ -13,94 +13,46 @@
13
13
  */
14
14
  import { type AnyField, type Infer } from "./fields.js";
15
15
  import { type LiteralSetSpec } from "./spec.js";
16
- /**
17
- * Resolves a whole `where()` selection against the declared fields, in the
18
- * selection's written order (macro parity: σ is spelled, not sorted). An
19
- * empty selection is the bare relation respelled and rejected (the
20
- * canonical-utterance law). THE one selection resolver — `closed()`'s
21
- * `where()` resolves its payload columns through this same machine (a
22
- * `ClosedColumn` is structurally a {@link RelationField}), so both surfaces
23
- * share one vocabulary and one error voice.
24
- */
25
16
  declare function resolveSelection(name: string, ordered: readonly RelationField[], entries: ReadonlyArray<readonly [string, unknown]>): readonly SelectionBinding[];
26
- /** The field block of a relation: field name to field descriptor. */
27
17
  type FieldsShape = Record<string, AnyField>;
28
- /** One declared field: name plus its descriptor, in declaration order. */
29
18
  interface RelationField {
30
19
  readonly name: string;
31
20
  readonly field: AnyField;
32
21
  }
33
- /** A relation's runtime description. */
34
22
  interface RelationData {
35
23
  readonly name: string;
36
24
  readonly fields: readonly RelationField[];
37
25
  }
38
- /**
39
- * One resolved σ binding: the field name and its lowered literal set —
40
- * handles already resolved to names, values already tagged by structural
41
- * type.
42
- */
43
26
  interface SelectionBinding {
44
27
  readonly field: string;
45
28
  readonly set: LiteralSetSpec;
46
29
  }
47
- /**
48
- * The `where()` argument: per field, a bare structural literal of that
49
- * field's value type (a closed reference's literal IS its handle name —
50
- * `"Savings"`, verified against the roster at construction), a plain
51
- * ARRAY of such literals read disjunctively — `kind: ["Checking",
52
- * "Savings"]` — or a `span(start, end)` interval literal. Membership is
53
- * an array, never an operator (the drizzle law); equality-only by
54
- * construction: no operator parameter exists anywhere.
55
- */
56
30
  type SelectionInput<Fields extends FieldsShape> = {
57
31
  readonly [K in keyof Fields]?: Infer<Fields[K]> | readonly Infer<Fields[K]>[];
58
32
  };
59
- /** A relation with a selection applied — what `on()` consumes as a σ-carrying source. */
60
33
  interface Selected<Name extends string, Fields extends FieldsShape> {
61
34
  readonly relation: Relation<Name, Fields>;
62
35
  readonly selection: readonly SelectionBinding[];
63
36
  }
64
- /** A relation value. */
65
37
  interface Relation<Name extends string, Fields extends FieldsShape> {
66
38
  readonly name: Name;
67
39
  readonly data: RelationData;
68
40
  where(selection: SelectionInput<Fields>): Selected<Name, Fields>;
69
41
  }
70
- /** Any relation value, whatever its name and field block. */
71
42
  type AnyRelation = Relation<string, FieldsShape>;
72
- /** Any selected relation value. */
73
43
  interface AnySelected {
74
44
  readonly relation: AnyRelation;
75
45
  readonly selection: readonly SelectionBinding[];
76
46
  }
77
- /** Extracts a relation's field block type. */
78
47
  type RelationFields<R extends AnyRelation> = R extends Relation<string, infer F extends FieldsShape> ? F : never;
79
- /**
80
- * The inferred row object type of a relation as READ: every field present,
81
- * at its BARE structural value type ({@link Infer}). Closed relations have
82
- * no `Fact` — they are unwritable, and the type constraint refuses them
83
- * because a closed value lacks the relation shape.
84
- */
85
48
  type Fact<R extends AnyRelation> = {
86
49
  [K in keyof RelationFields<R>]: Infer<RelationFields<R>[K]>;
87
50
  };
88
- /** The field names of `R` whose descriptor type carries the fresh mint mark. */
89
51
  type FreshKeys<R extends AnyRelation> = {
90
52
  [K in keyof RelationFields<R>]: RelationFields<R>[K] extends {
91
53
  readonly fresh: true;
92
54
  } ? K : never;
93
55
  }[keyof RelationFields<R>];
94
- /**
95
- * Declares one relation: `relation("Account", { id: u64.fresh,
96
- * holder: u64, kind: Kind.id, ... })` — every field is a pure-structure
97
- * descriptor (the constructor values themselves; domains are never
98
- * declared: `schema()` computes them from the statements). Field
99
- * declaration order is ordinal-id order (macro parity), carried at BOTH
100
- * levels: the type level by the fields object, the value level by the
101
- * frozen `data.fields` list — the law the schema-level class naming leans
102
- * on. The returned value is frozen and side-effect free.
103
- */
104
56
  declare function relation<const Name extends string, Fields extends FieldsShape>(name: Name, fields: Fields): Relation<Name, Fields>;
105
57
  export type { AnyRelation, AnySelected, Fact, FieldsShape, FreshKeys, Relation, RelationData, RelationField, RelationFields, Selected, SelectionBinding, SelectionInput };
106
58
  export { relation, resolveSelection };
@@ -1 +1 @@
1
- {"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,KAAK,QAAQ,EAAsD,KAAK,KAAK,EAAa,MAAM,YAAY,CAAA;AACrH,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,UAAU,CAAA;AA4C/E;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAChD,SAAS,gBAAgB,EAAE,CAsB7B;AAED,qEAAqE;AACrE,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AAE3C,0EAA0E;AAC1E,UAAU,aAAa;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CACxB;AAED,wCAAwC;AACxC,UAAU,YAAY;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;CACzC;AAED;;;;GAIG;AACH,UAAU,gBAAgB;IACzB,QAAQ,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EhD,UAAU,WAAW;IACpB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,gBAAgB,EAAE,CAAA;CAC/C;AAED,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEhH,KAAK,IAAI,CAAC,CAAC,SAAS,WAAW,IAAI;KACjC,CAAC,IAAI,MAAM,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAA;AAED,KAAK,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI;KACtC,CAAC,IAAI,MAAM,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG,CAAC,GAAG,KAAK;CACjG,CAAC,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1B,iBAAS,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,SAAS,WAAW,EACtE,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACZ,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAuBxB;AAED,YAAY,EACX,WAAW,EACX,WAAW,EACX,IAAI,EACJ,WAAW,EACX,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,CAAA;AACD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
package/dist/relation.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
- * `relation()` — the ordinary-relation half of the theory's signature. A
2
+ * `relation` — the ordinary-relation half of the theory's signature. A
3
3
  * relation value is a frozen plain object carrying its name, its ordered
4
4
  * field descriptors (declaration order = ordinal ids, the macro's law),
5
- * and — since selections are the relation's own vocabulary — `where()`,
5
+ * and — since selections are the relation's own vocabulary — `where`,
6
6
  * which resolves a selection into lowered bindings eagerly (handles
7
7
  * verified against their roster at construction). Fields are addressed by
8
8
  * NAME everywhere — statements (`on(R, "holder")`), selections, and match
@@ -14,22 +14,6 @@
14
14
  import * as errors from "@superbuilders/errors";
15
15
  import { assertDeclarationOrderKey, assertDeclarationRecord, literalOf } from "#fields.ts";
16
16
  import { renderLiteral } from "#spec.ts";
17
- /**
18
- * Resolves one selection entry to its lowered literal set: a plain ARRAY
19
- * (detected by `Array.isArray` — no field's value type is an array;
20
- * `Uint8Array` is not one) becomes a disjunctive set, anything else the
21
- * bare literal. The degenerate sets are construction errors, each
22
- * self-locating (`context` names the relation and field) — the empty set
23
- * selects nothing, the one-element set is the bare literal respelled, and
24
- * a DUPLICATE literal (judged on the canonical rendering — the engine's
25
- * own duplicate test, reached here first so its index-speak twin at
26
- * `Db.create` stays unreachable from this surface) is the same respelling
27
- * in disguise (the canonical-utterance law; the old set combinator's
28
- * signature made the length degenerates unwritable, and the refusals here
29
- * are that law's runtime seat). The lowered set — `{ kind: "many",
30
- * literals }` — is byte-identical to what the combinator produced, so no
31
- * fingerprint moves.
32
- */
33
17
  function resolveEntry(context, field, entry) {
34
18
  if (Array.isArray(entry)) {
35
19
  if (entry.length < 2) {
@@ -51,15 +35,6 @@ function resolveEntry(context, field, entry) {
51
35
  }
52
36
  return Object.freeze({ kind: "one", literal: Object.freeze(literalOf(field, entry)) });
53
37
  }
54
- /**
55
- * Resolves a whole `where()` selection against the declared fields, in the
56
- * selection's written order (macro parity: σ is spelled, not sorted). An
57
- * empty selection is the bare relation respelled and rejected (the
58
- * canonical-utterance law). THE one selection resolver — `closed()`'s
59
- * `where()` resolves its payload columns through this same machine (a
60
- * `ClosedColumn` is structurally a {@link RelationField}), so both surfaces
61
- * share one vocabulary and one error voice.
62
- */
63
38
  function resolveSelection(name, ordered, entries) {
64
39
  const bindings = [];
65
40
  for (const [fieldName, entry] of entries) {
@@ -79,16 +54,6 @@ function resolveSelection(name, ordered, entries) {
79
54
  }
80
55
  return Object.freeze(bindings);
81
56
  }
82
- /**
83
- * Declares one relation: `relation("Account", { id: u64.fresh,
84
- * holder: u64, kind: Kind.id, ... })` — every field is a pure-structure
85
- * descriptor (the constructor values themselves; domains are never
86
- * declared: `schema()` computes them from the statements). Field
87
- * declaration order is ordinal-id order (macro parity), carried at BOTH
88
- * levels: the type level by the fields object, the value level by the
89
- * frozen `data.fields` list — the law the schema-level class naming leans
90
- * on. The returned value is frozen and side-effect free.
91
- */
92
57
  function relation(name, fields) {
93
58
  assertDeclarationOrderKey("relation", name);
94
59
  assertDeclarationRecord(`relation ${name} fields`, fields);