@calimero-network/mero-js 26.6.0 → 26.8.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
@@ -1832,6 +1832,21 @@ var AdminApiClient = class {
1832
1832
  }
1833
1833
  return data;
1834
1834
  }
1835
+ /**
1836
+ * Bring back a namespace the user removed from this node while the account
1837
+ * stayed a member (POST /admin-api/namespaces/:namespace_id/join, no
1838
+ * invitation). Such namespaces are the `forgotten` ones in
1839
+ * {@link listNamespacesForApplication}.
1840
+ */
1841
+ async restoreNamespace(namespaceId) {
1842
+ return unwrap(
1843
+ await this.httpClient.post(
1844
+ `/admin-api/namespaces/${pathSegment(namespaceId)}/join`,
1845
+ {},
1846
+ { timeoutMs: 65e3 }
1847
+ )
1848
+ );
1849
+ }
1835
1850
  /**
1836
1851
  * Join the namespace an invitation grants, and say what happened — including
1837
1852
  * when the request failed but the join landed anyway.
@@ -2520,9 +2535,15 @@ var AdminApiClient = class {
2520
2535
  async leaveContext(contextId) {
2521
2536
  await this.httpClient.post(`/admin-api/contexts/${pathSegment(contextId)}/leave`, {});
2522
2537
  }
2523
- /** Leave a namespace (POST /admin-api/namespaces/:namespace_id/leave). */
2524
- async leaveNamespace(namespaceId) {
2525
- await this.httpClient.post(`/admin-api/namespaces/${pathSegment(namespaceId)}/leave`, {});
2538
+ /**
2539
+ * Leave a namespace (POST /admin-api/namespaces/:namespace_id/leave).
2540
+ *
2541
+ * With `purge`, every device of the account also takes the namespace off its
2542
+ * disk. Core reads `purge` from the query string, so it is not in the body.
2543
+ */
2544
+ async leaveNamespace(namespaceId, options = {}) {
2545
+ const query = options.purge ? "?purge=true" : "";
2546
+ await this.httpClient.post(`/admin-api/namespaces/${pathSegment(namespaceId)}/leave${query}`, {});
2526
2547
  }
2527
2548
  /** Issue a group ownership proof (POST /admin-api/groups/:group_id/issue-ownership-proof). */
2528
2549
  async issueOwnershipProof(groupId, request) {
@@ -13114,8 +13135,9 @@ async function verifySignedAgentPolicy(policy, bundle, options = {}) {
13114
13135
  } catch {
13115
13136
  throw new Error("The signed agent policy is not JSON");
13116
13137
  }
13117
- if (parsed?.role !== "agent") {
13118
- throw new Error(`The signed file is a ${JSON.stringify(parsed?.role)} policy, not an agent one`);
13138
+ const role2 = options.role ?? "agent";
13139
+ if (parsed?.role !== role2) {
13140
+ throw new Error(`The signed file is a ${JSON.stringify(parsed?.role)} policy, not an ${role2} one`);
13119
13141
  }
13120
13142
  const profile = options.profile ?? PRODUCTION_PROFILE;
13121
13143
  if (parsed.profile !== profile) {