@forzalabs/remora 1.2.2 → 1.2.3

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/index.js CHANGED
@@ -147,7 +147,7 @@ var require_has_flag = __commonJS({
147
147
  var require_supports_colors = __commonJS({
148
148
  "../../node_modules/logform/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module2) {
149
149
  "use strict";
150
- var os3 = require("os");
150
+ var os2 = require("os");
151
151
  var hasFlag = require_has_flag();
152
152
  var env = process.env;
153
153
  var forceColor = void 0;
@@ -185,7 +185,7 @@ var require_supports_colors = __commonJS({
185
185
  }
186
186
  var min = forceColor ? 1 : 0;
187
187
  if (process.platform === "win32") {
188
- var osRelease = os3.release().split(".");
188
+ var osRelease = os2.release().split(".");
189
189
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
190
190
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
191
191
  }
@@ -5429,7 +5429,7 @@ var require_winston_transport = __commonJS({
5429
5429
  var require_console = __commonJS({
5430
5430
  "../../packages/logger/node_modules/winston/lib/winston/transports/console.js"(exports2, module2) {
5431
5431
  "use strict";
5432
- var os3 = require("os");
5432
+ var os2 = require("os");
5433
5433
  var { LEVEL, MESSAGE } = require_triple_beam();
5434
5434
  var TransportStream = require_winston_transport();
5435
5435
  module2.exports = class Console extends TransportStream {
@@ -5443,7 +5443,7 @@ var require_console = __commonJS({
5443
5443
  this.name = options.name || "console";
5444
5444
  this.stderrLevels = this._stringArrayToSet(options.stderrLevels);
5445
5445
  this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels);
5446
- this.eol = typeof options.eol === "string" ? options.eol : os3.EOL;
5446
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
5447
5447
  this.forceConsole = options.forceConsole || false;
5448
5448
  this._consoleLog = console.log.bind(console);
5449
5449
  this._consoleWarn = console.warn.bind(console);
@@ -10293,7 +10293,7 @@ var require_node2 = __commonJS({
10293
10293
  var require_tail_file = __commonJS({
10294
10294
  "../../packages/logger/node_modules/winston/lib/winston/tail-file.js"(exports2, module2) {
10295
10295
  "use strict";
10296
- var fs25 = require("fs");
10296
+ var fs24 = require("fs");
10297
10297
  var { StringDecoder } = require("string_decoder");
10298
10298
  var { Stream } = require_readable();
10299
10299
  function noop() {
@@ -10314,7 +10314,7 @@ var require_tail_file = __commonJS({
10314
10314
  stream.emit("end");
10315
10315
  stream.emit("close");
10316
10316
  };
10317
- fs25.open(options.file, "a+", "0644", (err, fd) => {
10317
+ fs24.open(options.file, "a+", "0644", (err, fd) => {
10318
10318
  if (err) {
10319
10319
  if (!iter) {
10320
10320
  stream.emit("error", err);
@@ -10326,10 +10326,10 @@ var require_tail_file = __commonJS({
10326
10326
  }
10327
10327
  (function read() {
10328
10328
  if (stream.destroyed) {
10329
- fs25.close(fd, noop);
10329
+ fs24.close(fd, noop);
10330
10330
  return;
10331
10331
  }
10332
- return fs25.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
10332
+ return fs24.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
10333
10333
  if (error) {
10334
10334
  if (!iter) {
10335
10335
  stream.emit("error", error);
@@ -10388,7 +10388,7 @@ var require_tail_file = __commonJS({
10388
10388
  var require_file = __commonJS({
10389
10389
  "../../packages/logger/node_modules/winston/lib/winston/transports/file.js"(exports2, module2) {
10390
10390
  "use strict";
10391
- var fs25 = require("fs");
10391
+ var fs24 = require("fs");
10392
10392
  var path24 = require("path");
10393
10393
  var asyncSeries = require_series();
10394
10394
  var zlib2 = require("zlib");
@@ -10396,7 +10396,7 @@ var require_file = __commonJS({
10396
10396
  var { Stream, PassThrough } = require_readable();
10397
10397
  var TransportStream = require_winston_transport();
10398
10398
  var debug2 = require_node2()("winston:file");
10399
- var os3 = require("os");
10399
+ var os2 = require("os");
10400
10400
  var tailFile = require_tail_file();
10401
10401
  module2.exports = class File extends TransportStream {
10402
10402
  /**
@@ -10434,7 +10434,7 @@ var require_file = __commonJS({
10434
10434
  this.rotationFormat = options.rotationFormat || false;
10435
10435
  this.zippedArchive = options.zippedArchive || false;
10436
10436
  this.maxFiles = options.maxFiles || null;
10437
- this.eol = typeof options.eol === "string" ? options.eol : os3.EOL;
10437
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
10438
10438
  this.tailable = options.tailable || false;
10439
10439
  this.lazy = options.lazy || false;
10440
10440
  this._size = 0;
@@ -10593,7 +10593,7 @@ var require_file = __commonJS({
10593
10593
  let buff = "";
10594
10594
  let results = [];
10595
10595
  let row = 0;
10596
- const stream = fs25.createReadStream(file, {
10596
+ const stream = fs24.createReadStream(file, {
10597
10597
  encoding: "utf8"
10598
10598
  });
10599
10599
  stream.on("error", (err) => {
@@ -10745,7 +10745,7 @@ var require_file = __commonJS({
10745
10745
  stat(callback) {
10746
10746
  const target = this._getFile();
10747
10747
  const fullpath = path24.join(this.dirname, target);
10748
- fs25.stat(fullpath, (err, stat) => {
10748
+ fs24.stat(fullpath, (err, stat) => {
10749
10749
  if (err && err.code === "ENOENT") {
10750
10750
  debug2("ENOENT\xA0ok", fullpath);
10751
10751
  this.filename = target;
@@ -10850,7 +10850,7 @@ var require_file = __commonJS({
10850
10850
  _createStream(source) {
10851
10851
  const fullpath = path24.join(this.dirname, this.filename);
10852
10852
  debug2("create stream start", fullpath, this.options);
10853
- const dest = fs25.createWriteStream(fullpath, this.options).on("error", (err) => debug2(err)).on("close", () => debug2("close", dest.path, dest.bytesWritten)).on("open", () => {
10853
+ const dest = fs24.createWriteStream(fullpath, this.options).on("error", (err) => debug2(err)).on("close", () => debug2("close", dest.path, dest.bytesWritten)).on("open", () => {
10854
10854
  debug2("file open ok", fullpath);
10855
10855
  this.emit("open", fullpath);
10856
10856
  source.pipe(dest);
@@ -10929,7 +10929,7 @@ var require_file = __commonJS({
10929
10929
  const isZipped = this.zippedArchive ? ".gz" : "";
10930
10930
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
10931
10931
  const target = path24.join(this.dirname, filePath);
10932
- fs25.unlink(target, callback);
10932
+ fs24.unlink(target, callback);
10933
10933
  }
10934
10934
  /**
10935
10935
  * Roll files forward based on integer, up to maxFiles. e.g. if base if
@@ -10952,17 +10952,17 @@ var require_file = __commonJS({
10952
10952
  tasks.push(function(i, cb) {
10953
10953
  let fileName = `${basename}${i - 1}${ext}${isZipped}`;
10954
10954
  const tmppath = path24.join(this.dirname, fileName);
10955
- fs25.exists(tmppath, (exists) => {
10955
+ fs24.exists(tmppath, (exists) => {
10956
10956
  if (!exists) {
10957
10957
  return cb(null);
10958
10958
  }
10959
10959
  fileName = `${basename}${i}${ext}${isZipped}`;
10960
- fs25.rename(tmppath, path24.join(this.dirname, fileName), cb);
10960
+ fs24.rename(tmppath, path24.join(this.dirname, fileName), cb);
10961
10961
  });
10962
10962
  }.bind(this, x));
10963
10963
  }
10964
10964
  asyncSeries(tasks, () => {
10965
- fs25.rename(
10965
+ fs24.rename(
10966
10966
  path24.join(this.dirname, `${basename}${ext}${isZipped}`),
10967
10967
  path24.join(this.dirname, `${basename}1${ext}${isZipped}`),
10968
10968
  callback
@@ -10978,22 +10978,22 @@ var require_file = __commonJS({
10978
10978
  * @private
10979
10979
  */
10980
10980
  _compressFile(src, dest, callback) {
10981
- fs25.access(src, fs25.F_OK, (err) => {
10981
+ fs24.access(src, fs24.F_OK, (err) => {
10982
10982
  if (err) {
10983
10983
  return callback();
10984
10984
  }
10985
10985
  var gzip = zlib2.createGzip();
10986
- var inp = fs25.createReadStream(src);
10987
- var out = fs25.createWriteStream(dest);
10986
+ var inp = fs24.createReadStream(src);
10987
+ var out = fs24.createWriteStream(dest);
10988
10988
  out.on("finish", () => {
10989
- fs25.unlink(src, callback);
10989
+ fs24.unlink(src, callback);
10990
10990
  });
10991
10991
  inp.pipe(gzip).pipe(out);
10992
10992
  });
10993
10993
  }
10994
10994
  _createLogDirIfNotExist(dirPath) {
10995
- if (!fs25.existsSync(dirPath)) {
10996
- fs25.mkdirSync(dirPath, { recursive: true });
10995
+ if (!fs24.existsSync(dirPath)) {
10996
+ fs24.mkdirSync(dirPath, { recursive: true });
10997
10997
  }
10998
10998
  }
10999
10999
  };
@@ -11237,7 +11237,7 @@ var require_stream3 = __commonJS({
11237
11237
  "use strict";
11238
11238
  var isStream = require_is_stream();
11239
11239
  var { MESSAGE } = require_triple_beam();
11240
- var os3 = require("os");
11240
+ var os2 = require("os");
11241
11241
  var TransportStream = require_winston_transport();
11242
11242
  module2.exports = class Stream extends TransportStream {
11243
11243
  /**
@@ -11253,7 +11253,7 @@ var require_stream3 = __commonJS({
11253
11253
  this._stream = options.stream;
11254
11254
  this._stream.setMaxListeners(Infinity);
11255
11255
  this.isObjectMode = options.stream._writableState.objectMode;
11256
- this.eol = typeof options.eol === "string" ? options.eol : os3.EOL;
11256
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
11257
11257
  }
11258
11258
  /**
11259
11259
  * Core logging method exposed to Winston.
@@ -11636,7 +11636,7 @@ var require_exception_stream = __commonJS({
11636
11636
  var require_exception_handler = __commonJS({
11637
11637
  "../../packages/logger/node_modules/winston/lib/winston/exception-handler.js"(exports2, module2) {
11638
11638
  "use strict";
11639
- var os3 = require("os");
11639
+ var os2 = require("os");
11640
11640
  var asyncForEach = require_forEach();
11641
11641
  var debug2 = require_node2()("winston:exception");
11642
11642
  var once = require_one_time();
@@ -11731,8 +11731,8 @@ var require_exception_handler = __commonJS({
11731
11731
  */
11732
11732
  getOsInfo() {
11733
11733
  return {
11734
- loadavg: os3.loadavg(),
11735
- uptime: os3.uptime()
11734
+ loadavg: os2.loadavg(),
11735
+ uptime: os2.uptime()
11736
11736
  };
11737
11737
  }
11738
11738
  /**
@@ -11874,7 +11874,7 @@ var require_rejection_stream = __commonJS({
11874
11874
  var require_rejection_handler = __commonJS({
11875
11875
  "../../packages/logger/node_modules/winston/lib/winston/rejection-handler.js"(exports2, module2) {
11876
11876
  "use strict";
11877
- var os3 = require("os");
11877
+ var os2 = require("os");
11878
11878
  var asyncForEach = require_forEach();
11879
11879
  var debug2 = require_node2()("winston:rejection");
11880
11880
  var once = require_one_time();
@@ -11971,8 +11971,8 @@ var require_rejection_handler = __commonJS({
11971
11971
  */
11972
11972
  getOsInfo() {
11973
11973
  return {
11974
- loadavg: os3.loadavg(),
11975
- uptime: os3.uptime()
11974
+ loadavg: os2.loadavg(),
11975
+ uptime: os2.uptime()
11976
11976
  };
11977
11977
  }
11978
11978
  /**
@@ -17063,9 +17063,8 @@ var AutoMapperEngine = new AutoMapperEngineClass();
17063
17063
  var AutoMapperEngine_default = AutoMapperEngine;
17064
17064
 
17065
17065
  // ../../packages/engines/src/producer/ProducerEngine.ts
17066
- var fs15 = __toESM(require("fs"), 1);
17067
- var os = __toESM(require("os"), 1);
17068
17066
  var import_path14 = __toESM(require("path"), 1);
17067
+ var import_crypto3 = require("crypto");
17069
17068
 
17070
17069
  // ../../packages/engines/src/transform/TypeCaster.ts
17071
17070
  var import_dayjs = __toESM(require("dayjs"), 1);
@@ -17266,20 +17265,30 @@ var ProducerEngineClass = class {
17266
17265
  case "aws-s3":
17267
17266
  case "delta-share": {
17268
17267
  const { compressionType } = producer.settings;
17269
- let tempDir = null;
17268
+ let scope = null;
17270
17269
  try {
17271
17270
  let effectiveProducer = producer;
17272
17271
  let effectiveSource = source;
17273
17272
  if (compressionType) {
17274
- tempDir = fs15.mkdtempSync(import_path14.default.join(os.tmpdir(), "remora-sample-"));
17275
- const decompressedFileKey = await this._decompressForSampling(producer, source, tempDir);
17276
- effectiveProducer = { ...producer, settings: { ...producer.settings, fileKey: decompressedFileKey, compressionType: void 0 } };
17277
- effectiveSource = { ...source, authentication: { ...source.authentication, path: tempDir } };
17273
+ scope = { id: (0, import_crypto3.randomUUID)(), folder: `sample-${(0, import_crypto3.randomUUID)()}`, workersId: [] };
17274
+ const driver = await DriverFactory_default.instantiateSource(source);
17275
+ const readyResult = await driver.ready({ producer, scope });
17276
+ const firstFile = readyResult.files[0].fullUri;
17277
+ const decompressedDir = import_path14.default.dirname(firstFile);
17278
+ effectiveSource = { ...source, engine: "local", authentication: { ...source.authentication, path: decompressedDir } };
17279
+ effectiveProducer = {
17280
+ ...producer,
17281
+ settings: {
17282
+ ...producer.settings,
17283
+ fileKey: readyResult.files.length > 1 ? "%.dataset" : import_path14.default.basename(firstFile),
17284
+ compressionType: void 0
17285
+ }
17286
+ };
17278
17287
  }
17279
17288
  const fileData = await this.readFile(effectiveProducer, { readmode: "lines", lines: { from: 0, to: sampleSize } }, effectiveSource);
17280
17289
  rawData = fileData.data;
17281
17290
  } finally {
17282
- if (tempDir) fs15.rmSync(tempDir, { recursive: true, force: true });
17291
+ if (scope) await ExecutorScope_default.clearScope(scope);
17283
17292
  }
17284
17293
  break;
17285
17294
  }
@@ -17365,47 +17374,6 @@ var ProducerEngineClass = class {
17365
17374
  }
17366
17375
  return dimensions;
17367
17376
  };
17368
- this._decompressForSampling = async (producer, source, tempDir) => {
17369
- const { fileKey, compressionType } = producer.settings;
17370
- const sourcePath = source.authentication["path"];
17371
- switch (compressionType?.toUpperCase()) {
17372
- case "GZ": {
17373
- const decompressedName = fileKey.replace(/\.gz$/i, "");
17374
- const outputPath = import_path14.default.join(tempDir, decompressedName);
17375
- const outputDir = import_path14.default.dirname(outputPath);
17376
- if (!fs15.existsSync(outputDir)) fs15.mkdirSync(outputDir, { recursive: true });
17377
- await ParseCompression_default.decompressToFile(compressionType, fileKey, sourcePath, outputPath);
17378
- return decompressedName;
17379
- }
17380
- case "ZIP":
17381
- case "TAR": {
17382
- const extractDir = import_path14.default.join(tempDir, "extracted");
17383
- await ParseCompression_default.decompressToFile(compressionType, fileKey, sourcePath, extractDir);
17384
- const files = this._findFilesRecursive(extractDir);
17385
- Affirm_default(files.length > 0, `No files found after decompressing "${fileKey}"`);
17386
- const firstFile = files[0];
17387
- const relativePath = import_path14.default.relative(extractDir, firstFile);
17388
- const destPath = import_path14.default.join(tempDir, relativePath);
17389
- const destDir = import_path14.default.dirname(destPath);
17390
- if (!fs15.existsSync(destDir)) fs15.mkdirSync(destDir, { recursive: true });
17391
- fs15.renameSync(firstFile, destPath);
17392
- return relativePath;
17393
- }
17394
- default:
17395
- throw new Error(`Unsupported compression type "${compressionType}" for producer "${producer.name}"`);
17396
- }
17397
- };
17398
- this._findFilesRecursive = (dir) => {
17399
- const results = [];
17400
- for (const entry of fs15.readdirSync(dir)) {
17401
- const fullPath = import_path14.default.join(dir, entry);
17402
- if (fs15.statSync(fullPath).isDirectory())
17403
- results.push(...this._findFilesRecursive(fullPath));
17404
- else
17405
- results.push(fullPath);
17406
- }
17407
- return results;
17408
- };
17409
17377
  }
17410
17378
  };
17411
17379
  var ProducerEngine = new ProducerEngineClass();
@@ -18880,7 +18848,7 @@ var UsageManager = new UsageManagerClass();
18880
18848
  var UsageManager_default = UsageManager;
18881
18849
 
18882
18850
  // ../../packages/executors/src/OutputExecutor.ts
18883
- var fs18 = __toESM(require("fs"));
18851
+ var fs17 = __toESM(require("fs"));
18884
18852
 
18885
18853
  // ../../packages/executors/src/ExecutorScope.ts
18886
18854
  var import_path16 = __toESM(require("path"));
@@ -18991,7 +18959,7 @@ var OutputExecutorClass = class {
18991
18959
  const currentPath = import_path17.default.dirname(ExecutorScope_default2.getMainPath(scope));
18992
18960
  const destinationName = this._composeFileName(consumer, output, this._getExtension(output));
18993
18961
  Logger_default.log(`Exporting consumer "${consumer.name}" to "${output.exportDestination}" as ${output.format} (${destinationName})`);
18994
- const filenameArray = fs18.readdirSync(currentPath).filter((filename) => filename.includes(".dataset"));
18962
+ const filenameArray = fs17.readdirSync(currentPath).filter((filename) => filename.includes(".dataset"));
18995
18963
  for (const filename in filenameArray) {
18996
18964
  const destinationPath = this.getCompletedPath(destinationName, filename);
18997
18965
  const startingPath = import_path17.default.join(currentPath, filenameArray[filename]);
@@ -19586,7 +19554,7 @@ var ExecutorProgress = class {
19586
19554
  var ExecutorProgress_default = ExecutorProgress;
19587
19555
 
19588
19556
  // ../../packages/executors/src/ExecutorWriter.ts
19589
- var fs20 = __toESM(require("fs"));
19557
+ var fs19 = __toESM(require("fs"));
19590
19558
  var import_readline7 = __toESM(require("readline"));
19591
19559
  var ExecutorWriter = class {
19592
19560
  constructor() {
@@ -19603,11 +19571,11 @@ var ExecutorWriter = class {
19603
19571
  };
19604
19572
  this.splitBySize = async (scope, sourcePath) => {
19605
19573
  const maxOutputFileSize = scope.limitFileSize * this.FAKE_GB;
19606
- const readStream = fs20.createReadStream(sourcePath);
19574
+ const readStream = fs19.createReadStream(sourcePath);
19607
19575
  const reader = import_readline7.default.createInterface({ input: readStream, crlfDelay: Infinity });
19608
19576
  let writerIndex = 0;
19609
19577
  let destPath = this.getCompletedPath(sourcePath, writerIndex);
19610
- let writeStream = fs20.createWriteStream(destPath, { flags: "a" });
19578
+ let writeStream = fs19.createWriteStream(destPath, { flags: "a" });
19611
19579
  for await (const line of reader) {
19612
19580
  if (readStream.bytesRead > maxOutputFileSize * (writerIndex + 1)) {
19613
19581
  writeStream.end();
@@ -19617,7 +19585,7 @@ var ExecutorWriter = class {
19617
19585
  });
19618
19586
  writerIndex++;
19619
19587
  destPath = this.getCompletedPath(sourcePath, writerIndex);
19620
- writeStream = fs20.createWriteStream(destPath, { flags: "a" });
19588
+ writeStream = fs19.createWriteStream(destPath, { flags: "a" });
19621
19589
  }
19622
19590
  writeStream.write(line + "\n");
19623
19591
  }
@@ -19626,7 +19594,7 @@ var ExecutorWriter = class {
19626
19594
  writeStream.on("finish", resolve);
19627
19595
  writeStream.on("error", reject);
19628
19596
  });
19629
- await fs20.promises.unlink(sourcePath);
19597
+ await fs19.promises.unlink(sourcePath);
19630
19598
  };
19631
19599
  /**
19632
19600
  * Manage the Writestream for main.dataset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forzalabs/remora",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "A powerful CLI tool for seamless data translation.",
5
5
  "main": "index.js",
6
6
  "private": false,
@@ -146,7 +146,7 @@ var require_has_flag = __commonJS({
146
146
  var require_supports_colors = __commonJS({
147
147
  "../../node_modules/logform/node_modules/@colors/colors/lib/system/supports-colors.js"(exports2, module2) {
148
148
  "use strict";
149
- var os3 = require("os");
149
+ var os2 = require("os");
150
150
  var hasFlag = require_has_flag();
151
151
  var env = process.env;
152
152
  var forceColor = void 0;
@@ -184,7 +184,7 @@ var require_supports_colors = __commonJS({
184
184
  }
185
185
  var min = forceColor ? 1 : 0;
186
186
  if (process.platform === "win32") {
187
- var osRelease = os3.release().split(".");
187
+ var osRelease = os2.release().split(".");
188
188
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
189
189
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
190
190
  }
@@ -5428,7 +5428,7 @@ var require_winston_transport = __commonJS({
5428
5428
  var require_console = __commonJS({
5429
5429
  "../../packages/logger/node_modules/winston/lib/winston/transports/console.js"(exports2, module2) {
5430
5430
  "use strict";
5431
- var os3 = require("os");
5431
+ var os2 = require("os");
5432
5432
  var { LEVEL, MESSAGE } = require_triple_beam();
5433
5433
  var TransportStream = require_winston_transport();
5434
5434
  module2.exports = class Console extends TransportStream {
@@ -5442,7 +5442,7 @@ var require_console = __commonJS({
5442
5442
  this.name = options.name || "console";
5443
5443
  this.stderrLevels = this._stringArrayToSet(options.stderrLevels);
5444
5444
  this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels);
5445
- this.eol = typeof options.eol === "string" ? options.eol : os3.EOL;
5445
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
5446
5446
  this.forceConsole = options.forceConsole || false;
5447
5447
  this._consoleLog = console.log.bind(console);
5448
5448
  this._consoleWarn = console.warn.bind(console);
@@ -10292,7 +10292,7 @@ var require_node2 = __commonJS({
10292
10292
  var require_tail_file = __commonJS({
10293
10293
  "../../packages/logger/node_modules/winston/lib/winston/tail-file.js"(exports2, module2) {
10294
10294
  "use strict";
10295
- var fs19 = require("fs");
10295
+ var fs18 = require("fs");
10296
10296
  var { StringDecoder } = require("string_decoder");
10297
10297
  var { Stream } = require_readable();
10298
10298
  function noop() {
@@ -10313,7 +10313,7 @@ var require_tail_file = __commonJS({
10313
10313
  stream.emit("end");
10314
10314
  stream.emit("close");
10315
10315
  };
10316
- fs19.open(options.file, "a+", "0644", (err, fd) => {
10316
+ fs18.open(options.file, "a+", "0644", (err, fd) => {
10317
10317
  if (err) {
10318
10318
  if (!iter) {
10319
10319
  stream.emit("error", err);
@@ -10325,10 +10325,10 @@ var require_tail_file = __commonJS({
10325
10325
  }
10326
10326
  (function read() {
10327
10327
  if (stream.destroyed) {
10328
- fs19.close(fd, noop);
10328
+ fs18.close(fd, noop);
10329
10329
  return;
10330
10330
  }
10331
- return fs19.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
10331
+ return fs18.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => {
10332
10332
  if (error) {
10333
10333
  if (!iter) {
10334
10334
  stream.emit("error", error);
@@ -10387,7 +10387,7 @@ var require_tail_file = __commonJS({
10387
10387
  var require_file = __commonJS({
10388
10388
  "../../packages/logger/node_modules/winston/lib/winston/transports/file.js"(exports2, module2) {
10389
10389
  "use strict";
10390
- var fs19 = require("fs");
10390
+ var fs18 = require("fs");
10391
10391
  var path18 = require("path");
10392
10392
  var asyncSeries = require_series();
10393
10393
  var zlib2 = require("zlib");
@@ -10395,7 +10395,7 @@ var require_file = __commonJS({
10395
10395
  var { Stream, PassThrough } = require_readable();
10396
10396
  var TransportStream = require_winston_transport();
10397
10397
  var debug = require_node2()("winston:file");
10398
- var os3 = require("os");
10398
+ var os2 = require("os");
10399
10399
  var tailFile = require_tail_file();
10400
10400
  module2.exports = class File extends TransportStream {
10401
10401
  /**
@@ -10433,7 +10433,7 @@ var require_file = __commonJS({
10433
10433
  this.rotationFormat = options.rotationFormat || false;
10434
10434
  this.zippedArchive = options.zippedArchive || false;
10435
10435
  this.maxFiles = options.maxFiles || null;
10436
- this.eol = typeof options.eol === "string" ? options.eol : os3.EOL;
10436
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
10437
10437
  this.tailable = options.tailable || false;
10438
10438
  this.lazy = options.lazy || false;
10439
10439
  this._size = 0;
@@ -10592,7 +10592,7 @@ var require_file = __commonJS({
10592
10592
  let buff = "";
10593
10593
  let results = [];
10594
10594
  let row = 0;
10595
- const stream = fs19.createReadStream(file, {
10595
+ const stream = fs18.createReadStream(file, {
10596
10596
  encoding: "utf8"
10597
10597
  });
10598
10598
  stream.on("error", (err) => {
@@ -10744,7 +10744,7 @@ var require_file = __commonJS({
10744
10744
  stat(callback) {
10745
10745
  const target = this._getFile();
10746
10746
  const fullpath = path18.join(this.dirname, target);
10747
- fs19.stat(fullpath, (err, stat) => {
10747
+ fs18.stat(fullpath, (err, stat) => {
10748
10748
  if (err && err.code === "ENOENT") {
10749
10749
  debug("ENOENT\xA0ok", fullpath);
10750
10750
  this.filename = target;
@@ -10849,7 +10849,7 @@ var require_file = __commonJS({
10849
10849
  _createStream(source) {
10850
10850
  const fullpath = path18.join(this.dirname, this.filename);
10851
10851
  debug("create stream start", fullpath, this.options);
10852
- const dest = fs19.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
10852
+ const dest = fs18.createWriteStream(fullpath, this.options).on("error", (err) => debug(err)).on("close", () => debug("close", dest.path, dest.bytesWritten)).on("open", () => {
10853
10853
  debug("file open ok", fullpath);
10854
10854
  this.emit("open", fullpath);
10855
10855
  source.pipe(dest);
@@ -10928,7 +10928,7 @@ var require_file = __commonJS({
10928
10928
  const isZipped = this.zippedArchive ? ".gz" : "";
10929
10929
  const filePath = `${basename}${isOldest}${ext}${isZipped}`;
10930
10930
  const target = path18.join(this.dirname, filePath);
10931
- fs19.unlink(target, callback);
10931
+ fs18.unlink(target, callback);
10932
10932
  }
10933
10933
  /**
10934
10934
  * Roll files forward based on integer, up to maxFiles. e.g. if base if
@@ -10951,17 +10951,17 @@ var require_file = __commonJS({
10951
10951
  tasks.push(function(i, cb) {
10952
10952
  let fileName = `${basename}${i - 1}${ext}${isZipped}`;
10953
10953
  const tmppath = path18.join(this.dirname, fileName);
10954
- fs19.exists(tmppath, (exists) => {
10954
+ fs18.exists(tmppath, (exists) => {
10955
10955
  if (!exists) {
10956
10956
  return cb(null);
10957
10957
  }
10958
10958
  fileName = `${basename}${i}${ext}${isZipped}`;
10959
- fs19.rename(tmppath, path18.join(this.dirname, fileName), cb);
10959
+ fs18.rename(tmppath, path18.join(this.dirname, fileName), cb);
10960
10960
  });
10961
10961
  }.bind(this, x));
10962
10962
  }
10963
10963
  asyncSeries(tasks, () => {
10964
- fs19.rename(
10964
+ fs18.rename(
10965
10965
  path18.join(this.dirname, `${basename}${ext}${isZipped}`),
10966
10966
  path18.join(this.dirname, `${basename}1${ext}${isZipped}`),
10967
10967
  callback
@@ -10977,22 +10977,22 @@ var require_file = __commonJS({
10977
10977
  * @private
10978
10978
  */
10979
10979
  _compressFile(src, dest, callback) {
10980
- fs19.access(src, fs19.F_OK, (err) => {
10980
+ fs18.access(src, fs18.F_OK, (err) => {
10981
10981
  if (err) {
10982
10982
  return callback();
10983
10983
  }
10984
10984
  var gzip = zlib2.createGzip();
10985
- var inp = fs19.createReadStream(src);
10986
- var out = fs19.createWriteStream(dest);
10985
+ var inp = fs18.createReadStream(src);
10986
+ var out = fs18.createWriteStream(dest);
10987
10987
  out.on("finish", () => {
10988
- fs19.unlink(src, callback);
10988
+ fs18.unlink(src, callback);
10989
10989
  });
10990
10990
  inp.pipe(gzip).pipe(out);
10991
10991
  });
10992
10992
  }
10993
10993
  _createLogDirIfNotExist(dirPath) {
10994
- if (!fs19.existsSync(dirPath)) {
10995
- fs19.mkdirSync(dirPath, { recursive: true });
10994
+ if (!fs18.existsSync(dirPath)) {
10995
+ fs18.mkdirSync(dirPath, { recursive: true });
10996
10996
  }
10997
10997
  }
10998
10998
  };
@@ -11236,7 +11236,7 @@ var require_stream3 = __commonJS({
11236
11236
  "use strict";
11237
11237
  var isStream = require_is_stream();
11238
11238
  var { MESSAGE } = require_triple_beam();
11239
- var os3 = require("os");
11239
+ var os2 = require("os");
11240
11240
  var TransportStream = require_winston_transport();
11241
11241
  module2.exports = class Stream extends TransportStream {
11242
11242
  /**
@@ -11252,7 +11252,7 @@ var require_stream3 = __commonJS({
11252
11252
  this._stream = options.stream;
11253
11253
  this._stream.setMaxListeners(Infinity);
11254
11254
  this.isObjectMode = options.stream._writableState.objectMode;
11255
- this.eol = typeof options.eol === "string" ? options.eol : os3.EOL;
11255
+ this.eol = typeof options.eol === "string" ? options.eol : os2.EOL;
11256
11256
  }
11257
11257
  /**
11258
11258
  * Core logging method exposed to Winston.
@@ -11635,7 +11635,7 @@ var require_exception_stream = __commonJS({
11635
11635
  var require_exception_handler = __commonJS({
11636
11636
  "../../packages/logger/node_modules/winston/lib/winston/exception-handler.js"(exports2, module2) {
11637
11637
  "use strict";
11638
- var os3 = require("os");
11638
+ var os2 = require("os");
11639
11639
  var asyncForEach = require_forEach();
11640
11640
  var debug = require_node2()("winston:exception");
11641
11641
  var once = require_one_time();
@@ -11730,8 +11730,8 @@ var require_exception_handler = __commonJS({
11730
11730
  */
11731
11731
  getOsInfo() {
11732
11732
  return {
11733
- loadavg: os3.loadavg(),
11734
- uptime: os3.uptime()
11733
+ loadavg: os2.loadavg(),
11734
+ uptime: os2.uptime()
11735
11735
  };
11736
11736
  }
11737
11737
  /**
@@ -11873,7 +11873,7 @@ var require_rejection_stream = __commonJS({
11873
11873
  var require_rejection_handler = __commonJS({
11874
11874
  "../../packages/logger/node_modules/winston/lib/winston/rejection-handler.js"(exports2, module2) {
11875
11875
  "use strict";
11876
- var os3 = require("os");
11876
+ var os2 = require("os");
11877
11877
  var asyncForEach = require_forEach();
11878
11878
  var debug = require_node2()("winston:rejection");
11879
11879
  var once = require_one_time();
@@ -11970,8 +11970,8 @@ var require_rejection_handler = __commonJS({
11970
11970
  */
11971
11971
  getOsInfo() {
11972
11972
  return {
11973
- loadavg: os3.loadavg(),
11974
- uptime: os3.uptime()
11973
+ loadavg: os2.loadavg(),
11974
+ uptime: os2.uptime()
11975
11975
  };
11976
11976
  }
11977
11977
  /**
@@ -14607,9 +14607,8 @@ var AutoMapperEngineClass = class {
14607
14607
  var AutoMapperEngine = new AutoMapperEngineClass();
14608
14608
 
14609
14609
  // ../../packages/engines/src/producer/ProducerEngine.ts
14610
- var fs11 = __toESM(require("fs"), 1);
14611
- var os = __toESM(require("os"), 1);
14612
14610
  var import_path11 = __toESM(require("path"), 1);
14611
+ var import_crypto2 = require("crypto");
14613
14612
 
14614
14613
  // ../../packages/drivers/src/DeltaShareDriver.ts
14615
14614
  var DeltaShareSourceDriver = class {
@@ -16596,20 +16595,30 @@ var ProducerEngineClass = class {
16596
16595
  case "aws-s3":
16597
16596
  case "delta-share": {
16598
16597
  const { compressionType } = producer.settings;
16599
- let tempDir = null;
16598
+ let scope = null;
16600
16599
  try {
16601
16600
  let effectiveProducer = producer;
16602
16601
  let effectiveSource = source;
16603
16602
  if (compressionType) {
16604
- tempDir = fs11.mkdtempSync(import_path11.default.join(os.tmpdir(), "remora-sample-"));
16605
- const decompressedFileKey = await this._decompressForSampling(producer, source, tempDir);
16606
- effectiveProducer = { ...producer, settings: { ...producer.settings, fileKey: decompressedFileKey, compressionType: void 0 } };
16607
- effectiveSource = { ...source, authentication: { ...source.authentication, path: tempDir } };
16603
+ scope = { id: (0, import_crypto2.randomUUID)(), folder: `sample-${(0, import_crypto2.randomUUID)()}`, workersId: [] };
16604
+ const driver = await DriverFactory_default.instantiateSource(source);
16605
+ const readyResult = await driver.ready({ producer, scope });
16606
+ const firstFile = readyResult.files[0].fullUri;
16607
+ const decompressedDir = import_path11.default.dirname(firstFile);
16608
+ effectiveSource = { ...source, engine: "local", authentication: { ...source.authentication, path: decompressedDir } };
16609
+ effectiveProducer = {
16610
+ ...producer,
16611
+ settings: {
16612
+ ...producer.settings,
16613
+ fileKey: readyResult.files.length > 1 ? "%.dataset" : import_path11.default.basename(firstFile),
16614
+ compressionType: void 0
16615
+ }
16616
+ };
16608
16617
  }
16609
16618
  const fileData = await this.readFile(effectiveProducer, { readmode: "lines", lines: { from: 0, to: sampleSize } }, effectiveSource);
16610
16619
  rawData = fileData.data;
16611
16620
  } finally {
16612
- if (tempDir) fs11.rmSync(tempDir, { recursive: true, force: true });
16621
+ if (scope) await ExecutorScope_default.clearScope(scope);
16613
16622
  }
16614
16623
  break;
16615
16624
  }
@@ -16695,47 +16704,6 @@ var ProducerEngineClass = class {
16695
16704
  }
16696
16705
  return dimensions;
16697
16706
  };
16698
- this._decompressForSampling = async (producer, source, tempDir) => {
16699
- const { fileKey, compressionType } = producer.settings;
16700
- const sourcePath = source.authentication["path"];
16701
- switch (compressionType?.toUpperCase()) {
16702
- case "GZ": {
16703
- const decompressedName = fileKey.replace(/\.gz$/i, "");
16704
- const outputPath = import_path11.default.join(tempDir, decompressedName);
16705
- const outputDir = import_path11.default.dirname(outputPath);
16706
- if (!fs11.existsSync(outputDir)) fs11.mkdirSync(outputDir, { recursive: true });
16707
- await ParseCompression_default.decompressToFile(compressionType, fileKey, sourcePath, outputPath);
16708
- return decompressedName;
16709
- }
16710
- case "ZIP":
16711
- case "TAR": {
16712
- const extractDir = import_path11.default.join(tempDir, "extracted");
16713
- await ParseCompression_default.decompressToFile(compressionType, fileKey, sourcePath, extractDir);
16714
- const files = this._findFilesRecursive(extractDir);
16715
- Affirm_default(files.length > 0, `No files found after decompressing "${fileKey}"`);
16716
- const firstFile = files[0];
16717
- const relativePath = import_path11.default.relative(extractDir, firstFile);
16718
- const destPath = import_path11.default.join(tempDir, relativePath);
16719
- const destDir = import_path11.default.dirname(destPath);
16720
- if (!fs11.existsSync(destDir)) fs11.mkdirSync(destDir, { recursive: true });
16721
- fs11.renameSync(firstFile, destPath);
16722
- return relativePath;
16723
- }
16724
- default:
16725
- throw new Error(`Unsupported compression type "${compressionType}" for producer "${producer.name}"`);
16726
- }
16727
- };
16728
- this._findFilesRecursive = (dir) => {
16729
- const results = [];
16730
- for (const entry of fs11.readdirSync(dir)) {
16731
- const fullPath = import_path11.default.join(dir, entry);
16732
- if (fs11.statSync(fullPath).isDirectory())
16733
- results.push(...this._findFilesRecursive(fullPath));
16734
- else
16735
- results.push(fullPath);
16736
- }
16737
- return results;
16738
- };
16739
16707
  }
16740
16708
  };
16741
16709
  var ProducerEngine = new ProducerEngineClass();
@@ -18479,7 +18447,7 @@ var UsageManager = new UsageManagerClass();
18479
18447
  var UsageManager_default = UsageManager;
18480
18448
 
18481
18449
  // ../../packages/executors/src/OutputExecutor.ts
18482
- var fs14 = __toESM(require("fs"));
18450
+ var fs13 = __toESM(require("fs"));
18483
18451
 
18484
18452
  // ../../packages/executors/src/ExecutorScope.ts
18485
18453
  var import_path13 = __toESM(require("path"));
@@ -18590,7 +18558,7 @@ var OutputExecutorClass = class {
18590
18558
  const currentPath = import_path14.default.dirname(ExecutorScope_default2.getMainPath(scope));
18591
18559
  const destinationName = this._composeFileName(consumer, output, this._getExtension(output));
18592
18560
  Logger_default.log(`Exporting consumer "${consumer.name}" to "${output.exportDestination}" as ${output.format} (${destinationName})`);
18593
- const filenameArray = fs14.readdirSync(currentPath).filter((filename) => filename.includes(".dataset"));
18561
+ const filenameArray = fs13.readdirSync(currentPath).filter((filename) => filename.includes(".dataset"));
18594
18562
  for (const filename in filenameArray) {
18595
18563
  const destinationPath = this.getCompletedPath(destinationName, filename);
18596
18564
  const startingPath = import_path14.default.join(currentPath, filenameArray[filename]);
@@ -19345,7 +19313,7 @@ var ExecutorProgress = class {
19345
19313
  var ExecutorProgress_default = ExecutorProgress;
19346
19314
 
19347
19315
  // ../../packages/executors/src/ExecutorWriter.ts
19348
- var fs17 = __toESM(require("fs"));
19316
+ var fs16 = __toESM(require("fs"));
19349
19317
  var import_readline8 = __toESM(require("readline"));
19350
19318
  var ExecutorWriter = class {
19351
19319
  constructor() {
@@ -19362,11 +19330,11 @@ var ExecutorWriter = class {
19362
19330
  };
19363
19331
  this.splitBySize = async (scope, sourcePath) => {
19364
19332
  const maxOutputFileSize = scope.limitFileSize * this.FAKE_GB;
19365
- const readStream = fs17.createReadStream(sourcePath);
19333
+ const readStream = fs16.createReadStream(sourcePath);
19366
19334
  const reader = import_readline8.default.createInterface({ input: readStream, crlfDelay: Infinity });
19367
19335
  let writerIndex = 0;
19368
19336
  let destPath = this.getCompletedPath(sourcePath, writerIndex);
19369
- let writeStream = fs17.createWriteStream(destPath, { flags: "a" });
19337
+ let writeStream = fs16.createWriteStream(destPath, { flags: "a" });
19370
19338
  for await (const line of reader) {
19371
19339
  if (readStream.bytesRead > maxOutputFileSize * (writerIndex + 1)) {
19372
19340
  writeStream.end();
@@ -19376,7 +19344,7 @@ var ExecutorWriter = class {
19376
19344
  });
19377
19345
  writerIndex++;
19378
19346
  destPath = this.getCompletedPath(sourcePath, writerIndex);
19379
- writeStream = fs17.createWriteStream(destPath, { flags: "a" });
19347
+ writeStream = fs16.createWriteStream(destPath, { flags: "a" });
19380
19348
  }
19381
19349
  writeStream.write(line + "\n");
19382
19350
  }
@@ -19385,7 +19353,7 @@ var ExecutorWriter = class {
19385
19353
  writeStream.on("finish", resolve);
19386
19354
  writeStream.on("error", reject);
19387
19355
  });
19388
- await fs17.promises.unlink(sourcePath);
19356
+ await fs16.promises.unlink(sourcePath);
19389
19357
  };
19390
19358
  /**
19391
19359
  * Manage the Writestream for main.dataset