@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.cjs CHANGED
@@ -2130,6 +2130,21 @@ var AdminApiClient = class {
2130
2130
  }
2131
2131
  return data;
2132
2132
  }
2133
+ /**
2134
+ * Bring back a namespace the user removed from this node while the account
2135
+ * stayed a member (POST /admin-api/namespaces/:namespace_id/join, no
2136
+ * invitation). Such namespaces are the `forgotten` ones in
2137
+ * {@link listNamespacesForApplication}.
2138
+ */
2139
+ async restoreNamespace(namespaceId) {
2140
+ return unwrap(
2141
+ await this.httpClient.post(
2142
+ `/admin-api/namespaces/${pathSegment(namespaceId)}/join`,
2143
+ {},
2144
+ { timeoutMs: 65e3 }
2145
+ )
2146
+ );
2147
+ }
2133
2148
  /**
2134
2149
  * Join the namespace an invitation grants, and say what happened — including
2135
2150
  * when the request failed but the join landed anyway.
@@ -2818,9 +2833,15 @@ var AdminApiClient = class {
2818
2833
  async leaveContext(contextId) {
2819
2834
  await this.httpClient.post(`/admin-api/contexts/${pathSegment(contextId)}/leave`, {});
2820
2835
  }
2821
- /** Leave a namespace (POST /admin-api/namespaces/:namespace_id/leave). */
2822
- async leaveNamespace(namespaceId) {
2823
- await this.httpClient.post(`/admin-api/namespaces/${pathSegment(namespaceId)}/leave`, {});
2836
+ /**
2837
+ * Leave a namespace (POST /admin-api/namespaces/:namespace_id/leave).
2838
+ *
2839
+ * With `purge`, every device of the account also takes the namespace off its
2840
+ * disk. Core reads `purge` from the query string, so it is not in the body.
2841
+ */
2842
+ async leaveNamespace(namespaceId, options = {}) {
2843
+ const query = options.purge ? "?purge=true" : "";
2844
+ await this.httpClient.post(`/admin-api/namespaces/${pathSegment(namespaceId)}/leave${query}`, {});
2824
2845
  }
2825
2846
  /** Issue a group ownership proof (POST /admin-api/groups/:group_id/issue-ownership-proof). */
2826
2847
  async issueOwnershipProof(groupId, request) {
@@ -13412,8 +13433,9 @@ async function verifySignedAgentPolicy(policy, bundle, options = {}) {
13412
13433
  } catch {
13413
13434
  throw new Error("The signed agent policy is not JSON");
13414
13435
  }
13415
- if (parsed?.role !== "agent") {
13416
- throw new Error(`The signed file is a ${JSON.stringify(parsed?.role)} policy, not an agent one`);
13436
+ const role2 = options.role ?? "agent";
13437
+ if (parsed?.role !== role2) {
13438
+ throw new Error(`The signed file is a ${JSON.stringify(parsed?.role)} policy, not an ${role2} one`);
13417
13439
  }
13418
13440
  const profile = options.profile ?? PRODUCTION_PROFILE;
13419
13441
  if (parsed.profile !== profile) {