@calimero-network/mero-js 19.24.1 → 19.25.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
@@ -823,6 +823,14 @@ var AdminApiClient = class {
823
823
  async healthCheck() {
824
824
  return unwrap(await this.httpClient.get("/admin-api/health"));
825
825
  }
826
+ /**
827
+ * Whether the node has finished starting and its store answers. Public, like
828
+ * {@link healthCheck}; unlike it, a node that is up but not ready answers
829
+ * `503`, which this surfaces as an `HTTPError` whose body names the stage.
830
+ */
831
+ async readinessCheck() {
832
+ return unwrap(await this.httpClient.get("/admin-api/ready"));
833
+ }
826
834
  async isAuthed() {
827
835
  return this.httpClient.get("/admin-api/is-authed");
828
836
  }
@@ -1217,6 +1225,23 @@ var AdminApiClient = class {
1217
1225
  )
1218
1226
  );
1219
1227
  }
1228
+ /**
1229
+ * Read a context as the session's ACCOUNT, without minting a warrant.
1230
+ *
1231
+ * Needs an account-authenticated session — one from {@link login}, not the
1232
+ * admin password login — and refuses otherwise with a `401`. The account must
1233
+ * be a member of the group owning the context (`403` if not), and the method
1234
+ * must be declared read-only in the app's ABI (`409` if not; a write needs
1235
+ * {@link performIntent}).
1236
+ */
1237
+ async queryContext(contextId, request) {
1238
+ return unwrap(
1239
+ await this.httpClient.post(
1240
+ `/admin-api/contexts/${contextId}/query`,
1241
+ request
1242
+ )
1243
+ );
1244
+ }
1220
1245
  /**
1221
1246
  * Ask what this node can do for a member in `contextId`, before they sign
1222
1247
  * anything.
@@ -1539,6 +1564,32 @@ var AdminApiClient = class {
1539
1564
  }
1540
1565
  return response;
1541
1566
  }
1567
+ /**
1568
+ * Member accounts in the group and the devices bound to each. An admin node
1569
+ * sees every account; a plain member only its own. `403` if this node is not a
1570
+ * member of the group.
1571
+ */
1572
+ async listMemberDevices(groupId, options = {}) {
1573
+ const params = new URLSearchParams();
1574
+ if (options.offset !== void 0) params.set("offset", String(options.offset));
1575
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
1576
+ const query = params.toString();
1577
+ const path = `/admin-api/groups/${groupId}/member-devices${query ? `?${query}` : ""}`;
1578
+ return this.httpClient.get(path);
1579
+ }
1580
+ /**
1581
+ * Seal a small payload to a member account's root key. This node must be a
1582
+ * member of the group, and `account` must be an account the group knows, so
1583
+ * the route reaches no further than the caller already does.
1584
+ */
1585
+ async sealToAccount(groupId, account, request) {
1586
+ return unwrap(
1587
+ await this.httpClient.post(
1588
+ `/admin-api/groups/${groupId}/accounts/${account}/seal`,
1589
+ request
1590
+ )
1591
+ );
1592
+ }
1542
1593
  async listGroupContexts(groupId) {
1543
1594
  return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}/contexts`));
1544
1595
  }