@unicitylabs/sphere-sdk 0.14.11-dev.2 → 0.14.11-dev.3
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/connect/index.cjs +1 -1
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/core/index.cjs +16 -3
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +16 -3
- package/dist/core/index.js.map +1 -1
- package/dist/impl/browser/connect/index.cjs +1 -1
- package/dist/impl/browser/connect/index.cjs.map +1 -1
- package/dist/impl/browser/connect/index.js +1 -1
- package/dist/impl/browser/connect/index.js.map +1 -1
- package/dist/index.cjs +16 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +16 -3
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +16 -3
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12935,16 +12935,28 @@ var Receive = class {
|
|
|
12935
12935
|
this.unsubscribeWake?.();
|
|
12936
12936
|
this.unsubscribeWake = null;
|
|
12937
12937
|
}
|
|
12938
|
-
/**
|
|
12939
|
-
|
|
12938
|
+
/**
|
|
12939
|
+
* Flush what has been accepted, then ask for a mirror refresh — at most once
|
|
12940
|
+
* per REFRESH_INTERVAL_MS.
|
|
12941
|
+
*
|
|
12942
|
+
* The flush is not incidental. A `claimed` ack is what materializes a token
|
|
12943
|
+
* into SERVER inventory, and acks otherwise sit queued until ACK_BATCH_SIZE
|
|
12944
|
+
* (200) — so for any ordinary drain, including the 54-token case this exists
|
|
12945
|
+
* for, refreshing before the flush would query an inventory holding none of
|
|
12946
|
+
* the tokens just accepted, and the balance would still only move at the end.
|
|
12947
|
+
* Ordering is preserved: store() still precedes the ack (§5.7).
|
|
12948
|
+
*/
|
|
12949
|
+
async maybeRefresh(deps, pending, epochOf) {
|
|
12940
12950
|
if (deps.refreshView === void 0) return;
|
|
12941
12951
|
const now = deps.now?.() ?? Date.now();
|
|
12942
12952
|
if (now - this.lastRefreshAt < REFRESH_INTERVAL_MS) return;
|
|
12943
12953
|
this.lastRefreshAt = now;
|
|
12954
|
+
await flushAcks(deps, pending, epochOf);
|
|
12944
12955
|
deps.refreshView();
|
|
12945
12956
|
}
|
|
12946
12957
|
async doDrain() {
|
|
12947
12958
|
const deps = this.deps;
|
|
12959
|
+
this.lastRefreshAt = deps.now?.() ?? Date.now();
|
|
12948
12960
|
const engine = deps.engine();
|
|
12949
12961
|
const stored = [];
|
|
12950
12962
|
const pending = [];
|
|
@@ -12954,9 +12966,10 @@ var Receive = class {
|
|
|
12954
12966
|
let basis = record !== null && record.syncEpoch === deps.syncEpoch() ? record : null;
|
|
12955
12967
|
for (let pass = 0; pass < 2; pass++) {
|
|
12956
12968
|
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
12969
|
+
const storedBefore = stored.length;
|
|
12957
12970
|
await this.processEntry(deps, engine, entry, pending, stored);
|
|
12958
12971
|
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
12959
|
-
if (stored.length >
|
|
12972
|
+
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
12960
12973
|
}
|
|
12961
12974
|
await flushAcks(deps, pending, pageEpoch);
|
|
12962
12975
|
const served = deps.delivery.incomingEpoch();
|