@bjornpagen/bumbledb 0.6.0 → 0.8.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 +150 -9
- package/README.md +18 -5
- package/dist/capacity.d.ts +310 -0
- package/dist/capacity.d.ts.map +1 -0
- package/dist/capacity.js +138 -0
- package/dist/capacity.js.map +1 -0
- 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/db.d.ts +115 -76
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +178 -122
- 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 +11 -7
- 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 +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/law.d.ts +3 -2
- package/dist/law.d.ts.map +1 -1
- package/dist/law.js +1 -1
- package/dist/law.js.map +1 -1
- package/dist/lower.d.ts +9 -9
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +20 -14
- 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 +66 -12
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js.map +1 -1
- package/dist/query/atom.d.ts +72 -7
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +12 -9
- package/dist/query/atom.js.map +1 -1
- package/dist/query/lower.d.ts +8 -0
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +80 -13
- package/dist/query/lower.js.map +1 -1
- package/dist/query/run.d.ts +5 -5
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +7 -12
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +15 -5
- package/dist/query/scope.d.ts.map +1 -1
- 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 +95 -32
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js +39 -7
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +62 -25
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +105 -22
- package/dist/statements.js.map +1 -1
- package/package.json +3 -3
- package/src/capacity.ts +454 -0
- package/src/closed.ts +13 -7
- package/src/db.ts +302 -184
- package/src/exhume.ts +48 -11
- package/src/face.ts +14 -6
- package/src/fields.ts +51 -15
- package/src/index.ts +20 -9
- package/src/law.ts +3 -2
- package/src/lower.ts +20 -14
- package/src/marshal.ts +38 -13
- package/src/native.ts +65 -11
- package/src/query/atom.ts +119 -15
- package/src/query/lower.ts +117 -15
- package/src/query/run.ts +7 -12
- package/src/query/scope.ts +15 -6
- package/src/relation.ts +3 -1
- package/src/schema.ts +14 -2
- package/src/spec.ts +112 -34
- package/src/statements.ts +188 -38
- package/dist/count.d.ts +0 -102
- package/dist/count.d.ts.map +0 -1
- package/dist/count.js +0 -115
- package/dist/count.js.map +0 -1
- package/src/count.ts +0 -211
package/dist/spec.d.ts
CHANGED
|
@@ -96,10 +96,10 @@ type LiteralSetSpec = {
|
|
|
96
96
|
readonly literals: readonly LiteralSpec[];
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
|
-
* One side of a containment or
|
|
100
|
-
* all names. `projection` is π in the
|
|
101
|
-
* pairing with the other side);
|
|
102
|
-
* pairs, read conjunctively.
|
|
99
|
+
* One side of a containment or capacity statement:
|
|
100
|
+
* `R(fields… | field == literal…)`, all names. `projection` is π in the
|
|
101
|
+
* statement's written order (positional pairing with the other side);
|
|
102
|
+
* `selection` is σ as (field, literal-or-set) pairs, read conjunctively.
|
|
103
103
|
*/
|
|
104
104
|
interface SideSpec {
|
|
105
105
|
readonly relation: string;
|
|
@@ -107,22 +107,58 @@ interface SideSpec {
|
|
|
107
107
|
readonly selection: ReadonlyArray<readonly [string, LiteralSetSpec]>;
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
110
|
+
* One capacity bound: a non-negative literal, a u64 field of the TARGET
|
|
111
|
+
* row (the dependent bound — per-group capacity read at judge time), or
|
|
112
|
+
* the interval-measure of a TARGET-row field (`Duration(span)`). Names,
|
|
113
|
+
* not ids — the spec is the name-level wire; the engine resolves bound
|
|
114
|
+
* names against the target's FULL roster (C1), never the projection.
|
|
115
115
|
*/
|
|
116
|
-
type
|
|
116
|
+
type CapacityBoundSpec = {
|
|
117
|
+
readonly kind: "lit";
|
|
118
|
+
readonly value: bigint;
|
|
119
|
+
} | {
|
|
120
|
+
readonly kind: "field";
|
|
121
|
+
readonly field: string;
|
|
122
|
+
} | {
|
|
123
|
+
readonly kind: "durationField";
|
|
124
|
+
readonly field: string;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* A capacity statement's weight — a TOTAL sum (C4: `unit` is a case, not
|
|
128
|
+
* an absence): the count instance (`unit`), a u64 field of the SOURCE row
|
|
129
|
+
* (`field`), or a SOURCE-row interval's measure (`durationField`). The
|
|
130
|
+
* wire always carries it — a unit statement crosses as `{ kind: "unit" }`,
|
|
131
|
+
* never by omission.
|
|
132
|
+
*/
|
|
133
|
+
type WeightSpec = {
|
|
134
|
+
readonly kind: "unit";
|
|
135
|
+
} | {
|
|
136
|
+
readonly kind: "field";
|
|
137
|
+
readonly field: string;
|
|
138
|
+
} | {
|
|
139
|
+
readonly kind: "durationField";
|
|
140
|
+
readonly field: string;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* A capacity statement's window — the canonical-utterance law's surviving
|
|
144
|
+
* spellings, per-aggregate where weight-sensitive (design § 6), since the
|
|
145
|
+
* SDK's `within()` mint makes every banned spelling unwritable or a
|
|
146
|
+
* construction error: `exact` is `{n}` (`{0}` the exclusion on the unit
|
|
147
|
+
* instance, "total is zero" on a weighted one), `range` is `{lo..hi}` with
|
|
148
|
+
* lo < hi (`{0..hi}` the canonical ceiling; the hi slot admits a dependent
|
|
149
|
+
* bound — C6: hi only), `floor` is `{lo..*}` (`{1..*}` legal on weighted
|
|
150
|
+
* statements only).
|
|
151
|
+
*/
|
|
152
|
+
type CapacityWindowSpec = {
|
|
117
153
|
readonly kind: "exact";
|
|
118
|
-
readonly n:
|
|
154
|
+
readonly n: CapacityBoundSpec;
|
|
119
155
|
} | {
|
|
120
156
|
readonly kind: "range";
|
|
121
|
-
readonly lo:
|
|
122
|
-
readonly hi:
|
|
157
|
+
readonly lo: CapacityBoundSpec;
|
|
158
|
+
readonly hi: CapacityBoundSpec;
|
|
123
159
|
} | {
|
|
124
160
|
readonly kind: "floor";
|
|
125
|
-
readonly lo:
|
|
161
|
+
readonly lo: CapacityBoundSpec;
|
|
126
162
|
};
|
|
127
163
|
/**
|
|
128
164
|
* One field: name, structural type, host newtype name — the field's
|
|
@@ -145,26 +181,38 @@ interface RowSpec {
|
|
|
145
181
|
readonly values: readonly LiteralSpec[];
|
|
146
182
|
}
|
|
147
183
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* `` `${name}.id` `` — the same label every referencing field
|
|
154
|
-
* law),
|
|
184
|
+
* A relation's closedness as ONE sum (ruled 2026-07-23, R7): the handle
|
|
185
|
+
* newtype and the ground axioms travel together — the two illegal states
|
|
186
|
+
* (a roster without its newtype, a newtype without its roster) are
|
|
187
|
+
* unspellable on the wire exactly as they are unrepresentable in the
|
|
188
|
+
* fused Rust `RelationSpec`. `newtype` is the id's law-computed generator
|
|
189
|
+
* class (`` `${name}.id` `` — the same label every referencing field
|
|
190
|
+
* carries by law), which is how the engine resolves a handle literal back
|
|
191
|
+
* to its roster.
|
|
192
|
+
*/
|
|
193
|
+
interface ClosedSpec {
|
|
194
|
+
readonly newtype: string;
|
|
195
|
+
readonly rows: readonly RowSpec[];
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* One relation. A present `closed` declares it closed (the option is the
|
|
199
|
+
* kind, one sum — R7); a closed relation's `fields` are its declared
|
|
200
|
+
* intrinsic columns only — the synthetic (`id`, u64) handle field is
|
|
201
|
+
* materialized by the engine's schema validation.
|
|
155
202
|
*/
|
|
156
203
|
interface RelationSpec {
|
|
157
204
|
readonly name: string;
|
|
158
|
-
readonly newtype: string | undefined;
|
|
159
205
|
readonly fields: readonly FieldSpec[];
|
|
160
|
-
readonly
|
|
206
|
+
readonly closed: ClosedSpec | undefined;
|
|
161
207
|
}
|
|
162
208
|
/**
|
|
163
209
|
* One dependency statement, tagged by form. `==` is not a variant: a
|
|
164
210
|
* bidirectional containment is `containment` with `bidirectional: true`,
|
|
165
211
|
* lowered by the engine to the two adjacent containments (`source <=
|
|
166
|
-
* target` first). `
|
|
167
|
-
* per-group parent, the source
|
|
212
|
+
* target` first). `capacity` reads as the operator does (C2 — target,
|
|
213
|
+
* weight, window, source): the target is the per-group parent, the source
|
|
214
|
+
* is the weighed side, and the weight is ALWAYS present (`unit` the count
|
|
215
|
+
* instance).
|
|
168
216
|
*/
|
|
169
217
|
type StatementSpec = {
|
|
170
218
|
readonly kind: "fd";
|
|
@@ -176,9 +224,10 @@ type StatementSpec = {
|
|
|
176
224
|
readonly target: SideSpec;
|
|
177
225
|
readonly bidirectional: boolean;
|
|
178
226
|
} | {
|
|
179
|
-
readonly kind: "
|
|
227
|
+
readonly kind: "capacity";
|
|
180
228
|
readonly target: SideSpec;
|
|
181
|
-
readonly
|
|
229
|
+
readonly weight: WeightSpec;
|
|
230
|
+
readonly window: CapacityWindowSpec;
|
|
182
231
|
readonly source: SideSpec;
|
|
183
232
|
};
|
|
184
233
|
/**
|
|
@@ -211,11 +260,25 @@ declare function renderLiteral(literal: LiteralSpec): string;
|
|
|
211
260
|
*/
|
|
212
261
|
declare function renderLiteralSet(set: LiteralSetSpec): string;
|
|
213
262
|
/**
|
|
214
|
-
* Renders
|
|
263
|
+
* Renders one capacity bound in its one canonical spelling: a literal as
|
|
264
|
+
* digits, a dependent bound bare by field name, an interval-measure bound
|
|
265
|
+
* as `Duration(field)` — the spellings the engine's renderer emits.
|
|
266
|
+
*/
|
|
267
|
+
declare function renderCapacityBound(bound: CapacityBoundSpec): string;
|
|
268
|
+
/**
|
|
269
|
+
* Renders a capacity window in its one canonical spelling: `{n}` exact
|
|
215
270
|
* (`{0}` the exclusion), `{lo..hi}`, `{lo..*}` — the spelling set the
|
|
216
|
-
* engine's renderer emits for sealed statements
|
|
271
|
+
* engine's renderer emits for sealed statements, bounds through
|
|
272
|
+
* {@link renderCapacityBound}.
|
|
273
|
+
*/
|
|
274
|
+
declare function renderCapacityWindow(window: CapacityWindowSpec): string;
|
|
275
|
+
/**
|
|
276
|
+
* Renders a capacity weight as the operator's bracket: the unit weight
|
|
277
|
+
* renders NOTHING — the count utterance `<={lo..hi}` falls out of the one
|
|
278
|
+
* printer, never a second "legacy" arm — a field weight as `[field]`, an
|
|
279
|
+
* interval measure as `[Duration(field)]`.
|
|
217
280
|
*/
|
|
218
|
-
declare function
|
|
219
|
-
export type { FieldSpec, LiteralSetSpec, LiteralSpec, RelationSpec, RowSpec, SchemaSpec, SideSpec, StatementSpec, ValueSpec, ValueTypeSpec,
|
|
220
|
-
export { renderLiteral, renderLiteralSet,
|
|
281
|
+
declare function renderWeight(weight: WeightSpec): string;
|
|
282
|
+
export type { CapacityBoundSpec, CapacityWindowSpec, ClosedSpec, FieldSpec, LiteralSetSpec, LiteralSpec, RelationSpec, RowSpec, SchemaSpec, SideSpec, StatementSpec, ValueSpec, ValueTypeSpec, WeightSpec };
|
|
283
|
+
export { renderCapacityBound, renderCapacityWindow, renderLiteral, renderLiteralSet, renderWeight };
|
|
221
284
|
//# sourceMappingURL=spec.d.ts.map
|
package/dist/spec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH,KAAK,aAAa,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACrD;IACA,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,KAAK,GAAG,KAAK,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,CAAA;AAEJ;;;;;GAKG;AACH,KAAK,SAAS,GACX;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;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G,EAAE,cAAc,GAAG,MAAM,CAKrD;AAED;;;;GAIG;AACH,iBAAS,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAS7D;AAED;;;;;GAKG;AACH,iBAAS,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAShE;AAED;;;;;GAKG;AACH,iBAAS,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAShD;AAED,YAAY,EACX,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,aAAa,EACb,UAAU,EACV,CAAA;AACD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/spec.js
CHANGED
|
@@ -136,19 +136,51 @@ function renderLiteralSet(set) {
|
|
|
136
136
|
return `{${set.literals.map(renderLiteral).join(", ")}}`;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Renders
|
|
139
|
+
* Renders one capacity bound in its one canonical spelling: a literal as
|
|
140
|
+
* digits, a dependent bound bare by field name, an interval-measure bound
|
|
141
|
+
* as `Duration(field)` — the spellings the engine's renderer emits.
|
|
142
|
+
*/
|
|
143
|
+
function renderCapacityBound(bound) {
|
|
144
|
+
switch (bound.kind) {
|
|
145
|
+
case "lit":
|
|
146
|
+
return bound.value.toString();
|
|
147
|
+
case "field":
|
|
148
|
+
return bound.field;
|
|
149
|
+
case "durationField":
|
|
150
|
+
return `Duration(${bound.field})`;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Renders a capacity window in its one canonical spelling: `{n}` exact
|
|
140
155
|
* (`{0}` the exclusion), `{lo..hi}`, `{lo..*}` — the spelling set the
|
|
141
|
-
* engine's renderer emits for sealed statements
|
|
156
|
+
* engine's renderer emits for sealed statements, bounds through
|
|
157
|
+
* {@link renderCapacityBound}.
|
|
142
158
|
*/
|
|
143
|
-
function
|
|
159
|
+
function renderCapacityWindow(window) {
|
|
144
160
|
switch (window.kind) {
|
|
145
161
|
case "exact":
|
|
146
|
-
return `{${window.n}}`;
|
|
162
|
+
return `{${renderCapacityBound(window.n)}}`;
|
|
147
163
|
case "range":
|
|
148
|
-
return `{${window.lo}..${window.hi}}`;
|
|
164
|
+
return `{${renderCapacityBound(window.lo)}..${renderCapacityBound(window.hi)}}`;
|
|
149
165
|
case "floor":
|
|
150
|
-
return `{${window.lo}..*}`;
|
|
166
|
+
return `{${renderCapacityBound(window.lo)}..*}`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Renders a capacity weight as the operator's bracket: the unit weight
|
|
171
|
+
* renders NOTHING — the count utterance `<={lo..hi}` falls out of the one
|
|
172
|
+
* printer, never a second "legacy" arm — a field weight as `[field]`, an
|
|
173
|
+
* interval measure as `[Duration(field)]`.
|
|
174
|
+
*/
|
|
175
|
+
function renderWeight(weight) {
|
|
176
|
+
switch (weight.kind) {
|
|
177
|
+
case "unit":
|
|
178
|
+
return "";
|
|
179
|
+
case "field":
|
|
180
|
+
return `[${weight.field}]`;
|
|
181
|
+
case "durationField":
|
|
182
|
+
return `[Duration(${weight.field})]`;
|
|
151
183
|
}
|
|
152
184
|
}
|
|
153
|
-
export { renderLiteral, renderLiteralSet,
|
|
185
|
+
export { renderCapacityBound, renderCapacityWindow, renderLiteral, renderLiteralSet, renderWeight };
|
|
154
186
|
//# sourceMappingURL=spec.js.map
|
package/dist/spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;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GAAG,CAAA;QAChF,KAAK,OAAO;YACX,OAAO,IAAI,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAA;IACjD,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,MAAkB;IACvC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,MAAM;YACV,OAAO,EAAE,CAAA;QACV,KAAK,OAAO;YACX,OAAO,IAAI,MAAM,CAAC,KAAK,GAAG,CAAA;QAC3B,KAAK,eAAe;YACnB,OAAO,aAAa,MAAM,CAAC,KAAK,IAAI,CAAA;IACtC,CAAC;AACF,CAAC;AAkBD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/statements.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Dependency statements as typed values (`docs/architecture/30-dependencies.md`
|
|
3
3
|
* owns the semantics; `docs/architecture/70-api.md` the surface): the FD key
|
|
4
4
|
* form, conditional containment, the bidirectional `==` abbreviation, and
|
|
5
|
-
* the
|
|
5
|
+
* the capacity statement. A statement value is opaque and inert — no
|
|
6
6
|
* methods, no fluent continuation: a fact about the theory, not a builder.
|
|
7
7
|
*
|
|
8
8
|
* Every field reference is checked against the relation it names in the
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
* `Db.create`/`Db.open` (the two-boundary split, engine as final
|
|
34
34
|
* authority).
|
|
35
35
|
*/
|
|
36
|
-
import type
|
|
36
|
+
import { type BoundsOnTarget, type CapacityWeight, type CapacityWindow, type UnitWindowBan, type WeightOnSource } from "#capacity.ts";
|
|
37
37
|
import { type AnyFace, type FaceData, type SameArity, type SameShapes } from "#face.ts";
|
|
38
38
|
import type { AnyRelation, RelationFields } from "#relation.ts";
|
|
39
|
-
import { type
|
|
39
|
+
import { type CapacityWindowSpec, type WeightSpec } from "#spec.ts";
|
|
40
40
|
/** A `key()` statement's runtime description — owner and projection carried at exact types. */
|
|
41
41
|
interface KeyData<R extends AnyRelation, Projection extends readonly string[]> {
|
|
42
42
|
readonly kind: "key";
|
|
@@ -56,19 +56,45 @@ interface ContainmentData<Src extends FaceData = FaceData, Tgt extends FaceData
|
|
|
56
56
|
readonly target: Tgt;
|
|
57
57
|
readonly bidirectional: boolean;
|
|
58
58
|
}
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
/**
|
|
60
|
+
* A capacity statement's runtime description — target-left, in the
|
|
61
|
+
* operator's own order (C2: target, weight, window, source), faces at
|
|
62
|
+
* exact types like {@link ContainmentData}. The weight is ALWAYS present
|
|
63
|
+
* (C4 — `unit` is a case, not an absence).
|
|
64
|
+
*/
|
|
65
|
+
interface CapacityData<Tgt extends FaceData = FaceData, Src extends FaceData = FaceData> {
|
|
66
|
+
readonly kind: "capacity";
|
|
62
67
|
readonly target: Tgt;
|
|
63
|
-
readonly
|
|
68
|
+
readonly weight: WeightSpec;
|
|
69
|
+
readonly window: CapacityWindowSpec;
|
|
64
70
|
readonly source: Src;
|
|
65
71
|
}
|
|
66
72
|
/** One statement's runtime description, tagged by form. */
|
|
67
|
-
type StatementData = KeyData<AnyRelation, readonly string[]> | ContainmentData |
|
|
68
|
-
/**
|
|
73
|
+
type StatementData = KeyData<AnyRelation, readonly string[]> | ContainmentData | CapacityData;
|
|
74
|
+
/**
|
|
75
|
+
* The admission brand — a module-private symbol, deliberately unexported
|
|
76
|
+
* (the `capacity.ts` pattern): `Statement` is a public structural type, so
|
|
77
|
+
* without this brand a forged plain object of the right shape would walk
|
|
78
|
+
* past the construction-time arity and roster walls into `schema()` — and
|
|
79
|
+
* the roster wall is the one the engine cannot backstop (the wire carries
|
|
80
|
+
* plain u64s, no rosters). The symbol makes the four constructors the ONLY
|
|
81
|
+
* mints, so a statement that skipped the walls is unspellable.
|
|
82
|
+
*/
|
|
83
|
+
declare const admitted: unique symbol;
|
|
84
|
+
/** An opaque statement value — what `schema()` assembles into a theory. Only the four constructors produce one. */
|
|
69
85
|
interface Statement {
|
|
70
86
|
readonly data: StatementData;
|
|
87
|
+
readonly [admitted]: true;
|
|
71
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Narrows any value to an admitted statement — the probe is the
|
|
91
|
+
* module-private {@link admitted} brand only the four constructors set, so
|
|
92
|
+
* no host-built value (fact cells are structurally OPEN — an interval with
|
|
93
|
+
* an excess `kind` property is a legal cell) can ever be misread as one.
|
|
94
|
+
* The keyed-get selector dispatch and `schema()`'s admission both judge
|
|
95
|
+
* through here.
|
|
96
|
+
*/
|
|
97
|
+
declare function isStatement(value: unknown): value is Statement;
|
|
72
98
|
/**
|
|
73
99
|
* A containment (or `==` bijection) statement as a TYPED value: `data`
|
|
74
100
|
* carries both faces at their exact types, so the schema-level class laws
|
|
@@ -80,9 +106,9 @@ interface Statement {
|
|
|
80
106
|
interface ContainedStatement<Src extends FaceData, Tgt extends FaceData> extends Statement {
|
|
81
107
|
readonly data: ContainmentData<Src, Tgt>;
|
|
82
108
|
}
|
|
83
|
-
/** A
|
|
84
|
-
interface
|
|
85
|
-
readonly data:
|
|
109
|
+
/** A capacity statement as a TYPED value — the {@link ContainedStatement} of the capacity form. */
|
|
110
|
+
interface CapacityStatement<Tgt extends FaceData, Src extends FaceData> extends Statement {
|
|
111
|
+
readonly data: CapacityData<Tgt, Src>;
|
|
86
112
|
}
|
|
87
113
|
/**
|
|
88
114
|
* A `key()` statement as a TYPED value: its `data` carries the owner
|
|
@@ -129,27 +155,38 @@ declare function contained<A extends AnyFace, B extends AnyFace>(source: A, targ
|
|
|
129
155
|
*/
|
|
130
156
|
declare function mirrors<A extends AnyFace, B extends AnyFace>(source: A, target: B & SameArity<A, B> & SameShapes<A, B>): ContainedStatement<A["data"], B["data"]>;
|
|
131
157
|
/**
|
|
132
|
-
* `B(Y|ψ) <={window} A(X|φ)` — the
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
158
|
+
* `B(Y|ψ) <=[w]{window} A(X|φ)` — the capacity statement, the one
|
|
159
|
+
* extension form: per ψ-selected target fact, the group of φ-selected
|
|
160
|
+
* source facts sharing its key tuple must have its MEASURE (Σ weight; the
|
|
161
|
+
* unit weight IS the count instance) inside the window. READ CAREFULLY:
|
|
162
|
+
* the LEFT face is the TARGET, the per-group parent (B-family, target-left
|
|
163
|
+
* — macro parity), and the RIGHT face is the weighed source. Two
|
|
164
|
+
* overloads mirror the operator positionally (target, weight?, window,
|
|
165
|
+
* source): `capacity(on(Holder, "id"), within(0n, 3n), on(Account,
|
|
166
|
+
* "holder"))` says each Holder id groups at most three Account rows;
|
|
167
|
+
* `capacity(on(Pool, "id"), weigh("watts"), within(0n, ref("supply")),
|
|
168
|
+
* on(Device, "pool"))` bounds each pool's summed draw by the pool's own
|
|
169
|
+
* row. The two faces pair by arity AND structural shape
|
|
170
|
+
* ({@link SameShapes}), exactly as containment — the grouping join reads
|
|
171
|
+
* the same positionwise field pairing. The weight-sensitive `{1..*}` ban
|
|
172
|
+
* rides the UNIT overload only ({@link UnitWindowBan} — on a weighted
|
|
173
|
+
* statement "positive total" is a different, weaker law than containment).
|
|
140
174
|
*/
|
|
141
|
-
declare function
|
|
175
|
+
declare function capacity<B extends AnyFace, W extends CapacityWindow, A extends AnyFace>(target: B, window: W & UnitWindowBan<W> & BoundsOnTarget<W, B>, source: A & SameArity<B, A> & SameShapes<B, A>): CapacityStatement<B["data"], A["data"]>;
|
|
176
|
+
declare function capacity<B extends AnyFace, M extends CapacityWeight, W extends CapacityWindow, A extends AnyFace>(target: B, weight: M & WeightOnSource<M, A>, window: W & BoundsOnTarget<W, B>, source: A & SameArity<B, A> & SameShapes<B, A>): CapacityStatement<B["data"], A["data"]>;
|
|
142
177
|
/**
|
|
143
178
|
* Renders one statement in the CANONICAL macro spelling
|
|
144
179
|
* (`docs/architecture/70-api.md`; the engine's `schema/render.rs` emits the
|
|
145
180
|
* same shapes for violations) — `Account(id) -> Account`,
|
|
146
181
|
* `Account(holder) <= Holder(id)`,
|
|
147
182
|
* `Account(id | kind == Savings) == SavingsTerms(account)`,
|
|
148
|
-
* `Holder(id) <={0..3} Account(holder)
|
|
183
|
+
* `Holder(id) <={0..3} Account(holder)`,
|
|
184
|
+
* `Pool(id) <=[watts]{0..supply} Device(pool)` — so TS-side errors and
|
|
149
185
|
* engine-side diagnostics read identically. A renderer, never a parser:
|
|
150
|
-
* strings are output-only.
|
|
186
|
+
* strings are output-only. The unit weight renders nothing — the count
|
|
187
|
+
* utterance falls out of the one printer.
|
|
151
188
|
*/
|
|
152
189
|
declare function renderStatement(statement: Statement): string;
|
|
153
|
-
export type { ContainedStatement, ContainmentData, KeyData, KeyStatement, Statement, StatementData
|
|
154
|
-
export { contained, key, mirrors, renderStatement
|
|
190
|
+
export type { CapacityData, CapacityStatement, ContainedStatement, ContainmentData, KeyData, KeyStatement, Statement, StatementData };
|
|
191
|
+
export { capacity, contained, isStatement, key, mirrors, renderStatement };
|
|
155
192
|
//# sourceMappingURL=statements.d.ts.map
|
package/dist/statements.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;
|
|
1
|
+
{"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EAGnB,KAAK,aAAa,EAElB,KAAK,cAAc,EACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAc,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CA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E,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5C,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AA6C1C;;;;;;;;;;;GAWG;AACH,iBAAS,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAYrD;AAED,YAAY,EACX,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,YAAY,EACZ,SAAS,EACT,aAAa,EACb,CAAA;AACD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,CAAA"}
|
package/dist/statements.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Dependency statements as typed values (`docs/architecture/30-dependencies.md`
|
|
3
3
|
* owns the semantics; `docs/architecture/70-api.md` the surface): the FD key
|
|
4
4
|
* form, conditional containment, the bidirectional `==` abbreviation, and
|
|
5
|
-
* the
|
|
5
|
+
* the capacity statement. A statement value is opaque and inert — no
|
|
6
6
|
* methods, no fluent continuation: a fact about the theory, not a builder.
|
|
7
7
|
*
|
|
8
8
|
* Every field reference is checked against the relation it names in the
|
|
@@ -34,10 +34,32 @@
|
|
|
34
34
|
* authority).
|
|
35
35
|
*/
|
|
36
36
|
import * as errors from "@superbuilders/errors";
|
|
37
|
+
import { isCapacityWeight, isCapacityWindow, unitWeight } from "#capacity.ts";
|
|
37
38
|
import { isClosedMember, sealedFieldOf } from "#closed.ts";
|
|
38
39
|
import { renderFace } from "#face.ts";
|
|
39
40
|
import { rosterOf } from "#fields.ts";
|
|
40
|
-
import {
|
|
41
|
+
import { renderCapacityWindow, renderWeight } from "#spec.ts";
|
|
42
|
+
/**
|
|
43
|
+
* The admission brand — a module-private symbol, deliberately unexported
|
|
44
|
+
* (the `capacity.ts` pattern): `Statement` is a public structural type, so
|
|
45
|
+
* without this brand a forged plain object of the right shape would walk
|
|
46
|
+
* past the construction-time arity and roster walls into `schema()` — and
|
|
47
|
+
* the roster wall is the one the engine cannot backstop (the wire carries
|
|
48
|
+
* plain u64s, no rosters). The symbol makes the four constructors the ONLY
|
|
49
|
+
* mints, so a statement that skipped the walls is unspellable.
|
|
50
|
+
*/
|
|
51
|
+
const admitted = Symbol("bumbledb.statement.admitted");
|
|
52
|
+
/**
|
|
53
|
+
* Narrows any value to an admitted statement — the probe is the
|
|
54
|
+
* module-private {@link admitted} brand only the four constructors set, so
|
|
55
|
+
* no host-built value (fact cells are structurally OPEN — an interval with
|
|
56
|
+
* an excess `kind` property is a legal cell) can ever be misread as one.
|
|
57
|
+
* The keyed-get selector dispatch and `schema()`'s admission both judge
|
|
58
|
+
* through here.
|
|
59
|
+
*/
|
|
60
|
+
function isStatement(value) {
|
|
61
|
+
return typeof value === "object" && value !== null && admitted in value;
|
|
62
|
+
}
|
|
41
63
|
/** Renders one face position's closedness for the roster-agreement diagnostics. */
|
|
42
64
|
function renderRosterSide(roster) {
|
|
43
65
|
return roster === undefined ? "a bare column" : `a ${roster.name} reference`;
|
|
@@ -105,7 +127,7 @@ function key(relation, fields) {
|
|
|
105
127
|
owner: relation,
|
|
106
128
|
projection: Object.freeze(fields)
|
|
107
129
|
});
|
|
108
|
-
return Object.freeze({ data });
|
|
130
|
+
return Object.freeze({ data, [admitted]: true });
|
|
109
131
|
}
|
|
110
132
|
/**
|
|
111
133
|
* `A(X|φ) <= B(Y|ψ)` — conditional inclusion, source left. Arity mismatch
|
|
@@ -123,7 +145,7 @@ function contained(source, target) {
|
|
|
123
145
|
target: target.data,
|
|
124
146
|
bidirectional: false
|
|
125
147
|
});
|
|
126
|
-
const statement = Object.freeze({ data });
|
|
148
|
+
const statement = Object.freeze({ data, [admitted]: true });
|
|
127
149
|
assertArityAgreement(data.source, data.target, statement);
|
|
128
150
|
assertRosterAgreement(data.source, data.target, statement);
|
|
129
151
|
return statement;
|
|
@@ -144,31 +166,90 @@ function mirrors(source, target) {
|
|
|
144
166
|
target: target.data,
|
|
145
167
|
bidirectional: true
|
|
146
168
|
});
|
|
147
|
-
const statement = Object.freeze({ data });
|
|
169
|
+
const statement = Object.freeze({ data, [admitted]: true });
|
|
148
170
|
assertArityAgreement(data.source, data.target, statement);
|
|
149
171
|
assertRosterAgreement(data.source, data.target, statement);
|
|
150
172
|
return statement;
|
|
151
173
|
}
|
|
152
174
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
|
|
160
|
-
|
|
175
|
+
* The runtime twin of the weight source wall ({@link WeightOnSource}): the
|
|
176
|
+
* weighed field must be a u64-encoded position of the SOURCE's own row
|
|
177
|
+
* (a signed weight would break the polarity scheduler — the illegal weight
|
|
178
|
+
* is unrepresentable, not checked), an interval position for the
|
|
179
|
+
* `Duration(...)` form. Judged at CONSTRUCTION for untyped callers; the
|
|
180
|
+
* engine's `validate_capacity` stays the final authority.
|
|
181
|
+
*/
|
|
182
|
+
function assertWeightOnSource(weight, source, statement) {
|
|
183
|
+
if (weight.kind === "unit") {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const field = sealedFieldOf(source.owner, weight.field);
|
|
187
|
+
if (field === undefined) {
|
|
188
|
+
throw errors.new(`${source.owner.name} has no field ${weight.field} — a weight names a field of the SOURCE's own row (the weight vocabulary is closed at the row) — ${renderStatement(statement)}`);
|
|
189
|
+
}
|
|
190
|
+
if (weight.kind === "field" && field.kind !== "u64") {
|
|
191
|
+
throw errors.new(`${source.owner.name}.${weight.field} is ${field.kind}, not u64 — a weight is u64-encoded (a signed weight would break the polarity scheduler: an insert could lower a sum) — ${renderStatement(statement)}`);
|
|
192
|
+
}
|
|
193
|
+
if (weight.kind === "durationField" && field.kind !== "interval") {
|
|
194
|
+
throw errors.new(`${source.owner.name}.${weight.field} is ${field.kind}, not an interval — Duration(...) weighs an interval field's measure — ${renderStatement(statement)}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* The runtime twin of the dependent-bound target wall
|
|
199
|
+
* ({@link BoundsOnTarget}): a `ref()` bound must name a u64 field of the
|
|
200
|
+
* TARGET's own row, a `duration()` bound an interval field — bound names
|
|
201
|
+
* resolve against the target's FULL roster (C1), never the projection.
|
|
202
|
+
* `within()` mints dependent bounds in the hi slot only (C6), but the walk
|
|
203
|
+
* here is total over the window's bound slots.
|
|
161
204
|
*/
|
|
162
|
-
function window
|
|
205
|
+
function assertBoundsOnTarget(window, target, statement) {
|
|
206
|
+
const bounds = window.kind === "range" ? [window.lo, window.hi] : [window.kind === "exact" ? window.n : window.lo];
|
|
207
|
+
for (const bound of bounds) {
|
|
208
|
+
if (bound.kind === "lit") {
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
const field = sealedFieldOf(target.owner, bound.field);
|
|
212
|
+
if (field === undefined) {
|
|
213
|
+
throw errors.new(`${target.owner.name} has no field ${bound.field} — a dependent bound names a field of the TARGET's own row (bound names resolve against the target's full roster) — ${renderStatement(statement)}`);
|
|
214
|
+
}
|
|
215
|
+
if (bound.kind === "field" && field.kind !== "u64") {
|
|
216
|
+
throw errors.new(`${target.owner.name}.${bound.field} is ${field.kind}, not u64 — a dependent bound reads a u64 field of the TARGET row (Duration(...) is the interval-measure spelling) — ${renderStatement(statement)}`);
|
|
217
|
+
}
|
|
218
|
+
if (bound.kind === "durationField" && field.kind !== "interval") {
|
|
219
|
+
throw errors.new(`${target.owner.name}.${bound.field} is ${field.kind}, not an interval — Duration(...) bounds by an interval field's measure — ${renderStatement(statement)}`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function capacity(target, second, third, fourth) {
|
|
224
|
+
const weighted = fourth !== undefined;
|
|
225
|
+
const windowValue = weighted ? third : second;
|
|
226
|
+
const source = weighted ? fourth : third;
|
|
227
|
+
if (!isCapacityWindow(windowValue)) {
|
|
228
|
+
throw errors.new("a capacity window is minted only by within() — a structural literal skips the ban table (the canonical-utterance law)");
|
|
229
|
+
}
|
|
230
|
+
let weight = unitWeight;
|
|
231
|
+
if (weighted) {
|
|
232
|
+
if (!isCapacityWeight(second)) {
|
|
233
|
+
throw errors.new("a capacity weight is minted only by weigh() — a structural literal skips the row-local weight wall");
|
|
234
|
+
}
|
|
235
|
+
weight = second.weight;
|
|
236
|
+
}
|
|
237
|
+
const window = windowValue.window;
|
|
238
|
+
if (weight.kind === "unit" && window.kind === "floor" && window.lo.kind === "lit" && window.lo.value === 1n) {
|
|
239
|
+
throw errors.new("`{1..*}` on the unit instance says only what the bare containment says — drop the annotation and write the containment: contained(source, target)");
|
|
240
|
+
}
|
|
163
241
|
const data = Object.freeze({
|
|
164
|
-
kind: "
|
|
242
|
+
kind: "capacity",
|
|
165
243
|
target: target.data,
|
|
166
|
-
|
|
244
|
+
weight,
|
|
245
|
+
window,
|
|
167
246
|
source: source.data
|
|
168
247
|
});
|
|
169
|
-
const statement = Object.freeze({ data });
|
|
248
|
+
const statement = Object.freeze({ data, [admitted]: true });
|
|
170
249
|
assertArityAgreement(data.source, data.target, statement);
|
|
171
250
|
assertRosterAgreement(data.source, data.target, statement);
|
|
251
|
+
assertWeightOnSource(weight, data.source, statement);
|
|
252
|
+
assertBoundsOnTarget(window, data.target, statement);
|
|
172
253
|
return statement;
|
|
173
254
|
}
|
|
174
255
|
/**
|
|
@@ -177,9 +258,11 @@ function window(target, count, source) {
|
|
|
177
258
|
* same shapes for violations) — `Account(id) -> Account`,
|
|
178
259
|
* `Account(holder) <= Holder(id)`,
|
|
179
260
|
* `Account(id | kind == Savings) == SavingsTerms(account)`,
|
|
180
|
-
* `Holder(id) <={0..3} Account(holder)
|
|
261
|
+
* `Holder(id) <={0..3} Account(holder)`,
|
|
262
|
+
* `Pool(id) <=[watts]{0..supply} Device(pool)` — so TS-side errors and
|
|
181
263
|
* engine-side diagnostics read identically. A renderer, never a parser:
|
|
182
|
-
* strings are output-only.
|
|
264
|
+
* strings are output-only. The unit weight renders nothing — the count
|
|
265
|
+
* utterance falls out of the one printer.
|
|
183
266
|
*/
|
|
184
267
|
function renderStatement(statement) {
|
|
185
268
|
const data = statement.data;
|
|
@@ -190,9 +273,9 @@ function renderStatement(statement) {
|
|
|
190
273
|
const operator = data.bidirectional ? "==" : "<=";
|
|
191
274
|
return `${renderFace(data.source)} ${operator} ${renderFace(data.target)}`;
|
|
192
275
|
}
|
|
193
|
-
case "
|
|
194
|
-
return `${renderFace(data.target)} <=${
|
|
276
|
+
case "capacity":
|
|
277
|
+
return `${renderFace(data.target)} <=${renderWeight(data.weight)}${renderCapacityWindow(data.window)} ${renderFace(data.source)}`;
|
|
195
278
|
}
|
|
196
279
|
}
|
|
197
|
-
export { contained, key, mirrors, renderStatement
|
|
280
|
+
export { capacity, contained, isStatement, key, mirrors, renderStatement };
|
|
198
281
|
//# sourceMappingURL=statements.js.map
|