@pgxsinkit/client 0.1.32 → 0.1.36

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 (85) hide show
  1. package/README.md +11 -0
  2. package/dist/convergence.d.ts +76 -0
  3. package/dist/convergence.d.ts.map +1 -0
  4. package/dist/debug.d.ts +34 -0
  5. package/dist/debug.d.ts.map +1 -0
  6. package/dist/index.d.ts +421 -7
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +7214 -2234
  9. package/dist/index.js.map +74 -44
  10. package/dist/lazy-guard.d.ts +58 -0
  11. package/dist/lazy-guard.d.ts.map +1 -0
  12. package/dist/local-store.d.ts +56 -0
  13. package/dist/local-store.d.ts.map +1 -0
  14. package/dist/local-tables.d.ts +707 -0
  15. package/dist/local-tables.d.ts.map +1 -0
  16. package/dist/mutation-state.d.ts +62 -0
  17. package/dist/mutation-state.d.ts.map +1 -0
  18. package/dist/mutation.d.ts +117 -4
  19. package/dist/mutation.d.ts.map +1 -1
  20. package/dist/schema.d.ts +49 -0
  21. package/dist/schema.d.ts.map +1 -1
  22. package/dist/shape-sync.d.ts +180 -0
  23. package/dist/shape-sync.d.ts.map +1 -0
  24. package/dist/sync/apply.d.ts +51 -0
  25. package/dist/sync/apply.d.ts.map +1 -0
  26. package/dist/sync/copy.d.ts +43 -0
  27. package/dist/sync/copy.d.ts.map +1 -0
  28. package/dist/sync/drizzle-executor.d.ts +5 -0
  29. package/dist/sync/drizzle-executor.d.ts.map +1 -0
  30. package/dist/sync/index.d.ts +32 -0
  31. package/dist/sync/index.d.ts.map +1 -0
  32. package/dist/sync/metadata-tables.d.ts +131 -0
  33. package/dist/sync/metadata-tables.d.ts.map +1 -0
  34. package/dist/sync/nudge.d.ts +49 -0
  35. package/dist/sync/nudge.d.ts.map +1 -0
  36. package/dist/sync/shape-inbox.d.ts +215 -0
  37. package/dist/sync/shape-inbox.d.ts.map +1 -0
  38. package/dist/sync/subscription-state.d.ts +39 -0
  39. package/dist/sync/subscription-state.d.ts.map +1 -0
  40. package/dist/sync/tags.d.ts +130 -0
  41. package/dist/sync/tags.d.ts.map +1 -0
  42. package/dist/sync/types.d.ts +118 -0
  43. package/dist/sync/types.d.ts.map +1 -0
  44. package/dist/sync-auth.d.ts +53 -0
  45. package/dist/sync-auth.d.ts.map +1 -0
  46. package/dist/worker/attach-sync-client.d.ts +75 -0
  47. package/dist/worker/attach-sync-client.d.ts.map +1 -0
  48. package/dist/worker/define-sync-worker.d.ts +75 -0
  49. package/dist/worker/define-sync-worker.d.ts.map +1 -0
  50. package/dist/worker/live-diff.d.ts +44 -0
  51. package/dist/worker/live-diff.d.ts.map +1 -0
  52. package/dist/worker/protocol.d.ts +260 -0
  53. package/dist/worker/protocol.d.ts.map +1 -0
  54. package/dist/worker/token-cache.d.ts +26 -0
  55. package/dist/worker/token-cache.d.ts.map +1 -0
  56. package/oxlint-plugin.js +143 -0
  57. package/package.json +15 -7
  58. package/skills/core/SKILL.md +197 -0
  59. package/skills/operating/SKILL.md +243 -0
  60. package/src/convergence.ts +197 -0
  61. package/src/debug.ts +151 -0
  62. package/src/index.ts +1104 -44
  63. package/src/lazy-guard.ts +121 -0
  64. package/src/local-store.ts +193 -0
  65. package/src/local-tables.ts +546 -0
  66. package/src/mutation-state.ts +90 -0
  67. package/src/mutation.ts +1868 -562
  68. package/src/schema.ts +352 -27
  69. package/src/shape-sync.ts +477 -0
  70. package/src/sync/apply.ts +530 -0
  71. package/src/sync/copy.ts +206 -0
  72. package/src/sync/drizzle-executor.ts +48 -0
  73. package/src/sync/index.ts +1076 -0
  74. package/src/sync/metadata-tables.ts +67 -0
  75. package/src/sync/nudge.ts +110 -0
  76. package/src/sync/shape-inbox.ts +566 -0
  77. package/src/sync/subscription-state.ts +135 -0
  78. package/src/sync/tags.ts +365 -0
  79. package/src/sync/types.ts +132 -0
  80. package/src/sync-auth.ts +117 -0
  81. package/src/worker/attach-sync-client.ts +558 -0
  82. package/src/worker/define-sync-worker.ts +596 -0
  83. package/src/worker/live-diff.ts +140 -0
  84. package/src/worker/protocol.ts +325 -0
  85. package/src/worker/token-cache.ts +84 -0
@@ -0,0 +1,707 @@
1
+ import { type AnyPgTable, type PgColumn, type PgTableWithColumns, type PgViewWithSelection } from "drizzle-orm/pg-core";
2
+ import { type SyncColumnType, type SyncTableEntry, type SyncTableRegistry } from "@pgxsinkit/contracts";
3
+ declare const journalShape: PgTableWithColumns<{
4
+ name: "_pgxsinkit_journal_shape";
5
+ schema: undefined;
6
+ columns: {
7
+ mutationId: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgUUIDBuilder>, {
8
+ name: string;
9
+ tableName: "_pgxsinkit_journal_shape";
10
+ dataType: "string uuid";
11
+ data: string;
12
+ driverParam: string;
13
+ notNull: true;
14
+ hasDefault: false;
15
+ isPrimaryKey: false;
16
+ isAutoincrement: false;
17
+ hasRuntimeDefault: false;
18
+ enumValues: undefined;
19
+ identity: undefined;
20
+ generated: undefined;
21
+ }>;
22
+ entityKeyJson: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
23
+ name: string;
24
+ tableName: "_pgxsinkit_journal_shape";
25
+ dataType: "string";
26
+ data: string;
27
+ driverParam: string;
28
+ notNull: true;
29
+ hasDefault: false;
30
+ isPrimaryKey: false;
31
+ isAutoincrement: false;
32
+ hasRuntimeDefault: false;
33
+ enumValues: undefined;
34
+ identity: undefined;
35
+ generated: undefined;
36
+ }>;
37
+ mutationSeq: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgIntegerBuilder>, {
38
+ name: string;
39
+ tableName: "_pgxsinkit_journal_shape";
40
+ dataType: "number int32";
41
+ data: number;
42
+ driverParam: string | number;
43
+ notNull: true;
44
+ hasDefault: false;
45
+ isPrimaryKey: false;
46
+ isAutoincrement: false;
47
+ hasRuntimeDefault: false;
48
+ enumValues: undefined;
49
+ identity: undefined;
50
+ generated: undefined;
51
+ }>;
52
+ mutationKind: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
53
+ name: string;
54
+ tableName: "_pgxsinkit_journal_shape";
55
+ dataType: "string";
56
+ data: string;
57
+ driverParam: string;
58
+ notNull: true;
59
+ hasDefault: false;
60
+ isPrimaryKey: false;
61
+ isAutoincrement: false;
62
+ hasRuntimeDefault: false;
63
+ enumValues: undefined;
64
+ identity: undefined;
65
+ generated: undefined;
66
+ }>;
67
+ status: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
68
+ name: string;
69
+ tableName: "_pgxsinkit_journal_shape";
70
+ dataType: "string";
71
+ data: string;
72
+ driverParam: string;
73
+ notNull: true;
74
+ hasDefault: false;
75
+ isPrimaryKey: false;
76
+ isAutoincrement: false;
77
+ hasRuntimeDefault: false;
78
+ enumValues: undefined;
79
+ identity: undefined;
80
+ generated: undefined;
81
+ }>;
82
+ registryVersion: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
83
+ name: string;
84
+ tableName: "_pgxsinkit_journal_shape";
85
+ dataType: "string";
86
+ data: string;
87
+ driverParam: string;
88
+ notNull: false;
89
+ hasDefault: false;
90
+ isPrimaryKey: false;
91
+ isAutoincrement: false;
92
+ hasRuntimeDefault: false;
93
+ enumValues: undefined;
94
+ identity: undefined;
95
+ generated: undefined;
96
+ }>;
97
+ baseServerVersion: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
98
+ dataType: 'custom';
99
+ data: string;
100
+ driverParam: string;
101
+ }>, {
102
+ name: string;
103
+ tableName: "_pgxsinkit_journal_shape";
104
+ dataType: "custom";
105
+ data: string;
106
+ driverParam: string;
107
+ notNull: false;
108
+ hasDefault: false;
109
+ isPrimaryKey: false;
110
+ isAutoincrement: false;
111
+ hasRuntimeDefault: false;
112
+ enumValues: undefined;
113
+ identity: undefined;
114
+ generated: undefined;
115
+ }>;
116
+ writeUnit: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
117
+ name: string;
118
+ tableName: "_pgxsinkit_journal_shape";
119
+ dataType: "string";
120
+ data: string;
121
+ driverParam: string;
122
+ notNull: false;
123
+ hasDefault: false;
124
+ isPrimaryKey: false;
125
+ isAutoincrement: false;
126
+ hasRuntimeDefault: false;
127
+ enumValues: undefined;
128
+ identity: undefined;
129
+ generated: undefined;
130
+ }>;
131
+ writeMode: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>, {
132
+ name: string;
133
+ tableName: "_pgxsinkit_journal_shape";
134
+ dataType: "string";
135
+ data: string;
136
+ driverParam: string;
137
+ notNull: false;
138
+ hasDefault: false;
139
+ isPrimaryKey: false;
140
+ isAutoincrement: false;
141
+ hasRuntimeDefault: false;
142
+ enumValues: undefined;
143
+ identity: undefined;
144
+ generated: undefined;
145
+ }>;
146
+ payloadJson: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
147
+ name: string;
148
+ tableName: "_pgxsinkit_journal_shape";
149
+ dataType: "string";
150
+ data: string;
151
+ driverParam: string;
152
+ notNull: true;
153
+ hasDefault: false;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: undefined;
158
+ identity: undefined;
159
+ generated: undefined;
160
+ }>;
161
+ attemptCount: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgIntegerBuilder>>, {
162
+ name: string;
163
+ tableName: "_pgxsinkit_journal_shape";
164
+ dataType: "number int32";
165
+ data: number;
166
+ driverParam: string | number;
167
+ notNull: true;
168
+ hasDefault: true;
169
+ isPrimaryKey: false;
170
+ isAutoincrement: false;
171
+ hasRuntimeDefault: false;
172
+ enumValues: undefined;
173
+ identity: undefined;
174
+ generated: undefined;
175
+ }>;
176
+ lastError: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
177
+ name: string;
178
+ tableName: "_pgxsinkit_journal_shape";
179
+ dataType: "string";
180
+ data: string;
181
+ driverParam: string;
182
+ notNull: false;
183
+ hasDefault: false;
184
+ isPrimaryKey: false;
185
+ isAutoincrement: false;
186
+ hasRuntimeDefault: false;
187
+ enumValues: undefined;
188
+ identity: undefined;
189
+ generated: undefined;
190
+ }>;
191
+ lastHttpStatus: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgIntegerBuilder, {
192
+ name: string;
193
+ tableName: "_pgxsinkit_journal_shape";
194
+ dataType: "number int32";
195
+ data: number;
196
+ driverParam: string | number;
197
+ notNull: false;
198
+ hasDefault: false;
199
+ isPrimaryKey: false;
200
+ isAutoincrement: false;
201
+ hasRuntimeDefault: false;
202
+ enumValues: undefined;
203
+ identity: undefined;
204
+ generated: undefined;
205
+ }>;
206
+ conflictReason: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
207
+ name: string;
208
+ tableName: "_pgxsinkit_journal_shape";
209
+ dataType: "string";
210
+ data: string;
211
+ driverParam: string;
212
+ notNull: false;
213
+ hasDefault: false;
214
+ isPrimaryKey: false;
215
+ isAutoincrement: false;
216
+ hasRuntimeDefault: false;
217
+ enumValues: undefined;
218
+ identity: undefined;
219
+ generated: undefined;
220
+ }>;
221
+ serverUpdatedAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
222
+ dataType: 'custom';
223
+ data: string;
224
+ driverParam: string;
225
+ }>, {
226
+ name: string;
227
+ tableName: "_pgxsinkit_journal_shape";
228
+ dataType: "custom";
229
+ data: string;
230
+ driverParam: string;
231
+ notNull: false;
232
+ hasDefault: false;
233
+ isPrimaryKey: false;
234
+ isAutoincrement: false;
235
+ hasRuntimeDefault: false;
236
+ enumValues: undefined;
237
+ identity: undefined;
238
+ generated: undefined;
239
+ }>;
240
+ enqueuedAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
241
+ dataType: 'custom';
242
+ data: string;
243
+ driverParam: string;
244
+ }>>, {
245
+ name: string;
246
+ tableName: "_pgxsinkit_journal_shape";
247
+ dataType: "custom";
248
+ data: string;
249
+ driverParam: string;
250
+ notNull: true;
251
+ hasDefault: false;
252
+ isPrimaryKey: false;
253
+ isAutoincrement: false;
254
+ hasRuntimeDefault: false;
255
+ enumValues: undefined;
256
+ identity: undefined;
257
+ generated: undefined;
258
+ }>;
259
+ nextRetryAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
260
+ dataType: 'custom';
261
+ data: string;
262
+ driverParam: string;
263
+ }>, {
264
+ name: string;
265
+ tableName: "_pgxsinkit_journal_shape";
266
+ dataType: "custom";
267
+ data: string;
268
+ driverParam: string;
269
+ notNull: false;
270
+ hasDefault: false;
271
+ isPrimaryKey: false;
272
+ isAutoincrement: false;
273
+ hasRuntimeDefault: false;
274
+ enumValues: undefined;
275
+ identity: undefined;
276
+ generated: undefined;
277
+ }>;
278
+ sentAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
279
+ dataType: 'custom';
280
+ data: string;
281
+ driverParam: string;
282
+ }>, {
283
+ name: string;
284
+ tableName: "_pgxsinkit_journal_shape";
285
+ dataType: "custom";
286
+ data: string;
287
+ driverParam: string;
288
+ notNull: false;
289
+ hasDefault: false;
290
+ isPrimaryKey: false;
291
+ isAutoincrement: false;
292
+ hasRuntimeDefault: false;
293
+ enumValues: undefined;
294
+ identity: undefined;
295
+ generated: undefined;
296
+ }>;
297
+ ackedAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
298
+ dataType: 'custom';
299
+ data: string;
300
+ driverParam: string;
301
+ }>, {
302
+ name: string;
303
+ tableName: "_pgxsinkit_journal_shape";
304
+ dataType: "custom";
305
+ data: string;
306
+ driverParam: string;
307
+ notNull: false;
308
+ hasDefault: false;
309
+ isPrimaryKey: false;
310
+ isAutoincrement: false;
311
+ hasRuntimeDefault: false;
312
+ enumValues: undefined;
313
+ identity: undefined;
314
+ generated: undefined;
315
+ }>;
316
+ updatedAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_journal_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
317
+ dataType: 'custom';
318
+ data: string;
319
+ driverParam: string;
320
+ }>>, {
321
+ name: string;
322
+ tableName: "_pgxsinkit_journal_shape";
323
+ dataType: "custom";
324
+ data: string;
325
+ driverParam: string;
326
+ notNull: true;
327
+ hasDefault: false;
328
+ isPrimaryKey: false;
329
+ isAutoincrement: false;
330
+ hasRuntimeDefault: false;
331
+ enumValues: undefined;
332
+ identity: undefined;
333
+ generated: undefined;
334
+ }>;
335
+ };
336
+ dialect: 'pg';
337
+ }>;
338
+ declare const overlayShape: PgTableWithColumns<{
339
+ name: "_pgxsinkit_overlay_shape";
340
+ schema: undefined;
341
+ columns: {
342
+ overlayKind: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_overlay_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
343
+ name: string;
344
+ tableName: "_pgxsinkit_overlay_shape";
345
+ dataType: "string";
346
+ data: string;
347
+ driverParam: string;
348
+ notNull: true;
349
+ hasDefault: false;
350
+ isPrimaryKey: false;
351
+ isAutoincrement: false;
352
+ hasRuntimeDefault: false;
353
+ enumValues: undefined;
354
+ identity: undefined;
355
+ generated: undefined;
356
+ }>;
357
+ localUpdatedAtUs: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_overlay_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
358
+ dataType: 'custom';
359
+ data: string;
360
+ driverParam: string;
361
+ }>>, {
362
+ name: string;
363
+ tableName: "_pgxsinkit_overlay_shape";
364
+ dataType: "custom";
365
+ data: string;
366
+ driverParam: string;
367
+ notNull: true;
368
+ hasDefault: false;
369
+ isPrimaryKey: false;
370
+ isAutoincrement: false;
371
+ hasRuntimeDefault: false;
372
+ enumValues: undefined;
373
+ identity: undefined;
374
+ generated: undefined;
375
+ }>;
376
+ };
377
+ dialect: 'pg';
378
+ }>;
379
+ declare const syncStateShape: PgViewWithSelection<"_pgxsinkit_sync_state_shape", true, {
380
+ observedServerVersion: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").PgBigInt64Builder, {
381
+ name: string;
382
+ tableName: "_pgxsinkit_sync_state_shape";
383
+ dataType: "bigint int64";
384
+ data: bigint;
385
+ driverParam: string;
386
+ notNull: false;
387
+ hasDefault: false;
388
+ isPrimaryKey: false;
389
+ isAutoincrement: false;
390
+ hasRuntimeDefault: false;
391
+ enumValues: undefined;
392
+ identity: undefined;
393
+ generated: undefined;
394
+ }>;
395
+ ackedServerVersion: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").PgBigInt64Builder, {
396
+ name: string;
397
+ tableName: "_pgxsinkit_sync_state_shape";
398
+ dataType: "bigint int64";
399
+ data: bigint;
400
+ driverParam: string;
401
+ notNull: false;
402
+ hasDefault: false;
403
+ isPrimaryKey: false;
404
+ isAutoincrement: false;
405
+ hasRuntimeDefault: false;
406
+ enumValues: undefined;
407
+ identity: undefined;
408
+ generated: undefined;
409
+ }>;
410
+ pendingCount: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
411
+ name: string;
412
+ tableName: "_pgxsinkit_sync_state_shape";
413
+ dataType: "number int53";
414
+ data: number;
415
+ driverParam: string | number;
416
+ notNull: true;
417
+ hasDefault: false;
418
+ isPrimaryKey: false;
419
+ isAutoincrement: false;
420
+ hasRuntimeDefault: false;
421
+ enumValues: undefined;
422
+ identity: undefined;
423
+ generated: undefined;
424
+ }>;
425
+ hasAckedUnobservedWrite: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBooleanBuilder>, {
426
+ name: string;
427
+ tableName: "_pgxsinkit_sync_state_shape";
428
+ dataType: "boolean";
429
+ data: boolean;
430
+ driverParam: boolean;
431
+ notNull: true;
432
+ hasDefault: false;
433
+ isPrimaryKey: false;
434
+ isAutoincrement: false;
435
+ hasRuntimeDefault: false;
436
+ enumValues: undefined;
437
+ identity: undefined;
438
+ generated: undefined;
439
+ }>;
440
+ localDeletePending: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBooleanBuilder>, {
441
+ name: string;
442
+ tableName: "_pgxsinkit_sync_state_shape";
443
+ dataType: "boolean";
444
+ data: boolean;
445
+ driverParam: boolean;
446
+ notNull: true;
447
+ hasDefault: false;
448
+ isPrimaryKey: false;
449
+ isAutoincrement: false;
450
+ hasRuntimeDefault: false;
451
+ enumValues: undefined;
452
+ identity: undefined;
453
+ generated: undefined;
454
+ }>;
455
+ conflictState: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
456
+ name: string;
457
+ tableName: "_pgxsinkit_sync_state_shape";
458
+ dataType: "string";
459
+ data: string;
460
+ driverParam: string;
461
+ notNull: false;
462
+ hasDefault: false;
463
+ isPrimaryKey: false;
464
+ isAutoincrement: false;
465
+ hasRuntimeDefault: false;
466
+ enumValues: undefined;
467
+ identity: undefined;
468
+ generated: undefined;
469
+ }>;
470
+ quarantinedCount: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt53Builder>, {
471
+ name: string;
472
+ tableName: "_pgxsinkit_sync_state_shape";
473
+ dataType: "number int53";
474
+ data: number;
475
+ driverParam: string | number;
476
+ notNull: true;
477
+ hasDefault: false;
478
+ isPrimaryKey: false;
479
+ isAutoincrement: false;
480
+ hasRuntimeDefault: false;
481
+ enumValues: undefined;
482
+ identity: undefined;
483
+ generated: undefined;
484
+ }>;
485
+ quarantineState: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_sync_state_shape", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
486
+ name: string;
487
+ tableName: "_pgxsinkit_sync_state_shape";
488
+ dataType: "string";
489
+ data: string;
490
+ driverParam: string;
491
+ notNull: false;
492
+ hasDefault: false;
493
+ isPrimaryKey: false;
494
+ isAutoincrement: false;
495
+ hasRuntimeDefault: false;
496
+ enumValues: undefined;
497
+ identity: undefined;
498
+ generated: undefined;
499
+ }>;
500
+ }>;
501
+ declare const readModelShape: PgViewWithSelection<"_pgxsinkit_read_model_shape", true, {
502
+ overlay_kind: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_read_model_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgVarcharBuilder<[string, ...string[]]>>, {
503
+ name: string;
504
+ tableName: "_pgxsinkit_read_model_shape";
505
+ dataType: "string";
506
+ data: string;
507
+ driverParam: string;
508
+ notNull: true;
509
+ hasDefault: false;
510
+ isPrimaryKey: false;
511
+ isAutoincrement: false;
512
+ hasRuntimeDefault: false;
513
+ enumValues: undefined;
514
+ identity: undefined;
515
+ generated: undefined;
516
+ }>;
517
+ local_updated_at_us: import("drizzle-orm/pg-core").PgBuildColumn<"_pgxsinkit_read_model_shape", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgBigInt64Builder>, {
518
+ name: string;
519
+ tableName: "_pgxsinkit_read_model_shape";
520
+ dataType: "bigint int64";
521
+ data: bigint;
522
+ driverParam: string;
523
+ notNull: true;
524
+ hasDefault: false;
525
+ isPrimaryKey: false;
526
+ isAutoincrement: false;
527
+ hasRuntimeDefault: false;
528
+ enumValues: undefined;
529
+ identity: undefined;
530
+ generated: undefined;
531
+ }>;
532
+ }>;
533
+ declare const localMetaShape: PgTableWithColumns<{
534
+ name: "pgxsinkit_local_meta";
535
+ schema: undefined;
536
+ columns: {
537
+ key: import("drizzle-orm/pg-core").PgBuildColumn<"pgxsinkit_local_meta", import("drizzle-orm/pg-core").SetIsPrimaryKey<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
538
+ name: string;
539
+ tableName: "pgxsinkit_local_meta";
540
+ dataType: "string";
541
+ data: string;
542
+ driverParam: string;
543
+ notNull: true;
544
+ hasDefault: false;
545
+ isPrimaryKey: false;
546
+ isAutoincrement: false;
547
+ hasRuntimeDefault: false;
548
+ enumValues: undefined;
549
+ identity: undefined;
550
+ generated: undefined;
551
+ }>;
552
+ value: import("drizzle-orm/pg-core").PgBuildColumn<"pgxsinkit_local_meta", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>>, {
553
+ name: string;
554
+ tableName: "pgxsinkit_local_meta";
555
+ dataType: "string";
556
+ data: string;
557
+ driverParam: string;
558
+ notNull: true;
559
+ hasDefault: false;
560
+ isPrimaryKey: false;
561
+ isAutoincrement: false;
562
+ hasRuntimeDefault: false;
563
+ enumValues: undefined;
564
+ identity: undefined;
565
+ generated: undefined;
566
+ }>;
567
+ };
568
+ dialect: 'pg';
569
+ }>;
570
+ /**
571
+ * The entry's PROJECTED local table type — its server columns minus `clientProjection.omitColumns`,
572
+ * exactly the shape `defineSyncTable` stamped onto `entry.localTable`. When `TEntry` is a concrete
573
+ * entry (a registry built by `defineSyncRegistry`) this carries the real, typed columns; when it is a
574
+ * bare `SyncTableEntry` (a generic `SyncTableRegistry`) it degrades to `AnyPgTable`, which pushes every
575
+ * derived type below onto the open `Record<string, PgColumn>` index-signature fallback.
576
+ */
577
+ type EntryLocalTable<TEntry> = TEntry extends SyncTableEntry<AnyPgTable, infer TLocal extends AnyPgTable> ? TLocal : AnyPgTable;
578
+ /** The entry's projected columns keyed by drizzle property key (or the open `PgColumns` fallback). */
579
+ type EntryColumns<TEntry> = EntryLocalTable<TEntry>["_"]["columns"];
580
+ type OverlayFixedColumns = (typeof overlayShape)["_"]["columns"];
581
+ type ReadModelFixedColumns = (typeof readModelShape)["_"]["selectedFields"];
582
+ /**
583
+ * The `<t>_overlay` optimistic-intent table: the entry's PROJECTED columns (same builders the generator
584
+ * and `entry.localTable` carry) merged with the two fixed overlay columns. The entity columns read
585
+ * back through real drizzle result mapping, so their types mirror the projected table exactly (a
586
+ * `mode: "bigint"` column is `bigint`, etc.). The two overlay columns are `bigintText` passthrough
587
+ * (`local_updated_at_us` reads as a string). `TEntry` defaults to a bare entry, giving the open
588
+ * index-signature form the mutation runtime (generic over any registry) needs.
589
+ */
590
+ export type OverlayTable<TEntry = SyncTableEntry> = PgTableWithColumns<{
591
+ name: string;
592
+ schema: string | undefined;
593
+ columns: EntryColumns<TEntry> & OverlayFixedColumns;
594
+ dialect: "pg";
595
+ }>;
596
+ /**
597
+ * The `<t>_read_model` overlay-merged read view (ADR-0004): the entry's PROJECTED columns under their
598
+ * property keys plus the two fixed overlay columns (`overlay_kind`, `local_updated_at_us`). Read
599
+ * through a live query, so `local_updated_at_us` is an int8 `mode: "bigint"` column.
600
+ */
601
+ export type ReadModelView<TEntry = SyncTableEntry> = PgViewWithSelection<string, true, EntryColumns<TEntry> & ReadModelFixedColumns>;
602
+ /**
603
+ * The projected SYNCED read-cache table — the entry's projected local table (or `AnyPgTable` fallback).
604
+ * Type-level note: the phantom relation name here is the original `tableName` (inherited from
605
+ * `ProjectedLocalTable`), but the runtime object `getSyncedLocalTable` returns honours a
606
+ * `clientProjection.syncedTable` rename — so the rendered SQL uses the runtime name, not this type's name.
607
+ */
608
+ export type SyncedLocalTable<TEntry = SyncTableEntry> = EntryLocalTable<TEntry>;
609
+ /**
610
+ * The `<t>_mutations` journal: fixed runtime columns + the entry's PK columns (index-signature access).
611
+ * Kept conservatively indexed: the journal carries ONLY the PK columns, keyed by DB COLUMN NAME and
612
+ * type-erased to `text`, but neither the PK column-name set nor the "PK only" subset is recoverable at
613
+ * the type level from `SyncTableEntry` (its `primaryKey.columns` is an un-narrowed `string[]`), so an
614
+ * honest per-entry type is not representable without a footgun (claiming non-PK columns that do not
615
+ * exist on the journal at runtime). PK/entity columns therefore ride the index signature.
616
+ */
617
+ export type JournalTable = typeof journalShape & {
618
+ [columnName: string]: PgColumn;
619
+ };
620
+ /**
621
+ * The `<t>_sync_state` convergence view (ADR-0011): fixed state columns + the entry's PK columns.
622
+ * Conservatively indexed for the same reason as {@link JournalTable} — it projects only the PK columns
623
+ * (a subset not recoverable at the type level), so the PK columns ride the index signature.
624
+ */
625
+ export type SyncStateView = typeof syncStateShape & {
626
+ [columnName: string]: PgColumn;
627
+ };
628
+ /** The `pgxsinkit_local_meta` key/value table (ADR-0006). */
629
+ export type LocalMetaTable = typeof localMetaShape;
630
+ /**
631
+ * The projected SYNCED read-cache table as a runtime Drizzle object, under the resolved local name
632
+ * (`clientProjection.syncedTable` override honoured) and the registry's local schema — the exact
633
+ * relation the generator's `CREATE TABLE` provisions. Prefer `entry.localTable` where its name
634
+ * already matches; this object exists for the runtime/tests that must track the projection rename.
635
+ * Carries the entry's real projected columns under a concretely-typed registry, `AnyPgTable` under a
636
+ * bare `SyncTableRegistry` (see {@link SyncedLocalTable}).
637
+ */
638
+ export declare function getSyncedLocalTable<TRegistry extends SyncTableRegistry, TKey extends string & keyof TRegistry>(registry: TRegistry, tableKey: TKey): SyncedLocalTable<TRegistry[TKey]>;
639
+ /**
640
+ * The `<t>_overlay` optimistic-intent table as a runtime Drizzle object (writable tables only — throws
641
+ * for a readonly entry, which has no overlay/journal projection). Its entity columns are typed exactly
642
+ * as {@link OverlayTable} describes — real per-column types under a concretely-typed registry, the open
643
+ * index-signature fallback under a bare `SyncTableRegistry` — plus the two fixed overlay columns.
644
+ */
645
+ export declare function getOverlayTable<TRegistry extends SyncTableRegistry, TKey extends string & keyof TRegistry>(registry: TRegistry, tableKey: TKey): OverlayTable<TRegistry[TKey]>;
646
+ /**
647
+ * The `<t>_mutations` journal table as a runtime Drizzle object (writable tables only). The fixed runtime
648
+ * columns are typed; the PK/entity columns ride the index signature and are reached by DB column NAME
649
+ * (`journal["id"]`), because per-entry typing is not representable — see {@link JournalTable}.
650
+ */
651
+ export declare function getJournalTable<TRegistry extends SyncTableRegistry>(registry: TRegistry, tableKey: string & keyof TRegistry): JournalTable;
652
+ /**
653
+ * The `<t>_sync_state` convergence view (ADR-0011) as a runtime Drizzle object (writable tables only) —
654
+ * PK columns under the entry's own property keys plus the fixed state columns, mirroring
655
+ * `buildSyncStateView`'s projection. The fixed state columns are typed; the PK columns ride the index
656
+ * signature (not recoverable at the type level — see {@link SyncStateView}) and are reached by their
657
+ * drizzle PROPERTY key (`view["authorId"]`), unlike the journal, which keys its PK columns by DB column
658
+ * name.
659
+ */
660
+ export declare function getSyncStateView<TRegistry extends SyncTableRegistry>(registry: TRegistry, tableKey: string & keyof TRegistry): SyncStateView;
661
+ /**
662
+ * The `<t>_read_model` overlay-merged read view (ADR-0004) as a runtime Drizzle object: every projected
663
+ * synced column under the entry's own property key plus the two overlay columns (`overlay_kind`,
664
+ * `local_updated_at_us`), mirroring the generator's `CREATE VIEW`. The entry's own `entry.view` is
665
+ * schema-UNQUALIFIED (`defineSyncTable` builds it with a bare `pgView`), so a consumer whose local store
666
+ * lives in a non-public schema must author against this qualified object instead of `entry.view`.
667
+ */
668
+ export declare function getReadModelView<TRegistry extends SyncTableRegistry, TKey extends string & keyof TRegistry>(registry: TRegistry, tableKey: TKey): ReadModelView<TRegistry[TKey]>;
669
+ /**
670
+ * The read-path applier's resolved per-shape target (ADR-0029 D1/D2). Every table-scoped fact the
671
+ * appliers need is derived once from the registry entry — the real projected synced table object, its
672
+ * columns indexed by DB column name, the primary-key column names, and the model-derived column types —
673
+ * so the appliers author over Drizzle objects (no name/schema strings, no `information_schema` probe).
674
+ * Resolved once per shape at subscribe time; reused for every message. Electric change rows are keyed
675
+ * by DB **column name**, while Drizzle DML keys by **property key**, so both indexes are carried.
676
+ */
677
+ export interface ApplyTarget {
678
+ /** The real projected synced local table (`getSyncedLocalTable`) — bare for ephemeral lifecycles. */
679
+ table: AnyPgTable;
680
+ /** DB column name → its Drizzle `PgColumn` (for `eq`/conflict-target/COPY clauses). */
681
+ columnByName: Record<string, PgColumn>;
682
+ /** DB column name → its Drizzle property key (to key `.values()`/`.set()` from a name-keyed row). */
683
+ propertyKeyByName: Record<string, string>;
684
+ /** Primary-key column NAMES, in order (from the entry, local-projection override honoured). */
685
+ primaryKey: string[];
686
+ /** Model-derived column types (`deriveSyncColumnTypes`), keyed by DB column name via `.name`. */
687
+ columnTypes: SyncColumnType[];
688
+ /**
689
+ * Per-shape render-once cache for the batched-INSERT family (ADR-0029 D5): a rendered `{sqlText,
690
+ * params}` per distinct (column-set, row-count), reused across batches with per-value codecs applied
691
+ * at execution. Empty at resolution; populated lazily by the applier.
692
+ */
693
+ insertRenderCache: Map<string, {
694
+ sqlText: string;
695
+ params: unknown[];
696
+ }>;
697
+ }
698
+ /**
699
+ * Resolve a shape's {@link ApplyTarget} from its registry entry (ADR-0029 D1/D2). Called once per shape
700
+ * at subscribe time — never per message. The single source is the registry item: identity via
701
+ * `getSyncedLocalTable`, PKs via `getLocalSyncedTablePrimaryKeyColumns`, types via `deriveSyncColumnTypes`.
702
+ */
703
+ export declare function resolveApplyTarget<TRegistry extends SyncTableRegistry, TKey extends string & keyof TRegistry>(registry: TRegistry, tableKey: TKey): ApplyTarget;
704
+ /** The `pgxsinkit_local_meta` key/value table (ADR-0006) under the registry's local schema. */
705
+ export declare function getLocalMetaTable(registry: SyncTableRegistry): LocalMetaTable;
706
+ export {};
707
+ //# sourceMappingURL=local-tables.d.ts.map