@unicitylabs/sphere-sdk 0.14.11-dev.7 → 0.14.11-dev.8
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 +26 -12
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +26 -12
- 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/impl/wallet-api-v2/index.cjs +1 -0
- package/dist/impl/wallet-api-v2/index.cjs.map +1 -1
- package/dist/impl/wallet-api-v2/index.js +1 -0
- package/dist/impl/wallet-api-v2/index.js.map +1 -1
- package/dist/index.cjs +26 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/dist/modules/payments-v2/index.cjs +25 -12
- package/dist/modules/payments-v2/index.cjs.map +1 -1
- package/dist/modules/payments-v2/index.js +25 -12
- package/dist/modules/payments-v2/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/index.js
CHANGED
|
@@ -11217,12 +11217,19 @@ var SerialChain = class {
|
|
|
11217
11217
|
return run;
|
|
11218
11218
|
}
|
|
11219
11219
|
};
|
|
11220
|
-
function coalesced(run) {
|
|
11220
|
+
function coalesced(run, observe) {
|
|
11221
11221
|
let inFlight = false;
|
|
11222
11222
|
let queued = false;
|
|
11223
11223
|
const start = () => {
|
|
11224
11224
|
inFlight = true;
|
|
11225
|
-
|
|
11225
|
+
let running;
|
|
11226
|
+
try {
|
|
11227
|
+
running = run();
|
|
11228
|
+
} catch {
|
|
11229
|
+
running = Promise.resolve();
|
|
11230
|
+
}
|
|
11231
|
+
observe?.(running);
|
|
11232
|
+
void running.catch(() => void 0).finally(() => {
|
|
11226
11233
|
inFlight = false;
|
|
11227
11234
|
if (!queued) return;
|
|
11228
11235
|
queued = false;
|
|
@@ -12979,6 +12986,17 @@ var Receive = class {
|
|
|
12979
12986
|
await flushAcks(deps, pending, epochOf);
|
|
12980
12987
|
deps.refreshView();
|
|
12981
12988
|
}
|
|
12989
|
+
/** One listing pass: process each entry, flushing and refreshing as it goes. */
|
|
12990
|
+
async drainPages(ctx, basis) {
|
|
12991
|
+
const { deps, engine, pending, stored, pageEpoch } = ctx;
|
|
12992
|
+
for await (const entry of deps.delivery.incoming(basis === null ? void 0 : String(basis.cursor))) {
|
|
12993
|
+
const storedBefore = stored.length;
|
|
12994
|
+
await this.processEntry(deps, engine, entry, pending, stored);
|
|
12995
|
+
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
12996
|
+
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
12997
|
+
}
|
|
12998
|
+
await flushAcks(deps, pending, pageEpoch);
|
|
12999
|
+
}
|
|
12982
13000
|
async doDrain() {
|
|
12983
13001
|
const deps = this.deps;
|
|
12984
13002
|
this.lastRefreshAt = deps.now?.() ?? Date.now();
|
|
@@ -12990,13 +13008,7 @@ var Receive = class {
|
|
|
12990
13008
|
const record = await deps.kv.get(STORE_KEYS.streamCursor("mailbox"));
|
|
12991
13009
|
let basis = record !== null && record.syncEpoch === deps.syncEpoch() ? record : null;
|
|
12992
13010
|
for (let pass = 0; pass < 2; pass++) {
|
|
12993
|
-
|
|
12994
|
-
const storedBefore = stored.length;
|
|
12995
|
-
await this.processEntry(deps, engine, entry, pending, stored);
|
|
12996
|
-
if (pending.length >= ACK_BATCH_SIZE) await flushAcks(deps, pending, pageEpoch);
|
|
12997
|
-
if (stored.length > storedBefore) await this.maybeRefresh(deps, pending, pageEpoch);
|
|
12998
|
-
}
|
|
12999
|
-
await flushAcks(deps, pending, pageEpoch);
|
|
13011
|
+
await this.drainPages({ deps, engine, pending, stored, pageEpoch }, basis);
|
|
13000
13012
|
const served = deps.delivery.incomingEpoch();
|
|
13001
13013
|
if (basis === null || served === null || served === basis.syncEpoch) break;
|
|
13002
13014
|
await deps.kv.remove(STORE_KEYS.streamCursor("mailbox"));
|
|
@@ -13009,6 +13021,7 @@ var Receive = class {
|
|
|
13009
13021
|
logger.warn("PaymentsV2", "receive ack flush failed \u2014 cursor holds at the acked prefix:", flushErr);
|
|
13010
13022
|
});
|
|
13011
13023
|
}
|
|
13024
|
+
if (stored.length > 0) deps.refreshView?.();
|
|
13012
13025
|
return stored;
|
|
13013
13026
|
}
|
|
13014
13027
|
async processEntry(deps, engine, entry, pending, stored) {
|
|
@@ -13939,7 +13952,7 @@ function composeFacadeParts(deps, hooks) {
|
|
|
13939
13952
|
const machineDeps = buildMachineDeps(deps, hooks, historyStore);
|
|
13940
13953
|
const machineStores = createMachineStores(deps.kv);
|
|
13941
13954
|
const heldStates = /* @__PURE__ */ new Map();
|
|
13942
|
-
const refreshView = coalesced(() => view.delta());
|
|
13955
|
+
const refreshView = coalesced(() => view.delta(), hooks.track);
|
|
13943
13956
|
return {
|
|
13944
13957
|
ownPubkeyBytes,
|
|
13945
13958
|
view,
|
|
@@ -14082,7 +14095,8 @@ var PaymentsFacade = class {
|
|
|
14082
14095
|
const parts = composeFacadeParts(deps, {
|
|
14083
14096
|
engine: () => this.engine(),
|
|
14084
14097
|
send: (request) => this.send(request),
|
|
14085
|
-
isActiveOp: (id) => this.activeMoneyOps.has(id)
|
|
14098
|
+
isActiveOp: (id) => this.activeMoneyOps.has(id),
|
|
14099
|
+
track: (op) => this.trackTail(op)
|
|
14086
14100
|
});
|
|
14087
14101
|
this.view = parts.view;
|
|
14088
14102
|
this.wakeRefresh = parts.refreshView;
|
|
@@ -14222,7 +14236,6 @@ var PaymentsFacade = class {
|
|
|
14222
14236
|
}
|
|
14223
14237
|
async receive() {
|
|
14224
14238
|
const transfers = await this.track(this.receiveLoop.drainOnce());
|
|
14225
|
-
if (transfers.length > 0) this.trackTail(this.view.delta());
|
|
14226
14239
|
return { transfers };
|
|
14227
14240
|
}
|
|
14228
14241
|
mint(coinId, amount) {
|
|
@@ -15617,6 +15630,7 @@ var WalletApiDeliveryPort = class {
|
|
|
15617
15630
|
await this.settleClaims(acks, settled, outcomes);
|
|
15618
15631
|
await this.settleRejects(acks, settled);
|
|
15619
15632
|
} catch (err) {
|
|
15633
|
+
await this.addSeenAll(settled).catch(() => void 0);
|
|
15620
15634
|
throw asRetryable(err);
|
|
15621
15635
|
}
|
|
15622
15636
|
await this.addSeenAll(settled);
|