@bjornpagen/bumbledb 0.5.0 → 0.7.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 +140 -136
- package/README.md +24 -11
- package/dist/closed.d.ts +7 -5
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +4 -1
- package/dist/closed.js.map +1 -1
- package/dist/count.js +1 -1
- package/dist/count.js.map +1 -1
- package/dist/db.d.ts +110 -73
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +172 -116
- package/dist/db.js.map +1 -1
- package/dist/exhume.d.ts +22 -10
- package/dist/exhume.d.ts.map +1 -1
- package/dist/exhume.js +42 -9
- package/dist/exhume.js.map +1 -1
- package/dist/face.d.ts +10 -6
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +38 -16
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +33 -8
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/lower.d.ts +9 -9
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +17 -12
- package/dist/lower.js.map +1 -1
- package/dist/marshal.d.ts +17 -7
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +32 -10
- package/dist/marshal.js.map +1 -1
- package/dist/native.d.ts +60 -9
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js.map +1 -1
- package/dist/query/atom.d.ts +199 -203
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +39 -48
- 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 +131 -158
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +505 -494
- 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 +35 -42
- package/dist/query/predicate.js.map +1 -1
- package/dist/query/run.d.ts +8 -8
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +16 -21
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +139 -74
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +80 -33
- package/dist/query/scope.js.map +1 -1
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +3 -1
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +12 -2
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +20 -10
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +22 -2
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +26 -5
- package/dist/statements.js.map +1 -1
- package/package.json +3 -3
- package/src/closed.ts +13 -7
- package/src/count.ts +1 -1
- package/src/db.ts +293 -177
- package/src/exhume.ts +48 -11
- package/src/face.ts +13 -6
- package/src/fields.ts +51 -15
- package/src/index.ts +12 -8
- package/src/lower.ts +17 -12
- package/src/marshal.ts +38 -13
- package/src/native.ts +59 -8
- package/src/query/atom.ts +297 -275
- package/src/query/find.ts +212 -0
- package/src/query/lower.ts +692 -724
- package/src/query/predicate.ts +37 -45
- package/src/query/run.ts +17 -22
- package/src/query/scope.ts +184 -90
- package/src/relation.ts +3 -1
- package/src/schema.ts +14 -2
- package/src/spec.ts +21 -9
- package/src/statements.ts +30 -6
- 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,39 @@
|
|
|
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 { QueryParam } from "#native.ts";
|
|
36
|
+
import type { AnyRelation, RelationFields } from "#relation.ts";
|
|
22
37
|
/**
|
|
23
38
|
* The runtime discriminant of query term values. Host literals (bigints,
|
|
24
39
|
* strings, interval objects) never carry it, so "is this position a term
|
|
@@ -33,16 +48,43 @@ declare const term: unique symbol;
|
|
|
33
48
|
*/
|
|
34
49
|
declare const inferred: unique symbol;
|
|
35
50
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
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).
|
|
41
56
|
*/
|
|
42
|
-
|
|
57
|
+
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
|
+
type MatchFields<R extends MatchOwner> = R extends AnyClosed ? {
|
|
66
|
+
readonly id: R["id"];
|
|
67
|
+
} & 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
|
+
interface Var<F extends AnyField = AnyField, RN extends string = string, K extends string = string> {
|
|
43
78
|
readonly [term]: "var";
|
|
44
|
-
readonly
|
|
79
|
+
readonly owner: MatchOwner & {
|
|
80
|
+
readonly name: RN;
|
|
81
|
+
};
|
|
82
|
+
readonly column: K;
|
|
83
|
+
readonly field: F;
|
|
84
|
+
readonly label: string;
|
|
45
85
|
}
|
|
86
|
+
/** Any query variable, whatever its descriptor and mint coordinate. */
|
|
87
|
+
type AnyVar = Var;
|
|
46
88
|
/**
|
|
47
89
|
* A scalar query parameter — `r.param("root")`. The name is the key of the
|
|
48
90
|
* typed params object `execute` takes; the type is the element type of the
|
|
@@ -77,47 +119,72 @@ interface MaskParam<Name extends string = string> {
|
|
|
77
119
|
/**
|
|
78
120
|
* The measure of an interval-typed variable (`ir::Term::Measure`):
|
|
79
121
|
* `|[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).
|
|
122
|
+
* find entry, and as the input of `sum`/`min`/`max`; every other position
|
|
123
|
+
* is unwritable, exactly as the IR rejects it typed. Carries the interval
|
|
124
|
+
* variable it measures BY REFERENCE.
|
|
84
125
|
*/
|
|
85
|
-
interface Duration<
|
|
126
|
+
interface Duration<V extends AnyVar = AnyVar> {
|
|
86
127
|
readonly [term]: "duration";
|
|
87
|
-
readonly
|
|
128
|
+
readonly over: V;
|
|
88
129
|
}
|
|
89
130
|
/** Any scope term value. */
|
|
90
131
|
type AnyTerm = Var | Param | SetParam | MaskParam | Duration;
|
|
91
132
|
/** Narrows an unknown position value to a scope term (vs a host literal). */
|
|
92
133
|
declare function isTerm(value: unknown): value is AnyTerm;
|
|
93
|
-
/**
|
|
94
|
-
|
|
134
|
+
/**
|
|
135
|
+
* The record of fresh variables `v(owner)` mints — one per statically-known
|
|
136
|
+
* column, each typed by its column's descriptor and mint coordinate.
|
|
137
|
+
*/
|
|
138
|
+
type VarsOf<R extends MatchOwner> = {
|
|
139
|
+
readonly [K in keyof MatchFields<R> & string]: Var<MatchFields<R>[K], R["name"], K>;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Mints a FRESH batch of query variables over an atom owner's
|
|
143
|
+
* statically-known columns — one variable per sealed column
|
|
144
|
+
* (`sealedFieldsOf`: a closed owner mints `id` first, then payload columns),
|
|
145
|
+
* each frozen and each defined by OWN-property definition (object-protocol
|
|
146
|
+
* column names must work, the `closed()` precedent). Every `v()` call mints
|
|
147
|
+
* new objects, so two batches are two variables; property access within one
|
|
148
|
+
* batch is stable by construction (the record is an eager frozen record,
|
|
149
|
+
* never a Proxy). Variable identity is the object reference: destructure
|
|
150
|
+
* what you need (`const { id, holder } = v(Account)`) and reuse a value
|
|
151
|
+
* across binding positions to join.
|
|
152
|
+
*/
|
|
153
|
+
declare function v<R extends MatchOwner>(owner: R): VarsOf<R>;
|
|
95
154
|
/** Builds one scalar-parameter term. */
|
|
96
155
|
declare function makeParam<const Name extends string>(name: Name): Param<Name>;
|
|
97
156
|
/** Builds one set-parameter term. */
|
|
98
157
|
declare function makeSetParam<const Name extends string>(name: Name): SetParam<Name>;
|
|
99
158
|
/** Builds one Allen-mask-parameter term. */
|
|
100
159
|
declare function makeMaskParam<const Name extends string>(name: Name): MaskParam<Name>;
|
|
101
|
-
/** Builds one measure term over an interval-typed variable
|
|
102
|
-
declare function makeDuration<const
|
|
160
|
+
/** Builds one measure term over an interval-typed variable reference. */
|
|
161
|
+
declare function makeDuration<const V extends AnyVar>(over: V): Duration<V>;
|
|
103
162
|
/**
|
|
104
163
|
* One bound field slot: the field's descriptor plus the slot's
|
|
105
164
|
* law-computed CLASS (`undefined` = bare — the slot is in no law). The one
|
|
106
|
-
* shape
|
|
107
|
-
*
|
|
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.
|
|
165
|
+
* shape every join judgment compares, at the TYPE level (a variable's mint
|
|
166
|
+
* slot, a binding position's slot) and at RUNTIME alike.
|
|
110
167
|
*/
|
|
111
168
|
interface ClassedField {
|
|
112
169
|
readonly field: AnyField;
|
|
113
170
|
readonly class: string | undefined;
|
|
114
171
|
}
|
|
115
172
|
/**
|
|
116
|
-
* A
|
|
117
|
-
*
|
|
118
|
-
*
|
|
173
|
+
* A variable's law-computed CLASS at the TYPE level: its column's class,
|
|
174
|
+
* read off the schema type's class map through the mint coordinate the
|
|
175
|
+
* variable carries (`RN.K`). `undefined` = bare.
|
|
176
|
+
*/
|
|
177
|
+
type MintClassOf<Classes extends SchemaClasses, V> = V extends Var<AnyField, infer RN extends string, infer K extends string> ? ClassLookup<ClassRecordOf<Classes, RN>, K> : never;
|
|
178
|
+
/**
|
|
179
|
+
* A variable's MINT slot: the descriptor it was minted at plus its
|
|
180
|
+
* law-computed class. The one slot every binding position judges against —
|
|
181
|
+
* because {@link JoinOk} is an equality, judging each position against the
|
|
182
|
+
* mint slot makes every cross-binding join transitively class-equal.
|
|
119
183
|
*/
|
|
120
|
-
type
|
|
184
|
+
type MintSlotOf<Classes extends SchemaClasses, V extends AnyVar> = {
|
|
185
|
+
readonly field: V["field"];
|
|
186
|
+
readonly class: MintClassOf<Classes, V>;
|
|
187
|
+
};
|
|
121
188
|
/** A params object type — what `execute` takes and inference carries. */
|
|
122
189
|
type ParamsRecord = Readonly<Record<string, unknown>>;
|
|
123
190
|
/** Flattens an intersection into one displayed object type (hover legibility). */
|
|
@@ -139,23 +206,28 @@ type WidthOf<F extends AnyField> = F extends {
|
|
|
139
206
|
type ElementOf<F extends AnyField> = F extends {
|
|
140
207
|
readonly element: infer E;
|
|
141
208
|
} ? E : undefined;
|
|
142
|
-
/**
|
|
209
|
+
/**
|
|
210
|
+
* Reads a closed reference's vocabulary name literal paired with its handle
|
|
211
|
+
* union; `undefined` on every non-closed kind (the roster IS descriptor
|
|
212
|
+
* structure). The name literal is the type-tier encoding of the runtime's
|
|
213
|
+
* roster VALUE-IDENTITY judgment ({@link fieldJoins}): two same-shaped
|
|
214
|
+
* vocabularies are distinct rosters, so they mismatch here exactly as they
|
|
215
|
+
* refuse at runtime.
|
|
216
|
+
*/
|
|
143
217
|
type RosterOf<F extends AnyField> = F extends {
|
|
144
218
|
readonly closed: {
|
|
219
|
+
readonly name: infer N extends string;
|
|
145
220
|
readonly handles: readonly (infer H extends string)[];
|
|
146
221
|
};
|
|
147
|
-
} ? H : undefined;
|
|
222
|
+
} ? readonly [N, H] : undefined;
|
|
148
223
|
/**
|
|
149
224
|
* The join judgment: two bound slots join iff their descriptors' structure
|
|
150
225
|
* agrees (kind, width label, interval element, and the closed ROSTER — a
|
|
151
226
|
* closed reference pairs only with the same vocabulary, never with a bare
|
|
152
|
-
* u64
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
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.
|
|
227
|
+
* u64) AND their law-computed classes agree — same class name joins, and
|
|
228
|
+
* bare (`undefined`) pairs only with bare (ruling 3). The class names come
|
|
229
|
+
* off the SCHEMA type's class map; no descriptor label beyond the roster
|
|
230
|
+
* exists to compare.
|
|
159
231
|
*/
|
|
160
232
|
type JoinOk<A extends ClassedField, B extends ClassedField> = [
|
|
161
233
|
A["field"]["kind"],
|
|
@@ -174,29 +246,23 @@ type JoinOk<A extends ClassedField, B extends ClassedField> = [
|
|
|
174
246
|
* The runtime twin of {@link JoinOk}: two bound slots join iff descriptor
|
|
175
247
|
* structure and class agree — the same comparison the type tier makes,
|
|
176
248
|
* judged on the honest runtime values (the descriptor, the roster by VALUE
|
|
177
|
-
* IDENTITY
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* not only where the compiler can see.
|
|
249
|
+
* IDENTITY, and the schema value's frozen class map). The rule builders
|
|
250
|
+
* throw through this on a class-unequal reuse, so the wall holds for untyped
|
|
251
|
+
* callers too.
|
|
181
252
|
*/
|
|
182
253
|
declare function fieldJoins(a: ClassedField, b: ClassedField): boolean;
|
|
183
254
|
/**
|
|
184
255
|
* Renders one bound slot for join-mismatch diagnostics — the structural
|
|
185
256
|
* kind in the schema grammar's spelling (a closed reference names its
|
|
186
|
-
* vocabulary
|
|
187
|
-
* slot
|
|
188
|
-
* renders `bare`).
|
|
257
|
+
* vocabulary) plus the slot's law-computed class (`u64 in class Holder.id`;
|
|
258
|
+
* a lawless slot renders `bare`).
|
|
189
259
|
*/
|
|
190
260
|
declare function renderFieldKind(slot: ClassedField): string;
|
|
191
261
|
/**
|
|
192
262
|
* What a PARAM anchored at field `F` accepts at execution: the field's
|
|
193
263
|
* bare value type, exactly — at a CLOSED-reference field that is the
|
|
194
264
|
* 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.
|
|
265
|
+
* at execute through the one roster-verification point (`taggedHandleId`).
|
|
200
266
|
*/
|
|
201
267
|
type ParamValueAt<F extends AnyField> = Infer<F>;
|
|
202
268
|
/** Reads a value's inferred-types carrier (rules, queries, recs). */
|
|
@@ -207,21 +273,20 @@ type InferredOf<T> = T extends {
|
|
|
207
273
|
* One registered parameter of a query, as the wire marshal reads it: the
|
|
208
274
|
* name, the wire shape, the field descriptor (or the measure) that anchored
|
|
209
275
|
* it, and the comparison op the anchor came from (`"binding"` for atom
|
|
210
|
-
* positions)
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* is never read from, and never demanded of, the host's params object.
|
|
276
|
+
* positions). `anchor` is `undefined` only on a query built but not yet
|
|
277
|
+
* anchored by any rule. `membership` is present exactly on a
|
|
278
|
+
* MEMBERSHIP-ARRAY entry: the FROZEN wire param, already resolved through
|
|
279
|
+
* the one roster-verification point at BUILD time (the entry stores the
|
|
280
|
+
* image, never the pre-image — no per-execute re-translation exists, and an
|
|
281
|
+
* out-of-roster handle name fails where the mistake was made).
|
|
217
282
|
*/
|
|
218
283
|
interface ParamEntry {
|
|
219
284
|
readonly name: string;
|
|
220
285
|
readonly shape: "value" | "set" | "mask";
|
|
221
286
|
readonly anchor: AnyField | "measure" | undefined;
|
|
222
287
|
readonly op: "binding" | "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "pointIn" | "allen";
|
|
223
|
-
readonly
|
|
288
|
+
readonly membership: QueryParam | undefined;
|
|
224
289
|
}
|
|
225
|
-
export type { AnyTerm, ClassedField, Duration,
|
|
226
|
-
export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam,
|
|
290
|
+
export type { AnyTerm, AnyVar, ClassedField, Duration, Flatten, InferredOf, JoinOk, MaskParam, MatchFields, MatchOwner, MintClassOf, MintSlotOf, Param, ParamEntry, ParamsRecord, ParamValueAt, SetParam, ShapeOf, UnionToIntersection, Var, VarsOf };
|
|
291
|
+
export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, renderFieldKind, term, v };
|
|
227
292
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAC,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,KAAK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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"}
|
package/dist/query/scope.js
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
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 * 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
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
60
|
-
function makeDuration(
|
|
61
|
-
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 };
|
|
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
|
|
69
|
-
*
|
|
70
|
-
*
|
|
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
|
|
90
|
-
* 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,
|
|
155
|
+
export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, renderFieldKind, term, v };
|
|
109
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;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AS,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;AAuDD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA"}
|
package/dist/relation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,KAAK,QAAQ,EAAsD,KAAK,KAAK,EAAa,MAAM,YAAY,CAAA;AACrH,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,UAAU,CAAA;AAE/E,kFAAkF;AAClF,KAAK,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AA4C1C;;;;;;;;GAQG;AACH,iBAAS,gBAAgB,CACxB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,aAAa,EAAE,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;GASG;AACH,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,UAAU,EACV,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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (resupply-to-preserve-identity), typed exactly.
|
|
14
14
|
*/
|
|
15
15
|
import * as errors from "@superbuilders/errors";
|
|
16
|
-
import { assertDeclarationOrderKey, literalOf } from "#fields.ts";
|
|
16
|
+
import { assertDeclarationOrderKey, assertDeclarationRecord, literalOf } from "#fields.ts";
|
|
17
17
|
import { renderLiteral } from "#spec.ts";
|
|
18
18
|
/**
|
|
19
19
|
* Resolves one selection entry to its lowered literal set: a plain ARRAY
|
|
@@ -91,6 +91,8 @@ function resolveSelection(name, ordered, entries) {
|
|
|
91
91
|
* on. The returned value is frozen and side-effect free.
|
|
92
92
|
*/
|
|
93
93
|
function relation(name, fields) {
|
|
94
|
+
assertDeclarationOrderKey("relation", name);
|
|
95
|
+
assertDeclarationRecord(`relation ${name} fields`, fields);
|
|
94
96
|
const ordered = [];
|
|
95
97
|
for (const [fieldName, field] of Object.entries(fields)) {
|
|
96
98
|
assertDeclarationOrderKey(`relation ${name} field`, fieldName);
|
package/dist/relation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,MAAM,MAAM,u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AK,EAAE,CAAC,CAAA;IAC1E,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,OAAO,KAAK,CAAA;AACb,CAAC;AAiBD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAmC,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AACpH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAI3C,OAAO,EAAE,KAAK,SAAS,EAAmC,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AACpH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAwM7E,gDAAgD;AAChD,KAAK,cAAc,GAAG,WAAW,GAAG,SAAS,CAAA;AAE7C,mFAAmF;AACnF,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAErD;;;;;;;;;GASG;AACH,UAAU,MAAM,CAAC,IAAI,SAAS,eAAe,EAAE,OAAO,SAAS,aAAa,GAAG,aAAa;IAC3F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAA;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CACzB;AAED,sDAAsD;AACtD,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;AAExC;;;;;;;;;;;;GAYG;AACH,KAAK,gBAAgB,CAAC,CAAC,SAAS,aAAa,IAAI,CAAC,SAAS,aAAa,GACrE;IAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG;QAAE,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE;CAAE,GACpE,KAAK,CAAA;AAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iBAAS,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,eAAe,EAAE,KAAK,CAAC,KAAK,SAAS,SAAS,SAAS,EAAE,EAC3F,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,KAAK,GAAG,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,GAC/C,MAAM,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAkCxD;AAED,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as errors from "@superbuilders/errors";
|
|
12
12
|
import { isClosedMember, sealedFieldOf } from "#closed.ts";
|
|
13
|
-
import { assertDeclarationOrderKey, rosterOf } from "#fields.ts";
|
|
13
|
+
import { assertDeclarationOrderKey, assertDeclarationRecord, rosterOf } from "#fields.ts";
|
|
14
14
|
import { classesComplete, computeClasses } from "#law.ts";
|
|
15
|
-
import { renderStatement } from "#statements.ts";
|
|
15
|
+
import { isStatement, renderStatement } from "#statements.ts";
|
|
16
16
|
/**
|
|
17
17
|
* Validates the relation record and collects the implied keys: the
|
|
18
18
|
* fresh-implied `R(field) -> R` per minted field and the closed auto-key
|
|
@@ -21,6 +21,7 @@ import { renderStatement } from "#statements.ts";
|
|
|
21
21
|
* single spelling authority.
|
|
22
22
|
*/
|
|
23
23
|
function collectImplied(name, relations) {
|
|
24
|
+
assertDeclarationRecord(`schema ${name} relations`, relations);
|
|
24
25
|
const implied = new Set();
|
|
25
26
|
for (const [recordKey, member] of Object.entries(relations)) {
|
|
26
27
|
assertDeclarationOrderKey(`schema ${name} relation`, recordKey);
|
|
@@ -214,6 +215,15 @@ function schema(name, relations, statements) {
|
|
|
214
215
|
const implied = collectImplied(name, relations);
|
|
215
216
|
const seen = new Set();
|
|
216
217
|
for (const statement of statements) {
|
|
218
|
+
/**
|
|
219
|
+
* The untyped caller's half of the admission brand: the type tier
|
|
220
|
+
* already refuses an unbranded structural literal, and this probe
|
|
221
|
+
* refuses the same forgery at runtime — a statement that skipped the
|
|
222
|
+
* construction-time arity and roster walls never enters the theory.
|
|
223
|
+
*/
|
|
224
|
+
if (!isStatement(statement)) {
|
|
225
|
+
throw errors.new(`schema ${name}: a statement is minted only by key/contained/mirrors/window — a structural literal skips the construction-time arity and roster walls`);
|
|
226
|
+
}
|
|
217
227
|
const rendered = renderStatement(statement);
|
|
218
228
|
verifyMembership(name, relations, statement, rendered);
|
|
219
229
|
if (implied.has(rendered)) {
|