@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/fields.js
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
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
20
|
import * as errors from "@superbuilders/errors";
|
|
18
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Constructs an interval literal — the `start..end` spelling. Half-open
|
|
23
|
+
* and nonempty by construction: `start >= end` is a typed construction
|
|
24
|
+
* error (parse, don't validate — the same invariant Rust's
|
|
25
|
+
* `Interval::new` enforces at the host boundary). The value is bare and
|
|
26
|
+
* structural: it is assignable to any interval field.
|
|
27
|
+
*/
|
|
28
|
+
function span(start, end) {
|
|
29
|
+
if (start >= end) {
|
|
30
|
+
throw errors.new(`interval is half-open and nonempty: start must be < end (got ${start}..${end})`);
|
|
31
|
+
}
|
|
32
|
+
return Object.freeze({ start, end });
|
|
33
|
+
}
|
|
19
34
|
/**
|
|
20
35
|
* The typed shape refusal of the selection-literal machine — reached only
|
|
21
36
|
* through ill-typed input (the well-typed surfaces make it unrepresentable).
|
|
@@ -33,10 +48,10 @@ function isIntervalLiteral(value) {
|
|
|
33
48
|
typeof value.end === "bigint");
|
|
34
49
|
}
|
|
35
50
|
/**
|
|
36
|
-
* Resolves one closed-handle literal: the
|
|
37
|
-
*
|
|
38
|
-
* construction error, the belt the type level
|
|
39
|
-
*
|
|
51
|
+
* Resolves one closed-handle literal: the handle id (a bare bigint) back to
|
|
52
|
+
* its handle NAME through the roster — an out-of-roster id is a
|
|
53
|
+
* construction error, the belt the type level deliberately does not provide
|
|
54
|
+
* (structural values make any bigint spellable here; the roster judges).
|
|
40
55
|
*/
|
|
41
56
|
function handleLiteral(closed, value) {
|
|
42
57
|
if (typeof value !== "bigint") {
|
|
@@ -73,82 +88,66 @@ function assertDeclarationOrderKey(where, name) {
|
|
|
73
88
|
throw errors.new(`${where}: name ${name} is an integer index — JavaScript object keys re-order integer indices, breaking the declaration-order law; use a non-numeric name`);
|
|
74
89
|
}
|
|
75
90
|
}
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* values against its own roster).
|
|
80
|
-
*/
|
|
81
|
-
function fieldData(type, newtype, minted, closed) {
|
|
82
|
-
return Object.freeze({ type: Object.freeze(type), newtype, minted, closed });
|
|
91
|
+
/** Builds one fresh-marked u64 descriptor (the `.fresh` property of an unmarked one). */
|
|
92
|
+
function freshU64(domain) {
|
|
93
|
+
return Object.freeze({ kind: "u64", domain, fresh: true });
|
|
83
94
|
}
|
|
84
|
-
/** The one `u64`
|
|
95
|
+
/** The one `u64` constructor value. */
|
|
85
96
|
const u64 = Object.freeze({
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
return Object.freeze({
|
|
92
|
-
data: fieldData({ kind: "u64" }, name, false, undefined),
|
|
93
|
-
fresh
|
|
94
|
-
});
|
|
97
|
+
kind: "u64",
|
|
98
|
+
domain: undefined,
|
|
99
|
+
fresh: freshU64(undefined),
|
|
100
|
+
as(domain) {
|
|
101
|
+
return Object.freeze({ kind: "u64", domain, fresh: freshU64(domain) });
|
|
95
102
|
}
|
|
96
103
|
});
|
|
97
|
-
/** The one `i64`
|
|
104
|
+
/** The one `i64` constructor value. */
|
|
98
105
|
const i64 = Object.freeze({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
kind: "i64",
|
|
107
|
+
domain: undefined,
|
|
108
|
+
as(domain) {
|
|
109
|
+
return Object.freeze({ kind: "i64", domain });
|
|
102
110
|
}
|
|
103
111
|
});
|
|
104
|
-
/** The one `bool`
|
|
105
|
-
const bool = Object.freeze({
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
/** The one `str` field constructor value. */
|
|
109
|
-
const str = Object.freeze({
|
|
110
|
-
data: fieldData({ kind: "string" }, undefined, false, undefined)
|
|
111
|
-
});
|
|
112
|
+
/** The one `bool` constructor value. */
|
|
113
|
+
const bool = Object.freeze({ kind: "bool", domain: undefined });
|
|
114
|
+
/** The one `str` constructor value. */
|
|
115
|
+
const str = Object.freeze({ kind: "str", domain: undefined });
|
|
112
116
|
/**
|
|
113
|
-
* The `bytes<N>` field constructor. The width is mandatory and
|
|
114
|
-
* type; `
|
|
115
|
-
* range at declaration (`docs/architecture/70-api.md`
|
|
116
|
-
* grammar: N ∈ 1..=64 — bare `bytes` does not parse), the
|
|
117
|
-
* boundary's analog being construction.
|
|
117
|
+
* The `bytes<N>` field constructor. The width is mandatory and a
|
|
118
|
+
* descriptor-type label; `width` is validated to 1..=64 here because the
|
|
119
|
+
* grammar pins that range at declaration (`docs/architecture/70-api.md`
|
|
120
|
+
* § the `schema!` grammar: N ∈ 1..=64 — bare `bytes` does not parse), the
|
|
121
|
+
* macro-expansion boundary's analog being construction.
|
|
118
122
|
*/
|
|
119
|
-
function bytes(
|
|
120
|
-
if (!Number.isInteger(
|
|
121
|
-
throw errors.new(`bytes width must be an integer in 1..=64 (got ${
|
|
123
|
+
function bytes(width) {
|
|
124
|
+
if (!Number.isInteger(width) || width < 1 || width > 64) {
|
|
125
|
+
throw errors.new(`bytes width must be an integer in 1..=64 (got ${width}) — docs/architecture/70-api.md pins the range at declaration`);
|
|
122
126
|
}
|
|
123
127
|
return Object.freeze({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
128
|
+
kind: "bytes",
|
|
129
|
+
width,
|
|
130
|
+
domain: undefined,
|
|
131
|
+
as(domain) {
|
|
132
|
+
return Object.freeze({ kind: "bytes", width, domain });
|
|
127
133
|
}
|
|
128
134
|
});
|
|
129
135
|
}
|
|
130
|
-
/**
|
|
131
|
-
* The interval field constructor — `interval(u64)` / `interval(i64)` for
|
|
132
|
-
* the general type (rays representable), `interval(u64, w)` for the
|
|
133
|
-
* fixed-width family whose width IS the type. The element is spelled with
|
|
134
|
-
* the u64/i64 field constructor values themselves, never a string. `width
|
|
135
|
-
* >= 1` is validated here because the grammar pins it at declaration
|
|
136
|
-
* (`docs/architecture/70-api.md`: w ≥ 1; `interval<u64, 0>` is an
|
|
137
|
-
* expansion error naming the field).
|
|
138
|
-
*/
|
|
139
136
|
function interval(element, width) {
|
|
140
|
-
const elementKind = element.
|
|
137
|
+
const elementKind = element.kind;
|
|
141
138
|
if (elementKind !== "u64" && elementKind !== "i64") {
|
|
142
139
|
throw errors.new(`interval element must be the u64 or i64 field constructor (got ${elementKind})`);
|
|
143
140
|
}
|
|
144
141
|
if (width !== undefined && width < 1n) {
|
|
145
142
|
throw errors.new(`interval width must be >= 1 (got ${width}) — docs/architecture/70-api.md pins w >= 1 at declaration`);
|
|
146
143
|
}
|
|
147
|
-
const type = { kind: "interval", element: elementKind, width };
|
|
148
144
|
return Object.freeze({
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
145
|
+
kind: "interval",
|
|
146
|
+
element: elementKind,
|
|
147
|
+
width,
|
|
148
|
+
domain: undefined,
|
|
149
|
+
as(domain) {
|
|
150
|
+
return Object.freeze({ kind: "interval", element: elementKind, width, domain });
|
|
152
151
|
}
|
|
153
152
|
});
|
|
154
153
|
}
|
|
@@ -157,15 +156,15 @@ function interval(element, width) {
|
|
|
157
156
|
* {@link LiteralSpec} — the selection-literal machine ground axioms and
|
|
158
157
|
* `where()` bindings both ride (one machine, same errors — the macro's own
|
|
159
158
|
* rule). A value on a closed-reference field resolves to its handle NAME
|
|
160
|
-
* (the id is
|
|
159
|
+
* (the id is verified against the roster: an out-of-roster id is a
|
|
161
160
|
* construction error); everything else lowers to a plain value tagged by
|
|
162
|
-
* the field's structural
|
|
161
|
+
* the field's structural kind.
|
|
163
162
|
*/
|
|
164
163
|
function literalOf(field, value) {
|
|
165
|
-
if (
|
|
164
|
+
if ("closed" in field) {
|
|
166
165
|
return handleLiteral(field.closed, value);
|
|
167
166
|
}
|
|
168
|
-
switch (field.
|
|
167
|
+
switch (field.kind) {
|
|
169
168
|
case "bool": {
|
|
170
169
|
if (typeof value !== "boolean") {
|
|
171
170
|
throw literalShapeError("boolean", value);
|
|
@@ -184,21 +183,21 @@ function literalOf(field, value) {
|
|
|
184
183
|
}
|
|
185
184
|
return { kind: "value", value: { kind: "i64", value } };
|
|
186
185
|
}
|
|
187
|
-
case "
|
|
186
|
+
case "str": {
|
|
188
187
|
if (typeof value !== "string") {
|
|
189
188
|
throw literalShapeError("string", value);
|
|
190
189
|
}
|
|
191
190
|
return { kind: "value", value: { kind: "string", value } };
|
|
192
191
|
}
|
|
193
|
-
case "
|
|
192
|
+
case "bytes": {
|
|
194
193
|
if (!(value instanceof Uint8Array)) {
|
|
195
194
|
throw literalShapeError("Uint8Array", value);
|
|
196
195
|
}
|
|
197
196
|
return { kind: "value", value: { kind: "fixedBytes", value } };
|
|
198
197
|
}
|
|
199
198
|
case "interval":
|
|
200
|
-
return intervalLiteral(field.
|
|
199
|
+
return intervalLiteral(field.element, value);
|
|
201
200
|
}
|
|
202
201
|
}
|
|
203
|
-
export { assertDeclarationOrderKey, bool, bytes,
|
|
202
|
+
export { assertDeclarationOrderKey, bool, bytes, i64, interval, literalOf, span, str, u64 };
|
|
204
203
|
//# sourceMappingURL=fields.js.map
|
package/dist/fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAiB/C;;;;;;GAMG;AACH,SAAS,IAAI,CAAC,KAAa,EAAE,GAAW;IACvC,IAAI,KAAK,IAAI,GAAG,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,GAAG,CAAC,gEAAgE,KAAK,KAAK,GAAG,GAAG,CAAC,CAAA;IACnG,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;AACrC,CAAC;AA4JD;;;GAGG;AACH,SAAS,iBAAiB,CAAC,QAAgB,EAAE,KAAc;IAC1D,OAAO,MAAM,CAAC,GAAG,CAAC,8CAA8C,QAAQ,SAAS,OAAO,KAAK,EAAE,CAAC,CAAA;AACjG,CAAC;AAED,yEAAyE;AACzE,SAAS,iBAAiB,CAAC,KAAc;IACxC,OAAO,CACN,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAO,IAAI,KAAK;Q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E,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAA;QAC3D,CAAC;QACD,KAAK,OAAO,EAAE,CAAC;YACd,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,EAAE,CAAC;gBACpC,MAAM,iBAAiB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAA;YAC7C,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,CAAA;QAC/D,CAAC;QACD,KAAK,UAAU;YACd,OAAO,eAAe,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC9C,CAAC;AACF,CAAC;AAoBD,OAAO,EAAE,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @bjornpagen/bumbledb — the type-theoretic TypeScript SDK for the
|
|
3
|
-
* bumbledb embedded relational engine. Public surface: the type
|
|
4
|
-
* (
|
|
3
|
+
* bumbledb embedded relational engine. Public surface: the structural type
|
|
4
|
+
* kernel (fields with schema-level domain labels, `relation()`,
|
|
5
|
+
* `closed()`), the statement
|
|
5
6
|
* algebra with `schema()` and `SchemaSpec` lowering (PRD-06), the `Db`
|
|
6
7
|
* runtime (path-cached stores, transactions, typed violations, scoped
|
|
7
8
|
* snapshot reads, the witnessed write loop with `abandon` — PRD-07, zero
|
|
8
|
-
* closables), the query surface (Datalog as values:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* closables), the query surface (Datalog as values, kysely-shaped:
|
|
10
|
+
* `query(S).rule(r => r.match(...).where(...).select(...))` with
|
|
11
|
+
* string-named domain-typed vars, params typed by use, negation,
|
|
12
|
+
* conditions, aggregates, and stratified recursion via `program()`/`rec` —
|
|
13
|
+
* `db.prepare` as a plain value), and the exhume surface
|
|
11
14
|
* (`Db.exhume` — the one schema-independent read path: the store's
|
|
12
|
-
* self-described shapes and raw facts by name,
|
|
13
|
-
*
|
|
14
|
-
* PRD-03 stub died here as scheduled).
|
|
15
|
+
* self-described shapes and raw facts by name, typed at bare structural
|
|
16
|
+
* values, deliberately schema-free). The raw native bridge is not exported.
|
|
15
17
|
*/
|
|
16
|
-
export type { Brand, Interval, IntervalValue } from "#brand.ts";
|
|
17
|
-
export { span } from "#brand.ts";
|
|
18
18
|
export type { AnyClosed, AxiomRow, Axioms, Closed, ClosedColumn, ClosedCore, ClosedData, ClosedRow, PayloadField } from "#closed.ts";
|
|
19
19
|
export { closed } from "#closed.ts";
|
|
20
20
|
export type { Count } from "#count.ts";
|
|
@@ -23,27 +23,27 @@ export type { Abandon, DeclaredKeyFact, DeltaBuild, MemberRelation, OffendingFac
|
|
|
23
23
|
export { abandon, Db } from "#db.ts";
|
|
24
24
|
export type { Exhumed, ExhumedAxiom, ExhumedDescriptor, ExhumedFact, ExhumedField, ExhumedRelation } from "#exhume.ts";
|
|
25
25
|
export { ErrExhumeCorruption, ErrExhumeFormatMismatch, ErrExhumeNoDescriptor } from "#exhume.ts";
|
|
26
|
-
export type { AnyFace, Arity, Face, FaceArityMismatch, FaceData, FaceFields, FaceOwner, FaceSource, OneOf, SameArity } from "#face.ts";
|
|
26
|
+
export type { AnyFace, Arity, Face, FaceArityMismatch, FaceData, FaceDomainMismatch, FaceDomains, FaceFields, FaceOwner, FaceSource, OneOf, SameArity, SameDomains } from "#face.ts";
|
|
27
27
|
export { on, oneOf } from "#face.ts";
|
|
28
|
-
export type { AnyField, BoolField,
|
|
29
|
-
export { bool, bytes, i64, interval, str, u64 } from "#fields.ts";
|
|
28
|
+
export type { AnyField, BoolField, BytesCtor, BytesField, ClosedIdField, ClosedRoster, FreshU64Field, I64Ctor, I64Field, Infer, IntervalCtor, IntervalField, IntervalValue, StrField, U64Ctor, U64Field } from "#fields.ts";
|
|
29
|
+
export { bool, bytes, i64, interval, span, str, u64 } from "#fields.ts";
|
|
30
30
|
export { lower, lowerClosed, lowerRelation } from "#lower.ts";
|
|
31
31
|
export type { KeyFact, Minted } from "#marshal.ts";
|
|
32
32
|
export type { FactValue, OccurrenceDrift, ProgramIr, Staleness, StatementKindTag } from "#native.ts";
|
|
33
|
-
export type {
|
|
34
|
-
export { ALLEN
|
|
35
|
-
export type { AnyQuery, Query,
|
|
33
|
+
export type { AnyCond, BindingInput, Cmp, MatchShape, NotAtom, RecData, RuleData, SelectColumn, Tree } from "#query/atom.ts";
|
|
34
|
+
export { ALLEN } from "#query/atom.ts";
|
|
35
|
+
export type { AnyQuery, AnyRuleValue, OutputRuleChain, OutputRuleScope, Query, QueryData, QueryParams, QueryRelation, QueryRow, QueryRuleChain, QueryRuleScope, QueryStart, RecRef, RecRuleChain, RecRuleScope, RuleValue, TermOps } from "#query/lower.ts";
|
|
36
36
|
export { lowerQuery, query } from "#query/lower.ts";
|
|
37
|
-
export type {
|
|
38
|
-
export
|
|
39
|
-
export type {
|
|
40
|
-
export {
|
|
37
|
+
export type { ProgramScope, Rec } from "#query/predicate.ts";
|
|
38
|
+
export { program } from "#query/predicate.ts";
|
|
39
|
+
export type { Duration, MaskParam, Param, ParamEntry, ParamsRecord, SetParam, Var } from "#query/scope.ts";
|
|
40
|
+
export type { Agg, SelectEntry } from "#query/select.ts";
|
|
41
41
|
export type { AnyRelation, AnySelected, Fact, FieldRef, FieldRefs, FieldsShape, FreshKeys, InsertFact, Relation, RelationData, RelationField, RelationFields, Selected, SelectionBinding, SelectionInput } from "#relation.ts";
|
|
42
42
|
export { relation } from "#relation.ts";
|
|
43
43
|
export type { AnySchema, Schema, SchemaRelation, SchemaRelations } from "#schema.ts";
|
|
44
44
|
export { schema } from "#schema.ts";
|
|
45
45
|
export type { FieldSpec, LiteralSetSpec, LiteralSpec, RelationSpec, RowSpec, SchemaSpec, SideSpec, StatementSpec, ValueSpec, ValueTypeSpec, WindowSpec } from "#spec.ts";
|
|
46
46
|
export { renderLiteral, renderLiteralSet, renderWindow } from "#spec.ts";
|
|
47
|
-
export type { KeyStatement, Statement, StatementData } from "#statements.ts";
|
|
47
|
+
export type { KeyData, KeyStatement, Statement, StatementData } from "#statements.ts";
|
|
48
48
|
export { contained, key, mirrors, renderStatement, window } from "#statements.ts";
|
|
49
49
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EACX,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,YAAY,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACnE,YAAY,EACX,OAAO,EACP,eAAe,EACf,UAAU,EACV,cAAc,EACd,aAAa,EACb,QAAQ,EACR,SAAS,EACT,EAAE,EACF,SAAS,EACT,oBAAoB,EACpB,WAAW,EACX,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AACpC,YAAY,EACX,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,EACN,mBAAmB,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.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @bjornpagen/bumbledb — the type-theoretic TypeScript SDK for the
|
|
3
|
-
* bumbledb embedded relational engine. Public surface: the type
|
|
4
|
-
* (
|
|
3
|
+
* bumbledb embedded relational engine. Public surface: the structural type
|
|
4
|
+
* kernel (fields with schema-level domain labels, `relation()`,
|
|
5
|
+
* `closed()`), the statement
|
|
5
6
|
* algebra with `schema()` and `SchemaSpec` lowering (PRD-06), the `Db`
|
|
6
7
|
* runtime (path-cached stores, transactions, typed violations, scoped
|
|
7
8
|
* snapshot reads, the witnessed write loop with `abandon` — PRD-07, zero
|
|
8
|
-
* closables), the query surface (Datalog as values:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* closables), the query surface (Datalog as values, kysely-shaped:
|
|
10
|
+
* `query(S).rule(r => r.match(...).where(...).select(...))` with
|
|
11
|
+
* string-named domain-typed vars, params typed by use, negation,
|
|
12
|
+
* conditions, aggregates, and stratified recursion via `program()`/`rec` —
|
|
13
|
+
* `db.prepare` as a plain value), and the exhume surface
|
|
11
14
|
* (`Db.exhume` — the one schema-independent read path: the store's
|
|
12
|
-
* self-described shapes and raw facts by name,
|
|
13
|
-
*
|
|
14
|
-
* PRD-03 stub died here as scheduled).
|
|
15
|
+
* self-described shapes and raw facts by name, typed at bare structural
|
|
16
|
+
* values, deliberately schema-free). The raw native bridge is not exported.
|
|
15
17
|
*/
|
|
16
|
-
export { span } from "#brand.ts";
|
|
17
18
|
export { closed } from "#closed.ts";
|
|
18
19
|
export { atLeast, atMost, between, exactly, none } from "#count.ts";
|
|
19
20
|
export { abandon, Db } from "#db.ts";
|
|
20
21
|
export { ErrExhumeCorruption, ErrExhumeFormatMismatch, ErrExhumeNoDescriptor } from "#exhume.ts";
|
|
21
22
|
export { on, oneOf } from "#face.ts";
|
|
22
|
-
export { bool, bytes, i64, interval, str, u64 } from "#fields.ts";
|
|
23
|
+
export { bool, bytes, i64, interval, span, str, u64 } from "#fields.ts";
|
|
23
24
|
export { lower, lowerClosed, lowerRelation } from "#lower.ts";
|
|
24
|
-
export { ALLEN
|
|
25
|
+
export { ALLEN } from "#query/atom.ts";
|
|
25
26
|
export { lowerQuery, query } from "#query/lower.ts";
|
|
26
|
-
export {
|
|
27
|
+
export { program } from "#query/predicate.ts";
|
|
27
28
|
export { relation } from "#relation.ts";
|
|
28
29
|
export { schema } from "#schema.ts";
|
|
29
30
|
export { renderLiteral, renderLiteralSet, renderWindow } from "#spec.ts";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAaH,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAcnE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AASpC,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,YAAY,CAAA;AAgBnB,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAmBpC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AACvE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAqB7D,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAoBtC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAoB7C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAcnC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAExE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/lower.d.ts
CHANGED
|
@@ -19,9 +19,12 @@ declare function lowerRelation(relation: AnyRelation): RelationSpec;
|
|
|
19
19
|
/**
|
|
20
20
|
* Lowers one closed relation to its `RelationSpec` fragment: declared
|
|
21
21
|
* intrinsic columns only (the engine materializes the synthetic `id`),
|
|
22
|
-
* the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* the HANDLE DOMAIN as its handle newtype — the `id` descriptor's own
|
|
23
|
+
* `` `${name}Id` `` label (Rust's `closed relation Kind as KindId`), the
|
|
24
|
+
* same string every referencing field carries, which is exactly how the
|
|
25
|
+
* engine resolves a handle literal back to its roster — and the ground
|
|
26
|
+
* axioms in declaration order (row id = index); the literals were already
|
|
27
|
+
* lowered at `closed()` construction.
|
|
25
28
|
*/
|
|
26
29
|
declare function lowerClosed(member: AnyClosed): RelationSpec;
|
|
27
30
|
/**
|
package/dist/lower.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lower.d.ts","sourceRoot":"","sources":["../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"lower.d.ts","sourceRoot":"","sources":["../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAA;AAC3D,OAAO,KAAK,EAGX,YAAY,EACZ,UAAU,EAIV,MAAM,UAAU,CAAA;AA0FjB;;;GAGG;AACH,iBAAS,aAAa,CAAC,QAAQ,EAAE,WAAW,GAAG,YAAY,CAK1D;AAED;;;;;;;;;GASG;AACH,iBAAS,WAAW,CAAC,MAAM,EAAE,SAAS,GAAG,YAAY,CAQpD;AAED;;;;GAIG;AACH,iBAAS,KAAK,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAQ5C;AAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA"}
|
package/dist/lower.js
CHANGED
|
@@ -14,6 +14,44 @@
|
|
|
14
14
|
function isClosedMember(member) {
|
|
15
15
|
return "handles" in member.data;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Lowers one field descriptor's structural type to the wire
|
|
19
|
+
* {@link ValueTypeSpec}: the S1 kind tags map 1:1 onto the `ValueType`
|
|
20
|
+
* vocabulary (`str` spells `string`, `bytes` spells `fixedBytes` with its
|
|
21
|
+
* width label as `len`; intervals carry element and width labels through).
|
|
22
|
+
*/
|
|
23
|
+
function valueTypeOf(field) {
|
|
24
|
+
switch (field.kind) {
|
|
25
|
+
case "bool":
|
|
26
|
+
return { kind: "bool" };
|
|
27
|
+
case "u64":
|
|
28
|
+
return { kind: "u64" };
|
|
29
|
+
case "i64":
|
|
30
|
+
return { kind: "i64" };
|
|
31
|
+
case "str":
|
|
32
|
+
return { kind: "string" };
|
|
33
|
+
case "bytes":
|
|
34
|
+
return { kind: "fixedBytes", len: field.width };
|
|
35
|
+
case "interval":
|
|
36
|
+
return { kind: "interval", element: field.element, width: field.width };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Lowers one field descriptor to its {@link FieldSpec}: the structural
|
|
41
|
+
* type, the DOMAIN label as the wire's `newtype` (the macro's `as NewType`
|
|
42
|
+
* name — carried for engine handle resolution, dropped at descriptor
|
|
43
|
+
* lowering, never fingerprinted), and the structural fresh mark (`fresh`
|
|
44
|
+
* is the literal `true` exactly on a fresh-marked u64 — on an unmarked one
|
|
45
|
+
* the property holds the marked descriptor, never `true`).
|
|
46
|
+
*/
|
|
47
|
+
function lowerField(name, field) {
|
|
48
|
+
return {
|
|
49
|
+
name,
|
|
50
|
+
valueType: valueTypeOf(field),
|
|
51
|
+
newtype: field.domain,
|
|
52
|
+
fresh: "fresh" in field && field.fresh === true
|
|
53
|
+
};
|
|
54
|
+
}
|
|
17
55
|
/** Lowers one face to a `SideSpec`: names only, σ as (field, set) pairs. */
|
|
18
56
|
function lowerFace(face) {
|
|
19
57
|
return {
|
|
@@ -56,36 +94,29 @@ function lowerStatement(statement) {
|
|
|
56
94
|
* declaration order, `extension: undefined` (the option is the kind).
|
|
57
95
|
*/
|
|
58
96
|
function lowerRelation(relation) {
|
|
59
|
-
const fields = relation.data.fields.map(function
|
|
60
|
-
return
|
|
61
|
-
name: declared.name,
|
|
62
|
-
valueType: declared.field.type,
|
|
63
|
-
newtype: declared.field.newtype,
|
|
64
|
-
fresh: declared.field.minted
|
|
65
|
-
};
|
|
97
|
+
const fields = relation.data.fields.map(function lowerDeclared(declared) {
|
|
98
|
+
return lowerField(declared.name, declared.field);
|
|
66
99
|
});
|
|
67
100
|
return { name: relation.name, newtype: undefined, fields, extension: undefined };
|
|
68
101
|
}
|
|
69
102
|
/**
|
|
70
103
|
* Lowers one closed relation to its `RelationSpec` fragment: declared
|
|
71
104
|
* intrinsic columns only (the engine materializes the synthetic `id`),
|
|
72
|
-
* the
|
|
73
|
-
*
|
|
74
|
-
*
|
|
105
|
+
* the HANDLE DOMAIN as its handle newtype — the `id` descriptor's own
|
|
106
|
+
* `` `${name}Id` `` label (Rust's `closed relation Kind as KindId`), the
|
|
107
|
+
* same string every referencing field carries, which is exactly how the
|
|
108
|
+
* engine resolves a handle literal back to its roster — and the ground
|
|
109
|
+
* axioms in declaration order (row id = index); the literals were already
|
|
110
|
+
* lowered at `closed()` construction.
|
|
75
111
|
*/
|
|
76
112
|
function lowerClosed(member) {
|
|
77
113
|
const fields = member.data.columns.map(function lowerColumn(column) {
|
|
78
|
-
return
|
|
79
|
-
name: column.name,
|
|
80
|
-
valueType: column.field.type,
|
|
81
|
-
newtype: column.field.newtype,
|
|
82
|
-
fresh: false
|
|
83
|
-
};
|
|
114
|
+
return lowerField(column.name, column.field);
|
|
84
115
|
});
|
|
85
116
|
const extension = member.data.rows.map(function lowerRow(row) {
|
|
86
117
|
return { handle: row.handle, values: row.values };
|
|
87
118
|
});
|
|
88
|
-
return { name: member.name, newtype: member.
|
|
119
|
+
return { name: member.name, newtype: member.id.domain, fields, extension };
|
|
89
120
|
}
|
|
90
121
|
/**
|
|
91
122
|
* Lowers a whole theory to the `SchemaSpec` the bridge takes: relations in
|
package/dist/lower.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lower.js","sourceRoot":"","sources":["../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"lower.js","sourceRoot":"","sources":["../src/lower.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAkBH;;;GAGG;AACH,SAAS,cAAc,CAAC,MAAsB;IAC7C,OAAO,SAAS,IAAI,MAAM,CAAC,IAAI,CAAA;AAChC,CAAC;AAED;;;;;GAKG;AACH,SAAS,WAAW,CAAC,KAAe;IACnC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM;YACV,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;QACxB,KAAK,KAAK;YACT,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACvB,KAAK,KAAK;YACT,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QACvB,KAAK,KAAK;YACT,OAAO,EAAE,I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