@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../src/order.ts"],"names":[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d.ts
CHANGED
|
@@ -1,68 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Atoms and conditions,
|
|
3
|
-
* rule, mirroring the engine IR variant for variant
|
|
2
|
+
* Atoms and conditions, REFERENCE-IDENTITY edition — the body vocabulary of
|
|
3
|
+
* a rule, mirroring the engine IR variant for variant
|
|
4
4
|
* (`bumbledb/crates/bumbledb/src/ir.rs`, the bijection target;
|
|
5
5
|
* `docs/architecture/20-query-ir.md` normative). A `match` binding record
|
|
6
|
-
* binds fields to
|
|
7
|
-
* — a closed-reference field's literal is its
|
|
8
|
-
* ARRAY of names there is membership
|
|
9
|
-
* by owner ruling; see {@link BindingInput})
|
|
6
|
+
* binds fields to VARIABLES (minted by {@link v}), params, ∈-set params, or
|
|
7
|
+
* bare structural literals — a closed-reference field's literal is its
|
|
8
|
+
* handle NAME, and a plain ARRAY of names there is membership
|
|
10
9
|
* (unmentioned fields ARE the wildcard — no wildcard value exists);
|
|
11
10
|
* `not(Rel, {...})` is negation-as-position (anti-join); `eq`/`ne` and the
|
|
12
|
-
* order roster, `pointIn
|
|
11
|
+
* order roster, `pointIn` (the one spelling of `ir::CmpOp::PointIn`,
|
|
13
12
|
* always lowered interval-left), `allen` (the 13-bit mask pair
|
|
14
13
|
* comparison), and `and`/`or` (the input condition-tree grammar) complete
|
|
15
14
|
* the roster. Nothing beyond the IR exists here — and the walls the engine
|
|
16
|
-
* enforces at prepare are TYPES first: a
|
|
17
|
-
* fields
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
15
|
+
* enforces at prepare are TYPES first: a variable joins only class-equal
|
|
16
|
+
* fields, judged at every binding position against the var's MINT slot
|
|
17
|
+
* ({@link MintSlotOf}); because {@link JoinOk} is an equality, that ALONE
|
|
18
|
+
* makes every cross-binding join transitively class-equal (the env/sibling
|
|
19
|
+
* checks the name-keyed edition needed are gone). An interval-typed var
|
|
20
|
+
* under a non-`pointIn` comparison is unwritable. BOUNDNESS (a negated
|
|
21
|
+
* atom's variables must be positively bound) is the one check types cannot
|
|
22
|
+
* carry — object identity is invisible to TS — so it is a construction-time
|
|
23
|
+
* wall only.
|
|
24
24
|
*
|
|
25
25
|
* This module also owns the plain runtime DATA a built rule is made of
|
|
26
26
|
* (`RuleData`/`RecData` and friends): frozen values the lowering walks —
|
|
27
|
-
* pure data, so lowering stays a pure,
|
|
27
|
+
* pure data (variable references included), so lowering stays a pure,
|
|
28
|
+
* stable function of the query value.
|
|
28
29
|
*/
|
|
29
|
-
import type { AnyClosed } from "#closed.ts";
|
|
30
30
|
import type { AnyField, ClosedIdField, ClosedRoster, Infer, IntervalValue } from "#fields.ts";
|
|
31
31
|
import type { ClassLookup, ClassRecordOf, SchemaClasses } from "#law.ts";
|
|
32
|
-
import type { ClassedField, Duration,
|
|
33
|
-
import type {
|
|
32
|
+
import type { AnyVar, ClassedField, Duration, JoinOk, MaskParam, MatchFields, MatchOwner, MintSlotOf, Param, ParamValueAt, SetParam, ShapeOf } from "#query/scope.ts";
|
|
33
|
+
import type { FieldsShape } from "#relation.ts";
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* virtual image when the shape does not fold; the SDK never pre-folds and
|
|
39
|
-
* never knows which — transparency is the contract).
|
|
40
|
-
*/
|
|
41
|
-
type MatchOwner = AnyRelation | AnyClosed;
|
|
42
|
-
/**
|
|
43
|
-
* The matchable field block of an atom owner: a relation's declared
|
|
44
|
-
* fields; a closed relation's SEALED shape — the synthetic `id` (the
|
|
45
|
-
* value's OWN roster-carrying descriptor, at its precise type: the handle
|
|
46
|
-
* union rides into ψ id bindings and joins exactly as it does on a
|
|
47
|
-
* referencing column) first, then the declared payload columns read
|
|
48
|
-
* through the typed `columns` carrier (the one source of payload typing —
|
|
49
|
-
* no parallel column table exists). The runtime twin is `matchFieldsOf` in
|
|
50
|
-
* `#query/lower.ts`; the id-first ordinal shift the two tiers share is
|
|
51
|
-
* pinned by the lowering golden.
|
|
52
|
-
*/
|
|
53
|
-
type MatchFields<R extends MatchOwner> = R extends AnyClosed ? {
|
|
54
|
-
readonly id: R["id"];
|
|
55
|
-
} & R["columns"] : R extends AnyRelation ? RelationFields<R> : never;
|
|
56
|
-
/**
|
|
57
|
-
* One atom-binding position as runtime data. `literalSet` is a membership
|
|
58
|
-
* ARRAY at a closed-reference field, folded into the program: `name` is
|
|
59
|
-
* the content-addressed registry key its dense `ParamId` is minted under
|
|
60
|
-
* (the lowering rides the existing param-set term; the SDK itself supplies
|
|
61
|
-
* the translated member set at every execute — never the host).
|
|
35
|
+
* One atom-binding position as runtime data. A variable rides BY REFERENCE
|
|
36
|
+
* (`ref`) — object identity is the join. `literalSet` is a membership
|
|
37
|
+
* ARRAY at a closed-reference field, folded into the program.
|
|
62
38
|
*/
|
|
63
39
|
type BindingTermData = {
|
|
64
40
|
readonly kind: "var";
|
|
65
|
-
readonly
|
|
41
|
+
readonly ref: AnyVar;
|
|
66
42
|
} | {
|
|
67
43
|
readonly kind: "param";
|
|
68
44
|
readonly name: string;
|
|
@@ -91,10 +67,10 @@ interface AtomData {
|
|
|
91
67
|
}
|
|
92
68
|
/** One comparison operator name (mirrors `ir::CmpOp`). */
|
|
93
69
|
type CmpKind = "eq" | "ne" | "lt" | "le" | "gt" | "ge" | "pointIn" | "allen";
|
|
94
|
-
/** One comparison side as runtime data. */
|
|
70
|
+
/** One comparison side as runtime data (variables and the measure ride BY REFERENCE). */
|
|
95
71
|
type CmpTermData = {
|
|
96
72
|
readonly kind: "var";
|
|
97
|
-
readonly
|
|
73
|
+
readonly ref: AnyVar;
|
|
98
74
|
} | {
|
|
99
75
|
readonly kind: "param";
|
|
100
76
|
readonly name: string;
|
|
@@ -103,7 +79,7 @@ type CmpTermData = {
|
|
|
103
79
|
readonly name: string;
|
|
104
80
|
} | {
|
|
105
81
|
readonly kind: "measure";
|
|
106
|
-
readonly
|
|
82
|
+
readonly ref: AnyVar;
|
|
107
83
|
} | {
|
|
108
84
|
readonly kind: "literal";
|
|
109
85
|
readonly value: unknown;
|
|
@@ -132,52 +108,59 @@ interface TreeData {
|
|
|
132
108
|
}
|
|
133
109
|
/** Any condition node as runtime data. */
|
|
134
110
|
type CondData = CmpData | TreeData;
|
|
135
|
-
/** One aggregate's runtime description (
|
|
111
|
+
/** One aggregate's runtime description (find vocabulary, over variable REFERENCES). */
|
|
136
112
|
type AggData = {
|
|
137
113
|
readonly op: "count";
|
|
138
114
|
} | {
|
|
139
115
|
readonly op: "countDistinct";
|
|
140
|
-
readonly over:
|
|
116
|
+
readonly over: AnyVar;
|
|
141
117
|
} | {
|
|
142
118
|
readonly op: "fold";
|
|
143
119
|
readonly fold: "sum" | "min" | "max";
|
|
144
|
-
readonly over:
|
|
145
|
-
readonly duration:
|
|
120
|
+
readonly over: AnyVar | {
|
|
121
|
+
readonly duration: AnyVar;
|
|
146
122
|
};
|
|
147
123
|
} | {
|
|
148
124
|
readonly op: "arg";
|
|
149
125
|
readonly direction: "argMax" | "argMin";
|
|
150
|
-
readonly over:
|
|
151
|
-
readonly key:
|
|
126
|
+
readonly over: AnyVar;
|
|
127
|
+
readonly key: AnyVar;
|
|
152
128
|
} | {
|
|
153
129
|
readonly op: "pack";
|
|
154
|
-
readonly over:
|
|
130
|
+
readonly over: AnyVar;
|
|
155
131
|
};
|
|
156
|
-
/** One classified
|
|
157
|
-
type
|
|
132
|
+
/** One classified find entry as runtime data (variables and the measure ride BY REFERENCE). */
|
|
133
|
+
type FindEntryData = {
|
|
158
134
|
readonly kind: "var";
|
|
159
|
-
readonly over:
|
|
135
|
+
readonly over: AnyVar;
|
|
160
136
|
} | {
|
|
161
137
|
readonly kind: "measure";
|
|
162
|
-
readonly over:
|
|
138
|
+
readonly over: AnyVar;
|
|
163
139
|
} | {
|
|
164
140
|
readonly kind: "aggregate";
|
|
165
141
|
readonly agg: AggData;
|
|
166
142
|
};
|
|
167
143
|
/**
|
|
168
|
-
* One answer column: its name (the row object key
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
144
|
+
* One answer column: its name (the row object key — the find record's key,
|
|
145
|
+
* so renames are real and a duplicate column is unrepresentable), its entry,
|
|
146
|
+
* the classed mint SLOT its values flow from (a projected var or an
|
|
147
|
+
* Arg-carried payload; `undefined` for counts/folds/measures/pack, which
|
|
148
|
+
* derive numbers or intervals), and — when that slot is a closed reference —
|
|
149
|
+
* the roster the decode lifts row ids back to handle NAMES through
|
|
150
|
+
* (`undefined` on every bare column). The slice is SDK-side marshaling data
|
|
151
|
+
* only: the wire `ProgramIr` never carries it.
|
|
174
152
|
*/
|
|
175
|
-
interface
|
|
153
|
+
interface FindColumn {
|
|
176
154
|
readonly name: string;
|
|
177
|
-
readonly entry:
|
|
155
|
+
readonly entry: FindEntryData;
|
|
178
156
|
readonly closed: ClosedRoster | undefined;
|
|
157
|
+
readonly slot: ClassedField | undefined;
|
|
179
158
|
}
|
|
180
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* One body item of a rule, in written order. The idb join is a NAMED record
|
|
161
|
+
* over the rec's head keys (`key`) bound to local variables (`ref`) — the
|
|
162
|
+
* typed wall a record's unordered keys would otherwise lose.
|
|
163
|
+
*/
|
|
181
164
|
type RuleItem = {
|
|
182
165
|
readonly kind: "atom";
|
|
183
166
|
readonly atom: AtomData;
|
|
@@ -187,7 +170,10 @@ type RuleItem = {
|
|
|
187
170
|
} | {
|
|
188
171
|
readonly kind: "idb";
|
|
189
172
|
readonly rec: RecData;
|
|
190
|
-
readonly
|
|
173
|
+
readonly bindings: ReadonlyArray<{
|
|
174
|
+
readonly key: string;
|
|
175
|
+
readonly ref: AnyVar;
|
|
176
|
+
}>;
|
|
191
177
|
} | {
|
|
192
178
|
readonly kind: "cond";
|
|
193
179
|
readonly cond: CondData;
|
|
@@ -196,9 +182,7 @@ type RuleItem = {
|
|
|
196
182
|
* One use of a parameter inside a rule, in written order: the census the
|
|
197
183
|
* query-level registry folds (first use mints the dense `ParamId`, first
|
|
198
184
|
* FIELD-ANCHORED use types the wire). `members` is present exactly on a
|
|
199
|
-
* membership-array use
|
|
200
|
-
* names the SDK itself translates and supplies at execute — the entry
|
|
201
|
-
* never appears in the host's params object.
|
|
185
|
+
* membership-array use.
|
|
202
186
|
*/
|
|
203
187
|
interface ParamUse {
|
|
204
188
|
readonly name: string;
|
|
@@ -210,9 +194,7 @@ interface ParamUse {
|
|
|
210
194
|
/** One complete rule as runtime data. */
|
|
211
195
|
interface RuleData {
|
|
212
196
|
readonly items: readonly RuleItem[];
|
|
213
|
-
readonly
|
|
214
|
-
/** Variable name → the classed slot its FIRST positive binding carries (the runtime env — descriptor + class). */
|
|
215
|
-
readonly varFields: Readonly<Record<string, ClassedField>>;
|
|
197
|
+
readonly finds: readonly FindColumn[];
|
|
216
198
|
readonly paramUses: readonly ParamUse[];
|
|
217
199
|
}
|
|
218
200
|
/**
|
|
@@ -226,21 +208,13 @@ interface RecData {
|
|
|
226
208
|
}
|
|
227
209
|
/**
|
|
228
210
|
* What a binding position of field `F` accepts: a bare structural literal
|
|
229
|
-
* of the field's value type, a
|
|
230
|
-
* field is interval-typed, a bare point literal
|
|
231
|
-
*
|
|
232
|
-
* membership; an interval-typed term is value equality). A
|
|
233
|
-
* CLOSED-reference field additionally takes a plain ARRAY of handle names
|
|
234
|
-
* read as membership — `kind: ["Practice", "Review"]` (the drizzle law:
|
|
235
|
-
* set membership is an array, never an operator). Arrays are CLOSED-ONLY
|
|
236
|
-
* in this packet by owner ruling: ordinary u64/str membership already has
|
|
237
|
-
* its spelling through `r.inSet` params; widening literal arrays to every
|
|
238
|
-
* literal-capable kind is a separate future taste call — deliberately not
|
|
239
|
-
* done here.
|
|
211
|
+
* of the field's value type, a variable/param/∈-set-param term — and, when
|
|
212
|
+
* the field is interval-typed, a bare point literal. A CLOSED-reference
|
|
213
|
+
* field additionally takes a plain ARRAY of handle names read as membership.
|
|
240
214
|
*/
|
|
241
215
|
type BindingInput<F extends AnyField> = Infer<F> | (F extends ClosedIdField ? readonly Infer<F>[] : never) | (F extends {
|
|
242
216
|
readonly kind: "interval";
|
|
243
|
-
} ? bigint : never) |
|
|
217
|
+
} ? bigint : never) | AnyVar | Param<string> | SetParam<string>;
|
|
244
218
|
/**
|
|
245
219
|
* The `match`/`not` bindings record: per field, a term or literal of that
|
|
246
220
|
* field's structural type; unmentioned fields are wildcards (absence IS
|
|
@@ -252,44 +226,22 @@ type MatchShape<F extends FieldsShape> = {
|
|
|
252
226
|
/**
|
|
253
227
|
* One field position of a bindings record as a classed slot: the declared
|
|
254
228
|
* descriptor plus the slot's law-computed class, read off the relation's
|
|
255
|
-
* class record (`CR`
|
|
256
|
-
*
|
|
229
|
+
* class record (`CR`). The one shape a binding position's join judgment
|
|
230
|
+
* compares against.
|
|
257
231
|
*/
|
|
258
232
|
type SlotAt<F extends FieldsShape, CR, K> = {
|
|
259
233
|
readonly field: F[K & keyof F];
|
|
260
234
|
readonly class: ClassLookup<CR, K>;
|
|
261
235
|
};
|
|
262
236
|
/**
|
|
263
|
-
* The
|
|
264
|
-
*
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
* The var binding's judgment against its OWN record's siblings: two
|
|
269
|
-
* bindings of one var name inside a single bindings record are the same
|
|
270
|
-
* join the environment check judges across atoms, so every same-named
|
|
271
|
-
* sibling must be class-equal too. Without this arm two FIRST occurrences
|
|
272
|
-
* of one name (a record the environment has not seen yet) would meet no
|
|
273
|
-
* check at all — the intra-atom join would silently cross classes.
|
|
237
|
+
* The per-property join judgment of a bindings record: a VARIABLE binding
|
|
238
|
+
* must join its own MINT slot to the position slot (a cross-class reuse maps
|
|
239
|
+
* the property to `never`). Because {@link JoinOk} is an equality, judging
|
|
240
|
+
* every position against the mint slot makes all cross-binding joins
|
|
241
|
+
* mutually class-equal by transitivity — no env or sibling arm is needed.
|
|
274
242
|
*/
|
|
275
|
-
type
|
|
276
|
-
[
|
|
277
|
-
}[Exclude<keyof B & keyof F, K>] ? false : true;
|
|
278
|
-
/**
|
|
279
|
-
* The per-property join judgment of a bindings record: a var binding must
|
|
280
|
-
* be class-equal to the rule environment's binding of the name AND to
|
|
281
|
-
* every same-named sibling of its own record (a cross-class reuse maps
|
|
282
|
-
* the property to `never` — the compile error the old value brand carried,
|
|
283
|
-
* now law-born off the schema type's class map).
|
|
284
|
-
*/
|
|
285
|
-
type BindingOk<Env extends EnvShape, F extends FieldsShape, CR, B, K extends keyof B> = B[K] extends Var<infer N extends string> ? [EnvJoinOk<Env, F, CR, K, N>, SiblingJoinOk<F, CR, B, K, N>] extends [true, true] ? true : false : true;
|
|
286
|
-
/** The validated bindings record (intersect with the inferred `B` — errors land on the offending property). */
|
|
287
|
-
type CheckBindings<Env extends EnvShape, F extends FieldsShape, CR, B> = {
|
|
288
|
-
readonly [K in keyof B]: K extends keyof F ? (BindingOk<Env, F, CR, B, K> extends true ? B[K] : never) : never;
|
|
289
|
-
};
|
|
290
|
-
/** The environment a bindings record contributes: var name → the bound slot (descriptor + class). */
|
|
291
|
-
type BindEnv<F extends FieldsShape, CR, B> = {
|
|
292
|
-
readonly [K in keyof B & keyof F as B[K] extends Var<infer N extends string> ? N : never]: SlotAt<F, CR, K>;
|
|
243
|
+
type CheckBindings<Classes extends SchemaClasses, F extends FieldsShape, CR, B> = {
|
|
244
|
+
readonly [K in keyof B]: K extends keyof F ? B[K] extends AnyVar ? JoinOk<MintSlotOf<Classes, B[K]>, SlotAt<F, CR, K>> extends true ? B[K] : never : B[K] : never;
|
|
293
245
|
};
|
|
294
246
|
/** The params-object fragments a bindings record contributes (one union member per param use). */
|
|
295
247
|
type BindParams<F extends FieldsShape, B> = {
|
|
@@ -301,8 +253,8 @@ type BindParams<F extends FieldsShape, B> = {
|
|
|
301
253
|
}[keyof B & keyof F];
|
|
302
254
|
/**
|
|
303
255
|
* One comparison VALUE: op plus its operands, raw — the runtime
|
|
304
|
-
* representation carries the
|
|
305
|
-
*
|
|
256
|
+
* representation carries the operands (variable references included), so
|
|
257
|
+
* `.where`'s judgment and the params inference both read the value itself.
|
|
306
258
|
* `mask` is populated exactly for `allen`.
|
|
307
259
|
*/
|
|
308
260
|
interface Cmp<Op extends CmpKind, L, R, M = undefined> {
|
|
@@ -321,9 +273,9 @@ interface Tree<Ch extends readonly AnyTreeChild[]> {
|
|
|
321
273
|
/**
|
|
322
274
|
* One negated-atom VALUE — negation is a position in the rule (anti-join
|
|
323
275
|
* over sets, no null trick): a binding satisfies it iff NO fact matches.
|
|
324
|
-
* Its variables must be positively bound in the rule —
|
|
325
|
-
*
|
|
326
|
-
*
|
|
276
|
+
* Its variables must be positively bound in the rule — a construction-time
|
|
277
|
+
* wall (BOUNDNESS is invisible to the type tier), before the engine's own
|
|
278
|
+
* refusal.
|
|
327
279
|
*/
|
|
328
280
|
interface NotAtom<R extends MatchOwner, B> {
|
|
329
281
|
readonly cond: "not";
|
|
@@ -339,27 +291,27 @@ type AnyNotAtom = NotAtom<MatchOwner, unknown>;
|
|
|
339
291
|
/** Any `.where` input: a comparison, a condition tree, or a negated atom. */
|
|
340
292
|
type AnyCond = AnyCmp | Tree<readonly AnyTreeChild[]> | AnyNotAtom;
|
|
341
293
|
/** What `eq`'s right side accepts (`ParamSet` is `Eq`-only — the IR's rule). */
|
|
342
|
-
type EqRight =
|
|
294
|
+
type EqRight = AnyVar | Param<string> | SetParam<string> | bigint | string | boolean | Uint8Array | IntervalValue;
|
|
343
295
|
/** What `ne`'s right side accepts. */
|
|
344
|
-
type NeRight =
|
|
296
|
+
type NeRight = AnyVar | Param<string> | bigint | string | boolean | Uint8Array | IntervalValue;
|
|
345
297
|
/** One side of an order comparison: orderable terms only (the IR's comparison rules). */
|
|
346
|
-
type OrderSide =
|
|
347
|
-
/** The point side of `pointIn
|
|
348
|
-
type PointSide =
|
|
349
|
-
/** The interval side of `pointIn`/`
|
|
350
|
-
type IntervalSide =
|
|
298
|
+
type OrderSide = AnyVar | Param<string> | Duration | bigint;
|
|
299
|
+
/** The point side of `pointIn`. */
|
|
300
|
+
type PointSide = AnyVar | Param<string> | bigint;
|
|
301
|
+
/** The interval side of `pointIn`/`allen`. */
|
|
302
|
+
type IntervalSide = AnyVar | Param<string> | IntervalValue;
|
|
351
303
|
/** Builds one comparison value. */
|
|
352
304
|
declare function comparison<Op extends CmpKind, L, R, M>(op: Op, lhs: L, rhs: R, mask: M): Cmp<Op, L, R, M>;
|
|
353
305
|
/**
|
|
354
306
|
* The equality comparison (`ir::CmpOp::Eq`) — a bound variable against a
|
|
355
|
-
* variable (var-to-var unification,
|
|
356
|
-
*
|
|
357
|
-
*
|
|
358
|
-
*
|
|
307
|
+
* variable (var-to-var unification, class-equal by the join judgment), a
|
|
308
|
+
* param (typed by the variable), an ∈-set param (`Eq`-only), or a bare
|
|
309
|
+
* literal of the variable's own value type. Prefer direct placement in
|
|
310
|
+
* `match` where punning applies.
|
|
359
311
|
*/
|
|
360
|
-
declare function eq<L extends
|
|
312
|
+
declare function eq<L extends AnyVar, const R extends EqRight>(left: L, right: R): Cmp<"eq", L, R>;
|
|
361
313
|
/** Typed disequality (`ir::CmpOp::Ne`). "Not in set" has no operator — write a negated atom. */
|
|
362
|
-
declare function ne<L extends
|
|
314
|
+
declare function ne<L extends AnyVar, const R extends NeRight>(left: L, right: R): Cmp<"ne", L, R>;
|
|
363
315
|
/** Strict less-than (`ir::CmpOp::Lt`) — orderable sides only, never intervals/bytes/strings/bools. */
|
|
364
316
|
declare function lt<const L extends OrderSide, const R extends OrderSide>(left: L, right: R): Cmp<"lt", L, R>;
|
|
365
317
|
/** Less-or-equal (`ir::CmpOp::Le`). */
|
|
@@ -369,27 +321,23 @@ declare function gt<const L extends OrderSide, const R extends OrderSide>(left:
|
|
|
369
321
|
/** Greater-or-equal (`ir::CmpOp::Ge`). */
|
|
370
322
|
declare function ge<const L extends OrderSide, const R extends OrderSide>(left: L, right: R): Cmp<"ge", L, R>;
|
|
371
323
|
/**
|
|
372
|
-
* Point membership as a predicate (`ir::CmpOp::PointIn`)
|
|
324
|
+
* Point membership as a predicate (`ir::CmpOp::PointIn`) — THE one
|
|
373
325
|
* spelling: `pointIn(t, w)` holds iff `w.start ≤ t < w.end`. The IR
|
|
374
326
|
* orders the operands interval-left, point-right; the value stores them
|
|
375
|
-
* that way whatever the surface
|
|
327
|
+
* that way whatever the surface argument order. Interval ⊇ interval is NOT
|
|
328
|
+
* this operator; that predicate is `allen(a, ALLEN.covers, b)`.
|
|
376
329
|
*/
|
|
377
330
|
declare function pointIn<const P extends PointSide, const I extends IntervalSide>(point: P, interval: I): Cmp<"pointIn", I, P>;
|
|
378
331
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
* `
|
|
382
|
-
* element domain — the bug-hunt fix, now also a type-level guarantee).
|
|
383
|
-
* Interval ⊇ interval is NOT this operator; that predicate is
|
|
384
|
-
* `allen(a, ALLEN.covers, b)`.
|
|
332
|
+
* The 13-bit mask range: bits above the low 13 are unrepresentable in the
|
|
333
|
+
* engine's `AllenMask` (`bumbledb/crates/bumbledb/src/allen.rs`:
|
|
334
|
+
* `AllenMask::new` refuses them).
|
|
385
335
|
*/
|
|
386
|
-
declare
|
|
336
|
+
declare const ALLEN_ALL_BITS: number;
|
|
387
337
|
/**
|
|
388
338
|
* The Allen coordinate system's named constants — the 13 basics in the
|
|
389
|
-
* engine's palindromic bit order
|
|
390
|
-
* `
|
|
391
|
-
* plus the workload composites, values identical to the engine's. Compose
|
|
392
|
-
* with `|`: `ALLEN.before | ALLEN.meets`.
|
|
339
|
+
* engine's palindromic bit order plus the workload composites, values
|
|
340
|
+
* identical to the engine's. Compose with `|`: `ALLEN.before | ALLEN.meets`.
|
|
393
341
|
*/
|
|
394
342
|
declare const ALLEN: Readonly<{
|
|
395
343
|
before: number;
|
|
@@ -418,9 +366,7 @@ declare const ALLEN: Readonly<{
|
|
|
418
366
|
* THE interval-pair comparison (`ir::CmpOp::Allen`): two interval terms of
|
|
419
367
|
* one element type, satisfied iff the pair's classification is in the
|
|
420
368
|
* 13-bit mask — a literal built from the `ALLEN` constants, or a mask
|
|
421
|
-
* parameter (`r.maskParam`).
|
|
422
|
-
* two distinct typed rejections; nothing is pre-judged here beyond the
|
|
423
|
-
* representable bit range.
|
|
369
|
+
* parameter (`r.maskParam`).
|
|
424
370
|
*/
|
|
425
371
|
declare function allen<const A extends IntervalSide, const M extends number | MaskParam<string>, const B extends IntervalSide>(left: A, mask: M, right: B): Cmp<"allen", A, B, M>;
|
|
426
372
|
/**
|
|
@@ -433,70 +379,59 @@ declare function and<const C extends readonly AnyTreeChild[]>(...children: C): T
|
|
|
433
379
|
/**
|
|
434
380
|
* Disjunction node of the input condition grammar (`ConditionTree::Or`) —
|
|
435
381
|
* the one place the surface admits a nested OR; validation distributes it
|
|
436
|
-
* to DNF rules engine-side
|
|
437
|
-
* its algebraic reading (false: the rule denotes nothing).
|
|
382
|
+
* to DNF rules engine-side. `Or([])` keeps its algebraic reading (false).
|
|
438
383
|
*/
|
|
439
384
|
declare function or<const C extends readonly AnyTreeChild[]>(...children: C): Tree<C>;
|
|
440
385
|
/**
|
|
441
|
-
* Negation — anti-join over sets: `not(Rel, { field:
|
|
386
|
+
* Negation — anti-join over sets: `not(Rel, { field: someVar, ... })`
|
|
442
387
|
* rejects every binding some matching fact extends. A negated atom binds
|
|
443
388
|
* nothing, only rejects: every variable it names must be positively bound
|
|
444
|
-
* in the rule,
|
|
445
|
-
*
|
|
446
|
-
* here too — the engine folds a resolvable negated closed atom to the
|
|
447
|
-
* COMPLEMENT of its member set (domain-witness guarded), and the SDK's
|
|
448
|
-
* negation rules apply to it unchanged.
|
|
389
|
+
* in the rule, a construction-time wall (the engine's safety refusal stands
|
|
390
|
+
* behind it). A CLOSED owner is legal here too.
|
|
449
391
|
*/
|
|
450
392
|
declare function not<R extends MatchOwner, const B extends MatchShape<MatchFields<R>>>(relation: R, bindings: B): NotAtom<R, B>;
|
|
451
393
|
/**
|
|
452
|
-
* Whether a
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* judgment is the one gate they all read, and the construction-time
|
|
459
|
-
* validations in `#query/lower.ts` are its runtime twin.
|
|
394
|
+
* Whether a variable's OWN field is orderable (u64/i64). A CLOSED reference
|
|
395
|
+
* is excluded even though its kind is `u64`: a vocabulary's declaration-id
|
|
396
|
+
* order is an accident, not semantics (`docs/architecture/10-data-model.md`
|
|
397
|
+
* § orderability), so every order-comparison and fold position refuses
|
|
398
|
+
* closed-bound terms — this judgment is the one gate they all read, and the
|
|
399
|
+
* construction-time validations in `#query/lower.ts` are its runtime twin.
|
|
460
400
|
*/
|
|
461
|
-
type OrderVarOk<
|
|
401
|
+
type OrderVarOk<V extends AnyVar> = V["field"] extends {
|
|
462
402
|
readonly closed: ClosedRoster;
|
|
463
|
-
} ? false :
|
|
464
|
-
/** Whether a
|
|
465
|
-
type IntervalVarOk<
|
|
466
|
-
/** One order-comparison side's judgment
|
|
467
|
-
type OrderSideOk<
|
|
403
|
+
} ? false : V["field"]["kind"] extends "u64" | "i64" ? true : false;
|
|
404
|
+
/** Whether a variable's OWN field is interval-typed. */
|
|
405
|
+
type IntervalVarOk<V extends AnyVar> = V["field"]["kind"] extends "interval" ? true : false;
|
|
406
|
+
/** One order-comparison side's judgment (off the term's own field). */
|
|
407
|
+
type OrderSideOk<T> = T extends AnyVar ? OrderVarOk<T> : T extends Duration<infer V extends AnyVar> ? IntervalVarOk<V> : true;
|
|
468
408
|
/** One point side's judgment. */
|
|
469
|
-
type PointSideOk<
|
|
409
|
+
type PointSideOk<T> = T extends AnyVar ? OrderVarOk<T> : true;
|
|
470
410
|
/** One interval side's judgment. */
|
|
471
|
-
type IntervalSideOk<
|
|
472
|
-
/** The `eq`/`ne` judgment:
|
|
473
|
-
type EqOk<
|
|
474
|
-
/** One negated-atom binding's judgment: a
|
|
475
|
-
type NotBindingOk<
|
|
411
|
+
type IntervalSideOk<T> = T extends AnyVar ? IntervalVarOk<T> : true;
|
|
412
|
+
/** The `eq`/`ne` judgment: var-var joins by mint slot; var-literal is exact-typed by the var's own field. */
|
|
413
|
+
type EqOk<Classes extends SchemaClasses, L, R> = L extends AnyVar ? R extends AnyVar ? JoinOk<MintSlotOf<Classes, L>, MintSlotOf<Classes, R>> extends true ? true : false : R extends Param<string> | SetParam<string> ? true : [R] extends [Infer<L["field"]>] ? true : false : false;
|
|
414
|
+
/** One negated-atom binding's judgment: a variable must be class-equal (boundness is a runtime wall). */
|
|
415
|
+
type NotBindingOk<Classes extends SchemaClasses, S extends ClassedField, T> = T extends AnyVar ? JoinOk<MintSlotOf<Classes, T>, S> extends true ? true : false : true;
|
|
476
416
|
/** The whole negated atom's judgment (`CR` — the negated relation's class record off the schema class map). */
|
|
477
|
-
type NotOk<
|
|
478
|
-
[K in keyof B]: NotBindingOk<
|
|
417
|
+
type NotOk<Classes extends SchemaClasses, F extends FieldsShape, CR, B> = false extends {
|
|
418
|
+
[K in keyof B]: NotBindingOk<Classes, SlotAt<F, CR, K>, B[K]>;
|
|
479
419
|
}[keyof B] ? false : true;
|
|
480
420
|
/**
|
|
481
|
-
* One condition's judgment
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* `
|
|
486
|
-
* relation's class record is resolved through `Classes` by its name). The
|
|
487
|
-
* leading `[AnyTreeChild] extends [C]` arm is the recursion's base case:
|
|
488
|
-
* at an UNRESOLVED constraint (the whole condition union — or a tree's
|
|
489
|
-
* child union, which is the union itself) the judgment is vacuously true —
|
|
490
|
-
* without it the constraint instantiation recurses into itself.
|
|
421
|
+
* One condition's judgment — the type-level twin of the engine's comparison
|
|
422
|
+
* roster: class-equal joins (off the mint slots), orderable order sides (an
|
|
423
|
+
* interval var under a non-`pointIn` op is exactly here refused),
|
|
424
|
+
* kind-correct `pointIn`/`allen` sides, and negated-atom class safety. The
|
|
425
|
+
* leading `[AnyTreeChild] extends [C]` arm is the recursion's base case.
|
|
491
426
|
*/
|
|
492
|
-
type CondOkBool<
|
|
427
|
+
type CondOkBool<Classes extends SchemaClasses, C> = [AnyTreeChild] extends [C] ? true : C extends Cmp<infer Op, infer L, infer R, unknown> ? Op extends "eq" | "ne" ? EqOk<Classes, L, R> : Op extends "lt" | "le" | "gt" | "ge" ? [OrderSideOk<L>, OrderSideOk<R>] extends [true, true] ? true : false : Op extends "pointIn" ? [IntervalSideOk<L>, PointSideOk<R>] extends [true, true] ? true : false : Op extends "allen" ? [IntervalSideOk<L>, IntervalSideOk<R>] extends [true, true] ? true : false : false : C extends Tree<infer Ch extends readonly AnyTreeChild[]> ? false extends CondOkBool<Classes, Ch[number]> ? false : true : C extends NotAtom<infer R extends MatchOwner, infer B> ? NotOk<Classes, MatchFields<R>, ClassRecordOf<Classes, R["name"]>, B> : false;
|
|
493
428
|
/** The validated `.where` argument (intersect with the inferred condition type). */
|
|
494
|
-
type CheckCond<
|
|
495
|
-
/** The `eq`/`ne` params contribution: the param typed by the left variable's field. */
|
|
496
|
-
type EqParams<
|
|
497
|
-
readonly [Q in P]: Infer<
|
|
429
|
+
type CheckCond<Classes extends SchemaClasses, C> = CondOkBool<Classes, C> extends true ? C : never;
|
|
430
|
+
/** The `eq`/`ne` params contribution: the param typed by the left variable's own field. */
|
|
431
|
+
type EqParams<L, R> = L extends AnyVar ? R extends Param<infer P extends string> ? {
|
|
432
|
+
readonly [Q in P]: Infer<L["field"]>;
|
|
498
433
|
} : R extends SetParam<infer P extends string> ? {
|
|
499
|
-
readonly [Q in P]: readonly Infer<
|
|
434
|
+
readonly [Q in P]: readonly Infer<L["field"]>[];
|
|
500
435
|
} : never : never;
|
|
501
436
|
/** An order side's params contribution (order params are always `bigint`). */
|
|
502
437
|
type OrderSideParams<T> = T extends Param<infer P extends string> ? {
|
|
@@ -513,14 +448,13 @@ type MaskParams<M> = M extends MaskParam<infer P extends string> ? {
|
|
|
513
448
|
/**
|
|
514
449
|
* One condition's params-object fragments (a union; the rule builder folds
|
|
515
450
|
* them into the inferred `Params` record) — every param typed by its use.
|
|
516
|
-
* The leading arm is the same base case as {@link CondOkBool}'s
|
|
517
|
-
* unresolved constraint contributes nothing.
|
|
451
|
+
* The leading arm is the same base case as {@link CondOkBool}'s.
|
|
518
452
|
*/
|
|
519
|
-
type CondParams<
|
|
453
|
+
type CondParams<C> = [AnyTreeChild] extends [C] ? never : C extends Cmp<infer Op, infer L, infer R, infer M> ? Op extends "eq" | "ne" ? EqParams<L, R> : Op extends "lt" | "le" | "gt" | "ge" ? OrderSideParams<L> | OrderSideParams<R> : Op extends "pointIn" ? IntervalSideParams<L> | OrderSideParams<R> : Op extends "allen" ? IntervalSideParams<L> | IntervalSideParams<R> | MaskParams<M> : never : C extends Tree<infer Ch extends readonly AnyTreeChild[]> ? CondParams<Ch[number]> : C extends NotAtom<infer R extends MatchOwner, infer B> ? BindParams<MatchFields<R>, B> : never;
|
|
520
454
|
/** The flattened params record one bindings record contributes. */
|
|
521
455
|
type BindParamsShape<F extends FieldsShape, B> = ShapeOf<BindParams<F, B>>;
|
|
522
456
|
/** The flattened params record one condition contributes. */
|
|
523
|
-
type CondParamsShape<
|
|
524
|
-
export type { AggData, AnyCmp, AnyCond, AnyNotAtom, AnyTreeChild, AtomData,
|
|
525
|
-
export { ALLEN, allen, and, comparison,
|
|
457
|
+
type CondParamsShape<C> = ShapeOf<CondParams<C>>;
|
|
458
|
+
export type { AggData, AnyCmp, AnyCond, AnyNotAtom, AnyTreeChild, AtomData, BindingEntry, BindingInput, BindingTermData, BindParams, BindParamsShape, CheckBindings, CheckCond, Cmp, CmpData, CmpKind, CmpTermData, CondData, CondOkBool, CondParams, CondParamsShape, FindColumn, FindEntryData, IntervalSide, IntervalVarOk, MaskData, MatchFields, MatchOwner, MatchShape, NotAtom, OrderSide, OrderVarOk, ParamUse, PointSide, RecData, RuleData, RuleItem, SlotAt, Tree, TreeData };
|
|
459
|
+
export { ALLEN, ALLEN_ALL_BITS, allen, and, comparison, eq, ge, gt, le, lt, ne, not, or, pointIn };
|
|
526
460
|
//# sourceMappingURL=atom.d.ts.map
|