@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.cjs CHANGED
@@ -929,6 +929,14 @@ var AdminApiClient = class {
929
929
  async healthCheck() {
930
930
  return unwrap(await this.httpClient.get("/admin-api/health"));
931
931
  }
932
+ /**
933
+ * Whether the node has finished starting and its store answers. Public, like
934
+ * {@link healthCheck}; unlike it, a node that is up but not ready answers
935
+ * `503`, which this surfaces as an `HTTPError` whose body names the stage.
936
+ */
937
+ async readinessCheck() {
938
+ return unwrap(await this.httpClient.get("/admin-api/ready"));
939
+ }
932
940
  async isAuthed() {
933
941
  return this.httpClient.get("/admin-api/is-authed");
934
942
  }
@@ -1323,6 +1331,23 @@ var AdminApiClient = class {
1323
1331
  )
1324
1332
  );
1325
1333
  }
1334
+ /**
1335
+ * Read a context as the session's ACCOUNT, without minting a warrant.
1336
+ *
1337
+ * Needs an account-authenticated session — one from {@link login}, not the
1338
+ * admin password login — and refuses otherwise with a `401`. The account must
1339
+ * be a member of the group owning the context (`403` if not), and the method
1340
+ * must be declared read-only in the app's ABI (`409` if not; a write needs
1341
+ * {@link performIntent}).
1342
+ */
1343
+ async queryContext(contextId, request) {
1344
+ return unwrap(
1345
+ await this.httpClient.post(
1346
+ `/admin-api/contexts/${contextId}/query`,
1347
+ request
1348
+ )
1349
+ );
1350
+ }
1326
1351
  /**
1327
1352
  * Ask what this node can do for a member in `contextId`, before they sign
1328
1353
  * anything.
@@ -1645,6 +1670,32 @@ var AdminApiClient = class {
1645
1670
  }
1646
1671
  return response;
1647
1672
  }
1673
+ /**
1674
+ * Member accounts in the group and the devices bound to each. An admin node
1675
+ * sees every account; a plain member only its own. `403` if this node is not a
1676
+ * member of the group.
1677
+ */
1678
+ async listMemberDevices(groupId, options = {}) {
1679
+ const params = new URLSearchParams();
1680
+ if (options.offset !== void 0) params.set("offset", String(options.offset));
1681
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
1682
+ const query = params.toString();
1683
+ const path = `/admin-api/groups/${groupId}/member-devices${query ? `?${query}` : ""}`;
1684
+ return this.httpClient.get(path);
1685
+ }
1686
+ /**
1687
+ * Seal a small payload to a member account's root key. This node must be a
1688
+ * member of the group, and `account` must be an account the group knows, so
1689
+ * the route reaches no further than the caller already does.
1690
+ */
1691
+ async sealToAccount(groupId, account, request) {
1692
+ return unwrap(
1693
+ await this.httpClient.post(
1694
+ `/admin-api/groups/${groupId}/accounts/${account}/seal`,
1695
+ request
1696
+ )
1697
+ );
1698
+ }
1648
1699
  async listGroupContexts(groupId) {
1649
1700
  return unwrap(await this.httpClient.get(`/admin-api/groups/${groupId}/contexts`));
1650
1701
  }