@calimero-network/mero-js 29.13.0 → 29.15.0

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/index.mjs CHANGED
@@ -1406,6 +1406,14 @@ var ReleaseDeadlineError = class extends CalimeroError {
1406
1406
  this.after = typeof details.after === "string" ? details.after : "";
1407
1407
  }
1408
1408
  };
1409
+ var RuntimeTooOld = class extends CalimeroError {
1410
+ constructor(message, details = {}) {
1411
+ super(409, "RUNTIME_TOO_OLD", message, details);
1412
+ this.name = "RuntimeTooOld";
1413
+ this.minRuntimeVersion = typeof details.minRuntimeVersion === "string" ? details.minRuntimeVersion : "";
1414
+ this.nodes = Array.isArray(details.nodes) ? details.nodes : [];
1415
+ }
1416
+ };
1409
1417
  var ConsentStale = class extends CalimeroError {
1410
1418
  constructor(message, details = {}) {
1411
1419
  super(409, "CONSENT_STALE", message, details);
@@ -1541,6 +1549,8 @@ function errorFrom(status, body, retryAfterHeader) {
1541
1549
  return new IdempotencyMismatch(message, details);
1542
1550
  case "409 RELEASE_DEADLINE":
1543
1551
  return new ReleaseDeadlineError(message, details);
1552
+ case "409 RUNTIME_TOO_OLD":
1553
+ return new RuntimeTooOld(message, details);
1544
1554
  case "409 CONSENT_STALE":
1545
1555
  return new ConsentStale(message, details);
1546
1556
  case "403 ORIGIN_NOT_REGISTERED":
@@ -1808,12 +1818,16 @@ function pendingApprovalsFrom(report, rules, now = Date.now() / 1e3) {
1808
1818
  for (const a of report.apps) {
1809
1819
  const available = a.availableVersions ?? [];
1810
1820
  if (a.package === null || available.length === 0) continue;
1821
+ const latest = available[available.length - 1];
1822
+ const reachable = a.latestReachable === void 0 ? latest : a.latestReachable;
1811
1823
  upgrades.push({
1812
1824
  app: a.app,
1813
1825
  name: a.name ?? null,
1814
1826
  package: a.package.package,
1815
1827
  from: a.package.version,
1816
- to: available[available.length - 1],
1828
+ to: reachable ?? latest,
1829
+ reachable: reachable !== null,
1830
+ blocked: a.latestBlocked ?? null,
1817
1831
  available,
1818
1832
  actionable: upgradesActionable
1819
1833
  });
@@ -2690,8 +2704,10 @@ var CalimeroClient = class _CalimeroClient {
2690
2704
  }
2691
2705
  /**
2692
2706
  * Move an app to another release of its package (`{ version }`), another
2693
- * package, or a bundle hash, running its migration. Answers the upgrade's
2694
- * entry; a failed migration rejects with code `UPGRADE_FAILED` (422).
2707
+ * package, or a bundle hash. An upgrade is code only: the app moves to any
2708
+ * newer release in one step. Answers the upgrade's entry; one the app's
2709
+ * group refuses rejects with code `UPGRADE_FAILED` (422), and one a
2710
+ * replica's node is too old to run with {@link RuntimeTooOld} (409).
2695
2711
  * Where owners hold app upgrades, the node asks for the approval of
2696
2712
  * whoever the package's manifest names (`412 CONFIRM_REQUIRED`), which
2697
2713
  * `passkey` gives. Refused (`403`) to a session opened on an app's
@@ -3141,6 +3157,20 @@ var CalimeroClient = class _CalimeroClient {
3141
3157
  async setCapabilities(org, capabilities, passkey, at = {}) {
3142
3158
  await this.postConfirmed(`orgs/${seg(org)}/capabilities`, { capabilities, ...at }, passkey);
3143
3159
  }
3160
+ /**
3161
+ * Give a member every app added to the organization from now on, or stop
3162
+ * it (`allApps: false`), core `POST /orgs/{org}/all-apps`: the owner's or
3163
+ * an admin's, approved with `passkey` (`__set_all_apps { account, allApps
3164
+ * }`). Each app team made after gives them a row, so in an organization
3165
+ * that keeps its apps apart a new app reaches them though nobody named
3166
+ * them; apps already there are untouched. {@link invite} with
3167
+ * `{ allApps: true }` gives it to whoever redeems the invite. A member
3168
+ * below admin is refused (`403`), someone outside gets {@link NotFound};
3169
+ * a node from before the route answers a bare `404`.
3170
+ */
3171
+ async setAllApps(org, account, allApps, passkey) {
3172
+ await this.postConfirmed(`orgs/${seg(org)}/all-apps`, { account, allApps }, passkey);
3173
+ }
3144
3174
  /**
3145
3175
  * Set the capability bits everyone in `team` holds there on top of their
3146
3176
  * own, unless their row sets its own (`POST /orgs/{org}/capabilities` with
@@ -3841,6 +3871,7 @@ export {
3841
3871
  RELEASE_VERIFIER,
3842
3872
  RecoveryNotReady,
3843
3873
  ReleaseDeadlineError,
3874
+ RuntimeTooOld,
3844
3875
  SEALED_CONTENT_TYPE,
3845
3876
  SEALED_PATH,
3846
3877
  SealedTransportError,