@bjornpagen/bumbledb 0.1.0 → 0.3.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 +1450 -0
- package/README.md +69 -30
- package/dist/closed.d.ts +157 -38
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +232 -47
- 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 +27 -8
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +33 -10
- 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 +135 -30
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +44 -19
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +130 -130
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +60 -94
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +29 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -14
- package/dist/index.js.map +1 -1
- package/dist/law.d.ts +224 -0
- package/dist/law.d.ts.map +1 -0
- package/dist/law.js +224 -0
- package/dist/law.js.map +1 -0
- package/dist/lower.d.ts +17 -7
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +66 -24
- 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.d.ts +6 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +2 -2
- package/dist/native.js.map +1 -1
- package/dist/query/atom.d.ts +370 -174
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +75 -172
- package/dist/query/atom.js.map +1 -1
- package/dist/query/lower.d.ts +312 -109
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +906 -387
- package/dist/query/lower.js.map +1 -1
- package/dist/query/predicate.d.ts +70 -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 +178 -127
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +111 -108
- 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 +48 -38
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +24 -19
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts +41 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +34 -9
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +7 -5
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +91 -36
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +42 -12
- package/dist/statements.js.map +1 -1
- package/package.json +4 -3
- package/src/closed.ts +448 -95
- package/src/count.ts +112 -18
- package/src/db.ts +45 -17
- package/src/exhume.ts +12 -11
- package/src/face.ts +211 -41
- package/src/fields.ts +199 -234
- package/src/index.ts +78 -61
- package/src/law.ts +519 -0
- package/src/lower.ts +82 -27
- package/src/marshal.ts +48 -30
- package/src/native.ts +8 -4
- package/src/query/atom.ts +525 -374
- package/src/query/lower.ts +1469 -538
- package/src/query/predicate.ts +208 -161
- package/src/query/run.ts +35 -25
- package/src/query/scope.ts +264 -218
- package/src/query/select.ts +168 -93
- package/src/relation.ts +47 -47
- package/src/schema.ts +69 -18
- package/src/spec.ts +7 -5
- package/src/statements.ts +124 -41
- 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/spec.d.ts
CHANGED
|
@@ -124,9 +124,10 @@ type WindowSpec = {
|
|
|
124
124
|
readonly lo: bigint;
|
|
125
125
|
};
|
|
126
126
|
/**
|
|
127
|
-
* One field: name, structural type, host newtype name
|
|
128
|
-
*
|
|
129
|
-
*
|
|
127
|
+
* One field: name, structural type, host newtype name — the field's
|
|
128
|
+
* DOMAIN (the macro's declared `as NewType`; the SDK's law-computed class
|
|
129
|
+
* name), carried for handle resolution only, dropped by the engine at
|
|
130
|
+
* descriptor lowering and never fingerprinted — and the `fresh` mint mark.
|
|
130
131
|
*/
|
|
131
132
|
interface FieldSpec {
|
|
132
133
|
readonly name: string;
|
|
@@ -147,8 +148,9 @@ interface RowSpec {
|
|
|
147
148
|
* kind); a closed relation's `fields` are its declared intrinsic columns
|
|
148
149
|
* only — the synthetic (`id`, u64) handle field is materialized by the
|
|
149
150
|
* engine's schema validation. `newtype` is the handle newtype of a closed
|
|
150
|
-
* relation (the SDK
|
|
151
|
-
*
|
|
151
|
+
* relation (the SDK emits the id's law-computed generator class,
|
|
152
|
+
* `` `${name}.id` `` — the same label every referencing field carries by
|
|
153
|
+
* law), undefined on an ordinary one.
|
|
152
154
|
*/
|
|
153
155
|
interface RelationSpec {
|
|
154
156
|
readonly name: string;
|
package/dist/spec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;GAOG;AACH,KAAK,aAAa,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,KA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Aa,EAAE,CAAA;CAC7C;AA6ED;;;;;;;;;GASG;AACH,iBAAS,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CA6BnD;AAED;;;GAGG;AACH,iBAAS,gBAAgB,CAAC,GAAG,EAAE,cAAc,GAAG,MAAM,CAKrD;AAED;;;;GAIG;AACH,iBAAS,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAShD;AAED,YAAY,EACX,SAAS,EACT,cAAc,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,UAAU,EACV,QAAQ,EACR,aAAa,EACb,SAAS,EACT,aAAa,EACb,UAAU,EACV,CAAA;AACD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA2JH;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,eAAe,CAAA;AAErC,oGAAoG;AACpG,MAAM,eAAe,GAAG,sBAAsB,CAAA;AAE9C;;;;;GAKG;AACH,SAAS,eAAe,CAAC,EAAU;IAClC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAA;IACb,CAAC;IACD,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAA;IACb,CAAC;IACD,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAA;IACb,CAAC;IACD,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAA;IACb,CAAC;IACD,IAAI,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE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C,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAA;AACzD,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAkB;IACvC,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,OAAO;YACX,OAAO,IAAI,MAAM,CAAC,CAAC,GAAG,CAAA;QACvB,KAAK,OAAO;YACX,OAAO,IAAI,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,EAAE,GAAG,CAAA;QACtC,KAAK,OAAO;YACX,OAAO,IAAI,MAAM,CAAC,EAAE,MAAM,CAAA;IAC5B,CAAC;AACF,CAAC;AAeD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/statements.d.ts
CHANGED
|
@@ -4,77 +4,132 @@
|
|
|
4
4
|
* form, conditional containment, the bidirectional `==` abbreviation, and
|
|
5
5
|
* the cardinality window. A statement value is opaque and inert — no
|
|
6
6
|
* methods, no fluent continuation: a fact about the theory, not a builder.
|
|
7
|
+
*
|
|
8
|
+
* Every field reference is checked against the relation it names in the
|
|
9
|
+
* TYPE — existence through {@link FaceFields} (`on(R, "nope")` does not
|
|
10
|
+
* compile) and STRUCTURAL compatibility through {@link SameShapes}: the two
|
|
11
|
+
* faces' projected kind/width/element triples are read off the schema type
|
|
12
|
+
* (the minimal kernel — descriptors are pure structure) and constrained
|
|
13
|
+
* positionwise equal, so a u64 face against a str face, a bytes width
|
|
14
|
+
* mismatch, or an interval element mismatch is a compile error. Domains are
|
|
15
|
+
* NOT compared here — there is no domain to compare at construction: the
|
|
16
|
+
* statements themselves are what define the equivalence classes, and the
|
|
17
|
+
* domain wall lives where they aggregate — `schema()` (the
|
|
18
|
+
* one-generator-per-class law) and query joins (class names off the schema
|
|
19
|
+
* type). What is only a SEMANTIC property — the target side of a
|
|
20
|
+
* containment resolving a declared key of its relation — is DELIBERATELY
|
|
21
|
+
* not (and cannot be) stated here: whether `B(y)` is a key of `B` depends
|
|
22
|
+
* on which `key()` statements the surrounding `schema()` collects, a set no
|
|
23
|
+
* face type can see; it stays the engine's typed `SchemaError` judgment at
|
|
24
|
+
* `Db.create`/`Db.open` (the two-boundary split, engine as final
|
|
25
|
+
* authority).
|
|
7
26
|
*/
|
|
8
|
-
import { phantom } from "#brand.ts";
|
|
9
27
|
import type { Count } from "#count.ts";
|
|
10
|
-
import { type AnyFace, type FaceData, type SameArity } from "#face.ts";
|
|
28
|
+
import { type AnyFace, type FaceData, type SameArity, type SameShapes } from "#face.ts";
|
|
11
29
|
import type { AnyRelation, RelationFields } from "#relation.ts";
|
|
12
30
|
import { type WindowSpec } from "#spec.ts";
|
|
13
|
-
/**
|
|
14
|
-
|
|
31
|
+
/** A `key()` statement's runtime description — owner and projection carried at exact types. */
|
|
32
|
+
interface KeyData<R extends AnyRelation, Projection extends readonly string[]> {
|
|
15
33
|
readonly kind: "key";
|
|
16
|
-
readonly owner:
|
|
17
|
-
readonly projection:
|
|
18
|
-
}
|
|
34
|
+
readonly owner: R;
|
|
35
|
+
readonly projection: Projection;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A containment statement's runtime description — the two faces carried at
|
|
39
|
+
* their EXACT types (owner names and projection tuples are honest runtime
|
|
40
|
+
* properties, and they are the type-level carrier `schema()`'s law-typing
|
|
41
|
+
* pairs slots through). The defaults are the wide shape renderers and the
|
|
42
|
+
* wire lowering consume.
|
|
43
|
+
*/
|
|
44
|
+
interface ContainmentData<Src extends FaceData = FaceData, Tgt extends FaceData = FaceData> {
|
|
19
45
|
readonly kind: "containment";
|
|
20
|
-
readonly source:
|
|
21
|
-
readonly target:
|
|
46
|
+
readonly source: Src;
|
|
47
|
+
readonly target: Tgt;
|
|
22
48
|
readonly bidirectional: boolean;
|
|
23
|
-
}
|
|
49
|
+
}
|
|
50
|
+
/** A window statement's runtime description — target-left, faces at exact types like {@link ContainmentData}. */
|
|
51
|
+
interface WindowData<Tgt extends FaceData = FaceData, Src extends FaceData = FaceData> {
|
|
24
52
|
readonly kind: "window";
|
|
25
|
-
readonly target:
|
|
53
|
+
readonly target: Tgt;
|
|
26
54
|
readonly window: WindowSpec;
|
|
27
|
-
readonly source:
|
|
28
|
-
}
|
|
55
|
+
readonly source: Src;
|
|
56
|
+
}
|
|
57
|
+
/** One statement's runtime description, tagged by form. */
|
|
58
|
+
type StatementData = KeyData<AnyRelation, readonly string[]> | ContainmentData | WindowData;
|
|
29
59
|
/** An opaque statement value — what `schema()` assembles into a theory. */
|
|
30
60
|
interface Statement {
|
|
31
61
|
readonly data: StatementData;
|
|
32
62
|
}
|
|
33
63
|
/**
|
|
34
|
-
* A
|
|
35
|
-
*
|
|
64
|
+
* A containment (or `==` bijection) statement as a TYPED value: `data`
|
|
65
|
+
* carries both faces at their exact types, so the schema-level class laws
|
|
66
|
+
* can read every paired (relation, field) slot off the statement type —
|
|
67
|
+
* spell the statement list inline in `schema()` and the equivalence
|
|
68
|
+
* classes compute at the type level too. Structurally still a plain
|
|
69
|
+
* {@link Statement}.
|
|
70
|
+
*/
|
|
71
|
+
interface ContainedStatement<Src extends FaceData, Tgt extends FaceData> extends Statement {
|
|
72
|
+
readonly data: ContainmentData<Src, Tgt>;
|
|
73
|
+
}
|
|
74
|
+
/** A window statement as a TYPED value — the {@link ContainedStatement} of the window form. */
|
|
75
|
+
interface WindowStatement<Tgt extends FaceData, Src extends FaceData> extends Statement {
|
|
76
|
+
readonly data: WindowData<Tgt, Src>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A `key()` statement as a TYPED value: its `data` carries the owner
|
|
80
|
+
* relation and the projection tuple at their EXACT types (honest runtime
|
|
81
|
+
* properties — no phantom), which is what the key-statement-selected
|
|
36
82
|
* `get(relation, keyStatement, key)` overload types its key object by
|
|
37
|
-
* (`docs/architecture/70-api.md` § the freeze, the multi-key typed get)
|
|
38
|
-
*
|
|
39
|
-
*
|
|
83
|
+
* (`docs/architecture/70-api.md` § the freeze, the multi-key typed get) and
|
|
84
|
+
* what resolves each projected field's descriptor through the owner's
|
|
85
|
+
* schema type. Structurally still a plain {@link Statement}.
|
|
40
86
|
*/
|
|
41
87
|
interface KeyStatement<R extends AnyRelation, Projection extends readonly string[]> extends Statement {
|
|
42
|
-
readonly
|
|
43
|
-
readonly owner: R;
|
|
44
|
-
readonly projection: Projection;
|
|
45
|
-
};
|
|
88
|
+
readonly data: KeyData<R, Projection>;
|
|
46
89
|
}
|
|
47
90
|
/**
|
|
48
91
|
* `R(X) -> R` — the FD key form, composite keys as tuples. No selection
|
|
49
92
|
* parameter exists (the FD-with-selection shape is unrepresentable, as in
|
|
50
93
|
* the grammar), and only ordinary relations are accepted: a closed
|
|
51
94
|
* relation's key `R(id) -> R` is materialized by the engine, so an
|
|
52
|
-
* explicit one would only ever be a duplicate.
|
|
53
|
-
*
|
|
54
|
-
*
|
|
95
|
+
* explicit one would only ever be a duplicate. Every projected name is
|
|
96
|
+
* checked against `R`'s field block in the type, and the tuple is carried
|
|
97
|
+
* in the returned value's type ({@link KeyStatement}) — keyed point reads
|
|
98
|
+
* through THIS statement are typed field-for-field, descriptors resolvable
|
|
99
|
+
* through the owner's schema type.
|
|
55
100
|
*/
|
|
56
101
|
declare function key<R extends AnyRelation, const Projection extends readonly [keyof RelationFields<R> & string, ...(keyof RelationFields<R> & string)[]]>(relation: R, fields: Projection): KeyStatement<R, Projection>;
|
|
57
102
|
/**
|
|
58
|
-
* `A(X|φ) <= B(Y|ψ)` — conditional inclusion, source left.
|
|
59
|
-
*
|
|
103
|
+
* `A(X|φ) <= B(Y|ψ)` — conditional inclusion, source left. Arity mismatch
|
|
104
|
+
* between the two faces is a type error ({@link SameArity}); a structurally
|
|
105
|
+
* mismatched pair is a type error ({@link SameShapes} — positionwise
|
|
106
|
+
* equality of the projected kind/width/element triples). The target side
|
|
107
|
+
* must resolve a declared key of B — a SEMANTIC property of the whole
|
|
108
|
+
* statement set that no face type can state, DELIBERATELY judged by the
|
|
60
109
|
* engine at `Db.create`/`Db.open` (`SchemaError`), never re-checked here.
|
|
61
|
-
* Arity mismatch between the two faces is a type error ({@link SameArity}).
|
|
62
110
|
*/
|
|
63
|
-
declare function contained<A extends AnyFace, B extends AnyFace>(source: A, target: B & SameArity<A, B>):
|
|
111
|
+
declare function contained<A extends AnyFace, B extends AnyFace>(source: A, target: B & SameArity<A, B> & SameShapes<A, B>): ContainedStatement<A["data"], B["data"]>;
|
|
64
112
|
/**
|
|
65
|
-
* `A(X|φ) == B(Y|ψ)` — the bidirectional abbreviation, one utterance
|
|
66
|
-
*
|
|
67
|
-
* (
|
|
113
|
+
* `A(X|φ) == B(Y|ψ)` — the bidirectional abbreviation, one utterance: the
|
|
114
|
+
* selected `==` bijection, a keyed one-to-one correspondence between the
|
|
115
|
+
* two faces (each side contains the other). It lowers to the two adjacent
|
|
116
|
+
* containments in the `A <= B` first order (macro parity — the engine
|
|
117
|
+
* performs the split, source-first) and renders as `==` once, in the
|
|
118
|
+
* written orientation. Faces pair by arity AND structural shape, exactly
|
|
119
|
+
* as {@link contained}.
|
|
68
120
|
*/
|
|
69
|
-
declare function mirrors<A extends AnyFace, B extends AnyFace>(source: A, target: B & SameArity<A, B>):
|
|
121
|
+
declare function mirrors<A extends AnyFace, B extends AnyFace>(source: A, target: B & SameArity<A, B> & SameShapes<A, B>): ContainedStatement<A["data"], B["data"]>;
|
|
70
122
|
/**
|
|
71
123
|
* `B(Y|ψ) <={window} A(X|φ)` — the cardinality window. READ CAREFULLY: the
|
|
72
124
|
* LEFT face is the window's TARGET, the per-group parent (B-family,
|
|
73
125
|
* target-left — macro parity), and the RIGHT face is the counted source.
|
|
74
126
|
* `window(on(Holder, "id"), atMost(3n), on(Account, "holder"))` says: each
|
|
75
|
-
* Holder id groups at most three Account rows by holder.
|
|
127
|
+
* Holder id groups at most three Account rows by holder. The two faces
|
|
128
|
+
* pair by arity AND structural shape ({@link SameShapes}), exactly as
|
|
129
|
+
* containment — the grouping join reads the same positionwise field
|
|
130
|
+
* pairing.
|
|
76
131
|
*/
|
|
77
|
-
declare function window<B extends AnyFace, A extends AnyFace>(target: B, count: Count, source: A & SameArity<B, A>):
|
|
132
|
+
declare function window<B extends AnyFace, A extends AnyFace>(target: B, count: Count, source: A & SameArity<B, A> & SameShapes<B, A>): WindowStatement<B["data"], A["data"]>;
|
|
78
133
|
/**
|
|
79
134
|
* Renders one statement in the CANONICAL macro spelling
|
|
80
135
|
* (`docs/architecture/70-api.md`; the engine's `schema/render.rs` emits the
|
|
@@ -86,6 +141,6 @@ declare function window<B extends AnyFace, A extends AnyFace>(target: B, count:
|
|
|
86
141
|
* strings are output-only.
|
|
87
142
|
*/
|
|
88
143
|
declare function renderStatement(statement: Statement): string;
|
|
89
|
-
export type { KeyStatement, Statement, StatementData };
|
|
144
|
+
export type { ContainedStatement, ContainmentData, KeyData, KeyStatement, Statement, StatementData, WindowData, WindowStatement };
|
|
90
145
|
export { contained, key, mirrors, renderStatement, window };
|
|
91
146
|
//# sourceMappingURL=statements.d.ts.map
|
package/dist/statements.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAc,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AACnG,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,UAAU,CAAA;AAExD,+FAA+F;AAC/F,UAAU,OAAO,CAAC,CAAC,SAAS,WA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AAED;;;;;;;;;GASG;AACH,iBAAS,MAAM,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,OAAO,EACnD,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5C,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAQvC;AAED;;;;;;;;;GASG;AACH,iBAAS,eAAe,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAYrD;AAED,YAAY,EACX,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,eAAe,EACf,CAAA;AACD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/statements.js
CHANGED
|
@@ -4,9 +4,27 @@
|
|
|
4
4
|
* form, conditional containment, the bidirectional `==` abbreviation, and
|
|
5
5
|
* the cardinality window. A statement value is opaque and inert — no
|
|
6
6
|
* methods, no fluent continuation: a fact about the theory, not a builder.
|
|
7
|
+
*
|
|
8
|
+
* Every field reference is checked against the relation it names in the
|
|
9
|
+
* TYPE — existence through {@link FaceFields} (`on(R, "nope")` does not
|
|
10
|
+
* compile) and STRUCTURAL compatibility through {@link SameShapes}: the two
|
|
11
|
+
* faces' projected kind/width/element triples are read off the schema type
|
|
12
|
+
* (the minimal kernel — descriptors are pure structure) and constrained
|
|
13
|
+
* positionwise equal, so a u64 face against a str face, a bytes width
|
|
14
|
+
* mismatch, or an interval element mismatch is a compile error. Domains are
|
|
15
|
+
* NOT compared here — there is no domain to compare at construction: the
|
|
16
|
+
* statements themselves are what define the equivalence classes, and the
|
|
17
|
+
* domain wall lives where they aggregate — `schema()` (the
|
|
18
|
+
* one-generator-per-class law) and query joins (class names off the schema
|
|
19
|
+
* type). What is only a SEMANTIC property — the target side of a
|
|
20
|
+
* containment resolving a declared key of its relation — is DELIBERATELY
|
|
21
|
+
* not (and cannot be) stated here: whether `B(y)` is a key of `B` depends
|
|
22
|
+
* on which `key()` statements the surrounding `schema()` collects, a set no
|
|
23
|
+
* face type can see; it stays the engine's typed `SchemaError` judgment at
|
|
24
|
+
* `Db.create`/`Db.open` (the two-boundary split, engine as final
|
|
25
|
+
* authority).
|
|
7
26
|
*/
|
|
8
27
|
import * as errors from "@superbuilders/errors";
|
|
9
|
-
import { phantom } from "#brand.ts";
|
|
10
28
|
import { renderFace } from "#face.ts";
|
|
11
29
|
import { renderWindow } from "#spec.ts";
|
|
12
30
|
/**
|
|
@@ -14,9 +32,11 @@ import { renderWindow } from "#spec.ts";
|
|
|
14
32
|
* parameter exists (the FD-with-selection shape is unrepresentable, as in
|
|
15
33
|
* the grammar), and only ordinary relations are accepted: a closed
|
|
16
34
|
* relation's key `R(id) -> R` is materialized by the engine, so an
|
|
17
|
-
* explicit one would only ever be a duplicate.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
35
|
+
* explicit one would only ever be a duplicate. Every projected name is
|
|
36
|
+
* checked against `R`'s field block in the type, and the tuple is carried
|
|
37
|
+
* in the returned value's type ({@link KeyStatement}) — keyed point reads
|
|
38
|
+
* through THIS statement are typed field-for-field, descriptors resolvable
|
|
39
|
+
* through the owner's schema type.
|
|
20
40
|
*/
|
|
21
41
|
function key(relation, fields) {
|
|
22
42
|
if (!("fields" in relation.data)) {
|
|
@@ -25,15 +45,18 @@ function key(relation, fields) {
|
|
|
25
45
|
const data = Object.freeze({
|
|
26
46
|
kind: "key",
|
|
27
47
|
owner: relation,
|
|
28
|
-
projection: Object.freeze(
|
|
48
|
+
projection: Object.freeze(fields)
|
|
29
49
|
});
|
|
30
50
|
return Object.freeze({ data });
|
|
31
51
|
}
|
|
32
52
|
/**
|
|
33
|
-
* `A(X|φ) <= B(Y|ψ)` — conditional inclusion, source left.
|
|
34
|
-
*
|
|
53
|
+
* `A(X|φ) <= B(Y|ψ)` — conditional inclusion, source left. Arity mismatch
|
|
54
|
+
* between the two faces is a type error ({@link SameArity}); a structurally
|
|
55
|
+
* mismatched pair is a type error ({@link SameShapes} — positionwise
|
|
56
|
+
* equality of the projected kind/width/element triples). The target side
|
|
57
|
+
* must resolve a declared key of B — a SEMANTIC property of the whole
|
|
58
|
+
* statement set that no face type can state, DELIBERATELY judged by the
|
|
35
59
|
* engine at `Db.create`/`Db.open` (`SchemaError`), never re-checked here.
|
|
36
|
-
* Arity mismatch between the two faces is a type error ({@link SameArity}).
|
|
37
60
|
*/
|
|
38
61
|
function contained(source, target) {
|
|
39
62
|
const data = Object.freeze({
|
|
@@ -45,9 +68,13 @@ function contained(source, target) {
|
|
|
45
68
|
return Object.freeze({ data });
|
|
46
69
|
}
|
|
47
70
|
/**
|
|
48
|
-
* `A(X|φ) == B(Y|ψ)` — the bidirectional abbreviation, one utterance
|
|
49
|
-
*
|
|
50
|
-
* (
|
|
71
|
+
* `A(X|φ) == B(Y|ψ)` — the bidirectional abbreviation, one utterance: the
|
|
72
|
+
* selected `==` bijection, a keyed one-to-one correspondence between the
|
|
73
|
+
* two faces (each side contains the other). It lowers to the two adjacent
|
|
74
|
+
* containments in the `A <= B` first order (macro parity — the engine
|
|
75
|
+
* performs the split, source-first) and renders as `==` once, in the
|
|
76
|
+
* written orientation. Faces pair by arity AND structural shape, exactly
|
|
77
|
+
* as {@link contained}.
|
|
51
78
|
*/
|
|
52
79
|
function mirrors(source, target) {
|
|
53
80
|
const data = Object.freeze({
|
|
@@ -63,7 +90,10 @@ function mirrors(source, target) {
|
|
|
63
90
|
* LEFT face is the window's TARGET, the per-group parent (B-family,
|
|
64
91
|
* target-left — macro parity), and the RIGHT face is the counted source.
|
|
65
92
|
* `window(on(Holder, "id"), atMost(3n), on(Account, "holder"))` says: each
|
|
66
|
-
* Holder id groups at most three Account rows by holder.
|
|
93
|
+
* Holder id groups at most three Account rows by holder. The two faces
|
|
94
|
+
* pair by arity AND structural shape ({@link SameShapes}), exactly as
|
|
95
|
+
* containment — the grouping join reads the same positionwise field
|
|
96
|
+
* pairing.
|
|
67
97
|
*/
|
|
68
98
|
function window(target, count, source) {
|
|
69
99
|
const data = Object.freeze({
|
package/dist/statements.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statements.js","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"statements.js","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAE/C,OAAO,EAA+B,UAAU,EAAmC,MAAM,UAAU,CAAA;AAEnG,OAAO,EAAE,YAAY,EAAmB,MAAM,UAAU,CAAA;AAqExD;;;;;;;;;;GAUG;AACH,SAAS,GAAG,CAGV,QAAW,EAAE,MAAkB;IAChC,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAClC,MAAM,MAAM,CAAC,GAAG,CACf,OAAO,QAAQ,CAAC,IAAI,2CAA2C,QAAQ,CAAC,IAAI,WAAW,QAAQ,CAAC,IAAI,oEAAoE,CACxK,CAAA;IACF,CAAC;IACD,MAAM,IAAI,GAA2B,MAAM,CAAC,MAAM,CAAC;QAClD,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,QAAQ;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;KACjC,CAAC,CAAA;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;AAC/B,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,SAAS,CACjB,MAAS,EACT,MAA8C;IAE9C,MAAM,IAAI,GAA0C,MAAM,CAAC,MAAM,CAAC;QACjE,IAAI,EAAE,aAAa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GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAA;YACjD,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;QAC3E,CAAC;QACD,KAAK,QAAQ;YACZ,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA;IAC/F,CAAC;AACF,CAAC;AAYD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bjornpagen/bumbledb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Type-theoretic TypeScript SDK for the bumbledb embedded relational engine",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|
|
24
|
-
"src"
|
|
24
|
+
"src",
|
|
25
|
+
"COOKBOOK.md"
|
|
25
26
|
],
|
|
26
27
|
"keywords": [
|
|
27
28
|
"database",
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"@superbuilders/errors": "^4.0.2"
|
|
44
45
|
},
|
|
45
46
|
"optionalDependencies": {
|
|
46
|
-
"@bjornpagen/bumbledb-darwin-arm64": "0.
|
|
47
|
+
"@bjornpagen/bumbledb-darwin-arm64": "0.3.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@biomejs/biome": "^2.0.0-beta.5",
|