prostgles-server 4.2.134 → 4.2.136

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 (93) hide show
  1. package/dist/Auth/AuthHandler.d.ts +66 -0
  2. package/dist/Auth/AuthHandler.d.ts.map +1 -0
  3. package/dist/Auth/AuthHandler.js +425 -0
  4. package/dist/Auth/AuthHandler.js.map +1 -0
  5. package/dist/Auth/AuthTypes.d.ts +218 -0
  6. package/dist/Auth/AuthTypes.d.ts.map +1 -0
  7. package/dist/Auth/AuthTypes.js +3 -0
  8. package/dist/Auth/AuthTypes.js.map +1 -0
  9. package/dist/Auth/authInit.d.ts +3 -0
  10. package/dist/Auth/authInit.d.ts.map +1 -0
  11. package/dist/Auth/authInit.js +155 -0
  12. package/dist/Auth/authInit.js.map +1 -0
  13. package/dist/Auth/getSafeReturnURL.d.ts +2 -0
  14. package/dist/Auth/getSafeReturnURL.d.ts.map +1 -0
  15. package/dist/Auth/getSafeReturnURL.js +35 -0
  16. package/dist/Auth/getSafeReturnURL.js.map +1 -0
  17. package/dist/Auth/setAuthSignup.d.ts +5 -0
  18. package/dist/Auth/setAuthSignup.d.ts.map +1 -0
  19. package/dist/Auth/setAuthSignup.js +85 -0
  20. package/dist/Auth/setAuthSignup.js.map +1 -0
  21. package/dist/DboBuilder/DboBuilderTypes.d.ts +3 -3
  22. package/dist/DboBuilder/DboBuilderTypes.d.ts.map +1 -1
  23. package/dist/DboBuilder/DboBuilderTypes.js.map +1 -1
  24. package/dist/DboBuilder/QueryBuilder/getNewQuery.d.ts +1 -1
  25. package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts +1 -1
  26. package/dist/DboBuilder/runSQL.d.ts +1 -1
  27. package/dist/FileManager/initFileManager.js +1 -1
  28. package/dist/FileManager/initFileManager.js.map +1 -1
  29. package/dist/Filtering.d.ts +1 -1
  30. package/dist/Prostgles.d.ts +1 -1
  31. package/dist/Prostgles.d.ts.map +1 -1
  32. package/dist/Prostgles.js +1 -1
  33. package/dist/Prostgles.js.map +1 -1
  34. package/dist/ProstglesTypes.d.ts +1 -1
  35. package/dist/ProstglesTypes.d.ts.map +1 -1
  36. package/dist/PublishParser/PublishParser.d.ts +2 -2
  37. package/dist/PublishParser/PublishParser.d.ts.map +1 -1
  38. package/dist/PublishParser/PublishParser.js.map +1 -1
  39. package/dist/PublishParser/getFileTableRules.d.ts +1 -1
  40. package/dist/PublishParser/getFileTableRules.d.ts.map +1 -1
  41. package/dist/PublishParser/getSchemaFromPublish.d.ts +1 -1
  42. package/dist/PublishParser/getSchemaFromPublish.d.ts.map +1 -1
  43. package/dist/PublishParser/getTableRulesWithoutFileTable.d.ts +1 -1
  44. package/dist/PublishParser/getTableRulesWithoutFileTable.d.ts.map +1 -1
  45. package/dist/PublishParser/publishTypesAndUtils.d.ts +1 -1
  46. package/dist/PublishParser/publishTypesAndUtils.d.ts.map +1 -1
  47. package/dist/PublishParser/publishTypesAndUtils.js.map +1 -1
  48. package/dist/RestApi.d.ts +1 -1
  49. package/dist/RestApi.d.ts.map +1 -1
  50. package/dist/RestApi.js +1 -1
  51. package/dist/RestApi.js.map +1 -1
  52. package/dist/index.d.ts +1 -1
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/initProstgles.js +1 -1
  55. package/dist/initProstgles.js.map +1 -1
  56. package/dist/runClientRequest.d.ts +1 -1
  57. package/dist/runClientRequest.d.ts.map +1 -1
  58. package/dist/runClientRequest.js +1 -1
  59. package/dist/runClientRequest.js.map +1 -1
  60. package/lib/Auth/AuthHandler.ts +474 -0
  61. package/lib/Auth/AuthTypes.ts +247 -0
  62. package/lib/Auth/authInit.ts +166 -0
  63. package/lib/Auth/getSafeReturnURL.ts +35 -0
  64. package/lib/Auth/setAuthSignup.ts +100 -0
  65. package/lib/DBSchemaBuilder.ts +1 -1
  66. package/lib/DboBuilder/DboBuilderTypes.ts +4 -3
  67. package/lib/FileManager/initFileManager.ts +1 -1
  68. package/lib/Prostgles.ts +2 -2
  69. package/lib/ProstglesTypes.ts +1 -1
  70. package/lib/PublishParser/PublishParser.ts +3 -3
  71. package/lib/PublishParser/getFileTableRules.ts +1 -1
  72. package/lib/PublishParser/getSchemaFromPublish.ts +1 -1
  73. package/lib/PublishParser/getTableRulesWithoutFileTable.ts +1 -1
  74. package/lib/PublishParser/publishTypesAndUtils.ts +1 -1
  75. package/lib/RestApi.ts +2 -1
  76. package/lib/index.ts +1 -1
  77. package/lib/initProstgles.ts +1 -1
  78. package/lib/runClientRequest.ts +3 -3
  79. package/package.json +14 -4
  80. package/tests/client/index.ts +9 -7
  81. package/tests/client/package-lock.json +2827 -143
  82. package/tests/client/package.json +1 -1
  83. package/tests/client/tsconfig.json +0 -6
  84. package/tests/clientFileTests.spec.ts +2 -3
  85. package/tests/clientOnlyQueries.spec.ts +2 -2
  86. package/tests/clientRestApi.spec.ts +2 -2
  87. package/tests/server/index.ts +1 -1
  88. package/tests/server/package-lock.json +62 -77
  89. package/tests/server/package.json +2 -2
  90. package/tests/server/tsconfig.json +1 -2
  91. package/tests/serverOnlyQueries.spec.ts +2 -2
  92. package/tsconfig.json +0 -1
  93. package/lib/AuthHandler.ts +0 -816
package/lib/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SessionUser } from "./AuthHandler";
1
+ import { SessionUser } from "./Auth/AuthTypes";
2
2
  import { Prostgles } from "./Prostgles";
3
3
  import { ProstglesInitOptions } from "./ProstglesTypes";
4
4
 
@@ -1,7 +1,7 @@
1
1
  import * as pgPromise from "pg-promise";
2
2
  import pg from "pg-promise/typescript/pg-subset";
3
3
  import { isEmpty } from "prostgles-types";
4
- import { AuthHandler } from "./AuthHandler";
4
+ import { AuthHandler } from "./Auth/AuthHandler";
5
5
  import { DBEventsManager } from "./DBEventsManager";
6
6
  import { DBOFullyTyped } from "./DBSchemaBuilder";
7
7
  import { DBHandlerServer, Prostgles, getIsSuperUser } from "./Prostgles";
@@ -1,5 +1,5 @@
1
- import { AnyObject, TableHandler, getKeys, pickKeys } from "prostgles-types";
2
- import { ExpressReq, UserLike } from "./AuthHandler";
1
+ import { AnyObject, TableHandler, UserLike, getKeys, pickKeys } from "prostgles-types";
2
+ import { ExpressReq } from "./Auth/AuthTypes";
3
3
  import { LocalParams, PRGLIOSocket } from "./DboBuilder/DboBuilder";
4
4
  import { parseFieldFilter } from "./DboBuilder/ViewHandler/parseFieldFilter";
5
5
  import { canRunSQL } from "./DboBuilder/runSQL";
@@ -50,7 +50,7 @@ export const runClientRequest = async function(this: Prostgles, args: Args){
50
50
  const valid_table_command_rules = await this.publishParser.getValidatedRequestRule({ tableName, command, localParams: reqInfo }, clientInfo);
51
51
  if (valid_table_command_rules) {
52
52
  const sessionUser: UserLike | undefined = !clientInfo?.user? undefined : {
53
- ...parseFieldFilter(clientInfo.sessionFields ?? [], false, getKeys(clientInfo.user)),
53
+ ...parseFieldFilter(clientInfo.sessionFields ?? [] as any, false, Object.keys(clientInfo.user)),
54
54
  ...pickKeys(clientInfo.user, ["id", "type"]) as UserLike,
55
55
  }
56
56
  const localParams: LocalParams = { ...reqInfo, isRemoteRequest: { user: sessionUser } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-server",
3
- "version": "4.2.134",
3
+ "version": "4.2.136",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,20 +38,30 @@
38
38
  "body-parser": "^1.20.3",
39
39
  "check-disk-space": "^3.4.0",
40
40
  "file-type": "^18.5.0",
41
+ "passport": "^0.7.0",
42
+ "passport-facebook": "^3.0.0",
43
+ "passport-github2": "^0.1.12",
44
+ "passport-google-oauth20": "^2.0.0",
45
+ "passport-microsoft": "^2.1.0",
41
46
  "pg": "^8.11.5",
42
47
  "pg-cursor": "^2.11.0",
43
48
  "pg-promise": "^11.9.1",
44
- "prostgles-types": "^4.0.89"
49
+ "prostgles-types": "^4.0.105"
45
50
  },
46
51
  "devDependencies": {
47
52
  "@types/express": "^4.17.21",
48
53
  "@types/json-schema": "^7.0.15",
49
54
  "@types/node": "^22.8.1",
55
+ "@types/passport": "^1.0.17",
56
+ "@types/passport-facebook": "^3.0.3",
57
+ "@types/passport-github2": "^1.2.9",
58
+ "@types/passport-google-oauth20": "^2.0.16",
59
+ "@types/passport-microsoft": "^1.0.3",
50
60
  "@types/pg": "^8.11.5",
51
61
  "@types/pg-cursor": "^2.7.2",
52
62
  "@types/sharp": "^0.30.4",
53
- "@typescript-eslint/eslint-plugin": "^8.11.0",
54
- "@typescript-eslint/parser": "^8.11.0",
63
+ "@typescript-eslint/eslint-plugin": "^8.15.0",
64
+ "@typescript-eslint/parser": "^8.15.0",
55
65
  "eslint": "^8.51.0",
56
66
  "socket.io": "^4.8.1",
57
67
  "typescript": "^5.3.3"
@@ -1,15 +1,17 @@
1
1
  import prostgles from "prostgles-client";
2
2
  import io from "socket.io-client";
3
3
 
4
+ import { AuthHandler } from "prostgles-client/dist/Auth";
5
+ export { AuthHandler } from "prostgles-client/dist/Auth";
6
+ import type { DBHandlerClient, MethodHandler } from "prostgles-client/dist/prostgles";
7
+ import { DBSchemaTable } from "prostgles-types";
8
+ import { clientFileTests } from "../clientFileTests.spec";
9
+ import { clientOnlyQueries } from "../clientOnlyQueries.spec";
10
+ import { clientRestApi } from "../clientRestApi.spec";
4
11
  import { isomorphicQueries } from "../isomorphicQueries.spec";
5
- import { clientOnlyQueries } from "../clientOnlyQueries.spec";
6
- import { clientRestApi } from "../clientRestApi.spec";
7
- import { clientFileTests } from "../clientFileTests.spec";
8
- import type { Auth, DBHandlerClient, MethodHandler } from "prostgles-client/dist/prostgles";
9
- export { DBHandlerClient, Auth } from "prostgles-client/dist/prostgles";
10
12
  import { clientHooks } from "./hooks.spec";
11
13
  import { newly_created_table, useProstglesTest } from "./useProstgles.spec";
12
- import { DBSchemaTable } from "prostgles-types";
14
+ export { DBHandlerClient } from "prostgles-client/dist/prostgles";
13
15
 
14
16
  const start = Date.now();
15
17
  const log = (msgOrObj: any, extra?: any) => {
@@ -35,7 +37,7 @@ type ClientTestSpecV2 = (args: {
35
37
  methods: MethodHandler;
36
38
  tableSchema: DBSchemaTable[];
37
39
  isReconnect?: boolean;
38
- auth: Auth;
40
+ auth: AuthHandler;
39
41
  }) => Promise<void>;
40
42
 
41
43
  const tests: Record<string, ClientTestSpecV2> = {