@bjornpagen/bumbledb 0.3.0 → 0.5.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 +246 -92
- package/README.md +31 -16
- package/dist/closed.d.ts +80 -75
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +102 -127
- package/dist/closed.js.map +1 -1
- package/dist/db.d.ts +37 -7
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +95 -55
- package/dist/db.js.map +1 -1
- package/dist/exhume.d.ts.map +1 -1
- package/dist/exhume.js +1 -14
- package/dist/exhume.js.map +1 -1
- package/dist/face.d.ts +40 -40
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +9 -17
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +46 -15
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +58 -29
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +13 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/law.d.ts +2 -1
- package/dist/law.d.ts.map +1 -1
- package/dist/law.js +15 -14
- package/dist/law.js.map +1 -1
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +1 -7
- 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 +75 -26
- package/dist/marshal.js.map +1 -1
- package/dist/native.d.ts +21 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +20 -3
- package/dist/native.js.map +1 -1
- package/dist/order.d.ts +36 -0
- package/dist/order.d.ts.map +1 -0
- package/dist/order.js +135 -0
- package/dist/order.js.map +1 -0
- package/dist/query/atom.d.ts +76 -28
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +12 -16
- package/dist/query/atom.js.map +1 -1
- package/dist/query/lower.d.ts +5 -8
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +308 -72
- package/dist/query/lower.js.map +1 -1
- package/dist/query/predicate.d.ts.map +1 -1
- package/dist/query/predicate.js +34 -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 +27 -8
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +37 -29
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +19 -47
- package/dist/query/scope.js.map +1 -1
- package/dist/relation.d.ts +17 -29
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +41 -38
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +7 -31
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +3 -2
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +13 -4
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +75 -8
- package/dist/statements.js.map +1 -1
- package/package.json +2 -5
- package/src/closed.ts +144 -206
- package/src/db.ts +143 -68
- package/src/exhume.ts +1 -15
- package/src/face.ts +38 -48
- package/src/fields.ts +103 -49
- package/src/index.ts +11 -10
- package/src/law.ts +15 -14
- package/src/lower.ts +2 -9
- package/src/marshal.ts +82 -31
- package/src/native.ts +22 -4
- package/src/order.ts +156 -0
- package/src/query/atom.ts +70 -35
- package/src/query/lower.ts +354 -82
- package/src/query/predicate.ts +39 -4
- package/src/query/run.ts +27 -9
- package/src/query/scope.ts +52 -70
- package/src/relation.ts +54 -68
- package/src/schema.ts +7 -33
- package/src/spec.ts +3 -2
- package/src/statements.ts +82 -8
package/README.md
CHANGED
|
@@ -27,9 +27,11 @@ classes, inferred query rows, and rejections that arrive as data rather than
|
|
|
27
27
|
exceptions.
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import { bool, closed, contained, Db, gt, key, on, query, relation, schema, u64 } from "@bjornpagen/bumbledb"
|
|
30
|
+
import { bool, closed, contained, Db, gt, type Infer, key, on, query, relation, schema, u64 } from "@bjornpagen/bumbledb"
|
|
31
31
|
|
|
32
32
|
// A closed relation: a sealed roster of axioms with typed payload columns.
|
|
33
|
+
// At the host surface a handle is its NAME — the string literal "DirectPass"
|
|
34
|
+
// is the one spelling, and closed columns type as the handle union.
|
|
33
35
|
const Kind = closed(
|
|
34
36
|
"Kind",
|
|
35
37
|
{ mastered: bool, rank: u64 },
|
|
@@ -57,10 +59,12 @@ const Review = schema("Review", { Kind, Attempt, Certificate }, [
|
|
|
57
59
|
|
|
58
60
|
const db = await Db.create("./review.db", Review)
|
|
59
61
|
|
|
60
|
-
// Write. The delta is judged against every statement at commit.
|
|
62
|
+
// Write. The delta is judged against every statement at commit. A closed
|
|
63
|
+
// column takes the handle name — a wrong string is a compile error AND a
|
|
64
|
+
// marshal refusal.
|
|
61
65
|
const result = db.write((tx) => {
|
|
62
|
-
const attempt = tx.insert(Attempt, { kind:
|
|
63
|
-
tx.insert(Certificate, { attempt: attempt.id, kind:
|
|
66
|
+
const attempt = tx.insert(Attempt, { kind: "DirectPass" }) // attempt.id minted, a bare bigint
|
|
67
|
+
tx.insert(Certificate, { attempt: attempt.id, kind: "DirectPass" })
|
|
64
68
|
})
|
|
65
69
|
|
|
66
70
|
// Rejection-as-data: no throw — a rejected commit is a typed value carrying
|
|
@@ -75,7 +79,9 @@ if (!result.ok) {
|
|
|
75
79
|
// first binding; params are typed by use; rows are typed from the select.
|
|
76
80
|
// `gt` is one of the free comparison exports.
|
|
77
81
|
const certifiedAbove = query(Review).rule((r) => {
|
|
78
|
-
const
|
|
82
|
+
const a = r.var("a")
|
|
83
|
+
const k = r.var("k")
|
|
84
|
+
const rank = r.var("rank")
|
|
79
85
|
return r
|
|
80
86
|
.match(Certificate, { attempt: a, kind: k })
|
|
81
87
|
.match(Kind, { id: k, mastered: true, rank }) // ψ on the read side too
|
|
@@ -87,14 +93,21 @@ const prepared = db.prepare(certifiedAbove)
|
|
|
87
93
|
const rows = db.execute(prepared, { floor: 15n }) // rows: { a: bigint; rank: bigint }[]
|
|
88
94
|
console.log(rows)
|
|
89
95
|
|
|
90
|
-
// Host dispatch over the sealed roster
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
// Host dispatch over the sealed roster is native `switch` narrowing over
|
|
97
|
+
// the handle union ("DirectPass" | "JudgedPass" | "Failed") — exhaustive
|
|
98
|
+
// via `satisfies never`; the sealed axioms read back typed.
|
|
99
|
+
function describe(kind: Infer<typeof Kind.id>): string {
|
|
100
|
+
switch (kind) {
|
|
101
|
+
case "DirectPass":
|
|
102
|
+
case "JudgedPass":
|
|
103
|
+
return `mastered, rank ${Kind.axioms[kind].rank}`
|
|
104
|
+
case "Failed":
|
|
105
|
+
return "not mastered"
|
|
106
|
+
default:
|
|
107
|
+
return kind satisfies never
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
console.log(describe("JudgedPass")) // "mastered, rank 20"
|
|
98
111
|
```
|
|
99
112
|
|
|
100
113
|
Every `ts` fence in this README is extracted and type-checked against the
|
|
@@ -102,10 +115,12 @@ real surface by `test/readme.test.ts` — the examples cannot drift.
|
|
|
102
115
|
|
|
103
116
|
## Surface
|
|
104
117
|
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
The drizzle law governs this surface: the SDK's job at the host boundary is translation, not abstraction — every database idiom arrives as the modern TypeScript idiom for that concept, and the SDK never invents an operator where the language already has one.
|
|
119
|
+
|
|
120
|
+
- The structural type kernel — fields as pure structure (`bool`, `bytes`, `i64`, `u64`, `str`, `interval`, `span`), `relation()`, and `closed()` sealed rosters with typed axiom payloads. A closed reference's value type IS the handle union (`Infer` speaks it); dispatch is native `switch` narrowing with `satisfies never` exhaustiveness. Domains are never declared: `schema()` computes every field's class from the statement list.
|
|
121
|
+
- The statement algebra — `schema()`, `key`, `contained`, `mirrors`, `window`; faces via `on` (set membership is a plain array in `.where`); counts via `exactly`, `atLeast`, `atMost`, `between`, `none`; ψ-selection via `.where` on relations and closed rosters.
|
|
107
122
|
- The `Db` runtime — `Db.create`/`Db.open`, path-cached stores, transactions, typed violations, scoped snapshot reads, the witnessed write loop with `abandon`.
|
|
108
|
-
- The query surface — Datalog as values, `query(S).rule(r => ...)`: named vars, params typed by use, negation, aggregates, and the free comparison/connective exports (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `and`, `or`, `not`, `allen`/`ALLEN`, `pointIn
|
|
123
|
+
- The query surface — Datalog as values, `query(S).rule(r => ...)`: named vars, params typed by use, negation, aggregates, and the free comparison/connective exports (`eq`, `ne`, `lt`, `le`, `gt`, `ge`, `and`, `or`, `not`, `allen`/`ALLEN`, `pointIn`); set membership at a closed field is a plain array in the match record (`r.match(Ticket, { priority: ["Normal", "Urgent"] })` — closed-only there: an ordinary field's membership is a bound `r.inSet` param); stratified recursion via `program()`; `db.prepare` as a plain value.
|
|
109
124
|
- The exhume surface — `Db.exhume`, the schema-independent read path: a store's self-described shapes and raw facts by name, with typed refusals (`ErrExhumeNoDescriptor`, `ErrExhumeFormatMismatch`, `ErrExhumeCorruption`).
|
|
110
125
|
|
|
111
126
|
## Cookbook
|
package/dist/closed.d.ts
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Closed relations (`docs/architecture/10-data-model.md` § closed
|
|
3
3
|
* relations): a vocabulary whose extension is declared in the schema — two
|
|
4
|
-
* tiers, one function.
|
|
5
|
-
* macro's (host-enum analog): handle CONSTANTS on the value
|
|
6
|
-
* (`Kind.Checking`, ids = declaration order, each a BARE `bigint` — no
|
|
7
|
-
* brand), the `fromId` weld, an `id` field descriptor carrying the CLOSED
|
|
8
|
-
* LINKAGE (the roster — pure structure, no declared domain: the laws type
|
|
9
|
-
* the columns, and `schema()` names the id's generator class `"Kind.id"`)
|
|
10
|
-
* for other relations' field blocks (`kind: Kind.id`), payload readback
|
|
11
|
-
* (`Kind.axioms`), and the declared payload column descriptors
|
|
12
|
-
* (`Kind.columns` — the runtime twin of the `Cols` type parameter, which
|
|
13
|
-
* the face layer's structural wall reads). Bare tier: `closed("Kind", ["Checking",
|
|
4
|
+
* tiers, one function. Bare tier: `closed("Kind", ["Checking",
|
|
14
5
|
* "Savings"])`. Payload tier: `closed("Sev", { pages: bool }, { Critical:
|
|
15
6
|
* { pages: true }, ... })` — one call, three arguments (the curried tier-2
|
|
16
7
|
* spelling is DELETED — canonical utterance): the axioms record IS the
|
|
17
8
|
* handle declaration, every handle carrying every column exactly once
|
|
18
|
-
* (type-enforced).
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
9
|
+
* (type-enforced). At the host surface a handle is its NAME — a string
|
|
10
|
+
* literal of the roster's union (the drizzle law: translation, not
|
|
11
|
+
* abstraction; dispatch over a vocabulary is native `switch` narrowing, so
|
|
12
|
+
* no match operator is minted and no handle constants exist — the literal
|
|
13
|
+
* `"Checking"` is the ONE spelling). Handles are pure DATA, not properties
|
|
14
|
+
* of the value, so NO handle name is reserved: a vocabulary may legally
|
|
15
|
+
* contain handles named `match`, `where`, or `id` — the axioms record and
|
|
16
|
+
* the roster are their own namespaces. The value's whole surface: `name`;
|
|
17
|
+
* `id` — the field descriptor carrying the CLOSED LINKAGE (the roster —
|
|
18
|
+
* pure structure, no declared domain: the laws type the columns, and
|
|
19
|
+
* `schema()` names the id's generator class `"Kind.id"`) for other
|
|
20
|
+
* relations' field blocks (`kind: Kind.id`); `data` (the lowering
|
|
21
|
+
* carrier); `axioms` (payload readback, `Kind.axioms`); `columns` (the
|
|
22
|
+
* runtime twin of the `Cols` type parameter, which the face layer's
|
|
23
|
+
* structural wall reads); and — exactly when payload columns exist —
|
|
24
|
+
* `where()`, the ψ-selection surface (`Kind.where({ mastered: true })` as a
|
|
25
|
+
* face source), resolved through the ONE selection machine
|
|
26
|
+
* (`relation.ts::resolveSelection`); the bare tier has no payload columns
|
|
27
|
+
* to select on, so `.where` is absent there, at the type AND on the value.
|
|
28
|
+
* No fact type and no insert surface exist — closed relations are
|
|
29
|
+
* unwritable by construction: the value simply lacks the writable relation
|
|
30
|
+
* shape.
|
|
28
31
|
*/
|
|
29
|
-
import type { OneOf } from "#face.ts";
|
|
30
32
|
import { type AnyField, type ClosedIdField, type Infer } from "#fields.ts";
|
|
31
|
-
import {
|
|
33
|
+
import type { AnyRelation, RelationField } from "#relation.ts";
|
|
34
|
+
import { type SelectionBinding, type SelectionInput } from "#relation.ts";
|
|
32
35
|
import type { LiteralSpec } from "#spec.ts";
|
|
33
36
|
/**
|
|
34
37
|
* A payload column of a closed relation: any field descriptor except a
|
|
@@ -42,7 +45,7 @@ type PayloadField = Exclude<AnyField, {
|
|
|
42
45
|
* unspellable — the sealed shape mints the synthetic `id` itself (ordinal
|
|
43
46
|
* 0 of the matchable fields), so a declared column named `id` would be
|
|
44
47
|
* shadowed by the synthetic slot everywhere the shape resolves by name
|
|
45
|
-
* (`
|
|
48
|
+
* (`sealedFieldsOf`, the projected face, `spec.rs`'s resolver). The wall is
|
|
46
49
|
* typed here and judged again at construction in {@link mintClosed} — the
|
|
47
50
|
* runtime twin for untyped callers, warmer and earlier than the engine's
|
|
48
51
|
* `DuplicateFieldName` at `Db.create`.
|
|
@@ -93,12 +96,14 @@ interface ClosedCore<Name extends string, Handles extends string, Cols extends R
|
|
|
93
96
|
readonly name: Name;
|
|
94
97
|
/**
|
|
95
98
|
* The closed reference descriptor: `kind: Kind.id` in another relation's
|
|
96
|
-
* field block is the reference through which
|
|
97
|
-
* legal in that relation's selections. Pure structure plus the
|
|
98
|
-
*
|
|
99
|
-
*
|
|
99
|
+
* field block is the reference through which handle literals become
|
|
100
|
+
* legal in that relation's selections. Pure structure plus the PRECISE
|
|
101
|
+
* roster (`ClosedIdField<Handles>` — the handle union is the field's
|
|
102
|
+
* value type under `Infer`); the referencing field's domain is law-born:
|
|
103
|
+
* `schema()` computes it from the declared containment (`"Kind.id"`, the
|
|
104
|
+
* generator class).
|
|
100
105
|
*/
|
|
101
|
-
readonly id: ClosedIdField
|
|
106
|
+
readonly id: ClosedIdField<Handles>;
|
|
102
107
|
readonly data: ClosedData;
|
|
103
108
|
/** Payload readback: handle to its declared column values, bare and structural. */
|
|
104
109
|
readonly axioms: Axioms<Handles, Cols>;
|
|
@@ -111,19 +116,17 @@ interface ClosedCore<Name extends string, Handles extends string, Cols extends R
|
|
|
111
116
|
* descriptors in declaration order for the lowering).
|
|
112
117
|
*/
|
|
113
118
|
readonly columns: Cols;
|
|
114
|
-
/** The weld: declaration-order id back to its handle, or undefined beyond the roster. */
|
|
115
|
-
fromId(id: bigint): Handles | undefined;
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
118
|
-
* The `where()` argument of a closed relation:
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
121
|
+
* The `where()` argument of a closed relation: EXACTLY the relation
|
|
122
|
+
* surface's {@link SelectionInput}, over the declared payload columns — the
|
|
123
|
+
* ONE selection vocabulary, so a spelling change there (H3's membership
|
|
124
|
+
* arrays) flows through with no local change here. The synthetic `id` is
|
|
125
|
+
* deliberately unspellable ({@link PayloadColumns} refuses an `id` column):
|
|
126
|
+
* an id selection is spelled only as handle literals on the REFERENCING
|
|
127
|
+
* side (the canonical-utterance law).
|
|
123
128
|
*/
|
|
124
|
-
type ClosedSelectionInput<Cols extends Record<string, PayloadField>> =
|
|
125
|
-
readonly [C in keyof Cols]?: Infer<Cols[C]> | OneOf<Infer<Cols[C]>>;
|
|
126
|
-
};
|
|
129
|
+
type ClosedSelectionInput<Cols extends Record<string, PayloadField>> = SelectionInput<Cols>;
|
|
127
130
|
/**
|
|
128
131
|
* A closed relation with a ψ selection applied — what `on()` consumes as a
|
|
129
132
|
* σ-carrying closed source (`on(Kind.where({ mastered: true }), "id")`).
|
|
@@ -152,42 +155,17 @@ interface ClosedSelectable<Name extends string, Handles extends string, Cols ext
|
|
|
152
155
|
where(selection: ClosedSelectionInput<Cols>): SelectedClosed<Name, Handles, Cols>;
|
|
153
156
|
}
|
|
154
157
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*/
|
|
163
|
-
interface ClosedMatchBare<Handles extends string> {
|
|
164
|
-
match<T>(id: bigint, arms: {
|
|
165
|
-
readonly [H in Handles]: () => T;
|
|
166
|
-
}): T;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Exhaustive dispatch over a PAYLOAD-tier closed vocabulary: the same
|
|
170
|
-
* mapped-type exhaustiveness as the bare tier, and each arm receives its
|
|
171
|
-
* handle's typed axiom row (the declared columns, bare and structural —
|
|
172
|
-
* the frozen readback row from `axioms`).
|
|
173
|
-
*/
|
|
174
|
-
interface ClosedMatchPayload<Handles extends string, Cols extends Record<string, PayloadField>> {
|
|
175
|
-
match<T>(id: bigint, arms: {
|
|
176
|
-
readonly [H in Handles]: (row: AxiomRow<Cols>) => T;
|
|
177
|
-
}): T;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* A closed relation value: the core surface plus one BARE constant per
|
|
181
|
-
* handle (`Kind.Checking: bigint`, ids = declaration order — the value is
|
|
182
|
-
* structural; the roster judges out-of-vocabulary ids at construction and
|
|
183
|
-
* the engine at commit), plus `match()` on BOTH tiers (bare arms take
|
|
184
|
-
* nothing; payload arms receive the typed axiom row), plus — exactly when
|
|
185
|
-
* payload columns exist — `where()` (the bare tier has nothing to select
|
|
186
|
-
* on, so the method is ABSENT there, not merely uncallable).
|
|
158
|
+
* A closed relation value: the core surface plus — exactly when payload
|
|
159
|
+
* columns exist — `where()` (the bare tier has nothing to select on, so
|
|
160
|
+
* the method is ABSENT there, not merely uncallable). NOTHING else:
|
|
161
|
+
* handles are data on the roster, never properties of the value (the
|
|
162
|
+
* handle constants, the match operator, and the id-to-handle weld died
|
|
163
|
+
* with the bigint era — dispatch is native `switch` narrowing over the
|
|
164
|
+
* handle union).
|
|
187
165
|
*/
|
|
188
|
-
type Closed<Name extends string, Handles extends string, Cols extends Record<string, PayloadField>> =
|
|
189
|
-
|
|
190
|
-
|
|
166
|
+
type Closed<Name extends string, Handles extends string, Cols extends Record<string, PayloadField>> = [
|
|
167
|
+
keyof Cols
|
|
168
|
+
] extends [never] ? ClosedCore<Name, Handles, Cols> : ClosedCore<Name, Handles, Cols> & ClosedSelectable<Name, Handles, Cols>;
|
|
191
169
|
/** Any closed relation value, whatever its roster and columns. */
|
|
192
170
|
interface AnyClosed {
|
|
193
171
|
readonly name: string;
|
|
@@ -196,6 +174,33 @@ interface AnyClosed {
|
|
|
196
174
|
readonly axioms: Readonly<Record<string, object>>;
|
|
197
175
|
readonly columns: Readonly<Record<string, PayloadField>>;
|
|
198
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* THE relation-kind discriminant — the ONE spelling of "is this schema
|
|
179
|
+
* member closed?" (the type tier's twin is the `AnyClosed` conditional
|
|
180
|
+
* arms). A closed relation's runtime description carries its handle
|
|
181
|
+
* roster; an ordinary relation's never does. Every runtime closed/ordinary
|
|
182
|
+
* fork in the SDK judges through this predicate — never a re-spelled
|
|
183
|
+
* structural probe.
|
|
184
|
+
*/
|
|
185
|
+
declare function isClosedMember(member: AnyRelation | AnyClosed): member is AnyClosed;
|
|
186
|
+
/**
|
|
187
|
+
* The SEALED field list of a schema member — THE one reader of "what
|
|
188
|
+
* fields does this owner expose": an ordinary relation's declared fields;
|
|
189
|
+
* a closed relation's sealed shape — the synthetic `id` (the value's own
|
|
190
|
+
* roster-carrying descriptor, by identity) at ordinal 0, then the declared
|
|
191
|
+
* payload columns at declared index + 1 (the sealed shift, mirroring the
|
|
192
|
+
* engine's `SchemaDescriptor::sealed_fields`). A `ClosedColumn` is
|
|
193
|
+
* structurally a `RelationField`, so both kinds read uniformly.
|
|
194
|
+
*/
|
|
195
|
+
declare function sealedFieldsOf(member: AnyRelation | AnyClosed): readonly RelationField[];
|
|
196
|
+
/**
|
|
197
|
+
* One sealed field by name — derived from {@link sealedFieldsOf}, so the
|
|
198
|
+
* closed synthetic `id` resolves everywhere a name is looked up (no reader
|
|
199
|
+
* can silently lack the `id` arm). `undefined` when the name is foreign
|
|
200
|
+
* (the type tiers make that unwritable; the engine re-judges at
|
|
201
|
+
* `Db.create`).
|
|
202
|
+
*/
|
|
203
|
+
declare function sealedFieldOf(member: AnyRelation | AnyClosed, fieldName: string): AnyField | undefined;
|
|
199
204
|
/** Bare tier: `closed("Kind", ["Checking", "Savings"])` — handles only. */
|
|
200
205
|
declare function closed<const Name extends string, const Handles extends readonly [string, ...string[]]>(name: Name, handles: Handles): Closed<Name, Handles[number], Record<never, never>>;
|
|
201
206
|
/**
|
|
@@ -211,6 +216,6 @@ declare function closed<const Name extends string, const Handles extends readonl
|
|
|
211
216
|
* {@link Axioms}).
|
|
212
217
|
*/
|
|
213
218
|
declare function closed<const Name extends string, const Cols extends PayloadColumns, Handles extends string>(name: Name, columns: Cols, axioms: Axioms<Handles, Cols>): Closed<Name, Handles, Cols>;
|
|
214
|
-
export type { AnyClosed, AnySelectedClosed, AxiomRow, Axioms, Closed, ClosedColumn, ClosedCore, ClosedData, ClosedRow, ClosedSelectionInput, PayloadField, SelectedClosed };
|
|
215
|
-
export { closed };
|
|
219
|
+
export type { AnyClosed, AnySelectedClosed, AxiomRow, Axioms, Closed, ClosedColumn, ClosedCore, ClosedData, ClosedRow, ClosedSelectable, ClosedSelectionInput, PayloadField, SelectedClosed };
|
|
220
|
+
export { closed, isClosedMember, sealedFieldOf, sealedFieldsOf };
|
|
216
221
|
//# sourceMappingURL=closed.d.ts.map
|
package/dist/closed.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closed.d.ts","sourceRoot":"","sources":["../src/closed.ts"],"names":[],"mappings":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