@powersync/service-module-mongodb-storage 0.0.0-dev-20260225093637 → 0.0.0-dev-20260313100403

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 (70) hide show
  1. package/CHANGELOG.md +51 -7
  2. package/dist/storage/MongoBucketStorage.js +17 -3
  3. package/dist/storage/MongoBucketStorage.js.map +1 -1
  4. package/dist/storage/MongoReportStorage.d.ts +3 -3
  5. package/dist/storage/MongoReportStorage.js +5 -5
  6. package/dist/storage/MongoReportStorage.js.map +1 -1
  7. package/dist/storage/implementation/MongoBucketBatch.d.ts +13 -11
  8. package/dist/storage/implementation/MongoBucketBatch.js +208 -127
  9. package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
  10. package/dist/storage/implementation/MongoChecksums.d.ts +4 -4
  11. package/dist/storage/implementation/MongoChecksums.js +1 -0
  12. package/dist/storage/implementation/MongoChecksums.js.map +1 -1
  13. package/dist/storage/implementation/MongoCompactor.d.ts +2 -2
  14. package/dist/storage/implementation/MongoCompactor.js +52 -26
  15. package/dist/storage/implementation/MongoCompactor.js.map +1 -1
  16. package/dist/storage/implementation/MongoParameterCompactor.d.ts +2 -2
  17. package/dist/storage/implementation/MongoParameterCompactor.js.map +1 -1
  18. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js +3 -7
  19. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js.map +1 -1
  20. package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +9 -4
  21. package/dist/storage/implementation/MongoSyncBucketStorage.js +35 -33
  22. package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
  23. package/dist/storage/implementation/MongoSyncRulesLock.d.ts +3 -3
  24. package/dist/storage/implementation/MongoSyncRulesLock.js.map +1 -1
  25. package/dist/storage/implementation/MongoWriteCheckpointAPI.d.ts +4 -4
  26. package/dist/storage/implementation/MongoWriteCheckpointAPI.js.map +1 -1
  27. package/dist/storage/implementation/OperationBatch.js +3 -2
  28. package/dist/storage/implementation/OperationBatch.js.map +1 -1
  29. package/dist/storage/implementation/PersistedBatch.d.ts +11 -4
  30. package/dist/storage/implementation/PersistedBatch.js +42 -11
  31. package/dist/storage/implementation/PersistedBatch.js.map +1 -1
  32. package/dist/storage/implementation/db.d.ts +35 -1
  33. package/dist/storage/implementation/db.js +99 -0
  34. package/dist/storage/implementation/db.js.map +1 -1
  35. package/dist/storage/implementation/models.d.ts +15 -2
  36. package/dist/storage/implementation/models.js +2 -1
  37. package/dist/storage/implementation/models.js.map +1 -1
  38. package/dist/utils/test-utils.d.ts +4 -1
  39. package/dist/utils/test-utils.js +15 -12
  40. package/dist/utils/test-utils.js.map +1 -1
  41. package/dist/utils/util.d.ts +2 -1
  42. package/dist/utils/util.js +15 -1
  43. package/dist/utils/util.js.map +1 -1
  44. package/package.json +7 -7
  45. package/src/storage/MongoBucketStorage.ts +30 -8
  46. package/src/storage/MongoReportStorage.ts +5 -5
  47. package/src/storage/implementation/MongoBucketBatch.ts +263 -177
  48. package/src/storage/implementation/MongoChecksums.ts +5 -3
  49. package/src/storage/implementation/MongoCompactor.ts +62 -31
  50. package/src/storage/implementation/MongoParameterCompactor.ts +3 -3
  51. package/src/storage/implementation/MongoPersistedSyncRulesContent.ts +4 -11
  52. package/src/storage/implementation/MongoSyncBucketStorage.ts +33 -26
  53. package/src/storage/implementation/MongoSyncRulesLock.ts +3 -3
  54. package/src/storage/implementation/MongoWriteCheckpointAPI.ts +4 -4
  55. package/src/storage/implementation/OperationBatch.ts +3 -2
  56. package/src/storage/implementation/PersistedBatch.ts +42 -11
  57. package/src/storage/implementation/db.ts +129 -1
  58. package/src/storage/implementation/models.ts +18 -3
  59. package/src/utils/test-utils.ts +15 -12
  60. package/src/utils/util.ts +17 -2
  61. package/test/src/__snapshots__/{connection-report-storage.test.ts.snap → client-connections-storage.test.ts.snap} +68 -68
  62. package/test/src/__snapshots__/storage.test.ts.snap +201 -0
  63. package/test/src/__snapshots__/storage_compacting.test.ts.snap +17 -0
  64. package/test/src/__snapshots__/storage_sync.test.ts.snap +1111 -16
  65. package/test/src/{connection-report-storage.test.ts → client-connections-storage.test.ts} +1 -1
  66. package/test/src/storage.test.ts +9 -7
  67. package/test/src/storage_compacting.test.ts +54 -45
  68. package/test/src/storage_sync.test.ts +53 -51
  69. package/test/src/util.ts +3 -3
  70. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,201 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Mongo Sync Bucket Storage - Data > (insert, delete, insert), (delete) 1`] = `
4
+ [
5
+ {
6
+ "checksum": 2871785649,
7
+ "object_id": "test1",
8
+ "op": "PUT",
9
+ },
10
+ {
11
+ "checksum": 2872534815,
12
+ "object_id": "test1",
13
+ "op": "REMOVE",
14
+ },
15
+ {
16
+ "checksum": 2871785649,
17
+ "object_id": "test1",
18
+ "op": "PUT",
19
+ },
20
+ {
21
+ "checksum": 2872534815,
22
+ "object_id": "test1",
23
+ "op": "REMOVE",
24
+ },
25
+ ]
26
+ `;
27
+
28
+ exports[`Mongo Sync Bucket Storage - Data > (insert, delete, insert), (delete) 2`] = `
29
+ [
30
+ {
31
+ "checksum": 2871785649,
32
+ "object_id": "test1",
33
+ "op": "PUT",
34
+ },
35
+ {
36
+ "checksum": 2872534815,
37
+ "object_id": "test1",
38
+ "op": "REMOVE",
39
+ },
40
+ {
41
+ "checksum": 2871785649,
42
+ "object_id": "test1",
43
+ "op": "PUT",
44
+ },
45
+ {
46
+ "checksum": 2872534815,
47
+ "object_id": "test1",
48
+ "op": "REMOVE",
49
+ },
50
+ ]
51
+ `;
52
+
53
+ exports[`Mongo Sync Bucket Storage - Data > (insert, delete, insert), (delete) 3`] = `
54
+ [
55
+ {
56
+ "checksum": 2871785649,
57
+ "object_id": "test1",
58
+ "op": "PUT",
59
+ },
60
+ {
61
+ "checksum": 2872534815,
62
+ "object_id": "test1",
63
+ "op": "REMOVE",
64
+ },
65
+ {
66
+ "checksum": 2871785649,
67
+ "object_id": "test1",
68
+ "op": "PUT",
69
+ },
70
+ {
71
+ "checksum": 2872534815,
72
+ "object_id": "test1",
73
+ "op": "REMOVE",
74
+ },
75
+ ]
76
+ `;
77
+
78
+ exports[`Mongo Sync Bucket Storage - Data - v1 > (insert, delete, insert), (delete) 1`] = `
79
+ [
80
+ {
81
+ "checksum": 2871785649,
82
+ "object_id": "test1",
83
+ "op": "PUT",
84
+ },
85
+ {
86
+ "checksum": 2872534815,
87
+ "object_id": "test1",
88
+ "op": "REMOVE",
89
+ },
90
+ {
91
+ "checksum": 2871785649,
92
+ "object_id": "test1",
93
+ "op": "PUT",
94
+ },
95
+ {
96
+ "checksum": 2872534815,
97
+ "object_id": "test1",
98
+ "op": "REMOVE",
99
+ },
100
+ ]
101
+ `;
102
+
103
+ exports[`Mongo Sync Bucket Storage - Data - v2 > (insert, delete, insert), (delete) 1`] = `
104
+ [
105
+ {
106
+ "checksum": 2871785649,
107
+ "object_id": "test1",
108
+ "op": "PUT",
109
+ },
110
+ {
111
+ "checksum": 2872534815,
112
+ "object_id": "test1",
113
+ "op": "REMOVE",
114
+ },
115
+ {
116
+ "checksum": 2871785649,
117
+ "object_id": "test1",
118
+ "op": "PUT",
119
+ },
120
+ {
121
+ "checksum": 2872534815,
122
+ "object_id": "test1",
123
+ "op": "REMOVE",
124
+ },
125
+ ]
126
+ `;
127
+
128
+ exports[`Mongo Sync Bucket Storage - Data - v3 > (insert, delete, insert), (delete) 1`] = `
129
+ [
130
+ {
131
+ "checksum": 2871785649,
132
+ "object_id": "test1",
133
+ "op": "PUT",
134
+ },
135
+ {
136
+ "checksum": 2872534815,
137
+ "object_id": "test1",
138
+ "op": "REMOVE",
139
+ },
140
+ {
141
+ "checksum": 2871785649,
142
+ "object_id": "test1",
143
+ "op": "PUT",
144
+ },
145
+ {
146
+ "checksum": 2872534815,
147
+ "object_id": "test1",
148
+ "op": "REMOVE",
149
+ },
150
+ ]
151
+ `;
152
+
153
+ exports[`Mongo Sync Bucket Storage - split buckets > (insert, delete, insert), (delete) 1`] = `
154
+ [
155
+ {
156
+ "checksum": 2871785649,
157
+ "object_id": "test1",
158
+ "op": "PUT",
159
+ },
160
+ {
161
+ "checksum": 2872534815,
162
+ "object_id": "test1",
163
+ "op": "REMOVE",
164
+ },
165
+ {
166
+ "checksum": 2871785649,
167
+ "object_id": "test1",
168
+ "op": "PUT",
169
+ },
170
+ {
171
+ "checksum": 2872534815,
172
+ "object_id": "test1",
173
+ "op": "REMOVE",
174
+ },
175
+ ]
176
+ `;
177
+
178
+ exports[`Mongo Sync Bucket Storage - split operations > (insert, delete, insert), (delete) 1`] = `
179
+ [
180
+ {
181
+ "checksum": 2871785649,
182
+ "object_id": "test1",
183
+ "op": "PUT",
184
+ },
185
+ {
186
+ "checksum": 2872534815,
187
+ "object_id": "test1",
188
+ "op": "REMOVE",
189
+ },
190
+ {
191
+ "checksum": 2871785649,
192
+ "object_id": "test1",
193
+ "op": "PUT",
194
+ },
195
+ {
196
+ "checksum": 2872534815,
197
+ "object_id": "test1",
198
+ "op": "REMOVE",
199
+ },
200
+ ]
201
+ `;
@@ -0,0 +1,17 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Mongo Sync Bucket Storage Compact > partial checksums after compacting (2) 1`] = `
4
+ {
5
+ "bucket": "1#global[]",
6
+ "checksum": -1481659821,
7
+ "count": 1,
8
+ }
9
+ `;
10
+
11
+ exports[`Mongo Sync Bucket Storage Compact > partial checksums after compacting 1`] = `
12
+ {
13
+ "bucket": "1#global[]",
14
+ "checksum": 1874612650,
15
+ "count": 4,
16
+ }
17
+ `;