@powersync/service-module-mongodb-storage 0.0.0-dev-20250827091123 → 0.0.0-dev-20250828134335

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 (69) hide show
  1. package/CHANGELOG.md +28 -13
  2. package/dist/index.d.ts +0 -1
  3. package/dist/index.js +0 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/storage/MongoBucketStorage.js +1 -1
  6. package/dist/storage/MongoBucketStorage.js.map +1 -1
  7. package/dist/storage/implementation/MongoBucketBatch.d.ts +1 -1
  8. package/dist/storage/implementation/MongoBucketBatch.js +7 -4
  9. package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
  10. package/dist/storage/implementation/MongoCompactor.d.ts +16 -2
  11. package/dist/storage/implementation/MongoCompactor.js +204 -48
  12. package/dist/storage/implementation/MongoCompactor.js.map +1 -1
  13. package/dist/storage/implementation/MongoStorageProvider.d.ts +1 -1
  14. package/dist/storage/implementation/MongoStorageProvider.js +3 -7
  15. package/dist/storage/implementation/MongoStorageProvider.js.map +1 -1
  16. package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +12 -1
  17. package/dist/storage/implementation/MongoSyncBucketStorage.js +196 -37
  18. package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
  19. package/dist/storage/implementation/MongoTestStorageFactoryGenerator.d.ts +7 -0
  20. package/dist/storage/implementation/MongoTestStorageFactoryGenerator.js +18 -0
  21. package/dist/storage/implementation/MongoTestStorageFactoryGenerator.js.map +1 -0
  22. package/dist/storage/implementation/PersistedBatch.d.ts +1 -0
  23. package/dist/storage/implementation/PersistedBatch.js +13 -6
  24. package/dist/storage/implementation/PersistedBatch.js.map +1 -1
  25. package/dist/storage/implementation/db.d.ts +1 -6
  26. package/dist/storage/implementation/db.js +0 -16
  27. package/dist/storage/implementation/db.js.map +1 -1
  28. package/dist/storage/implementation/models.d.ts +14 -3
  29. package/dist/{utils → storage/implementation}/util.d.ts +35 -3
  30. package/dist/{utils → storage/implementation}/util.js +54 -0
  31. package/dist/storage/implementation/util.js.map +1 -0
  32. package/dist/storage/storage-index.d.ts +2 -3
  33. package/dist/storage/storage-index.js +2 -3
  34. package/dist/storage/storage-index.js.map +1 -1
  35. package/package.json +8 -8
  36. package/src/index.ts +0 -1
  37. package/src/storage/MongoBucketStorage.ts +1 -1
  38. package/src/storage/implementation/MongoBucketBatch.ts +8 -6
  39. package/src/storage/implementation/MongoCompactor.ts +239 -49
  40. package/src/storage/implementation/MongoStorageProvider.ts +4 -9
  41. package/src/storage/implementation/MongoSyncBucketStorage.ts +242 -38
  42. package/src/storage/implementation/MongoTestStorageFactoryGenerator.ts +28 -0
  43. package/src/storage/implementation/PersistedBatch.ts +14 -6
  44. package/src/storage/implementation/db.ts +0 -18
  45. package/src/storage/implementation/models.ts +15 -3
  46. package/src/{utils → storage/implementation}/util.ts +61 -3
  47. package/src/storage/storage-index.ts +2 -3
  48. package/test/src/__snapshots__/storage_sync.test.ts.snap +110 -0
  49. package/test/src/util.ts +2 -6
  50. package/tsconfig.tsbuildinfo +1 -1
  51. package/dist/migrations/db/migrations/1752661449910-connection-reporting.d.ts +0 -3
  52. package/dist/migrations/db/migrations/1752661449910-connection-reporting.js +0 -36
  53. package/dist/migrations/db/migrations/1752661449910-connection-reporting.js.map +0 -1
  54. package/dist/storage/MongoReportStorage.d.ts +0 -18
  55. package/dist/storage/MongoReportStorage.js +0 -154
  56. package/dist/storage/MongoReportStorage.js.map +0 -1
  57. package/dist/utils/test-utils.d.ts +0 -11
  58. package/dist/utils/test-utils.js +0 -40
  59. package/dist/utils/test-utils.js.map +0 -1
  60. package/dist/utils/util.js.map +0 -1
  61. package/dist/utils/utils-index.d.ts +0 -2
  62. package/dist/utils/utils-index.js +0 -3
  63. package/dist/utils/utils-index.js.map +0 -1
  64. package/src/migrations/db/migrations/1752661449910-connection-reporting.ts +0 -58
  65. package/src/storage/MongoReportStorage.ts +0 -177
  66. package/src/utils/test-utils.ts +0 -55
  67. package/src/utils/utils-index.ts +0 -2
  68. package/test/src/__snapshots__/connection-report-storage.test.ts.snap +0 -215
  69. package/test/src/connection-report-storage.test.ts +0 -133
@@ -104,6 +104,116 @@ exports[`sync - mongodb > compacting data - invalidate checkpoint 2`] = `
104
104
  ]
105
105
  `;
106
106
 
107
+ exports[`sync - mongodb > 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": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
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 - mongodb > 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": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
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
+
107
217
  exports[`sync - mongodb > expired token 1`] = `
108
218
  [
109
219
  {
package/test/src/util.ts CHANGED
@@ -1,12 +1,8 @@
1
1
  import { env } from './env.js';
2
- import { mongoTestReportStorageFactoryGenerator, mongoTestStorageFactoryGenerator } from '@module/utils/test-utils.js';
3
2
 
4
- export const INITIALIZED_MONGO_STORAGE_FACTORY = mongoTestStorageFactoryGenerator({
5
- url: env.MONGO_TEST_URL,
6
- isCI: env.CI
7
- });
3
+ import { MongoTestStorageFactoryGenerator } from '@module/storage/implementation/MongoTestStorageFactoryGenerator.js';
8
4
 
9
- export const INITIALIZED_MONGO_REPORT_STORAGE_FACTORY = mongoTestReportStorageFactoryGenerator({
5
+ export const INITIALIZED_MONGO_STORAGE_FACTORY = MongoTestStorageFactoryGenerator({
10
6
  url: env.MONGO_TEST_URL,
11
7
  isCI: env.CI
12
8
  });