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.
Files changed (57) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/dist/AuthHandler.d.ts +13 -12
  3. package/dist/AuthHandler.d.ts.map +1 -1
  4. package/dist/AuthHandler.js +5 -2
  5. package/dist/AuthHandler.js.map +1 -1
  6. package/dist/DBSchemaBuilder.d.ts +11 -0
  7. package/dist/DBSchemaBuilder.d.ts.map +1 -0
  8. package/dist/DBSchemaBuilder.js +56 -0
  9. package/dist/DBSchemaBuilder.js.map +1 -0
  10. package/dist/DboBuilder.d.ts +23 -22
  11. package/dist/DboBuilder.d.ts.map +1 -1
  12. package/dist/DboBuilder.js +34 -44
  13. package/dist/DboBuilder.js.map +1 -1
  14. package/dist/FileManager.d.ts +2 -2
  15. package/dist/FileManager.d.ts.map +1 -1
  16. package/dist/Filtering.d.ts.map +1 -1
  17. package/dist/Filtering.js.map +1 -1
  18. package/dist/Prostgles.d.ts +25 -260
  19. package/dist/Prostgles.d.ts.map +1 -1
  20. package/dist/Prostgles.js +5 -390
  21. package/dist/Prostgles.js.map +1 -1
  22. package/dist/PubSubManager.d.ts +6 -5
  23. package/dist/PubSubManager.d.ts.map +1 -1
  24. package/dist/PubSubManager.js.map +1 -1
  25. package/dist/PublishParser.d.ts +262 -0
  26. package/dist/PublishParser.d.ts.map +1 -0
  27. package/dist/PublishParser.js +391 -0
  28. package/dist/PublishParser.js.map +1 -0
  29. package/dist/QueryBuilder.d.ts +20 -4
  30. package/dist/QueryBuilder.d.ts.map +1 -1
  31. package/dist/QueryBuilder.js.map +1 -1
  32. package/dist/TableConfig.d.ts +2 -2
  33. package/dist/TableConfig.d.ts.map +1 -1
  34. package/dist/index.d.ts +3 -3
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +4 -0
  37. package/dist/index.js.map +1 -1
  38. package/lib/AuthHandler.ts +25 -19
  39. package/lib/DBSchemaBuilder.ts +91 -0
  40. package/lib/DboBuilder.ts +75 -81
  41. package/lib/FileManager.ts +2 -2
  42. package/lib/Filtering.ts +3 -3
  43. package/lib/Prostgles.ts +22 -721
  44. package/lib/PubSubManager.ts +6 -5
  45. package/lib/PublishParser.ts +723 -0
  46. package/lib/QueryBuilder.ts +6 -5
  47. package/lib/TableConfig.ts +2 -2
  48. package/lib/index.ts +4 -4
  49. package/package.json +2 -2
  50. package/tests/client/PID.txt +1 -1
  51. package/tests/client/package-lock.json +15 -15
  52. package/tests/client/package.json +1 -1
  53. package/tests/isomorphic_queries.ts +2 -2
  54. package/tests/server/DBoGenerated.d.ts +428 -286
  55. package/tests/server/index.js +0 -13
  56. package/tests/server/index.ts +4 -18
  57. package/tests/server/package-lock.json +3 -3
@@ -5,8 +5,8 @@
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
 
7
7
  import { pgp, Filter, LocalParams, isPlainObject, TableHandler, ViewHandler, postgresToTsType } from "./DboBuilder";
8
- import { TableRule } from "./Prostgles";
9
- import { SelectParamsBasic as SelectParams, isEmpty, FieldFilter, asName, TextFilter_FullTextSearchFilterKeys, ColumnInfo, PG_COLUMN_UDT_DATA_TYPE, isObject } from "prostgles-types";
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: FieldFilter, joinParse?: (key: string, val: any, throwErr: (msg: string) => any) => any) => {
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
- } else if(isPlainObject(userSelect) && !isEmpty(userSelect as object)){
1116
+
1117
+ } else if(isPlainObject(userSelect) && !isEmpty(userSelect)){
1117
1118
  const selectKeys = Object.keys(userSelect),
1118
1119
  selectValues = Object.values(userSelect);
1119
1120
 
@@ -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, DbHandler, Prostgles } from "./Prostgles";
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(): DbHandler {
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 { DbHandler, TableHandler, ViewHandler } from "./DboBuilder";
2
+ import { DBSchema } from "prostgles-types";
3
3
 
4
- function prostgles<DBObj = DbHandler>(params: ProstglesInitOptions<DBObj>){
4
+ function prostgles<S extends DBSchema = any>(params: ProstglesInitOptions<S>){
5
5
 
6
- let prgl = new Prostgles<DBObj>(params as any);
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.174",
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.140",
32
+ "prostgles-types": "^1.5.153",
33
33
  "sharp": "^0.30.5"
34
34
  },
35
35
  "devDependencies": {
@@ -1 +1 @@
1
- 23576
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.150",
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.150",
71
- "resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.150.tgz",
72
- "integrity": "sha512-ocdd0We0xjB6vmlT87hWhx33Y9+beydgDkFGGiJWLV3kLCNV5obURon4sGZuI4/qi1Am4EkgCzktFoWzaNPrmQ==",
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.140"
74
+ "prostgles-types": "^1.5.153"
75
75
  }
76
76
  },
77
77
  "node_modules/prostgles-types": {
78
- "version": "1.5.140",
79
- "resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.140.tgz",
80
- "integrity": "sha512-nJcrL2yjB2dY4M6whIlIpDDb9USgdfxTwylqUUCMx6Bt+DsSPEMHKD76Ao55WJ6BZAhxNfo6aqg6aOGprY7vRA=="
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.150",
180
- "resolved": "https://registry.npmjs.org/prostgles-client/-/prostgles-client-1.5.150.tgz",
181
- "integrity": "sha512-ocdd0We0xjB6vmlT87hWhx33Y9+beydgDkFGGiJWLV3kLCNV5obURon4sGZuI4/qi1Am4EkgCzktFoWzaNPrmQ==",
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.140"
183
+ "prostgles-types": "^1.5.153"
184
184
  }
185
185
  },
186
186
  "prostgles-types": {
187
- "version": "1.5.140",
188
- "resolved": "https://registry.npmjs.org/prostgles-types/-/prostgles-types-1.5.140.tgz",
189
- "integrity": "sha512-nJcrL2yjB2dY4M6whIlIpDDb9USgdfxTwylqUUCMx6Bt+DsSPEMHKD76Ao55WJ6BZAhxNfo6aqg6aOGprY7vRA=="
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",
@@ -13,7 +13,7 @@
13
13
  "license": "ISC",
14
14
  "dependencies": {
15
15
  "@types/node": "^14.14.16",
16
- "prostgles-client": "^1.5.150",
16
+ "prostgles-client": "^1.5.153",
17
17
  "prostgles-types": "^1.5.68",
18
18
  "socket.io-client": "^4.5.1"
19
19
  }
@@ -1,6 +1,6 @@
1
1
  import { strict as assert } from 'assert';
2
2
 
3
- import { DbHandler} from "../dist/Prostgles";
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<DbHandler> | Partial<DBHandlerClient>) {
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()){