@bjornpagen/bumbledb 0.5.0 → 0.6.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 (45) hide show
  1. package/COOKBOOK.md +96 -131
  2. package/README.md +9 -9
  3. package/dist/db.js +2 -2
  4. package/dist/db.js.map +1 -1
  5. package/dist/index.d.ts +8 -5
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +5 -2
  8. package/dist/index.js.map +1 -1
  9. package/dist/query/atom.d.ts +132 -201
  10. package/dist/query/atom.d.ts.map +1 -1
  11. package/dist/query/atom.js +30 -42
  12. package/dist/query/atom.js.map +1 -1
  13. package/dist/query/find.d.ts +116 -0
  14. package/dist/query/find.d.ts.map +1 -0
  15. package/dist/query/{select.js → find.js} +22 -22
  16. package/dist/query/find.js.map +1 -0
  17. package/dist/query/lower.d.ts +123 -158
  18. package/dist/query/lower.d.ts.map +1 -1
  19. package/dist/query/lower.js +437 -493
  20. package/dist/query/lower.js.map +1 -1
  21. package/dist/query/predicate.d.ts +22 -14
  22. package/dist/query/predicate.d.ts.map +1 -1
  23. package/dist/query/predicate.js +35 -42
  24. package/dist/query/predicate.js.map +1 -1
  25. package/dist/query/run.d.ts +3 -3
  26. package/dist/query/run.d.ts.map +1 -1
  27. package/dist/query/run.js +9 -9
  28. package/dist/query/run.js.map +1 -1
  29. package/dist/query/scope.d.ts +127 -72
  30. package/dist/query/scope.d.ts.map +1 -1
  31. package/dist/query/scope.js +80 -33
  32. package/dist/query/scope.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/db.ts +4 -4
  35. package/src/index.ts +11 -7
  36. package/src/query/atom.ts +181 -263
  37. package/src/query/find.ts +212 -0
  38. package/src/query/lower.ts +588 -722
  39. package/src/query/predicate.ts +37 -45
  40. package/src/query/run.ts +10 -10
  41. package/src/query/scope.ts +172 -87
  42. package/dist/query/select.d.ts +0 -128
  43. package/dist/query/select.d.ts.map +0 -1
  44. package/dist/query/select.js.map +0 -1
  45. package/src/query/select.ts +0 -215
@@ -1,24 +1,38 @@
1
1
  /**
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.
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.
20
31
  */
32
+ import type { AnyClosed } from "#closed.ts";
21
33
  import type { AnyField, Infer } from "#fields.ts";
34
+ import type { ClassLookup, ClassRecordOf, SchemaClasses } from "#law.ts";
35
+ import type { AnyRelation, RelationFields } from "#relation.ts";
22
36
  /**
23
37
  * The runtime discriminant of query term values. Host literals (bigints,
24
38
  * strings, interval objects) never carry it, so "is this position a term
@@ -33,16 +47,43 @@ declare const term: unique symbol;
33
47
  */
34
48
  declare const inferred: unique symbol;
35
49
  /**
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`).
50
+ * What a query atom matches over: an ordinary relation or a CLOSED
51
+ * vocabulary (ψ query atoms the engine folds a resolvable closed atom
52
+ * into a plan-constant member set at prepare, or joins the L1-resident
53
+ * virtual image when the shape does not fold; the SDK never pre-folds and
54
+ * never knows which transparency is the contract).
41
55
  */
42
- interface Var<Name extends string = string> {
56
+ type MatchOwner = AnyRelation | AnyClosed;
57
+ /**
58
+ * The matchable field block of an atom owner: a relation's declared
59
+ * fields; a closed relation's SEALED shape — the synthetic `id` (the
60
+ * value's OWN roster-carrying descriptor, at its precise type) first, then
61
+ * the declared payload columns read through the typed `columns` carrier.
62
+ * The runtime twin is `sealedFieldsOf` in `#closed.ts`.
63
+ */
64
+ type MatchFields<R extends MatchOwner> = R extends AnyClosed ? {
65
+ readonly id: R["id"];
66
+ } & R["columns"] : R extends AnyRelation ? RelationFields<R> : never;
67
+ /**
68
+ * A query variable — an OBJECT minted by {@link v}. Identity is the object
69
+ * reference: reuse of the same value across binding positions is the join,
70
+ * strictly rule-scoped (each rule numbers its own dense `VarId`s). The type
71
+ * carries the mint COORDINATE — `RN` the owner relation name literal, `K`
72
+ * the column name literal — and `F` the mint descriptor, so the mint slot
73
+ * (descriptor + law-computed class) is recoverable at every binding
74
+ * position for the join judgment.
75
+ */
76
+ interface Var<F extends AnyField = AnyField, RN extends string = string, K extends string = string> {
43
77
  readonly [term]: "var";
44
- readonly name: Name;
78
+ readonly owner: MatchOwner & {
79
+ readonly name: RN;
80
+ };
81
+ readonly column: K;
82
+ readonly field: F;
83
+ readonly label: string;
45
84
  }
85
+ /** Any query variable, whatever its descriptor and mint coordinate. */
86
+ type AnyVar = Var;
46
87
  /**
47
88
  * A scalar query parameter — `r.param("root")`. The name is the key of the
48
89
  * typed params object `execute` takes; the type is the element type of the
@@ -77,47 +118,72 @@ interface MaskParam<Name extends string = string> {
77
118
  /**
78
119
  * The measure of an interval-typed variable (`ir::Term::Measure`):
79
120
  * `|[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).
121
+ * find entry, and as the input of `sum`/`min`/`max`; every other position
122
+ * is unwritable, exactly as the IR rejects it typed. Carries the interval
123
+ * variable it measures BY REFERENCE.
84
124
  */
85
- interface Duration<Name extends string = string> {
125
+ interface Duration<V extends AnyVar = AnyVar> {
86
126
  readonly [term]: "duration";
87
- readonly name: Name;
127
+ readonly over: V;
88
128
  }
89
129
  /** Any scope term value. */
90
130
  type AnyTerm = Var | Param | SetParam | MaskParam | Duration;
91
131
  /** Narrows an unknown position value to a scope term (vs a host literal). */
92
132
  declare function isTerm(value: unknown): value is AnyTerm;
93
- /** Builds one variable term. */
94
- declare function makeVar<const Name extends string>(name: Name): Var<Name>;
133
+ /**
134
+ * The record of fresh variables `v(owner)` mints — one per statically-known
135
+ * column, each typed by its column's descriptor and mint coordinate.
136
+ */
137
+ type VarsOf<R extends MatchOwner> = {
138
+ readonly [K in keyof MatchFields<R> & string]: Var<MatchFields<R>[K], R["name"], K>;
139
+ };
140
+ /**
141
+ * Mints a FRESH batch of query variables over an atom owner's
142
+ * statically-known columns — one variable per sealed column
143
+ * (`sealedFieldsOf`: a closed owner mints `id` first, then payload columns),
144
+ * each frozen and each defined by OWN-property definition (object-protocol
145
+ * column names must work, the `closed()` precedent). Every `v()` call mints
146
+ * new objects, so two batches are two variables; property access within one
147
+ * batch is stable by construction (the record is an eager frozen record,
148
+ * never a Proxy). Variable identity is the object reference: destructure
149
+ * what you need (`const { id, holder } = v(Account)`) and reuse a value
150
+ * across binding positions to join.
151
+ */
152
+ declare function v<R extends MatchOwner>(owner: R): VarsOf<R>;
95
153
  /** Builds one scalar-parameter term. */
96
154
  declare function makeParam<const Name extends string>(name: Name): Param<Name>;
97
155
  /** Builds one set-parameter term. */
98
156
  declare function makeSetParam<const Name extends string>(name: Name): SetParam<Name>;
99
157
  /** Builds one Allen-mask-parameter term. */
100
158
  declare function makeMaskParam<const Name extends string>(name: Name): MaskParam<Name>;
101
- /** Builds one measure term over an interval-typed variable's name. */
102
- declare function makeDuration<const Name extends string>(name: Name): Duration<Name>;
159
+ /** Builds one measure term over an interval-typed variable reference. */
160
+ declare function makeDuration<const V extends AnyVar>(over: V): Duration<V>;
103
161
  /**
104
162
  * One bound field slot: the field's descriptor plus the slot's
105
163
  * law-computed CLASS (`undefined` = bare — the slot is in no law). The one
106
- * shape the rule environment carries per variable, at the TYPE level (env
107
- * entries hold the schema type's class-map lookups) and at RUNTIME alike
108
- * (the rule's `varFields` record holds exactly this shape, read off the
109
- * schema value's frozen class map) — one shape, two tiers, one walk.
164
+ * shape every join judgment compares, at the TYPE level (a variable's mint
165
+ * slot, a binding position's slot) and at RUNTIME alike.
110
166
  */
111
167
  interface ClassedField {
112
168
  readonly field: AnyField;
113
169
  readonly class: string | undefined;
114
170
  }
115
171
  /**
116
- * A rule's typing environment: variable name the classed slot it first
117
- * bound. Purely a TYPE the runtime twin is the rule's `varFields`
118
- * record, and the two are built by the same walk.
172
+ * A variable's law-computed CLASS at the TYPE level: its column's class,
173
+ * read off the schema type's class map through the mint coordinate the
174
+ * variable carries (`RN.K`). `undefined` = bare.
175
+ */
176
+ type MintClassOf<Classes extends SchemaClasses, V> = V extends Var<AnyField, infer RN extends string, infer K extends string> ? ClassLookup<ClassRecordOf<Classes, RN>, K> : never;
177
+ /**
178
+ * A variable's MINT slot: the descriptor it was minted at plus its
179
+ * law-computed class. The one slot every binding position judges against —
180
+ * because {@link JoinOk} is an equality, judging each position against the
181
+ * mint slot makes every cross-binding join transitively class-equal.
119
182
  */
120
- type EnvShape = Record<string, ClassedField>;
183
+ type MintSlotOf<Classes extends SchemaClasses, V extends AnyVar> = {
184
+ readonly field: V["field"];
185
+ readonly class: MintClassOf<Classes, V>;
186
+ };
121
187
  /** A params object type — what `execute` takes and inference carries. */
122
188
  type ParamsRecord = Readonly<Record<string, unknown>>;
123
189
  /** Flattens an intersection into one displayed object type (hover legibility). */
@@ -139,7 +205,9 @@ type WidthOf<F extends AnyField> = F extends {
139
205
  type ElementOf<F extends AnyField> = F extends {
140
206
  readonly element: infer E;
141
207
  } ? E : undefined;
142
- /** Reads a closed reference's handle union; `undefined` on every non-closed kind (the roster IS descriptor structure). */
208
+ /**
209
+ * Reads a closed reference's handle union; `undefined` on every non-closed kind (the roster IS descriptor structure).
210
+ */
143
211
  type RosterOf<F extends AnyField> = F extends {
144
212
  readonly closed: {
145
213
  readonly handles: readonly (infer H extends string)[];
@@ -149,13 +217,10 @@ type RosterOf<F extends AnyField> = F extends {
149
217
  * The join judgment: two bound slots join iff their descriptors' structure
150
218
  * agrees (kind, width label, interval element, and the closed ROSTER — a
151
219
  * closed reference pairs only with the same vocabulary, never with a bare
152
- * u64: the roster keys every closed judgment downstream, so a join across
153
- * it would decode/order/translate incoherently by binding order) AND their
154
- * law-computed classes agree same class name joins, and bare
155
- * (`undefined`) pairs only with bare (ruling 3: a field in no law has no
156
- * class; a bare↔classed pairing refuses). The class names come off the
157
- * SCHEMA type's class map — the statements are the typing; no descriptor
158
- * label beyond the roster exists to compare.
220
+ * u64) AND their law-computed classes agree same class name joins, and
221
+ * bare (`undefined`) pairs only with bare (ruling 3). The class names come
222
+ * off the SCHEMA type's class map; no descriptor label beyond the roster
223
+ * exists to compare.
159
224
  */
160
225
  type JoinOk<A extends ClassedField, B extends ClassedField> = [
161
226
  A["field"]["kind"],
@@ -174,29 +239,23 @@ type JoinOk<A extends ClassedField, B extends ClassedField> = [
174
239
  * The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
175
240
  * structure and class agree — the same comparison the type tier makes,
176
241
  * judged on the honest runtime values (the descriptor, the roster by VALUE
177
- * IDENTITY vocabulary identity is value identity and the schema
178
- * value's frozen class map). The rule builders throw through this on a
179
- * class-unequal variable reuse, so the wall holds for untyped callers too,
180
- * not only where the compiler can see.
242
+ * IDENTITY, and the schema value's frozen class map). The rule builders
243
+ * throw through this on a class-unequal reuse, so the wall holds for untyped
244
+ * callers too.
181
245
  */
182
246
  declare function fieldJoins(a: ClassedField, b: ClassedField): boolean;
183
247
  /**
184
248
  * Renders one bound slot for join-mismatch diagnostics — the structural
185
249
  * kind in the schema grammar's spelling (a closed reference names its
186
- * vocabulary: the roster is part of the structure being compared) plus the
187
- * slot's law-computed class (`u64 in class Holder.id`; a lawless slot
188
- * renders `bare`).
250
+ * vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
251
+ * a lawless slot renders `bare`).
189
252
  */
190
253
  declare function renderFieldKind(slot: ClassedField): string;
191
254
  /**
192
255
  * What a PARAM anchored at field `F` accepts at execution: the field's
193
256
  * bare value type, exactly — at a CLOSED-reference field that is the
194
257
  * handle-name union (`"DirectPass" | "Failed"`), translated name → row id
195
- * at execute through the one roster-verification point
196
- * (`taggedHandleId`). At an interval field the engine resolves the
197
- * bivalent anchor to the INTERVAL reading (value equality) — the point
198
- * reading of a param is spelled `pointIn(r.param(...), w)`, whose sibling
199
- * anchors it element-typed.
258
+ * at execute through the one roster-verification point (`taggedHandleId`).
200
259
  */
201
260
  type ParamValueAt<F extends AnyField> = Infer<F>;
202
261
  /** Reads a value's inferred-types carrier (rules, queries, recs). */
@@ -207,13 +266,9 @@ type InferredOf<T> = T extends {
207
266
  * One registered parameter of a query, as the wire marshal reads it: the
208
267
  * name, the wire shape, the field descriptor (or the measure) that anchored
209
268
  * it, and the comparison op the anchor came from (`"binding"` for atom
210
- * positions) the op keeps literal tagging op-aware at `pointIn`
211
- * (the bug-hunt fix, preserved). `anchor` is `undefined` only on a query
212
- * built but not yet anchored by any rule; lowering and the wire both refuse
213
- * that state typed. `members` is present exactly on a MEMBERSHIP-ARRAY
214
- * entry (a literal set at a closed field, folded into the program): the
215
- * SDK itself translates and supplies the set at every execute — the entry
216
- * is never read from, and never demanded of, the host's params object.
269
+ * positions). `anchor` is `undefined` only on a query built but not yet
270
+ * anchored by any rule. `members` is present exactly on a MEMBERSHIP-ARRAY
271
+ * entry.
217
272
  */
218
273
  interface ParamEntry {
219
274
  readonly name: string;
@@ -222,6 +277,6 @@ interface ParamEntry {
222
277
  readonly op: "binding" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "pointIn" | "allen";
223
278
  readonly members: readonly string[] | undefined;
224
279
  }
225
- export type { AnyTerm, ClassedField, Duration, EnvShape, Flatten, InferredOf, JoinOk, MaskParam, Param, ParamEntry, ParamsRecord, ParamValueAt, SetParam, ShapeOf, UnionToIntersection, Var };
226
- export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, makeVar, renderFieldKind, term };
280
+ export type { AnyTerm, AnyVar, ClassedField, Duration, Flatten, InferredOf, JoinOk, MaskParam, MatchFields, MatchOwner, MintClassOf, MintSlotOf, Param, ParamEntry, ParamsRecord, ParamValueAt, SetParam, ShapeOf, UnionToIntersection, Var, VarsOf };
281
+ export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, renderFieldKind, term, v };
227
282
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGjD;;;;GAIG;AACH,QAAA,MAAM,IAAI,EAAE,OAAO,MAAsC,CAAA;AAEzD;;;;;GAKG;AACH,QAAA,MAAM,QAAQ,EAAE,OAAO,MAA0C,CAAA;AAEjE;;;;;;GAMG;AACH,UAAU,GAAG,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IACzC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACnB;AAED;;;;;GAKG;AACH,UAAU,KAAK,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IAC3C,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACnB;AAED;;;;;;GAMG;AACH,UAAU,QAAQ,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IAC9C,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,UAAU,CAAA;IAC3B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACnB;AAED;;;;;GAKG;AACH,UAAU,SAAS,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IAC/C,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE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AC,CAAC,SAAS,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,CAAA;AAEhD,qEAAqE;AACrE,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAA;AAEhG;;;;;;;GAOG;AACH,UAAU,UAAU;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;IACxC,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;IACjD,QAAQ,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAAA;IACtF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAC/C;AAED,YAAY,EACX,OAAO,EACP,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,MAAM,EACN,SAAS,EACT,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,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA"}
@@ -1,23 +1,36 @@
1
1
  /**
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.
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.
20
31
  */
32
+ import * as errors from "@superbuilders/errors";
33
+ import { sealedFieldsOf } from "#closed.ts";
21
34
  import { rosterOf } from "#fields.ts";
22
35
  /**
23
36
  * The runtime discriminant of query term values. Host literals (bigints,
@@ -36,10 +49,46 @@ const inferred = Symbol("bumbledb.query.inferred");
36
49
  function isTerm(value) {
37
50
  return typeof value === "object" && value !== null && term in value;
38
51
  }
39
- /** Builds one variable term. */
40
- function makeVar(name) {
41
- const value = { [term]: "var", name };
42
- return Object.freeze(value);
52
+ /**
53
+ * The trusted admission seam of the variable-record mint (the pattern's
54
+ * home is `isTypedScope` in `#query/lower.ts`): the checkable fact — one own
55
+ * enumerable variable per sealed column — is verified before the record is
56
+ * admitted at its computed {@link VarsOf} type.
57
+ */
58
+ function varsMinted(owner, record) {
59
+ return sealedFieldsOf(owner).every(function columnMinted(declared) {
60
+ return Object.hasOwn(record, declared.name);
61
+ });
62
+ }
63
+ /**
64
+ * Mints a FRESH batch of query variables over an atom owner's
65
+ * statically-known columns — one variable per sealed column
66
+ * (`sealedFieldsOf`: a closed owner mints `id` first, then payload columns),
67
+ * each frozen and each defined by OWN-property definition (object-protocol
68
+ * column names must work, the `closed()` precedent). Every `v()` call mints
69
+ * new objects, so two batches are two variables; property access within one
70
+ * batch is stable by construction (the record is an eager frozen record,
71
+ * never a Proxy). Variable identity is the object reference: destructure
72
+ * what you need (`const { id, holder } = v(Account)`) and reuse a value
73
+ * across binding positions to join.
74
+ */
75
+ function v(owner) {
76
+ const record = {};
77
+ for (const declared of sealedFieldsOf(owner)) {
78
+ const variable = Object.freeze({
79
+ [term]: "var",
80
+ owner,
81
+ column: declared.name,
82
+ field: declared.field,
83
+ label: `${owner.name}.${declared.name}`
84
+ });
85
+ Object.defineProperty(record, declared.name, { value: variable, enumerable: true });
86
+ }
87
+ Object.freeze(record);
88
+ if (!varsMinted(owner, record)) {
89
+ throw errors.new(`v(${owner.name}): variable-record minting incomplete`);
90
+ }
91
+ return record;
43
92
  }
44
93
  /** Builds one scalar-parameter term. */
45
94
  function makeParam(name) {
@@ -56,19 +105,18 @@ function makeMaskParam(name) {
56
105
  const value = { [term]: "maskParam", name };
57
106
  return Object.freeze(value);
58
107
  }
59
- /** Builds one measure term over an interval-typed variable's name. */
60
- function makeDuration(name) {
61
- const value = { [term]: "duration", name };
108
+ /** Builds one measure term over an interval-typed variable reference. */
109
+ function makeDuration(over) {
110
+ const value = { [term]: "duration", over };
62
111
  return Object.freeze(value);
63
112
  }
64
113
  /**
65
114
  * The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
66
115
  * structure and class agree — the same comparison the type tier makes,
67
116
  * judged on the honest runtime values (the descriptor, the roster by VALUE
68
- * IDENTITY vocabulary identity is value identity and the schema
69
- * value's frozen class map). The rule builders throw through this on a
70
- * class-unequal variable reuse, so the wall holds for untyped callers too,
71
- * not only where the compiler can see.
117
+ * IDENTITY, and the schema value's frozen class map). The rule builders
118
+ * throw through this on a class-unequal reuse, so the wall holds for untyped
119
+ * callers too.
72
120
  */
73
121
  function fieldJoins(a, b) {
74
122
  const widthA = "width" in a.field ? a.field.width : undefined;
@@ -86,9 +134,8 @@ function fieldJoins(a, b) {
86
134
  /**
87
135
  * Renders one bound slot for join-mismatch diagnostics — the structural
88
136
  * kind in the schema grammar's spelling (a closed reference names its
89
- * vocabulary: the roster is part of the structure being compared) plus the
90
- * slot's law-computed class (`u64 in class Holder.id`; a lawless slot
91
- * renders `bare`).
137
+ * vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
138
+ * a lawless slot renders `bare`).
92
139
  */
93
140
  function renderFieldKind(slot) {
94
141
  const field = slot.field;
@@ -105,5 +152,5 @@ function renderFieldKind(slot) {
105
152
  }
106
153
  return slot.class === undefined ? `${base} (bare)` : `${base} in class ${slot.class}`;
107
154
  }
108
- export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, makeVar, renderFieldKind, term };
155
+ export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, renderFieldKind, term, v };
109
156
  //# sourceMappingURL=scope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC;;;;GAIG;AACH,MAAM,IAAI,GAAkB,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,QAAQ,GAAkB,MAAM,CAAC,yBAAyB,CAAC,CAAA;AAgEjE,6EAA6E;AAC7E,SAAS,MAAM,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,CAAA;AACpE,CAAC;AAED,gCAAgC;AAChC,SAAS,OAAO,CAA4B,IAAU;IACrD,MAAM,KAAK,GAAc,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5B,CAAC;AAED,wCAAwC;AACxC,SAAS,SAAS,CAA4B,IAAU;IACvD,MAAM,KAAK,GAAgB,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IACpD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5B,CAAC;AAED,qCAAqC;AACrC,SAAS,YAAY,CAA4B,IAAU;IAC1D,MAAM,KAAK,GAAmB,EAAE,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;I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I,GAAG,SAAS,KAAK,CAAC,KAAK,GAAG,CAAA;IAC/B,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,IAAI,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,YAAY,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,KAAK,GAAG,CAAA;IAC/G,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,aAAa,IAAI,CAAC,KAAK,EAAE,CAAA;AACtF,CAAC;AAoDD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bjornpagen/bumbledb",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Type-theoretic TypeScript SDK for the bumbledb embedded relational engine",
5
5
  "type": "module",
6
6
  "exports": {
@@ -41,7 +41,7 @@
41
41
  "@superbuilders/errors": "^4.0.2"
42
42
  },
43
43
  "optionalDependencies": {
44
- "@bjornpagen/bumbledb-darwin-arm64": "0.5.0"
44
+ "@bjornpagen/bumbledb-darwin-arm64": "0.6.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@biomejs/biome": "^2.0.0-beta.5",
package/src/db.ts CHANGED
@@ -62,7 +62,7 @@ import type {
62
62
  ViolationFact as WireViolationFact
63
63
  } from "#native.ts"
64
64
  import { bridged, native } from "#native.ts"
65
- import type { SelectColumn } from "#query/atom.ts"
65
+ import type { FindColumn } from "#query/atom.ts"
66
66
  import type { Query } from "#query/lower.ts"
67
67
  import { lowerQuery } from "#query/lower.ts"
68
68
  import { decodeAnswers, wireParams } from "#query/run.ts"
@@ -643,7 +643,7 @@ interface PreparedPlan {
643
643
  readonly handle: PreparedHandle
644
644
  readonly owner: object
645
645
  readonly params: readonly ParamEntry[]
646
- readonly select: readonly SelectColumn[]
646
+ readonly finds: readonly FindColumn[]
647
647
  }
648
648
 
649
649
  /** The private engine halves of this module's prepared values. */
@@ -938,7 +938,7 @@ function openDb<Rels extends SchemaRelations>(handle: DbHandle, theory: Schema<R
938
938
  const rows = bridged("execute bumbledb prepared query", function callExecute() {
939
939
  return native.preparedExecute(plan.handle, state.handle, wire)
940
940
  })
941
- return decodeAnswers<Row>(plan.select, rows)
941
+ return decodeAnswers<Row>(plan.finds, rows)
942
942
  }
943
943
  const scope: ReadScope<Rels> = Object.freeze({
944
944
  generation,
@@ -1424,7 +1424,7 @@ function openDb<Rels extends SchemaRelations>(handle: DbHandle, theory: Schema<R
1424
1424
  handle: preparedHandle,
1425
1425
  owner,
1426
1426
  params: q.data.params,
1427
- select: q.data.select
1427
+ finds: q.data.finds
1428
1428
  })
1429
1429
  )
1430
1430
  planReclaimer.register(prepared, preparedHandle)
package/src/index.ts CHANGED
@@ -8,8 +8,10 @@
8
8
  * runtime (path-cached stores, transactions, typed violations, scoped
9
9
  * snapshot reads, the witnessed write loop with `abandon` — PRD-07, zero
10
10
  * closables), the query surface (Datalog as values, kysely-shaped:
11
- * `query(S).rule(r => r.match(...).where(...).select(...))` with
12
- * string-named domain-typed vars, params typed by use, negation,
11
+ * `query(S).rule(r => { const { id, name } = v(Holder); return r.match(Holder, { id, name }).find({ name }) })`
12
+ * variables minted by `v()` and joined by OBJECT REFERENCE (reuse is the
13
+ * join), the head a `find` RECORD whose keys name the answer columns
14
+ * (renames are real), params still STRING-named, plus negation,
13
15
  * conditions, aggregates, and stratified recursion via `program()`/`rec` —
14
16
  * `db.prepare` as a plain value; the comparison/connective builders are
15
17
  * also free exports, and the free names `eq`/`not`/`and`/`or` collide with
@@ -115,16 +117,15 @@ export type {
115
117
  AnyCond,
116
118
  BindingInput,
117
119
  Cmp,
118
- MatchFields,
119
- MatchOwner,
120
+ FindColumn,
120
121
  MatchShape,
121
122
  NotAtom,
122
123
  RecData,
123
124
  RuleData,
124
- SelectColumn,
125
125
  Tree
126
126
  } from "#query/atom.ts"
127
127
  export { ALLEN, allen, and, eq, ge, gt, le, lt, ne, not, or, pointIn } from "#query/atom.ts"
128
+ export type { Agg, FindEntry } from "#query/find.ts"
128
129
  export type {
129
130
  AnyQuery,
130
131
  AnyRuleValue,
@@ -151,13 +152,16 @@ export type {
151
152
  ClassedField,
152
153
  Duration,
153
154
  MaskParam,
155
+ MatchFields,
156
+ MatchOwner,
154
157
  Param,
155
158
  ParamEntry,
156
159
  ParamsRecord,
157
160
  SetParam,
158
- Var
161
+ Var,
162
+ VarsOf
159
163
  } from "#query/scope.ts"
160
- export type { Agg, SelectEntry } from "#query/select.ts"
164
+ export { v } from "#query/scope.ts"
161
165
  export type {
162
166
  AnyRelation,
163
167
  AnySelected,