@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.cjs
CHANGED
|
@@ -13063,16 +13063,28 @@ var Receive = class {
|
|
|
13063
13063
|
this.unsubscribeWake?.();
|
|
13064
13064
|
this.unsubscribeWake = null;
|
|
13065
13065
|
}
|
|
13066
|
-
/**
|
|
13067
|
-
|
|
13066
|
+
/**
|
|
13067
|
+
* Flush what has been accepted, then ask for a mirror refresh — at most once
|
|
13068
|
+
* per REFRESH_INTERVAL_MS.
|
|
13069
|
+
*
|
|
13070
|
+
* The flush is not incidental. A `claimed` ack is what materializes a token
|
|
13071
|
+
* into SERVER inventory, and acks otherwise sit queued until ACK_BATCH_SIZE
|
|
13072
|
+
* (200) — so for any ordinary drain, including the 54-token case this exists
|
|
13073
|
+
* for, refreshing before the flush would query an inventory holding none of
|
|
13074
|
+
* the tokens just accepted, and the balance would still only move at the end.
|
|
13075
|
+
* Ordering is preserved: store() still precedes the ack (§5.7).
|
|
13076
|
+
*/
|
|
13077
|
+
async maybeRefresh(deps, pending, epochOf) {
|
|
13068
13078
|
if (deps.refreshView === void 0) return;
|
|
13069
13079
|
const now = deps.now?.() ?? Date.now();
|
|
13070
13080
|
if (now - this.lastRefreshAt < REFRESH_INTERVAL_MS) return;
|
|
13071
13081
|
this.lastRefreshAt = now;
|
|
13082
|
+
await flushAcks(deps, pending, epochOf);
|
|
13072
13083
|
deps.refreshView();
|
|
13073
13084
|
}
|
|
13074
13085
|
async doDrain() {
|
|
13075
13086
|
const deps = this.deps;
|
|
13087
|
+
this.lastRefreshAt = deps.now?.() ?? Date.now();
|
|
13076
13088
|
const engine = deps.engine();
|
|
13077
13089
|
const stored = [];
|
|
13078
13090
|
const pending = [];
|
|
@@ -13082,9 +13094,10 @@ var Receive = class {
|
|
|
13082
13094
|
let basis = record !== null && record.syncEpoch === deps.syncEpoch() ? record : null;
|
|
13083
13095
|
for (let pass = 0; pass < 2; pass++) {
|
|
13084
13096
|
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
13097
|
+
const storedBefore = stored.length;
|
|
13085
13098
|
await this.processEntry(deps, engine, entry, pending, stored);
|
|
13086
13099
|
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
13087
|
-
if (stored.length >
|
|
13100
|
+
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
13088
13101
|
}
|
|
13089
13102
|
await flushAcks(deps, pending, pageEpoch);
|
|
13090
13103
|
const served = deps.delivery.incomingEpoch();
|