@bjornpagen/bumbledb 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COOKBOOK.md +1450 -0
- package/README.md +69 -30
- package/dist/closed.d.ts +157 -38
- package/dist/closed.d.ts.map +1 -1
- package/dist/closed.js +232 -47
- package/dist/closed.js.map +1 -1
- package/dist/count.d.ts +64 -17
- package/dist/count.d.ts.map +1 -1
- package/dist/count.js +37 -14
- package/dist/count.js.map +1 -1
- package/dist/db.d.ts +27 -8
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +33 -10
- package/dist/db.js.map +1 -1
- package/dist/exhume.d.ts +12 -11
- package/dist/exhume.d.ts.map +1 -1
- package/dist/exhume.js +7 -6
- package/dist/exhume.js.map +1 -1
- package/dist/face.d.ts +135 -30
- package/dist/face.d.ts.map +1 -1
- package/dist/face.js +44 -19
- package/dist/face.js.map +1 -1
- package/dist/fields.d.ts +130 -130
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +60 -94
- package/dist/fields.js.map +1 -1
- package/dist/index.d.ts +29 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -14
- package/dist/index.js.map +1 -1
- package/dist/law.d.ts +224 -0
- package/dist/law.d.ts.map +1 -0
- package/dist/law.js +224 -0
- package/dist/law.js.map +1 -0
- package/dist/lower.d.ts +17 -7
- package/dist/lower.d.ts.map +1 -1
- package/dist/lower.js +66 -24
- package/dist/lower.js.map +1 -1
- package/dist/marshal.d.ts +36 -21
- package/dist/marshal.d.ts.map +1 -1
- package/dist/marshal.js +41 -25
- package/dist/marshal.js.map +1 -1
- package/dist/native.d.ts +6 -2
- package/dist/native.d.ts.map +1 -1
- package/dist/native.js +2 -2
- package/dist/native.js.map +1 -1
- package/dist/query/atom.d.ts +370 -174
- package/dist/query/atom.d.ts.map +1 -1
- package/dist/query/atom.js +75 -172
- package/dist/query/atom.js.map +1 -1
- package/dist/query/lower.d.ts +312 -109
- package/dist/query/lower.d.ts.map +1 -1
- package/dist/query/lower.js +906 -387
- package/dist/query/lower.js.map +1 -1
- package/dist/query/predicate.d.ts +70 -88
- package/dist/query/predicate.d.ts.map +1 -1
- package/dist/query/predicate.js +118 -72
- package/dist/query/predicate.js.map +1 -1
- package/dist/query/run.d.ts +19 -16
- package/dist/query/run.d.ts.map +1 -1
- package/dist/query/run.js +31 -24
- package/dist/query/run.js.map +1 -1
- package/dist/query/scope.d.ts +178 -127
- package/dist/query/scope.d.ts.map +1 -1
- package/dist/query/scope.js +111 -108
- package/dist/query/scope.js.map +1 -1
- package/dist/query/select.d.ts +102 -80
- package/dist/query/select.d.ts.map +1 -1
- package/dist/query/select.js +39 -34
- package/dist/query/select.js.map +1 -1
- package/dist/relation.d.ts +48 -38
- package/dist/relation.d.ts.map +1 -1
- package/dist/relation.js +24 -19
- package/dist/relation.js.map +1 -1
- package/dist/schema.d.ts +41 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +34 -9
- package/dist/schema.js.map +1 -1
- package/dist/spec.d.ts +7 -5
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/statements.d.ts +91 -36
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +42 -12
- package/dist/statements.js.map +1 -1
- package/package.json +4 -3
- package/src/closed.ts +448 -95
- package/src/count.ts +112 -18
- package/src/db.ts +45 -17
- package/src/exhume.ts +12 -11
- package/src/face.ts +211 -41
- package/src/fields.ts +199 -234
- package/src/index.ts +78 -61
- package/src/law.ts +519 -0
- package/src/lower.ts +82 -27
- package/src/marshal.ts +48 -30
- package/src/native.ts +8 -4
- package/src/query/atom.ts +525 -374
- package/src/query/lower.ts +1469 -538
- package/src/query/predicate.ts +208 -161
- package/src/query/run.ts +35 -25
- package/src/query/scope.ts +264 -218
- package/src/query/select.ts +168 -93
- package/src/relation.ts +47 -47
- package/src/schema.ts +69 -18
- package/src/spec.ts +7 -5
- package/src/statements.ts +124 -41
- package/dist/brand.d.ts +0 -59
- package/dist/brand.d.ts.map +0 -1
- package/dist/brand.js +0 -47
- package/dist/brand.js.map +0 -1
- package/src/brand.ts +0 -82
package/dist/query/select.js
CHANGED
|
@@ -1,39 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Select entries and aggregates
|
|
3
|
-
* the IR's aggregate roster exactly
|
|
4
|
-
* `
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* maximal segment), the result
|
|
2
|
+
* Select entries and aggregates, STRUCTURAL edition — the head vocabulary,
|
|
3
|
+
* mirroring the IR's aggregate roster exactly
|
|
4
|
+
* (`bumbledb/crates/bumbledb/src/ir.rs` `AggOp`/`FindTerm`;
|
|
5
|
+
* `docs/architecture/20-query-ir.md` § aggregation): `count` (nullary),
|
|
6
|
+
* `countDistinct`, `sum`/`min`/`max` (over an orderable variable or the
|
|
7
|
+
* measure), `argMax`/`argMin` (arg-restriction: carried value + orderable
|
|
8
|
+
* key; a tie yields every attaining row), and `pack` (the coalescing fold —
|
|
9
|
+
* RELATION-SHAPED: one answer row per (group, maximal segment), the result
|
|
10
|
+
* position interval-typed). Aggregates name their variables — `r.sum("m")`
|
|
11
|
+
* — and are typed by the rule environment at `.select`. Grouping is
|
|
10
12
|
* implicit: the non-aggregate select entries are the group key; over empty
|
|
11
13
|
* input an all-aggregate select yields the EMPTY SET, never a zero row.
|
|
14
|
+
* The creation quarantine is representational: a head position is a var
|
|
15
|
+
* name, the measure, or an aggregate — no minting or arithmetic term
|
|
16
|
+
* exists to spell (permanent law).
|
|
12
17
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
/** Builds one aggregate value. */
|
|
19
|
+
function aggregate(op, over, key) {
|
|
20
|
+
return Object.freeze({ agg: op, over, key });
|
|
21
|
+
}
|
|
22
|
+
/** Nullary count: |the group's set of distinct full bindings|, `bigint`; the answer column is named `count`. */
|
|
16
23
|
function count() {
|
|
17
|
-
return
|
|
24
|
+
return aggregate("count", undefined, undefined);
|
|
18
25
|
}
|
|
19
|
-
/** |the distinct values of
|
|
26
|
+
/** |the distinct values of the named variable across the group|, `bigint`; legal over every type. */
|
|
20
27
|
function countDistinct(over) {
|
|
21
|
-
return
|
|
28
|
+
return aggregate("countDistinct", over, undefined);
|
|
22
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Exact checked sum over an orderable (u64/i64) variable — wide
|
|
32
|
+
* accumulator, one finalize range check; overflow is the engine's typed
|
|
33
|
+
* runtime error, never a wrap — or over the measure
|
|
34
|
+
* (`r.sum(r.duration("w"))`).
|
|
35
|
+
*/
|
|
23
36
|
function sum(over) {
|
|
24
|
-
return
|
|
25
|
-
aggregate: Object.freeze({ op: "fold", fold: "sum", over })
|
|
26
|
-
});
|
|
37
|
+
return aggregate("sum", over, undefined);
|
|
27
38
|
}
|
|
39
|
+
/** Minimum over an orderable variable or the measure (orderable types only). */
|
|
28
40
|
function min(over) {
|
|
29
|
-
return
|
|
30
|
-
aggregate: Object.freeze({ op: "fold", fold: "min", over })
|
|
31
|
-
});
|
|
41
|
+
return aggregate("min", over, undefined);
|
|
32
42
|
}
|
|
43
|
+
/** Maximum over an orderable variable or the measure (orderable types only). */
|
|
33
44
|
function max(over) {
|
|
34
|
-
return
|
|
35
|
-
aggregate: Object.freeze({ op: "fold", fold: "max", over })
|
|
36
|
-
});
|
|
45
|
+
return aggregate("max", over, undefined);
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
39
48
|
* Arg-restriction toward the maximum of `key` (`ir::AggOp::ArgMax`): the
|
|
@@ -43,16 +52,12 @@ function max(over) {
|
|
|
43
52
|
* direction; Arg and fold aggregates never mix (both the engine's typed
|
|
44
53
|
* rules).
|
|
45
54
|
*/
|
|
46
|
-
function
|
|
47
|
-
return
|
|
48
|
-
aggregate: Object.freeze({ op: "arg", direction: "argMax", key, over: value })
|
|
49
|
-
});
|
|
55
|
+
function argMax(value, key) {
|
|
56
|
+
return aggregate("argMax", value, key);
|
|
50
57
|
}
|
|
51
|
-
/** Arg-restriction toward the minimum of `key`; rules as {@link
|
|
52
|
-
function
|
|
53
|
-
return
|
|
54
|
-
aggregate: Object.freeze({ op: "arg", direction: "argMin", key, over: value })
|
|
55
|
-
});
|
|
58
|
+
/** Arg-restriction toward the minimum of `key`; rules as {@link argMax}. */
|
|
59
|
+
function argMin(value, key) {
|
|
60
|
+
return aggregate("argMin", value, key);
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
58
63
|
* The coalescing fold (Snodgrass coalesce, `ir::AggOp::Pack`): per group,
|
|
@@ -63,7 +68,7 @@ function argmin(key, value) {
|
|
|
63
68
|
* fold or an Arg entry (the engine's typed rules).
|
|
64
69
|
*/
|
|
65
70
|
function pack(over) {
|
|
66
|
-
return
|
|
71
|
+
return aggregate("pack", over, undefined);
|
|
67
72
|
}
|
|
68
|
-
export {
|
|
73
|
+
export { argMax, argMin, count, countDistinct, max, min, pack, sum };
|
|
69
74
|
//# sourceMappingURL=select.js.map
|
package/dist/query/select.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/query/select.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/query/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA+BH,kCAAkC;AAClC,SAAS,SAAS,CAIhB,EAAM,EAAE,IAAU,EAAE,GAAQ;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;AAC7C,CAAC;AAED,gHAAgH;AAChH,SAAS,KAAK;IACb,OAAO,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAChD,CAAC;AAED,qGAAqG;AACrG,SAAS,aAAa,CAAyB,IAAO;IACrD,OAAO,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AACnD,CAAC;AAED;;;;;GAKG;AACH,SAAS,GAAG,CAA4C,IAAO;IAC9D,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AACzC,CAAC;AAED,gFAAgF;AAChF,SAAS,GAAG,CAA4C,IAAO;IAC9D,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AACzC,CAAC;AAED,gFAAgF;AAChF,SAAS,GAAG,CAA4C,IAAO;IAC9D,OAAO,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,MAAM,CAAiD,KAAQ,EAAE,GAAM;IAC/E,OAAO,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;AACvC,CAAC;AAED,4EAA4E;AAC5E,SAAS,MAAM,CAAiD,KAAQ,EAAE,GAAM;IAC/E,OAAO,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;AACvC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,IAAI,CAAyB,IAAO;IAC5C,OAAO,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAA;AAC1C,CAAC;AAqGD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA"}
|
package/dist/relation.d.ts
CHANGED
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `relation()` — the ordinary-relation half of the theory's signature. A
|
|
3
3
|
* relation value is a frozen plain object carrying its name, its ordered
|
|
4
|
-
* field
|
|
5
|
-
* field references (`R.fields.holder`), and — since selections are
|
|
6
|
-
* relation's own vocabulary — `where()`, which resolves a selection
|
|
7
|
-
* lowered bindings eagerly (handles
|
|
4
|
+
* field descriptors (declaration order = ordinal ids, the macro's law),
|
|
5
|
+
* typed field references (`R.fields.holder`), and — since selections are
|
|
6
|
+
* the relation's own vocabulary — `where()`, which resolves a selection
|
|
7
|
+
* into lowered bindings eagerly (handles verified against their roster at
|
|
8
8
|
* construction). `Fact<>`/`InsertFact<>` are the inferred row object
|
|
9
|
-
* types
|
|
10
|
-
*
|
|
9
|
+
* types at BARE structural value types (no brands): fresh fields are
|
|
10
|
+
* optional on insert input (omit-to-mint) and present on read
|
|
11
|
+
* (resupply-to-preserve-identity), typed exactly.
|
|
11
12
|
*/
|
|
12
|
-
import { phantom } from "#brand.ts";
|
|
13
13
|
import type { OneOf } from "#face.ts";
|
|
14
|
-
import { type AnyField, type
|
|
14
|
+
import { type AnyField, type Infer } from "#fields.ts";
|
|
15
15
|
import type { LiteralSetSpec } from "#spec.ts";
|
|
16
16
|
/** Flattens an intersection into one displayed object type (hover legibility). */
|
|
17
17
|
type Flatten<T> = {
|
|
18
18
|
[K in keyof T]: T[K];
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Resolves a whole `where()` selection against the declared fields, in the
|
|
22
|
+
* selection's written order (macro parity: σ is spelled, not sorted). An
|
|
23
|
+
* empty selection is the bare relation respelled and rejected (the
|
|
24
|
+
* canonical-utterance law). THE one selection resolver — `closed()`'s
|
|
25
|
+
* `where()` resolves its payload columns through this same machine (a
|
|
26
|
+
* `ClosedColumn` is structurally a {@link RelationField}), so both surfaces
|
|
27
|
+
* share one vocabulary and one error voice.
|
|
28
|
+
*/
|
|
29
|
+
declare function resolveSelection(name: string, ordered: readonly RelationField[], entries: ReadonlyArray<readonly [string, unknown]>): readonly SelectionBinding[];
|
|
30
|
+
/** The field block of a relation: field name to field descriptor. */
|
|
21
31
|
type FieldsShape = Record<string, AnyField>;
|
|
22
32
|
/**
|
|
23
33
|
* A typed field reference (`Account.fields.holder`) — the value statements,
|
|
24
|
-
* selections, and queries address a field through
|
|
25
|
-
* field's
|
|
34
|
+
* selections, and queries address a field through. Purely positional
|
|
35
|
+
* (relation name + field name); the field's descriptor is read off the
|
|
36
|
+
* relation's schema type structurally.
|
|
26
37
|
*/
|
|
27
|
-
interface FieldRef<Rel extends string, Name extends string
|
|
38
|
+
interface FieldRef<Rel extends string, Name extends string> {
|
|
28
39
|
readonly relation: Rel;
|
|
29
40
|
readonly field: Name;
|
|
30
|
-
readonly [phantom]?: V;
|
|
31
41
|
}
|
|
32
42
|
/** The typed field-reference record of a relation. */
|
|
33
43
|
type FieldRefs<RName extends string, Fields extends FieldsShape> = {
|
|
34
|
-
readonly [K in keyof Fields & string]: FieldRef<RName, K
|
|
44
|
+
readonly [K in keyof Fields & string]: FieldRef<RName, K>;
|
|
35
45
|
};
|
|
36
|
-
/** One declared field: name plus its
|
|
46
|
+
/** One declared field: name plus its descriptor, in declaration order. */
|
|
37
47
|
interface RelationField {
|
|
38
48
|
readonly name: string;
|
|
39
|
-
readonly field:
|
|
49
|
+
readonly field: AnyField;
|
|
40
50
|
}
|
|
41
51
|
/** A relation's runtime description. */
|
|
42
52
|
interface RelationData {
|
|
@@ -53,15 +63,14 @@ interface SelectionBinding {
|
|
|
53
63
|
readonly set: LiteralSetSpec;
|
|
54
64
|
}
|
|
55
65
|
/**
|
|
56
|
-
* The `where()` argument: per field, a
|
|
57
|
-
* type (a closed handle constant IS such a literal —
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* parameter exists anywhere.
|
|
66
|
+
* The `where()` argument: per field, a bare structural literal of that
|
|
67
|
+
* field's value type (a closed handle constant IS such a literal — a
|
|
68
|
+
* bigint verified against the roster at construction), an `oneOf(a, b,
|
|
69
|
+
* ...)` literal set, or a `span(start, end)` interval literal.
|
|
70
|
+
* Equality-only by construction: no operator parameter exists anywhere.
|
|
62
71
|
*/
|
|
63
72
|
type SelectionInput<Fields extends FieldsShape> = {
|
|
64
|
-
readonly [K in keyof Fields]?:
|
|
73
|
+
readonly [K in keyof Fields]?: Infer<Fields[K]> | OneOf<Infer<Fields[K]>>;
|
|
65
74
|
};
|
|
66
75
|
/** A relation with a selection applied — what `on()` consumes as a σ-carrying source. */
|
|
67
76
|
interface Selected<Name extends string, Fields extends FieldsShape> {
|
|
@@ -83,22 +92,20 @@ interface AnySelected {
|
|
|
83
92
|
readonly selection: readonly SelectionBinding[];
|
|
84
93
|
}
|
|
85
94
|
/** Extracts a relation's field block type. */
|
|
86
|
-
type RelationFields<R extends AnyRelation> = R extends Relation<string, infer F> ? F : never;
|
|
95
|
+
type RelationFields<R extends AnyRelation> = R extends Relation<string, infer F extends FieldsShape> ? F : never;
|
|
87
96
|
/**
|
|
88
97
|
* The inferred row object type of a relation as READ: every field present,
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* shape.
|
|
98
|
+
* at its BARE structural value type ({@link Infer}). Closed relations have
|
|
99
|
+
* no `Fact` — they are unwritable, and the type constraint refuses them
|
|
100
|
+
* because a closed value lacks the relation shape.
|
|
92
101
|
*/
|
|
93
102
|
type Fact<R extends AnyRelation> = {
|
|
94
|
-
[K in keyof RelationFields<R>]:
|
|
103
|
+
[K in keyof RelationFields<R>]: Infer<RelationFields<R>[K]>;
|
|
95
104
|
};
|
|
96
|
-
/** The field names of `R`
|
|
105
|
+
/** The field names of `R` whose descriptor type carries the fresh mint mark. */
|
|
97
106
|
type FreshKeys<R extends AnyRelation> = {
|
|
98
107
|
[K in keyof RelationFields<R>]: RelationFields<R>[K] extends {
|
|
99
|
-
readonly
|
|
100
|
-
readonly minted: true;
|
|
101
|
-
};
|
|
108
|
+
readonly fresh: true;
|
|
102
109
|
} ? K : never;
|
|
103
110
|
}[keyof RelationFields<R>];
|
|
104
111
|
/**
|
|
@@ -108,13 +115,16 @@ type FreshKeys<R extends AnyRelation> = {
|
|
|
108
115
|
*/
|
|
109
116
|
type InsertFact<R extends AnyRelation> = Flatten<Omit<Fact<R>, FreshKeys<R>> & Partial<Pick<Fact<R>, FreshKeys<R>>>>;
|
|
110
117
|
/**
|
|
111
|
-
* Declares one relation: `relation("Account", { id:
|
|
112
|
-
* holder:
|
|
113
|
-
* (
|
|
114
|
-
*
|
|
115
|
-
*
|
|
118
|
+
* Declares one relation: `relation("Account", { id: u64.fresh,
|
|
119
|
+
* holder: u64, kind: Kind.id, ... })` — every field is a pure-structure
|
|
120
|
+
* descriptor (the constructor values themselves; domains are never
|
|
121
|
+
* declared: `schema()` computes them from the statements). Field
|
|
122
|
+
* declaration order is ordinal-id order (macro parity), carried at BOTH
|
|
123
|
+
* levels: the type level by the fields object, the value level by the
|
|
124
|
+
* frozen `data.fields` list — the law the schema-level class naming leans
|
|
125
|
+
* on. The returned value is frozen and side-effect free.
|
|
116
126
|
*/
|
|
117
127
|
declare function relation<const Name extends string, Fields extends FieldsShape>(name: Name, fields: Fields): Relation<Name, Fields>;
|
|
118
128
|
export type { AnyRelation, AnySelected, Fact, FieldRef, FieldRefs, FieldsShape, FreshKeys, InsertFact, Relation, RelationData, RelationField, RelationFields, Selected, SelectionBinding, SelectionInput };
|
|
119
|
-
export { relation };
|
|
129
|
+
export { relation, resolveSelection };
|
|
120
130
|
//# sourceMappingURL=relation.d.ts.map
|
package/dist/relation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,KAAK,QAAQ,EAA6B,KAAK,KAAK,EAAa,MAAM,YAAY,CAAA;AAC5F,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,UAAU,CAAA;AAE3D,kFAAkF;AAClF,KAAK,OAAO,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MA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C,CAAC,CAAC,CAAC,CAAC;CAC3D,CAAA;AAED,gFAAgF;AAChF,KAAK,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI;KACtC,CAAC,IAAI,MAAM,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG,CAAC,GAAG,KAAK;CACjG,CAAC,MAAM,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAE1B;;;;GAIG;AACH,KAAK,UAAU,CAAC,CAAC,SAAS,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpH;;;;;;;;;GASG;AACH,iBAAS,QAAQ,CAAC,KAAK,CAAC,IAAI,SAAS,MAAM,EAAE,MAAM,SAAS,WAAW,EACtE,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACZ,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CA6BxB;AAED,YAAY,EACX,WAAW,EACX,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,CAAA;AACD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
|
package/dist/relation.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `relation()` — the ordinary-relation half of the theory's signature. A
|
|
3
3
|
* relation value is a frozen plain object carrying its name, its ordered
|
|
4
|
-
* field
|
|
5
|
-
* field references (`R.fields.holder`), and — since selections are
|
|
6
|
-
* relation's own vocabulary — `where()`, which resolves a selection
|
|
7
|
-
* lowered bindings eagerly (handles
|
|
4
|
+
* field descriptors (declaration order = ordinal ids, the macro's law),
|
|
5
|
+
* typed field references (`R.fields.holder`), and — since selections are
|
|
6
|
+
* the relation's own vocabulary — `where()`, which resolves a selection
|
|
7
|
+
* into lowered bindings eagerly (handles verified against their roster at
|
|
8
8
|
* construction). `Fact<>`/`InsertFact<>` are the inferred row object
|
|
9
|
-
* types
|
|
10
|
-
*
|
|
9
|
+
* types at BARE structural value types (no brands): fresh fields are
|
|
10
|
+
* optional on insert input (omit-to-mint) and present on read
|
|
11
|
+
* (resupply-to-preserve-identity), typed exactly.
|
|
11
12
|
*/
|
|
12
13
|
import * as errors from "@superbuilders/errors";
|
|
13
|
-
import { phantom } from "#brand.ts";
|
|
14
14
|
import { assertDeclarationOrderKey, literalOf } from "#fields.ts";
|
|
15
15
|
/**
|
|
16
|
-
* The one
|
|
16
|
+
* The one trusted seam of `relation()`: the reference record is built by
|
|
17
17
|
* iterating the declared fields, and this guard verifies the checkable
|
|
18
18
|
* facts — one reference per declared field, each carrying its own name —
|
|
19
|
-
* before the record is admitted as the typed {@link FieldRefs}
|
|
20
|
-
*
|
|
21
|
-
* module's single trusted seam, the macro-emission analog.
|
|
19
|
+
* before the record is admitted as the typed {@link FieldRefs} (the
|
|
20
|
+
* macro-emission analog).
|
|
22
21
|
*/
|
|
23
22
|
function refsComplete(refs, fields) {
|
|
24
23
|
return Object.keys(fields).every(function hasRef(fieldName) {
|
|
@@ -46,7 +45,10 @@ function resolveEntry(field, entry) {
|
|
|
46
45
|
* Resolves a whole `where()` selection against the declared fields, in the
|
|
47
46
|
* selection's written order (macro parity: σ is spelled, not sorted). An
|
|
48
47
|
* empty selection is the bare relation respelled and rejected (the
|
|
49
|
-
* canonical-utterance law).
|
|
48
|
+
* canonical-utterance law). THE one selection resolver — `closed()`'s
|
|
49
|
+
* `where()` resolves its payload columns through this same machine (a
|
|
50
|
+
* `ClosedColumn` is structurally a {@link RelationField}), so both surfaces
|
|
51
|
+
* share one vocabulary and one error voice.
|
|
50
52
|
*/
|
|
51
53
|
function resolveSelection(name, ordered, entries) {
|
|
52
54
|
const bindings = [];
|
|
@@ -68,17 +70,20 @@ function resolveSelection(name, ordered, entries) {
|
|
|
68
70
|
return Object.freeze(bindings);
|
|
69
71
|
}
|
|
70
72
|
/**
|
|
71
|
-
* Declares one relation: `relation("Account", { id:
|
|
72
|
-
* holder:
|
|
73
|
-
* (
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* Declares one relation: `relation("Account", { id: u64.fresh,
|
|
74
|
+
* holder: u64, kind: Kind.id, ... })` — every field is a pure-structure
|
|
75
|
+
* descriptor (the constructor values themselves; domains are never
|
|
76
|
+
* declared: `schema()` computes them from the statements). Field
|
|
77
|
+
* declaration order is ordinal-id order (macro parity), carried at BOTH
|
|
78
|
+
* levels: the type level by the fields object, the value level by the
|
|
79
|
+
* frozen `data.fields` list — the law the schema-level class naming leans
|
|
80
|
+
* on. The returned value is frozen and side-effect free.
|
|
76
81
|
*/
|
|
77
82
|
function relation(name, fields) {
|
|
78
83
|
const ordered = [];
|
|
79
84
|
for (const [fieldName, field] of Object.entries(fields)) {
|
|
80
85
|
assertDeclarationOrderKey(`relation ${name} field`, fieldName);
|
|
81
|
-
ordered.push(Object.freeze({ name: fieldName, field
|
|
86
|
+
ordered.push(Object.freeze({ name: fieldName, field }));
|
|
82
87
|
}
|
|
83
88
|
const data = Object.freeze({ name, fields: Object.freeze(ordered) });
|
|
84
89
|
const refs = {};
|
|
@@ -104,5 +109,5 @@ function relation(name, fields) {
|
|
|
104
109
|
holder.value = value;
|
|
105
110
|
return value;
|
|
106
111
|
}
|
|
107
|
-
export { relation };
|
|
112
|
+
export { relation, resolveSelection };
|
|
108
113
|
//# sourceMappingURL=relation.js.map
|
package/dist/relation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRo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ACD,MAAM,KAAK,GAA2B,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IACxF,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,OAAO,KAAK,CAAA;AACb,CAAC;AAmBD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -9,20 +9,49 @@
|
|
|
9
9
|
* same judge, the same two-boundary split as Rust.
|
|
10
10
|
*/
|
|
11
11
|
import type { AnyClosed } from "#closed.ts";
|
|
12
|
+
import { type ClassesOf, type LawfulStatements, type SchemaClasses } from "#law.ts";
|
|
12
13
|
import type { AnyRelation } from "#relation.ts";
|
|
13
14
|
import { type Statement } from "#statements.ts";
|
|
14
15
|
/** One member of a schema's relation record. */
|
|
15
16
|
type SchemaRelation = AnyRelation | AnyClosed;
|
|
16
17
|
/** The relation record a schema is generic over — what `Db` and queries key on. */
|
|
17
18
|
type SchemaRelations = Record<string, SchemaRelation>;
|
|
18
|
-
/**
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* A theory value: named relations, the DECLARED dependency statements, and
|
|
21
|
+
* the LAW-COMPUTED class map (`classes` — relation → field → class name,
|
|
22
|
+
* `undefined` = bare). The class map is THE domain authority: `schema()`
|
|
23
|
+
* computes it FROM the statement list at both tiers (the type through
|
|
24
|
+
* {@link ClassesOf}, the value through the union-find twin), queries
|
|
25
|
+
* compare class names off it, and the wire lowering emits it as the spec
|
|
26
|
+
* `newtype` labels. Nothing is ever synthesized: `statements` is exactly
|
|
27
|
+
* the declared list, in written order.
|
|
28
|
+
*/
|
|
29
|
+
interface Schema<Rels extends SchemaRelations, Classes extends SchemaClasses = SchemaClasses> {
|
|
20
30
|
readonly name: string;
|
|
21
31
|
readonly relations: Rels;
|
|
22
32
|
readonly statements: readonly Statement[];
|
|
33
|
+
readonly classes: Classes;
|
|
23
34
|
}
|
|
24
35
|
/** Any schema value, whatever its relation record. */
|
|
25
36
|
type AnySchema = Schema<SchemaRelations>;
|
|
37
|
+
/**
|
|
38
|
+
* Forces the class map to EVALUATE at the `schema()` boundary: a two-level
|
|
39
|
+
* mapped copy, type-identical to `C` — but instantiation resolves it to
|
|
40
|
+
* the finished relation → field → class record, so hovering a schema value
|
|
41
|
+
* (or anything carrying its `Classes` parameter — queries, `Db`) shows the
|
|
42
|
+
* computed record instead of the unevaluated `ClassesOf<...>` application
|
|
43
|
+
* dragging the whole statement-tuple type along. The conditional wrapper
|
|
44
|
+
* is the display mechanism, not a judgment: resolving it drops the alias
|
|
45
|
+
* reference, so tsc renders the finished record (measured against tsc's
|
|
46
|
+
* own type rendering; a bare mapped alias still displays by name).
|
|
47
|
+
* Display-only by construction; `classesComplete` guards the same type at
|
|
48
|
+
* the value tier.
|
|
49
|
+
*/
|
|
50
|
+
type EvaluatedClasses<C extends SchemaClasses> = C extends SchemaClasses ? {
|
|
51
|
+
readonly [N in keyof C]: {
|
|
52
|
+
readonly [F in keyof C[N]]: C[N][F];
|
|
53
|
+
};
|
|
54
|
+
} : never;
|
|
26
55
|
/**
|
|
27
56
|
* Assembles a theory:
|
|
28
57
|
* `schema("Ledger", { Kind, Account, Holder }, [ ...statements ])`.
|
|
@@ -43,8 +72,17 @@ type AnySchema = Schema<SchemaRelations>;
|
|
|
43
72
|
* list: the engine materializes them itself, in its own pinned order
|
|
44
73
|
* (`SchemaDescriptor::materialized_statements`), and restating them would
|
|
45
74
|
* double them.
|
|
75
|
+
*
|
|
76
|
+
* THE LAW-TYPING happens here too (rulings 2/3 — the laws type the
|
|
77
|
+
* columns): the statement list induces the equivalence classes over field
|
|
78
|
+
* slots, at the TYPE level ({@link ClassesOf} — spell the statement list
|
|
79
|
+
* inline so the tuple type stays precise) and at runtime (the union-find
|
|
80
|
+
* twin), and the one-generator-per-class wall holds at both tiers — the
|
|
81
|
+
* {@link LawfulStatements} verdict lands the compile error on the
|
|
82
|
+
* statements argument; `computeClasses` throws the same content naming the
|
|
83
|
+
* exact statement.
|
|
46
84
|
*/
|
|
47
|
-
declare function schema<const Rels extends SchemaRelations>(name: string, relations: Rels, statements:
|
|
85
|
+
declare function schema<const Rels extends SchemaRelations, const Stmts extends readonly Statement[]>(name: string, relations: Rels, statements: Stmts & LawfulStatements<Rels, Stmts>): Schema<Rels, EvaluatedClasses<ClassesOf<Rels, Stmts>>>;
|
|
48
86
|
export type { AnySchema, Schema, SchemaRelation, SchemaRelations };
|
|
49
87
|
export { schema };
|
|
50
88
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG3C,OAAO,EAAE,KAAK,SAAS,EAAmC,KAAK,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AACpH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAkOhE,gDAAgD;AAChD,KAAK,cAAc,GAAG,WAAW,GAAG,SAAS,CAAA;AAE7C,mFAAmF;AACnF,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAErD;;;;;;;;;GASG;AACH,UAAU,MAAM,CA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{ classesComplete, computeClasses } from "#law.ts";
|
|
13
14
|
import { renderStatement } from "#statements.ts";
|
|
14
15
|
/**
|
|
15
16
|
* Validates the relation record and collects the implied keys: the
|
|
@@ -30,7 +31,7 @@ function collectImplied(name, relations) {
|
|
|
30
31
|
continue;
|
|
31
32
|
}
|
|
32
33
|
for (const declared of member.data.fields) {
|
|
33
|
-
if (declared.field.
|
|
34
|
+
if ("fresh" in declared.field && declared.field.fresh === true) {
|
|
34
35
|
implied.add(`${member.name}(${declared.name}) -> ${member.name}`);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
@@ -61,7 +62,7 @@ function verifyMembership(name, relations, statement, rendered) {
|
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
|
-
/** Finds a face's field
|
|
65
|
+
/** Finds a face's field descriptor by name, across both relation kinds. */
|
|
65
66
|
function faceField(face, fieldName) {
|
|
66
67
|
const data = face.owner.data;
|
|
67
68
|
if ("handles" in data) {
|
|
@@ -75,6 +76,17 @@ function faceField(face, fieldName) {
|
|
|
75
76
|
});
|
|
76
77
|
return declared?.field;
|
|
77
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* The roster a field resolves handles through: present exactly on a closed
|
|
81
|
+
* reference descriptor (the structural `closed` property — S1's
|
|
82
|
+
* `ClosedIdField`), absent on every other field kind.
|
|
83
|
+
*/
|
|
84
|
+
function rosterOf(field) {
|
|
85
|
+
if (field !== undefined && "closed" in field) {
|
|
86
|
+
return field.closed;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
78
90
|
/** Flattens one binding's literal set into its literals. */
|
|
79
91
|
function bindingLiterals(set) {
|
|
80
92
|
if (set.kind === "one") {
|
|
@@ -89,16 +101,16 @@ function bindingLiterals(set) {
|
|
|
89
101
|
* engine boundary with a colder message.
|
|
90
102
|
*/
|
|
91
103
|
function verifyBindingHandles(name, face, binding, rendered) {
|
|
92
|
-
const
|
|
104
|
+
const roster = rosterOf(faceField(face, binding.field));
|
|
93
105
|
for (const literal of bindingLiterals(binding.set)) {
|
|
94
106
|
if (literal.kind !== "handle") {
|
|
95
107
|
continue;
|
|
96
108
|
}
|
|
97
|
-
if (
|
|
98
|
-
throw errors.new(`schema ${name}: ${face.owner.name}.${binding.field} is not a closed-relation reference — the handle literal ${literal.handle} is legal only on a field
|
|
109
|
+
if (roster === undefined) {
|
|
110
|
+
throw errors.new(`schema ${name}: ${face.owner.name}.${binding.field} is not a closed-relation reference — the handle literal ${literal.handle} is legal only on a field carrying a closed relation's roster — ${rendered}`);
|
|
99
111
|
}
|
|
100
|
-
if (!
|
|
101
|
-
throw errors.new(`schema ${name}: closed relation ${
|
|
112
|
+
if (!roster.handles.includes(literal.handle)) {
|
|
113
|
+
throw errors.new(`schema ${name}: closed relation ${roster.name} has no handle ${literal.handle} — ${rendered}`);
|
|
102
114
|
}
|
|
103
115
|
}
|
|
104
116
|
}
|
|
@@ -180,7 +192,7 @@ function verifyClosedReferenceBinding(name, statements, face, binding, rendered)
|
|
|
180
192
|
if (!spellsHandle) {
|
|
181
193
|
return;
|
|
182
194
|
}
|
|
183
|
-
const roster = faceField(face, binding.field)
|
|
195
|
+
const roster = rosterOf(faceField(face, binding.field));
|
|
184
196
|
if (roster === undefined) {
|
|
185
197
|
return;
|
|
186
198
|
}
|
|
@@ -212,6 +224,15 @@ function verifyClosedReferenceBinding(name, statements, face, binding, rendered)
|
|
|
212
224
|
* list: the engine materializes them itself, in its own pinned order
|
|
213
225
|
* (`SchemaDescriptor::materialized_statements`), and restating them would
|
|
214
226
|
* double them.
|
|
227
|
+
*
|
|
228
|
+
* THE LAW-TYPING happens here too (rulings 2/3 — the laws type the
|
|
229
|
+
* columns): the statement list induces the equivalence classes over field
|
|
230
|
+
* slots, at the TYPE level ({@link ClassesOf} — spell the statement list
|
|
231
|
+
* inline so the tuple type stays precise) and at runtime (the union-find
|
|
232
|
+
* twin), and the one-generator-per-class wall holds at both tiers — the
|
|
233
|
+
* {@link LawfulStatements} verdict lands the compile error on the
|
|
234
|
+
* statements argument; `computeClasses` throws the same content naming the
|
|
235
|
+
* exact statement.
|
|
215
236
|
*/
|
|
216
237
|
function schema(name, relations, statements) {
|
|
217
238
|
const implied = collectImplied(name, relations);
|
|
@@ -229,7 +250,11 @@ function schema(name, relations, statements) {
|
|
|
229
250
|
verifyHandles(name, statement, rendered);
|
|
230
251
|
}
|
|
231
252
|
verifyClosedReferences(name, statements);
|
|
232
|
-
|
|
253
|
+
const classes = computeClasses(name, relations, statements);
|
|
254
|
+
if (!classesComplete(classes, relations)) {
|
|
255
|
+
throw errors.new(`schema ${name}: class-map construction incomplete`);
|
|
256
|
+
}
|
|
257
|
+
return Object.freeze({ name, relations, statements: Object.freeze([...statements]), classes });
|
|
233
258
|
}
|
|
234
259
|
export { schema };
|
|
235
260
|
//# sourceMappingURL=schema.js.map
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAG/C,OAAO,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAG/C,OAAO,EAAiB,yBAAyB,EAAqB,MAAM,YAAY,CAAA;AACxF,OAAO,EAAkB,eAAe,EAAE,cAAc,EAA6C,MAAM,SAAS,CAAA;AAGpH,OAAO,EAAE,eAAe,EAAkB,MAAM,gBAAgB,CAAA;AAEhE;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,SAA0B;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAA;IACjC,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAA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