@powersync/service-module-mongodb-storage 0.6.0 → 0.6.2
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 +24 -0
- package/dist/storage/MongoBucketStorage.d.ts +3 -3
- package/dist/storage/MongoBucketStorage.js +26 -13
- package/dist/storage/MongoBucketStorage.js.map +1 -1
- package/dist/storage/implementation/MongoBucketBatch.js +1 -1
- package/dist/storage/implementation/MongoBucketBatch.js.map +1 -1
- package/dist/storage/implementation/MongoCompactor.d.ts +0 -6
- package/dist/storage/implementation/MongoCompactor.js +1 -2
- package/dist/storage/implementation/MongoCompactor.js.map +1 -1
- package/dist/storage/implementation/MongoSyncBucketStorage.js +20 -14
- package/dist/storage/implementation/MongoSyncBucketStorage.js.map +1 -1
- package/dist/storage/implementation/MongoWriteCheckpointAPI.js +1 -2
- package/dist/storage/implementation/MongoWriteCheckpointAPI.js.map +1 -1
- package/dist/storage/implementation/OperationBatch.d.ts +1 -0
- package/dist/storage/implementation/OperationBatch.js +3 -0
- package/dist/storage/implementation/OperationBatch.js.map +1 -1
- package/dist/storage/implementation/PersistedBatch.js +7 -6
- package/dist/storage/implementation/PersistedBatch.js.map +1 -1
- package/dist/storage/implementation/util.d.ts +0 -14
- package/dist/storage/implementation/util.js +0 -38
- package/dist/storage/implementation/util.js.map +1 -1
- package/package.json +6 -6
- package/src/storage/MongoBucketStorage.ts +31 -14
- package/src/storage/implementation/MongoBucketBatch.ts +1 -1
- package/src/storage/implementation/MongoCompactor.ts +2 -10
- package/src/storage/implementation/MongoSyncBucketStorage.ts +46 -35
- package/src/storage/implementation/MongoWriteCheckpointAPI.ts +1 -3
- package/src/storage/implementation/OperationBatch.ts +4 -0
- package/src/storage/implementation/PersistedBatch.ts +7 -6
- package/src/storage/implementation/util.ts +0 -45
- package/test/src/__snapshots__/storage_sync.test.ts.snap +56 -0
- package/test/src/storage_compacting.test.ts +1 -7
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -127,6 +127,62 @@ exports[`sync - mongodb > expiring token 2`] = `
|
|
|
127
127
|
]
|
|
128
128
|
`;
|
|
129
129
|
|
|
130
|
+
exports[`sync - mongodb > sends checkpoint complete line for empty checkpoint 1`] = `
|
|
131
|
+
[
|
|
132
|
+
{
|
|
133
|
+
"checkpoint": {
|
|
134
|
+
"buckets": [
|
|
135
|
+
{
|
|
136
|
+
"bucket": "mybucket[]",
|
|
137
|
+
"checksum": -1221282404,
|
|
138
|
+
"count": 1,
|
|
139
|
+
"priority": 3,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
"last_op_id": "1",
|
|
143
|
+
"write_checkpoint": undefined,
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"data": {
|
|
148
|
+
"after": "0",
|
|
149
|
+
"bucket": "mybucket[]",
|
|
150
|
+
"data": [
|
|
151
|
+
{
|
|
152
|
+
"checksum": 3073684892,
|
|
153
|
+
"data": "{"id":"t1","description":"sync"}",
|
|
154
|
+
"object_id": "t1",
|
|
155
|
+
"object_type": "test",
|
|
156
|
+
"op": "PUT",
|
|
157
|
+
"op_id": "1",
|
|
158
|
+
"subkey": "e5aa2ddc-1328-58fa-a000-0b5ed31eaf1a",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
"has_more": false,
|
|
162
|
+
"next_after": "1",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"checkpoint_complete": {
|
|
167
|
+
"last_op_id": "1",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"checkpoint_diff": {
|
|
172
|
+
"last_op_id": "1",
|
|
173
|
+
"removed_buckets": [],
|
|
174
|
+
"updated_buckets": [],
|
|
175
|
+
"write_checkpoint": "1",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"checkpoint_complete": {
|
|
180
|
+
"last_op_id": "1",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
]
|
|
184
|
+
`;
|
|
185
|
+
|
|
130
186
|
exports[`sync - mongodb > sync buckets in order 1`] = `
|
|
131
187
|
[
|
|
132
188
|
{
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { MongoCompactOptions } from '@module/storage/implementation/MongoCompactor.js';
|
|
2
1
|
import { register } from '@powersync/service-core-tests';
|
|
3
2
|
import { describe } from 'vitest';
|
|
4
3
|
import { INITIALIZED_MONGO_STORAGE_FACTORY } from './util.js';
|
|
5
4
|
|
|
6
|
-
describe('Mongo Sync Bucket Storage Compact', () =>
|
|
7
|
-
register.registerCompactTests<MongoCompactOptions>(INITIALIZED_MONGO_STORAGE_FACTORY, {
|
|
8
|
-
clearBatchLimit: 2,
|
|
9
|
-
moveBatchLimit: 1,
|
|
10
|
-
moveBatchQueryLimit: 1
|
|
11
|
-
}));
|
|
5
|
+
describe('Mongo Sync Bucket Storage Compact', () => register.registerCompactTests(INITIALIZED_MONGO_STORAGE_FACTORY));
|