cry-synced-db-client 0.1.106 → 0.1.107
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/dist/index.js +11 -0
- package/dist/src/db/types/managers.d.ts +6 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2385,6 +2385,7 @@ var _SyncEngine = class _SyncEngine {
|
|
|
2385
2385
|
});
|
|
2386
2386
|
}
|
|
2387
2387
|
try {
|
|
2388
|
+
const completedCollections = /* @__PURE__ */ new Set();
|
|
2388
2389
|
await this.deps.withSyncTimeout(
|
|
2389
2390
|
this.restInterface.findNewerManyStream(
|
|
2390
2391
|
syncSpecs,
|
|
@@ -2403,6 +2404,15 @@ var _SyncEngine = class _SyncEngine {
|
|
|
2403
2404
|
if (stats.updatedIds.length > 0) {
|
|
2404
2405
|
this.deps.broadcastUpdates({ [collection]: stats.updatedIds });
|
|
2405
2406
|
}
|
|
2407
|
+
if (!completedCollections.has(collection)) {
|
|
2408
|
+
completedCollections.add(collection);
|
|
2409
|
+
this.callbackSafe(this.callbacks.onSyncProgress, {
|
|
2410
|
+
collection,
|
|
2411
|
+
loaded: completedCollections.size,
|
|
2412
|
+
total: syncSpecs.length,
|
|
2413
|
+
items: items.length
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2406
2416
|
}
|
|
2407
2417
|
),
|
|
2408
2418
|
"findNewerManyStream"
|
|
@@ -3478,6 +3488,7 @@ var SyncedDb = class _SyncedDb {
|
|
|
3478
3488
|
callbacks: {
|
|
3479
3489
|
onSyncStart: config.onSyncStart ? (info) => config.onSyncStart(__spreadProps(__spreadValues({}, info), { initialSync: !this._lastFullSyncDate })) : void 0,
|
|
3480
3490
|
onSyncEnd: config.onSyncEnd,
|
|
3491
|
+
onSyncProgress: config.onSyncProgress,
|
|
3481
3492
|
onServerSyncStart: config.onServerSyncStart,
|
|
3482
3493
|
onServerSyncEnd: config.onServerSyncEnd,
|
|
3483
3494
|
onConflictResolved: config.onConflictResolved,
|
|
@@ -213,6 +213,12 @@ export interface SyncEngineCallbacks {
|
|
|
213
213
|
initialSync: boolean;
|
|
214
214
|
}) => void;
|
|
215
215
|
onSyncEnd?: (info: SyncInfo) => void;
|
|
216
|
+
onSyncProgress?: (info: {
|
|
217
|
+
collection: string;
|
|
218
|
+
loaded: number;
|
|
219
|
+
total: number;
|
|
220
|
+
items: number;
|
|
221
|
+
}) => void;
|
|
216
222
|
onServerSyncStart?: (info: {
|
|
217
223
|
calledFrom?: string;
|
|
218
224
|
collectionCount: number;
|