@bjornpagen/bumbledb 0.14.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COOKBOOK.md +58 -62
- package/README.md +82 -56
- package/dist/capacity.d.ts +24 -136
- package/dist/capacity.d.ts.map +1 -1
- package/dist/capacity.js +18 -40
- package/dist/capacity.js.map +1 -1
- package/dist/closed.d.ts +0 -156
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +0 -104
- package/dist/closed.js.map +1 -1
- package/dist/db.d.ts +93 -290
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +713 -556
- package/dist/db.js.map +1 -1
- package/dist/face.d.ts +0 -133
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +0 -33
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +1 -145
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +2 -91
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +13 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -20
- package/dist/index.js.map +1 -1
- package/dist/law.d.ts +111 -93
- package/dist/law.d.ts.map +1 -1
- package/dist/law.js +23 -27
- package/dist/law.js.map +1 -1
- package/dist/lower.d.ts +9 -35
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +8 -53
- package/dist/lower.js.map +1 -1
- package/dist/marshal.d.ts +0 -65
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +0 -72
- package/dist/marshal.js.map +1 -1
- package/dist/native.d.ts +97 -390
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +39 -61
- package/dist/native.js.map +1 -1
- package/dist/query/atom.d.ts +10 -276
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +1 -96
- package/dist/query/atom.js.map +1 -1
- package/dist/query/find.d.ts +10 -76
- package/dist/query/find.d.ts.map +1 -1
- package/dist/query/find.js +0 -30
- package/dist/query/find.js.map +1 -1
- package/dist/query/lower.d.ts +64 -146
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +19 -256
- package/dist/query/lower.js.map +1 -1
- package/dist/query/parse-ir.d.ts +0 -7
- package/dist/query/parse-ir.d.ts.map +1 -1
- package/dist/query/parse-ir.js +1 -13
- package/dist/query/parse-ir.js.map +1 -1
- package/dist/query/run.d.ts +0 -36
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +0 -44
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +24 -180
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +2 -66
- package/dist/query/scope.js.map +1 -1
- package/dist/relation.d.ts +2 -50
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +2 -37
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts +13 -63
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +118 -92
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +1 -140
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js +1 -68
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +6 -137
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +16 -119
- package/dist/statements.js.map +1 -1
- package/package.json +3 -3
- package/src/capacity.ts +26 -140
- package/src/closed.ts +5 -206
- package/src/db.ts +997 -854
- package/src/face.ts +0 -142
- package/src/fields.ts +4 -172
- package/src/index.ts +32 -35
- package/src/law.ts +201 -129
- package/src/lower.ts +8 -53
- package/src/marshal.ts +1 -85
- package/src/native.ts +192 -413
- package/src/query/atom.ts +26 -313
- package/src/query/find.ts +24 -110
- package/src/query/lower.ts +132 -377
- package/src/query/parse-ir.ts +1 -14
- package/src/query/run.ts +0 -45
- package/src/query/scope.ts +25 -186
- package/src/relation.ts +2 -66
- package/src/schema.ts +143 -122
- package/src/spec.ts +1 -160
- package/src/statements.ts +22 -174
- package/dist/exhume.d.ts +0 -143
- package/dist/exhume.d.ts.map +0 -1
- package/dist/exhume.js +0 -166
- package/dist/exhume.js.map +0 -1
- package/src/exhume.ts +0 -267
package/dist/capacity.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Capacity-law mints — the window, weight, and dependent-bound vocabulary
|
|
3
|
-
* the one `capacity
|
|
4
|
-
*
|
|
5
|
-
* around the aggregate form). `within
|
|
3
|
+
* the one `capacity` statement constructor consumes
|
|
4
|
+
* § the canonical-utterance law, restated
|
|
5
|
+
* around the aggregate form). `within` is the ONE window spelling —
|
|
6
6
|
* `within(n)` exact (`within(0n)` IS the exclusion's one spelling),
|
|
7
7
|
* `within(lo, hi)` range (`within(0n, hi)` the canonical ceiling),
|
|
8
|
-
* `within(lo, "*")` floor — `weigh
|
|
8
|
+
* `within(lo, "*")` floor — `weigh` names the measure on the SOURCE row
|
|
9
9
|
* (`weigh("watts")` a u64 field, `weigh(duration("booked"))` an interval's
|
|
10
|
-
* measure), and `ref
|
|
10
|
+
* measure), and `ref`/`duration` read a dependent bound from the
|
|
11
11
|
* TARGET row (hi slot only — ruled 2026-07-24, C6). The ban table is
|
|
12
12
|
* enforced REPRESENTATIONALLY in two tiers, split per-aggregate where
|
|
13
13
|
* weight-sensitive (design § 6: a ban is canonical-utterance policing when
|
|
14
14
|
* it is weight-independent, semantic deduplication when it is not):
|
|
15
15
|
*
|
|
16
16
|
* - **The type tier**: a banned spelling written as a LITERAL does not
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
17
|
+
* compile — every negative bound, `within(n, n)`, `within(0n, 0n)`, and
|
|
18
|
+
* `within(0n, "*")` are type errors naming the canonical form. The
|
|
19
|
+
* weight-SENSITIVE row rides the `capacity` overloads themselves:
|
|
20
|
+
* `within(1n, "*")` is banned on the unit overload only (`{1..*}` on the
|
|
21
|
+
* count instance is the bare containment respelled —
|
|
22
|
+
* `window_floor_containment`), and LEGAL on the weighted one ("positive
|
|
23
|
+
* total" is not an existence claim over rows).
|
|
24
24
|
* - **The construction tier**: a bound the type level cannot judge — a
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* COMPUTED `bigint`, or an inverted `within(lo, hi)` order — is judged at
|
|
26
|
+
* construction with the same canonical-naming errors; and past both
|
|
27
|
+
* tiers the engine's own spec validation remains the law for a hostile
|
|
28
|
+
* FFI caller (the standing two-tier ban enforcement).
|
|
29
29
|
*
|
|
30
30
|
* The weight vocabulary is closed at the row (ruled 2026-07-24, ruling 6):
|
|
31
31
|
* a path weight (`weigh("model.watts")`) is a typed refusal at BOTH tiers
|
|
@@ -36,65 +36,25 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import type { AnyFace, FaceFields, FaceSource, ProjectedShape } from "./face.js";
|
|
38
38
|
import type { CapacityWindowSpec, WeightSpec } from "./spec.js";
|
|
39
|
-
/**
|
|
40
|
-
* The admission brand — a module-private symbol, deliberately unexported
|
|
41
|
-
* (the standing statement-mint pattern): `CapacityWindowSpec` and
|
|
42
|
-
* `WeightSpec` are public wire types, so without this brand every banned
|
|
43
|
-
* spelling in the ban table would be writable as a plain object literal.
|
|
44
|
-
* The symbol makes `within()` and `weigh()` the ONLY producers of the
|
|
45
|
-
* values `capacity()` accepts, which is what "the ban table is unwritable"
|
|
46
|
-
* means.
|
|
47
|
-
*/
|
|
48
39
|
declare const admitted: unique symbol;
|
|
49
|
-
/**
|
|
50
|
-
* An admitted capacity window — opaque and inert: a fact about the theory,
|
|
51
|
-
* not a builder. Only `within()` produces one; the spec is carried at its
|
|
52
|
-
* EXACT type so the weight-sensitive `{1..*}` ban and the dependent-bound
|
|
53
|
-
* target wall are judged at the `capacity()` call.
|
|
54
|
-
*/
|
|
55
40
|
interface CapacityWindow<S extends CapacityWindowSpec = CapacityWindowSpec> {
|
|
56
41
|
readonly window: S;
|
|
57
42
|
readonly [admitted]: true;
|
|
58
43
|
}
|
|
59
|
-
/**
|
|
60
|
-
* An admitted measure — `weigh()`'s product, the `[w]` bracket of the
|
|
61
|
-
* operator. The spec is carried at its exact type so the u64/interval
|
|
62
|
-
* source wall ({@link WeightOnSource}) reads the weighed field's name off
|
|
63
|
-
* the value.
|
|
64
|
-
*/
|
|
65
44
|
interface CapacityWeight<S extends WeightSpec = WeightSpec> {
|
|
66
45
|
readonly weight: S;
|
|
67
46
|
readonly [admitted]: true;
|
|
68
47
|
}
|
|
69
|
-
/**
|
|
70
|
-
* A dependent bound naming a u64 field of the TARGET row — `ref()`'s
|
|
71
|
-
* product, legal in `within()`'s hi slot only (C6: a dependent floor has
|
|
72
|
-
* no use case; inversion with idents is unrepresentable). Carries no
|
|
73
|
-
* value: bounds resolve per target row at judge time.
|
|
74
|
-
*/
|
|
75
48
|
interface FieldRef<F extends string = string> {
|
|
76
49
|
readonly kind: "field";
|
|
77
50
|
readonly field: F;
|
|
78
51
|
}
|
|
79
|
-
/**
|
|
80
|
-
* A dependent interval-measure bound (`Duration(field)` of the TARGET
|
|
81
|
-
* row), or — handed to `weigh()` — the interval-measure weight of the
|
|
82
|
-
* SOURCE row. One mint, both slots: the interval enters through the
|
|
83
|
-
* measure argument, never the group key.
|
|
84
|
-
*/
|
|
85
52
|
interface DurationRef<F extends string = string> {
|
|
86
53
|
readonly kind: "durationField";
|
|
87
54
|
readonly field: F;
|
|
88
55
|
}
|
|
89
|
-
/** Narrows any value to an admitted capacity window through the module-private brand. */
|
|
90
56
|
declare function isCapacityWindow(value: unknown): value is CapacityWindow;
|
|
91
|
-
/** Narrows any value to an admitted capacity weight through the module-private brand. */
|
|
92
57
|
declare function isCapacityWeight(value: unknown): value is CapacityWeight;
|
|
93
|
-
/**
|
|
94
|
-
* The legible banned-spelling verdict: intersected into a mint's parameter
|
|
95
|
-
* when the LITERAL argument spells a banned window, naming the canonical
|
|
96
|
-
* form — the compile-time face of the ban table.
|
|
97
|
-
*/
|
|
98
58
|
interface BannedWindow<Canonical extends string> {
|
|
99
59
|
readonly "banned window spelling — the canonical-utterance law names the one legal form": Canonical;
|
|
100
60
|
}
|
|
@@ -106,7 +66,6 @@ interface BannedWindow<Canonical extends string> {
|
|
|
106
66
|
interface RefusedPath<Idiom extends string> {
|
|
107
67
|
readonly "path spelling refused — the vocabulary is closed at the row": Idiom;
|
|
108
68
|
}
|
|
109
|
-
/** `true` exactly when the literal bigint `N` is negative (out of the u64 bound domain). */
|
|
110
69
|
type IsNegative<N extends bigint> = `${N}` extends `-${string}` ? true : false;
|
|
111
70
|
/**
|
|
112
71
|
* The dotted-name ban, both mints: a `a.b` spelling is a typed refusal
|
|
@@ -115,43 +74,23 @@ type IsNegative<N extends bigint> = `${N}` extends `-${string}` ? true : false;
|
|
|
115
74
|
* name the local field.
|
|
116
75
|
*/
|
|
117
76
|
type PathBan<F extends string> = string extends F ? unknown : F extends `${string}.${string}` ? RefusedPath<"pin the column — a two-column containment (Source(ref, f) <= Catalog(id, f)) proves the local copy, then name the local field"> : unknown;
|
|
118
|
-
/** The ban verdict on a single bound: negatives are out of the u64 domain. */
|
|
119
77
|
type NegativeBan<N extends bigint> = bigint extends N ? unknown : IsNegative<N> extends true ? BannedWindow<"capacity bounds are u64 — a negative bound is out of domain"> : unknown;
|
|
120
|
-
/**
|
|
121
|
-
* The ban verdict on `within(lo, "*")`: `{0..*}` is vacuous —
|
|
122
|
-
* weight-independent (sums are ≥ 0). `{1..*}` is NOT judged here: the ban
|
|
123
|
-
* is weight-sensitive (Count-instance only) and rides the `capacity()`
|
|
124
|
-
* unit overload ({@link UnitWindowBan}).
|
|
125
|
-
*/
|
|
126
78
|
type FloorBan<N extends bigint> = bigint extends N ? unknown : IsNegative<N> extends true ? BannedWindow<"capacity bounds are u64 — a negative bound is out of domain"> : N extends 0n ? BannedWindow<"`{0..*}` is vacuous — it provably says nothing; delete the statement"> : unknown;
|
|
127
|
-
/**
|
|
128
|
-
* The ban verdict on `within(lo, hi)` with both literals known: `{n..n}`
|
|
129
|
-
* is the exact measure respelled (`within(n)`, or `within(0n)` at 0) —
|
|
130
|
-
* weight-independent canonical policing. Bound ORDER (`{hi..lo}` inverted)
|
|
131
|
-
* is not type-expressible — bigint literals have no type-level comparison
|
|
132
|
-
* — so inversion stays a construction error.
|
|
133
|
-
*/
|
|
134
79
|
type RangeBan<Lo extends bigint, Hi extends bigint> = bigint extends Lo ? unknown : bigint extends Hi ? unknown : IsNegative<Lo> extends true ? BannedWindow<"capacity bounds are u64 — a negative bound is out of domain"> : IsNegative<Hi> extends true ? BannedWindow<"capacity bounds are u64 — a negative bound is out of domain"> : Lo extends Hi ? Hi extends Lo ? Lo extends 0n ? BannedWindow<"`{0..0}` — the point window is written `{0}`: use within(0n)"> : BannedWindow<"`{n..n}` — an exact measure is written `{n}`: use within(n)"> : unknown : unknown;
|
|
135
|
-
/**
|
|
136
|
-
* The weight-SENSITIVE ban row, judged at the `capacity()` call where the
|
|
137
|
-
* aggregate instance is known (design § 6): on the UNIT overload a
|
|
138
|
-
* `{1..*}` floor says only what the bare containment says
|
|
139
|
-
* (`window_floor_containment`) and is banned naming `contained`; on the
|
|
140
|
-
* weighted overload the same window is LEGAL — "positive total" admits
|
|
141
|
-
* zero-weight rows and is a different, weaker law.
|
|
142
|
-
*/
|
|
143
80
|
type UnitWindowBan<W extends CapacityWindow> = W["window"] extends {
|
|
144
81
|
readonly kind: "floor";
|
|
145
82
|
readonly lo: {
|
|
146
83
|
readonly kind: "lit";
|
|
147
84
|
readonly value: 1n;
|
|
148
85
|
};
|
|
149
|
-
} ? BannedWindow<"`{1..*}` on the unit instance says only what the bare containment says — write contained(source, target)"> :
|
|
86
|
+
} ? BannedWindow<"`{1..*}` on the unit instance says only what the bare containment says — write contained(source, target)"> : W["window"] extends {
|
|
87
|
+
readonly kind: "floor";
|
|
88
|
+
} ? BannedWindow<"`{N..*}` on the unit instance — a bare count floor is refused; weigh the source (`<=[w]{N..*}` stays legal) or drop the bound"> : unknown;
|
|
150
89
|
/**
|
|
151
90
|
* The C18 dimension gate's ban row, unit instance (the engine's
|
|
152
91
|
* `CapacityDimensionMixing` twin, ruled 2026-07-24): a unit (count)
|
|
153
|
-
* window against a `duration
|
|
154
|
-
* time — a dimension error. Judged on the `capacity
|
|
92
|
+
* window against a `duration` bound counts facts against a span of
|
|
93
|
+
* time — a dimension error. Judged on the `capacity` UNIT overload
|
|
155
94
|
* only: Duration weights pair with Duration-capable bounds, so the
|
|
156
95
|
* weighted overload takes the same window freely.
|
|
157
96
|
*/
|
|
@@ -160,57 +99,31 @@ type UnitDimensionBan<W extends CapacityWindow> = W["window"] extends {
|
|
|
160
99
|
readonly kind: "durationField";
|
|
161
100
|
};
|
|
162
101
|
} ? BannedWindow<"a count of facts bounded by a span of time mixes dimensions (C18) — weigh the source with weigh(duration(field)), or bound by a u64 field or literal"> : unknown;
|
|
163
|
-
/** The projected kind of one field of a face's source, read off the schema type. */
|
|
164
102
|
type KindAt<S extends FaceSource, K extends string> = ProjectedShape<S, K> extends readonly [infer Kind, ...unknown[]] ? Kind : undefined;
|
|
165
|
-
/**
|
|
166
|
-
* The legible off-roster verdict for a dependent bound: bound names
|
|
167
|
-
* resolve against the TARGET's full field roster (C1 — the written
|
|
168
|
-
* projection tuple stays the pure grouping key), and the verdict names
|
|
169
|
-
* that roster.
|
|
170
|
-
*/
|
|
171
103
|
interface BoundOffTargetRoster<K, Roster> {
|
|
172
104
|
readonly "dependent bound must name a field of the TARGET's own row — bound names resolve against the target's full roster": readonly [
|
|
173
105
|
K,
|
|
174
106
|
Roster
|
|
175
107
|
];
|
|
176
108
|
}
|
|
177
|
-
/** The legible kind-mismatch verdict for a dependent bound: `ref()` needs u64, `duration()` an interval. */
|
|
178
109
|
interface BoundKindMismatch<K, Want> {
|
|
179
110
|
readonly "dependent bound kind mismatch — ref() reads a u64 field, duration() an interval field, of the TARGET row": readonly [
|
|
180
111
|
K,
|
|
181
112
|
Want
|
|
182
113
|
];
|
|
183
114
|
}
|
|
184
|
-
/**
|
|
185
|
-
* One dependent-bound slot judged against the target face's roster and
|
|
186
|
-
* kinds. A WIDE field name (the untyped-caller path — literal identity
|
|
187
|
-
* already lost) passes the type tier and is judged at construction.
|
|
188
|
-
*/
|
|
189
115
|
type BoundOnTarget<K extends string, Want extends "u64" | "interval", B extends AnyFace> = string extends K ? unknown : K extends FaceFields<B["source"]> ? KindAt<B["source"], K> extends Want ? unknown : BoundKindMismatch<K, Want> : BoundOffTargetRoster<K, FaceFields<B["source"]>>;
|
|
190
|
-
/**
|
|
191
|
-
* The dependent-bound target wall (type tier): for a `ref(K)` bound in the
|
|
192
|
-
* window's hi slot, `K` must name a u64 field of the TARGET face's own
|
|
193
|
-
* row; for a `duration(K)` bound, an interval field. Literal-bound windows
|
|
194
|
-
* pass untouched. The runtime twin for untyped callers lives at the
|
|
195
|
-
* `capacity()` construction (`statements.ts`).
|
|
196
|
-
*/
|
|
197
116
|
type BoundsOnTarget<W extends CapacityWindow, B extends AnyFace> = W["window"] extends {
|
|
198
117
|
readonly hi: FieldRef<infer K>;
|
|
199
118
|
} ? BoundOnTarget<K, "u64", B> : W["window"] extends {
|
|
200
119
|
readonly hi: DurationRef<infer K>;
|
|
201
120
|
} ? BoundOnTarget<K, "interval", B> : unknown;
|
|
202
|
-
/** The legible off-roster verdict for a weight: the vocabulary is closed at the SOURCE row. */
|
|
203
121
|
interface WeightOffSourceRoster<K, Roster> {
|
|
204
122
|
readonly "weight must name a field of the SOURCE's own row — the weight vocabulary is closed at the row": readonly [
|
|
205
123
|
K,
|
|
206
124
|
Roster
|
|
207
125
|
];
|
|
208
126
|
}
|
|
209
|
-
/**
|
|
210
|
-
* The legible kind-mismatch verdict for a weight: a signed weight would
|
|
211
|
-
* break the polarity scheduler (an insert could lower a sum), so the
|
|
212
|
-
* illegal weight is unrepresentable, not checked.
|
|
213
|
-
*/
|
|
214
127
|
interface WeightKindMismatch<K, Want> {
|
|
215
128
|
readonly "weight kind mismatch — weigh(field) reads a u64 field, weigh(duration(field)) an interval field, of the SOURCE row": readonly [
|
|
216
129
|
K,
|
|
@@ -221,7 +134,7 @@ interface WeightKindMismatch<K, Want> {
|
|
|
221
134
|
* The weight source wall (type tier): `weigh(K)`'s field must be a
|
|
222
135
|
* u64-encoded position of the SOURCE face's own row (signed encodings are
|
|
223
136
|
* the typed polarity refusal), `weigh(duration(K))`'s an interval
|
|
224
|
-
* position. Checked at the `capacity
|
|
137
|
+
* position. Checked at the `capacity` call where the source face is
|
|
225
138
|
* inferred — the proven constrain-after-inference pattern.
|
|
226
139
|
*/
|
|
227
140
|
type WeightOnSource<M extends CapacityWeight, A extends AnyFace> = M["weight"] extends {
|
|
@@ -231,13 +144,7 @@ type WeightOnSource<M extends CapacityWeight, A extends AnyFace> = M["weight"] e
|
|
|
231
144
|
readonly kind: "durationField";
|
|
232
145
|
readonly field: infer K extends string;
|
|
233
146
|
} ? string extends K ? unknown : K extends FaceFields<A["source"]> ? KindAt<A["source"], K> extends "interval" ? unknown : WeightKindMismatch<K, "interval"> : WeightOffSourceRoster<K, FaceFields<A["source"]>> : unknown;
|
|
234
|
-
/** The unit weight — a case, not an absence (C4): the count instance's one wire spelling. */
|
|
235
147
|
declare const unitWeight: WeightSpec;
|
|
236
|
-
/**
|
|
237
|
-
* `{n}` — THE exact-measure spelling; `within(0n)` IS the exclusion's one
|
|
238
|
-
* spelling on the unit instance, and the weaker "total is zero" law on a
|
|
239
|
-
* weighted one (zero-weight rows may exist — design § 6, stated loudly).
|
|
240
|
-
*/
|
|
241
148
|
declare function within<const N extends bigint>(n: N & NegativeBan<N>): CapacityWindow<{
|
|
242
149
|
readonly kind: "exact";
|
|
243
150
|
readonly n: {
|
|
@@ -245,12 +152,6 @@ declare function within<const N extends bigint>(n: N & NegativeBan<N>): Capacity
|
|
|
245
152
|
readonly value: N;
|
|
246
153
|
};
|
|
247
154
|
}>;
|
|
248
|
-
/**
|
|
249
|
-
* `{lo..*}` — a floor with no ceiling. `within(0n, "*")` is vacuous
|
|
250
|
-
* (unwritable as a literal); `within(1n, "*")` constructs — the `{1..*}`
|
|
251
|
-
* ban is weight-sensitive and judged at the `capacity()` call (unit
|
|
252
|
-
* instance only).
|
|
253
|
-
*/
|
|
254
155
|
declare function within<const Lo extends bigint>(lo: Lo & FloorBan<Lo>, hi: "*"): CapacityWindow<{
|
|
255
156
|
readonly kind: "floor";
|
|
256
157
|
readonly lo: {
|
|
@@ -272,13 +173,6 @@ declare function within<const Lo extends bigint, const R extends FieldRef | Dura
|
|
|
272
173
|
};
|
|
273
174
|
readonly hi: R;
|
|
274
175
|
}>;
|
|
275
|
-
/**
|
|
276
|
-
* `{lo..hi}` — both bounds explicit, lo < hi; `within(0n, hi)` is the
|
|
277
|
-
* canonical ceiling. `lo === hi` is the exact measure respelled
|
|
278
|
-
* (unwritable as literals — {@link RangeBan} names `within(n)`), rejected
|
|
279
|
-
* at construction when computed; an inverted window is unsatisfiable and
|
|
280
|
-
* rejected at construction (bigint literals carry no type-level order).
|
|
281
|
-
*/
|
|
282
176
|
declare function within<const Lo extends bigint, const Hi extends bigint>(lo: Lo, hi: Hi & RangeBan<Lo, Hi>): CapacityWindow<{
|
|
283
177
|
readonly kind: "range";
|
|
284
178
|
readonly lo: {
|
|
@@ -304,17 +198,11 @@ declare function weigh<const F extends string>(measure: DurationRef<F>): Capacit
|
|
|
304
198
|
readonly kind: "durationField";
|
|
305
199
|
readonly field: F;
|
|
306
200
|
}>;
|
|
307
|
-
/**
|
|
308
|
-
* A dependent bound by name — `within(0n, ref("supply"))` reads each
|
|
309
|
-
* group's ceiling from the TARGET row's u64 field (bound names resolve
|
|
310
|
-
* against the target's FULL roster, C1 — the projection tuple stays the
|
|
311
|
-
* pure grouping key). Carries no value.
|
|
312
|
-
*/
|
|
313
201
|
declare function ref<const F extends string>(field: F & PathBan<F>): FieldRef<F>;
|
|
314
202
|
/**
|
|
315
203
|
* `Duration(field)` — the interval-measure spelling, one mint for both
|
|
316
|
-
* slots: handed to `weigh
|
|
317
|
-
* in `within
|
|
204
|
+
* slots: handed to `weigh` it is the SOURCE row's interval measure;
|
|
205
|
+
* in `within`'s hi slot it is the TARGET row's interval-measure bound
|
|
318
206
|
* (Duration weights pair with Duration-capable bounds — C18).
|
|
319
207
|
*/
|
|
320
208
|
declare function duration<const F extends string>(field: F & PathBan<F>): DurationRef<F>;
|
package/dist/capacity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capacity.d.ts","sourceRoot":"","sources":["../src/capacity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,KAAK,EAAqB,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEjF
|
|
1
|
+
{"version":3,"file":"capacity.d.ts","sourceRoot":"","sources":["../src/capacity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,KAAK,EAAqB,kBAAkB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEjF,QAAA,MAAM,QAAQ,EAAE,OAAO,MAA6C,CAAA;AAEpE,UAAU,cAAc,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IACzE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAClB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CACzB;AAED,UAAU,cAAc,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IACzD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAClB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CACzB;AAED,UAAU,QAAQ,CAAC,CAAC,SAAS,MAAM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OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAE/E;AAED,YAAY,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,CAAA;AACD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/capacity.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Capacity-law mints — the window, weight, and dependent-bound vocabulary
|
|
3
|
-
* the one `capacity
|
|
4
|
-
*
|
|
5
|
-
* around the aggregate form). `within
|
|
3
|
+
* the one `capacity` statement constructor consumes
|
|
4
|
+
* § the canonical-utterance law, restated
|
|
5
|
+
* around the aggregate form). `within` is the ONE window spelling —
|
|
6
6
|
* `within(n)` exact (`within(0n)` IS the exclusion's one spelling),
|
|
7
7
|
* `within(lo, hi)` range (`within(0n, hi)` the canonical ceiling),
|
|
8
|
-
* `within(lo, "*")` floor — `weigh
|
|
8
|
+
* `within(lo, "*")` floor — `weigh` names the measure on the SOURCE row
|
|
9
9
|
* (`weigh("watts")` a u64 field, `weigh(duration("booked"))` an interval's
|
|
10
|
-
* measure), and `ref
|
|
10
|
+
* measure), and `ref`/`duration` read a dependent bound from the
|
|
11
11
|
* TARGET row (hi slot only — ruled 2026-07-24, C6). The ban table is
|
|
12
12
|
* enforced REPRESENTATIONALLY in two tiers, split per-aggregate where
|
|
13
13
|
* weight-sensitive (design § 6: a ban is canonical-utterance policing when
|
|
14
14
|
* it is weight-independent, semantic deduplication when it is not):
|
|
15
15
|
*
|
|
16
16
|
* - **The type tier**: a banned spelling written as a LITERAL does not
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
17
|
+
* compile — every negative bound, `within(n, n)`, `within(0n, 0n)`, and
|
|
18
|
+
* `within(0n, "*")` are type errors naming the canonical form. The
|
|
19
|
+
* weight-SENSITIVE row rides the `capacity` overloads themselves:
|
|
20
|
+
* `within(1n, "*")` is banned on the unit overload only (`{1..*}` on the
|
|
21
|
+
* count instance is the bare containment respelled —
|
|
22
|
+
* `window_floor_containment`), and LEGAL on the weighted one ("positive
|
|
23
|
+
* total" is not an existence claim over rows).
|
|
24
24
|
* - **The construction tier**: a bound the type level cannot judge — a
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* COMPUTED `bigint`, or an inverted `within(lo, hi)` order — is judged at
|
|
26
|
+
* construction with the same canonical-naming errors; and past both
|
|
27
|
+
* tiers the engine's own spec validation remains the law for a hostile
|
|
28
|
+
* FFI caller (the standing two-tier ban enforcement).
|
|
29
29
|
*
|
|
30
30
|
* The weight vocabulary is closed at the row (ruled 2026-07-24, ruling 6):
|
|
31
31
|
* a path weight (`weigh("model.watts")`) is a typed refusal at BOTH tiers
|
|
@@ -35,39 +35,24 @@
|
|
|
35
35
|
* back as `bigint` too (u128-wide engine accumulator, C3).
|
|
36
36
|
*/
|
|
37
37
|
import * as errors from "@superbuilders/errors";
|
|
38
|
-
/**
|
|
39
|
-
* The admission brand — a module-private symbol, deliberately unexported
|
|
40
|
-
* (the standing statement-mint pattern): `CapacityWindowSpec` and
|
|
41
|
-
* `WeightSpec` are public wire types, so without this brand every banned
|
|
42
|
-
* spelling in the ban table would be writable as a plain object literal.
|
|
43
|
-
* The symbol makes `within()` and `weigh()` the ONLY producers of the
|
|
44
|
-
* values `capacity()` accepts, which is what "the ban table is unwritable"
|
|
45
|
-
* means.
|
|
46
|
-
*/
|
|
47
38
|
const admitted = Symbol("bumbledb.capacity.admitted");
|
|
48
|
-
/** Narrows any value to an admitted capacity window through the module-private brand. */
|
|
49
39
|
function isCapacityWindow(value) {
|
|
50
40
|
return typeof value === "object" && value !== null && admitted in value && "window" in value;
|
|
51
41
|
}
|
|
52
|
-
/** Narrows any value to an admitted capacity weight through the module-private brand. */
|
|
53
42
|
function isCapacityWeight(value) {
|
|
54
43
|
return typeof value === "object" && value !== null && admitted in value && "weight" in value;
|
|
55
44
|
}
|
|
56
|
-
/** The unit weight — a case, not an absence (C4): the count instance's one wire spelling. */
|
|
57
45
|
const unitWeight = Object.freeze({ kind: "unit" });
|
|
58
|
-
/** The construction-tier twin of {@link PathBan}: a dotted name refuses naming the idiom. */
|
|
59
46
|
function assertRowLocal(field, role) {
|
|
60
47
|
if (field.includes(".")) {
|
|
61
48
|
throw errors.new(`${role} \`${field}\` walks a reference — the vocabulary is closed at the row (ruling 6): pin the column with a two-column containment (Source(ref, f) <= Catalog(id, f)) and name the local field`);
|
|
62
49
|
}
|
|
63
50
|
return field;
|
|
64
51
|
}
|
|
65
|
-
/** Stamps one admitted window spec as a frozen branded value. */
|
|
66
52
|
function admitWindow(window) {
|
|
67
53
|
const value = { window, [admitted]: true };
|
|
68
54
|
return Object.freeze(value);
|
|
69
55
|
}
|
|
70
|
-
/** One literal bound. */
|
|
71
56
|
function lit(value) {
|
|
72
57
|
return Object.freeze({ kind: "lit", value });
|
|
73
58
|
}
|
|
@@ -105,7 +90,6 @@ function within(lo, hi) {
|
|
|
105
90
|
}
|
|
106
91
|
return admitWindow({ kind: "range", lo: lit(lo), hi: Object.freeze({ kind: "field", field }) });
|
|
107
92
|
}
|
|
108
|
-
/** Stamps one admitted weight spec as a frozen branded value. */
|
|
109
93
|
function admitWeight(weight) {
|
|
110
94
|
const value = { weight, [admitted]: true };
|
|
111
95
|
return Object.freeze(value);
|
|
@@ -116,19 +100,13 @@ function weigh(measure) {
|
|
|
116
100
|
}
|
|
117
101
|
return admitWeight({ kind: "durationField", field: assertRowLocal(measure.field, "weight") });
|
|
118
102
|
}
|
|
119
|
-
/**
|
|
120
|
-
* A dependent bound by name — `within(0n, ref("supply"))` reads each
|
|
121
|
-
* group's ceiling from the TARGET row's u64 field (bound names resolve
|
|
122
|
-
* against the target's FULL roster, C1 — the projection tuple stays the
|
|
123
|
-
* pure grouping key). Carries no value.
|
|
124
|
-
*/
|
|
125
103
|
function ref(field) {
|
|
126
104
|
return Object.freeze({ kind: "field", field: assertRowLocal(field, "dependent bound") });
|
|
127
105
|
}
|
|
128
106
|
/**
|
|
129
107
|
* `Duration(field)` — the interval-measure spelling, one mint for both
|
|
130
|
-
* slots: handed to `weigh
|
|
131
|
-
* in `within
|
|
108
|
+
* slots: handed to `weigh` it is the SOURCE row's interval measure;
|
|
109
|
+
* in `within`'s hi slot it is the TARGET row's interval-measure bound
|
|
132
110
|
* (Duration weights pair with Duration-capable bounds — C18).
|
|
133
111
|
*/
|
|
134
112
|
function duration(field) {
|
package/dist/capacity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capacity.js","sourceRoot":"","sources":["../src/capacity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAI/C
|
|
1
|
+
{"version":3,"file":"capacity.js","sourceRoot":"","sources":["../src/capacity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAI/C,MAAM,QAAQ,GAAkB,MAAM,CAAC,4BAA4B,CAAC,CAAA;AAsBpE,SAAS,gBAAgB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAA;AAC7F,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,IAAI,QAAQ,IAAI,KA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