prostgles-server 4.2.610 → 4.2.612

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 (61) hide show
  1. package/dist/Audit/AuditTable.d.ts +12 -1
  2. package/dist/Audit/AuditTable.d.ts.map +1 -1
  3. package/dist/Audit/AuditTable.js +12 -1
  4. package/dist/Audit/AuditTable.js.map +1 -1
  5. package/dist/Audit/AuditTypes.d.ts +1 -2
  6. package/dist/Audit/AuditTypes.d.ts.map +1 -1
  7. package/dist/Audit/getAuditTriggerConfig.d.ts.map +1 -1
  8. package/dist/Audit/getAuditTriggerConfig.js +12 -4
  9. package/dist/Audit/getAuditTriggerConfig.js.map +1 -1
  10. package/dist/Audit/parseAuditConfig.d.ts.map +1 -1
  11. package/dist/Audit/parseAuditConfig.js +0 -4
  12. package/dist/Audit/parseAuditConfig.js.map +1 -1
  13. package/dist/DboBuilder/runSql/runSQL.d.ts.map +1 -1
  14. package/dist/DboBuilder/runSql/runSQL.js +2 -0
  15. package/dist/DboBuilder/runSql/runSQL.js.map +1 -1
  16. package/dist/Prostgles.d.ts +2 -1
  17. package/dist/Prostgles.d.ts.map +1 -1
  18. package/dist/Prostgles.js +4 -0
  19. package/dist/Prostgles.js.map +1 -1
  20. package/dist/PublishParser/PublishParser.d.ts.map +1 -1
  21. package/dist/PublishParser/PublishParser.js +4 -0
  22. package/dist/PublishParser/PublishParser.js.map +1 -1
  23. package/dist/TableConfig/TableRowFromColumnDefinitions.d.ts +8 -0
  24. package/dist/TableConfig/TableRowFromColumnDefinitions.d.ts.map +1 -1
  25. package/dist/WebsocketAPI/getClientHandlers.d.ts.map +1 -1
  26. package/dist/WebsocketAPI/getClientHandlers.js +1 -0
  27. package/dist/WebsocketAPI/getClientHandlers.js.map +1 -1
  28. package/dist/WebsocketAPI/getClientSchema.d.ts.map +1 -1
  29. package/dist/WebsocketAPI/getClientSchema.js +1 -0
  30. package/dist/WebsocketAPI/getClientSchema.js.map +1 -1
  31. package/dist/WebsocketAPI/onSocketConnected.d.ts.map +1 -1
  32. package/dist/WebsocketAPI/onSocketConnected.js +10 -3
  33. package/dist/WebsocketAPI/onSocketConnected.js.map +1 -1
  34. package/dist/WebsocketAPI/pushSocketSchema.d.ts.map +1 -1
  35. package/dist/WebsocketAPI/pushSocketSchema.js +9 -0
  36. package/dist/WebsocketAPI/pushSocketSchema.js.map +1 -1
  37. package/dist/initProstgles.d.ts.map +1 -1
  38. package/dist/initProstgles.js +8 -11
  39. package/dist/initProstgles.js.map +1 -1
  40. package/dist/runClientRequest.d.ts.map +1 -1
  41. package/dist/runClientRequest.js +8 -0
  42. package/dist/runClientRequest.js.map +1 -1
  43. package/dist/updateConfiguration.d.ts.map +1 -1
  44. package/dist/updateConfiguration.js +1 -0
  45. package/dist/updateConfiguration.js.map +1 -1
  46. package/lib/Audit/AuditTable.ts +12 -1
  47. package/lib/Audit/AuditTypes.ts +1 -2
  48. package/lib/Audit/getAuditTriggerConfig.ts +12 -4
  49. package/lib/Audit/parseAuditConfig.ts +0 -4
  50. package/lib/DboBuilder/runSql/runSQL.ts +2 -0
  51. package/lib/Prostgles.ts +7 -2
  52. package/lib/PublishParser/PublishParser.ts +4 -0
  53. package/lib/TableConfig/TableRowFromColumnDefinitions.ts +18 -12
  54. package/lib/WebsocketAPI/getClientHandlers.ts +1 -0
  55. package/lib/WebsocketAPI/getClientSchema.ts +1 -0
  56. package/lib/WebsocketAPI/onSocketConnected.ts +6 -2
  57. package/lib/WebsocketAPI/pushSocketSchema.ts +5 -0
  58. package/lib/initProstgles.ts +7 -12
  59. package/lib/runClientRequest.ts +8 -0
  60. package/lib/updateConfiguration.ts +1 -0
  61. package/package.json +1 -1
@@ -65,6 +65,7 @@ export const runClientRequest = async function (
65
65
  clientReq: AuthClientRequest,
66
66
  scope: PermissionScope | undefined,
67
67
  ) {
68
+ this.checkNotDestroyed();
68
69
  /* Channel name will only include client-sent params so we ignore table_rules enforced params */
69
70
  if (!this.publishParser || !this.dbo) {
70
71
  throw "socket/httpReq or authHandler missing";
@@ -124,6 +125,7 @@ export const runClientRequest = async function (
124
125
  scope,
125
126
  };
126
127
 
128
+ this.checkNotDestroyed();
127
129
  if (command === "abort") {
128
130
  const validation = getJSONBObjectSchemaValidationError(
129
131
  {
@@ -173,6 +175,7 @@ export const runClientRequest = async function (
173
175
  tableHandler[command].bind(tableHandler) satisfies
174
176
  undefined | TableMethodFunctionWithRulesAndLocalParams;
175
177
 
178
+ this.checkNotDestroyed();
176
179
  return (tableHandler[command] as TableMethodFunctionWithRulesAndLocalParams)(
177
180
  param1,
178
181
  param2,
@@ -186,11 +189,13 @@ export const clientCanRunSqlRequest = async function (
186
189
  this: Prostgles,
187
190
  clientReq: AuthClientRequest,
188
191
  ) {
192
+ this.checkNotDestroyed();
189
193
  if (!this.opts.publishRawSQL || typeof this.opts.publishRawSQL !== "function") {
190
194
  return { allowed: false, clientReq };
191
195
  }
192
196
  const canRunSQL = async () => {
193
197
  const publishParams = await this.publishParser?.getPublishParams(clientReq, undefined);
198
+ this.checkNotDestroyed();
194
199
  const allowedToRunSQL = publishParams && (await this.opts.publishRawSQL?.(publishParams));
195
200
  return allowedToRunSQL === true || allowedToRunSQL === "*";
196
201
  };
@@ -222,6 +227,7 @@ export const runClientSqlRequest = async function (
222
227
  }
223
228
  const reqData = validation.data;
224
229
  const { query, params, options } = reqData;
230
+ this.checkNotDestroyed();
225
231
  return this.dboBuilder.runSQL(query, params, options, { clientReq });
226
232
  };
227
233
 
@@ -235,6 +241,7 @@ export const runClientMethod = async function (
235
241
  unvalidatedArgs: ArgsMethod,
236
242
  clientReq: AuthClientRequest,
237
243
  ) {
244
+ this.checkNotDestroyed();
238
245
  const validation = getJSONBObjectSchemaValidationError(
239
246
  {
240
247
  name: "string",
@@ -276,6 +283,7 @@ export const runClientMethod = async function (
276
283
  }
277
284
 
278
285
  /** Allowed functions are wrapped with their request context by PublishParser. */
286
+ this.checkNotDestroyed();
279
287
  const res = await functionDefinition.run(input as never, undefined);
280
288
 
281
289
  return res;
@@ -8,6 +8,7 @@ export const updateConfiguration = async (
8
8
  newOpts: UpdatableOptions<void, any, any>,
9
9
  force?: true,
10
10
  ) => {
11
+ prgl.checkNotDestroyed();
11
12
  const optionsThatChanged = getKeys(newOpts)
12
13
  .map((k) => {
13
14
  // eslint-disable-next-line @typescript-eslint/unbound-method
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-server",
3
- "version": "4.2.610",
3
+ "version": "4.2.612",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",