@bjornpagen/bumbledb 0.14.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/COOKBOOK.md +58 -62
  2. package/README.md +82 -56
  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 +93 -290
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +713 -556
  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 +13 -23
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +11 -20
  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 +97 -390
  40. package/dist/native.d.ts.map +1 -1
  41. package/dist/native.js +39 -61
  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 +3 -3
  84. package/src/capacity.ts +26 -140
  85. package/src/closed.ts +5 -206
  86. package/src/db.ts +997 -854
  87. package/src/face.ts +0 -142
  88. package/src/fields.ts +4 -172
  89. package/src/index.ts +32 -35
  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 +192 -413
  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
  104. package/dist/exhume.d.ts +0 -143
  105. package/dist/exhume.d.ts.map +0 -1
  106. package/dist/exhume.js +0 -166
  107. package/dist/exhume.js.map +0 -1
  108. package/src/exhume.ts +0 -267
package/dist/law.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The law-typing engine (owner ruling 2026-07-18, "option 2, zero debate"):
3
- * THE LAWS TYPE THE COLUMNS. Domains are declared nowhere — `schema()`
3
+ * THE LAWS TYPE THE COLUMNS. Domains are declared nowhere — `schema`
4
4
  * computes every field's domain FROM the statement list, at BOTH the type
5
5
  * level (this module's type machinery, reading the statements tuple type)
6
6
  * and at runtime (a plain union-find over the same pairs), and the two
@@ -8,37 +8,41 @@
8
8
  *
9
9
  * The three class laws (ratified; implemented exactly):
10
10
  *
11
- * 1. GENERATORS — a `fresh` field is a generator and names its class by
12
- * its declaration coordinate (`"Account.id"`); a closed relation's
13
- * synthetic id is a generator named `"Kind.id"`.
14
- * 2. GENERATOR-LESS classes are named by their least member coordinate
15
- * in relation-declaration × field-declaration order (readable off the
16
- * relation record and each member's frozen field list at the VALUE
17
- * tier — deterministic, pinned forever; the wire reads only this
18
- * tier). At the TYPE tier the same class is carried as its
19
- * member-coordinate SET (see {@link ClassOfCoord}): TypeScript's
20
- * union member order is not observably deterministic, so a type-level
21
- * least-member pick would drift between compilations — the set is the
22
- * canonical deterministic spelling, the runtime name is always a
23
- * member of it, and the join judgment is identical at both tiers.
24
- * 3. BARE — a field in no law has NO class and pairs only with bare in
25
- * queries (the deliberate sum-domain pointer stays legal).
11
+ * 1. GENERATORS — a `fresh` field is a generator and names its class by
12
+ * its declaration coordinate (`"Account.id"`); a closed relation's
13
+ * synthetic id is a generator named `"Kind.id"`.
14
+ * 2. GENERATOR-LESS classes are named by their least member coordinate
15
+ * in relation-declaration × field-declaration order (readable off the
16
+ * relation record and each member's frozen field list at the VALUE
17
+ * tier — deterministic, pinned forever; the wire reads only this
18
+ * tier). At the TYPE tier the same class is carried as its
19
+ * member-coordinate SET (see {@link ClassOfCoord}): TypeScript's
20
+ * union member order is not observably deterministic, so a type-level
21
+ * least-member pick would drift between compilations — the set is the
22
+ * canonical deterministic spelling, the runtime name is always a
23
+ * member of it, and the join judgment is identical at both tiers.
24
+ * 3. BARE — a field in no law has NO class and pairs only with bare in
25
+ * queries (the deliberate sum-domain pointer stays legal).
26
26
  *
27
27
  * THE WALL: a class containing more than one generator is a contradiction
28
28
  * (two mints cannot share a carrier) — a schema-level COMPILE error (the
29
29
  * named, self-locating {@link ClassWall}: which generator coordinates
30
30
  * collided, through which paired slots) with a construction-time runtime
31
31
  * twin (`computeClasses` throws with the same content, naming the exact
32
- * statement).
32
+ * statement). The TARGET-KEY WALL ({@link TargetKeyWall},
33
+ * 60-containment-parity) rides the same constraint seam: a containment/
34
+ * mirrors/capacity target projection that resolves no key of its relation
35
+ * is the same kind of schema-level compile error, with `schema`'s
36
+ * `verifyTargetKeys` as its authoritative runtime twin.
33
37
  *
34
38
  * Every paired face of the statement tuple unions its positionwise field
35
39
  * slots: containment (ψ-selected targets included — a selection changes
36
40
  * pairing not at all), the `==` bijection, and capacity source/target pairs.
37
- * `key()` statements pair nothing (an FD constrains one relation's own
41
+ * `key` statements pair nothing (an FD constrains one relation's own
38
42
  * rows; it identifies no carriers).
39
43
  *
40
44
  * The type tier reads pairs off the statement types' exact face data, so
41
- * spell the statement list INLINE in `schema()` (the `const` type
45
+ * spell the statement list INLINE in `schema` (the `const` type
42
46
  * parameter keeps the tuple precise). A widened `Statement[]` list
43
47
  * degrades the TYPE tier to generators-only (no pair is readable off a
44
48
  * widened type) — the runtime map stays complete and authoritative, and
@@ -54,149 +58,163 @@ import type { FaceData } from "./face.js";
54
58
  import type { AnyRelation, RelationFields } from "./relation.js";
55
59
  import type { SchemaRelation, SchemaRelations } from "./schema.js";
56
60
  import { type Statement } from "./statements.js";
57
- /** One relation's computed classes: field name → class name, `undefined` = bare. */
58
61
  type RelationClasses = {
59
62
  readonly [field: string]: string | undefined;
60
63
  };
61
- /**
62
- * The class map a schema carries — relation name → field name → the
63
- * computed class name (`undefined` = bare). THE domain authority: queries
64
- * and the wire lowering read domains from here and nowhere else. The wide
65
- * shape is the default every `Schema`-generic surface accepts; a concrete
66
- * schema's `classes` property carries the EXACT computed map
67
- * ({@link ClassesOf}) at the type level and the frozen runtime twin
68
- * (`computeClasses`) at the value level — one property, two tiers, one
69
- * computation.
70
- */
71
64
  type SchemaClasses = {
72
65
  readonly [relation: string]: RelationClasses;
73
66
  };
74
- /** Looks one relation's class record up in a schema's class map (absent relation = no classes). */
75
67
  type ClassRecordOf<Classes extends SchemaClasses, N extends string> = N extends keyof Classes ? Classes[N] : Record<never, never>;
76
- /** Looks one field's class up in a relation's class record (absent field = bare). */
77
68
  type ClassLookup<CR, K> = K extends keyof CR ? CR[K] & (string | undefined) : undefined;
78
- /** A closed member's declared payload-column record (`never` on ordinary relations). */
79
69
  type MemberColumns<M> = M extends AnyClosed ? M["columns"] : never;
80
- /** The field names of one schema member: a relation's declared fields; a closed relation's sealed `id` + columns. */
81
70
  type MemberFieldNames<M extends SchemaRelation> = M extends AnyClosed ? "id" | (keyof MemberColumns<M> & string) : M extends AnyRelation ? keyof RelationFields<M> & string : never;
82
- /** The fresh-marked field names of one field block. */
83
71
  type FreshFieldNames<Fields> = {
84
72
  [F in keyof Fields & string]: Fields[F] extends {
85
73
  readonly fresh: true;
86
74
  } ? F : never;
87
75
  }[keyof Fields & string];
88
- /** One member's generator coordinates: fresh fields; a closed relation's synthetic id. */
89
76
  type MemberGenerators<N extends string, M extends SchemaRelation> = M extends AnyClosed ? `${N}.id` : M extends AnyRelation ? `${N}.${FreshFieldNames<RelationFields<M>>}` : never;
90
- /** Every generator coordinate of a relation record (a union). */
91
77
  type GeneratorsOf<Rels extends SchemaRelations> = {
92
78
  [N in keyof Rels & string]: MemberGenerators<N, Rels[N]>;
93
79
  }[keyof Rels & string];
94
- /** One paired-slot pair of coordinates. */
95
80
  type Pair = readonly [string, string];
96
- /** A list of slot pairs. */
97
81
  type PairList = readonly Pair[];
98
- /** Zips two faces' projections into coordinate pairs, positionwise. */
99
82
  type ZipCoords<SN extends string, SP extends readonly string[], TN extends string, TP extends readonly string[], Acc extends PairList = []> = SP extends readonly [infer SH extends string, ...infer ST extends readonly string[]] ? TP extends readonly [infer TH extends string, ...infer TT extends readonly string[]] ? ZipCoords<SN, ST, TN, TT, readonly [...Acc, readonly [`${SN}.${SH}`, `${TN}.${TH}`]]> : Acc : Acc;
100
- /**
101
- * One statement's slot pairs: containments (bidirectional included — pair
102
- * unions are symmetric) and capacity statements pair their two faces
103
- * positionwise;
104
- * `key()` pairs nothing. A widened face (owner name or projection no
105
- * longer literal) contributes nothing — the runtime map stays complete.
106
- */
107
83
  type StatementPairs<St extends Statement> = St["data"] extends {
108
84
  readonly source: infer S extends FaceData;
109
85
  readonly target: infer T extends FaceData;
110
86
  } ? string extends S["owner"]["name"] ? [] : string extends T["owner"]["name"] ? [] : ZipCoords<S["owner"]["name"], S["projection"], T["owner"]["name"], T["projection"]> : [];
111
- /** Every slot pair of a statements tuple, in written order. */
112
87
  type PairsOf<Stmts extends readonly Statement[], Acc extends PairList = []> = Stmts extends readonly [
113
88
  infer H extends Statement,
114
89
  ...infer T extends readonly Statement[]
115
90
  ] ? PairsOf<T, readonly [...Acc, ...StatementPairs<H>]> : Acc;
116
- /** The component (a union of coordinates) containing `X`, or `never` when `X` is in none. */
117
91
  type CompOf<Comps extends readonly string[], X extends string> = Comps extends readonly [
118
92
  infer H extends string,
119
93
  ...infer T extends readonly string[]
120
94
  ] ? [X] extends [H] ? H : CompOf<T, X> : never;
121
- /** Rebuilds the component list without the component `C` (components are disjoint; identity is mutual extension). */
122
95
  type WithoutComp<Comps extends readonly string[], C extends string, Acc extends readonly string[] = []> = Comps extends readonly [infer H extends string, ...infer T extends readonly string[]] ? [H, C] extends [C, H] ? WithoutComp<T, C, Acc> : WithoutComp<T, C, readonly [...Acc, H]> : Acc;
123
- /** Unions one pair into the component list: create, extend, keep, or merge. */
124
96
  type AddPair<Comps extends readonly string[], A extends string, B extends string> = [
125
97
  CompOf<Comps, A>,
126
98
  CompOf<Comps, B>
127
99
  ] extends [infer CA extends string, infer CB extends string] ? [CA] extends [never] ? [CB] extends [never] ? readonly [...Comps, A | B] : readonly [...WithoutComp<Comps, CB>, CB | A] : [CB] extends [never] ? readonly [...WithoutComp<Comps, CA>, CA | B] : [CA, CB] extends [CB, CA] ? Comps : readonly [...WithoutComp<WithoutComp<Comps, CA>, CB>, CA | CB] : Comps;
128
- /** Folds every pair into connected components (tail-recursive — the whole walk is one loop). */
129
100
  type BuildComps<Pairs extends PairList, Comps extends readonly string[] = readonly []> = Pairs extends readonly [
130
101
  infer P extends Pair,
131
102
  ...infer T extends PairList
132
103
  ] ? BuildComps<T, AddPair<Comps, P[0], P[1]>> : Comps;
133
- /** Whether a union holds two or more members (`All` captures the whole union across distribution). */
134
104
  type IsMulti<U, All = U> = [U] extends [never] ? false : U extends unknown ? ([All] extends [U] ? false : true) : never;
135
- /**
136
- * The named, self-locating compile verdict of the one-generator wall: the
137
- * generator coordinates that collided and the paired slots (rendered
138
- * `A.x ~ B.y`, statement order) whose chain unified them. Intersected into
139
- * `schema()`'s statements parameter, so the error lands ON the statement
140
- * list with this key naming the law. The runtime twin throws from
141
- * `computeClasses` with the same content, naming the exact statement.
142
- */
143
105
  interface ClassWall<Generators extends string, Chain extends readonly string[]> {
144
106
  readonly "schema class wall — the statements unify two generators into one class (two mints cannot share a carrier)": {
145
107
  readonly generators: Generators;
146
108
  readonly through: Chain;
147
109
  };
148
110
  }
149
- /** The paired slots lying inside component `C`, rendered — the wall's self-locating chain. */
150
111
  type ChainOf<Pairs extends PairList, C extends string, Acc extends readonly string[] = []> = Pairs extends readonly [
151
112
  infer P extends Pair,
152
113
  ...infer T extends PairList
153
114
  ] ? [P[0]] extends [C] ? ChainOf<T, C, readonly [...Acc, `${P[0]} ~ ${P[1]}`]> : ChainOf<T, C, Acc> : Acc;
154
- /** Scans the components for a two-generator class: `unknown` (lawful) or the {@link ClassWall}. */
155
115
  type WallScan<Comps extends readonly string[], Gens extends string, Pairs extends PairList> = Comps extends readonly [
156
116
  infer H extends string,
157
117
  ...infer T extends readonly string[]
158
118
  ] ? true extends IsMulti<Extract<H, Gens>> ? ClassWall<Extract<H, Gens>, ChainOf<Pairs, H>> : WallScan<T, Gens, Pairs> : unknown;
119
+ type SetEq<A extends string, B extends string> = [A] extends [B] ? ([B] extends [A] ? true : false) : false;
120
+ type KeyEntry = readonly [string, string];
159
121
  /**
160
- * The one-generator-per-class law as a constraint: resolves to `unknown`
161
- * (a no-op intersection into the statements parameter) when the statement
162
- * list is lawful, and to the named {@link ClassWall} otherwise.
122
+ * Every declared `key` of a statements tuple as {@link KeyEntry} rows —
123
+ * the declared half of the target-key roster (the implied half is read off
124
+ * each target face's own relation value: fresh marks, closed ids). A
125
+ * statement-tuple union or any undecidable key element degrades the WHOLE
126
+ * wall to silent before this roster is ever consulted
127
+ * ({@link DecidableRoster}) — the skip arm here is the same judgment
128
+ * stated locally, kept as belt, as is {@link DeclaredKeyMatch}'s
129
+ * unjudgeable-projection arm.
163
130
  */
164
- type LawfulStatements<Rels extends SchemaRelations, Stmts extends readonly Statement[]> = WallScan<BuildComps<PairsOf<Stmts>>, GeneratorsOf<Rels>, PairsOf<Stmts>>;
131
+ type DeclaredKeysOf<Stmts extends readonly Statement[], Acc extends readonly KeyEntry[] = []> = Stmts extends readonly [
132
+ infer H extends Statement,
133
+ ...infer T extends readonly Statement[]
134
+ ] ? H["data"] extends {
135
+ readonly kind: "key";
136
+ readonly owner: infer O extends AnyRelation;
137
+ readonly projection: infer P extends readonly string[];
138
+ } ? string extends O["name"] ? DeclaredKeysOf<T, Acc> : DeclaredKeysOf<T, readonly [...Acc, readonly [O["name"], P[number]]]> : DeclaredKeysOf<T, Acc> : Acc;
139
+ type LiteralProjection<P extends readonly string[]> = [true] extends [IsMulti<P>] ? false : [number] extends [P["length"]] ? false : [P] extends [readonly [infer H extends string, ...infer T extends readonly string[]]] ? [string] extends [H] ? false : [true] extends [IsMulti<H>] ? false : LiteralProjection<T> : true;
140
+ type DecidableKeyData<D> = [D] extends [
141
+ {
142
+ readonly kind: "key";
143
+ readonly owner: infer O extends AnyRelation;
144
+ readonly projection: infer P extends readonly string[];
145
+ }
146
+ ] ? [true] extends [IsMulti<D>] ? false : [string] extends [O["name"]] ? false : [true] extends [IsMulti<O["name"]>] ? false : LiteralProjection<P> : false;
165
147
  /**
166
- * One coordinate's class per the three laws, at the TYPE tier: its
167
- * component's single generator (the exact literal — a generator names its
168
- * class); a component-less generator is its own class; a component-less
169
- * non-generator is bare (`undefined`); and a GENERATOR-LESS component is
170
- * carried as its member-coordinate SET (the union of the component's
171
- * coordinates — a canonical, deterministic type). The set REPRESENTS the
172
- * runtime's least-member class name faithfully: the runtime name is by
173
- * construction a member, two slots share a class exactly when their sets
174
- * are identical (so `JoinOk` judges identically at both tiers), and bare
175
- * never equals a set. The least-member PICK itself is deliberately not
176
- * made at the type tier: TypeScript's union member order is not observably
177
- * deterministic (the same key union tuples differently across checking
178
- * contexts — measured, not conjectured), so any type-level "least in
179
- * declaration order" would drift between compilations; the ratified
180
- * declaration-order name lives at the VALUE tier (`computeClasses`), which
181
- * is the only tier the wire reads.
148
+ * THE total decidability detector of the type-tier target-key judgment —
149
+ * a strict WHITELIST of provably-judgeable shapes, never a blocklist of
150
+ * known-bad spellings (representation over control flow: the detector is
151
+ * total by construction, so a spelling nobody has met yet degrades
152
+ * instead of firing). It answers `true` ONLY when ALL hold, each check
153
+ * tuple-bracketed against distribution:
154
+ *
155
+ * - SINGULAR — `Stmts` itself is a single non-union type (a ternary
156
+ * between two individually-lawful `as const` statement lists infers a
157
+ * UNION of tuples; a naked `Stmts` would distribute the scan
158
+ * ({@link TargetKeyScan}) and the roster ({@link DeclaredKeysOf})
159
+ * INDEPENDENTLY, cross-judging one arm's faces against the other
160
+ * arm's keys). The union test is the house device ({@link IsMulti}).
161
+ * - FIXED-LENGTH — `Stmts` is a literal tuple with no rest tail:
162
+ * `[number] extends [Stmts["length"]]` detects a rest/array length. A
163
+ * rest-tail tuple (`readonly [typeof stmt,...Statement[]]`) peels its
164
+ * literal head and hides EVERY key in the tail from a head-peeling
165
+ * roster read — the scan would judge the head against a roster blind
166
+ * to keys the value tier can see.
167
+ * - CONCRETE ELEMENTS — every element is a single non-union statement
168
+ * (per-element {@link IsMulti}), and every element whose
169
+ * `data["kind"]` type INCLUDES `"key"` is a single concrete `KeyData`
170
+ * with a literal owner name and a projection that is itself a single
171
+ * non-union fixed-length tuple of string literals
172
+ * ({@link DecidableKeyData}, {@link LiteralProjection}). A bare
173
+ * `Statement` element, a `Statement` union, a `KeyStatement` union, a
174
+ * widened owner, a widened or union projection each make the roster
175
+ * UNKNOWABLE.
176
+ *
177
+ * Any failure is the tier's one forbidden verdict in waiting — a false
178
+ * wall — so anything outside the whitelist degrades the WHOLE
179
+ * {@link TargetKeyWall} to silent (the degradation law: best effort
180
+ * degrades to silent, never to a wrong judgment), exactly as a widened
181
+ * FACE already silences its own judgment; the value tier stays
182
+ * authoritative. ONE recorded limit, pre-existing and outside this
183
+ * detector's reach: a generic type parameter CONSTRAINED to a union of
184
+ * tuples hangs tsc in the deferred-scan machinery before any verdict is
185
+ * reached — a degenerate spelling no shipped surface writes, recorded
186
+ * here as the tier's known boundary, not fixed.
182
187
  */
188
+ type DecidableRoster<Stmts extends readonly Statement[]> = [true] extends [IsMulti<Stmts>] ? false : [number] extends [Stmts["length"]] ? false : [Stmts] extends [readonly [infer H extends Statement, ...infer T extends readonly Statement[]]] ? [true] extends [IsMulti<H>] ? false : "key" extends H["data"]["kind"] ? [DecidableKeyData<H["data"]>] extends [true] ? DecidableRoster<T> : false : DecidableRoster<T> : true;
189
+ interface TargetKeyWall<Target extends string, Projection extends string> {
190
+ readonly "schema target-key wall — a containment/mirrors/capacity target projection matches no key of the target relation (declare the key() it resolves, or project an existing one)": {
191
+ readonly target: Target;
192
+ readonly projection: Projection;
193
+ };
194
+ }
195
+ type DeclaredKeyMatch<N extends string, PU extends string, Keys extends readonly KeyEntry[]> = Keys extends readonly [
196
+ infer H extends KeyEntry,
197
+ ...infer T extends readonly KeyEntry[]
198
+ ] ? SetEq<H[0], N> extends true ? string extends H[1] ? true : SetEq<PU, H[1]> extends true ? true : DeclaredKeyMatch<N, PU, T> : DeclaredKeyMatch<N, PU, T> : TargetKeyWall<N, PU>;
199
+ type FreshKeyMatch<PU extends string, O extends AnyRelation> = [PU] extends [FreshFieldNames<RelationFields<O>>] ? true extends IsMulti<PU> ? false : true : false;
200
+ type JudgeTargetFace<F extends FaceData, Keys extends readonly KeyEntry[]> = string extends F["owner"]["name"] ? true : string extends F["projection"][number] ? true : F["owner"] extends AnyClosed ? SetEq<F["projection"][number], "id"> extends true ? true : TargetKeyWall<F["owner"]["name"], F["projection"][number]> : F["owner"] extends AnyRelation ? FreshKeyMatch<F["projection"][number], F["owner"]> extends true ? true : DeclaredKeyMatch<F["owner"]["name"], F["projection"][number], Keys> : true;
201
+ type JudgeStatement<St extends Statement, Keys extends readonly KeyEntry[]> = St["data"] extends {
202
+ readonly source: FaceData;
203
+ readonly target: infer Tg extends FaceData;
204
+ } ? JudgeTargetFace<Tg, Keys> : true;
205
+ type TargetKeyScan<Stmts extends readonly Statement[], Keys extends readonly KeyEntry[]> = Stmts extends readonly [
206
+ infer H extends Statement,
207
+ ...infer T extends readonly Statement[]
208
+ ] ? [JudgeStatement<H, Keys>] extends [true] ? TargetKeyScan<T, Keys> : JudgeStatement<H, Keys> : unknown;
209
+ type LawfulStatements<Rels extends SchemaRelations, Stmts extends readonly Statement[]> = WallScan<BuildComps<PairsOf<Stmts>>, GeneratorsOf<Rels>, PairsOf<Stmts>> & ([DecidableRoster<Stmts>] extends [true] ? TargetKeyScan<Stmts, DeclaredKeysOf<Stmts>> : unknown);
183
210
  type ClassOfCoord<Comps extends readonly string[], Gens extends string, C extends string> = [CompOf<Comps, C>] extends [
184
211
  infer M extends string
185
212
  ] ? [M] extends [never] ? [C] extends [Gens] ? C : undefined : [Extract<M, Gens>] extends [infer G extends string] ? [G] extends [never] ? M : G : never : never;
186
- /** The computed class map over precomputed components/generators. */
187
213
  type ComputedClasses<Rels extends SchemaRelations, Comps extends readonly string[], Gens extends string> = {
188
214
  readonly [N in keyof Rels & string]: {
189
215
  readonly [F in MemberFieldNames<Rels[N]>]: ClassOfCoord<Comps, Gens, `${N}.${F}`>;
190
216
  };
191
217
  };
192
- /**
193
- * THE type-level class map of a schema: relation name → field name → the
194
- * law-computed class (`undefined` = bare) — what `schema()` returns as the
195
- * `classes` property's type, and what query joins compare. Generator
196
- * classes are exact name literals; generator-less classes are their
197
- * member-coordinate sets (see {@link ClassOfCoord} — the runtime map's
198
- * least-member name is always a member, so the property type is honest).
199
- */
200
218
  type ClassesOf<Rels extends SchemaRelations, Stmts extends readonly Statement[]> = ComputedClasses<Rels, BuildComps<PairsOf<Stmts>>, GeneratorsOf<Rels>>;
201
219
  /**
202
220
  * Computes the class map — the runtime twin of {@link ClassesOf}, the SAME
@@ -221,6 +239,6 @@ declare function computeClasses(name: string, relations: SchemaRelations, statem
221
239
  * the generated fixture probes (the runtime/type diff check).
222
240
  */
223
241
  declare function classesComplete<Classes extends SchemaClasses>(classes: SchemaClasses, relations: SchemaRelations): classes is Classes;
224
- export type { ClassesOf, ClassLookup, ClassRecordOf, ClassWall, LawfulStatements, RelationClasses, SchemaClasses };
242
+ export type { ClassesOf, ClassLookup, ClassRecordOf, ClassWall, LawfulStatements, RelationClasses, SchemaClasses, TargetKeyWall };
225
243
  export { classesComplete, computeClasses };
226
244
  //# sourceMappingURL=law.d.ts.map
package/dist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M,CAAC,SAAS,MAAM,CAAC,GAClD,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAClB,CAAC,GACD,CAAC,GACF,KAAK,GACP,KAAK,CAAA;AAER,KAAK,eAAe,CAAC,IAAI,SAAS,eAAe,EAAE,KAAK,SAAS,SAAS,MAAM,EAAE,EAAE,IAAI,SAAS,MAAM,IAAI;IAC1G,QAAQ,EAAE,CAAC,IAAI,MAAM,IAAI,GAAG,MAAM,GAAG;QACpC,QAAQ,EAAE,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;KACjF;CACD,CAAA;AAED,KAAK,SAAS,CAAC,IAAI,SAAS,eAAe,EAAE,KAAK,SAAS,SAAS,SAAS,EAAE,IAAI,eAAe,CACjG,IAAI,EACJ,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAC1B,YAAY,CAAC,IAAI,CAAC,CAClB,CAAA;AA+ED;;;;;;;;;;;GAWG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,aAAa,CAiEjH;AAED;;;;;;;;GAQG;AACH,iBAAS,eAAe,CAAC,OAAO,SAAS,aAAa,EACrD,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,eAAe,GACxB,OAAO,IAAI,OAAO,CAapB;AAED,YAAY,EACX,SAAS,EACT,WAAW,EACX,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,aAAa,EACb,CAAA;AACD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAA"}
package/dist/law.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The law-typing engine (owner ruling 2026-07-18, "option 2, zero debate"):
3
- * THE LAWS TYPE THE COLUMNS. Domains are declared nowhere — `schema()`
3
+ * THE LAWS TYPE THE COLUMNS. Domains are declared nowhere — `schema`
4
4
  * computes every field's domain FROM the statement list, at BOTH the type
5
5
  * level (this module's type machinery, reading the statements tuple type)
6
6
  * and at runtime (a plain union-find over the same pairs), and the two
@@ -8,37 +8,41 @@
8
8
  *
9
9
  * The three class laws (ratified; implemented exactly):
10
10
  *
11
- * 1. GENERATORS — a `fresh` field is a generator and names its class by
12
- * its declaration coordinate (`"Account.id"`); a closed relation's
13
- * synthetic id is a generator named `"Kind.id"`.
14
- * 2. GENERATOR-LESS classes are named by their least member coordinate
15
- * in relation-declaration × field-declaration order (readable off the
16
- * relation record and each member's frozen field list at the VALUE
17
- * tier — deterministic, pinned forever; the wire reads only this
18
- * tier). At the TYPE tier the same class is carried as its
19
- * member-coordinate SET (see {@link ClassOfCoord}): TypeScript's
20
- * union member order is not observably deterministic, so a type-level
21
- * least-member pick would drift between compilations — the set is the
22
- * canonical deterministic spelling, the runtime name is always a
23
- * member of it, and the join judgment is identical at both tiers.
24
- * 3. BARE — a field in no law has NO class and pairs only with bare in
25
- * queries (the deliberate sum-domain pointer stays legal).
11
+ * 1. GENERATORS — a `fresh` field is a generator and names its class by
12
+ * its declaration coordinate (`"Account.id"`); a closed relation's
13
+ * synthetic id is a generator named `"Kind.id"`.
14
+ * 2. GENERATOR-LESS classes are named by their least member coordinate
15
+ * in relation-declaration × field-declaration order (readable off the
16
+ * relation record and each member's frozen field list at the VALUE
17
+ * tier — deterministic, pinned forever; the wire reads only this
18
+ * tier). At the TYPE tier the same class is carried as its
19
+ * member-coordinate SET (see {@link ClassOfCoord}): TypeScript's
20
+ * union member order is not observably deterministic, so a type-level
21
+ * least-member pick would drift between compilations — the set is the
22
+ * canonical deterministic spelling, the runtime name is always a
23
+ * member of it, and the join judgment is identical at both tiers.
24
+ * 3. BARE — a field in no law has NO class and pairs only with bare in
25
+ * queries (the deliberate sum-domain pointer stays legal).
26
26
  *
27
27
  * THE WALL: a class containing more than one generator is a contradiction
28
28
  * (two mints cannot share a carrier) — a schema-level COMPILE error (the
29
29
  * named, self-locating {@link ClassWall}: which generator coordinates
30
30
  * collided, through which paired slots) with a construction-time runtime
31
31
  * twin (`computeClasses` throws with the same content, naming the exact
32
- * statement).
32
+ * statement). The TARGET-KEY WALL ({@link TargetKeyWall},
33
+ * 60-containment-parity) rides the same constraint seam: a containment/
34
+ * mirrors/capacity target projection that resolves no key of its relation
35
+ * is the same kind of schema-level compile error, with `schema`'s
36
+ * `verifyTargetKeys` as its authoritative runtime twin.
33
37
  *
34
38
  * Every paired face of the statement tuple unions its positionwise field
35
39
  * slots: containment (ψ-selected targets included — a selection changes
36
40
  * pairing not at all), the `==` bijection, and capacity source/target pairs.
37
- * `key()` statements pair nothing (an FD constrains one relation's own
41
+ * `key` statements pair nothing (an FD constrains one relation's own
38
42
  * rows; it identifies no carriers).
39
43
  *
40
44
  * The type tier reads pairs off the statement types' exact face data, so
41
- * spell the statement list INLINE in `schema()` (the `const` type
45
+ * spell the statement list INLINE in `schema` (the `const` type
42
46
  * parameter keeps the tuple precise). A widened `Statement[]` list
43
47
  * degrades the TYPE tier to generators-only (no pair is readable off a
44
48
  * widened type) — the runtime map stays complete and authoritative, and
@@ -52,12 +56,6 @@
52
56
  import * as errors from "@superbuilders/errors";
53
57
  import { isClosedMember, sealedFieldsOf } from "#closed.ts";
54
58
  import { renderStatement } from "#statements.ts";
55
- /**
56
- * Reads every member's coordinates off the relation record, declaration
57
- * order throughout — the sealed shape through THE one reader
58
- * (`sealedFieldsOf`): a closed member's generator is its synthetic `id`
59
- * (ordinal 0), an ordinary member's generators are its fresh-marked fields.
60
- */
61
59
  function memberCoords(relations) {
62
60
  const out = [];
63
61
  for (const [relationName, member] of Object.entries(relations)) {
@@ -72,7 +70,6 @@ function memberCoords(relations) {
72
70
  }
73
71
  return out;
74
72
  }
75
- /** Builds the union-find. */
76
73
  function makeUnionFind() {
77
74
  const parent = new Map();
78
75
  const generators = new Map();
@@ -114,7 +111,6 @@ function makeUnionFind() {
114
111
  }
115
112
  };
116
113
  }
117
- /** The paired faces of one statement, or undefined for a key (an FD pairs nothing). */
118
114
  function statementFaces(statement) {
119
115
  const data = statement.data;
120
116
  if (data.kind === "key") {
package/dist/law.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"law.js","sourceRoot":"","sources":["../src/law.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAI3D,OAAO,EAAE,eAAe,EAAkB,MAAM,gBAAgB,CAAA;AAkRhE;;;;;GAKG;AACH,SAAS,YAAY,CAAC,SAA0B;IAC/C,MAAM,GAAG,GAAmB,EAAE,CAAA;IAC9B,KAAK,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAChE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;QACrC,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,UAAU,CAAC,QAAQ;YACrE,OAAO;gBACN,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI;aACvG,CAAA;QACF,CAAC,CAAC,CAAA;QACF,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,CAAA;IAC7C,CAAC;IACD,OAAO,GAAG,CAAA;AACX,CAAC;AAUD,6BAA6B;AAC7B,SAAS,aAAa;IAC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AAC,MAAM,CAAC,EAAE,CAAC;YACtD,OAAO,KAAK,CAAA;QACb,CAAC;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,WAAW,CAAC,KAAK;YACpD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;QACzC,CAAC,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC;AAYD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,CAAA"}
package/dist/lower.d.ts CHANGED
@@ -3,42 +3,16 @@
3
3
  * data (`#spec.ts`), which the napi bridge marshals verbatim. Lowering is
4
4
  * TOTAL on well-typed inputs — no validation lives here beyond what the
5
5
  * types and the construction boundaries already guarantee — and it is the
6
- * only place statement internals are read for the wire. Ordering is
7
- * declaration order throughout, and every output object is built with one
8
- * fixed key order, so serialization is deterministic (byte-stable).
6
+ * only place statement internals are read for the wire. In particular,
7
+ * lowering never emits an engine-refused containment target: it accepts
8
+ * only `schema` outputs, and `schema`'s target-key wall already
9
+ * refused any non-key target projection (60-containment-parity —
10
+ * totality INHERITED, not re-checked). Ordering is declaration order
11
+ * throughout, and every output object is built with one fixed key order,
12
+ * so serialization is deterministic (byte-stable).
9
13
  */
10
- import type { AnyClosed } from "./closed.js";
11
- import type { RelationClasses } from "./law.js";
12
- import type { AnyRelation } from "./relation.js";
13
14
  import type { AnySchema } from "./schema.js";
14
- import type { RelationSpec, SchemaSpec } from "./spec.js";
15
- /**
16
- * Lowers one ordinary relation to its `RelationSpec` fragment: fields in
17
- * declaration order, each carrying its law-computed class name as the
18
- * `newtype` (`classes` — the schema's class record for this relation;
19
- * bare fields carry `undefined`), `closed: undefined` (the option is the
20
- * kind — one sum, R7).
21
- */
22
- declare function lowerRelation(relation: AnyRelation, classes: RelationClasses): RelationSpec;
23
- /**
24
- * Lowers one closed relation to its `RelationSpec` fragment: declared
25
- * intrinsic columns only (the engine materializes the synthetic `id`) and
26
- * the fused closedness sum (R7) — the handle newtype (the COMPUTED class
27
- * name of the id's generator class, `"Kind.id"`, always present: a closed
28
- * id is a generator; every referencing field shares it by law, which is
29
- * how the engine resolves a handle literal back to its roster) together
30
- * with the ground axioms in declaration order (row id = index); the
31
- * literals were already lowered at `closed()` construction.
32
- */
33
- declare function lowerClosed(member: AnyClosed, classes: RelationClasses): RelationSpec;
34
- /**
35
- * Lowers a whole theory to the `SchemaSpec` the bridge takes: relations in
36
- * record declaration order, DECLARED statements only in written order (the
37
- * engine materializes the fresh-implied and closed auto-keys itself), and
38
- * every field's `newtype` slot fed from the schema's law-computed class
39
- * map — the ONE domain authority (fingerprint-neutral: the engine drops
40
- * newtypes at descriptor lowering).
41
- */
15
+ import type { SchemaSpec } from "./spec.js";
42
16
  declare function lower(theory: AnySchema): SchemaSpec;
43
- export { lower, lowerClosed, lowerRelation };
17
+ export { lower };
44
18
  //# sourceMappingURL=lower.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lower.d.ts","sourceRoot":"","sources":["../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAI3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAGX,YAAY,EACZ,UAAU,EAIV,MAAM,UAAU,CAAA;AA4FjB;;;;;;GAMG;AACH,iBAAS,aAAa,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,eAAe,GAAG,YAAY,CAKpF;AAED;;;;;;;;;GASG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,GAAG,YAAY,CAY9E;AAKD;;;;;;;GAOG;AACH,iBAAS,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAS5C;AAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA"}
1
+ {"version":3,"file":"lower.d.ts","sourceRoot":"","sources":["../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,KAAK,EAIX,UAAU,EAIV,MAAM,UAAU,CAAA;AA4FjB,iBAAS,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAS5C;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}