@whaly/connector-sdk 0.3.9 → 0.3.10

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
@@ -10853,6 +10853,16 @@ function getMimeType(filePathOrExt) {
10853
10853
  const ext = filePathOrExt.startsWith(".") ? filePathOrExt.toLowerCase() : path.extname(filePathOrExt).toLowerCase();
10854
10854
  return MIME_TYPES[ext] ?? "application/octet-stream";
10855
10855
  }
10856
+ var EXTENSION_BY_MIME = Object.entries(MIME_TYPES).reduce(
10857
+ (acc, [ext, mime]) => {
10858
+ if (!acc[mime]) acc[mime] = ext;
10859
+ return acc;
10860
+ },
10861
+ {}
10862
+ );
10863
+ function getExtension(mimeType) {
10864
+ return EXTENSION_BY_MIME[mimeType] ?? ".bin";
10865
+ }
10856
10866
 
10857
10867
  // src/sdk/models/replication.ts
10858
10868
  var ReplicationMethod = /* @__PURE__ */ ((ReplicationMethod2) => {
@@ -14054,6 +14064,13 @@ var AssetTap = class {
14054
14064
  const inspectPath = path5.join(this.outputDir, stream.streamId, entry.destinationPath);
14055
14065
  await fs6.ensureDir(path5.dirname(inspectPath));
14056
14066
  await fs6.copy(uploadPath, inspectPath);
14067
+ if (wasTransformed) {
14068
+ const baseName = path5.basename(entry.destinationPath, path5.extname(entry.destinationPath));
14069
+ const origExt = getExtension(entry.contentType);
14070
+ const originalPath = path5.join(this.outputDir, "originals", `${baseName}${origExt}`);
14071
+ await fs6.ensureDir(path5.dirname(originalPath));
14072
+ await fs6.copy(downloadedPath, originalPath);
14073
+ }
14057
14074
  }
14058
14075
  assetEntries.push({
14059
14076
  sourcePath: entry.sourcePath,
@@ -15473,6 +15490,7 @@ export {
15473
15490
  getCounterMetrics,
15474
15491
  getDownloadFileApiCall,
15475
15492
  getDryRunLimit,
15493
+ getExtension,
15476
15494
  getJSONApiCall,
15477
15495
  getJSONApiCallWithFullResponse,
15478
15496
  getMimeType,