@powersync/service-core 0.0.0-dev-20260202103935 → 0.0.0-dev-20260202131921
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 +5 -5
- package/dist/routes/endpoints/sync-stream.js +6 -1
- package/dist/routes/endpoints/sync-stream.js.map +1 -1
- package/dist/storage/ReportStorage.d.ts +1 -0
- package/dist/sync/BucketChecksumState.d.ts +2 -1
- package/dist/sync/BucketChecksumState.js +5 -4
- package/dist/sync/BucketChecksumState.js.map +1 -1
- package/dist/sync/sync.js +8 -17
- package/dist/sync/sync.js.map +1 -1
- package/dist/sync/util.d.ts +22 -0
- package/dist/sync/util.js +24 -0
- package/dist/sync/util.js.map +1 -1
- package/package.json +5 -5
- package/src/routes/endpoints/sync-stream.ts +6 -1
- package/src/storage/ReportStorage.ts +2 -0
- package/src/sync/BucketChecksumState.ts +5 -6
- package/src/sync/sync.ts +17 -17
- package/src/sync/util.ts +25 -0
- package/tsconfig.tsbuildinfo +1 -1
package/src/sync/util.ts
CHANGED
|
@@ -2,8 +2,11 @@ import * as timers from 'timers/promises';
|
|
|
2
2
|
|
|
3
3
|
import { SemaphoreInterface } from 'async-mutex';
|
|
4
4
|
import * as util from '../util/util-index.js';
|
|
5
|
+
import { StreamingSyncCheckpoint, StreamingSyncCheckpointDiff } from '../util/util-index.js';
|
|
5
6
|
import { RequestTracker } from './RequestTracker.js';
|
|
7
|
+
import * as bson from 'bson';
|
|
6
8
|
import { serialize } from 'bson';
|
|
9
|
+
import { SyncEventCheckpointType } from '@powersync/service-types/dist/reports.js';
|
|
7
10
|
|
|
8
11
|
export type TokenStreamOptions = {
|
|
9
12
|
/**
|
|
@@ -215,3 +218,25 @@ export function* getIntersection<T>(a: MapOrSet<T>, b: MapOrSet<T>): IterableIte
|
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
}
|
|
221
|
+
|
|
222
|
+
export function parseCheckpointLineForEvent(line: StreamingSyncCheckpoint | StreamingSyncCheckpointDiff) {
|
|
223
|
+
if ('checkpoint' in line) {
|
|
224
|
+
return {
|
|
225
|
+
id: new bson.ObjectId(),
|
|
226
|
+
type: SyncEventCheckpointType.FULL,
|
|
227
|
+
last_op_id: line.checkpoint.last_op_id,
|
|
228
|
+
buckets: line.checkpoint.buckets,
|
|
229
|
+
streams: line.checkpoint.streams,
|
|
230
|
+
date: new Date()
|
|
231
|
+
};
|
|
232
|
+
} else {
|
|
233
|
+
return {
|
|
234
|
+
id: new bson.ObjectId(),
|
|
235
|
+
type: SyncEventCheckpointType.DIFF,
|
|
236
|
+
last_op_id: line.checkpoint_diff.last_op_id,
|
|
237
|
+
updated_buckets: line.checkpoint_diff.updated_buckets,
|
|
238
|
+
removed_buckets: line.checkpoint_diff.removed_buckets,
|
|
239
|
+
date: new Date()
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|