prostgles-server 4.2.648 → 4.2.649

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/debug/als-build.log +4 -0
  2. package/debug/als-e2e.log +1747 -0
  3. package/debug/als-lint.log +4 -0
  4. package/debug/als-npm-test.log +712 -0
  5. package/debug/als-row-parts-e2e.log +1759 -0
  6. package/debug/als-row-parts-npm-test.log +716 -0
  7. package/debug/als-typecheck.log +8 -0
  8. package/debug/als-unified-build.log +4 -0
  9. package/debug/als-unified-lint.log +4 -0
  10. package/debug/als-unified-test-build.log +11 -0
  11. package/debug/als-unified-test-server.log +3444 -0
  12. package/dist/Audit/AuditTable.d.ts +1 -1
  13. package/dist/DboBuilder/DboBuilder.d.ts.map +1 -1
  14. package/dist/DboBuilder/DboBuilder.js +4 -2
  15. package/dist/DboBuilder/DboBuilder.js.map +1 -1
  16. package/dist/DboBuilder/DboBuilder.spec.js +3 -1
  17. package/dist/DboBuilder/DboBuilder.spec.js.map +1 -1
  18. package/dist/DboBuilder/TableHandler/TableHandler.d.ts.map +1 -1
  19. package/dist/DboBuilder/TableHandler/TableHandler.js +3 -2
  20. package/dist/DboBuilder/TableHandler/TableHandler.js.map +1 -1
  21. package/dist/DboBuilder/TableHandler/delete.d.ts.map +1 -1
  22. package/dist/DboBuilder/TableHandler/delete.js +4 -3
  23. package/dist/DboBuilder/TableHandler/delete.js.map +1 -1
  24. package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.d.ts.map +1 -1
  25. package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.js +7 -6
  26. package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.js.map +1 -1
  27. package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts +1 -1
  28. package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts.map +1 -1
  29. package/dist/DboBuilder/schema/getTablesForSchemaPostgresSQL.d.ts +2 -2
  30. package/dist/ExecutionContext.d.ts +32 -0
  31. package/dist/ExecutionContext.d.ts.map +1 -0
  32. package/dist/ExecutionContext.js +25 -0
  33. package/dist/ExecutionContext.js.map +1 -0
  34. package/dist/JSONBSchemaValidation/validateJSONBSchemaSQL.d.ts +1 -1
  35. package/dist/Prostgles.d.ts +5 -0
  36. package/dist/Prostgles.d.ts.map +1 -1
  37. package/dist/Prostgles.js +5 -0
  38. package/dist/Prostgles.js.map +1 -1
  39. package/dist/PubSubManager/PubSubManager.d.ts +1 -1
  40. package/dist/PublishParser/PublishParser.d.ts.map +1 -1
  41. package/dist/PublishParser/PublishParser.js +14 -1
  42. package/dist/PublishParser/PublishParser.js.map +1 -1
  43. package/dist/PublishParser/getFunctionRelatedRecords.d.ts +5 -0
  44. package/dist/PublishParser/getFunctionRelatedRecords.d.ts.map +1 -0
  45. package/dist/PublishParser/getFunctionRelatedRecords.js +26 -0
  46. package/dist/PublishParser/getFunctionRelatedRecords.js.map +1 -0
  47. package/dist/index.d.ts +2 -1
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js.map +1 -1
  50. package/dist/initProstgles.d.ts +3 -0
  51. package/dist/initProstgles.d.ts.map +1 -1
  52. package/dist/initProstgles.js +1 -0
  53. package/dist/initProstgles.js.map +1 -1
  54. package/dist/runClientRequest.d.ts.map +1 -1
  55. package/dist/runClientRequest.js +6 -1
  56. package/dist/runClientRequest.js.map +1 -1
  57. package/lib/DboBuilder/DboBuilder.spec.ts +3 -7
  58. package/lib/DboBuilder/DboBuilder.ts +4 -2
  59. package/lib/DboBuilder/TableHandler/TableHandler.ts +14 -11
  60. package/lib/DboBuilder/TableHandler/delete.ts +14 -11
  61. package/lib/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.ts +28 -21
  62. package/lib/ExecutionContext.ts +60 -0
  63. package/lib/Prostgles.ts +8 -4
  64. package/lib/PublishParser/PublishParser.ts +17 -1
  65. package/lib/PublishParser/getFunctionRelatedRecords.ts +25 -0
  66. package/lib/index.ts +2 -4
  67. package/lib/initProstgles.ts +5 -4
  68. package/lib/runClientRequest.ts +16 -8
  69. package/package.json +1 -1
@@ -0,0 +1,1759 @@
1
+
2
+ > prostgles-server@4.2.648 test-only
3
+ > cd tests/ && ./test.sh
4
+
5
+
6
+ > prostgles-server@4.2.648 build
7
+ > tsc
8
+
9
+
10
+ > client@1.0.0 build
11
+ > rm -rf ./node_modules/* && rm -rf ./dist/* && npm i && tsc
12
+
13
+ npm warn deprecated whatwg-encoding@3.1.1: Use @exodus/bytes instead for a more spec-conformant and faster implementation
14
+
15
+ added 58 packages, and audited 59 packages in 570ms
16
+
17
+ 7 packages are looking for funding
18
+ run `npm fund` for details
19
+
20
+ found 0 vulnerabilities
21
+
22
+ > client@1.0.0 testBasicHooks
23
+ > node --test dist/client/basicHooks.spec.js
24
+
25
+ ▶ React hooks
26
+ ✔ useAsyncEffectQueue executes the first and debounces the rest (1619.597601ms)
27
+ ✔ useAsyncEffectQueue executes the first and debounces the rest if still mounted (1513.214163ms)
28
+ ✔ React hooks (3134.217751ms)
29
+ ℹ tests 2
30
+ ℹ suites 1
31
+ ℹ pass 2
32
+ ℹ fail 0
33
+ ℹ cancelled 0
34
+ ℹ skipped 0
35
+ ℹ todo 0
36
+ ℹ duration_ms 3428.465546
37
+
38
+ up to date, audited 115 packages in 4s
39
+
40
+ 28 packages are looking for funding
41
+ run `npm fund` for details
42
+
43
+ found 0 vulnerabilities
44
+
45
+ > server_tests@1.0.0 build
46
+ > rm -rf ./node_modules/* && rm -rf ./media/* && rm -rf ./dist/* && npm i && tsc
47
+
48
+
49
+ added 113 packages, and audited 115 packages in 5s
50
+
51
+ 28 packages are looking for funding
52
+ run `npm fund` for details
53
+
54
+ found 0 vulnerabilities
55
+
56
+ > prostgles-server@4.2.648 lint
57
+ > eslint . --ext .ts --quiet
58
+
59
+
60
+ > server_tests@1.0.0 test-server
61
+ > TEST_TYPE=server node --trace-uncaught --test dist/server/index.js
62
+
63
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
64
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
65
+
66
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
67
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
68
+ id TEXT PRIMARY KEY
69
+ , "description" TEXT
70
+ );
71
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
72
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
73
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
74
+
75
+ CREATE TABLE "files" (
76
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
77
+ "storage_key" UUID UNIQUE ,
78
+ "extension" TEXT NOT NULL DEFAULT '' ,
79
+ "content_type" TEXT NOT NULL DEFAULT '' ,
80
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
81
+ "etag" TEXT NOT NULL DEFAULT '' ,
82
+ "original_name" TEXT NOT NULL ,
83
+ "original_last_modified" TIMESTAMPTZ ,
84
+ "description" TEXT ,
85
+ "url" TEXT NOT NULL DEFAULT '' ,
86
+ "cloud_url" TEXT ,
87
+ "signed_url" TEXT ,
88
+ "signed_url_expires" BIGINT ,
89
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
90
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
91
+ "deleted" TIMESTAMPTZ ,
92
+ "deleted_from_storage" TIMESTAMPTZ ,
93
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
94
+ "version" INTEGER NOT NULL DEFAULT 1 ,
95
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
96
+ );
97
+ CREATE TABLE "files_versions" (
98
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
99
+ "storage_key" UUID NOT NULL ,
100
+ "extension" TEXT NOT NULL DEFAULT '' ,
101
+ "content_type" TEXT NOT NULL DEFAULT '' ,
102
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
103
+ "etag" TEXT NOT NULL DEFAULT '' ,
104
+ "original_name" TEXT NOT NULL ,
105
+ "original_last_modified" TIMESTAMPTZ ,
106
+ "description" TEXT ,
107
+ "url" TEXT NOT NULL DEFAULT '' ,
108
+ "cloud_url" TEXT ,
109
+ "signed_url" TEXT ,
110
+ "signed_url_expires" BIGINT ,
111
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
112
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
113
+ "deleted" TIMESTAMPTZ ,
114
+ "deleted_from_storage" TIMESTAMPTZ ,
115
+ "file_id" UUID NOT NULL ,
116
+ "version" INTEGER NOT NULL ,
117
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
118
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
119
+ );
120
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
121
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
122
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
123
+ CREATE TABLE "users_public_info" (
124
+ "id" SERIAL PRIMARY KEY ,
125
+ "name" TEXT ,
126
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
127
+ "sid" TEXT
128
+ );
129
+ DROP TABLE IF EXISTS "users";
130
+ CREATE TABLE "users" (
131
+ "id" SERIAL PRIMARY KEY ,
132
+ "email" TEXT NOT NULL ,
133
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
134
+ "type" TEXT NOT NULL ,
135
+ "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"}' ))
136
+ );
137
+ DROP TABLE IF EXISTS "tjson";
138
+ CREATE TABLE "tjson" (
139
+ "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"}' )),
140
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
141
+ "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"}' )),
142
+ "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"}' )),
143
+ "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"}' ))
144
+ );
145
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
146
+
147
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
148
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
149
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
150
+ DROP TABLE IF EXISTS "api_table";
151
+ CREATE TABLE "api_table" (
152
+ "id" SERIAL PRIMARY KEY
153
+ );
154
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
155
+ (server): prostgles onReady
156
+ IO missing. Publish has no effect without io or restApi
157
+ IO missing. Publish has no effect without io or restApi
158
+ destroying prgl instance
159
+ destroying prgl instance
160
+ ▶ Server Only Queries
161
+ ✔ execution context follows functions, hooks and deferred transaction callbacks (2477.347435ms)
162
+ ✔ column definition row types support SQL aliases, arrays and generated columns (8.785647ms)
163
+ ✔ lookup types propagate through database references while preserving overrides (14.346832ms)
164
+ ✔ lookup types follow FK chains by column and terminate cycles (151.639508ms)
165
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
166
+
167
+ CREATE TABLE "files" (
168
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
169
+ "storage_key" UUID UNIQUE ,
170
+ "extension" TEXT NOT NULL DEFAULT '' ,
171
+ "content_type" TEXT NOT NULL DEFAULT '' ,
172
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
173
+ "etag" TEXT NOT NULL DEFAULT '' ,
174
+ "original_name" TEXT NOT NULL ,
175
+ "original_last_modified" TIMESTAMPTZ ,
176
+ "description" TEXT ,
177
+ "url" TEXT NOT NULL DEFAULT '' ,
178
+ "cloud_url" TEXT ,
179
+ "signed_url" TEXT ,
180
+ "signed_url_expires" BIGINT ,
181
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
182
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
183
+ "deleted" TIMESTAMPTZ ,
184
+ "deleted_from_storage" TIMESTAMPTZ ,
185
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
186
+ );
187
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
188
+ Prostgles: Created typescript schema definition file:
189
+ DBGeneratedSchema.ts
190
+ Prostgles: Created typescript schema definition file:
191
+ DBGeneratedSchema.ts
192
+ ▶ client publish profiles compile at startup and follow user types
193
+ ✔ server user handlers enforce permissions and reject client impersonation (48.803772ms)
194
+ ✔ a rejected guest abort cannot cancel a later server-user query (3.890359ms)
195
+ ✔ caught subscription errors still roll back client transactions (4.957291ms)
196
+ ✔ caught checkFilter errors still roll back client transactions (7.106168ms)
197
+ ✔ caught postValidate errors still roll back client transactions (2.453049ms)
198
+ No options changed
199
+ Prostgles: Created typescript schema definition file:
200
+ DBGeneratedSchema.ts
201
+ Prostgles: Created typescript schema definition file:
202
+ DBGeneratedSchema.ts
203
+ Prostgles: Created typescript schema definition file:
204
+ DBGeneratedSchema.ts
205
+ Prostgles: Created typescript schema definition file:
206
+ DBGeneratedSchema.ts
207
+ destroying prgl instance
208
+ ✔ server user handlers require configured authentication (1.090545ms)
209
+ ✔ client publish profiles compile at startup and follow user types (1996.650445ms)
210
+ ▶ Managed storage permission and transaction safety
211
+ ✔ legacy ID-based files remain readable and replaceable (26.217106ms)
212
+ ✔ custom columns do not require or interfere with file data (18.280767ms)
213
+ ✔ filtered updates and failed validation preserve storage (15.626881ms)
214
+ ✔ failed uploads and application hooks leave no replacement objects (27.084322ms)
215
+ ✔ duplicate IDs, conflict updates and SQL-only requests cannot overwrite (35.967902ms)
216
+ ✔ PostgreSQL update policies are enforced before uploading (6.273465ms)
217
+ ✔ RLS-hidden references fail closed during storage cleanup (2.388563ms)
218
+ ✔ beforeEach lifecycle callbacks follow the outer transaction (41.924731ms)
219
+ ✔ outer rollback preserves replaced and deleted objects (31.602407ms)
220
+ ✔ a failed multi-insert waits for other uploads before cleanup (4.534171ms)
221
+ ✔ concurrent replacements leave one complete referenced object (21.3706ms)
222
+ ✔ version retention removes only unreferenced objects (73.249627ms)
223
+ ✔ foreign-key failure preserves bytes and deletion waits for commit (16.204798ms)
224
+ ✔ cloud downloads and cleanup use the committed storage key (48.961942ms)
225
+ ✔ Managed storage permission and transaction safety (407.538172ms)
226
+ destroying prgl instance
227
+ destroying prgl instance
228
+ ✔ custom joins add conditions unless override is requested (2344.76255ms)
229
+ destroying prgl instance
230
+ ✔ custom self joins use configured paths and override inferred joins (1184.277826ms)
231
+ destroying prgl instance
232
+ destroying prgl instance
233
+ destroying prgl instance
234
+ ✔ destroy allows reusing Socket.IO on a running HTTP server (3465.013176ms)
235
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
236
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
237
+
238
+ CREATE TABLE "audit_events" (
239
+ "id" BIGSERIAL PRIMARY KEY ,
240
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
241
+ "schema_name" TEXT NOT NULL ,
242
+ "table_name" TEXT NOT NULL ,
243
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
244
+ "old_id" JSONB ,
245
+ "new_id" JSONB ,
246
+ "old_row" JSONB ,
247
+ "new_row" JSONB ,
248
+ "actor" JSONB ,
249
+ "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"}' ))
250
+ );
251
+ CREATE TABLE "audit_test_files" (
252
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
253
+ "storage_key" UUID UNIQUE ,
254
+ "extension" TEXT NOT NULL DEFAULT '' ,
255
+ "content_type" TEXT NOT NULL DEFAULT '' ,
256
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
257
+ "etag" TEXT NOT NULL DEFAULT '' ,
258
+ "original_name" TEXT NOT NULL ,
259
+ "original_last_modified" TIMESTAMPTZ ,
260
+ "description" TEXT ,
261
+ "url" TEXT NOT NULL DEFAULT '' ,
262
+ "cloud_url" TEXT ,
263
+ "signed_url" TEXT ,
264
+ "signed_url_expires" BIGINT ,
265
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
266
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
267
+ "deleted" TIMESTAMPTZ ,
268
+ "deleted_from_storage" TIMESTAMPTZ ,
269
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
270
+ );
271
+ CREATE TABLE "audit_test_source" (
272
+ "a" int NOT NULL ,
273
+ "b" text NOT NULL ,
274
+ "value" text ,
275
+ "secret" text
276
+ );
277
+ ALTER TABLE "audit_test_source" ADD PRIMARY KEY (a, b);
278
+ CREATE TABLE "audit_test_documents" (
279
+ "id" serial PRIMARY KEY ,
280
+ "file_id" uuid NOT NULL REFERENCES audit_test_files(id)
281
+ );
282
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
283
+ IO missing. Publish has no effect without io or restApi
284
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
285
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
286
+ IO missing. Publish has no effect without io or restApi
287
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
288
+ IO missing. Publish has no effect without io or restApi
289
+ destroying prgl instance
290
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
291
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
292
+ IO missing. Publish has no effect without io or restApi
293
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
294
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
295
+ IO missing. Publish has no effect without io or restApi
296
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
297
+ Trace: Error: audit.tables cannot mix enabled and disabled entries
298
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:19:15)
299
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
300
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
301
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
302
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
303
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
304
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
305
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
306
+ at async waitForActual (node:assert:646:5)
307
+ at async strict.rejects (node:assert:769:25)
308
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
309
+ at async Test.run (node:internal/test_runner/test:1125:7)
310
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
311
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
312
+ Trace: Error: Unknown audit table: missing_table
313
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:23:19)
314
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
315
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
316
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
317
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
318
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
319
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
320
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
321
+ at async waitForActual (node:assert:646:5)
322
+ at async strict.rejects (node:assert:769:25)
323
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
324
+ at async Test.run (node:internal/test_runner/test:1125:7)
325
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
326
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
327
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
328
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
329
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
330
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
331
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
332
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
333
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
334
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
335
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
336
+ at async waitForActual (node:assert:646:5)
337
+ at async strict.rejects (node:assert:769:25)
338
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
339
+ at async Test.run (node:internal/test_runner/test:1125:7)
340
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
341
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
342
+ Trace: Error: Unsupported audit target: audit_test_view
343
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:37:23)
344
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
345
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
346
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
347
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
348
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
349
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
350
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
351
+ at async waitForActual (node:assert:646:5)
352
+ at async strict.rejects (node:assert:769:25)
353
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
354
+ at async Test.run (node:internal/test_runner/test:1125:7)
355
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
356
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
357
+ Trace: Error: Audit identity columns cannot be excluded: audit_test_source
358
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:54:19)
359
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
360
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
361
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
362
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
363
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
364
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
365
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
366
+ at async waitForActual (node:assert:646:5)
367
+ at async strict.rejects (node:assert:769:25)
368
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
369
+ at async Test.run (node:internal/test_runner/test:1125:7)
370
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
371
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
372
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
373
+ IO missing. Publish has no effect without io or restApi
374
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
375
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
376
+ IO missing. Publish has no effect without io or restApi
377
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
378
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
379
+ IO missing. Publish has no effect without io or restApi
380
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
381
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
382
+ IO missing. Publish has no effect without io or restApi
383
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-OXVP3B/init.sql
384
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
385
+ IO missing. Publish has no effect without io or restApi
386
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
387
+ IO missing. Publish has no effect without io or restApi
388
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
389
+ IO missing. Publish has no effect without io or restApi
390
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
391
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
392
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
393
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
394
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
395
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
396
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
397
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
398
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
399
+ at async updateConfiguration (/home/s/prostgles-server-js/dist/updateConfiguration.js:58:9)
400
+ at async Object.update (/home/s/prostgles-server-js/dist/initProstgles.js:162:17)
401
+ at async waitForActual (node:assert:646:5)
402
+ at async strict.rejects (node:assert:769:25)
403
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:535:13)
404
+ at async Test.run (node:internal/test_runner/test:1125:7)
405
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
406
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
407
+ IO missing. Publish has no effect without io or restApi
408
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
409
+
410
+ CREATE TABLE "audit_next_events" (
411
+ "id" BIGSERIAL PRIMARY KEY ,
412
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
413
+ "schema_name" TEXT NOT NULL ,
414
+ "table_name" TEXT NOT NULL ,
415
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
416
+ "old_id" JSONB ,
417
+ "new_id" JSONB ,
418
+ "old_row" JSONB ,
419
+ "new_row" JSONB ,
420
+ "actor" JSONB ,
421
+ "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"}' ))
422
+ );
423
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
424
+ IO missing. Publish has no effect without io or restApi
425
+ destroying prgl instance
426
+ ✔ Managed audit setup, row history, protection, access and query readiness (8716.486625ms)
427
+ ✔ getJSONBSchemaValidationErrorAsync with real db handlers (2.565983ms)
428
+ ✔ Parallel subscription at init causing crash in getPubSubManager: duplicate key value violates unique constraint "apps_pkey" (101.584097ms)
429
+ ✔ RLS context is isolated across implicit transactions, commit, rollback and pool reuse (14.27981ms)
430
+ ✔ subscription and sync reads isolate users with a real RLS policy (12.546684ms)
431
+ ✔ ordinary beforeEach hooks transform inputs before validation (46.054984ms)
432
+ ✔ multi false is checked after beforeEach and rolls back the update (8.384582ms)
433
+ ✔ ordinary beforeEach hooks run before PostgreSQL UPDATE policy checks (7.121513ms)
434
+ ✔ before and after hooks preserve RLS across dbx and raw tx calls (15.867188ms)
435
+ ▶ post-transaction hooks receive committed and authenticated context
436
+ ✔ afterCommit runs after commit, filters changed fields and skips rollback (12.628099ms)
437
+ ✔ clearing a watched field runs before, after and commit hooks (2.12651ms)
438
+ ✔ client updateBatch runs hooks atomically in implicit and explicit transactions (16.273956ms)
439
+ destroying prgl instance
440
+ ✔ server-user requests preserve tenant_id from sessionFields (1.394832ms)
441
+ ✔ post-transaction hooks receive committed and authenticated context (1198.307474ms)
442
+ ✔ Self reference recursion bug (3.778446ms)
443
+ ✔ Transactions (16.666979ms)
444
+ (server): Server-only query tests successful
445
+ (server): Starting isomorphic queries
446
+ ✔ TableConfig onMount works (4.087549ms)
447
+ ✔ Server Only Queries (22200.688705ms)
448
+ (server): DELETING items
449
+ ▶ Isomorphic queries
450
+ ✔ Deleting stale data (30.163926ms)
451
+ ✔ Error structure malformed array literal (19.835389ms)
452
+ ✔ Table info (0.417367ms)
453
+ ✔ Prepare data (18.645471ms)
454
+ ✔ Test bytea (2.039618ms)
455
+ ✔ abortSignal terminates a running query (5541.2293ms)
456
+ ✔ Client queries are aborted no more than after n seconds (0.404876ms)
457
+ ✔ Subscription tracked_columns get merged correctly (28.082988ms)
458
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (960.996859ms)
459
+ ✔ CASE select and subscription dependencies (658.679535ms)
460
+ ✔ Subscription tracks non-selected ORDER BY columns (643.412498ms)
461
+ ✔ merge json (13.525382ms)
462
+ ✔ json array converted to pg array filter bug (2.129412ms)
463
+ ✔ onConflict do update (12.720076ms)
464
+ ✔ Local file upload (33.196358ms)
465
+ ✔ Local file delete (14.696189ms)
466
+ ✔ Local file update (15.740773ms)
467
+ ✔ getColumns definition (0.527215ms)
468
+ ✔ returnType (0.237165ms)
469
+ ✔ Table config triggers (3.380136ms)
470
+ ✔ $unnest_words (0.693434ms)
471
+ ✔ Group by/Distinct (0.967911ms)
472
+ ✔ sql returntype default-with-rollback (7.861989ms)
473
+ ✔ returnType: value (0.629827ms)
474
+ ✔ PostgreSQL array element (2.697279ms)
475
+ ✔ FTS filtering (3.13181ms)
476
+ ✔ $term_highlight (2.802041ms)
477
+ ✔ funcFilters: $term_highlight (1.089479ms)
478
+ (server): [{"name":null}]
479
+ (server): [{"name":"zz3zz1"}]
480
+ (server): []
481
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (856.810175ms)
482
+ (server): [{"name":null}]
483
+ (server): [{"name":"zz3zz1"}]
484
+ (server): [{"name":"zz3zz1"}]
485
+ (server): [{"name":"zz3zz1"}]
486
+ (server): []
487
+ ✔ subscribe skipChangedColumnsCheck true (3389.080601ms)
488
+ unsubscribe start - various
489
+ unsubscribe end - various
490
+ ✔ subscribe (48.000174ms)
491
+ ✔ subscribe to schema.table (15.060214ms)
492
+ ✔ parallel subscriptions (2022.185685ms)
493
+ (server): updateAll done in 1643
494
+ (server): updateAll done in 1622
495
+ (server): Locks: [{"pid":253,"blocking_pids":[260],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"},{"pid":267,"blocking_pids":[260,253,265],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"},{"pid":265,"blocking_pids":[260,253],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"},{"pid":264,"blocking_pids":[260,253,265,267],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
496
+ (server): updateAll done in 1895
497
+ ✔ subscriptions do not serialize transactions (9690.716999ms)
498
+ Created PubSubManager
499
+ throttling sub for 1700 ms
500
+ throttling finished. pushSubData...
501
+ throttling sub for 1700 ms
502
+ ✔ subscribeOne with throttle (1730.983706ms)
503
+ throttling sub for 1700 ms
504
+ ✔ subscribeOne with throttle skipFirst: true (1710.527983ms)
505
+ ✔ subscribeOne without skipFirst (1029.004118ms)
506
+ ✔ subscribeOne with skipFirst: true (1528.074027ms)
507
+ ✔ subscribeOne actions: { insert: true } (1542.608984ms)
508
+ ✔ subscribeOne actions: { insert: false } (1546.453313ms)
509
+ ✔ JSON filtering (2.232065ms)
510
+ ✔ Complex filtering (1.985144ms)
511
+ ✔ template_string function (1.495993ms)
512
+ ✔ Between filtering (1.823937ms)
513
+ ✔ In filtering (1.981779ms)
514
+ ✔ Order by (2.424061ms)
515
+ ✔ Order by aliased func (1.367668ms)
516
+ ✔ Filter by aliased func (1.082874ms)
517
+ ✔ Count with Filter by aliased func (4.336684ms)
518
+ ✔ Count with Aggregate and Filter by aliased func (1.734171ms)
519
+ ✔ Count with complex filter (1.519346ms)
520
+ ✔ Order by aggregation (1.003431ms)
521
+ ✔ Aggregate FILTER and ORDER BY (1.32085ms)
522
+ ✔ Column alias func (1.12574ms)
523
+ ✔ Order by colliding alias name (1.029027ms)
524
+ ✔ Update batch example (12.016646ms)
525
+ TODO: socket.io stringifies dates
526
+ ✔ Function example (10.977816ms)
527
+ ✔ JSONB filtering (4.880366ms)
528
+ ✔ Postgis examples (57.359665ms)
529
+ ✔ jsonbSchema validation (11.201401ms)
530
+ ✔ find and findOne (1.979407ms)
531
+ ✔ Result size (3.440497ms)
532
+ ✔ Basic exists (2.740674ms)
533
+ ✔ Basic fts with shorthand notation (2.496232ms)
534
+ ✔ Exists with shortest path wildcard filter example (1.790007ms)
535
+ ✔ Exists with exact path filter example (0.626655ms)
536
+ ✔ Not Exists with exact path filter example (1.086999ms)
537
+ ✔ Upsert example (11.022547ms)
538
+ ✔ Joins example (1.536669ms)
539
+ ✔ Joins repeating table example (2.275286ms)
540
+ ✔ Join aggregate functions example (4.747346ms)
541
+ ✔ $rowhash example (3.479933ms)
542
+ ✔ Reference column nested insert (5.676585ms)
543
+ ✔ Join escaped table names with quotes (15.474297ms)
544
+ (server): {
545
+ "item": {
546
+ "\"id0\"": 1,
547
+ "\"quoted1_id\"": 1,
548
+ "\"text_col0\"": "0"
549
+ },
550
+ "runs": 0
551
+ }
552
+ (server): {
553
+ "item": {
554
+ "\"id0\"": 1,
555
+ "\"quoted1_id\"": 1,
556
+ "\"text_col0\"": "1"
557
+ },
558
+ "runs": 1
559
+ }
560
+ unsubscribe start - """quoted0"""
561
+ unsubscribe end - """quoted0"""
562
+ ✔ subscribe to escaped table name (15.256675ms)
563
+ ✔ subscribe using a filter bigger than block_size (16.083135ms)
564
+ ✔ Reverse join with agg (12.366775ms)
565
+ {
566
+ _rows: [
567
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
568
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
569
+ ],
570
+ runs: 1
571
+ }
572
+ {
573
+ _rows: [
574
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
575
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
576
+ ],
577
+ runs: 2
578
+ }
579
+ ✔ Related table subscribe (9054.567908ms)
580
+ ✔ Aggregate FILTER registers joined dependency triggers (653.721449ms)
581
+ ✔ Nested sort by computed col (6.71745ms)
582
+ ✔ Nested function on different than source column getNewQuery name bug fix (1.698409ms)
583
+ ✔ Reference column deep nested insert (16.985101ms)
584
+ ✔ Multi reference column nested insert (9.34959ms)
585
+ ✔ Join path with order by nested (6.932017ms)
586
+ ✔ Self join (11.852485ms)
587
+ ✔ One to many multi join duplicate row bug fix (10.042745ms)
588
+ (server): various id=99 count
589
+ (server): various id=99 count
590
+ ok
591
+ (server): various id=99 count
592
+ (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":"3716","routine":"errorMissingColumn","query":"-- prostgles query id: eaea37da-220e-473b-b0f9-a1191639630a\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"}
593
+ ok
594
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6535.876778ms)
595
+ ✔ Isomorphic queries (49667.232746ms)
596
+ ✔ Having clause (3.916076ms)
597
+ ✔ Having clause with complex filter (2.025528ms)
598
+ (server): Server isomorphic tests successful
599
+ (server): Stopping server ...
600
+ ℹ tests 135
601
+ ℹ suites 2
602
+ ℹ pass 135
603
+ ℹ fail 0
604
+ ℹ cancelled 0
605
+ ℹ skipped 0
606
+ ℹ todo 0
607
+ ℹ duration_ms 77708.78928
608
+
609
+ > server_tests@1.0.0 test-client
610
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
611
+
612
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
613
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
614
+
615
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
616
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
617
+ id TEXT PRIMARY KEY
618
+ , "description" TEXT
619
+ );
620
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
621
+
622
+ CREATE TABLE "files" (
623
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
624
+ "storage_key" UUID UNIQUE ,
625
+ "extension" TEXT NOT NULL DEFAULT '' ,
626
+ "content_type" TEXT NOT NULL DEFAULT '' ,
627
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
628
+ "etag" TEXT NOT NULL DEFAULT '' ,
629
+ "original_name" TEXT NOT NULL ,
630
+ "original_last_modified" TIMESTAMPTZ ,
631
+ "description" TEXT ,
632
+ "url" TEXT NOT NULL DEFAULT '' ,
633
+ "cloud_url" TEXT ,
634
+ "signed_url" TEXT ,
635
+ "signed_url_expires" BIGINT ,
636
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
637
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
638
+ "deleted" TIMESTAMPTZ ,
639
+ "deleted_from_storage" TIMESTAMPTZ ,
640
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
641
+ "version" INTEGER NOT NULL DEFAULT 1 ,
642
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
643
+ );
644
+ CREATE TABLE "files_versions" (
645
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
646
+ "storage_key" UUID NOT NULL ,
647
+ "extension" TEXT NOT NULL DEFAULT '' ,
648
+ "content_type" TEXT NOT NULL DEFAULT '' ,
649
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
650
+ "etag" TEXT NOT NULL DEFAULT '' ,
651
+ "original_name" TEXT NOT NULL ,
652
+ "original_last_modified" TIMESTAMPTZ ,
653
+ "description" TEXT ,
654
+ "url" TEXT NOT NULL DEFAULT '' ,
655
+ "cloud_url" TEXT ,
656
+ "signed_url" TEXT ,
657
+ "signed_url_expires" BIGINT ,
658
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
659
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
660
+ "deleted" TIMESTAMPTZ ,
661
+ "deleted_from_storage" TIMESTAMPTZ ,
662
+ "file_id" UUID NOT NULL ,
663
+ "version" INTEGER NOT NULL ,
664
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
665
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
666
+ );
667
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
668
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
669
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
670
+ CREATE TABLE "users_public_info" (
671
+ "id" SERIAL PRIMARY KEY ,
672
+ "name" TEXT ,
673
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
674
+ "sid" TEXT
675
+ );
676
+ DROP TABLE IF EXISTS "users";
677
+ CREATE TABLE "users" (
678
+ "id" SERIAL PRIMARY KEY ,
679
+ "email" TEXT NOT NULL ,
680
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
681
+ "type" TEXT NOT NULL ,
682
+ "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"}' ))
683
+ );
684
+ DROP TABLE IF EXISTS "tjson";
685
+ CREATE TABLE "tjson" (
686
+ "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"}' )),
687
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
688
+ "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"}' )),
689
+ "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"}' )),
690
+ "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"}' ))
691
+ );
692
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
693
+
694
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
695
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
696
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
697
+ DROP TABLE IF EXISTS "api_table";
698
+ CREATE TABLE "api_table" (
699
+ "id" SERIAL PRIMARY KEY
700
+ );
701
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
702
+ (server): prostgles onReady
703
+ (server): Waiting for client...
704
+ (client) t+ 0ms Started client...
705
+ onSocketConnect DtJdiU7xxc-_x4-lAAAA
706
+ (server): Client connected -> console does not work. use log function. socket.id: DtJdiU7xxc-_x4-lAAAA
707
+ (client) t+ 39ms Client connect.
708
+ (client) t+ 166ms TEST_NAME: syncTriggerCleanup Started
709
+ Created PubSubManager
710
+ Pushing 0 rows to socket
711
+ ✔ subscription receives an update immediately after another trigger is deleted (431.026837ms)
712
+ Pushing 1 rows to socket x2
713
+ Pushing 0 rows to socket
714
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
715
+ Client log (client) t+ 3264ms TEST_NAME: syncTriggerCleanup Finished OK
716
+ ✔ unsubscribe cleanup preserves a sync being registered (2662.427904ms)
717
+ Client test successful
718
+ (server): Stopping server ...
719
+ ℹ tests 2
720
+ ℹ suites 0
721
+ ℹ pass 2
722
+ ℹ fail 0
723
+ ℹ cancelled 0
724
+ ℹ skipped 0
725
+ ℹ todo 0
726
+ ℹ duration_ms 11246.618634
727
+
728
+ > server_tests@1.0.0 test-client
729
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
730
+
731
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
732
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
733
+
734
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
735
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
736
+ id TEXT PRIMARY KEY
737
+ , "description" TEXT
738
+ );
739
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
740
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
741
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
742
+
743
+ CREATE TABLE "files" (
744
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
745
+ "storage_key" UUID UNIQUE ,
746
+ "extension" TEXT NOT NULL DEFAULT '' ,
747
+ "content_type" TEXT NOT NULL DEFAULT '' ,
748
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
749
+ "etag" TEXT NOT NULL DEFAULT '' ,
750
+ "original_name" TEXT NOT NULL ,
751
+ "original_last_modified" TIMESTAMPTZ ,
752
+ "description" TEXT ,
753
+ "url" TEXT NOT NULL DEFAULT '' ,
754
+ "cloud_url" TEXT ,
755
+ "signed_url" TEXT ,
756
+ "signed_url_expires" BIGINT ,
757
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
758
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
759
+ "deleted" TIMESTAMPTZ ,
760
+ "deleted_from_storage" TIMESTAMPTZ ,
761
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
762
+ "version" INTEGER NOT NULL DEFAULT 1 ,
763
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
764
+ );
765
+ CREATE TABLE "files_versions" (
766
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
767
+ "storage_key" UUID NOT NULL ,
768
+ "extension" TEXT NOT NULL DEFAULT '' ,
769
+ "content_type" TEXT NOT NULL DEFAULT '' ,
770
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
771
+ "etag" TEXT NOT NULL DEFAULT '' ,
772
+ "original_name" TEXT NOT NULL ,
773
+ "original_last_modified" TIMESTAMPTZ ,
774
+ "description" TEXT ,
775
+ "url" TEXT NOT NULL DEFAULT '' ,
776
+ "cloud_url" TEXT ,
777
+ "signed_url" TEXT ,
778
+ "signed_url_expires" BIGINT ,
779
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
780
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
781
+ "deleted" TIMESTAMPTZ ,
782
+ "deleted_from_storage" TIMESTAMPTZ ,
783
+ "file_id" UUID NOT NULL ,
784
+ "version" INTEGER NOT NULL ,
785
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
786
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
787
+ );
788
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
789
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
790
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
791
+ CREATE TABLE "users_public_info" (
792
+ "id" SERIAL PRIMARY KEY ,
793
+ "name" TEXT ,
794
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
795
+ "sid" TEXT
796
+ );
797
+ DROP TABLE IF EXISTS "users";
798
+ CREATE TABLE "users" (
799
+ "id" SERIAL PRIMARY KEY ,
800
+ "email" TEXT NOT NULL ,
801
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
802
+ "type" TEXT NOT NULL ,
803
+ "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"}' ))
804
+ );
805
+ DROP TABLE IF EXISTS "tjson";
806
+ CREATE TABLE "tjson" (
807
+ "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"}' )),
808
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
809
+ "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"}' )),
810
+ "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"}' )),
811
+ "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"}' ))
812
+ );
813
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
814
+
815
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
816
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
817
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
818
+ DROP TABLE IF EXISTS "api_table";
819
+ CREATE TABLE "api_table" (
820
+ "id" SERIAL PRIMARY KEY
821
+ );
822
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
823
+ (server): prostgles onReady
824
+ (server): Waiting for client...
825
+ (client) t+ 0ms Started client...
826
+ onSocketConnect NcXAOW-BFcyyueQ2AAAA
827
+ (server): Client connected -> console does not work. use log function. socket.id: NcXAOW-BFcyyueQ2AAAA
828
+ (client) t+ 40ms Client connect.
829
+ (client) t+ 172ms TEST_NAME: main Started
830
+ Client log (client) t+ 186ms Starting isomorphic queries
831
+ ▶ Isomorphic queries
832
+ ✔ Deleting stale data (22.245461ms)
833
+ {
834
+ message: 'malformed array literal: "a"',
835
+ length: 149,
836
+ name: 'error',
837
+ severity: 'ERROR',
838
+ code: '22P02',
839
+ detail: 'Array value must start with "{" or dimension information.',
840
+ position: '325',
841
+ file: 'arrayfuncs.c',
842
+ line: '262',
843
+ routine: 'array_in',
844
+ query: '-- prostgles query id: c1cb40f0-007c-4f7a-af6c-67c006e51a48\n' +
845
+ 'SET LOCAL "prostgles.user" \n' +
846
+ `TO '{"id":"1","type":"public"}';\n` +
847
+ 'SELECT \n' +
848
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
849
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
850
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
851
+ ' FROM ( \n' +
852
+ ' SELECT * \n' +
853
+ ' FROM items \n' +
854
+ ` WHERE "h" = 'a' \n` +
855
+ ' ) prostgles_root_table_alias \n' +
856
+ ' LIMIT 0',
857
+ code_info: 'invalid_text_representation'
858
+ }
859
+ {
860
+ message: 'malformed array literal: "a"',
861
+ length: 149,
862
+ name: 'error',
863
+ severity: 'ERROR',
864
+ code: '22P02',
865
+ detail: 'Array value must start with "{" or dimension information.',
866
+ position: '325',
867
+ file: 'arrayfuncs.c',
868
+ line: '262',
869
+ routine: 'array_in',
870
+ query: '-- prostgles query id: 3daee160-c01e-49ff-bab9-8974c9f86e3c\n' +
871
+ 'SET LOCAL "prostgles.user" \n' +
872
+ `TO '{"id":"1","type":"public"}';\n` +
873
+ 'SELECT \n' +
874
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
875
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
876
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
877
+ ' FROM ( \n' +
878
+ ' SELECT * \n' +
879
+ ' FROM items \n' +
880
+ ` WHERE "h" = 'a' \n` +
881
+ ' ) prostgles_root_table_alias \n' +
882
+ ' LIMIT 0',
883
+ code_info: 'invalid_text_representation'
884
+ }
885
+ ✔ Error structure malformed array literal (61.379602ms)
886
+ ✔ Table info (1.313564ms)
887
+ ✔ Prepare data (82.636354ms)
888
+ ✔ Test bytea (14.068858ms)
889
+ ✔ abortSignal terminates a running query (5549.023501ms)
890
+ ✔ Client queries are aborted no more than after n seconds (14014.459738ms)
891
+ ✔ Subscription tracked_columns get merged correctly (0.593709ms)
892
+ Created PubSubManager
893
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (1017.209134ms)
894
+ ✔ CASE select and subscription dependencies (658.723369ms)
895
+ ✔ Subscription tracks non-selected ORDER BY columns (665.149501ms)
896
+ ✔ merge json (16.683675ms)
897
+ ✔ json array converted to pg array filter bug (3.620644ms)
898
+ ✔ onConflict do update (12.008002ms)
899
+ ✔ Local file upload (57.787533ms)
900
+ ✔ Local file delete (30.220403ms)
901
+ ✔ Local file update (57.396586ms)
902
+ ✔ getColumns definition (1.807949ms)
903
+ ✔ returnType (0.84137ms)
904
+ ✔ Table config triggers (7.703121ms)
905
+ ✔ $unnest_words (2.359239ms)
906
+ ✔ Group by/Distinct (3.998095ms)
907
+ ✔ sql returntype default-with-rollback (27.136788ms)
908
+ ✔ returnType: value (1.936698ms)
909
+ ✔ PostgreSQL array element (7.39173ms)
910
+ ✔ FTS filtering (13.816795ms)
911
+ ✔ $term_highlight (20.153352ms)
912
+ ✔ funcFilters: $term_highlight (4.017386ms)
913
+ Client log (client) t+ 22569ms [{"name":null}]
914
+ Client log (client) t+ 22573ms [{"name":"zz3zz1"}]
915
+ Pushing 1 rows to socket x9
916
+ Client log (client) t+ 23211ms []
917
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (859.455936ms)
918
+ Pushing 0 rows to socket
919
+ Client log (client) t+ 25952ms [{"name":null}]
920
+ Client log (client) t+ 25959ms [{"name":"zz3zz1"}]
921
+ Client log (client) t+ 26175ms [{"name":"zz3zz1"}]
922
+ Client log (client) t+ 26391ms [{"name":"zz3zz1"}]
923
+ Pushing 1 rows to socket x4
924
+ Client log (client) t+ 26603ms []
925
+ ✔ subscribe skipChangedColumnsCheck true (3391.506232ms)
926
+ Pushing 0 rows to socket
927
+ Pushing 1 rows to socket x4
928
+ Client log unsubscribe start - various
929
+ Client log unsubscribe end - various
930
+ ✔ subscribe (49.098873ms)
931
+ Pushing 0 rows to socket
932
+ Pushing 1 rows to socket
933
+ ✔ subscribe to schema.table (21.753642ms)
934
+ Pushing 2 rows to socket
935
+ ✔ parallel subscriptions (2009.928587ms)
936
+ Client log (client) t+ 33157ms updateAll done in 1767
937
+ Client log (client) t+ 34815ms updateAll done in 1654
938
+ Pushing 0 rows to socket
939
+ Pushing 3 rows to socket
940
+ Client log (client) t+ 35368ms Locks: [{"pid":302,"blocking_pids":[307],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":null}]
941
+ Client log (client) t+ 35369ms Locks: [{"pid":304,"blocking_pids":[306],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
942
+ Pushing 996 rows to socket
943
+ Client log (client) t+ 36892ms updateAll done in 2055
944
+ Pushing 1000 rows to socket x2
945
+ ✔ subscriptions do not serialize transactions (10019.493518ms)
946
+ Pushing 3 rows to socket
947
+ Pushing 1 rows to socket
948
+ throttling sub for 1700 ms
949
+ throttling finished. pushSubData...
950
+ Pushing 1 rows to socket
951
+ throttling sub for 1700 ms
952
+ ✔ subscribeOne with throttle (1779.742664ms)
953
+ throttling sub for 1700 ms
954
+ throttling finished. pushSubData...
955
+ ✔ subscribeOne with throttle skipFirst: true (1702.933618ms)
956
+ Pushing 1 rows to socket
957
+ throttling finished. pushSubData...
958
+ Pushing 1 rows to socket
959
+ ✔ subscribeOne without skipFirst (1070.388203ms)
960
+ Pushing 0 rows to socket
961
+ Pushing 1 rows to socket
962
+ ✔ subscribeOne with skipFirst: true (1585.3833ms)
963
+ Pushing 0 rows to socket x2
964
+ ✔ subscribeOne actions: { insert: true } (1585.350799ms)
965
+ Pushing 1 rows to socket
966
+ ✔ subscribeOne actions: { insert: false } (1593.292829ms)
967
+ ✔ JSON filtering (6.149905ms)
968
+ ✔ Complex filtering (5.047772ms)
969
+ ✔ template_string function (5.020614ms)
970
+ ✔ Between filtering (3.674104ms)
971
+ ✔ In filtering (3.378601ms)
972
+ ✔ Order by (3.839384ms)
973
+ ✔ Order by aliased func (2.487393ms)
974
+ ✔ Filter by aliased func (2.303515ms)
975
+ ✔ Count with Filter by aliased func (3.882603ms)
976
+ ✔ Count with Aggregate and Filter by aliased func (3.410754ms)
977
+ ✔ Count with complex filter (2.519625ms)
978
+ ✔ Order by aggregation (1.97484ms)
979
+ ✔ Aggregate FILTER and ORDER BY (2.201781ms)
980
+ ✔ Column alias func (2.022417ms)
981
+ ✔ Order by colliding alias name (2.029005ms)
982
+ ✔ Update batch example (24.920561ms)
983
+ Client log TODO: socket.io stringifies dates
984
+ ✔ Function example (21.00403ms)
985
+ ✔ JSONB filtering (10.506056ms)
986
+ ✔ Postgis examples (22.503206ms)
987
+ ✔ jsonbSchema validation (15.612186ms)
988
+ ✔ find and findOne (3.267765ms)
989
+ ✔ Result size (3.1939ms)
990
+ ✔ Basic exists (5.390534ms)
991
+ ✔ Basic fts with shorthand notation (5.624121ms)
992
+ ✔ Exists with shortest path wildcard filter example (8.591998ms)
993
+ ✔ Exists with exact path filter example (3.272936ms)
994
+ ✔ Not Exists with exact path filter example (3.367645ms)
995
+ ✔ Upsert example (20.805342ms)
996
+ ✔ Joins example (4.152126ms)
997
+ ✔ Joins repeating table example (4.68847ms)
998
+ ✔ Join aggregate functions example (13.220981ms)
999
+ ✔ $rowhash example (11.862977ms)
1000
+ ✔ Reference column nested insert (11.248566ms)
1001
+ ✔ Join escaped table names with quotes (11.626588ms)
1002
+ Pushing 0 rows to socket x2
1003
+ Client log (client) t+ 48482ms {
1004
+ "item": {
1005
+ "\"id0\"": 1,
1006
+ "\"quoted1_id\"": 1,
1007
+ "\"text_col0\"": "0"
1008
+ },
1009
+ "runs": 0
1010
+ }
1011
+ Client log (client) t+ 48487ms {
1012
+ "item": {
1013
+ "\"id0\"": 1,
1014
+ "\"quoted1_id\"": 1,
1015
+ "\"text_col0\"": "1"
1016
+ },
1017
+ "runs": 1
1018
+ }
1019
+ Client log unsubscribe start - """quoted0"""
1020
+ Client log unsubscribe end - """quoted0"""
1021
+ ✔ subscribe to escaped table name (12.47447ms)
1022
+ Pushing 1 rows to socket x2
1023
+ ✔ subscribe using a filter bigger than block_size (18.641585ms)
1024
+ ✔ Reverse join with agg (19.460672ms)
1025
+ Pushing 0 rows to socket
1026
+ 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}
1027
+ 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}
1028
+ ✔ Related table subscribe (9051.885086ms)
1029
+ Pushing 2 rows to socket x2
1030
+ ✔ Aggregate FILTER registers joined dependency triggers (674.71952ms)
1031
+ ✔ Nested sort by computed col (13.72668ms)
1032
+ ✔ Nested function on different than source column getNewQuery name bug fix (2.798664ms)
1033
+ ✔ Reference column deep nested insert (14.936497ms)
1034
+ ✔ Multi reference column nested insert (13.631824ms)
1035
+ ✔ Join path with order by nested (8.371955ms)
1036
+ ✔ Self join (11.25498ms)
1037
+ ✔ One to many multi join duplicate row bug fix (15.263842ms)
1038
+ Client log (client) t+ 58344ms various id=99 count 1
1039
+ Pushing 1 rows to socket x3
1040
+ Client log (client) t+ 58367ms various id=99 count
1041
+ Client log ok
1042
+ Error within running subscription
1043
+ _psqlWS_..various.{"id":99}.{"select":{"name":1}}.m.sub {
1044
+ message: 'column prostgles_root_table_alias.name does not exist',
1045
+ length: 130,
1046
+ name: 'error',
1047
+ severity: 'ERROR',
1048
+ code: '42703',
1049
+ position: '133',
1050
+ file: 'parse_relation.c',
1051
+ line: '3716',
1052
+ routine: 'errorMissingColumn',
1053
+ query: '-- prostgles query id: 13c09d1c-7b41-415f-bcee-df95a8b46350\n' +
1054
+ 'SET LOCAL "prostgles.user" \n' +
1055
+ `TO '{"id":"1","type":"public"}';\n` +
1056
+ 'SELECT \n' +
1057
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
1058
+ ' FROM ( \n' +
1059
+ ' SELECT * \n' +
1060
+ ' FROM various \n' +
1061
+ ' WHERE "id" = 99 \n' +
1062
+ ' ) prostgles_root_table_alias \n' +
1063
+ ' LIMIT 1000',
1064
+ code_info: 'undefined_column'
1065
+ }
1066
+ Client log (client) t+ 60392ms various id=99 count
1067
+ Client log (client) t+ 60392ms 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":"3716","routine":"errorMissingColumn","query":"-- prostgles query id: 13c09d1c-7b41-415f-bcee-df95a8b46350\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"}
1068
+ Client log ok
1069
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6570.557269ms)
1070
+ ✔ Isomorphic queries (64713.771457ms)
1071
+ ✔ Having clause (2.947543ms)
1072
+ ✔ Having clause with complex filter (2.098015ms)
1073
+ Client log (client) t+ 64919ms auth.user: {"sid":"main","uid":"1","id":"1","type":"public"}
1074
+ ✔ Nested join having clause (3.11473ms)
1075
+ ▶ isomorphic typed queries
1076
+ ✔ isLookupTable DB Types from colConf (0.207087ms)
1077
+ ✔ isLookupTable DB Types from reference column actual definition (0.105512ms)
1078
+ ✔ isLookupTable pkey column itself is typed (0.074533ms)
1079
+ ✔ isomorphic typed queries (0.531182ms)
1080
+ ▶ Client only queries
1081
+ ✔ modifyClientSchema adds custom table and column metadata (3.119738ms)
1082
+ ✔ SQL Stream more than 1k records (22.203191ms)
1083
+ ✔ SQL Stream persistedConnection with streamLimit works for subsequent queries (14.220193ms)
1084
+ ✔ SQL Stream ensure the connection is never released (same pg_backend_pid is the same for subsequent) when using persistConnectionId (8.823109ms)
1085
+ ✔ SQL Stream stop kills the query (1024.760991ms)
1086
+ ✔ SQL Stream limit works (39.956532ms)
1087
+ ✔ SQL Stream stop with terminate kills the query (expect flakiness) (136.181667ms)
1088
+ ✔ SQL Stream (14.789042ms)
1089
+ ✔ SQL Stream parallel execution + parameters (13.650732ms)
1090
+ ✔ SQL Stream query error structure matches default sql run error (14.10882ms)
1091
+ ✔ SQL Stream streamLimit (12.924035ms)
1092
+ ✔ SQL Stream table fields are the same as on default request (21.829756ms)
1093
+ ✔ SQL Stream works for multiple statements (16.083364ms)
1094
+ ✔ Check tableSchema (19.887643ms)
1095
+ Client log (client) t+ 66283ms Checking public data
1096
+ ✔ Security rules example (40.357209ms)
1097
+ Client log (client) t+ 66333ms Started testRealtime
1098
+ Client log (client) t+ 66360ms 1790856513854: sub stats: x10 -> 0 x20 ->0
1099
+ Client log (client) t+ 66367ms 1790856513861: sync stats: x10 -> 0 x20 -> 0
1100
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 0)
1101
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 1)
1102
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 2)
1103
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 3)
1104
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 4)
1105
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 5)
1106
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 6)
1107
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 7)
1108
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 8)
1109
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 9)
1110
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 10)
1111
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 11)
1112
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 12)
1113
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 13)
1114
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 14)
1115
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 15)
1116
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 16)
1117
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 17)
1118
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 18)
1119
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 19)
1120
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 20)
1121
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 21)
1122
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 22)
1123
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 23)
1124
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 24)
1125
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 25)
1126
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 26)
1127
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 27)
1128
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 28)
1129
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 29)
1130
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 30)
1131
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 31)
1132
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 32)
1133
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 33)
1134
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 34)
1135
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 35)
1136
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 36)
1137
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 37)
1138
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 38)
1139
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 39)
1140
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 40)
1141
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 41)
1142
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 42)
1143
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 43)
1144
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 44)
1145
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 45)
1146
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 46)
1147
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 47)
1148
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 48)
1149
+ Client log (client) t+ 66368ms 1790856513862: sync: p.$update({ x: 10 }); (id: 49)
1150
+ Pushing 0 rows to socket x3
1151
+ upsertData (from client): inserted( 0 ) updated( 50 ) total( 50 )
1152
+ last insert undefined
1153
+ last update {"id":49,"x":10,"y":49,"flight_number":"FN49","last_updated":1790856513862}
1154
+ Client log (client) t+ 66427ms 1790856513921: sub stats: x10 -> 50 x20 ->0
1155
+ Pushing 50 rows to socket
1156
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1157
+ last insert undefined
1158
+ last update undefined
1159
+ server.syncBatch planes: inserted( 0 ) updated( 50 ) deleted( 0 ) pushed to client( 50 ) total( 100 ) undefined
1160
+ Client log (client) t+ 66439ms 1790856513933: sync stats: x10 -> 50 x20 -> 0
1161
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 50)
1162
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 51)
1163
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 52)
1164
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 53)
1165
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 54)
1166
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 55)
1167
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 56)
1168
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 57)
1169
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 58)
1170
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 59)
1171
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 60)
1172
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 61)
1173
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 62)
1174
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 63)
1175
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 64)
1176
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 65)
1177
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 66)
1178
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 67)
1179
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 68)
1180
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 69)
1181
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 70)
1182
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 71)
1183
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 72)
1184
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 73)
1185
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 74)
1186
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 75)
1187
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 76)
1188
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 77)
1189
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 78)
1190
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 79)
1191
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 80)
1192
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 81)
1193
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 82)
1194
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 83)
1195
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 84)
1196
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 85)
1197
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 86)
1198
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 87)
1199
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 88)
1200
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 89)
1201
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 90)
1202
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 91)
1203
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 92)
1204
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 93)
1205
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 94)
1206
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 95)
1207
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 96)
1208
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 97)
1209
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 98)
1210
+ Client log (client) t+ 66439ms 1790856513933: sync: p.$update({ x: 10 }); (id: 99)
1211
+ Client log (client) t+ 66443ms 1790856513937: sync stats: x10 -> 100 x20 -> 0
1212
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 1 )
1213
+ last insert undefined
1214
+ last update undefined
1215
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1216
+ last insert undefined
1217
+ last update undefined
1218
+ upsertData (from client): inserted( 0 ) updated( 50 ) total( 50 )
1219
+ last insert undefined
1220
+ last update {"id":99,"x":10,"y":99,"flight_number":"FN99","last_updated":1790856513933}
1221
+ Client log (client) t+ 66508ms 1790856514002: sub stats: x10 -> 100 x20 ->0
1222
+ Pushing 100 rows to socket
1223
+ server.syncBatch planes: inserted( 0 ) updated( 50 ) deleted( 0 ) pushed to client( 0 ) total( 100 ) undefined
1224
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 50 )
1225
+ last insert undefined
1226
+ last update undefined
1227
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1228
+ last insert undefined
1229
+ last update undefined
1230
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 0 ) total( 50 ) undefined
1231
+ Client log (client) t+ 68508ms 1790856516002: sub: db.planes.update({}, { x: 20, last_updated });
1232
+ Client log (client) t+ 68525ms 1790856516017: sub: Updated to x20 100
1233
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 49 )
1234
+ last insert undefined
1235
+ last update undefined
1236
+ Client log (client) t+ 68532ms 1790856516026: sync stats: x10 -> 50 x20 -> 50
1237
+ Client log (client) t+ 68544ms 1790856516038: sync stats: x10 -> 0 x20 -> 100
1238
+ Client log (client) t+ 68544ms 1790856516038: sync end: Finished replication test. Inserting 100 rows then updating two times took: 211ms
1239
+ ✔ Realtime (2221.419495ms)
1240
+ Client log (client) t+ 68546ms sync handlesOnData true 100
1241
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1242
+ last insert undefined
1243
+ last update undefined x2
1244
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 100 ) total( 100 ) undefined
1245
+ ✔ sync handlesOnData true -> false no data bug (2002.598036ms)
1246
+ ﹣ Security rules example (0.559442ms) # SKIP
1247
+ ✔ Client only queries (5628.966105ms)
1248
+ ▶ React hooks
1249
+ ✔ useFind (523.07828ms)
1250
+ {
1251
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1252
+ }
1253
+ ✔ useSubscribe (534.325998ms)
1254
+ ✔ useFindOne (505.410941ms)
1255
+ Pushing 1 rows to socket
1256
+ {
1257
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1258
+ }
1259
+ ✔ useSubscribeOne (517.620437ms)
1260
+ ✔ useCount (507.001891ms)
1261
+ ✔ useSize (508.55373ms)
1262
+ ✔ useCount planes (254.623513ms)
1263
+ Pushing 2 rows to socket
1264
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1265
+ last insert undefined
1266
+ last update undefined
1267
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1268
+ last insert undefined
1269
+ last update undefined
1270
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1271
+ Client log (client) t+ 74204ms 1790856521697: sync stats: x10 -> 0 x20 -> 99
1272
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1273
+ last insert undefined
1274
+ last update undefined
1275
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 2 ) total( 100 ) undefined
1276
+ ✔ useSync (546.876036ms)
1277
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1278
+ last insert undefined
1279
+ last update undefined x2
1280
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1281
+ Client log (client) t+ 74470ms 1790856521964: sync stats: x10 -> 0 x20 -> 100
1282
+ Client log (client) t+ 74470ms 1790856521964: sync end: Finished replication test. Inserting 100 rows then updating two times took: 6137ms
1283
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1284
+ Client log (client) t+ 74743ms 1790856522237: sync stats: x10 -> 0 x20 -> 99
1285
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1286
+ last insert undefined
1287
+ last update undefined x2
1288
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1289
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1290
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1291
+ last insert undefined
1292
+ last update {"id":0,"x":232,"last_updated":1790856522245}
1293
+ ✔ useSync updates invalidate useMemo without mutating old data (323.641851ms)
1294
+ Client log (client) t+ 74775ms 1790856522269: sync stats: x10 -> 0 x20 -> 99
1295
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1296
+ last insert undefined
1297
+ last update undefined
1298
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1299
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1300
+ last insert undefined
1301
+ last update undefined x2
1302
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1303
+ Client log (client) t+ 74794ms 1790856522288: sync stats: x10 -> 0 x20 -> 99
1304
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1305
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1306
+ last insert undefined
1307
+ last update undefined x2
1308
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1309
+ Client log (client) t+ 75063ms 1790856522557: sync stats: x10 -> 0 x20 -> 99
1310
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1311
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1312
+ last insert undefined
1313
+ last update {"id":0,"x":32,"last_updated":1790856522563}
1314
+ Client log (client) t+ 75089ms 1790856522583: sync stats: x10 -> 0 x20 -> 99
1315
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1316
+ last insert undefined
1317
+ last update undefined
1318
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1319
+ ✔ concurrent useSync hooks with matching options all update (317.474617ms)
1320
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1321
+ last insert undefined
1322
+ last update undefined
1323
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 51 ) total( 52 ) undefined
1324
+ Client log (client) t+ 75382ms Reconnected
1325
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1326
+ last insert undefined
1327
+ last update undefined
1328
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 151 ) total( 201 ) undefined
1329
+ Client log (client) t+ 75413ms 1790856522907: sync stats: x10 -> 1 x20 -> 100
1330
+ Client log (client) t+ 75413ms 1790856522907: sync: p.$update({ x: 10 }); (id: 999000)
1331
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999001)
1332
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999002)
1333
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999003)
1334
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999004)
1335
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999005)
1336
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999006)
1337
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999007)
1338
+ Client log (client) t+ 75414ms 1790856522908: sync: p.$update({ x: 10 }); (id: 999008)
1339
+ Client log (client) t+ 75414ms 1790856522908: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7081ms
1340
+ Client log (client) t+ 75415ms TEST_NAME: main Started
1341
+ Client log (client) t+ 75418ms 1790856522912: sync stats: x10 -> 10 x20 -> 100
1342
+ Client log (client) t+ 75418ms 1790856522912: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7085ms
1343
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1344
+ last insert undefined
1345
+ last update undefined
1346
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1347
+ last insert undefined
1348
+ last update {"id":999000,"x":10,"last_updated":1790856522907}
1349
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1350
+ Client log (client) t+ 75448ms 1790856522942: sync stats: x10 -> 10 x20 -> 100
1351
+ Client log (client) t+ 75448ms 1790856522942: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7115ms
1352
+ upsertData (from client): inserted( 0 ) updated( 8 ) total( 9 )
1353
+ last insert undefined
1354
+ last update {"id":999008,"x":10,"y":999999,"flight_number":null,"last_updated":1790856522908}
1355
+ server.syncBatch planes: inserted( 0 ) updated( 8 ) deleted( 0 ) pushed to client( 1 ) total( 10 ) undefined
1356
+ (server): Client disconnected. socket.id: NcXAOW-BFcyyueQ2AAAA
1357
+ onSocketConnect MGXsZKLDrvHwJcgGAAAB
1358
+ (server): Client connected -> console does not work. use log function. socket.id: MGXsZKLDrvHwJcgGAAAB
1359
+ Client log (client) t+ 75450ms Disconnected
1360
+ Client log (client) t+ 76352ms Client connect.
1361
+ schemaChanged must syncHandler.destroySyncs()
1362
+ Client log (client) t+ 76469ms Reconnected
1363
+ Client log (client) t+ 76501ms TEST_NAME: main Started
1364
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1365
+ last insert undefined
1366
+ last update undefined
1367
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 152 ) total( 202 ) undefined
1368
+ Client log (client) t+ 76512ms 1790856524006: sync stats: x10 -> 10 x20 -> 100
1369
+ Client log (client) t+ 76512ms 1790856524006: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8179ms
1370
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1371
+ last insert undefined
1372
+ last update undefined x2
1373
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1374
+ Client log (client) t+ 76519ms 1790856524013: sync stats: x10 -> 10 x20 -> 100
1375
+ Client log (client) t+ 76519ms 1790856524013: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8186ms
1376
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 2 ) undefined
1377
+ ✔ concurrent useSync hooks receive inserts after reattachment and reconnect (1440.78653ms)
1378
+ ✔ React hooks (5980.157913ms)
1379
+ Client log (client) t+ 76531ms TEST_NAME: main Finished OK
1380
+ Client test successful
1381
+ (server): Stopping server ...
1382
+ ℹ tests 122
1383
+ ℹ suites 4
1384
+ ℹ pass 121
1385
+ ℹ fail 0
1386
+ ℹ cancelled 0
1387
+ ℹ skipped 1
1388
+ ℹ todo 0
1389
+ ℹ duration_ms 84621.809686
1390
+
1391
+ > server_tests@1.0.0 test-client
1392
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1393
+
1394
+ Created PubSubManager
1395
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1396
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1397
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1398
+
1399
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1400
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1401
+ id TEXT PRIMARY KEY
1402
+ , "description" TEXT
1403
+ );
1404
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1405
+
1406
+ CREATE TABLE "files" (
1407
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1408
+ "storage_key" UUID UNIQUE ,
1409
+ "extension" TEXT NOT NULL DEFAULT '' ,
1410
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1411
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1412
+ "etag" TEXT NOT NULL DEFAULT '' ,
1413
+ "original_name" TEXT NOT NULL ,
1414
+ "original_last_modified" TIMESTAMPTZ ,
1415
+ "description" TEXT ,
1416
+ "url" TEXT NOT NULL DEFAULT '' ,
1417
+ "cloud_url" TEXT ,
1418
+ "signed_url" TEXT ,
1419
+ "signed_url_expires" BIGINT ,
1420
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1421
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1422
+ "deleted" TIMESTAMPTZ ,
1423
+ "deleted_from_storage" TIMESTAMPTZ ,
1424
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1425
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1426
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1427
+ );
1428
+ CREATE TABLE "files_versions" (
1429
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1430
+ "storage_key" UUID NOT NULL ,
1431
+ "extension" TEXT NOT NULL DEFAULT '' ,
1432
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1433
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1434
+ "etag" TEXT NOT NULL DEFAULT '' ,
1435
+ "original_name" TEXT NOT NULL ,
1436
+ "original_last_modified" TIMESTAMPTZ ,
1437
+ "description" TEXT ,
1438
+ "url" TEXT NOT NULL DEFAULT '' ,
1439
+ "cloud_url" TEXT ,
1440
+ "signed_url" TEXT ,
1441
+ "signed_url_expires" BIGINT ,
1442
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1443
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1444
+ "deleted" TIMESTAMPTZ ,
1445
+ "deleted_from_storage" TIMESTAMPTZ ,
1446
+ "file_id" UUID NOT NULL ,
1447
+ "version" INTEGER NOT NULL ,
1448
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1449
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1450
+ );
1451
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1452
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1453
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1454
+ CREATE TABLE "users_public_info" (
1455
+ "id" SERIAL PRIMARY KEY ,
1456
+ "name" TEXT ,
1457
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1458
+ "sid" TEXT
1459
+ );
1460
+ DROP TABLE IF EXISTS "users";
1461
+ CREATE TABLE "users" (
1462
+ "id" SERIAL PRIMARY KEY ,
1463
+ "email" TEXT NOT NULL ,
1464
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1465
+ "type" TEXT NOT NULL ,
1466
+ "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"}' ))
1467
+ );
1468
+ DROP TABLE IF EXISTS "tjson";
1469
+ CREATE TABLE "tjson" (
1470
+ "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"}' )),
1471
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1472
+ "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"}' )),
1473
+ "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"}' )),
1474
+ "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"}' ))
1475
+ );
1476
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1477
+
1478
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1479
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1480
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1481
+ DROP TABLE IF EXISTS "api_table";
1482
+ CREATE TABLE "api_table" (
1483
+ "id" SERIAL PRIMARY KEY
1484
+ );
1485
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1486
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1487
+ (server): prostgles onReady
1488
+ (server): Waiting for client...
1489
+ (client) t+ 0ms Started client...
1490
+ onSocketConnect lDr7llOde-9Y9U33AAAA
1491
+ (server): Client connected -> console does not work. use log function. socket.id: lDr7llOde-9Y9U33AAAA
1492
+ (client) t+ 41ms Client connect.
1493
+ (client) t+ 162ms TEST_NAME: useProstgles Started
1494
+ onSocketConnect pjHYS1BLMPCaeYixAAAB
1495
+ (server): Client connected -> console does not work. use log function. socket.id: pjHYS1BLMPCaeYixAAAB
1496
+ ▶ useProstgles hook
1497
+ ✔ useProstglesClient (501.064716ms)
1498
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1499
+ (server): Client disconnected. socket.id: pjHYS1BLMPCaeYixAAAB
1500
+ schemaChanged must syncHandler.destroySyncs()
1501
+ ✔ useProstglesClient with schema reload (2458.638591ms)
1502
+ onSocketConnect o6HuvdOM9w0XvGeYAAAD
1503
+ (server): Client connected -> console does not work. use log function. socket.id: o6HuvdOM9w0XvGeYAAAD
1504
+ (server): Client disconnected. socket.id: o6HuvdOM9w0XvGeYAAAD
1505
+ Client log (client) t+ 6915ms TEST_NAME: useProstgles Finished OK
1506
+ ✔ useProstglesClient with initial skip (764.899897ms)
1507
+ ✔ useProstgles hook (3726.648022ms)
1508
+ Client test successful
1509
+ (server): Stopping server ...
1510
+ ℹ tests 3
1511
+ ℹ suites 1
1512
+ ℹ pass 3
1513
+ ℹ fail 0
1514
+ ℹ cancelled 0
1515
+ ℹ skipped 0
1516
+ ℹ todo 0
1517
+ ℹ duration_ms 15442.352147
1518
+
1519
+ > server_tests@1.0.0 test-client
1520
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1521
+
1522
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1523
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1524
+
1525
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1526
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1527
+ id TEXT PRIMARY KEY
1528
+ , "description" TEXT
1529
+ );
1530
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
1531
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
1532
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1533
+
1534
+ CREATE TABLE "files" (
1535
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1536
+ "storage_key" UUID UNIQUE ,
1537
+ "extension" TEXT NOT NULL DEFAULT '' ,
1538
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1539
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1540
+ "etag" TEXT NOT NULL DEFAULT '' ,
1541
+ "original_name" TEXT NOT NULL ,
1542
+ "original_last_modified" TIMESTAMPTZ ,
1543
+ "description" TEXT ,
1544
+ "url" TEXT NOT NULL DEFAULT '' ,
1545
+ "cloud_url" TEXT ,
1546
+ "signed_url" TEXT ,
1547
+ "signed_url_expires" BIGINT ,
1548
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1549
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1550
+ "deleted" TIMESTAMPTZ ,
1551
+ "deleted_from_storage" TIMESTAMPTZ ,
1552
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1553
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1554
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1555
+ );
1556
+ CREATE TABLE "files_versions" (
1557
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1558
+ "storage_key" UUID NOT NULL ,
1559
+ "extension" TEXT NOT NULL DEFAULT '' ,
1560
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1561
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1562
+ "etag" TEXT NOT NULL DEFAULT '' ,
1563
+ "original_name" TEXT NOT NULL ,
1564
+ "original_last_modified" TIMESTAMPTZ ,
1565
+ "description" TEXT ,
1566
+ "url" TEXT NOT NULL DEFAULT '' ,
1567
+ "cloud_url" TEXT ,
1568
+ "signed_url" TEXT ,
1569
+ "signed_url_expires" BIGINT ,
1570
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1571
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1572
+ "deleted" TIMESTAMPTZ ,
1573
+ "deleted_from_storage" TIMESTAMPTZ ,
1574
+ "file_id" UUID NOT NULL ,
1575
+ "version" INTEGER NOT NULL ,
1576
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1577
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1578
+ );
1579
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1580
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1581
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1582
+ CREATE TABLE "users_public_info" (
1583
+ "id" SERIAL PRIMARY KEY ,
1584
+ "name" TEXT ,
1585
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1586
+ "sid" TEXT
1587
+ );
1588
+ DROP TABLE IF EXISTS "users";
1589
+ CREATE TABLE "users" (
1590
+ "id" SERIAL PRIMARY KEY ,
1591
+ "email" TEXT NOT NULL ,
1592
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1593
+ "type" TEXT NOT NULL ,
1594
+ "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"}' ))
1595
+ );
1596
+ DROP TABLE IF EXISTS "tjson";
1597
+ CREATE TABLE "tjson" (
1598
+ "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"}' )),
1599
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1600
+ "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"}' )),
1601
+ "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"}' )),
1602
+ "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"}' ))
1603
+ );
1604
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1605
+
1606
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1607
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1608
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1609
+ DROP TABLE IF EXISTS "api_table";
1610
+ CREATE TABLE "api_table" (
1611
+ "id" SERIAL PRIMARY KEY
1612
+ );
1613
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1614
+ Prostgles: Created typescript schema definition file:
1615
+ DBGeneratedSchema.ts
1616
+ (server): prostgles onReady
1617
+ (server): Waiting for client...
1618
+ (client) t+ 0ms Started client...
1619
+ onSocketConnect xPpPyKBlUd6ERZN9AAAA
1620
+ (server): Client connected -> console does not work. use log function. socket.id: xPpPyKBlUd6ERZN9AAAA
1621
+ (client) t+ 30ms Client connect.
1622
+ (client) t+ 66ms TEST_NAME: files Started
1623
+ ▶ clientFileTests
1624
+ ✔ Files table is present (7.632264ms)
1625
+ ✔ Insert file from nested insert (39.95508ms)
1626
+ ✔ Cannot Insert file directly (8.930795ms)
1627
+ ✔ Disallowed updates cannot change stored bytes or create nested uploads (24.638106ms)
1628
+ ✔ Duplicate file IDs and failed validation preserve the original object (26.85603ms)
1629
+ ✔ Can update allowed files directly (47.952258ms)
1630
+ ✔ Can insert allowed files through a nested update (27.193532ms)
1631
+ Client log (client) t+ 312ms TEST_NAME: files Finished OK
1632
+ ✔ Can delete only allowed files directly (11.96799ms)
1633
+ ✔ clientFileTests (197.092257ms)
1634
+ Client test successful
1635
+ (server): Stopping server ...
1636
+ ℹ tests 8
1637
+ ℹ suites 1
1638
+ ℹ pass 8
1639
+ ℹ fail 0
1640
+ ℹ cancelled 0
1641
+ ℹ skipped 0
1642
+ ℹ todo 0
1643
+ ℹ duration_ms 8320.945089
1644
+
1645
+ > server_tests@1.0.0 test-client
1646
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1647
+
1648
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1649
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1650
+
1651
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1652
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1653
+ id TEXT PRIMARY KEY
1654
+ , "description" TEXT
1655
+ );
1656
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1657
+
1658
+ CREATE TABLE "files" (
1659
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1660
+ "storage_key" UUID UNIQUE ,
1661
+ "extension" TEXT NOT NULL DEFAULT '' ,
1662
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1663
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1664
+ "etag" TEXT NOT NULL DEFAULT '' ,
1665
+ "original_name" TEXT NOT NULL ,
1666
+ "original_last_modified" TIMESTAMPTZ ,
1667
+ "description" TEXT ,
1668
+ "url" TEXT NOT NULL DEFAULT '' ,
1669
+ "cloud_url" TEXT ,
1670
+ "signed_url" TEXT ,
1671
+ "signed_url_expires" BIGINT ,
1672
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1673
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1674
+ "deleted" TIMESTAMPTZ ,
1675
+ "deleted_from_storage" TIMESTAMPTZ ,
1676
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1677
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1678
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1679
+ );
1680
+ CREATE TABLE "files_versions" (
1681
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1682
+ "storage_key" UUID NOT NULL ,
1683
+ "extension" TEXT NOT NULL DEFAULT '' ,
1684
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1685
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1686
+ "etag" TEXT NOT NULL DEFAULT '' ,
1687
+ "original_name" TEXT NOT NULL ,
1688
+ "original_last_modified" TIMESTAMPTZ ,
1689
+ "description" TEXT ,
1690
+ "url" TEXT NOT NULL DEFAULT '' ,
1691
+ "cloud_url" TEXT ,
1692
+ "signed_url" TEXT ,
1693
+ "signed_url_expires" BIGINT ,
1694
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1695
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1696
+ "deleted" TIMESTAMPTZ ,
1697
+ "deleted_from_storage" TIMESTAMPTZ ,
1698
+ "file_id" UUID NOT NULL ,
1699
+ "version" INTEGER NOT NULL ,
1700
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1701
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1702
+ );
1703
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1704
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1705
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1706
+ CREATE TABLE "users_public_info" (
1707
+ "id" SERIAL PRIMARY KEY ,
1708
+ "name" TEXT ,
1709
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1710
+ "sid" TEXT
1711
+ );
1712
+ DROP TABLE IF EXISTS "users";
1713
+ CREATE TABLE "users" (
1714
+ "id" SERIAL PRIMARY KEY ,
1715
+ "email" TEXT NOT NULL ,
1716
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1717
+ "type" TEXT NOT NULL ,
1718
+ "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"}' ))
1719
+ );
1720
+ DROP TABLE IF EXISTS "tjson";
1721
+ CREATE TABLE "tjson" (
1722
+ "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"}' )),
1723
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1724
+ "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"}' )),
1725
+ "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"}' )),
1726
+ "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"}' ))
1727
+ );
1728
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1729
+
1730
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1731
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1732
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1733
+ DROP TABLE IF EXISTS "api_table";
1734
+ CREATE TABLE "api_table" (
1735
+ "id" SERIAL PRIMARY KEY
1736
+ );
1737
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1738
+ (server): prostgles onReady
1739
+ (server): Waiting for client...
1740
+ (client) t+ 0ms Started client...
1741
+ onSocketConnect e4kkOSHooj_ZrMoGAAAA
1742
+ (server): Client connected -> console does not work. use log function. socket.id: e4kkOSHooj_ZrMoGAAAA
1743
+ (client) t+ 28ms Client connect.
1744
+ (client) t+ 37ms TEST_NAME: rest_api Started
1745
+ ▶ clientRestApi
1746
+ ✔ Rest api test (82.141108ms)
1747
+ ✔ Rest api security (16.566374ms)
1748
+ Client log (client) t+ 140ms TEST_NAME: rest_api Finished OK
1749
+ ✔ clientRestApi (99.414633ms)
1750
+ Client test successful
1751
+ (server): Stopping server ...
1752
+ ℹ tests 2
1753
+ ℹ suites 1
1754
+ ℹ pass 2
1755
+ ℹ fail 0
1756
+ ℹ cancelled 0
1757
+ ℹ skipped 0
1758
+ ℹ todo 0
1759
+ ℹ duration_ms 8219.548242