@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.mjs CHANGED
@@ -734,6 +734,16 @@ var AdminApiClient = class {
734
734
  async getApplication(appId) {
735
735
  return unwrap(await this.httpClient.get(`/admin-api/applications/${appId}`));
736
736
  }
737
+ /**
738
+ * Installed-blob inventory for an application — one entry per locally installed
739
+ * version. This is the *installed* inventory (source for a "pick a version to
740
+ * pin" UI); the registry equivalent is `listPackageVersions`.
741
+ */
742
+ async listApplicationVersions(applicationId) {
743
+ return unwrap(
744
+ await this.httpClient.get(`/admin-api/applications/${applicationId}/versions`)
745
+ );
746
+ }
737
747
  // ---- Package Management ----
738
748
  async listPackages() {
739
749
  return unwrap(await this.httpClient.get("/admin-api/packages"));
@@ -801,6 +811,17 @@ var AdminApiClient = class {
801
811
  async syncContext(contextId) {
802
812
  await this.httpClient.post(`/admin-api/contexts/sync/${contextId ?? ""}`, {});
803
813
  }
814
+ /**
815
+ * Kick off a full state re-pull for a context (operator recovery for a
816
+ * stranded context). `force` re-pulls even when the node does not flag the
817
+ * context as stranded.
818
+ */
819
+ async resyncContext(contextId, request = {}) {
820
+ return this.httpClient.post(
821
+ `/admin-api/contexts/${contextId}/resync`,
822
+ request
823
+ );
824
+ }
804
825
  async inviteSpecializedNode(request) {
805
826
  return unwrap(
806
827
  await this.httpClient.post(
@@ -824,7 +845,10 @@ var AdminApiClient = class {
824
845
  return unwrap(await this.httpClient.put("/admin-api/blobs", data));
825
846
  }
826
847
  async deleteBlob(blobId) {
827
- 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 };
828
852
  }
829
853
  async listBlobs() {
830
854
  return unwrap(await this.httpClient.get("/admin-api/blobs"));
@@ -1343,9 +1367,9 @@ var SseClient = class {
1343
1367
  */
1344
1368
  onAppVersionChanged(handler) {
1345
1369
  const listener = (ev) => {
1370
+ if (ev.type !== "AppVersionChanged") return;
1346
1371
  const d = ev.data;
1347
- if (d?.type !== "AppVersionChanged") return;
1348
- handler({ contextId: ev.contextId, fromVersion: d.data?.fromVersion, toVersion: d.data?.toVersion });
1372
+ handler({ contextId: ev.contextId, fromVersion: d?.fromVersion, toVersion: d?.toVersion });
1349
1373
  };
1350
1374
  this.on("event", listener);
1351
1375
  return () => this.off("event", listener);
@@ -1454,6 +1478,9 @@ var SseClient = class {
1454
1478
  }
1455
1479
  this.emit("event", {
1456
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,
1457
1484
  data: eventData
1458
1485
  });
1459
1486
  }