kaafil-js 0.7.0 → 0.8.0
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/client-entry.cjs +32 -6
- package/dist/client-entry.cjs.map +1 -1
- package/dist/client-entry.d.cts +25 -0
- package/dist/client-entry.d.ts +25 -0
- package/dist/client-entry.js +32 -6
- package/dist/client-entry.js.map +1 -1
- package/package.json +1 -1
package/dist/client-entry.cjs
CHANGED
|
@@ -2877,6 +2877,9 @@ function createDrainer(options) {
|
|
|
2877
2877
|
remaining: report.remaining,
|
|
2878
2878
|
usedBatchTransport: report.usedBatchTransport
|
|
2879
2879
|
});
|
|
2880
|
+
if (report.applied > 0) {
|
|
2881
|
+
options.onLanesApplied?.(report.lanes);
|
|
2882
|
+
}
|
|
2880
2883
|
return report;
|
|
2881
2884
|
}
|
|
2882
2885
|
let kickTimer;
|
|
@@ -3600,22 +3603,45 @@ function createOfflineEngine(options) {
|
|
|
3600
3603
|
...options.share.monotonic !== void 0 ? { monotonic: options.share.monotonic } : {}
|
|
3601
3604
|
});
|
|
3602
3605
|
}
|
|
3606
|
+
const pull = createPullCoordinator({
|
|
3607
|
+
snapshot,
|
|
3608
|
+
transport: options.transport,
|
|
3609
|
+
events,
|
|
3610
|
+
onServerTime
|
|
3611
|
+
});
|
|
3603
3612
|
const drainer = createDrainer({
|
|
3604
3613
|
outbox,
|
|
3605
3614
|
snapshot,
|
|
3606
3615
|
transport: options.transport,
|
|
3607
3616
|
events,
|
|
3608
3617
|
onServerTime,
|
|
3618
|
+
/*
|
|
3619
|
+
* A DRAIN IS FOLLOWED BY A PULL, for the lanes it actually changed.
|
|
3620
|
+
*
|
|
3621
|
+
* Not every write rebases the snapshot: one enqueued without an
|
|
3622
|
+
* `entity`/`optimistic` pairing — deliberately, wherever the response
|
|
3623
|
+
* carries server-assigned fields a client cannot compute — reaches the
|
|
3624
|
+
* server and leaves the local snapshot untouched. Nothing used to close
|
|
3625
|
+
* that gap, so a host reading a snapshot-backed list saw its own
|
|
3626
|
+
* successful write missing from it until something reopened the screen.
|
|
3627
|
+
*
|
|
3628
|
+
* Failures are swallowed on purpose. This is a background reconcile behind
|
|
3629
|
+
* a write that has already succeeded; a pull that cannot reach the server
|
|
3630
|
+
* changes nothing the caller needs to hear about, and `pullTrip` has
|
|
3631
|
+
* already emitted whatever the host subscribes to. Rethrowing here would
|
|
3632
|
+
* surface a sync failure as if the WRITE had failed, which is the one
|
|
3633
|
+
* reading of it that is untrue.
|
|
3634
|
+
*/
|
|
3635
|
+
onLanesApplied: (lanes) => {
|
|
3636
|
+
for (const tripRef of lanes) {
|
|
3637
|
+
void pull.pullTrip({ tripRef }).catch(() => {
|
|
3638
|
+
});
|
|
3639
|
+
}
|
|
3640
|
+
},
|
|
3609
3641
|
...options.conflictResolver !== void 0 ? { conflictResolver: options.conflictResolver } : {},
|
|
3610
3642
|
...options.now !== void 0 ? { now: options.now } : {},
|
|
3611
3643
|
...options.random !== void 0 ? { random: options.random } : {}
|
|
3612
3644
|
});
|
|
3613
|
-
const pull = createPullCoordinator({
|
|
3614
|
-
snapshot,
|
|
3615
|
-
transport: options.transport,
|
|
3616
|
-
events,
|
|
3617
|
-
onServerTime
|
|
3618
|
-
});
|
|
3619
3645
|
const blobs = options.blob === void 0 ? void 0 : createBlobLane({
|
|
3620
3646
|
storage: options.storage,
|
|
3621
3647
|
keyPrefix,
|