@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.cjs CHANGED
@@ -68,6 +68,7 @@ __export(index_exports, {
68
68
  RELEASE_VERIFIER: () => RELEASE_VERIFIER,
69
69
  RecoveryNotReady: () => RecoveryNotReady,
70
70
  ReleaseDeadlineError: () => ReleaseDeadlineError,
71
+ RuntimeTooOld: () => RuntimeTooOld,
71
72
  SEALED_CONTENT_TYPE: () => SEALED_CONTENT_TYPE,
72
73
  SEALED_PATH: () => SEALED_PATH,
73
74
  SealedTransportError: () => SealedTransportError,
@@ -1539,6 +1540,14 @@ var ReleaseDeadlineError = class extends CalimeroError {
1539
1540
  this.after = typeof details.after === "string" ? details.after : "";
1540
1541
  }
1541
1542
  };
1543
+ var RuntimeTooOld = class extends CalimeroError {
1544
+ constructor(message, details = {}) {
1545
+ super(409, "RUNTIME_TOO_OLD", message, details);
1546
+ this.name = "RuntimeTooOld";
1547
+ this.minRuntimeVersion = typeof details.minRuntimeVersion === "string" ? details.minRuntimeVersion : "";
1548
+ this.nodes = Array.isArray(details.nodes) ? details.nodes : [];
1549
+ }
1550
+ };
1542
1551
  var ConsentStale = class extends CalimeroError {
1543
1552
  constructor(message, details = {}) {
1544
1553
  super(409, "CONSENT_STALE", message, details);
@@ -1674,6 +1683,8 @@ function errorFrom(status, body, retryAfterHeader) {
1674
1683
  return new IdempotencyMismatch(message, details);
1675
1684
  case "409 RELEASE_DEADLINE":
1676
1685
  return new ReleaseDeadlineError(message, details);
1686
+ case "409 RUNTIME_TOO_OLD":
1687
+ return new RuntimeTooOld(message, details);
1677
1688
  case "409 CONSENT_STALE":
1678
1689
  return new ConsentStale(message, details);
1679
1690
  case "403 ORIGIN_NOT_REGISTERED":
@@ -1941,12 +1952,16 @@ function pendingApprovalsFrom(report, rules, now = Date.now() / 1e3) {
1941
1952
  for (const a of report.apps) {
1942
1953
  const available = a.availableVersions ?? [];
1943
1954
  if (a.package === null || available.length === 0) continue;
1955
+ const latest = available[available.length - 1];
1956
+ const reachable = a.latestReachable === void 0 ? latest : a.latestReachable;
1944
1957
  upgrades.push({
1945
1958
  app: a.app,
1946
1959
  name: a.name ?? null,
1947
1960
  package: a.package.package,
1948
1961
  from: a.package.version,
1949
- to: available[available.length - 1],
1962
+ to: reachable ?? latest,
1963
+ reachable: reachable !== null,
1964
+ blocked: a.latestBlocked ?? null,
1950
1965
  available,
1951
1966
  actionable: upgradesActionable
1952
1967
  });
@@ -2823,8 +2838,10 @@ var CalimeroClient = class _CalimeroClient {
2823
2838
  }
2824
2839
  /**
2825
2840
  * Move an app to another release of its package (`{ version }`), another
2826
- * package, or a bundle hash, running its migration. Answers the upgrade's
2827
- * entry; a failed migration rejects with code `UPGRADE_FAILED` (422).
2841
+ * package, or a bundle hash. An upgrade is code only: the app moves to any
2842
+ * newer release in one step. Answers the upgrade's entry; one the app's
2843
+ * group refuses rejects with code `UPGRADE_FAILED` (422), and one a
2844
+ * replica's node is too old to run with {@link RuntimeTooOld} (409).
2828
2845
  * Where owners hold app upgrades, the node asks for the approval of
2829
2846
  * whoever the package's manifest names (`412 CONFIRM_REQUIRED`), which
2830
2847
  * `passkey` gives. Refused (`403`) to a session opened on an app's
@@ -3274,6 +3291,20 @@ var CalimeroClient = class _CalimeroClient {
3274
3291
  async setCapabilities(org, capabilities, passkey, at = {}) {
3275
3292
  await this.postConfirmed(`orgs/${seg(org)}/capabilities`, { capabilities, ...at }, passkey);
3276
3293
  }
3294
+ /**
3295
+ * Give a member every app added to the organization from now on, or stop
3296
+ * it (`allApps: false`), core `POST /orgs/{org}/all-apps`: the owner's or
3297
+ * an admin's, approved with `passkey` (`__set_all_apps { account, allApps
3298
+ * }`). Each app team made after gives them a row, so in an organization
3299
+ * that keeps its apps apart a new app reaches them though nobody named
3300
+ * them; apps already there are untouched. {@link invite} with
3301
+ * `{ allApps: true }` gives it to whoever redeems the invite. A member
3302
+ * below admin is refused (`403`), someone outside gets {@link NotFound};
3303
+ * a node from before the route answers a bare `404`.
3304
+ */
3305
+ async setAllApps(org, account, allApps, passkey) {
3306
+ await this.postConfirmed(`orgs/${seg(org)}/all-apps`, { account, allApps }, passkey);
3307
+ }
3277
3308
  /**
3278
3309
  * Set the capability bits everyone in `team` holds there on top of their
3279
3310
  * own, unless their row sets its own (`POST /orgs/{org}/capabilities` with