@calimero-network/mero-js 2.5.1 → 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
@@ -794,6 +794,16 @@ var AdminApiClient = class {
794
794
  async getApplication(appId) {
795
795
  return unwrap(await this.httpClient.get(`/admin-api/applications/${appId}`));
796
796
  }
797
+ /**
798
+ * Installed-blob inventory for an application — one entry per locally installed
799
+ * version. This is the *installed* inventory (source for a "pick a version to
800
+ * pin" UI); the registry equivalent is `listPackageVersions`.
801
+ */
802
+ async listApplicationVersions(applicationId) {
803
+ return unwrap(
804
+ await this.httpClient.get(`/admin-api/applications/${applicationId}/versions`)
805
+ );
806
+ }
797
807
  // ---- Package Management ----
798
808
  async listPackages() {
799
809
  return unwrap(await this.httpClient.get("/admin-api/packages"));
@@ -861,6 +871,17 @@ var AdminApiClient = class {
861
871
  async syncContext(contextId) {
862
872
  await this.httpClient.post(`/admin-api/contexts/sync/${contextId ?? ""}`, {});
863
873
  }
874
+ /**
875
+ * Kick off a full state re-pull for a context (operator recovery for a
876
+ * stranded context). `force` re-pulls even when the node does not flag the
877
+ * context as stranded.
878
+ */
879
+ async resyncContext(contextId, request = {}) {
880
+ return this.httpClient.post(
881
+ `/admin-api/contexts/${contextId}/resync`,
882
+ request
883
+ );
884
+ }
864
885
  async inviteSpecializedNode(request) {
865
886
  return unwrap(
866
887
  await this.httpClient.post(
@@ -884,7 +905,10 @@ var AdminApiClient = class {
884
905
  return unwrap(await this.httpClient.put("/admin-api/blobs", data));
885
906
  }
886
907
  async deleteBlob(blobId) {
887
- 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 };
888
912
  }
889
913
  async listBlobs() {
890
914
  return unwrap(await this.httpClient.get("/admin-api/blobs"));
@@ -1403,9 +1427,9 @@ var SseClient = class {
1403
1427
  */
1404
1428
  onAppVersionChanged(handler) {
1405
1429
  const listener = (ev) => {
1430
+ if (ev.type !== "AppVersionChanged") return;
1406
1431
  const d = ev.data;
1407
- if (d?.type !== "AppVersionChanged") return;
1408
- handler({ contextId: ev.contextId, fromVersion: d.data?.fromVersion, toVersion: d.data?.toVersion });
1432
+ handler({ contextId: ev.contextId, fromVersion: d?.fromVersion, toVersion: d?.toVersion });
1409
1433
  };
1410
1434
  this.on("event", listener);
1411
1435
  return () => this.off("event", listener);
@@ -1514,6 +1538,9 @@ var SseClient = class {
1514
1538
  }
1515
1539
  this.emit("event", {
1516
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,
1517
1544
  data: eventData
1518
1545
  });
1519
1546
  }