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,1747 @@
1
+
2
+ > prostgles-server@4.2.648 test-only
3
+ > cd tests/ && ./test.sh
4
+
5
+
6
+ > prostgles-server@4.2.648 build
7
+ > tsc
8
+
9
+
10
+ > client@1.0.0 build
11
+ > rm -rf ./node_modules/* && rm -rf ./dist/* && npm i && tsc
12
+
13
+ npm warn deprecated whatwg-encoding@3.1.1: Use @exodus/bytes instead for a more spec-conformant and faster implementation
14
+
15
+ added 58 packages, and audited 59 packages in 708ms
16
+
17
+ 7 packages are looking for funding
18
+ run `npm fund` for details
19
+
20
+ found 0 vulnerabilities
21
+
22
+ > client@1.0.0 testBasicHooks
23
+ > node --test dist/client/basicHooks.spec.js
24
+
25
+ ▶ React hooks
26
+ ✔ useAsyncEffectQueue executes the first and debounces the rest (1619.72386ms)
27
+ ✔ useAsyncEffectQueue executes the first and debounces the rest if still mounted (1516.470434ms)
28
+ ✔ React hooks (3138.279958ms)
29
+ ℹ tests 2
30
+ ℹ suites 1
31
+ ℹ pass 2
32
+ ℹ fail 0
33
+ ℹ cancelled 0
34
+ ℹ skipped 0
35
+ ℹ todo 0
36
+ ℹ duration_ms 3437.248484
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.648 lint
57
+ > eslint . --ext .ts --quiet
58
+
59
+
60
+ > server_tests@1.0.0 test-server
61
+ > TEST_TYPE=server node --trace-uncaught --test dist/server/index.js
62
+
63
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
64
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
65
+
66
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
67
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
68
+ id TEXT PRIMARY KEY
69
+ , "description" TEXT
70
+ );
71
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
72
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
73
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
74
+
75
+ CREATE TABLE "files" (
76
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
77
+ "storage_key" UUID UNIQUE ,
78
+ "extension" TEXT NOT NULL DEFAULT '' ,
79
+ "content_type" TEXT NOT NULL DEFAULT '' ,
80
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
81
+ "etag" TEXT NOT NULL DEFAULT '' ,
82
+ "original_name" TEXT NOT NULL ,
83
+ "original_last_modified" TIMESTAMPTZ ,
84
+ "description" TEXT ,
85
+ "url" TEXT NOT NULL DEFAULT '' ,
86
+ "cloud_url" TEXT ,
87
+ "signed_url" TEXT ,
88
+ "signed_url_expires" BIGINT ,
89
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
90
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
91
+ "deleted" TIMESTAMPTZ ,
92
+ "deleted_from_storage" TIMESTAMPTZ ,
93
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
94
+ "version" INTEGER NOT NULL DEFAULT 1 ,
95
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
96
+ );
97
+ CREATE TABLE "files_versions" (
98
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
99
+ "storage_key" UUID NOT NULL ,
100
+ "extension" TEXT NOT NULL DEFAULT '' ,
101
+ "content_type" TEXT NOT NULL DEFAULT '' ,
102
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
103
+ "etag" TEXT NOT NULL DEFAULT '' ,
104
+ "original_name" TEXT NOT NULL ,
105
+ "original_last_modified" TIMESTAMPTZ ,
106
+ "description" TEXT ,
107
+ "url" TEXT NOT NULL DEFAULT '' ,
108
+ "cloud_url" TEXT ,
109
+ "signed_url" TEXT ,
110
+ "signed_url_expires" BIGINT ,
111
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
112
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
113
+ "deleted" TIMESTAMPTZ ,
114
+ "deleted_from_storage" TIMESTAMPTZ ,
115
+ "file_id" UUID NOT NULL ,
116
+ "version" INTEGER NOT NULL ,
117
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
118
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
119
+ );
120
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
121
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
122
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
123
+ CREATE TABLE "users_public_info" (
124
+ "id" SERIAL PRIMARY KEY ,
125
+ "name" TEXT ,
126
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
127
+ "sid" TEXT
128
+ );
129
+ DROP TABLE IF EXISTS "users";
130
+ CREATE TABLE "users" (
131
+ "id" SERIAL PRIMARY KEY ,
132
+ "email" TEXT NOT NULL ,
133
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
134
+ "type" TEXT NOT NULL ,
135
+ "preferences" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"showIntro":{"type":"boolean","optional":true},"theme":{"enum":["light","dark","auto"],"optional":true},"others":{"type":"any[]"}}}'::TEXT, "preferences", '{"table":"users","column":"preferences"}' ))
136
+ );
137
+ DROP TABLE IF EXISTS "tjson";
138
+ CREATE TABLE "tjson" (
139
+ "json" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"a":{"type":"boolean"},"arr":{"enum":["1","2","3"]},"arr1":{"enum":[1,2,3]},"arr2":{"type":"integer[]"},"arrStr":{"type":"string[]","optional":true,"nullable":true},"o":{"optional":true,"nullable":true,"oneOfType":[{"o1":"integer"},{"o2":"boolean"}]}}}'::TEXT, "json", '{"table":"tjson","column":"json"}' )),
140
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
141
+ "status" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"ok":{"type":"string"}},{"err":{"type":"string"}},{"loading":{"type":{"loaded":{"type":"number"},"total":{"type":"number"}}}}]}'::TEXT, "status", '{"table":"tjson","column":"status"}' )),
142
+ "jsonOneOf" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"oneOfType":[{"command":{"enum":["a"]}},{"command":{"enum":["b"]},"option":{"type":"integer[]"}}]}'::TEXT, "jsonOneOf", '{"table":"tjson","column":"jsonOneOf"}' )),
143
+ "table_config" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"referencedTables":{"optional":true,"arrayOfType":{"name":"string","minFiles":"number"}},"recType":{"nullable":true,"optional":true,"record":{"keysEnum":["a","b"],"values":{"type":{"bools":"boolean[]"}}}}}}'::TEXT, "table_config", '{"table":"tjson","column":"table_config"}' ))
144
+ );
145
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
146
+
147
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
148
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
149
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
150
+ DROP TABLE IF EXISTS "api_table";
151
+ CREATE TABLE "api_table" (
152
+ "id" SERIAL PRIMARY KEY
153
+ );
154
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
155
+ (server): prostgles onReady
156
+ IO missing. Publish has no effect without io or restApi
157
+ IO missing. Publish has no effect without io or restApi
158
+ destroying prgl instance
159
+ destroying prgl instance
160
+ ▶ Server Only Queries
161
+ ✔ execution context follows functions, hooks and deferred transaction callbacks (2393.903871ms)
162
+ ✔ column definition row types support SQL aliases, arrays and generated columns (6.320328ms)
163
+ ✔ lookup types propagate through database references while preserving overrides (11.91538ms)
164
+ ✔ lookup types follow FK chains by column and terminate cycles (154.127359ms)
165
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
166
+
167
+ CREATE TABLE "files" (
168
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
169
+ "storage_key" UUID UNIQUE ,
170
+ "extension" TEXT NOT NULL DEFAULT '' ,
171
+ "content_type" TEXT NOT NULL DEFAULT '' ,
172
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
173
+ "etag" TEXT NOT NULL DEFAULT '' ,
174
+ "original_name" TEXT NOT NULL ,
175
+ "original_last_modified" TIMESTAMPTZ ,
176
+ "description" TEXT ,
177
+ "url" TEXT NOT NULL DEFAULT '' ,
178
+ "cloud_url" TEXT ,
179
+ "signed_url" TEXT ,
180
+ "signed_url_expires" BIGINT ,
181
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
182
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
183
+ "deleted" TIMESTAMPTZ ,
184
+ "deleted_from_storage" TIMESTAMPTZ ,
185
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
186
+ );
187
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
188
+ Prostgles: Created typescript schema definition file:
189
+ DBGeneratedSchema.ts
190
+ Prostgles: Created typescript schema definition file:
191
+ DBGeneratedSchema.ts
192
+ ▶ client publish profiles compile at startup and follow user types
193
+ ✔ server user handlers enforce permissions and reject client impersonation (38.59378ms)
194
+ ✔ a rejected guest abort cannot cancel a later server-user query (2.760503ms)
195
+ ✔ caught subscription errors still roll back client transactions (3.131683ms)
196
+ ✔ caught checkFilter errors still roll back client transactions (8.454494ms)
197
+ ✔ caught postValidate errors still roll back client transactions (2.3802ms)
198
+ No options changed
199
+ Prostgles: Created typescript schema definition file:
200
+ DBGeneratedSchema.ts
201
+ Prostgles: Created typescript schema definition file:
202
+ DBGeneratedSchema.ts
203
+ Prostgles: Created typescript schema definition file:
204
+ DBGeneratedSchema.ts
205
+ Prostgles: Created typescript schema definition file:
206
+ DBGeneratedSchema.ts
207
+ destroying prgl instance
208
+ ✔ server user handlers require configured authentication (0.830886ms)
209
+ ✔ client publish profiles compile at startup and follow user types (1935.942564ms)
210
+ ▶ Managed storage permission and transaction safety
211
+ ✔ legacy ID-based files remain readable and replaceable (30.983311ms)
212
+ ✔ custom columns do not require or interfere with file data (27.128776ms)
213
+ ✔ filtered updates and failed validation preserve storage (12.203926ms)
214
+ ✔ failed uploads and application hooks leave no replacement objects (30.123096ms)
215
+ ✔ duplicate IDs, conflict updates and SQL-only requests cannot overwrite (22.615863ms)
216
+ ✔ PostgreSQL update policies are enforced before uploading (10.610148ms)
217
+ ✔ RLS-hidden references fail closed during storage cleanup (3.671675ms)
218
+ ✔ beforeEach lifecycle callbacks follow the outer transaction (35.49512ms)
219
+ ✔ outer rollback preserves replaced and deleted objects (46.87388ms)
220
+ ✔ a failed multi-insert waits for other uploads before cleanup (9.328123ms)
221
+ ✔ concurrent replacements leave one complete referenced object (26.063862ms)
222
+ ✔ version retention removes only unreferenced objects (44.096658ms)
223
+ ✔ foreign-key failure preserves bytes and deletion waits for commit (28.781346ms)
224
+ ✔ cloud downloads and cleanup use the committed storage key (47.30752ms)
225
+ ✔ Managed storage permission and transaction safety (401.399308ms)
226
+ destroying prgl instance
227
+ destroying prgl instance
228
+ ✔ custom joins add conditions unless override is requested (2286.030378ms)
229
+ destroying prgl instance
230
+ ✔ custom self joins use configured paths and override inferred joins (1169.98207ms)
231
+ destroying prgl instance
232
+ destroying prgl instance
233
+ destroying prgl instance
234
+ ✔ destroy allows reusing Socket.IO on a running HTTP server (3412.55097ms)
235
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
236
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
237
+
238
+ CREATE TABLE "audit_events" (
239
+ "id" BIGSERIAL PRIMARY KEY ,
240
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
241
+ "schema_name" TEXT NOT NULL ,
242
+ "table_name" TEXT NOT NULL ,
243
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
244
+ "old_id" JSONB ,
245
+ "new_id" JSONB ,
246
+ "old_row" JSONB ,
247
+ "new_row" JSONB ,
248
+ "actor" JSONB ,
249
+ "db_context" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"transaction_id":"string","transaction_started_at":"string","statement_started_at":"string","current_role":"string","session_user":"string","application_name":"string"}}'::TEXT, "db_context", '{"table":"audit_events","column":"db_context"}' ))
250
+ );
251
+ CREATE TABLE "audit_test_files" (
252
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
253
+ "storage_key" UUID UNIQUE ,
254
+ "extension" TEXT NOT NULL DEFAULT '' ,
255
+ "content_type" TEXT NOT NULL DEFAULT '' ,
256
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
257
+ "etag" TEXT NOT NULL DEFAULT '' ,
258
+ "original_name" TEXT NOT NULL ,
259
+ "original_last_modified" TIMESTAMPTZ ,
260
+ "description" TEXT ,
261
+ "url" TEXT NOT NULL DEFAULT '' ,
262
+ "cloud_url" TEXT ,
263
+ "signed_url" TEXT ,
264
+ "signed_url_expires" BIGINT ,
265
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
266
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
267
+ "deleted" TIMESTAMPTZ ,
268
+ "deleted_from_storage" TIMESTAMPTZ ,
269
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex'))
270
+ );
271
+ CREATE TABLE "audit_test_source" (
272
+ "a" int NOT NULL ,
273
+ "b" text NOT NULL ,
274
+ "value" text ,
275
+ "secret" text
276
+ );
277
+ ALTER TABLE "audit_test_source" ADD PRIMARY KEY (a, b);
278
+ CREATE TABLE "audit_test_documents" (
279
+ "id" serial PRIMARY KEY ,
280
+ "file_id" uuid NOT NULL REFERENCES audit_test_files(id)
281
+ );
282
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
283
+ IO missing. Publish has no effect without io or restApi
284
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
285
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
286
+ IO missing. Publish has no effect without io or restApi
287
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
288
+ IO missing. Publish has no effect without io or restApi
289
+ destroying prgl instance
290
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
291
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
292
+ IO missing. Publish has no effect without io or restApi
293
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
294
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
295
+ IO missing. Publish has no effect without io or restApi
296
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
297
+ Trace: Error: audit.tables cannot mix enabled and disabled entries
298
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:19:15)
299
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
300
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
301
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
302
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
303
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
304
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
305
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
306
+ at async waitForActual (node:assert:646:5)
307
+ at async strict.rejects (node:assert:769:25)
308
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
309
+ at async Test.run (node:internal/test_runner/test:1125:7)
310
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
311
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
312
+ Trace: Error: Unknown audit table: missing_table
313
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:23:19)
314
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
315
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
316
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
317
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
318
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
319
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
320
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
321
+ at async waitForActual (node:assert:646:5)
322
+ at async strict.rejects (node:assert:769:25)
323
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
324
+ at async Test.run (node:internal/test_runner/test:1125:7)
325
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
326
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
327
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
328
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
329
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
330
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
331
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
332
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
333
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
334
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
335
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
336
+ at async waitForActual (node:assert:646:5)
337
+ at async strict.rejects (node:assert:769:25)
338
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
339
+ at async Test.run (node:internal/test_runner/test:1125:7)
340
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
341
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
342
+ Trace: Error: Unsupported audit target: audit_test_view
343
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:37:23)
344
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
345
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
346
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
347
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
348
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
349
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
350
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
351
+ at async waitForActual (node:assert:646:5)
352
+ at async strict.rejects (node:assert:769:25)
353
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
354
+ at async Test.run (node:internal/test_runner/test:1125:7)
355
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
356
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
357
+ Trace: Error: Audit identity columns cannot be excluded: audit_test_source
358
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:54:19)
359
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
360
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
361
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
362
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
363
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
364
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
365
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
366
+ at async waitForActual (node:assert:646:5)
367
+ at async strict.rejects (node:assert:769:25)
368
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:485:17)
369
+ at async Test.run (node:internal/test_runner/test:1125:7)
370
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
371
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
372
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
373
+ IO missing. Publish has no effect without io or restApi
374
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
375
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
376
+ IO missing. Publish has no effect without io or restApi
377
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
378
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
379
+ IO missing. Publish has no effect without io or restApi
380
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
381
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
382
+ IO missing. Publish has no effect without io or restApi
383
+ Prostgles: SQL file executed successfuly /tmp/prostgles-audit-Vnl641/init.sql
384
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
385
+ IO missing. Publish has no effect without io or restApi
386
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
387
+ IO missing. Publish has no effect without io or restApi
388
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
389
+ IO missing. Publish has no effect without io or restApi
390
+ Trace: Error: audit.idColumns is required for audit_test_nopk without a primary key
391
+ at parseAuditConfig (/home/s/prostgles-server-js/dist/Audit/parseAuditConfig.js:45:19)
392
+ at get resolvedAuditConfig (/home/s/prostgles-server-js/dist/Prostgles.js:136:56)
393
+ at get mergedTableConfig (/home/s/prostgles-server-js/dist/Prostgles.js:148:28)
394
+ at syncTableTriggers (/home/s/prostgles-server-js/dist/TableConfig/syncTableTriggers.js:8:25)
395
+ at /home/s/prostgles-server-js/dist/initProstgles.js:99:61
396
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
397
+ at Prostgles.initProstgles (/home/s/prostgles-server-js/dist/initProstgles.js:199:17)
398
+ at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
399
+ at async updateConfiguration (/home/s/prostgles-server-js/dist/updateConfiguration.js:58:9)
400
+ at async Object.update (/home/s/prostgles-server-js/dist/initProstgles.js:162:17)
401
+ at async waitForActual (node:assert:646:5)
402
+ at async strict.rejects (node:assert:769:25)
403
+ at async TestContext.<anonymous> (/home/s/prostgles-server-js/tests/server/dist/server/audit.spec.js:535:13)
404
+ at async Test.run (node:internal/test_runner/test:1125:7)
405
+ at async Suite.processPendingSubtests (node:internal/test_runner/test:787:7)
406
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
407
+ IO missing. Publish has no effect without io or restApi
408
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
409
+
410
+ CREATE TABLE "audit_next_events" (
411
+ "id" BIGSERIAL PRIMARY KEY ,
412
+ "created_at" TIMESTAMPTZ NOT NULL DEFAULT clock_timestamp() ,
413
+ "schema_name" TEXT NOT NULL ,
414
+ "table_name" TEXT NOT NULL ,
415
+ "operation" TEXT NOT NULL CHECK("operation" = 'INSERT' OR "operation" = 'UPDATE' OR "operation" = 'DELETE'),
416
+ "old_id" JSONB ,
417
+ "new_id" JSONB ,
418
+ "old_row" JSONB ,
419
+ "new_row" JSONB ,
420
+ "actor" JSONB ,
421
+ "db_context" JSONB NOT NULL CHECK(prostgles.validate_jsonb_schema('{"type":{"transaction_id":"string","transaction_started_at":"string","statement_started_at":"string","current_role":"string","session_user":"string","application_name":"string"}}'::TEXT, "db_context", '{"table":"audit_next_events","column":"db_context"}' ))
422
+ );
423
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
424
+ IO missing. Publish has no effect without io or restApi
425
+ destroying prgl instance
426
+ ✔ Managed audit setup, row history, protection, access and query readiness (7642.876163ms)
427
+ ✔ getJSONBSchemaValidationErrorAsync with real db handlers (4.570718ms)
428
+ ✔ Parallel subscription at init causing crash in getPubSubManager: duplicate key value violates unique constraint "apps_pkey" (100.750637ms)
429
+ ✔ RLS context is isolated across implicit transactions, commit, rollback and pool reuse (11.359745ms)
430
+ ✔ subscription and sync reads isolate users with a real RLS policy (9.938727ms)
431
+ ✔ ordinary beforeEach hooks transform inputs before validation (37.249837ms)
432
+ ✔ multi false is checked after beforeEach and rolls back the update (9.460374ms)
433
+ ✔ ordinary beforeEach hooks run before PostgreSQL UPDATE policy checks (20.44066ms)
434
+ ✔ before and after hooks preserve RLS across dbx and raw tx calls (26.447771ms)
435
+ ▶ post-transaction hooks receive committed and authenticated context
436
+ ✔ afterCommit runs after commit, filters changed fields and skips rollback (26.772997ms)
437
+ ✔ clearing a watched field runs before, after and commit hooks (5.526735ms)
438
+ ✔ client updateBatch runs hooks atomically in implicit and explicit transactions (26.230293ms)
439
+ destroying prgl instance
440
+ ✔ server-user requests preserve tenant_id from sessionFields (1.282375ms)
441
+ ✔ post-transaction hooks receive committed and authenticated context (1236.04756ms)
442
+ ✔ Self reference recursion bug (3.350283ms)
443
+ ✔ Transactions (18.912506ms)
444
+ (server): Server-only query tests successful
445
+ (server): Starting isomorphic queries
446
+ ✔ TableConfig onMount works (2.413732ms)
447
+ ✔ Server Only Queries (20898.469283ms)
448
+ (server): DELETING items
449
+ ▶ Isomorphic queries
450
+ ✔ Deleting stale data (35.399803ms)
451
+ ✔ Error structure malformed array literal (13.972803ms)
452
+ ✔ Table info (0.356834ms)
453
+ ✔ Prepare data (22.904619ms)
454
+ ✔ Test bytea (3.18696ms)
455
+ ✔ abortSignal terminates a running query (5538.901651ms)
456
+ ✔ Client queries are aborted no more than after n seconds (0.35283ms)
457
+ ✔ Subscription tracked_columns get merged correctly (24.02202ms)
458
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (969.880838ms)
459
+ ✔ CASE select and subscription dependencies (650.645605ms)
460
+ ✔ Subscription tracks non-selected ORDER BY columns (643.664636ms)
461
+ ✔ merge json (10.819264ms)
462
+ ✔ json array converted to pg array filter bug (1.439499ms)
463
+ ✔ onConflict do update (6.152547ms)
464
+ ✔ Local file upload (27.874704ms)
465
+ ✔ Local file delete (27.909551ms)
466
+ ✔ Local file update (23.370134ms)
467
+ ✔ getColumns definition (0.624631ms)
468
+ ✔ returnType (0.253385ms)
469
+ ✔ Table config triggers (3.9554ms)
470
+ ✔ $unnest_words (0.800113ms)
471
+ ✔ Group by/Distinct (1.846237ms)
472
+ ✔ sql returntype default-with-rollback (17.378982ms)
473
+ ✔ returnType: value (1.561203ms)
474
+ ✔ PostgreSQL array element (4.993236ms)
475
+ ✔ FTS filtering (6.650186ms)
476
+ ✔ $term_highlight (5.963559ms)
477
+ ✔ funcFilters: $term_highlight (2.547109ms)
478
+ (server): [{"name":null}]
479
+ (server): [{"name":"zz3zz1"}]
480
+ (server): []
481
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (857.358556ms)
482
+ (server): [{"name":"zz3zz1"}]
483
+ (server): [{"name":"zz3zz1"}]
484
+ (server): [{"name":"zz3zz1"}]
485
+ (server): [{"name":"zz3zz1"}]
486
+ (server): []
487
+ ✔ subscribe skipChangedColumnsCheck true (3410.568221ms)
488
+ unsubscribe start - various
489
+ unsubscribe end - various
490
+ ✔ subscribe (46.796302ms)
491
+ ✔ subscribe to schema.table (17.917755ms)
492
+ ✔ parallel subscriptions (2028.856594ms)
493
+ (server): updateAll done in 1572
494
+ (server): updateAll done in 1583
495
+ (server): Locks: [{"pid":157850,"blocking_pids":[157945],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"},{"pid":157851,"blocking_pids":[157945,157850],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
496
+ (server): Locks: [{"pid":157851,"blocking_pids":[157850],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
497
+ (server): Locks: [{"pid":157851,"blocking_pids":[157850],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
498
+ (server): Locks: [{"pid":157851,"blocking_pids":[157850],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":"commit"}]
499
+ (server): updateAll done in 2007
500
+ ✔ subscriptions do not serialize transactions (9687.729208ms)
501
+ Created PubSubManager
502
+ throttling sub for 1700 ms
503
+ ✔ subscribeOne with throttle (1736.510512ms)
504
+ throttling finished. pushSubData...
505
+ throttling sub for 1700 ms
506
+ ✔ subscribeOne with throttle skipFirst: true (1709.701911ms)
507
+ ✔ subscribeOne without skipFirst (1032.819668ms)
508
+ ✔ subscribeOne with skipFirst: true (1533.129637ms)
509
+ ✔ subscribeOne actions: { insert: true } (1542.102883ms)
510
+ ✔ subscribeOne actions: { insert: false } (1531.782361ms)
511
+ ✔ JSON filtering (4.389682ms)
512
+ ✔ Complex filtering (4.21076ms)
513
+ ✔ template_string function (3.584684ms)
514
+ ✔ Between filtering (2.095709ms)
515
+ ✔ In filtering (2.483927ms)
516
+ ✔ Order by (2.659236ms)
517
+ ✔ Order by aliased func (1.176585ms)
518
+ ✔ Filter by aliased func (1.022886ms)
519
+ ✔ Count with Filter by aliased func (1.343395ms)
520
+ ✔ Count with Aggregate and Filter by aliased func (1.359835ms)
521
+ ✔ Count with complex filter (1.166944ms)
522
+ ✔ Order by aggregation (0.840844ms)
523
+ ✔ Aggregate FILTER and ORDER BY (1.429739ms)
524
+ ✔ Column alias func (1.328192ms)
525
+ ✔ Order by colliding alias name (1.114801ms)
526
+ ✔ Update batch example (13.199289ms)
527
+ TODO: socket.io stringifies dates
528
+ ✔ Function example (14.171562ms)
529
+ ✔ JSONB filtering (4.303772ms)
530
+ ✔ Postgis examples (5.548826ms)
531
+ ✔ jsonbSchema validation (45.429372ms)
532
+ ✔ find and findOne (1.143299ms)
533
+ ✔ Result size (1.211723ms)
534
+ ✔ Basic exists (1.797554ms)
535
+ ✔ Basic fts with shorthand notation (1.832842ms)
536
+ ✔ Exists with shortest path wildcard filter example (2.164154ms)
537
+ ✔ Exists with exact path filter example (0.679784ms)
538
+ ✔ Not Exists with exact path filter example (0.673969ms)
539
+ ✔ Upsert example (12.484601ms)
540
+ ✔ Joins example (1.389387ms)
541
+ ✔ Joins repeating table example (1.7509ms)
542
+ ✔ Join aggregate functions example (5.743406ms)
543
+ ✔ $rowhash example (2.740335ms)
544
+ ✔ Reference column nested insert (7.433661ms)
545
+ ✔ Join escaped table names with quotes (8.861205ms)
546
+ (server): {
547
+ "item": {
548
+ "\"id0\"": 1,
549
+ "\"quoted1_id\"": 1,
550
+ "\"text_col0\"": "0"
551
+ },
552
+ "runs": 0
553
+ }
554
+ (server): {
555
+ "item": {
556
+ "\"id0\"": 1,
557
+ "\"quoted1_id\"": 1,
558
+ "\"text_col0\"": "1"
559
+ },
560
+ "runs": 1
561
+ }
562
+ unsubscribe start - """quoted0"""
563
+ unsubscribe end - """quoted0"""
564
+ ✔ subscribe to escaped table name (17.406729ms)
565
+ ✔ subscribe using a filter bigger than block_size (16.480428ms)
566
+ ✔ Reverse join with agg (13.118265ms)
567
+ {
568
+ _rows: [
569
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
570
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
571
+ ],
572
+ runs: 1
573
+ }
574
+ {
575
+ _rows: [
576
+ { id: 1, t1: null, tr2: [Array], tr3: [] },
577
+ { id: 2, t1: null, tr2: [Array], tr3: [] }
578
+ ],
579
+ runs: 2
580
+ }
581
+ ✔ Related table subscribe (9054.319092ms)
582
+ ✔ Aggregate FILTER registers joined dependency triggers (668.167059ms)
583
+ ✔ Nested sort by computed col (10.150498ms)
584
+ ✔ Nested function on different than source column getNewQuery name bug fix (2.30279ms)
585
+ ✔ Reference column deep nested insert (23.246659ms)
586
+ ✔ Multi reference column nested insert (16.553795ms)
587
+ ✔ Join path with order by nested (8.187899ms)
588
+ ✔ Self join (17.555054ms)
589
+ ✔ One to many multi join duplicate row bug fix (14.195911ms)
590
+ (server): various id=99 count
591
+ (server): various id=99 count
592
+ ok
593
+ (server): various id=99 count
594
+ (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: af82de04-1cab-4783-8b84-a07df2429e1c\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"}
595
+ ok
596
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6539.086081ms)
597
+ ✔ Isomorphic queries (49751.436042ms)
598
+ ✔ Having clause (2.657844ms)
599
+ ✔ Having clause with complex filter (1.950212ms)
600
+ (server): Server isomorphic tests successful
601
+ (server): Stopping server ...
602
+ ℹ tests 135
603
+ ℹ suites 2
604
+ ℹ pass 135
605
+ ℹ fail 0
606
+ ℹ cancelled 0
607
+ ℹ skipped 0
608
+ ℹ todo 0
609
+ ℹ duration_ms 76459.196376
610
+
611
+ > server_tests@1.0.0 test-client
612
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
613
+
614
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
615
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
616
+
617
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
618
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
619
+ id TEXT PRIMARY KEY
620
+ , "description" TEXT
621
+ );
622
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
623
+
624
+ CREATE TABLE "files" (
625
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
626
+ "storage_key" UUID UNIQUE ,
627
+ "extension" TEXT NOT NULL DEFAULT '' ,
628
+ "content_type" TEXT NOT NULL DEFAULT '' ,
629
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
630
+ "etag" TEXT NOT NULL DEFAULT '' ,
631
+ "original_name" TEXT NOT NULL ,
632
+ "original_last_modified" TIMESTAMPTZ ,
633
+ "description" TEXT ,
634
+ "url" TEXT NOT NULL DEFAULT '' ,
635
+ "cloud_url" TEXT ,
636
+ "signed_url" TEXT ,
637
+ "signed_url_expires" BIGINT ,
638
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
639
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
640
+ "deleted" TIMESTAMPTZ ,
641
+ "deleted_from_storage" TIMESTAMPTZ ,
642
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
643
+ "version" INTEGER NOT NULL DEFAULT 1 ,
644
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
645
+ );
646
+ CREATE TABLE "files_versions" (
647
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
648
+ "storage_key" UUID NOT NULL ,
649
+ "extension" TEXT NOT NULL DEFAULT '' ,
650
+ "content_type" TEXT NOT NULL DEFAULT '' ,
651
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
652
+ "etag" TEXT NOT NULL DEFAULT '' ,
653
+ "original_name" TEXT NOT NULL ,
654
+ "original_last_modified" TIMESTAMPTZ ,
655
+ "description" TEXT ,
656
+ "url" TEXT NOT NULL DEFAULT '' ,
657
+ "cloud_url" TEXT ,
658
+ "signed_url" TEXT ,
659
+ "signed_url_expires" BIGINT ,
660
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
661
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
662
+ "deleted" TIMESTAMPTZ ,
663
+ "deleted_from_storage" TIMESTAMPTZ ,
664
+ "file_id" UUID NOT NULL ,
665
+ "version" INTEGER NOT NULL ,
666
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
667
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
668
+ );
669
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
670
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
671
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
672
+ CREATE TABLE "users_public_info" (
673
+ "id" SERIAL PRIMARY KEY ,
674
+ "name" TEXT ,
675
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
676
+ "sid" TEXT
677
+ );
678
+ DROP TABLE IF EXISTS "users";
679
+ CREATE TABLE "users" (
680
+ "id" SERIAL PRIMARY KEY ,
681
+ "email" TEXT NOT NULL ,
682
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
683
+ "type" TEXT NOT NULL ,
684
+ "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"}' ))
685
+ );
686
+ DROP TABLE IF EXISTS "tjson";
687
+ CREATE TABLE "tjson" (
688
+ "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"}' )),
689
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
690
+ "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"}' )),
691
+ "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"}' )),
692
+ "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"}' ))
693
+ );
694
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
695
+
696
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
697
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
698
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
699
+ DROP TABLE IF EXISTS "api_table";
700
+ CREATE TABLE "api_table" (
701
+ "id" SERIAL PRIMARY KEY
702
+ );
703
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
704
+ (server): prostgles onReady
705
+ (server): Waiting for client...
706
+ (client) t+ 0ms Started client...
707
+ onSocketConnect GltSrQ-s1mRJPZotAAAA
708
+ (server): Client connected -> console does not work. use log function. socket.id: GltSrQ-s1mRJPZotAAAA
709
+ (client) t+ 39ms Client connect.
710
+ (client) t+ 172ms TEST_NAME: syncTriggerCleanup Started
711
+ Created PubSubManager
712
+ Pushing 0 rows to socket
713
+ ✔ subscription receives an update immediately after another trigger is deleted (407.451011ms)
714
+ Pushing 1 rows to socket x2
715
+ Pushing 0 rows to socket
716
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
717
+ Client log (client) t+ 3243ms TEST_NAME: syncTriggerCleanup Finished OK
718
+ ✔ unsubscribe cleanup preserves a sync being registered (2658.341556ms)
719
+ Client test successful
720
+ (server): Stopping server ...
721
+ ℹ tests 2
722
+ ℹ suites 0
723
+ ℹ pass 2
724
+ ℹ fail 0
725
+ ℹ cancelled 0
726
+ ℹ skipped 0
727
+ ℹ todo 0
728
+ ℹ duration_ms 11431.540573
729
+
730
+ > server_tests@1.0.0 test-client
731
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
732
+
733
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
734
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
735
+
736
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
737
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
738
+ id TEXT PRIMARY KEY
739
+ , "description" TEXT
740
+ );
741
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
742
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
743
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
744
+
745
+ CREATE TABLE "files" (
746
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
747
+ "storage_key" UUID UNIQUE ,
748
+ "extension" TEXT NOT NULL DEFAULT '' ,
749
+ "content_type" TEXT NOT NULL DEFAULT '' ,
750
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
751
+ "etag" TEXT NOT NULL DEFAULT '' ,
752
+ "original_name" TEXT NOT NULL ,
753
+ "original_last_modified" TIMESTAMPTZ ,
754
+ "description" TEXT ,
755
+ "url" TEXT NOT NULL DEFAULT '' ,
756
+ "cloud_url" TEXT ,
757
+ "signed_url" TEXT ,
758
+ "signed_url_expires" BIGINT ,
759
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
760
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
761
+ "deleted" TIMESTAMPTZ ,
762
+ "deleted_from_storage" TIMESTAMPTZ ,
763
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
764
+ "version" INTEGER NOT NULL DEFAULT 1 ,
765
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
766
+ );
767
+ CREATE TABLE "files_versions" (
768
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
769
+ "storage_key" UUID NOT NULL ,
770
+ "extension" TEXT NOT NULL DEFAULT '' ,
771
+ "content_type" TEXT NOT NULL DEFAULT '' ,
772
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
773
+ "etag" TEXT NOT NULL DEFAULT '' ,
774
+ "original_name" TEXT NOT NULL ,
775
+ "original_last_modified" TIMESTAMPTZ ,
776
+ "description" TEXT ,
777
+ "url" TEXT NOT NULL DEFAULT '' ,
778
+ "cloud_url" TEXT ,
779
+ "signed_url" TEXT ,
780
+ "signed_url_expires" BIGINT ,
781
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
782
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
783
+ "deleted" TIMESTAMPTZ ,
784
+ "deleted_from_storage" TIMESTAMPTZ ,
785
+ "file_id" UUID NOT NULL ,
786
+ "version" INTEGER NOT NULL ,
787
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
788
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
789
+ );
790
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
791
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
792
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
793
+ CREATE TABLE "users_public_info" (
794
+ "id" SERIAL PRIMARY KEY ,
795
+ "name" TEXT ,
796
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
797
+ "sid" TEXT
798
+ );
799
+ DROP TABLE IF EXISTS "users";
800
+ CREATE TABLE "users" (
801
+ "id" SERIAL PRIMARY KEY ,
802
+ "email" TEXT NOT NULL ,
803
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
804
+ "type" TEXT NOT NULL ,
805
+ "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"}' ))
806
+ );
807
+ DROP TABLE IF EXISTS "tjson";
808
+ CREATE TABLE "tjson" (
809
+ "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"}' )),
810
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
811
+ "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"}' )),
812
+ "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"}' )),
813
+ "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"}' ))
814
+ );
815
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
816
+
817
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
818
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
819
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
820
+ DROP TABLE IF EXISTS "api_table";
821
+ CREATE TABLE "api_table" (
822
+ "id" SERIAL PRIMARY KEY
823
+ );
824
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
825
+ (server): prostgles onReady
826
+ (server): Waiting for client...
827
+ (client) t+ 0ms Started client...
828
+ onSocketConnect tNlzarBscS4noy_NAAAA
829
+ (server): Client connected -> console does not work. use log function. socket.id: tNlzarBscS4noy_NAAAA
830
+ (client) t+ 40ms Client connect.
831
+ (client) t+ 174ms TEST_NAME: main Started
832
+ Client log (client) t+ 195ms Starting isomorphic queries
833
+ ▶ Isomorphic queries
834
+ ✔ Deleting stale data (24.635325ms)
835
+ {
836
+ message: 'malformed array literal: "a"',
837
+ length: 149,
838
+ name: 'error',
839
+ severity: 'ERROR',
840
+ code: '22P02',
841
+ detail: 'Array value must start with "{" or dimension information.',
842
+ position: '325',
843
+ file: 'arrayfuncs.c',
844
+ line: '317',
845
+ routine: 'array_in',
846
+ query: '-- prostgles query id: f57890dd-d3c3-41e6-a566-c33a0ed4352e\n' +
847
+ 'SET LOCAL "prostgles.user" \n' +
848
+ `TO '{"id":"1","type":"public"}';\n` +
849
+ 'SELECT \n' +
850
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
851
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
852
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
853
+ ' FROM ( \n' +
854
+ ' SELECT * \n' +
855
+ ' FROM items \n' +
856
+ ` WHERE "h" = 'a' \n` +
857
+ ' ) prostgles_root_table_alias \n' +
858
+ ' LIMIT 0',
859
+ code_info: 'invalid_text_representation'
860
+ }
861
+ {
862
+ message: 'malformed array literal: "a"',
863
+ length: 149,
864
+ name: 'error',
865
+ severity: 'ERROR',
866
+ code: '22P02',
867
+ detail: 'Array value must start with "{" or dimension information.',
868
+ position: '325',
869
+ file: 'arrayfuncs.c',
870
+ line: '317',
871
+ routine: 'array_in',
872
+ query: '-- prostgles query id: 067fe4b9-f26c-423e-823d-22efde80ef7a\n' +
873
+ 'SET LOCAL "prostgles.user" \n' +
874
+ `TO '{"id":"1","type":"public"}';\n` +
875
+ 'SELECT \n' +
876
+ ' "prostgles_root_table_alias"."id" AS "id", \n' +
877
+ ' "prostgles_root_table_alias"."h" AS "h", \n' +
878
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
879
+ ' FROM ( \n' +
880
+ ' SELECT * \n' +
881
+ ' FROM items \n' +
882
+ ` WHERE "h" = 'a' \n` +
883
+ ' ) prostgles_root_table_alias \n' +
884
+ ' LIMIT 0',
885
+ code_info: 'invalid_text_representation'
886
+ }
887
+ ✔ Error structure malformed array literal (39.798227ms)
888
+ ✔ Table info (4.268278ms)
889
+ ✔ Prepare data (77.357311ms)
890
+ ✔ Test bytea (11.970385ms)
891
+ ✔ abortSignal terminates a running query (5544.009667ms)
892
+ ✔ Client queries are aborted no more than after n seconds (14013.237482ms)
893
+ ✔ Subscription tracked_columns get merged correctly (0.518521ms)
894
+ Created PubSubManager
895
+ ✔ Aggregate subscription tracks FILTER and ORDER BY dependencies (1012.46179ms)
896
+ ✔ CASE select and subscription dependencies (674.508037ms)
897
+ ✔ Subscription tracks non-selected ORDER BY columns (642.90201ms)
898
+ ✔ merge json (14.565801ms)
899
+ ✔ json array converted to pg array filter bug (3.239147ms)
900
+ ✔ onConflict do update (8.523943ms)
901
+ ✔ Local file upload (36.771715ms)
902
+ ✔ Local file delete (17.268925ms)
903
+ ✔ Local file update (50.50934ms)
904
+ ✔ getColumns definition (1.652551ms)
905
+ ✔ returnType (0.714758ms)
906
+ ✔ Table config triggers (5.623738ms)
907
+ ✔ $unnest_words (1.18072ms)
908
+ ✔ Group by/Distinct (1.998214ms)
909
+ ✔ sql returntype default-with-rollback (13.562284ms)
910
+ ✔ returnType: value (1.155367ms)
911
+ ✔ PostgreSQL array element (4.020764ms)
912
+ ✔ FTS filtering (4.365721ms)
913
+ ✔ $term_highlight (3.421564ms)
914
+ ✔ funcFilters: $term_highlight (1.649139ms)
915
+ Client log (client) t+ 22427ms [{"name":null}]
916
+ Client log (client) t+ 22442ms [{"name":"zz3zz1"}]
917
+ Pushing 1 rows to socket x9
918
+ Client log (client) t+ 23097ms []
919
+ ✔ subscribe skipChangedColumnsCheck false by default = sub should not fire if selected data did not change (876.267178ms)
920
+ Pushing 0 rows to socket
921
+ Client log (client) t+ 25831ms [{"name":null}]
922
+ Client log (client) t+ 25836ms [{"name":"zz3zz1"}]
923
+ Client log (client) t+ 26055ms [{"name":"zz3zz1"}]
924
+ Client log (client) t+ 26274ms [{"name":"zz3zz1"}]
925
+ Pushing 1 rows to socket x4
926
+ Client log (client) t+ 26488ms []
927
+ ✔ subscribe skipChangedColumnsCheck true (3391.367841ms)
928
+ Pushing 0 rows to socket
929
+ Pushing 1 rows to socket x4
930
+ Client log unsubscribe start - various
931
+ Client log unsubscribe end - various
932
+ ✔ subscribe (59.70729ms)
933
+ Pushing 0 rows to socket
934
+ Pushing 1 rows to socket
935
+ ✔ subscribe to schema.table (18.614641ms)
936
+ Pushing 2 rows to socket
937
+ ✔ parallel subscriptions (2010.683935ms)
938
+ Client log (client) t+ 32982ms updateAll done in 1701
939
+ Client log (client) t+ 34606ms updateAll done in 1620
940
+ Pushing 0 rows to socket
941
+ Pushing 3 rows to socket
942
+ Client log (client) t+ 35148ms Locks: [{"pid":159925,"blocking_pids":[159931],"wait_event":"object","wait_event_type":"Lock","query":"commit","blocking_query":null}]
943
+ Pushing 996 rows to socket
944
+ Client log (client) t+ 36673ms updateAll done in 2056
945
+ Pushing 1000 rows to socket x2
946
+ ✔ subscriptions do not serialize transactions (9910.669886ms)
947
+ Pushing 3 rows to socket
948
+ Pushing 1 rows to socket
949
+ throttling sub for 1700 ms
950
+ throttling finished. pushSubData...
951
+ Pushing 1 rows to socket
952
+ throttling sub for 1700 ms
953
+ ✔ subscribeOne with throttle (1755.451906ms)
954
+ throttling sub for 1700 ms
955
+ throttling finished. pushSubData...
956
+ ✔ subscribeOne with throttle skipFirst: true (1703.447486ms)
957
+ Pushing 1 rows to socket
958
+ throttling finished. pushSubData...
959
+ Pushing 1 rows to socket
960
+ ✔ subscribeOne without skipFirst (1061.724132ms)
961
+ Pushing 0 rows to socket
962
+ Pushing 1 rows to socket
963
+ ✔ subscribeOne with skipFirst: true (1562.929561ms)
964
+ Pushing 0 rows to socket x2
965
+ ✔ subscribeOne actions: { insert: true } (1582.015748ms)
966
+ Pushing 1 rows to socket
967
+ ✔ subscribeOne actions: { insert: false } (1585.49607ms)
968
+ ✔ JSON filtering (7.01013ms)
969
+ ✔ Complex filtering (4.387333ms)
970
+ ✔ template_string function (4.896448ms)
971
+ ✔ Between filtering (3.784952ms)
972
+ ✔ In filtering (3.768853ms)
973
+ ✔ Order by (3.550816ms)
974
+ ✔ Order by aliased func (2.484582ms)
975
+ ✔ Filter by aliased func (1.961288ms)
976
+ ✔ Count with Filter by aliased func (2.738841ms)
977
+ ✔ Count with Aggregate and Filter by aliased func (3.189136ms)
978
+ ✔ Count with complex filter (3.059841ms)
979
+ ✔ Order by aggregation (2.132004ms)
980
+ ✔ Aggregate FILTER and ORDER BY (2.255646ms)
981
+ ✔ Column alias func (2.563005ms)
982
+ ✔ Order by colliding alias name (2.0847ms)
983
+ ✔ Update batch example (31.509705ms)
984
+ Client log TODO: socket.io stringifies dates
985
+ ✔ Function example (27.567933ms)
986
+ ✔ JSONB filtering (12.466689ms)
987
+ ✔ Postgis examples (16.018385ms)
988
+ ✔ jsonbSchema validation (14.64404ms)
989
+ ✔ find and findOne (5.303205ms)
990
+ ✔ Result size (4.459221ms)
991
+ ✔ Basic exists (5.713837ms)
992
+ ✔ Basic fts with shorthand notation (3.636467ms)
993
+ ✔ Exists with shortest path wildcard filter example (5.879788ms)
994
+ ✔ Exists with exact path filter example (1.776867ms)
995
+ ✔ Not Exists with exact path filter example (2.300734ms)
996
+ ✔ Upsert example (19.976553ms)
997
+ ✔ Joins example (3.508541ms)
998
+ ✔ Joins repeating table example (2.987675ms)
999
+ ✔ Join aggregate functions example (6.592861ms)
1000
+ ✔ $rowhash example (3.96356ms)
1001
+ ✔ Reference column nested insert (5.798938ms)
1002
+ ✔ Join escaped table names with quotes (9.785211ms)
1003
+ Pushing 0 rows to socket x2
1004
+ Client log (client) t+ 48181ms {
1005
+ "item": {
1006
+ "\"id0\"": 1,
1007
+ "\"quoted1_id\"": 1,
1008
+ "\"text_col0\"": "0"
1009
+ },
1010
+ "runs": 0
1011
+ }
1012
+ Client log (client) t+ 48185ms {
1013
+ "item": {
1014
+ "\"id0\"": 1,
1015
+ "\"quoted1_id\"": 1,
1016
+ "\"text_col0\"": "1"
1017
+ },
1018
+ "runs": 1
1019
+ }
1020
+ Client log unsubscribe start - """quoted0"""
1021
+ Client log unsubscribe end - """quoted0"""
1022
+ ✔ subscribe to escaped table name (13.763253ms)
1023
+ Pushing 1 rows to socket x2
1024
+ ✔ subscribe using a filter bigger than block_size (15.81619ms)
1025
+ ✔ Reverse join with agg (20.950836ms)
1026
+ Pushing 0 rows to socket
1027
+ 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}
1028
+ 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}
1029
+ ✔ Related table subscribe (9091.252502ms)
1030
+ Pushing 2 rows to socket x2
1031
+ ✔ Aggregate FILTER registers joined dependency triggers (760.714506ms)
1032
+ ✔ Nested sort by computed col (15.068024ms)
1033
+ ✔ Nested function on different than source column getNewQuery name bug fix (3.123477ms)
1034
+ ✔ Reference column deep nested insert (25.030941ms)
1035
+ ✔ Multi reference column nested insert (18.984025ms)
1036
+ ✔ Join path with order by nested (11.553337ms)
1037
+ ✔ Self join (27.649794ms)
1038
+ ✔ One to many multi join duplicate row bug fix (18.675549ms)
1039
+ Client log (client) t+ 58204ms various id=99 count 1
1040
+ Pushing 1 rows to socket x3
1041
+ Client log (client) t+ 58233ms various id=99 count
1042
+ Client log ok
1043
+ Error within running subscription
1044
+ _psqlWS_..various.{"id":99}.{"select":{"name":1}}.m.sub {
1045
+ message: 'column prostgles_root_table_alias.name does not exist',
1046
+ length: 130,
1047
+ name: 'error',
1048
+ severity: 'ERROR',
1049
+ code: '42703',
1050
+ position: '133',
1051
+ file: 'parse_relation.c',
1052
+ line: '3665',
1053
+ routine: 'errorMissingColumn',
1054
+ query: '-- prostgles query id: 3d2b273d-d884-4cb9-a197-9e74e840c46f\n' +
1055
+ 'SET LOCAL "prostgles.user" \n' +
1056
+ `TO '{"id":"1","type":"public"}';\n` +
1057
+ 'SELECT \n' +
1058
+ ' "prostgles_root_table_alias"."name" AS "name" \n' +
1059
+ ' FROM ( \n' +
1060
+ ' SELECT * \n' +
1061
+ ' FROM various \n' +
1062
+ ' WHERE "id" = 99 \n' +
1063
+ ' ) prostgles_root_table_alias \n' +
1064
+ ' LIMIT 1000',
1065
+ code_info: 'undefined_column'
1066
+ }
1067
+ Client log (client) t+ 60282ms various id=99 count
1068
+ Client log (client) t+ 60282ms 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: 3d2b273d-d884-4cb9-a197-9e74e840c46f\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"}
1069
+ Client log ok
1070
+ ✔ subscribe triggers with stale schema should fail gracefully and never block other queries (6622.87097ms)
1071
+ ✔ Isomorphic queries (64620.405381ms)
1072
+ ✔ Having clause (3.861498ms)
1073
+ ✔ Having clause with complex filter (2.299421ms)
1074
+ Client log (client) t+ 64835ms auth.user: {"sid":"main","uid":"1","id":"1","type":"public"}
1075
+ ✔ Nested join having clause (3.115334ms)
1076
+ ▶ isomorphic typed queries
1077
+ ✔ isLookupTable DB Types from colConf (0.167246ms)
1078
+ ✔ isLookupTable DB Types from reference column actual definition (0.100502ms)
1079
+ ✔ isLookupTable pkey column itself is typed (0.073716ms)
1080
+ ✔ isomorphic typed queries (0.492298ms)
1081
+ ▶ Client only queries
1082
+ ✔ modifyClientSchema adds custom table and column metadata (2.983722ms)
1083
+ ✔ SQL Stream more than 1k records (17.051977ms)
1084
+ ✔ SQL Stream persistedConnection with streamLimit works for subsequent queries (11.575679ms)
1085
+ ✔ SQL Stream ensure the connection is never released (same pg_backend_pid is the same for subsequent) when using persistConnectionId (10.651844ms)
1086
+ ✔ SQL Stream stop kills the query (1029.105364ms)
1087
+ ✔ SQL Stream limit works (27.689825ms)
1088
+ ✔ SQL Stream stop with terminate kills the query (expect flakiness) (136.345788ms)
1089
+ ✔ SQL Stream (11.889022ms)
1090
+ ✔ SQL Stream parallel execution + parameters (13.405312ms)
1091
+ ✔ SQL Stream query error structure matches default sql run error (13.101375ms)
1092
+ ✔ SQL Stream streamLimit (10.784975ms)
1093
+ ✔ SQL Stream table fields are the same as on default request (43.87191ms)
1094
+ ✔ SQL Stream works for multiple statements (14.745949ms)
1095
+ Client log (client) t+ 66198ms Checking public data
1096
+ ✔ Check tableSchema (18.630289ms)
1097
+ ✔ Security rules example (36.02968ms)
1098
+ Client log (client) t+ 66247ms Started testRealtime
1099
+ Client log (client) t+ 66273ms 1790854782181: sub stats: x10 -> 0 x20 ->0
1100
+ Client log (client) t+ 66280ms 1790854782188: sync stats: x10 -> 0 x20 -> 0
1101
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 0)
1102
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 1)
1103
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 2)
1104
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 3)
1105
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 4)
1106
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 5)
1107
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 6)
1108
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 7)
1109
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 8)
1110
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 9)
1111
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 10)
1112
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 11)
1113
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 12)
1114
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 13)
1115
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 14)
1116
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 15)
1117
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 16)
1118
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 17)
1119
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 18)
1120
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 19)
1121
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 20)
1122
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 21)
1123
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 22)
1124
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 23)
1125
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 24)
1126
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 25)
1127
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 26)
1128
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 27)
1129
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 28)
1130
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 29)
1131
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 30)
1132
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 31)
1133
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 32)
1134
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 33)
1135
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 34)
1136
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 35)
1137
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 36)
1138
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 37)
1139
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 38)
1140
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 39)
1141
+ Client log (client) t+ 66280ms 1790854782188: sync: p.$update({ x: 10 }); (id: 40)
1142
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 41)
1143
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 42)
1144
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 43)
1145
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 44)
1146
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 45)
1147
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 46)
1148
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 47)
1149
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 48)
1150
+ Client log (client) t+ 66281ms 1790854782189: sync: p.$update({ x: 10 }); (id: 49)
1151
+ Pushing 0 rows to socket x3
1152
+ upsertData (from client): inserted( 0 ) updated( 50 ) total( 50 )
1153
+ last insert undefined
1154
+ last update {"id":49,"x":10,"y":49,"flight_number":"FN49","last_updated":1790854782189}
1155
+ Client log (client) t+ 66369ms 1790854782277: sub stats: x10 -> 50 x20 ->0
1156
+ Pushing 50 rows to socket
1157
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1158
+ last insert undefined
1159
+ last update undefined
1160
+ server.syncBatch planes: inserted( 0 ) updated( 50 ) deleted( 0 ) pushed to client( 50 ) total( 100 ) undefined
1161
+ Client log (client) t+ 66380ms 1790854782288: sync stats: x10 -> 50 x20 -> 0
1162
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 50)
1163
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 51)
1164
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 52)
1165
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 53)
1166
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 54)
1167
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 55)
1168
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 56)
1169
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 57)
1170
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 58)
1171
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 59)
1172
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 60)
1173
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 61)
1174
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 62)
1175
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 63)
1176
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 64)
1177
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 65)
1178
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 66)
1179
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 67)
1180
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 68)
1181
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 69)
1182
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 70)
1183
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 71)
1184
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 72)
1185
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 73)
1186
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 74)
1187
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 75)
1188
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 76)
1189
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 77)
1190
+ Client log (client) t+ 66380ms 1790854782288: sync: p.$update({ x: 10 }); (id: 78)
1191
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 79)
1192
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 80)
1193
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 81)
1194
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 82)
1195
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 83)
1196
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 84)
1197
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 85)
1198
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 86)
1199
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 87)
1200
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 88)
1201
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 89)
1202
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 90)
1203
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 91)
1204
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 92)
1205
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 93)
1206
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 94)
1207
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 95)
1208
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 96)
1209
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 97)
1210
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 98)
1211
+ Client log (client) t+ 66381ms 1790854782289: sync: p.$update({ x: 10 }); (id: 99)
1212
+ Client log (client) t+ 66384ms 1790854782292: sync stats: x10 -> 100 x20 -> 0
1213
+ upsertData (from WAL): inserted( 0 ) updated( 0 ) total( 1 )
1214
+ last insert undefined
1215
+ last update undefined
1216
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 50 )
1217
+ last insert undefined
1218
+ last update {"id":50,"x":10,"last_updated":1790854782288}
1219
+ Client log (client) t+ 66511ms 1790854782419: sub stats: x10 -> 51 x20 ->0
1220
+ Pushing 51 rows to socket
1221
+ upsertData (from WAL): inserted( 0 ) updated( 49 ) total( 49 )
1222
+ last insert undefined
1223
+ last update {"id":99,"x":10,"last_updated":1790854782289}
1224
+ Client log (client) t+ 66661ms 1790854782569: sub stats: x10 -> 100 x20 ->0
1225
+ Client log (client) t+ 68662ms 1790854784570: sub: db.planes.update({}, { x: 20, last_updated });
1226
+ Client log (client) t+ 68690ms 1790854784593: sub: Updated to x20 100
1227
+ Pushing 100 rows to socket
1228
+ Client log (client) t+ 68703ms 1790854784611: sync stats: x10 -> 50 x20 -> 50
1229
+ Client log (client) t+ 68713ms 1790854784621: sync stats: x10 -> 0 x20 -> 100
1230
+ Client log (client) t+ 68713ms 1790854784621: sync end: Finished replication test. Inserting 100 rows then updating two times took: 466ms
1231
+ ✔ Realtime (2478.957869ms)
1232
+ Client log (client) t+ 68714ms sync handlesOnData true 100
1233
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 21 )
1234
+ last insert undefined
1235
+ last update undefined x2
1236
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 100 ) total( 100 ) undefined
1237
+ ✔ sync handlesOnData true -> false no data bug (2000.827176ms)
1238
+ ﹣ Security rules example (0.271445ms) # SKIP
1239
+ ✔ Client only queries (5879.229376ms)
1240
+ ▶ React hooks
1241
+ ✔ useFind (529.161297ms)
1242
+ {
1243
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1244
+ }
1245
+ ✔ useSubscribe (521.688233ms)
1246
+ ✔ useFindOne (508.640495ms)
1247
+ Pushing 1 rows to socket
1248
+ {
1249
+ message: 'items4.named is invalid/disallowed for filtering. Allowed columns: added, "id", "public", "name"'
1250
+ }
1251
+ ✔ useSubscribeOne (536.377193ms)
1252
+ ✔ useCount (506.096536ms)
1253
+ ✔ useSize (508.604316ms)
1254
+ ✔ useCount planes (254.142467ms)
1255
+ Pushing 2 rows to socket
1256
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1257
+ last insert undefined
1258
+ last update undefined
1259
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1260
+ last insert undefined
1261
+ last update undefined
1262
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1263
+ Client log (client) t+ 74414ms 1790854790322: sync stats: x10 -> 0 x20 -> 99
1264
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1265
+ last insert undefined
1266
+ last update undefined
1267
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 2 ) total( 100 ) undefined
1268
+ ✔ useSync (570.38907ms)
1269
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1270
+ last insert undefined
1271
+ last update undefined x2
1272
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1273
+ Client log (client) t+ 74684ms 1790854790592: sync stats: x10 -> 0 x20 -> 100
1274
+ Client log (client) t+ 74684ms 1790854790592: sync end: Finished replication test. Inserting 100 rows then updating two times took: 6437ms
1275
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1276
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1277
+ last insert undefined
1278
+ last update undefined x2
1279
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1280
+ Client log (client) t+ 74967ms 1790854790875: sync stats: x10 -> 0 x20 -> 99
1281
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1282
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1283
+ last insert undefined
1284
+ last update {"id":0,"x":232,"last_updated":1790854790882}
1285
+ Client log (client) t+ 74991ms 1790854790899: sync stats: x10 -> 0 x20 -> 99
1286
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1287
+ last insert undefined
1288
+ last update undefined
1289
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1290
+ ✔ useSync updates invalidate useMemo without mutating old data (343.15253ms)
1291
+ Client log (client) t+ 75026ms 1790854790934: sync stats: x10 -> 0 x20 -> 99
1292
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1293
+ last insert undefined
1294
+ last update undefined x2
1295
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1296
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1297
+ Client log (client) t+ 75314ms 1790854791222: sync stats: x10 -> 0 x20 -> 99
1298
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1299
+ last insert undefined
1300
+ last update undefined x2
1301
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1302
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1303
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1304
+ last insert undefined
1305
+ last update {"id":0,"x":32,"last_updated":1790854791241}
1306
+ ✔ concurrent useSync hooks with matching options all update (359.556846ms)
1307
+ Client log (client) t+ 75356ms 1790854791264: sync stats: x10 -> 0 x20 -> 99
1308
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1309
+ last insert undefined
1310
+ last update undefined
1311
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
1312
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1313
+ last insert undefined
1314
+ last update undefined
1315
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 51 ) total( 52 ) undefined
1316
+ Client log (client) t+ 75675ms Reconnected
1317
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1318
+ last insert undefined
1319
+ last update undefined
1320
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 151 ) total( 201 ) undefined
1321
+ Client log (client) t+ 75726ms 1790854791634: sync stats: x10 -> 1 x20 -> 100
1322
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999000)
1323
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999001)
1324
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999002)
1325
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999003)
1326
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999004)
1327
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999005)
1328
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999006)
1329
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999007)
1330
+ Client log (client) t+ 75727ms 1790854791635: sync: p.$update({ x: 10 }); (id: 999008)
1331
+ Client log (client) t+ 75727ms 1790854791635: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7480ms
1332
+ Client log (client) t+ 75728ms TEST_NAME: main Started
1333
+ Client log (client) t+ 75730ms 1790854791638: sync stats: x10 -> 10 x20 -> 100
1334
+ Client log (client) t+ 75730ms 1790854791638: sync end: Finished replication test. Inserting 100 rows then updating two times took: 7483ms
1335
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1336
+ last insert undefined
1337
+ last update undefined
1338
+ upsertData (from WAL): inserted( 0 ) updated( 1 ) total( 1 )
1339
+ last insert undefined
1340
+ last update {"id":999000,"x":10,"last_updated":1790854791635}
1341
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1342
+ (server): Client disconnected. socket.id: tNlzarBscS4noy_NAAAA
1343
+ onSocketConnect _OH-U_rd-pVrXTBIAAAB
1344
+ (server): Client connected -> console does not work. use log function. socket.id: _OH-U_rd-pVrXTBIAAAB
1345
+ Client log (client) t+ 75769ms Disconnected
1346
+ Client log (client) t+ 77186ms Client connect.
1347
+ schemaChanged must syncHandler.destroySyncs()
1348
+ Client log (client) t+ 77306ms Reconnected
1349
+ upsertData (from client): inserted( 0 ) updated( 8 ) total( 9 )
1350
+ last insert undefined
1351
+ last update {"id":999008,"x":10,"y":999999,"flight_number":null,"last_updated":1790854791635}
1352
+ Client log (client) t+ 77331ms TEST_NAME: main Started
1353
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 50 )
1354
+ last insert undefined
1355
+ last update undefined
1356
+ upsertData (from client): inserted( 0 ) updated( 0 ) total( 1 )
1357
+ last insert undefined
1358
+ last update undefined
1359
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 153 ) total( 203 ) undefined
1360
+ Client log (client) t+ 77348ms 1790854793256: sync stats: x10 -> 10 x20 -> 100
1361
+ Client log (client) t+ 77348ms 1790854793256: sync end: Finished replication test. Inserting 100 rows then updating two times took: 9101ms
1362
+ server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 53 ) total( 54 ) undefined
1363
+ ✔ concurrent useSync hooks receive inserts after reattachment and reconnect (2009.720832ms)
1364
+ Client log (client) t+ 77365ms TEST_NAME: main Finished OK
1365
+ ✔ React hooks (6648.475445ms)
1366
+ Client test successful
1367
+ (server): Stopping server ...
1368
+ ℹ tests 122
1369
+ ℹ suites 4
1370
+ ℹ pass 121
1371
+ ℹ fail 0
1372
+ ℹ cancelled 0
1373
+ ℹ skipped 1
1374
+ ℹ todo 0
1375
+ ℹ duration_ms 85322.373855
1376
+
1377
+ > server_tests@1.0.0 test-client
1378
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1379
+
1380
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1381
+ Created PubSubManager
1382
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1383
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1384
+
1385
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1386
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1387
+ id TEXT PRIMARY KEY
1388
+ , "description" TEXT
1389
+ );
1390
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1391
+
1392
+ CREATE TABLE "files" (
1393
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1394
+ "storage_key" UUID UNIQUE ,
1395
+ "extension" TEXT NOT NULL DEFAULT '' ,
1396
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1397
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1398
+ "etag" TEXT NOT NULL DEFAULT '' ,
1399
+ "original_name" TEXT NOT NULL ,
1400
+ "original_last_modified" TIMESTAMPTZ ,
1401
+ "description" TEXT ,
1402
+ "url" TEXT NOT NULL DEFAULT '' ,
1403
+ "cloud_url" TEXT ,
1404
+ "signed_url" TEXT ,
1405
+ "signed_url_expires" BIGINT ,
1406
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1407
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1408
+ "deleted" TIMESTAMPTZ ,
1409
+ "deleted_from_storage" TIMESTAMPTZ ,
1410
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1411
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1412
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1413
+ );
1414
+ CREATE TABLE "files_versions" (
1415
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1416
+ "storage_key" UUID NOT NULL ,
1417
+ "extension" TEXT NOT NULL DEFAULT '' ,
1418
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1419
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1420
+ "etag" TEXT NOT NULL DEFAULT '' ,
1421
+ "original_name" TEXT NOT NULL ,
1422
+ "original_last_modified" TIMESTAMPTZ ,
1423
+ "description" TEXT ,
1424
+ "url" TEXT NOT NULL DEFAULT '' ,
1425
+ "cloud_url" TEXT ,
1426
+ "signed_url" TEXT ,
1427
+ "signed_url_expires" BIGINT ,
1428
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1429
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1430
+ "deleted" TIMESTAMPTZ ,
1431
+ "deleted_from_storage" TIMESTAMPTZ ,
1432
+ "file_id" UUID NOT NULL ,
1433
+ "version" INTEGER NOT NULL ,
1434
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1435
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1436
+ );
1437
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1438
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1439
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1440
+ CREATE TABLE "users_public_info" (
1441
+ "id" SERIAL PRIMARY KEY ,
1442
+ "name" TEXT ,
1443
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1444
+ "sid" TEXT
1445
+ );
1446
+ DROP TABLE IF EXISTS "users";
1447
+ CREATE TABLE "users" (
1448
+ "id" SERIAL PRIMARY KEY ,
1449
+ "email" TEXT NOT NULL ,
1450
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1451
+ "type" TEXT NOT NULL ,
1452
+ "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"}' ))
1453
+ );
1454
+ DROP TABLE IF EXISTS "tjson";
1455
+ CREATE TABLE "tjson" (
1456
+ "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"}' )),
1457
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1458
+ "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"}' )),
1459
+ "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"}' )),
1460
+ "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"}' ))
1461
+ );
1462
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1463
+
1464
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1465
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1466
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1467
+ DROP TABLE IF EXISTS "api_table";
1468
+ CREATE TABLE "api_table" (
1469
+ "id" SERIAL PRIMARY KEY
1470
+ );
1471
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1472
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1473
+ Prostgles: Created typescript schema definition file:
1474
+ DBGeneratedSchema.ts
1475
+ (server): prostgles onReady
1476
+ (server): Waiting for client...
1477
+ (client) t+ 0ms Started client...
1478
+ onSocketConnect afMyWSBTWsLLI5g3AAAA
1479
+ (server): Client connected -> console does not work. use log function. socket.id: afMyWSBTWsLLI5g3AAAA
1480
+ (client) t+ 42ms Client connect.
1481
+ (client) t+ 171ms TEST_NAME: useProstgles Started
1482
+ onSocketConnect kjyPaSJADRoOk8DEAAAB
1483
+ (server): Client connected -> console does not work. use log function. socket.id: kjyPaSJADRoOk8DEAAAB
1484
+ ▶ useProstgles hook
1485
+ ✔ useProstglesClient (491.817318ms)
1486
+ watchSchema: Full re-initialisation { query: 'Only shown in debug mode' }
1487
+ (server): Client disconnected. socket.id: kjyPaSJADRoOk8DEAAAB
1488
+ schemaChanged must syncHandler.destroySyncs()
1489
+ ✔ useProstglesClient with schema reload (2353.386009ms)
1490
+ onSocketConnect aDvfk4IT9100lrsAAAAD
1491
+ (server): Client connected -> console does not work. use log function. socket.id: aDvfk4IT9100lrsAAAAD
1492
+ (server): Client disconnected. socket.id: aDvfk4IT9100lrsAAAAD
1493
+ Client log (client) t+ 6808ms TEST_NAME: useProstgles Finished OK
1494
+ ✔ useProstglesClient with initial skip (766.43707ms)
1495
+ ✔ useProstgles hook (3613.515697ms)
1496
+ Client test successful
1497
+ (server): Stopping server ...
1498
+ ℹ tests 3
1499
+ ℹ suites 1
1500
+ ℹ pass 3
1501
+ ℹ fail 0
1502
+ ℹ cancelled 0
1503
+ ℹ skipped 0
1504
+ ℹ todo 0
1505
+ ℹ duration_ms 15261.400607
1506
+
1507
+ > server_tests@1.0.0 test-client
1508
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1509
+
1510
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1511
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1512
+
1513
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1514
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1515
+ id TEXT PRIMARY KEY
1516
+ , "description" TEXT
1517
+ );
1518
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
1519
+ INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
1520
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1521
+
1522
+ CREATE TABLE "files" (
1523
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1524
+ "storage_key" UUID UNIQUE ,
1525
+ "extension" TEXT NOT NULL DEFAULT '' ,
1526
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1527
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1528
+ "etag" TEXT NOT NULL DEFAULT '' ,
1529
+ "original_name" TEXT NOT NULL ,
1530
+ "original_last_modified" TIMESTAMPTZ ,
1531
+ "description" TEXT ,
1532
+ "url" TEXT NOT NULL DEFAULT '' ,
1533
+ "cloud_url" TEXT ,
1534
+ "signed_url" TEXT ,
1535
+ "signed_url_expires" BIGINT ,
1536
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1537
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1538
+ "deleted" TIMESTAMPTZ ,
1539
+ "deleted_from_storage" TIMESTAMPTZ ,
1540
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1541
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1542
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1543
+ );
1544
+ CREATE TABLE "files_versions" (
1545
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1546
+ "storage_key" UUID NOT NULL ,
1547
+ "extension" TEXT NOT NULL DEFAULT '' ,
1548
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1549
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1550
+ "etag" TEXT NOT NULL DEFAULT '' ,
1551
+ "original_name" TEXT NOT NULL ,
1552
+ "original_last_modified" TIMESTAMPTZ ,
1553
+ "description" TEXT ,
1554
+ "url" TEXT NOT NULL DEFAULT '' ,
1555
+ "cloud_url" TEXT ,
1556
+ "signed_url" TEXT ,
1557
+ "signed_url_expires" BIGINT ,
1558
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1559
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1560
+ "deleted" TIMESTAMPTZ ,
1561
+ "deleted_from_storage" TIMESTAMPTZ ,
1562
+ "file_id" UUID NOT NULL ,
1563
+ "version" INTEGER NOT NULL ,
1564
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1565
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1566
+ );
1567
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1568
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1569
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1570
+ CREATE TABLE "users_public_info" (
1571
+ "id" SERIAL PRIMARY KEY ,
1572
+ "name" TEXT ,
1573
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1574
+ "sid" TEXT
1575
+ );
1576
+ DROP TABLE IF EXISTS "users";
1577
+ CREATE TABLE "users" (
1578
+ "id" SERIAL PRIMARY KEY ,
1579
+ "email" TEXT NOT NULL ,
1580
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1581
+ "type" TEXT NOT NULL ,
1582
+ "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"}' ))
1583
+ );
1584
+ DROP TABLE IF EXISTS "tjson";
1585
+ CREATE TABLE "tjson" (
1586
+ "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"}' )),
1587
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1588
+ "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"}' )),
1589
+ "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"}' )),
1590
+ "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"}' ))
1591
+ );
1592
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1593
+
1594
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1595
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1596
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1597
+ DROP TABLE IF EXISTS "api_table";
1598
+ CREATE TABLE "api_table" (
1599
+ "id" SERIAL PRIMARY KEY
1600
+ );
1601
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1602
+ Prostgles: Created typescript schema definition file:
1603
+ DBGeneratedSchema.ts
1604
+ (server): prostgles onReady
1605
+ (server): Waiting for client...
1606
+ (client) t+ 0ms Started client...
1607
+ onSocketConnect h0lod6MThPCQtjpvAAAA
1608
+ (server): Client connected -> console does not work. use log function. socket.id: h0lod6MThPCQtjpvAAAA
1609
+ (client) t+ 28ms Client connect.
1610
+ (client) t+ 58ms TEST_NAME: files Started
1611
+ ▶ clientFileTests
1612
+ ✔ Files table is present (3.835351ms)
1613
+ ✔ Insert file from nested insert (27.357971ms)
1614
+ ✔ Cannot Insert file directly (5.96366ms)
1615
+ ✔ Disallowed updates cannot change stored bytes or create nested uploads (14.636846ms)
1616
+ ✔ Duplicate file IDs and failed validation preserve the original object (17.740871ms)
1617
+ ✔ Can update allowed files directly (48.703296ms)
1618
+ ✔ Can insert allowed files through a nested update (34.598445ms)
1619
+ Client log (client) t+ 254ms TEST_NAME: files Finished OK
1620
+ ✔ Can delete only allowed files directly (16.627023ms)
1621
+ ✔ clientFileTests (170.570685ms)
1622
+ Client test successful
1623
+ (server): Stopping server ...
1624
+ ℹ tests 8
1625
+ ℹ suites 1
1626
+ ℹ pass 8
1627
+ ℹ fail 0
1628
+ ℹ cancelled 0
1629
+ ℹ skipped 0
1630
+ ℹ todo 0
1631
+ ℹ duration_ms 8307.320709
1632
+
1633
+ > server_tests@1.0.0 test-client
1634
+ > TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
1635
+
1636
+ Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
1637
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1638
+
1639
+ DROP TABLE IF EXISTS "lookup_col1" CASCADE;
1640
+ CREATE TABLE IF NOT EXISTS "lookup_col1" (
1641
+ id TEXT PRIMARY KEY
1642
+ , "description" TEXT
1643
+ );
1644
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1645
+
1646
+ CREATE TABLE "files" (
1647
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1648
+ "storage_key" UUID UNIQUE ,
1649
+ "extension" TEXT NOT NULL DEFAULT '' ,
1650
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1651
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1652
+ "etag" TEXT NOT NULL DEFAULT '' ,
1653
+ "original_name" TEXT NOT NULL ,
1654
+ "original_last_modified" TIMESTAMPTZ ,
1655
+ "description" TEXT ,
1656
+ "url" TEXT NOT NULL DEFAULT '' ,
1657
+ "cloud_url" TEXT ,
1658
+ "signed_url" TEXT ,
1659
+ "signed_url_expires" BIGINT ,
1660
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1661
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1662
+ "deleted" TIMESTAMPTZ ,
1663
+ "deleted_from_storage" TIMESTAMPTZ ,
1664
+ "data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
1665
+ "version" INTEGER NOT NULL DEFAULT 1 ,
1666
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
1667
+ );
1668
+ CREATE TABLE "files_versions" (
1669
+ "id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
1670
+ "storage_key" UUID NOT NULL ,
1671
+ "extension" TEXT NOT NULL DEFAULT '' ,
1672
+ "content_type" TEXT NOT NULL DEFAULT '' ,
1673
+ "content_length" BIGINT NOT NULL DEFAULT 0 ,
1674
+ "etag" TEXT NOT NULL DEFAULT '' ,
1675
+ "original_name" TEXT NOT NULL ,
1676
+ "original_last_modified" TIMESTAMPTZ ,
1677
+ "description" TEXT ,
1678
+ "url" TEXT NOT NULL DEFAULT '' ,
1679
+ "cloud_url" TEXT ,
1680
+ "signed_url" TEXT ,
1681
+ "signed_url_expires" BIGINT ,
1682
+ "added" TIMESTAMP NOT NULL DEFAULT NOW() ,
1683
+ "updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
1684
+ "deleted" TIMESTAMPTZ ,
1685
+ "deleted_from_storage" TIMESTAMPTZ ,
1686
+ "file_id" UUID NOT NULL ,
1687
+ "version" INTEGER NOT NULL ,
1688
+ "created" TIMESTAMP NOT NULL DEFAULT NOW() ,
1689
+ "metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
1690
+ );
1691
+ ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
1692
+ CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
1693
+ COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
1694
+ CREATE TABLE "users_public_info" (
1695
+ "id" SERIAL PRIMARY KEY ,
1696
+ "name" TEXT ,
1697
+ "avatar" UUID REFERENCES files ON DELETE CASCADE ,
1698
+ "sid" TEXT
1699
+ );
1700
+ DROP TABLE IF EXISTS "users";
1701
+ CREATE TABLE "users" (
1702
+ "id" SERIAL PRIMARY KEY ,
1703
+ "email" TEXT NOT NULL ,
1704
+ "status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
1705
+ "type" TEXT NOT NULL ,
1706
+ "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"}' ))
1707
+ );
1708
+ DROP TABLE IF EXISTS "tjson";
1709
+ CREATE TABLE "tjson" (
1710
+ "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"}' )),
1711
+ "colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
1712
+ "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"}' )),
1713
+ "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"}' )),
1714
+ "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"}' ))
1715
+ );
1716
+ Running queries: /* prostgles internal query that should be excluded from schema watch */
1717
+
1718
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col1) REFERENCES lookup_col1(id);
1719
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col2) REFERENCES lookup_col1(id);
1720
+ ALTER TABLE "uuid_text" ADD FOREIGN KEY (col3) REFERENCES lookup_col1(id);
1721
+ DROP TABLE IF EXISTS "api_table";
1722
+ CREATE TABLE "api_table" (
1723
+ "id" SERIAL PRIMARY KEY
1724
+ );
1725
+ Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
1726
+ (server): prostgles onReady
1727
+ (server): Waiting for client...
1728
+ (client) t+ 0ms Started client...
1729
+ onSocketConnect IZ9ac6_ZXjpnM2IjAAAA
1730
+ (server): Client connected -> console does not work. use log function. socket.id: IZ9ac6_ZXjpnM2IjAAAA
1731
+ (client) t+ 27ms Client connect.
1732
+ (client) t+ 36ms TEST_NAME: rest_api Started
1733
+ ▶ clientRestApi
1734
+ ✔ Rest api test (82.290982ms)
1735
+ ✔ Rest api security (18.580939ms)
1736
+ Client log (client) t+ 141ms TEST_NAME: rest_api Finished OK
1737
+ ✔ clientRestApi (101.634987ms)
1738
+ Client test successful
1739
+ (server): Stopping server ...
1740
+ ℹ tests 2
1741
+ ℹ suites 1
1742
+ ℹ pass 2
1743
+ ℹ fail 0
1744
+ ℹ cancelled 0
1745
+ ℹ skipped 0
1746
+ ℹ todo 0
1747
+ ℹ duration_ms 8196.509898