@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.
- package/CHANGELOG.md +28 -13
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/storage/MongoBucketStorage.js +1 -1
- package/dist/storage/MongoBucketStorage.js.map +1 -1
- package/dist/storage/implementation/MongoBucketBatch.d.ts +1 -1
- package/dist/storage/implementation/MongoBucketBatch.js +7 -4
- package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
- package/dist/storage/implementation/MongoCompactor.d.ts +16 -2
- package/dist/storage/implementation/MongoCompactor.js +204 -48
- package/dist/storage/implementation/MongoCompactor.js.map +1 -1
- package/dist/storage/implementation/MongoStorageProvider.d.ts +1 -1
- package/dist/storage/implementation/MongoStorageProvider.js +3 -7
- package/dist/storage/implementation/MongoStorageProvider.js.map +1 -1
- package/dist/storage/implementation/MongoSyncBucketStorage.d.ts +12 -1
- package/dist/storage/implementation/MongoSyncBucketStorage.js +196 -37
- package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
- package/dist/storage/implementation/MongoTestStorageFactoryGenerator.d.ts +7 -0
- package/dist/storage/implementation/MongoTestStorageFactoryGenerator.js +18 -0
- package/dist/storage/implementation/MongoTestStorageFactoryGenerator.js.map +1 -0
- package/dist/storage/implementation/PersistedBatch.d.ts +1 -0
- package/dist/storage/implementation/PersistedBatch.js +13 -6
- package/dist/storage/implementation/PersistedBatch.js.map +1 -1
- package/dist/storage/implementation/db.d.ts +1 -6
- package/dist/storage/implementation/db.js +0 -16
- package/dist/storage/implementation/db.js.map +1 -1
- package/dist/storage/implementation/models.d.ts +14 -3
- package/dist/{utils → storage/implementation}/util.d.ts +35 -3
- package/dist/{utils → storage/implementation}/util.js +54 -0
- package/dist/storage/implementation/util.js.map +1 -0
- package/dist/storage/storage-index.d.ts +2 -3
- package/dist/storage/storage-index.js +2 -3
- package/dist/storage/storage-index.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +0 -1
- package/src/storage/MongoBucketStorage.ts +1 -1
- package/src/storage/implementation/MongoBucketBatch.ts +8 -6
- package/src/storage/implementation/MongoCompactor.ts +239 -49
- package/src/storage/implementation/MongoStorageProvider.ts +4 -9
- package/src/storage/implementation/MongoSyncBucketStorage.ts +242 -38
- package/src/storage/implementation/MongoTestStorageFactoryGenerator.ts +28 -0
- package/src/storage/implementation/PersistedBatch.ts +14 -6
- package/src/storage/implementation/db.ts +0 -18
- package/src/storage/implementation/models.ts +15 -3
- package/src/{utils → storage/implementation}/util.ts +61 -3
- package/src/storage/storage-index.ts +2 -3
- package/test/src/__snapshots__/storage_sync.test.ts.snap +110 -0
- package/test/src/util.ts +2 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/migrations/db/migrations/1752661449910-connection-reporting.d.ts +0 -3
- package/dist/migrations/db/migrations/1752661449910-connection-reporting.js +0 -36
- package/dist/migrations/db/migrations/1752661449910-connection-reporting.js.map +0 -1
- package/dist/storage/MongoReportStorage.d.ts +0 -18
- package/dist/storage/MongoReportStorage.js +0 -154
- package/dist/storage/MongoReportStorage.js.map +0 -1
- package/dist/utils/test-utils.d.ts +0 -11
- package/dist/utils/test-utils.js +0 -40
- package/dist/utils/test-utils.js.map +0 -1
- package/dist/utils/util.js.map +0 -1
- package/dist/utils/utils-index.d.ts +0 -2
- package/dist/utils/utils-index.js +0 -3
- package/dist/utils/utils-index.js.map +0 -1
- package/src/migrations/db/migrations/1752661449910-connection-reporting.ts +0 -58
- package/src/storage/MongoReportStorage.ts +0 -177
- package/src/utils/test-utils.ts +0 -55
- package/src/utils/utils-index.ts +0 -2
- package/test/src/__snapshots__/connection-report-storage.test.ts.snap +0 -215
- 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
|
-
|
|
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
|
|
5
|
+
export const INITIALIZED_MONGO_STORAGE_FACTORY = MongoTestStorageFactoryGenerator({
|
|
10
6
|
url: env.MONGO_TEST_URL,
|
|
11
7
|
isCI: env.CI
|
|
12
8
|
});
|