prostgles-server 4.2.649 → 4.2.650

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.
@@ -0,0 +1,1839 @@
1
+
2
+ > prostgles-server@4.2.649 test
3
+ > npm run test:lib && npm run test-only
4
+
5
+
6
+ > prostgles-server@4.2.649 test:lib
7
+ > rm -rf ./node_modules/* && rm -rf ./dist/* && npm i && npm run lint -- --ignore-pattern tests && tsc && node --trace-uncaught --test dist/**/*.spec.js
8
+
9
+ npm warn deprecated eslint@9.39.5: This version is no longer supported. Please see https://eslint.org/version-support for other options.
10
+
11
+ > prostgles-server@4.2.649 prepare
12
+ > npm run build
13
+
14
+
15
+ > prostgles-server@4.2.649 build
16
+ > tsc
17
+
18
+
19
+ added 226 packages, and audited 227 packages in 5s
20
+
21
+ 51 packages are looking for funding
22
+ run `npm fund` for details
23
+
24
+ 3 vulnerabilities (1 moderate, 2 high)
25
+
26
+ To address issues that do not require attention, run:
27
+ npm audit fix
28
+
29
+ To address all issues (including breaking changes), run:
30
+ npm audit fix --force
31
+
32
+ Run `npm audit` for details.
33
+
34
+ > prostgles-server@4.2.649 lint
35
+ > eslint . --ext .ts --quiet --ignore-pattern tests
36
+
37
+ ▶ DBSchemaBuilder type tests
38
+ ✔ Type checks (0.83301ms)
39
+ ✔ DBSchemaBuilder type tests (1.908805ms)
40
+ ▶ getServerFunctionReturnTypes
41
+ ✔ reads grouped functions and stops at recursive types (1061.372474ms)
42
+ ✔ getServerFunctionReturnTypes (1062.2333ms)
43
+ ▶ DboBuilder onCommit
44
+ ✔ awaits callbacks after commit and logs callback errors (2.772478ms)
45
+ ✔ discards callbacks on rollback (0.475347ms)
46
+ ✔ DboBuilder onCommit (4.42284ms)
47
+ ▶ dboBuilderUtils
48
+ ✔ getErrorAsObject circular (0.810545ms)
49
+ ✔ dboBuilderUtils (1.429726ms)
50
+ ▶ defineFunction type test
51
+ ✔ Type test (0.520937ms)
52
+ ✔ defineFunction type test (1.075541ms)
53
+ ✔ file version rules inherit fields and restrictive select options (2.865464ms)
54
+ ✔ managed files preserve hooks on other tables and append file hooks (0.839016ms)
55
+ ▶ DBOFullyTyped test
56
+ ✔ Type test (0.681808ms)
57
+ ✔ DBOFullyTyped test (1.614345ms)
58
+ ℹ tests 9
59
+ ℹ suites 6
60
+ ℹ pass 9
61
+ ℹ fail 0
62
+ ℹ cancelled 0
63
+ ℹ skipped 0
64
+ ℹ todo 0
65
+ ℹ duration_ms 1310.350604
66
+
67
+ > prostgles-server@4.2.649 test-only
68
+ > cd tests/ && ./test.sh
69
+
70
+
71
+ > prostgles-server@4.2.649 build
72
+ > tsc
73
+
74
+
75
+ > client@1.0.0 build
76
+ > rm -rf ./node_modules/* && rm -rf ./dist/* && npm i && tsc
77
+
78
+ npm warn deprecated whatwg-encoding@3.1.1: Use @exodus/bytes instead for a more spec-conformant and faster implementation
79
+
80
+ added 58 packages, and audited 59 packages in 654ms
81
+
82
+ 7 packages are looking for funding
83
+ run `npm fund` for details
84
+
85
+ found 0 vulnerabilities
86
+
87
+ > client@1.0.0 testBasicHooks
88
+ > node --test dist/client/basicHooks.spec.js
89
+
90
+ ▶ React hooks
91
+ ✔ useAsyncEffectQueue executes the first and debounces the rest (1621.85465ms)
92
+ ✔ useAsyncEffectQueue executes the first and debounces the rest if still mounted (1514.272243ms)
93
+ ✔ React hooks (3137.939178ms)
94
+ ℹ tests 2
95
+ ℹ suites 1
96
+ ℹ pass 2
97
+ ℹ fail 0
98
+ ℹ cancelled 0
99
+ ℹ skipped 0
100
+ ℹ todo 0
101
+ ℹ duration_ms 3438.881593
102
+
103
+ up to date, audited 115 packages in 4s
104
+
105
+ 28 packages are looking for funding
106
+ run `npm fund` for details
107
+
108
+ found 0 vulnerabilities
109
+
110
+ > server_tests@1.0.0 build
111
+ > rm -rf ./node_modules/* && rm -rf ./media/* && rm -rf ./dist/* && npm i && tsc
112
+
113
+
114
+ added 113 packages, and audited 115 packages in 4s
115
+
116
+ 28 packages are looking for funding
117
+ run `npm fund` for details
118
+
119
+ found 0 vulnerabilities
120
+
121
+ > prostgles-server@4.2.649 lint
122
+ > eslint . --ext .ts --quiet
123
+
124
+
125
+ > server_tests@1.0.0 test-server
126
+ > TEST_TYPE=server node --trace-uncaught --test dist/server/index.js
127
+
128
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
129
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
130
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
131
+
132
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
133
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
134
+ id TEXT PRIMARY KEY
135
+ , "description" TEXT
136
+ );
137
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
138
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
139
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
140
+
141
+ CREATE TABLE "files" (
142
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
143
+ "storage_key" UUID UNIQUE ,
144
+ "extension" TEXT NOT NULL DEFAULT '' ,
145
+ "content_type" TEXT NOT NULL DEFAULT '' ,
146
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
147
+ "etag" TEXT NOT NULL DEFAULT '' ,
148
+ "original_name" TEXT NOT NULL ,
149
+ "original_last_modified" TIMESTAMPTZ ,
150
+ "description" TEXT ,
151
+ "url" TEXT NOT NULL DEFAULT '' ,
152
+ "cloud_url" TEXT ,
153
+ "signed_url" TEXT ,
154
+ "signed_url_expires" BIGINT ,
155
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
156
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
157
+ "deleted" TIMESTAMPTZ ,
158
+ "deleted_from_storage" TIMESTAMPTZ ,
159
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
160
+ "version" INTEGER NOT NULL DEFAULT 1 ,
161
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
162
+ );
163
+ CREATE TABLE "files_versions" (
164
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
165
+ "storage_key" UUID NOT NULL ,
166
+ "extension" TEXT NOT NULL DEFAULT '' ,
167
+ "content_type" TEXT NOT NULL DEFAULT '' ,
168
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
169
+ "etag" TEXT NOT NULL DEFAULT '' ,
170
+ "original_name" TEXT NOT NULL ,
171
+ "original_last_modified" TIMESTAMPTZ ,
172
+ "description" TEXT ,
173
+ "url" TEXT NOT NULL DEFAULT '' ,
174
+ "cloud_url" TEXT ,
175
+ "signed_url" TEXT ,
176
+ "signed_url_expires" BIGINT ,
177
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
178
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
179
+ "deleted" TIMESTAMPTZ ,
180
+ "deleted_from_storage" TIMESTAMPTZ ,
181
+ "file_id" UUID NOT NULL ,
182
+ "version" INTEGER NOT NULL ,
183
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
184
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
185
+ );
186
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
187
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
188
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
189
+ CREATE TABLE "users_public_info" (
190
+ "id" SERIAL PRIMARY KEY ,
191
+ "name" TEXT ,
192
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
193
+ "sid" TEXT
194
+ );
195
+ DROP TABLE IF EXISTS "users";
196
+ CREATE TABLE "users" (
197
+ "id" SERIAL PRIMARY KEY ,
198
+ "email" TEXT NOT NULL ,
199
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
200
+ "type" TEXT NOT NULL ,
201
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
202
+ );
203
+ DROP TABLE IF EXISTS "tjson";
204
+ CREATE TABLE "tjson" (
205
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
206
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
207
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
208
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
209
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
210
+ );
211
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
212
+
213
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
214
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
215
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
216
+ DROP TABLE IF EXISTS "api_table";
217
+ CREATE TABLE "api_table" (
218
+ "id" SERIAL PRIMARY KEY
219
+ );
220
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
221
+ (server): prostgles onReady
222
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
223
+ IO missing. Publish has no effect without io or restApi
224
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
225
+ IO missing. Publish has no effect without io or restApi
226
+ destroying prgl instance
227
+ destroying prgl instance
228
+ ▶ Server Only Queries
229
+ ✔ execution context follows functions, hooks and deferred transaction callbacks (2435.589282ms)
230
+ ✔ column definition row types support SQL aliases, arrays and generated columns (7.076453ms)
231
+ ✔ lookup types propagate through database references while preserving overrides (9.3565ms)
232
+ ✔ lookup types follow FK chains by column and terminate cycles (149.68838ms)
233
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
234
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
235
+
236
+ CREATE TABLE "files" (
237
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
238
+ "storage_key" UUID UNIQUE ,
239
+ "extension" TEXT NOT NULL DEFAULT '' ,
240
+ "content_type" TEXT NOT NULL DEFAULT '' ,
241
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
242
+ "etag" TEXT NOT NULL DEFAULT '' ,
243
+ "original_name" TEXT NOT NULL ,
244
+ "original_last_modified" TIMESTAMPTZ ,
245
+ "description" TEXT ,
246
+ "url" TEXT NOT NULL DEFAULT '' ,
247
+ "cloud_url" TEXT ,
248
+ "signed_url" TEXT ,
249
+ "signed_url_expires" BIGINT ,
250
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
251
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
252
+ "deleted" TIMESTAMPTZ ,
253
+ "deleted_from_storage" TIMESTAMPTZ ,
254
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
255
+ );
256
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
257
+ Prostgles: Created typescript schema definition file:
258
+ DBGeneratedSchema.ts
259
+ Prostgles: Created typescript schema definition file:
260
+ DBGeneratedSchema.ts
261
+ ▶ client publish profiles compile at startup and follow user types
262
+ ✔ server user handlers enforce permissions and reject client impersonation (40.875002ms)
263
+ ✔ a rejected guest abort cannot cancel a later server-user query (2.778574ms)
264
+ ✔ caught subscription errors still roll back client transactions (2.894815ms)
265
+ ✔ caught checkFilter errors still roll back client transactions (8.023264ms)
266
+ ✔ caught postValidate errors still roll back client transactions (2.344502ms)
267
+ No options changed
268
+ Prostgles: Created typescript schema definition file:
269
+ DBGeneratedSchema.ts
270
+ Prostgles: Created typescript schema definition file:
271
+ DBGeneratedSchema.ts
272
+ Prostgles: Created typescript schema definition file:
273
+ DBGeneratedSchema.ts
274
+ Prostgles: Created typescript schema definition file:
275
+ DBGeneratedSchema.ts
276
+ destroying prgl instance
277
+ ✔ server user handlers require configured authentication (0.862266ms)
278
+ ✔ client publish profiles compile at startup and follow user types (1948.335377ms)
279
+ ▶ Managed storage permission and transaction safety
280
+ ✔ legacy ID-based files remain readable and replaceable (26.902402ms)
281
+ ✔ custom columns do not require or interfere with file data (26.084646ms)
282
+ ✔ filtered updates and failed validation preserve storage (11.204979ms)
283
+ ✔ failed uploads and application hooks leave no replacement objects (25.747478ms)
284
+ ✔ duplicate IDs, conflict updates and SQL-only requests cannot overwrite (21.586657ms)
285
+ ✔ PostgreSQL update policies are enforced before uploading (11.483877ms)
286
+ ✔ RLS-hidden references fail closed during storage cleanup (11.507526ms)
287
+ ✔ beforeEach lifecycle callbacks follow the outer transaction (51.465419ms)
288
+ ✔ outer rollback preserves replaced and deleted objects (25.86862ms)
289
+ ✔ a failed multi-insert waits for other uploads before cleanup (4.899251ms)
290
+ ✔ concurrent replacements leave one complete referenced object (21.269863ms)
291
+ ✔ version retention removes only unreferenced objects (36.236969ms)
292
+ ✔ foreign-key failure preserves bytes and deletion waits for commit (20.208969ms)
293
+ ✔ cloud downloads and cleanup use the committed storage key (46.975342ms)
294
+ ✔ Managed storage permission and transaction safety (376.643581ms)
295
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
296
+ destroying prgl instance
297
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
298
+ destroying prgl instance
299
+ ✔ custom joins add conditions unless override is requested (2302.896705ms)
300
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
301
+ destroying prgl instance
302
+ ✔ custom self joins use configured paths and override inferred joins (1197.227497ms)
303
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
304
+ destroying prgl instance
305
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
306
+ destroying prgl instance
307
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
308
+ destroying prgl instance
309
+ ✔ destroy allows reusing Socket.IO on a running HTTP server (3440.675681ms)
310
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
311
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
312
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
313
+
314
+ CREATE TABLE "audit_events" (
315
+ "id" BIGSERIAL PRIMARY KEY ,
316
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
317
+ "schema_name" TEXT NOT NULL ,
318
+ "table_name" TEXT NOT NULL ,
319
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
320
+ "old_id" JSONB ,
321
+ "new_id" JSONB ,
322
+ "old_row" JSONB ,
323
+ "new_row" JSONB ,
324
+ "actor" JSONB ,
325
+ "db_context" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"transaction_id":"string","transaction_started_at":"string","statement_started_at":"string","current_role":"string","session_user":"string","application_name":"string"}}'::TEXT, "db_context", '{"table":"audit_events","column":"db_context"}' ))
326
+ );
327
+ CREATE TABLE "audit_test_files" (
328
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
329
+ "storage_key" UUID UNIQUE ,
330
+ "extension" TEXT NOT NULL DEFAULT '' ,
331
+ "content_type" TEXT NOT NULL DEFAULT '' ,
332
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
333
+ "etag" TEXT NOT NULL DEFAULT '' ,
334
+ "original_name" TEXT NOT NULL ,
335
+ "original_last_modified" TIMESTAMPTZ ,
336
+ "description" TEXT ,
337
+ "url" TEXT NOT NULL DEFAULT '' ,
338
+ "cloud_url" TEXT ,
339
+ "signed_url" TEXT ,
340
+ "signed_url_expires" BIGINT ,
341
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
342
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
343
+ "deleted" TIMESTAMPTZ ,
344
+ "deleted_from_storage" TIMESTAMPTZ ,
345
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
346
+ );
347
+ CREATE TABLE "audit_test_source" (
348
+ "a" int NOT NULL ,
349
+ "b" text NOT NULL ,
350
+ "value" text ,
351
+ "secret" text
352
+ );
353
+ ALTER TABLE "audit_test_source" ADD PRIMARY KEY (a, b);
354
+ CREATE TABLE "audit_test_documents" (
355
+ "id" serial PRIMARY KEY ,
356
+ "file_id" uuid NOT NULL REFERENCES audit_test_files(id)
357
+ );
358
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
359
+ IO missing. Publish has no effect without io or restApi
360
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
361
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
362
+ IO missing. Publish has no effect without io or restApi
363
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
364
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
365
+ IO missing. Publish has no effect without io or restApi
366
+ destroying prgl instance
367
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
368
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
369
+ IO missing. Publish has no effect without io or restApi
370
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
371
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
372
+ IO missing. Publish has no effect without io or restApi
373
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
374
+ Trace: Error: audit.tables cannot mix enabled and disabled entries
375
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:19:15)
376
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
377
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
378
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
379
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
380
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
381
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
382
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
383
+ at async waitForActual (node:assert:646:5)
384
+ at async strict.rejects (node:assert:769:25)
385
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
386
+ at async Test.run (node:internal/test_runner/test:1125:7)
387
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
388
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
389
+ Trace: Error: Unknown audit table: missing_table
390
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:23:19)
391
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
392
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
393
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
394
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
395
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
396
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
397
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
398
+ at async waitForActual (node:assert:646:5)
399
+ at async strict.rejects (node:assert:769:25)
400
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
401
+ at async Test.run (node:internal/test_runner/test:1125:7)
402
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
403
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
404
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
405
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
406
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
407
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
408
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
409
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
410
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
411
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
412
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
413
+ at async waitForActual (node:assert:646:5)
414
+ at async strict.rejects (node:assert:769:25)
415
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
416
+ at async Test.run (node:internal/test_runner/test:1125:7)
417
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
418
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
419
+ Trace: Error: Unsupported audit target: audit_test_view
420
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:37:23)
421
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
422
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
423
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
424
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
425
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
426
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
427
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
428
+ at async waitForActual (node:assert:646:5)
429
+ at async strict.rejects (node:assert:769:25)
430
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
431
+ at async Test.run (node:internal/test_runner/test:1125:7)
432
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
433
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
434
+ Trace: Error: Audit identity columns cannot be excluded: audit_test_source
435
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:54:19)
436
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
437
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
438
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
439
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
440
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
441
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
442
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
443
+ at async waitForActual (node:assert:646:5)
444
+ at async strict.rejects (node:assert:769:25)
445
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
446
+ at async Test.run (node:internal/test_runner/test:1125:7)
447
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
448
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
449
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
450
+ IO missing. Publish has no effect without io or restApi
451
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
452
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
453
+ IO missing. Publish has no effect without io or restApi
454
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
455
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
456
+ IO missing. Publish has no effect without io or restApi
457
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
458
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
459
+ IO missing. Publish has no effect without io or restApi
460
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-z7ItfI/init.sql
461
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
462
+ IO missing. Publish has no effect without io or restApi
463
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
464
+ IO missing. Publish has no effect without io or restApi
465
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
466
+ IO missing. Publish has no effect without io or restApi
467
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
468
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
469
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
470
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
471
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
472
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
473
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
474
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
475
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
476
+ at async updateConfiguration (/home/s/prostgles-server-js/dist/updateConfiguration.js:58:9)
477
+ at async Object.update (/home/s/prostgles-server-js/dist/initProstgles.js:162:17)
478
+ at async waitForActual (node:assert:646:5)
479
+ at async strict.rejects (node:assert:769:25)
480
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:535:13)
481
+ at async Test.run (node:internal/test_runner/test:1125:7)
482
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
483
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
484
+ IO missing. Publish has no effect without io or restApi
485
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
486
+
487
+ CREATE TABLE "audit_next_events" (
488
+ "id" BIGSERIAL PRIMARY KEY ,
489
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
490
+ "schema_name" TEXT NOT NULL ,
491
+ "table_name" TEXT NOT NULL ,
492
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
493
+ "old_id" JSONB ,
494
+ "new_id" JSONB ,
495
+ "old_row" JSONB ,
496
+ "new_row" JSONB ,
497
+ "actor" JSONB ,
498
+ "db_context" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"transaction_id":"string","transaction_started_at":"string","statement_started_at":"string","current_role":"string","session_user":"string","application_name":"string"}}'::TEXT, "db_context", '{"table":"audit_next_events","column":"db_context"}' ))
499
+ );
500
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
501
+ IO missing. Publish has no effect without io or restApi
502
+ destroying prgl instance
503
+ ✔ Managed audit setup, row history, protection, access and query readiness (8130.078577ms)
504
+ ✔ getJSONBSchemaValidationErrorAsync with real db handlers (3.344163ms)
505
+ getPubSubManagerInitQuery: Outdated prostgles schema. Re-creating...
506
+ ✔ Parallel subscription at init causing crash in getPubSubManager: duplicate key value violates unique constraint "apps_pkey" (101.7867ms)
507
+ ✔ RLS context is isolated across implicit transactions, commit, rollback and pool reuse (19.53828ms)
508
+ ✔ subscription and sync reads isolate users with a real RLS policy (16.688855ms)
509
+ ✔ ordinary beforeEach hooks transform inputs before validation (32.672449ms)
510
+ ✔ multi false is checked after beforeEach and rolls back the update (8.724429ms)
511
+ ✔ ordinary beforeEach hooks run before PostgreSQL UPDATE policy checks (11.637814ms)
512
+ ✔ before and after hooks preserve RLS across dbx and raw tx calls (21.015427ms)
513
+ ▶ post-transaction hooks receive committed and authenticated context
514
+ ✔ afterCommit runs after commit, filters changed fields and skips rollback (16.614008ms)
515
+ ✔ clearing a watched field runs before, after and commit hooks (2.790773ms)
516
+ ✔ client updateBatch runs hooks atomically in implicit and explicit transactions (16.693623ms)
517
+ destroying prgl instance
518
+ ✔ server-user requests preserve tenant_id from sessionFields (1.682345ms)
519
+ ✔ post-transaction hooks receive committed and authenticated context (1204.016162ms)
520
+ ✔ Self reference recursion bug (4.085907ms)
521
+ ✔ Transactions (17.64106ms)
522
+ (server): Server-only query tests successful
523
+ (server): Starting isomorphic queries
524
+ ✔ TableConfig onMount works (4.228177ms)
525
+ ✔ Server Only Queries (21445.337685ms)
526
+ (server): DELETING items
527
+ ▶ Isomorphic queries
528
+ ✔ Deleting stale data (39.985893ms)
529
+ ✔ Error structure malformed array literal (20.252427ms)
530
+ ✔ Table info (0.322179ms)
531
+ ✔ Prepare data (22.716536ms)
532
+ ✔ Test bytea (2.325496ms)
533
+ ✔ abortSignal terminates a running query (5539.363433ms)
534
+ ✔ Client queries are aborted no more than after n seconds (0.397617ms)
535
+ ✔ Subscription tracked_columns get merged correctly (25.320713ms)
536
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (969.043908ms)
537
+ ✔ CASE select and subscription dependencies (660.656288ms)
538
+ ✔ Subscription tracks non-selected ORDER BY columns (647.23179ms)
539
+ ✔ merge json (6.689139ms)
540
+ ✔ json array converted to pg array filter bug (4.98953ms)
541
+ ✔ onConflict do update (6.043046ms)
542
+ ✔ Local file upload (21.440163ms)
543
+ ✔ Local file delete (16.556278ms)
544
+ ✔ Local file update (16.752289ms)
545
+ ✔ getColumns definition (0.539783ms)
546
+ ✔ returnType (0.226254ms)
547
+ ✔ Table config triggers (3.890889ms)
548
+ ✔ $unnest_words (0.712268ms)
549
+ ✔ Group by/Distinct (1.775906ms)
550
+ ✔ sql returntype default-with-rollback (7.185997ms)
551
+ ✔ returnType: value (0.586954ms)
552
+ ✔ PostgreSQL array element (2.524411ms)
553
+ ✔ FTS filtering (2.994317ms)
554
+ ✔ $term_highlight (2.865062ms)
555
+ ✔ funcFilters: $term_highlight (1.209421ms)
556
+ (server): [{"name":null}]
557
+ (server): [{"name":"zz3zz1"}]
558
+ (server): []
559
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (857.40504ms)
560
+ (server): [{"name":null}]
561
+ (server): [{"name":"zz3zz1"}]
562
+ (server): [{"name":"zz3zz1"}]
563
+ (server): [{"name":"zz3zz1"}]
564
+ (server): []
565
+ ✔ subscribe skipChangedColumnsCheck true (3386.627577ms)
566
+ unsubscribe start - various
567
+ unsubscribe end - various
568
+ ✔ subscribe (46.062078ms)
569
+ ✔ subscribe to schema.table (16.743229ms)
570
+ ✔ parallel subscriptions (2025.471196ms)
571
+ (server): updateAll done in 1633
572
+ (server): updateAll done in 1604
573
+ (server): Locks: [{"pid":260887,"blocking_pids":[261001],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"},{"pid":260998,"blocking_pids":[261001,260887,261000],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"},{"pid":261000,"blocking_pids":[261001,260887],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
574
+ (server): updateAll done in 1955
575
+ ✔ subscriptions do not serialize transactions (9720.29707ms)
576
+ Created PubSubManager
577
+ throttling sub for 1700 ms
578
+ ✔ subscribeOne with throttle (1741.947048ms)
579
+ throttling finished. pushSubData...
580
+ throttling sub for 1700 ms
581
+ ✔ subscribeOne with throttle skipFirst: true (1712.273266ms)
582
+ ✔ subscribeOne without skipFirst (1026.928545ms)
583
+ ✔ subscribeOne with skipFirst: true (1534.996348ms)
584
+ ✔ subscribeOne actions: { insert: true } (1538.654655ms)
585
+ ✔ subscribeOne actions: { insert: false } (1542.182994ms)
586
+ ✔ JSON filtering (4.573605ms)
587
+ ✔ Complex filtering (4.294986ms)
588
+ ✔ template_string function (3.681819ms)
589
+ ✔ Between filtering (2.918993ms)
590
+ ✔ In filtering (2.900948ms)
591
+ ✔ Order by (3.31834ms)
592
+ ✔ Order by aliased func (2.603711ms)
593
+ ✔ Filter by aliased func (2.568672ms)
594
+ ✔ Count with Filter by aliased func (1.757427ms)
595
+ ✔ Count with Aggregate and Filter by aliased func (2.154997ms)
596
+ ✔ Count with complex filter (1.823318ms)
597
+ ✔ Order by aggregation (2.358995ms)
598
+ ✔ Aggregate FILTER and ORDER BY (1.704511ms)
599
+ ✔ Column alias func (1.036031ms)
600
+ ✔ Order by colliding alias name (1.073829ms)
601
+ ✔ Update batch example (13.637095ms)
602
+ TODO: socket.io stringifies dates
603
+ ✔ Function example (13.411174ms)
604
+ ✔ JSONB filtering (6.708139ms)
605
+ ✔ Postgis examples (11.500034ms)
606
+ ✔ jsonbSchema validation (5.335733ms)
607
+ ✔ find and findOne (2.20929ms)
608
+ ✔ Result size (1.840757ms)
609
+ ✔ Basic exists (1.75699ms)
610
+ ✔ Basic fts with shorthand notation (2.25133ms)
611
+ ✔ Exists with shortest path wildcard filter example (1.585334ms)
612
+ ✔ Exists with exact path filter example (0.784308ms)
613
+ ✔ Not Exists with exact path filter example (0.628211ms)
614
+ ✔ Upsert example (12.521678ms)
615
+ ✔ Joins example (1.443506ms)
616
+ ✔ Joins repeating table example (1.767599ms)
617
+ ✔ Join aggregate functions example (5.276144ms)
618
+ ✔ $rowhash example (3.085841ms)
619
+ ✔ Reference column nested insert (7.09887ms)
620
+ ✔ Join escaped table names with quotes (11.744929ms)
621
+ (server): {
622
+ "item": {
623
+ "\"id0\"": 1,
624
+ "\"quoted1_id\"": 1,
625
+ "\"text_col0\"": "0"
626
+ },
627
+ "runs": 0
628
+ }
629
+ (server): {
630
+ "item": {
631
+ "\"id0\"": 1,
632
+ "\"quoted1_id\"": 1,
633
+ "\"text_col0\"": "1"
634
+ },
635
+ "runs": 1
636
+ }
637
+ unsubscribe start - """quoted0"""
638
+ unsubscribe end - """quoted0"""
639
+ ✔ subscribe to escaped table name (22.982451ms)
640
+ ✔ subscribe using a filter bigger than block_size (18.825955ms)
641
+ ✔ Reverse join with agg (16.339914ms)
642
+ {
643
+ _rows: [
644
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
645
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
646
+ ],
647
+ runs: 1
648
+ }
649
+ {
650
+ _rows: [
651
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
652
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
653
+ ],
654
+ runs: 2
655
+ }
656
+ ✔ Related table subscribe (9053.091482ms)
657
+ ✔ Aggregate FILTER registers joined dependency triggers (675.34108ms)
658
+ ✔ Nested sort by computed col (15.330783ms)
659
+ ✔ Nested function on different than source column getNewQuery name bug fix (2.122409ms)
660
+ ✔ Reference column deep nested insert (18.419221ms)
661
+ ✔ Multi reference column nested insert (9.011775ms)
662
+ ✔ Join path with order by nested (6.869732ms)
663
+ ✔ Self join (14.774527ms)
664
+ ✔ One to many multi join duplicate row bug fix (15.909949ms)
665
+ (server): various id=99 count 1
666
+ (server): various id=99 count
667
+ ok
668
+ (server): various id=99 count
669
+ (server): Error in subscription callback: {"message":"column prostgles_root_table_alias.name does not exist","length":130,"name":"error","severity":"ERROR","code":"42703","position":"107","file":"parse_relation.c","line":"3665","routine":"errorMissingColumn","query":"-- prostgles query id: c7a30020-4a27-4c3d-9da7-41916f8a39e0\nSET LOCAL \"prostgles.user\" \nTO '';\nSELECT \n \"prostgles_root_table_alias\".\"name\" AS \"name\" \n FROM ( \n SELECT * \n FROM various \n WHERE \"id\" = 99 \n ) prostgles_root_table_alias \n LIMIT 1000","code_info":"undefined_column"}
670
+ ok
671
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6540.755306ms)
672
+ ✔ Isomorphic queries (49732.680812ms)
673
+ ✔ Having clause (1.108222ms)
674
+ ✔ Having clause with complex filter (0.919087ms)
675
+ (server): Server isomorphic tests successful
676
+ (server): Stopping server ...
677
+ ℹ tests 135
678
+ ℹ suites 2
679
+ ℹ pass 135
680
+ ℹ fail 0
681
+ ℹ cancelled 0
682
+ ℹ skipped 0
683
+ ℹ todo 0
684
+ ℹ duration_ms 77140.051413
685
+
686
+ > server_tests@1.0.0 test-client
687
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
688
+
689
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
690
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
691
+
692
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
693
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
694
+ id TEXT PRIMARY KEY
695
+ , "description" TEXT
696
+ );
697
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
698
+
699
+ CREATE TABLE "files" (
700
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
701
+ "storage_key" UUID UNIQUE ,
702
+ "extension" TEXT NOT NULL DEFAULT '' ,
703
+ "content_type" TEXT NOT NULL DEFAULT '' ,
704
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
705
+ "etag" TEXT NOT NULL DEFAULT '' ,
706
+ "original_name" TEXT NOT NULL ,
707
+ "original_last_modified" TIMESTAMPTZ ,
708
+ "description" TEXT ,
709
+ "url" TEXT NOT NULL DEFAULT '' ,
710
+ "cloud_url" TEXT ,
711
+ "signed_url" TEXT ,
712
+ "signed_url_expires" BIGINT ,
713
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
714
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
715
+ "deleted" TIMESTAMPTZ ,
716
+ "deleted_from_storage" TIMESTAMPTZ ,
717
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
718
+ "version" INTEGER NOT NULL DEFAULT 1 ,
719
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
720
+ );
721
+ CREATE TABLE "files_versions" (
722
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
723
+ "storage_key" UUID NOT NULL ,
724
+ "extension" TEXT NOT NULL DEFAULT '' ,
725
+ "content_type" TEXT NOT NULL DEFAULT '' ,
726
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
727
+ "etag" TEXT NOT NULL DEFAULT '' ,
728
+ "original_name" TEXT NOT NULL ,
729
+ "original_last_modified" TIMESTAMPTZ ,
730
+ "description" TEXT ,
731
+ "url" TEXT NOT NULL DEFAULT '' ,
732
+ "cloud_url" TEXT ,
733
+ "signed_url" TEXT ,
734
+ "signed_url_expires" BIGINT ,
735
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
736
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
737
+ "deleted" TIMESTAMPTZ ,
738
+ "deleted_from_storage" TIMESTAMPTZ ,
739
+ "file_id" UUID NOT NULL ,
740
+ "version" INTEGER NOT NULL ,
741
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
742
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
743
+ );
744
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
745
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
746
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
747
+ CREATE TABLE "users_public_info" (
748
+ "id" SERIAL PRIMARY KEY ,
749
+ "name" TEXT ,
750
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
751
+ "sid" TEXT
752
+ );
753
+ DROP TABLE IF EXISTS "users";
754
+ CREATE TABLE "users" (
755
+ "id" SERIAL PRIMARY KEY ,
756
+ "email" TEXT NOT NULL ,
757
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
758
+ "type" TEXT NOT NULL ,
759
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
760
+ );
761
+ DROP TABLE IF EXISTS "tjson";
762
+ CREATE TABLE "tjson" (
763
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
764
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
765
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
766
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
767
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
768
+ );
769
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
770
+
771
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
772
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
773
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
774
+ DROP TABLE IF EXISTS "api_table";
775
+ CREATE TABLE "api_table" (
776
+ "id" SERIAL PRIMARY KEY
777
+ );
778
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
779
+ (server): prostgles onReady
780
+ (server): Waiting for client...
781
+ (client) t+ 0ms Started client...
782
+ onSocketConnect WmwdVVRF6MlAgNqXAAAA
783
+ (server): Client connected -> console does not work. use log function. socket.id: WmwdVVRF6MlAgNqXAAAA
784
+ (client) t+ 38ms Client connect.
785
+ (client) t+ 176ms TEST_NAME: syncTriggerCleanup Started
786
+ Created PubSubManager
787
+ Pushing 0 rows to socket
788
+ ✔ subscription receives an update immediately after another trigger is deleted (477.519363ms)
789
+ Pushing 1 rows to socket x2
790
+ Pushing 0 rows to socket
791
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
792
+ Client log (client) t+ 3345ms TEST_NAME: syncTriggerCleanup Finished OK
793
+ ✔ unsubscribe cleanup preserves a sync being registered (2685.799098ms)
794
+ Client test successful
795
+ (server): Stopping server ...
796
+ ℹ tests 2
797
+ ℹ suites 0
798
+ ℹ pass 2
799
+ ℹ fail 0
800
+ ℹ cancelled 0
801
+ ℹ skipped 0
802
+ ℹ todo 0
803
+ ℹ duration_ms 11614.538862
804
+
805
+ > server_tests@1.0.0 test-client
806
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
807
+
808
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
809
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
810
+
811
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
812
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
813
+ id TEXT PRIMARY KEY
814
+ , "description" TEXT
815
+ );
816
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
817
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
818
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
819
+
820
+ CREATE TABLE "files" (
821
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
822
+ "storage_key" UUID UNIQUE ,
823
+ "extension" TEXT NOT NULL DEFAULT '' ,
824
+ "content_type" TEXT NOT NULL DEFAULT '' ,
825
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
826
+ "etag" TEXT NOT NULL DEFAULT '' ,
827
+ "original_name" TEXT NOT NULL ,
828
+ "original_last_modified" TIMESTAMPTZ ,
829
+ "description" TEXT ,
830
+ "url" TEXT NOT NULL DEFAULT '' ,
831
+ "cloud_url" TEXT ,
832
+ "signed_url" TEXT ,
833
+ "signed_url_expires" BIGINT ,
834
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
835
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
836
+ "deleted" TIMESTAMPTZ ,
837
+ "deleted_from_storage" TIMESTAMPTZ ,
838
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
839
+ "version" INTEGER NOT NULL DEFAULT 1 ,
840
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
841
+ );
842
+ CREATE TABLE "files_versions" (
843
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
844
+ "storage_key" UUID NOT NULL ,
845
+ "extension" TEXT NOT NULL DEFAULT '' ,
846
+ "content_type" TEXT NOT NULL DEFAULT '' ,
847
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
848
+ "etag" TEXT NOT NULL DEFAULT '' ,
849
+ "original_name" TEXT NOT NULL ,
850
+ "original_last_modified" TIMESTAMPTZ ,
851
+ "description" TEXT ,
852
+ "url" TEXT NOT NULL DEFAULT '' ,
853
+ "cloud_url" TEXT ,
854
+ "signed_url" TEXT ,
855
+ "signed_url_expires" BIGINT ,
856
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
857
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
858
+ "deleted" TIMESTAMPTZ ,
859
+ "deleted_from_storage" TIMESTAMPTZ ,
860
+ "file_id" UUID NOT NULL ,
861
+ "version" INTEGER NOT NULL ,
862
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
863
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
864
+ );
865
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
866
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
867
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
868
+ CREATE TABLE "users_public_info" (
869
+ "id" SERIAL PRIMARY KEY ,
870
+ "name" TEXT ,
871
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
872
+ "sid" TEXT
873
+ );
874
+ DROP TABLE IF EXISTS "users";
875
+ CREATE TABLE "users" (
876
+ "id" SERIAL PRIMARY KEY ,
877
+ "email" TEXT NOT NULL ,
878
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
879
+ "type" TEXT NOT NULL ,
880
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
881
+ );
882
+ DROP TABLE IF EXISTS "tjson";
883
+ CREATE TABLE "tjson" (
884
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
885
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
886
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
887
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
888
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
889
+ );
890
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
891
+
892
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
893
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
894
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
895
+ DROP TABLE IF EXISTS "api_table";
896
+ CREATE TABLE "api_table" (
897
+ "id" SERIAL PRIMARY KEY
898
+ );
899
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
900
+ (server): prostgles onReady
901
+ (server): Waiting for client...
902
+ (client) t+ 0ms Started client...
903
+ onSocketConnect UC-pe1mjfNEtJlsnAAAA
904
+ (server): Client connected -> console does not work. use log function. socket.id: UC-pe1mjfNEtJlsnAAAA
905
+ (client) t+ 39ms Client connect.
906
+ (client) t+ 183ms TEST_NAME: main Started
907
+ Client log (client) t+ 223ms Starting isomorphic queries
908
+ ▶ Isomorphic queries
909
+ ✔ Deleting stale data (22.936025ms)
910
+ {
911
+ message: 'malformed array literal: "a"',
912
+ length: 149,
913
+ name: 'error',
914
+ severity: 'ERROR',
915
+ code: '22P02',
916
+ detail: 'Array value must start with "{" or dimension information.',
917
+ position: '325',
918
+ file: 'arrayfuncs.c',
919
+ line: '317',
920
+ routine: 'array_in',
921
+ query: '-- prostgles query id: fc18379e-7887-420b-aa92-238d2aedce2f\n' +
922
+ 'SET LOCAL "prostgles.user" \n' +
923
+ `TO '{"id":"1","type":"public"}';\n` +
924
+ 'SELECT \n' +
925
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
926
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
927
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
928
+ ' FROM ( \n' +
929
+ ' SELECT * \n' +
930
+ ' FROM items \n' +
931
+ ` WHERE "h" = 'a' \n` +
932
+ ' ) prostgles_root_table_alias \n' +
933
+ ' LIMIT 0',
934
+ code_info: 'invalid_text_representation'
935
+ }
936
+ {
937
+ message: 'malformed array literal: "a"',
938
+ length: 149,
939
+ name: 'error',
940
+ severity: 'ERROR',
941
+ code: '22P02',
942
+ detail: 'Array value must start with "{" or dimension information.',
943
+ position: '325',
944
+ file: 'arrayfuncs.c',
945
+ line: '317',
946
+ routine: 'array_in',
947
+ query: '-- prostgles query id: 7475d97b-b2d4-4ff2-a4bf-8e6709b862a1\n' +
948
+ 'SET LOCAL "prostgles.user" \n' +
949
+ `TO '{"id":"1","type":"public"}';\n` +
950
+ 'SELECT \n' +
951
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
952
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
953
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
954
+ ' FROM ( \n' +
955
+ ' SELECT * \n' +
956
+ ' FROM items \n' +
957
+ ` WHERE "h" = 'a' \n` +
958
+ ' ) prostgles_root_table_alias \n' +
959
+ ' LIMIT 0',
960
+ code_info: 'invalid_text_representation'
961
+ }
962
+ ✔ Error structure malformed array literal (30.263339ms)
963
+ ✔ Table info (0.980329ms)
964
+ ✔ Prepare data (37.969854ms)
965
+ ✔ Test bytea (9.456725ms)
966
+ ✔ abortSignal terminates a running query (5542.434722ms)
967
+ ✔ Client queries are aborted no more than after n seconds (14011.933236ms)
968
+ ✔ Subscription tracked_columns get merged correctly (0.57362ms)
969
+ Created PubSubManager
970
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (1013.400735ms)
971
+ ✔ CASE select and subscription dependencies (684.416709ms)
972
+ ✔ Subscription tracks non-selected ORDER BY columns (646.664691ms)
973
+ ✔ merge json (17.486802ms)
974
+ ✔ json array converted to pg array filter bug (3.226196ms)
975
+ ✔ onConflict do update (10.692387ms)
976
+ ✔ Local file upload (35.106743ms)
977
+ ✔ Local file delete (21.407128ms)
978
+ ✔ Local file update (51.066749ms)
979
+ ✔ getColumns definition (1.847748ms)
980
+ ✔ returnType (0.87199ms)
981
+ ✔ Table config triggers (10.121971ms)
982
+ ✔ $unnest_words (1.505739ms)
983
+ ✔ Group by/Distinct (2.252876ms)
984
+ ✔ sql returntype default-with-rollback (28.292346ms)
985
+ ✔ returnType: value (2.783769ms)
986
+ ✔ PostgreSQL array element (9.43829ms)
987
+ ✔ FTS filtering (5.955603ms)
988
+ ✔ $term_highlight (4.804685ms)
989
+ ✔ funcFilters: $term_highlight (3.319282ms)
990
+ Client log (client) t+ 22455ms [{"name":null}]
991
+ Client log (client) t+ 22459ms [{"name":"zz3zz1"}]
992
+ Pushing 1 rows to socket x9
993
+ Client log (client) t+ 23105ms []
994
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (860.752647ms)
995
+ Pushing 0 rows to socket
996
+ Client log (client) t+ 25844ms [{"name":null}]
997
+ Client log (client) t+ 25870ms [{"name":"zz3zz1"}]
998
+ Client log (client) t+ 26080ms [{"name":"zz3zz1"}]
999
+ Client log (client) t+ 26295ms [{"name":"zz3zz1"}]
1000
+ Pushing 1 rows to socket x4
1001
+ Client log (client) t+ 26515ms []
1002
+ ✔ subscribe skipChangedColumnsCheck true (3409.17348ms)
1003
+ Pushing 0 rows to socket
1004
+ Pushing 1 rows to socket x4
1005
+ Client log unsubscribe start - various
1006
+ Client log unsubscribe end - various
1007
+ ✔ subscribe (42.229549ms)
1008
+ Pushing 0 rows to socket
1009
+ Pushing 1 rows to socket
1010
+ ✔ subscribe to schema.table (16.088282ms)
1011
+ Pushing 2 rows to socket
1012
+ ✔ parallel subscriptions (2009.533603ms)
1013
+ Client log (client) t+ 32920ms updateAll done in 1632
1014
+ Client log (client) t+ 34579ms updateAll done in 1653
1015
+ Pushing 0 rows to socket
1016
+ Pushing 3 rows to socket
1017
+ Pushing 996 rows to socket
1018
+ Client log (client) t+ 36653ms updateAll done in 2057
1019
+ Pushing 1000 rows to socket x2
1020
+ ✔ subscriptions do not serialize transactions (9882.684368ms)
1021
+ Pushing 3 rows to socket
1022
+ Pushing 1 rows to socket
1023
+ throttling sub for 1700 ms
1024
+ throttling finished. pushSubData...
1025
+ Pushing 1 rows to socket
1026
+ throttling sub for 1700 ms
1027
+ ✔ subscribeOne with throttle (1735.593989ms)
1028
+ throttling sub for 1700 ms
1029
+ throttling finished. pushSubData...
1030
+ ✔ subscribeOne with throttle skipFirst: true (1703.103176ms)
1031
+ Pushing 1 rows to socket
1032
+ throttling finished. pushSubData...
1033
+ Pushing 1 rows to socket
1034
+ ✔ subscribeOne without skipFirst (1036.552156ms)
1035
+ Pushing 0 rows to socket
1036
+ Pushing 1 rows to socket
1037
+ ✔ subscribeOne with skipFirst: true (1534.259291ms)
1038
+ Pushing 0 rows to socket x2
1039
+ ✔ subscribeOne actions: { insert: true } (1539.559884ms)
1040
+ Pushing 1 rows to socket
1041
+ ✔ subscribeOne actions: { insert: false } (1544.136754ms)
1042
+ ✔ JSON filtering (4.867705ms)
1043
+ ✔ Complex filtering (4.128951ms)
1044
+ ✔ template_string function (4.854889ms)
1045
+ ✔ Between filtering (3.659624ms)
1046
+ ✔ In filtering (3.312298ms)
1047
+ ✔ Order by (3.59458ms)
1048
+ ✔ Order by aliased func (2.242828ms)
1049
+ ✔ Filter by aliased func (1.414825ms)
1050
+ ✔ Count with Filter by aliased func (1.901845ms)
1051
+ ✔ Count with Aggregate and Filter by aliased func (2.039199ms)
1052
+ ✔ Count with complex filter (3.597212ms)
1053
+ ✔ Order by aggregation (2.119821ms)
1054
+ ✔ Aggregate FILTER and ORDER BY (2.310688ms)
1055
+ ✔ Column alias func (1.262908ms)
1056
+ ✔ Order by colliding alias name (0.993196ms)
1057
+ ✔ Update batch example (11.729139ms)
1058
+ Client log TODO: socket.io stringifies dates
1059
+ ✔ Function example (16.79026ms)
1060
+ ✔ JSONB filtering (11.132104ms)
1061
+ ✔ Postgis examples (17.151076ms)
1062
+ ✔ jsonbSchema validation (13.312714ms)
1063
+ ✔ find and findOne (3.022115ms)
1064
+ ✔ Result size (2.673431ms)
1065
+ ✔ Basic exists (5.231341ms)
1066
+ ✔ Basic fts with shorthand notation (5.580694ms)
1067
+ ✔ Exists with shortest path wildcard filter example (5.972491ms)
1068
+ ✔ Exists with exact path filter example (4.01639ms)
1069
+ ✔ Not Exists with exact path filter example (2.282668ms)
1070
+ ✔ Upsert example (19.059831ms)
1071
+ ✔ Joins example (2.18894ms)
1072
+ ✔ Joins repeating table example (2.725335ms)
1073
+ ✔ Join aggregate functions example (6.506009ms)
1074
+ ✔ $rowhash example (4.117968ms)
1075
+ ✔ Reference column nested insert (8.372527ms)
1076
+ ✔ Join escaped table names with quotes (23.695541ms)
1077
+ Pushing 0 rows to socket x2
1078
+ Client log (client) t+ 47976ms {
1079
+ "item": {
1080
+ "\"id0\"": 1,
1081
+ "\"quoted1_id\"": 1,
1082
+ "\"text_col0\"": "0"
1083
+ },
1084
+ "runs": 0
1085
+ }
1086
+ Client log (client) t+ 47986ms {
1087
+ "item": {
1088
+ "\"id0\"": 1,
1089
+ "\"quoted1_id\"": 1,
1090
+ "\"text_col0\"": "1"
1091
+ },
1092
+ "runs": 1
1093
+ }
1094
+ Client log unsubscribe start - """quoted0"""
1095
+ Client log unsubscribe end - """quoted0"""
1096
+ ✔ subscribe to escaped table name (20.797875ms)
1097
+ Pushing 1 rows to socket x2
1098
+ ✔ subscribe using a filter bigger than block_size (19.43575ms)
1099
+ ✔ Reverse join with agg (20.851589ms)
1100
+ Pushing 0 rows to socket
1101
+ Client log {"_rows":[{"id":1,"t1":null,"tr2":[{"id":1,"tr1_id":1,"t1":"a","t2":"b"}],"tr3":[]},{"id":2,"t1":null,"tr2":[{"id":2,"tr1_id":2,"t1":"a","t2":"b"}],"tr3":[]}],"runs":1}
1102
+ Client log {"_rows":[{"id":1,"t1":null,"tr2":[{"id":1,"tr1_id":1,"t1":"a","t2":"b"},{"id":3,"tr1_id":1,"t1":"a","t2":"b"}],"tr3":[]},{"id":2,"t1":null,"tr2":[{"id":2,"tr1_id":2,"t1":"a","t2":"b"}],"tr3":[]}],"runs":2}
1103
+ ✔ Related table subscribe (9055.869049ms)
1104
+ Pushing 2 rows to socket x2
1105
+ ✔ Aggregate FILTER registers joined dependency triggers (674.437381ms)
1106
+ ✔ Nested sort by computed col (15.776438ms)
1107
+ ✔ Nested function on different than source column getNewQuery name bug fix (3.594556ms)
1108
+ ✔ Reference column deep nested insert (24.223268ms)
1109
+ ✔ Multi reference column nested insert (13.481742ms)
1110
+ ✔ Join path with order by nested (6.817579ms)
1111
+ ✔ Self join (10.999573ms)
1112
+ ✔ One to many multi join duplicate row bug fix (10.770082ms)
1113
+ Client log (client) t+ 57849ms various id=99 count 1
1114
+ Pushing 1 rows to socket x3
1115
+ Client log (client) t+ 57861ms various id=99 count
1116
+ Client log ok
1117
+ Error within running subscription
1118
+ _psqlWS_..various.{"id":99}.{"select":{"name":1}}.m.sub {
1119
+ message: 'column prostgles_root_table_alias.name does not exist',
1120
+ length: 130,
1121
+ name: 'error',
1122
+ severity: 'ERROR',
1123
+ code: '42703',
1124
+ position: '133',
1125
+ file: 'parse_relation.c',
1126
+ line: '3665',
1127
+ routine: 'errorMissingColumn',
1128
+ query: '-- prostgles query id: 0137d97f-1316-4f8c-a167-597267f5d9f1\n' +
1129
+ 'SET LOCAL "prostgles.user" \n' +
1130
+ `TO '{"id":"1","type":"public"}';\n` +
1131
+ 'SELECT \n' +
1132
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
1133
+ ' FROM ( \n' +
1134
+ ' SELECT * \n' +
1135
+ ' FROM various \n' +
1136
+ ' WHERE "id" = 99 \n' +
1137
+ ' ) prostgles_root_table_alias \n' +
1138
+ ' LIMIT 1000',
1139
+ code_info: 'undefined_column'
1140
+ }
1141
+ Client log (client) t+ 59885ms various id=99 count
1142
+ Client log (client) t+ 59885ms Error in subscription callback: {"message":"column prostgles_root_table_alias.name does not exist","length":130,"name":"error","severity":"ERROR","code":"42703","position":"133","file":"parse_relation.c","line":"3665","routine":"errorMissingColumn","query":"-- prostgles query id: 0137d97f-1316-4f8c-a167-597267f5d9f1\nSET LOCAL \"prostgles.user\" \nTO '{\"id\":\"1\",\"type\":\"public\"}';\nSELECT \n \"prostgles_root_table_alias\".\"name\" AS \"name\" \n FROM ( \n SELECT * \n FROM various \n WHERE \"id\" = 99 \n ) prostgles_root_table_alias \n LIMIT 1000","code_info":"undefined_column"}
1143
+ Client log ok
1144
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6563.079263ms)
1145
+ ✔ Isomorphic queries (64179.134934ms)
1146
+ ✔ Having clause (4.261565ms)
1147
+ ✔ Having clause with complex filter (2.697717ms)
1148
+ Client log (client) t+ 64425ms auth.user: {"sid":"main","uid":"1","id":"1","type":"public"}
1149
+ ✔ Nested join having clause (3.765015ms)
1150
+ ▶ isomorphic typed queries
1151
+ ✔ isLookupTable DB Types from colConf (0.174081ms)
1152
+ ✔ isLookupTable DB Types from reference column actual definition (0.092041ms)
1153
+ ✔ isLookupTable pkey column itself is typed (0.075501ms)
1154
+ ✔ isomorphic typed queries (0.493268ms)
1155
+ ▶ Client only queries
1156
+ ✔ modifyClientSchema adds custom table and column metadata (3.047549ms)
1157
+ ✔ SQL Stream more than 1k records (17.530196ms)
1158
+ ✔ SQL Stream persistedConnection with streamLimit works for subsequent queries (12.029002ms)
1159
+ ✔ SQL Stream ensure the connection is never released (same pg_backend_pid is the same for subsequent) when using persistConnectionId (11.592228ms)
1160
+ ✔ SQL Stream stop kills the query (1026.027197ms)
1161
+ ✔ SQL Stream limit works (28.419182ms)
1162
+ ✔ SQL Stream stop with terminate kills the query (expect flakiness) (133.640222ms)
1163
+ ✔ SQL Stream (13.015631ms)
1164
+ ✔ SQL Stream parallel execution + parameters (11.451934ms)
1165
+ ✔ SQL Stream query error structure matches default sql run error (10.924749ms)
1166
+ ✔ SQL Stream streamLimit (10.382972ms)
1167
+ ✔ SQL Stream table fields are the same as on default request (31.010606ms)
1168
+ ✔ SQL Stream works for multiple statements (10.486648ms)
1169
+ Client log (client) t+ 65765ms Checking public data
1170
+ ✔ Check tableSchema (19.584435ms)
1171
+ ✔ Security rules example (35.160976ms)
1172
+ Client log (client) t+ 65813ms Started testRealtime
1173
+ Client log (client) t+ 65836ms 1790858905216: sub stats: x10 -> 0 x20 ->0
1174
+ Client log (client) t+ 65842ms 1790858905222: sync stats: x10 -> 0 x20 -> 0
1175
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 0)
1176
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 1)
1177
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 2)
1178
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 3)
1179
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 4)
1180
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 5)
1181
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 6)
1182
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 7)
1183
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 8)
1184
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 9)
1185
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 10)
1186
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 11)
1187
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 12)
1188
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 13)
1189
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 14)
1190
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 15)
1191
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 16)
1192
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 17)
1193
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 18)
1194
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 19)
1195
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 20)
1196
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 21)
1197
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 22)
1198
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 23)
1199
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 24)
1200
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 25)
1201
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 26)
1202
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 27)
1203
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 28)
1204
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 29)
1205
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 30)
1206
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 31)
1207
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 32)
1208
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 33)
1209
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 34)
1210
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 35)
1211
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 36)
1212
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 37)
1213
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 38)
1214
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 39)
1215
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 40)
1216
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 41)
1217
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 42)
1218
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 43)
1219
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 44)
1220
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 45)
1221
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 46)
1222
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 47)
1223
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 48)
1224
+ Client log (client) t+ 65843ms 1790858905223: sync: p.$update({ x: 10 }); (id: 49)
1225
+ Pushing 0 rows to socket x3
1226
+ upsertData (from client): inserted( 0 ) updated( 50 ) total( 50 )
1227
+ last insert undefined
1228
+ last update {"id":49,"x":10,"y":49,"flight_number":"FN49","last_updated":1790858905223}
1229
+ Client log (client) t+ 65906ms 1790858905286: sub stats: x10 -> 50 x20 ->0
1230
+ Pushing 50 rows to socket
1231
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1232
+ last insert undefined
1233
+ last update undefined
1234
+ server.syncBatch planes: inserted( 0 ) updated( 50 ) deleted( 0 ) pushed to client( 50 ) total( 100 ) undefined
1235
+ Client log (client) t+ 65916ms 1790858905296: sync stats: x10 -> 50 x20 -> 0
1236
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 50)
1237
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 51)
1238
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 52)
1239
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 53)
1240
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 54)
1241
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 55)
1242
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 56)
1243
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 57)
1244
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 58)
1245
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 59)
1246
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 60)
1247
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 61)
1248
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 62)
1249
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 63)
1250
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 64)
1251
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 65)
1252
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 66)
1253
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 67)
1254
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 68)
1255
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 69)
1256
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 70)
1257
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 71)
1258
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 72)
1259
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 73)
1260
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 74)
1261
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 75)
1262
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 76)
1263
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 77)
1264
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 78)
1265
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 79)
1266
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 80)
1267
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 81)
1268
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 82)
1269
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 83)
1270
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 84)
1271
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 85)
1272
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 86)
1273
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 87)
1274
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 88)
1275
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 89)
1276
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 90)
1277
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 91)
1278
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 92)
1279
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 93)
1280
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 94)
1281
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 95)
1282
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 96)
1283
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 97)
1284
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 98)
1285
+ Client log (client) t+ 65916ms 1790858905296: sync: p.$update({ x: 10 }); (id: 99)
1286
+ Client log (client) t+ 65922ms 1790858905302: sync stats: x10 -> 100 x20 -> 0
1287
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 1 )
1288
+ last insert undefined
1289
+ last update undefined
1290
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1291
+ last insert undefined
1292
+ last update undefined
1293
+ upsertData (from client): inserted( 0 ) updated( 50 ) total( 50 )
1294
+ last insert undefined
1295
+ last update {"id":99,"x":10,"y":99,"flight_number":"FN99","last_updated":1790858905296}
1296
+ Client log (client) t+ 65987ms 1790858905367: sub stats: x10 -> 100 x20 ->0
1297
+ Pushing 100 rows to socket
1298
+ server.syncBatch planes: inserted( 0 ) updated( 50 ) deleted( 0 ) pushed to client( 0 ) total( 100 ) undefined
1299
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 50 )
1300
+ last insert undefined
1301
+ last update undefined
1302
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1303
+ last insert undefined
1304
+ last update undefined
1305
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 0 ) total( 50 ) undefined
1306
+ Client log (client) t+ 67988ms 1790858907368: sub: db.planes.update({}, { x: 20, last_updated });
1307
+ Client log (client) t+ 68011ms 1790858907385: sub: Updated to x20 100
1308
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 49 )
1309
+ last insert undefined
1310
+ last update undefined
1311
+ Client log (client) t+ 68027ms 1790858907407: sync stats: x10 -> 50 x20 -> 50
1312
+ Client log (client) t+ 68040ms 1790858907420: sync stats: x10 -> 0 x20 -> 100
1313
+ ✔ Realtime (2240.006442ms)
1314
+ Client log (client) t+ 68040ms 1790858907420: sync end: Finished replication test. Inserting 100 rows then updating two times took: 226ms
1315
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1316
+ last insert undefined
1317
+ last update undefined x2
1318
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 100 ) total( 100 ) undefined
1319
+ Client log (client) t+ 68043ms sync handlesOnData true 100
1320
+ ✔ sync handlesOnData true -> false no data bug (2002.820806ms)
1321
+ ﹣ Security rules example (0.252223ms) # SKIP
1322
+ ✔ Client only queries (5618.643571ms)
1323
+ ▶ React hooks
1324
+ ✔ useFind (527.804808ms)
1325
+ {
1326
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1327
+ }
1328
+ ✔ useSubscribe (529.207259ms)
1329
+ ✔ useFindOne (511.951669ms)
1330
+ Pushing 1 rows to socket
1331
+ {
1332
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1333
+ }
1334
+ ✔ useSubscribeOne (524.705706ms)
1335
+ ✔ useCount (507.444392ms)
1336
+ ✔ useSize (508.240342ms)
1337
+ ✔ useCount planes (255.816804ms)
1338
+ Pushing 2 rows to socket
1339
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1340
+ last insert undefined
1341
+ last update undefined
1342
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1343
+ last insert undefined
1344
+ last update undefined
1345
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1346
+ Client log (client) t+ 73733ms 1790858913113: sync stats: x10 -> 0 x20 -> 99
1347
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1348
+ last insert undefined
1349
+ last update undefined
1350
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 2 ) total( 100 ) undefined
1351
+ ✔ useSync (564.733749ms)
1352
+ Client log (client) t+ 74011ms 1790858913391: sync stats: x10 -> 0 x20 -> 100
1353
+ Client log (client) t+ 74011ms 1790858913391: sync end: Finished replication test. Inserting 100 rows then updating two times took: 6197ms
1354
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1355
+ last insert undefined
1356
+ last update undefined x2
1357
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1358
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1359
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1360
+ last insert undefined
1361
+ last update undefined x2
1362
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1363
+ Client log (client) t+ 74297ms 1790858913677: sync stats: x10 -> 0 x20 -> 99
1364
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1365
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1366
+ last insert undefined
1367
+ last update {"id":0,"x":232,"last_updated":1790858913677}
1368
+ Client log (client) t+ 74310ms 1790858913690: sync stats: x10 -> 0 x20 -> 99
1369
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1370
+ last insert undefined
1371
+ last update undefined
1372
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1373
+ ✔ useSync updates invalidate useMemo without mutating old data (340.881269ms)
1374
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1375
+ last insert undefined
1376
+ last update undefined x2
1377
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1378
+ Client log (client) t+ 74339ms 1790858913719: sync stats: x10 -> 0 x20 -> 99
1379
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1380
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1381
+ last insert undefined
1382
+ last update undefined x2
1383
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1384
+ Client log (client) t+ 74620ms 1790858914000: sync stats: x10 -> 0 x20 -> 99
1385
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1386
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1387
+ last insert undefined
1388
+ last update {"id":0,"x":32,"last_updated":1790858914003}
1389
+ Client log (client) t+ 74638ms 1790858914018: sync stats: x10 -> 0 x20 -> 99
1390
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1391
+ last insert undefined
1392
+ last update undefined
1393
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1394
+ ✔ concurrent useSync hooks with matching options all update (326.65474ms)
1395
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1396
+ last insert undefined
1397
+ last update undefined
1398
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 51 ) total( 52 ) undefined
1399
+ Client log (client) t+ 74938ms Reconnected
1400
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1401
+ last insert undefined
1402
+ last update undefined
1403
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 151 ) total( 201 ) undefined
1404
+ Client log (client) t+ 74979ms 1790858914359: sync stats: x10 -> 1 x20 -> 100
1405
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999000)
1406
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999001)
1407
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999002)
1408
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999003)
1409
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999004)
1410
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999005)
1411
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999006)
1412
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999007)
1413
+ Client log (client) t+ 74979ms 1790858914359: sync: p.$update({ x: 10 }); (id: 999008)
1414
+ Client log (client) t+ 74979ms 1790858914359: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7165ms
1415
+ Client log (client) t+ 74984ms 1790858914364: sync stats: x10 -> 10 x20 -> 100
1416
+ Client log (client) t+ 74984ms 1790858914364: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7170ms
1417
+ Client log (client) t+ 74984ms TEST_NAME: main Started
1418
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1419
+ last insert undefined
1420
+ last update {"id":999000,"x":10,"last_updated":1790858914359}
1421
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1422
+ last insert undefined
1423
+ last update undefined
1424
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1425
+ Client log (client) t+ 75005ms 1790858914385: sync stats: x10 -> 10 x20 -> 100
1426
+ Client log (client) t+ 75005ms 1790858914385: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7191ms
1427
+ upsertData (from client): inserted( 0 ) updated( 8 ) total( 9 )
1428
+ last insert undefined
1429
+ last update {"id":999008,"x":10,"y":999999,"flight_number":null,"last_updated":1790858914359}
1430
+ server.syncBatch planes: inserted( 0 ) updated( 8 ) deleted( 0 ) pushed to client( 1 ) total( 10 ) undefined
1431
+ (server): Client disconnected. socket.id: UC-pe1mjfNEtJlsnAAAA
1432
+ onSocketConnect RDsqtTP8Dq8T82EVAAAB
1433
+ (server): Client connected -> console does not work. use log function. socket.id: RDsqtTP8Dq8T82EVAAAB
1434
+ Client log (client) t+ 75013ms Disconnected
1435
+ Client log (client) t+ 76005ms Client connect.
1436
+ schemaChanged must syncHandler.destroySyncs()
1437
+ Client log (client) t+ 76130ms Reconnected
1438
+ Client log (client) t+ 76171ms TEST_NAME: main Started
1439
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1440
+ last insert undefined
1441
+ last update undefined
1442
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 152 ) total( 202 ) undefined
1443
+ Client log (client) t+ 76181ms 1790858915561: sync stats: x10 -> 10 x20 -> 100
1444
+ Client log (client) t+ 76181ms 1790858915561: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8367ms
1445
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1446
+ last insert undefined
1447
+ last update undefined
1448
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1449
+ Client log (client) t+ 76199ms 1790858915579: sync stats: x10 -> 10 x20 -> 100
1450
+ Client log (client) t+ 76199ms 1790858915579: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8385ms
1451
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1452
+ last insert undefined
1453
+ last update undefined
1454
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 2 ) undefined
1455
+ ✔ concurrent useSync hooks receive inserts after reattachment and reconnect (1565.645225ms)
1456
+ ✔ React hooks (6164.107041ms)
1457
+ Client log (client) t+ 76210ms TEST_NAME: main Finished OK
1458
+ Client test successful
1459
+ (server): Stopping server ...
1460
+ ℹ tests 122
1461
+ ℹ suites 4
1462
+ ℹ pass 121
1463
+ ℹ fail 0
1464
+ ℹ cancelled 0
1465
+ ℹ skipped 1
1466
+ ℹ todo 0
1467
+ ℹ duration_ms 84315.257173
1468
+
1469
+ > server_tests@1.0.0 test-client
1470
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1471
+
1472
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1473
+ Created PubSubManager
1474
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1475
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1476
+
1477
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1478
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1479
+ id TEXT PRIMARY KEY
1480
+ , "description" TEXT
1481
+ );
1482
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1483
+
1484
+ CREATE TABLE "files" (
1485
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1486
+ "storage_key" UUID UNIQUE ,
1487
+ "extension" TEXT NOT NULL DEFAULT '' ,
1488
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1489
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1490
+ "etag" TEXT NOT NULL DEFAULT '' ,
1491
+ "original_name" TEXT NOT NULL ,
1492
+ "original_last_modified" TIMESTAMPTZ ,
1493
+ "description" TEXT ,
1494
+ "url" TEXT NOT NULL DEFAULT '' ,
1495
+ "cloud_url" TEXT ,
1496
+ "signed_url" TEXT ,
1497
+ "signed_url_expires" BIGINT ,
1498
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1499
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1500
+ "deleted" TIMESTAMPTZ ,
1501
+ "deleted_from_storage" TIMESTAMPTZ ,
1502
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1503
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1504
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1505
+ );
1506
+ CREATE TABLE "files_versions" (
1507
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1508
+ "storage_key" UUID NOT NULL ,
1509
+ "extension" TEXT NOT NULL DEFAULT '' ,
1510
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1511
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1512
+ "etag" TEXT NOT NULL DEFAULT '' ,
1513
+ "original_name" TEXT NOT NULL ,
1514
+ "original_last_modified" TIMESTAMPTZ ,
1515
+ "description" TEXT ,
1516
+ "url" TEXT NOT NULL DEFAULT '' ,
1517
+ "cloud_url" TEXT ,
1518
+ "signed_url" TEXT ,
1519
+ "signed_url_expires" BIGINT ,
1520
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1521
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1522
+ "deleted" TIMESTAMPTZ ,
1523
+ "deleted_from_storage" TIMESTAMPTZ ,
1524
+ "file_id" UUID NOT NULL ,
1525
+ "version" INTEGER NOT NULL ,
1526
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1527
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1528
+ );
1529
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1530
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1531
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1532
+ CREATE TABLE "users_public_info" (
1533
+ "id" SERIAL PRIMARY KEY ,
1534
+ "name" TEXT ,
1535
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1536
+ "sid" TEXT
1537
+ );
1538
+ DROP TABLE IF EXISTS "users";
1539
+ CREATE TABLE "users" (
1540
+ "id" SERIAL PRIMARY KEY ,
1541
+ "email" TEXT NOT NULL ,
1542
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1543
+ "type" TEXT NOT NULL ,
1544
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
1545
+ );
1546
+ DROP TABLE IF EXISTS "tjson";
1547
+ CREATE TABLE "tjson" (
1548
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
1549
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1550
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
1551
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
1552
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
1553
+ );
1554
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1555
+
1556
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1557
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1558
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1559
+ DROP TABLE IF EXISTS "api_table";
1560
+ CREATE TABLE "api_table" (
1561
+ "id" SERIAL PRIMARY KEY
1562
+ );
1563
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1564
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1565
+ Prostgles: Created typescript schema definition file:
1566
+ DBGeneratedSchema.ts
1567
+ (server): prostgles onReady
1568
+ (server): Waiting for client...
1569
+ (client) t+ 0ms Started client...
1570
+ onSocketConnect b4O3mNCPgc2wR9jmAAAA
1571
+ (server): Client connected -> console does not work. use log function. socket.id: b4O3mNCPgc2wR9jmAAAA
1572
+ (client) t+ 39ms Client connect.
1573
+ (client) t+ 173ms TEST_NAME: useProstgles Started
1574
+ onSocketConnect OK00xfyclPML6E-KAAAB
1575
+ (server): Client connected -> console does not work. use log function. socket.id: OK00xfyclPML6E-KAAAB
1576
+ ▶ useProstgles hook
1577
+ ✔ useProstglesClient (513.344293ms)
1578
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1579
+ (server): Client disconnected. socket.id: OK00xfyclPML6E-KAAAB
1580
+ schemaChanged must syncHandler.destroySyncs()
1581
+ ✔ useProstglesClient with schema reload (2380.897939ms)
1582
+ onSocketConnect 8wfpoGhK4ggqnkQqAAAD
1583
+ (server): Client connected -> console does not work. use log function. socket.id: 8wfpoGhK4ggqnkQqAAAD
1584
+ (server): Client disconnected. socket.id: 8wfpoGhK4ggqnkQqAAAD
1585
+ ✔ useProstglesClient with initial skip (763.570293ms)
1586
+ Client log (client) t+ 6857ms TEST_NAME: useProstgles Finished OK
1587
+ ✔ useProstgles hook (3659.452645ms)
1588
+ Client test successful
1589
+ (server): Stopping server ...
1590
+ ℹ tests 3
1591
+ ℹ suites 1
1592
+ ℹ pass 3
1593
+ ℹ fail 0
1594
+ ℹ cancelled 0
1595
+ ℹ skipped 0
1596
+ ℹ todo 0
1597
+ ℹ duration_ms 15309.165059
1598
+
1599
+ > server_tests@1.0.0 test-client
1600
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1601
+
1602
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1603
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1604
+
1605
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1606
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1607
+ id TEXT PRIMARY KEY
1608
+ , "description" TEXT
1609
+ );
1610
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
1611
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
1612
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1613
+
1614
+ CREATE TABLE "files" (
1615
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1616
+ "storage_key" UUID UNIQUE ,
1617
+ "extension" TEXT NOT NULL DEFAULT '' ,
1618
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1619
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1620
+ "etag" TEXT NOT NULL DEFAULT '' ,
1621
+ "original_name" TEXT NOT NULL ,
1622
+ "original_last_modified" TIMESTAMPTZ ,
1623
+ "description" TEXT ,
1624
+ "url" TEXT NOT NULL DEFAULT '' ,
1625
+ "cloud_url" TEXT ,
1626
+ "signed_url" TEXT ,
1627
+ "signed_url_expires" BIGINT ,
1628
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1629
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1630
+ "deleted" TIMESTAMPTZ ,
1631
+ "deleted_from_storage" TIMESTAMPTZ ,
1632
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1633
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1634
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1635
+ );
1636
+ CREATE TABLE "files_versions" (
1637
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1638
+ "storage_key" UUID NOT NULL ,
1639
+ "extension" TEXT NOT NULL DEFAULT '' ,
1640
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1641
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1642
+ "etag" TEXT NOT NULL DEFAULT '' ,
1643
+ "original_name" TEXT NOT NULL ,
1644
+ "original_last_modified" TIMESTAMPTZ ,
1645
+ "description" TEXT ,
1646
+ "url" TEXT NOT NULL DEFAULT '' ,
1647
+ "cloud_url" TEXT ,
1648
+ "signed_url" TEXT ,
1649
+ "signed_url_expires" BIGINT ,
1650
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1651
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1652
+ "deleted" TIMESTAMPTZ ,
1653
+ "deleted_from_storage" TIMESTAMPTZ ,
1654
+ "file_id" UUID NOT NULL ,
1655
+ "version" INTEGER NOT NULL ,
1656
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1657
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1658
+ );
1659
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1660
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1661
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1662
+ CREATE TABLE "users_public_info" (
1663
+ "id" SERIAL PRIMARY KEY ,
1664
+ "name" TEXT ,
1665
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1666
+ "sid" TEXT
1667
+ );
1668
+ DROP TABLE IF EXISTS "users";
1669
+ CREATE TABLE "users" (
1670
+ "id" SERIAL PRIMARY KEY ,
1671
+ "email" TEXT NOT NULL ,
1672
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1673
+ "type" TEXT NOT NULL ,
1674
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
1675
+ );
1676
+ DROP TABLE IF EXISTS "tjson";
1677
+ CREATE TABLE "tjson" (
1678
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
1679
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1680
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
1681
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
1682
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
1683
+ );
1684
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1685
+
1686
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1687
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1688
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1689
+ DROP TABLE IF EXISTS "api_table";
1690
+ CREATE TABLE "api_table" (
1691
+ "id" SERIAL PRIMARY KEY
1692
+ );
1693
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1694
+ Prostgles: Created typescript schema definition file:
1695
+ DBGeneratedSchema.ts
1696
+ (server): prostgles onReady
1697
+ (server): Waiting for client...
1698
+ (client) t+ 0ms Started client...
1699
+ onSocketConnect RFJq_CPlGQlCd01VAAAA
1700
+ (server): Client connected -> console does not work. use log function. socket.id: RFJq_CPlGQlCd01VAAAA
1701
+ (client) t+ 43ms Client connect.
1702
+ (client) t+ 73ms TEST_NAME: files Started
1703
+ ▶ clientFileTests
1704
+ ✔ Files table is present (5.512629ms)
1705
+ ✔ Insert file from nested insert (34.07125ms)
1706
+ ✔ Cannot Insert file directly (8.980503ms)
1707
+ ✔ Disallowed updates cannot change stored bytes or create nested uploads (30.700434ms)
1708
+ ✔ Duplicate file IDs and failed validation preserve the original object (24.836025ms)
1709
+ ✔ Can update allowed files directly (48.031583ms)
1710
+ ✔ Can insert allowed files through a nested update (35.027378ms)
1711
+ Client log (client) t+ 310ms TEST_NAME: files Finished OK
1712
+ ✔ Can delete only allowed files directly (20.802624ms)
1713
+ ✔ clientFileTests (209.89573ms)
1714
+ Client test successful
1715
+ (server): Stopping server ...
1716
+ ℹ tests 8
1717
+ ℹ suites 1
1718
+ ℹ pass 8
1719
+ ℹ fail 0
1720
+ ℹ cancelled 0
1721
+ ℹ skipped 0
1722
+ ℹ todo 0
1723
+ ℹ duration_ms 8345.232399
1724
+
1725
+ > server_tests@1.0.0 test-client
1726
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1727
+
1728
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1729
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1730
+
1731
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1732
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1733
+ id TEXT PRIMARY KEY
1734
+ , "description" TEXT
1735
+ );
1736
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1737
+
1738
+ CREATE TABLE "files" (
1739
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1740
+ "storage_key" UUID UNIQUE ,
1741
+ "extension" TEXT NOT NULL DEFAULT '' ,
1742
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1743
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1744
+ "etag" TEXT NOT NULL DEFAULT '' ,
1745
+ "original_name" TEXT NOT NULL ,
1746
+ "original_last_modified" TIMESTAMPTZ ,
1747
+ "description" TEXT ,
1748
+ "url" TEXT NOT NULL DEFAULT '' ,
1749
+ "cloud_url" TEXT ,
1750
+ "signed_url" TEXT ,
1751
+ "signed_url_expires" BIGINT ,
1752
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1753
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1754
+ "deleted" TIMESTAMPTZ ,
1755
+ "deleted_from_storage" TIMESTAMPTZ ,
1756
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1757
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1758
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1759
+ );
1760
+ CREATE TABLE "files_versions" (
1761
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1762
+ "storage_key" UUID NOT NULL ,
1763
+ "extension" TEXT NOT NULL DEFAULT '' ,
1764
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1765
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1766
+ "etag" TEXT NOT NULL DEFAULT '' ,
1767
+ "original_name" TEXT NOT NULL ,
1768
+ "original_last_modified" TIMESTAMPTZ ,
1769
+ "description" TEXT ,
1770
+ "url" TEXT NOT NULL DEFAULT '' ,
1771
+ "cloud_url" TEXT ,
1772
+ "signed_url" TEXT ,
1773
+ "signed_url_expires" BIGINT ,
1774
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1775
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1776
+ "deleted" TIMESTAMPTZ ,
1777
+ "deleted_from_storage" TIMESTAMPTZ ,
1778
+ "file_id" UUID NOT NULL ,
1779
+ "version" INTEGER NOT NULL ,
1780
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1781
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1782
+ );
1783
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1784
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1785
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1786
+ CREATE TABLE "users_public_info" (
1787
+ "id" SERIAL PRIMARY KEY ,
1788
+ "name" TEXT ,
1789
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1790
+ "sid" TEXT
1791
+ );
1792
+ DROP TABLE IF EXISTS "users";
1793
+ CREATE TABLE "users" (
1794
+ "id" SERIAL PRIMARY KEY ,
1795
+ "email" TEXT NOT NULL ,
1796
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1797
+ "type" TEXT NOT NULL ,
1798
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
1799
+ );
1800
+ DROP TABLE IF EXISTS "tjson";
1801
+ CREATE TABLE "tjson" (
1802
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
1803
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1804
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
1805
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
1806
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
1807
+ );
1808
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1809
+
1810
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1811
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1812
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1813
+ DROP TABLE IF EXISTS "api_table";
1814
+ CREATE TABLE "api_table" (
1815
+ "id" SERIAL PRIMARY KEY
1816
+ );
1817
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1818
+ (server): prostgles onReady
1819
+ (server): Waiting for client...
1820
+ (client) t+ 0ms Started client...
1821
+ onSocketConnect QnIOllPbvYdcIsDxAAAA
1822
+ (server): Client connected -> console does not work. use log function. socket.id: QnIOllPbvYdcIsDxAAAA
1823
+ (client) t+ 26ms Client connect.
1824
+ (client) t+ 36ms TEST_NAME: rest_api Started
1825
+ ▶ clientRestApi
1826
+ ✔ Rest api test (85.714321ms)
1827
+ ✔ Rest api security (18.3336ms)
1828
+ Client log (client) t+ 144ms TEST_NAME: rest_api Finished OK
1829
+ ✔ clientRestApi (104.791166ms)
1830
+ Client test successful
1831
+ (server): Stopping server ...
1832
+ ℹ tests 2
1833
+ ℹ suites 1
1834
+ ℹ pass 2
1835
+ ℹ fail 0
1836
+ ℹ cancelled 0
1837
+ ℹ skipped 0
1838
+ ℹ todo 0
1839
+ ℹ duration_ms 8271.153227