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

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 (275) hide show
  1. package/CHANGELOG.md +177 -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 +71 -18
  6. package/dist/storage/MongoBucketStorage.js +516 -202
  7. package/dist/storage/MongoBucketStorage.js.map +1 -1
  8. package/dist/storage/implementation/MongoBucketBatch.d.ts +71 -29
  9. package/dist/storage/implementation/MongoBucketBatch.js +140 -66
  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 +28 -90
  15. package/dist/storage/implementation/MongoCompactor.js +87 -481
  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 +82 -8
  21. package/dist/storage/implementation/MongoParameterCompactor.js +312 -76
  22. package/dist/storage/implementation/MongoParameterCompactor.js.map +1 -1
  23. package/dist/storage/implementation/MongoParsedSyncConfigSet.d.ts +21 -0
  24. package/dist/storage/implementation/MongoParsedSyncConfigSet.js +93 -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 +125 -0
  31. package/dist/storage/implementation/MongoPersistedSyncConfigContent.js.map +1 -0
  32. package/dist/storage/implementation/MongoStorageProvider.js +41 -4
  33. package/dist/storage/implementation/MongoStorageProvider.js.map +1 -1
  34. package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +81 -37
  35. package/dist/storage/implementation/MongoSyncBucketStorage.js +159 -86
  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 +23 -11
  39. package/dist/storage/implementation/MongoSyncRulesLock.js.map +1 -1
  40. package/dist/storage/implementation/MongoWriteCheckpointAPI.d.ts +11 -8
  41. package/dist/storage/implementation/MongoWriteCheckpointAPI.js +159 -33
  42. package/dist/storage/implementation/MongoWriteCheckpointAPI.js.map +1 -1
  43. package/dist/storage/implementation/SyncRuleStateUpdate.d.ts +11 -5
  44. package/dist/storage/implementation/SyncRuleStateUpdate.js +14 -6
  45. package/dist/storage/implementation/SyncRuleStateUpdate.js.map +1 -1
  46. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.d.ts +28 -0
  47. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.js +2 -0
  48. package/dist/storage/implementation/common/MongoSyncBucketStorageCheckpoint.js.map +1 -0
  49. package/dist/storage/implementation/common/PersistedBatch.d.ts +34 -2
  50. package/dist/storage/implementation/common/PersistedBatch.js +63 -10
  51. package/dist/storage/implementation/common/PersistedBatch.js.map +1 -1
  52. package/dist/storage/implementation/common/VersionedPowerSyncMongoBase.js +1 -1
  53. package/dist/storage/implementation/common/VersionedPowerSyncMongoBase.js.map +1 -1
  54. package/dist/storage/implementation/createMongoSyncBucketStorage.d.ts +2 -2
  55. package/dist/storage/implementation/createMongoSyncBucketStorage.js +4 -4
  56. package/dist/storage/implementation/createMongoSyncBucketStorage.js.map +1 -1
  57. package/dist/storage/implementation/db.d.ts +4 -1
  58. package/dist/storage/implementation/db.js +31 -16
  59. package/dist/storage/implementation/db.js.map +1 -1
  60. package/dist/storage/implementation/models.d.ts +55 -13
  61. package/dist/storage/implementation/models.js.map +1 -1
  62. package/dist/storage/implementation/v1/MongoBucketBatchV1.d.ts +15 -1
  63. package/dist/storage/implementation/v1/MongoBucketBatchV1.js +135 -107
  64. package/dist/storage/implementation/v1/MongoBucketBatchV1.js.map +1 -1
  65. package/dist/storage/implementation/v1/MongoChecksumsV1.d.ts +4 -4
  66. package/dist/storage/implementation/v1/MongoChecksumsV1.js +119 -7
  67. package/dist/storage/implementation/v1/MongoChecksumsV1.js.map +1 -1
  68. package/dist/storage/implementation/v1/MongoCompactorV1.d.ts +47 -7
  69. package/dist/storage/implementation/v1/MongoCompactorV1.js +478 -8
  70. package/dist/storage/implementation/v1/MongoCompactorV1.js.map +1 -1
  71. package/dist/storage/implementation/v1/MongoParameterCompactorV1.d.ts +16 -2
  72. package/dist/storage/implementation/v1/MongoParameterCompactorV1.js +20 -9
  73. package/dist/storage/implementation/v1/MongoParameterCompactorV1.js.map +1 -1
  74. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.d.ts +33 -27
  75. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.js +146 -73
  76. package/dist/storage/implementation/v1/MongoSyncBucketStorageV1.js.map +1 -1
  77. package/dist/storage/implementation/v1/SingleBucketStoreV1.d.ts +9 -10
  78. package/dist/storage/implementation/v1/SingleBucketStoreV1.js +2 -8
  79. package/dist/storage/implementation/v1/SingleBucketStoreV1.js.map +1 -1
  80. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.d.ts +2 -1
  81. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.js +3 -0
  82. package/dist/storage/implementation/v1/VersionedPowerSyncMongoV1.js.map +1 -1
  83. package/dist/storage/implementation/v1/models.d.ts +10 -1
  84. package/dist/storage/implementation/v1/models.js +1 -0
  85. package/dist/storage/implementation/v1/models.js.map +1 -1
  86. package/dist/storage/implementation/v3/BucketDataContextV3.d.ts +13 -0
  87. package/dist/storage/implementation/v3/BucketDataContextV3.js +23 -0
  88. package/dist/storage/implementation/v3/BucketDataContextV3.js.map +1 -0
  89. package/dist/storage/implementation/v3/CompactionLease.d.ts +50 -0
  90. package/dist/storage/implementation/v3/CompactionLease.js +131 -0
  91. package/dist/storage/implementation/v3/CompactionLease.js.map +1 -0
  92. package/dist/storage/implementation/v3/MongoBucketBatchV3.d.ts +16 -5
  93. package/dist/storage/implementation/v3/MongoBucketBatchV3.js +393 -262
  94. package/dist/storage/implementation/v3/MongoBucketBatchV3.js.map +1 -1
  95. package/dist/storage/implementation/v3/MongoChecksumsV3.d.ts +30 -9
  96. package/dist/storage/implementation/v3/MongoChecksumsV3.js +161 -20
  97. package/dist/storage/implementation/v3/MongoChecksumsV3.js.map +1 -1
  98. package/dist/storage/implementation/v3/MongoCompactorV3.d.ts +108 -18
  99. package/dist/storage/implementation/v3/MongoCompactorV3.js +1115 -47
  100. package/dist/storage/implementation/v3/MongoCompactorV3.js.map +1 -1
  101. package/dist/storage/implementation/v3/MongoParameterCompactorV3.d.ts +12 -3
  102. package/dist/storage/implementation/v3/MongoParameterCompactorV3.js +13 -8
  103. package/dist/storage/implementation/v3/MongoParameterCompactorV3.js.map +1 -1
  104. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.d.ts +54 -0
  105. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.js +319 -0
  106. package/dist/storage/implementation/v3/MongoStoppedSyncConfigCleanup.js.map +1 -0
  107. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.d.ts +61 -36
  108. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.js +353 -161
  109. package/dist/storage/implementation/v3/MongoSyncBucketStorageV3.js.map +1 -1
  110. package/dist/storage/implementation/v3/MongoWriteCheckpointAPIV3.d.ts +26 -0
  111. package/dist/storage/implementation/v3/MongoWriteCheckpointAPIV3.js +82 -0
  112. package/dist/storage/implementation/v3/MongoWriteCheckpointAPIV3.js.map +1 -0
  113. package/dist/storage/implementation/v3/PersistedBatchV3.d.ts +8 -3
  114. package/dist/storage/implementation/v3/PersistedBatchV3.js +131 -29
  115. package/dist/storage/implementation/v3/PersistedBatchV3.js.map +1 -1
  116. package/dist/storage/implementation/v3/SourceRecordStoreV3.d.ts +3 -3
  117. package/dist/storage/implementation/v3/SourceRecordStoreV3.js +13 -11
  118. package/dist/storage/implementation/v3/SourceRecordStoreV3.js.map +1 -1
  119. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.d.ts +26 -14
  120. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.js +73 -29
  121. package/dist/storage/implementation/v3/VersionedPowerSyncMongoV3.js.map +1 -1
  122. package/dist/storage/implementation/v3/bucket-format.d.ts +13 -0
  123. package/dist/storage/implementation/v3/bucket-format.js +79 -0
  124. package/dist/storage/implementation/v3/bucket-format.js.map +1 -0
  125. package/dist/storage/implementation/v3/chunking.d.ts +10 -0
  126. package/dist/storage/implementation/v3/chunking.js +30 -0
  127. package/dist/storage/implementation/v3/chunking.js.map +1 -0
  128. package/dist/storage/implementation/v3/compact-utils.d.ts +107 -0
  129. package/dist/storage/implementation/v3/compact-utils.js +216 -0
  130. package/dist/storage/implementation/v3/compact-utils.js.map +1 -0
  131. package/dist/storage/implementation/v3/compaction-constants.d.ts +5 -0
  132. package/dist/storage/implementation/v3/compaction-constants.js +6 -0
  133. package/dist/storage/implementation/v3/compaction-constants.js.map +1 -0
  134. package/dist/storage/implementation/v3/models.d.ts +187 -23
  135. package/dist/storage/implementation/v3/models.js +11 -28
  136. package/dist/storage/implementation/v3/models.js.map +1 -1
  137. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.d.ts +20 -0
  138. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.js +48 -0
  139. package/dist/storage/implementation/v3/object-storage/BucketDataObjectStorage.js.map +1 -0
  140. package/dist/storage/implementation/v3/object-storage/ObjectStorage.d.ts +33 -0
  141. package/dist/storage/implementation/v3/object-storage/ObjectStorage.js +12 -0
  142. package/dist/storage/implementation/v3/object-storage/ObjectStorage.js.map +1 -0
  143. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.d.ts +68 -0
  144. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.js +154 -0
  145. package/dist/storage/implementation/v3/object-storage/ObjectStorageLifecycle.js.map +1 -0
  146. package/dist/storage/implementation/v3/object-storage/ObjectStorageUsage.d.ts +37 -0
  147. package/dist/storage/implementation/v3/object-storage/ObjectStorageUsage.js +167 -0
  148. package/dist/storage/implementation/v3/object-storage/ObjectStorageUsage.js.map +1 -0
  149. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.d.ts +67 -0
  150. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.js +439 -0
  151. package/dist/storage/implementation/v3/object-storage/S3ObjectStorage.js.map +1 -0
  152. package/dist/storage/implementation/v3/source-table-utils.d.ts +63 -0
  153. package/dist/storage/implementation/v3/source-table-utils.js +206 -0
  154. package/dist/storage/implementation/v3/source-table-utils.js.map +1 -0
  155. package/dist/storage/storage-index.d.ts +5 -4
  156. package/dist/storage/storage-index.js +5 -4
  157. package/dist/storage/storage-index.js.map +1 -1
  158. package/dist/types/types.d.ts +71 -3
  159. package/dist/types/types.js +58 -2
  160. package/dist/types/types.js.map +1 -1
  161. package/dist/utils/test-utils.d.ts +1 -2
  162. package/dist/utils/test-utils.js +7 -1
  163. package/dist/utils/test-utils.js.map +1 -1
  164. package/dist/utils/util.d.ts +9 -2
  165. package/dist/utils/util.js +131 -5
  166. package/dist/utils/util.js.map +1 -1
  167. package/package.json +13 -19
  168. package/src/migrations/db/migrations/1782950400000-checkpoint-requested-at-index.ts +55 -0
  169. package/src/storage/MongoBucketStorage.ts +728 -242
  170. package/src/storage/implementation/MongoBucketBatch.ts +196 -91
  171. package/src/storage/implementation/MongoChecksums.ts +93 -153
  172. package/src/storage/implementation/MongoCompactor.ts +106 -631
  173. package/src/storage/implementation/MongoHydrationState.ts +61 -0
  174. package/src/storage/implementation/MongoParameterCompactor.ts +392 -87
  175. package/src/storage/implementation/MongoParsedSyncConfigSet.ts +122 -0
  176. package/src/storage/implementation/MongoPersistedReplicationStream.ts +118 -0
  177. package/src/storage/implementation/MongoPersistedSyncConfigContent.ts +156 -0
  178. package/src/storage/implementation/MongoStorageProvider.ts +48 -4
  179. package/src/storage/implementation/MongoSyncBucketStorage.ts +226 -118
  180. package/src/storage/implementation/MongoSyncRulesLock.ts +28 -12
  181. package/src/storage/implementation/MongoWriteCheckpointAPI.ts +194 -52
  182. package/src/storage/implementation/SyncRuleStateUpdate.ts +13 -6
  183. package/src/storage/implementation/common/MongoSyncBucketStorageCheckpoint.ts +31 -0
  184. package/src/storage/implementation/common/PersistedBatch.ts +83 -15
  185. package/src/storage/implementation/common/VersionedPowerSyncMongoBase.ts +1 -1
  186. package/src/storage/implementation/createMongoSyncBucketStorage.ts +21 -7
  187. package/src/storage/implementation/db.ts +40 -22
  188. package/src/storage/implementation/models.ts +58 -14
  189. package/src/storage/implementation/v1/MongoBucketBatchV1.ts +174 -125
  190. package/src/storage/implementation/v1/MongoChecksumsV1.ts +154 -12
  191. package/src/storage/implementation/v1/MongoCompactorV1.ts +594 -25
  192. package/src/storage/implementation/v1/MongoParameterCompactorV1.ts +25 -9
  193. package/src/storage/implementation/v1/MongoSyncBucketStorageV1.ts +226 -129
  194. package/src/storage/implementation/v1/SingleBucketStoreV1.ts +18 -27
  195. package/src/storage/implementation/v1/VersionedPowerSyncMongoV1.ts +11 -1
  196. package/src/storage/implementation/v1/models.ts +12 -1
  197. package/src/storage/implementation/v3/BucketDataContextV3.ts +32 -0
  198. package/src/storage/implementation/v3/CompactionLease.ts +152 -0
  199. package/src/storage/implementation/v3/MongoBucketBatchV3.ts +502 -324
  200. package/src/storage/implementation/v3/MongoChecksumsV3.ts +250 -32
  201. package/src/storage/implementation/v3/MongoCompactorV3.ts +1439 -70
  202. package/src/storage/implementation/v3/MongoParameterCompactorV3.ts +19 -9
  203. package/src/storage/implementation/v3/MongoStoppedSyncConfigCleanup.ts +473 -0
  204. package/src/storage/implementation/v3/MongoSyncBucketStorageV3.ts +453 -211
  205. package/src/storage/implementation/v3/MongoWriteCheckpointAPIV3.ts +111 -0
  206. package/src/storage/implementation/v3/PersistedBatchV3.ts +169 -45
  207. package/src/storage/implementation/v3/SourceRecordStoreV3.ts +12 -12
  208. package/src/storage/implementation/v3/VersionedPowerSyncMongoV3.ts +99 -38
  209. package/src/storage/implementation/v3/bucket-format.ts +99 -0
  210. package/src/storage/implementation/v3/chunking.ts +40 -0
  211. package/src/storage/implementation/v3/compact-utils.ts +320 -0
  212. package/src/storage/implementation/v3/compaction-constants.ts +5 -0
  213. package/src/storage/implementation/v3/models.ts +228 -58
  214. package/src/storage/implementation/v3/object-storage/BucketDataObjectStorage.ts +62 -0
  215. package/src/storage/implementation/v3/object-storage/ObjectStorage.ts +44 -0
  216. package/src/storage/implementation/v3/object-storage/ObjectStorageLifecycle.ts +182 -0
  217. package/src/storage/implementation/v3/object-storage/ObjectStorageUsage.ts +230 -0
  218. package/src/storage/implementation/v3/object-storage/S3ObjectStorage.ts +573 -0
  219. package/src/storage/implementation/v3/source-table-utils.ts +398 -0
  220. package/src/storage/storage-index.ts +14 -4
  221. package/src/types/types.ts +76 -2
  222. package/src/utils/test-utils.ts +8 -3
  223. package/src/utils/util.ts +188 -7
  224. package/test/src/__snapshots__/storage.test.ts.snap +4 -54
  225. package/test/src/__snapshots__/storage_sync.test.ts.snap +652 -645
  226. package/test/src/cleanup-stopped-sync-configs.test.ts +698 -0
  227. package/test/src/compact-utils.test.ts +226 -0
  228. package/test/src/helpers/MemoryObjectStorage.ts +61 -0
  229. package/test/src/helpers/s3TestFactory.ts +69 -0
  230. package/test/src/object_storage_lifecycle.test.ts +59 -0
  231. package/test/src/object_storage_usage.test.ts +255 -0
  232. package/test/src/parameter_compacting_v1.test.ts +120 -0
  233. package/test/src/parameter_compacting_v3.test.ts +192 -0
  234. package/test/src/parameter_compaction_fence.test.ts +276 -0
  235. package/test/src/setup.ts +6 -1
  236. package/test/src/storage.test.ts +478 -13
  237. package/test/src/storage_compacting.test.ts +2516 -107
  238. package/test/src/storage_object_storage_inline_threshold.test.ts +116 -0
  239. package/test/src/storage_s3_checksums.test.ts +190 -0
  240. package/test/src/storage_s3_compaction_lifecycle.test.ts +543 -0
  241. package/test/src/storage_s3_reading.test.ts +768 -0
  242. package/test/src/storage_s3_writing.test.ts +136 -0
  243. package/test/src/storage_sync.test.ts +1507 -76
  244. package/test/src/storeCurrentData.test.ts +227 -0
  245. package/test/src/util.ts +3 -2
  246. package/tsconfig.json +1 -4
  247. package/tsconfig.tsbuildinfo +1 -1
  248. package/dist/storage/implementation/BucketDefinitionMapping.d.ts +0 -15
  249. package/dist/storage/implementation/BucketDefinitionMapping.js +0 -58
  250. package/dist/storage/implementation/BucketDefinitionMapping.js.map +0 -1
  251. package/dist/storage/implementation/MongoPersistedSyncRules.d.ts +0 -14
  252. package/dist/storage/implementation/MongoPersistedSyncRules.js +0 -67
  253. package/dist/storage/implementation/MongoPersistedSyncRules.js.map +0 -1
  254. package/dist/storage/implementation/MongoPersistedSyncRulesContent.d.ts +0 -29
  255. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js +0 -76
  256. package/dist/storage/implementation/MongoPersistedSyncRulesContent.js.map +0 -1
  257. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.d.ts +0 -13
  258. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.js +0 -2
  259. package/dist/storage/implementation/common/MongoSyncBucketStorageContext.js.map +0 -1
  260. package/dist/storage/implementation/common/SingleBucketStore.d.ts +0 -54
  261. package/dist/storage/implementation/common/SingleBucketStore.js +0 -3
  262. package/dist/storage/implementation/common/SingleBucketStore.js.map +0 -1
  263. package/dist/storage/implementation/v3/MongoParameterLookupV3.d.ts +0 -4
  264. package/dist/storage/implementation/v3/MongoParameterLookupV3.js +0 -9
  265. package/dist/storage/implementation/v3/MongoParameterLookupV3.js.map +0 -1
  266. package/dist/storage/implementation/v3/SingleBucketStoreV3.d.ts +0 -18
  267. package/dist/storage/implementation/v3/SingleBucketStoreV3.js +0 -48
  268. package/dist/storage/implementation/v3/SingleBucketStoreV3.js.map +0 -1
  269. package/src/storage/implementation/BucketDefinitionMapping.ts +0 -75
  270. package/src/storage/implementation/MongoPersistedSyncRules.ts +0 -82
  271. package/src/storage/implementation/MongoPersistedSyncRulesContent.ts +0 -101
  272. package/src/storage/implementation/common/MongoSyncBucketStorageContext.ts +0 -15
  273. package/src/storage/implementation/common/SingleBucketStore.ts +0 -63
  274. package/src/storage/implementation/v3/MongoParameterLookupV3.ts +0 -11
  275. package/src/storage/implementation/v3/SingleBucketStoreV3.ts +0 -68
package/CHANGELOG.md CHANGED
@@ -1,17 +1,188 @@
1
1
  # @powersync/service-module-mongodb-storage
2
2
 
3
- ## 0.0.0-dev-20260602073133
3
+ ## 0.0.0-dev-20260909133214
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [70b00a4]
8
+ - @powersync/service-sync-rules@0.0.0-dev-20260909133214
9
+ - @powersync/lib-services-framework@0.0.0-dev-20260909133214
10
+ - @powersync/service-core@0.0.0-dev-20260909133214
11
+ - @powersync/lib-service-mongodb@0.0.0-dev-20260909133214
12
+
13
+ ## 0.21.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 189bd9e: Add storage_version: 4 as a stable storage version.
18
+ - 332d649: [MongoDB Storage] Support incremental parameter compacting jobs.
19
+ - 33a3c23: Add optional version_label for sync configs.
20
+ - fccdff2: Add object storage metrics, and storage metrics split by sync config.
21
+ - 989d9e1: Scope MongoDB v3 custom write checkpoint records and reads to the stream-assigned event definition that created them. Custom checkpoint mode names the event whose id is resolved through the active sync config's persisted mapping, while event handlers copy the assigned id from replication event payloads when writing checkpoints. This keeps active and incrementally processing checkpoint events separate when their definitions change.
22
+ - 646c0de: Track replication events as MongoDB storage v3 source-table memberships so unchanged event definitions retain their assigned ids while new or changed definitions are resnapshotted during incremental reprocessing.
23
+ - 2407f71: Apply timeouts and abortSignal handling to all S3 operations. The broad timeouts can be configured using the new `storage.object_storage.defaults_mode` option, or the `AWS_DEFAULTS_MODE` environment variable. Upgrade S3 SDK to fix further timeout issues.
24
+ - a997c88: Restructure MongoDB V3 bucket compacting.
25
+
26
+ ### Patch Changes
27
+
28
+ - e11c54b: Add S3 timing info for sync checkpoints.
29
+ - aecf844: Persist subkey instead of re-computing every time.
30
+ - cc121b3: [MongoDB Storage V3] Force create new replication stream when the old one is invalidated, and fix other consistency issues with V3 replication stream updates.
31
+ - 4e4063b: Optimize runtime type checks, closes https://github.com/powersync-ja/powersync-service/issues/771.
32
+ - 4037e8f: Add storage.default_storage_version config option.
33
+ - dd7a22f: Add the sync config version label to attributed storage metrics while excluding it from shared OTLP telemetry.
34
+ - Updated dependencies [e11c54b]
35
+ - Updated dependencies [4b6a23e]
36
+ - Updated dependencies [189bd9e]
37
+ - Updated dependencies [bb08068]
38
+ - Updated dependencies [0077a8d]
39
+ - Updated dependencies [332d649]
40
+ - Updated dependencies [33a3c23]
41
+ - Updated dependencies [fccdff2]
42
+ - Updated dependencies [989d9e1]
43
+ - Updated dependencies [646c0de]
44
+ - Updated dependencies [cc121b3]
45
+ - Updated dependencies [4e4063b]
46
+ - Updated dependencies [2407f71]
47
+ - Updated dependencies [10131ca]
48
+ - Updated dependencies [4037e8f]
49
+ - Updated dependencies [3972bac]
50
+ - Updated dependencies [dd7a22f]
51
+ - Updated dependencies [a997c88]
52
+ - @powersync/service-core@1.26.0
53
+ - @powersync/service-sync-rules@0.41.0
54
+ - @powersync/service-types@0.18.0
55
+ - @powersync/lib-services-framework@0.10.1
56
+ - @powersync/lib-service-mongodb@0.6.31
57
+
58
+ ## 0.20.0
59
+
60
+ ### Minor Changes
61
+
62
+ - 798d739: Add source-owned `SourceTable` reconciliation.
63
+
64
+ `resolveTables()` now queries all overlapping persisted candidates and passes them to a
65
+ source-provided reconciler that returns compatible and incompatible tables, can return
66
+ modified compatible copies, and supplies values used for potential new records. Storage persists allowlisted
67
+ source metadata differences but never interprets them. MongoDB v1/v3 and PostgreSQL storage were
68
+ refactored to this candidate-first model (PostgreSQL gains a nullable `source_metadata` JSONB column
69
+ via migration).
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [27b56cb]
74
+ - Updated dependencies [798d739]
75
+ - @powersync/service-core@1.25.0
76
+
77
+ ## 0.19.0
78
+
79
+ ### Minor Changes
80
+
81
+ - 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.
82
+
83
+ This release includes storage migrations for the checkpoint request metadata. Self-hosters should run migrations as part of the upgrade.
84
+
85
+ - 922f974: Add experimental support for storing bucket data chunks on S3.
86
+
87
+ ### Patch Changes
88
+
89
+ - 37591e9: [MongoDB Storage] Use batched deletes for clearing data.
90
+ - 63707af: Stability and performance fixes for MongoDB storage V3.
91
+ - be14bfe: [MongoDB Storage V3] Tweak size estimates and chunking to use actual BSON sizes.
92
+ - aab068b: [MongoDB Storage V3] Add has_clear_op field and simplify checksum queries.
93
+ - b3cbc25: Update "Flushed X + Y + Z updates" log to include more detail
94
+ - Updated dependencies [087b61e]
95
+ - Updated dependencies [2189250]
96
+ - Updated dependencies [922f974]
97
+ - Updated dependencies [c4860c9]
98
+ - Updated dependencies [37591e9]
99
+ - Updated dependencies [483415d]
100
+ - Updated dependencies [8daa300]
101
+ - Updated dependencies [aab068b]
102
+ - Updated dependencies [37591e9]
103
+ - Updated dependencies [be42e25]
104
+ - Updated dependencies [cb4c627]
105
+ - @powersync/service-core@1.24.0
106
+ - @powersync/lib-services-framework@0.10.0
107
+ - @powersync/service-types@0.17.0
108
+ - @powersync/lib-service-mongodb@0.6.30
109
+ - @powersync/service-sync-rules@0.40.0
110
+
111
+ ## 0.18.3
112
+
113
+ ### Patch Changes
114
+
115
+ - ea31f64: Potential fix and improved stack trace for 'evicted' errors.
116
+ - 1f854d3: Fix for occasional readConcern errors when using bulk_read_preference.
117
+ - Updated dependencies [ea71bf3]
118
+ - Updated dependencies [ea31f64]
119
+ - Updated dependencies [edc6ed4]
120
+ - @powersync/service-sync-rules@0.39.0
121
+ - @powersync/service-core@1.23.3
122
+ - @powersync/lib-services-framework@0.9.8
123
+ - @powersync/lib-service-mongodb@0.6.29
124
+
125
+ ## 0.18.2
126
+
127
+ ### Patch Changes
128
+
129
+ - e4f683d: [MongoDB Storage] Add experimental option to allow reading data from secondaries.
130
+ - c2edf86: Add `api.parameters.bucket_count_cache_ttl_minutes` configuration option.
131
+ - df9ab1e: Batch concurrent write checkpoint requests and increase request limits to improve throughput.
132
+ - b9f6b6f: [MongoDB Storage] Optimize writes under high replication lag.
133
+ - Updated dependencies [71d4a0a]
134
+ - Updated dependencies [e4f683d]
135
+ - Updated dependencies [71d4a0a]
136
+ - Updated dependencies [a6ae678]
137
+ - Updated dependencies [c2edf86]
138
+ - Updated dependencies [df9ab1e]
139
+ - @powersync/service-core@1.23.2
140
+ - @powersync/lib-service-mongodb@0.6.28
141
+ - @powersync/service-sync-rules@0.38.1
142
+ - @powersync/service-types@0.16.1
143
+ - @powersync/lib-services-framework@0.9.7
144
+
145
+ ## 0.18.1
146
+
147
+ ### Patch Changes
148
+
149
+ - 7e65360: Restructure replication locks for updated sync config.
150
+ - Updated dependencies [7e65360]
151
+ - @powersync/service-core@1.23.1
152
+
153
+ ## 0.18.0
154
+
155
+ ### Minor Changes
156
+
157
+ - a91a08f: [Experimental] Enable incremental reprocessing for MongoDB source + MongoDB storage. This includes significant changes to the v3 storage format.
158
+
159
+ ### Patch Changes
160
+
161
+ - 101ea67: Include table names in "Cannot mark snapshot done while source tables still require snapshotting" error.
162
+ - Updated dependencies [a91a08f]
163
+ - Updated dependencies [184c39f]
164
+ - Updated dependencies [c3f75df]
165
+ - Updated dependencies [4bd35ea]
166
+ - @powersync/service-core@1.23.0
167
+ - @powersync/service-types@0.16.0
168
+ - @powersync/service-sync-rules@0.38.0
169
+ - @powersync/lib-services-framework@0.9.6
170
+ - @powersync/lib-service-mongodb@0.6.27
171
+
172
+ ## 0.17.0
4
173
 
5
174
  ### Minor Changes
6
175
 
7
176
  - e2bf1ad: [Internal] rework resolveTables to handle multiple SourceTables.
8
177
  - cd5a222: [MongoDB V3 Storage] Split storage for "sync config definition" versus "replication stream status".
9
178
  - 15e2466: [MongoDB] Support snapshotting concurrently with streaming in storage v3+.
179
+ - ebeaa3b: [Postgres] Skip storing a redundant copy of replicated rows in `current_data` for tables with `REPLICA IDENTITY FULL`.
10
180
 
11
181
  ### Patch Changes
12
182
 
13
183
  - 6e2a57e: Refactor HydratedSyncConfig to support multiple SyncConfigs.
14
184
  - 92cc83b: Add the experimental `unstable_sqlite_expression_engine` sync config option to evaluate Sync Streams with SQLite.
185
+ - Updated dependencies [17fd96b]
15
186
  - Updated dependencies [6e2a57e]
16
187
  - Updated dependencies [ec6df9f]
17
188
  - Updated dependencies [99d33d5]
@@ -24,12 +195,13 @@
24
195
  - Updated dependencies [92cc83b]
25
196
  - Updated dependencies [0aab0f9]
26
197
  - Updated dependencies [15e2466]
198
+ - Updated dependencies [ebeaa3b]
27
199
  - Updated dependencies [b116857]
28
200
  - 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
201
+ - @powersync/service-core@1.22.0
202
+ - @powersync/service-sync-rules@0.37.0
203
+ - @powersync/lib-services-framework@0.9.5
204
+ - @powersync/lib-service-mongodb@0.6.26
33
205
 
34
206
  ## 0.16.0
35
207
 
@@ -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,88 @@
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
+ defaultStorageVersion?: number;
21
+ /**
22
+ * Reuse a compatible active replication stream by appending a new sync config.
23
+ *
24
+ * This currently requires source replication support. MongoDB sources can process multiple
25
+ * sync configs in one replication stream, but other source connectors still expect a single
26
+ * sync config per stream.
27
+ */
28
+ supportsMultipleSyncConfigs?: boolean;
9
29
  }
10
30
  export declare class MongoBucketStorage extends storage.BucketStorageFactory {
11
- private internalOptions?;
31
+ private options;
12
32
  [DO_NOT_LOG]: boolean;
13
33
  private readonly client;
14
- 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>;
25
- 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>;
41
+ restartReplication(replicationStreamId: number): Promise<void>;
42
+ /**
43
+ * Keep an active config readable after its replication stream is invalidated.
44
+ *
45
+ * Incremental V3 streams can retain stopped historical configs and embed a deploying config.
46
+ * Read-side storage requires exactly one ACTIVE or ERRORED config, so only the active config
47
+ * transitions to ERRORED; every other embedded config remains or becomes STOP.
48
+ */
49
+ private errorActiveStreamForReplacement;
50
+ private updateSyncRulesInTransaction;
51
+ /**
52
+ * Update to a V3 sync config.
53
+ *
54
+ * Does support cases where existing replication streams are on V1.
55
+ */
56
+ private updateSyncConfigV3InTransaction;
57
+ private loadSyncConfigDefinitions;
58
+ /**
59
+ * Load _all_ definition mappings for a replication stream - used as a base to generate new ids.
60
+ */
61
+ private loadHistoricalSyncConfigRuleMappings;
62
+ private logIncrementalDefinitionChanges;
63
+ private appendSyncConfigToStream;
64
+ updateSyncRules(options: storage.UpdateSyncRulesOptions): Promise<MongoPersistedReplicationStream>;
65
+ private withTransaction;
66
+ /**
67
+ * Update to a V1 sync config.
68
+ *
69
+ * Does support cases where existing replication streams are on V3.
70
+ */
71
+ private updateSyncConfigV1InTransaction;
72
+ /**
73
+ * Stop top-level and embedded processing work before creating a replacement stream.
74
+ *
75
+ * Use in the same transaction that the replacement stream is created.
76
+ */
77
+ private stopExistingProcessingWork;
78
+ getActiveSyncConfig(): Promise<storage.ResolvedSyncConfig | null>;
79
+ private getActiveSyncConfigInternal;
80
+ private replicationStreamFromDoc;
81
+ getDeployingSyncConfig(): Promise<storage.ResolvedSyncConfig | null>;
82
+ private getDeployingSyncConfigInternal;
83
+ getReplicatingReplicationStreams(): Promise<storage.PersistedReplicationStream[]>;
84
+ getStoppedReplicationStreams(): Promise<storage.PersistedReplicationStream[]>;
85
+ private resolvedSyncConfigFromDoc;
33
86
  getStorageMetrics(): Promise<storage.StorageMetrics>;
34
87
  getPowerSyncInstanceId(): Promise<string>;
35
88
  }