@bjornpagen/bumbledb 0.1.0 → 0.2.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 +1394 -0
  2. package/README.md +4 -0
  3. package/dist/closed.d.ts +60 -37
  4. package/dist/closed.d.ts.map +1 -1
  5. package/dist/closed.js +159 -40
  6. package/dist/closed.js.map +1 -1
  7. package/dist/count.d.ts +64 -17
  8. package/dist/count.d.ts.map +1 -1
  9. package/dist/count.js +37 -14
  10. package/dist/count.js.map +1 -1
  11. package/dist/db.d.ts +15 -7
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +13 -5
  14. package/dist/db.js.map +1 -1
  15. package/dist/exhume.d.ts +12 -11
  16. package/dist/exhume.d.ts.map +1 -1
  17. package/dist/exhume.js +7 -6
  18. package/dist/exhume.js.map +1 -1
  19. package/dist/face.d.ts +79 -19
  20. package/dist/face.d.ts.map +1 -1
  21. package/dist/face.js +14 -15
  22. package/dist/face.js.map +1 -1
  23. package/dist/fields.d.ts +158 -129
  24. package/dist/fields.d.ts.map +1 -1
  25. package/dist/fields.js +80 -81
  26. package/dist/fields.js.map +1 -1
  27. package/dist/index.d.ts +21 -21
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +13 -12
  30. package/dist/index.js.map +1 -1
  31. package/dist/lower.d.ts +6 -3
  32. package/dist/lower.d.ts.map +1 -1
  33. package/dist/lower.js +48 -17
  34. package/dist/lower.js.map +1 -1
  35. package/dist/marshal.d.ts +36 -21
  36. package/dist/marshal.d.ts.map +1 -1
  37. package/dist/marshal.js +41 -25
  38. package/dist/marshal.js.map +1 -1
  39. package/dist/native.js +2 -2
  40. package/dist/query/atom.d.ts +332 -174
  41. package/dist/query/atom.d.ts.map +1 -1
  42. package/dist/query/atom.js +72 -172
  43. package/dist/query/atom.js.map +1 -1
  44. package/dist/query/lower.d.ts +295 -107
  45. package/dist/query/lower.d.ts.map +1 -1
  46. package/dist/query/lower.js +860 -388
  47. package/dist/query/lower.js.map +1 -1
  48. package/dist/query/predicate.d.ts +69 -88
  49. package/dist/query/predicate.d.ts.map +1 -1
  50. package/dist/query/predicate.js +118 -72
  51. package/dist/query/predicate.js.map +1 -1
  52. package/dist/query/run.d.ts +19 -16
  53. package/dist/query/run.d.ts.map +1 -1
  54. package/dist/query/run.js +31 -24
  55. package/dist/query/run.js.map +1 -1
  56. package/dist/query/scope.d.ts +139 -123
  57. package/dist/query/scope.d.ts.map +1 -1
  58. package/dist/query/scope.js +71 -115
  59. package/dist/query/scope.js.map +1 -1
  60. package/dist/query/select.d.ts +102 -80
  61. package/dist/query/select.d.ts.map +1 -1
  62. package/dist/query/select.js +39 -34
  63. package/dist/query/select.js.map +1 -1
  64. package/dist/relation.d.ts +33 -36
  65. package/dist/relation.d.ts.map +1 -1
  66. package/dist/relation.js +15 -16
  67. package/dist/relation.js.map +1 -1
  68. package/dist/schema.d.ts.map +1 -1
  69. package/dist/schema.js +19 -8
  70. package/dist/schema.js.map +1 -1
  71. package/dist/spec.d.ts +6 -5
  72. package/dist/spec.d.ts.map +1 -1
  73. package/dist/spec.js.map +1 -1
  74. package/dist/statements.d.ts +56 -31
  75. package/dist/statements.d.ts.map +1 -1
  76. package/dist/statements.js +38 -13
  77. package/dist/statements.js.map +1 -1
  78. package/package.json +4 -3
  79. package/src/closed.ts +271 -93
  80. package/src/count.ts +112 -18
  81. package/src/db.ts +22 -12
  82. package/src/exhume.ts +12 -11
  83. package/src/face.ts +114 -22
  84. package/src/fields.ts +261 -217
  85. package/src/index.ts +50 -59
  86. package/src/lower.ts +62 -20
  87. package/src/marshal.ts +48 -30
  88. package/src/native.ts +2 -2
  89. package/src/query/atom.ts +480 -376
  90. package/src/query/lower.ts +1341 -542
  91. package/src/query/predicate.ts +198 -161
  92. package/src/query/run.ts +35 -25
  93. package/src/query/scope.ts +188 -218
  94. package/src/query/select.ts +168 -93
  95. package/src/relation.ts +38 -44
  96. package/src/schema.ts +22 -12
  97. package/src/spec.ts +6 -5
  98. package/src/statements.ts +69 -26
  99. package/dist/brand.d.ts +0 -59
  100. package/dist/brand.d.ts.map +0 -1
  101. package/dist/brand.js +0 -47
  102. package/dist/brand.js.map +0 -1
  103. package/src/brand.ts +0 -82
package/README.md CHANGED
@@ -73,6 +73,10 @@ const rows = db.execute(prepared, { holder: adaId }) // rows: { acct: AccountId
73
73
  - The query surface — Datalog as values: scoped vars/params, atoms, negation, conditions, aggregates, engine recursion via predicates, `db.prepare`.
74
74
  - The exhume surface — `Db.exhume`, the schema-independent read path: a store's self-described shapes and raw facts by name.
75
75
 
76
+ ## Cookbook
77
+
78
+ The engine cookbook's 29 modeling recipes, translated to this SDK's structural API: [COOKBOOK.md](./COOKBOOK.md). Every recipe is compile-pinned by `test/cookbook.test.ts` — each schema is admitted by the real engine and every query snippet lowers through `db.prepare` — so the cookbook can never drift from the surface.
79
+
76
80
  ## Architecture
77
81
 
78
82
  The SDK is a typed surface over the native engine; the model (relations,
package/dist/closed.d.ts CHANGED
@@ -1,28 +1,34 @@
1
1
  /**
2
2
  * Closed relations (`docs/architecture/10-data-model.md` § closed
3
3
  * relations): a vocabulary whose extension is declared in the schema — two
4
- * tiers, one function. The emission per closed relation mirrors the macro's
5
- * (host-enum analog): handle CONSTANTS on the value (`Kind.Checking`, ids =
6
- * declaration order), the `fromId` weld, an `id` field constructor
7
- * pre-branded with the handle newtype for other relations' field blocks
8
- * (`kind: Kind.id`), and payload readback (`Kind.axioms`). No fact type and
9
- * no insert surface exist closed relations are unwritable by
4
+ * tiers, one function. The emission per closed relation mirrors the
5
+ * macro's (host-enum analog): handle CONSTANTS on the value
6
+ * (`Kind.Checking`, ids = declaration order, each a BARE `bigint` no
7
+ * brand), the `fromId` weld, an `id` field descriptor carrying the handle
8
+ * DOMAIN (`"KindId"`, mirroring Rust's `closed relation Kind as KindId`)
9
+ * for other relations' field blocks (`kind: Kind.id`), payload readback
10
+ * (`Kind.axioms`), and the declared payload column descriptors
11
+ * (`Kind.columns` — the runtime twin of the `Cols` type parameter, which
12
+ * the face layer's domain wall reads). Bare tier: `closed("Kind", ["Checking",
13
+ * "Savings"])`. Payload tier: `closed("Sev", { pages: bool })({ Critical:
14
+ * { pages: true }, ... })` — the axioms record IS the handle declaration,
15
+ * every handle carrying every column exactly once (type-enforced). No fact
16
+ * type and no insert surface exist — closed relations are unwritable by
10
17
  * construction: the value simply lacks the writable relation shape.
11
18
  */
12
- import type { Brand } from "#brand.ts";
13
- import { type AnyField, type ClosedIdField, type FieldData, type FieldValue } from "#fields.ts";
19
+ import { type AnyField, type ClosedIdField, type Infer } from "#fields.ts";
14
20
  import type { LiteralSpec } from "#spec.ts";
15
21
  /**
16
- * A payload column of a closed relation: any field constructor except a
22
+ * A payload column of a closed relation: any field descriptor except a
17
23
  * fresh-marked one (a vocabulary's rows are ground axioms, never minted).
18
24
  */
19
- type PayloadField = AnyField & {
20
- readonly data: FieldData<false>;
21
- };
22
- /** One declared payload column: name plus its field description. */
25
+ type PayloadField = Exclude<AnyField, {
26
+ readonly fresh: true;
27
+ }>;
28
+ /** One declared payload column: name plus its field descriptor. */
23
29
  interface ClosedColumn {
24
30
  readonly name: string;
25
- readonly field: FieldData;
31
+ readonly field: PayloadField;
26
32
  }
27
33
  /**
28
34
  * One ground axiom, already lowered: the handle plus one wire literal per
@@ -41,57 +47,74 @@ interface ClosedData {
41
47
  readonly columns: readonly ClosedColumn[];
42
48
  readonly rows: readonly ClosedRow[];
43
49
  }
44
- /** One axiom row as the host writes and reads it: column name to host value. */
45
- type AxiomRow<Cols> = {
46
- readonly [C in keyof Cols]: FieldValue<Cols[C]>;
50
+ /** One axiom row as the host writes and reads it: column name to bare structural value. */
51
+ type AxiomRow<Cols extends Record<string, PayloadField>> = {
52
+ readonly [C in keyof Cols]: Infer<Cols[C]>;
47
53
  };
48
54
  /**
49
55
  * The whole axiom record: every handle exactly once, every column exactly
50
- * once per row — a missing or extra axiom, column, or handle is a TYPE
51
- * error (mapped over the handle tuple).
56
+ * once per row — a missing or extra column is a TYPE error (each row is
57
+ * contextually checked against the declared columns), and the handle set
58
+ * IS the record's key set.
52
59
  */
53
- type Axioms<Handles extends readonly string[], Cols> = {
54
- readonly [H in Handles[number]]: AxiomRow<Cols>;
60
+ type Axioms<Handles extends string, Cols extends Record<string, PayloadField>> = {
61
+ readonly [H in Handles]: AxiomRow<Cols>;
55
62
  };
56
63
  /**
57
64
  * The named surface of a closed relation value, minus the handle constants
58
65
  * (which {@link Closed} intersects in).
59
66
  */
60
- interface ClosedCore<Name extends string, Handles extends readonly string[], Cols> {
67
+ interface ClosedCore<Name extends string, Handles extends string, Cols extends Record<string, PayloadField>> {
61
68
  readonly name: Name;
62
69
  /**
63
- * The pre-branded u64 field constructor: `kind: Kind.id` in another
64
- * relation's field block is the reference through which bare handles
65
- * become legal in that relation's selections.
70
+ * The handle-domain reference descriptor: `kind: Kind.id` in another
71
+ * relation's field block is the reference through which bare handle ids
72
+ * become legal in that relation's selections. Its domain is the closed
73
+ * relation's handle domain (`"KindId"` — Rust's `as KindId`).
66
74
  */
67
- readonly id: ClosedIdField<Name>;
75
+ readonly id: ClosedIdField<`${Name}Id`>;
68
76
  readonly data: ClosedData;
69
- /** Payload readback: handle to its declared column values. */
77
+ /** Payload readback: handle to its declared column values, bare and structural. */
70
78
  readonly axioms: Axioms<Handles, Cols>;
79
+ /**
80
+ * The declared payload columns, name → S1 field descriptor — an HONEST
81
+ * frozen runtime record (the descriptors themselves, by identity), and
82
+ * the typed carrier a projected payload column's domain label is
83
+ * recovered through off the schema type (the face layer's
84
+ * `ProjectedDomain` reads it; `data.columns` carries the same
85
+ * descriptors in declaration order for the lowering).
86
+ */
87
+ readonly columns: Cols;
71
88
  /** The weld: declaration-order id back to its handle, or undefined beyond the roster. */
72
- fromId(id: Brand<bigint, Name>): Handles[number] | undefined;
89
+ fromId(id: bigint): Handles | undefined;
73
90
  }
74
91
  /**
75
- * A closed relation value: the core surface plus one branded constant per
76
- * handle (`Kind.Checking: Brand<bigint, "Kind">`, ids = declaration order).
92
+ * A closed relation value: the core surface plus one BARE constant per
93
+ * handle (`Kind.Checking: bigint`, ids = declaration order — the value is
94
+ * structural; the roster judges out-of-vocabulary ids at construction and
95
+ * the engine at commit).
77
96
  */
78
- type Closed<Name extends string, Handles extends readonly string[], Cols> = ClosedCore<Name, Handles, Cols> & {
79
- readonly [H in Handles[number]]: Brand<bigint, Name>;
97
+ type Closed<Name extends string, Handles extends string, Cols extends Record<string, PayloadField>> = ClosedCore<Name, Handles, Cols> & {
98
+ readonly [H in Handles]: bigint;
80
99
  };
81
100
  /** Any closed relation value, whatever its roster and columns. */
82
101
  interface AnyClosed {
83
102
  readonly name: string;
84
- readonly id: ClosedIdField<string>;
103
+ readonly id: ClosedIdField;
85
104
  readonly data: ClosedData;
86
105
  readonly axioms: Readonly<Record<string, object>>;
106
+ readonly columns: Readonly<Record<string, PayloadField>>;
87
107
  }
88
108
  /** Bare tier: `closed("Kind", ["Checking", "Savings"])` — handles only. */
89
- declare function closed<const Name extends string, const Handles extends readonly [string, ...string[]]>(name: Name, handles: Handles): Closed<Name, Handles, Record<never, never>>;
109
+ declare function closed<const Name extends string, const Handles extends readonly [string, ...string[]]>(name: Name, handles: Handles): Closed<Name, Handles[number], Record<never, never>>;
90
110
  /**
91
- * Payload tier: declared columns plus ground axioms, every handle with
92
- * every column exactly once (type-enforced by {@link Axioms}).
111
+ * Payload tier: declared columns, then ground axioms `closed("Grade",
112
+ * { mastered: bool })({ DirectPass: { mastered: true }, Failed: { mastered:
113
+ * false } })`. The axioms record's keys ARE the handles (declaration order
114
+ * = key order, integer-index names rejected); every row carries every
115
+ * column exactly once (type-enforced by {@link Axioms}).
93
116
  */
94
- declare function closed<const Name extends string, const Handles extends readonly [string, ...string[]], const Cols extends Record<string, PayloadField>>(name: Name, handles: Handles, columns: Cols, axioms: Axioms<Handles, Cols>): Closed<Name, Handles, Cols>;
117
+ declare function closed<const Name extends string, const Cols extends Record<string, PayloadField>>(name: Name, columns: Cols): <Handles extends string>(axioms: Axioms<Handles, Cols>) => Closed<Name, Handles, Cols>;
95
118
  export type { AnyClosed, AxiomRow, Axioms, Closed, ClosedColumn, ClosedCore, ClosedData, ClosedRow, PayloadField };
96
119
  export { closed };
97
120
  //# sourceMappingURL=closed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"closed.d.ts","sourceRoot":"","sources":["../src/closed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EACN,KAAK,QAAQ,EAEb,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,UAAU,EAGf,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAsC3C;;;GAGG;AACH,KAAK,YAAY,GAAG,QAAQ,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,CAAA;CAAE,CAAA;AAElE,oEAAoE;AACpE,UAAU,YAAY;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CACzB;AAED;;;;;GAKG;AACH,UAAU,SAAS;IAClB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,CAAA;CACvC;AAED,+CAA+C;AAC/C,UAAU,UAAU;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;IACzC,QAAQ,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,CAAA;CACnC;AAED,gFAAgF;AAChF,KAAK,QAAQ,CAAC,IAAI,IAAI;IAAE,QAAQ,EAAE,C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GAMG;AACH,iBAAS,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,EAAE,KAAK,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACzF,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,IAAI,GACX,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AAmIzF,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA;AAClH,OAAO,EAAE,MAAM,EAAE,CAAA"}
package/dist/closed.js CHANGED
@@ -1,16 +1,23 @@
1
1
  /**
2
2
  * Closed relations (`docs/architecture/10-data-model.md` § closed
3
3
  * relations): a vocabulary whose extension is declared in the schema — two
4
- * tiers, one function. The emission per closed relation mirrors the macro's
5
- * (host-enum analog): handle CONSTANTS on the value (`Kind.Checking`, ids =
6
- * declaration order), the `fromId` weld, an `id` field constructor
7
- * pre-branded with the handle newtype for other relations' field blocks
8
- * (`kind: Kind.id`), and payload readback (`Kind.axioms`). No fact type and
9
- * no insert surface exist closed relations are unwritable by
4
+ * tiers, one function. The emission per closed relation mirrors the
5
+ * macro's (host-enum analog): handle CONSTANTS on the value
6
+ * (`Kind.Checking`, ids = declaration order, each a BARE `bigint` no
7
+ * brand), the `fromId` weld, an `id` field descriptor carrying the handle
8
+ * DOMAIN (`"KindId"`, mirroring Rust's `closed relation Kind as KindId`)
9
+ * for other relations' field blocks (`kind: Kind.id`), payload readback
10
+ * (`Kind.axioms`), and the declared payload column descriptors
11
+ * (`Kind.columns` — the runtime twin of the `Cols` type parameter, which
12
+ * the face layer's domain wall reads). Bare tier: `closed("Kind", ["Checking",
13
+ * "Savings"])`. Payload tier: `closed("Sev", { pages: bool })({ Critical:
14
+ * { pages: true }, ... })` — the axioms record IS the handle declaration,
15
+ * every handle carrying every column exactly once (type-enforced). No fact
16
+ * type and no insert surface exist — closed relations are unwritable by
10
17
  * construction: the value simply lacks the writable relation shape.
11
18
  */
12
19
  import * as errors from "@superbuilders/errors";
13
- import { assertDeclarationOrderKey, fieldData, literalOf } from "#fields.ts";
20
+ import { assertDeclarationOrderKey, literalOf } from "#fields.ts";
14
21
  /**
15
22
  * The value-surface property names a handle may not shadow — the macro's
16
23
  * name-collision diagnostic, here over the closed value's own properties
@@ -22,26 +29,136 @@ const reservedHandleNames = Object.freeze([
22
29
  "id",
23
30
  "data",
24
31
  "axioms",
32
+ "columns",
25
33
  "fromId",
26
34
  "relation",
27
35
  "selection"
28
36
  ]);
37
+ /** Narrows the two-tier second argument: a handle tuple (bare tier) or a column block (payload tier). */
38
+ function isHandleTuple(shape) {
39
+ return Array.isArray(shape);
40
+ }
41
+ /**
42
+ * The trusted seam of the payload tier's handle enumeration: the axioms
43
+ * record's own enumerable keys ARE its handle set (the type says so —
44
+ * {@link Axioms} is keyed by the handles), and this guard verifies exactly
45
+ * that checkable fact before the key list is admitted at the handle type.
46
+ */
47
+ function handleKeysOwn(axioms, names) {
48
+ return names.every(function ownHandle(name) {
49
+ return Object.hasOwn(axioms, name);
50
+ });
51
+ }
52
+ /**
53
+ * The trusted seam of the axiom-readback mint: every handle carries an own
54
+ * frozen row and every row carries every declared column as an own
55
+ * property — verified before the record is admitted as the typed
56
+ * {@link Axioms} (the `refsComplete` analog of `relation()`).
57
+ */
58
+ function axiomsMinted(record, handles, cols) {
59
+ return handles.every(function rowMinted(handle) {
60
+ const row = record[handle];
61
+ return (row !== undefined &&
62
+ cols.every(function columnMinted(column) {
63
+ return Object.hasOwn(row, column.name);
64
+ }));
65
+ });
66
+ }
67
+ /**
68
+ * The trusted seam of the handle-constant mint: every handle reads back as
69
+ * an own bigint — verified before the record is admitted at the constants
70
+ * type (a "__proto__"-named handle riding the object-protocol accessor
71
+ * would fail exactly this check).
72
+ */
73
+ function constantsMinted(record, handles) {
74
+ return handles.every(function constantMinted(handle) {
75
+ return typeof record[handle] === "bigint";
76
+ });
77
+ }
29
78
  /**
30
- * Reads one handle's axiom row, refusing absence loudly: the payload tier's
31
- * overload types the record exhaustively, so a missing row is ill-typed
32
- * input, and the bare tier never reaches here (it declares no columns).
79
+ * Reads one handle's ground axiom row for lowering. The typed payload
80
+ * surface makes absence unrepresentable ({@link Axioms} carries every
81
+ * handle's row); the refusal below guards the one ill-typed path payload
82
+ * columns with the bare tier's absent axioms — which no public spelling
83
+ * reaches.
33
84
  */
34
- function axiomRow(name, axioms, handle) {
85
+ function groundRow(name, axioms, handle) {
35
86
  if (axioms === undefined) {
36
87
  throw errors.new(`closed relation ${name}: payload columns declared without ground axioms`);
37
88
  }
38
- const row = axioms[handle];
39
- if (row === undefined) {
40
- throw errors.new(`closed relation ${name}: no ground axiom for handle ${handle}`);
89
+ return axioms[handle];
90
+ }
91
+ /**
92
+ * Mints the axiom-readback record: one own frozen row per handle (the bare
93
+ * tier's rows are empty — it declares no columns), each row a fresh copy of
94
+ * its ground axiom.
95
+ */
96
+ function mintAxioms(name, handles, cols, axioms) {
97
+ const out = {};
98
+ for (const handle of handles) {
99
+ const row = axioms === undefined ? Object.freeze({}) : Object.freeze({ ...groundRow(name, axioms, handle) });
100
+ Object.defineProperty(out, handle, { value: row, enumerable: true });
101
+ }
102
+ Object.freeze(out);
103
+ if (!axiomsMinted(out, handles, cols)) {
104
+ throw errors.new(`closed relation ${name}: axiom-row minting incomplete`);
105
+ }
106
+ return out;
107
+ }
108
+ /** Mints the handle constants: one own bigint per handle, ids = declaration order. */
109
+ function mintHandleConstants(name, handles) {
110
+ const out = {};
111
+ handles.forEach(function mintHandleConstant(handle, index) {
112
+ Object.defineProperty(out, handle, { value: BigInt(index), enumerable: true });
113
+ });
114
+ Object.freeze(out);
115
+ if (!constantsMinted(out, handles)) {
116
+ throw errors.new(`closed relation ${name}: handle-constant minting incomplete`);
117
+ }
118
+ return out;
119
+ }
120
+ function closed(name, shape) {
121
+ if (isHandleTuple(shape)) {
122
+ return closedBare(name, shape);
123
+ }
124
+ return closedPayload(name, shape);
125
+ }
126
+ /** The bare tier's precisely-typed builder: no columns, no axioms. */
127
+ function closedBare(name, handles) {
128
+ return mintClosed(name, handles, {}, undefined);
129
+ }
130
+ /**
131
+ * The payload tier's precisely-typed builder: column names are judged
132
+ * EAGERLY (at `closed(name, columns)`, before any axioms arrive — the
133
+ * macro-expansion analog), and the returned `withAxioms` reads its handle
134
+ * set off the axioms record's own keys.
135
+ */
136
+ function closedPayload(name, columns) {
137
+ for (const columnName of Object.keys(columns)) {
138
+ assertDeclarationOrderKey(`closed relation ${name} column`, columnName);
41
139
  }
42
- return row;
140
+ return function withAxioms(axioms) {
141
+ const handles = Object.keys(axioms);
142
+ for (const handle of handles) {
143
+ assertDeclarationOrderKey(`closed relation ${name} handle`, handle);
144
+ }
145
+ if (!handleKeysOwn(axioms, handles)) {
146
+ throw errors.new(`closed relation ${name}: handle enumeration incomplete`);
147
+ }
148
+ return mintClosed(name, handles, columns, axioms);
149
+ };
43
150
  }
44
- function closed(name, handles, columns, axioms) {
151
+ /**
152
+ * Mints one closed relation value — the shared seam of both tiers, HONESTLY
153
+ * typed end to end (a wrong-shaped mint is a compile error here, not a
154
+ * laundered `unknown`): roster checks, eager axiom lowering, the
155
+ * domain-labeled `id` descriptor, the frozen `columns` carrier (the runtime
156
+ * twin of the `Cols` type parameter), and the handle constants.
157
+ */
158
+ function mintClosed(name, handles, columns, axioms) {
159
+ if (handles.length === 0) {
160
+ throw errors.new(`closed relation ${name}: at least one handle is required (an empty vocabulary declares nothing)`);
161
+ }
45
162
  const seen = new Set();
46
163
  for (const handle of handles) {
47
164
  if (seen.has(handle)) {
@@ -52,17 +169,17 @@ function closed(name, handles, columns, axioms) {
52
169
  throw errors.new(`closed relation ${name}: handle ${handle} collides with the closed value's own surface (${reservedHandleNames.join(", ")})`);
53
170
  }
54
171
  }
55
- const roster = Object.freeze({ name, handles: Object.freeze([...handles]) });
172
+ const handleList = Object.freeze([...handles]);
173
+ const roster = Object.freeze({ name, handles: handleList });
56
174
  const cols = [];
57
- if (columns !== undefined) {
58
- for (const [columnName, field] of Object.entries(columns)) {
59
- assertDeclarationOrderKey(`closed relation ${name} column`, columnName);
60
- cols.push(Object.freeze({ name: columnName, field: field.data }));
61
- }
175
+ for (const [columnName, field] of Object.entries(columns)) {
176
+ assertDeclarationOrderKey(`closed relation ${name} column`, columnName);
177
+ cols.push(Object.freeze({ name: columnName, field }));
62
178
  }
63
- const rows = handles.map(function lowerRow(handle) {
179
+ Object.freeze(cols);
180
+ const rows = handleList.map(function lowerRow(handle) {
64
181
  const values = cols.map(function lowerAxiomLiteral(column) {
65
- const row = axiomRow(name, axioms, handle);
182
+ const row = groundRow(name, axioms, handle);
66
183
  return Object.freeze(literalOf(column.field, row[column.name]));
67
184
  });
68
185
  return Object.freeze({ handle, values: Object.freeze(values) });
@@ -70,38 +187,40 @@ function closed(name, handles, columns, axioms) {
70
187
  const data = Object.freeze({
71
188
  name,
72
189
  handles: roster.handles,
73
- columns: Object.freeze(cols),
190
+ columns: cols,
74
191
  rows: Object.freeze(rows)
75
192
  });
76
193
  const id = Object.freeze({
77
- data: fieldData({ kind: "u64" }, name, false, roster)
194
+ kind: "u64",
195
+ domain: `${name}Id`,
196
+ closed: roster
78
197
  });
79
198
  /**
80
199
  * Handle names are arbitrary identifiers, so rows and constants are
81
- * minted with OWN-property definition, never assignment: a handle named
200
+ * minted with OWN-property definition (inside {@link mintAxioms} and
201
+ * {@link mintHandleConstants}), never assignment: a handle named
82
202
  * "__proto__" would otherwise ride the Object.prototype accessor —
83
203
  * silently swapping the record's prototype instead of creating the row,
84
204
  * and no-oping the constant (a primitive through the setter) — minting a
85
- * value whose type claims Brand<bigint, Name> but reads back an object.
205
+ * value whose type claims a bigint constant but reads back an object.
206
+ * (Object SPREAD is CreateDataProperty by spec, so the copies below are
207
+ * own-property safe for column names too.)
86
208
  */
87
- const axiomsOut = {};
88
- for (const handle of handles) {
89
- const row = axioms === undefined ? Object.freeze({}) : Object.freeze({ ...axiomRow(name, axioms, handle) });
90
- Object.defineProperty(axiomsOut, handle, { value: row, enumerable: true });
91
- }
92
- const value = {
209
+ const axiomsOut = mintAxioms(name, handleList, cols, axioms);
210
+ const constants = mintHandleConstants(name, handleList);
211
+ const columnsOut = { ...columns };
212
+ Object.freeze(columnsOut);
213
+ return Object.freeze({
214
+ ...constants,
93
215
  name,
94
216
  id,
95
217
  data,
96
- axioms: Object.freeze(axiomsOut),
218
+ axioms: axiomsOut,
219
+ columns: columnsOut,
97
220
  fromId(idValue) {
98
- return roster.handles[Number(idValue)];
221
+ return handleList[Number(idValue)];
99
222
  }
100
- };
101
- handles.forEach(function mintHandleConstant(handle, index) {
102
- Object.defineProperty(value, handle, { value: BigInt(index), enumerable: true });
103
223
  });
104
- return Object.freeze(value);
105
224
  }
106
225
  export { closed };
107
226
  //# sourceMappingURL=closed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"closed.js","sourceRoot":"","sources":["../src/closed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAEN,yBAAyB,EAKzB,SAAS,EACT,SAAS,EACT,MAAM,YAAY,CAAA;AAGnB;;;;;GAKG;AACH,MAAM,mBAAmB,GAAsB,MAAM,CAAC,MAAM,CAAC;IAC5D,MAAM;IACN,IAAI;IACJ,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,WAAW;CACX,CAAC,CAAA;AAEF;;;;GAIG;AACH,SAAS,QAAQ,CAChB,IAAY,EACZ,MAA+E,EAC/E,MAAc;IAEd,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,MAAM,CAAC,GAAG,CAAC,mBAAmB,IAAI,kDAAkD,CAAC,CAAA;IAC5F,CAAC;IACD,MAAM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,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,UAAU;QACnB,MAAM,CAAC,OAAe;YACrB,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QACnC,CAAC;KACD,CAAC,CAAA;AACH,CAAC;AAGD,OAAO,EAAE,MAAM,EAAE,CAAA"}
package/dist/count.d.ts CHANGED
@@ -1,10 +1,22 @@
1
1
  /**
2
2
  * Cardinality-window counts — exactly five constructors, and nothing else
3
- * (`docs/architecture/70-api.md` § the canonical-utterance law). The ban
4
- * table is enforced REPRESENTATIONALLY, stronger than Rust's expansion
5
- * errors: `{1..*}`, `{n..n}`, `{0..0}`, `{0..*}`, and inverted windows have
6
- * NO constructor — the spellings that could produce them are construction
7
- * errors naming the canonical form, and no other spelling exists at all.
3
+ * (`docs/architecture/70-api.md` § the canonical-utterance law). The five
4
+ * constructors PARTITION the legal windows, and the ban table is enforced
5
+ * REPRESENTATIONALLY, stronger than Rust's expansion errors, in two tiers:
6
+ *
7
+ * - **The type tier**: a banned spelling written as a LITERAL does not
8
+ * compile — `exactly(0n)`, `between(n, n)`, `between(0n, hi)`,
9
+ * `atLeast(0n)`, `atLeast(1n)`, `atMost(0n)`, and every negative bound
10
+ * are type errors naming the canonical form (`{n..n}`, `{0..0}`,
11
+ * `{0..hi}`-via-between, `{0..*}`, `{1..*}` have NO argument shape that
12
+ * produces them), and no sixth constructor exists at all.
13
+ * - **The construction tier**: a bound the type level cannot judge — a
14
+ * COMPUTED `bigint`, whose literal identity is erased, or an inverted
15
+ * `between(lo, hi)` order, which type-level bigints cannot compare — is
16
+ * judged here at construction with the same canonical-naming errors; and
17
+ * past both tiers the engine's own spec validation remains the law for a
18
+ * hostile FFI caller (the standing two-tier ban enforcement).
19
+ *
8
20
  * Bounds are `bigint` (u64 crosses as bigint always, PRD-04's law).
9
21
  */
10
22
  import type { WindowSpec } from "#spec.ts";
@@ -26,30 +38,65 @@ interface Count {
26
38
  readonly window: WindowSpec;
27
39
  readonly [admitted]: true;
28
40
  }
41
+ /**
42
+ * The legible banned-spelling verdict: intersected into a count
43
+ * constructor's parameter when the LITERAL argument spells a banned window,
44
+ * naming the canonical form — the compile-time face of the ban table.
45
+ */
46
+ interface BannedWindow<Canonical extends string> {
47
+ readonly "banned window spelling — the canonical-utterance law names the one legal form": Canonical;
48
+ }
49
+ /** `true` exactly when the literal bigint `N` is negative (out of the u64 count domain). */
50
+ type IsNegative<N extends bigint> = `${N}` extends `-${string}` ? true : false;
51
+ /** The ban verdict on `exactly(n)`: negatives are out of domain; `{0}` is the exclusion, written `none`. */
52
+ type ExactlyBan<N extends bigint> = bigint extends N ? unknown : IsNegative<N> extends true ? BannedWindow<"window counts are u64 — a negative count is out of domain"> : N extends 0n ? BannedWindow<"`{0}` is the exclusion — write none"> : unknown;
53
+ /** The ban verdict on `atLeast(lo)`: `{0..*}` is vacuous; `{1..*}` is the bare containment respelled. */
54
+ type AtLeastBan<N extends bigint> = bigint extends N ? unknown : IsNegative<N> extends true ? BannedWindow<"window counts are u64 — a negative count is out of domain"> : N extends 0n ? BannedWindow<"`{0..*}` is vacuous — it provably says nothing; delete the statement"> : N extends 1n ? BannedWindow<"`{1..*}` says only what the bare containment says — write contained(source, target)"> : unknown;
55
+ /** The ban verdict on `atMost(hi)`: `{0..0}` is the exclusion, written `none`. */
56
+ type AtMostBan<N extends bigint> = bigint extends N ? unknown : IsNegative<N> extends true ? BannedWindow<"window counts are u64 — a negative count is out of domain"> : N extends 0n ? BannedWindow<"`{0..0}` — the exclusion is written `{0}`: use none"> : unknown;
57
+ /** The ban verdict on a `between` floor of zero: `{0..hi}` is the ceiling respelled (`atMost(hi)`). */
58
+ type BetweenFloorBan<Lo extends bigint> = Lo extends 0n ? BannedWindow<"`{0..hi}` — a ceiling is written atMost(hi)"> : unknown;
59
+ /**
60
+ * The ban verdict on `between(lo, hi)`, judged on the second bound once
61
+ * both literals are known: `{n..n}` is the exact count respelled
62
+ * (`exactly(n)`, or `none` at 0), and `{0..hi}` is the ceiling respelled
63
+ * (`atMost(hi)` — the five constructors PARTITION the legal windows, so
64
+ * the one ceiling window keeps its one spelling). Bound ORDER (`{hi..lo}`
65
+ * inverted) is not type-expressible — bigint literals have no type-level
66
+ * comparison — so inversion stays a construction error below.
67
+ */
68
+ type BetweenBan<Lo extends bigint, Hi extends bigint> = bigint extends Lo ? unknown : bigint extends Hi ? unknown : IsNegative<Lo> extends true ? BannedWindow<"window counts are u64 — a negative bound is out of domain"> : IsNegative<Hi> extends true ? BannedWindow<"window counts are u64 — a negative bound is out of domain"> : Lo extends Hi ? Hi extends Lo ? Lo extends 0n ? BannedWindow<"`{0..0}` — the exclusion is written `{0}`: use none"> : BannedWindow<"`{n..n}` — an exact count is written `{n}`: use exactly(n)"> : BetweenFloorBan<Lo> : BetweenFloorBan<Lo>;
29
69
  /**
30
70
  * `{n}` — THE exact-count spelling, n ≥ 1. `exactly(0)` is the exclusion
31
- * respelled and rejected naming `none`.
71
+ * respelled: unwritable as a literal ({@link ExactlyBan} names `none`),
72
+ * rejected at construction when computed.
32
73
  */
33
- declare function exactly(n: bigint): Count;
74
+ declare function exactly<const N extends bigint>(n: N & ExactlyBan<N>): Count;
34
75
  /** `{0}` — the exclusion: no source fact may pair with the target group. */
35
76
  declare const none: Count;
36
77
  /**
37
- * `{lo..hi}` — both bounds explicit, 0 ≤ lo < hi. `lo === hi` is the exact
38
- * count respelled (rejected naming `exactly(n)`, or `none` at 0); an
39
- * inverted window is unsatisfiable and rejected.
78
+ * `{lo..hi}` — both bounds explicit, 1 ≤ lo < hi. `lo === hi` is the exact
79
+ * count respelled and `lo === 0` is the ceiling respelled: unwritable as
80
+ * literals ({@link BetweenBan} names `exactly(n)`, `none` at `{0..0}`, or
81
+ * `atMost(hi)` at a zero floor — the five constructors PARTITION the legal
82
+ * windows), rejected at construction when computed; an inverted window is
83
+ * unsatisfiable and rejected at construction (bigint literals carry no
84
+ * type-level order).
40
85
  */
41
- declare function between(lo: bigint, hi: bigint): Count;
86
+ declare function between<const Lo extends bigint, const Hi extends bigint>(lo: Lo, hi: Hi & BetweenBan<Lo, Hi>): Count;
42
87
  /**
43
88
  * `{lo..*}` — a floor with no ceiling, lo ≥ 2: `atLeast(1)` says only what
44
- * the bare containment says (rejected naming `contained`), and
45
- * `atLeast(0)` is vacuous (rejected naming deletion).
89
+ * the bare containment says and `atLeast(0)` is vacuous — both unwritable
90
+ * as literals ({@link AtLeastBan} names the canonical form), rejected at
91
+ * construction when computed.
46
92
  */
47
- declare function atLeast(lo: bigint): Count;
93
+ declare function atLeast<const N extends bigint>(lo: N & AtLeastBan<N>): Count;
48
94
  /**
49
- * `{0..hi}` — a ceiling, hi ≥ 1: `atMost(0)` is the exclusion respelled
50
- * and rejected naming `none`.
95
+ * `{0..hi}` — a ceiling, hi ≥ 1: `atMost(0)` is the exclusion respelled
96
+ * unwritable as a literal ({@link AtMostBan} names `none`), rejected at
97
+ * construction when computed.
51
98
  */
52
- declare function atMost(hi: bigint): Count;
99
+ declare function atMost<const N extends bigint>(hi: N & AtMostBan<N>): Count;
53
100
  export type { Count };
54
101
  export { atLeast, atMost, between, exactly, none };
55
102
  //# sourceMappingURL=count.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../src/count.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C;;;;;;;GAOG;AACH,QAAA,MAAM,QAAQ,EAAE,OAAO,MAA0C,CAAA;AAEjE;;;;GAIG;AACH,UAAU,KAAK;IACd,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;IAC3B,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAA;CACzB;AAOD;;;GAGG;AACH,iBAAS,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK,CAQjC;AAED,4EAA4E;AAC5E,QAAA,MAAM,IAAI,EAAE,KAAwB,CAAA;AAEp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