@hoardodile/host 0.1.0 → 0.1.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.d.ts CHANGED
@@ -143,7 +143,12 @@ type PluginRegistry = {
143
143
  * workbench) omit it and the methods answer `UNAVAILABLE`.
144
144
  */
145
145
  type PluginAssetHandler = {
146
- readonly download: (pluginId: string, request: PluginDownloadRequest) => Promise<PluginDownloadResult>;
146
+ /**
147
+ * Download one request or a batch of requests. Answers with the
148
+ * result array (batch shape) — this adapter unwraps the single
149
+ * result for a single request (see {@link dispatchApi}).
150
+ */
151
+ readonly download: (pluginId: string, request: PluginDownloadRequest | readonly PluginDownloadRequest[]) => Promise<readonly PluginDownloadResult[]>;
147
152
  readonly statAsset: (pluginId: string, path: string) => Promise<{
148
153
  readonly sizeBytes: number;
149
154
  } | undefined>;
package/dist/index.js CHANGED
@@ -3004,10 +3004,9 @@ function createPluginSandbox(config = DEFAULT_SANDBOX_CONFIG) {
3004
3004
  return;
3005
3005
  }
3006
3006
  if (method === "download") {
3007
- respond(
3008
- true,
3009
- await handler.download(state.id, args[0])
3010
- );
3007
+ const request = args[0];
3008
+ const results = await handler.download(state.id, request);
3009
+ respond(true, Array.isArray(request) ? results : results[0]);
3011
3010
  } else if (method === "statAsset") {
3012
3011
  respond(true, await handler.statAsset(state.id, args[0]));
3013
3012
  } else if (method === "readAsset") {