prostgles-server 2.0.174 → 2.0.175
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/.vscode/settings.json +3 -0
- package/dist/AuthHandler.d.ts +13 -12
- package/dist/AuthHandler.d.ts.map +1 -1
- package/dist/AuthHandler.js +5 -2
- package/dist/AuthHandler.js.map +1 -1
- package/dist/DBSchemaBuilder.d.ts +11 -0
- package/dist/DBSchemaBuilder.d.ts.map +1 -0
- package/dist/DBSchemaBuilder.js +56 -0
- package/dist/DBSchemaBuilder.js.map +1 -0
- package/dist/DboBuilder.d.ts +23 -22
- package/dist/DboBuilder.d.ts.map +1 -1
- package/dist/DboBuilder.js +34 -44
- package/dist/DboBuilder.js.map +1 -1
- package/dist/FileManager.d.ts +2 -2
- package/dist/FileManager.d.ts.map +1 -1
- package/dist/Filtering.d.ts.map +1 -1
- package/dist/Filtering.js.map +1 -1
- package/dist/Prostgles.d.ts +25 -260
- package/dist/Prostgles.d.ts.map +1 -1
- package/dist/Prostgles.js +5 -390
- package/dist/Prostgles.js.map +1 -1
- package/dist/PubSubManager.d.ts +6 -5
- package/dist/PubSubManager.d.ts.map +1 -1
- package/dist/PubSubManager.js.map +1 -1
- package/dist/PublishParser.d.ts +262 -0
- package/dist/PublishParser.d.ts.map +1 -0
- package/dist/PublishParser.js +391 -0
- package/dist/PublishParser.js.map +1 -0
- package/dist/QueryBuilder.d.ts +20 -4
- package/dist/QueryBuilder.d.ts.map +1 -1
- package/dist/QueryBuilder.js.map +1 -1
- package/dist/TableConfig.d.ts +2 -2
- package/dist/TableConfig.d.ts.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/lib/AuthHandler.ts +25 -19
- package/lib/DBSchemaBuilder.ts +91 -0
- package/lib/DboBuilder.ts +75 -81
- package/lib/FileManager.ts +2 -2
- package/lib/Filtering.ts +3 -3
- package/lib/Prostgles.ts +22 -721
- package/lib/PubSubManager.ts +6 -5
- package/lib/PublishParser.ts +723 -0
- package/lib/QueryBuilder.ts +6 -5
- package/lib/TableConfig.ts +2 -2
- package/lib/index.ts +4 -4
- 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/isomorphic_queries.ts +2 -2
- package/tests/server/DBoGenerated.d.ts +428 -286
- package/tests/server/index.js +0 -13
- package/tests/server/index.ts +4 -18
- package/tests/server/package-lock.json +3 -3
package/lib/QueryBuilder.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
|
|
7
7
|
import { pgp, Filter, LocalParams, isPlainObject, TableHandler, ViewHandler, postgresToTsType } from "./DboBuilder";
|
|
8
|
-
import { TableRule } from "./
|
|
9
|
-
import {
|
|
8
|
+
import { TableRule } from "./PublishParser";
|
|
9
|
+
import { SelectParams, isEmpty, FieldFilter, asName, TextFilter_FullTextSearchFilterKeys, ColumnInfo, PG_COLUMN_UDT_DATA_TYPE, isObject, Select } from "prostgles-types";
|
|
10
10
|
import { get } from "./utils";
|
|
11
11
|
|
|
12
12
|
|
|
@@ -200,7 +200,7 @@ const FTS_Funcs: FunctionSpec[] =
|
|
|
200
200
|
if(isPlainObject(qVal)){
|
|
201
201
|
const keys = Object.keys(qVal);
|
|
202
202
|
if(!keys.length) throw "Bad arg";
|
|
203
|
-
if(keys.length !==1 || !searchTypes.includes(keys[0])) throw "Expecting a an object with a single key named one of: " + searchTypes.join(", ");
|
|
203
|
+
if(keys.length !==1 || !searchTypes.includes(keys[0] as any)) throw "Expecting a an object with a single key named one of: " + searchTypes.join(", ");
|
|
204
204
|
qType = keys[0];
|
|
205
205
|
qVal = asValue(qVal[qType]);
|
|
206
206
|
|
|
@@ -1094,7 +1094,7 @@ export class SelectItemBuilder {
|
|
|
1094
1094
|
});
|
|
1095
1095
|
}
|
|
1096
1096
|
|
|
1097
|
-
parseUserSelect = async (userSelect:
|
|
1097
|
+
parseUserSelect = async (userSelect: Select, joinParse?: (key: string, val: any, throwErr: (msg: string) => any) => any) => {
|
|
1098
1098
|
|
|
1099
1099
|
/* Array select */
|
|
1100
1100
|
if(Array.isArray(userSelect)){
|
|
@@ -1113,7 +1113,8 @@ export class SelectItemBuilder {
|
|
|
1113
1113
|
return [];
|
|
1114
1114
|
} else if(userSelect === "*"){
|
|
1115
1115
|
this.allowedFields.map(key => this.addColumn(key, true) );
|
|
1116
|
-
|
|
1116
|
+
|
|
1117
|
+
} else if(isPlainObject(userSelect) && !isEmpty(userSelect)){
|
|
1117
1118
|
const selectKeys = Object.keys(userSelect),
|
|
1118
1119
|
selectValues = Object.values(userSelect);
|
|
1119
1120
|
|
package/lib/TableConfig.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getKeys, asName } from "prostgles-types";
|
|
2
2
|
import { JoinInfo } from "./DboBuilder";
|
|
3
3
|
import { ALLOWED_EXTENSION, ALLOWED_CONTENT_TYPE } from "./FileManager";
|
|
4
|
-
import { DB,
|
|
4
|
+
import { DB, DBHandlerServer, Prostgles } from "./Prostgles";
|
|
5
5
|
import { asValue } from "./PubSubManager";
|
|
6
6
|
|
|
7
7
|
type ColExtraInfo = {
|
|
@@ -184,7 +184,7 @@ export type TableConfig<LANG_IDS = { en: 1 }> = {
|
|
|
184
184
|
export default class TableConfigurator {
|
|
185
185
|
|
|
186
186
|
config?: TableConfig;
|
|
187
|
-
get dbo():
|
|
187
|
+
get dbo(): DBHandlerServer {
|
|
188
188
|
if(!this.prostgles.dbo) throw "this.prostgles.dbo missing"
|
|
189
189
|
return this.prostgles.dbo
|
|
190
190
|
};
|
package/lib/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Prostgles, ProstglesInitOptions } from "./Prostgles";
|
|
2
|
-
import {
|
|
2
|
+
import { DBSchema } from "prostgles-types";
|
|
3
3
|
|
|
4
|
-
function prostgles<
|
|
4
|
+
function prostgles<S extends DBSchema = any>(params: ProstglesInitOptions<S>){
|
|
5
5
|
|
|
6
|
-
let prgl = new Prostgles<
|
|
6
|
+
let prgl = new Prostgles<S>(params as any);
|
|
7
7
|
return prgl.init(params.onReady);
|
|
8
8
|
}
|
|
9
|
+
export = prostgles;//{ , TableHandler, ViewHandler };
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
// declare const init (params: InitOptions) => {
|
|
@@ -13,7 +14,6 @@ function prostgles<DBObj = DbHandler>(params: ProstglesInitOptions<DBObj>){
|
|
|
13
14
|
// prgl.init(params.isReady);
|
|
14
15
|
// }
|
|
15
16
|
|
|
16
|
-
export = prostgles;//{ , TableHandler, ViewHandler };
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prostgles-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.175",
|
|
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.153",
|
|
33
33
|
"sharp": "^0.30.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/tests/client/PID.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
77066
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@types/node": "^14.14.16",
|
|
13
|
-
"prostgles-client": "^1.5.
|
|
13
|
+
"prostgles-client": "^1.5.153",
|
|
14
14
|
"prostgles-types": "^1.5.68",
|
|
15
15
|
"socket.io-client": "^4.5.1"
|
|
16
16
|
}
|
|
@@ -67,17 +67,17 @@
|
|
|
67
67
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
68
68
|
},
|
|
69
69
|
"node_modules/prostgles-client": {
|
|
70
|
-
"version": "1.5.
|
|
71
|
-
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.
|
|
72
|
-
"integrity": "sha512-
|
|
70
|
+
"version": "1.5.153",
|
|
71
|
+
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.153.tgz",
|
|
72
|
+
"integrity": "sha512-kveb392Ye8XNgcWGmaMUg9PTQFVdb+f1RegK9TNVLLFG1b03hmsaVBAXCQvO5VvmGkW4rgQ5fZvfsEre5t+flg==",
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"prostgles-types": "^1.5.
|
|
74
|
+
"prostgles-types": "^1.5.153"
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"node_modules/prostgles-types": {
|
|
78
|
-
"version": "1.5.
|
|
79
|
-
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.
|
|
80
|
-
"integrity": "sha512-
|
|
78
|
+
"version": "1.5.153",
|
|
79
|
+
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.153.tgz",
|
|
80
|
+
"integrity": "sha512-TIPtsMFBGH3M01zGXMT1m7aVkr9cJgFryE8mOotJGTZUcaTaNA3s21wwGo4tbOVnyNqnyEgBolItb1s1DuNexg=="
|
|
81
81
|
},
|
|
82
82
|
"node_modules/socket.io-client": {
|
|
83
83
|
"version": "4.5.1",
|
|
@@ -176,17 +176,17 @@
|
|
|
176
176
|
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
|
177
177
|
},
|
|
178
178
|
"prostgles-client": {
|
|
179
|
-
"version": "1.5.
|
|
180
|
-
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.
|
|
181
|
-
"integrity": "sha512-
|
|
179
|
+
"version": "1.5.153",
|
|
180
|
+
"resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.153.tgz",
|
|
181
|
+
"integrity": "sha512-kveb392Ye8XNgcWGmaMUg9PTQFVdb+f1RegK9TNVLLFG1b03hmsaVBAXCQvO5VvmGkW4rgQ5fZvfsEre5t+flg==",
|
|
182
182
|
"requires": {
|
|
183
|
-
"prostgles-types": "^1.5.
|
|
183
|
+
"prostgles-types": "^1.5.153"
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"prostgles-types": {
|
|
187
|
-
"version": "1.5.
|
|
188
|
-
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.
|
|
189
|
-
"integrity": "sha512-
|
|
187
|
+
"version": "1.5.153",
|
|
188
|
+
"resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.153.tgz",
|
|
189
|
+
"integrity": "sha512-TIPtsMFBGH3M01zGXMT1m7aVkr9cJgFryE8mOotJGTZUcaTaNA3s21wwGo4tbOVnyNqnyEgBolItb1s1DuNexg=="
|
|
190
190
|
},
|
|
191
191
|
"socket.io-client": {
|
|
192
192
|
"version": "4.5.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { strict as assert } from 'assert';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { DBHandlerServer} from "../dist/Prostgles";
|
|
4
4
|
import { DBHandlerClient } from "./client/index";
|
|
5
5
|
import * as fs from "fs";
|
|
6
6
|
|
|
@@ -29,7 +29,7 @@ export function tryRunP(desc: string, func: (resolve: any, reject: any) => any,
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export default async function isomorphic(db: Partial<
|
|
32
|
+
export default async function isomorphic(db: Partial<DBHandlerServer> | Partial<DBHandlerClient>) {
|
|
33
33
|
console.log("Starting isomorphic queries");
|
|
34
34
|
|
|
35
35
|
if(await db.items.count()){
|