@calimero-network/mero-js 3.0.0 → 3.0.1

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
@@ -817,11 +817,9 @@ var AdminApiClient = class {
817
817
  * context as stranded.
818
818
  */
819
819
  async resyncContext(contextId, request = {}) {
820
- return unwrap(
821
- await this.httpClient.post(
822
- `/admin-api/contexts/${contextId}/resync`,
823
- request
824
- )
820
+ return this.httpClient.post(
821
+ `/admin-api/contexts/${contextId}/resync`,
822
+ request
825
823
  );
826
824
  }
827
825
  async inviteSpecializedNode(request) {
@@ -847,7 +845,10 @@ var AdminApiClient = class {
847
845
  return unwrap(await this.httpClient.put("/admin-api/blobs", data));
848
846
  }
849
847
  async deleteBlob(blobId) {
850
- return unwrap(await this.httpClient.delete(`/admin-api/blobs/${blobId}`));
848
+ const body = await this.httpClient.delete(
849
+ `/admin-api/blobs/${blobId}`
850
+ );
851
+ return { blobId: body.blob_id, deleted: body.deleted };
851
852
  }
852
853
  async listBlobs() {
853
854
  return unwrap(await this.httpClient.get("/admin-api/blobs"));
@@ -1366,9 +1367,9 @@ var SseClient = class {
1366
1367
  */
1367
1368
  onAppVersionChanged(handler) {
1368
1369
  const listener = (ev) => {
1370
+ if (ev.type !== "AppVersionChanged") return;
1369
1371
  const d = ev.data;
1370
- if (d?.type !== "AppVersionChanged") return;
1371
- handler({ contextId: ev.contextId, fromVersion: d.data?.fromVersion, toVersion: d.data?.toVersion });
1372
+ handler({ contextId: ev.contextId, fromVersion: d?.fromVersion, toVersion: d?.toVersion });
1372
1373
  };
1373
1374
  this.on("event", listener);
1374
1375
  return () => this.off("event", listener);
@@ -1477,6 +1478,9 @@ var SseClient = class {
1477
1478
  }
1478
1479
  this.emit("event", {
1479
1480
  contextId: msg.result.contextId,
1481
+ // Forward the event tag (sibling of `data` in core's flattened
1482
+ // payload) so typed helpers like `onAppVersionChanged` can discriminate.
1483
+ type: msg.result.type,
1480
1484
  data: eventData
1481
1485
  });
1482
1486
  }