@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.
- package/COOKBOOK.md +1394 -0
- package/README.md +4 -0
- package/dist/closed.d.ts +60 -37
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +159 -40
- package/dist/closed.js.map +1 -1
- package/dist/count.d.ts +64 -17
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +37 -14
- package/dist/count.js.map +1 -1
- package/dist/db.d.ts +15 -7
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +13 -5
- package/dist/db.js.map +1 -1
- package/dist/exhume.d.ts +12 -11
- package/dist/exhume.d.ts.map +1 -1
- package/dist/exhume.js +7 -6
- package/dist/exhume.js.map +1 -1
- package/dist/face.d.ts +79 -19
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +14 -15
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +158 -129
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +80 -81
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +21 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/lower.d.ts +6 -3
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +48 -17
- package/dist/lower.js.map +1 -1
- package/dist/marshal.d.ts +36 -21
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +41 -25
- package/dist/marshal.js.map +1 -1
- package/dist/native.js +2 -2
- package/dist/query/atom.d.ts +332 -174
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +72 -172
- package/dist/query/atom.js.map +1 -1
- package/dist/query/lower.d.ts +295 -107
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +860 -388
- package/dist/query/lower.js.map +1 -1
- package/dist/query/predicate.d.ts +69 -88
- package/dist/query/predicate.d.ts.map +1 -1
- package/dist/query/predicate.js +118 -72
- package/dist/query/predicate.js.map +1 -1
- package/dist/query/run.d.ts +19 -16
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +31 -24
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +139 -123
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +71 -115
- package/dist/query/scope.js.map +1 -1
- package/dist/query/select.d.ts +102 -80
- package/dist/query/select.d.ts.map +1 -1
- package/dist/query/select.js +39 -34
- package/dist/query/select.js.map +1 -1
- package/dist/relation.d.ts +33 -36
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +15 -16
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +19 -8
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +6 -5
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +56 -31
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +38 -13
- package/dist/statements.js.map +1 -1
- package/package.json +4 -3
- package/src/closed.ts +271 -93
- package/src/count.ts +112 -18
- package/src/db.ts +22 -12
- package/src/exhume.ts +12 -11
- package/src/face.ts +114 -22
- package/src/fields.ts +261 -217
- package/src/index.ts +50 -59
- package/src/lower.ts +62 -20
- package/src/marshal.ts +48 -30
- package/src/native.ts +2 -2
- package/src/query/atom.ts +480 -376
- package/src/query/lower.ts +1341 -542
- package/src/query/predicate.ts +198 -161
- package/src/query/run.ts +35 -25
- package/src/query/scope.ts +188 -218
- package/src/query/select.ts +168 -93
- package/src/relation.ts +38 -44
- package/src/schema.ts +22 -12
- package/src/spec.ts +6 -5
- package/src/statements.ts +69 -26
- package/dist/brand.d.ts +0 -59
- package/dist/brand.d.ts.map +0 -1
- package/dist/brand.js +0 -47
- package/dist/brand.js.map +0 -1
- 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")
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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. `
|
|
36
|
-
*
|
|
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
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
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
|
|
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
|
package/dist/face.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../src/face.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"face.d.ts","sourceRoot":"","sources":["../src/face.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAsB3G;;;;;GAKG;AACH,UAAU,KAAK,CAAC,CAAC;IAChB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;CAC1C;AAED;;;;GAIG;AACH,iBAAS,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAI7D;AAED,8DAA8D;AAC9D,KAAK,SAAS,GAAG,WAAW,GAAG,SAAS,CAAA;AAExC,qFAAqF;AACrF,UAAU,QAAQ;IACjB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,Q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AAC,CAAA;AAYb;;;;GAIG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAW1C;AAED,YAAY,EACX,OAAO,EACP,KAAK,EACL,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,WAAW,EACX,UAAU,EACV,SAAS,EACT,UAAU,EACV,KAAK,EACL,SAAS,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")
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"face.js","sourceRoot":"","sources":["../src/face.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;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,E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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
|
|
3
|
-
* (`docs/architecture/70-api.md`): `bool`, `u64`, `i64`,
|
|
4
|
-
* `interval(u64|i64[, width])`, each a plain frozen value
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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 structurally — the
|
|
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 {
|
|
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
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
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
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
30
|
+
interface IntervalValue {
|
|
31
|
+
readonly start: bigint;
|
|
32
|
+
readonly end: bigint;
|
|
29
33
|
}
|
|
30
34
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
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
|
-
|
|
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
|
-
*
|
|
44
|
-
*
|
|
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
|
|
47
|
-
readonly
|
|
48
|
-
readonly [
|
|
48
|
+
interface ClosedRoster {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly handles: readonly string[];
|
|
49
51
|
}
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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:
|
|
59
|
-
interface StrField
|
|
60
|
-
readonly
|
|
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
|
|
64
|
-
* u64 as AccountId, fresh`).
|
|
65
|
-
* `
|
|
66
|
-
*
|
|
67
|
-
*
|
|
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
|
|
70
|
-
readonly
|
|
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
|
|
74
|
-
* (Rust: `u64 as
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
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
|
|
80
|
-
readonly
|
|
81
|
-
readonly
|
|
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
|
|
84
|
-
interface
|
|
85
|
-
|
|
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
|
|
89
|
-
interface
|
|
90
|
-
readonly
|
|
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
|
|
93
|
-
interface
|
|
94
|
-
|
|
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
|
-
/**
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
102
|
-
interface
|
|
103
|
-
|
|
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
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
111
|
-
interface
|
|
112
|
-
|
|
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
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* `
|
|
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
|
-
|
|
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
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
147
|
+
* The bare structural VALUE type of a field descriptor — the 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
|
-
|
|
130
|
-
readonly
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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`
|
|
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
|
|
159
|
-
* type; `
|
|
160
|
-
* range at declaration (`docs/architecture/70-api.md`
|
|
161
|
-
* grammar: N ∈ 1..=64 — bare `bytes` does not parse), the
|
|
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(
|
|
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
|
|
169
|
-
* the u64/i64
|
|
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
|
|
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
|
|
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
|
|
211
|
+
* the field's structural kind.
|
|
183
212
|
*/
|
|
184
|
-
declare function literalOf(field:
|
|
185
|
-
export type { AnyField, BoolField,
|
|
186
|
-
export { assertDeclarationOrderKey, bool, bytes,
|
|
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
|
package/dist/fields.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C;;;;;;;;GAQG;AACH,UAAU,aAAa;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;GAMG;AACH,iBAAS,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa,CAKvD;AAED;;;;;GAKG;AACH,UAAU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