@rebasepro/server-postgres 0.19.2-canary.g9b599d4 → 0.20.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/dist/index.es.js +24 -2
- package/dist/index.es.js.map +1 -1
- package/dist/services/FetchService.d.ts +25 -0
- package/package.json +7 -7
|
@@ -11,6 +11,31 @@ import { type WithDeleted } from "./soft-delete.js";
|
|
|
11
11
|
* Service for handling all row read operations.
|
|
12
12
|
* Handles fetching, searching, counting, and filtering rows.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* Which aggregate aliases hold a number that Postgres handed back as a string.
|
|
16
|
+
*
|
|
17
|
+
* `count`, `sum` and `avg` always do: bigint and numeric are returned as text
|
|
18
|
+
* because they do not fit a JS number in general. `min` and `max` are uncast,
|
|
19
|
+
* so they do it too — but only over a numeric column, and those are the two
|
|
20
|
+
* functions that also apply to text and dates.
|
|
21
|
+
*
|
|
22
|
+
* Decided by the column's DECLARED type, not by trying `Number()` on the value.
|
|
23
|
+
* `?select=avg(price),max(price)` used to answer `{avg_price: 5,
|
|
24
|
+
* max_price: "8.5"}` — one column, two functions, two JSON types, and
|
|
25
|
+
* arithmetic on the second one silently concatenates. Parsing whatever looks
|
|
26
|
+
* numeric would fix that and break something worse: a `min(sku)` of `"00123"`
|
|
27
|
+
* would come back as `123`, a different value, and no NaN check would catch it.
|
|
28
|
+
*
|
|
29
|
+
* Exported to be tested: the parsing itself needs a database, this decision
|
|
30
|
+
* does not.
|
|
31
|
+
*/
|
|
32
|
+
export declare function numericAggregateAliases(aggregates: {
|
|
33
|
+
fn: "count" | "sum" | "avg" | "min" | "max";
|
|
34
|
+
field?: string;
|
|
35
|
+
alias: string;
|
|
36
|
+
}[], properties: Record<string, {
|
|
37
|
+
type?: string;
|
|
38
|
+
}>): Set<string>;
|
|
14
39
|
export declare class FetchService {
|
|
15
40
|
private db;
|
|
16
41
|
private registry;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/server-postgres",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "PostgreSQL data source backend implementation for Rebase with Drizzle ORM",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"execa": "^9.6.1",
|
|
51
51
|
"pg": "^8.22.0",
|
|
52
52
|
"ws": "^8.21.1",
|
|
53
|
-
"@rebasepro/codegen": "0.
|
|
54
|
-
"@rebasepro/
|
|
55
|
-
"@rebasepro/
|
|
56
|
-
"@rebasepro/
|
|
57
|
-
"@rebasepro/
|
|
53
|
+
"@rebasepro/codegen": "0.20.0",
|
|
54
|
+
"@rebasepro/common": "0.20.0",
|
|
55
|
+
"@rebasepro/server": "0.20.0",
|
|
56
|
+
"@rebasepro/types": "0.20.0",
|
|
57
|
+
"@rebasepro/utils": "0.20.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@electric-sql/pglite": "0.5.6",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"typescript": "^6.0.3",
|
|
71
71
|
"vite": "^8.1.5",
|
|
72
72
|
"vitest": "^4.1.10",
|
|
73
|
-
"@rebasepro/client": "0.
|
|
73
|
+
"@rebasepro/client": "0.20.0"
|
|
74
74
|
},
|
|
75
75
|
"gitHead": "d935eefa5aa8d1009a2398cfac2c1e4ee9aeb6b6",
|
|
76
76
|
"publishConfig": {
|