@unicitylabs/sphere-sdk 0.14.6 → 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.
@@ -823,6 +823,9 @@ function classifyError(e) {
823
823
  }
824
824
  return "other";
825
825
  }
826
+ function firstNonConflictError(outcomes) {
827
+ return outcomes.find((o) => o.error !== void 0 && classifyError(o.error) !== "conflict");
828
+ }
826
829
  function summarize(outcomes) {
827
830
  const committed = outcomes.filter((o) => o.certified);
828
831
  const rank = { "keep-open": 3, conflict: 2, other: 1 };
@@ -883,14 +886,15 @@ var TransferMachine = class {
883
886
  ...r.payload.memo !== void 0 ? { memo: r.payload.memo } : {}
884
887
  };
885
888
  const outcomes = await this.resumeOps(ctx, engine, r);
886
- const { committed, cls, firstError } = summarize(outcomes);
889
+ const { committed } = summarize(outcomes);
887
890
  const conflicts = this.toConflicts(engine, r, outcomes);
888
891
  if (committed.length === 0 && conflicts.length > 0) throw conflicts[0].error;
889
892
  let deliveryPending = false;
890
893
  if (committed.length > 0) {
891
894
  deliveryPending = await this.deliverSet(r.transferId, r.payload.recipient, r.payload.memo, committed);
892
895
  }
893
- if (cls !== null && cls !== "conflict") throw firstError;
896
+ const blocking = firstNonConflictError(outcomes);
897
+ if (blocking !== void 0) throw blocking.error;
894
898
  await this.applyCommitted(engine, r.transferId, committed);
895
899
  if (conflicts.length > 0) {
896
900
  return { deliveryPending, partial: await this.settlePartial(engine, r, committed, conflicts) };