@bjornpagen/bumbledb 0.2.0 → 0.4.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 +503 -427
- package/README.md +84 -36
- package/dist/closed.d.ts +111 -38
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +94 -99
- package/dist/closed.js.map +1 -1
- package/dist/db.d.ts +16 -2
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +46 -8
- package/dist/db.js.map +1 -1
- package/dist/face.d.ts +114 -69
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +38 -21
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +72 -87
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +35 -67
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +18 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- 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 -10
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +34 -23
- package/dist/lower.js.map +1 -1
- package/dist/marshal.d.ts +33 -6
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +67 -6
- 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.map +1 -1
- package/dist/query/atom.d.ts +139 -56
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +7 -1
- package/dist/query/atom.js.map +1 -1
- package/dist/query/lower.d.ts +71 -56
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +341 -69
- package/dist/query/lower.js.map +1 -1
- package/dist/query/predicate.d.ts +10 -9
- package/dist/query/predicate.d.ts.map +1 -1
- package/dist/query/predicate.js +2 -2
- package/dist/query/predicate.js.map +1 -1
- package/dist/query/run.d.ts +15 -5
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +26 -6
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +100 -43
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +89 -30
- package/dist/query/scope.js.map +1 -1
- package/dist/query/select.d.ts +5 -5
- package/dist/query/select.d.ts.map +1 -1
- package/dist/relation.d.ts +29 -15
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +45 -17
- 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 +16 -2
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +10 -8
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +67 -31
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +97 -20
- package/dist/statements.js.map +1 -1
- package/package.json +2 -2
- package/src/closed.ts +214 -146
- package/src/db.ts +65 -10
- package/src/face.ts +169 -102
- package/src/fields.ts +97 -164
- package/src/index.ts +43 -18
- package/src/law.ts +519 -0
- package/src/lower.ts +36 -23
- package/src/marshal.ts +74 -7
- package/src/native.ts +6 -2
- package/src/query/atom.ts +155 -65
- package/src/query/lower.ts +572 -167
- package/src/query/predicate.ts +43 -33
- package/src/query/run.ts +26 -6
- package/src/query/scope.ts +161 -51
- package/src/query/select.ts +5 -5
- package/src/relation.ts +60 -26
- package/src/schema.ts +48 -7
- package/src/spec.ts +10 -8
- package/src/statements.ts +165 -46
package/dist/fields.d.ts
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Field descriptors — the value half of the `schema!` field grammar
|
|
3
|
-
* (`docs/architecture/70-api.md`),
|
|
3
|
+
* (`docs/architecture/70-api.md`), MINIMAL edition: `bool`, `u64`, `i64`,
|
|
4
4
|
* `str`, `bytes(n)`, `interval(u64|i64[, width])`, each a plain frozen value
|
|
5
|
-
* that IS its own descriptor type — `{ kind,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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.
|
|
5
|
+
* that IS its own descriptor type — `{ kind, width?, element?, fresh? }` —
|
|
6
|
+
* honest at runtime and in the type alike. A field's VALUE type is its bare
|
|
7
|
+
* structural type (`u64` → `bigint`, `str` → `string`, `bytes(n)` →
|
|
8
|
+
* `Uint8Array`, intervals → `{ start, end }`): no brands, no phantoms, no
|
|
9
|
+
* minting casts. A descriptor carries STRUCTURE ONLY — domains are never
|
|
10
|
+
* declared anywhere (the owner ruling: THE LAWS TYPE THE COLUMNS): a
|
|
11
|
+
* field's domain is COMPUTED by `schema()` from the statement list, where
|
|
12
|
+
* the dependencies themselves induce the equivalence classes. The macro's
|
|
13
|
+
* refusals are reproduced representationally: `.fresh` exists only on u64,
|
|
14
|
+
* and no field-level constraint vocabulary of any kind exists —
|
|
15
|
+
* `unique`/`fk` are unwritable, not rejected.
|
|
19
16
|
*/
|
|
20
17
|
import type { LiteralSpec } from "#spec.ts";
|
|
21
18
|
/**
|
|
22
19
|
* A half-open interval `[start, end)` as a plain value object — the ONE
|
|
23
|
-
* interval value type, whatever the field's element
|
|
24
|
-
* The ray is representable (`end` = the element
|
|
20
|
+
* interval value type, whatever the field's element type or width label.
|
|
21
|
+
* The ray is representable (`end` = the element type's MAX_END); widths
|
|
25
22
|
* and signedness are NOT modeled on the value — they are descriptor-type
|
|
26
23
|
* labels the engine judges at the typed write boundary. Interval fields
|
|
27
24
|
* derive no order (the Rust refusal, `docs/architecture/10-data-model.md`),
|
|
@@ -42,61 +39,51 @@ declare function span(start: bigint, end: bigint): IntervalValue;
|
|
|
42
39
|
/**
|
|
43
40
|
* A closed relation's roster as seen from a referencing field: the handle
|
|
44
41
|
* 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
|
|
46
|
-
*
|
|
42
|
+
* through (the macro's own rule: a handle is legal exactly on a field that
|
|
43
|
+
* references a closed relation). The handle union is PRECISE — `H` carries
|
|
44
|
+
* the literal handle names in declaration order (the unbound `string`
|
|
45
|
+
* default exists only as the fallback where no roster is in scope); the
|
|
46
|
+
* runtime twin is the same frozen declaration-order array that was always
|
|
47
|
+
* there.
|
|
47
48
|
*/
|
|
48
|
-
interface ClosedRoster {
|
|
49
|
+
interface ClosedRoster<H extends string = string> {
|
|
49
50
|
readonly name: string;
|
|
50
|
-
readonly handles: readonly
|
|
51
|
+
readonly handles: readonly H[];
|
|
51
52
|
}
|
|
52
|
-
/** The `bool` field descriptor: value type `boolean`. No `.
|
|
53
|
+
/** The `bool` field descriptor: value type `boolean`. No `.fresh` (macro parity). */
|
|
53
54
|
interface BoolField {
|
|
54
55
|
readonly kind: "bool";
|
|
55
|
-
readonly domain: undefined;
|
|
56
56
|
}
|
|
57
|
-
/** The `str` field descriptor: value type `string`. No `.
|
|
57
|
+
/** The `str` field descriptor: value type `string`. No `.fresh` (macro parity). */
|
|
58
58
|
interface StrField {
|
|
59
59
|
readonly kind: "str";
|
|
60
|
-
readonly domain: undefined;
|
|
61
60
|
}
|
|
62
61
|
/**
|
|
63
|
-
* A `fresh`-marked u64 field descriptor — `id: u64.
|
|
64
|
-
* (
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* (`
|
|
68
|
-
*
|
|
62
|
+
* A `fresh`-marked u64 field descriptor — `id: u64.fresh`. The mark is a
|
|
63
|
+
* structural label (`fresh: true`) in the descriptor type AND on the
|
|
64
|
+
* runtime value; it implies the key `R(field) -> R`, which the ENGINE
|
|
65
|
+
* materializes (`SchemaDescriptor::materialized_statements`), and it makes
|
|
66
|
+
* the field a GENERATOR — `schema()` names its equivalence class by the
|
|
67
|
+
* declaration coordinate (`"Account.id"`). Terminal: no builder property
|
|
68
|
+
* survives the mark.
|
|
69
69
|
*/
|
|
70
|
-
interface FreshU64Field
|
|
70
|
+
interface FreshU64Field {
|
|
71
71
|
readonly kind: "u64";
|
|
72
|
-
readonly domain: Domain;
|
|
73
72
|
readonly fresh: true;
|
|
74
73
|
}
|
|
75
74
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* descriptor
|
|
79
|
-
*
|
|
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).
|
|
75
|
+
* The `u64` field descriptor. `.fresh` marks the field as engine-minted —
|
|
76
|
+
* the property doubles as the mark itself: on an unmarked descriptor it
|
|
77
|
+
* holds the marked descriptor, on a marked one it IS the literal `true`
|
|
78
|
+
* (one structural property, read either way).
|
|
82
79
|
*/
|
|
83
|
-
interface U64Field
|
|
80
|
+
interface U64Field {
|
|
84
81
|
readonly kind: "u64";
|
|
85
|
-
readonly
|
|
86
|
-
readonly fresh: FreshU64Field<Domain>;
|
|
82
|
+
readonly fresh: FreshU64Field;
|
|
87
83
|
}
|
|
88
|
-
/** The `
|
|
89
|
-
interface
|
|
90
|
-
as<const Domain extends string>(domain: Domain): U64Field<Domain>;
|
|
91
|
-
}
|
|
92
|
-
/** A domain-labeled i64 field descriptor. Terminal: `.fresh` is legal on u64 only. */
|
|
93
|
-
interface I64Field<Domain extends string | undefined = undefined> {
|
|
84
|
+
/** The `i64` field descriptor. Terminal: `.fresh` is legal on u64 only. */
|
|
85
|
+
interface I64Field {
|
|
94
86
|
readonly kind: "i64";
|
|
95
|
-
readonly domain: Domain;
|
|
96
|
-
}
|
|
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>;
|
|
100
87
|
}
|
|
101
88
|
/**
|
|
102
89
|
* A `bytes<N>` field descriptor. The width is a descriptor-type label
|
|
@@ -104,14 +91,9 @@ interface I64Ctor extends I64Field<undefined> {
|
|
|
104
91
|
* value type is bare `Uint8Array`. No order is derived — no comparators
|
|
105
92
|
* exist on the value type (the engine refuses order on bytes).
|
|
106
93
|
*/
|
|
107
|
-
interface BytesField<Width extends number = number
|
|
94
|
+
interface BytesField<Width extends number = number> {
|
|
108
95
|
readonly kind: "bytes";
|
|
109
96
|
readonly width: Width;
|
|
110
|
-
readonly domain: Domain;
|
|
111
|
-
}
|
|
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>;
|
|
115
97
|
}
|
|
116
98
|
/**
|
|
117
99
|
* An interval field descriptor — `interval(i64)` general (rays
|
|
@@ -119,42 +101,46 @@ interface BytesCtor<Width extends number = number> extends BytesField<Width, und
|
|
|
119
101
|
* width are descriptor-type labels; the value type is always the bare
|
|
120
102
|
* {@link IntervalValue}.
|
|
121
103
|
*/
|
|
122
|
-
interface IntervalField<Element extends "u64" | "i64" = "u64" | "i64", Width extends bigint | undefined = bigint | undefined
|
|
104
|
+
interface IntervalField<Element extends "u64" | "i64" = "u64" | "i64", Width extends bigint | undefined = bigint | undefined> {
|
|
123
105
|
readonly kind: "interval";
|
|
124
106
|
readonly element: Element;
|
|
125
107
|
readonly width: Width;
|
|
126
|
-
readonly domain: Domain;
|
|
127
|
-
}
|
|
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>;
|
|
131
108
|
}
|
|
132
109
|
/**
|
|
133
110
|
* A closed relation's reference field descriptor (`Kind.id`) — a u64
|
|
134
|
-
* descriptor
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
111
|
+
* descriptor carrying the closed linkage: the roster resolves handle
|
|
112
|
+
* literals in selections and ground axioms, and `schema()` names the id's
|
|
113
|
+
* generator class `"Kind.id"`. The handle union `H` is the field's VALUE
|
|
114
|
+
* TYPE (see {@link Infer}); `kind: "u64"` stays load-bearing for the class
|
|
115
|
+
* map and JoinOk, which compare kind/class/width/element. Terminal: no
|
|
116
|
+
* `.fresh` — a vocabulary's rows are ground axioms, never minted.
|
|
138
117
|
*/
|
|
139
|
-
interface ClosedIdField<
|
|
118
|
+
interface ClosedIdField<H extends string = string> {
|
|
140
119
|
readonly kind: "u64";
|
|
141
|
-
readonly
|
|
142
|
-
readonly closed: ClosedRoster;
|
|
120
|
+
readonly closed: ClosedRoster<H>;
|
|
143
121
|
}
|
|
144
|
-
/** Any field descriptor, whatever its kind
|
|
145
|
-
type AnyField = BoolField | StrField | U64Field
|
|
122
|
+
/** Any field descriptor, whatever its kind or marks. */
|
|
123
|
+
type AnyField = BoolField | StrField | U64Field | FreshU64Field | I64Field | BytesField | IntervalField | ClosedIdField;
|
|
146
124
|
/**
|
|
147
125
|
* The bare structural VALUE type of a field descriptor — the one total
|
|
148
126
|
* definition every fact, result row, and query term reads: `bool` →
|
|
149
|
-
* `boolean`, `str` → `string`, `u64`/`i64` → `bigint`
|
|
150
|
-
*
|
|
151
|
-
* `
|
|
127
|
+
* `boolean`, `str` → `string`, `u64`/`i64` → `bigint`, `bytes<N>` →
|
|
128
|
+
* `Uint8Array`, intervals → {@link IntervalValue}, and a closed reference →
|
|
129
|
+
* its PRECISE handle union (`"DirectPass" | "Failed"` — the string-literal
|
|
130
|
+
* union IS the value type at the TS surface; the engine keeps u64 row ids
|
|
131
|
+
* and the marshal owns the bijection). The closed arm precedes the `u64`
|
|
132
|
+
* arm because a closed reference is structurally a u64 descriptor plus the
|
|
133
|
+
* roster.
|
|
152
134
|
*/
|
|
153
135
|
type Infer<F extends AnyField> = F extends {
|
|
154
136
|
readonly kind: "bool";
|
|
155
137
|
} ? boolean : F extends {
|
|
156
138
|
readonly kind: "str";
|
|
157
139
|
} ? string : F extends {
|
|
140
|
+
readonly closed: {
|
|
141
|
+
readonly handles: readonly (infer H extends string)[];
|
|
142
|
+
};
|
|
143
|
+
} ? H : F extends {
|
|
158
144
|
readonly kind: "u64";
|
|
159
145
|
} ? bigint : F extends {
|
|
160
146
|
readonly kind: "i64";
|
|
@@ -175,9 +161,9 @@ type Infer<F extends AnyField> = F extends {
|
|
|
175
161
|
*/
|
|
176
162
|
declare function assertDeclarationOrderKey(where: string, name: string): void;
|
|
177
163
|
/** The one `u64` constructor value. */
|
|
178
|
-
declare const u64:
|
|
164
|
+
declare const u64: U64Field;
|
|
179
165
|
/** The one `i64` constructor value. */
|
|
180
|
-
declare const i64:
|
|
166
|
+
declare const i64: I64Field;
|
|
181
167
|
/** The one `bool` constructor value. */
|
|
182
168
|
declare const bool: BoolField;
|
|
183
169
|
/** The one `str` constructor value. */
|
|
@@ -189,7 +175,7 @@ declare const str: StrField;
|
|
|
189
175
|
* § the `schema!` grammar: N ∈ 1..=64 — bare `bytes` does not parse), the
|
|
190
176
|
* macro-expansion boundary's analog being construction.
|
|
191
177
|
*/
|
|
192
|
-
declare function bytes<const Width extends number>(width: Width):
|
|
178
|
+
declare function bytes<const Width extends number>(width: Width): BytesField<Width>;
|
|
193
179
|
/**
|
|
194
180
|
* The interval field constructor — `interval(u64)` / `interval(i64)` for
|
|
195
181
|
* the general type (rays representable), `interval(u64, w)` for the
|
|
@@ -199,18 +185,17 @@ declare function bytes<const Width extends number>(width: Width): BytesCtor<Widt
|
|
|
199
185
|
* (`docs/architecture/70-api.md`: w ≥ 1; `interval<u64, 0>` is an
|
|
200
186
|
* expansion error naming the field).
|
|
201
187
|
*/
|
|
202
|
-
declare function interval<Element extends
|
|
203
|
-
declare function interval<Element extends
|
|
188
|
+
declare function interval<Element extends U64Field | I64Field>(element: Element): IntervalField<Element["kind"], undefined>;
|
|
189
|
+
declare function interval<Element extends U64Field | I64Field, const Width extends bigint>(element: Element, width: Width): IntervalField<Element["kind"], Width>;
|
|
204
190
|
/**
|
|
205
191
|
* Lowers one host literal at its field position to the wire
|
|
206
192
|
* {@link LiteralSpec} — the selection-literal machine ground axioms and
|
|
207
193
|
* `where()` bindings both ride (one machine, same errors — the macro's own
|
|
208
|
-
* rule). A value on a closed-reference field
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
* the field's structural kind.
|
|
194
|
+
* rule). A value on a closed-reference field IS its handle NAME (verified
|
|
195
|
+
* against the roster: an unknown name is a construction error); everything
|
|
196
|
+
* else lowers to a plain value tagged by the field's structural kind.
|
|
212
197
|
*/
|
|
213
198
|
declare function literalOf(field: AnyField, value: unknown): LiteralSpec;
|
|
214
|
-
export type { AnyField, BoolField,
|
|
199
|
+
export type { AnyField, BoolField, BytesField, ClosedIdField, ClosedRoster, FreshU64Field, I64Field, Infer, IntervalField, IntervalValue, StrField, U64Field };
|
|
215
200
|
export { assertDeclarationOrderKey, bool, bytes, i64, interval, literalOf, span, str, u64 };
|
|
216
201
|
//# 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;;;;;;;;;;;;;;;GAeG;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,I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AA;AAEpD,wCAAwC;AACxC,QAAA,MAAM,IAAI,EAAE,SAA2C,CAAA;AAEvD,uCAAuC;AACvC,QAAA,MAAM,GAAG,EAAE,QAAyC,CAAA;AAEpD;;;;;;GAMG;AACH,iBAAS,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAO1E;AAED;;;;;;;;GAQG;AACH,iBAAS,QAAQ,CAAC,OAAO,SAAS,QAAQ,GAAG,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAA;AACnH,iBAAS,QAAQ,CAAC,OAAO,SAAS,QAAQ,GAAG,QAAQ,EAAE,KAAK,CAAC,KAAK,SAAS,MAAM,EAChF,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,GACV,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,CAAA;AAcxC;;;;;;;GAOG;AACH,iBAAS,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAsC/D;AAED,YAAY,EACX,QAAQ,EACR,SAAS,EACT,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,KAAK,EACL,aAAa,EACb,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,CAAA;AACD,OAAO,EAAE,yBAAyB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA"}
|
package/dist/fields.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Field descriptors — the value half of the `schema!` field grammar
|
|
3
|
-
* (`docs/architecture/70-api.md`),
|
|
3
|
+
* (`docs/architecture/70-api.md`), MINIMAL edition: `bool`, `u64`, `i64`,
|
|
4
4
|
* `str`, `bytes(n)`, `interval(u64|i64[, width])`, each a plain frozen value
|
|
5
|
-
* that IS its own descriptor type — `{ kind,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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.
|
|
5
|
+
* that IS its own descriptor type — `{ kind, width?, element?, fresh? }` —
|
|
6
|
+
* honest at runtime and in the type alike. A field's VALUE type is its bare
|
|
7
|
+
* structural type (`u64` → `bigint`, `str` → `string`, `bytes(n)` →
|
|
8
|
+
* `Uint8Array`, intervals → `{ start, end }`): no brands, no phantoms, no
|
|
9
|
+
* minting casts. A descriptor carries STRUCTURE ONLY — domains are never
|
|
10
|
+
* declared anywhere (the owner ruling: THE LAWS TYPE THE COLUMNS): a
|
|
11
|
+
* field's domain is COMPUTED by `schema()` from the statement list, where
|
|
12
|
+
* the dependencies themselves induce the equivalence classes. The macro's
|
|
13
|
+
* refusals are reproduced representationally: `.fresh` exists only on u64,
|
|
14
|
+
* and no field-level constraint vocabulary of any kind exists —
|
|
15
|
+
* `unique`/`fk` are unwritable, not rejected.
|
|
19
16
|
*/
|
|
20
17
|
import * as errors from "@superbuilders/errors";
|
|
21
18
|
/**
|
|
@@ -48,20 +45,22 @@ function isIntervalLiteral(value) {
|
|
|
48
45
|
typeof value.end === "bigint");
|
|
49
46
|
}
|
|
50
47
|
/**
|
|
51
|
-
* Resolves one closed-handle literal: the handle
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
48
|
+
* Resolves one closed-handle literal: the handle NAME, verified against the
|
|
49
|
+
* roster — an unknown name is a construction error, the belt the wide
|
|
50
|
+
* fallback type deliberately does not provide (structural values make any
|
|
51
|
+
* string spellable here; the roster judges). The name IS the value at the
|
|
52
|
+
* TS surface (the drizzle law); the wire literal already crossed as
|
|
53
|
+
* `{ kind: "handle", handle }`, so the output — and every fingerprint
|
|
54
|
+
* derived from it — is untouched.
|
|
55
55
|
*/
|
|
56
56
|
function handleLiteral(closed, value) {
|
|
57
|
-
if (typeof value !== "
|
|
58
|
-
throw literalShapeError(`a ${closed.name} handle
|
|
57
|
+
if (typeof value !== "string") {
|
|
58
|
+
throw literalShapeError(`a ${closed.name} handle name (string)`, value);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
throw errors.new(`closed relation ${closed.name} has no handle with id ${value} (roster holds ${closed.handles.length})`);
|
|
60
|
+
if (!closed.handles.includes(value)) {
|
|
61
|
+
throw errors.new(`"${value}" is not a handle of ${closed.name} — the roster is ${closed.handles.join(", ")}`);
|
|
63
62
|
}
|
|
64
|
-
return { kind: "handle", handle };
|
|
63
|
+
return { kind: "handle", handle: value };
|
|
65
64
|
}
|
|
66
65
|
/** Lowers one interval literal at its element type. */
|
|
67
66
|
function intervalLiteral(element, value) {
|
|
@@ -88,31 +87,16 @@ function assertDeclarationOrderKey(where, name) {
|
|
|
88
87
|
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`);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
return Object.freeze({ kind: "u64", domain, fresh: true });
|
|
94
|
-
}
|
|
90
|
+
/** The one fresh-marked u64 descriptor (the `.fresh` property of the unmarked one). */
|
|
91
|
+
const freshU64 = Object.freeze({ kind: "u64", fresh: true });
|
|
95
92
|
/** The one `u64` constructor value. */
|
|
96
|
-
const u64 = Object.freeze({
|
|
97
|
-
kind: "u64",
|
|
98
|
-
domain: undefined,
|
|
99
|
-
fresh: freshU64(undefined),
|
|
100
|
-
as(domain) {
|
|
101
|
-
return Object.freeze({ kind: "u64", domain, fresh: freshU64(domain) });
|
|
102
|
-
}
|
|
103
|
-
});
|
|
93
|
+
const u64 = Object.freeze({ kind: "u64", fresh: freshU64 });
|
|
104
94
|
/** The one `i64` constructor value. */
|
|
105
|
-
const i64 = Object.freeze({
|
|
106
|
-
kind: "i64",
|
|
107
|
-
domain: undefined,
|
|
108
|
-
as(domain) {
|
|
109
|
-
return Object.freeze({ kind: "i64", domain });
|
|
110
|
-
}
|
|
111
|
-
});
|
|
95
|
+
const i64 = Object.freeze({ kind: "i64" });
|
|
112
96
|
/** The one `bool` constructor value. */
|
|
113
|
-
const bool = Object.freeze({ kind: "bool"
|
|
97
|
+
const bool = Object.freeze({ kind: "bool" });
|
|
114
98
|
/** The one `str` constructor value. */
|
|
115
|
-
const str = Object.freeze({ kind: "str"
|
|
99
|
+
const str = Object.freeze({ kind: "str" });
|
|
116
100
|
/**
|
|
117
101
|
* The `bytes<N>` field constructor. The width is mandatory and a
|
|
118
102
|
* descriptor-type label; `width` is validated to 1..=64 here because the
|
|
@@ -124,14 +108,7 @@ function bytes(width) {
|
|
|
124
108
|
if (!Number.isInteger(width) || width < 1 || width > 64) {
|
|
125
109
|
throw errors.new(`bytes width must be an integer in 1..=64 (got ${width}) — docs/architecture/70-api.md pins the range at declaration`);
|
|
126
110
|
}
|
|
127
|
-
return Object.freeze({
|
|
128
|
-
kind: "bytes",
|
|
129
|
-
width,
|
|
130
|
-
domain: undefined,
|
|
131
|
-
as(domain) {
|
|
132
|
-
return Object.freeze({ kind: "bytes", width, domain });
|
|
133
|
-
}
|
|
134
|
-
});
|
|
111
|
+
return Object.freeze({ kind: "bytes", width });
|
|
135
112
|
}
|
|
136
113
|
function interval(element, width) {
|
|
137
114
|
const elementKind = element.kind;
|
|
@@ -141,24 +118,15 @@ function interval(element, width) {
|
|
|
141
118
|
if (width !== undefined && width < 1n) {
|
|
142
119
|
throw errors.new(`interval width must be >= 1 (got ${width}) — docs/architecture/70-api.md pins w >= 1 at declaration`);
|
|
143
120
|
}
|
|
144
|
-
return Object.freeze({
|
|
145
|
-
kind: "interval",
|
|
146
|
-
element: elementKind,
|
|
147
|
-
width,
|
|
148
|
-
domain: undefined,
|
|
149
|
-
as(domain) {
|
|
150
|
-
return Object.freeze({ kind: "interval", element: elementKind, width, domain });
|
|
151
|
-
}
|
|
152
|
-
});
|
|
121
|
+
return Object.freeze({ kind: "interval", element: elementKind, width });
|
|
153
122
|
}
|
|
154
123
|
/**
|
|
155
124
|
* Lowers one host literal at its field position to the wire
|
|
156
125
|
* {@link LiteralSpec} — the selection-literal machine ground axioms and
|
|
157
126
|
* `where()` bindings both ride (one machine, same errors — the macro's own
|
|
158
|
-
* rule). A value on a closed-reference field
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* the field's structural kind.
|
|
127
|
+
* rule). A value on a closed-reference field IS its handle NAME (verified
|
|
128
|
+
* against the roster: an unknown name is a construction error); everything
|
|
129
|
+
* else lowers to a plain value tagged by the field's structural kind.
|
|
162
130
|
*/
|
|
163
131
|
function literalOf(field, value) {
|
|
164
132
|
if ("closed" in field) {
|
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;;;;;;;;;;;;;;;GAeG;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;AA+HD;;;GAGG;AACH,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E,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,42 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @bjornpagen/bumbledb — the type-theoretic TypeScript SDK for the
|
|
3
3
|
* bumbledb embedded relational engine. Public surface: the structural type
|
|
4
|
-
* kernel (fields
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
4
|
+
* kernel (fields as pure structure, `relation()`, `closed()` — domains are
|
|
5
|
+
* never declared: THE LAWS TYPE THE COLUMNS, `schema()` computing every
|
|
6
|
+
* field's equivalence class FROM the statement list at both tiers), the
|
|
7
|
+
* statement algebra with `schema()` and `SchemaSpec` lowering (PRD-06), the `Db`
|
|
7
8
|
* runtime (path-cached stores, transactions, typed violations, scoped
|
|
8
9
|
* snapshot reads, the witnessed write loop with `abandon` — PRD-07, zero
|
|
9
10
|
* closables), the query surface (Datalog as values, kysely-shaped:
|
|
10
11
|
* `query(S).rule(r => r.match(...).where(...).select(...))` with
|
|
11
12
|
* string-named domain-typed vars, params typed by use, negation,
|
|
12
13
|
* conditions, aggregates, and stratified recursion via `program()`/`rec` —
|
|
13
|
-
* `db.prepare` as a plain value
|
|
14
|
+
* `db.prepare` as a plain value; the comparison/connective builders are
|
|
15
|
+
* also free exports, and the free names `eq`/`not`/`and`/`or` collide with
|
|
16
|
+
* common host identifiers — import aliasing is the answer; the SDK does
|
|
17
|
+
* not rename for collision-avoidance), and the exhume surface
|
|
14
18
|
* (`Db.exhume` — the one schema-independent read path: the store's
|
|
15
19
|
* self-described shapes and raw facts by name, typed at bare structural
|
|
16
20
|
* values, deliberately schema-free). The raw native bridge is not exported.
|
|
17
21
|
*/
|
|
18
|
-
export type { AnyClosed, AxiomRow, Axioms, Closed, ClosedColumn, ClosedCore, ClosedData, ClosedRow, PayloadField } from "#closed.ts";
|
|
22
|
+
export type { AnyClosed, AnySelectedClosed, AxiomRow, Axioms, Closed, ClosedColumn, ClosedCore, ClosedData, ClosedRow, ClosedSelectionInput, PayloadField, SelectedClosed } from "#closed.ts";
|
|
19
23
|
export { closed } from "#closed.ts";
|
|
20
24
|
export type { Count } from "#count.ts";
|
|
21
25
|
export { atLeast, atMost, between, exactly, none } from "#count.ts";
|
|
22
26
|
export type { Abandon, DeclaredKeyFact, DeltaBuild, MemberRelation, OffendingFact, Prepared, ReadScope, Tx, Violation, WitnessedWriteResult, WriteResult } from "#db.ts";
|
|
23
|
-
export { abandon, Db } from "#db.ts";
|
|
27
|
+
export { abandon, Db, ErrNewtypeMismatch } from "#db.ts";
|
|
24
28
|
export type { Exhumed, ExhumedAxiom, ExhumedDescriptor, ExhumedFact, ExhumedField, ExhumedRelation } from "#exhume.ts";
|
|
25
29
|
export { ErrExhumeCorruption, ErrExhumeFormatMismatch, ErrExhumeNoDescriptor } from "#exhume.ts";
|
|
26
|
-
export type { AnyFace, Arity, Face, FaceArityMismatch, FaceData,
|
|
27
|
-
export { on
|
|
28
|
-
export type { AnyField, BoolField,
|
|
30
|
+
export type { AnyFace, Arity, Face, FaceArityMismatch, FaceData, FaceFields, FaceOwner, FaceShapeMismatch, FaceShapes, FaceSource, OwnerOf, SameArity, SameShapes } from "#face.ts";
|
|
31
|
+
export { on } from "#face.ts";
|
|
32
|
+
export type { AnyField, BoolField, BytesField, ClosedIdField, ClosedRoster, FreshU64Field, I64Field, Infer, IntervalField, IntervalValue, StrField, U64Field } from "#fields.ts";
|
|
29
33
|
export { bool, bytes, i64, interval, span, str, u64 } from "#fields.ts";
|
|
34
|
+
export type { ClassesOf, ClassWall, LawfulStatements, RelationClasses, SchemaClasses } from "#law.ts";
|
|
30
35
|
export { lower, lowerClosed, lowerRelation } from "#lower.ts";
|
|
31
36
|
export type { KeyFact, Minted } from "#marshal.ts";
|
|
32
37
|
export type { FactValue, OccurrenceDrift, ProgramIr, Staleness, StatementKindTag } from "#native.ts";
|
|
33
|
-
export type { AnyCond, BindingInput, Cmp, MatchShape, NotAtom, RecData, RuleData, SelectColumn, Tree } from "#query/atom.ts";
|
|
34
|
-
export { ALLEN } from "#query/atom.ts";
|
|
38
|
+
export type { AnyCond, BindingInput, Cmp, MatchFields, MatchOwner, MatchShape, NotAtom, RecData, RuleData, SelectColumn, Tree } from "#query/atom.ts";
|
|
39
|
+
export { ALLEN, allen, and, covers, eq, ge, gt, le, lt, ne, not, or, pointIn } from "#query/atom.ts";
|
|
35
40
|
export type { AnyQuery, AnyRuleValue, OutputRuleChain, OutputRuleScope, Query, QueryData, QueryParams, QueryRelation, QueryRow, QueryRuleChain, QueryRuleScope, QueryStart, RecRef, RecRuleChain, RecRuleScope, RuleValue, TermOps } from "#query/lower.ts";
|
|
36
41
|
export { lowerQuery, query } from "#query/lower.ts";
|
|
37
42
|
export type { ProgramScope, Rec } from "#query/predicate.ts";
|
|
38
43
|
export { program } from "#query/predicate.ts";
|
|
39
|
-
export type { Duration, MaskParam, Param, ParamEntry, ParamsRecord, SetParam, Var } from "#query/scope.ts";
|
|
44
|
+
export type { ClassedField, Duration, MaskParam, Param, ParamEntry, ParamsRecord, SetParam, Var, VarsRecord } from "#query/scope.ts";
|
|
40
45
|
export type { Agg, SelectEntry } from "#query/select.ts";
|
|
41
46
|
export type { AnyRelation, AnySelected, Fact, FieldRef, FieldRefs, FieldsShape, FreshKeys, InsertFact, Relation, RelationData, RelationField, RelationFields, Selected, SelectionBinding, SelectionInput } from "#relation.ts";
|
|
42
47
|
export { relation } from "#relation.ts";
|
|
@@ -44,6 +49,6 @@ export type { AnySchema, Schema, SchemaRelation, SchemaRelations } from "#schema
|
|
|
44
49
|
export { schema } from "#schema.ts";
|
|
45
50
|
export type { FieldSpec, LiteralSetSpec, LiteralSpec, RelationSpec, RowSpec, SchemaSpec, SideSpec, StatementSpec, ValueSpec, ValueTypeSpec, WindowSpec } from "#spec.ts";
|
|
46
51
|
export { renderLiteral, renderLiteralSet, renderWindow } from "#spec.ts";
|
|
47
|
-
export type { KeyData, KeyStatement, Statement, StatementData } from "#statements.ts";
|
|
52
|
+
export type { ContainedStatement, ContainmentData, KeyData, KeyStatement, Statement, StatementData, WindowData, WindowStatement } from "#statements.ts";
|
|
48
53
|
export { contained, key, mirrors, renderStatement, window } from "#statements.ts";
|
|
49
54
|
//# 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;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,YAAY,EACX,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,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,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AACxD,YAAY,EACX,OAAO,EACP,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,eAAe,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,YAAY,CAAA;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ClB,eAAe,EACf,OAAO,EACP,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,eAAe,EACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @bjornpagen/bumbledb — the type-theoretic TypeScript SDK for the
|
|
3
3
|
* bumbledb embedded relational engine. Public surface: the structural type
|
|
4
|
-
* kernel (fields
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
4
|
+
* kernel (fields as pure structure, `relation()`, `closed()` — domains are
|
|
5
|
+
* never declared: THE LAWS TYPE THE COLUMNS, `schema()` computing every
|
|
6
|
+
* field's equivalence class FROM the statement list at both tiers), the
|
|
7
|
+
* statement algebra with `schema()` and `SchemaSpec` lowering (PRD-06), the `Db`
|
|
7
8
|
* runtime (path-cached stores, transactions, typed violations, scoped
|
|
8
9
|
* snapshot reads, the witnessed write loop with `abandon` — PRD-07, zero
|
|
9
10
|
* closables), the query surface (Datalog as values, kysely-shaped:
|
|
10
11
|
* `query(S).rule(r => r.match(...).where(...).select(...))` with
|
|
11
12
|
* string-named domain-typed vars, params typed by use, negation,
|
|
12
13
|
* conditions, aggregates, and stratified recursion via `program()`/`rec` —
|
|
13
|
-
* `db.prepare` as a plain value
|
|
14
|
+
* `db.prepare` as a plain value; the comparison/connective builders are
|
|
15
|
+
* also free exports, and the free names `eq`/`not`/`and`/`or` collide with
|
|
16
|
+
* common host identifiers — import aliasing is the answer; the SDK does
|
|
17
|
+
* not rename for collision-avoidance), and the exhume surface
|
|
14
18
|
* (`Db.exhume` — the one schema-independent read path: the store's
|
|
15
19
|
* self-described shapes and raw facts by name, typed at bare structural
|
|
16
20
|
* values, deliberately schema-free). The raw native bridge is not exported.
|
|
17
21
|
*/
|
|
18
22
|
export { closed } from "#closed.ts";
|
|
19
23
|
export { atLeast, atMost, between, exactly, none } from "#count.ts";
|
|
20
|
-
export { abandon, Db } from "#db.ts";
|
|
24
|
+
export { abandon, Db, ErrNewtypeMismatch } from "#db.ts";
|
|
21
25
|
export { ErrExhumeCorruption, ErrExhumeFormatMismatch, ErrExhumeNoDescriptor } from "#exhume.ts";
|
|
22
|
-
export { on
|
|
26
|
+
export { on } from "#face.ts";
|
|
23
27
|
export { bool, bytes, i64, interval, span, str, u64 } from "#fields.ts";
|
|
24
28
|
export { lower, lowerClosed, lowerRelation } from "#lower.ts";
|
|
25
|
-
export { ALLEN } from "#query/atom.ts";
|
|
29
|
+
export { ALLEN, allen, and, covers, eq, ge, gt, le, lt, ne, not, or, pointIn } from "#query/atom.ts";
|
|
26
30
|
export { lowerQuery, query } from "#query/lower.ts";
|
|
27
31
|
export { program } from "#query/predicate.ts";
|
|
28
32
|
export { relation } from "#relation.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;;;;;;;;;;;;;;;;;;;;GAoBG;AAgBH,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,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AASxD,OAAO,EACN,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,YAAY,CAAA;AAgBnB,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAA;AAe7B,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EA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