@bjornpagen/bumbledb 0.12.2 → 0.14.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 +10 -8
- package/README.md +5 -4
- package/dist/db.d.ts +43 -19
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +70 -65
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/marshal.d.ts +5 -27
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +4 -21
- package/dist/marshal.js.map +1 -1
- package/dist/native.d.ts +37 -20
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js.map +1 -1
- package/dist/query/find.d.ts +14 -9
- package/dist/query/find.d.ts.map +1 -1
- package/dist/query/find.js +2 -2
- package/dist/query/find.js.map +1 -1
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +5 -4
- package/dist/query/lower.js.map +1 -1
- package/dist/query/parse-ir.d.ts.map +1 -1
- package/dist/query/parse-ir.js +11 -9
- package/dist/query/parse-ir.js.map +1 -1
- package/dist/relation.d.ts +4 -25
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +3 -4
- package/dist/relation.js.map +1 -1
- package/package.json +2 -2
- package/src/db.ts +123 -104
- package/src/index.ts +3 -2
- package/src/marshal.ts +5 -35
- package/src/native.ts +34 -16
- package/src/query/find.ts +19 -14
- package/src/query/lower.ts +7 -6
- package/src/query/parse-ir.ts +11 -9
- package/src/relation.ts +3 -28
package/src/relation.ts
CHANGED
|
@@ -7,29 +7,15 @@
|
|
|
7
7
|
* verified against their roster at construction). Fields are addressed by
|
|
8
8
|
* NAME everywhere — statements (`on(R, "holder")`), selections, and match
|
|
9
9
|
* records all spell the field's own name, checked by type
|
|
10
|
-
* (`FaceFields`/`MatchShape`). `Fact
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* (resupply-to-preserve-identity), typed exactly.
|
|
10
|
+
* (`FaceFields`/`MatchShape`). `Fact<>` is the inferred row object type
|
|
11
|
+
* at BARE structural value types (no brands): every field is present,
|
|
12
|
+
* including fresh cells. Mint with `tx.reserve` before insert.
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
import * as errors from "@superbuilders/errors"
|
|
17
16
|
import { type AnyField, assertDeclarationOrderKey, assertDeclarationRecord, type Infer, literalOf } from "#fields.ts"
|
|
18
17
|
import { type LiteralSetSpec, type LiteralSpec, renderLiteral } from "#spec.ts"
|
|
19
18
|
|
|
20
|
-
/** Flattens an intersection into one displayed object type (hover legibility). */
|
|
21
|
-
type Flatten<T> = { [K in keyof T]: T[K] }
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* An optional property that may be omitted OR explicitly `undefined`.
|
|
25
|
-
* `Partial<T>` under `exactOptionalPropertyTypes` is omit-only (`key?: T`),
|
|
26
|
-
* which rejects `key: T | undefined` — insert must accept both (omit-to-mint,
|
|
27
|
-
* and a host binding that is already `bigint | undefined`).
|
|
28
|
-
*/
|
|
29
|
-
type ExactOptional<T> = {
|
|
30
|
-
[K in keyof T]?: T[K] | undefined
|
|
31
|
-
}
|
|
32
|
-
|
|
33
19
|
/**
|
|
34
20
|
* Resolves one selection entry to its lowered literal set: a plain ARRAY
|
|
35
21
|
* (detected by `Array.isArray` — no field's value type is an array;
|
|
@@ -187,16 +173,6 @@ type FreshKeys<R extends AnyRelation> = {
|
|
|
187
173
|
[K in keyof RelationFields<R>]: RelationFields<R>[K] extends { readonly fresh: true } ? K : never
|
|
188
174
|
}[keyof RelationFields<R>]
|
|
189
175
|
|
|
190
|
-
/**
|
|
191
|
-
* The inferred row object type of a relation as INSERTED: fresh fields
|
|
192
|
-
* optional — omitted, the engine mints; supplied, identity is preserved
|
|
193
|
-
* (the ETL resupply idiom). Explicit `undefined` is the same as omit
|
|
194
|
-
* (`exactOptionalPropertyTypes`: `id?: bigint | undefined`, not omit-only).
|
|
195
|
-
*/
|
|
196
|
-
type InsertFact<R extends AnyRelation> = Flatten<
|
|
197
|
-
Omit<Fact<R>, FreshKeys<R>> & ExactOptional<Pick<Fact<R>, FreshKeys<R>>>
|
|
198
|
-
>
|
|
199
|
-
|
|
200
176
|
/**
|
|
201
177
|
* Declares one relation: `relation("Account", { id: u64.fresh,
|
|
202
178
|
* holder: u64, kind: Kind.id, ... })` — every field is a pure-structure
|
|
@@ -241,7 +217,6 @@ export type {
|
|
|
241
217
|
Fact,
|
|
242
218
|
FieldsShape,
|
|
243
219
|
FreshKeys,
|
|
244
|
-
InsertFact,
|
|
245
220
|
Relation,
|
|
246
221
|
RelationData,
|
|
247
222
|
RelationField,
|