prostgles-server 4.2.63 → 4.2.66
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/PubSubManager/getInitQuery.d.ts.map +1 -1
- package/dist/PubSubManager/getInitQuery.js +30 -17
- package/dist/PubSubManager/getInitQuery.js.map +1 -1
- package/lib/PubSubManager/getInitQuery.ts +30 -17
- package/package.json +1 -1
- package/tests/isomorphicQueries.spec.ts +24 -15
- package/tests/server/DBoGenerated.d.ts +10 -0
- package/tests/server/package-lock.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInitQuery.d.ts","sourceRoot":"","sources":["../../lib/PubSubManager/getInitQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGpF,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,eAAO,MAAM,YAAY,SAAwB,aAAa,KAAG,QAAQ,MAAM,
|
|
1
|
+
{"version":3,"file":"getInitQuery.d.ts","sourceRoot":"","sources":["../../lib/PubSubManager/getInitQuery.ts"],"names":[],"mappings":"AACA,OAAO,EAAsC,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGpF,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,eAAO,MAAM,YAAY,SAAwB,aAAa,KAAG,QAAQ,MAAM,CAqkB9E,CAAA"}
|
|
@@ -199,15 +199,21 @@ BEGIN
|
|
|
199
199
|
|
|
200
200
|
DECLARE view_def_query TEXT := '';
|
|
201
201
|
|
|
202
|
+
DECLARE escaped_table TEXT;
|
|
203
|
+
|
|
202
204
|
BEGIN
|
|
203
205
|
|
|
204
|
-
--
|
|
206
|
+
--PERFORM pg_notify('debug', concat_ws(' ', 'TABLE', TG_TABLE_NAME, TG_OP));
|
|
207
|
+
|
|
208
|
+
escaped_table := format('%I', TG_TABLE_NAME);
|
|
205
209
|
|
|
206
210
|
SELECT string_agg(
|
|
207
211
|
format(
|
|
208
212
|
$c$
|
|
209
213
|
SELECT CASE WHEN EXISTS(
|
|
210
|
-
SELECT 1
|
|
214
|
+
SELECT 1
|
|
215
|
+
FROM %s
|
|
216
|
+
WHERE %s
|
|
211
217
|
) THEN %s::text END AS t_ids
|
|
212
218
|
$c$,
|
|
213
219
|
table_name,
|
|
@@ -218,7 +224,7 @@ BEGIN
|
|
|
218
224
|
)
|
|
219
225
|
INTO unions
|
|
220
226
|
FROM prostgles.v_triggers
|
|
221
|
-
WHERE table_name =
|
|
227
|
+
WHERE table_name = escaped_table;
|
|
222
228
|
|
|
223
229
|
|
|
224
230
|
/* unions = 'old_table union new_table' or any one of the tables */
|
|
@@ -240,7 +246,7 @@ BEGIN
|
|
|
240
246
|
FROM (
|
|
241
247
|
SELECT DISTINCT related_view_name, related_view_def
|
|
242
248
|
FROM prostgles.v_triggers
|
|
243
|
-
WHERE table_name =
|
|
249
|
+
WHERE table_name = escaped_table
|
|
244
250
|
AND related_view_name IS NOT NULL
|
|
245
251
|
AND related_view_def IS NOT NULL
|
|
246
252
|
) t
|
|
@@ -252,7 +258,8 @@ BEGIN
|
|
|
252
258
|
FROM (
|
|
253
259
|
%s
|
|
254
260
|
) t
|
|
255
|
-
$c$,
|
|
261
|
+
$c$,
|
|
262
|
+
unions
|
|
256
263
|
)
|
|
257
264
|
INTO query;
|
|
258
265
|
|
|
@@ -292,7 +299,7 @@ BEGIN
|
|
|
292
299
|
${(0, PubSubManager_1.asValue)(PubSubManager_1.PubSubManager.DELIMITER)},
|
|
293
300
|
|
|
294
301
|
${(0, PubSubManager_1.asValue)(PubSubManager_1.NOTIF_TYPE.data)},
|
|
295
|
-
COALESCE(
|
|
302
|
+
COALESCE(escaped_table, 'MISSING'),
|
|
296
303
|
COALESCE(TG_OP, 'MISSING'),
|
|
297
304
|
CASE WHEN has_errors
|
|
298
305
|
THEN concat_ws('; ', 'error', err_text, err_detail, err_hint, 'query: ' || query )
|
|
@@ -354,12 +361,18 @@ BEGIN
|
|
|
354
361
|
SELECT DISTINCT table_name
|
|
355
362
|
FROM old_table ot
|
|
356
363
|
WHERE NOT EXISTS (
|
|
357
|
-
SELECT 1
|
|
364
|
+
SELECT 1
|
|
365
|
+
FROM prostgles.app_triggers t
|
|
358
366
|
WHERE t.table_name = ot.table_name
|
|
359
367
|
)
|
|
360
368
|
AND EXISTS (
|
|
361
|
-
SELECT trigger_name
|
|
362
|
-
|
|
369
|
+
SELECT trigger_name
|
|
370
|
+
FROM information_schema.triggers
|
|
371
|
+
WHERE trigger_name IN (
|
|
372
|
+
concat_ws('_', 'prostgles_triggers', table_name, 'insert'),
|
|
373
|
+
concat_ws('_', 'prostgles_triggers', table_name, 'update'),
|
|
374
|
+
concat_ws('_', 'prostgles_triggers', table_name, 'delete')
|
|
375
|
+
)
|
|
363
376
|
)
|
|
364
377
|
LOOP
|
|
365
378
|
|
|
@@ -368,7 +381,7 @@ BEGIN
|
|
|
368
381
|
trg_name := concat_ws('_', 'prostgles_triggers', trw.table_name, op);
|
|
369
382
|
|
|
370
383
|
--EXECUTE format(' DROP TRIGGER IF EXISTS %I ON %s ;' , trg_name, trw.table_name);
|
|
371
|
-
EXECUTE format(' ALTER TABLE %s DISABLE TRIGGER %I ;',
|
|
384
|
+
EXECUTE format(' ALTER TABLE %s DISABLE TRIGGER %I ;', trw.table_name, trg_name);
|
|
372
385
|
END LOOP;
|
|
373
386
|
|
|
374
387
|
END LOOP;
|
|
@@ -376,11 +389,10 @@ BEGIN
|
|
|
376
389
|
/* If newly added listeners on table then CREATE table data watch triggers */
|
|
377
390
|
ELSIF TG_OP = 'INSERT' THEN
|
|
378
391
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
392
|
+
SELECT count(*)
|
|
393
|
+
FROM new_table
|
|
394
|
+
INTO changed_triggers_count;
|
|
395
|
+
|
|
384
396
|
/* Loop through newly added tables to add data watch triggers */
|
|
385
397
|
FOR trw IN
|
|
386
398
|
|
|
@@ -395,13 +407,14 @@ BEGIN
|
|
|
395
407
|
AND t.inserted < nt.inserted -- exclude current record (this is an after trigger). Turn into before trigger?
|
|
396
408
|
)
|
|
397
409
|
|
|
398
|
-
/* Table is valid
|
|
410
|
+
/* Table is valid
|
|
399
411
|
AND EXISTS (
|
|
400
412
|
SELECT 1
|
|
401
413
|
FROM information_schema.tables
|
|
402
414
|
WHERE table_schema = 'public'
|
|
403
415
|
AND table_name = nt.table_name
|
|
404
416
|
)
|
|
417
|
+
*/
|
|
405
418
|
LOOP
|
|
406
419
|
|
|
407
420
|
IF (
|
|
@@ -445,7 +458,7 @@ BEGIN
|
|
|
445
458
|
$q$
|
|
446
459
|
DROP TRIGGER IF EXISTS %1$I ON %2$s;
|
|
447
460
|
CREATE TRIGGER %1$I
|
|
448
|
-
AFTER DELETE ON %2$
|
|
461
|
+
AFTER DELETE ON %2$s
|
|
449
462
|
REFERENCING OLD TABLE AS old_table
|
|
450
463
|
FOR EACH STATEMENT EXECUTE PROCEDURE ${exports.DB_OBJ_NAMES.data_watch_func}();
|
|
451
464
|
COMMENT ON TRIGGER %1$I ON %2$s IS 'Prostgles internal trigger used to notify when data in the table changed';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInitQuery.js","sourceRoot":"","sources":["../../lib/PubSubManager/getInitQuery.ts"],"names":[],"mappings":";;;AACA,mDAAoF;AACpF,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAErC,QAAA,YAAY,GAAG;IAC1B,uBAAuB,EAAE,mCAAmC;IAC5D,eAAe,EAAE,sCAAsC;IACvD,iBAAiB,EAAE,6BAA6B;IAChD,oBAAoB,EAAE,oCAAoC;CAClD,CAAC;AAEJ,MAAM,YAAY,GAAG,KAAK;IAE/B,MAAM,QAAQ,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,EAAmB,EAAE;QAC9D,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,WAAW,CA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M pg_notify('debug', concat_ws(' ', 'TABLE', TG_TABLE_NAME, TG_OP));
|
|
209
|
+
|
|
210
|
+
escaped_table := format('%I', TG_TABLE_NAME);
|
|
207
211
|
|
|
208
212
|
SELECT string_agg(
|
|
209
213
|
format(
|
|
210
214
|
$c$
|
|
211
215
|
SELECT CASE WHEN EXISTS(
|
|
212
|
-
SELECT 1
|
|
216
|
+
SELECT 1
|
|
217
|
+
FROM %s
|
|
218
|
+
WHERE %s
|
|
213
219
|
) THEN %s::text END AS t_ids
|
|
214
220
|
$c$,
|
|
215
221
|
table_name,
|
|
@@ -220,7 +226,7 @@ BEGIN
|
|
|
220
226
|
)
|
|
221
227
|
INTO unions
|
|
222
228
|
FROM prostgles.v_triggers
|
|
223
|
-
WHERE table_name =
|
|
229
|
+
WHERE table_name = escaped_table;
|
|
224
230
|
|
|
225
231
|
|
|
226
232
|
/* unions = 'old_table union new_table' or any one of the tables */
|
|
@@ -242,7 +248,7 @@ BEGIN
|
|
|
242
248
|
FROM (
|
|
243
249
|
SELECT DISTINCT related_view_name, related_view_def
|
|
244
250
|
FROM prostgles.v_triggers
|
|
245
|
-
WHERE table_name =
|
|
251
|
+
WHERE table_name = escaped_table
|
|
246
252
|
AND related_view_name IS NOT NULL
|
|
247
253
|
AND related_view_def IS NOT NULL
|
|
248
254
|
) t
|
|
@@ -254,7 +260,8 @@ BEGIN
|
|
|
254
260
|
FROM (
|
|
255
261
|
%s
|
|
256
262
|
) t
|
|
257
|
-
$c$,
|
|
263
|
+
$c$,
|
|
264
|
+
unions
|
|
258
265
|
)
|
|
259
266
|
INTO query;
|
|
260
267
|
|
|
@@ -294,7 +301,7 @@ BEGIN
|
|
|
294
301
|
${asValue(PubSubManager.DELIMITER)},
|
|
295
302
|
|
|
296
303
|
${asValue(NOTIF_TYPE.data)},
|
|
297
|
-
COALESCE(
|
|
304
|
+
COALESCE(escaped_table, 'MISSING'),
|
|
298
305
|
COALESCE(TG_OP, 'MISSING'),
|
|
299
306
|
CASE WHEN has_errors
|
|
300
307
|
THEN concat_ws('; ', 'error', err_text, err_detail, err_hint, 'query: ' || query )
|
|
@@ -356,12 +363,18 @@ BEGIN
|
|
|
356
363
|
SELECT DISTINCT table_name
|
|
357
364
|
FROM old_table ot
|
|
358
365
|
WHERE NOT EXISTS (
|
|
359
|
-
SELECT 1
|
|
366
|
+
SELECT 1
|
|
367
|
+
FROM prostgles.app_triggers t
|
|
360
368
|
WHERE t.table_name = ot.table_name
|
|
361
369
|
)
|
|
362
370
|
AND EXISTS (
|
|
363
|
-
SELECT trigger_name
|
|
364
|
-
|
|
371
|
+
SELECT trigger_name
|
|
372
|
+
FROM information_schema.triggers
|
|
373
|
+
WHERE trigger_name IN (
|
|
374
|
+
concat_ws('_', 'prostgles_triggers', table_name, 'insert'),
|
|
375
|
+
concat_ws('_', 'prostgles_triggers', table_name, 'update'),
|
|
376
|
+
concat_ws('_', 'prostgles_triggers', table_name, 'delete')
|
|
377
|
+
)
|
|
365
378
|
)
|
|
366
379
|
LOOP
|
|
367
380
|
|
|
@@ -370,7 +383,7 @@ BEGIN
|
|
|
370
383
|
trg_name := concat_ws('_', 'prostgles_triggers', trw.table_name, op);
|
|
371
384
|
|
|
372
385
|
--EXECUTE format(' DROP TRIGGER IF EXISTS %I ON %s ;' , trg_name, trw.table_name);
|
|
373
|
-
EXECUTE format(' ALTER TABLE %s DISABLE TRIGGER %I ;',
|
|
386
|
+
EXECUTE format(' ALTER TABLE %s DISABLE TRIGGER %I ;', trw.table_name, trg_name);
|
|
374
387
|
END LOOP;
|
|
375
388
|
|
|
376
389
|
END LOOP;
|
|
@@ -378,11 +391,10 @@ BEGIN
|
|
|
378
391
|
/* If newly added listeners on table then CREATE table data watch triggers */
|
|
379
392
|
ELSIF TG_OP = 'INSERT' THEN
|
|
380
393
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
394
|
+
SELECT count(*)
|
|
395
|
+
FROM new_table
|
|
396
|
+
INTO changed_triggers_count;
|
|
397
|
+
|
|
386
398
|
/* Loop through newly added tables to add data watch triggers */
|
|
387
399
|
FOR trw IN
|
|
388
400
|
|
|
@@ -397,13 +409,14 @@ BEGIN
|
|
|
397
409
|
AND t.inserted < nt.inserted -- exclude current record (this is an after trigger). Turn into before trigger?
|
|
398
410
|
)
|
|
399
411
|
|
|
400
|
-
/* Table is valid
|
|
412
|
+
/* Table is valid
|
|
401
413
|
AND EXISTS (
|
|
402
414
|
SELECT 1
|
|
403
415
|
FROM information_schema.tables
|
|
404
416
|
WHERE table_schema = 'public'
|
|
405
417
|
AND table_name = nt.table_name
|
|
406
418
|
)
|
|
419
|
+
*/
|
|
407
420
|
LOOP
|
|
408
421
|
|
|
409
422
|
IF (
|
|
@@ -447,7 +460,7 @@ BEGIN
|
|
|
447
460
|
$q$
|
|
448
461
|
DROP TRIGGER IF EXISTS %1$I ON %2$s;
|
|
449
462
|
CREATE TRIGGER %1$I
|
|
450
|
-
AFTER DELETE ON %2$
|
|
463
|
+
AFTER DELETE ON %2$s
|
|
451
464
|
REFERENCING OLD TABLE AS old_table
|
|
452
465
|
FOR EACH STATEMENT EXECUTE PROCEDURE ${DB_OBJ_NAMES.data_watch_func}();
|
|
453
466
|
COMMENT ON TRIGGER %1$I ON %2$s IS 'Prostgles internal trigger used to notify when data in the table changed';
|
package/package.json
CHANGED
|
@@ -993,15 +993,20 @@ export const isomorphicQueries = async (db: DBOFullyTyped | DBHandlerClient, log
|
|
|
993
993
|
|
|
994
994
|
await test("subscribe to escaped table name", async () => {
|
|
995
995
|
await tryRunP("subscribe to escaped table name", async (resolve, reject) => {
|
|
996
|
-
|
|
997
|
-
|
|
996
|
+
const filter = { [`"text_col0"`]: "0" }
|
|
997
|
+
let runs = 0;
|
|
998
|
+
const sub = await db[`"""quoted0"""`].subscribe!(filter, { }, async items => {
|
|
998
999
|
const item = items[0];
|
|
999
|
-
|
|
1000
1000
|
if(item && item[`"text_col0"`] === "0"){
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1001
|
+
if(!runs){
|
|
1002
|
+
db[`"""quoted0"""`].update!(filter, filter);
|
|
1003
|
+
}
|
|
1004
|
+
runs++;
|
|
1005
|
+
if(runs < 2){
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
await sub.unsubscribe();
|
|
1009
|
+
resolve(true);
|
|
1005
1010
|
}
|
|
1006
1011
|
});
|
|
1007
1012
|
});
|
|
@@ -1024,15 +1029,19 @@ export const isomorphicQueries = async (db: DBOFullyTyped | DBHandlerClient, log
|
|
|
1024
1029
|
});
|
|
1025
1030
|
|
|
1026
1031
|
await test("Related table subscribe", async () => {
|
|
1027
|
-
const sub = await db.tr1.subscribe!(
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1032
|
+
const sub = await db.tr1.subscribe!(
|
|
1033
|
+
{},
|
|
1034
|
+
{
|
|
1035
|
+
select: {
|
|
1036
|
+
"*": 1,
|
|
1037
|
+
tr2: "*",
|
|
1038
|
+
tr3: "*",
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
_rows => {
|
|
1034
1042
|
|
|
1035
|
-
|
|
1043
|
+
}
|
|
1044
|
+
);
|
|
1036
1045
|
|
|
1037
1046
|
await sub.unsubscribe();
|
|
1038
1047
|
});
|
|
@@ -505,6 +505,16 @@ export type DBSchemaGenerated = {
|
|
|
505
505
|
symbol: string;
|
|
506
506
|
};
|
|
507
507
|
};
|
|
508
|
+
unions: {
|
|
509
|
+
is_view: false;
|
|
510
|
+
select: true;
|
|
511
|
+
insert: true;
|
|
512
|
+
update: true;
|
|
513
|
+
delete: true;
|
|
514
|
+
columns: {
|
|
515
|
+
string_agg?: null | string;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
508
518
|
users: {
|
|
509
519
|
is_view: false;
|
|
510
520
|
select: true;
|