@atscript/db 0.1.135 → 0.1.137
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/dist/{agg-DKuf_v2L.d.cts → agg-CV7y8nC6.d.cts} +13 -3
- package/dist/{agg-BtlGeRfj.d.mts → agg-D5DHsAby.d.mts} +13 -3
- package/dist/agg.cjs +35 -3
- package/dist/agg.d.cts +2 -2
- package/dist/agg.d.mts +2 -2
- package/dist/agg.mjs +34 -1
- package/dist/aggregate-fns-CGBv3E8S.cjs +87 -0
- package/dist/aggregate-fns-CfsveE1w.mjs +58 -0
- package/dist/{buckets-GruoVxH5.d.mts → buckets-BFG2RYRW.d.mts} +662 -31
- package/dist/{buckets-D6PBXKRJ.d.cts → buckets-C-27xmtq.d.cts} +662 -31
- package/dist/column-diff-BmqvgBWw.d.cts +24 -0
- package/dist/{db-view-Doh8vPg3.mjs → column-diff-BwOA5101.mjs} +795 -125
- package/dist/{db-view-Dm7MpUGB.cjs → column-diff-CgxgFKzx.cjs} +873 -125
- package/dist/column-diff-DPkbZIVE.d.mts +24 -0
- package/dist/index.cjs +79 -55
- package/dist/index.d.cts +12 -10
- package/dist/index.d.mts +12 -10
- package/dist/index.mjs +30 -11
- package/dist/{nested-writer-wk1EFUNY.cjs → nested-writer-BZNCuqI6.cjs} +16 -2
- package/dist/{nested-writer-CqL24ojl.mjs → nested-writer-FWD5oOYh.mjs} +11 -3
- package/dist/plugin.cjs +217 -77
- package/dist/plugin.mjs +217 -78
- package/dist/rel.cjs +2 -2
- package/dist/rel.d.cts +2 -20
- package/dist/rel.d.mts +2 -20
- package/dist/rel.mjs +2 -2
- package/dist/relation-helpers-D3Zu0Mta.d.mts +30 -0
- package/dist/relation-helpers-DxrvS6ar.d.cts +30 -0
- package/dist/{relation-loader-BD4xANQJ.cjs → relation-loader-6ZB_5KFq.cjs} +1 -1
- package/dist/{relation-loader-B68R1LET.mjs → relation-loader-CTFaZpVa.mjs} +1 -1
- package/dist/shared.cjs +5 -1
- package/dist/shared.d.cts +16 -3
- package/dist/shared.d.mts +16 -3
- package/dist/shared.mjs +2 -2
- package/dist/sync.cjs +38 -321
- package/dist/sync.d.cts +29 -17
- package/dist/sync.d.mts +29 -17
- package/dist/sync.mjs +6 -289
- package/dist/{validation-utils-MWOP1Ts4.mjs → validation-utils-B4h-GW4d.mjs} +29 -7
- package/dist/{validation-utils-B7SXPkm7.cjs → validation-utils-Dg0hW6dn.cjs} +52 -6
- package/dist/{validator-CewfnGZj.d.mts → validator-Drb2N-YL.d.cts} +1 -1
- package/dist/{validator-CewfnGZj.d.cts → validator-Drb2N-YL.d.mts} +1 -1
- package/dist/validator.d.cts +1 -1
- package/dist/validator.d.mts +1 -1
- package/package.json +1 -1
- package/dist/agg-CvXDGnKi.mjs +0 -61
- package/dist/agg-EcIbAFnJ.cjs +0 -78
- package/dist/db-space-9CH5neN7.d.mts +0 -439
- package/dist/db-space-BdtBNTeH.d.cts +0 -439
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { AggregateControls, AggregateExpr as AggregateExpr$1, AggregateFn, AggregateFn as AggregateFn$1, AggregateQuery as AggregateQuery$1, AggregateResult, BucketExpr, BucketUnit as BucketUnit$1, CalendarBucketLabel, ComputedExpr, ResolvedBucket as ResolvedBucket$1, WeekStart, isAggregateExpr, isBucketExpr, resolveAlias } from "@uniqu/core";
|
|
2
2
|
|
|
3
3
|
//#region src/query/aggregate-fns.d.ts
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The aggregate functions atscript-db knows — uniqu's full `AggregateFn` set.
|
|
6
|
+
* Which of them an adapter renders is its `aggregateFns()` capability.
|
|
7
|
+
*/
|
|
8
|
+
type TDbAggregateFn = AggregateFn;
|
|
9
|
+
/**
|
|
10
|
+
* Every aggregate function — what an adapter that renders them all returns
|
|
11
|
+
* from `aggregateFns()`.
|
|
12
|
+
*
|
|
13
|
+
* @since 0.1.136
|
|
14
|
+
*/
|
|
15
|
+
declare const ALL_AGGREGATE_FNS: ReadonlySet<TDbAggregateFn>;
|
|
6
16
|
/**
|
|
7
17
|
* Throws `DbError` `INVALID_QUERY` (uniqu's wording) unless `fn` is in
|
|
8
18
|
* `SUPPORTED_AGGREGATE_FNS` — for adapters to re-assert before rendering.
|
|
@@ -40,4 +50,4 @@ declare function resolveAggregateSearch(controls: {
|
|
|
40
50
|
[key: `$${string}`]: unknown;
|
|
41
51
|
} | undefined): TAggregateSearch | undefined;
|
|
42
52
|
//#endregion
|
|
43
|
-
export {
|
|
53
|
+
export { TDbAggregateFn as _, AggregateResult as a, CalendarBucketLabel as c, WeekStart as d, isAggregateExpr as f, ALL_AGGREGATE_FNS as g, resolveAlias as h, AggregateQuery$1 as i, ComputedExpr as l, resolveAggregateSearch as m, AggregateExpr$1 as n, BucketExpr as o, isBucketExpr as p, AggregateFn$1 as r, BucketUnit$1 as s, AggregateControls as t, ResolvedBucket$1 as u, assertAggregateFn as v };
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { AggregateControls, AggregateExpr as AggregateExpr$1, AggregateFn, AggregateFn as AggregateFn$1, AggregateQuery as AggregateQuery$1, AggregateResult, BucketExpr, BucketUnit as BucketUnit$1, CalendarBucketLabel, ComputedExpr, ResolvedBucket as ResolvedBucket$1, WeekStart, isAggregateExpr as isAggregateExpr$1, isBucketExpr as isBucketExpr$1, resolveAlias } from "@uniqu/core";
|
|
2
2
|
|
|
3
3
|
//#region src/query/aggregate-fns.d.ts
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The aggregate functions atscript-db knows — uniqu's full `AggregateFn` set.
|
|
6
|
+
* Which of them an adapter renders is its `aggregateFns()` capability.
|
|
7
|
+
*/
|
|
8
|
+
type TDbAggregateFn = AggregateFn;
|
|
9
|
+
/**
|
|
10
|
+
* Every aggregate function — what an adapter that renders them all returns
|
|
11
|
+
* from `aggregateFns()`.
|
|
12
|
+
*
|
|
13
|
+
* @since 0.1.136
|
|
14
|
+
*/
|
|
15
|
+
declare const ALL_AGGREGATE_FNS: ReadonlySet<TDbAggregateFn>;
|
|
6
16
|
/**
|
|
7
17
|
* Throws `DbError` `INVALID_QUERY` (uniqu's wording) unless `fn` is in
|
|
8
18
|
* `SUPPORTED_AGGREGATE_FNS` — for adapters to re-assert before rendering.
|
|
@@ -40,4 +50,4 @@ declare function resolveAggregateSearch(controls: {
|
|
|
40
50
|
[key: `$${string}`]: unknown;
|
|
41
51
|
} | undefined): TAggregateSearch | undefined;
|
|
42
52
|
//#endregion
|
|
43
|
-
export {
|
|
53
|
+
export { TDbAggregateFn as _, AggregateResult as a, CalendarBucketLabel as c, WeekStart as d, isAggregateExpr$1 as f, ALL_AGGREGATE_FNS as g, resolveAlias as h, AggregateQuery$1 as i, ComputedExpr as l, resolveAggregateSearch as m, AggregateExpr$1 as n, BucketExpr as o, isBucketExpr$1 as p, AggregateFn$1 as r, BucketUnit$1 as s, AggregateControls as t, ResolvedBucket$1 as u, assertAggregateFn as v };
|
package/dist/agg.cjs
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_aggregate_fns = require("./aggregate-fns-CGBv3E8S.cjs");
|
|
3
3
|
let _uniqu_core = require("@uniqu/core");
|
|
4
|
-
|
|
4
|
+
//#region src/agg.ts
|
|
5
|
+
/**
|
|
6
|
+
* Reads the `$search` / `$index` controls of an aggregate query.
|
|
7
|
+
*
|
|
8
|
+
* Search and grouping are orthogonal: `$search` narrows the ROWS, `$groupBy`
|
|
9
|
+
* shapes what is left. Every adapter must therefore apply the search predicate
|
|
10
|
+
* BEFORE grouping, so the groups — and `$count`, which counts them — only ever
|
|
11
|
+
* describe rows that matched. An adapter that silently ignored the term would
|
|
12
|
+
* report totals for rows the same search excludes from the leaf list.
|
|
13
|
+
*
|
|
14
|
+
* Two rules the leaf search path applies and the grouped path must NOT:
|
|
15
|
+
* - **No implicit relevance ordering.** Relevance is a property of a row, not
|
|
16
|
+
* of a group; after `$group` there is no per-row score left to sort on.
|
|
17
|
+
* Grouped results order by `$sort` or not at all.
|
|
18
|
+
* - **No implicit row cap.** The leaf runners cap an unbounded search at 1000
|
|
19
|
+
* rows; applying that before `$group` would silently truncate group counts.
|
|
20
|
+
*
|
|
21
|
+
* Returns `undefined` when there is nothing to search for, so callers fall
|
|
22
|
+
* straight through to the plain grouped path.
|
|
23
|
+
*/
|
|
24
|
+
function resolveAggregateSearch(controls) {
|
|
25
|
+
const raw = controls?.$search;
|
|
26
|
+
if (typeof raw !== "string") return;
|
|
27
|
+
const text = raw.trim();
|
|
28
|
+
if (!text) return;
|
|
29
|
+
const index = controls?.$index;
|
|
30
|
+
return {
|
|
31
|
+
text,
|
|
32
|
+
indexName: typeof index === "string" && index ? index : void 0
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
exports.assertAggregateFn = require_aggregate_fns.assertAggregateFn;
|
|
5
37
|
Object.defineProperty(exports, "isAggregateExpr", {
|
|
6
38
|
enumerable: true,
|
|
7
39
|
get: function() {
|
|
@@ -14,7 +46,7 @@ Object.defineProperty(exports, "isBucketExpr", {
|
|
|
14
46
|
return _uniqu_core.isBucketExpr;
|
|
15
47
|
}
|
|
16
48
|
});
|
|
17
|
-
exports.resolveAggregateSearch =
|
|
49
|
+
exports.resolveAggregateSearch = resolveAggregateSearch;
|
|
18
50
|
Object.defineProperty(exports, "resolveAlias", {
|
|
19
51
|
enumerable: true,
|
|
20
52
|
get: function() {
|
package/dist/agg.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as TResolvedBucket } from "./buckets-
|
|
2
|
-
import { _ as
|
|
1
|
+
import { n as TResolvedBucket } from "./buckets-C-27xmtq.cjs";
|
|
2
|
+
import { _ as TDbAggregateFn, a as AggregateResult, c as CalendarBucketLabel, d as WeekStart, f as isAggregateExpr, h as resolveAlias, i as AggregateQuery, l as ComputedExpr, m as resolveAggregateSearch, n as AggregateExpr, o as BucketExpr, p as isBucketExpr, r as AggregateFn, s as BucketUnit, t as AggregateControls, u as ResolvedBucket, v as assertAggregateFn } from "./agg-CV7y8nC6.cjs";
|
|
3
3
|
export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, type BucketExpr, type BucketUnit, type CalendarBucketLabel, type ComputedExpr, type ResolvedBucket, type TDbAggregateFn, type TResolvedBucket, type WeekStart, assertAggregateFn, isAggregateExpr, isBucketExpr, resolveAggregateSearch, resolveAlias };
|
package/dist/agg.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as TResolvedBucket } from "./buckets-
|
|
2
|
-
import { _ as
|
|
1
|
+
import { n as TResolvedBucket } from "./buckets-BFG2RYRW.mjs";
|
|
2
|
+
import { _ as TDbAggregateFn, a as AggregateResult, c as CalendarBucketLabel, d as WeekStart, f as isAggregateExpr, h as resolveAlias, i as AggregateQuery, l as ComputedExpr, m as resolveAggregateSearch, n as AggregateExpr, o as BucketExpr, p as isBucketExpr, r as AggregateFn, s as BucketUnit, t as AggregateControls, u as ResolvedBucket, v as assertAggregateFn } from "./agg-D5DHsAby.mjs";
|
|
3
3
|
export { type AggregateControls, type AggregateExpr, type AggregateFn, type AggregateQuery, type AggregateResult, type BucketExpr, type BucketUnit, type CalendarBucketLabel, type ComputedExpr, type ResolvedBucket, type TDbAggregateFn, type TResolvedBucket, type WeekStart, assertAggregateFn, isAggregateExpr, isBucketExpr, resolveAggregateSearch, resolveAlias };
|
package/dist/agg.mjs
CHANGED
|
@@ -1,2 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as assertAggregateFn } from "./aggregate-fns-CfsveE1w.mjs";
|
|
2
|
+
import { isAggregateExpr, isBucketExpr, resolveAlias } from "@uniqu/core";
|
|
3
|
+
//#region src/agg.ts
|
|
4
|
+
/**
|
|
5
|
+
* Reads the `$search` / `$index` controls of an aggregate query.
|
|
6
|
+
*
|
|
7
|
+
* Search and grouping are orthogonal: `$search` narrows the ROWS, `$groupBy`
|
|
8
|
+
* shapes what is left. Every adapter must therefore apply the search predicate
|
|
9
|
+
* BEFORE grouping, so the groups — and `$count`, which counts them — only ever
|
|
10
|
+
* describe rows that matched. An adapter that silently ignored the term would
|
|
11
|
+
* report totals for rows the same search excludes from the leaf list.
|
|
12
|
+
*
|
|
13
|
+
* Two rules the leaf search path applies and the grouped path must NOT:
|
|
14
|
+
* - **No implicit relevance ordering.** Relevance is a property of a row, not
|
|
15
|
+
* of a group; after `$group` there is no per-row score left to sort on.
|
|
16
|
+
* Grouped results order by `$sort` or not at all.
|
|
17
|
+
* - **No implicit row cap.** The leaf runners cap an unbounded search at 1000
|
|
18
|
+
* rows; applying that before `$group` would silently truncate group counts.
|
|
19
|
+
*
|
|
20
|
+
* Returns `undefined` when there is nothing to search for, so callers fall
|
|
21
|
+
* straight through to the plain grouped path.
|
|
22
|
+
*/
|
|
23
|
+
function resolveAggregateSearch(controls) {
|
|
24
|
+
const raw = controls?.$search;
|
|
25
|
+
if (typeof raw !== "string") return;
|
|
26
|
+
const text = raw.trim();
|
|
27
|
+
if (!text) return;
|
|
28
|
+
const index = controls?.$index;
|
|
29
|
+
return {
|
|
30
|
+
text,
|
|
31
|
+
indexName: typeof index === "string" && index ? index : void 0
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
2
35
|
export { assertAggregateFn, isAggregateExpr, isBucketExpr, resolveAggregateSearch, resolveAlias };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const require_db_error = require("./db-error-DTkkeu5b.cjs");
|
|
2
|
+
//#region src/query/aggregate-fns.ts
|
|
3
|
+
/**
|
|
4
|
+
* The only `$fn` names a `$select` aggregate may use. Any other name is rejected with
|
|
5
|
+
* `INVALID_QUERY` (HTTP 400 through moost-db) before a query reaches an
|
|
6
|
+
* adapter, so no adapter ever renders an unchecked function name into SQL or
|
|
7
|
+
* a pipeline. A known name missing from the adapter's `aggregateFns()` is
|
|
8
|
+
* `AGG_FN_NOT_SUPPORTED`.
|
|
9
|
+
*/
|
|
10
|
+
const SUPPORTED_AGGREGATE_FNS = [
|
|
11
|
+
"sum",
|
|
12
|
+
"count",
|
|
13
|
+
"avg",
|
|
14
|
+
"min",
|
|
15
|
+
"max",
|
|
16
|
+
"countDistinct"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* The aggregates that are NULL over no (non-null) value — every function but
|
|
20
|
+
* the counts, which are 0. So a view field reading a left-joined table must be
|
|
21
|
+
* optional unless it counts, and a CONDITIONAL one must be optional when no
|
|
22
|
+
* row may match — except `sum`, whose conditional form is rendered as
|
|
23
|
+
* `COALESCE(…, 0)`.
|
|
24
|
+
*/
|
|
25
|
+
const NULL_WHEN_EMPTY_AGGREGATE_FNS = new Set([
|
|
26
|
+
"sum",
|
|
27
|
+
"avg",
|
|
28
|
+
"min",
|
|
29
|
+
"max"
|
|
30
|
+
]);
|
|
31
|
+
/** `BaseDbAdapter.aggregateFns()` by default: every function except `countDistinct`. */
|
|
32
|
+
const BASE_AGGREGATE_FNS = new Set([
|
|
33
|
+
"sum",
|
|
34
|
+
"count",
|
|
35
|
+
"avg",
|
|
36
|
+
"min",
|
|
37
|
+
"max"
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* Every aggregate function — what an adapter that renders them all returns
|
|
41
|
+
* from `aggregateFns()`.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.1.136
|
|
44
|
+
*/
|
|
45
|
+
const ALL_AGGREGATE_FNS = new Set(SUPPORTED_AGGREGATE_FNS);
|
|
46
|
+
const SUPPORTED_LIST = `${SUPPORTED_AGGREGATE_FNS.slice(0, -1).join(", ")} or ${SUPPORTED_AGGREGATE_FNS.at(-1)}`;
|
|
47
|
+
/**
|
|
48
|
+
* Throws `DbError` `INVALID_QUERY` (uniqu's wording) unless `fn` is in
|
|
49
|
+
* `SUPPORTED_AGGREGATE_FNS` — for adapters to re-assert before rendering.
|
|
50
|
+
*/
|
|
51
|
+
function assertAggregateFn(fn, path = "$select") {
|
|
52
|
+
if (!SUPPORTED_AGGREGATE_FNS.includes(fn)) throw new require_db_error.DbError("INVALID_QUERY", [{
|
|
53
|
+
path,
|
|
54
|
+
message: `Unknown aggregate function "${String(fn)}" — use ${SUPPORTED_LIST}`
|
|
55
|
+
}]);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
Object.defineProperty(exports, "ALL_AGGREGATE_FNS", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function() {
|
|
61
|
+
return ALL_AGGREGATE_FNS;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "BASE_AGGREGATE_FNS", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function() {
|
|
67
|
+
return BASE_AGGREGATE_FNS;
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "NULL_WHEN_EMPTY_AGGREGATE_FNS", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function() {
|
|
73
|
+
return NULL_WHEN_EMPTY_AGGREGATE_FNS;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
Object.defineProperty(exports, "SUPPORTED_AGGREGATE_FNS", {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function() {
|
|
79
|
+
return SUPPORTED_AGGREGATE_FNS;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "assertAggregateFn", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: function() {
|
|
85
|
+
return assertAggregateFn;
|
|
86
|
+
}
|
|
87
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { r as DbError } from "./db-error-D5uilS_A.mjs";
|
|
2
|
+
//#region src/query/aggregate-fns.ts
|
|
3
|
+
/**
|
|
4
|
+
* The only `$fn` names a `$select` aggregate may use. Any other name is rejected with
|
|
5
|
+
* `INVALID_QUERY` (HTTP 400 through moost-db) before a query reaches an
|
|
6
|
+
* adapter, so no adapter ever renders an unchecked function name into SQL or
|
|
7
|
+
* a pipeline. A known name missing from the adapter's `aggregateFns()` is
|
|
8
|
+
* `AGG_FN_NOT_SUPPORTED`.
|
|
9
|
+
*/
|
|
10
|
+
const SUPPORTED_AGGREGATE_FNS = [
|
|
11
|
+
"sum",
|
|
12
|
+
"count",
|
|
13
|
+
"avg",
|
|
14
|
+
"min",
|
|
15
|
+
"max",
|
|
16
|
+
"countDistinct"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* The aggregates that are NULL over no (non-null) value — every function but
|
|
20
|
+
* the counts, which are 0. So a view field reading a left-joined table must be
|
|
21
|
+
* optional unless it counts, and a CONDITIONAL one must be optional when no
|
|
22
|
+
* row may match — except `sum`, whose conditional form is rendered as
|
|
23
|
+
* `COALESCE(…, 0)`.
|
|
24
|
+
*/
|
|
25
|
+
const NULL_WHEN_EMPTY_AGGREGATE_FNS = new Set([
|
|
26
|
+
"sum",
|
|
27
|
+
"avg",
|
|
28
|
+
"min",
|
|
29
|
+
"max"
|
|
30
|
+
]);
|
|
31
|
+
/** `BaseDbAdapter.aggregateFns()` by default: every function except `countDistinct`. */
|
|
32
|
+
const BASE_AGGREGATE_FNS = new Set([
|
|
33
|
+
"sum",
|
|
34
|
+
"count",
|
|
35
|
+
"avg",
|
|
36
|
+
"min",
|
|
37
|
+
"max"
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* Every aggregate function — what an adapter that renders them all returns
|
|
41
|
+
* from `aggregateFns()`.
|
|
42
|
+
*
|
|
43
|
+
* @since 0.1.136
|
|
44
|
+
*/
|
|
45
|
+
const ALL_AGGREGATE_FNS = new Set(SUPPORTED_AGGREGATE_FNS);
|
|
46
|
+
const SUPPORTED_LIST = `${SUPPORTED_AGGREGATE_FNS.slice(0, -1).join(", ")} or ${SUPPORTED_AGGREGATE_FNS.at(-1)}`;
|
|
47
|
+
/**
|
|
48
|
+
* Throws `DbError` `INVALID_QUERY` (uniqu's wording) unless `fn` is in
|
|
49
|
+
* `SUPPORTED_AGGREGATE_FNS` — for adapters to re-assert before rendering.
|
|
50
|
+
*/
|
|
51
|
+
function assertAggregateFn(fn, path = "$select") {
|
|
52
|
+
if (!SUPPORTED_AGGREGATE_FNS.includes(fn)) throw new DbError("INVALID_QUERY", [{
|
|
53
|
+
path,
|
|
54
|
+
message: `Unknown aggregate function "${String(fn)}" — use ${SUPPORTED_LIST}`
|
|
55
|
+
}]);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { assertAggregateFn as a, SUPPORTED_AGGREGATE_FNS as i, BASE_AGGREGATE_FNS as n, NULL_WHEN_EMPTY_AGGREGATE_FNS as r, ALL_AGGREGATE_FNS as t };
|