@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.cjs CHANGED
@@ -877,11 +877,9 @@ var AdminApiClient = class {
877
877
  * context as stranded.
878
878
  */
879
879
  async resyncContext(contextId, request = {}) {
880
- return unwrap(
881
- await this.httpClient.post(
882
- `/admin-api/contexts/${contextId}/resync`,
883
- request
884
- )
880
+ return this.httpClient.post(
881
+ `/admin-api/contexts/${contextId}/resync`,
882
+ request
885
883
  );
886
884
  }
887
885
  async inviteSpecializedNode(request) {
@@ -907,7 +905,10 @@ var AdminApiClient = class {
907
905
  return unwrap(await this.httpClient.put("/admin-api/blobs", data));
908
906
  }
909
907
  async deleteBlob(blobId) {
910
- return unwrap(await this.httpClient.delete(`/admin-api/blobs/${blobId}`));
908
+ const body = await this.httpClient.delete(
909
+ `/admin-api/blobs/${blobId}`
910
+ );
911
+ return { blobId: body.blob_id, deleted: body.deleted };
911
912
  }
912
913
  async listBlobs() {
913
914
  return unwrap(await this.httpClient.get("/admin-api/blobs"));
@@ -1426,9 +1427,9 @@ var SseClient = class {
1426
1427
  */
1427
1428
  onAppVersionChanged(handler) {
1428
1429
  const listener = (ev) => {
1430
+ if (ev.type !== "AppVersionChanged") return;
1429
1431
  const d = ev.data;
1430
- if (d?.type !== "AppVersionChanged") return;
1431
- handler({ contextId: ev.contextId, fromVersion: d.data?.fromVersion, toVersion: d.data?.toVersion });
1432
+ handler({ contextId: ev.contextId, fromVersion: d?.fromVersion, toVersion: d?.toVersion });
1432
1433
  };
1433
1434
  this.on("event", listener);
1434
1435
  return () => this.off("event", listener);
@@ -1537,6 +1538,9 @@ var SseClient = class {
1537
1538
  }
1538
1539
  this.emit("event", {
1539
1540
  contextId: msg.result.contextId,
1541
+ // Forward the event tag (sibling of `data` in core's flattened
1542
+ // payload) so typed helpers like `onAppVersionChanged` can discriminate.
1543
+ type: msg.result.type,
1540
1544
  data: eventData
1541
1545
  });
1542
1546
  }