@powersync/service-module-mongodb-storage 0.0.0-dev-20260602073133 → 0.0.0-dev-20260803144812

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 (239) hide show
  1. package/CHANGELOG.md +101 -5
  2. package/dist/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.d.ts +3 -0
  3. package/dist/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.js +41 -0
  4. package/dist/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.js.map +1 -0
  5. package/dist/storage/MongoBucketStorage.d.ts +41 -16
  6. package/dist/storage/MongoBucketStorage.js +226 -71
  7. package/dist/storage/MongoBucketStorage.js.map +1 -1
  8. package/dist/storage/implementation/MongoBucketBatch.d.ts +56 -25
  9. package/dist/storage/implementation/MongoBucketBatch.js +110 -62
  10. package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
  11. package/dist/storage/implementation/MongoChecksums.d.ts +41 -13
  12. package/dist/storage/implementation/MongoChecksums.js +36 -121
  13. package/dist/storage/implementation/MongoChecksums.js.map +1 -1
  14. package/dist/storage/implementation/MongoCompactor.d.ts +17 -19
  15. package/dist/storage/implementation/MongoCompactor.js +80 -263
  16. package/dist/storage/implementation/MongoCompactor.js.map +1 -1
  17. package/dist/storage/implementation/MongoHydrationState.d.ts +11 -0
  18. package/dist/storage/implementation/MongoHydrationState.js +49 -0
  19. package/dist/storage/implementation/MongoHydrationState.js.map +1 -0
  20. package/dist/storage/implementation/MongoParameterCompactor.d.ts +7 -6
  21. package/dist/storage/implementation/MongoParameterCompactor.js +25 -2
  22. package/dist/storage/implementation/MongoParameterCompactor.js.map +1 -1
  23. package/dist/storage/implementation/MongoParsedSyncConfigSet.d.ts +13 -0
  24. package/dist/storage/implementation/MongoParsedSyncConfigSet.js +64 -0
  25. package/dist/storage/implementation/MongoParsedSyncConfigSet.js.map +1 -0
  26. package/dist/storage/implementation/MongoPersistedReplicationStream.d.ts +36 -0
  27. package/dist/storage/implementation/MongoPersistedReplicationStream.js +90 -0
  28. package/dist/storage/implementation/MongoPersistedReplicationStream.js.map +1 -0
  29. package/dist/storage/implementation/MongoPersistedSyncConfigContent.d.ts +25 -0
  30. package/dist/storage/implementation/MongoPersistedSyncConfigContent.js +123 -0
  31. package/dist/storage/implementation/MongoPersistedSyncConfigContent.js.map +1 -0
  32. package/dist/storage/implementation/MongoStorageProvider.js +39 -4
  33. package/dist/storage/implementation/MongoStorageProvider.js.map +1 -1
  34. package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +57 -29
  35. package/dist/storage/implementation/MongoSyncBucketStorage.js +87 -61
  36. package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
  37. package/dist/storage/implementation/MongoSyncRulesLock.d.ts +1 -1
  38. package/dist/storage/implementation/MongoSyncRulesLock.js +3 -3
  39. package/dist/storage/implementation/MongoSyncRulesLock.js.map +1 -1
  40. package/dist/storage/implementation/MongoWriteCheckpointAPI.d.ts +2 -1
  41. package/dist/storage/implementation/MongoWriteCheckpointAPI.js +171 -24
  42. package/dist/storage/implementation/MongoWriteCheckpointAPI.js.map +1 -1
  43. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.d.ts +8 -0
  44. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.js +2 -0
  45. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.js.map +1 -0
  46. package/dist/storage/implementation/common/PersistedBatch.d.ts +7 -2
  47. package/dist/storage/implementation/common/PersistedBatch.js +12 -0
  48. package/dist/storage/implementation/common/PersistedBatch.js.map +1 -1
  49. package/dist/storage/implementation/common/VersionedPowerSyncMongoBase.js +1 -1
  50. package/dist/storage/implementation/common/VersionedPowerSyncMongoBase.js.map +1 -1
  51. package/dist/storage/implementation/createMongoSyncBucketStorage.d.ts +2 -2
  52. package/dist/storage/implementation/createMongoSyncBucketStorage.js +4 -4
  53. package/dist/storage/implementation/createMongoSyncBucketStorage.js.map +1 -1
  54. package/dist/storage/implementation/db.js +17 -15
  55. package/dist/storage/implementation/db.js.map +1 -1
  56. package/dist/storage/implementation/models.d.ts +20 -13
  57. package/dist/storage/implementation/models.js.map +1 -1
  58. package/dist/storage/implementation/v1/MongoBucketBatchV1.d.ts +9 -1
  59. package/dist/storage/implementation/v1/MongoBucketBatchV1.js +61 -29
  60. package/dist/storage/implementation/v1/MongoBucketBatchV1.js.map +1 -1
  61. package/dist/storage/implementation/v1/MongoChecksumsV1.d.ts +4 -4
  62. package/dist/storage/implementation/v1/MongoChecksumsV1.js +119 -7
  63. package/dist/storage/implementation/v1/MongoChecksumsV1.js.map +1 -1
  64. package/dist/storage/implementation/v1/MongoCompactorV1.d.ts +11 -2
  65. package/dist/storage/implementation/v1/MongoCompactorV1.js +251 -2
  66. package/dist/storage/implementation/v1/MongoCompactorV1.js.map +1 -1
  67. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.d.ts +18 -19
  68. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.js +82 -58
  69. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.js.map +1 -1
  70. package/dist/storage/implementation/v1/SingleBucketStoreV1.d.ts +9 -10
  71. package/dist/storage/implementation/v1/SingleBucketStoreV1.js +2 -8
  72. package/dist/storage/implementation/v1/SingleBucketStoreV1.js.map +1 -1
  73. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.d.ts +2 -1
  74. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.js +3 -0
  75. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.js.map +1 -1
  76. package/dist/storage/implementation/v1/models.d.ts +10 -1
  77. package/dist/storage/implementation/v3/BucketDataContextV3.d.ts +13 -0
  78. package/dist/storage/implementation/v3/BucketDataContextV3.js +23 -0
  79. package/dist/storage/implementation/v3/BucketDataContextV3.js.map +1 -0
  80. package/dist/storage/implementation/v3/MongoBucketBatchV3.d.ts +8 -4
  81. package/dist/storage/implementation/v3/MongoBucketBatchV3.js +309 -259
  82. package/dist/storage/implementation/v3/MongoBucketBatchV3.js.map +1 -1
  83. package/dist/storage/implementation/v3/MongoChecksumsV3.d.ts +30 -9
  84. package/dist/storage/implementation/v3/MongoChecksumsV3.js +161 -20
  85. package/dist/storage/implementation/v3/MongoChecksumsV3.js.map +1 -1
  86. package/dist/storage/implementation/v3/MongoCompactorV3.d.ts +40 -2
  87. package/dist/storage/implementation/v3/MongoCompactorV3.js +647 -23
  88. package/dist/storage/implementation/v3/MongoCompactorV3.js.map +1 -1
  89. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.d.ts +67 -0
  90. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.js +351 -0
  91. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.js.map +1 -0
  92. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.d.ts +45 -30
  93. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.js +272 -140
  94. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.js.map +1 -1
  95. package/dist/storage/implementation/v3/PersistedBatchV3.d.ts +6 -3
  96. package/dist/storage/implementation/v3/PersistedBatchV3.js +84 -21
  97. package/dist/storage/implementation/v3/PersistedBatchV3.js.map +1 -1
  98. package/dist/storage/implementation/v3/SourceRecordStoreV3.d.ts +3 -3
  99. package/dist/storage/implementation/v3/SourceRecordStoreV3.js +13 -11
  100. package/dist/storage/implementation/v3/SourceRecordStoreV3.js.map +1 -1
  101. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.d.ts +15 -13
  102. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.js +32 -27
  103. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.js.map +1 -1
  104. package/dist/storage/implementation/v3/bucket-format.d.ts +13 -0
  105. package/dist/storage/implementation/v3/bucket-format.js +77 -0
  106. package/dist/storage/implementation/v3/bucket-format.js.map +1 -0
  107. package/dist/storage/implementation/v3/chunking.d.ts +10 -0
  108. package/dist/storage/implementation/v3/chunking.js +30 -0
  109. package/dist/storage/implementation/v3/chunking.js.map +1 -0
  110. package/dist/storage/implementation/v3/models.d.ts +101 -21
  111. package/dist/storage/implementation/v3/models.js +11 -28
  112. package/dist/storage/implementation/v3/models.js.map +1 -1
  113. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.d.ts +21 -0
  114. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.js +44 -0
  115. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.js.map +1 -0
  116. package/dist/storage/implementation/v3/object-storage/ObjectStorage.d.ts +30 -0
  117. package/dist/storage/implementation/v3/object-storage/ObjectStorage.js +12 -0
  118. package/dist/storage/implementation/v3/object-storage/ObjectStorage.js.map +1 -0
  119. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.d.ts +70 -0
  120. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.js +146 -0
  121. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.js.map +1 -0
  122. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.d.ts +42 -0
  123. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.js +285 -0
  124. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.js.map +1 -0
  125. package/dist/storage/implementation/v3/source-table-utils.d.ts +55 -0
  126. package/dist/storage/implementation/v3/source-table-utils.js +214 -0
  127. package/dist/storage/implementation/v3/source-table-utils.js.map +1 -0
  128. package/dist/storage/storage-index.d.ts +4 -4
  129. package/dist/storage/storage-index.js +4 -4
  130. package/dist/storage/storage-index.js.map +1 -1
  131. package/dist/types/types.d.ts +49 -3
  132. package/dist/types/types.js +48 -1
  133. package/dist/types/types.js.map +1 -1
  134. package/dist/utils/test-utils.d.ts +1 -2
  135. package/dist/utils/test-utils.js +7 -1
  136. package/dist/utils/test-utils.js.map +1 -1
  137. package/dist/utils/util.d.ts +9 -2
  138. package/dist/utils/util.js +128 -4
  139. package/dist/utils/util.js.map +1 -1
  140. package/package.json +12 -19
  141. package/src/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.ts +55 -0
  142. package/src/storage/MongoBucketStorage.ts +347 -88
  143. package/src/storage/implementation/MongoBucketBatch.ts +147 -82
  144. package/src/storage/implementation/MongoChecksums.ts +93 -153
  145. package/src/storage/implementation/MongoCompactor.ts +102 -316
  146. package/src/storage/implementation/MongoHydrationState.ts +61 -0
  147. package/src/storage/implementation/MongoParameterCompactor.ts +25 -6
  148. package/src/storage/implementation/MongoParsedSyncConfigSet.ts +88 -0
  149. package/src/storage/implementation/MongoPersistedReplicationStream.ts +118 -0
  150. package/src/storage/implementation/MongoPersistedSyncConfigContent.ts +154 -0
  151. package/src/storage/implementation/MongoStorageProvider.ts +46 -4
  152. package/src/storage/implementation/MongoSyncBucketStorage.ts +121 -87
  153. package/src/storage/implementation/MongoSyncRulesLock.ts +7 -4
  154. package/src/storage/implementation/MongoWriteCheckpointAPI.ts +202 -28
  155. package/src/storage/implementation/common/MongoSyncBucketStorageCheckpoint.ts +9 -0
  156. package/src/storage/implementation/common/PersistedBatch.ts +19 -3
  157. package/src/storage/implementation/common/VersionedPowerSyncMongoBase.ts +1 -1
  158. package/src/storage/implementation/createMongoSyncBucketStorage.ts +21 -7
  159. package/src/storage/implementation/db.ts +19 -20
  160. package/src/storage/implementation/models.ts +20 -14
  161. package/src/storage/implementation/v1/MongoBucketBatchV1.ts +75 -37
  162. package/src/storage/implementation/v1/MongoChecksumsV1.ts +154 -12
  163. package/src/storage/implementation/v1/MongoCompactorV1.ts +294 -9
  164. package/src/storage/implementation/v1/MongoSyncBucketStorageV1.ts +142 -105
  165. package/src/storage/implementation/v1/SingleBucketStoreV1.ts +18 -27
  166. package/src/storage/implementation/v1/VersionedPowerSyncMongoV1.ts +11 -1
  167. package/src/storage/implementation/v1/models.ts +11 -1
  168. package/src/storage/implementation/v3/BucketDataContextV3.ts +32 -0
  169. package/src/storage/implementation/v3/MongoBucketBatchV3.ts +382 -321
  170. package/src/storage/implementation/v3/MongoChecksumsV3.ts +250 -32
  171. package/src/storage/implementation/v3/MongoCompactorV3.ts +847 -32
  172. package/src/storage/implementation/v3/MongoStoppedSyncConfigCleanup.ts +482 -0
  173. package/src/storage/implementation/v3/MongoSyncBucketStorageV3.ts +359 -187
  174. package/src/storage/implementation/v3/PersistedBatchV3.ts +118 -37
  175. package/src/storage/implementation/v3/SourceRecordStoreV3.ts +12 -12
  176. package/src/storage/implementation/v3/VersionedPowerSyncMongoV3.ts +46 -36
  177. package/src/storage/implementation/v3/bucket-format.ts +97 -0
  178. package/src/storage/implementation/v3/chunking.ts +40 -0
  179. package/src/storage/implementation/v3/models.ts +132 -55
  180. package/src/storage/implementation/v3/object-storage/BucketDataObjectStorage.ts +54 -0
  181. package/src/storage/implementation/v3/object-storage/ObjectStorage.ts +29 -0
  182. package/src/storage/implementation/v3/object-storage/ObjectStorageLifecycle.ts +171 -0
  183. package/src/storage/implementation/v3/object-storage/S3ObjectStorage.ts +343 -0
  184. package/src/storage/implementation/v3/source-table-utils.ts +392 -0
  185. package/src/storage/storage-index.ts +12 -4
  186. package/src/types/types.ts +58 -1
  187. package/src/utils/test-utils.ts +8 -3
  188. package/src/utils/util.ts +185 -6
  189. package/test/src/__snapshots__/storage.test.ts.snap +0 -75
  190. package/test/src/__snapshots__/storage_sync.test.ts.snap +35 -617
  191. package/test/src/cleanup-stopped-sync-configs.test.ts +671 -0
  192. package/test/src/helpers/MemoryObjectStorage.ts +53 -0
  193. package/test/src/helpers/s3TestFactory.ts +69 -0
  194. package/test/src/object_storage_lifecycle.test.ts +59 -0
  195. package/test/src/setup.ts +6 -1
  196. package/test/src/storage.test.ts +227 -13
  197. package/test/src/storage_compacting.test.ts +1951 -12
  198. package/test/src/storage_object_storage_inline_threshold.test.ts +116 -0
  199. package/test/src/storage_s3_checksums.test.ts +191 -0
  200. package/test/src/storage_s3_compaction_lifecycle.test.ts +417 -0
  201. package/test/src/storage_s3_reading.test.ts +526 -0
  202. package/test/src/storage_s3_writing.test.ts +135 -0
  203. package/test/src/storage_sync.test.ts +1180 -73
  204. package/test/src/storeCurrentData.test.ts +227 -0
  205. package/test/src/util.ts +2 -1
  206. package/tsconfig.json +1 -4
  207. package/tsconfig.tsbuildinfo +1 -1
  208. package/dist/storage/implementation/BucketDefinitionMapping.d.ts +0 -15
  209. package/dist/storage/implementation/BucketDefinitionMapping.js +0 -58
  210. package/dist/storage/implementation/BucketDefinitionMapping.js.map +0 -1
  211. package/dist/storage/implementation/MongoPersistedSyncRules.d.ts +0 -14
  212. package/dist/storage/implementation/MongoPersistedSyncRules.js +0 -67
  213. package/dist/storage/implementation/MongoPersistedSyncRules.js.map +0 -1
  214. package/dist/storage/implementation/MongoPersistedSyncRulesContent.d.ts +0 -29
  215. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js +0 -76
  216. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js.map +0 -1
  217. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.d.ts +0 -13
  218. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.js +0 -2
  219. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.js.map +0 -1
  220. package/dist/storage/implementation/common/SingleBucketStore.d.ts +0 -54
  221. package/dist/storage/implementation/common/SingleBucketStore.js +0 -3
  222. package/dist/storage/implementation/common/SingleBucketStore.js.map +0 -1
  223. package/dist/storage/implementation/v3/MongoParameterCompactorV3.d.ts +0 -9
  224. package/dist/storage/implementation/v3/MongoParameterCompactorV3.js +0 -18
  225. package/dist/storage/implementation/v3/MongoParameterCompactorV3.js.map +0 -1
  226. package/dist/storage/implementation/v3/MongoParameterLookupV3.d.ts +0 -4
  227. package/dist/storage/implementation/v3/MongoParameterLookupV3.js +0 -9
  228. package/dist/storage/implementation/v3/MongoParameterLookupV3.js.map +0 -1
  229. package/dist/storage/implementation/v3/SingleBucketStoreV3.d.ts +0 -18
  230. package/dist/storage/implementation/v3/SingleBucketStoreV3.js +0 -48
  231. package/dist/storage/implementation/v3/SingleBucketStoreV3.js.map +0 -1
  232. package/src/storage/implementation/BucketDefinitionMapping.ts +0 -75
  233. package/src/storage/implementation/MongoPersistedSyncRules.ts +0 -82
  234. package/src/storage/implementation/MongoPersistedSyncRulesContent.ts +0 -101
  235. package/src/storage/implementation/common/MongoSyncBucketStorageContext.ts +0 -15
  236. package/src/storage/implementation/common/SingleBucketStore.ts +0 -63
  237. package/src/storage/implementation/v3/MongoParameterCompactorV3.ts +0 -24
  238. package/src/storage/implementation/v3/MongoParameterLookupV3.ts +0 -11
  239. package/src/storage/implementation/v3/SingleBucketStoreV3.ts +0 -68
package/CHANGELOG.md CHANGED
@@ -1,17 +1,112 @@
1
1
  # @powersync/service-module-mongodb-storage
2
2
 
3
- ## 0.0.0-dev-20260602073133
3
+ ## 0.0.0-dev-20260803144812
4
+
5
+ ### Minor Changes
6
+
7
+ - 2189250: Add `/sync/checkpoint-request` for client-supplied checkpoint request ids, previously called write checkpoint ids. The route returns the stored `checkpoint_request_id`, storage now treats managed request ids as monotonic per user/client, custom checkpoint request ids continue to use the existing `checkpoint` field for backwards compatibility, and `checkpoint_requested_at` metadata lets compact jobs remove expired request-derived checkpoint records.
8
+
9
+ This release includes storage migrations for the checkpoint request metadata. Self-hosters should run migrations as part of the upgrade.
10
+
11
+ - 922f974: Add experimental support for storing bucket data chunks on S3.
12
+
13
+ ### Patch Changes
14
+
15
+ - 37591e9: [MongoDB Storage] Use batched deletes for clearing data.
16
+ - 37d1856: Stability and performance fixes for MongoDB storage V3.
17
+ - be14bfe: [MongoDB Storage V3] Tweak size estimates and chunking to use actual BSON sizes.
18
+ - aab068b: [MongoDB Storage V3] Add has_clear_op field and simplify checksum queries.
19
+ - Updated dependencies [2189250]
20
+ - Updated dependencies [922f974]
21
+ - Updated dependencies [c4860c9]
22
+ - Updated dependencies [37591e9]
23
+ - Updated dependencies [483415d]
24
+ - Updated dependencies [8daa300]
25
+ - Updated dependencies [aab068b]
26
+ - Updated dependencies [37591e9]
27
+ - Updated dependencies [be42e25]
28
+ - Updated dependencies [cb4c627]
29
+ - @powersync/lib-services-framework@0.0.0-dev-20260803144812
30
+ - @powersync/service-core@0.0.0-dev-20260803144812
31
+ - @powersync/service-types@0.0.0-dev-20260803144812
32
+ - @powersync/lib-service-mongodb@0.0.0-dev-20260803144812
33
+ - @powersync/service-sync-rules@0.0.0-dev-20260803144812
34
+
35
+ ## 0.18.3
36
+
37
+ ### Patch Changes
38
+
39
+ - ea31f64: Potential fix and improved stack trace for 'evicted' errors.
40
+ - 1f854d3: Fix for occasional readConcern errors when using bulk_read_preference.
41
+ - Updated dependencies [ea71bf3]
42
+ - Updated dependencies [ea31f64]
43
+ - Updated dependencies [edc6ed4]
44
+ - @powersync/service-sync-rules@0.39.0
45
+ - @powersync/service-core@1.23.3
46
+ - @powersync/lib-services-framework@0.9.8
47
+ - @powersync/lib-service-mongodb@0.6.29
48
+
49
+ ## 0.18.2
50
+
51
+ ### Patch Changes
52
+
53
+ - e4f683d: [MongoDB Storage] Add experimental option to allow reading data from secondaries.
54
+ - c2edf86: Add `api.parameters.bucket_count_cache_ttl_minutes` configuration option.
55
+ - df9ab1e: Batch concurrent write checkpoint requests and increase request limits to improve throughput.
56
+ - b9f6b6f: [MongoDB Storage] Optimize writes under high replication lag.
57
+ - Updated dependencies [71d4a0a]
58
+ - Updated dependencies [e4f683d]
59
+ - Updated dependencies [71d4a0a]
60
+ - Updated dependencies [a6ae678]
61
+ - Updated dependencies [c2edf86]
62
+ - Updated dependencies [df9ab1e]
63
+ - @powersync/service-core@1.23.2
64
+ - @powersync/lib-service-mongodb@0.6.28
65
+ - @powersync/service-sync-rules@0.38.1
66
+ - @powersync/service-types@0.16.1
67
+ - @powersync/lib-services-framework@0.9.7
68
+
69
+ ## 0.18.1
70
+
71
+ ### Patch Changes
72
+
73
+ - 7e65360: Restructure replication locks for updated sync config.
74
+ - Updated dependencies [7e65360]
75
+ - @powersync/service-core@1.23.1
76
+
77
+ ## 0.18.0
78
+
79
+ ### Minor Changes
80
+
81
+ - a91a08f: [Experimental] Enable incremental reprocessing for MongoDB source + MongoDB storage. This includes significant changes to the v3 storage format.
82
+
83
+ ### Patch Changes
84
+
85
+ - 101ea67: Include table names in "Cannot mark snapshot done while source tables still require snapshotting" error.
86
+ - Updated dependencies [a91a08f]
87
+ - Updated dependencies [184c39f]
88
+ - Updated dependencies [c3f75df]
89
+ - Updated dependencies [4bd35ea]
90
+ - @powersync/service-core@1.23.0
91
+ - @powersync/service-types@0.16.0
92
+ - @powersync/service-sync-rules@0.38.0
93
+ - @powersync/lib-services-framework@0.9.6
94
+ - @powersync/lib-service-mongodb@0.6.27
95
+
96
+ ## 0.17.0
4
97
 
5
98
  ### Minor Changes
6
99
 
7
100
  - e2bf1ad: [Internal] rework resolveTables to handle multiple SourceTables.
8
101
  - cd5a222: [MongoDB V3 Storage] Split storage for "sync config definition" versus "replication stream status".
9
102
  - 15e2466: [MongoDB] Support snapshotting concurrently with streaming in storage v3+.
103
+ - ebeaa3b: [Postgres] Skip storing a redundant copy of replicated rows in `current_data` for tables with `REPLICA IDENTITY FULL`.
10
104
 
11
105
  ### Patch Changes
12
106
 
13
107
  - 6e2a57e: Refactor HydratedSyncConfig to support multiple SyncConfigs.
14
108
  - 92cc83b: Add the experimental `unstable_sqlite_expression_engine` sync config option to evaluate Sync Streams with SQLite.
109
+ - Updated dependencies [17fd96b]
15
110
  - Updated dependencies [6e2a57e]
16
111
  - Updated dependencies [ec6df9f]
17
112
  - Updated dependencies [99d33d5]
@@ -24,12 +119,13 @@
24
119
  - Updated dependencies [92cc83b]
25
120
  - Updated dependencies [0aab0f9]
26
121
  - Updated dependencies [15e2466]
122
+ - Updated dependencies [ebeaa3b]
27
123
  - Updated dependencies [b116857]
28
124
  - Updated dependencies [a94b6c3]
29
- - @powersync/service-sync-rules@0.0.0-dev-20260602073133
30
- - @powersync/service-core@0.0.0-dev-20260602073133
31
- - @powersync/lib-services-framework@0.0.0-dev-20260602073133
32
- - @powersync/lib-service-mongodb@0.0.0-dev-20260602073133
125
+ - @powersync/service-core@1.22.0
126
+ - @powersync/service-sync-rules@0.37.0
127
+ - @powersync/lib-services-framework@0.9.5
128
+ - @powersync/lib-service-mongodb@0.6.26
33
129
 
34
130
  ## 0.16.0
35
131
 
@@ -0,0 +1,3 @@
1
+ import { migrations } from '@powersync/service-core';
2
+ export declare const up: migrations.PowerSyncMigrationFunction;
3
+ export declare const down: migrations.PowerSyncMigrationFunction;
@@ -0,0 +1,41 @@
1
+ import * as storage from '../../../storage/storage-index.js';
2
+ export const up = async (context) => {
3
+ const { service_context: { configuration } } = context;
4
+ const db = storage.createPowerSyncMongo(configuration.storage);
5
+ try {
6
+ await db.write_checkpoints.createIndex({
7
+ checkpoint_requested_at: 1
8
+ }, {
9
+ name: 'checkpoint_requested_at',
10
+ // Only client-requested checkpoints have this field; generated
11
+ // checkpoints leave it unset. This keeps the index limited to the
12
+ // documents the compact job's retention delete scans.
13
+ partialFilterExpression: { checkpoint_requested_at: { $exists: true } }
14
+ });
15
+ await db.custom_write_checkpoints.createIndex({
16
+ checkpoint_requested_at: 1
17
+ }, {
18
+ name: 'checkpoint_requested_at',
19
+ partialFilterExpression: { checkpoint_requested_at: { $exists: true } }
20
+ });
21
+ }
22
+ finally {
23
+ await db.client.close();
24
+ }
25
+ };
26
+ export const down = async (context) => {
27
+ const { service_context: { configuration } } = context;
28
+ const db = storage.createPowerSyncMongo(configuration.storage);
29
+ try {
30
+ if (await db.write_checkpoints.indexExists('checkpoint_requested_at')) {
31
+ await db.write_checkpoints.dropIndex('checkpoint_requested_at');
32
+ }
33
+ if (await db.custom_write_checkpoints.indexExists('checkpoint_requested_at')) {
34
+ await db.custom_write_checkpoints.dropIndex('checkpoint_requested_at');
35
+ }
36
+ }
37
+ finally {
38
+ await db.client.close();
39
+ }
40
+ };
41
+ //# sourceMappingURL=1782950400000-checkpoint-requested-at-index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"1782950400000-checkpoint-requested-at-index.js","sourceRoot":"","sources":["../../../../src/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAG7D,MAAM,CAAC,MAAM,EAAE,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IACzE,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IACZ,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,OAA6B,CAAC,CAAC;IAErF,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,iBAAiB,CAAC,WAAW,CACpC;YACE,uBAAuB,EAAE,CAAC;SAC3B,EACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,+DAA+D;YAC/D,kEAAkE;YAClE,sDAAsD;YACtD,uBAAuB,EAAE,EAAE,uBAAuB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;SACxE,CACF,CAAC;QACF,MAAM,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAC3C;YACE,uBAAuB,EAAE,CAAC;SAC3B,EACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,uBAAuB,EAAE,EAAE,uBAAuB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;SACxE,CACF,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAA0C,KAAK,EAAE,OAAO,EAAE,EAAE;IAC3E,MAAM,EACJ,eAAe,EAAE,EAAE,aAAa,EAAE,EACnC,GAAG,OAAO,CAAC;IAEZ,MAAM,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,OAA6B,CAAC,CAAC;IAErF,IAAI,CAAC;QACH,IAAI,MAAM,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,yBAAyB,CAAC,EAAE,CAAC;YACtE,MAAM,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,MAAM,EAAE,CAAC,wBAAwB,CAAC,WAAW,CAAC,yBAAyB,CAAC,EAAE,CAAC;YAC7E,MAAM,EAAE,CAAC,wBAAwB,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC"}
@@ -1,35 +1,60 @@
1
1
  import { GetIntanceOptions, storage } from '@powersync/service-core';
2
2
  import { DO_NOT_LOG } from '@powersync/lib-services-framework';
3
+ import { mongo } from '@powersync/lib-service-mongodb';
3
4
  import type { MongoSyncBucketStorage } from './implementation/createMongoSyncBucketStorage.js';
4
5
  import { PowerSyncMongo } from './implementation/db.js';
5
6
  import { MongoChecksumOptions } from './implementation/MongoChecksums.js';
6
- import { MongoPersistedSyncRulesContentV1, MongoPersistedSyncRulesContentV3 } from './implementation/MongoPersistedSyncRulesContent.js';
7
+ import { MongoPersistedReplicationStream } from './implementation/MongoPersistedReplicationStream.js';
8
+ import { ObjectStorage } from './implementation/v3/object-storage/ObjectStorage.js';
7
9
  export interface MongoBucketStorageOptions {
8
- checksumOptions?: Omit<MongoChecksumOptions, 'storageConfig' | 'mapping'>;
10
+ checksumOptions?: Omit<MongoChecksumOptions, 'storageConfig'>;
11
+ objectStorage?: ObjectStorage;
12
+ inlineThresholdBytes?: number;
13
+ /**
14
+ * Prefix for replication stream name and Postgres logical replication slot name.
15
+ */
16
+ replicationStreamNamePrefix: string;
17
+ readPreference?: mongo.ReadPreference;
18
+ checksumCacheTtlMs?: number;
19
+ clearBatchThrottleRate?: number;
20
+ /**
21
+ * Reuse a compatible active replication stream by appending a new sync config.
22
+ *
23
+ * This currently requires source replication support. MongoDB sources can process multiple
24
+ * sync configs in one replication stream, but other source connectors still expect a single
25
+ * sync config per stream.
26
+ */
27
+ supportsMultipleSyncConfigs?: boolean;
9
28
  }
10
29
  export declare class MongoBucketStorage extends storage.BucketStorageFactory {
11
- private internalOptions?;
30
+ private options;
12
31
  [DO_NOT_LOG]: boolean;
13
32
  private readonly client;
14
33
  private readonly session;
15
- readonly slot_name_prefix: string;
34
+ readonly replicationStreamNamePrefix: string;
16
35
  private activeStorageCache;
17
36
  readonly db: PowerSyncMongo;
18
- constructor(db: PowerSyncMongo, options: {
19
- slot_name_prefix: string;
20
- }, internalOptions?: MongoBucketStorageOptions | undefined);
37
+ constructor(db: PowerSyncMongo, options: MongoBucketStorageOptions);
21
38
  [Symbol.asyncDispose](): Promise<void>;
22
- getInstance(syncRules: storage.PersistedSyncRulesContent, options?: GetIntanceOptions): MongoSyncBucketStorage;
39
+ getInstance(replicationStream: storage.PersistedReplicationStream, options?: GetIntanceOptions): MongoSyncBucketStorage;
23
40
  getSystemIdentifier(): Promise<storage.BucketStorageSystemIdentifier>;
24
- restartReplication(sync_rules_group_id: number): Promise<void>;
41
+ restartReplication(replicationStreamId: number): Promise<void>;
25
42
  private updateSyncRulesV3;
26
- updateSyncRules(options: storage.UpdateSyncRulesOptions): Promise<MongoPersistedSyncRulesContentV1 | MongoPersistedSyncRulesContentV3>;
27
- getActiveSyncRulesContent(): Promise<MongoPersistedSyncRulesContentV1 | MongoPersistedSyncRulesContentV3 | null>;
28
- private getSyncRulesContent;
29
- getNextSyncRulesContent(): Promise<MongoPersistedSyncRulesContentV1 | MongoPersistedSyncRulesContentV3 | null>;
30
- getReplicatingSyncRules(): Promise<storage.PersistedSyncRulesContent[]>;
31
- getStoppedSyncRules(): Promise<storage.PersistedSyncRulesContent[]>;
32
- getActiveStorage(): Promise<MongoSyncBucketStorage | null>;
43
+ private loadSyncConfigDefinitions;
44
+ /**
45
+ * Load _all_ definition mappings for a replication stream - used as a base to generate new ids.
46
+ */
47
+ private loadHistoricalSyncConfigRuleMappings;
48
+ private stopEmbeddedDeployingConfigs;
49
+ private logIncrementalDefinitionChanges;
50
+ private appendSyncConfigToStream;
51
+ updateSyncRules(options: storage.UpdateSyncRulesOptions): Promise<MongoPersistedReplicationStream>;
52
+ getActiveSyncConfig(): Promise<storage.ResolvedSyncConfig | null>;
53
+ private replicationStreamFromDoc;
54
+ getDeployingSyncConfig(): Promise<storage.ResolvedSyncConfig | null>;
55
+ getReplicatingReplicationStreams(): Promise<storage.PersistedReplicationStream[]>;
56
+ getStoppedReplicationStreams(): Promise<storage.PersistedReplicationStream[]>;
57
+ private resolvedSyncConfigFromDoc;
33
58
  getStorageMetrics(): Promise<storage.StorageMetrics>;
34
59
  getPowerSyncInstanceId(): Promise<string>;
35
60
  }