@bjornpagen/bumbledb 0.1.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/LICENSE +12 -0
- package/README.md +84 -0
- package/dist/brand.d.ts +59 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +47 -0
- package/dist/brand.js.map +1 -0
- package/dist/closed.d.ts +97 -0
- package/dist/closed.d.ts.map +1 -0
- package/dist/closed.js +107 -0
- package/dist/closed.js.map +1 -0
- package/dist/count.d.ts +55 -0
- package/dist/count.d.ts.map +1 -0
- package/dist/count.js +92 -0
- package/dist/count.js.map +1 -0
- package/dist/db.d.ts +341 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +1016 -0
- package/dist/db.js.map +1 -0
- package/dist/exhume.d.ts +130 -0
- package/dist/exhume.d.ts.map +1 -0
- package/dist/exhume.js +145 -0
- package/dist/exhume.js.map +1 -0
- package/dist/face.d.ts +91 -0
- package/dist/face.d.ts.map +1 -0
- package/dist/face.js +69 -0
- package/dist/face.js.map +1 -0
- package/dist/fields.d.ts +187 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +204 -0
- package/dist/fields.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/lower.d.ts +34 -0
- package/dist/lower.d.ts.map +1 -0
- package/dist/lower.js +105 -0
- package/dist/lower.js.map +1 -0
- package/dist/marshal.d.ts +79 -0
- package/dist/marshal.d.ts.map +1 -0
- package/dist/marshal.js +167 -0
- package/dist/marshal.js.map +1 -0
- package/dist/native.d.ts +532 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +64 -0
- package/dist/native.js.map +1 -0
- package/dist/query/atom.d.ts +285 -0
- package/dist/query/atom.d.ts.map +1 -0
- package/dist/query/atom.js +281 -0
- package/dist/query/atom.js.map +1 -0
- package/dist/query/lower.d.ts +145 -0
- package/dist/query/lower.d.ts.map +1 -0
- package/dist/query/lower.js +604 -0
- package/dist/query/lower.js.map +1 -0
- package/dist/query/predicate.d.ts +101 -0
- package/dist/query/predicate.d.ts.map +1 -0
- package/dist/query/predicate.js +85 -0
- package/dist/query/predicate.js.map +1 -0
- package/dist/query/run.d.ts +30 -0
- package/dist/query/run.d.ts.map +1 -0
- package/dist/query/run.js +94 -0
- package/dist/query/run.js.map +1 -0
- package/dist/query/scope.d.ts +168 -0
- package/dist/query/scope.d.ts.map +1 -0
- package/dist/query/scope.js +134 -0
- package/dist/query/scope.js.map +1 -0
- package/dist/query/select.d.ts +106 -0
- package/dist/query/select.d.ts.map +1 -0
- package/dist/query/select.js +69 -0
- package/dist/query/select.js.map +1 -0
- package/dist/relation.d.ts +120 -0
- package/dist/relation.d.ts.map +1 -0
- package/dist/relation.js +108 -0
- package/dist/relation.js.map +1 -0
- package/dist/schema.d.ts +50 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +235 -0
- package/dist/schema.js.map +1 -0
- package/dist/spec.d.ts +218 -0
- package/dist/spec.d.ts.map +1 -0
- package/dist/spec.js +154 -0
- package/dist/spec.js.map +1 -0
- package/dist/statements.d.ts +91 -0
- package/dist/statements.d.ts.map +1 -0
- package/dist/statements.js +101 -0
- package/dist/statements.js.map +1 -0
- package/package.json +66 -0
- package/src/brand.ts +82 -0
- package/src/closed.ts +228 -0
- package/src/count.ts +117 -0
- package/src/db.ts +1519 -0
- package/src/exhume.ts +243 -0
- package/src/face.ts +161 -0
- package/src/fields.ts +385 -0
- package/src/index.ts +185 -0
- package/src/lower.ts +118 -0
- package/src/marshal.ts +220 -0
- package/src/native.ts +576 -0
- package/src/query/atom.ts +556 -0
- package/src/query/lower.ts +855 -0
- package/src/query/predicate.ts +195 -0
- package/src/query/run.ts +106 -0
- package/src/query/scope.ts +301 -0
- package/src/query/select.ts +140 -0
- package/src/relation.ts +252 -0
- package/src/schema.ts +297 -0
- package/src/spec.ts +325 -0
- package/src/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4
|
+
* `AggOp`/`FindTerm`; `docs/architecture/20-query-ir.md` § aggregation):
|
|
5
|
+
* `count` (nullary), `countDistinct`, `sum`/`min`/`max` (over a u64/i64
|
|
6
|
+
* variable or the measure), `argmax`/`argmin` (arg-restriction: carried
|
|
7
|
+
* value + orderable key; a tie yields every attaining row), and `pack`
|
|
8
|
+
* (the coalescing fold — RELATION-SHAPED: one answer row per (group,
|
|
9
|
+
* maximal segment), the result position interval-typed). Grouping is
|
|
10
|
+
* implicit: the non-aggregate select entries are the group key; over empty
|
|
11
|
+
* input an all-aggregate select yields the EMPTY SET, never a zero row.
|
|
12
|
+
*/
|
|
13
|
+
import type { IntervalValue } from "#brand.ts";
|
|
14
|
+
import { phantom } from "#brand.ts";
|
|
15
|
+
import type { Duration } from "#query/atom.ts";
|
|
16
|
+
import type { AnyVar, Flatten, Var } from "#query/scope.ts";
|
|
17
|
+
import { term } from "#query/scope.ts";
|
|
18
|
+
/** The three folds the measure admits (and the plain-variable folds). */
|
|
19
|
+
type FoldOp = "sum" | "min" | "max";
|
|
20
|
+
/** One aggregate's runtime description. */
|
|
21
|
+
type AggregateData = {
|
|
22
|
+
readonly op: "count";
|
|
23
|
+
} | {
|
|
24
|
+
readonly op: "countDistinct";
|
|
25
|
+
readonly over: AnyVar;
|
|
26
|
+
} | {
|
|
27
|
+
readonly op: "fold";
|
|
28
|
+
readonly fold: FoldOp;
|
|
29
|
+
readonly over: AnyVar | Duration;
|
|
30
|
+
} | {
|
|
31
|
+
readonly op: "arg";
|
|
32
|
+
readonly direction: "argMax" | "argMin";
|
|
33
|
+
readonly key: AnyVar;
|
|
34
|
+
readonly over: AnyVar;
|
|
35
|
+
} | {
|
|
36
|
+
readonly op: "pack";
|
|
37
|
+
readonly over: AnyVar;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* One aggregate select value; the phantom carries the answer column's
|
|
41
|
+
* host type (`count`/`countDistinct` → `bigint` whatever they counted;
|
|
42
|
+
* folds carry their input's type; the Arg forms the carried payload's
|
|
43
|
+
* type; `pack` its interval type).
|
|
44
|
+
*/
|
|
45
|
+
interface Aggregate<R> {
|
|
46
|
+
readonly aggregate: AggregateData;
|
|
47
|
+
readonly [phantom]?: R;
|
|
48
|
+
}
|
|
49
|
+
/** What a select record's values may be: a projection, a measure, or an aggregate. */
|
|
50
|
+
type SelectEntryInput = AnyVar | Duration | Aggregate<unknown>;
|
|
51
|
+
/** The select record: answer column name to entry, written order = column order. */
|
|
52
|
+
type SelectShape = Readonly<Record<string, SelectEntryInput>>;
|
|
53
|
+
/** One select entry's answer type. */
|
|
54
|
+
type SelectValue<T> = T extends {
|
|
55
|
+
readonly aggregate: AggregateData;
|
|
56
|
+
readonly [phantom]?: infer R;
|
|
57
|
+
} ? Exclude<R, undefined> : T extends {
|
|
58
|
+
readonly measure: AnyVar;
|
|
59
|
+
} ? bigint : T extends {
|
|
60
|
+
readonly [term]: "var";
|
|
61
|
+
readonly [phantom]?: infer V;
|
|
62
|
+
} ? Exclude<V, undefined> : never;
|
|
63
|
+
/** The inferred answer-row object type of a select record. */
|
|
64
|
+
type RowOf<Sel extends SelectShape> = Flatten<{
|
|
65
|
+
[K in keyof Sel]: SelectValue<Sel[K]>;
|
|
66
|
+
}>;
|
|
67
|
+
/** Nullary count: |the group's set of distinct full bindings|, `bigint`. */
|
|
68
|
+
declare function count(): Aggregate<bigint>;
|
|
69
|
+
/** |the distinct values of `over` across the group|, `bigint`; legal over every type. */
|
|
70
|
+
declare function countDistinct<V>(over: Var<V>): Aggregate<bigint>;
|
|
71
|
+
/**
|
|
72
|
+
* Exact checked sum over a u64/i64 variable (wide accumulator, one
|
|
73
|
+
* finalize range check — overflow is the engine's typed runtime error,
|
|
74
|
+
* never a wrap), or over the measure (`sum(duration(v))`).
|
|
75
|
+
*/
|
|
76
|
+
declare function sum<V extends bigint>(over: Var<V>): Aggregate<V>;
|
|
77
|
+
declare function sum(over: Duration): Aggregate<bigint>;
|
|
78
|
+
/** Minimum over a u64/i64 variable or the measure (orderable types only). */
|
|
79
|
+
declare function min<V extends bigint>(over: Var<V>): Aggregate<V>;
|
|
80
|
+
declare function min(over: Duration): Aggregate<bigint>;
|
|
81
|
+
/** Maximum over a u64/i64 variable or the measure (orderable types only). */
|
|
82
|
+
declare function max<V extends bigint>(over: Var<V>): Aggregate<V>;
|
|
83
|
+
declare function max(over: Duration): Aggregate<bigint>;
|
|
84
|
+
/**
|
|
85
|
+
* Arg-restriction toward the maximum of `key` (`ir::AggOp::ArgMax`): the
|
|
86
|
+
* group's binding set is restricted to the bindings attaining the extreme
|
|
87
|
+
* of the orderable key, and `value` is the carried payload — a tie yields
|
|
88
|
+
* every attaining row. All Arg entries of one query share one key and one
|
|
89
|
+
* direction; Arg and fold aggregates never mix (both the engine's typed
|
|
90
|
+
* rules).
|
|
91
|
+
*/
|
|
92
|
+
declare function argmax<K extends bigint, V>(key: Var<K>, value: Var<V>): Aggregate<V>;
|
|
93
|
+
/** Arg-restriction toward the minimum of `key`; rules as {@link argmax}. */
|
|
94
|
+
declare function argmin<K extends bigint, V>(key: Var<K>, value: Var<V>): Aggregate<V>;
|
|
95
|
+
/**
|
|
96
|
+
* The coalescing fold (Snodgrass coalesce, `ir::AggOp::Pack`): per group,
|
|
97
|
+
* the maximal disjoint half-open segments of the union of the group's
|
|
98
|
+
* interval point sets — RELATION-SHAPED, one answer row per (group,
|
|
99
|
+
* maximal segment), the result position carrying one interval of the
|
|
100
|
+
* input's element type. At most one `pack` per select, never beside a
|
|
101
|
+
* fold or an Arg entry (the engine's typed rules).
|
|
102
|
+
*/
|
|
103
|
+
declare function pack<IV extends IntervalValue>(over: Var<IV>): Aggregate<IV>;
|
|
104
|
+
export type { Aggregate, AggregateData, FoldOp, RowOf, SelectEntryInput, SelectShape, SelectValue };
|
|
105
|
+
export { argmax, argmin, count, countDistinct, max, min, pack, sum };
|
|
106
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Select entries and aggregates (PRD-08) — the head vocabulary, mirroring
|
|
3
|
+
* the IR's aggregate roster exactly (`bumbledb/crates/bumbledb/src/ir.rs`
|
|
4
|
+
* `AggOp`/`FindTerm`; `docs/architecture/20-query-ir.md` § aggregation):
|
|
5
|
+
* `count` (nullary), `countDistinct`, `sum`/`min`/`max` (over a u64/i64
|
|
6
|
+
* variable or the measure), `argmax`/`argmin` (arg-restriction: carried
|
|
7
|
+
* value + orderable key; a tie yields every attaining row), and `pack`
|
|
8
|
+
* (the coalescing fold — RELATION-SHAPED: one answer row per (group,
|
|
9
|
+
* maximal segment), the result position interval-typed). Grouping is
|
|
10
|
+
* implicit: the non-aggregate select entries are the group key; over empty
|
|
11
|
+
* input an all-aggregate select yields the EMPTY SET, never a zero row.
|
|
12
|
+
*/
|
|
13
|
+
import { phantom } from "#brand.ts";
|
|
14
|
+
import { term } from "#query/scope.ts";
|
|
15
|
+
/** Nullary count: |the group's set of distinct full bindings|, `bigint`. */
|
|
16
|
+
function count() {
|
|
17
|
+
return Object.freeze({ aggregate: Object.freeze({ op: "count" }) });
|
|
18
|
+
}
|
|
19
|
+
/** |the distinct values of `over` across the group|, `bigint`; legal over every type. */
|
|
20
|
+
function countDistinct(over) {
|
|
21
|
+
return Object.freeze({ aggregate: Object.freeze({ op: "countDistinct", over }) });
|
|
22
|
+
}
|
|
23
|
+
function sum(over) {
|
|
24
|
+
return Object.freeze({
|
|
25
|
+
aggregate: Object.freeze({ op: "fold", fold: "sum", over })
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function min(over) {
|
|
29
|
+
return Object.freeze({
|
|
30
|
+
aggregate: Object.freeze({ op: "fold", fold: "min", over })
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function max(over) {
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
aggregate: Object.freeze({ op: "fold", fold: "max", over })
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Arg-restriction toward the maximum of `key` (`ir::AggOp::ArgMax`): the
|
|
40
|
+
* group's binding set is restricted to the bindings attaining the extreme
|
|
41
|
+
* of the orderable key, and `value` is the carried payload — a tie yields
|
|
42
|
+
* every attaining row. All Arg entries of one query share one key and one
|
|
43
|
+
* direction; Arg and fold aggregates never mix (both the engine's typed
|
|
44
|
+
* rules).
|
|
45
|
+
*/
|
|
46
|
+
function argmax(key, value) {
|
|
47
|
+
return Object.freeze({
|
|
48
|
+
aggregate: Object.freeze({ op: "arg", direction: "argMax", key, over: value })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** Arg-restriction toward the minimum of `key`; rules as {@link argmax}. */
|
|
52
|
+
function argmin(key, value) {
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
aggregate: Object.freeze({ op: "arg", direction: "argMin", key, over: value })
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The coalescing fold (Snodgrass coalesce, `ir::AggOp::Pack`): per group,
|
|
59
|
+
* the maximal disjoint half-open segments of the union of the group's
|
|
60
|
+
* interval point sets — RELATION-SHAPED, one answer row per (group,
|
|
61
|
+
* maximal segment), the result position carrying one interval of the
|
|
62
|
+
* input's element type. At most one `pack` per select, never beside a
|
|
63
|
+
* fold or an Arg entry (the engine's typed rules).
|
|
64
|
+
*/
|
|
65
|
+
function pack(over) {
|
|
66
|
+
return Object.freeze({ aggregate: Object.freeze({ op: "pack", over }) });
|
|
67
|
+
}
|
|
68
|
+
export { argmax, argmin, count, countDistinct, max, min, pack, sum };
|
|
69
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/query/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,OAAO,EAA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AE,EAAE,EAAE,KAAc,EAAE,SAAS,EAAE,QAAiB,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;KAChG,CAAC,CAAA;AACH,CAAC;AAED,4EAA4E;AAC5E,SAAS,MAAM,CAAsB,GAAW,EAAE,KAAa;IAC9D,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAc,EAAE,SAAS,EAAE,QAAiB,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;KAChG,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,IAAI,CAA2B,IAAa;IACpD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;AAClF,CAAC;AAGD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `relation()` — the ordinary-relation half of the theory's signature. A
|
|
3
|
+
* relation value is a frozen plain object carrying its name, its ordered
|
|
4
|
+
* field metadata (declaration order = ordinal ids, the macro's law), typed
|
|
5
|
+
* field references (`R.fields.holder`), and — since selections are the
|
|
6
|
+
* relation's own vocabulary — `where()`, which resolves a selection into
|
|
7
|
+
* lowered bindings eagerly (handles re-verified against their roster at
|
|
8
|
+
* construction). `Fact<>`/`InsertFact<>` are the inferred row object
|
|
9
|
+
* types: fresh fields are optional on insert input (omit-to-mint) and
|
|
10
|
+
* present on read (resupply-to-preserve-identity), typed exactly.
|
|
11
|
+
*/
|
|
12
|
+
import { phantom } from "#brand.ts";
|
|
13
|
+
import type { OneOf } from "#face.ts";
|
|
14
|
+
import { type AnyField, type FieldData, type FieldValue } from "#fields.ts";
|
|
15
|
+
import type { LiteralSetSpec } from "#spec.ts";
|
|
16
|
+
/** Flattens an intersection into one displayed object type (hover legibility). */
|
|
17
|
+
type Flatten<T> = {
|
|
18
|
+
[K in keyof T]: T[K];
|
|
19
|
+
};
|
|
20
|
+
/** The field block of a relation: field name to field constructor value. */
|
|
21
|
+
type FieldsShape = Record<string, AnyField>;
|
|
22
|
+
/**
|
|
23
|
+
* A typed field reference (`Account.fields.holder`) — the value statements,
|
|
24
|
+
* selections, and queries address a field through; its hover shows the
|
|
25
|
+
* field's brand in the phantom position.
|
|
26
|
+
*/
|
|
27
|
+
interface FieldRef<Rel extends string, Name extends string, V> {
|
|
28
|
+
readonly relation: Rel;
|
|
29
|
+
readonly field: Name;
|
|
30
|
+
readonly [phantom]?: V;
|
|
31
|
+
}
|
|
32
|
+
/** The typed field-reference record of a relation. */
|
|
33
|
+
type FieldRefs<RName extends string, Fields extends FieldsShape> = {
|
|
34
|
+
readonly [K in keyof Fields & string]: FieldRef<RName, K, FieldValue<Fields[K]>>;
|
|
35
|
+
};
|
|
36
|
+
/** One declared field: name plus its runtime description, in declaration order. */
|
|
37
|
+
interface RelationField {
|
|
38
|
+
readonly name: string;
|
|
39
|
+
readonly field: FieldData;
|
|
40
|
+
}
|
|
41
|
+
/** A relation's runtime description. */
|
|
42
|
+
interface RelationData {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly fields: readonly RelationField[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* One resolved σ binding: the field name and its lowered literal set —
|
|
48
|
+
* handles already resolved to names, values already tagged by structural
|
|
49
|
+
* type.
|
|
50
|
+
*/
|
|
51
|
+
interface SelectionBinding {
|
|
52
|
+
readonly field: string;
|
|
53
|
+
readonly set: LiteralSetSpec;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The `where()` argument: per field, a branded literal of that field's
|
|
57
|
+
* type (a closed handle constant IS such a literal — it carries the closed
|
|
58
|
+
* relation's brand, so it is legal exactly where the field is that closed
|
|
59
|
+
* relation's id type), an `oneOf(a, b, ...)` literal set, or a `span(start,
|
|
60
|
+
* end)` interval literal. Equality-only by construction: no operator
|
|
61
|
+
* parameter exists anywhere.
|
|
62
|
+
*/
|
|
63
|
+
type SelectionInput<Fields extends FieldsShape> = {
|
|
64
|
+
readonly [K in keyof Fields]?: FieldValue<Fields[K]> | OneOf<FieldValue<Fields[K]>>;
|
|
65
|
+
};
|
|
66
|
+
/** A relation with a selection applied — what `on()` consumes as a σ-carrying source. */
|
|
67
|
+
interface Selected<Name extends string, Fields extends FieldsShape> {
|
|
68
|
+
readonly relation: Relation<Name, Fields>;
|
|
69
|
+
readonly selection: readonly SelectionBinding[];
|
|
70
|
+
}
|
|
71
|
+
/** A relation value. */
|
|
72
|
+
interface Relation<Name extends string, Fields extends FieldsShape> {
|
|
73
|
+
readonly name: Name;
|
|
74
|
+
readonly data: RelationData;
|
|
75
|
+
readonly fields: FieldRefs<Name, Fields>;
|
|
76
|
+
where(selection: SelectionInput<Fields>): Selected<Name, Fields>;
|
|
77
|
+
}
|
|
78
|
+
/** Any relation value, whatever its name and field block. */
|
|
79
|
+
type AnyRelation = Relation<string, FieldsShape>;
|
|
80
|
+
/** Any selected relation value. */
|
|
81
|
+
interface AnySelected {
|
|
82
|
+
readonly relation: AnyRelation;
|
|
83
|
+
readonly selection: readonly SelectionBinding[];
|
|
84
|
+
}
|
|
85
|
+
/** Extracts a relation's field block type. */
|
|
86
|
+
type RelationFields<R extends AnyRelation> = R extends Relation<string, infer F> ? F : never;
|
|
87
|
+
/**
|
|
88
|
+
* The inferred row object type of a relation as READ: every field present,
|
|
89
|
+
* branded. Closed relations have no `Fact` — they are unwritable, and the
|
|
90
|
+
* type constraint refuses them because a closed value lacks the relation
|
|
91
|
+
* shape.
|
|
92
|
+
*/
|
|
93
|
+
type Fact<R extends AnyRelation> = {
|
|
94
|
+
[K in keyof RelationFields<R>]: FieldValue<RelationFields<R>[K]>;
|
|
95
|
+
};
|
|
96
|
+
/** The field names of `R` that carry the fresh mint mark. */
|
|
97
|
+
type FreshKeys<R extends AnyRelation> = {
|
|
98
|
+
[K in keyof RelationFields<R>]: RelationFields<R>[K] extends {
|
|
99
|
+
readonly data: {
|
|
100
|
+
readonly minted: true;
|
|
101
|
+
};
|
|
102
|
+
} ? K : never;
|
|
103
|
+
}[keyof RelationFields<R>];
|
|
104
|
+
/**
|
|
105
|
+
* The inferred row object type of a relation as INSERTED: fresh fields
|
|
106
|
+
* optional — omitted, the engine mints; supplied, identity is preserved
|
|
107
|
+
* (the ETL resupply idiom).
|
|
108
|
+
*/
|
|
109
|
+
type InsertFact<R extends AnyRelation> = Flatten<Omit<Fact<R>, FreshKeys<R>> & Partial<Pick<Fact<R>, FreshKeys<R>>>>;
|
|
110
|
+
/**
|
|
111
|
+
* Declares one relation: `relation("Account", { id: AccountId.fresh,
|
|
112
|
+
* holder: HolderId, ... })` — every field references a declared newtype
|
|
113
|
+
* (`const AccountId = u64.newtype("AccountId")`) or a bare constructor.
|
|
114
|
+
* Field declaration order is ordinal-id order (macro parity); the returned
|
|
115
|
+
* value is frozen and side-effect free.
|
|
116
|
+
*/
|
|
117
|
+
declare function relation<const Name extends string, Fields extends FieldsShape>(name: Name, fields: Fields): Relation<Name, Fields>;
|
|
118
|
+
export type { AnyRelation, AnySelected, Fact, FieldRef, FieldRefs, FieldsShape, FreshKeys, InsertFact, Relation, RelationData, RelationField, RelationFields, Selected, SelectionBinding, SelectionInput };
|
|
119
|
+
export { relation };
|
|
120
|
+
//# sourceMappingURL=relation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACr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/**
|
|
2
|
+
* `relation()` — the ordinary-relation half of the theory's signature. A
|
|
3
|
+
* relation value is a frozen plain object carrying its name, its ordered
|
|
4
|
+
* field metadata (declaration order = ordinal ids, the macro's law), typed
|
|
5
|
+
* field references (`R.fields.holder`), and — since selections are the
|
|
6
|
+
* relation's own vocabulary — `where()`, which resolves a selection into
|
|
7
|
+
* lowered bindings eagerly (handles re-verified against their roster at
|
|
8
|
+
* construction). `Fact<>`/`InsertFact<>` are the inferred row object
|
|
9
|
+
* types: fresh fields are optional on insert input (omit-to-mint) and
|
|
10
|
+
* present on read (resupply-to-preserve-identity), typed exactly.
|
|
11
|
+
*/
|
|
12
|
+
import * as errors from "@superbuilders/errors";
|
|
13
|
+
import { phantom } from "#brand.ts";
|
|
14
|
+
import { assertDeclarationOrderKey, literalOf } from "#fields.ts";
|
|
15
|
+
/**
|
|
16
|
+
* The one nominal step of `relation()`: the reference record is built by
|
|
17
|
+
* iterating the declared fields, and this guard verifies the checkable
|
|
18
|
+
* facts — one reference per declared field, each carrying its own name —
|
|
19
|
+
* before the record is admitted as the typed {@link FieldRefs}. The
|
|
20
|
+
* phantom halves (brands) are carried by construction; this is the
|
|
21
|
+
* module's single trusted seam, the macro-emission analog.
|
|
22
|
+
*/
|
|
23
|
+
function refsComplete(refs, fields) {
|
|
24
|
+
return Object.keys(fields).every(function hasRef(fieldName) {
|
|
25
|
+
const ref = refs[fieldName];
|
|
26
|
+
return typeof ref === "object" && ref !== null && "field" in ref && ref.field === fieldName;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolves one selection entry to its lowered literal set: an `oneOf`
|
|
31
|
+
* value (detected by its `literals` tuple — no field value is ever an
|
|
32
|
+
* object carrying `literals`) becomes a disjunctive set (≥ 2 by the
|
|
33
|
+
* `oneOf` signature — the one-element set is unwritable); anything else is
|
|
34
|
+
* the bare literal.
|
|
35
|
+
*/
|
|
36
|
+
function resolveEntry(field, entry) {
|
|
37
|
+
if (typeof entry === "object" && entry !== null && "literals" in entry && Array.isArray(entry.literals)) {
|
|
38
|
+
const literals = entry.literals.map(function lowerSetLiteral(literal) {
|
|
39
|
+
return Object.freeze(literalOf(field, literal));
|
|
40
|
+
});
|
|
41
|
+
return Object.freeze({ kind: "many", literals: Object.freeze(literals) });
|
|
42
|
+
}
|
|
43
|
+
return Object.freeze({ kind: "one", literal: Object.freeze(literalOf(field, entry)) });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Resolves a whole `where()` selection against the declared fields, in the
|
|
47
|
+
* selection's written order (macro parity: σ is spelled, not sorted). An
|
|
48
|
+
* empty selection is the bare relation respelled and rejected (the
|
|
49
|
+
* canonical-utterance law).
|
|
50
|
+
*/
|
|
51
|
+
function resolveSelection(name, ordered, entries) {
|
|
52
|
+
const bindings = [];
|
|
53
|
+
for (const [fieldName, entry] of entries) {
|
|
54
|
+
if (entry === undefined) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const declared = ordered.find(function byName(candidate) {
|
|
58
|
+
return candidate.name === fieldName;
|
|
59
|
+
});
|
|
60
|
+
if (declared === undefined) {
|
|
61
|
+
throw errors.new(`relation ${name} has no field ${fieldName}`);
|
|
62
|
+
}
|
|
63
|
+
bindings.push(Object.freeze({ field: fieldName, set: resolveEntry(declared.field, entry) }));
|
|
64
|
+
}
|
|
65
|
+
if (bindings.length === 0) {
|
|
66
|
+
throw errors.new(`relation ${name}: an empty selection is the bare relation respelled — pass the relation itself (the canonical-utterance law: one meaning, one spelling)`);
|
|
67
|
+
}
|
|
68
|
+
return Object.freeze(bindings);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Declares one relation: `relation("Account", { id: AccountId.fresh,
|
|
72
|
+
* holder: HolderId, ... })` — every field references a declared newtype
|
|
73
|
+
* (`const AccountId = u64.newtype("AccountId")`) or a bare constructor.
|
|
74
|
+
* Field declaration order is ordinal-id order (macro parity); the returned
|
|
75
|
+
* value is frozen and side-effect free.
|
|
76
|
+
*/
|
|
77
|
+
function relation(name, fields) {
|
|
78
|
+
const ordered = [];
|
|
79
|
+
for (const [fieldName, field] of Object.entries(fields)) {
|
|
80
|
+
assertDeclarationOrderKey(`relation ${name} field`, fieldName);
|
|
81
|
+
ordered.push(Object.freeze({ name: fieldName, field: field.data }));
|
|
82
|
+
}
|
|
83
|
+
const data = Object.freeze({ name, fields: Object.freeze(ordered) });
|
|
84
|
+
const refs = {};
|
|
85
|
+
for (const declared of ordered) {
|
|
86
|
+
refs[declared.name] = Object.freeze({ relation: name, field: declared.name });
|
|
87
|
+
}
|
|
88
|
+
Object.freeze(refs);
|
|
89
|
+
if (!refsComplete(refs, fields)) {
|
|
90
|
+
throw errors.new(`relation ${name}: field-reference construction incomplete`);
|
|
91
|
+
}
|
|
92
|
+
const holder = { value: undefined };
|
|
93
|
+
function where(selection) {
|
|
94
|
+
const owner = holder.value;
|
|
95
|
+
if (owner === undefined) {
|
|
96
|
+
throw errors.new(`relation ${name}: self-reference read before construction completed`);
|
|
97
|
+
}
|
|
98
|
+
return Object.freeze({
|
|
99
|
+
relation: owner,
|
|
100
|
+
selection: resolveSelection(name, ordered, Object.entries(selection))
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
const value = Object.freeze({ name, data, fields: refs, where });
|
|
104
|
+
holder.value = value;
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
export { relation };
|
|
108
|
+
//# sourceMappingURL=relation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../src/relation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAiB,yBAAyB,EAAmC,SAAS,EAAE,MAAM,YAAY,CAAA;AAMjH;;;;;;;GAOG;AACH,SAAS,YAAY,CACpB,IA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@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `schema()` — assembles relations and statements into a theory value (the
|
|
3
|
+
* `Theory` analog; what `Db.create`/`Db.open` take). Construction-time
|
|
4
|
+
* validation is the macro-EXPANSION-boundary analog and nothing more:
|
|
5
|
+
* membership, implied-key duplicates, duplicate statements, and a
|
|
6
|
+
* belt-and-braces handle re-verification. Everything semantically deeper
|
|
7
|
+
* (containment targets resolving declared keys, fresh-on-u64, …) is
|
|
8
|
+
* DELIBERATELY left to the engine's `SchemaError` at `Db.create` — the
|
|
9
|
+
* same judge, the same two-boundary split as Rust.
|
|
10
|
+
*/
|
|
11
|
+
import type { AnyClosed } from "#closed.ts";
|
|
12
|
+
import type { AnyRelation } from "#relation.ts";
|
|
13
|
+
import { type Statement } from "#statements.ts";
|
|
14
|
+
/** One member of a schema's relation record. */
|
|
15
|
+
type SchemaRelation = AnyRelation | AnyClosed;
|
|
16
|
+
/** The relation record a schema is generic over — what `Db` and queries key on. */
|
|
17
|
+
type SchemaRelations = Record<string, SchemaRelation>;
|
|
18
|
+
/** A theory value: named relations plus the DECLARED dependency statements. */
|
|
19
|
+
interface Schema<Rels extends SchemaRelations> {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly relations: Rels;
|
|
22
|
+
readonly statements: readonly Statement[];
|
|
23
|
+
}
|
|
24
|
+
/** Any schema value, whatever its relation record. */
|
|
25
|
+
type AnySchema = Schema<SchemaRelations>;
|
|
26
|
+
/**
|
|
27
|
+
* Assembles a theory:
|
|
28
|
+
* `schema("Ledger", { Kind, Account, Holder }, [ ...statements ])`.
|
|
29
|
+
*
|
|
30
|
+
* Rejected here, each with the offending statement rendered canonically:
|
|
31
|
+
* a record key differing from its relation's declared name; a statement
|
|
32
|
+
* whose relation is not (identically) a member of the record; an explicit
|
|
33
|
+
* duplicate of a fresh-implied or closedness-implied key (macro parity:
|
|
34
|
+
* "redundant here — and rejected as a duplicate"); a duplicate statement
|
|
35
|
+
* (two statements rendering to one canonical utterance ARE one judgment);
|
|
36
|
+
* a handle selection that its roster does not hold (belt-and-braces —
|
|
37
|
+
* the type level already blocks it); and a handle selection whose closed
|
|
38
|
+
* reference no declared containment resolves (the engine's canonical
|
|
39
|
+
* renderer would print the raw row id where `renderStatement` prints the
|
|
40
|
+
* handle — the paste-back law demands the two spellings agree).
|
|
41
|
+
*
|
|
42
|
+
* The fresh-implied and closed auto-keys are NOT added to the statement
|
|
43
|
+
* list: the engine materializes them itself, in its own pinned order
|
|
44
|
+
* (`SchemaDescriptor::materialized_statements`), and restating them would
|
|
45
|
+
* double them.
|
|
46
|
+
*/
|
|
47
|
+
declare function schema<const Rels extends SchemaRelations>(name: string, relations: Rels, statements: readonly Statement[]): Schema<Rels>;
|
|
48
|
+
export type { AnySchema, Schema, SchemaRelation, SchemaRelations };
|
|
49
|
+
export { schema };
|
|
50
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +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;AAwNhE,gDAAgD;AAChD,KAAK,cAAc,GAAG,WAAW,GAAG,SAAS,CAAA;AAE7C,mFAAmF;AACnF,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAErD,+EAA+E;AAC/E,UAAU,MAAM,CAAC,IAAI,SAAS,eAAe;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAA;IACxB,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAA;CACzC;AAED,sDAAsD;AACtD,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAC,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iBAAS,MAAM,CAAC,KAAK,CAAC,IAAI,SAAS,eAAe,EACjD,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,IAAI,EACf,UAAU,EAAE,SAAS,SAAS,EAAE,GAC9B,MAAM,CAAC,IAAI,CAAC,CAmBd;AAED,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,CAAA"}
|