@almadar/integrations 2.28.0 → 2.30.0

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.
@@ -1,5 +1,5 @@
1
1
  import { g as IntegrationParams, I as IntegrationCallContext, d as IntegrationFactory } from '../BaseIntegration-C_5q54DM.js';
2
- import { o as IntegrationName, m as IntegrationActionName, n as IntegrationContracts, e as CredentialStore } from '../store-tehIm2rt.js';
2
+ import { o as IntegrationName, m as IntegrationActionName, n as IntegrationContracts, e as CredentialStore } from '../store-eq1-GfDi.js';
3
3
  import '@almadar/core';
4
4
 
5
5
  /**
@@ -4221,6 +4221,9 @@ var StorageIntegration = class extends BaseIntegration {
4221
4221
  case "upload":
4222
4222
  data = await this.executeWithRetry(() => this.upload(params));
4223
4223
  break;
4224
+ case "uploadMany":
4225
+ data = await this.executeWithRetry(() => this.uploadMany(params));
4226
+ break;
4224
4227
  case "download":
4225
4228
  data = await this.executeWithRetry(() => this.download(params));
4226
4229
  break;
@@ -4332,9 +4335,41 @@ var StorageIntegration = class extends BaseIntegration {
4332
4335
  etag
4333
4336
  });
4334
4337
  }
4335
- const url = acl === "public-read" ? this.publicUrl(bucket, key) : (await this.signUrl(bucket, key, "get", 3600)).url;
4338
+ const url = this.s3 ? acl === "public-read" ? this.publicUrl(bucket, key) : (await this.signUrl(bucket, key, "get", 3600)).url : `data:${contentType};base64,${bytes.toString("base64")}`;
4336
4339
  return { key, bucket, size: bytes.length, etag, id: key, url };
4337
4340
  }
4341
+ /**
4342
+ * Upload a whole UploadDropZone batch in one action — the FSM-friendly
4343
+ * shape for multi-file atoms (std-image-upload-multi): one call-service
4344
+ * arm in, one bulk-persistable `items` array out. Each item carries
4345
+ * id/url plus the name/sizeBytes/mimeType columns an uploaded-file row
4346
+ * declares.
4347
+ */
4348
+ async uploadMany(params) {
4349
+ const rawFiles = Array.isArray(params.files) ? params.files : [];
4350
+ const files = rawFiles.map((f) => toFilePayload(f)).filter((f) => f !== null);
4351
+ if (files.length === 0) {
4352
+ throw new Error("uploadMany requires a non-empty `files` array (UploadDropZone batch shape)");
4353
+ }
4354
+ const items = [];
4355
+ for (const file of files) {
4356
+ const result = await this.upload({
4357
+ bucket: params.bucket,
4358
+ file: { name: file.name, size: file.size, type: file.type, content: file.content },
4359
+ acl: params.acl,
4360
+ maxSize: params.maxSize
4361
+ });
4362
+ items.push({
4363
+ id: result.id,
4364
+ key: result.key,
4365
+ url: result.url,
4366
+ name: file.name,
4367
+ sizeBytes: file.size,
4368
+ mimeType: file.type
4369
+ });
4370
+ }
4371
+ return { items, count: items.length };
4372
+ }
4338
4373
  async download(params) {
4339
4374
  const bucket = this.bucketOf(params);
4340
4375
  const key = params.key;