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.
- package/.github/workflows/main.yml +1 -1
- package/debug/als-build.log +4 -0
- package/debug/als-e2e.log +1747 -0
- package/debug/als-lint.log +4 -0
- package/debug/als-npm-test.log +712 -0
- package/debug/als-row-parts-e2e.log +1759 -0
- package/debug/als-row-parts-npm-test.log +716 -0
- package/debug/als-typecheck.log +8 -0
- package/debug/als-unified-build.log +4 -0
- package/debug/als-unified-lint.log +4 -0
- package/debug/als-unified-test-build.log +11 -0
- package/debug/als-unified-test-server.log +3444 -0
- package/debug/inspect-ui-sync.cjs +24 -0
- package/debug/subscription-cleanup-repro.log +662 -0
- package/debug/subscription-cleanup-trace.log +7230 -0
- package/debug/sync-bigint-DBGeneratedSchema.backup +489 -0
- package/debug/sync-bigint-build.log +4 -0
- package/debug/sync-bigint-client-build.log +0 -0
- package/debug/sync-bigint-lint.log +4 -0
- package/debug/sync-bigint-server-build.log +0 -0
- package/debug/sync-comment-DBGeneratedSchema.backup +489 -0
- package/debug/sync-delay-gate-DBGeneratedSchema.backup +489 -0
- package/debug/sync-delay-gate-build.log +0 -0
- package/debug/sync-diff-review-test.log +132 -0
- package/debug/sync-followup-build.log +4 -0
- package/debug/sync-notification-before.log +121 -0
- package/debug/sync-trigger-cleanup-before.log +134 -0
- package/debug/sync-trigger-fix-e2e.log +1758 -0
- package/debug/sync-trigger-fix-npm-test.log +1815 -0
- package/debug/sync-trigger-lint.log +4 -0
- package/debug/trace-subscription-cleanup.cjs +19 -0
- package/debug/ui-sync-database-snapshot.log +8 -0
- package/debug/ui-sync-investigation.md +30 -0
- package/debug/ui-sync-server-tests.log +553 -0
- package/dist/Audit/AuditTable.d.ts +1 -1
- package/dist/DboBuilder/DboBuilder.d.ts.map +1 -1
- package/dist/DboBuilder/DboBuilder.js +4 -2
- package/dist/DboBuilder/DboBuilder.js.map +1 -1
- package/dist/DboBuilder/DboBuilder.spec.js +3 -1
- package/dist/DboBuilder/DboBuilder.spec.js.map +1 -1
- package/dist/DboBuilder/TableHandler/TableHandler.d.ts.map +1 -1
- package/dist/DboBuilder/TableHandler/TableHandler.js +3 -2
- package/dist/DboBuilder/TableHandler/TableHandler.js.map +1 -1
- package/dist/DboBuilder/TableHandler/delete.d.ts.map +1 -1
- package/dist/DboBuilder/TableHandler/delete.js +4 -3
- package/dist/DboBuilder/TableHandler/delete.js.map +1 -1
- package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.d.ts.map +1 -1
- package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.js +7 -6
- package/dist/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.js.map +1 -1
- package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts +1 -1
- package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts.map +1 -1
- package/dist/DboBuilder/schema/getTablesForSchemaPostgresSQL.d.ts +2 -2
- package/dist/ExecutionContext.d.ts +32 -0
- package/dist/ExecutionContext.d.ts.map +1 -0
- package/dist/ExecutionContext.js +25 -0
- package/dist/ExecutionContext.js.map +1 -0
- package/dist/JSONBSchemaValidation/validateJSONBSchemaSQL.d.ts +1 -1
- package/dist/Prostgles.d.ts +5 -0
- package/dist/Prostgles.d.ts.map +1 -1
- package/dist/Prostgles.js +5 -0
- package/dist/Prostgles.js.map +1 -1
- package/dist/PubSubManager/PubSubManager.d.ts +9 -26
- package/dist/PubSubManager/PubSubManager.d.ts.map +1 -1
- package/dist/PubSubManager/PubSubManager.js +27 -23
- package/dist/PubSubManager/PubSubManager.js.map +1 -1
- package/dist/PubSubManager/deleteOrphanedTriggers.d.ts.map +1 -1
- package/dist/PubSubManager/deleteOrphanedTriggers.js +5 -3
- package/dist/PubSubManager/deleteOrphanedTriggers.js.map +1 -1
- package/dist/PubSubManager/init/getDataWatchFunctionQuery.d.ts.map +1 -1
- package/dist/PubSubManager/init/getDataWatchFunctionQuery.js +1 -2
- package/dist/PubSubManager/init/getDataWatchFunctionQuery.js.map +1 -1
- package/dist/PubSubManager/init/getPubSubManagerInitQuery.d.ts.map +1 -1
- package/dist/PubSubManager/init/getPubSubManagerInitQuery.js +3 -2
- package/dist/PubSubManager/init/getPubSubManagerInitQuery.js.map +1 -1
- package/dist/PubSubManager/notifListener.js +2 -2
- package/dist/PubSubManager/notifListener.js.map +1 -1
- package/dist/PubSubManager/refreshTriggers.d.ts.map +1 -1
- package/dist/PubSubManager/refreshTriggers.js +5 -3
- package/dist/PubSubManager/refreshTriggers.js.map +1 -1
- package/dist/PublishParser/PublishParser.d.ts.map +1 -1
- package/dist/PublishParser/PublishParser.js +14 -1
- package/dist/PublishParser/PublishParser.js.map +1 -1
- package/dist/PublishParser/getFunctionRelatedRecords.d.ts +5 -0
- package/dist/PublishParser/getFunctionRelatedRecords.d.ts.map +1 -0
- package/dist/PublishParser/getFunctionRelatedRecords.js +26 -0
- package/dist/PublishParser/getFunctionRelatedRecords.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/initProstgles.d.ts +3 -0
- package/dist/initProstgles.d.ts.map +1 -1
- package/dist/initProstgles.js +1 -0
- package/dist/initProstgles.js.map +1 -1
- package/dist/runClientRequest.d.ts.map +1 -1
- package/dist/runClientRequest.js +6 -1
- package/dist/runClientRequest.js.map +1 -1
- package/lib/DboBuilder/DboBuilder.spec.ts +3 -7
- package/lib/DboBuilder/DboBuilder.ts +4 -2
- package/lib/DboBuilder/TableHandler/TableHandler.ts +14 -11
- package/lib/DboBuilder/TableHandler/delete.ts +14 -11
- package/lib/DboBuilder/TableHandler/executeAfterHooksCheckAndPostValidation.ts +28 -21
- package/lib/ExecutionContext.ts +60 -0
- package/lib/Prostgles.ts +8 -4
- package/lib/PubSubManager/PubSubManager.ts +31 -28
- package/lib/PubSubManager/deleteOrphanedTriggers.ts +5 -3
- package/lib/PubSubManager/init/getDataWatchFunctionQuery.ts +1 -2
- package/lib/PubSubManager/init/getPubSubManagerInitQuery.ts +3 -2
- package/lib/PubSubManager/notifListener.ts +2 -2
- package/lib/PubSubManager/refreshTriggers.ts +7 -5
- package/lib/PublishParser/PublishParser.ts +17 -1
- package/lib/PublishParser/getFunctionRelatedRecords.ts +25 -0
- package/lib/index.ts +2 -4
- package/lib/initProstgles.ts +5 -4
- package/lib/runClientRequest.ts +16 -8
- package/package.json +1 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
/* Schema definition generated by prostgles-server */
|
|
2
|
+
|
|
3
|
+
export type DBGeneratedSchema = {
|
|
4
|
+
__rb_test_commit: {
|
|
5
|
+
columns: {
|
|
6
|
+
id?: null | number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
};
|
|
10
|
+
"\"\"\"*\"\"\"": {
|
|
11
|
+
columns: {
|
|
12
|
+
"\"*\""?: null | string;
|
|
13
|
+
id?: number;
|
|
14
|
+
qq?: null | string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
};
|
|
18
|
+
"\"\"\"quoted0\"\"\"": {
|
|
19
|
+
columns: {
|
|
20
|
+
"\"id0\""?: number;
|
|
21
|
+
"\"quoted1_id\""?: null | number;
|
|
22
|
+
"\"text_col0\""?: null | string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
"\"\"\"quoted1\"\"\"": {
|
|
27
|
+
columns: {
|
|
28
|
+
"\"id1\""?: number;
|
|
29
|
+
"\"quoted2_id\""?: null | number;
|
|
30
|
+
"\"text_col1\""?: null | string;
|
|
31
|
+
};
|
|
32
|
+
referencedBy: {"\"\"\"quoted0\"\"\"":["\"quoted1_id\""]};
|
|
33
|
+
};
|
|
34
|
+
"\"\"\"quoted2\"\"\"": {
|
|
35
|
+
columns: {
|
|
36
|
+
"\"id2\""?: number;
|
|
37
|
+
"\"text_col2\""?: null | string;
|
|
38
|
+
};
|
|
39
|
+
referencedBy: {"\"\"\"quoted1\"\"\"":["\"quoted2_id\""]};
|
|
40
|
+
};
|
|
41
|
+
"\"*\"": {
|
|
42
|
+
columns: {
|
|
43
|
+
"*"?: null | string;
|
|
44
|
+
id?: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
};
|
|
48
|
+
api_table: {
|
|
49
|
+
columns: {
|
|
50
|
+
col1?: null | string;
|
|
51
|
+
id?: number;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
};
|
|
55
|
+
bytea_test: {
|
|
56
|
+
columns: {
|
|
57
|
+
id?: number;
|
|
58
|
+
value?: null | Uint8Array;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
};
|
|
62
|
+
ex_j_ins: {
|
|
63
|
+
columns: {
|
|
64
|
+
added?: null | string;
|
|
65
|
+
id?: number;
|
|
66
|
+
name: string;
|
|
67
|
+
public?: null | string;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
};
|
|
71
|
+
files: {
|
|
72
|
+
columns: {
|
|
73
|
+
added?: string;
|
|
74
|
+
cloud_url?: null | string;
|
|
75
|
+
content_length?: number | string;
|
|
76
|
+
content_type?: string;
|
|
77
|
+
data: Uint8Array;
|
|
78
|
+
deleted?: null | string;
|
|
79
|
+
deleted_from_storage?: null | string;
|
|
80
|
+
description?: null | string;
|
|
81
|
+
etag?: string;
|
|
82
|
+
extension?: string;
|
|
83
|
+
id?: string;
|
|
84
|
+
metadata?: null | { description: string; };
|
|
85
|
+
original_last_modified?: null | string;
|
|
86
|
+
original_name: string;
|
|
87
|
+
signed_url?: null | string;
|
|
88
|
+
signed_url_expires?: null | number | string;
|
|
89
|
+
storage_key?: null | string;
|
|
90
|
+
updated?: string;
|
|
91
|
+
url?: string;
|
|
92
|
+
version?: number;
|
|
93
|
+
};
|
|
94
|
+
referencedBy: {"files_versions":["file_id"],"users_public_info":["avatar"]};
|
|
95
|
+
};
|
|
96
|
+
files_versions: {
|
|
97
|
+
columns: {
|
|
98
|
+
added?: string;
|
|
99
|
+
cloud_url?: null | string;
|
|
100
|
+
content_length?: number | string;
|
|
101
|
+
content_type?: string;
|
|
102
|
+
created?: string;
|
|
103
|
+
deleted?: null | string;
|
|
104
|
+
deleted_from_storage?: null | string;
|
|
105
|
+
description?: null | string;
|
|
106
|
+
etag?: string;
|
|
107
|
+
extension?: string;
|
|
108
|
+
file_id: string;
|
|
109
|
+
id?: string;
|
|
110
|
+
metadata?: null | { description: string; };
|
|
111
|
+
original_last_modified?: null | string;
|
|
112
|
+
original_name: string;
|
|
113
|
+
signed_url?: null | string;
|
|
114
|
+
signed_url_expires?: null | number | string;
|
|
115
|
+
storage_key: string;
|
|
116
|
+
updated?: string;
|
|
117
|
+
url?: string;
|
|
118
|
+
version: number;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
};
|
|
122
|
+
geography_columns: {
|
|
123
|
+
columns: {
|
|
124
|
+
coord_dimension?: null | number;
|
|
125
|
+
f_geography_column?: null | string;
|
|
126
|
+
f_table_catalog?: null | string;
|
|
127
|
+
f_table_name?: null | string;
|
|
128
|
+
f_table_schema?: null | string;
|
|
129
|
+
srid?: null | number;
|
|
130
|
+
type?: null | string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
};
|
|
134
|
+
geometry_columns: {
|
|
135
|
+
columns: {
|
|
136
|
+
coord_dimension?: null | number;
|
|
137
|
+
f_geometry_column?: null | string;
|
|
138
|
+
f_table_catalog?: null | string;
|
|
139
|
+
f_table_name?: null | string;
|
|
140
|
+
f_table_schema?: null | string;
|
|
141
|
+
srid?: null | number;
|
|
142
|
+
type?: null | string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
};
|
|
146
|
+
insert_rules: {
|
|
147
|
+
columns: {
|
|
148
|
+
added?: null | string;
|
|
149
|
+
id?: number;
|
|
150
|
+
name?: null | string;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
};
|
|
154
|
+
items: {
|
|
155
|
+
columns: {
|
|
156
|
+
h?: null | string[];
|
|
157
|
+
id?: number;
|
|
158
|
+
name?: null | string;
|
|
159
|
+
};
|
|
160
|
+
referencedBy: {"items2":["items_id"],"items4a":["items_id"],"items_multi":["items0_id","items1_id","items2_id","items3_id"],"slow_items":["id"],"very_slow_items":["id"]};
|
|
161
|
+
};
|
|
162
|
+
items_multi: {
|
|
163
|
+
columns: {
|
|
164
|
+
id?: number;
|
|
165
|
+
items0_id?: null | number;
|
|
166
|
+
items1_id?: null | number;
|
|
167
|
+
items2_id?: null | number;
|
|
168
|
+
items3_id?: null | number;
|
|
169
|
+
name?: null | string;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
};
|
|
173
|
+
items2: {
|
|
174
|
+
columns: {
|
|
175
|
+
hh?: null | string[];
|
|
176
|
+
id?: number;
|
|
177
|
+
items_id?: null | number;
|
|
178
|
+
name?: null | string;
|
|
179
|
+
};
|
|
180
|
+
referencedBy: {"items4a":["items2_id"]};
|
|
181
|
+
};
|
|
182
|
+
items3: {
|
|
183
|
+
columns: {
|
|
184
|
+
h?: null | string[];
|
|
185
|
+
id?: number;
|
|
186
|
+
name?: null | string;
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
};
|
|
190
|
+
items4: {
|
|
191
|
+
columns: {
|
|
192
|
+
added?: null | string;
|
|
193
|
+
id?: number;
|
|
194
|
+
name: string;
|
|
195
|
+
public?: null | string;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
};
|
|
199
|
+
items4_pub: {
|
|
200
|
+
columns: {
|
|
201
|
+
added?: null | string;
|
|
202
|
+
id?: number;
|
|
203
|
+
name: string;
|
|
204
|
+
public?: null | string;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
};
|
|
208
|
+
items4a: {
|
|
209
|
+
columns: {
|
|
210
|
+
id?: number;
|
|
211
|
+
items_id?: null | number;
|
|
212
|
+
items2_id?: null | number;
|
|
213
|
+
name?: null | string;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
};
|
|
217
|
+
lookup_col1: {
|
|
218
|
+
columns: {
|
|
219
|
+
description?: null | string;
|
|
220
|
+
id: "a" | "b"
|
|
221
|
+
};
|
|
222
|
+
referencedBy: {"uuid_text":["col1","col2","col3"]};
|
|
223
|
+
};
|
|
224
|
+
newly_created_table: {
|
|
225
|
+
columns: {
|
|
226
|
+
id?: null | number;
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
};
|
|
230
|
+
obj_table: {
|
|
231
|
+
columns: {
|
|
232
|
+
id?: number;
|
|
233
|
+
obj?: null | any;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
};
|
|
237
|
+
planes: {
|
|
238
|
+
columns: {
|
|
239
|
+
flight_number?: null | string;
|
|
240
|
+
id?: number;
|
|
241
|
+
last_updated: number | string;
|
|
242
|
+
x?: null | number;
|
|
243
|
+
y?: null | number;
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
};
|
|
247
|
+
"prostgles_test.basic": {
|
|
248
|
+
columns: {
|
|
249
|
+
id?: number;
|
|
250
|
+
txt?: null | string;
|
|
251
|
+
};
|
|
252
|
+
referencedBy: {"prostgles_test.basic1":["id_basic"]};
|
|
253
|
+
};
|
|
254
|
+
"prostgles_test.basic1": {
|
|
255
|
+
columns: {
|
|
256
|
+
id?: number;
|
|
257
|
+
id_basic?: null | number;
|
|
258
|
+
txt?: null | string;
|
|
259
|
+
};
|
|
260
|
+
referencedBy: {"prostgles_test.mv_basic1":["id"]};
|
|
261
|
+
};
|
|
262
|
+
"prostgles_test.mv_basic1": {
|
|
263
|
+
columns: {
|
|
264
|
+
id: number;
|
|
265
|
+
id_basic: number;
|
|
266
|
+
txt: string;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
};
|
|
270
|
+
rec: {
|
|
271
|
+
columns: {
|
|
272
|
+
id?: number;
|
|
273
|
+
parent_id?: null | number;
|
|
274
|
+
recf?: null | number;
|
|
275
|
+
};
|
|
276
|
+
referencedBy: {"rec":["parent_id"]};
|
|
277
|
+
};
|
|
278
|
+
rec_ref: {
|
|
279
|
+
columns: {
|
|
280
|
+
id?: number;
|
|
281
|
+
};
|
|
282
|
+
referencedBy: {"rec":["recf"]};
|
|
283
|
+
};
|
|
284
|
+
schema_version: {
|
|
285
|
+
columns: {
|
|
286
|
+
id: number | string;
|
|
287
|
+
table_config: any;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
};
|
|
291
|
+
self_join: {
|
|
292
|
+
columns: {
|
|
293
|
+
id?: number;
|
|
294
|
+
my_id?: null | number;
|
|
295
|
+
my_id1?: null | number;
|
|
296
|
+
name?: null | string;
|
|
297
|
+
};
|
|
298
|
+
referencedBy: {"self_join":["my_id","my_id1"]};
|
|
299
|
+
};
|
|
300
|
+
shapes: {
|
|
301
|
+
columns: {
|
|
302
|
+
geog?: null | string;
|
|
303
|
+
geom?: null | string;
|
|
304
|
+
id?: string;
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
};
|
|
308
|
+
slow_items: {
|
|
309
|
+
columns: {
|
|
310
|
+
h?: null | string[];
|
|
311
|
+
id?: null | number;
|
|
312
|
+
name?: null | string;
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
};
|
|
316
|
+
spatial_ref_sys: {
|
|
317
|
+
columns: {
|
|
318
|
+
auth_name?: null | string;
|
|
319
|
+
auth_srid?: null | number;
|
|
320
|
+
proj4text?: null | string;
|
|
321
|
+
srid: number;
|
|
322
|
+
srtext?: null | string;
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
};
|
|
326
|
+
symbols: {
|
|
327
|
+
columns: {
|
|
328
|
+
id: string;
|
|
329
|
+
};
|
|
330
|
+
referencedBy: {"trades":["symbol"]};
|
|
331
|
+
};
|
|
332
|
+
table_name3434: {
|
|
333
|
+
columns: {
|
|
334
|
+
id: number;
|
|
335
|
+
};
|
|
336
|
+
referencedBy: {"table_name3434cccc":["id","id2"]};
|
|
337
|
+
};
|
|
338
|
+
table_name3434cccc: {
|
|
339
|
+
columns: {
|
|
340
|
+
id?: null | number;
|
|
341
|
+
id2?: null | number;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
};
|
|
345
|
+
tjson: {
|
|
346
|
+
columns: {
|
|
347
|
+
colOneOf: "a" | "b" | "c"
|
|
348
|
+
json: { a: boolean; arr: "1" | "2" | "3"; arr1: 1 | 2 | 3; arr2: number[]; arrStr?: null | string[]; o?: | null
|
|
349
|
+
| { o1: number; }
|
|
350
|
+
| { o2: boolean; }; };
|
|
351
|
+
jsonOneOf?:
|
|
352
|
+
| null
|
|
353
|
+
| { command: "a"; }
|
|
354
|
+
| { command: "b"; option: number[]; }
|
|
355
|
+
status?:
|
|
356
|
+
| null
|
|
357
|
+
| { ok: string; }
|
|
358
|
+
| { err: string; }
|
|
359
|
+
| { loading: { loaded: number; total: number; }; }
|
|
360
|
+
table_config?: null | { referencedTables?: ( { name: string; minFiles: number; } )[]; recType?: null | Record<"a" | "b", { bools: boolean[]; }>; };
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
};
|
|
364
|
+
tr1: {
|
|
365
|
+
columns: {
|
|
366
|
+
id?: number;
|
|
367
|
+
t1?: null | string;
|
|
368
|
+
};
|
|
369
|
+
referencedBy: {"tr2":["tr1_id"]};
|
|
370
|
+
};
|
|
371
|
+
tr2: {
|
|
372
|
+
columns: {
|
|
373
|
+
id?: number;
|
|
374
|
+
t1?: null | string;
|
|
375
|
+
t2?: null | string;
|
|
376
|
+
tr1_id?: null | number;
|
|
377
|
+
};
|
|
378
|
+
referencedBy: {"tr3":["tr2_id"]};
|
|
379
|
+
};
|
|
380
|
+
tr3: {
|
|
381
|
+
columns: {
|
|
382
|
+
id?: number;
|
|
383
|
+
t2?: null | string;
|
|
384
|
+
tr2_id?: null | number;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
};
|
|
388
|
+
trades: {
|
|
389
|
+
columns: {
|
|
390
|
+
id?: number;
|
|
391
|
+
price: number | string;
|
|
392
|
+
symbol: string;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
};
|
|
396
|
+
users: {
|
|
397
|
+
columns: {
|
|
398
|
+
email: string;
|
|
399
|
+
id?: number;
|
|
400
|
+
preferences: { showIntro?: boolean; theme?: "light" | "dark" | "auto"; others: any[]; };
|
|
401
|
+
status: "active" | "disabled" | "pending"
|
|
402
|
+
type: string;
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
};
|
|
406
|
+
users_public_info: {
|
|
407
|
+
columns: {
|
|
408
|
+
avatar?: null | string;
|
|
409
|
+
id?: number;
|
|
410
|
+
name?: null | string;
|
|
411
|
+
sid?: null | string;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
};
|
|
415
|
+
uuid_text: {
|
|
416
|
+
columns: {
|
|
417
|
+
col1?: null | "a" | "b"
|
|
418
|
+
col2?: null | "a" | "b"
|
|
419
|
+
col3?: null | "a" | "b"
|
|
420
|
+
id?: null | string;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
};
|
|
424
|
+
v_items: {
|
|
425
|
+
columns: {
|
|
426
|
+
id?: null | number;
|
|
427
|
+
name?: null | string;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
};
|
|
431
|
+
various: {
|
|
432
|
+
columns: {
|
|
433
|
+
added?: null | string;
|
|
434
|
+
h?: null | string[];
|
|
435
|
+
id?: number;
|
|
436
|
+
jsn?: null | any;
|
|
437
|
+
name?: null | string;
|
|
438
|
+
tsv?: null | string;
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
};
|
|
442
|
+
very_slow_items: {
|
|
443
|
+
columns: {
|
|
444
|
+
h?: null | string[];
|
|
445
|
+
id?: null | number;
|
|
446
|
+
name?: null | string;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
type CollapseNumberIfStringPresent<T> =
|
|
454
|
+
[Extract<T, string>] extends [never] ? T : Exclude<T, number>;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Numeric columns that serialize to strings keep the numeric type as well to allow:
|
|
458
|
+
* - inserting numeric values as either numbers or strings
|
|
459
|
+
* - reading numeric values as strings
|
|
460
|
+
*/
|
|
461
|
+
export type NormalizedRow<T extends Record<string, unknown>> = Required<{
|
|
462
|
+
[K in keyof T]: CollapseNumberIfStringPresent<T[K]>;
|
|
463
|
+
}>;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Data types as expected when selecting from the database
|
|
467
|
+
* */
|
|
468
|
+
export type DBSchema = {
|
|
469
|
+
[K in keyof DBGeneratedSchema]: NormalizedRow<DBGeneratedSchema[K]["columns"]>;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Data types as expected when inserting into the database (optional fields might be nullable/with defaults)
|
|
474
|
+
* */
|
|
475
|
+
export type DBSchemaForInsert = {
|
|
476
|
+
[K in keyof DBGeneratedSchema]: DBGeneratedSchema[K]["columns"];
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
export type GeneratedFunctionSchema = {
|
|
482
|
+
"myfunc": (args: { arg1: number; }) => Promise<number>;
|
|
483
|
+
"myfuncVoid": () => Promise<void>;
|
|
484
|
+
"myfuncWithBadReturn": (args: { arg1: number; }) => Promise<string>;
|
|
485
|
+
"myfuncWithComplexReturn": (args: { arg1: number; }) => Promise<(Array<number> | { a: number; b: string; c: { d: boolean } })>;
|
|
486
|
+
"myAdminFunc": (args: { arg1: number; }) => Promise<number>;
|
|
487
|
+
"myfuncForDefault": () => Promise<void>;
|
|
488
|
+
"myfuncForDefault2": (args: { name: string; }) => Promise<({ a: number; b?: undefined } | { b: string; a?: undefined })>;
|
|
489
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
> server_tests@1.0.0 test-client
|
|
3
|
+
> TEST_TYPE=client node --trace-uncaught --test dist/server/index.js
|
|
4
|
+
|
|
5
|
+
Prostgles: SQL file executed successfuly /home/s/prostgles-server-js/tests/server/init.sql
|
|
6
|
+
Running queries: /* prostgles internal query that should be excluded from schema watch */
|
|
7
|
+
|
|
8
|
+
DROP TABLE IF EXISTS "lookup_col1" CASCADE;
|
|
9
|
+
CREATE TABLE IF NOT EXISTS "lookup_col1" (
|
|
10
|
+
id TEXT PRIMARY KEY
|
|
11
|
+
, "description" TEXT
|
|
12
|
+
);
|
|
13
|
+
INSERT INTO "lookup_col1" ("id", "description") VALUES ('a','desc') ON CONFLICT DO NOTHING;
|
|
14
|
+
INSERT INTO "lookup_col1" ("id", "description") VALUES ('b',null) ON CONFLICT DO NOTHING;
|
|
15
|
+
Running queries: /* prostgles internal query that should be excluded from schema watch */
|
|
16
|
+
|
|
17
|
+
CREATE TABLE "files" (
|
|
18
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
|
|
19
|
+
"storage_key" UUID UNIQUE ,
|
|
20
|
+
"extension" TEXT NOT NULL DEFAULT '' ,
|
|
21
|
+
"content_type" TEXT NOT NULL DEFAULT '' ,
|
|
22
|
+
"content_length" BIGINT NOT NULL DEFAULT 0 ,
|
|
23
|
+
"etag" TEXT NOT NULL DEFAULT '' ,
|
|
24
|
+
"original_name" TEXT NOT NULL ,
|
|
25
|
+
"original_last_modified" TIMESTAMPTZ ,
|
|
26
|
+
"description" TEXT ,
|
|
27
|
+
"url" TEXT NOT NULL DEFAULT '' ,
|
|
28
|
+
"cloud_url" TEXT ,
|
|
29
|
+
"signed_url" TEXT ,
|
|
30
|
+
"signed_url_expires" BIGINT ,
|
|
31
|
+
"added" TIMESTAMP NOT NULL DEFAULT NOW() ,
|
|
32
|
+
"updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
|
|
33
|
+
"deleted" TIMESTAMPTZ ,
|
|
34
|
+
"deleted_from_storage" TIMESTAMPTZ ,
|
|
35
|
+
"data" BYTEA NOT NULL CHECK (data = decode('01', 'hex')) ,
|
|
36
|
+
"version" INTEGER NOT NULL DEFAULT 1 ,
|
|
37
|
+
"metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files","column":"metadata"}' ))
|
|
38
|
+
);
|
|
39
|
+
CREATE TABLE "files_versions" (
|
|
40
|
+
"id" UUID PRIMARY KEY DEFAULT gen_random_uuid() ,
|
|
41
|
+
"storage_key" UUID NOT NULL ,
|
|
42
|
+
"extension" TEXT NOT NULL DEFAULT '' ,
|
|
43
|
+
"content_type" TEXT NOT NULL DEFAULT '' ,
|
|
44
|
+
"content_length" BIGINT NOT NULL DEFAULT 0 ,
|
|
45
|
+
"etag" TEXT NOT NULL DEFAULT '' ,
|
|
46
|
+
"original_name" TEXT NOT NULL ,
|
|
47
|
+
"original_last_modified" TIMESTAMPTZ ,
|
|
48
|
+
"description" TEXT ,
|
|
49
|
+
"url" TEXT NOT NULL DEFAULT '' ,
|
|
50
|
+
"cloud_url" TEXT ,
|
|
51
|
+
"signed_url" TEXT ,
|
|
52
|
+
"signed_url_expires" BIGINT ,
|
|
53
|
+
"added" TIMESTAMP NOT NULL DEFAULT NOW() ,
|
|
54
|
+
"updated" TIMESTAMP NOT NULL DEFAULT NOW() ,
|
|
55
|
+
"deleted" TIMESTAMPTZ ,
|
|
56
|
+
"deleted_from_storage" TIMESTAMPTZ ,
|
|
57
|
+
"file_id" UUID NOT NULL ,
|
|
58
|
+
"version" INTEGER NOT NULL ,
|
|
59
|
+
"created" TIMESTAMP NOT NULL DEFAULT NOW() ,
|
|
60
|
+
"metadata" JSONB CHECK(prostgles.validate_jsonb_schema('{"nullable":true,"type":{"description":{"type":"string"}}}'::TEXT, "metadata", '{"table":"files_versions","column":"metadata"}' ))
|
|
61
|
+
);
|
|
62
|
+
ALTER TABLE "files_versions" ADD CONSTRAINT "prostgles_file_version_e24fec525e76b3433749621f589d35d9" FOREIGN KEY (file_id) REFERENCES "files"(id) ON DELETE CASCADE;
|
|
63
|
+
CREATE UNIQUE INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" ON "files_versions" (file_id, version);
|
|
64
|
+
COMMENT ON INDEX "prostgles_file_version_9692aae50022f45f1098646939b287b1_key" IS 'd4af15d064cae99adac0c1194199a9e3';
|
|
65
|
+
CREATE TABLE "users_public_info" (
|
|
66
|
+
"id" SERIAL PRIMARY KEY ,
|
|
67
|
+
"name" TEXT ,
|
|
68
|
+
"avatar" UUID REFERENCES files ON DELETE CASCADE ,
|
|
69
|
+
"sid" TEXT
|
|
70
|
+
);
|
|
71
|
+
DROP TABLE IF EXISTS "users";
|
|
72
|
+
CREATE TABLE "users" (
|
|
73
|
+
"id" SERIAL PRIMARY KEY ,
|
|
74
|
+
"email" TEXT NOT NULL ,
|
|
75
|
+
"status" TEXT NOT NULL CHECK("status" = 'active' OR "status" = 'disabled' OR "status" = 'pending'),
|
|
76
|
+
"type" TEXT NOT NULL ,
|
|
77
|
+
"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"}' ))
|
|
78
|
+
);
|
|
79
|
+
DROP TABLE IF EXISTS "tjson";
|
|
80
|
+
CREATE TABLE "tjson" (
|
|
81
|
+
"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"}' )),
|
|
82
|
+
"colOneOf" TEXT NOT NULL CHECK("colOneOf" = 'a' OR "colOneOf" = 'b' OR "colOneOf" = 'c'),
|
|
83
|
+
"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"}' )),
|
|
84
|
+
"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"}' )),
|
|
85
|
+
"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"}' ))
|
|
86
|
+
);
|
|
87
|
+
CREATE TABLE "uuid_text" (
|
|
88
|
+
"id" UUID ,
|
|
89
|
+
"col1" TEXT REFERENCES lookup_col1 (id) ,
|
|
90
|
+
"col2" TEXT REFERENCES lookup_col1 (id) ,
|
|
91
|
+
"col3" TEXT REFERENCES lookup_col1
|
|
92
|
+
);
|
|
93
|
+
DROP TABLE IF EXISTS "api_table";
|
|
94
|
+
CREATE TABLE "api_table" (
|
|
95
|
+
"id" SERIAL PRIMARY KEY
|
|
96
|
+
);
|
|
97
|
+
CREATE TABLE "rec_ref" (
|
|
98
|
+
"id" SERIAL PRIMARY KEY
|
|
99
|
+
);
|
|
100
|
+
CREATE TABLE "rec" (
|
|
101
|
+
"id" SERIAL PRIMARY KEY ,
|
|
102
|
+
"parent_id" INTEGER REFERENCES rec ,
|
|
103
|
+
"recf" INTEGER REFERENCES rec_ref
|
|
104
|
+
);
|
|
105
|
+
Prostgles: Initiated file manager. Max allowed file size: 1MB (maxHttpBufferSize = 1e6). To increase this set maxHttpBufferSize in socket.io server init options
|
|
106
|
+
Prostgles: Created typescript schema definition file:
|
|
107
|
+
DBGeneratedSchema.ts
|
|
108
|
+
(server): prostgles onReady
|
|
109
|
+
(server): Waiting for client...
|
|
110
|
+
(client) t+ 0ms Started client...
|
|
111
|
+
onSocketConnect f2bItFxhU26m2reUAAAA
|
|
112
|
+
(server): Client connected -> console does not work. use log function. socket.id: f2bItFxhU26m2reUAAAA
|
|
113
|
+
(client) t+ 39ms Client connect.
|
|
114
|
+
(client) t+ 161ms TEST_NAME: syncTriggerCleanup Started
|
|
115
|
+
getPubSubManagerInitQuery: No prostgles.versions table found. Creating...
|
|
116
|
+
Created PubSubManager
|
|
117
|
+
Pushing 0 rows to socket
|
|
118
|
+
✔ subscription receives an update immediately after another trigger is deleted (418.583892ms)
|
|
119
|
+
Pushing 1 rows to socket x2
|
|
120
|
+
server.syncBatch planes: inserted( 0 ) updated( 0 ) deleted( 0 ) pushed to client( 1 ) total( 1 ) undefined
|
|
121
|
+
Client log (client) t+ 3232ms TEST_NAME: syncTriggerCleanup Finished OK
|
|
122
|
+
✔ unsubscribe cleanup preserves a sync being registered (2647.875212ms)
|
|
123
|
+
Client test successful
|
|
124
|
+
(server): Stopping server ...
|
|
125
|
+
ℹ tests 2
|
|
126
|
+
ℹ suites 0
|
|
127
|
+
ℹ pass 2
|
|
128
|
+
ℹ fail 0
|
|
129
|
+
ℹ cancelled 0
|
|
130
|
+
ℹ skipped 0
|
|
131
|
+
ℹ todo 0
|
|
132
|
+
ℹ duration_ms 11212.817186
|