@powersync/service-module-postgres-storage 0.9.0 → 0.10.1

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.
@@ -10,9 +10,21 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 1`] = `
10
10
  "checksum": -93886621,
11
11
  "count": 2,
12
12
  "priority": 3,
13
+ "subscriptions": [
14
+ {
15
+ "default": 0,
16
+ },
17
+ ],
13
18
  },
14
19
  ],
15
20
  "last_op_id": "2",
21
+ "streams": [
22
+ {
23
+ "errors": [],
24
+ "is_default": true,
25
+ "name": "mybucket",
26
+ },
27
+ ],
16
28
  "write_checkpoint": undefined,
17
29
  },
18
30
  },
@@ -27,7 +39,7 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
27
39
  "bucket": "mybucket[]",
28
40
  "data": [
29
41
  {
30
- "checksum": -93886621n,
42
+ "checksum": -93886621,
31
43
  "op": "CLEAR",
32
44
  "op_id": "2",
33
45
  },
@@ -46,6 +58,11 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
46
58
  "checksum": 499012468,
47
59
  "count": 4,
48
60
  "priority": 3,
61
+ "subscriptions": [
62
+ {
63
+ "default": 0,
64
+ },
65
+ ],
49
66
  },
50
67
  ],
51
68
  "write_checkpoint": undefined,
@@ -57,7 +74,7 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
57
74
  "bucket": "mybucket[]",
58
75
  "data": [
59
76
  {
60
- "checksum": 1859363232n,
77
+ "checksum": 1859363232,
61
78
  "data": "{"id":"t1","description":"Test 1b"}",
62
79
  "object_id": "t1",
63
80
  "object_type": "test",
@@ -66,7 +83,7 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
66
83
  "subkey": "02d285ac-4f96-5124-8fba-c6d1df992dd1",
67
84
  },
68
85
  {
69
- "checksum": 3028503153n,
86
+ "checksum": 3028503153,
70
87
  "data": "{"id":"t2","description":"Test 2b"}",
71
88
  "object_id": "t2",
72
89
  "object_type": "test",
@@ -87,6 +104,116 @@ exports[`sync - postgres > compacting data - invalidate checkpoint 2`] = `
87
104
  ]
88
105
  `;
89
106
 
107
+ exports[`sync - postgres > encodes sync rules id in buckes for streams 1`] = `
108
+ [
109
+ {
110
+ "checkpoint": {
111
+ "buckets": [
112
+ {
113
+ "bucket": "1#test|0[]",
114
+ "checksum": 920318466,
115
+ "count": 1,
116
+ "priority": 3,
117
+ "subscriptions": [
118
+ {
119
+ "default": 0,
120
+ },
121
+ ],
122
+ },
123
+ ],
124
+ "last_op_id": "1",
125
+ "streams": [
126
+ {
127
+ "errors": [],
128
+ "is_default": true,
129
+ "name": "test",
130
+ },
131
+ ],
132
+ "write_checkpoint": undefined,
133
+ },
134
+ },
135
+ {
136
+ "data": {
137
+ "after": "0",
138
+ "bucket": "1#test|0[]",
139
+ "data": [
140
+ {
141
+ "checksum": 920318466,
142
+ "data": "{"id":"t1","description":"Test 1"}",
143
+ "object_id": "t1",
144
+ "object_type": "test",
145
+ "op": "PUT",
146
+ "op_id": "1",
147
+ "subkey": "02d285ac-4f96-5124-8fba-c6d1df992dd1",
148
+ },
149
+ ],
150
+ "has_more": false,
151
+ "next_after": "1",
152
+ },
153
+ },
154
+ {
155
+ "checkpoint_complete": {
156
+ "last_op_id": "1",
157
+ },
158
+ },
159
+ ]
160
+ `;
161
+
162
+ exports[`sync - postgres > encodes sync rules id in buckes for streams 2`] = `
163
+ [
164
+ {
165
+ "checkpoint": {
166
+ "buckets": [
167
+ {
168
+ "bucket": "2#test|0[]",
169
+ "checksum": 920318466,
170
+ "count": 1,
171
+ "priority": 3,
172
+ "subscriptions": [
173
+ {
174
+ "default": 0,
175
+ },
176
+ ],
177
+ },
178
+ ],
179
+ "last_op_id": "2",
180
+ "streams": [
181
+ {
182
+ "errors": [],
183
+ "is_default": true,
184
+ "name": "test",
185
+ },
186
+ ],
187
+ "write_checkpoint": undefined,
188
+ },
189
+ },
190
+ {
191
+ "data": {
192
+ "after": "0",
193
+ "bucket": "2#test|0[]",
194
+ "data": [
195
+ {
196
+ "checksum": 920318466,
197
+ "data": "{"id":"t1","description":"Test 1"}",
198
+ "object_id": "t1",
199
+ "object_type": "test",
200
+ "op": "PUT",
201
+ "op_id": "2",
202
+ "subkey": "02d285ac-4f96-5124-8fba-c6d1df992dd1",
203
+ },
204
+ ],
205
+ "has_more": false,
206
+ "next_after": "2",
207
+ },
208
+ },
209
+ {
210
+ "checkpoint_complete": {
211
+ "last_op_id": "2",
212
+ },
213
+ },
214
+ ]
215
+ `;
216
+
90
217
  exports[`sync - postgres > expired token 1`] = `
91
218
  [
92
219
  {
@@ -105,9 +232,21 @@ exports[`sync - postgres > expiring token 1`] = `
105
232
  "checksum": 0,
106
233
  "count": 0,
107
234
  "priority": 3,
235
+ "subscriptions": [
236
+ {
237
+ "default": 0,
238
+ },
239
+ ],
108
240
  },
109
241
  ],
110
242
  "last_op_id": "0",
243
+ "streams": [
244
+ {
245
+ "errors": [],
246
+ "is_default": true,
247
+ "name": "mybucket",
248
+ },
249
+ ],
111
250
  "write_checkpoint": undefined,
112
251
  },
113
252
  },
@@ -137,9 +276,21 @@ exports[`sync - postgres > sends checkpoint complete line for empty checkpoint 1
137
276
  "checksum": -1221282404,
138
277
  "count": 1,
139
278
  "priority": 3,
279
+ "subscriptions": [
280
+ {
281
+ "default": 0,
282
+ },
283
+ ],
140
284
  },
141
285
  ],
142
286
  "last_op_id": "1",
287
+ "streams": [
288
+ {
289
+ "errors": [],
290
+ "is_default": true,
291
+ "name": "mybucket",
292
+ },
293
+ ],
143
294
  "write_checkpoint": undefined,
144
295
  },
145
296
  },
@@ -162,6 +313,7 @@ exports[`sync - postgres > sends checkpoint complete line for empty checkpoint 1
162
313
  "next_after": "1",
163
314
  },
164
315
  },
316
+ null,
165
317
  {
166
318
  "checkpoint_complete": {
167
319
  "last_op_id": "1",
@@ -193,15 +345,37 @@ exports[`sync - postgres > sync buckets in order 1`] = `
193
345
  "checksum": 920318466,
194
346
  "count": 1,
195
347
  "priority": 2,
348
+ "subscriptions": [
349
+ {
350
+ "default": 0,
351
+ },
352
+ ],
196
353
  },
197
354
  {
198
355
  "bucket": "b1[]",
199
356
  "checksum": -1382098757,
200
357
  "count": 1,
201
358
  "priority": 1,
359
+ "subscriptions": [
360
+ {
361
+ "default": 1,
362
+ },
363
+ ],
202
364
  },
203
365
  ],
204
366
  "last_op_id": "2",
367
+ "streams": [
368
+ {
369
+ "errors": [],
370
+ "is_default": true,
371
+ "name": "b0",
372
+ },
373
+ {
374
+ "errors": [],
375
+ "is_default": true,
376
+ "name": "b1",
377
+ },
378
+ ],
205
379
  "write_checkpoint": undefined,
206
380
  },
207
381
  },
@@ -211,7 +385,7 @@ exports[`sync - postgres > sync buckets in order 1`] = `
211
385
  "bucket": "b1[]",
212
386
  "data": [
213
387
  {
214
- "checksum": 2912868539n,
388
+ "checksum": 2912868539,
215
389
  "data": "{"id":"earlier","description":"Test 2"}",
216
390
  "object_id": "earlier",
217
391
  "object_type": "test",
@@ -236,7 +410,7 @@ exports[`sync - postgres > sync buckets in order 1`] = `
236
410
  "bucket": "b0[]",
237
411
  "data": [
238
412
  {
239
- "checksum": 920318466n,
413
+ "checksum": 920318466,
240
414
  "data": "{"id":"t1","description":"Test 1"}",
241
415
  "object_id": "t1",
242
416
  "object_type": "test",
@@ -267,9 +441,21 @@ exports[`sync - postgres > sync global data 1`] = `
267
441
  "checksum": -93886621,
268
442
  "count": 2,
269
443
  "priority": 3,
444
+ "subscriptions": [
445
+ {
446
+ "default": 0,
447
+ },
448
+ ],
270
449
  },
271
450
  ],
272
451
  "last_op_id": "2",
452
+ "streams": [
453
+ {
454
+ "errors": [],
455
+ "is_default": true,
456
+ "name": "mybucket",
457
+ },
458
+ ],
273
459
  "write_checkpoint": undefined,
274
460
  },
275
461
  },
@@ -279,7 +465,7 @@ exports[`sync - postgres > sync global data 1`] = `
279
465
  "bucket": "mybucket[]",
280
466
  "data": [
281
467
  {
282
- "checksum": 920318466n,
468
+ "checksum": 920318466,
283
469
  "data": "{"id":"t1","description":"Test 1"}",
284
470
  "object_id": "t1",
285
471
  "object_type": "test",
@@ -288,7 +474,7 @@ exports[`sync - postgres > sync global data 1`] = `
288
474
  "subkey": "02d285ac-4f96-5124-8fba-c6d1df992dd1",
289
475
  },
290
476
  {
291
- "checksum": 3280762209n,
477
+ "checksum": 3280762209,
292
478
  "data": "{"id":"t2","description":"Test 2"}",
293
479
  "object_id": "t2",
294
480
  "object_type": "test",
@@ -319,21 +505,53 @@ exports[`sync - postgres > sync interrupts low-priority buckets on new checkpoin
319
505
  "checksum": -659831575,
320
506
  "count": 2000,
321
507
  "priority": 2,
508
+ "subscriptions": [
509
+ {
510
+ "default": 0,
511
+ },
512
+ ],
322
513
  },
323
514
  {
324
515
  "bucket": "b0b[]",
325
516
  "checksum": -659831575,
326
517
  "count": 2000,
327
518
  "priority": 2,
519
+ "subscriptions": [
520
+ {
521
+ "default": 1,
522
+ },
523
+ ],
328
524
  },
329
525
  {
330
526
  "bucket": "b1[]",
331
527
  "checksum": -1096116670,
332
528
  "count": 1,
333
529
  "priority": 1,
530
+ "subscriptions": [
531
+ {
532
+ "default": 2,
533
+ },
534
+ ],
334
535
  },
335
536
  ],
336
537
  "last_op_id": "4001",
538
+ "streams": [
539
+ {
540
+ "errors": [],
541
+ "is_default": true,
542
+ "name": "b0a",
543
+ },
544
+ {
545
+ "errors": [],
546
+ "is_default": true,
547
+ "name": "b0b",
548
+ },
549
+ {
550
+ "errors": [],
551
+ "is_default": true,
552
+ "name": "b1",
553
+ },
554
+ ],
337
555
  "write_checkpoint": undefined,
338
556
  },
339
557
  },
@@ -380,18 +598,33 @@ exports[`sync - postgres > sync interrupts low-priority buckets on new checkpoin
380
598
  "checksum": 883076828,
381
599
  "count": 2001,
382
600
  "priority": 2,
601
+ "subscriptions": [
602
+ {
603
+ "default": 0,
604
+ },
605
+ ],
383
606
  },
384
607
  {
385
608
  "bucket": "b0b[]",
386
609
  "checksum": 883076828,
387
610
  "count": 2001,
388
611
  "priority": 2,
612
+ "subscriptions": [
613
+ {
614
+ "default": 1,
615
+ },
616
+ ],
389
617
  },
390
618
  {
391
619
  "bucket": "b1[]",
392
620
  "checksum": 1841937527,
393
621
  "count": 2,
394
622
  "priority": 1,
623
+ "subscriptions": [
624
+ {
625
+ "default": 2,
626
+ },
627
+ ],
395
628
  },
396
629
  ],
397
630
  "write_checkpoint": undefined,
@@ -466,9 +699,21 @@ exports[`sync - postgres > sync legacy non-raw data 1`] = `
466
699
  "checksum": -852817836,
467
700
  "count": 1,
468
701
  "priority": 3,
702
+ "subscriptions": [
703
+ {
704
+ "default": 0,
705
+ },
706
+ ],
469
707
  },
470
708
  ],
471
709
  "last_op_id": "1",
710
+ "streams": [
711
+ {
712
+ "errors": [],
713
+ "is_default": true,
714
+ "name": "mybucket",
715
+ },
716
+ ],
472
717
  "write_checkpoint": undefined,
473
718
  },
474
719
  },
@@ -514,9 +759,21 @@ exports[`sync - postgres > sync updates to data query only 1`] = `
514
759
  "checksum": 0,
515
760
  "count": 0,
516
761
  "priority": 3,
762
+ "subscriptions": [
763
+ {
764
+ "default": 0,
765
+ },
766
+ ],
517
767
  },
518
768
  ],
519
769
  "last_op_id": "1",
770
+ "streams": [
771
+ {
772
+ "errors": [],
773
+ "is_default": true,
774
+ "name": "by_user",
775
+ },
776
+ ],
520
777
  "write_checkpoint": undefined,
521
778
  },
522
779
  },
@@ -540,6 +797,11 @@ exports[`sync - postgres > sync updates to data query only 2`] = `
540
797
  "checksum": 1418351250,
541
798
  "count": 1,
542
799
  "priority": 3,
800
+ "subscriptions": [
801
+ {
802
+ "default": 0,
803
+ },
804
+ ],
543
805
  },
544
806
  ],
545
807
  "write_checkpoint": undefined,
@@ -551,7 +813,7 @@ exports[`sync - postgres > sync updates to data query only 2`] = `
551
813
  "bucket": "by_user["user1"]",
552
814
  "data": [
553
815
  {
554
- "checksum": 1418351250n,
816
+ "checksum": 1418351250,
555
817
  "data": "{"id":"list1","user_id":"user1","name":"User 1"}",
556
818
  "object_id": "list1",
557
819
  "object_type": "lists",
@@ -582,9 +844,21 @@ exports[`sync - postgres > sync updates to global data 1`] = `
582
844
  "checksum": 0,
583
845
  "count": 0,
584
846
  "priority": 3,
847
+ "subscriptions": [
848
+ {
849
+ "default": 0,
850
+ },
851
+ ],
585
852
  },
586
853
  ],
587
854
  "last_op_id": "0",
855
+ "streams": [
856
+ {
857
+ "errors": [],
858
+ "is_default": true,
859
+ "name": "mybucket",
860
+ },
861
+ ],
588
862
  "write_checkpoint": undefined,
589
863
  },
590
864
  },
@@ -608,6 +882,11 @@ exports[`sync - postgres > sync updates to global data 2`] = `
608
882
  "checksum": 920318466,
609
883
  "count": 1,
610
884
  "priority": 3,
885
+ "subscriptions": [
886
+ {
887
+ "default": 0,
888
+ },
889
+ ],
611
890
  },
612
891
  ],
613
892
  "write_checkpoint": undefined,
@@ -619,7 +898,7 @@ exports[`sync - postgres > sync updates to global data 2`] = `
619
898
  "bucket": "mybucket[]",
620
899
  "data": [
621
900
  {
622
- "checksum": 920318466n,
901
+ "checksum": 920318466,
623
902
  "data": "{"id":"t1","description":"Test 1"}",
624
903
  "object_id": "t1",
625
904
  "object_type": "test",
@@ -652,6 +931,11 @@ exports[`sync - postgres > sync updates to global data 3`] = `
652
931
  "checksum": -93886621,
653
932
  "count": 2,
654
933
  "priority": 3,
934
+ "subscriptions": [
935
+ {
936
+ "default": 0,
937
+ },
938
+ ],
655
939
  },
656
940
  ],
657
941
  "write_checkpoint": undefined,
@@ -663,7 +947,7 @@ exports[`sync - postgres > sync updates to global data 3`] = `
663
947
  "bucket": "mybucket[]",
664
948
  "data": [
665
949
  {
666
- "checksum": 3280762209n,
950
+ "checksum": 3280762209,
667
951
  "data": "{"id":"t2","description":"Test 2"}",
668
952
  "object_id": "t2",
669
953
  "object_type": "test",
@@ -690,6 +974,13 @@ exports[`sync - postgres > sync updates to parameter query + data 1`] = `
690
974
  "checkpoint": {
691
975
  "buckets": [],
692
976
  "last_op_id": "0",
977
+ "streams": [
978
+ {
979
+ "errors": [],
980
+ "is_default": true,
981
+ "name": "by_user",
982
+ },
983
+ ],
693
984
  "write_checkpoint": undefined,
694
985
  },
695
986
  },
@@ -713,6 +1004,11 @@ exports[`sync - postgres > sync updates to parameter query + data 2`] = `
713
1004
  "checksum": 1418351250,
714
1005
  "count": 1,
715
1006
  "priority": 3,
1007
+ "subscriptions": [
1008
+ {
1009
+ "default": 0,
1010
+ },
1011
+ ],
716
1012
  },
717
1013
  ],
718
1014
  "write_checkpoint": undefined,
@@ -724,7 +1020,7 @@ exports[`sync - postgres > sync updates to parameter query + data 2`] = `
724
1020
  "bucket": "by_user["user1"]",
725
1021
  "data": [
726
1022
  {
727
- "checksum": 1418351250n,
1023
+ "checksum": 1418351250,
728
1024
  "data": "{"id":"list1","user_id":"user1","name":"User 1"}",
729
1025
  "object_id": "list1",
730
1026
  "object_type": "lists",
@@ -751,6 +1047,13 @@ exports[`sync - postgres > sync updates to parameter query only 1`] = `
751
1047
  "checkpoint": {
752
1048
  "buckets": [],
753
1049
  "last_op_id": "0",
1050
+ "streams": [
1051
+ {
1052
+ "errors": [],
1053
+ "is_default": true,
1054
+ "name": "by_user",
1055
+ },
1056
+ ],
754
1057
  "write_checkpoint": undefined,
755
1058
  },
756
1059
  },
@@ -774,6 +1077,11 @@ exports[`sync - postgres > sync updates to parameter query only 2`] = `
774
1077
  "checksum": 0,
775
1078
  "count": 0,
776
1079
  "priority": 3,
1080
+ "subscriptions": [
1081
+ {
1082
+ "default": 0,
1083
+ },
1084
+ ],
777
1085
  },
778
1086
  ],
779
1087
  "write_checkpoint": undefined,