prostgles-server 2.0.153 → 2.0.156
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/DBEventsManager.d.ts.map +1 -1
- package/dist/DBEventsManager.js +1 -2
- package/dist/DBEventsManager.js.map +1 -1
- package/dist/DboBuilder.d.ts +0 -1
- package/dist/DboBuilder.d.ts.map +1 -1
- package/dist/DboBuilder.js +4 -8
- package/dist/DboBuilder.js.map +1 -1
- package/dist/FileManager.js +1 -2
- package/dist/FileManager.js.map +1 -1
- package/dist/Filtering.d.ts.map +1 -1
- package/dist/Filtering.js +1 -1
- package/dist/Filtering.js.map +1 -1
- package/dist/Prostgles.d.ts.map +1 -1
- package/dist/Prostgles.js +6 -6
- package/dist/Prostgles.js.map +1 -1
- package/dist/PubSubManager.d.ts +1 -1
- package/dist/PubSubManager.d.ts.map +1 -1
- package/dist/PubSubManager.js +4 -3
- package/dist/PubSubManager.js.map +1 -1
- package/dist/QueryBuilder.d.ts.map +1 -1
- package/dist/QueryBuilder.js +4 -2
- package/dist/QueryBuilder.js.map +1 -1
- package/dist/TableConfig.d.ts.map +1 -1
- package/dist/TableConfig.js +2 -3
- package/dist/TableConfig.js.map +1 -1
- package/lib/DBEventsManager.ts +2 -2
- package/lib/DboBuilder.ts +3 -5
- package/lib/FileManager.ts +2 -2
- package/lib/Filtering.ts +2 -2
- package/lib/Prostgles.ts +2 -2
- package/lib/PubSubManager.ts +766 -765
- package/lib/QueryBuilder.ts +4 -3
- package/lib/TableConfig.ts +3 -3
- package/package.json +2 -2
- package/tests/client/PID.txt +1 -1
- package/tests/client/package-lock.json +15 -15
- package/tests/client/package.json +1 -1
- package/tests/client_only_queries.js +16 -8
- package/tests/client_only_queries.ts +18 -8
- package/tests/server/package-lock.json +3 -3
package/lib/QueryBuilder.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { pgp, Filter, LocalParams, isPlainObject, TableHandler, ViewHandler, postgresToTsType } from "./DboBuilder";
|
|
8
8
|
import { TableRule } from "./Prostgles";
|
|
9
|
-
import { SelectParamsBasic as SelectParams, isEmpty, FieldFilter, asName, TextFilter_FullTextSearchFilterKeys,
|
|
9
|
+
import { SelectParamsBasic as SelectParams, isEmpty, FieldFilter, asName, TextFilter_FullTextSearchFilterKeys, ColumnInfo, PG_COLUMN_UDT_DATA_TYPE, isObject } from "prostgles-types";
|
|
10
10
|
import { get } from "./utils";
|
|
11
11
|
|
|
12
12
|
|
|
@@ -692,9 +692,10 @@ export const FUNCTIONS: FunctionSpec[] = [
|
|
|
692
692
|
if(![1,2].includes(validCols)) throw new Error("Must have one or two column names")
|
|
693
693
|
const [leftField, rightField] = args;
|
|
694
694
|
const leftQ = asNameAlias(leftField, tableAlias);
|
|
695
|
-
|
|
695
|
+
let rightQ = rightField? asNameAlias(rightField, tableAlias) : "";
|
|
696
696
|
if(funcName === "age"){
|
|
697
|
-
|
|
697
|
+
if(rightQ) rightQ = ", " + rightQ;
|
|
698
|
+
return `${funcName}(${leftQ} ${rightQ})`;
|
|
698
699
|
} else {
|
|
699
700
|
return `${leftQ} - ${rightQ}`;
|
|
700
701
|
}
|
package/lib/TableConfig.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getKeys, asName } from "prostgles-types";
|
|
2
|
+
import { JoinInfo } from "./DboBuilder";
|
|
3
|
+
import { ALLOWED_EXTENSION, ALLOWED_CONTENT_TYPE } from "./FileManager";
|
|
4
4
|
import { DB, DbHandler, Prostgles } from "./Prostgles";
|
|
5
5
|
import { asValue } from "./PubSubManager";
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prostgles-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.156",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"bluebird": "^3.7.2",
|
|
30
30
|
"file-type": "^16.5.3",
|
|
31
31
|
"pg-promise": "^10.11.1",
|
|
32
|
-
"prostgles-types": "^1.5.
|
|
32
|
+
"prostgles-types": "^1.5.130",
|
|
33
33
|
"sharp": "^0.30.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/tests/client/PID.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
10445
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@types/node": "^14.14.16",
|
|
13
13
|
"@types/socket.io-client": "^1.4.35",
|
|
14
|
-
"prostgles-client": "^1.5.
|
|
14
|
+
"prostgles-client": "^1.5.143",
|
|
15
15
|
"prostgles-types": "^1.5.68",
|
|
16
16
|
"socket.io-client": "^4.5.1"
|
|
17
17
|
}
|
|
@@ -73,17 +73,17 @@
|
|
|
73
73
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
74
74
|
},
|
|
75
75
|
"node_modules/prostgles-client": {
|
|
76
|
-
"version": "1.5.
|
|
77
|
-
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.
|
|
78
|
-
"integrity": "sha512-
|
|
76
|
+
"version": "1.5.143",
|
|
77
|
+
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.143.tgz",
|
|
78
|
+
"integrity": "sha512-1+YpgEAvDCdbl0MWZnSjr75Wjo7wDYOSAVCflunJpUs9zsELqIumB1dCmrMRDCKM4UsQxgoFLHDtU6MxJDm7Ug==",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"prostgles-types": "^1.5.
|
|
80
|
+
"prostgles-types": "^1.5.130"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
"node_modules/prostgles-types": {
|
|
84
|
-
"version": "1.5.
|
|
85
|
-
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.
|
|
86
|
-
"integrity": "sha512-
|
|
84
|
+
"version": "1.5.130",
|
|
85
|
+
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.130.tgz",
|
|
86
|
+
"integrity": "sha512-Kv3c6ennbBVITVjdFYFS9WVNzbC1XVnPN59kA73zgzbhRbRjcHRCzW9MbZjZeHvX5PTICHF4a+XnpHMVF58tTA=="
|
|
87
87
|
},
|
|
88
88
|
"node_modules/socket.io-client": {
|
|
89
89
|
"version": "4.5.1",
|
|
@@ -187,17 +187,17 @@
|
|
|
187
187
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
188
188
|
},
|
|
189
189
|
"prostgles-client": {
|
|
190
|
-
"version": "1.5.
|
|
191
|
-
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.
|
|
192
|
-
"integrity": "sha512-
|
|
190
|
+
"version": "1.5.143",
|
|
191
|
+
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.143.tgz",
|
|
192
|
+
"integrity": "sha512-1+YpgEAvDCdbl0MWZnSjr75Wjo7wDYOSAVCflunJpUs9zsELqIumB1dCmrMRDCKM4UsQxgoFLHDtU6MxJDm7Ug==",
|
|
193
193
|
"requires": {
|
|
194
|
-
"prostgles-types": "^1.5.
|
|
194
|
+
"prostgles-types": "^1.5.130"
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
197
|
"prostgles-types": {
|
|
198
|
-
"version": "1.5.
|
|
199
|
-
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.
|
|
200
|
-
"integrity": "sha512-
|
|
198
|
+
"version": "1.5.130",
|
|
199
|
+
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.130.tgz",
|
|
200
|
+
"integrity": "sha512-Kv3c6ennbBVITVjdFYFS9WVNzbC1XVnPN59kA73zgzbhRbRjcHRCzW9MbZjZeHvX5PTICHF4a+XnpHMVF58tTA=="
|
|
201
201
|
},
|
|
202
202
|
"socket.io-client": {
|
|
203
203
|
"version": "4.5.1",
|
|
@@ -69,12 +69,6 @@ async function client_only(db, auth, log, methods) {
|
|
|
69
69
|
}, log);
|
|
70
70
|
/* REPLICATION */
|
|
71
71
|
let start = Date.now();
|
|
72
|
-
const msLimit = 20000;
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
const msg = "Replication test failed due to taking longer than " + msLimit + "ms";
|
|
75
|
-
log(msg);
|
|
76
|
-
reject(msg);
|
|
77
|
-
}, msLimit);
|
|
78
72
|
await db.planes.delete();
|
|
79
73
|
let inserts = new Array(100).fill(null).map((d, i) => ({ id: i, flight_number: `FN${i}`, x: Math.random(), y: i }));
|
|
80
74
|
await db.planes.insert(inserts);
|
|
@@ -131,8 +125,22 @@ async function client_only(db, auth, log, methods) {
|
|
|
131
125
|
resolve(true);
|
|
132
126
|
}
|
|
133
127
|
});
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
const msLimit = 20000;
|
|
129
|
+
setTimeout(async () => {
|
|
130
|
+
const dbCounts = {
|
|
131
|
+
x10: await db.planes.count({ x: 10 }),
|
|
132
|
+
x20: await db.planes.count({ x: 20 }),
|
|
133
|
+
latest: await db.planes.findOne({}, { orderBy: { last_updated: -1 } }),
|
|
134
|
+
};
|
|
135
|
+
const syncCounts = {
|
|
136
|
+
x10: sync?.getItems().filter(d => d.x == 10),
|
|
137
|
+
x20: sync?.getItems().filter(d => d.x == 20),
|
|
138
|
+
latest: sync?.getItems()?.sort((a, b) => +b.last_updated - +a.last_updated)[0],
|
|
139
|
+
};
|
|
140
|
+
const msg = "Replication test failed due to taking longer than " + msLimit + "ms \n " + JSON.stringify({ dbCounts, syncCounts }, null, 2);
|
|
141
|
+
log(msg);
|
|
142
|
+
reject(msg);
|
|
143
|
+
}, msLimit);
|
|
136
144
|
}
|
|
137
145
|
catch (err) {
|
|
138
146
|
log(JSON.stringify(err));
|
|
@@ -79,12 +79,6 @@ export default async function client_only(db: DBHandlerClient, auth: Auth, log:
|
|
|
79
79
|
|
|
80
80
|
/* REPLICATION */
|
|
81
81
|
let start = Date.now();
|
|
82
|
-
const msLimit = 20000;
|
|
83
|
-
setTimeout(() => {
|
|
84
|
-
const msg = "Replication test failed due to taking longer than " + msLimit + "ms";
|
|
85
|
-
log(msg)
|
|
86
|
-
reject(msg)
|
|
87
|
-
}, msLimit);
|
|
88
82
|
|
|
89
83
|
await db.planes.delete();
|
|
90
84
|
let inserts = new Array(100).fill(null).map((d, i) => ({ id: i, flight_number: `FN${i}`, x: Math.random(), y: i }));
|
|
@@ -149,8 +143,24 @@ export default async function client_only(db: DBHandlerClient, auth: Auth, log:
|
|
|
149
143
|
resolve(true)
|
|
150
144
|
}
|
|
151
145
|
});
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
const msLimit = 20000;
|
|
149
|
+
setTimeout(async () => {
|
|
150
|
+
const dbCounts = {
|
|
151
|
+
x10: await db.planes.count({ x: 10 }),
|
|
152
|
+
x20: await db.planes.count({ x: 20 }),
|
|
153
|
+
latest: await db.planes.findOne({}, { orderBy: { last_updated: -1 } }),
|
|
154
|
+
}
|
|
155
|
+
const syncCounts = {
|
|
156
|
+
x10: sync?.getItems().filter(d => d.x == 10),
|
|
157
|
+
x20: sync?.getItems().filter(d => d.x == 20),
|
|
158
|
+
latest: sync?.getItems()?.sort((a, b) => +b.last_updated - +a.last_updated )[0],
|
|
159
|
+
}
|
|
160
|
+
const msg = "Replication test failed due to taking longer than " + msLimit + "ms \n " + JSON.stringify({ dbCounts, syncCounts }, null, 2);
|
|
161
|
+
log(msg)
|
|
162
|
+
reject(msg)
|
|
163
|
+
}, msLimit);
|
|
154
164
|
|
|
155
165
|
|
|
156
166
|
} catch(err){
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"../..": {
|
|
25
25
|
"name": "prostgles-server",
|
|
26
|
-
"version": "2.0.
|
|
26
|
+
"version": "2.0.155",
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@aws-sdk/client-s3": "^3.95.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"bluebird": "^3.7.2",
|
|
32
32
|
"file-type": "^16.5.3",
|
|
33
33
|
"pg-promise": "^10.11.1",
|
|
34
|
-
"prostgles-types": "^1.5.
|
|
34
|
+
"prostgles-types": "^1.5.130",
|
|
35
35
|
"sharp": "^0.30.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
@@ -1436,7 +1436,7 @@
|
|
|
1436
1436
|
"bluebird": "^3.7.2",
|
|
1437
1437
|
"file-type": "^16.5.3",
|
|
1438
1438
|
"pg-promise": "^10.11.1",
|
|
1439
|
-
"prostgles-types": "^1.5.
|
|
1439
|
+
"prostgles-types": "^1.5.130",
|
|
1440
1440
|
"sharp": "^0.30.5",
|
|
1441
1441
|
"typescript": "^4.7.2"
|
|
1442
1442
|
}
|