@bjornpagen/bumbledb 0.15.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.
Files changed (103) hide show
  1. package/COOKBOOK.md +33 -49
  2. package/README.md +3 -3
  3. package/dist/capacity.d.ts +24 -136
  4. package/dist/capacity.d.ts.map +1 -1
  5. package/dist/capacity.js +18 -40
  6. package/dist/capacity.js.map +1 -1
  7. package/dist/closed.d.ts +0 -156
  8. package/dist/closed.d.ts.map +1 -1
  9. package/dist/closed.js +0 -104
  10. package/dist/closed.js.map +1 -1
  11. package/dist/db.d.ts +7 -223
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +147 -396
  14. package/dist/db.js.map +1 -1
  15. package/dist/face.d.ts +0 -133
  16. package/dist/face.d.ts.map +1 -1
  17. package/dist/face.js +0 -33
  18. package/dist/face.js.map +1 -1
  19. package/dist/fields.d.ts +1 -145
  20. package/dist/fields.d.ts.map +1 -1
  21. package/dist/fields.js +2 -91
  22. package/dist/fields.js.map +1 -1
  23. package/dist/index.d.ts +11 -15
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +9 -13
  26. package/dist/index.js.map +1 -1
  27. package/dist/law.d.ts +111 -93
  28. package/dist/law.d.ts.map +1 -1
  29. package/dist/law.js +23 -27
  30. package/dist/law.js.map +1 -1
  31. package/dist/lower.d.ts +9 -35
  32. package/dist/lower.d.ts.map +1 -1
  33. package/dist/lower.js +8 -53
  34. package/dist/lower.js.map +1 -1
  35. package/dist/marshal.d.ts +0 -65
  36. package/dist/marshal.d.ts.map +1 -1
  37. package/dist/marshal.js +0 -72
  38. package/dist/marshal.js.map +1 -1
  39. package/dist/native.d.ts +25 -290
  40. package/dist/native.d.ts.map +1 -1
  41. package/dist/native.js +6 -66
  42. package/dist/native.js.map +1 -1
  43. package/dist/query/atom.d.ts +10 -276
  44. package/dist/query/atom.d.ts.map +1 -1
  45. package/dist/query/atom.js +1 -96
  46. package/dist/query/atom.js.map +1 -1
  47. package/dist/query/find.d.ts +10 -76
  48. package/dist/query/find.d.ts.map +1 -1
  49. package/dist/query/find.js +0 -30
  50. package/dist/query/find.js.map +1 -1
  51. package/dist/query/lower.d.ts +64 -146
  52. package/dist/query/lower.d.ts.map +1 -1
  53. package/dist/query/lower.js +19 -256
  54. package/dist/query/lower.js.map +1 -1
  55. package/dist/query/parse-ir.d.ts +0 -7
  56. package/dist/query/parse-ir.d.ts.map +1 -1
  57. package/dist/query/parse-ir.js +1 -13
  58. package/dist/query/parse-ir.js.map +1 -1
  59. package/dist/query/run.d.ts +0 -36
  60. package/dist/query/run.d.ts.map +1 -1
  61. package/dist/query/run.js +0 -44
  62. package/dist/query/run.js.map +1 -1
  63. package/dist/query/scope.d.ts +24 -180
  64. package/dist/query/scope.d.ts.map +1 -1
  65. package/dist/query/scope.js +2 -66
  66. package/dist/query/scope.js.map +1 -1
  67. package/dist/relation.d.ts +2 -50
  68. package/dist/relation.d.ts.map +1 -1
  69. package/dist/relation.js +2 -37
  70. package/dist/relation.js.map +1 -1
  71. package/dist/schema.d.ts +13 -63
  72. package/dist/schema.d.ts.map +1 -1
  73. package/dist/schema.js +118 -92
  74. package/dist/schema.js.map +1 -1
  75. package/dist/spec.d.ts +1 -140
  76. package/dist/spec.d.ts.map +1 -1
  77. package/dist/spec.js +1 -68
  78. package/dist/spec.js.map +1 -1
  79. package/dist/statements.d.ts +6 -137
  80. package/dist/statements.d.ts.map +1 -1
  81. package/dist/statements.js +16 -119
  82. package/dist/statements.js.map +1 -1
  83. package/package.json +2 -2
  84. package/src/capacity.ts +26 -140
  85. package/src/closed.ts +5 -206
  86. package/src/db.ts +203 -692
  87. package/src/face.ts +0 -142
  88. package/src/fields.ts +4 -172
  89. package/src/index.ts +9 -15
  90. package/src/law.ts +201 -129
  91. package/src/lower.ts +8 -53
  92. package/src/marshal.ts +1 -85
  93. package/src/native.ts +47 -323
  94. package/src/query/atom.ts +26 -313
  95. package/src/query/find.ts +24 -110
  96. package/src/query/lower.ts +132 -377
  97. package/src/query/parse-ir.ts +1 -14
  98. package/src/query/run.ts +0 -45
  99. package/src/query/scope.ts +25 -186
  100. package/src/relation.ts +2 -66
  101. package/src/schema.ts +143 -122
  102. package/src/spec.ts +1 -160
  103. package/src/statements.ts +22 -174
package/COOKBOOK.md CHANGED
@@ -2,11 +2,9 @@
2
2
 
3
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
- never normative**: where a recipe and an engine architecture chapter disagree,
6
- the chapter wins (`docs/architecture/README.md` rule 5) — the SDK is the same
7
- theory in another skin, and the engine cookbook's deference chain
8
- (`10-data-model.md`, `30-dependencies.md`, `20-query-ir.md`, `70-api.md`)
9
- applies here unchanged.
5
+ never normative**: the compiled tests are the authority every block here
6
+ is executed by the sync suitesand the SDK is the same theory in another
7
+ skin.
10
8
 
11
9
  Every `ts` fence below compiles VERBATIM against the current SDK —
12
10
  `ts/test/cookbook-doc.test.ts` extracts each recipe's fences from this
@@ -36,22 +34,17 @@ import {
36
34
  Db,
37
35
  type Infer,
38
36
  abandon,
39
- allen,
40
37
  bool,
41
38
  bytes,
42
39
  capacity,
43
40
  closed,
44
41
  contained,
45
42
  duration,
46
- eq,
47
43
  i64,
48
44
  interval,
49
45
  key,
50
- lt,
51
46
  mirrors,
52
- not,
53
47
  on,
54
- pointIn,
55
48
  query,
56
49
  ref,
57
50
  relation,
@@ -128,7 +121,7 @@ const downAt = query(Uptime).rule((r) => {
128
121
  const { service, window } = v(Outage)
129
122
  return r
130
123
  .match(Outage, { service, window })
131
- .where(pointIn(r.param("t"), window))
124
+ .where(r.pointIn(r.param("t"), window))
132
125
  .find({ service })
133
126
  })
134
127
  // overlapping an incident window (one Allen mask, no operator zoo):
@@ -136,14 +129,11 @@ const overlapping = query(Uptime).rule((r) => {
136
129
  const { service, window } = v(Outage)
137
130
  return r
138
131
  .match(Outage, { service, window })
139
- .where(allen(window, ALLEN.intersects, r.param("incident")))
132
+ .where(r.allen(window, ALLEN.intersects, r.param("incident")))
140
133
  .find({ service, window })
141
134
  })
142
- // total downtime per service (the denotation's one arithmetic):
143
- const downtime = query(Uptime).rule((r) => {
144
- const { service, window } = v(Outage)
145
- return r.match(Outage, { service, window }).find({ service, downtime: r.sum(r.duration(window)) })
146
- })
135
+ // total downtime per service is host arithmetic on the interval
136
+ // endpoints every answer row already carries (`end − start`).
147
137
  ```
148
138
 
149
139
  ## 2. Discriminated unions
@@ -225,7 +215,7 @@ const unaddressed = query(Optionality).rule((r) => {
225
215
  const { id: b } = v(Business)
226
216
  return r
227
217
  .match(Business, { id: b })
228
- .where(not(MailingAddress, { business: b }))
218
+ .where(r.not(MailingAddress, { business: b }))
229
219
  .find({ b })
230
220
  })
231
221
  ```
@@ -507,7 +497,7 @@ const playingAt = query(Playlists).rule((r) => {
507
497
  const { slot, track } = v(Slot)
508
498
  return r
509
499
  .match(Slot, { playlist: r.param("list"), slot, track })
510
- .where(pointIn(r.param("pos"), slot))
500
+ .where(r.pointIn(r.param("pos"), slot))
511
501
  .find({ track })
512
502
  })
513
503
 
@@ -623,7 +613,7 @@ const mutual = query(Graph).rule((r) => {
623
613
  return r
624
614
  .match(Follows, { follower: a, followee: b })
625
615
  .match(Follows, { follower: b, followee: a })
626
- .where(lt(a, b))
616
+ .where(r.lt(a, b))
627
617
  .find({ a, b })
628
618
  })
629
619
  ```
@@ -772,14 +762,14 @@ const roomConflicts = query(Calendar).rule((r) => {
772
762
  const { room, span } = v(Booking)
773
763
  return r
774
764
  .match(Booking, { room, span })
775
- .where(allen(span, ALLEN.intersects, r.param("want")))
765
+ .where(r.allen(span, ALLEN.intersects, r.param("want")))
776
766
  .find({ room, span })
777
767
  })
778
768
  const personLoad = query(Calendar).rule((r) => {
779
769
  const { person, span } = v(Claim)
780
770
  return r
781
771
  .match(Claim, { person, span })
782
- .where(allen(span, ALLEN.intersects, r.param("window")))
772
+ .where(r.allen(span, ALLEN.intersects, r.param("window")))
783
773
  .find({ person, span })
784
774
  })
785
775
  ```
@@ -815,7 +805,7 @@ const inForce = query(Pricing).rule((r) => {
815
805
  const { rate_bps, valid } = v(Version)
816
806
  return r
817
807
  .match(Version, { policy: r.param("p"), rate_bps, valid })
818
- .where(pointIn(r.param("t"), valid))
808
+ .where(r.pointIn(r.param("t"), valid))
819
809
  .find({ rate_bps })
820
810
  })
821
811
  // clean successions (half-open makes MEETS exact, no ±1 fudge):
@@ -825,7 +815,7 @@ const successions = query(Pricing).rule((r) => {
825
815
  return r
826
816
  .match(Version, { policy: p, valid: a })
827
817
  .match(Version, { policy: p, valid: b })
828
- .where(allen(a, ALLEN.meets, b))
818
+ .where(r.allen(a, ALLEN.meets, b))
829
819
  .find({ a, b })
830
820
  })
831
821
  ```
@@ -858,7 +848,7 @@ const holding = query(Payroll).rule((r) => {
858
848
  const { seq, span } = v(PayPeriod)
859
849
  return r
860
850
  .match(PayPeriod, { year: r.param("y"), seq, span })
861
- .where(pointIn(r.param("t"), span))
851
+ .where(r.pointIn(r.param("t"), span))
862
852
  .find({ seq })
863
853
  })
864
854
  ```
@@ -908,7 +898,7 @@ const marginal = query(Tax).rule((r) => {
908
898
  return r
909
899
  .match(Regime, { id: reg, year: r.param("y"), status: r.param("s") })
910
900
  .match(Bracket, { regime: reg, income: b, rate_bps })
911
- .where(pointIn(r.param("taxable"), b))
901
+ .where(r.pointIn(r.param("taxable"), b))
912
902
  .find({ rate_bps })
913
903
  })
914
904
  ```
@@ -939,11 +929,9 @@ const busy = query(FreeTime).rule((r) => {
939
929
  const { person, span } = v(Claim)
940
930
  return r.match(Claim, { person, span }).find({ person, packed: r.pack(span) })
941
931
  })
942
- // raw claimed time (overlaps double-count often the wrong question):
943
- const claimed = query(FreeTime).rule((r) => {
944
- const { person, span } = v(Claim)
945
- return r.match(Claim, { person, span }).find({ person, claimed: r.sum(r.duration(span)) })
946
- })
932
+ // raw claimed time is host arithmetic on the interval endpoints every
933
+ // answer row already carries (`end − start`). Overlaps double-count,
934
+ // often the wrong question.
947
935
  // Coalesced totals = the two-query composition (pack, then a host fold) —
948
936
  // aggregates never nest; free time (gaps) is the two-line host walk over
949
937
  // sorted packed answers (host sorts by person then span start/end) — both
@@ -1096,10 +1084,9 @@ const deriving = query(Rollup).rule((r) => {
1096
1084
 
1097
1085
  Guarantee: Lean theorem + represented planner/runtime premise — rule union is
1098
1086
  set-idempotent (`lean/Bumbledb/Query/Denotation.lean: union_idempotent`);
1099
- key-backed DU arms justify a disjointness *witness*
1100
- (`lean/Bumbledb/Exec/Dedup.lean: disjoint_witness_licence`) spent diagnostically
1101
- only — execution always keeps one spanning seen-set
1102
- (`docs/architecture/40-execution.md` § set semantics).
1087
+ key-backed DU arms satisfy the disjoint-arms licence
1088
+ (`lean/Bumbledb/Exec/Dedup.lean: disjoint_witness_licence`); execution
1089
+ always keeps one spanning seen-set.
1103
1090
 
1104
1091
  The whole-DU read is a set of rules: one head, one rule per arm — disjunction
1105
1092
  is data at the top, never an execution node.
@@ -1120,8 +1107,8 @@ const Payments = schema("Payments", { Kind, Payment, Card, Ach }, [
1120
1107
 
1121
1108
  // One query, two rules (set union). The exclusivity theorem (recipe 2) is
1122
1109
  // spent a third time here: rules selecting different `kind` handles are
1123
- // provably disjoint. Plan introspection retains the witness; execution still
1124
- // probes one spanning seen-set — the measured refutation deleted the elision.
1110
+ // provably disjoint. Execution still probes one spanning seen-set — the
1111
+ // measured refutation deleted the elision.
1125
1112
  const wholeDu = query(Payments)
1126
1113
  .rule((r) => {
1127
1114
  const { id } = v(Payment)
@@ -1226,7 +1213,7 @@ const root = 1n // the host's chosen root node id
1226
1213
  const seen = new Set<bigint>([root])
1227
1214
  let frontier: readonly bigint[] = [root]
1228
1215
  for (;;) {
1229
- const next = db.execute(stepPrepared, { frontier }) // one set-param query
1216
+ const next = db.read((i) => i.execute(stepPrepared, { frontier })) // one set-param query
1230
1217
  const fresh = next
1231
1218
  .map((row) => row.c)
1232
1219
  .filter((c) => {
@@ -1257,7 +1244,7 @@ const reach = query(Closure)
1257
1244
  const { id: c } = v(Node)
1258
1245
  return r
1259
1246
  .match(Node, { id: c })
1260
- .where(eq(c, r.param("root")))
1247
+ .where(r.eq(c, r.param("root")))
1261
1248
  .find({ c })
1262
1249
  }
1263
1250
  ],
@@ -1289,7 +1276,7 @@ const unreached = query(Closure)
1289
1276
  const { id: c } = v(Node)
1290
1277
  return r
1291
1278
  .match(Node, { id: c })
1292
- .where(eq(c, r.param("root")))
1279
+ .where(r.eq(c, r.param("root")))
1293
1280
  .find({ c })
1294
1281
  }
1295
1282
  ],
@@ -1360,7 +1347,7 @@ const nativeRollup = query(Accounts)
1360
1347
  const { id: a } = v(Account)
1361
1348
  return r
1362
1349
  .match(Account, { id: a })
1363
- .where(eq(a, r.param("root")))
1350
+ .where(r.eq(a, r.param("root")))
1364
1351
  .find({ a })
1365
1352
  }
1366
1353
  ],
@@ -1500,7 +1487,7 @@ const inForceAt = query(Payroll).rule((r) => {
1500
1487
  return r
1501
1488
  .match(Employee, { id: e, name })
1502
1489
  .match(Salary, { employee: e, amount, applies: w })
1503
- .where(pointIn(r.param("at"), w))
1490
+ .where(r.pointIn(r.param("at"), w))
1504
1491
  .find({ name, amount })
1505
1492
  })
1506
1493
  ```
@@ -1620,7 +1607,7 @@ db.write((tx) => {
1620
1607
  const grp = minted.grp ?? 0n
1621
1608
 
1622
1609
  // db.get — the standalone keyed read through the declared law:
1623
- const byGroup = db.get(Course, courseGrpKey, { grp })
1610
+ const byGroup = db.read((i) => i.get(Course, courseGrpKey, { grp }))
1624
1611
 
1625
1612
  // snap.get — the same spelling inside a read scope:
1626
1613
  const viaSnap = db.read((instance) => instance.get(Course, courseGrpKey, { grp }))
@@ -1636,7 +1623,7 @@ db.write((tx) => {
1636
1623
  })
1637
1624
 
1638
1625
  // The primary 2-arg form — the fresh field is the primary key:
1639
- const byId = byGroup === undefined ? undefined : db.get(Course, { id: byGroup.id })
1626
+ const byId = byGroup === undefined ? undefined : db.read((i) => i.get(Course, { id: byGroup.id }))
1640
1627
  ```
1641
1628
 
1642
1629
  The anti-pattern this recipe retires: a scan-and-find where a key law
@@ -1729,11 +1716,8 @@ const Rooms = schema("Rooms", { Room, Booking }, [
1729
1716
  )
1730
1717
  ])
1731
1718
 
1732
- // the booked time per room, read back:
1733
- const booked = query(Rooms).rule((r) => {
1734
- const { id, room, booked } = v(Booking)
1735
- return r.match(Booking, { id, room, booked }).find({ room, total: r.sum(r.duration(booked)) })
1736
- })
1719
+ // the booked time per room is host arithmetic on the `booked`
1720
+ // endpoints every answer row already carries (`end − start`).
1737
1721
  ```
1738
1722
 
1739
1723
  Mind the weighted `{0}` and the weighted floor: on a weighted statement
package/README.md CHANGED
@@ -33,7 +33,7 @@ and result rows are inferred, and a failed constraint check is returned as
33
33
  structured data rather than thrown as an exception.
34
34
 
35
35
  ```ts
36
- import { bool, closed, contained, Db, gt, type Infer, key, on, query, relation, schema, u64, v } from "@bjornpagen/bumbledb"
36
+ import { bool, closed, contained, Db, type Infer, key, on, query, relation, schema, u64, v } from "@bjornpagen/bumbledb"
37
37
 
38
38
  // A fixed set can carry typed columns as well as names.
39
39
  // Its ID type is the union "DirectPass" | "JudgedPass" | "Failed".
@@ -92,12 +92,12 @@ const certifiedAbove = query(Review).rule((r) => {
92
92
  return r
93
93
  .match(Certificate, { attempt: a, kind: k })
94
94
  .match(Kind, { id: k, mastered: true, rank }) // reusing k at Kind.id creates the join
95
- .where(gt(rank, r.param("floor")))
95
+ .where(r.gt(rank, r.param("floor")))
96
96
  .find({ a, rank })
97
97
  })
98
98
 
99
99
  const prepared = db.prepare(certifiedAbove)
100
- const rows = db.execute(prepared, { floor: 15n }) // rows: { a: bigint; rank: bigint }[]
100
+ const rows = db.read((i) => i.execute(prepared, { floor: 15n })) // rows: { a: bigint; rank: bigint }[]
101
101
  console.log(rows)
102
102
 
103
103
  // A store read is one callback. The instance is invalid when the callback
@@ -1,31 +1,31 @@
1
1
  /**
2
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 —
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()` names the measure on the SOURCE row
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()`/`duration()` read a dependent bound from the
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
- * 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).
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
- * 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).
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)"> : unknown;
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()` bound counts facts against a span of
154
- * time — a dimension error. Judged on the `capacity()` UNIT overload
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()` call where the source face is
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()` it is the SOURCE row's interval measure;
317
- * in `within()`'s hi slot it is the TARGET row's interval-measure bound
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>;
@@ -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;;;;;;;;GAQG;AACH,QAAA,MAAM,QAAQ,EAAE,OAAO,MAA6C,CAAA;AAEpE;;;;;GAKG;AACH,UAAU,c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