@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/COOKBOOK.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The cookbook — modeling intuition as schemas, in TypeScript
|
|
2
2
|
|
|
3
|
-
The bumbledb engine's
|
|
3
|
+
The bumbledb engine's 32 cookbook recipes (`bumbledb/docs/cookbook.md`),
|
|
4
4
|
translated to this SDK's structural API. **This document is illustrative,
|
|
5
5
|
never normative**: where a recipe and an engine architecture chapter disagree,
|
|
6
6
|
the chapter wins (`docs/architecture/README.md` rule 5) — the SDK is the same
|
|
@@ -39,9 +39,11 @@ import {
|
|
|
39
39
|
bool,
|
|
40
40
|
by,
|
|
41
41
|
bytes,
|
|
42
|
+
capacity,
|
|
42
43
|
closed,
|
|
43
44
|
contained,
|
|
44
45
|
desc,
|
|
46
|
+
duration,
|
|
45
47
|
eq,
|
|
46
48
|
i64,
|
|
47
49
|
interval,
|
|
@@ -53,11 +55,14 @@ import {
|
|
|
53
55
|
pointIn,
|
|
54
56
|
program,
|
|
55
57
|
query,
|
|
58
|
+
ref,
|
|
56
59
|
relation,
|
|
57
60
|
schema,
|
|
58
61
|
str,
|
|
59
62
|
u64,
|
|
60
|
-
v
|
|
63
|
+
v,
|
|
64
|
+
weigh,
|
|
65
|
+
within
|
|
61
66
|
} from "@bjornpagen/bumbledb"
|
|
62
67
|
```
|
|
63
68
|
|
|
@@ -66,7 +71,7 @@ import {
|
|
|
66
71
|
Relation declarations are pure structure — `kind`, `width`, `element`,
|
|
67
72
|
`fresh`, nothing else. Domains are never declared: `schema()` computes every
|
|
68
73
|
field's equivalence class FROM the statement list, by union-find across every
|
|
69
|
-
paired face (containment, `mirrors`,
|
|
74
|
+
paired face (containment, `mirrors`, capacity targets, ψ-selected faces
|
|
70
75
|
included). Three laws govern the classes:
|
|
71
76
|
|
|
72
77
|
1. **A fresh field is a generator** and names its class by its declaration
|
|
@@ -983,7 +988,10 @@ the host's own interleaved writes), capped at 64 attempts: a callback that
|
|
|
983
988
|
itself issues a plain `db.write` each try re-moves the generation it is about
|
|
984
989
|
to witness, and past the cap that interleave hazard throws the typed
|
|
985
990
|
`ErrWitnessedLivelock` instead of spinning forever. `abandon(payload)`
|
|
986
|
-
declines to commit without issuing anything.
|
|
991
|
+
declines to commit without issuing anything — from `db.write` and
|
|
992
|
+
`db.writeWitnessed` alike (the sentinel's contract is unconditional, and
|
|
993
|
+
the outcome arm is in the result type exactly when the callback can
|
|
994
|
+
abandon).
|
|
987
995
|
|
|
988
996
|
```ts
|
|
989
997
|
const State = closed("State", ["Queued", "Running", "Done"])
|
|
@@ -1207,9 +1215,9 @@ for (;;) {
|
|
|
1207
1215
|
Termination is the host's theorem: `seen` grows strictly or the loop breaks,
|
|
1208
1216
|
inside a finite node set. When the idiom's costs bite — **unbounded or large
|
|
1209
1217
|
depth**, or **closure composed into a larger plan** — write the engine-native
|
|
1210
|
-
form instead: `?root` seeds the predicate, and the output
|
|
1211
|
-
set
|
|
1212
|
-
|
|
1218
|
+
form instead: `?root` seeds the predicate, and the output is the finished
|
|
1219
|
+
set's own identity projection (an `idb` atom is a positive occurrence, so it
|
|
1220
|
+
grounds its variables — no re-grounding join over a domain relation exists):
|
|
1213
1221
|
|
|
1214
1222
|
```ts
|
|
1215
1223
|
const reach = program(Closure, (p) => {
|
|
@@ -1231,12 +1239,46 @@ const reach = program(Closure, (p) => {
|
|
|
1231
1239
|
})
|
|
1232
1240
|
return p.output((r) => {
|
|
1233
1241
|
const { id: c } = v(Node)
|
|
1234
|
-
return r.
|
|
1242
|
+
return r.idb(seeded, { c }).find({ c })
|
|
1235
1243
|
})
|
|
1236
1244
|
})
|
|
1237
1245
|
const reachPrepared = db.prepare(reach)
|
|
1238
1246
|
```
|
|
1239
1247
|
|
|
1248
|
+
The complement is one `r.not` away — negation **of** a finished stratum is
|
|
1249
|
+
engine-legal (the strata judge refuses only negation *through* a cycle), so
|
|
1250
|
+
"every node the closure never reached" runs in-plan through the engine's
|
|
1251
|
+
anti-probe, never as a host-side set difference — the same program with the
|
|
1252
|
+
output rule:
|
|
1253
|
+
|
|
1254
|
+
```ts
|
|
1255
|
+
const unreached = program(Closure, (p) => {
|
|
1256
|
+
const rec = p.rec("reach")
|
|
1257
|
+
const seeded = rec
|
|
1258
|
+
.rule((r) => {
|
|
1259
|
+
const { id: c } = v(Node)
|
|
1260
|
+
return r
|
|
1261
|
+
.match(Node, { id: c })
|
|
1262
|
+
.where(eq(c, r.param("root")))
|
|
1263
|
+
.find({ c })
|
|
1264
|
+
})
|
|
1265
|
+
.rule((r) => {
|
|
1266
|
+
const { child: c, parent } = v(Parent)
|
|
1267
|
+
return r
|
|
1268
|
+
.match(Parent, { child: c, parent })
|
|
1269
|
+
.idb(rec, { c: parent })
|
|
1270
|
+
.find({ c })
|
|
1271
|
+
})
|
|
1272
|
+
return p.output((r) => {
|
|
1273
|
+
const { id: c } = v(Node)
|
|
1274
|
+
return r
|
|
1275
|
+
.match(Node, { id: c })
|
|
1276
|
+
.where(r.not(seeded, { c }))
|
|
1277
|
+
.find({ c })
|
|
1278
|
+
})
|
|
1279
|
+
})
|
|
1280
|
+
```
|
|
1281
|
+
|
|
1240
1282
|
(the test drives both dialects and asserts the same reachable sets, root for
|
|
1241
1283
|
root). What stays host-side is the **chain-window class** — interval
|
|
1242
1284
|
intersection along paths — which the recursion surface fences out: the idiom
|
|
@@ -1441,7 +1483,9 @@ the fingerprint refusal, load order, identity, mint catch-up, judgment); the
|
|
|
1441
1483
|
SDK pin asserts the two theories carry two distinct fingerprints — the
|
|
1442
1484
|
refusal's premise. For stores whose creating schema is gone, `Db.exhume`
|
|
1443
1485
|
reads the store's own persisted descriptor — the one schema-independent read
|
|
1444
|
-
path, the E half of ETL.
|
|
1486
|
+
path, the E half of ETL. Its lifetime is a `using` scope (`using exhumed =
|
|
1487
|
+
await Db.exhume(oldPath)`): disposal releases the store's exclusive lock at
|
|
1488
|
+
scope exit, so the rebirth loop's same-path retry never waits on GC.
|
|
1445
1489
|
|
|
1446
1490
|
## Composition
|
|
1447
1491
|
|
|
@@ -1567,3 +1611,100 @@ exists — `snap.scan(Program).find((row) => row.grp === grp)` — re-derives
|
|
|
1567
1611
|
in the host what the store already enforces. The uniqueness the fold
|
|
1568
1612
|
quietly assumes IS the declared key statement; spell the law and the point
|
|
1569
1613
|
read comes with it.
|
|
1614
|
+
|
|
1615
|
+
## Capacity laws
|
|
1616
|
+
|
|
1617
|
+
## 31. The power budget
|
|
1618
|
+
|
|
1619
|
+
Guarantee: Lean theorem + validator/runtime premises — the capacity law
|
|
1620
|
+
bounds each pool's summed draw by the pool's own row
|
|
1621
|
+
(`lean/Bumbledb/Capacity.lean: CapacityLaw`; per touched parent, one keyed
|
|
1622
|
+
probe plus one measure walk, `lean/Bumbledb/Oracle.lean:
|
|
1623
|
+
capacity_plan_decides`); the pinned-column containment proves a device's
|
|
1624
|
+
watts equals its model's at every commit.
|
|
1625
|
+
|
|
1626
|
+
Per-group capacity is one statement — the `capacity` builder mirrors the
|
|
1627
|
+
operator positionally (target, weight, window, source): `weigh` names the
|
|
1628
|
+
measure on the SOURCE row, and `ref` reads each group's ceiling from the
|
|
1629
|
+
TARGET row (hi slot only — ruled 2026-07-24, C6; bound names resolve
|
|
1630
|
+
against the target's full roster, ruled 2026-07-24, C1).
|
|
1631
|
+
|
|
1632
|
+
```ts
|
|
1633
|
+
const Pool = relation("Pool", { id: u64.fresh, supply: u64 })
|
|
1634
|
+
const Model = relation("Model", { id: u64.fresh, watts: u64 })
|
|
1635
|
+
const Device = relation("Device", {
|
|
1636
|
+
id: u64.fresh,
|
|
1637
|
+
pool: u64,
|
|
1638
|
+
model: u64,
|
|
1639
|
+
watts: u64
|
|
1640
|
+
})
|
|
1641
|
+
|
|
1642
|
+
const Racks = schema("Racks", { Pool, Model, Device }, [
|
|
1643
|
+
contained(on(Device, "pool"), on(Pool, "id")),
|
|
1644
|
+
// The pinned column: a device's watts provably equals its model's — the
|
|
1645
|
+
// two-column containment IS the join, stated as a law. The superkey it
|
|
1646
|
+
// targets is deliberate write-amplification rent.
|
|
1647
|
+
key(Model, ["id", "watts"]),
|
|
1648
|
+
contained(on(Device, ["model", "watts"]), on(Model, ["id", "watts"])),
|
|
1649
|
+
// Σ watts over a pool's devices stays within the pool's own supply:
|
|
1650
|
+
capacity(on(Pool, "id"), weigh("watts"), within(0n, ref("supply")), on(Device, "pool"))
|
|
1651
|
+
])
|
|
1652
|
+
|
|
1653
|
+
// utilization is a query, never a column (the ledger's law, recipe 19):
|
|
1654
|
+
const draw = query(Racks).rule((r) => {
|
|
1655
|
+
const { id, pool, watts } = v(Device)
|
|
1656
|
+
return r.match(Device, { id, pool, watts }).find({ pool, total: r.sum(watts) })
|
|
1657
|
+
})
|
|
1658
|
+
```
|
|
1659
|
+
|
|
1660
|
+
A path weight (`weigh("model.watts")`) is a typed refusal whose diagnostic
|
|
1661
|
+
names exactly this pair — the weight vocabulary is closed at the row (ruled
|
|
1662
|
+
2026-07-24, ruling 6): a weight read through a reference would be a
|
|
1663
|
+
maintained copy of another relation's field, and a catalog edit would
|
|
1664
|
+
silently re-weigh deployed fleets. Pinned, the inconsistent commit refuses
|
|
1665
|
+
at the device site and the migration is explicit.
|
|
1666
|
+
|
|
1667
|
+
## 32. Calendar capacity
|
|
1668
|
+
|
|
1669
|
+
Guarantee: Lean theorem + validator/runtime premises — the Duration weight
|
|
1670
|
+
sums each booking's interval measure against the room's own span measure
|
|
1671
|
+
(`lean/Bumbledb/Capacity.lean: CapacityLaw`; Duration weights pair with
|
|
1672
|
+
Duration-capable bounds, ruled 2026-07-24, C18; a ray-valued weight or
|
|
1673
|
+
bound refuses typed at the law site, ruled 2026-07-24, C10).
|
|
1674
|
+
|
|
1675
|
+
"Total booked time per room stays within the room's span" — one statement.
|
|
1676
|
+
The interval enters through the measure argument, never the group key.
|
|
1677
|
+
|
|
1678
|
+
```ts
|
|
1679
|
+
const Room = relation("Room", { id: u64.fresh, span: interval(i64) })
|
|
1680
|
+
const Booking = relation("Booking", {
|
|
1681
|
+
id: u64.fresh,
|
|
1682
|
+
room: u64,
|
|
1683
|
+
booked: interval(i64)
|
|
1684
|
+
})
|
|
1685
|
+
|
|
1686
|
+
const Rooms = schema("Rooms", { Room, Booking }, [
|
|
1687
|
+
contained(on(Booking, "room"), on(Room, "id")),
|
|
1688
|
+
// The pointwise key forbids double-booking (recipe 1); the capacity law
|
|
1689
|
+
// bounds the TOTAL. Different laws — a schema usually wants both.
|
|
1690
|
+
key(Booking, ["room", "booked"]),
|
|
1691
|
+
capacity(
|
|
1692
|
+
on(Room, "id"),
|
|
1693
|
+
weigh(duration("booked")),
|
|
1694
|
+
within(0n, duration("span")),
|
|
1695
|
+
on(Booking, "room")
|
|
1696
|
+
)
|
|
1697
|
+
])
|
|
1698
|
+
|
|
1699
|
+
// the booked time per room, read back:
|
|
1700
|
+
const booked = query(Rooms).rule((r) => {
|
|
1701
|
+
const { id, room, booked } = v(Booking)
|
|
1702
|
+
return r.match(Booking, { id, room, booked }).find({ room, total: r.sum(r.duration(booked)) })
|
|
1703
|
+
})
|
|
1704
|
+
```
|
|
1705
|
+
|
|
1706
|
+
Mind the weighted `{0}` and the weighted floor: on a weighted statement
|
|
1707
|
+
`within(0n)` says "the group's total is zero" (zero-measure rows may exist
|
|
1708
|
+
— the weaker law than the unit exclusion), and `within(1n, "*")` under a
|
|
1709
|
+
weight ("positive total") is not "at least one booking" — that intent is
|
|
1710
|
+
the bare `contained`. Choose by what you mean.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Type-theoretic TypeScript SDK for the [bumbledb](https://github.com/bjornpagen/bumbledb) embedded relational engine.
|
|
4
4
|
|
|
5
|
-
bumbledb models data as relations judged by statements (functionality, containment,
|
|
5
|
+
bumbledb models data as relations judged by statements (functionality, containment, capacity) and queried with Datalog expressed as plain values — no SQL, no query-string parser. The SDK is a thin, fully typed surface over an in-process native engine (LMDB storage, MVCC snapshots, a single-writer witnessed write loop).
|
|
6
6
|
|
|
7
7
|
The surface is structural to the bone. Relation declarations are pure structure — kind, width, element, fresh, nothing else — and domains are never declared anywhere: **the laws type the columns**. `schema()` computes every field's equivalence class from the statement list itself, so the containments and mirrors you already write ARE the typing, at compile time and again at construction. Values stay bare (`bigint`, `string`, …); identity lives in the class the laws compute, not in a wrapper.
|
|
8
8
|
|
|
@@ -93,6 +93,19 @@ const prepared = db.prepare(certifiedAbove)
|
|
|
93
93
|
const rows = db.execute(prepared, { floor: 15n }) // rows: { a: bigint; rank: bigint }[]
|
|
94
94
|
console.log(rows)
|
|
95
95
|
|
|
96
|
+
// Lifetimes are disposables, never close() (Node 26 explicit resource
|
|
97
|
+
// management): a read scope acquired without a callback is released by its
|
|
98
|
+
// `using` declaration at scope exit — deterministic, in the language's own
|
|
99
|
+
// syntax. `db.read(fn)` remains the callback spelling of the same scope.
|
|
100
|
+
{
|
|
101
|
+
using snap = db.read()
|
|
102
|
+
console.log(snap.generation, snap.execute(prepared, { floor: 15n }))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// explain(): the plan as data — what the engine did with the query, plan
|
|
106
|
+
// sections and counters as plain values (a diagnostic surface, unfrozen).
|
|
107
|
+
console.log(db.explain(prepared, { floor: 15n }).emits)
|
|
108
|
+
|
|
96
109
|
// Host dispatch over the sealed roster is native `switch` narrowing over
|
|
97
110
|
// the handle union ("DirectPass" | "JudgedPass" | "Failed") — exhaustive
|
|
98
111
|
// via `satisfies never`; the sealed axioms read back typed.
|
|
@@ -118,14 +131,14 @@ real surface by `test/readme.test.ts` — the examples cannot drift.
|
|
|
118
131
|
The drizzle law governs this surface: the SDK's job at the host boundary is translation, not abstraction — every database idiom arrives as the modern TypeScript idiom for that concept, and the SDK never invents an operator where the language already has one.
|
|
119
132
|
|
|
120
133
|
- The structural type kernel — fields as pure structure (`bool`, `bytes`, `i64`, `u64`, `str`, `interval`, `span`), `relation()`, and `closed()` sealed rosters with typed axiom payloads. A closed reference's value type IS the handle union (`Infer` speaks it); dispatch is native `switch` narrowing with `satisfies never` exhaustiveness. Domains are never declared: `schema()` computes every field's class from the statement list.
|
|
121
|
-
- The statement algebra — `schema()`, `key`, `contained`, `mirrors`, `
|
|
122
|
-
- The `Db` runtime — `Db.create`/`Db.open`, path-cached stores, transactions, typed violations, scoped snapshot reads, the
|
|
134
|
+
- The statement algebra — `schema()`, `key`, `contained`, `mirrors`, `capacity`; faces via `on` (set membership is a plain array in `.where`); windows via `within` (`within(n)` exact, `within(lo, hi)` range, `within(lo, "*")` floor), measures via `weigh` (`weigh("f")` a u64 field, `weigh(duration("f"))` an interval's measure), dependent bounds via `ref`/`duration` read from the target row; ψ-selection via `.where` on relations and closed rosters.
|
|
135
|
+
- The `Db` runtime — `Db.create`/`Db.open`, path-cached stores, transactions, typed violations, scoped snapshot reads (`db.read(fn)`, or `using snap = db.read()` — lifetimes are disposables, never `close()`), the write verbs with `abandon` (returning `abandon(payload)` from `write` or `writeWitnessed` rolls the transaction back; the outcome arm is in the result type), and `db.explain` — the prepared plan as data.
|
|
123
136
|
- The query surface — Datalog as values, `query(S).rule(r => ...)`: `v(R)`-minted vars (identity is the object reference — reusing one across binding positions IS the join), `find({...})` named result heads (renames are real), params typed by use unchanged, negation, aggregates, and the free comparison/connective exports (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `and`, `or`, `not`, `allen`/`ALLEN`, `pointIn`); set membership at a closed field is a plain array in the match record (`r.match(Ticket, { priority: ["Normal", "Urgent"] })` — closed-only there: an ordinary field's membership is a bound `r.inSet` param); stratified recursion via `program()`; `db.prepare` as a plain value.
|
|
124
|
-
- The exhume surface — `Db.exhume`, the schema-independent read path: a store's self-described shapes and raw facts by name, with typed refusals (`ErrExhumeNoDescriptor`, `ErrExhumeFormatMismatch`, `ErrExhumeCorruption`).
|
|
137
|
+
- The exhume surface — `Db.exhume`, the schema-independent read path: a store's self-described shapes and raw facts by name, with typed refusals (`ErrExhumeNoDescriptor`, `ErrExhumeFormatMismatch`, `ErrExhumeCorruption`). A disposable lifetime: `using exhumed = await Db.exhume(path)` releases the store's exclusive lock at scope exit.
|
|
125
138
|
|
|
126
139
|
## Cookbook
|
|
127
140
|
|
|
128
|
-
The engine cookbook's
|
|
141
|
+
The engine cookbook's 32 modeling recipes, translated to this SDK's structural API: [COOKBOOK.md](./COOKBOOK.md). Two referees hold it: `test/cookbook-doc.test.ts` extracts the document's own `ts` fences and type-checks them against the real surface (the doc itself cannot drift), and `test/cookbook.test.ts` runs compiled copies of the recipes — each schema admitted by the real engine, its fingerprint asserted against the cross-host goldens the Rust cookbook suite also pins, every query snippet lowered through `db.prepare`.
|
|
129
142
|
|
|
130
143
|
## Architecture
|
|
131
144
|
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capacity-law mints — the window, weight, and dependent-bound vocabulary
|
|
3
|
+
* the one `capacity()` statement constructor consumes
|
|
4
|
+
* (`docs/architecture/70-api.md` § the canonical-utterance law, restated
|
|
5
|
+
* around the aggregate form). `within()` is the ONE window spelling —
|
|
6
|
+
* `within(n)` exact (`within(0n)` IS the exclusion's one spelling),
|
|
7
|
+
* `within(lo, hi)` range (`within(0n, hi)` the canonical ceiling),
|
|
8
|
+
* `within(lo, "*")` floor — `weigh()` names the measure on the SOURCE row
|
|
9
|
+
* (`weigh("watts")` a u64 field, `weigh(duration("booked"))` an interval's
|
|
10
|
+
* measure), and `ref()`/`duration()` read a dependent bound from the
|
|
11
|
+
* TARGET row (hi slot only — ruled 2026-07-24, C6). The ban table is
|
|
12
|
+
* enforced REPRESENTATIONALLY in two tiers, split per-aggregate where
|
|
13
|
+
* weight-sensitive (design § 6: a ban is canonical-utterance policing when
|
|
14
|
+
* it is weight-independent, semantic deduplication when it is not):
|
|
15
|
+
*
|
|
16
|
+
* - **The type tier**: a banned spelling written as a LITERAL does not
|
|
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
|
+
* - **The construction tier**: a bound the type level cannot judge — a
|
|
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
|
+
*
|
|
30
|
+
* The weight vocabulary is closed at the row (ruled 2026-07-24, ruling 6):
|
|
31
|
+
* a path weight (`weigh("model.watts")`) is a typed refusal at BOTH tiers
|
|
32
|
+
* whose diagnostic names the pinned-column idiom — the two-column
|
|
33
|
+
* containment IS the join, stated as a law. Bounds are `bigint` (u64
|
|
34
|
+
* crosses as bigint always, PRD-04's law); the witnessed measure comes
|
|
35
|
+
* back as `bigint` too (u128-wide engine accumulator, C3).
|
|
36
|
+
*/
|
|
37
|
+
import type { AnyFace, FaceFields, FaceSource, ProjectedShape } from "#face.ts";
|
|
38
|
+
import type { CapacityWindowSpec, WeightSpec } from "#spec.ts";
|
|
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
|
+
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
|
+
interface CapacityWindow<S extends CapacityWindowSpec = CapacityWindowSpec> {
|
|
56
|
+
readonly window: S;
|
|
57
|
+
readonly [admitted]: true;
|
|
58
|
+
}
|
|
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
|
+
interface CapacityWeight<S extends WeightSpec = WeightSpec> {
|
|
66
|
+
readonly weight: S;
|
|
67
|
+
readonly [admitted]: true;
|
|
68
|
+
}
|
|
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
|
+
interface FieldRef<F extends string = string> {
|
|
76
|
+
readonly kind: "field";
|
|
77
|
+
readonly field: F;
|
|
78
|
+
}
|
|
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
|
+
interface DurationRef<F extends string = string> {
|
|
86
|
+
readonly kind: "durationField";
|
|
87
|
+
readonly field: F;
|
|
88
|
+
}
|
|
89
|
+
/** Narrows any value to an admitted capacity window through the module-private brand. */
|
|
90
|
+
declare function isCapacityWindow(value: unknown): value is CapacityWindow;
|
|
91
|
+
/** Narrows any value to an admitted capacity weight through the module-private brand. */
|
|
92
|
+
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
|
+
interface BannedWindow<Canonical extends string> {
|
|
99
|
+
readonly "banned window spelling — the canonical-utterance law names the one legal form": Canonical;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The path-weight refusal (ruling 6 — a boundary, not a deferral): the
|
|
103
|
+
* verdict names the pinned-column idiom, the same diagnostic the macro
|
|
104
|
+
* expansion and the spec resolver carry.
|
|
105
|
+
*/
|
|
106
|
+
interface RefusedPath<Idiom extends string> {
|
|
107
|
+
readonly "path spelling refused — the vocabulary is closed at the row": Idiom;
|
|
108
|
+
}
|
|
109
|
+
/** `true` exactly when the literal bigint `N` is negative (out of the u64 bound domain). */
|
|
110
|
+
type IsNegative<N extends bigint> = `${N}` extends `-${string}` ? true : false;
|
|
111
|
+
/**
|
|
112
|
+
* The dotted-name ban, both mints: a `a.b` spelling is a typed refusal
|
|
113
|
+
* whose verdict names the composition idiom — pin the column with a
|
|
114
|
+
* two-column containment (`Device(model, watts) <= Model(id, watts)`) and
|
|
115
|
+
* name the local field.
|
|
116
|
+
*/
|
|
117
|
+
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
|
+
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
|
+
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
|
+
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
|
+
type UnitWindowBan<W extends CapacityWindow> = W["window"] extends {
|
|
144
|
+
readonly kind: "floor";
|
|
145
|
+
readonly lo: {
|
|
146
|
+
readonly kind: "lit";
|
|
147
|
+
readonly value: 1n;
|
|
148
|
+
};
|
|
149
|
+
} ? BannedWindow<"`{1..*}` on the unit instance says only what the bare containment says — write contained(source, target)"> : unknown;
|
|
150
|
+
/** The projected kind of one field of a face's source, read off the schema type. */
|
|
151
|
+
type KindAt<S extends FaceSource, K extends string> = ProjectedShape<S, K> extends readonly [infer Kind, ...unknown[]] ? Kind : undefined;
|
|
152
|
+
/**
|
|
153
|
+
* The legible off-roster verdict for a dependent bound: bound names
|
|
154
|
+
* resolve against the TARGET's full field roster (C1 — the written
|
|
155
|
+
* projection tuple stays the pure grouping key), and the verdict names
|
|
156
|
+
* that roster.
|
|
157
|
+
*/
|
|
158
|
+
interface BoundOffTargetRoster<K, Roster> {
|
|
159
|
+
readonly "dependent bound must name a field of the TARGET's own row — bound names resolve against the target's full roster": readonly [
|
|
160
|
+
K,
|
|
161
|
+
Roster
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
/** The legible kind-mismatch verdict for a dependent bound: `ref()` needs u64, `duration()` an interval. */
|
|
165
|
+
interface BoundKindMismatch<K, Want> {
|
|
166
|
+
readonly "dependent bound kind mismatch — ref() reads a u64 field, duration() an interval field, of the TARGET row": readonly [
|
|
167
|
+
K,
|
|
168
|
+
Want
|
|
169
|
+
];
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* One dependent-bound slot judged against the target face's roster and
|
|
173
|
+
* kinds. A WIDE field name (the untyped-caller path — literal identity
|
|
174
|
+
* already lost) passes the type tier and is judged at construction.
|
|
175
|
+
*/
|
|
176
|
+
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"]>>;
|
|
177
|
+
/**
|
|
178
|
+
* The dependent-bound target wall (type tier): for a `ref(K)` bound in the
|
|
179
|
+
* window's hi slot, `K` must name a u64 field of the TARGET face's own
|
|
180
|
+
* row; for a `duration(K)` bound, an interval field. Literal-bound windows
|
|
181
|
+
* pass untouched. The runtime twin for untyped callers lives at the
|
|
182
|
+
* `capacity()` construction (`statements.ts`).
|
|
183
|
+
*/
|
|
184
|
+
type BoundsOnTarget<W extends CapacityWindow, B extends AnyFace> = W["window"] extends {
|
|
185
|
+
readonly hi: FieldRef<infer K>;
|
|
186
|
+
} ? BoundOnTarget<K, "u64", B> : W["window"] extends {
|
|
187
|
+
readonly hi: DurationRef<infer K>;
|
|
188
|
+
} ? BoundOnTarget<K, "interval", B> : unknown;
|
|
189
|
+
/** The legible off-roster verdict for a weight: the vocabulary is closed at the SOURCE row. */
|
|
190
|
+
interface WeightOffSourceRoster<K, Roster> {
|
|
191
|
+
readonly "weight must name a field of the SOURCE's own row — the weight vocabulary is closed at the row": readonly [
|
|
192
|
+
K,
|
|
193
|
+
Roster
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The legible kind-mismatch verdict for a weight: a signed weight would
|
|
198
|
+
* break the polarity scheduler (an insert could lower a sum), so the
|
|
199
|
+
* illegal weight is unrepresentable, not checked.
|
|
200
|
+
*/
|
|
201
|
+
interface WeightKindMismatch<K, Want> {
|
|
202
|
+
readonly "weight kind mismatch — weigh(field) reads a u64 field, weigh(duration(field)) an interval field, of the SOURCE row": readonly [
|
|
203
|
+
K,
|
|
204
|
+
Want
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The weight source wall (type tier): `weigh(K)`'s field must be a
|
|
209
|
+
* u64-encoded position of the SOURCE face's own row (signed encodings are
|
|
210
|
+
* the typed polarity refusal), `weigh(duration(K))`'s an interval
|
|
211
|
+
* position. Checked at the `capacity()` call where the source face is
|
|
212
|
+
* inferred — the proven constrain-after-inference pattern.
|
|
213
|
+
*/
|
|
214
|
+
type WeightOnSource<M extends CapacityWeight, A extends AnyFace> = M["weight"] extends {
|
|
215
|
+
readonly kind: "field";
|
|
216
|
+
readonly field: infer K extends string;
|
|
217
|
+
} ? string extends K ? unknown : K extends FaceFields<A["source"]> ? KindAt<A["source"], K> extends "u64" ? unknown : WeightKindMismatch<K, "u64"> : WeightOffSourceRoster<K, FaceFields<A["source"]>> : M["weight"] extends {
|
|
218
|
+
readonly kind: "durationField";
|
|
219
|
+
readonly field: infer K extends string;
|
|
220
|
+
} ? 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;
|
|
221
|
+
/** The unit weight — a case, not an absence (C4): the count instance's one wire spelling. */
|
|
222
|
+
declare const unitWeight: WeightSpec;
|
|
223
|
+
/**
|
|
224
|
+
* `{n}` — THE exact-measure spelling; `within(0n)` IS the exclusion's one
|
|
225
|
+
* spelling on the unit instance, and the weaker "total is zero" law on a
|
|
226
|
+
* weighted one (zero-weight rows may exist — design § 6, stated loudly).
|
|
227
|
+
*/
|
|
228
|
+
declare function within<const N extends bigint>(n: N & NegativeBan<N>): CapacityWindow<{
|
|
229
|
+
readonly kind: "exact";
|
|
230
|
+
readonly n: {
|
|
231
|
+
readonly kind: "lit";
|
|
232
|
+
readonly value: N;
|
|
233
|
+
};
|
|
234
|
+
}>;
|
|
235
|
+
/**
|
|
236
|
+
* `{lo..*}` — a floor with no ceiling. `within(0n, "*")` is vacuous
|
|
237
|
+
* (unwritable as a literal); `within(1n, "*")` constructs — the `{1..*}`
|
|
238
|
+
* ban is weight-sensitive and judged at the `capacity()` call (unit
|
|
239
|
+
* instance only).
|
|
240
|
+
*/
|
|
241
|
+
declare function within<const Lo extends bigint>(lo: Lo & FloorBan<Lo>, hi: "*"): CapacityWindow<{
|
|
242
|
+
readonly kind: "floor";
|
|
243
|
+
readonly lo: {
|
|
244
|
+
readonly kind: "lit";
|
|
245
|
+
readonly value: Lo;
|
|
246
|
+
};
|
|
247
|
+
}>;
|
|
248
|
+
/**
|
|
249
|
+
* `{lo..field}` / `{lo..Duration(field)}` — the dependent ceiling, read
|
|
250
|
+
* from the TARGET row per group (C6: hi slot only). The ref carries no
|
|
251
|
+
* value, so no inversion judgment exists at construction — a per-row
|
|
252
|
+
* inverted window is the judge's typed refusal.
|
|
253
|
+
*/
|
|
254
|
+
declare function within<const Lo extends bigint, const R extends FieldRef | DurationRef>(lo: Lo & NegativeBan<Lo>, hi: R): CapacityWindow<{
|
|
255
|
+
readonly kind: "range";
|
|
256
|
+
readonly lo: {
|
|
257
|
+
readonly kind: "lit";
|
|
258
|
+
readonly value: Lo;
|
|
259
|
+
};
|
|
260
|
+
readonly hi: R;
|
|
261
|
+
}>;
|
|
262
|
+
/**
|
|
263
|
+
* `{lo..hi}` — both bounds explicit, lo < hi; `within(0n, hi)` is the
|
|
264
|
+
* canonical ceiling. `lo === hi` is the exact measure respelled
|
|
265
|
+
* (unwritable as literals — {@link RangeBan} names `within(n)`), rejected
|
|
266
|
+
* at construction when computed; an inverted window is unsatisfiable and
|
|
267
|
+
* rejected at construction (bigint literals carry no type-level order).
|
|
268
|
+
*/
|
|
269
|
+
declare function within<const Lo extends bigint, const Hi extends bigint>(lo: Lo, hi: Hi & RangeBan<Lo, Hi>): CapacityWindow<{
|
|
270
|
+
readonly kind: "range";
|
|
271
|
+
readonly lo: {
|
|
272
|
+
readonly kind: "lit";
|
|
273
|
+
readonly value: Lo;
|
|
274
|
+
};
|
|
275
|
+
readonly hi: {
|
|
276
|
+
readonly kind: "lit";
|
|
277
|
+
readonly value: Hi;
|
|
278
|
+
};
|
|
279
|
+
}>;
|
|
280
|
+
/**
|
|
281
|
+
* `[field]` — the measure: a u64-encoded field of the SOURCE row summed
|
|
282
|
+
* per target group. A dotted path is the typed refusal naming the
|
|
283
|
+
* pinned-column idiom (ruling 6); `weigh(duration(field))` is the
|
|
284
|
+
* interval-measure weight — calendar capacity as one statement.
|
|
285
|
+
*/
|
|
286
|
+
declare function weigh<const F extends string>(field: F & PathBan<F>): CapacityWeight<{
|
|
287
|
+
readonly kind: "field";
|
|
288
|
+
readonly field: F;
|
|
289
|
+
}>;
|
|
290
|
+
declare function weigh<const F extends string>(measure: DurationRef<F>): CapacityWeight<{
|
|
291
|
+
readonly kind: "durationField";
|
|
292
|
+
readonly field: F;
|
|
293
|
+
}>;
|
|
294
|
+
/**
|
|
295
|
+
* A dependent bound by name — `within(0n, ref("supply"))` reads each
|
|
296
|
+
* group's ceiling from the TARGET row's u64 field (bound names resolve
|
|
297
|
+
* against the target's FULL roster, C1 — the projection tuple stays the
|
|
298
|
+
* pure grouping key). Carries no value.
|
|
299
|
+
*/
|
|
300
|
+
declare function ref<const F extends string>(field: F & PathBan<F>): FieldRef<F>;
|
|
301
|
+
/**
|
|
302
|
+
* `Duration(field)` — the interval-measure spelling, one mint for both
|
|
303
|
+
* slots: handed to `weigh()` it is the SOURCE row's interval measure;
|
|
304
|
+
* in `within()`'s hi slot it is the TARGET row's interval-measure bound
|
|
305
|
+
* (Duration weights pair with Duration-capable bounds — C18).
|
|
306
|
+
*/
|
|
307
|
+
declare function duration<const F extends string>(field: F & PathBan<F>): DurationRef<F>;
|
|
308
|
+
export type { BoundsOnTarget, CapacityWeight, CapacityWindow, DurationRef, FieldRef, UnitWindowBan, WeightOnSource };
|
|
309
|
+
export { duration, isCapacityWeight, isCapacityWindow, ref, unitWeight, weigh, within };
|
|
310
|
+
//# sourceMappingURL=capacity.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;GAQG;AACH,QAAA,MAAM,QAAQ,EAAE,OAAO,MAA6C,CAAA;AAEpE;;;;;GAKG;AACH,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;;;;;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