@bjornpagen/bumbledb 0.4.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.
- package/COOKBOOK.md +191 -92
- package/README.md +9 -7
- package/dist/closed.d.ts +30 -2
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +66 -20
- package/dist/closed.js.map +1 -1
- package/dist/db.d.ts +33 -6
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +89 -72
- package/dist/db.js.map +1 -1
- package/dist/exhume.d.ts.map +1 -1
- package/dist/exhume.js +1 -14
- package/dist/exhume.js.map +1 -1
- package/dist/face.d.ts +1 -1
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +2 -1
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +18 -1
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +44 -16
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +18 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/law.d.ts +2 -1
- package/dist/law.d.ts.map +1 -1
- package/dist/law.js +15 -14
- package/dist/law.js.map +1 -1
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +1 -7
- package/dist/lower.js.map +1 -1
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +15 -27
- package/dist/marshal.js.map +1 -1
- package/dist/native.d.ts +21 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +20 -3
- package/dist/native.js.map +1 -1
- package/dist/order.d.ts +36 -0
- package/dist/order.d.ts.map +1 -0
- package/dist/order.js +135 -0
- package/dist/order.js.map +1 -0
- package/dist/query/atom.d.ts +140 -206
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +33 -52
- package/dist/query/atom.js.map +1 -1
- package/dist/query/find.d.ts +116 -0
- package/dist/query/find.d.ts.map +1 -0
- package/dist/query/{select.js → find.js} +22 -22
- package/dist/query/find.js.map +1 -0
- package/dist/query/lower.d.ts +124 -162
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +462 -507
- package/dist/query/lower.js.map +1 -1
- package/dist/query/predicate.d.ts +22 -14
- package/dist/query/predicate.d.ts.map +1 -1
- package/dist/query/predicate.js +45 -20
- package/dist/query/predicate.js.map +1 -1
- package/dist/query/run.d.ts +3 -3
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +10 -11
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +124 -83
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +77 -70
- package/dist/query/scope.js.map +1 -1
- package/dist/relation.d.ts +9 -22
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +9 -28
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +7 -31
- package/dist/schema.js.map +1 -1
- package/dist/statements.d.ts +5 -2
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +30 -35
- package/dist/statements.js.map +1 -1
- package/package.json +2 -5
- package/src/closed.ts +73 -28
- package/src/db.ts +126 -88
- package/src/exhume.ts +1 -15
- package/src/face.ts +4 -3
- package/src/fields.ts +58 -16
- package/src/index.ts +19 -13
- package/src/law.ts +15 -14
- package/src/lower.ts +2 -9
- package/src/marshal.ts +15 -31
- package/src/native.ts +22 -4
- package/src/order.ts +156 -0
- package/src/query/atom.ts +186 -276
- package/src/query/find.ts +212 -0
- package/src/query/lower.ts +614 -749
- package/src/query/predicate.ts +47 -20
- package/src/query/run.ts +11 -13
- package/src/query/scope.ts +165 -132
- package/src/relation.ts +9 -51
- package/src/schema.ts +7 -33
- package/src/statements.ts +33 -38
- package/dist/query/select.d.ts +0 -128
- package/dist/query/select.d.ts.map +0 -1
- package/dist/query/select.js.map +0 -1
- package/src/query/select.ts +0 -215
package/dist/query/scope.d.ts
CHANGED
|
@@ -1,24 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Query scope terms,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
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
|
-
|
|
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
|
|
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,61 +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
|
-
*
|
|
81
|
-
* is unwritable, exactly as the IR rejects it typed.
|
|
82
|
-
*
|
|
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<
|
|
125
|
+
interface Duration<V extends AnyVar = AnyVar> {
|
|
86
126
|
readonly [term]: "duration";
|
|
87
|
-
readonly
|
|
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
|
-
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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>;
|
|
98
139
|
};
|
|
99
140
|
/**
|
|
100
|
-
* Mints
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
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.
|
|
107
151
|
*/
|
|
108
|
-
declare function
|
|
152
|
+
declare function v<R extends MatchOwner>(owner: R): VarsOf<R>;
|
|
109
153
|
/** Builds one scalar-parameter term. */
|
|
110
154
|
declare function makeParam<const Name extends string>(name: Name): Param<Name>;
|
|
111
155
|
/** Builds one set-parameter term. */
|
|
112
156
|
declare function makeSetParam<const Name extends string>(name: Name): SetParam<Name>;
|
|
113
157
|
/** Builds one Allen-mask-parameter term. */
|
|
114
158
|
declare function makeMaskParam<const Name extends string>(name: Name): MaskParam<Name>;
|
|
115
|
-
/** Builds one measure term over an interval-typed variable
|
|
116
|
-
declare function makeDuration<const
|
|
159
|
+
/** Builds one measure term over an interval-typed variable reference. */
|
|
160
|
+
declare function makeDuration<const V extends AnyVar>(over: V): Duration<V>;
|
|
117
161
|
/**
|
|
118
162
|
* One bound field slot: the field's descriptor plus the slot's
|
|
119
163
|
* law-computed CLASS (`undefined` = bare — the slot is in no law). The one
|
|
120
|
-
* shape
|
|
121
|
-
*
|
|
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.
|
|
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.
|
|
124
166
|
*/
|
|
125
167
|
interface ClassedField {
|
|
126
168
|
readonly field: AnyField;
|
|
127
169
|
readonly class: string | undefined;
|
|
128
170
|
}
|
|
129
171
|
/**
|
|
130
|
-
* A
|
|
131
|
-
*
|
|
132
|
-
*
|
|
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.
|
|
133
182
|
*/
|
|
134
|
-
type
|
|
183
|
+
type MintSlotOf<Classes extends SchemaClasses, V extends AnyVar> = {
|
|
184
|
+
readonly field: V["field"];
|
|
185
|
+
readonly class: MintClassOf<Classes, V>;
|
|
186
|
+
};
|
|
135
187
|
/** A params object type — what `execute` takes and inference carries. */
|
|
136
188
|
type ParamsRecord = Readonly<Record<string, unknown>>;
|
|
137
189
|
/** Flattens an intersection into one displayed object type (hover legibility). */
|
|
@@ -153,7 +205,9 @@ type WidthOf<F extends AnyField> = F extends {
|
|
|
153
205
|
type ElementOf<F extends AnyField> = F extends {
|
|
154
206
|
readonly element: infer E;
|
|
155
207
|
} ? E : undefined;
|
|
156
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* Reads a closed reference's handle union; `undefined` on every non-closed kind (the roster IS descriptor structure).
|
|
210
|
+
*/
|
|
157
211
|
type RosterOf<F extends AnyField> = F extends {
|
|
158
212
|
readonly closed: {
|
|
159
213
|
readonly handles: readonly (infer H extends string)[];
|
|
@@ -163,13 +217,10 @@ type RosterOf<F extends AnyField> = F extends {
|
|
|
163
217
|
* The join judgment: two bound slots join iff their descriptors' structure
|
|
164
218
|
* agrees (kind, width label, interval element, and the closed ROSTER — a
|
|
165
219
|
* closed reference pairs only with the same vocabulary, never with a bare
|
|
166
|
-
* u64
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* class; a bare↔classed pairing refuses). The class names come off the
|
|
171
|
-
* SCHEMA type's class map — the statements are the typing; no descriptor
|
|
172
|
-
* 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.
|
|
173
224
|
*/
|
|
174
225
|
type JoinOk<A extends ClassedField, B extends ClassedField> = [
|
|
175
226
|
A["field"]["kind"],
|
|
@@ -188,29 +239,23 @@ type JoinOk<A extends ClassedField, B extends ClassedField> = [
|
|
|
188
239
|
* The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
|
|
189
240
|
* structure and class agree — the same comparison the type tier makes,
|
|
190
241
|
* judged on the honest runtime values (the descriptor, the roster by VALUE
|
|
191
|
-
* IDENTITY
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* 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.
|
|
195
245
|
*/
|
|
196
246
|
declare function fieldJoins(a: ClassedField, b: ClassedField): boolean;
|
|
197
247
|
/**
|
|
198
248
|
* Renders one bound slot for join-mismatch diagnostics — the structural
|
|
199
249
|
* kind in the schema grammar's spelling (a closed reference names its
|
|
200
|
-
* vocabulary
|
|
201
|
-
* slot
|
|
202
|
-
* renders `bare`).
|
|
250
|
+
* vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
|
|
251
|
+
* a lawless slot renders `bare`).
|
|
203
252
|
*/
|
|
204
253
|
declare function renderFieldKind(slot: ClassedField): string;
|
|
205
254
|
/**
|
|
206
255
|
* What a PARAM anchored at field `F` accepts at execution: the field's
|
|
207
256
|
* bare value type, exactly — at a CLOSED-reference field that is the
|
|
208
257
|
* handle-name union (`"DirectPass" | "Failed"`), translated name → row id
|
|
209
|
-
* at execute through the one roster-verification point
|
|
210
|
-
* (`taggedHandleId`). At an interval field the engine resolves the
|
|
211
|
-
* bivalent anchor to the INTERVAL reading (value equality) — the point
|
|
212
|
-
* reading of a param is spelled `pointIn(r.param(...), w)`, whose sibling
|
|
213
|
-
* anchors it element-typed.
|
|
258
|
+
* at execute through the one roster-verification point (`taggedHandleId`).
|
|
214
259
|
*/
|
|
215
260
|
type ParamValueAt<F extends AnyField> = Infer<F>;
|
|
216
261
|
/** Reads a value's inferred-types carrier (rules, queries, recs). */
|
|
@@ -221,13 +266,9 @@ type InferredOf<T> = T extends {
|
|
|
221
266
|
* One registered parameter of a query, as the wire marshal reads it: the
|
|
222
267
|
* name, the wire shape, the field descriptor (or the measure) that anchored
|
|
223
268
|
* it, and the comparison op the anchor came from (`"binding"` for atom
|
|
224
|
-
* positions)
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
* that state typed. `members` is present exactly on a MEMBERSHIP-ARRAY
|
|
228
|
-
* entry (a literal set at a closed field, folded into the program): the
|
|
229
|
-
* SDK itself translates and supplies the set at every execute — the entry
|
|
230
|
-
* 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.
|
|
231
272
|
*/
|
|
232
273
|
interface ParamEntry {
|
|
233
274
|
readonly name: string;
|
|
@@ -236,6 +277,6 @@ interface ParamEntry {
|
|
|
236
277
|
readonly op: "binding" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "pointIn" | "allen";
|
|
237
278
|
readonly members: readonly string[] | undefined;
|
|
238
279
|
}
|
|
239
|
-
export type { AnyTerm, ClassedField, Duration,
|
|
240
|
-
export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam,
|
|
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 };
|
|
241
282
|
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA;;;;;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|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
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
|
*/
|
|
21
32
|
import * as errors from "@superbuilders/errors";
|
|
33
|
+
import { sealedFieldsOf } from "#closed.ts";
|
|
34
|
+
import { rosterOf } from "#fields.ts";
|
|
22
35
|
/**
|
|
23
36
|
* The runtime discriminant of query term values. Host literals (bigints,
|
|
24
37
|
* strings, interval objects) never carry it, so "is this position a term
|
|
@@ -36,51 +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);
|
|
43
|
-
}
|
|
44
52
|
/**
|
|
45
|
-
* The trusted seam of the
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* this check).
|
|
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.
|
|
50
57
|
*/
|
|
51
|
-
function varsMinted(
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
const value = record[name];
|
|
57
|
-
return isTerm(value) && value[term] === "var" && value.name === name;
|
|
58
|
+
function varsMinted(owner, record) {
|
|
59
|
+
return sealedFieldsOf(owner).every(function columnMinted(declared) {
|
|
60
|
+
return Object.hasOwn(record, declared.name);
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
/**
|
|
61
|
-
* Mints
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
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.
|
|
68
74
|
*/
|
|
69
|
-
function
|
|
70
|
-
const
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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 });
|
|
78
86
|
}
|
|
79
|
-
Object.freeze(
|
|
80
|
-
if (!varsMinted(
|
|
81
|
-
throw errors.new(
|
|
87
|
+
Object.freeze(record);
|
|
88
|
+
if (!varsMinted(owner, record)) {
|
|
89
|
+
throw errors.new(`v(${owner.name}): variable-record minting incomplete`);
|
|
82
90
|
}
|
|
83
|
-
return
|
|
91
|
+
return record;
|
|
84
92
|
}
|
|
85
93
|
/** Builds one scalar-parameter term. */
|
|
86
94
|
function makeParam(name) {
|
|
@@ -97,27 +105,26 @@ function makeMaskParam(name) {
|
|
|
97
105
|
const value = { [term]: "maskParam", name };
|
|
98
106
|
return Object.freeze(value);
|
|
99
107
|
}
|
|
100
|
-
/** Builds one measure term over an interval-typed variable
|
|
101
|
-
function makeDuration(
|
|
102
|
-
const value = { [term]: "duration",
|
|
108
|
+
/** Builds one measure term over an interval-typed variable reference. */
|
|
109
|
+
function makeDuration(over) {
|
|
110
|
+
const value = { [term]: "duration", over };
|
|
103
111
|
return Object.freeze(value);
|
|
104
112
|
}
|
|
105
113
|
/**
|
|
106
114
|
* The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
|
|
107
115
|
* structure and class agree — the same comparison the type tier makes,
|
|
108
116
|
* judged on the honest runtime values (the descriptor, the roster by VALUE
|
|
109
|
-
* IDENTITY
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* 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.
|
|
113
120
|
*/
|
|
114
121
|
function fieldJoins(a, b) {
|
|
115
122
|
const widthA = "width" in a.field ? a.field.width : undefined;
|
|
116
123
|
const widthB = "width" in b.field ? b.field.width : undefined;
|
|
117
124
|
const elementA = "element" in a.field ? a.field.element : undefined;
|
|
118
125
|
const elementB = "element" in b.field ? b.field.element : undefined;
|
|
119
|
-
const rosterA =
|
|
120
|
-
const rosterB =
|
|
126
|
+
const rosterA = rosterOf(a.field);
|
|
127
|
+
const rosterB = rosterOf(b.field);
|
|
121
128
|
return (a.field.kind === b.field.kind &&
|
|
122
129
|
a.class === b.class &&
|
|
123
130
|
widthA === widthB &&
|
|
@@ -127,15 +134,15 @@ function fieldJoins(a, b) {
|
|
|
127
134
|
/**
|
|
128
135
|
* Renders one bound slot for join-mismatch diagnostics — the structural
|
|
129
136
|
* kind in the schema grammar's spelling (a closed reference names its
|
|
130
|
-
* vocabulary
|
|
131
|
-
* slot
|
|
132
|
-
* renders `bare`).
|
|
137
|
+
* vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
|
|
138
|
+
* a lawless slot renders `bare`).
|
|
133
139
|
*/
|
|
134
140
|
function renderFieldKind(slot) {
|
|
135
141
|
const field = slot.field;
|
|
136
142
|
let base = field.kind;
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
const roster = rosterOf(field);
|
|
144
|
+
if (roster !== undefined) {
|
|
145
|
+
base = `u64 referencing ${roster.name}`;
|
|
139
146
|
}
|
|
140
147
|
if (field.kind === "bytes") {
|
|
141
148
|
base = `bytes<${field.width}>`;
|
|
@@ -145,5 +152,5 @@ function renderFieldKind(slot) {
|
|
|
145
152
|
}
|
|
146
153
|
return slot.class === undefined ? `${base} (bare)` : `${base} in class ${slot.class}`;
|
|
147
154
|
}
|
|
148
|
-
export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam,
|
|
155
|
+
export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, renderFieldKind, term, v };
|
|
149
156
|
//# sourceMappingURL=scope.js.map
|
package/dist/query/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/query/scope.ts"],"names":[],"mappings":"AAAA
|
|
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;AAIrC;;;;GAIG;AACH,MAAM,IAAI,GAAkB,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,QAAQ,GAAkB,MAAM,CAAC,yBAAyB,CAAC,CAAA;AA6FjE,6EAA6E;AAC7E,SAAS,MAAM,CAAC,KAAc;IAC7B,OAAO,OAA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