@calimero-network/mero-js 35.2.0 → 35.2.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
@@ -4808,12 +4808,7 @@ async function exportFileTo(transport, app, id, sink, signal, recipientSecret) {
4808
4808
  }
4809
4809
  async function exportChecked(transport, app, id, sink, signal, recipientSecret) {
4810
4810
  const recipient = await x25519KeyPair(recipientSecret);
4811
- const answer = checked(
4812
- await transport.json("POST", routePath("apps/{app}/files/{id}/export", { app, id }), {
4813
- body: { recipient: hex(recipient.publicKey) },
4814
- signal
4815
- })
4816
- );
4811
+ const answer = checked(await transport.exportsExport({ app, id, recipient: hex(recipient.publicKey) }, { signal }));
4817
4812
  const { segments, named } = answer;
4818
4813
  if (segments.length === 0 || hex(await fileId(segments)) !== hex(named) || hex(named) !== id) {
4819
4814
  throw new ExportError("NOT_THE_FILE", `the node answered segments that are not the file ${id}`);
@@ -5344,17 +5339,20 @@ var CalimeroClient = class _CalimeroClient {
5344
5339
  async downloadBlob(app, id) {
5345
5340
  return new Uint8Array(await (await this.apps.blobDownload({ app, id })).arrayBuffer());
5346
5341
  }
5342
+ get exportClient() {
5343
+ return { exportsExport: this.apps.exportsExport, request: this.transport.request.bind(this.transport) };
5344
+ }
5347
5345
  /**
5348
5346
  * Write the plaintext of sealed file `id` of component app `app` to `sink`, checked against its id,
5349
5347
  * size and hash. On rejection, discard what `sink` received: it is authentic but may be a prefix of
5350
5348
  * the file. A failed check is an `ExportError`; `signal` aborts the download.
5351
5349
  */
5352
5350
  exportFileTo(app, id, sink, signal) {
5353
- return exportFileTo(this.transport, app, id, sink, signal);
5351
+ return exportFileTo(this.exportClient, app, id, sink, signal);
5354
5352
  }
5355
5353
  /** The plaintext of sealed file `id` of component app `app`, in memory; use {@link exportFileTo} for a large one. */
5356
5354
  exportFile(app, id, signal) {
5357
- return exportFile(this.transport, app, id, signal);
5355
+ return exportFile(this.exportClient, app, id, signal);
5358
5356
  }
5359
5357
  /**
5360
5358
  * Download a component app's blob with a grant one of its runs handed out