@bjornpagen/bumbledb 0.1.0 → 0.2.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.
Files changed (103) hide show
  1. package/COOKBOOK.md +1394 -0
  2. package/README.md +4 -0
  3. package/dist/closed.d.ts +60 -37
  4. package/dist/closed.d.ts.map +1 -1
  5. package/dist/closed.js +159 -40
  6. package/dist/closed.js.map +1 -1
  7. package/dist/count.d.ts +64 -17
  8. package/dist/count.d.ts.map +1 -1
  9. package/dist/count.js +37 -14
  10. package/dist/count.js.map +1 -1
  11. package/dist/db.d.ts +15 -7
  12. package/dist/db.d.ts.map +1 -1
  13. package/dist/db.js +13 -5
  14. package/dist/db.js.map +1 -1
  15. package/dist/exhume.d.ts +12 -11
  16. package/dist/exhume.d.ts.map +1 -1
  17. package/dist/exhume.js +7 -6
  18. package/dist/exhume.js.map +1 -1
  19. package/dist/face.d.ts +79 -19
  20. package/dist/face.d.ts.map +1 -1
  21. package/dist/face.js +14 -15
  22. package/dist/face.js.map +1 -1
  23. package/dist/fields.d.ts +158 -129
  24. package/dist/fields.d.ts.map +1 -1
  25. package/dist/fields.js +80 -81
  26. package/dist/fields.js.map +1 -1
  27. package/dist/index.d.ts +21 -21
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +13 -12
  30. package/dist/index.js.map +1 -1
  31. package/dist/lower.d.ts +6 -3
  32. package/dist/lower.d.ts.map +1 -1
  33. package/dist/lower.js +48 -17
  34. package/dist/lower.js.map +1 -1
  35. package/dist/marshal.d.ts +36 -21
  36. package/dist/marshal.d.ts.map +1 -1
  37. package/dist/marshal.js +41 -25
  38. package/dist/marshal.js.map +1 -1
  39. package/dist/native.js +2 -2
  40. package/dist/query/atom.d.ts +332 -174
  41. package/dist/query/atom.d.ts.map +1 -1
  42. package/dist/query/atom.js +72 -172
  43. package/dist/query/atom.js.map +1 -1
  44. package/dist/query/lower.d.ts +295 -107
  45. package/dist/query/lower.d.ts.map +1 -1
  46. package/dist/query/lower.js +860 -388
  47. package/dist/query/lower.js.map +1 -1
  48. package/dist/query/predicate.d.ts +69 -88
  49. package/dist/query/predicate.d.ts.map +1 -1
  50. package/dist/query/predicate.js +118 -72
  51. package/dist/query/predicate.js.map +1 -1
  52. package/dist/query/run.d.ts +19 -16
  53. package/dist/query/run.d.ts.map +1 -1
  54. package/dist/query/run.js +31 -24
  55. package/dist/query/run.js.map +1 -1
  56. package/dist/query/scope.d.ts +139 -123
  57. package/dist/query/scope.d.ts.map +1 -1
  58. package/dist/query/scope.js +71 -115
  59. package/dist/query/scope.js.map +1 -1
  60. package/dist/query/select.d.ts +102 -80
  61. package/dist/query/select.d.ts.map +1 -1
  62. package/dist/query/select.js +39 -34
  63. package/dist/query/select.js.map +1 -1
  64. package/dist/relation.d.ts +33 -36
  65. package/dist/relation.d.ts.map +1 -1
  66. package/dist/relation.js +15 -16
  67. package/dist/relation.js.map +1 -1
  68. package/dist/schema.d.ts.map +1 -1
  69. package/dist/schema.js +19 -8
  70. package/dist/schema.js.map +1 -1
  71. package/dist/spec.d.ts +6 -5
  72. package/dist/spec.d.ts.map +1 -1
  73. package/dist/spec.js.map +1 -1
  74. package/dist/statements.d.ts +56 -31
  75. package/dist/statements.d.ts.map +1 -1
  76. package/dist/statements.js +38 -13
  77. package/dist/statements.js.map +1 -1
  78. package/package.json +4 -3
  79. package/src/closed.ts +271 -93
  80. package/src/count.ts +112 -18
  81. package/src/db.ts +22 -12
  82. package/src/exhume.ts +12 -11
  83. package/src/face.ts +114 -22
  84. package/src/fields.ts +261 -217
  85. package/src/index.ts +50 -59
  86. package/src/lower.ts +62 -20
  87. package/src/marshal.ts +48 -30
  88. package/src/native.ts +2 -2
  89. package/src/query/atom.ts +480 -376
  90. package/src/query/lower.ts +1341 -542
  91. package/src/query/predicate.ts +198 -161
  92. package/src/query/run.ts +35 -25
  93. package/src/query/scope.ts +188 -218
  94. package/src/query/select.ts +168 -93
  95. package/src/relation.ts +38 -44
  96. package/src/schema.ts +22 -12
  97. package/src/spec.ts +6 -5
  98. package/src/statements.ts +69 -26
  99. package/dist/brand.d.ts +0 -59
  100. package/dist/brand.d.ts.map +0 -1
  101. package/dist/brand.js +0 -47
  102. package/dist/brand.js.map +0 -1
  103. package/src/brand.ts +0 -82
@@ -1,134 +1,90 @@
1
1
  /**
2
- * Query scope terms (PRD-08): typed variables and parameters, declared
3
- * inside a `query()` scope callback so identity is lexical. A `Var` is
4
- * typed by the field it is declared from and joins are brand-equal by
5
- * construction (the nominal join discipline); var identity is OBJECT
6
- * identity two `$.var` calls are two variables even from the same field,
7
- * and no name-collision machinery exists. Params are query-global, carry a
8
- * mandatory literal name (the key of `execute`'s params object), and lower
9
- * to dense positional `ParamId`s in declaration order. This module also
10
- * owns the type-level params extraction: every atom and condition value
11
- * carries its contributed params object in a phantom, and the query's
12
- * `Params` type is the flattened intersection over the returned rules
13
- * inference rides the return value, never a mutable type accumulator.
2
+ * Query scope terms, STRUCTURAL edition: string-named variables and
3
+ * parameters as plain frozen values. A `Var` is a NAME it is typed by the
4
+ * field it first binds (structurally, off the schema type, through the rule
5
+ * builder's environment), reuse of the name within one rule IS the join,
6
+ * and a domain-mismatched reuse is a compile error (the structural analog
7
+ * of the old brand-equal join now domain-equal, no value brands
8
+ * anywhere). Params are query-global by name and typed BY USE: the field
9
+ * position or comparison sibling that anchors a param types it, the
10
+ * query's inferred `Params` object is exactly the params the rules use,
11
+ * and a param value that no rule uses simply never registers — the query
12
+ * executes under its own inferred type (the bug-hunt law). This module
13
+ * also owns the environment/typing utilities the whole surface shares:
14
+ * the env shape (var name → field descriptor), the domain-equality
15
+ * judgment, and the record-folding helpers `Params` and `Row` inference
16
+ * ride.
14
17
  */
15
- import * as errors from "@superbuilders/errors";
16
- import { phantom } from "#brand.ts";
17
18
  /**
18
19
  * The runtime discriminant of query term values. Host literals (bigints,
19
- * strings, interval objects, `oneOf` sets) never carry it, so "is this
20
- * binding a term or a literal" is one property probe, never a guess.
20
+ * strings, interval objects) never carry it, so "is this position a term
21
+ * or a literal" is one property probe, never a guess.
21
22
  */
22
23
  const term = Symbol("bumbledb.query.term");
23
- /** Narrows an unknown binding value to a scope term (vs a host literal). */
24
+ /**
25
+ * The carrier of a value's INFERRED types (a rule's row/params, a query's
26
+ * row/params, a rec's params). The property is never present at runtime —
27
+ * it exists so inference rides plain values without any brand on any
28
+ * field value.
29
+ */
30
+ const inferred = Symbol("bumbledb.query.inferred");
31
+ /** Narrows an unknown position value to a scope term (vs a host literal). */
24
32
  function isTerm(value) {
25
33
  return typeof value === "object" && value !== null && term in value;
26
34
  }
27
- /** Creates one empty scope registry over the query's theory. */
28
- function createRegistry(theory) {
29
- return {
30
- theory,
31
- vars: new Set(),
32
- params: [],
33
- paramIndex: new Map(),
34
- predicates: []
35
- };
35
+ /** Builds one variable term. */
36
+ function makeVar(name) {
37
+ const value = { [term]: "var", name };
38
+ return Object.freeze(value);
39
+ }
40
+ /** Builds one scalar-parameter term. */
41
+ function makeParam(name) {
42
+ const value = { [term]: "param", name };
43
+ return Object.freeze(value);
44
+ }
45
+ /** Builds one set-parameter term. */
46
+ function makeSetParam(name) {
47
+ const value = { [term]: "setParam", name };
48
+ return Object.freeze(value);
49
+ }
50
+ /** Builds one Allen-mask-parameter term. */
51
+ function makeMaskParam(name) {
52
+ const value = { [term]: "maskParam", name };
53
+ return Object.freeze(value);
54
+ }
55
+ /** Builds one measure term over an interval-typed variable's name. */
56
+ function makeDuration(name) {
57
+ const value = { [term]: "duration", name };
58
+ return Object.freeze(value);
36
59
  }
37
60
  /**
38
- * The relation-kind discriminant: a closed relation's runtime description
39
- * carries its handle roster, an ordinary relation's never does.
61
+ * The runtime twin of {@link JoinOk}: two field descriptors join iff kind,
62
+ * domain label, width label, and interval element all agree — the same
63
+ * structural comparison the type tier makes, judged on the descriptor
64
+ * VALUES (S1 descriptors are honest at runtime). The rule builders throw
65
+ * through this on a domain-unequal variable reuse, so the wall holds for
66
+ * untyped callers too, not only where the compiler can see.
40
67
  */
41
- function isClosedMember(member) {
42
- return "handles" in member.data;
68
+ function fieldJoins(a, b) {
69
+ const widthA = "width" in a ? a.width : undefined;
70
+ const widthB = "width" in b ? b.width : undefined;
71
+ const elementA = "element" in a ? a.element : undefined;
72
+ const elementB = "element" in b ? b.element : undefined;
73
+ return a.kind === b.kind && a.domain === b.domain && widthA === widthB && elementA === elementB;
43
74
  }
44
75
  /**
45
- * Resolves a field reference's runtime description through the schema
46
- * the seam that types `$.var`/`$.param` declarations at runtime (the type
47
- * level already carries the brand; this recovers the structural type the
48
- * lowering and the param marshaler direct by).
76
+ * Renders one field descriptor for join-mismatch diagnostics the schema
77
+ * grammar's own spelling (`u64 as HolderId`, `interval<i64, 7> as Window`).
49
78
  */
50
- function resolveFieldData(theory, relationName, fieldName) {
51
- const member = theory.relations[relationName];
52
- if (member === undefined) {
53
- throw errors.new(`schema ${theory.name} has no relation ${relationName}`);
54
- }
55
- if (isClosedMember(member)) {
56
- if (fieldName === "id") {
57
- return member.id.data;
58
- }
59
- const column = member.data.columns.find(function byName(candidate) {
60
- return candidate.name === fieldName;
61
- });
62
- if (column === undefined) {
63
- throw errors.new(`closed relation ${relationName} has no column ${fieldName}`);
64
- }
65
- return column.field;
79
+ function renderFieldKind(field) {
80
+ let base = field.kind;
81
+ if (field.kind === "bytes") {
82
+ base = `bytes<${field.width}>`;
66
83
  }
67
- const declared = member.data.fields.find(function byName(candidate) {
68
- return candidate.name === fieldName;
69
- });
70
- if (declared === undefined) {
71
- throw errors.new(`relation ${relationName} has no field ${fieldName}`);
84
+ if (field.kind === "interval") {
85
+ base = field.width === undefined ? `interval<${field.element}>` : `interval<${field.element}, ${field.width}>`;
72
86
  }
73
- return declared.field;
74
- }
75
- /** Declares one variable in the scope (the `$.var` implementation). */
76
- function scopeVar(registry, ref) {
77
- const value = Object.freeze({
78
- [term]: "var",
79
- relation: ref.relation,
80
- field: ref.field,
81
- data: resolveFieldData(registry.theory, ref.relation, ref.field)
82
- });
83
- registry.vars.add(value);
84
- return value;
85
- }
86
- /** Rejects a second parameter under an already-taken name. */
87
- function assertFreshParamName(registry, name) {
88
- const taken = registry.params.some(function byName(entry) {
89
- return entry.name === name;
90
- });
91
- if (taken) {
92
- throw errors.new(`query scope already declares a param named ${name} — param names key the execute params object, one declaration each`);
93
- }
94
- }
95
- /** Declares one scalar parameter (the `$.param` implementation). */
96
- function scopeParam(registry, name, ref) {
97
- assertFreshParamName(registry, name);
98
- const data = resolveFieldData(registry.theory, ref.relation, ref.field);
99
- const value = Object.freeze({
100
- [term]: "param",
101
- name,
102
- relation: ref.relation,
103
- field: ref.field,
104
- data
105
- });
106
- registry.paramIndex.set(value, registry.params.length);
107
- registry.params.push(Object.freeze({ name, shape: "value", data }));
108
- return value;
109
- }
110
- /** Declares one set parameter (the `$.paramSet` implementation). */
111
- function scopeParamSet(registry, name, ref) {
112
- assertFreshParamName(registry, name);
113
- const data = resolveFieldData(registry.theory, ref.relation, ref.field);
114
- const value = Object.freeze({
115
- [term]: "paramSet",
116
- name,
117
- relation: ref.relation,
118
- field: ref.field,
119
- data
120
- });
121
- registry.paramIndex.set(value, registry.params.length);
122
- registry.params.push(Object.freeze({ name, shape: "set", data }));
123
- return value;
124
- }
125
- /** Declares one Allen-mask parameter (the `$.allenParam` implementation). */
126
- function scopeAllenParam(registry, name) {
127
- assertFreshParamName(registry, name);
128
- const value = Object.freeze({ [term]: "maskParam", name });
129
- registry.paramIndex.set(value, registry.params.length);
130
- registry.params.push(Object.freeze({ name, shape: "mask", data: undefined }));
131
- return value;
87
+ return field.domain === undefined ? base : `${base} as ${field.domain}`;
132
88
  }
133
- export { createRegistry, isTerm, resolveFieldData, scopeAllenParam, scopeParam, scopeParamSet, scopeVar, term };
89
+ export { fieldJoins, inferred, isTerm, makeDuration, makeMaskParam, makeParam, makeSetParam, makeVar, renderFieldKind, term };
134
90
  //# sourceMappingURL=scope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/query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,EACN,YAAY,EACZ,aAAa,EACb,SAAS,EACT,YAAY,EACZ,OAAO,EACP,eAAe,EACf,IAAI,EACJ,CAAA"}
@@ -1,86 +1,55 @@
1
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
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
- 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
- };
18
+ import type { Infer } from "#fields.ts";
19
+ import type { IntervalVarOk, OrderVarOk } from "#query/atom.ts";
20
+ import type { Duration, EnvShape, ShapeOf } from "#query/scope.ts";
21
+ /** One aggregate operator name of the select vocabulary. */
22
+ type AggOpName = "count" | "countDistinct" | "sum" | "min" | "max" | "argMax" | "argMin" | "pack";
39
23
  /**
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).
24
+ * One aggregate select VALUE: the op, the variable name (or measure) it
25
+ * folds, and for the Arg forms — the orderable key's variable name. The
26
+ * runtime representation carries the types; the rule environment types the
27
+ * result at `.select`.
44
28
  */
45
- interface Aggregate<R> {
46
- readonly aggregate: AggregateData;
47
- readonly [phantom]?: R;
29
+ interface Agg<Op extends AggOpName, Over extends string | Duration<string> | undefined, Key extends string | undefined = undefined> {
30
+ readonly agg: Op;
31
+ readonly over: Over;
32
+ readonly key: Key;
48
33
  }
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>;
34
+ /** Any aggregate select value. */
35
+ type AnyAgg = Agg<AggOpName, string | Duration<string> | undefined, string | undefined>;
36
+ /** One select entry: a projected var name, the measure, or an aggregate. */
37
+ type SelectEntry = string | Duration<string> | AnyAgg;
38
+ /** Nullary count: |the group's set of distinct full bindings|, `bigint`; the answer column is named `count`. */
39
+ declare function count(): Agg<"count", undefined>;
40
+ /** |the distinct values of the named variable across the group|, `bigint`; legal over every type. */
41
+ declare function countDistinct<const N extends string>(over: N): Agg<"countDistinct", N>;
71
42
  /**
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))`).
43
+ * Exact checked sum over an orderable (u64/i64) variable wide
44
+ * accumulator, one finalize range check; overflow is the engine's typed
45
+ * runtime error, never a wrap or over the measure
46
+ * (`r.sum(r.duration("w"))`).
75
47
  */
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>;
48
+ declare function sum<const N extends string | Duration<string>>(over: N): Agg<"sum", N>;
49
+ /** Minimum over an orderable variable or the measure (orderable types only). */
50
+ declare function min<const N extends string | Duration<string>>(over: N): Agg<"min", N>;
51
+ /** Maximum over an orderable variable or the measure (orderable types only). */
52
+ declare function max<const N extends string | Duration<string>>(over: N): Agg<"max", N>;
84
53
  /**
85
54
  * Arg-restriction toward the maximum of `key` (`ir::AggOp::ArgMax`): the
86
55
  * group's binding set is restricted to the bindings attaining the extreme
@@ -89,9 +58,9 @@ declare function max(over: Duration): Aggregate<bigint>;
89
58
  * direction; Arg and fold aggregates never mix (both the engine's typed
90
59
  * rules).
91
60
  */
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>;
61
+ declare function argMax<const V extends string, const K extends string>(value: V, key: K): Agg<"argMax", V, K>;
62
+ /** Arg-restriction toward the minimum of `key`; rules as {@link argMax}. */
63
+ declare function argMin<const V extends string, const K extends string>(value: V, key: K): Agg<"argMin", V, K>;
95
64
  /**
96
65
  * The coalescing fold (Snodgrass coalesce, `ir::AggOp::Pack`): per group,
97
66
  * the maximal disjoint half-open segments of the union of the group's
@@ -100,7 +69,60 @@ declare function argmin<K extends bigint, V>(key: Var<K>, value: Var<V>): Aggreg
100
69
  * input's element type. At most one `pack` per select, never beside a
101
70
  * fold or an Arg entry (the engine's typed rules).
102
71
  */
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 };
72
+ declare function pack<const N extends string>(over: N): Agg<"pack", N>;
73
+ /** A fold input's judgment: an orderable variable, or the measure of an interval variable. */
74
+ type FoldOverOk<Env extends EnvShape, O> = O extends string ? OrderVarOk<Env, O> : O extends Duration<infer N extends string> ? IntervalVarOk<Env, N> : false;
75
+ /**
76
+ * One select entry's judgment against the rule environment: projected
77
+ * names must be bound, the measure and `pack` demand interval-typed
78
+ * variables, folds and Arg keys demand orderable ones.
79
+ */
80
+ type SelectEntryOk<Env extends EnvShape, E> = E extends string ? E extends keyof Env ? true : false : E extends Duration<infer N extends string> ? IntervalVarOk<Env, N> : E extends Agg<"count", undefined> ? true : E extends Agg<"countDistinct", infer O extends string> ? O extends keyof Env ? true : false : E extends Agg<"sum" | "min" | "max", infer O> ? FoldOverOk<Env, O> : E extends Agg<"argMax" | "argMin", infer O extends string, infer K extends string> ? [O extends keyof Env ? true : false, OrderVarOk<Env, K>] extends [true, true] ? true : false : E extends Agg<"pack", infer O extends string> ? IntervalVarOk<Env, O> : false;
81
+ /** The validated select tuple (intersect with the inferred entries — errors land on the offending argument). */
82
+ type CheckSelect<Env extends EnvShape, S> = {
83
+ readonly [I in keyof S]: SelectEntryOk<Env, S[I]> extends true ? S[I] : never;
84
+ };
85
+ /** The validated names-only select tuple of a RECURSIVE rule (aggregates and the measure are unwritable there). */
86
+ type CheckNameSelect<Env extends EnvShape, S> = {
87
+ readonly [I in keyof S]: S[I] extends keyof Env ? S[I] : never;
88
+ };
89
+ /**
90
+ * One select entry's answer-column fragment: the column is named by the
91
+ * variable it projects or folds (`count` names its column `count`), and
92
+ * its type reflects the entry — `count`/`countDistinct` are `bigint`
93
+ * whatever they counted, folds carry their input's type, the measure is
94
+ * `bigint`, the Arg forms carry the payload's type, `pack` its interval
95
+ * type.
96
+ */
97
+ type SelectEntryRow<Env extends EnvShape, E> = E extends string ? {
98
+ readonly [K in E]: Infer<Env[E & keyof Env]>;
99
+ } : E extends Duration<infer N extends string> ? {
100
+ readonly [K in N]: bigint;
101
+ } : E extends Agg<"count", undefined> ? {
102
+ readonly count: bigint;
103
+ } : E extends Agg<"countDistinct", infer O extends string> ? {
104
+ readonly [K in O]: bigint;
105
+ } : E extends Agg<"sum" | "min" | "max", infer O> ? O extends string ? {
106
+ readonly [K in O]: Infer<Env[O & keyof Env]>;
107
+ } : O extends Duration<infer N extends string> ? {
108
+ readonly [K in N]: bigint;
109
+ } : never : E extends Agg<"argMax" | "argMin", infer O extends string, string> ? {
110
+ readonly [K in O]: Infer<Env[O & keyof Env]>;
111
+ } : E extends Agg<"pack", infer O extends string> ? {
112
+ readonly [K in O]: Infer<Env[O & keyof Env]>;
113
+ } : never;
114
+ /** The inferred answer-row object type of a select tuple. */
115
+ type RowOfSelect<Env extends EnvShape, S extends readonly SelectEntry[]> = ShapeOf<SelectEntryRow<Env, S[number]>>;
116
+ /**
117
+ * One projected name's answer-column fragment — a NAKED parameter, so the
118
+ * judgment distributes per name (the union of a multi-name select never
119
+ * smears into one column's type), mirroring {@link SelectEntryRow}.
120
+ */
121
+ type NameSelectRow<Env extends EnvShape, N> = N extends string ? {
122
+ readonly [K in N]: Infer<Env[K & keyof Env]>;
123
+ } : never;
124
+ /** The inferred answer-row object type of a names-only (recursive-rule) select tuple. */
125
+ type RowOfNameSelect<Env extends EnvShape, S extends readonly string[]> = ShapeOf<NameSelectRow<Env, S[number]>>;
126
+ export type { Agg, AggOpName, AnyAgg, CheckNameSelect, CheckSelect, RowOfNameSelect, RowOfSelect, SelectEntry, SelectEntryOk, SelectEntryRow };
127
+ export { argMax, argMin, count, countDistinct, max, min, pack, sum };
106
128
  //# sourceMappingURL=select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/query/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAEtC,yEAAyE;AAC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IAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;CAAE,GAChD,KAAK,CAAA;AAEd,6DAA6D;AAC7D,KAAK,WAAW,CAAC,GAAG,SAAS,QAAQ,EAAE,CAAC,SAAS,SAAS,WAAW,EAAE,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAElH;;;;GAIG;AACH,KAAK,aAAa,CAAC,GAAG,SAAS,QAAQ,EAAE,CAAC,IAAI,CAAC,SAAS,MAAM,GAC3D;IAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;CAAE,GAChD,KAAK,CAAA;AAER,yFAAyF;AACzF,KAAK,eAAe,CAAC,GAAG,SAAS,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,EAAE,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAEhH,YAAY,EACX,GAAG,EACH,SAAS,EACT,MAAM,EACN,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,WAAW,EACX,aAAa,EACb,cAAc,EACd,CAAA;AACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA"}
@@ -1,39 +1,48 @@
1
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
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
- import { phantom } from "#brand.ts";
14
- import { term } from "#query/scope.ts";
15
- /** Nullary count: |the group's set of distinct full bindings|, `bigint`. */
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 Object.freeze({ aggregate: Object.freeze({ op: "count" }) });
24
+ return aggregate("count", undefined, undefined);
18
25
  }
19
- /** |the distinct values of `over` across the group|, `bigint`; legal over every type. */
26
+ /** |the distinct values of the named variable across the group|, `bigint`; legal over every type. */
20
27
  function countDistinct(over) {
21
- return Object.freeze({ aggregate: Object.freeze({ op: "countDistinct", over }) });
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 Object.freeze({
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 Object.freeze({
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 Object.freeze({
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 argmax(key, value) {
47
- return Object.freeze({
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 argmax}. */
52
- function argmin(key, value) {
53
- return Object.freeze({
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 Object.freeze({ aggregate: Object.freeze({ op: "pack", over }) });
71
+ return aggregate("pack", over, undefined);
67
72
  }
68
- export { argmax, argmin, count, countDistinct, max, min, pack, sum };
73
+ export { argMax, argMin, count, countDistinct, max, min, pack, sum };
69
74
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/query/select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGnC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AA+CtC,4EAA4E;AAC5E,SAAS,KAAK;IACb,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAgB,EAAE,CAAC,EAAE,CAAC,CAAA;AAC7E,CAAC;AAED,yFAAyF;AACzF,SAAS,aAAa,CAAI,IAAY;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,eAAwB,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAA;AAC3F,CAAC;AASD,SAAS,GAAG,CAAC,IAA4B;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAe,EAAE,IAAI,EAAE,KAAc,EAAE,IAAI,EAAE,CAAC;KAC7E,CAAC,CAAA;AACH,CAAC;AAKD,SAAS,GAAG,CAAC,IAA4B;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAe,EAAE,IAAI,EAAE,KAAc,EAAE,IAAI,EAAE,CAAC;KAC7E,CAAC,CAAA;AACH,CAAC;AAKD,SAAS,GAAG,CAAC,IAA4B;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,MAAe,EAAE,IAAI,EAAE,KAAc,EAAE,IAAI,EAA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