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.
- package/dist/Audit/AuditTable.d.ts +12 -1
- package/dist/Audit/AuditTable.d.ts.map +1 -1
- package/dist/Audit/AuditTable.js +12 -1
- package/dist/Audit/AuditTable.js.map +1 -1
- package/dist/Audit/AuditTypes.d.ts +1 -2
- package/dist/Audit/AuditTypes.d.ts.map +1 -1
- package/dist/Audit/getAuditTriggerConfig.d.ts.map +1 -1
- package/dist/Audit/getAuditTriggerConfig.js +12 -4
- package/dist/Audit/getAuditTriggerConfig.js.map +1 -1
- package/dist/Audit/parseAuditConfig.d.ts.map +1 -1
- package/dist/Audit/parseAuditConfig.js +0 -4
- package/dist/Audit/parseAuditConfig.js.map +1 -1
- package/dist/DboBuilder/runSql/runSQL.d.ts.map +1 -1
- package/dist/DboBuilder/runSql/runSQL.js +2 -0
- package/dist/DboBuilder/runSql/runSQL.js.map +1 -1
- package/dist/Prostgles.d.ts +2 -1
- package/dist/Prostgles.d.ts.map +1 -1
- package/dist/Prostgles.js +4 -0
- package/dist/Prostgles.js.map +1 -1
- package/dist/PublishParser/PublishParser.d.ts.map +1 -1
- package/dist/PublishParser/PublishParser.js +4 -0
- package/dist/PublishParser/PublishParser.js.map +1 -1
- package/dist/TableConfig/TableRowFromColumnDefinitions.d.ts +8 -0
- package/dist/TableConfig/TableRowFromColumnDefinitions.d.ts.map +1 -1
- package/dist/WebsocketAPI/getClientHandlers.d.ts.map +1 -1
- package/dist/WebsocketAPI/getClientHandlers.js +1 -0
- package/dist/WebsocketAPI/getClientHandlers.js.map +1 -1
- package/dist/WebsocketAPI/getClientSchema.d.ts.map +1 -1
- package/dist/WebsocketAPI/getClientSchema.js +1 -0
- package/dist/WebsocketAPI/getClientSchema.js.map +1 -1
- package/dist/WebsocketAPI/onSocketConnected.d.ts.map +1 -1
- package/dist/WebsocketAPI/onSocketConnected.js +10 -3
- package/dist/WebsocketAPI/onSocketConnected.js.map +1 -1
- package/dist/WebsocketAPI/pushSocketSchema.d.ts.map +1 -1
- package/dist/WebsocketAPI/pushSocketSchema.js +9 -0
- package/dist/WebsocketAPI/pushSocketSchema.js.map +1 -1
- package/dist/initProstgles.d.ts.map +1 -1
- package/dist/initProstgles.js +8 -11
- package/dist/initProstgles.js.map +1 -1
- package/dist/runClientRequest.d.ts.map +1 -1
- package/dist/runClientRequest.js +8 -0
- package/dist/runClientRequest.js.map +1 -1
- package/dist/updateConfiguration.d.ts.map +1 -1
- package/dist/updateConfiguration.js +1 -0
- package/dist/updateConfiguration.js.map +1 -1
- package/lib/Audit/AuditTable.ts +12 -1
- package/lib/Audit/AuditTypes.ts +1 -2
- package/lib/Audit/getAuditTriggerConfig.ts +12 -4
- package/lib/Audit/parseAuditConfig.ts +0 -4
- package/lib/DboBuilder/runSql/runSQL.ts +2 -0
- package/lib/Prostgles.ts +7 -2
- package/lib/PublishParser/PublishParser.ts +4 -0
- package/lib/TableConfig/TableRowFromColumnDefinitions.ts +18 -12
- package/lib/WebsocketAPI/getClientHandlers.ts +1 -0
- package/lib/WebsocketAPI/getClientSchema.ts +1 -0
- package/lib/WebsocketAPI/onSocketConnected.ts +6 -2
- package/lib/WebsocketAPI/pushSocketSchema.ts +5 -0
- package/lib/initProstgles.ts +7 -12
- package/lib/runClientRequest.ts +8 -0
- package/lib/updateConfiguration.ts +1 -0
- package/package.json +1 -1
package/lib/runClientRequest.ts
CHANGED
|
@@ -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
|