@calimero-network/mero-js 6.0.3 → 6.1.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
@@ -899,10 +899,11 @@ var AdminApiClient = class {
899
899
  * context as stranded.
900
900
  */
901
901
  async resyncContext(contextId, request = {}) {
902
- return this.httpClient.post(
902
+ const r = await this.httpClient.post(
903
903
  `/admin-api/contexts/${contextId}/resync`,
904
904
  request
905
905
  );
906
+ return r ?? { contextId, resyncStarted: true };
906
907
  }
907
908
  async inviteSpecializedNode(request) {
908
909
  return unwrap(
@@ -950,13 +951,30 @@ var AdminApiClient = class {
950
951
  );
951
952
  return { blobs: res.blobs.map((b) => ({ blobId: b.blob_id, size: b.size })) };
952
953
  }
954
+ /**
955
+ * Download a blob's raw bytes. `GET /admin-api/blobs/:id` streams the blob
956
+ * content (e.g. `application/gzip`), NOT JSON — so fetch it as an ArrayBuffer.
957
+ * Use {@link listBlobs} for `{ blobId, size }` metadata.
958
+ */
953
959
  async getBlob(blobId) {
954
- const res = unwrap(
955
- await this.httpClient.get(
956
- `/admin-api/blobs/${blobId}`
957
- )
958
- );
959
- return { blobId: res.blob_id, size: res.size };
960
+ return this.httpClient.get(`/admin-api/blobs/${blobId}`, {
961
+ parse: "arrayBuffer"
962
+ });
963
+ }
964
+ /**
965
+ * Fetch a blob's metadata without downloading it. `HEAD /admin-api/blobs/:id`
966
+ * returns the info in response headers (size via `content-length`, plus
967
+ * `x-blob-id`/`x-blob-hash`/`x-blob-mime-type`).
968
+ */
969
+ async getBlobInfo(blobId) {
970
+ const { headers } = await this.httpClient.head(`/admin-api/blobs/${blobId}`);
971
+ const size = Number(headers["content-length"]);
972
+ return {
973
+ blobId: headers["x-blob-id"] ?? blobId,
974
+ size: Number.isFinite(size) ? size : 0,
975
+ hash: headers["x-blob-hash"],
976
+ mimeType: headers["x-blob-mime-type"]
977
+ };
960
978
  }
961
979
  // ---- Alias Management ----
962
980
  async createContextAlias(request) {
@@ -1165,6 +1183,10 @@ var AdminApiClient = class {
1165
1183
  async setTeeAdmissionPolicy(groupId, request) {
1166
1184
  await this.httpClient.put(`/admin-api/groups/${groupId}/settings/tee-admission-policy`, request);
1167
1185
  }
1186
+ async getTeeAdmissionPolicy(groupId) {
1187
+ const response = await this.httpClient.get(`/admin-api/groups/${groupId}/settings/tee-admission-policy`);
1188
+ return response.data ?? response;
1189
+ }
1168
1190
  async updateGroupSettings(groupId, request) {
1169
1191
  await this.httpClient.patch(`/admin-api/groups/${groupId}`, request);
1170
1192
  }
@@ -1819,6 +1841,9 @@ var _WsClient = class _WsClient {
1819
1841
  }
1820
1842
  this.emit("event", {
1821
1843
  contextId: msg.result.contextId,
1844
+ // Forward the event tag (sibling of `data` in core's flattened
1845
+ // payload) so consumers can discriminate, matching `SseClient`.
1846
+ type: msg.result.type,
1822
1847
  data: eventData
1823
1848
  });
1824
1849
  }