@unicitylabs/sphere-sdk 0.14.6-dev.1 → 0.14.7

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.
@@ -778,6 +778,9 @@ function classifyError(e) {
778
778
  }
779
779
  return "other";
780
780
  }
781
+ function firstNonConflictError(outcomes) {
782
+ return outcomes.find((o) => o.error !== void 0 && classifyError(o.error) !== "conflict");
783
+ }
781
784
  function summarize(outcomes) {
782
785
  const committed = outcomes.filter((o) => o.certified);
783
786
  const rank = { "keep-open": 3, conflict: 2, other: 1 };
@@ -838,14 +841,15 @@ var TransferMachine = class {
838
841
  ...r.payload.memo !== void 0 ? { memo: r.payload.memo } : {}
839
842
  };
840
843
  const outcomes = await this.resumeOps(ctx, engine, r);
841
- const { committed, cls, firstError } = summarize(outcomes);
844
+ const { committed } = summarize(outcomes);
842
845
  const conflicts = this.toConflicts(engine, r, outcomes);
843
846
  if (committed.length === 0 && conflicts.length > 0) throw conflicts[0].error;
844
847
  let deliveryPending = false;
845
848
  if (committed.length > 0) {
846
849
  deliveryPending = await this.deliverSet(r.transferId, r.payload.recipient, r.payload.memo, committed);
847
850
  }
848
- if (cls !== null && cls !== "conflict") throw firstError;
851
+ const blocking = firstNonConflictError(outcomes);
852
+ if (blocking !== void 0) throw blocking.error;
849
853
  await this.applyCommitted(engine, r.transferId, committed);
850
854
  if (conflicts.length > 0) {
851
855
  return { deliveryPending, partial: await this.settlePartial(engine, r, committed, conflicts) };