@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/core/index.js
CHANGED
|
@@ -12919,16 +12919,28 @@ var Receive = class {
|
|
|
12919
12919
|
this.unsubscribeWake?.();
|
|
12920
12920
|
this.unsubscribeWake = null;
|
|
12921
12921
|
}
|
|
12922
|
-
/**
|
|
12923
|
-
|
|
12922
|
+
/**
|
|
12923
|
+
* Flush what has been accepted, then ask for a mirror refresh — at most once
|
|
12924
|
+
* per REFRESH_INTERVAL_MS.
|
|
12925
|
+
*
|
|
12926
|
+
* The flush is not incidental. A `claimed` ack is what materializes a token
|
|
12927
|
+
* into SERVER inventory, and acks otherwise sit queued until ACK_BATCH_SIZE
|
|
12928
|
+
* (200) — so for any ordinary drain, including the 54-token case this exists
|
|
12929
|
+
* for, refreshing before the flush would query an inventory holding none of
|
|
12930
|
+
* the tokens just accepted, and the balance would still only move at the end.
|
|
12931
|
+
* Ordering is preserved: store() still precedes the ack (§5.7).
|
|
12932
|
+
*/
|
|
12933
|
+
async maybeRefresh(deps, pending, epochOf) {
|
|
12924
12934
|
if (deps.refreshView === void 0) return;
|
|
12925
12935
|
const now = deps.now?.() ?? Date.now();
|
|
12926
12936
|
if (now - this.lastRefreshAt < REFRESH_INTERVAL_MS) return;
|
|
12927
12937
|
this.lastRefreshAt = now;
|
|
12938
|
+
await flushAcks(deps, pending, epochOf);
|
|
12928
12939
|
deps.refreshView();
|
|
12929
12940
|
}
|
|
12930
12941
|
async doDrain() {
|
|
12931
12942
|
const deps = this.deps;
|
|
12943
|
+
this.lastRefreshAt = deps.now?.() ?? Date.now();
|
|
12932
12944
|
const engine = deps.engine();
|
|
12933
12945
|
const stored = [];
|
|
12934
12946
|
const pending = [];
|
|
@@ -12938,9 +12950,10 @@ var Receive = class {
|
|
|
12938
12950
|
let basis = record !== null && record.syncEpoch === deps.syncEpoch() ? record : null;
|
|
12939
12951
|
for (let pass = 0; pass < 2; pass++) {
|
|
12940
12952
|
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
12953
|
+
const storedBefore = stored.length;
|
|
12941
12954
|
await this.processEntry(deps, engine, entry, pending, stored);
|
|
12942
12955
|
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
12943
|
-
if (stored.length >
|
|
12956
|
+
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
12944
12957
|
}
|
|
12945
12958
|
await flushAcks(deps, pending, pageEpoch);
|
|
12946
12959
|
const served = deps.delivery.incomingEpoch();
|