@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/dist/face.d.ts CHANGED
@@ -1,13 +1,19 @@
1
1
  /**
2
2
  * Faces — the projection-with-selection value both containments and
3
- * windows consume: `on(Account, "holder")`, `on(Account.where({ kind:
4
- * Kind.Savings }), "id")`, `on(Kind, "id")` (a closed relation's sealed
5
- * shape opens with its synthetic `id`). Projection is positional: tuple
6
- * order is preserved in the type, and the statement constructors pair the
7
- * two sides' tuples by arity (`SameArity`).
3
+ * windows consume: `on(Account, "holder")` the common single-field
4
+ * position, `on(Booking, ["room", "during"])` the composite/pointwise
5
+ * position (one spelling, arity-generic), `on(Account.where({ kind:
6
+ * Kind.Savings }), "id")` the σ-carrying source, `on(Kind, "id")` a closed
7
+ * relation's sealed shape opened through its synthetic `id`. Projection is
8
+ * positional: tuple order is preserved in the type, and the statement
9
+ * constructors pair the two sides' tuples by arity ({@link SameArity}) AND
10
+ * by domain ({@link SameDomains}) — the domain wall of the structural
11
+ * design: every projected field's domain LABEL is read off the schema type
12
+ * (`F["domain"]`, the S1 kernel) and compared positionwise by
13
+ * string-literal equality, never by any value brand.
8
14
  */
9
- import type { AnyClosed } from "#closed.ts";
10
- import type { AnyRelation, AnySelected, SelectionBinding } from "#relation.ts";
15
+ import type { AnyClosed, PayloadField } from "#closed.ts";
16
+ import type { AnyRelation, AnySelected, FieldsShape, RelationFields, SelectionBinding } from "#relation.ts";
11
17
  /**
12
18
  * A disjunctive literal set for a selection binding — `field == {A, B}`.
13
19
  * The signature of {@link oneOf} demands two leading literals, so the
@@ -32,15 +38,19 @@ interface FaceData {
32
38
  readonly selection: readonly SelectionBinding[];
33
39
  }
34
40
  /**
35
- * A face value. `P` is the projection tuple as written the statement
36
- * constructors read its length for positional-arity pairing.
41
+ * A face value. `S` is the source exactly as written (the relation,
42
+ * selected relation, or closed relation `on()` was handed — the statement
43
+ * constructors resolve each projected field's DOMAIN through it), and `P`
44
+ * is the projection tuple as written (its length is the positional-pairing
45
+ * arity). Both are honest runtime properties, not phantoms.
37
46
  */
38
- interface Face<P extends readonly string[]> {
47
+ interface Face<S extends FaceSource, P extends readonly string[]> {
48
+ readonly source: S;
39
49
  readonly projection: P;
40
50
  readonly data: FaceData;
41
51
  }
42
- /** Any face value, whatever its projection. */
43
- type AnyFace = Face<readonly string[]>;
52
+ /** Any face value, whatever its source and projection. */
53
+ type AnyFace = Face<FaceSource, readonly string[]>;
44
54
  /** What `on()` accepts: a relation, a selected relation, or a closed relation. */
45
55
  type FaceSource = AnyRelation | AnyClosed | AnySelected;
46
56
  /**
@@ -53,6 +63,32 @@ type FaceSource = AnyRelation | AnyClosed | AnySelected;
53
63
  type FaceFields<S extends FaceSource> = S extends AnySelected ? keyof S["relation"]["fields"] & string : S extends AnyRelation ? keyof S["fields"] & string : S extends {
54
64
  readonly axioms: Readonly<Record<string, infer Row>>;
55
65
  } ? "id" | (keyof Row & string) : never;
66
+ /** One field's domain label within a declared field block (`undefined` when the name is foreign). */
67
+ type DomainIn<Fields extends FieldsShape, K extends string> = K extends keyof Fields ? Fields[K]["domain"] : undefined;
68
+ /**
69
+ * The domain LABEL of one projected field, read structurally off the
70
+ * source's schema type — an ordinary or selected relation's field carries
71
+ * its S1 descriptor's `domain`; a closed relation's synthetic `id` carries
72
+ * the handle domain (`"KindId"`), and its payload columns carry their own
73
+ * declared descriptors' labels through the closed value's typed `columns`
74
+ * carrier (whose runtime twin is the frozen `columns` record the mint
75
+ * carries), so a same-label closed-payload ↔ relation-field pairing
76
+ * compiles and a mismatched one refuses — the identical wall every other
77
+ * face position gets. The lowering carries the same label to the engine,
78
+ * which stays the final authority.
79
+ */
80
+ type ProjectedDomain<S extends FaceSource, K extends string> = S extends AnySelected ? DomainIn<RelationFields<S["relation"]>, K> : S extends AnyRelation ? DomainIn<RelationFields<S>, K> : S extends {
81
+ readonly id: {
82
+ readonly domain: infer D extends string;
83
+ };
84
+ readonly columns: infer Cols extends Record<string, PayloadField>;
85
+ } ? K extends "id" ? D : DomainIn<Cols, K> : undefined;
86
+ /** The positionwise domain-label tuple of a projection over `S`. */
87
+ type DomainsOf<S extends FaceSource, P extends readonly string[]> = {
88
+ readonly [I in keyof P]: ProjectedDomain<S, P[I] & string>;
89
+ };
90
+ /** The domain-label tuple a face projects, positionwise — the comparand of {@link SameDomains}. */
91
+ type FaceDomains<F extends AnyFace> = F extends Face<infer S, infer P> ? DomainsOf<S, P> : never;
56
92
  /** The projection arity of a face. */
57
93
  type Arity<F extends AnyFace> = F["projection"]["length"];
58
94
  /**
@@ -73,19 +109,43 @@ interface FaceArityMismatch<Left, Right> {
73
109
  */
74
110
  type SameArity<A extends AnyFace, B extends AnyFace> = Arity<A> extends Arity<B> ? Arity<B> extends Arity<A> ? unknown : FaceArityMismatch<Arity<A>, Arity<B>> : FaceArityMismatch<Arity<A>, Arity<B>>;
75
111
  /**
76
- * Projects a face: `on(Account, "holder")`, `on(Account.where({...}),
77
- * "id")`. Field names are typechecked against the source; tuple order is
78
- * preserved (positional pairing with the other side, macro parity). At
79
- * least one field by signature an empty projection has no meaning in the
80
- * statement grammar.
112
+ * The legible domain-mismatch verdict: when the two faces of a containment,
113
+ * bijection, or window project different domain labels at any position,
114
+ * this type is intersected into the second face's parameter and names both
115
+ * label tuples a cross-domain pair is a COMPILE error, achieved by
116
+ * string-literal comparison of descriptor shapes (the structural design's
117
+ * ratified check), never by a value brand.
118
+ */
119
+ interface FaceDomainMismatch<Left, Right> {
120
+ readonly "face domain mismatch — positionwise domain labels must be equal on both sides": readonly [Left, Right];
121
+ }
122
+ /**
123
+ * Resolves to `unknown` (a no-op intersection) when the two faces project
124
+ * positionwise-equal domain labels, and to {@link FaceDomainMismatch}
125
+ * otherwise. Equality is mutual tuple assignability over string-literal
126
+ * labels (`undefined` pairs only with `undefined` — an unlabeled field
127
+ * links only unlabeled fields, mirroring Rust where `u64` and `u64 as
128
+ * HolderId` are different host types).
129
+ */
130
+ type SameDomains<A extends AnyFace, B extends AnyFace> = FaceDomains<A> extends FaceDomains<B> ? FaceDomains<B> extends FaceDomains<A> ? unknown : FaceDomainMismatch<FaceDomains<A>, FaceDomains<B>> : FaceDomainMismatch<FaceDomains<A>, FaceDomains<B>>;
131
+ /**
132
+ * Projects a face — one spelling, arity-generic: `on(Account, "holder")`
133
+ * for the common single-field position, `on(Booking, ["room", "during"])`
134
+ * for the composite/pointwise position (the interval-pointwise `==` and
135
+ * coverage recipes), `on(Account.where({...}), "id")` for a σ-carrying
136
+ * source. Field names are typechecked against the source (unknown field =
137
+ * type error, names autocomplete); tuple order is preserved (positional
138
+ * pairing with the other side, macro parity). The empty projection is
139
+ * unwritable by signature — it has no meaning in the statement grammar.
81
140
  */
82
- declare function on<S extends FaceSource, const P extends readonly [FaceFields<S>, ...FaceFields<S>[]]>(source: S, ...projection: P): Face<P>;
141
+ declare function on<S extends FaceSource, const F extends FaceFields<S>>(source: S, field: F): Face<S, readonly [F]>;
142
+ declare function on<S extends FaceSource, const P extends readonly [FaceFields<S>, ...FaceFields<S>[]]>(source: S, fields: P): Face<S, P>;
83
143
  /**
84
144
  * Renders one face in the exact macro notation — `Name(p1, p2 | f == lit,
85
145
  * g == {a, b})`, the selection block only when σ is nonempty (the engine
86
146
  * renderer's own shape, `schema/render.rs`).
87
147
  */
88
148
  declare function renderFace(face: FaceData): string;
89
- export type { AnyFace, Arity, Face, FaceArityMismatch, FaceData, FaceFields, FaceOwner, FaceSource, OneOf, SameArity };
149
+ export type { AnyFace, Arity, Face, FaceArityMismatch, FaceData, FaceDomainMismatch, FaceDomains, FaceFields, FaceOwner, FaceSource, OneOf, SameArity, SameDomains };
90
150
  export { on, oneOf, renderFace };
91
151
  //# sourceMappingURL=face.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../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AAS,EACT,WAAW,EACX,CAAA;AACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA"}
package/dist/face.js CHANGED
@@ -1,10 +1,16 @@
1
1
  /**
2
2
  * Faces — the projection-with-selection value both containments and
3
- * windows consume: `on(Account, "holder")`, `on(Account.where({ kind:
4
- * Kind.Savings }), "id")`, `on(Kind, "id")` (a closed relation's sealed
5
- * shape opens with its synthetic `id`). Projection is positional: tuple
6
- * order is preserved in the type, and the statement constructors pair the
7
- * two sides' tuples by arity (`SameArity`).
3
+ * windows consume: `on(Account, "holder")` the common single-field
4
+ * position, `on(Booking, ["room", "during"])` the composite/pointwise
5
+ * position (one spelling, arity-generic), `on(Account.where({ kind:
6
+ * Kind.Savings }), "id")` the σ-carrying source, `on(Kind, "id")` a closed
7
+ * relation's sealed shape opened through its synthetic `id`. Projection is
8
+ * positional: tuple order is preserved in the type, and the statement
9
+ * constructors pair the two sides' tuples by arity ({@link SameArity}) AND
10
+ * by domain ({@link SameDomains}) — the domain wall of the structural
11
+ * design: every projected field's domain LABEL is read off the schema type
12
+ * (`F["domain"]`, the S1 kernel) and compared positionwise by
13
+ * string-literal equality, never by any value brand.
8
14
  */
9
15
  import { renderLiteralSet } from "#spec.ts";
10
16
  /** The empty σ of a selection-free face, shared by every bare projection. */
@@ -31,22 +37,15 @@ function oneOf(first, second, ...rest) {
31
37
  Object.freeze(literals);
32
38
  return Object.freeze({ literals });
33
39
  }
34
- /**
35
- * Projects a face: `on(Account, "holder")`, `on(Account.where({...}),
36
- * "id")`. Field names are typechecked against the source; tuple order is
37
- * preserved (positional pairing with the other side, macro parity). At
38
- * least one field by signature — an empty projection has no meaning in the
39
- * statement grammar.
40
- */
41
- function on(source, ...projection) {
40
+ function on(source, fields) {
41
+ const projection = Object.freeze(typeof fields === "string" ? [fields] : [...fields]);
42
42
  const parts = faceParts(source);
43
- Object.freeze(projection);
44
43
  const data = Object.freeze({
45
44
  owner: parts.owner,
46
45
  projection,
47
46
  selection: parts.selection
48
47
  });
49
- return Object.freeze({ projection, data });
48
+ return Object.freeze({ source, projection, data });
50
49
  }
51
50
  /**
52
51
  * Renders one face in the exact macro notation — `Name(p1, p2 | f == lit,
package/dist/face.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"face.js","sourceRoot":"","sources":["../src/face.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,6EAA6E;AAC7E,MAAM,cAAc,GAAgC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;AAErE;;;;;GAKG;AACH,SAAS,SAAS,CAAC,MAAkB;IAIpC,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAA;IAC/D,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAA;AACpD,CAAC;AAYD;;;;GAIG;AACH,SAAS,KAAK,CAAI,KAAQ,EAAE,MAAS,EAAE,GAAG,IAAS;IAClD,MAAM,QAAQ,GAA4B,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAA;IAClE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACvB,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;AACnC,CAAC;AAqED;;;;;;GAMG;AACH,SAAS,EAAE,CACV,MAAS,EACT,GAAG,UAAa;IAEhB,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;IAC/B,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;IACzB,MAAM,IAAI,GAAa,MAAM,CAAC,MAAM,CAAC;QACpC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,UAAU;QACV,SAAS,EAAE,K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AClC,OAAO,GAAG,OAAO,CAAC,KAAK,OAAO,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAA;IAC9D,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;IACZ,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,UAAU,MAAM,QAAQ,GAAG,CAAA;AACzD,CAAC;AAiBD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAA"}
package/dist/fields.d.ts CHANGED
@@ -1,134 +1,168 @@
1
1
  /**
2
- * Field type constructors — the value half of the `schema!` field grammar
3
- * (`docs/architecture/70-api.md`): `bool`, `u64`, `i64`, `str`, `bytes(n)`,
4
- * `interval(u64|i64[, width])`, each a plain frozen value carrying its
5
- * structural type at runtime and its host value type in a phantom generic.
6
- * Newtypes are DECLARATION-FIRST, one spelling only (owner ruling
7
- * 2026-07-16): `const AccountId = u64.newtype("AccountId")` declares the
8
- * brand ONCE as a value that IS the field, paired with
9
- * `type AccountId = Infer<typeof AccountId>` for signatures; every field
10
- * position references the declared value (`holder: HolderId`). The macro's
11
- * refusals are reproduced representationally: `.newtype` exists only where
12
- * Rust's `as` is legal (u64, i64, bytes, intervals never bool/str),
13
- * `.fresh` exists only on declared u64 newtypes (the macro demands `as
14
- * NewType` on fresh fields), and no field-level constraint vocabulary of
15
- * any kind exists — `unique`/`fk` are unwritable, not rejected.
2
+ * Field descriptors — the value half of the `schema!` field grammar
3
+ * (`docs/architecture/70-api.md`), STRUCTURAL edition: `bool`, `u64`, `i64`,
4
+ * `str`, `bytes(n)`, `interval(u64|i64[, width])`, each a plain frozen value
5
+ * that IS its own descriptor type `{ kind, domain, fresh?, width?,
6
+ * element? }` honest at runtime and in the type alike. A field's VALUE
7
+ * type is its bare structural type (`u64` `bigint`, `str` → `string`,
8
+ * `bytes(n)` `Uint8Array`, intervals `{ start, end }`): no brands, no
9
+ * phantoms, no minting casts. The domain is a string LABEL in the
10
+ * descriptor type, attached by `.as("HolderId")` (the mirror of Rust's
11
+ * `as HolderId`); same-string domains link fields, and the relational
12
+ * builders (statements, queries) compare the labels structurallythe
13
+ * domain wall lives in the builders and the engine, never on the value.
14
+ * The macro's refusals are reproduced representationally: `.as` exists only
15
+ * where Rust's `as` is legal (u64, i64, bytes, intervals — never bool/str),
16
+ * `.fresh` exists only on u64 (bare or after `.as`), and no field-level
17
+ * constraint vocabulary of any kind exists — `unique`/`fk` are unwritable,
18
+ * not rejected.
16
19
  */
17
- import type { Brand, Interval, IntervalValue } from "#brand.ts";
18
- import { phantom } from "#brand.ts";
19
- import type { LiteralSpec, ValueTypeSpec } from "#spec.ts";
20
+ import type { LiteralSpec } from "#spec.ts";
20
21
  /**
21
- * A closed relation's roster as seen from a referencing field: the handle
22
- * namespace `where()` selections and ground axioms resolve bare handles
23
- * through (the macro's own rule: a handle is legal exactly on a field whose
24
- * newtype is a closed relation's handle newtype).
22
+ * A half-open interval `[start, end)` as a plain value object the ONE
23
+ * interval value type, whatever the field's element domain or width label.
24
+ * The ray is representable (`end` = the element domain's MAX_END); widths
25
+ * and signedness are NOT modeled on the value — they are descriptor-type
26
+ * labels the engine judges at the typed write boundary. Interval fields
27
+ * derive no order (the Rust refusal, `docs/architecture/10-data-model.md`),
28
+ * so no comparators exist on the value type.
25
29
  */
26
- interface ClosedRoster {
27
- readonly name: string;
28
- readonly handles: readonly string[];
30
+ interface IntervalValue {
31
+ readonly start: bigint;
32
+ readonly end: bigint;
29
33
  }
30
34
  /**
31
- * One field's runtime description: structural type, host newtype name, the
32
- * `fresh` mint mark (`minted` the property name `fresh` is taken by the
33
- * builder surface), and the closed-relation reference when the field is a
34
- * closed relation's id type.
35
+ * Constructs an interval literal the `start..end` spelling. Half-open
36
+ * and nonempty by construction: `start >= end` is a typed construction
37
+ * error (parse, don't validate the same invariant Rust's
38
+ * `Interval::new` enforces at the host boundary). The value is bare and
39
+ * structural: it is assignable to any interval field.
35
40
  */
36
- interface FieldData<Minted extends boolean = boolean> {
37
- readonly type: ValueTypeSpec;
38
- readonly newtype: string | undefined;
39
- readonly minted: Minted;
40
- readonly closed: ClosedRoster | undefined;
41
- }
41
+ declare function span(start: bigint, end: bigint): IntervalValue;
42
42
  /**
43
- * The base shape every field value shares: runtime data plus the phantom
44
- * host value type `V` (never present at runtime).
43
+ * A closed relation's roster as seen from a referencing field: the handle
44
+ * namespace `where()` selections and ground axioms resolve bare handle ids
45
+ * through (the macro's own rule: a handle is legal exactly on a field whose
46
+ * domain is a closed relation's handle domain).
45
47
  */
46
- interface Field<V> {
47
- readonly data: FieldData;
48
- readonly [phantom]?: V;
48
+ interface ClosedRoster {
49
+ readonly name: string;
50
+ readonly handles: readonly string[];
49
51
  }
50
- /** Extracts a field value's host value type from its phantom. */
51
- type FieldValue<F> = F extends Field<infer V> ? V : never;
52
- /** Any field value, whatever its host value type. */
53
- type AnyField = Field<unknown>;
54
- /** The `bool` field: host type `boolean`. No `.newtype`, no `.fresh` (macro parity). */
55
- interface BoolField extends Field<boolean> {
56
- readonly data: FieldData<false>;
52
+ /** The `bool` field descriptor: value type `boolean`. No `.as`, no `.fresh` (macro parity). */
53
+ interface BoolField {
54
+ readonly kind: "bool";
55
+ readonly domain: undefined;
57
56
  }
58
- /** The `str` field: host type `string`. No `.newtype`, no `.fresh` (macro parity). */
59
- interface StrField extends Field<string> {
60
- readonly data: FieldData<false>;
57
+ /** The `str` field descriptor: value type `string`. No `.as`, no `.fresh` (macro parity). */
58
+ interface StrField {
59
+ readonly kind: "str";
60
+ readonly domain: undefined;
61
61
  }
62
62
  /**
63
- * A `fresh`-marked u64 newtype field — `id: AccountId.fresh` (Rust: `id:
64
- * u64 as AccountId, fresh`). Terminal: the mark implies the key
65
- * `R(field) -> R`, which the ENGINE materializes
66
- * (`SchemaDescriptor::materialized_statements`); `schema()` rejects an
67
- * explicit duplicate of it (macro parity).
63
+ * A `fresh`-marked u64 field descriptor — `id: u64.as("AccountId").fresh`
64
+ * (Rust: `id: u64 as AccountId, fresh`). The mark is a structural label
65
+ * (`fresh: true`) in the descriptor type AND on the runtime value; it
66
+ * implies the key `R(field) -> R`, which the ENGINE materializes
67
+ * (`SchemaDescriptor::materialized_statements`). Terminal: no builder
68
+ * property survives the mark.
68
69
  */
69
- interface FreshU64Newtype<Name extends string> extends Field<Brand<bigint, Name>> {
70
- readonly data: FieldData<true>;
70
+ interface FreshU64Field<Domain extends string | undefined = undefined> {
71
+ readonly kind: "u64";
72
+ readonly domain: Domain;
73
+ readonly fresh: true;
71
74
  }
72
75
  /**
73
- * A declared u64 newtype — `const AccountId = u64.newtype("AccountId")`
74
- * (Rust: `u64 as AccountId`). The value IS the field: relation blocks
75
- * reference it (`holder: HolderId`). `.fresh` marks it as minted; the
76
- * property exists ONLY here (the macro demands `as NewType` on fresh
77
- * fields, so bare-u64 fresh is unwritable).
76
+ * A domain-labeled u64 field descriptor — `const HolderId =
77
+ * u64.as("HolderId")` (Rust: `u64 as HolderId`). The label lives in the
78
+ * descriptor type only; the value type stays bare `bigint`. `.fresh` marks
79
+ * the field as engine-minted the property doubles as the mark itself:
80
+ * on an unmarked descriptor it holds the marked descriptor, on a marked
81
+ * one it IS the literal `true` (one structural property, read either way).
78
82
  */
79
- interface U64Newtype<Name extends string> extends Field<Brand<bigint, Name>> {
80
- readonly data: FieldData<false>;
81
- readonly fresh: FreshU64Newtype<Name>;
83
+ interface U64Field<Domain extends string | undefined = undefined> {
84
+ readonly kind: "u64";
85
+ readonly domain: Domain;
86
+ readonly fresh: FreshU64Field<Domain>;
82
87
  }
83
- /** The bare `u64` field; `.newtype(name)` declares a branded u64 newtype. */
84
- interface U64Field extends Field<bigint> {
85
- readonly data: FieldData<false>;
86
- newtype<const Name extends string>(name: Name): U64Newtype<Name>;
88
+ /** The `u64` constructor value: a bare u64 descriptor plus `.as` (one application — `.as` is absent on the result). */
89
+ interface U64Ctor extends U64Field<undefined> {
90
+ as<const Domain extends string>(domain: Domain): U64Field<Domain>;
87
91
  }
88
- /** A declared i64 newtype. Terminal: `fresh` is legal on u64 only. */
89
- interface I64Newtype<Name extends string> extends Field<Brand<bigint, Name>> {
90
- readonly data: FieldData<false>;
92
+ /** A domain-labeled i64 field descriptor. Terminal: `.fresh` is legal on u64 only. */
93
+ interface I64Field<Domain extends string | undefined = undefined> {
94
+ readonly kind: "i64";
95
+ readonly domain: Domain;
91
96
  }
92
- /** The bare `i64` field; `.newtype(name)` declares a branded i64 newtype. */
93
- interface I64Field extends Field<bigint> {
94
- readonly data: FieldData<false>;
95
- newtype<const Name extends string>(name: Name): I64Newtype<Name>;
97
+ /** The `i64` constructor value: a bare i64 descriptor plus `.as`. */
98
+ interface I64Ctor extends I64Field<undefined> {
99
+ as<const Domain extends string>(domain: Domain): I64Field<Domain>;
96
100
  }
97
- /** A declared `bytes<N>` newtype (no order derived — no comparators exist). */
98
- interface BytesNewtype<Name extends string> extends Field<Brand<Uint8Array, Name>> {
99
- readonly data: FieldData<false>;
101
+ /**
102
+ * A `bytes<N>` field descriptor. The width is a descriptor-type label
103
+ * (load-bearing: the engine enforces it at the write boundary) and the
104
+ * value type is bare `Uint8Array`. No order is derived — no comparators
105
+ * exist on the value type (the engine refuses order on bytes).
106
+ */
107
+ interface BytesField<Width extends number = number, Domain extends string | undefined = undefined> {
108
+ readonly kind: "bytes";
109
+ readonly width: Width;
110
+ readonly domain: Domain;
100
111
  }
101
- /** A `bytes<N>` field; `.newtype(name)` declares a branded bytes newtype. */
102
- interface BytesField extends Field<Uint8Array> {
103
- readonly data: FieldData<false>;
104
- newtype<const Name extends string>(name: Name): BytesNewtype<Name>;
112
+ /** A `bytes(n)` constructor value: a bare bytes descriptor plus `.as`. */
113
+ interface BytesCtor<Width extends number = number> extends BytesField<Width, undefined> {
114
+ as<const Domain extends string>(domain: Domain): BytesField<Width, Domain>;
105
115
  }
106
- /** A declared interval newtype — Rust: `interval<i64> as ActiveDuring`. */
107
- interface IntervalNewtype<Name extends string> extends Field<Interval<Name>> {
108
- readonly data: FieldData<false>;
116
+ /**
117
+ * An interval field descriptor — `interval(i64)` general (rays
118
+ * representable), `interval(u64, w)` the fixed-width family. Element and
119
+ * width are descriptor-type labels; the value type is always the bare
120
+ * {@link IntervalValue}.
121
+ */
122
+ interface IntervalField<Element extends "u64" | "i64" = "u64" | "i64", Width extends bigint | undefined = bigint | undefined, Domain extends string | undefined = undefined> {
123
+ readonly kind: "interval";
124
+ readonly element: Element;
125
+ readonly width: Width;
126
+ readonly domain: Domain;
109
127
  }
110
- /** An interval field; `.newtype(name)` brands the whole `{ start, end }` object. */
111
- interface IntervalField extends Field<IntervalValue> {
112
- readonly data: FieldData<false>;
113
- newtype<const Name extends string>(name: Name): IntervalNewtype<Name>;
128
+ /** An `interval(e[, w])` constructor value: a bare interval descriptor plus `.as`. */
129
+ interface IntervalCtor<Element extends "u64" | "i64" = "u64" | "i64", Width extends bigint | undefined = bigint | undefined> extends IntervalField<Element, Width, undefined> {
130
+ as<const Domain extends string>(domain: Domain): IntervalField<Element, Width, Domain>;
114
131
  }
115
132
  /**
116
- * The branded value type of a declared newtype the type half of the
117
- * declaration-first pairing (owner ruling 2026-07-16): `const AccountId =
118
- * u64.newtype("AccountId")` + `type AccountId = Infer<typeof AccountId>`.
119
- * Reads the phantom, so it works on any field value (a closed relation's
120
- * `id` field infers its handle brand the same way).
133
+ * A closed relation's reference field descriptor (`Kind.id`)a u64
134
+ * descriptor whose domain is the closed relation's handle domain
135
+ * (`"KindId"`, mirroring Rust's `closed relation Kind as KindId`) and
136
+ * whose roster resolves bare handle ids in selections and ground axioms.
137
+ * Terminal: no `.as`, no `.fresh` its domain IS the closed relation's.
121
138
  */
122
- type Infer<F extends AnyField> = F extends Field<infer V> ? V : never;
139
+ interface ClosedIdField<Domain extends string = string> {
140
+ readonly kind: "u64";
141
+ readonly domain: Domain;
142
+ readonly closed: ClosedRoster;
143
+ }
144
+ /** Any field descriptor, whatever its kind, domain label, or marks. */
145
+ type AnyField = BoolField | StrField | U64Field<string | undefined> | FreshU64Field<string | undefined> | I64Field<string | undefined> | BytesField<number, string | undefined> | IntervalField<"u64" | "i64", bigint | undefined, string | undefined> | ClosedIdField;
123
146
  /**
124
- * A closed relation's id field constructor (`Kind.id`) a u64 field
125
- * pre-branded with the closed relation's handle newtype, for use in other
126
- * relations' field blocks (`kind: Kind.id`). Terminal: its newtype IS the
127
- * closed relation, so `.newtype` and `.fresh` do not exist.
147
+ * The bare structural VALUE type of a field descriptorthe one total
148
+ * definition every fact, result row, and query term reads: `bool`
149
+ * `boolean`, `str` `string`, `u64`/`i64` `bigint` (domain labels
150
+ * included the label never touches the value), `bytes<N>` →
151
+ * `Uint8Array`, intervals → {@link IntervalValue}.
128
152
  */
129
- interface ClosedIdField<Name extends string> extends Field<Brand<bigint, Name>> {
130
- readonly data: FieldData<false>;
131
- }
153
+ type Infer<F extends AnyField> = F extends {
154
+ readonly kind: "bool";
155
+ } ? boolean : F extends {
156
+ readonly kind: "str";
157
+ } ? string : F extends {
158
+ readonly kind: "u64";
159
+ } ? bigint : F extends {
160
+ readonly kind: "i64";
161
+ } ? bigint : F extends {
162
+ readonly kind: "bytes";
163
+ } ? Uint8Array : F extends {
164
+ readonly kind: "interval";
165
+ } ? IntervalValue : never;
132
166
  /**
133
167
  * Rejects a declaration name that JavaScript would re-order. Declaration
134
168
  * order = ordinal ids is the law relations, columns, and schemas all lean
@@ -140,48 +174,43 @@ interface ClosedIdField<Name extends string> extends Field<Brand<bigint, Name>>
140
174
  * error.
141
175
  */
142
176
  declare function assertDeclarationOrderKey(where: string, name: string): void;
143
- /**
144
- * Builds one frozen {@link FieldData}. Internal seam shared by the field
145
- * constructors here and by `closed()` (which mints {@link ClosedIdField}
146
- * values against its own roster).
147
- */
148
- declare function fieldData<Minted extends boolean>(type: ValueTypeSpec, newtype: string | undefined, minted: Minted, closed: ClosedRoster | undefined): FieldData<Minted>;
149
- /** The one `u64` field constructor value. */
150
- declare const u64: U64Field;
151
- /** The one `i64` field constructor value. */
152
- declare const i64: I64Field;
153
- /** The one `bool` field constructor value. */
177
+ /** The one `u64` constructor value. */
178
+ declare const u64: U64Ctor;
179
+ /** The one `i64` constructor value. */
180
+ declare const i64: I64Ctor;
181
+ /** The one `bool` constructor value. */
154
182
  declare const bool: BoolField;
155
- /** The one `str` field constructor value. */
183
+ /** The one `str` constructor value. */
156
184
  declare const str: StrField;
157
185
  /**
158
- * The `bytes<N>` field constructor. The width is mandatory and part of the
159
- * type; `len` is validated to 1..=64 here because the grammar pins that
160
- * range at declaration (`docs/architecture/70-api.md` § the `schema!`
161
- * grammar: N ∈ 1..=64 — bare `bytes` does not parse), the macro-expansion
162
- * boundary's analog being construction.
186
+ * The `bytes<N>` field constructor. The width is mandatory and a
187
+ * descriptor-type label; `width` is validated to 1..=64 here because the
188
+ * grammar pins that range at declaration (`docs/architecture/70-api.md`
189
+ * § the `schema!` grammar: N ∈ 1..=64 — bare `bytes` does not parse), the
190
+ * macro-expansion boundary's analog being construction.
163
191
  */
164
- declare function bytes(len: number): BytesField;
192
+ declare function bytes<const Width extends number>(width: Width): BytesCtor<Width>;
165
193
  /**
166
194
  * The interval field constructor — `interval(u64)` / `interval(i64)` for
167
195
  * the general type (rays representable), `interval(u64, w)` for the
168
- * fixed-width family whose width IS the type. The element is spelled with
169
- * the u64/i64 field constructor values themselves, never a string. `width
170
- * >= 1` is validated here because the grammar pins it at declaration
196
+ * fixed-width family whose width IS a descriptor-type label. The element is
197
+ * spelled with the u64/i64 constructor values themselves, never a string.
198
+ * `width >= 1` is validated here because the grammar pins it at declaration
171
199
  * (`docs/architecture/70-api.md`: w ≥ 1; `interval<u64, 0>` is an
172
200
  * expansion error naming the field).
173
201
  */
174
- declare function interval(element: U64Field | I64Field, width?: bigint): IntervalField;
202
+ declare function interval<Element extends U64Ctor | I64Ctor>(element: Element): IntervalCtor<Element["kind"], undefined>;
203
+ declare function interval<Element extends U64Ctor | I64Ctor, const Width extends bigint>(element: Element, width: Width): IntervalCtor<Element["kind"], Width>;
175
204
  /**
176
205
  * Lowers one host literal at its field position to the wire
177
206
  * {@link LiteralSpec} — the selection-literal machine ground axioms and
178
207
  * `where()` bindings both ride (one machine, same errors — the macro's own
179
208
  * rule). A value on a closed-reference field resolves to its handle NAME
180
- * (the id is re-verified against the roster: an out-of-roster id is a
209
+ * (the id is verified against the roster: an out-of-roster id is a
181
210
  * construction error); everything else lowers to a plain value tagged by
182
- * the field's structural type.
211
+ * the field's structural kind.
183
212
  */
184
- declare function literalOf(field: FieldData, value: unknown): LiteralSpec;
185
- export type { AnyField, BoolField, BytesField, BytesNewtype, ClosedIdField, ClosedRoster, Field, FieldData, FieldValue, FreshU64Newtype, I64Field, I64Newtype, Infer, IntervalField, IntervalNewtype, StrField, U64Field, U64Newtype };
186
- export { assertDeclarationOrderKey, bool, bytes, fieldData, i64, interval, literalOf, str, u64 };
213
+ declare function literalOf(field: AnyField, value: unknown): LiteralSpec;
214
+ export type { AnyField, BoolField, BytesCtor, BytesField, ClosedIdField, ClosedRoster, FreshU64Field, I64Ctor, I64Field, Infer, IntervalCtor, IntervalField, IntervalValue, StrField, U64Ctor, U64Field };
215
+ export { assertDeclarationOrderKey, bool, bytes, i64, interval, literalOf, span, str, u64 };
187
216
  //# sourceMappingURL=fields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAoD1D;;;;;GAKG;AACH,UAAU,YAAY;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC;AAED;;;;;GAKG;AACH,UA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