prostgles-server 4.2.647 → 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 (115) hide show
  1. package/.github/workflows/main.yml +1 -1
  2. package/debug/als-build.log +4 -0
  3. package/debug/als-e2e.log +1747 -0
  4. package/debug/als-lint.log +4 -0
  5. package/debug/als-npm-test.log +712 -0
  6. package/debug/als-row-parts-e2e.log +1759 -0
  7. package/debug/als-row-parts-npm-test.log +716 -0
  8. package/debug/als-typecheck.log +8 -0
  9. package/debug/als-unified-build.log +4 -0
  10. package/debug/als-unified-lint.log +4 -0
  11. package/debug/als-unified-test-build.log +11 -0
  12. package/debug/als-unified-test-server.log +3444 -0
  13. package/debug/inspect-ui-sync.cjs +24 -0
  14. package/debug/subscription-cleanup-repro.log +662 -0
  15. package/debug/subscription-cleanup-trace.log +7230 -0
  16. package/debug/sync-bigint-DBGeneratedSchema.backup +489 -0
  17. package/debug/sync-bigint-build.log +4 -0
  18. package/debug/sync-bigint-client-build.log +0 -0
  19. package/debug/sync-bigint-lint.log +4 -0
  20. package/debug/sync-bigint-server-build.log +0 -0
  21. package/debug/sync-comment-DBGeneratedSchema.backup +489 -0
  22. package/debug/sync-delay-gate-DBGeneratedSchema.backup +489 -0
  23. package/debug/sync-delay-gate-build.log +0 -0
  24. package/debug/sync-diff-review-test.log +132 -0
  25. package/debug/sync-followup-build.log +4 -0
  26. package/debug/sync-notification-before.log +121 -0
  27. package/debug/sync-trigger-cleanup-before.log +134 -0
  28. package/debug/sync-trigger-fix-e2e.log +1758 -0
  29. package/debug/sync-trigger-fix-npm-test.log +1815 -0
  30. package/debug/sync-trigger-lint.log +4 -0
  31. package/debug/trace-subscription-cleanup.cjs +19 -0
  32. package/debug/ui-sync-database-snapshot.log +8 -0
  33. package/debug/ui-sync-investigation.md +30 -0
  34. package/debug/ui-sync-server-tests.log +553 -0
  35. package/dist/Audit/AuditTable.d.ts +1 -1
  36. package/dist/DboBuilder/DboBuilder.d.ts.map +1 -1
  37. package/dist/DboBuilder/DboBuilder.js +4 -2
  38. package/dist/DboBuilder/DboBuilder.js.map +1 -1
  39. package/dist/DboBuilder/DboBuilder.spec.js +3 -1
  40. package/dist/DboBuilder/DboBuilder.spec.js.map +1 -1
  41. package/dist/DboBuilder/TableHandler/TableHandler.d.ts.map +1 -1
  42. package/dist/DboBuilder/TableHandler/TableHandler.js +3 -2
  43. package/dist/DboBuilder/TableHandler/TableHandler.js.map +1 -1
  44. package/dist/DboBuilder/TableHandler/delete.d.ts.map +1 -1
  45. package/dist/DboBuilder/TableHandler/delete.js +4 -3
  46. package/dist/DboBuilder/TableHandler/delete.js.map +1 -1
  47. package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.d.ts.map +1 -1
  48. package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.js +7 -6
  49. package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.js.map +1 -1
  50. package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts +1 -1
  51. package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts.map +1 -1
  52. package/dist/DboBuilder/schema/getTablesForSchemaPostgresSQL.d.ts +2 -2
  53. package/dist/ExecutionContext.d.ts +32 -0
  54. package/dist/ExecutionContext.d.ts.map +1 -0
  55. package/dist/ExecutionContext.js +25 -0
  56. package/dist/ExecutionContext.js.map +1 -0
  57. package/dist/JSONBSchemaValidation/validateJSONBSchemaSQL.d.ts +1 -1
  58. package/dist/Prostgles.d.ts +5 -0
  59. package/dist/Prostgles.d.ts.map +1 -1
  60. package/dist/Prostgles.js +5 -0
  61. package/dist/Prostgles.js.map +1 -1
  62. package/dist/PubSubManager/PubSubManager.d.ts +9 -26
  63. package/dist/PubSubManager/PubSubManager.d.ts.map +1 -1
  64. package/dist/PubSubManager/PubSubManager.js +27 -23
  65. package/dist/PubSubManager/PubSubManager.js.map +1 -1
  66. package/dist/PubSubManager/deleteOrphanedTriggers.d.ts.map +1 -1
  67. package/dist/PubSubManager/deleteOrphanedTriggers.js +5 -3
  68. package/dist/PubSubManager/deleteOrphanedTriggers.js.map +1 -1
  69. package/dist/PubSubManager/init/getDataWatchFunctionQuery.d.ts.map +1 -1
  70. package/dist/PubSubManager/init/getDataWatchFunctionQuery.js +1 -2
  71. package/dist/PubSubManager/init/getDataWatchFunctionQuery.js.map +1 -1
  72. package/dist/PubSubManager/init/getPubSubManagerInitQuery.d.ts.map +1 -1
  73. package/dist/PubSubManager/init/getPubSubManagerInitQuery.js +3 -2
  74. package/dist/PubSubManager/init/getPubSubManagerInitQuery.js.map +1 -1
  75. package/dist/PubSubManager/notifListener.js +2 -2
  76. package/dist/PubSubManager/notifListener.js.map +1 -1
  77. package/dist/PubSubManager/refreshTriggers.d.ts.map +1 -1
  78. package/dist/PubSubManager/refreshTriggers.js +5 -3
  79. package/dist/PubSubManager/refreshTriggers.js.map +1 -1
  80. package/dist/PublishParser/PublishParser.d.ts.map +1 -1
  81. package/dist/PublishParser/PublishParser.js +14 -1
  82. package/dist/PublishParser/PublishParser.js.map +1 -1
  83. package/dist/PublishParser/getFunctionRelatedRecords.d.ts +5 -0
  84. package/dist/PublishParser/getFunctionRelatedRecords.d.ts.map +1 -0
  85. package/dist/PublishParser/getFunctionRelatedRecords.js +26 -0
  86. package/dist/PublishParser/getFunctionRelatedRecords.js.map +1 -0
  87. package/dist/index.d.ts +2 -1
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js.map +1 -1
  90. package/dist/initProstgles.d.ts +3 -0
  91. package/dist/initProstgles.d.ts.map +1 -1
  92. package/dist/initProstgles.js +1 -0
  93. package/dist/initProstgles.js.map +1 -1
  94. package/dist/runClientRequest.d.ts.map +1 -1
  95. package/dist/runClientRequest.js +6 -1
  96. package/dist/runClientRequest.js.map +1 -1
  97. package/lib/DboBuilder/DboBuilder.spec.ts +3 -7
  98. package/lib/DboBuilder/DboBuilder.ts +4 -2
  99. package/lib/DboBuilder/TableHandler/TableHandler.ts +14 -11
  100. package/lib/DboBuilder/TableHandler/delete.ts +14 -11
  101. package/lib/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.ts +28 -21
  102. package/lib/ExecutionContext.ts +60 -0
  103. package/lib/Prostgles.ts +8 -4
  104. package/lib/PubSubManager/PubSubManager.ts +31 -28
  105. package/lib/PubSubManager/deleteOrphanedTriggers.ts +5 -3
  106. package/lib/PubSubManager/init/getDataWatchFunctionQuery.ts +1 -2
  107. package/lib/PubSubManager/init/getPubSubManagerInitQuery.ts +3 -2
  108. package/lib/PubSubManager/notifListener.ts +2 -2
  109. package/lib/PubSubManager/refreshTriggers.ts +7 -5
  110. package/lib/PublishParser/PublishParser.ts +17 -1
  111. package/lib/PublishParser/getFunctionRelatedRecords.ts +25 -0
  112. package/lib/index.ts +2 -4
  113. package/lib/initProstgles.ts +5 -4
  114. package/lib/runClientRequest.ts +16 -8
  115. package/package.json +1 -1
@@ -0,0 +1,1758 @@
1
+
2
+ > prostgles-server@4.2.647 test-only
3
+ > cd tests/ && ./test.sh
4
+
5
+
6
+ > prostgles-server@4.2.647 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 601ms
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 (1617.2841ms)
27
+ ✔ useAsyncEffectQueue executes the first and debounces the rest if still mounted (1511.212559ms)
28
+ ✔ React hooks (3129.402885ms)
29
+ ℹ tests 2
30
+ ℹ suites 1
31
+ ℹ pass 2
32
+ ℹ fail 0
33
+ ℹ cancelled 0
34
+ ℹ skipped 0
35
+ ℹ todo 0
36
+ ℹ duration_ms 3419.372319
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 4s
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.647 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
+ ▶ Server Only Queries
157
+ ✔ column definition row types support SQL aliases, arrays and generated columns (12.186993ms)
158
+ ✔ lookup types propagate through database references while preserving overrides (10.80221ms)
159
+ ✔ lookup types follow FK chains by column and terminate cycles (119.624591ms)
160
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
161
+
162
+ CREATE TABLE "files" (
163
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
164
+ "storage_key" UUID UNIQUE ,
165
+ "extension" TEXT NOT NULL DEFAULT '' ,
166
+ "content_type" TEXT NOT NULL DEFAULT '' ,
167
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
168
+ "etag" TEXT NOT NULL DEFAULT '' ,
169
+ "original_name" TEXT NOT NULL ,
170
+ "original_last_modified" TIMESTAMPTZ ,
171
+ "description" TEXT ,
172
+ "url" TEXT NOT NULL DEFAULT '' ,
173
+ "cloud_url" TEXT ,
174
+ "signed_url" TEXT ,
175
+ "signed_url_expires" BIGINT ,
176
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
177
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
178
+ "deleted" TIMESTAMPTZ ,
179
+ "deleted_from_storage" TIMESTAMPTZ ,
180
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
181
+ );
182
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
183
+ Prostgles: Created typescript schema definition file:
184
+ DBGeneratedSchema.ts
185
+ Prostgles: Created typescript schema definition file:
186
+ DBGeneratedSchema.ts
187
+ ▶ client publish profiles compile at startup and follow user types
188
+ ✔ server user handlers enforce permissions and reject client impersonation (42.822921ms)
189
+ ✔ a rejected guest abort cannot cancel a later server-user query (2.826547ms)
190
+ ✔ caught subscription errors still roll back client transactions (2.850152ms)
191
+ ✔ caught checkFilter errors still roll back client transactions (7.153348ms)
192
+ ✔ caught postValidate errors still roll back client transactions (2.976232ms)
193
+ No options changed
194
+ Prostgles: Created typescript schema definition file:
195
+ DBGeneratedSchema.ts
196
+ Prostgles: Created typescript schema definition file:
197
+ DBGeneratedSchema.ts
198
+ Prostgles: Created typescript schema definition file:
199
+ DBGeneratedSchema.ts
200
+ Prostgles: Created typescript schema definition file:
201
+ DBGeneratedSchema.ts
202
+ destroying prgl instance
203
+ ✔ server user handlers require configured authentication (1.397043ms)
204
+ ✔ client publish profiles compile at startup and follow user types (2005.435856ms)
205
+ ▶ Managed storage permission and transaction safety
206
+ ✔ legacy ID-based files remain readable and replaceable (27.166381ms)
207
+ ✔ custom columns do not require or interfere with file data (25.102963ms)
208
+ ✔ filtered updates and failed validation preserve storage (10.031021ms)
209
+ ✔ failed uploads and application hooks leave no replacement objects (24.257407ms)
210
+ ✔ duplicate IDs, conflict updates and SQL-only requests cannot overwrite (23.711865ms)
211
+ ✔ PostgreSQL update policies are enforced before uploading (8.169796ms)
212
+ ✔ RLS-hidden references fail closed during storage cleanup (3.506921ms)
213
+ ✔ beforeEach lifecycle callbacks follow the outer transaction (31.345484ms)
214
+ ✔ outer rollback preserves replaced and deleted objects (26.370091ms)
215
+ ✔ a failed multi-insert waits for other uploads before cleanup (5.513029ms)
216
+ ✔ concurrent replacements leave one complete referenced object (27.184581ms)
217
+ ✔ version retention removes only unreferenced objects (39.498114ms)
218
+ ✔ foreign-key failure preserves bytes and deletion waits for commit (18.452649ms)
219
+ ✔ cloud downloads and cleanup use the committed storage key (49.288224ms)
220
+ ✔ Managed storage permission and transaction safety (342.251245ms)
221
+ destroying prgl instance
222
+ destroying prgl instance
223
+ ✔ custom joins add conditions unless override is requested (2313.742491ms)
224
+ destroying prgl instance
225
+ ✔ custom self joins use configured paths and override inferred joins (1163.598478ms)
226
+ destroying prgl instance
227
+ destroying prgl instance
228
+ destroying prgl instance
229
+ ✔ destroy allows reusing Socket.IO on a running HTTP server (3345.075656ms)
230
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
231
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
232
+
233
+ CREATE TABLE "audit_events" (
234
+ "id" BIGSERIAL PRIMARY KEY ,
235
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
236
+ "schema_name" TEXT NOT NULL ,
237
+ "table_name" TEXT NOT NULL ,
238
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
239
+ "old_id" JSONB ,
240
+ "new_id" JSONB ,
241
+ "old_row" JSONB ,
242
+ "new_row" JSONB ,
243
+ "actor" JSONB ,
244
+ "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"}' ))
245
+ );
246
+ CREATE TABLE "audit_test_files" (
247
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
248
+ "storage_key" UUID UNIQUE ,
249
+ "extension" TEXT NOT NULL DEFAULT '' ,
250
+ "content_type" TEXT NOT NULL DEFAULT '' ,
251
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
252
+ "etag" TEXT NOT NULL DEFAULT '' ,
253
+ "original_name" TEXT NOT NULL ,
254
+ "original_last_modified" TIMESTAMPTZ ,
255
+ "description" TEXT ,
256
+ "url" TEXT NOT NULL DEFAULT '' ,
257
+ "cloud_url" TEXT ,
258
+ "signed_url" TEXT ,
259
+ "signed_url_expires" BIGINT ,
260
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
261
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
262
+ "deleted" TIMESTAMPTZ ,
263
+ "deleted_from_storage" TIMESTAMPTZ ,
264
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
265
+ );
266
+ CREATE TABLE "audit_test_source" (
267
+ "a" int NOT NULL ,
268
+ "b" text NOT NULL ,
269
+ "value" text ,
270
+ "secret" text
271
+ );
272
+ ALTER TABLE "audit_test_source" ADD PRIMARY KEY (a, b);
273
+ CREATE TABLE "audit_test_documents" (
274
+ "id" serial PRIMARY KEY ,
275
+ "file_id" uuid NOT NULL REFERENCES audit_test_files(id)
276
+ );
277
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
278
+ IO missing. Publish has no effect without io or restApi
279
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
280
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
281
+ IO missing. Publish has no effect without io or restApi
282
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
283
+ IO missing. Publish has no effect without io or restApi
284
+ destroying prgl instance
285
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
286
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
287
+ IO missing. Publish has no effect without io or restApi
288
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
289
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
290
+ IO missing. Publish has no effect without io or restApi
291
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
292
+ Trace: Error: audit.tables cannot mix enabled and disabled entries
293
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:19:15)
294
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:135:56)
295
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:147:28)
296
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
297
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
298
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
299
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:198:17)
300
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
301
+ at async waitForActual (node:assert:646:5)
302
+ at async strict.rejects (node:assert:769:25)
303
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
304
+ at async Test.run (node:internal/test_runner/test:1125:7)
305
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
306
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
307
+ Trace: Error: Unknown audit table: missing_table
308
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:23:19)
309
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:135:56)
310
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:147:28)
311
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
312
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
313
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
314
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:198:17)
315
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
316
+ at async waitForActual (node:assert:646:5)
317
+ at async strict.rejects (node:assert:769:25)
318
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
319
+ at async Test.run (node:internal/test_runner/test:1125:7)
320
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
321
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
322
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
323
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
324
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:135:56)
325
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:147:28)
326
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
327
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
328
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
329
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:198:17)
330
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
331
+ at async waitForActual (node:assert:646:5)
332
+ at async strict.rejects (node:assert:769:25)
333
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
334
+ at async Test.run (node:internal/test_runner/test:1125:7)
335
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
336
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
337
+ Trace: Error: Unsupported audit target: audit_test_view
338
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:37:23)
339
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:135:56)
340
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:147:28)
341
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
342
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
343
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
344
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:198:17)
345
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
346
+ at async waitForActual (node:assert:646:5)
347
+ at async strict.rejects (node:assert:769:25)
348
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
349
+ at async Test.run (node:internal/test_runner/test:1125:7)
350
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
351
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
352
+ Trace: Error: Audit identity columns cannot be excluded: audit_test_source
353
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:54:19)
354
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:135:56)
355
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:147:28)
356
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
357
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
358
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
359
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:198:17)
360
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
361
+ at async waitForActual (node:assert:646:5)
362
+ at async strict.rejects (node:assert:769:25)
363
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
364
+ at async Test.run (node:internal/test_runner/test:1125:7)
365
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
366
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
367
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
368
+ IO missing. Publish has no effect without io or restApi
369
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
370
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
371
+ IO missing. Publish has no effect without io or restApi
372
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
373
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
374
+ IO missing. Publish has no effect without io or restApi
375
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
376
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
377
+ IO missing. Publish has no effect without io or restApi
378
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-UYOKHE/init.sql
379
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
380
+ IO missing. Publish has no effect without io or restApi
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: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
384
+ IO missing. Publish has no effect without io or restApi
385
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
386
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
387
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:135:56)
388
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:147:28)
389
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
390
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
391
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
392
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:198:17)
393
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
394
+ at async updateConfiguration (/home/s/prostgles-server-js/dist/updateConfiguration.js:58:9)
395
+ at async Object.update (/home/s/prostgles-server-js/dist/initProstgles.js:162:17)
396
+ at async waitForActual (node:assert:646:5)
397
+ at async strict.rejects (node:assert:769:25)
398
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:535:13)
399
+ at async Test.run (node:internal/test_runner/test:1125:7)
400
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
401
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
402
+ IO missing. Publish has no effect without io or restApi
403
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
404
+
405
+ CREATE TABLE "audit_next_events" (
406
+ "id" BIGSERIAL PRIMARY KEY ,
407
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
408
+ "schema_name" TEXT NOT NULL ,
409
+ "table_name" TEXT NOT NULL ,
410
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
411
+ "old_id" JSONB ,
412
+ "new_id" JSONB ,
413
+ "old_row" JSONB ,
414
+ "new_row" JSONB ,
415
+ "actor" JSONB ,
416
+ "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"}' ))
417
+ );
418
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
419
+ IO missing. Publish has no effect without io or restApi
420
+ destroying prgl instance
421
+ ✔ Managed audit setup, row history, protection, access and query readiness (7623.257037ms)
422
+ ✔ getJSONBSchemaValidationErrorAsync with real db handlers (2.92581ms)
423
+ ✔ Parallel subscription at init causing crash in getPubSubManager: duplicate key value violates unique constraint "apps_pkey" (101.282744ms)
424
+ ✔ RLS context is isolated across implicit transactions, commit, rollback and pool reuse (12.897774ms)
425
+ ✔ subscription and sync reads isolate users with a real RLS policy (12.735761ms)
426
+ ✔ ordinary beforeEach hooks transform inputs before validation (25.498591ms)
427
+ ✔ multi false is checked after beforeEach and rolls back the update (11.280622ms)
428
+ ✔ ordinary beforeEach hooks run before PostgreSQL UPDATE policy checks (8.022439ms)
429
+ ✔ before and after hooks preserve RLS across dbx and raw tx calls (11.339534ms)
430
+ ▶ post-transaction hooks receive committed and authenticated context
431
+ ✔ afterCommit runs after commit, filters changed fields and skips rollback (11.914803ms)
432
+ ✔ clearing a watched field runs before, after and commit hooks (4.014786ms)
433
+ ✔ client updateBatch runs hooks atomically in implicit and explicit transactions (25.727999ms)
434
+ destroying prgl instance
435
+ ✔ server-user requests preserve tenant_id from sessionFields (1.197151ms)
436
+ ✔ post-transaction hooks receive committed and authenticated context (1196.62276ms)
437
+ ✔ Self reference recursion bug (1.45751ms)
438
+ ✔ Transactions (7.282524ms)
439
+ (server): Server-only query tests successful
440
+ (server): Starting isomorphic queries
441
+ ✔ TableConfig onMount works (1.617916ms)
442
+ ✔ Server Only Queries (18330.68132ms)
443
+ (server): DELETING items
444
+ ▶ Isomorphic queries
445
+ ✔ Deleting stale data (27.164583ms)
446
+ ✔ Error structure malformed array literal (10.775669ms)
447
+ ✔ Table info (0.317464ms)
448
+ ✔ Prepare data (26.625833ms)
449
+ ✔ Test bytea (3.4561ms)
450
+ ✔ abortSignal terminates a running query (5526.363962ms)
451
+ ✔ Client queries are aborted no more than after n seconds (0.207092ms)
452
+ ✔ Subscription tracked_columns get merged correctly (19.528261ms)
453
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (937.97111ms)
454
+ ✔ CASE select and subscription dependencies (631.642207ms)
455
+ ✔ Subscription tracks non-selected ORDER BY columns (633.301121ms)
456
+ ✔ merge json (6.004595ms)
457
+ ✔ json array converted to pg array filter bug (0.763769ms)
458
+ ✔ onConflict do update (4.208444ms)
459
+ ✔ Local file upload (25.259261ms)
460
+ ✔ Local file delete (23.502864ms)
461
+ ✔ Local file update (22.386893ms)
462
+ ✔ getColumns definition (1.166404ms)
463
+ ✔ returnType (0.452633ms)
464
+ ✔ Table config triggers (7.173269ms)
465
+ ✔ $unnest_words (1.402044ms)
466
+ ✔ Group by/Distinct (1.795464ms)
467
+ ✔ sql returntype default-with-rollback (15.05916ms)
468
+ ✔ returnType: value (1.189463ms)
469
+ ✔ PostgreSQL array element (5.011105ms)
470
+ ✔ FTS filtering (4.980213ms)
471
+ ✔ $term_highlight (3.895945ms)
472
+ ✔ funcFilters: $term_highlight (2.215618ms)
473
+ (server): [{"name":null}]
474
+ (server): [{"name":"zz3zz1"}]
475
+ (server): []
476
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (834.374833ms)
477
+ (server): [{"name":null}]
478
+ (server): [{"name":"zz3zz1"}]
479
+ (server): [{"name":"zz3zz1"}]
480
+ (server): [{"name":"zz3zz1"}]
481
+ (server): []
482
+ ✔ subscribe skipChangedColumnsCheck true (3343.922136ms)
483
+ unsubscribe start - various
484
+ unsubscribe end - various
485
+ ✔ subscribe (22.505828ms)
486
+ ✔ subscribe to schema.table (11.73672ms)
487
+ ✔ parallel subscriptions (2020.364646ms)
488
+ (server): updateAll done in 1570
489
+ (server): updateAll done in 1574
490
+ (server): updateAll done in 1873
491
+ ✔ subscriptions do not serialize transactions (9531.728141ms)
492
+ Created PubSubManager
493
+ throttling sub for 1700 ms
494
+ ✔ subscribeOne with throttle (1724.168878ms)
495
+ throttling finished. pushSubData...
496
+ throttling sub for 1700 ms
497
+ ✔ subscribeOne with throttle skipFirst: true (1708.536887ms)
498
+ ✔ subscribeOne without skipFirst (1027.092286ms)
499
+ ✔ subscribeOne with skipFirst: true (1511.554855ms)
500
+ ✔ subscribeOne actions: { insert: true } (1534.248703ms)
501
+ ✔ subscribeOne actions: { insert: false } (1538.168221ms)
502
+ ✔ JSON filtering (2.525012ms)
503
+ ✔ Complex filtering (1.821286ms)
504
+ ✔ template_string function (1.535501ms)
505
+ ✔ Between filtering (2.040906ms)
506
+ ✔ In filtering (1.435577ms)
507
+ ✔ Order by (1.591736ms)
508
+ ✔ Order by aliased func (0.912092ms)
509
+ ✔ Filter by aliased func (0.970944ms)
510
+ ✔ Count with Filter by aliased func (1.455856ms)
511
+ ✔ Count with Aggregate and Filter by aliased func (1.423802ms)
512
+ ✔ Count with complex filter (1.35455ms)
513
+ ✔ Order by aggregation (0.798032ms)
514
+ ✔ Aggregate FILTER and ORDER BY (1.045868ms)
515
+ ✔ Column alias func (0.840041ms)
516
+ ✔ Order by colliding alias name (0.778988ms)
517
+ ✔ Update batch example (11.06348ms)
518
+ TODO: socket.io stringifies dates
519
+ ✔ Function example (8.708033ms)
520
+ ✔ JSONB filtering (4.176532ms)
521
+ ✔ Postgis examples (7.429164ms)
522
+ ✔ jsonbSchema validation (7.403894ms)
523
+ ✔ find and findOne (1.223578ms)
524
+ ✔ Result size (1.087647ms)
525
+ ✔ Basic exists (2.257776ms)
526
+ ✔ Basic fts with shorthand notation (2.455924ms)
527
+ ✔ Exists with shortest path wildcard filter example (1.876214ms)
528
+ ✔ Exists with exact path filter example (1.169959ms)
529
+ ✔ Not Exists with exact path filter example (1.216762ms)
530
+ ✔ Upsert example (15.249815ms)
531
+ ✔ Joins example (16.166213ms)
532
+ ✔ Joins repeating table example (3.04184ms)
533
+ ✔ Join aggregate functions example (11.234164ms)
534
+ ✔ $rowhash example (22.982541ms)
535
+ ✔ Reference column nested insert (6.055519ms)
536
+ ✔ Join escaped table names with quotes (8.743895ms)
537
+ (server): {
538
+ "item": {
539
+ "\"id0\"": 1,
540
+ "\"quoted1_id\"": 1,
541
+ "\"text_col0\"": "0"
542
+ },
543
+ "runs": 0
544
+ }
545
+ (server): {
546
+ "item": {
547
+ "\"id0\"": 1,
548
+ "\"quoted1_id\"": 1,
549
+ "\"text_col0\"": "1"
550
+ },
551
+ "runs": 1
552
+ }
553
+ unsubscribe start - """quoted0"""
554
+ unsubscribe end - """quoted0"""
555
+ ✔ subscribe to escaped table name (13.909222ms)
556
+ ✔ subscribe using a filter bigger than block_size (16.064541ms)
557
+ ✔ Reverse join with agg (12.724145ms)
558
+ {
559
+ _rows: [
560
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
561
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
562
+ ],
563
+ runs: 1
564
+ }
565
+ {
566
+ _rows: [
567
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
568
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
569
+ ],
570
+ runs: 2
571
+ }
572
+ ✔ Related table subscribe (9036.799447ms)
573
+ ✔ Aggregate FILTER registers joined dependency triggers (640.380765ms)
574
+ ✔ Nested sort by computed col (6.858404ms)
575
+ ✔ Nested function on different than source column getNewQuery name bug fix (1.351492ms)
576
+ ✔ Reference column deep nested insert (16.17767ms)
577
+ ✔ Multi reference column nested insert (10.837057ms)
578
+ ✔ Join path with order by nested (7.723586ms)
579
+ ✔ Self join (16.371738ms)
580
+ ✔ One to many multi join duplicate row bug fix (11.136272ms)
581
+ (server): various id=99 count
582
+ (server): various id=99 count
583
+ ok
584
+ (server): various id=99 count
585
+ (server): Error in subscription callback: {"message":"column prostgles_root_table_alias.name does not exist","length":130,"name":"error","severity":"ERROR","code":"42703","position":"107","file":"parse_relation.c","line":"3665","routine":"errorMissingColumn","query":"-- prostgles query id: 34971730-d38b-41a4-a074-edcd1190f3e4\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"}
586
+ ok
587
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6524.628857ms)
588
+ ✔ Isomorphic queries (49225.122349ms)
589
+ ✔ Having clause (0.916436ms)
590
+ ✔ Having clause with complex filter (0.787462ms)
591
+ (server): Server isomorphic tests successful
592
+ (server): Stopping server ...
593
+ ℹ tests 134
594
+ ℹ suites 2
595
+ ℹ pass 134
596
+ ℹ fail 0
597
+ ℹ cancelled 0
598
+ ℹ skipped 0
599
+ ℹ todo 0
600
+ ℹ duration_ms 73328.778095
601
+
602
+ > server_tests@1.0.0 test-client
603
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
604
+
605
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
606
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
607
+
608
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
609
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
610
+ id TEXT PRIMARY KEY
611
+ , "description" TEXT
612
+ );
613
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
614
+
615
+ CREATE TABLE "files" (
616
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
617
+ "storage_key" UUID UNIQUE ,
618
+ "extension" TEXT NOT NULL DEFAULT '' ,
619
+ "content_type" TEXT NOT NULL DEFAULT '' ,
620
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
621
+ "etag" TEXT NOT NULL DEFAULT '' ,
622
+ "original_name" TEXT NOT NULL ,
623
+ "original_last_modified" TIMESTAMPTZ ,
624
+ "description" TEXT ,
625
+ "url" TEXT NOT NULL DEFAULT '' ,
626
+ "cloud_url" TEXT ,
627
+ "signed_url" TEXT ,
628
+ "signed_url_expires" BIGINT ,
629
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
630
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
631
+ "deleted" TIMESTAMPTZ ,
632
+ "deleted_from_storage" TIMESTAMPTZ ,
633
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
634
+ "version" INTEGER NOT NULL DEFAULT 1 ,
635
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
636
+ );
637
+ CREATE TABLE "files_versions" (
638
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
639
+ "storage_key" UUID NOT NULL ,
640
+ "extension" TEXT NOT NULL DEFAULT '' ,
641
+ "content_type" TEXT NOT NULL DEFAULT '' ,
642
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
643
+ "etag" TEXT NOT NULL DEFAULT '' ,
644
+ "original_name" TEXT NOT NULL ,
645
+ "original_last_modified" TIMESTAMPTZ ,
646
+ "description" TEXT ,
647
+ "url" TEXT NOT NULL DEFAULT '' ,
648
+ "cloud_url" TEXT ,
649
+ "signed_url" TEXT ,
650
+ "signed_url_expires" BIGINT ,
651
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
652
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
653
+ "deleted" TIMESTAMPTZ ,
654
+ "deleted_from_storage" TIMESTAMPTZ ,
655
+ "file_id" UUID NOT NULL ,
656
+ "version" INTEGER NOT NULL ,
657
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
658
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
659
+ );
660
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
661
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
662
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
663
+ CREATE TABLE "users_public_info" (
664
+ "id" SERIAL PRIMARY KEY ,
665
+ "name" TEXT ,
666
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
667
+ "sid" TEXT
668
+ );
669
+ DROP TABLE IF EXISTS "users";
670
+ CREATE TABLE "users" (
671
+ "id" SERIAL PRIMARY KEY ,
672
+ "email" TEXT NOT NULL ,
673
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
674
+ "type" TEXT NOT NULL ,
675
+ "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"}' ))
676
+ );
677
+ DROP TABLE IF EXISTS "tjson";
678
+ CREATE TABLE "tjson" (
679
+ "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"}' )),
680
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
681
+ "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"}' )),
682
+ "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"}' )),
683
+ "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"}' ))
684
+ );
685
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
686
+
687
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
688
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
689
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
690
+ DROP TABLE IF EXISTS "api_table";
691
+ CREATE TABLE "api_table" (
692
+ "id" SERIAL PRIMARY KEY
693
+ );
694
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
695
+ (server): prostgles onReady
696
+ (server): Waiting for client...
697
+ (client) t+ 0ms Started client...
698
+ onSocketConnect 1tcenshyGjsMuzCeAAAA
699
+ (server): Client connected -> console does not work. use log function. socket.id: 1tcenshyGjsMuzCeAAAA
700
+ (client) t+ 40ms Client connect.
701
+ (client) t+ 175ms TEST_NAME: syncTriggerCleanup Started
702
+ Created PubSubManager
703
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
704
+ ✔ unsubscribe cleanup preserves a sync being registered (2671.8342ms)
705
+ Client log (client) t+ 2851ms TEST_NAME: syncTriggerCleanup Finished OK
706
+ Client test successful
707
+ (server): Stopping server ...
708
+ ℹ tests 1
709
+ ℹ suites 0
710
+ ℹ pass 1
711
+ ℹ fail 0
712
+ ℹ cancelled 0
713
+ ℹ skipped 0
714
+ ℹ todo 0
715
+ ℹ duration_ms 11096.514469
716
+
717
+ > server_tests@1.0.0 test-client
718
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
719
+
720
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
721
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
722
+
723
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
724
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
725
+ id TEXT PRIMARY KEY
726
+ , "description" TEXT
727
+ );
728
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
729
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
730
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
731
+
732
+ CREATE TABLE "files" (
733
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
734
+ "storage_key" UUID UNIQUE ,
735
+ "extension" TEXT NOT NULL DEFAULT '' ,
736
+ "content_type" TEXT NOT NULL DEFAULT '' ,
737
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
738
+ "etag" TEXT NOT NULL DEFAULT '' ,
739
+ "original_name" TEXT NOT NULL ,
740
+ "original_last_modified" TIMESTAMPTZ ,
741
+ "description" TEXT ,
742
+ "url" TEXT NOT NULL DEFAULT '' ,
743
+ "cloud_url" TEXT ,
744
+ "signed_url" TEXT ,
745
+ "signed_url_expires" BIGINT ,
746
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
747
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
748
+ "deleted" TIMESTAMPTZ ,
749
+ "deleted_from_storage" TIMESTAMPTZ ,
750
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
751
+ "version" INTEGER NOT NULL DEFAULT 1 ,
752
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
753
+ );
754
+ CREATE TABLE "files_versions" (
755
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
756
+ "storage_key" UUID NOT NULL ,
757
+ "extension" TEXT NOT NULL DEFAULT '' ,
758
+ "content_type" TEXT NOT NULL DEFAULT '' ,
759
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
760
+ "etag" TEXT NOT NULL DEFAULT '' ,
761
+ "original_name" TEXT NOT NULL ,
762
+ "original_last_modified" TIMESTAMPTZ ,
763
+ "description" TEXT ,
764
+ "url" TEXT NOT NULL DEFAULT '' ,
765
+ "cloud_url" TEXT ,
766
+ "signed_url" TEXT ,
767
+ "signed_url_expires" BIGINT ,
768
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
769
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
770
+ "deleted" TIMESTAMPTZ ,
771
+ "deleted_from_storage" TIMESTAMPTZ ,
772
+ "file_id" UUID NOT NULL ,
773
+ "version" INTEGER NOT NULL ,
774
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
775
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
776
+ );
777
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
778
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
779
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
780
+ CREATE TABLE "users_public_info" (
781
+ "id" SERIAL PRIMARY KEY ,
782
+ "name" TEXT ,
783
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
784
+ "sid" TEXT
785
+ );
786
+ DROP TABLE IF EXISTS "users";
787
+ CREATE TABLE "users" (
788
+ "id" SERIAL PRIMARY KEY ,
789
+ "email" TEXT NOT NULL ,
790
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
791
+ "type" TEXT NOT NULL ,
792
+ "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"}' ))
793
+ );
794
+ DROP TABLE IF EXISTS "tjson";
795
+ CREATE TABLE "tjson" (
796
+ "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"}' )),
797
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
798
+ "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"}' )),
799
+ "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"}' )),
800
+ "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"}' ))
801
+ );
802
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
803
+
804
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
805
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
806
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
807
+ DROP TABLE IF EXISTS "api_table";
808
+ CREATE TABLE "api_table" (
809
+ "id" SERIAL PRIMARY KEY
810
+ );
811
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
812
+ (server): prostgles onReady
813
+ (server): Waiting for client...
814
+ (client) t+ 0ms Started client...
815
+ onSocketConnect fyirjqS4loqrh3XfAAAA
816
+ (server): Client connected -> console does not work. use log function. socket.id: fyirjqS4loqrh3XfAAAA
817
+ (client) t+ 42ms Client connect.
818
+ (client) t+ 180ms TEST_NAME: main Started
819
+ Client log (client) t+ 192ms Starting isomorphic queries
820
+ ▶ Isomorphic queries
821
+ ✔ Deleting stale data (26.587157ms)
822
+ {
823
+ message: 'malformed array literal: "a"',
824
+ length: 149,
825
+ name: 'error',
826
+ severity: 'ERROR',
827
+ code: '22P02',
828
+ detail: 'Array value must start with "{" or dimension information.',
829
+ position: '325',
830
+ file: 'arrayfuncs.c',
831
+ line: '317',
832
+ routine: 'array_in',
833
+ query: '-- prostgles query id: 44d5e304-f162-4088-a59f-2450f4980cd3\n' +
834
+ 'SET LOCAL "prostgles.user" \n' +
835
+ `TO '{"id":"1","type":"public"}';\n` +
836
+ 'SELECT \n' +
837
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
838
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
839
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
840
+ ' FROM ( \n' +
841
+ ' SELECT * \n' +
842
+ ' FROM items \n' +
843
+ ` WHERE "h" = 'a' \n` +
844
+ ' ) prostgles_root_table_alias \n' +
845
+ ' LIMIT 0',
846
+ code_info: 'invalid_text_representation'
847
+ }
848
+ {
849
+ message: 'malformed array literal: "a"',
850
+ length: 149,
851
+ name: 'error',
852
+ severity: 'ERROR',
853
+ code: '22P02',
854
+ detail: 'Array value must start with "{" or dimension information.',
855
+ position: '325',
856
+ file: 'arrayfuncs.c',
857
+ line: '317',
858
+ routine: 'array_in',
859
+ query: '-- prostgles query id: 1173a843-652c-4b5e-a544-8841a49960fe\n' +
860
+ 'SET LOCAL "prostgles.user" \n' +
861
+ `TO '{"id":"1","type":"public"}';\n` +
862
+ 'SELECT \n' +
863
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
864
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
865
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
866
+ ' FROM ( \n' +
867
+ ' SELECT * \n' +
868
+ ' FROM items \n' +
869
+ ` WHERE "h" = 'a' \n` +
870
+ ' ) prostgles_root_table_alias \n' +
871
+ ' LIMIT 0',
872
+ code_info: 'invalid_text_representation'
873
+ }
874
+ ✔ Error structure malformed array literal (26.464386ms)
875
+ ✔ Table info (1.647526ms)
876
+ ✔ Prepare data (43.979915ms)
877
+ ✔ Test bytea (6.045765ms)
878
+ ✔ abortSignal terminates a running query (5530.802856ms)
879
+ ✔ Client queries are aborted no more than after n seconds (14004.530687ms)
880
+ ✔ Subscription tracked_columns get merged correctly (0.306773ms)
881
+ Created PubSubManager
882
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (952.166617ms)
883
+ ✔ CASE select and subscription dependencies (637.495911ms)
884
+ ✔ Subscription tracks non-selected ORDER BY columns (628.336532ms)
885
+ ✔ merge json (11.405803ms)
886
+ ✔ json array converted to pg array filter bug (1.272213ms)
887
+ ✔ onConflict do update (8.495038ms)
888
+ ✔ Local file upload (30.932534ms)
889
+ ✔ Local file delete (17.457675ms)
890
+ ✔ Local file update (46.656239ms)
891
+ ✔ getColumns definition (1.768118ms)
892
+ ✔ returnType (0.777143ms)
893
+ ✔ Table config triggers (10.942601ms)
894
+ ✔ $unnest_words (1.927943ms)
895
+ ✔ Group by/Distinct (3.405359ms)
896
+ ✔ sql returntype default-with-rollback (28.870987ms)
897
+ ✔ returnType: value (1.287344ms)
898
+ ✔ PostgreSQL array element (7.370352ms)
899
+ ✔ FTS filtering (5.814891ms)
900
+ ✔ $term_highlight (3.807296ms)
901
+ ✔ funcFilters: $term_highlight (2.123358ms)
902
+ Client log (client) t+ 22251ms [{"name":null}]
903
+ Client log (client) t+ 22254ms [{"name":"zz3zz1"}]
904
+ Pushing 1 rows to socket x9
905
+ Client log (client) t+ 22874ms []
906
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (831.954455ms)
907
+ Pushing 0 rows to socket
908
+ Client log (client) t+ 25594ms [{"name":null}]
909
+ Client log (client) t+ 25599ms [{"name":"zz3zz1"}]
910
+ Client log (client) t+ 25812ms [{"name":"zz3zz1"}]
911
+ Client log (client) t+ 26016ms [{"name":"zz3zz1"}]
912
+ Pushing 1 rows to socket x4
913
+ Client log (client) t+ 26228ms []
914
+ ✔ subscribe skipChangedColumnsCheck true (3353.180562ms)
915
+ Pushing 0 rows to socket
916
+ Pushing 1 rows to socket x4
917
+ Client log unsubscribe start - various
918
+ Client log unsubscribe end - various
919
+ ✔ subscribe (32.585904ms)
920
+ Pushing 0 rows to socket
921
+ Pushing 1 rows to socket
922
+ ✔ subscribe to schema.table (11.418863ms)
923
+ Pushing 2 rows to socket
924
+ ✔ parallel subscriptions (2005.774972ms)
925
+ Client log (client) t+ 32577ms updateAll done in 1596
926
+ Client log (client) t+ 34161ms updateAll done in 1581
927
+ Pushing 0 rows to socket
928
+ Pushing 3 rows to socket
929
+ Pushing 996 rows to socket
930
+ Client log (client) t+ 36145ms updateAll done in 1977
931
+ Pushing 1000 rows to socket x2
932
+ ✔ subscriptions do not serialize transactions (9674.2937ms)
933
+ Pushing 3 rows to socket
934
+ Pushing 1 rows to socket
935
+ throttling sub for 1700 ms
936
+ throttling finished. pushSubData...
937
+ Pushing 1 rows to socket
938
+ throttling sub for 1700 ms
939
+ ✔ subscribeOne with throttle (1735.925651ms)
940
+ throttling sub for 1700 ms
941
+ throttling finished. pushSubData...
942
+ ✔ subscribeOne with throttle skipFirst: true (1702.235194ms)
943
+ Pushing 1 rows to socket
944
+ throttling finished. pushSubData...
945
+ Pushing 1 rows to socket
946
+ ✔ subscribeOne without skipFirst (1018.282515ms)
947
+ Pushing 0 rows to socket
948
+ Pushing 1 rows to socket
949
+ ✔ subscribeOne with skipFirst: true (1511.702088ms)
950
+ Pushing 0 rows to socket x2
951
+ ✔ subscribeOne actions: { insert: true } (1527.085691ms)
952
+ Pushing 1 rows to socket
953
+ ✔ subscribeOne actions: { insert: false } (1522.748751ms)
954
+ ✔ JSON filtering (3.057234ms)
955
+ ✔ Complex filtering (3.284718ms)
956
+ ✔ template_string function (3.508168ms)
957
+ ✔ Between filtering (2.547712ms)
958
+ ✔ In filtering (2.344941ms)
959
+ ✔ Order by (2.864185ms)
960
+ ✔ Order by aliased func (1.848078ms)
961
+ ✔ Filter by aliased func (1.64434ms)
962
+ ✔ Count with Filter by aliased func (2.384965ms)
963
+ ✔ Count with Aggregate and Filter by aliased func (2.41755ms)
964
+ ✔ Count with complex filter (2.285149ms)
965
+ ✔ Order by aggregation (1.908411ms)
966
+ ✔ Aggregate FILTER and ORDER BY (1.651967ms)
967
+ ✔ Column alias func (1.38051ms)
968
+ ✔ Order by colliding alias name (1.368688ms)
969
+ ✔ Update batch example (4.877226ms)
970
+ Client log TODO: socket.io stringifies dates
971
+ ✔ Function example (11.73122ms)
972
+ ✔ JSONB filtering (5.343372ms)
973
+ ✔ Postgis examples (5.650518ms)
974
+ ✔ jsonbSchema validation (6.994971ms)
975
+ ✔ find and findOne (1.766446ms)
976
+ ✔ Result size (1.598463ms)
977
+ ✔ Basic exists (2.512757ms)
978
+ ✔ Basic fts with shorthand notation (2.751992ms)
979
+ ✔ Exists with shortest path wildcard filter example (2.935236ms)
980
+ ✔ Exists with exact path filter example (1.156522ms)
981
+ ✔ Not Exists with exact path filter example (2.355543ms)
982
+ ✔ Upsert example (16.527661ms)
983
+ ✔ Joins example (2.336799ms)
984
+ ✔ Joins repeating table example (3.286213ms)
985
+ ✔ Join aggregate functions example (8.575979ms)
986
+ ✔ $rowhash example (6.02968ms)
987
+ ✔ Reference column nested insert (6.23454ms)
988
+ ✔ Join escaped table names with quotes (10.56118ms)
989
+ Pushing 0 rows to socket x2
990
+ Client log (client) t+ 47312ms {
991
+ "item": {
992
+ "\"id0\"": 1,
993
+ "\"quoted1_id\"": 1,
994
+ "\"text_col0\"": "0"
995
+ },
996
+ "runs": 0
997
+ }
998
+ Client log (client) t+ 47317ms {
999
+ "item": {
1000
+ "\"id0\"": 1,
1001
+ "\"quoted1_id\"": 1,
1002
+ "\"text_col0\"": "1"
1003
+ },
1004
+ "runs": 1
1005
+ }
1006
+ Client log unsubscribe start - """quoted0"""
1007
+ Client log unsubscribe end - """quoted0"""
1008
+ ✔ subscribe to escaped table name (10.90544ms)
1009
+ Pushing 1 rows to socket x2
1010
+ ✔ subscribe using a filter bigger than block_size (14.483266ms)
1011
+ ✔ Reverse join with agg (11.964979ms)
1012
+ Pushing 0 rows to socket
1013
+ 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}
1014
+ 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}
1015
+ ✔ Related table subscribe (9033.952753ms)
1016
+ Pushing 2 rows to socket x2
1017
+ ✔ Aggregate FILTER registers joined dependency triggers (646.46969ms)
1018
+ ✔ Nested sort by computed col (8.171415ms)
1019
+ ✔ Nested function on different than source column getNewQuery name bug fix (1.548162ms)
1020
+ ✔ Reference column deep nested insert (12.306185ms)
1021
+ ✔ Multi reference column nested insert (12.679063ms)
1022
+ ✔ Join path with order by nested (7.125286ms)
1023
+ ✔ Self join (15.132138ms)
1024
+ ✔ One to many multi join duplicate row bug fix (13.157383ms)
1025
+ Client log (client) t+ 57101ms various id=99 count 1
1026
+ Pushing 1 rows to socket x3
1027
+ Client log (client) t+ 57104ms various id=99 count
1028
+ Client log ok
1029
+ Error within running subscription
1030
+ _psqlWS_..various.{"id":99}.{"select":{"name":1}}.m.sub {
1031
+ message: 'column prostgles_root_table_alias.name does not exist',
1032
+ length: 130,
1033
+ name: 'error',
1034
+ severity: 'ERROR',
1035
+ code: '42703',
1036
+ position: '133',
1037
+ file: 'parse_relation.c',
1038
+ line: '3665',
1039
+ routine: 'errorMissingColumn',
1040
+ query: '-- prostgles query id: 11c6d711-8f0b-4fe5-8c68-3de1a06f3243\n' +
1041
+ 'SET LOCAL "prostgles.user" \n' +
1042
+ `TO '{"id":"1","type":"public"}';\n` +
1043
+ 'SELECT \n' +
1044
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
1045
+ ' FROM ( \n' +
1046
+ ' SELECT * \n' +
1047
+ ' FROM various \n' +
1048
+ ' WHERE "id" = 99 \n' +
1049
+ ' ) prostgles_root_table_alias \n' +
1050
+ ' LIMIT 1000',
1051
+ code_info: 'undefined_column'
1052
+ }
1053
+ Client log (client) t+ 59121ms various id=99 count
1054
+ Client log (client) t+ 59121ms Error in subscription callback: {"message":"column prostgles_root_table_alias.name does not exist","length":130,"name":"error","severity":"ERROR","code":"42703","position":"133","file":"parse_relation.c","line":"3665","routine":"errorMissingColumn","query":"-- prostgles query id: 11c6d711-8f0b-4fe5-8c68-3de1a06f3243\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"}
1055
+ Client log ok
1056
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6539.341251ms)
1057
+ ✔ Isomorphic queries (63438.835861ms)
1058
+ ✔ Having clause (2.076482ms)
1059
+ ✔ Having clause with complex filter (1.77453ms)
1060
+ Client log (client) t+ 63646ms auth.user: {"sid":"main","uid":"1","id":"1","type":"public"}
1061
+ ✔ Nested join having clause (2.513617ms)
1062
+ ▶ isomorphic typed queries
1063
+ ✔ isLookupTable DB Types from colConf (0.158614ms)
1064
+ ✔ isLookupTable DB Types from reference column actual definition (0.097795ms)
1065
+ ✔ isLookupTable pkey column itself is typed (0.09075ms)
1066
+ ✔ isomorphic typed queries (0.485811ms)
1067
+ ▶ Client only queries
1068
+ ✔ modifyClientSchema adds custom table and column metadata (2.456534ms)
1069
+ ✔ SQL Stream more than 1k records (16.425489ms)
1070
+ ✔ SQL Stream persistedConnection with streamLimit works for subsequent queries (7.524363ms)
1071
+ ✔ SQL Stream ensure the connection is never released (same pg_backend_pid is the same for subsequent) when using persistConnectionId (8.220652ms)
1072
+ ✔ SQL Stream stop kills the query (1018.803382ms)
1073
+ ✔ SQL Stream limit works (18.313812ms)
1074
+ ✔ SQL Stream stop with terminate kills the query (expect flakiness) (132.68896ms)
1075
+ ✔ SQL Stream (7.711525ms)
1076
+ ✔ SQL Stream parallel execution + parameters (7.26177ms)
1077
+ ✔ SQL Stream query error structure matches default sql run error (8.479983ms)
1078
+ ✔ SQL Stream streamLimit (8.424367ms)
1079
+ ✔ SQL Stream table fields are the same as on default request (18.434829ms)
1080
+ ✔ SQL Stream works for multiple statements (8.568843ms)
1081
+ Client log (client) t+ 64925ms Checking public data
1082
+ ✔ Check tableSchema (14.502749ms)
1083
+ ✔ Security rules example (40.904538ms)
1084
+ Client log (client) t+ 64980ms Started testRealtime
1085
+ Client log (client) t+ 65003ms 1790704575874: sub stats: x10 -> 0 x20 ->0
1086
+ Client log (client) t+ 65011ms 1790704575882: sync stats: x10 -> 0 x20 -> 0
1087
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 0)
1088
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 1)
1089
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 2)
1090
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 3)
1091
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 4)
1092
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 5)
1093
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 6)
1094
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 7)
1095
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 8)
1096
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 9)
1097
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 10)
1098
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 11)
1099
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 12)
1100
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 13)
1101
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 14)
1102
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 15)
1103
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 16)
1104
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 17)
1105
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 18)
1106
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 19)
1107
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 20)
1108
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 21)
1109
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 22)
1110
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 23)
1111
+ Client log (client) t+ 65012ms 1790704575883: sync: p.$update({ x: 10 }); (id: 24)
1112
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 25)
1113
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 26)
1114
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 27)
1115
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 28)
1116
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 29)
1117
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 30)
1118
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 31)
1119
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 32)
1120
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 33)
1121
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 34)
1122
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 35)
1123
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 36)
1124
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 37)
1125
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 38)
1126
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 39)
1127
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 40)
1128
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 41)
1129
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 42)
1130
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 43)
1131
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 44)
1132
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 45)
1133
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 46)
1134
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 47)
1135
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 48)
1136
+ Client log (client) t+ 65013ms 1790704575884: sync: p.$update({ x: 10 }); (id: 49)
1137
+ Pushing 0 rows to socket x3
1138
+ upsertData (from client): inserted( 0 ) updated( 50 ) total( 50 )
1139
+ last insert undefined
1140
+ last update {"id":49,"x":10,"y":49,"flight_number":"FN49","last_updated":1790704575884}
1141
+ Client log (client) t+ 65097ms 1790704575968: sub stats: x10 -> 50 x20 ->0
1142
+ Pushing 50 rows to socket
1143
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1144
+ last insert undefined
1145
+ last update undefined
1146
+ server.syncBatch planes: inserted( 0 ) updated( 50 ) deleted( 0 ) pushed to client( 50 ) total( 100 ) undefined
1147
+ Client log (client) t+ 65106ms 1790704575977: sync stats: x10 -> 50 x20 -> 0
1148
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 50)
1149
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 51)
1150
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 52)
1151
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 53)
1152
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 54)
1153
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 55)
1154
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 56)
1155
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 57)
1156
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 58)
1157
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 59)
1158
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 60)
1159
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 61)
1160
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 62)
1161
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 63)
1162
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 64)
1163
+ Client log (client) t+ 65106ms 1790704575977: sync: p.$update({ x: 10 }); (id: 65)
1164
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 66)
1165
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 67)
1166
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 68)
1167
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 69)
1168
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 70)
1169
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 71)
1170
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 72)
1171
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 73)
1172
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 74)
1173
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 75)
1174
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 76)
1175
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 77)
1176
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 78)
1177
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 79)
1178
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 80)
1179
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 81)
1180
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 82)
1181
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 83)
1182
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 84)
1183
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 85)
1184
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 86)
1185
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 87)
1186
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 88)
1187
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 89)
1188
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 90)
1189
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 91)
1190
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 92)
1191
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 93)
1192
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 94)
1193
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 95)
1194
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 96)
1195
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 97)
1196
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 98)
1197
+ Client log (client) t+ 65107ms 1790704575978: sync: p.$update({ x: 10 }); (id: 99)
1198
+ Client log (client) t+ 65112ms 1790704575983: sync stats: x10 -> 100 x20 -> 0
1199
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 1 )
1200
+ last insert undefined
1201
+ last update undefined
1202
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 50 )
1203
+ last insert undefined
1204
+ last update {"id":50,"x":10,"last_updated":1790704575977}
1205
+ Client log (client) t+ 65226ms 1790704576097: sub stats: x10 -> 51 x20 ->0
1206
+ Pushing 51 rows to socket
1207
+ upsertData (from WAL): inserted( 0 ) updated( 49 ) total( 49 )
1208
+ last insert undefined
1209
+ last update {"id":99,"x":10,"last_updated":1790704575978}
1210
+ Client log (client) t+ 65379ms 1790704576249: sub stats: x10 -> 100 x20 ->0
1211
+ Client log (client) t+ 67379ms 1790704578250: sub: db.planes.update({}, { x: 20, last_updated });
1212
+ Client log (client) t+ 67385ms 1790704578254: sub: Updated to x20 100
1213
+ Pushing 100 rows to socket
1214
+ Client log (client) t+ 67394ms 1790704578265: sync stats: x10 -> 50 x20 -> 50
1215
+ Client log (client) t+ 67407ms 1790704578278: sync stats: x10 -> 0 x20 -> 100
1216
+ ✔ Realtime (2441.652246ms)
1217
+ Client log (client) t+ 67407ms 1790704578278: sync end: Finished replication test. Inserting 100 rows then updating two times took: 426ms
1218
+ Client log (client) t+ 67409ms sync handlesOnData true 100
1219
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 33 )
1220
+ last insert undefined
1221
+ last update undefined x2
1222
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 100 ) total( 100 ) undefined
1223
+ ✔ sync handlesOnData true -> false no data bug (2001.634309ms)
1224
+ ﹣ Security rules example (0.156ms) # SKIP
1225
+ ✔ Client only queries (5763.079826ms)
1226
+ ▶ React hooks
1227
+ ✔ useFind (516.643184ms)
1228
+ {
1229
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1230
+ }
1231
+ ✔ useSubscribe (509.802917ms)
1232
+ ✔ useFindOne (505.439618ms)
1233
+ Pushing 1 rows to socket
1234
+ {
1235
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1236
+ }
1237
+ ✔ useSubscribeOne (507.622915ms)
1238
+ ✔ useCount (506.434196ms)
1239
+ ✔ useSize (506.88386ms)
1240
+ ✔ useCount planes (253.099638ms)
1241
+ Pushing 2 rows to socket
1242
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1243
+ last insert undefined
1244
+ last update undefined
1245
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1246
+ last insert undefined
1247
+ last update undefined
1248
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1249
+ Client log (client) t+ 73009ms 1790704583880: sync stats: x10 -> 0 x20 -> 99
1250
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1251
+ last insert undefined
1252
+ last update undefined
1253
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 2 ) total( 100 ) undefined
1254
+ ✔ useSync (532.019852ms)
1255
+ Client log (client) t+ 73269ms 1790704584140: sync stats: x10 -> 0 x20 -> 100
1256
+ Client log (client) t+ 73270ms 1790704584141: sync end: Finished replication test. Inserting 100 rows then updating two times took: 6289ms
1257
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1258
+ last insert undefined
1259
+ last update undefined x2
1260
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1261
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1262
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1263
+ last insert undefined
1264
+ last update undefined x2
1265
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1266
+ Client log (client) t+ 73540ms 1790704584411: sync stats: x10 -> 0 x20 -> 99
1267
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1268
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1269
+ last insert undefined
1270
+ last update {"id":0,"x":232,"last_updated":1790704584417}
1271
+ ✔ useSync updates invalidate useMemo without mutating old data (318.43247ms)
1272
+ Client log (client) t+ 73568ms 1790704584439: sync stats: x10 -> 0 x20 -> 99
1273
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1274
+ last insert undefined
1275
+ last update undefined
1276
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1277
+ Client log (client) t+ 73584ms 1790704584455: sync stats: x10 -> 0 x20 -> 99
1278
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1279
+ last insert undefined
1280
+ last update undefined x2
1281
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1282
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1283
+ Client log (client) t+ 73855ms 1790704584726: sync stats: x10 -> 0 x20 -> 99
1284
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1285
+ last insert undefined
1286
+ last update undefined
1287
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1288
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1289
+ last insert undefined
1290
+ last update undefined
1291
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1292
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1293
+ last insert undefined
1294
+ last update {"id":0,"x":32,"last_updated":1790704584738}
1295
+ Client log (client) t+ 73887ms 1790704584758: sync stats: x10 -> 0 x20 -> 99
1296
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1297
+ last insert undefined
1298
+ last update undefined
1299
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1300
+ ✔ concurrent useSync hooks with matching options all update (320.358238ms)
1301
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1302
+ last insert undefined
1303
+ last update undefined
1304
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 51 ) total( 52 ) undefined
1305
+ Client log (client) t+ 74174ms Reconnected
1306
+ Client log (client) t+ 74198ms TEST_NAME: main Started
1307
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1308
+ last insert undefined
1309
+ last update undefined
1310
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1311
+ last insert undefined
1312
+ last update undefined
1313
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 52 ) total( 53 ) undefined
1314
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 152 ) total( 202 ) undefined
1315
+ Client log (client) t+ 74212ms 1790704585083: sync stats: x10 -> 1 x20 -> 100
1316
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999000)
1317
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999001)
1318
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999002)
1319
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999003)
1320
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999004)
1321
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999005)
1322
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999006)
1323
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999007)
1324
+ Client log (client) t+ 74212ms 1790704585083: sync: p.$update({ x: 10 }); (id: 999008)
1325
+ Client log (client) t+ 74212ms 1790704585083: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7231ms
1326
+ Client log (client) t+ 74216ms 1790704585087: sync stats: x10 -> 10 x20 -> 100
1327
+ Client log (client) t+ 74216ms 1790704585087: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7235ms
1328
+ (server): Client disconnected. socket.id: fyirjqS4loqrh3XfAAAA
1329
+ onSocketConnect FKzNa14eNfJ0QrqlAAAB
1330
+ (server): Client connected -> console does not work. use log function. socket.id: FKzNa14eNfJ0QrqlAAAB
1331
+ Client log (client) t+ 74221ms Disconnected
1332
+ Client log (client) t+ 75103ms Client connect.
1333
+ schemaChanged must syncHandler.destroySyncs()
1334
+ Client log (client) t+ 75239ms Reconnected
1335
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1336
+ last insert undefined
1337
+ last update {"id":999000,"x":10,"last_updated":1790704585083}
1338
+ Client log (client) t+ 75261ms TEST_NAME: main Started
1339
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1340
+ last insert undefined
1341
+ last update undefined
1342
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 152 ) total( 202 ) undefined
1343
+ Client log (client) t+ 75275ms 1790704586146: sync stats: x10 -> 2 x20 -> 100
1344
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999001)
1345
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999002)
1346
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999003)
1347
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999004)
1348
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999005)
1349
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999006)
1350
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999007)
1351
+ Client log (client) t+ 75275ms 1790704586146: sync: p.$update({ x: 10 }); (id: 999008)
1352
+ Client log (client) t+ 75275ms 1790704586146: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8294ms
1353
+ Client log (client) t+ 75280ms 1790704586151: sync stats: x10 -> 10 x20 -> 100
1354
+ Client log (client) t+ 75280ms 1790704586151: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8299ms
1355
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1356
+ last insert undefined
1357
+ last update undefined
1358
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1359
+ ✔ concurrent useSync hooks receive inserts after reattachment and reconnect (1409.324843ms)
1360
+ ✔ React hooks (5886.546397ms)
1361
+ Client log (client) t+ 75297ms TEST_NAME: main Finished OK
1362
+ Client log (client) t+ 75298ms 1790704586169: sync stats: x10 -> 10 x20 -> 100
1363
+ Client log (client) t+ 75298ms 1790704586169: sync end: Finished replication test. Inserting 100 rows then updating two times took: 8317ms
1364
+ upsertData (from client): inserted( 0 ) updated( 8 ) total( 9 )
1365
+ last insert undefined
1366
+ last update {"id":999008,"x":10,"y":999999,"flight_number":null,"last_updated":1790704586146}
1367
+ server.syncBatch planes: inserted( 0 ) updated( 8 ) deleted( 0 ) pushed to client( 1 ) total( 10 ) undefined
1368
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 1 )
1369
+ last insert undefined
1370
+ last update undefined
1371
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1372
+ last insert undefined
1373
+ last update undefined
1374
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 8 ) total( 9 ) undefined
1375
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 8 )
1376
+ last insert undefined
1377
+ last update undefined
1378
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 0 ) total( 8 ) undefined
1379
+ Client test successful
1380
+ (server): Stopping server ...
1381
+ ℹ tests 122
1382
+ ℹ suites 4
1383
+ ℹ pass 121
1384
+ ℹ fail 0
1385
+ ℹ cancelled 0
1386
+ ℹ skipped 1
1387
+ ℹ todo 0
1388
+ ℹ duration_ms 83357.25715
1389
+
1390
+ > server_tests@1.0.0 test-client
1391
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1392
+
1393
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1394
+ Created PubSubManager
1395
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1396
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1397
+
1398
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1399
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1400
+ id TEXT PRIMARY KEY
1401
+ , "description" TEXT
1402
+ );
1403
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1404
+
1405
+ CREATE TABLE "files" (
1406
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1407
+ "storage_key" UUID UNIQUE ,
1408
+ "extension" TEXT NOT NULL DEFAULT '' ,
1409
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1410
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1411
+ "etag" TEXT NOT NULL DEFAULT '' ,
1412
+ "original_name" TEXT NOT NULL ,
1413
+ "original_last_modified" TIMESTAMPTZ ,
1414
+ "description" TEXT ,
1415
+ "url" TEXT NOT NULL DEFAULT '' ,
1416
+ "cloud_url" TEXT ,
1417
+ "signed_url" TEXT ,
1418
+ "signed_url_expires" BIGINT ,
1419
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1420
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1421
+ "deleted" TIMESTAMPTZ ,
1422
+ "deleted_from_storage" TIMESTAMPTZ ,
1423
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1424
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1425
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1426
+ );
1427
+ CREATE TABLE "files_versions" (
1428
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1429
+ "storage_key" UUID NOT NULL ,
1430
+ "extension" TEXT NOT NULL DEFAULT '' ,
1431
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1432
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1433
+ "etag" TEXT NOT NULL DEFAULT '' ,
1434
+ "original_name" TEXT NOT NULL ,
1435
+ "original_last_modified" TIMESTAMPTZ ,
1436
+ "description" TEXT ,
1437
+ "url" TEXT NOT NULL DEFAULT '' ,
1438
+ "cloud_url" TEXT ,
1439
+ "signed_url" TEXT ,
1440
+ "signed_url_expires" BIGINT ,
1441
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1442
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1443
+ "deleted" TIMESTAMPTZ ,
1444
+ "deleted_from_storage" TIMESTAMPTZ ,
1445
+ "file_id" UUID NOT NULL ,
1446
+ "version" INTEGER NOT NULL ,
1447
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1448
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1449
+ );
1450
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1451
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1452
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1453
+ CREATE TABLE "users_public_info" (
1454
+ "id" SERIAL PRIMARY KEY ,
1455
+ "name" TEXT ,
1456
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1457
+ "sid" TEXT
1458
+ );
1459
+ DROP TABLE IF EXISTS "users";
1460
+ CREATE TABLE "users" (
1461
+ "id" SERIAL PRIMARY KEY ,
1462
+ "email" TEXT NOT NULL ,
1463
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1464
+ "type" TEXT NOT NULL ,
1465
+ "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"}' ))
1466
+ );
1467
+ DROP TABLE IF EXISTS "tjson";
1468
+ CREATE TABLE "tjson" (
1469
+ "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"}' )),
1470
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1471
+ "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"}' )),
1472
+ "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"}' )),
1473
+ "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"}' ))
1474
+ );
1475
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1476
+
1477
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1478
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1479
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1480
+ DROP TABLE IF EXISTS "api_table";
1481
+ CREATE TABLE "api_table" (
1482
+ "id" SERIAL PRIMARY KEY
1483
+ );
1484
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1485
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1486
+ (server): prostgles onReady
1487
+ (server): Waiting for client...
1488
+ (client) t+ 0ms Started client...
1489
+ onSocketConnect hozOQRateVMro62CAAAA
1490
+ (server): Client connected -> console does not work. use log function. socket.id: hozOQRateVMro62CAAAA
1491
+ (client) t+ 40ms Client connect.
1492
+ (client) t+ 173ms TEST_NAME: useProstgles Started
1493
+ onSocketConnect HWkK0EiCCx35u7X3AAAB
1494
+ (server): Client connected -> console does not work. use log function. socket.id: HWkK0EiCCx35u7X3AAAB
1495
+ ▶ useProstgles hook
1496
+ ✔ useProstglesClient (495.249492ms)
1497
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1498
+ (server): Client disconnected. socket.id: HWkK0EiCCx35u7X3AAAB
1499
+ schemaChanged must syncHandler.destroySyncs()
1500
+ ✔ useProstglesClient with schema reload (2365.361721ms)
1501
+ onSocketConnect pCcCAfgvgME0wiUPAAAD
1502
+ (server): Client connected -> console does not work. use log function. socket.id: pCcCAfgvgME0wiUPAAAD
1503
+ (server): Client disconnected. socket.id: pCcCAfgvgME0wiUPAAAD
1504
+ ✔ useProstglesClient with initial skip (760.157823ms)
1505
+ ✔ useProstgles hook (3621.637896ms)
1506
+ Client log (client) t+ 6814ms TEST_NAME: useProstgles Finished OK
1507
+ Client test successful
1508
+ (server): Stopping server ...
1509
+ ℹ tests 3
1510
+ ℹ suites 1
1511
+ ℹ pass 3
1512
+ ℹ fail 0
1513
+ ℹ cancelled 0
1514
+ ℹ skipped 0
1515
+ ℹ todo 0
1516
+ ℹ duration_ms 15307.80905
1517
+
1518
+ > server_tests@1.0.0 test-client
1519
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1520
+
1521
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1522
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1523
+
1524
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1525
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1526
+ id TEXT PRIMARY KEY
1527
+ , "description" TEXT
1528
+ );
1529
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
1530
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
1531
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1532
+
1533
+ CREATE TABLE "files" (
1534
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1535
+ "storage_key" UUID UNIQUE ,
1536
+ "extension" TEXT NOT NULL DEFAULT '' ,
1537
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1538
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1539
+ "etag" TEXT NOT NULL DEFAULT '' ,
1540
+ "original_name" TEXT NOT NULL ,
1541
+ "original_last_modified" TIMESTAMPTZ ,
1542
+ "description" TEXT ,
1543
+ "url" TEXT NOT NULL DEFAULT '' ,
1544
+ "cloud_url" TEXT ,
1545
+ "signed_url" TEXT ,
1546
+ "signed_url_expires" BIGINT ,
1547
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1548
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1549
+ "deleted" TIMESTAMPTZ ,
1550
+ "deleted_from_storage" TIMESTAMPTZ ,
1551
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1552
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1553
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1554
+ );
1555
+ CREATE TABLE "files_versions" (
1556
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1557
+ "storage_key" UUID NOT NULL ,
1558
+ "extension" TEXT NOT NULL DEFAULT '' ,
1559
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1560
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1561
+ "etag" TEXT NOT NULL DEFAULT '' ,
1562
+ "original_name" TEXT NOT NULL ,
1563
+ "original_last_modified" TIMESTAMPTZ ,
1564
+ "description" TEXT ,
1565
+ "url" TEXT NOT NULL DEFAULT '' ,
1566
+ "cloud_url" TEXT ,
1567
+ "signed_url" TEXT ,
1568
+ "signed_url_expires" BIGINT ,
1569
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1570
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1571
+ "deleted" TIMESTAMPTZ ,
1572
+ "deleted_from_storage" TIMESTAMPTZ ,
1573
+ "file_id" UUID NOT NULL ,
1574
+ "version" INTEGER NOT NULL ,
1575
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1576
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1577
+ );
1578
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1579
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1580
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1581
+ CREATE TABLE "users_public_info" (
1582
+ "id" SERIAL PRIMARY KEY ,
1583
+ "name" TEXT ,
1584
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1585
+ "sid" TEXT
1586
+ );
1587
+ DROP TABLE IF EXISTS "users";
1588
+ CREATE TABLE "users" (
1589
+ "id" SERIAL PRIMARY KEY ,
1590
+ "email" TEXT NOT NULL ,
1591
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1592
+ "type" TEXT NOT NULL ,
1593
+ "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"}' ))
1594
+ );
1595
+ DROP TABLE IF EXISTS "tjson";
1596
+ CREATE TABLE "tjson" (
1597
+ "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"}' )),
1598
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1599
+ "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"}' )),
1600
+ "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"}' )),
1601
+ "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"}' ))
1602
+ );
1603
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1604
+
1605
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1606
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1607
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1608
+ DROP TABLE IF EXISTS "api_table";
1609
+ CREATE TABLE "api_table" (
1610
+ "id" SERIAL PRIMARY KEY
1611
+ );
1612
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1613
+ Prostgles: Created typescript schema definition file:
1614
+ DBGeneratedSchema.ts
1615
+ (server): prostgles onReady
1616
+ (server): Waiting for client...
1617
+ (client) t+ 0ms Started client...
1618
+ onSocketConnect LcEWoFxNqQ_3ZhjuAAAA
1619
+ (server): Client connected -> console does not work. use log function. socket.id: LcEWoFxNqQ_3ZhjuAAAA
1620
+ (client) t+ 29ms Client connect.
1621
+ (client) t+ 59ms TEST_NAME: files Started
1622
+ ▶ clientFileTests
1623
+ ✔ Files table is present (5.295234ms)
1624
+ ✔ Insert file from nested insert (33.203841ms)
1625
+ ✔ Cannot Insert file directly (6.148062ms)
1626
+ ✔ Disallowed updates cannot change stored bytes or create nested uploads (17.792129ms)
1627
+ ✔ Duplicate file IDs and failed validation preserve the original object (15.86029ms)
1628
+ ✔ Can update allowed files directly (52.675873ms)
1629
+ ✔ Can insert allowed files through a nested update (25.411695ms)
1630
+ Client log (client) t+ 267ms TEST_NAME: files Finished OK
1631
+ ✔ Can delete only allowed files directly (13.964773ms)
1632
+ ✔ clientFileTests (171.707816ms)
1633
+ Client test successful
1634
+ (server): Stopping server ...
1635
+ ℹ tests 8
1636
+ ℹ suites 1
1637
+ ℹ pass 8
1638
+ ℹ fail 0
1639
+ ℹ cancelled 0
1640
+ ℹ skipped 0
1641
+ ℹ todo 0
1642
+ ℹ duration_ms 8395.128354
1643
+
1644
+ > server_tests@1.0.0 test-client
1645
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1646
+
1647
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1648
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1649
+
1650
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1651
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1652
+ id TEXT PRIMARY KEY
1653
+ , "description" TEXT
1654
+ );
1655
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1656
+
1657
+ CREATE TABLE "files" (
1658
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1659
+ "storage_key" UUID UNIQUE ,
1660
+ "extension" TEXT NOT NULL DEFAULT '' ,
1661
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1662
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1663
+ "etag" TEXT NOT NULL DEFAULT '' ,
1664
+ "original_name" TEXT NOT NULL ,
1665
+ "original_last_modified" TIMESTAMPTZ ,
1666
+ "description" TEXT ,
1667
+ "url" TEXT NOT NULL DEFAULT '' ,
1668
+ "cloud_url" TEXT ,
1669
+ "signed_url" TEXT ,
1670
+ "signed_url_expires" BIGINT ,
1671
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1672
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1673
+ "deleted" TIMESTAMPTZ ,
1674
+ "deleted_from_storage" TIMESTAMPTZ ,
1675
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1676
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1677
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1678
+ );
1679
+ CREATE TABLE "files_versions" (
1680
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1681
+ "storage_key" UUID NOT NULL ,
1682
+ "extension" TEXT NOT NULL DEFAULT '' ,
1683
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1684
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1685
+ "etag" TEXT NOT NULL DEFAULT '' ,
1686
+ "original_name" TEXT NOT NULL ,
1687
+ "original_last_modified" TIMESTAMPTZ ,
1688
+ "description" TEXT ,
1689
+ "url" TEXT NOT NULL DEFAULT '' ,
1690
+ "cloud_url" TEXT ,
1691
+ "signed_url" TEXT ,
1692
+ "signed_url_expires" BIGINT ,
1693
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1694
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1695
+ "deleted" TIMESTAMPTZ ,
1696
+ "deleted_from_storage" TIMESTAMPTZ ,
1697
+ "file_id" UUID NOT NULL ,
1698
+ "version" INTEGER NOT NULL ,
1699
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1700
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1701
+ );
1702
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1703
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1704
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1705
+ CREATE TABLE "users_public_info" (
1706
+ "id" SERIAL PRIMARY KEY ,
1707
+ "name" TEXT ,
1708
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1709
+ "sid" TEXT
1710
+ );
1711
+ DROP TABLE IF EXISTS "users";
1712
+ CREATE TABLE "users" (
1713
+ "id" SERIAL PRIMARY KEY ,
1714
+ "email" TEXT NOT NULL ,
1715
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1716
+ "type" TEXT NOT NULL ,
1717
+ "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"}' ))
1718
+ );
1719
+ DROP TABLE IF EXISTS "tjson";
1720
+ CREATE TABLE "tjson" (
1721
+ "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"}' )),
1722
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1723
+ "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"}' )),
1724
+ "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"}' )),
1725
+ "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"}' ))
1726
+ );
1727
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1728
+
1729
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1730
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1731
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1732
+ DROP TABLE IF EXISTS "api_table";
1733
+ CREATE TABLE "api_table" (
1734
+ "id" SERIAL PRIMARY KEY
1735
+ );
1736
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1737
+ (server): prostgles onReady
1738
+ (server): Waiting for client...
1739
+ (client) t+ 0ms Started client...
1740
+ onSocketConnect ubUtd0LxvQaYB-XxAAAA
1741
+ (server): Client connected -> console does not work. use log function. socket.id: ubUtd0LxvQaYB-XxAAAA
1742
+ (client) t+ 27ms Client connect.
1743
+ (client) t+ 37ms TEST_NAME: rest_api Started
1744
+ ▶ clientRestApi
1745
+ ✔ Rest api test (85.795933ms)
1746
+ ✔ Rest api security (17.485207ms)
1747
+ Client log (client) t+ 145ms TEST_NAME: rest_api Finished OK
1748
+ ✔ clientRestApi (104.005492ms)
1749
+ Client test successful
1750
+ (server): Stopping server ...
1751
+ ℹ tests 2
1752
+ ℹ suites 1
1753
+ ℹ pass 2
1754
+ ℹ fail 0
1755
+ ℹ cancelled 0
1756
+ ℹ skipped 0
1757
+ ℹ todo 0
1758
+ ℹ duration_ms 8231.872304