@omgbase/oqx 0.21.0 → 0.24.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/CHANGELOG.md +17 -0
- package/README.md +79 -2
- package/dist/ast.d.ts +48 -3
- package/dist/ast.d.ts.map +1 -1
- package/dist/ast.js +17 -1
- package/dist/ast.js.map +1 -1
- package/dist/build.d.ts +7 -1
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +9 -2
- package/dist/build.js.map +1 -1
- package/dist/engine.d.ts +3 -0
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +153 -11
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/lexer.d.ts.map +1 -1
- package/dist/lexer.js +13 -3
- package/dist/lexer.js.map +1 -1
- package/dist/optimize/analysis.d.ts.map +1 -1
- package/dist/optimize/analysis.js +19 -2
- package/dist/optimize/analysis.js.map +1 -1
- package/dist/optimize/ir.d.ts +5 -1
- package/dist/optimize/ir.d.ts.map +1 -1
- package/dist/optimize/ir.js +2 -0
- package/dist/optimize/ir.js.map +1 -1
- package/dist/optimize/rules.d.ts.map +1 -1
- package/dist/optimize/rules.js +4 -3
- package/dist/optimize/rules.js.map +1 -1
- package/dist/parser.d.ts.map +1 -1
- package/dist/parser.js +406 -21
- package/dist/parser.js.map +1 -1
- package/dist/print.d.ts.map +1 -1
- package/dist/print.js +17 -0
- package/dist/print.js.map +1 -1
- package/dist/references.d.ts +28 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +287 -0
- package/dist/references.js.map +1 -0
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +20 -1
- package/dist/resolve.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/walk.d.ts +1 -1
- package/dist/walk.d.ts.map +1 -1
- package/dist/walk.js +10 -0
- package/dist/walk.js.map +1 -1
- package/package.json +1 -1
- package/src/ast.ts +64 -4
- package/src/build.ts +11 -4
- package/src/engine.ts +154 -11
- package/src/index.ts +3 -1
- package/src/lexer.ts +10 -4
- package/src/optimize/analysis.ts +17 -2
- package/src/optimize/ir.ts +7 -1
- package/src/optimize/rules.ts +4 -3
- package/src/parser.ts +328 -21
- package/src/print.ts +19 -3
- package/src/references.ts +293 -0
- package/src/resolve.ts +22 -2
- package/src/version.ts +1 -1
- package/src/walk.ts +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@ All notable changes to `@omgbase/oqx` are recorded here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow
|
|
5
5
|
[Semantic Versioning](https://semver.org/) (pre-1.0: a minor bump may break).
|
|
6
6
|
|
|
7
|
+
## [0.24.0] - 2026-10-15
|
|
8
|
+
|
|
9
|
+
### Minor
|
|
10
|
+
- **OQX 0.24 — `group by` with aggregates** (`spec/oqx` 0.23 → 0.24; new suite `group-by` (94 cases): 1379 → 1473 fixtures; `projection::projection may not use count` moved to the positive case). The clause order gains `group by <key>, …` and `having <pred>` after `follow` and before `order by` (`select from where frontier follow group by having order by limit offset`; a destination block adds `depth`). **Grouping** (SEMANTICS §24): the rows a body yields become one row per distinct key tuple — key values compare as identities (absent ≡ `null`, a host row by its id, else structurally), groups come in first-appearance order; a key is `name: expr` or an unaliased navigation named by its last segment (an expression key needs the alias); a **group scope** sits where the rows did, its row the key record (one property per key, the first row's value), so a bare key name reads the key, `$it` is the record, `$key` its structural identity, and **`rows`** is the group's rows — a value and a receiver (`rows collect { select title }`, `rows count { where checked }`, `rows first { … }`, `having rows exists { … }`) inside whose block `^` reads the keys. Any other bare name at the group scope is the parse error `` `title` is not a group key or aggregate — … a key (`group by title`), an aggregate over its rows (`collect(title)`), or the rows themselves (`rows collect { select title }`) `` (plus `` `median(…)` is not an aggregate `` inside an unknown free call). **Aggregates** — reserved free-function names `count sum min max avg collect first last any all`, parsing to a new `aggregate` node wherever written (never a `call`; a host cannot serve a function by these names), legal only in a select item, `having` or `order by` of a grouped body (elsewhere a parse error naming the clause, judged over the alias-resolved `where`/`select`; nesting is an error): `count()` counts rows; every value aggregate sees the **present** values of its argument — `count(e)`, `sum(e)` (`0` of none; a non-number is the eval error `cannot sum …`), `avg(e)` (absent of none), `min(e)`/`max(e)` (§6 ordering, an unorderable value leaves the extreme unchanged, absent of none), `collect(e)` (the list in group order), `first(e)`/`last(e)` — with the SQL-spelled modifier `count(distinct e)` / `collect(distinct e)` (identity dedup; `count(distinct)` reads a field named `distinct`; rejected on `any`/`all`); `any(p)`/`all(p)` test truthiness (absent is false) and short-circuit. **`having`** filters the groups and is alias-resolved like `where` (`having n > 1`); `order by` reads the group scope (`order by count() desc`; an alias there is the unknown-name error); `limit`/`offset` bound the groups; every consumer reduces the groups (`docs count { group by layer }`); a `where`-position test may group (`where jobs exists { group by employer having count() > 1 }`); `distinct` with `group by` is the parse error `` `distinct` is redundant with `group by` ``; a grouped body with no `select` projects its keys and `count: count()` (synthesized by the parser; a key named `count` then needs a `select`); `follow` + `group by` groups the occurrences. **`count { … }` is a value** wherever a value stands (`n: jobs count { }`, `jobs count { } > 2`); `exists`/`none` stay predicates. **AST** (AST.md): `query.groupBy`/`having` and `subquery.groupBy`/`having` (materialized `null`), `groupBy { keys }` and `key { name, expr }` nodes, `aggregate { name, arg, distinct }`; `CHILDREN` visits `groupBy`/`having` after `follow` (clauses `groupBy`, `having`); `print` writes every key aliased (`group by city: city`) in clause order and an aggregate as its call; `references` (§5b) reports key expressions in clause `groupBy` on the rows, an aggregate's argument on the rows, and a name read at the group scope with a `groupBy` step (`"group by city: city"`) — a bare key name there, `rows`, and `^key` from a nested block are not references; `build.groupBy`/`key`/`aggregate`; `isAggregateName`/`AGGREGATE_NAMES` exported. Engine: group scopes (`Scope.group`), `rows` resolution, aggregates over the group's row scopes (lifts and walk intrinsics readable); the optimizer never answers a grouped block from cardinality and treats a grouped block as may-raise; `optimized ≡ naive` holds over every fixture. `LANGUAGE_VERSION` 0.24.
|
|
11
|
+
- `@omgbase/oqx-syntax`: `LANGUAGE_VERSION` 0.24; `group by` and `having` highlighted as clauses, the aggregates (`AGGREGATES`) as builtin functions before `(`, `rows` (`GROUP_ROWS`) as an intrinsic; `group`/`having` join the contextual words; assets regenerated; parity over every fixture.
|
|
12
|
+
|
|
13
|
+
## [0.23.0] - 2026-10-13
|
|
14
|
+
|
|
15
|
+
### Minor
|
|
16
|
+
- **OQX 0.23 — the `references` static pass** (`spec/oqx` 0.22 → 0.23; `AST.md` §5b; new suite `references` (27 cases): 1350 → 1377 fixtures; new fixture kind `expect.references`). `references(query)` lists every **name a query reads from a row** — a bare identifier, a dotted navigation headed by one (one reference, the full path: `doc.layer`, `meta.owner`), an outer reference (`^title`, `1^title`; `$it` heads dropped) — in canonical source order, each as `{ name, clause, scope: { depth, steps }, span }`. `scope.steps` is the row chain producing the scope's rows, root first with the depth each step produces: the source, a body's `from`, a block's receiver (one deeper), a `follow` node (the walk's frontier rows, which destinations are read on); an outer reference's steps are cut at its depth; the empty list is the root scope (the source head `from people` is reported there with depth 0). Not references: `$`-names, bindings, function/method names (the receiver and arguments are), projection keys, a `select` alias where the language substitutes it (the same body's `where`; items to its right — an alias's own name inside its own item is the row field; `order by`/`frontier`/`limit`/`offset`/`from`/`follow` are never rewritten, so a name there is a reference), and the trailing members of a navigation headed by a value (`refs(before).title` references `before` only). The pass is host-agnostic and knows no data: a host maps each scope to a row type and judges the name (omgbase's "unknown names" hints and errors, spec/surface 4.6, are built on it). Grammar, semantics and AST shape are unchanged. `LANGUAGE_VERSION` 0.23.
|
|
17
|
+
- `@omgbase/oqx-syntax`: `LANGUAGE_VERSION` 0.23 (no lexical change).
|
|
18
|
+
|
|
19
|
+
## [0.22.0] - 2026-10-13
|
|
20
|
+
|
|
21
|
+
### Minor
|
|
22
|
+
- **OQX 0.22 — infix regex operators** (`spec/oqx` 0.21 → 0.22; new suite `regex-operators` (40 cases): 1310 → 1350 fixtures). Four operators at comparison precedence, pure sugar over `matches` (SEMANTICS §11): `a ~ b` ≡ `a.matches(b)`, `a ~* b` ≡ `a.matches(b, "i")`, `a !~ b` ≡ `!a.matches(b)`, `a !~* b` ≡ `!a.matches(b, "i")` — the PostgreSQL spellings, so `uri ~ "newton"` is no longer `unexpected character "~"`. Every rule of `matches` carries over: unanchored unless the pattern anchors, case-sensitive except under `~*`, string forms for a number receiver or pattern, either side any expression (`title ~ pattern` is field-vs-field), the OQX regex baseline (a construct outside it is rejected by name, a malformed pattern is `invalid regular expression`, raised when evaluated). **Absent follows OQX, not SQL**: `absent ~ "x"` is false, so `absent !~ "x"` is **true** (Postgres would yield NULL for both). Non-associative like the rest of the level (`a ~ b ~ c`, `a ~ b == c` are `comparisons do not chain`); `!`/`not` bind tighter, so `not a ~ b` is `(!a) ~ b` — write `a !~ b` or `not (a ~ b)`. Lexer: `!~*`, `!~`, `~*`, `~` are single tokens scanned longest first (`!~` wins over `!`, so `name!~"B"` is `name !~ "B"`; `~*` wins over `~`, so `x~*y` is `x ~* y`; `*` alone is still multiplication). **AST**: the operators are `binary` nodes carrying the operator as written (`op: "~" | "~*" | "!~" | "!~*"`; `RegexOp`, `REGEX_OPS`, `isRegexOp` exported) — not desugared in the tree, so `print` writes `a ~ b` back and the round-trip law holds over every fixture; evaluation goes through the same method dispatch as `.matches(…)`, so a host's `matches` and its `regexDialect` apply. Planners: a regex operator is never translated to SQL (the SQLite adapter leaves it residual, as it leaves the call) and is never raise-free (`exprRaiseFree`). `LANGUAGE_VERSION` 0.22.
|
|
23
|
+
|
|
7
24
|
## [0.21.0] - 2026-10-13
|
|
8
25
|
|
|
9
26
|
### Minor
|
package/README.md
CHANGED
|
@@ -58,6 +58,8 @@ once, and every one is optional except `from` at the top level:
|
|
|
58
58
|
from <collection> from ${people}
|
|
59
59
|
[ where <predicate> ] where age >= 18 and jobs exists { where not end }
|
|
60
60
|
[ follow <dest>, … ] follow children { depth 4 } (or: follow before, after; follow ^people { where … })
|
|
61
|
+
[ group by <key>, … ] group by city, decade: (age - age % 10) / 10 (0.24; then select reads keys, aggregates, rows)
|
|
62
|
+
[ having <predicate> ] having count() > 1
|
|
61
63
|
[ order by <expr> … ] order by age desc, name
|
|
62
64
|
[ limit N ] limit 10
|
|
63
65
|
[ offset N ] offset 20
|
|
@@ -72,8 +74,8 @@ projects and `jobs { is current }` filters — see §10). At the top level a
|
|
|
72
74
|
predicate always needs `where`, and `from ${people} count` is an error rather
|
|
73
75
|
than a projection of a field called `count`. Writing a clause out of
|
|
74
76
|
order is a parse error that names the order (`` `select` must come before
|
|
75
|
-
`from` — OQX clause order is select, from, where, follow,
|
|
76
|
-
offset ``). The same body grammar applies inside every consumer block
|
|
77
|
+
`from` — OQX clause order is select, from, where, frontier, follow, group by,
|
|
78
|
+
having, order by, limit, offset ``). The same body grammar applies inside every consumer block
|
|
77
79
|
(`collect { … }`, `exists { … }`, …), where `from` is optional because the
|
|
78
80
|
receiver supplies the rows.
|
|
79
81
|
|
|
@@ -375,6 +377,18 @@ oqx`name from ${people} where tags.contains("admin")`; // array membership
|
|
|
375
377
|
written in the **OQX regex baseline** (below), unanchored unless the pattern
|
|
376
378
|
anchors. `flags` is an optional string of `i` (case-insensitive), `m` (`^`/`$`
|
|
377
379
|
also at newlines), `s` (`.` also matches `\n`); an absent receiver is `false`.
|
|
380
|
+
- The **infix regex operators** (0.22) are sugar over `matches` at comparison
|
|
381
|
+
precedence: `a ~ b` is `a.matches(b)`, `a ~* b` is `a.matches(b, "i")`,
|
|
382
|
+
`a !~ b` and `a !~* b` are their negations. Either side is any expression
|
|
383
|
+
(`title ~ pattern`). An absent receiver is `false` under `~` and therefore
|
|
384
|
+
`true` under `!~` — OQX's absent, not SQL's NULL. `!`/`not` bind tighter
|
|
385
|
+
(`not a ~ b` is `(!a) ~ b`; write `a !~ b` or `not (a ~ b)`).
|
|
386
|
+
|
|
387
|
+
```js
|
|
388
|
+
oqx`name from ${people} where title ~ "^Eng"`; // → Bob
|
|
389
|
+
oqx`name from ${people} where title ~* "director"`; // → Alice
|
|
390
|
+
oqx`name from ${people} where title !~ "Eng"`; // → Alice, Carol
|
|
391
|
+
```
|
|
378
392
|
|
|
379
393
|
Anything not in these tables is an **eval error** (`unknown function 'f(…)'` /
|
|
380
394
|
`unknown method '.m(…)'`) — see [custom functions](#custom-functions-and-methods)
|
|
@@ -572,6 +586,44 @@ oqx`name from ${people} where jobs exists { offset 1 }`; // ha
|
|
|
572
586
|
A storage adapter that pushes the whole query may translate them to SQL
|
|
573
587
|
`LIMIT`/`OFFSET`; the shipped `SqliteTable` leaves them to the residual.
|
|
574
588
|
|
|
589
|
+
### 8c. Grouping and aggregates (0.24)
|
|
590
|
+
|
|
591
|
+
`group by <key>, …` — after `where`/`follow`, before `order by` — turns the rows
|
|
592
|
+
a body yields into **one row per distinct key tuple**. A key is a bare name
|
|
593
|
+
(`city`), a dotted navigation named by its last segment (`meta.region`), or an
|
|
594
|
+
aliased expression (`decade: (age - age % 10) / 10`); key values compare as
|
|
595
|
+
identities (absent ≡ `null`), groups come in first-appearance order. After the
|
|
596
|
+
grouping the body reads the **group**: a select item, `having` and `order by`
|
|
597
|
+
may name a key, an **aggregate** over the group's rows, or `rows` — the group's
|
|
598
|
+
rows, a value and a receiver (`rows collect { name values }`, `rows count { where
|
|
599
|
+
active }`, `rows first { … }`); any other bare name is a parse error naming it.
|
|
600
|
+
Without a `select` the projection is the keys plus `count: count()`.
|
|
601
|
+
|
|
602
|
+
```js
|
|
603
|
+
oqx`from ${people} group by city`;
|
|
604
|
+
// [{ city: "NYC", count: 2 }, { city: "SF", count: 1 }]
|
|
605
|
+
oqx`select city, n: count(), oldest: max(age), names: collect(name) from ${people} group by city order by count() desc`;
|
|
606
|
+
oqx`select city, active: rows count { where active } from ${people} group by city having count() > 1`;
|
|
607
|
+
oqx`select decade, n: count() from ${people} group by decade: (age - age % 10) / 10 order by decade`;
|
|
608
|
+
oqx`${people} count { group by city }`; // the number of groups
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
The aggregates are reserved free-function names, legal only in a grouped body's
|
|
612
|
+
select, `having` or `order by`: `count()` counts the group's rows; every other
|
|
613
|
+
aggregate sees the **present** values of its argument — `count(e)`, `sum(e)`
|
|
614
|
+
(`0` of none; a non-number is an eval error), `avg(e)`, `min(e)`, `max(e)`
|
|
615
|
+
(OQX ordering; absent of none), `collect(e)` (the list, in group order),
|
|
616
|
+
`first(e)`, `last(e)` — with `distinct` as a modifier (`count(distinct e)`,
|
|
617
|
+
`collect(distinct e)`); `any(p)` / `all(p)` test truthiness over the rows.
|
|
618
|
+
Aggregates do not nest. `having` is the post-group `where` (it may name a select
|
|
619
|
+
alias: `having n > 1`); `order by` reads the group scope and is not rewritten
|
|
620
|
+
against aliases (`order by count()`, not `order by n`); `limit`/`offset` bound
|
|
621
|
+
the groups; `distinct` with `group by` is an error (redundant). `count { … }` is
|
|
622
|
+
now a value wherever a value stands (`n: jobs count { where pay > 1 }`), in or
|
|
623
|
+
out of a group. A nested block may group too (`jobs collect { employer, total:
|
|
624
|
+
sum(pay) group by employer }`), and every consumer reduces the groups (`jobs
|
|
625
|
+
count { group by employer }`). Spec: `spec/oqx/SEMANTICS.md` §24.
|
|
626
|
+
|
|
575
627
|
### 9. Recursion: `follow`
|
|
576
628
|
|
|
577
629
|
`follow <destination>, …` turns a query into a bounded recursive traversal: the
|
|
@@ -909,6 +961,29 @@ defaults (`build.query(source, { select, where, … })`, `build.op(receiver,
|
|
|
909
961
|
`build.follow`, `build.ident`, `build.lit`, `build.binary`, `build.and`, …), so
|
|
910
962
|
a tree you assemble prints with `print` and has the shape of a parsed one.
|
|
911
963
|
|
|
964
|
+
`references(query)` (0.23, `spec/oqx/AST.md` §5b) lists every **name the query
|
|
965
|
+
reads from a row**, in source order, with the clause it stands in and the scope
|
|
966
|
+
it is read from — so a host that knows what rows an expression yields can say
|
|
967
|
+
which names exist there:
|
|
968
|
+
|
|
969
|
+
```ts
|
|
970
|
+
references(parse('select title, age from docs where blocks exists { where text == ^titel }'));
|
|
971
|
+
// [ { name: "title", clause: "select", scope: { depth: 1, steps: [{ expr: <docs>, depth: 1 }] }, span: [7, 12] },
|
|
972
|
+
// { name: "age", clause: "select", scope: { depth: 1, steps: [<docs>@1] }, … },
|
|
973
|
+
// { name: "docs", clause: "source", scope: { depth: 0, steps: [] }, … }, // a root name
|
|
974
|
+
// { name: "blocks", clause: "where", scope: { depth: 1, steps: [<docs>@1] }, … },
|
|
975
|
+
// { name: "text", clause: "where", scope: { depth: 2, steps: [<docs>@1, <blocks>@2] }, … },
|
|
976
|
+
// { name: "titel", clause: "where", scope: { depth: 1, steps: [<docs>@1] }, … } ] // ^titel: the enclosing row
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
A dotted navigation headed by a name is one reference with its full path
|
|
980
|
+
(`meta.owner`, `doc.layer`); `$it.x` is `x`; a `follow` node is a step (the
|
|
981
|
+
walk's frontier rows). Not references: `$`-names, bindings, function and
|
|
982
|
+
method names (their receiver and arguments are), an item's alias where the
|
|
983
|
+
language substitutes it (the same body's `where`, later items), and the members
|
|
984
|
+
of a navigation headed by a value (`refs(before).title` references `before`
|
|
985
|
+
alone).
|
|
986
|
+
|
|
912
987
|
## Data context: string queries and named roots
|
|
913
988
|
|
|
914
989
|
When you don't need interpolation, `execute` runs a plain string query against a
|
|
@@ -1288,6 +1363,8 @@ adapter lives on the `@omgbase/oqx/sqlite` subpath.
|
|
|
1288
1363
|
`{ strings, count, indices }`).
|
|
1289
1364
|
- `resolveAliases(query)` — the `select`-alias substitution the entry points
|
|
1290
1365
|
apply before evaluation (SEMANTICS §14).
|
|
1366
|
+
- `references(query)` — every name the query reads from a row, with its
|
|
1367
|
+
clause and scope (`Reference`, `ReferenceScope`, `ReferenceStep`; AST.md §5b).
|
|
1291
1368
|
- `toJSON(query)` — the tree stamped with `oqx: LANGUAGE_VERSION`; `stripSpans(node)`
|
|
1292
1369
|
— the tree without spans (`Stripped<T>`); `toUtf16(span, source)` and
|
|
1293
1370
|
`codePointLength(s)` — code-point ↔ UTF-16 offsets; `rawSource(strings)` —
|
package/dist/ast.d.ts
CHANGED
|
@@ -9,12 +9,29 @@ export type Consumer = "collect" | "exists" | "none" | "count" | "first" | "sing
|
|
|
9
9
|
export type RelOp = "==" | "!=" | "<" | "<=" | ">" | ">=";
|
|
10
10
|
/** The identity operators (SEMANTICS §5b, since 0.17). */
|
|
11
11
|
export type IdentityOp = "is" | "is not";
|
|
12
|
-
/** The
|
|
13
|
-
|
|
12
|
+
/** The infix regex operators (SEMANTICS §11, since 0.22): sugar over `matches` —
|
|
13
|
+
* `a ~ b` ≡ `a.matches(b)`, `a ~* b` ≡ `a.matches(b, "i")`, `a !~ b` ≡
|
|
14
|
+
* `!a.matches(b)`, `a !~* b` ≡ `!a.matches(b, "i")`. The tree keeps the
|
|
15
|
+
* operator as written so the canonical print is what the user wrote. */
|
|
16
|
+
export type RegexOp = "~" | "~*" | "!~" | "!~*";
|
|
17
|
+
/** The operator of a `binary` expression: a comparison, an identity test, a regex match, or arithmetic. */
|
|
18
|
+
export type BinaryOp = RelOp | IdentityOp | RegexOp | "+" | "-" | "*" | "/" | "%";
|
|
19
|
+
/** The regex operators, with the `matches` call each stands for. */
|
|
20
|
+
export declare const REGEX_OPS: Readonly<Record<RegexOp, {
|
|
21
|
+
negated: boolean;
|
|
22
|
+
flags: string | undefined;
|
|
23
|
+
}>>;
|
|
24
|
+
export declare function isRegexOp(op: string): op is RegexOp;
|
|
14
25
|
/** The operator of a `unary` expression. */
|
|
15
26
|
export type UnaryOp = "!" | "-";
|
|
16
27
|
/** The operator of a `logical` expression. */
|
|
17
28
|
export type LogicalOp = "&&" | "||";
|
|
29
|
+
/** The aggregate functions (SEMANTICS §24, since 0.24): reserved free-function
|
|
30
|
+
* names that reduce a group's rows. `count` takes zero or one argument, every
|
|
31
|
+
* other exactly one; `any`/`all` take a predicate and admit no `distinct`. */
|
|
32
|
+
export type AggregateName = "count" | "sum" | "min" | "max" | "avg" | "collect" | "first" | "last" | "any" | "all";
|
|
33
|
+
export declare const AGGREGATE_NAMES: ReadonlySet<string>;
|
|
34
|
+
export declare function isAggregateName(name: string): name is AggregateName;
|
|
18
35
|
/** One part of a template literal (since 0.21): a decoded text run, or an
|
|
19
36
|
* interpolated expression. The strings are not nodes (no `kind`, no span). */
|
|
20
37
|
export type TemplatePart = string | Expr;
|
|
@@ -87,7 +104,27 @@ export type Expr = {
|
|
|
87
104
|
kind: "template";
|
|
88
105
|
span: Span;
|
|
89
106
|
parts: TemplatePart[];
|
|
107
|
+
} | {
|
|
108
|
+
kind: "aggregate";
|
|
109
|
+
span: Span;
|
|
110
|
+
name: AggregateName;
|
|
111
|
+
arg: Expr | null;
|
|
112
|
+
distinct: boolean;
|
|
90
113
|
} | OpNode;
|
|
114
|
+
/** One `group by` key (since 0.24): `name: expr`, or an unaliased navigation
|
|
115
|
+
* keyed by its last segment, exactly as a `select` item is. */
|
|
116
|
+
export interface GroupKey {
|
|
117
|
+
kind: "key";
|
|
118
|
+
span: Span;
|
|
119
|
+
name: string;
|
|
120
|
+
expr: Expr;
|
|
121
|
+
}
|
|
122
|
+
/** The `group by` clause (since 0.24): one row per distinct key tuple. */
|
|
123
|
+
export interface GroupBy {
|
|
124
|
+
kind: "groupBy";
|
|
125
|
+
span: Span;
|
|
126
|
+
keys: GroupKey[];
|
|
127
|
+
}
|
|
91
128
|
/** One `order by` term. */
|
|
92
129
|
export interface OrderSpec {
|
|
93
130
|
kind: "order";
|
|
@@ -161,6 +198,11 @@ export interface Subquery {
|
|
|
161
198
|
* `depth` is destination-only. Both `null` when absent. */
|
|
162
199
|
frontier: Expr | null;
|
|
163
200
|
depth: number | null;
|
|
201
|
+
/** `group by` / `having` (since 0.24): the block's rows become one row per
|
|
202
|
+
* distinct key tuple (SEMANTICS §24); `having` filters the groups. Both
|
|
203
|
+
* `null` when absent; `having` is set only together with `groupBy`. */
|
|
204
|
+
groupBy: GroupBy | null;
|
|
205
|
+
having: Where | null;
|
|
164
206
|
/** `values` — scalar projection mode: the (single) projected expression is the
|
|
165
207
|
* row's result itself rather than being wrapped in a `{ name: value }` record,
|
|
166
208
|
* so `name values` yields `["Bob", …]` and `$it values` yields the rows. */
|
|
@@ -209,6 +251,9 @@ export interface Query {
|
|
|
209
251
|
* scope, like `where`) is a frontier (`$stop == "frontier"`, not expanded).
|
|
210
252
|
* `null` without one. */
|
|
211
253
|
frontier: Expr | null;
|
|
254
|
+
/** `group by` / `having` (since 0.24; see Subquery). */
|
|
255
|
+
groupBy: GroupBy | null;
|
|
256
|
+
having: Where | null;
|
|
212
257
|
/** `distinct` — dedup the result rows by their projected value (see OpNode). */
|
|
213
258
|
distinct: boolean;
|
|
214
259
|
/** `values` — scalar projection mode (see Subquery). */
|
|
@@ -218,7 +263,7 @@ export interface Query {
|
|
|
218
263
|
offset: Expr | null;
|
|
219
264
|
}
|
|
220
265
|
/** Every node of the tree. `AstNode["kind"]` is the closed set of node kinds. */
|
|
221
|
-
export type AstNode = Query | Subquery | OpNode | Follow | OrderSpec | SelectItem | Where | Expr;
|
|
266
|
+
export type AstNode = Query | Subquery | OpNode | Follow | GroupBy | GroupKey | OrderSpec | SelectItem | Where | Expr;
|
|
222
267
|
/** The closed set of node kinds. */
|
|
223
268
|
export type AstKind = AstNode["kind"];
|
|
224
269
|
/** Whether a node is a scalar `Expr` (an `op` in expression position is not: it
|
package/dist/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAaA;;kFAEkF;AAClF,MAAM,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAEhD;kFACkF;AAClF,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC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DACwD;AACxD,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,IAAI,CAElD;AAED;4BAC4B;AAC5B,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
package/dist/ast.js
CHANGED
|
@@ -10,9 +10,25 @@
|
|
|
10
10
|
// bare identifier here; `resolveAliases` (resolve.ts) performs the substitution
|
|
11
11
|
// before evaluation. Nodes built by a tool rather than the parser carry the
|
|
12
12
|
// empty span `[0, 0]` (see `build.ts`).
|
|
13
|
+
/** The regex operators, with the `matches` call each stands for. */
|
|
14
|
+
export const REGEX_OPS = {
|
|
15
|
+
"~": { negated: false, flags: undefined },
|
|
16
|
+
"~*": { negated: false, flags: "i" },
|
|
17
|
+
"!~": { negated: true, flags: undefined },
|
|
18
|
+
"!~*": { negated: true, flags: "i" },
|
|
19
|
+
};
|
|
20
|
+
export function isRegexOp(op) {
|
|
21
|
+
return Object.hasOwn(REGEX_OPS, op);
|
|
22
|
+
}
|
|
23
|
+
export const AGGREGATE_NAMES = new Set([
|
|
24
|
+
"count", "sum", "min", "max", "avg", "collect", "first", "last", "any", "all",
|
|
25
|
+
]);
|
|
26
|
+
export function isAggregateName(name) {
|
|
27
|
+
return AGGREGATE_NAMES.has(name);
|
|
28
|
+
}
|
|
13
29
|
/** The expression kinds (`Expr["kind"]`), for `isExpr`. */
|
|
14
30
|
const EXPR_KINDS = new Set([
|
|
15
|
-
"lit", "ident", "outer", "binding", "member", "call", "unary", "required", "binary", "logical", "in", "range", "tuple", "template",
|
|
31
|
+
"lit", "ident", "outer", "binding", "member", "call", "unary", "required", "binary", "logical", "in", "range", "tuple", "template", "aggregate",
|
|
16
32
|
]);
|
|
17
33
|
/** Whether a node is a scalar `Expr` (an `op` in expression position is not: it
|
|
18
34
|
* is an expression only by position, see AST.md §1). */
|
package/dist/ast.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,2EAA2E;AAC3E,gFAAgF;AAChF,wDAAwD;AACxD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,4EAA4E;AAC5E,wCAAwC;
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["../src/ast.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,2EAA2E;AAC3E,gFAAgF;AAChF,wDAAwD;AACxD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,4EAA4E;AAC5E,wCAAwC;AA0BxC,oEAAoE;AACpE,MAAM,CAAC,MAAM,SAAS,GAA+E;IACnG,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE;IACzC,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE;IACpC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;IACzC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;CACrC,CAAC;AAEF,MAAM,UAAU,SAAS,CAAC,EAAU;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAaD,MAAM,CAAC,MAAM,eAAe,GAAwB,IAAI,GAAG,CAAgB;IACzE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK;CAC9E,CAAC,CAAC;AAEH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAqMD,2DAA2D;AAC3D,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAC;IAC9C,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW;CAChJ,CAAC,CAAC;AAEH;wDACwD;AACxD,MAAM,UAAU,MAAM,CAAC,IAAa;IAClC,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/build.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BinaryOp, Consumer, CountCmp, Expr, Follow, FollowDestination, LogicalOp, OpNode, OrderSpec, Query, SelectItem, Span, Subquery, TemplatePart, UnaryOp, Where } from "./ast.js";
|
|
1
|
+
import type { AggregateName, BinaryOp, Consumer, CountCmp, Expr, Follow, FollowDestination, GroupBy, GroupKey, LogicalOp, OpNode, OrderSpec, Query, SelectItem, Span, Subquery, TemplatePart, UnaryOp, Where } from "./ast.js";
|
|
2
2
|
/** A fresh empty span (never shared: spans are mutable tuples). */
|
|
3
3
|
export declare const span: () => Span;
|
|
4
4
|
export declare const lit: (value: string | number | boolean | null) => Expr;
|
|
@@ -21,6 +21,8 @@ export declare const tuple: (items: Expr[]) => Expr;
|
|
|
21
21
|
/** `` `text ${expr} …` `` — a template literal (SEMANTICS §7b); `parts` alternates
|
|
22
22
|
* text, expression, text, … (odd length, text first and last). */
|
|
23
23
|
export declare const template: (parts: TemplatePart[]) => Expr;
|
|
24
|
+
/** `name(arg)` / `name(distinct arg)` / `count()` — an aggregate over the group's rows (SEMANTICS §24). */
|
|
25
|
+
export declare const aggregate: (name: AggregateName, arg?: Expr | null, distinct?: boolean) => Expr;
|
|
24
26
|
export declare const scalar: (expr: Expr) => Where;
|
|
25
27
|
export declare const and: (parts: Where[]) => Where;
|
|
26
28
|
export declare const or: (parts: Where[]) => Where;
|
|
@@ -28,6 +30,10 @@ export declare const not: (expr: Where) => Where;
|
|
|
28
30
|
export declare const field: (name: string, expr: Expr, lift?: number) => SelectItem;
|
|
29
31
|
export declare const collect: (name: string, op: OpNode) => SelectItem;
|
|
30
32
|
export declare const order: (expr: Expr, desc?: boolean) => OrderSpec;
|
|
33
|
+
/** One `group by` key, `name: expr`. */
|
|
34
|
+
export declare const key: (name: string, expr: Expr) => GroupKey;
|
|
35
|
+
/** `group by <keys>` (SEMANTICS §24). */
|
|
36
|
+
export declare const groupBy: (keys: GroupKey[]) => GroupBy;
|
|
31
37
|
/** A block body; every clause defaults to empty/absent. */
|
|
32
38
|
export declare function subquery(parts?: Partial<Omit<Subquery, "kind" | "span">>): Subquery;
|
|
33
39
|
/** `<receiver> <op> [distinct] { sub } [<relop> N]`. */
|
package/dist/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAC7H,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAChE,MAAM,UAAU,CAAC;AAElB,mEAAmE;AACnE,eAAO,MAAM,IAAI,QAAO,IAAc,CAAC;AAEvC,eAAO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GAAG,IAAI,CAAA;CAAO,GAC5D,MAAM,CAER;AAED;0EAC0E;AAC1E,wBAAgB,MAAM,CAAC,YAAY,EAAE,iBAAiB,EAAE,EAAE,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,MAAM,CAEnG;AAED;oCACoC;AACpC,wBAAgB,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,GAAE,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAM,GAAG,KAAK,CAOvG"}
|
package/dist/build.js
CHANGED
|
@@ -24,6 +24,8 @@ export const tuple = (items) => ({ kind: "tuple", span: span(), items });
|
|
|
24
24
|
/** `` `text ${expr} …` `` — a template literal (SEMANTICS §7b); `parts` alternates
|
|
25
25
|
* text, expression, text, … (odd length, text first and last). */
|
|
26
26
|
export const template = (parts) => ({ kind: "template", span: span(), parts });
|
|
27
|
+
/** `name(arg)` / `name(distinct arg)` / `count()` — an aggregate over the group's rows (SEMANTICS §24). */
|
|
28
|
+
export const aggregate = (name, arg = null, distinct = false) => ({ kind: "aggregate", span: span(), name, arg, distinct });
|
|
27
29
|
export const scalar = (expr) => ({ kind: "scalar", span: span(), expr });
|
|
28
30
|
export const and = (parts) => ({ kind: "and", span: span(), parts });
|
|
29
31
|
export const or = (parts) => ({ kind: "or", span: span(), parts });
|
|
@@ -31,11 +33,16 @@ export const not = (expr) => ({ kind: "not", span: span(), expr });
|
|
|
31
33
|
export const field = (name, expr, lift = 0) => ({ kind: "field", span: span(), name, expr, lift });
|
|
32
34
|
export const collect = (name, op) => ({ kind: "collect", span: span(), name, op });
|
|
33
35
|
export const order = (expr, desc = false) => ({ kind: "order", span: span(), expr, desc });
|
|
36
|
+
/** One `group by` key, `name: expr`. */
|
|
37
|
+
export const key = (name, expr) => ({ kind: "key", span: span(), name, expr });
|
|
38
|
+
/** `group by <keys>` (SEMANTICS §24). */
|
|
39
|
+
export const groupBy = (keys) => ({ kind: "groupBy", span: span(), keys });
|
|
34
40
|
/** A block body; every clause defaults to empty/absent. */
|
|
35
41
|
export function subquery(parts = {}) {
|
|
36
42
|
return {
|
|
37
43
|
kind: "subquery", span: span(),
|
|
38
|
-
from: [], where: null, select: [], orderBy: null, follow: null, frontier: null, depth: null,
|
|
44
|
+
from: [], where: null, select: [], orderBy: null, follow: null, frontier: null, depth: null, groupBy: null, having: null,
|
|
45
|
+
values: false, limit: null, offset: null,
|
|
39
46
|
...parts,
|
|
40
47
|
};
|
|
41
48
|
}
|
|
@@ -53,7 +60,7 @@ export function follow(destinations, opts = {}) {
|
|
|
53
60
|
export function query(source, parts = {}) {
|
|
54
61
|
return {
|
|
55
62
|
kind: "query", span: span(), source,
|
|
56
|
-
from: [], where: null, select: [], orderBy: null, consumer: "collect", follow: null, frontier: null,
|
|
63
|
+
from: [], where: null, select: [], orderBy: null, consumer: "collect", follow: null, frontier: null, groupBy: null, having: null,
|
|
57
64
|
distinct: false, values: false, limit: null, offset: null,
|
|
58
65
|
...parts,
|
|
59
66
|
};
|
package/dist/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,+EAA+E;AAC/E,mEAAmE;AAOnE,mEAAmE;AACnE,MAAM,CAAC,MAAM,IAAI,GAAG,GAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEvC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,KAAuC,EAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AAC7G,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE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E,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI;QAChI,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI;QACzD,GAAG,KAAK;KACT,CAAC;AACJ,CAAC"}
|
package/dist/engine.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export declare class InMemoryEngine implements Engine {
|
|
|
80
80
|
private applyKey;
|
|
81
81
|
private child;
|
|
82
82
|
private enter;
|
|
83
|
+
private groupScopes;
|
|
84
|
+
private aggregate;
|
|
83
85
|
private runFollow;
|
|
84
86
|
private keyed;
|
|
85
87
|
private dedupByProjection;
|
|
@@ -115,5 +117,6 @@ export declare class InMemoryEngine implements Engine {
|
|
|
115
117
|
private resolveIn;
|
|
116
118
|
private rowIdentity;
|
|
117
119
|
private evalCall;
|
|
120
|
+
private callMethod;
|
|
118
121
|
}
|
|
119
122
|
//# sourceMappingURL=engine.d.ts.map
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,KAAK,EAAe,MAAM,EAC3B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACV,KAAK,EAAe,MAAM,EAC3B,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMhD,OAAO,KAAK,EAA0B,IAAI,EAAY,MAAM,qBAAqB,CAAC;AAIlF;;;kDAGkD;AAClD,MAAM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