@forzalabs/remora 2.0.3 → 2.1.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.
@@ -1238,8 +1238,8 @@ var require_levels = __commonJS({
1238
1238
  var require_align = __commonJS({
1239
1239
  "../../node_modules/logform/align.js"(exports2, module2) {
1240
1240
  "use strict";
1241
- var format3 = require_format();
1242
- module2.exports = format3((info) => {
1241
+ var format4 = require_format();
1242
+ module2.exports = format4((info) => {
1243
1243
  info.message = ` ${info.message}`;
1244
1244
  return info;
1245
1245
  });
@@ -1250,9 +1250,9 @@ var require_align = __commonJS({
1250
1250
  var require_errors = __commonJS({
1251
1251
  "../../node_modules/logform/errors.js"(exports2, module2) {
1252
1252
  "use strict";
1253
- var format3 = require_format();
1253
+ var format4 = require_format();
1254
1254
  var { LEVEL, MESSAGE } = require_triple_beam();
1255
- module2.exports = format3((einfo, { stack, cause }) => {
1255
+ module2.exports = format4((einfo, { stack, cause }) => {
1256
1256
  if (einfo instanceof Error) {
1257
1257
  const info = Object.assign({}, einfo, {
1258
1258
  level: einfo.level,
@@ -1388,7 +1388,7 @@ var require_cli2 = __commonJS({
1388
1388
  var require_combine = __commonJS({
1389
1389
  "../../node_modules/logform/combine.js"(exports2, module2) {
1390
1390
  "use strict";
1391
- var format3 = require_format();
1391
+ var format4 = require_format();
1392
1392
  function cascade(formats) {
1393
1393
  if (!formats.every(isValidFormat)) {
1394
1394
  return;
@@ -1415,7 +1415,7 @@ var require_combine = __commonJS({
1415
1415
  return true;
1416
1416
  }
1417
1417
  module2.exports = (...formats) => {
1418
- const combinedFormat = format3(cascade(formats));
1418
+ const combinedFormat = format4(cascade(formats));
1419
1419
  const instance = combinedFormat();
1420
1420
  instance.Format = combinedFormat.Format;
1421
1421
  return instance;
@@ -2024,7 +2024,7 @@ ${originalIndentation}`;
2024
2024
  var require_json = __commonJS({
2025
2025
  "../../node_modules/logform/json.js"(exports2, module2) {
2026
2026
  "use strict";
2027
- var format3 = require_format();
2027
+ var format4 = require_format();
2028
2028
  var { MESSAGE } = require_triple_beam();
2029
2029
  var stringify = require_safe_stable_stringify();
2030
2030
  function replacer(key, value) {
@@ -2032,7 +2032,7 @@ var require_json = __commonJS({
2032
2032
  return value.toString();
2033
2033
  return value;
2034
2034
  }
2035
- module2.exports = format3((info, opts) => {
2035
+ module2.exports = format4((info, opts) => {
2036
2036
  const jsonStringify = stringify.configure(opts);
2037
2037
  info[MESSAGE] = jsonStringify(info, opts.replacer || replacer, opts.space);
2038
2038
  return info;
@@ -2044,8 +2044,8 @@ var require_json = __commonJS({
2044
2044
  var require_label = __commonJS({
2045
2045
  "../../node_modules/logform/label.js"(exports2, module2) {
2046
2046
  "use strict";
2047
- var format3 = require_format();
2048
- module2.exports = format3((info, opts) => {
2047
+ var format4 = require_format();
2048
+ module2.exports = format4((info, opts) => {
2049
2049
  if (opts.message) {
2050
2050
  info.message = `[${opts.label}] ${info.message}`;
2051
2051
  return info;
@@ -2060,10 +2060,10 @@ var require_label = __commonJS({
2060
2060
  var require_logstash = __commonJS({
2061
2061
  "../../node_modules/logform/logstash.js"(exports2, module2) {
2062
2062
  "use strict";
2063
- var format3 = require_format();
2063
+ var format4 = require_format();
2064
2064
  var { MESSAGE } = require_triple_beam();
2065
2065
  var jsonStringify = require_safe_stable_stringify();
2066
- module2.exports = format3((info) => {
2066
+ module2.exports = format4((info) => {
2067
2067
  const logstash = {};
2068
2068
  if (info.message) {
2069
2069
  logstash["@message"] = info.message;
@@ -2084,7 +2084,7 @@ var require_logstash = __commonJS({
2084
2084
  var require_metadata = __commonJS({
2085
2085
  "../../node_modules/logform/metadata.js"(exports2, module2) {
2086
2086
  "use strict";
2087
- var format3 = require_format();
2087
+ var format4 = require_format();
2088
2088
  function fillExcept(info, fillExceptKeys, metadataKey) {
2089
2089
  const savedKeys = fillExceptKeys.reduce((acc, key) => {
2090
2090
  acc[key] = info[key];
@@ -2109,7 +2109,7 @@ var require_metadata = __commonJS({
2109
2109
  }, {});
2110
2110
  return info;
2111
2111
  }
2112
- module2.exports = format3((info, opts = {}) => {
2112
+ module2.exports = format4((info, opts = {}) => {
2113
2113
  let metadataKey = "metadata";
2114
2114
  if (opts.key) {
2115
2115
  metadataKey = opts.key;
@@ -2253,9 +2253,9 @@ var require_ms = __commonJS({
2253
2253
  var require_ms2 = __commonJS({
2254
2254
  "../../node_modules/logform/ms.js"(exports2, module2) {
2255
2255
  "use strict";
2256
- var format3 = require_format();
2256
+ var format4 = require_format();
2257
2257
  var ms2 = require_ms();
2258
- module2.exports = format3((info) => {
2258
+ module2.exports = format4((info) => {
2259
2259
  const curr = +/* @__PURE__ */ new Date();
2260
2260
  exports2.diff = curr - (exports2.prevTime || curr);
2261
2261
  exports2.prevTime = curr;
@@ -2270,9 +2270,9 @@ var require_pretty_print = __commonJS({
2270
2270
  "../../node_modules/logform/pretty-print.js"(exports2, module2) {
2271
2271
  "use strict";
2272
2272
  var inspect = require("util").inspect;
2273
- var format3 = require_format();
2273
+ var format4 = require_format();
2274
2274
  var { LEVEL, MESSAGE, SPLAT } = require_triple_beam();
2275
- module2.exports = format3((info, opts = {}) => {
2275
+ module2.exports = format4((info, opts = {}) => {
2276
2276
  const stripped = Object.assign({}, info);
2277
2277
  delete stripped[LEVEL];
2278
2278
  delete stripped[MESSAGE];
@@ -2306,10 +2306,10 @@ var require_printf = __commonJS({
2306
2306
  var require_simple = __commonJS({
2307
2307
  "../../node_modules/logform/simple.js"(exports2, module2) {
2308
2308
  "use strict";
2309
- var format3 = require_format();
2309
+ var format4 = require_format();
2310
2310
  var { MESSAGE } = require_triple_beam();
2311
2311
  var jsonStringify = require_safe_stable_stringify();
2312
- module2.exports = format3((info) => {
2312
+ module2.exports = format4((info) => {
2313
2313
  const stringifiedRest = jsonStringify(Object.assign({}, info, {
2314
2314
  level: void 0,
2315
2315
  message: void 0,
@@ -2431,14 +2431,14 @@ function assign(origObj) {
2431
2431
  }
2432
2432
  return origObj;
2433
2433
  }
2434
- function parse(dateStr, format3, i18n) {
2434
+ function parse(dateStr, format4, i18n) {
2435
2435
  if (i18n === void 0) {
2436
2436
  i18n = {};
2437
2437
  }
2438
- if (typeof format3 !== "string") {
2438
+ if (typeof format4 !== "string") {
2439
2439
  throw new Error("Invalid format in fecha parse");
2440
2440
  }
2441
- format3 = globalMasks[format3] || format3;
2441
+ format4 = globalMasks[format4] || format4;
2442
2442
  if (dateStr.length > 1e3) {
2443
2443
  return null;
2444
2444
  }
@@ -2456,7 +2456,7 @@ function parse(dateStr, format3, i18n) {
2456
2456
  };
2457
2457
  var parseInfo = [];
2458
2458
  var literals = [];
2459
- var newFormat = format3.replace(literal, function($0, $1) {
2459
+ var newFormat = format4.replace(literal, function($0, $1) {
2460
2460
  literals.push(regexEscape($1));
2461
2461
  return "@@@";
2462
2462
  });
@@ -2818,8 +2818,8 @@ var require_timestamp = __commonJS({
2818
2818
  "../../node_modules/logform/timestamp.js"(exports2, module2) {
2819
2819
  "use strict";
2820
2820
  var fecha2 = (init_fecha(), __toCommonJS(fecha_exports));
2821
- var format3 = require_format();
2822
- module2.exports = format3((info, opts = {}) => {
2821
+ var format4 = require_format();
2822
+ module2.exports = format4((info, opts = {}) => {
2823
2823
  if (opts.format) {
2824
2824
  info.timestamp = typeof opts.format === "function" ? opts.format() : fecha2.format(/* @__PURE__ */ new Date(), opts.format);
2825
2825
  }
@@ -2839,9 +2839,9 @@ var require_uncolorize = __commonJS({
2839
2839
  "../../node_modules/logform/uncolorize.js"(exports2, module2) {
2840
2840
  "use strict";
2841
2841
  var colors = require_safe();
2842
- var format3 = require_format();
2842
+ var format4 = require_format();
2843
2843
  var { MESSAGE } = require_triple_beam();
2844
- module2.exports = format3((info, opts) => {
2844
+ module2.exports = format4((info, opts) => {
2845
2845
  if (opts.level !== false) {
2846
2846
  info.level = colors.strip(info.level);
2847
2847
  }
@@ -2860,10 +2860,10 @@ var require_uncolorize = __commonJS({
2860
2860
  var require_logform = __commonJS({
2861
2861
  "../../node_modules/logform/index.js"(exports2) {
2862
2862
  "use strict";
2863
- var format3 = exports2.format = require_format();
2863
+ var format4 = exports2.format = require_format();
2864
2864
  exports2.levels = require_levels();
2865
2865
  function exposeFormat(name, requireFormat) {
2866
- Object.defineProperty(format3, name, {
2866
+ Object.defineProperty(format4, name, {
2867
2867
  get() {
2868
2868
  return requireFormat();
2869
2869
  },
@@ -2928,17 +2928,17 @@ var require_logform = __commonJS({
2928
2928
  var require_common = __commonJS({
2929
2929
  "../../node_modules/winston/lib/winston/common.js"(exports2) {
2930
2930
  "use strict";
2931
- var { format: format3 } = require("util");
2931
+ var { format: format4 } = require("util");
2932
2932
  exports2.warn = {
2933
2933
  deprecated(prop) {
2934
2934
  return () => {
2935
- throw new Error(format3("{ %s } was removed in winston@3.0.0.", prop));
2935
+ throw new Error(format4("{ %s } was removed in winston@3.0.0.", prop));
2936
2936
  };
2937
2937
  },
2938
2938
  useFormat(prop) {
2939
2939
  return () => {
2940
2940
  throw new Error([
2941
- format3("{ %s } was removed in winston@3.0.0.", prop),
2941
+ format4("{ %s } was removed in winston@3.0.0.", prop),
2942
2942
  "Use a custom winston.format = winston.format(function) instead."
2943
2943
  ].join("\n"));
2944
2944
  };
@@ -4203,14 +4203,14 @@ var require_from = __commonJS({
4203
4203
  return (hint === "string" ? String : Number)(input);
4204
4204
  }
4205
4205
  var ERR_INVALID_ARG_TYPE = require_errors2().codes.ERR_INVALID_ARG_TYPE;
4206
- function from(Readable7, iterable, opts) {
4206
+ function from(Readable8, iterable, opts) {
4207
4207
  var iterator;
4208
4208
  if (iterable && typeof iterable.next === "function") {
4209
4209
  iterator = iterable;
4210
4210
  } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();
4211
4211
  else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();
4212
4212
  else throw new ERR_INVALID_ARG_TYPE("iterable", ["Iterable"], iterable);
4213
- var readable = new Readable7(_objectSpread({
4213
+ var readable = new Readable8(_objectSpread({
4214
4214
  objectMode: true
4215
4215
  }, opts));
4216
4216
  var reading = false;
@@ -4250,9 +4250,9 @@ var require_from = __commonJS({
4250
4250
  var require_stream_readable = __commonJS({
4251
4251
  "../../node_modules/readable-stream/lib/_stream_readable.js"(exports2, module2) {
4252
4252
  "use strict";
4253
- module2.exports = Readable7;
4253
+ module2.exports = Readable8;
4254
4254
  var Duplex;
4255
- Readable7.ReadableState = ReadableState;
4255
+ Readable8.ReadableState = ReadableState;
4256
4256
  var EE = require("events").EventEmitter;
4257
4257
  var EElistenerCount = function EElistenerCount2(emitter, type) {
4258
4258
  return emitter.listeners(type).length;
@@ -4287,7 +4287,7 @@ var require_stream_readable = __commonJS({
4287
4287
  var StringDecoder;
4288
4288
  var createReadableStreamAsyncIterator;
4289
4289
  var from;
4290
- require_inherits()(Readable7, Stream);
4290
+ require_inherits()(Readable8, Stream);
4291
4291
  var errorOrDestroy = destroyImpl.errorOrDestroy;
4292
4292
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
4293
4293
  function prependListener(emitter, event, fn) {
@@ -4331,9 +4331,9 @@ var require_stream_readable = __commonJS({
4331
4331
  this.encoding = options.encoding;
4332
4332
  }
4333
4333
  }
4334
- function Readable7(options) {
4334
+ function Readable8(options) {
4335
4335
  Duplex = Duplex || require_stream_duplex();
4336
- if (!(this instanceof Readable7)) return new Readable7(options);
4336
+ if (!(this instanceof Readable8)) return new Readable8(options);
4337
4337
  var isDuplex = this instanceof Duplex;
4338
4338
  this._readableState = new ReadableState(options, this, isDuplex);
4339
4339
  this.readable = true;
@@ -4343,7 +4343,7 @@ var require_stream_readable = __commonJS({
4343
4343
  }
4344
4344
  Stream.call(this);
4345
4345
  }
4346
- Object.defineProperty(Readable7.prototype, "destroyed", {
4346
+ Object.defineProperty(Readable8.prototype, "destroyed", {
4347
4347
  // making it explicit this property is not enumerable
4348
4348
  // because otherwise some prototype manipulation in
4349
4349
  // userland will fail
@@ -4361,12 +4361,12 @@ var require_stream_readable = __commonJS({
4361
4361
  this._readableState.destroyed = value;
4362
4362
  }
4363
4363
  });
4364
- Readable7.prototype.destroy = destroyImpl.destroy;
4365
- Readable7.prototype._undestroy = destroyImpl.undestroy;
4366
- Readable7.prototype._destroy = function(err2, cb) {
4364
+ Readable8.prototype.destroy = destroyImpl.destroy;
4365
+ Readable8.prototype._undestroy = destroyImpl.undestroy;
4366
+ Readable8.prototype._destroy = function(err2, cb) {
4367
4367
  cb(err2);
4368
4368
  };
4369
- Readable7.prototype.push = function(chunk, encoding) {
4369
+ Readable8.prototype.push = function(chunk, encoding) {
4370
4370
  var state2 = this._readableState;
4371
4371
  var skipChunkCheck;
4372
4372
  if (!state2.objectMode) {
@@ -4383,7 +4383,7 @@ var require_stream_readable = __commonJS({
4383
4383
  }
4384
4384
  return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
4385
4385
  };
4386
- Readable7.prototype.unshift = function(chunk) {
4386
+ Readable8.prototype.unshift = function(chunk) {
4387
4387
  return readableAddChunk(this, chunk, null, true, false);
4388
4388
  };
4389
4389
  function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
@@ -4444,10 +4444,10 @@ var require_stream_readable = __commonJS({
4444
4444
  }
4445
4445
  return er2;
4446
4446
  }
4447
- Readable7.prototype.isPaused = function() {
4447
+ Readable8.prototype.isPaused = function() {
4448
4448
  return this._readableState.flowing === false;
4449
4449
  };
4450
- Readable7.prototype.setEncoding = function(enc) {
4450
+ Readable8.prototype.setEncoding = function(enc) {
4451
4451
  if (!StringDecoder) StringDecoder = require_string_decoder().StringDecoder;
4452
4452
  var decoder = new StringDecoder(enc);
4453
4453
  this._readableState.decoder = decoder;
@@ -4493,7 +4493,7 @@ var require_stream_readable = __commonJS({
4493
4493
  }
4494
4494
  return state2.length;
4495
4495
  }
4496
- Readable7.prototype.read = function(n4) {
4496
+ Readable8.prototype.read = function(n4) {
4497
4497
  debug("read", n4);
4498
4498
  n4 = parseInt(n4, 10);
4499
4499
  var state2 = this._readableState;
@@ -4602,10 +4602,10 @@ var require_stream_readable = __commonJS({
4602
4602
  }
4603
4603
  state2.readingMore = false;
4604
4604
  }
4605
- Readable7.prototype._read = function(n4) {
4605
+ Readable8.prototype._read = function(n4) {
4606
4606
  errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED("_read()"));
4607
4607
  };
4608
- Readable7.prototype.pipe = function(dest, pipeOpts) {
4608
+ Readable8.prototype.pipe = function(dest, pipeOpts) {
4609
4609
  var src = this;
4610
4610
  var state2 = this._readableState;
4611
4611
  switch (state2.pipesCount) {
@@ -4708,7 +4708,7 @@ var require_stream_readable = __commonJS({
4708
4708
  }
4709
4709
  };
4710
4710
  }
4711
- Readable7.prototype.unpipe = function(dest) {
4711
+ Readable8.prototype.unpipe = function(dest) {
4712
4712
  var state2 = this._readableState;
4713
4713
  var unpipeInfo = {
4714
4714
  hasUnpiped: false
@@ -4742,7 +4742,7 @@ var require_stream_readable = __commonJS({
4742
4742
  dest.emit("unpipe", this, unpipeInfo);
4743
4743
  return this;
4744
4744
  };
4745
- Readable7.prototype.on = function(ev, fn) {
4745
+ Readable8.prototype.on = function(ev, fn) {
4746
4746
  var res = Stream.prototype.on.call(this, ev, fn);
4747
4747
  var state2 = this._readableState;
4748
4748
  if (ev === "data") {
@@ -4763,15 +4763,15 @@ var require_stream_readable = __commonJS({
4763
4763
  }
4764
4764
  return res;
4765
4765
  };
4766
- Readable7.prototype.addListener = Readable7.prototype.on;
4767
- Readable7.prototype.removeListener = function(ev, fn) {
4766
+ Readable8.prototype.addListener = Readable8.prototype.on;
4767
+ Readable8.prototype.removeListener = function(ev, fn) {
4768
4768
  var res = Stream.prototype.removeListener.call(this, ev, fn);
4769
4769
  if (ev === "readable") {
4770
4770
  process.nextTick(updateReadableListening, this);
4771
4771
  }
4772
4772
  return res;
4773
4773
  };
4774
- Readable7.prototype.removeAllListeners = function(ev) {
4774
+ Readable8.prototype.removeAllListeners = function(ev) {
4775
4775
  var res = Stream.prototype.removeAllListeners.apply(this, arguments);
4776
4776
  if (ev === "readable" || ev === void 0) {
4777
4777
  process.nextTick(updateReadableListening, this);
@@ -4791,7 +4791,7 @@ var require_stream_readable = __commonJS({
4791
4791
  debug("readable nexttick read 0");
4792
4792
  self2.read(0);
4793
4793
  }
4794
- Readable7.prototype.resume = function() {
4794
+ Readable8.prototype.resume = function() {
4795
4795
  var state2 = this._readableState;
4796
4796
  if (!state2.flowing) {
4797
4797
  debug("resume");
@@ -4817,7 +4817,7 @@ var require_stream_readable = __commonJS({
4817
4817
  flow(stream);
4818
4818
  if (state2.flowing && !state2.reading) stream.read(0);
4819
4819
  }
4820
- Readable7.prototype.pause = function() {
4820
+ Readable8.prototype.pause = function() {
4821
4821
  debug("call pause flowing=%j", this._readableState.flowing);
4822
4822
  if (this._readableState.flowing !== false) {
4823
4823
  debug("pause");
@@ -4832,7 +4832,7 @@ var require_stream_readable = __commonJS({
4832
4832
  debug("flow", state2.flowing);
4833
4833
  while (state2.flowing && stream.read() !== null) ;
4834
4834
  }
4835
- Readable7.prototype.wrap = function(stream) {
4835
+ Readable8.prototype.wrap = function(stream) {
4836
4836
  var _this = this;
4837
4837
  var state2 = this._readableState;
4838
4838
  var paused = false;
@@ -4877,14 +4877,14 @@ var require_stream_readable = __commonJS({
4877
4877
  return this;
4878
4878
  };
4879
4879
  if (typeof Symbol === "function") {
4880
- Readable7.prototype[Symbol.asyncIterator] = function() {
4880
+ Readable8.prototype[Symbol.asyncIterator] = function() {
4881
4881
  if (createReadableStreamAsyncIterator === void 0) {
4882
4882
  createReadableStreamAsyncIterator = require_async_iterator();
4883
4883
  }
4884
4884
  return createReadableStreamAsyncIterator(this);
4885
4885
  };
4886
4886
  }
4887
- Object.defineProperty(Readable7.prototype, "readableHighWaterMark", {
4887
+ Object.defineProperty(Readable8.prototype, "readableHighWaterMark", {
4888
4888
  // making it explicit this property is not enumerable
4889
4889
  // because otherwise some prototype manipulation in
4890
4890
  // userland will fail
@@ -4893,7 +4893,7 @@ var require_stream_readable = __commonJS({
4893
4893
  return this._readableState.highWaterMark;
4894
4894
  }
4895
4895
  });
4896
- Object.defineProperty(Readable7.prototype, "readableBuffer", {
4896
+ Object.defineProperty(Readable8.prototype, "readableBuffer", {
4897
4897
  // making it explicit this property is not enumerable
4898
4898
  // because otherwise some prototype manipulation in
4899
4899
  // userland will fail
@@ -4902,7 +4902,7 @@ var require_stream_readable = __commonJS({
4902
4902
  return this._readableState && this._readableState.buffer;
4903
4903
  }
4904
4904
  });
4905
- Object.defineProperty(Readable7.prototype, "readableFlowing", {
4905
+ Object.defineProperty(Readable8.prototype, "readableFlowing", {
4906
4906
  // making it explicit this property is not enumerable
4907
4907
  // because otherwise some prototype manipulation in
4908
4908
  // userland will fail
@@ -4916,8 +4916,8 @@ var require_stream_readable = __commonJS({
4916
4916
  }
4917
4917
  }
4918
4918
  });
4919
- Readable7._fromList = fromList;
4920
- Object.defineProperty(Readable7.prototype, "readableLength", {
4919
+ Readable8._fromList = fromList;
4920
+ Object.defineProperty(Readable8.prototype, "readableLength", {
4921
4921
  // making it explicit this property is not enumerable
4922
4922
  // because otherwise some prototype manipulation in
4923
4923
  // userland will fail
@@ -4963,11 +4963,11 @@ var require_stream_readable = __commonJS({
4963
4963
  }
4964
4964
  }
4965
4965
  if (typeof Symbol === "function") {
4966
- Readable7.from = function(iterable, opts) {
4966
+ Readable8.from = function(iterable, opts) {
4967
4967
  if (from === void 0) {
4968
4968
  from = require_from();
4969
4969
  }
4970
- return from(Readable7, iterable, opts);
4970
+ return from(Readable8, iterable, opts);
4971
4971
  };
4972
4972
  }
4973
4973
  function indexOf(xs2, x2) {
@@ -4989,9 +4989,9 @@ var require_stream_duplex = __commonJS({
4989
4989
  return keys2;
4990
4990
  };
4991
4991
  module2.exports = Duplex;
4992
- var Readable7 = require_stream_readable();
4992
+ var Readable8 = require_stream_readable();
4993
4993
  var Writable2 = require_stream_writable();
4994
- require_inherits()(Duplex, Readable7);
4994
+ require_inherits()(Duplex, Readable8);
4995
4995
  {
4996
4996
  keys = objectKeys(Writable2.prototype);
4997
4997
  for (v3 = 0; v3 < keys.length; v3++) {
@@ -5004,7 +5004,7 @@ var require_stream_duplex = __commonJS({
5004
5004
  var v3;
5005
5005
  function Duplex(options) {
5006
5006
  if (!(this instanceof Duplex)) return new Duplex(options);
5007
- Readable7.call(this, options);
5007
+ Readable8.call(this, options);
5008
5008
  Writable2.call(this, options);
5009
5009
  this.allowHalfOpen = true;
5010
5010
  if (options) {
@@ -6546,7 +6546,7 @@ var require_pipeline = __commonJS({
6546
6546
  if (typeof streams[streams.length - 1] !== "function") return noop;
6547
6547
  return streams.pop();
6548
6548
  }
6549
- function pipeline5() {
6549
+ function pipeline6() {
6550
6550
  for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
6551
6551
  streams[_key] = arguments[_key];
6552
6552
  }
@@ -6569,7 +6569,7 @@ var require_pipeline = __commonJS({
6569
6569
  });
6570
6570
  return streams.reduce(pipe);
6571
6571
  }
6572
- module2.exports = pipeline5;
6572
+ module2.exports = pipeline6;
6573
6573
  }
6574
6574
  });
6575
6575
 
@@ -10323,7 +10323,7 @@ var require_logger = __commonJS({
10323
10323
  */
10324
10324
  configure({
10325
10325
  silent,
10326
- format: format3,
10326
+ format: format4,
10327
10327
  defaultMeta,
10328
10328
  levels,
10329
10329
  level = "info",
@@ -10342,7 +10342,7 @@ var require_logger = __commonJS({
10342
10342
  this.clear();
10343
10343
  }
10344
10344
  this.silent = silent;
10345
- this.format = format3 || this.format || require_json()();
10345
+ this.format = format4 || this.format || require_json()();
10346
10346
  this.defaultMeta = defaultMeta || null;
10347
10347
  this.levels = levels || this.levels || config.npm.levels;
10348
10348
  this.level = level;
@@ -11164,18 +11164,32 @@ ${stack}` : base;
11164
11164
  });
11165
11165
 
11166
11166
  // ../../packages/logger/src/logger/Logger.ts
11167
- var import_chalk, MAX_CAUSE_DEPTH, Logger, logger, Logger_default;
11167
+ var import_util, import_chalk, MAX_CAUSE_DEPTH, LOG_RECORD_VERSION, MAX_FIELD_CHARS, ANSI_PATTERN, nativeConsole, Logger, logger, Logger_default;
11168
11168
  var init_Logger = __esm({
11169
11169
  "../../packages/logger/src/logger/Logger.ts"() {
11170
+ import_util = require("util");
11171
+ init_src();
11170
11172
  import_chalk = __toESM(require("chalk"), 1);
11171
11173
  init_FileLogService();
11172
11174
  MAX_CAUSE_DEPTH = 10;
11175
+ LOG_RECORD_VERSION = 1;
11176
+ MAX_FIELD_CHARS = 3e4;
11177
+ ANSI_PATTERN = /\u001B\[[0-9;]*m/g;
11178
+ nativeConsole = {
11179
+ log: console.log.bind(console),
11180
+ info: console.info.bind(console),
11181
+ warn: console.warn.bind(console),
11182
+ error: console.error.bind(console)
11183
+ };
11173
11184
  Logger = class {
11174
11185
  constructor() {
11175
11186
  // Counts lines written to the console. In-place TTY renderers (the CLI progress bar) read it to
11176
11187
  // detect that something else has printed since their last frame, so they redraw on a new line
11177
11188
  // instead of moving the cursor up and overwriting a log message.
11178
11189
  this._consoleWrites = 0;
11190
+ // Whether console.* has been redirected into this logger. Once per process, and one-way: our
11191
+ // own writes use `nativeConsole`, so there is nothing to restore it for.
11192
+ this._consoleCaptured = false;
11179
11193
  this.setLevel = (level) => this._level = level;
11180
11194
  this.enableFileLogging = (folder, file) => {
11181
11195
  this._fileLoggingFolder = folder;
@@ -11209,9 +11223,28 @@ var init_Logger = __esm({
11209
11223
  this._level = "debug";
11210
11224
  if (fileLoggingFolder && process.env.NODE_ENV !== "development") {
11211
11225
  this.enableFileLogging(fileLoggingFolder);
11212
- console.error("Enabled file logger.");
11226
+ nativeConsole.error("Enabled file logger.");
11213
11227
  }
11214
11228
  };
11229
+ /**
11230
+ * Routes `console.*` through this logger, so code that never heard of it still writes one line
11231
+ * per record. Call once from a deployed process entrypoint; a no-op under the `text` format,
11232
+ * where a human is reading the console and Node's own formatting is the better rendering.
11233
+ *
11234
+ * Interception rather than a sweep of the call sites: the requirement is about the STREAM, not
11235
+ * about our code — an express handler, a driver and a dependency all write to the same stdout,
11236
+ * and a rule enforced at the call sites is a rule that the next `console.error` breaks.
11237
+ */
11238
+ this.captureConsole = () => {
11239
+ if (this._consoleCaptured) return;
11240
+ if (this.consoleFormat() !== "json") return;
11241
+ this._consoleCaptured = true;
11242
+ console.log = (...args) => this.info((0, import_util.format)(...args));
11243
+ console.info = console.log;
11244
+ console.debug = (...args) => this.log((0, import_util.format)(...args));
11245
+ console.warn = (...args) => this.warn((0, import_util.format)(...args));
11246
+ console.error = (...args) => args.length === 1 && args[0] instanceof Error ? this.error(args[0]) : this.error((0, import_util.format)(...args));
11247
+ };
11215
11248
  // The file sink replaces the console only for the CLI: there a human is watching the progress bar
11216
11249
  // and can read the log file afterwards. Anywhere else that file sits on an ephemeral container
11217
11250
  // layer nobody reads, and stdout is the only sink reaching the log driver (ECS -> CloudWatch), so
@@ -11222,18 +11255,15 @@ var init_Logger = __esm({
11222
11255
  if (myLevel !== "debug") return;
11223
11256
  FileLogService_default.write("DEBUG", String(message));
11224
11257
  if (this.isConsoleSuppressed()) return;
11225
- console.log(import_chalk.default.cyanBright("DEBUG"), message);
11226
- this._consoleWrites++;
11258
+ this.writeConsole("debug", message);
11227
11259
  };
11228
11260
  this.info = (message) => {
11229
11261
  FileLogService_default.write("INFO", String(message));
11230
11262
  if (this.isConsoleSuppressed()) return;
11231
- console.info(message);
11232
- this._consoleWrites++;
11263
+ this.writeConsole("info", message);
11233
11264
  };
11234
11265
  this.warn = (message) => {
11235
- console.warn(message);
11236
- this._consoleWrites++;
11266
+ this.writeConsole("warn", message);
11237
11267
  FileLogService_default.write("WARN", String(message));
11238
11268
  };
11239
11269
  this.flush = () => FileLogService_default.flush();
@@ -11251,11 +11281,88 @@ var init_Logger = __esm({
11251
11281
  message = String(error);
11252
11282
  }
11253
11283
  const suppressed = this.isConsoleSuppressed();
11254
- console.error(message);
11255
- this._consoleWrites++;
11284
+ this.writeConsole("error", message, suppressed ? void 0 : stack);
11256
11285
  FileLogService_default.write("ERROR", message, stack);
11257
- if (stack && !suppressed)
11258
- console.error(stack);
11286
+ };
11287
+ /**
11288
+ * How console records are rendered: `text` for a human at a terminal, `json` for a log pipeline.
11289
+ *
11290
+ * Deployed processes default to `json` because there ONE RECORD MUST BE ONE LINE: the awslogs
11291
+ * driver turns every newline on stdout into its own CloudWatch event, so a stack trace arrived as
11292
+ * thirty separate events, none of them carrying the message they belonged to, interleaved with
11293
+ * whatever the other threads were writing. `REMORA_LOG_FORMAT` overrides the default either way.
11294
+ * Same rule as StateEmitter, whose records share the stream.
11295
+ */
11296
+ this.consoleFormat = () => {
11297
+ const configured = process.env.REMORA_LOG_FORMAT?.toLowerCase();
11298
+ if (configured === "json" || configured === "text")
11299
+ return configured;
11300
+ return process.env.REMORA_RUNTIME_CONTEXT === "cli" ? "text" : "json";
11301
+ };
11302
+ /**
11303
+ * The one place anything of ours reaches the console.
11304
+ *
11305
+ * `stack` belongs to the record it explains: a second line in text mode, a field of the same JSON
11306
+ * object in json mode — never a record of its own, which is how it would lose its message.
11307
+ */
11308
+ this.writeConsole = (level, message, stack) => {
11309
+ this._consoleWrites++;
11310
+ if (this.consoleFormat() === "json")
11311
+ return this.writeJson(level, message, stack);
11312
+ this.writeText(level, message, stack);
11313
+ };
11314
+ this.writeText = (level, message, stack) => {
11315
+ if (level === "debug")
11316
+ nativeConsole.log(import_chalk.default.cyanBright("DEBUG"), message);
11317
+ else if (level === "info")
11318
+ nativeConsole.info(message);
11319
+ else if (level === "warn")
11320
+ nativeConsole.warn(message);
11321
+ else
11322
+ nativeConsole.error(message);
11323
+ if (stack)
11324
+ nativeConsole.error(stack);
11325
+ };
11326
+ /**
11327
+ * One JSON object, one line, one log event. Written straight to the stream rather than through
11328
+ * `console`, which reformats and re-wraps what it is given.
11329
+ */
11330
+ this.writeJson = (level, message, stack) => {
11331
+ const record = {
11332
+ remora: "log",
11333
+ v: LOG_RECORD_VERSION,
11334
+ ts: DSTE_default.now().toISOString(),
11335
+ level,
11336
+ message: this.asField(message),
11337
+ ...stack ? { stack: this.asField(stack) } : {}
11338
+ };
11339
+ const stream = level === "warn" || level === "error" ? process.stderr : process.stdout;
11340
+ stream.write(`${this.stringify(record)}
11341
+ `);
11342
+ };
11343
+ /** A loggable value as one clamped, colour-free string. */
11344
+ this.asField = (value) => {
11345
+ const plain = this.asText(value).replace(ANSI_PATTERN, "");
11346
+ if (plain.length <= MAX_FIELD_CHARS)
11347
+ return plain;
11348
+ return `${plain.slice(0, MAX_FIELD_CHARS)}\u2026[+${plain.length - MAX_FIELD_CHARS} chars]`;
11349
+ };
11350
+ this.asText = (value) => {
11351
+ if (typeof value === "string")
11352
+ return value;
11353
+ if (value instanceof Error)
11354
+ return value.stack ?? value.message;
11355
+ if (typeof value === "object" && value !== null)
11356
+ return this.stringify(value);
11357
+ return String(value);
11358
+ };
11359
+ /** JSON.stringify that cannot throw: a circular or unserializable value still has to be logged. */
11360
+ this.stringify = (value) => {
11361
+ try {
11362
+ return JSON.stringify(value);
11363
+ } catch {
11364
+ return String(value);
11365
+ }
11259
11366
  };
11260
11367
  // Node's Error.stack omits `cause` — only util.inspect renders it, and we log strings rather
11261
11368
  // than Error objects. Without unwrapping here the root reason of a wrapped error is lost on any
@@ -11575,7 +11682,7 @@ var CONSTANTS, Constants_default;
11575
11682
  var init_Constants = __esm({
11576
11683
  "../../packages/constants/src/Constants.ts"() {
11577
11684
  CONSTANTS = {
11578
- cliVersion: "2.0.3",
11685
+ cliVersion: "2.1.0",
11579
11686
  backendVersion: 1,
11580
11687
  backendPort: 5088,
11581
11688
  workerVersion: 2,
@@ -12624,10 +12731,10 @@ var init_Validator = __esm({
12624
12731
  errors.push(`There are outputs with the same type. (duplicates type: ${duplicatesTypes.join(" and ")})`);
12625
12732
  }
12626
12733
  for (const output of consumer.outputs) {
12627
- const format3 = output.format.toUpperCase();
12628
- if (format3 === "CSV" || format3 === "JSON" || format3 === "PARQUET" || format3 === "TXT") {
12734
+ const format4 = output.format.toUpperCase();
12735
+ if (format4 === "CSV" || format4 === "JSON" || format4 === "PARQUET" || format4 === "TXT") {
12629
12736
  if (!output.exportDestination)
12630
- errors.push(`A static file output must have an export destination set (${format3})`);
12737
+ errors.push(`A static file output must have an export destination set (${format4})`);
12631
12738
  else if (!Environment_default.getSource(output.exportDestination))
12632
12739
  errors.push(`The export destination "${output.exportDestination}" was not found in the sources.`);
12633
12740
  }
@@ -12699,14 +12806,14 @@ var init_Validator = __esm({
12699
12806
  const errors = [];
12700
12807
  const positionalFormats = ["CSV", "TXT", "PARQUET"];
12701
12808
  for (const output of (consumer.outputs ?? []).filter((x2) => x2.omitNull === true)) {
12702
- const format3 = output.format.toUpperCase();
12703
- if (positionalFormats.includes(format3)) {
12704
- errors.push(`The ${format3} output of consumer "${consumer.name}" declares "omitNull", which only applies to JSON/API output: a positional column can't be omitted from a row.`);
12809
+ const format4 = output.format.toUpperCase();
12810
+ if (positionalFormats.includes(format4)) {
12811
+ errors.push(`The ${format4} output of consumer "${consumer.name}" declares "omitNull", which only applies to JSON/API output: a positional column can't be omitted from a row.`);
12705
12812
  continue;
12706
12813
  }
12707
12814
  const positional = (consumer.outputs ?? []).filter((x2) => positionalFormats.includes(x2.format.toUpperCase()));
12708
12815
  if (positional.length > 0)
12709
- errors.push(`The ${format3} output of consumer "${consumer.name}" declares "omitNull", but the consumer also writes ${positional.map((x2) => x2.format.toUpperCase()).join(" and ")}. Every output is serialized from one record, so omitting fields would break the positional one \u2014 split them into two consumers.`);
12816
+ errors.push(`The ${format4} output of consumer "${consumer.name}" declares "omitNull", but the consumer also writes ${positional.map((x2) => x2.format.toUpperCase()).join(" and ")}. Every output is serialized from one record, so omitting fields would break the positional one \u2014 split them into two consumers.`);
12710
12817
  }
12711
12818
  return errors;
12712
12819
  };
@@ -17759,17 +17866,17 @@ var init_split_header = __esm({
17759
17866
  });
17760
17867
 
17761
17868
  // ../../node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js
17762
- var format2, NumericValue;
17869
+ var format3, NumericValue;
17763
17870
  var init_NumericValue = __esm({
17764
17871
  "../../node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js"() {
17765
- format2 = /^-?\d*(\.\d+)?$/;
17872
+ format3 = /^-?\d*(\.\d+)?$/;
17766
17873
  NumericValue = class _NumericValue {
17767
17874
  string;
17768
17875
  type;
17769
17876
  constructor(string, type) {
17770
17877
  this.string = string;
17771
17878
  this.type = type;
17772
- if (!format2.test(string)) {
17879
+ if (!format3.test(string)) {
17773
17880
  throw new Error(`@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".`);
17774
17881
  }
17775
17882
  }
@@ -17781,7 +17888,7 @@ var init_NumericValue = __esm({
17781
17888
  return false;
17782
17889
  }
17783
17890
  const _nv = object;
17784
- return _NumericValue.prototype.isPrototypeOf(object) || _nv.type === "bigDecimal" && format2.test(_nv.string);
17891
+ return _NumericValue.prototype.isPrototypeOf(object) || _nv.type === "bigDecimal" && format3.test(_nv.string);
17785
17892
  }
17786
17893
  };
17787
17894
  }
@@ -21246,8 +21353,8 @@ var init_FromStringShapeDeserializer = __esm({
21246
21353
  return (this.serdeContext?.base64Decoder ?? fromBase64)(data);
21247
21354
  }
21248
21355
  if (ns2.isTimestampSchema()) {
21249
- const format3 = determineTimestampFormat(ns2, this.settings);
21250
- switch (format3) {
21356
+ const format4 = determineTimestampFormat(ns2, this.settings);
21357
+ switch (format4) {
21251
21358
  case 5:
21252
21359
  return _parseRfc3339DateTimeWithOffset(data);
21253
21360
  case 6:
@@ -21369,8 +21476,8 @@ var init_ToStringShapeSerializer = __esm({
21369
21476
  if (!(value instanceof Date)) {
21370
21477
  throw new Error(`@smithy/core/protocols - received non-Date value ${value} when schema expected Date in ${ns2.getName(true)}`);
21371
21478
  }
21372
- const format3 = determineTimestampFormat(ns2, this.settings);
21373
- switch (format3) {
21479
+ const format4 = determineTimestampFormat(ns2, this.settings);
21480
+ switch (format4) {
21374
21481
  case 5:
21375
21482
  this.stringBuffer = value.toISOString().replace(".000Z", "Z");
21376
21483
  break;
@@ -26604,8 +26711,8 @@ var init_JsonShapeDeserializer = __esm({
26604
26711
  return value;
26605
26712
  }
26606
26713
  if (ns2.isTimestampSchema() && value != null) {
26607
- const format3 = determineTimestampFormat(ns2, this.settings);
26608
- switch (format3) {
26714
+ const format4 = determineTimestampFormat(ns2, this.settings);
26715
+ switch (format4) {
26609
26716
  case 5:
26610
26717
  return parseRfc3339DateTimeWithOffset(value);
26611
26718
  case 6:
@@ -26829,8 +26936,8 @@ var init_JsonShapeSerializer = __esm({
26829
26936
  return (this.serdeContext?.base64Encoder ?? toBase64)(value);
26830
26937
  }
26831
26938
  if (value instanceof Date && (ns2.isTimestampSchema() || ns2.isDocumentSchema())) {
26832
- const format3 = determineTimestampFormat(ns2, this.settings);
26833
- switch (format3) {
26939
+ const format4 = determineTimestampFormat(ns2, this.settings);
26940
+ switch (format4) {
26834
26941
  case 5:
26835
26942
  return value.toISOString().replace(".000Z", "Z");
26836
26943
  case 6:
@@ -27458,8 +27565,8 @@ var init_QueryShapeSerializer = __esm({
27458
27565
  } else if (ns2.isTimestampSchema()) {
27459
27566
  if (value instanceof Date) {
27460
27567
  this.writeKey(prefix2);
27461
- const format3 = determineTimestampFormat(ns2, this.settings);
27462
- switch (format3) {
27568
+ const format4 = determineTimestampFormat(ns2, this.settings);
27569
+ switch (format4) {
27463
27570
  case 5:
27464
27571
  this.writeValue(value.toISOString().replace(".000Z", "Z"));
27465
27572
  break;
@@ -41894,11 +42001,13 @@ var init_src6 = __esm({
41894
42001
  });
41895
42002
 
41896
42003
  // ../../packages/drivers/src/DeltaShareDriver.ts
41897
- var fs9, import_promises7, MAX_LIMIT_HINT, DeltaShareSourceDriver, DeltaShareDriver_default;
42004
+ var fs9, import_promises7, import_stream, import_promises8, MAX_LIMIT_HINT, PARQUET_BATCH_ROWS, DeltaShareSourceDriver, DeltaShareDriver_default;
41898
42005
  var init_DeltaShareDriver = __esm({
41899
42006
  "../../packages/drivers/src/DeltaShareDriver.ts"() {
41900
42007
  fs9 = __toESM(require("fs"), 1);
41901
42008
  import_promises7 = __toESM(require("fs/promises"), 1);
42009
+ import_stream = require("stream");
42010
+ import_promises8 = require("stream/promises");
41902
42011
  init_src();
41903
42012
  init_src4();
41904
42013
  init_src2();
@@ -41906,6 +42015,7 @@ var init_DeltaShareDriver = __esm({
41906
42015
  init_DeltaSharePredicate();
41907
42016
  init_OidcTokenProvider();
41908
42017
  MAX_LIMIT_HINT = 2147483647;
42018
+ PARQUET_BATCH_ROWS = 5e4;
41909
42019
  DeltaShareSourceDriver = class {
41910
42020
  constructor() {
41911
42021
  this._query = "{prefix}/shares/{share}/schemas/{schema}/tables/{table}/query";
@@ -41915,6 +42025,9 @@ var init_DeltaShareDriver = __esm({
41915
42025
  // Column Delta types per table, for the predicate's literals. A table's schema does not change
41916
42026
  // under a run, and only a read with something to push ever asks for it.
41917
42027
  this._columnTypes = /* @__PURE__ */ new Map();
42028
+ // Rows held as objects at once. A run leaves this at PARQUET_BATCH_ROWS; the tests lower it so a
42029
+ // fixture small enough to read whole still splits its row groups the way a real part file does.
42030
+ this._batchRows = PARQUET_BATCH_ROWS;
41918
42031
  this.init = async (source) => {
41919
42032
  Affirm_default(source, "Invalid source");
41920
42033
  const { authentication } = source;
@@ -41975,12 +42088,11 @@ var init_DeltaShareDriver = __esm({
41975
42088
  Affirm_default(request, "Invalid download request");
41976
42089
  const table = this._resolveTable(request.fileKey);
41977
42090
  const deltaFiles = await this._getAllFilesInTable(table, request.disableHistory);
41978
- const hyparquet = await import("hyparquet");
41979
42091
  const lines = [];
41980
- for (const deltaFile of deltaFiles) {
41981
- const parquetRecords = await this._readParquetObjects(deltaFile);
41982
- lines.push(...parquetRecords.map((x2) => JSON.stringify(hyparquet.toJson(x2))));
41983
- }
42092
+ for (const deltaFile of deltaFiles)
42093
+ for await (const batch of this._readRemoteParquetBatches(deltaFile))
42094
+ for (const record of batch)
42095
+ lines.push(JSON.stringify(record));
41984
42096
  Logger_default.log(`Delta Share readAll: ${lines.length} record(s) from ${deltaFiles.length} file(s) of table "${table}"`);
41985
42097
  return lines;
41986
42098
  };
@@ -41990,22 +42102,41 @@ var init_DeltaShareDriver = __esm({
41990
42102
  Affirm_default(request.options.lineFrom !== void 0 && request.options.lineTo !== void 0, "Missing read range");
41991
42103
  const table = this._resolveTable(request.fileKey);
41992
42104
  const deltaFiles = await this._getAllFilesInTable(table, request.disableHistory);
41993
- const hyparquet = await import("hyparquet");
41994
42105
  const { options: { lineFrom, lineTo } } = request;
42106
+ const lines = await this._collectLinesInRange(deltaFiles, { from: lineFrom, to: lineTo });
42107
+ Logger_default.log(`Delta Share readLinesInRange [${lineFrom}, ${lineTo}) on table "${table}": ${lines.length} record(s)`);
42108
+ return lines;
42109
+ };
42110
+ /**
42111
+ * The records of the given range, serialized. Reading stops the moment the range is filled: a
42112
+ * part file holds hundreds of thousands of rows and a preview asks for a handful of them, so
42113
+ * decoding past `to` is both slow and the memory the batching above exists to avoid.
42114
+ */
42115
+ this._collectLinesInRange = async (deltaFiles, range2) => {
42116
+ if (range2.to <= range2.from)
42117
+ return [];
41995
42118
  const lines = [];
41996
42119
  let index = 0;
41997
42120
  for (const deltaFile of deltaFiles) {
41998
- const parquetRecords = await this._readParquetObjects(deltaFile);
41999
- for (const record of parquetRecords) {
42000
- if (index >= lineFrom && index < lineTo)
42001
- lines.push(JSON.stringify(hyparquet.toJson(record)));
42002
- index++;
42003
- if (index >= lineTo) break;
42121
+ for await (const batch of this._readRemoteParquetBatches(deltaFile)) {
42122
+ index = this._pushRecordsInRange(lines, batch, index, range2);
42123
+ if (index >= range2.to)
42124
+ return lines;
42004
42125
  }
42005
42126
  }
42006
- Logger_default.log(`Delta Share readLinesInRange [${lineFrom}, ${lineTo}) on table "${table}": ${lines.length} record(s)`);
42007
42127
  return lines;
42008
42128
  };
42129
+ // The index the batch ends on, so the next batch carries on counting where this one stopped.
42130
+ this._pushRecordsInRange = (lines, batch, index, range2) => {
42131
+ for (const record of batch) {
42132
+ if (index >= range2.from && index < range2.to)
42133
+ lines.push(JSON.stringify(record));
42134
+ index++;
42135
+ if (index >= range2.to)
42136
+ break;
42137
+ }
42138
+ return index;
42139
+ };
42009
42140
  this.exist = async (_producer) => {
42010
42141
  void _producer;
42011
42142
  let nextPageToken;
@@ -42149,20 +42280,48 @@ var init_DeltaShareDriver = __esm({
42149
42280
  return "(unparseable url)";
42150
42281
  }
42151
42282
  };
42152
- this._readParquetObjects = async (deltaFile) => {
42283
+ // Split out so the batch loop above stays one level of nesting, and so both failures name the file
42284
+ this._readParquetMetadata = async (file, label) => {
42153
42285
  const hyparquet = await import("hyparquet");
42154
- const { compressors: compressors2 } = await Promise.resolve().then(() => (init_src6(), src_exports));
42155
- const byteLength = deltaFile.file.deltaSingleAction.add?.size ?? deltaFile.file.deltaSingleAction.remove?.size;
42156
- const startedMs = Date.now();
42157
- let records;
42158
42286
  try {
42159
- const file = await hyparquet.asyncBufferFromUrl({ url: deltaFile.file.url, byteLength });
42160
- records = await hyparquet.parquetReadObjects({ file, compressors: compressors2 });
42287
+ return await hyparquet.parquetMetadataAsync(file);
42161
42288
  } catch (error) {
42162
- throw new Error(`Delta Share failed reading parquet from ${this._redactUrl(deltaFile.file.url)} (${byteLength ?? "?"} bytes)`, { cause: error });
42289
+ throw new Error(`Delta Share failed reading the parquet footer of ${label}`, { cause: error });
42290
+ }
42291
+ };
42292
+ this._readParquetBatch = async (options, label) => {
42293
+ const hyparquet = await import("hyparquet");
42294
+ try {
42295
+ return await hyparquet.parquetReadObjects(options);
42296
+ } catch (error) {
42297
+ throw new Error(`Delta Share failed reading parquet rows [${options.rowStart}, ${options.rowEnd}) of ${label}`, { cause: error });
42163
42298
  }
42164
- Logger_default.log(`Delta Share read ${records.length} record(s) from ${this._redactUrl(deltaFile.file.url)} (${byteLength ?? "?"} bytes) in ${Date.now() - startedMs}ms`);
42165
- return records;
42299
+ };
42300
+ // Reads straight from the pre-signed URL. Only for the bounded readers (preview, sample): every
42301
+ // batch refetches the row group, which is why `ready` stages the file locally instead.
42302
+ this._readRemoteParquetBatches = (deltaFile) => {
42303
+ const byteLength = deltaFile.file.deltaSingleAction.add?.size ?? deltaFile.file.deltaSingleAction.remove?.size;
42304
+ const label = `${this._redactUrl(deltaFile.file.url)} (${byteLength ?? "?"} bytes)`;
42305
+ const open = async () => {
42306
+ const hyparquet = await import("hyparquet");
42307
+ return await hyparquet.asyncBufferFromUrl({ url: deltaFile.file.url, byteLength });
42308
+ };
42309
+ return this._streamParquetBatchesFrom(open, label);
42310
+ };
42311
+ /**
42312
+ * Copies a part file to local disk, streamed, so nothing but the socket buffer is ever in memory.
42313
+ * `ready` re-reads the file once per batch and re-reading it over HTTP would refetch the same
42314
+ * bytes every time.
42315
+ */
42316
+ this._downloadParquet = async (deltaFile, localPath) => {
42317
+ const startedMs = Date.now();
42318
+ const res = await this._fetch(deltaFile.file.url, { method: "GET" }, `parquet download of ${this._redactUrl(deltaFile.file.url)}`);
42319
+ if (!res.ok)
42320
+ throw new Error(`Error downloading parquet from the delta share: ${res.status} ${res.statusText} (${this._redactUrl(deltaFile.file.url)})`);
42321
+ Affirm_default(res.body, `Empty response body downloading parquet from ${this._redactUrl(deltaFile.file.url)}`);
42322
+ await (0, import_promises8.pipeline)(import_stream.Readable.fromWeb(res.body), fs9.createWriteStream(localPath));
42323
+ const { size } = await import_promises7.default.stat(localPath);
42324
+ Logger_default.log(`Delta Share staged ${this._redactUrl(deltaFile.file.url)} (${size} bytes) in ${Date.now() - startedMs}ms`);
42166
42325
  };
42167
42326
  this._serializeDatasetValue = (value) => {
42168
42327
  if (value === null || value === void 0)
@@ -42176,17 +42335,41 @@ var init_DeltaShareDriver = __esm({
42176
42335
  this._getDeltaFileKey = (table, index) => {
42177
42336
  return `${this._resolveSchema()}/${table}/part-${index}.parquet`;
42178
42337
  };
42179
- this._writeDatasetFile = async (localPath, records, delimiter) => {
42180
- if (records.length === 0)
42181
- return false;
42182
- const header = Object.keys(records[0]);
42183
- const lines = [
42184
- CSVParser_default.stringifyRow(header, delimiter),
42185
- ...records.map((record) => CSVParser_default.stringifyRow(header.map((column) => this._serializeDatasetValue(record[column])), delimiter))
42186
- ];
42187
- await import_promises7.default.writeFile(localPath, `${lines.join("\n")}
42188
- `);
42189
- return true;
42338
+ /**
42339
+ * Writes the batches out as one CSV dataset file and reports how many records landed. Rows are
42340
+ * written as they arrive rather than joined into one string first: a file's worth of lines, and
42341
+ * the single string joining them, were each as large as the records themselves.
42342
+ *
42343
+ * The header is taken from the first record and reused for every later one, so a file whose rows
42344
+ * disagree on their columns still produces a rectangular dataset.
42345
+ */
42346
+ this._writeDatasetFile = async (localPath, batches, delimiter) => {
42347
+ const stream = fs9.createWriteStream(localPath);
42348
+ let header = null;
42349
+ let records = 0;
42350
+ try {
42351
+ for await (const batch of batches) {
42352
+ for (const record of batch) {
42353
+ if (!header) {
42354
+ header = Object.keys(record);
42355
+ await this._writeLine(stream, CSVParser_default.stringifyRow(header, delimiter));
42356
+ }
42357
+ await this._writeLine(stream, CSVParser_default.stringifyRow(header.map((column) => this._serializeDatasetValue(record[column])), delimiter));
42358
+ records++;
42359
+ }
42360
+ }
42361
+ } finally {
42362
+ await new Promise((resolve) => stream.end(resolve));
42363
+ }
42364
+ return records;
42365
+ };
42366
+ // A false from write() means the buffer is full; waiting for the drain just then keeps the queued
42367
+ // rows bounded instead of letting them pile up faster than the disk takes them.
42368
+ this._writeLine = async (stream, line) => {
42369
+ if (stream.write(`${line}
42370
+ `))
42371
+ return;
42372
+ await new Promise((resolve) => stream.once("drain", resolve));
42190
42373
  };
42191
42374
  /**
42192
42375
  * Every file the share reports for this table. `jsonPredicateHints` lets the server skip the
@@ -42250,30 +42433,22 @@ var init_DeltaShareDriver = __esm({
42250
42433
  const table = this._resolveTable(producer.settings.fileKey);
42251
42434
  const hints = await this._buildHints(producer, table, request.pushdown);
42252
42435
  const deltaFiles = await this._getAllFilesInTable(table, producer.settings.disableHistory, hints);
42253
- const hyparquet = await import("hyparquet");
42254
42436
  const delimiter = producer.settings.delimiter ?? ",";
42255
42437
  const files = [];
42256
42438
  let records = 0;
42257
42439
  let skipped = 0;
42258
42440
  for (const [index, deltaFile] of deltaFiles.entries()) {
42259
42441
  onProgress?.(index / deltaFiles.length);
42260
- const parquetRecords = await this._readParquetObjects(deltaFile);
42261
- if (parquetRecords.length === 0) {
42262
- skipped++;
42263
- Logger_default.log(`Delta Share ready: file ${index + 1}/${deltaFiles.length} of table "${table}" holds no records, skipping`);
42264
- continue;
42265
- }
42266
42442
  const sourceFileKey = this._getDeltaFileKey(table, index);
42267
42443
  const localPath = ExecutorScope_default.getProducerPath(scope, producer, sourceFileKey);
42268
42444
  ExecutorScope_default.ensurePath(localPath);
42269
- const jsonRecords = parquetRecords.map((record) => hyparquet.toJson(record));
42270
- const written = await this._writeDatasetFile(localPath, jsonRecords, delimiter);
42271
- if (written) {
42445
+ const written = await this._stageDeltaFile(deltaFile, localPath, delimiter);
42446
+ if (written > 0) {
42272
42447
  files.push({ fullUri: localPath, fileSize: fs9.statSync(localPath).size });
42273
- records += jsonRecords.length;
42448
+ records += written;
42274
42449
  } else {
42275
42450
  skipped++;
42276
- Logger_default.log(`Delta Share ready: nothing written for ${sourceFileKey}, discarding the staged file`);
42451
+ Logger_default.log(`Delta Share ready: file ${index + 1}/${deltaFiles.length} of table "${table}" (${sourceFileKey}) holds no records, discarding the staged file`);
42277
42452
  await import_promises7.default.unlink(localPath).catch(() => {
42278
42453
  });
42279
42454
  }
@@ -42284,6 +42459,57 @@ var init_DeltaShareDriver = __esm({
42284
42459
  Logger_default.log(`Delta Share ready: staged ${records} record(s) into ${files.length} dataset file(s) (${bytes} bytes) for producer "${producer.name}" from table "${table}"${skippedNote}`);
42285
42460
  return { files, filteredAtSource: !!hints?.jsonPredicateHints };
42286
42461
  };
42462
+ /**
42463
+ * One part file turned into one CSV dataset file, downloaded then converted a batch at a time so
42464
+ * that neither step's memory grows with the file. The download is dropped either way — it is the
42465
+ * dataset file the run reads from here on.
42466
+ */
42467
+ this._stageDeltaFile = async (deltaFile, localPath, delimiter) => {
42468
+ const downloadPath = `${localPath}.parquet`;
42469
+ await this._downloadParquet(deltaFile, downloadPath);
42470
+ try {
42471
+ const open = async () => {
42472
+ const hyparquet = await import("hyparquet");
42473
+ return await hyparquet.asyncBufferFromFile(downloadPath);
42474
+ };
42475
+ return await this._writeDatasetFile(localPath, this._streamParquetBatchesFrom(open, this._redactUrl(deltaFile.file.url)), delimiter);
42476
+ } finally {
42477
+ await import_promises7.default.unlink(downloadPath).catch(() => {
42478
+ });
42479
+ }
42480
+ };
42481
+ }
42482
+ /**
42483
+ * The rows of a part file, `_batchRows` at a time and already JSON-safe.
42484
+ *
42485
+ * hyparquet decodes a whole row group's columns per read either way, but only the requested rows
42486
+ * are turned into objects — and the objects are what dominates — so a row group larger than a
42487
+ * batch is read in several passes. Every pass re-reads the group's bytes, which is why `ready`
42488
+ * stages the file on disk first and only the small readers below stream it from its URL.
42489
+ */
42490
+ async *_streamParquetBatches(file, label) {
42491
+ const hyparquet = await import("hyparquet");
42492
+ const { compressors: compressors2 } = await Promise.resolve().then(() => (init_src6(), src_exports));
42493
+ const startedMs = Date.now();
42494
+ const metadata = await this._readParquetMetadata(file, label);
42495
+ let records = 0;
42496
+ let groupStart = 0;
42497
+ for (const rowGroup of metadata.row_groups) {
42498
+ const groupRows = Number(rowGroup.num_rows);
42499
+ const groupEnd = groupStart + groupRows;
42500
+ for (let rowStart = groupStart; rowStart < groupEnd; rowStart += this._batchRows) {
42501
+ const rowEnd = Math.min(rowStart + this._batchRows, groupEnd);
42502
+ const batch = await this._readParquetBatch({ file, metadata, compressors: compressors2, rowStart, rowEnd }, label);
42503
+ records += batch.length;
42504
+ yield batch.map((record) => hyparquet.toJson(record));
42505
+ }
42506
+ groupStart = groupEnd;
42507
+ }
42508
+ Logger_default.log(`Delta Share read ${records} record(s) from ${label} in ${Date.now() - startedMs}ms`);
42509
+ }
42510
+ // The buffer is opened inside the generator so nothing is fetched until the first batch is pulled
42511
+ async *_streamParquetBatchesFrom(open, label) {
42512
+ yield* this._streamParquetBatches(await open(), label);
42287
42513
  }
42288
42514
  };
42289
42515
  DeltaShareDriver_default = DeltaShareSourceDriver;
@@ -42830,12 +43056,12 @@ var init_src7 = __esm({
42830
43056
  });
42831
43057
 
42832
43058
  // ../../packages/drivers/src/DriverHelper.ts
42833
- var import_stream, import_readline, import_promises8, import_fs9, DriverHelper, DriverHelper_default;
43059
+ var import_stream2, import_readline, import_promises9, import_fs9, DriverHelper, DriverHelper_default;
42834
43060
  var init_DriverHelper = __esm({
42835
43061
  "../../packages/drivers/src/DriverHelper.ts"() {
42836
- import_stream = require("stream");
43062
+ import_stream2 = require("stream");
42837
43063
  import_readline = require("readline");
42838
- import_promises8 = require("stream/promises");
43064
+ import_promises9 = require("stream/promises");
42839
43065
  import_fs9 = require("fs");
42840
43066
  init_src2();
42841
43067
  init_src();
@@ -42852,7 +43078,7 @@ var init_DriverHelper = __esm({
42852
43078
  let leftoverData = "";
42853
43079
  let globalIndex = 0;
42854
43080
  let lineCount = 0;
42855
- const headerValidationTransform = new import_stream.Transform({
43081
+ const headerValidationTransform = new import_stream2.Transform({
42856
43082
  transform(chunk, encoding, callback) {
42857
43083
  const chunkStr = leftoverData + chunk.toString();
42858
43084
  const lines = chunkStr.split("\n");
@@ -42928,7 +43154,7 @@ var init_DriverHelper = __esm({
42928
43154
  };
42929
43155
  const writeOptions = append ? { flags: "a" } : {};
42930
43156
  const writeStream = (0, import_fs9.createWriteStream)(destinationPath, writeOptions);
42931
- await (0, import_promises8.pipeline)(stream, headerValidationTransform, writeStream);
43157
+ await (0, import_promises9.pipeline)(stream, headerValidationTransform, writeStream);
42932
43158
  return lineCount;
42933
43159
  },
42934
43160
  appendObjectsToUnifiedFile: async (options) => {
@@ -43238,11 +43464,11 @@ var init_LocalSourceDriver = __esm({
43238
43464
  });
43239
43465
 
43240
43466
  // ../../packages/drivers/src/files/LocalDestinationDriver.ts
43241
- var fs11, import_promises9, import_readline3, import_path10, LocalDestinationDriver;
43467
+ var fs11, import_promises10, import_readline3, import_path10, LocalDestinationDriver;
43242
43468
  var init_LocalDestinationDriver = __esm({
43243
43469
  "../../packages/drivers/src/files/LocalDestinationDriver.ts"() {
43244
43470
  fs11 = __toESM(require("fs"), 1);
43245
- import_promises9 = __toESM(require("fs/promises"), 1);
43471
+ import_promises10 = __toESM(require("fs/promises"), 1);
43246
43472
  import_readline3 = __toESM(require("readline"), 1);
43247
43473
  import_path10 = __toESM(require("path"), 1);
43248
43474
  init_src();
@@ -43277,8 +43503,8 @@ var init_LocalDestinationDriver = __esm({
43277
43503
  this.move = async (fromPath, toName) => {
43278
43504
  try {
43279
43505
  const toFilePath = import_path10.default.join(this._path, toName);
43280
- await import_promises9.default.copyFile(fromPath, toFilePath);
43281
- await import_promises9.default.unlink(fromPath);
43506
+ await import_promises10.default.copyFile(fromPath, toFilePath);
43507
+ await import_promises10.default.unlink(fromPath);
43282
43508
  return { bucket: "", key: toFilePath, res: true };
43283
43509
  } catch (error) {
43284
43510
  Logger_default.error(error);
@@ -43314,14 +43540,14 @@ var init_LocalDestinationDriver = __esm({
43314
43540
  });
43315
43541
 
43316
43542
  // ../../packages/drivers/src/s3/S3SourceDriver.ts
43317
- var import_client_s32, import_stream2, import_promises10, import_readline4, import_path11, import_fs10, import_xlsx2, S3SourceDriver;
43543
+ var import_client_s32, import_stream3, import_promises11, import_readline4, import_path11, import_fs10, import_xlsx2, S3SourceDriver;
43318
43544
  var init_S3SourceDriver = __esm({
43319
43545
  "../../packages/drivers/src/s3/S3SourceDriver.ts"() {
43320
43546
  import_client_s32 = require("@aws-sdk/client-s3");
43321
43547
  init_src();
43322
43548
  init_AwsCredentials();
43323
- import_stream2 = require("stream");
43324
- import_promises10 = require("stream/promises");
43549
+ import_stream3 = require("stream");
43550
+ import_promises11 = require("stream/promises");
43325
43551
  import_readline4 = __toESM(require("readline"), 1);
43326
43552
  import_path11 = __toESM(require("path"), 1);
43327
43553
  import_fs10 = __toESM(require("fs"), 1);
@@ -43589,7 +43815,7 @@ var init_S3SourceDriver = __esm({
43589
43815
  }
43590
43816
  const totalBytes = response.ContentLength ?? 0;
43591
43817
  let stagedBytes = 0;
43592
- const meter = new import_stream2.Transform({
43818
+ const meter = new import_stream3.Transform({
43593
43819
  transform(chunk, _encoding, done) {
43594
43820
  stagedBytes += chunk.length;
43595
43821
  if (totalBytes > 0)
@@ -43598,7 +43824,7 @@ var init_S3SourceDriver = __esm({
43598
43824
  }
43599
43825
  });
43600
43826
  const writeStream = import_fs10.default.createWriteStream(localPath);
43601
- await (0, import_promises10.pipeline)(response.Body, meter, writeStream);
43827
+ await (0, import_promises11.pipeline)(response.Body, meter, writeStream);
43602
43828
  report(1);
43603
43829
  };
43604
43830
  if (fileKey.includes("%")) {
@@ -43978,7 +44204,7 @@ var init_TypeCaster = __esm({
43978
44204
  * - Parsing dates (type 'date'/'datetime') from string with tokens: yyyy, mm, dd
43979
44205
  * - Formatting dates when casting to string with same tokens
43980
44206
  */
43981
- cast(value, type, format3) {
44207
+ cast(value, type, format4) {
43982
44208
  if (!Algo_default.hasVal(value)) return value;
43983
44209
  switch (type) {
43984
44210
  case "boolean": {
@@ -43989,8 +44215,8 @@ var init_TypeCaster = __esm({
43989
44215
  case "date": {
43990
44216
  let dateValue = null;
43991
44217
  try {
43992
- if (format3 && typeof value === "string")
43993
- dateValue = this.parseDate(value, format3, true).toDate();
44218
+ if (format4 && typeof value === "string")
44219
+ dateValue = this.parseDate(value, format4, true).toDate();
43994
44220
  else
43995
44221
  dateValue = new Date(value);
43996
44222
  return dateValue.toISOString();
@@ -43998,7 +44224,7 @@ var init_TypeCaster = __esm({
43998
44224
  dateValue = new Date(value);
43999
44225
  if (!isNaN(dateValue))
44000
44226
  return dateValue.toISOString();
44001
- throw new Error(`Error casting "${value}" to date with format "${format3}": ${error}`);
44227
+ throw new Error(`Error casting "${value}" to date with format "${format4}": ${error}`);
44002
44228
  }
44003
44229
  }
44004
44230
  case "number": {
@@ -44025,13 +44251,13 @@ var init_TypeCaster = __esm({
44025
44251
  * advancedFormat plugin, and then unpadded for `DDD`, while a positional ordinal date is always
44026
44252
  * 3 digits wide; the token is therefore rendered here rather than handed to dayjs.
44027
44253
  */
44028
- formatDate(value, format3) {
44254
+ formatDate(value, format4) {
44029
44255
  const date2 = import_dayjs.default.utc(value);
44030
- if (!DAY_OF_YEAR_TOKEN.test(this._stripLiterals(format3)))
44031
- return date2.format(format3);
44256
+ if (!DAY_OF_YEAR_TOKEN.test(this._stripLiterals(format4)))
44257
+ return date2.format(format4);
44032
44258
  const startOfYear = import_dayjs.default.utc(`${String(date2.year()).padStart(4, "0")}-01-01`, "YYYY-MM-DD", true);
44033
44259
  const dayOfYear = date2.diff(startOfYear, "day") + 1;
44034
- return date2.format(format3.replace(/D{3,4}/g, `[${String(dayOfYear).padStart(3, "0")}]`));
44260
+ return date2.format(format4.replace(/D{3,4}/g, `[${String(dayOfYear).padStart(3, "0")}]`));
44035
44261
  }
44036
44262
  /**
44037
44263
  * Parses a date string with a dayjs format, as UTC. Single entry point for every date parse, so
@@ -44040,13 +44266,13 @@ var init_TypeCaster = __esm({
44040
44266
  * ever FORMAT with are rejected outright — non-strict parsing would otherwise read `2007305` as
44041
44267
  * 2007-01-05 rather than 2007-11-01 and report no error at all.
44042
44268
  */
44043
- parseDate(value, format3, strict = true) {
44044
- if (DAY_OF_YEAR_TOKEN.test(this._stripLiterals(format3)))
44045
- return this._parseDayOfYear(value, format3);
44046
- this._assertParsableFormat(format3);
44047
- const parsed = import_dayjs.default.utc(value, format3, strict);
44269
+ parseDate(value, format4, strict = true) {
44270
+ if (DAY_OF_YEAR_TOKEN.test(this._stripLiterals(format4)))
44271
+ return this._parseDayOfYear(value, format4);
44272
+ this._assertParsableFormat(format4);
44273
+ const parsed = import_dayjs.default.utc(value, format4, strict);
44048
44274
  if (!parsed.isValid())
44049
- throw new Error(`Cannot parse "${value}" with input format "${format3}"`);
44275
+ throw new Error(`Cannot parse "${value}" with input format "${format4}"`);
44050
44276
  return parsed;
44051
44277
  }
44052
44278
  /**
@@ -44055,61 +44281,61 @@ var init_TypeCaster = __esm({
44055
44281
  * walked token by token against the format — every token of such a format has a fixed width, so
44056
44282
  * a plain cursor is enough — and the date is then built from the year plus the ordinal offset.
44057
44283
  */
44058
- _parseDayOfYear(value, format3) {
44284
+ _parseDayOfYear(value, format4) {
44059
44285
  const parts = {};
44060
44286
  let cursor = 0;
44061
44287
  let index = 0;
44062
- while (index < format3.length) {
44063
- if (format3[index] === "[") {
44064
- const close = format3.indexOf("]", index);
44288
+ while (index < format4.length) {
44289
+ if (format4[index] === "[") {
44290
+ const close = format4.indexOf("]", index);
44065
44291
  if (close < 0)
44066
- throw new Error(`Unterminated "[" literal in date format "${format3}"`);
44067
- const literal2 = format3.slice(index + 1, close);
44292
+ throw new Error(`Unterminated "[" literal in date format "${format4}"`);
44293
+ const literal2 = format4.slice(index + 1, close);
44068
44294
  if (value.slice(cursor, cursor + literal2.length) !== literal2)
44069
- throw new Error(`Cannot parse "${value}" with input format "${format3}": expected "${literal2}" at character ${cursor + 1}`);
44295
+ throw new Error(`Cannot parse "${value}" with input format "${format4}": expected "${literal2}" at character ${cursor + 1}`);
44070
44296
  cursor += literal2.length;
44071
44297
  index = close + 1;
44072
44298
  continue;
44073
44299
  }
44074
- const match = DATE_PARSE_TOKENS.find((x2) => format3.startsWith(x2.token, index));
44300
+ const match = DATE_PARSE_TOKENS.find((x2) => format4.startsWith(x2.token, index));
44075
44301
  if (!match) {
44076
- if (/[A-Za-z]/.test(format3[index]))
44077
- throw new Error(`Date format "${format3}" mixes a day-of-year token with "${format3[index]}", which can't be parsed alongside it. Use YYYY/YY, DDD/DDDD, HH, mm, ss and SSS only.`);
44078
- if (value[cursor] !== format3[index])
44079
- throw new Error(`Cannot parse "${value}" with input format "${format3}": expected "${format3[index]}" at character ${cursor + 1}`);
44302
+ if (/[A-Za-z]/.test(format4[index]))
44303
+ throw new Error(`Date format "${format4}" mixes a day-of-year token with "${format4[index]}", which can't be parsed alongside it. Use YYYY/YY, DDD/DDDD, HH, mm, ss and SSS only.`);
44304
+ if (value[cursor] !== format4[index])
44305
+ throw new Error(`Cannot parse "${value}" with input format "${format4}": expected "${format4[index]}" at character ${cursor + 1}`);
44080
44306
  cursor++;
44081
44307
  index++;
44082
44308
  continue;
44083
44309
  }
44084
44310
  const digits = value.slice(cursor, cursor + match.width);
44085
44311
  if (digits.length !== match.width || !/^\d+$/.test(digits))
44086
- throw new Error(`Cannot parse "${value}" with input format "${format3}": expected ${match.width} digit(s) for "${match.token}" at character ${cursor + 1}`);
44312
+ throw new Error(`Cannot parse "${value}" with input format "${format4}": expected ${match.width} digit(s) for "${match.token}" at character ${cursor + 1}`);
44087
44313
  parts[match.token] = Number(digits);
44088
44314
  cursor += match.width;
44089
44315
  index += match.token.length;
44090
44316
  }
44091
44317
  if (cursor !== value.length)
44092
- throw new Error(`Cannot parse "${value}" with input format "${format3}": ${value.length - cursor} unexpected trailing character(s)`);
44318
+ throw new Error(`Cannot parse "${value}" with input format "${format4}": ${value.length - cursor} unexpected trailing character(s)`);
44093
44319
  const year2 = Algo_default.hasVal(parts["YYYY"]) ? parts["YYYY"] : parts["YY"];
44094
44320
  const dayOfYear = Algo_default.hasVal(parts["DDDD"]) ? parts["DDDD"] : parts["DDD"];
44095
44321
  if (!Algo_default.hasVal(year2))
44096
- throw new Error(`Date format "${format3}" declares a day of year but no year, so the date is ambiguous.`);
44322
+ throw new Error(`Date format "${format4}" declares a day of year but no year, so the date is ambiguous.`);
44097
44323
  const startOfYear = import_dayjs.default.utc(`${String(year2).padStart(4, "0")}-01-01`, "YYYY-MM-DD", true);
44098
44324
  if (!startOfYear.isValid())
44099
- throw new Error(`Cannot parse "${value}" with input format "${format3}": "${year2}" is not a valid year`);
44325
+ throw new Error(`Cannot parse "${value}" with input format "${format4}": "${year2}" is not a valid year`);
44100
44326
  const parsed = startOfYear.add(dayOfYear - 1, "day").add(parts["HH"] ?? 0, "hour").add(parts["mm"] ?? 0, "minute").add(parts["ss"] ?? 0, "second").add(parts["SSS"] ?? 0, "millisecond");
44101
44327
  if (dayOfYear < 1 || parsed.year() !== startOfYear.year())
44102
- throw new Error(`Cannot parse "${value}" with input format "${format3}": day of year ${dayOfYear} is outside year ${year2} (which has ${startOfYear.add(1, "year").diff(startOfYear, "day")} days)`);
44328
+ throw new Error(`Cannot parse "${value}" with input format "${format4}": day of year ${dayOfYear} is outside year ${year2} (which has ${startOfYear.add(1, "year").diff(startOfYear, "day")} days)`);
44103
44329
  return parsed;
44104
44330
  }
44105
- _assertParsableFormat(format3) {
44106
- const stripped = this._stripLiterals(format3);
44331
+ _assertParsableFormat(format4) {
44332
+ const stripped = this._stripLiterals(format4);
44107
44333
  const offending = FORMAT_ONLY_TOKENS.find((token2) => stripped.includes(token2));
44108
44334
  if (offending)
44109
- throw new Error(`Date format "${format3}" uses the token "${offending}", which dayjs can only write, never read: parsing would silently produce the wrong date. Use a parseable token, or bracket it as a literal ("[${offending}]") if it is part of the text.`);
44335
+ throw new Error(`Date format "${format4}" uses the token "${offending}", which dayjs can only write, never read: parsing would silently produce the wrong date. Use a parseable token, or bracket it as a literal ("[${offending}]") if it is part of the text.`);
44110
44336
  }
44111
- _stripLiterals(format3) {
44112
- return String(format3 ?? "").replace(/\[[^\]]*\]/g, "");
44337
+ _stripLiterals(format4) {
44338
+ return String(format4 ?? "").replace(/\[[^\]]*\]/g, "");
44113
44339
  }
44114
44340
  };
44115
44341
  TypeCaster = new TypeCasterClass();
@@ -44501,7 +44727,7 @@ var init_ProducerEngine = __esm({
44501
44727
  });
44502
44728
 
44503
44729
  // ../../packages/engines/src/ai/DeveloperEngine.ts
44504
- var import_path14, import_promises11, import_dayjs2, import_customParseFormat2, DeveloperEngineClass, DeveloperEngine, DeveloperEngine_default;
44730
+ var import_path14, import_promises12, import_dayjs2, import_customParseFormat2, DeveloperEngineClass, DeveloperEngine, DeveloperEngine_default;
44505
44731
  var init_DeveloperEngine = __esm({
44506
44732
  "../../packages/engines/src/ai/DeveloperEngine.ts"() {
44507
44733
  init_src();
@@ -44509,7 +44735,7 @@ var init_DeveloperEngine = __esm({
44509
44735
  init_src4();
44510
44736
  init_src8();
44511
44737
  import_path14 = __toESM(require("path"), 1);
44512
- import_promises11 = __toESM(require("fs/promises"), 1);
44738
+ import_promises12 = __toESM(require("fs/promises"), 1);
44513
44739
  import_dayjs2 = __toESM(require("dayjs"), 1);
44514
44740
  import_customParseFormat2 = __toESM(require("dayjs/plugin/customParseFormat"), 1);
44515
44741
  import_dayjs2.default.extend(import_customParseFormat2.default);
@@ -44539,8 +44765,8 @@ var init_DeveloperEngine = __esm({
44539
44765
  };
44540
44766
  mappedProducer["$schema"] = producer["$schema"];
44541
44767
  const producerPath = Environment_default.resolveResourceFilePath("producers", producer.name);
44542
- await import_promises11.default.mkdir(import_path14.default.dirname(producerPath), { recursive: true });
44543
- await import_promises11.default.writeFile(producerPath, JSON.stringify(mappedProducer, null, 4), "utf-8");
44768
+ await import_promises12.default.mkdir(import_path14.default.dirname(producerPath), { recursive: true });
44769
+ await import_promises12.default.writeFile(producerPath, JSON.stringify(mappedProducer, null, 4), "utf-8");
44544
44770
  return { producer: mappedProducer, fields: typeDefinitions };
44545
44771
  };
44546
44772
  // Discover-only precondition: sampling real data requires a configured, readable file.
@@ -47077,10 +47303,10 @@ var init_MockDataFactory = __esm({
47077
47303
  });
47078
47304
 
47079
47305
  // ../../packages/engines/src/mock/SyntheticInputEngine.ts
47080
- var import_promises12, import_os, import_path15, import_dayjs4, import_customParseFormat3, import_utc3, POOL_CAP, SyntheticInputEngineClass, SyntheticInputEngine;
47306
+ var import_promises13, import_os, import_path15, import_dayjs4, import_customParseFormat3, import_utc3, POOL_CAP, SyntheticInputEngineClass, SyntheticInputEngine;
47081
47307
  var init_SyntheticInputEngine = __esm({
47082
47308
  "../../packages/engines/src/mock/SyntheticInputEngine.ts"() {
47083
- import_promises12 = __toESM(require("fs/promises"), 1);
47309
+ import_promises13 = __toESM(require("fs/promises"), 1);
47084
47310
  import_os = __toESM(require("os"), 1);
47085
47311
  import_path15 = __toESM(require("path"), 1);
47086
47312
  import_dayjs4 = __toESM(require("dayjs"), 1);
@@ -47106,7 +47332,7 @@ var init_SyntheticInputEngine = __esm({
47106
47332
  for (const cs2 of [...BUILTIN_CODE_SETS, ...codeSets]) codeSetMap.set(cs2.name.toLowerCase(), cs2);
47107
47333
  const producerMap = new Map(producers.map((p5) => [p5.name, p5]));
47108
47334
  const refTargets = this._collectReferences(producers, producerMap);
47109
- const dir = await import_promises12.default.mkdtemp(import_path15.default.join(import_os.default.tmpdir(), "remora-synth-"));
47335
+ const dir = await import_promises13.default.mkdtemp(import_path15.default.join(import_os.default.tmpdir(), "remora-synth-"));
47110
47336
  const poolSize = Math.min(Math.max(opts.records, 1), POOL_CAP);
47111
47337
  const registry = new MockKeyRegistry();
47112
47338
  const specs = producers.flatMap((p5) => this._specs(p5, codeSetMap, producerMap, refTargets));
@@ -47123,7 +47349,7 @@ var init_SyntheticInputEngine = __esm({
47123
47349
  return { inputs, dir };
47124
47350
  };
47125
47351
  this.cleanup = async (bundle) => {
47126
- if (bundle?.dir) await import_promises12.default.rm(bundle.dir, { recursive: true, force: true });
47352
+ if (bundle?.dir) await import_promises13.default.rm(bundle.dir, { recursive: true, force: true });
47127
47353
  };
47128
47354
  this._assertOpts = (opts) => {
47129
47355
  Affirm_default(opts, "Invalid options");
@@ -47173,8 +47399,8 @@ var init_SyntheticInputEngine = __esm({
47173
47399
  lines.push(JSON.stringify(row) + "\n");
47174
47400
  }
47175
47401
  const filePath = import_path15.default.join(dir, `${producer.name}.jsonl`);
47176
- await import_promises12.default.writeFile(filePath, lines.join(""), "utf-8");
47177
- const { size } = await import_promises12.default.stat(filePath);
47402
+ await import_promises13.default.writeFile(filePath, lines.join(""), "utf-8");
47403
+ const { size } = await import_promises13.default.stat(filePath);
47178
47404
  return { path: filePath, fileSize: size };
47179
47405
  };
47180
47406
  // Distinct structured code sets referenced by these specs -> their records (deduped by name).
@@ -47285,7 +47511,7 @@ var init_SyntheticInputEngine = __esm({
47285
47511
  // True when a date bound names a day rather than an instant — neither the value nor the dimension's
47286
47512
  // format carries a time. Both have to agree: the value alone can't tell `"20240131"` from a compact
47287
47513
  // `YYYYMMDDHHmmss` instant, and the format alone can't tell that an ISO value overrode it.
47288
- this._isDayGranular = (value, format3) => !/[T ]\d{1,2}:/.test(value) && !/[HhmsSAa]/.test(format3 ?? "");
47514
+ this._isDayGranular = (value, format4) => !/[T ]\d{1,2}:/.test(value) && !/[HhmsSAa]/.test(format4 ?? "");
47289
47515
  /**
47290
47516
  * One bound in the units the generator works in: the number itself, a count of characters for a
47291
47517
  * `string`, or epoch milliseconds for a `datetime`. A date bound is read with the dimension's own
@@ -48573,7 +48799,7 @@ var init_LineageRenderer = __esm({
48573
48799
  });
48574
48800
 
48575
48801
  // ../../packages/engines/src/lineage/ResourceView.ts
48576
- var VISIBLE_AUTH_KEYS, MAX_TABLE_ROWS, MAX_RAW_BYTES, MAX_CELL_CHARS, ResourceViewClass, ResourceView, ResourceView_default;
48802
+ var VISIBLE_AUTH_KEYS, MAX_TABLE_ROWS, MAX_RAW_BYTES, MAX_CELL_CHARS, MAX_NOTE_CHARS, ResourceViewClass, ResourceView, ResourceView_default;
48577
48803
  var init_ResourceView = __esm({
48578
48804
  "../../packages/engines/src/lineage/ResourceView.ts"() {
48579
48805
  init_src();
@@ -48612,6 +48838,7 @@ var init_ResourceView = __esm({
48612
48838
  MAX_TABLE_ROWS = 500;
48613
48839
  MAX_RAW_BYTES = 256 * 1024;
48614
48840
  MAX_CELL_CHARS = 200;
48841
+ MAX_NOTE_CHARS = 240;
48615
48842
  ResourceViewClass = class {
48616
48843
  constructor() {
48617
48844
  /**
@@ -48783,7 +49010,7 @@ var init_ResourceView = __esm({
48783
49010
  { key: "classification", label: "Classification" }
48784
49011
  ];
48785
49012
  const rows = dimensions.map((dimension) => [
48786
- { value: dimension.name },
49013
+ { value: dimension.name, note: this._note(dimension.description) },
48787
49014
  { value: this._text(dimension.type) },
48788
49015
  positioned ? { value: this._position(dimension.position) } : { value: this._text(dimension.alias), muted: !dimension.alias },
48789
49016
  { value: !!dimension.pk, muted: !dimension.pk },
@@ -48795,7 +49022,7 @@ var init_ResourceView = __esm({
48795
49022
  };
48796
49023
  this._measuresTable = (producer) => {
48797
49024
  const rows = (producer.measures ?? []).map((measure) => [
48798
- { value: measure.name },
49025
+ { value: measure.name, note: this._note(measure.description) },
48799
49026
  { value: measure.sql }
48800
49027
  ]);
48801
49028
  return this._table("Measures", [
@@ -48861,7 +49088,7 @@ var init_ResourceView = __esm({
48861
49088
  };
48862
49089
  this._consumerFieldsTable = (env2, consumer) => {
48863
49090
  const rows = (consumer.fields ?? []).map((field) => [
48864
- { value: field.key },
49091
+ { value: field.key, note: this._note(field.description) },
48865
49092
  { value: this._text(field.alias), muted: !field.alias },
48866
49093
  { value: this._text(field.from), link: field.from ? this._inputLink(env2, field.from) : void 0, muted: !field.from },
48867
49094
  { value: this._text(field.transform ? Object.keys(field.transform) : null), muted: !field.transform },
@@ -48950,7 +49177,7 @@ var init_ResourceView = __esm({
48950
49177
  const required = new Set(schema.required ?? []);
48951
49178
  const properties = Object.entries(schema.properties ?? {});
48952
49179
  const rows = properties.map(([property, definition]) => [
48953
- { value: property },
49180
+ { value: property, note: this._note(this._schemaKeyword(definition, "description")) },
48954
49181
  { value: this._schemaType(definition) },
48955
49182
  { value: required.has(property), muted: !required.has(property) },
48956
49183
  { value: this._text(this._schemaKeyword(definition, "format")), muted: !this._schemaKeyword(definition, "format") }
@@ -49056,6 +49283,15 @@ var init_ResourceView = __esm({
49056
49283
  const minutes = Math.floor(elapsedMS / 6e4);
49057
49284
  return `${minutes}m ${Math.round(elapsedMS % 6e4 / 1e3)}s`;
49058
49285
  };
49286
+ /**
49287
+ * A description as the secondary line of a cell. Blank prose is the same as none, so a field
49288
+ * documented with a stray space does not cost the row a line.
49289
+ */
49290
+ this._note = (description) => {
49291
+ const text = (description ?? "").trim();
49292
+ if (!text) return void 0;
49293
+ return text.length > MAX_NOTE_CHARS ? `${text.slice(0, MAX_NOTE_CHARS)}\u2026` : text;
49294
+ };
49059
49295
  /** Anything that is not already a scalar becomes readable text; absent becomes `null`. */
49060
49296
  this._text = (value) => {
49061
49297
  if (value === void 0 || value === null) return null;
@@ -49660,7 +49896,7 @@ var init_OpsHeartbeat = __esm({
49660
49896
  "../../packages/engines/src/ops/OpsHeartbeat.ts"() {
49661
49897
  init_src2();
49662
49898
  init_OpsService();
49663
- DEFAULT_INTERVAL_MS = 6e4;
49899
+ DEFAULT_INTERVAL_MS = 3e5;
49664
49900
  MIN_INTERVAL_MS = 5e3;
49665
49901
  MAX_INTERVAL_MS = 36e5;
49666
49902
  OpsHeartbeatClass = class {
@@ -49700,11 +49936,24 @@ var init_OpsHeartbeat = __esm({
49700
49936
  Logger_default.error(error);
49701
49937
  }
49702
49938
  };
49939
+ /**
49940
+ * Resolve the configured interval, in milliseconds. A value that is unusable or out of range is
49941
+ * reported rather than silently replaced: an operator who set an interval and got a different
49942
+ * one has no other way to find out.
49943
+ */
49703
49944
  this.resolveInterval = () => {
49704
- const configured = Number(process.env.REMORA_STATE_INTERVAL_MS);
49705
- if (!Number.isFinite(configured) || configured <= 0)
49945
+ const raw = process.env.REMORA_STATE_INTERVAL_MS;
49946
+ if (!raw)
49947
+ return DEFAULT_INTERVAL_MS;
49948
+ const configured = Number(raw);
49949
+ if (!Number.isFinite(configured) || configured <= 0) {
49950
+ Logger_default.warn(`REMORA_STATE_INTERVAL_MS is not a positive number of milliseconds ("${raw}"); using ${DEFAULT_INTERVAL_MS}ms.`);
49706
49951
  return DEFAULT_INTERVAL_MS;
49707
- return Math.min(Math.max(configured, MIN_INTERVAL_MS), MAX_INTERVAL_MS);
49952
+ }
49953
+ const clamped = Math.min(Math.max(configured, MIN_INTERVAL_MS), MAX_INTERVAL_MS);
49954
+ if (clamped !== configured)
49955
+ Logger_default.warn(`REMORA_STATE_INTERVAL_MS of ${configured}ms is outside ${MIN_INTERVAL_MS}ms..${MAX_INTERVAL_MS}ms; using ${clamped}ms.`);
49956
+ return clamped;
49708
49957
  };
49709
49958
  }
49710
49959
  };
@@ -50513,8 +50762,8 @@ var init_TransformationEngine = __esm({
50513
50762
  return result;
50514
50763
  }
50515
50764
  if ("cast" in transformations) {
50516
- const { cast, format: format3 } = transformations;
50517
- const casted = TypeCaster_default.cast(value, cast, format3);
50765
+ const { cast, format: format4 } = transformations;
50766
+ const casted = TypeCaster_default.cast(value, cast, format4);
50518
50767
  if (cast === "number" && isNaN(casted))
50519
50768
  throw new Error(`Cannot cast non-numeric value in field '${field.key}'`);
50520
50769
  if (cast === "datetime" && casted instanceof Date && isNaN(casted.getTime()))
@@ -51292,13 +51541,13 @@ var init_OutputExecutor = __esm({
51292
51541
  });
51293
51542
 
51294
51543
  // ../../packages/executors/src/ConsumerExecutor.ts
51295
- var import_path18, import_fs13, import_readline6, import_promises13, import_crypto6, LIMIT_SCAN_BYTES, NEWLINE_BYTE, ConsumerExecutorClass, ConsumerExecutor, ConsumerExecutor_default;
51544
+ var import_path18, import_fs13, import_readline6, import_promises14, import_crypto6, LIMIT_SCAN_BYTES, NEWLINE_BYTE, ConsumerExecutorClass, ConsumerExecutor, ConsumerExecutor_default;
51296
51545
  var init_ConsumerExecutor = __esm({
51297
51546
  "../../packages/executors/src/ConsumerExecutor.ts"() {
51298
51547
  import_path18 = __toESM(require("path"));
51299
51548
  import_fs13 = __toESM(require("fs"));
51300
51549
  import_readline6 = __toESM(require("readline"));
51301
- import_promises13 = __toESM(require("fs/promises"));
51550
+ import_promises14 = __toESM(require("fs/promises"));
51302
51551
  import_crypto6 = __toESM(require("crypto"));
51303
51552
  init_src10();
51304
51553
  init_src10();
@@ -51485,8 +51734,8 @@ var init_ConsumerExecutor = __esm({
51485
51734
  reader.destroy();
51486
51735
  });
51487
51736
  }
51488
- await import_promises13.default.unlink(datasetPath);
51489
- await import_promises13.default.rename(tempWorkPath, datasetPath);
51737
+ await import_promises14.default.unlink(datasetPath);
51738
+ await import_promises14.default.rename(tempWorkPath, datasetPath);
51490
51739
  return processedLineCount;
51491
51740
  };
51492
51741
  /**
@@ -51504,7 +51753,7 @@ var init_ConsumerExecutor = __esm({
51504
51753
  this.processLimit = async (datasetPath, limit) => {
51505
51754
  Affirm_default(datasetPath, "Invalid dataset path");
51506
51755
  Affirm_default(limit > 0, `Invalid record limit ${limit}`);
51507
- const handle = await import_promises13.default.open(datasetPath, "r+");
51756
+ const handle = await import_promises14.default.open(datasetPath, "r+");
51508
51757
  try {
51509
51758
  const buffer = Buffer.allocUnsafe(LIMIT_SCAN_BYTES);
51510
51759
  let newlines = 0;
@@ -51558,8 +51807,8 @@ var init_ConsumerExecutor = __esm({
51558
51807
  reader.destroy();
51559
51808
  });
51560
51809
  }
51561
- await import_promises13.default.unlink(datasetPath);
51562
- await import_promises13.default.rename(tempWorkPath, datasetPath);
51810
+ await import_promises14.default.unlink(datasetPath);
51811
+ await import_promises14.default.rename(tempWorkPath, datasetPath);
51563
51812
  return newLineCount;
51564
51813
  };
51565
51814
  this.processDistinctOn = async (consumer, datasetPath) => {
@@ -51603,8 +51852,8 @@ var init_ConsumerExecutor = __esm({
51603
51852
  reader.destroy();
51604
51853
  });
51605
51854
  }
51606
- await import_promises13.default.unlink(datasetPath);
51607
- await import_promises13.default.rename(tempWorkPath, datasetPath);
51855
+ await import_promises14.default.unlink(datasetPath);
51856
+ await import_promises14.default.rename(tempWorkPath, datasetPath);
51608
51857
  return winners.size;
51609
51858
  };
51610
51859
  this.processPivot = async (consumer, datasetPath) => {
@@ -51710,12 +51959,12 @@ var init_ConsumerExecutor = __esm({
51710
51959
  reader.destroy();
51711
51960
  });
51712
51961
  }
51713
- await import_promises13.default.unlink(datasetPath);
51714
- await import_promises13.default.rename(tempWorkPath, datasetPath);
51962
+ await import_promises14.default.unlink(datasetPath);
51963
+ await import_promises14.default.rename(tempWorkPath, datasetPath);
51715
51964
  return outputCount;
51716
51965
  };
51717
- this._parseLine = (line, format3, fields) => {
51718
- return format3 === "CSV" ? LineParser_default._internalParseCSV(line, fields) : LineParser_default._internalParseJSON(line);
51966
+ this._parseLine = (line, format4, fields) => {
51967
+ return format4 === "CSV" ? LineParser_default._internalParseCSV(line, fields) : LineParser_default._internalParseJSON(line);
51719
51968
  };
51720
51969
  /**
51721
51970
  * Determines if the new record should replace the existing record based on the resolution strategy
@@ -52184,11 +52433,11 @@ var init_OrchestratorHelper = __esm({
52184
52433
  });
52185
52434
 
52186
52435
  // ../../packages/executors/src/LookupResolver.ts
52187
- var import_fs15, import_promises14, import_path21, import_readline9, LookupResolverClass, LookupResolver, LookupResolver_default;
52436
+ var import_fs15, import_promises15, import_path21, import_readline9, LookupResolverClass, LookupResolver, LookupResolver_default;
52188
52437
  var init_LookupResolver = __esm({
52189
52438
  "../../packages/executors/src/LookupResolver.ts"() {
52190
52439
  import_fs15 = __toESM(require("fs"));
52191
- import_promises14 = __toESM(require("fs/promises"));
52440
+ import_promises15 = __toESM(require("fs/promises"));
52192
52441
  import_path21 = __toESM(require("path"));
52193
52442
  import_readline9 = __toESM(require("readline"));
52194
52443
  init_src();
@@ -52229,11 +52478,11 @@ var init_LookupResolver = __esm({
52229
52478
  this.cache.set(id, await this.buildDict(lookupConsumer, capturePath, ref));
52230
52479
  }
52231
52480
  ExecutorScope_default.ensurePath(outPath);
52232
- await import_promises14.default.writeFile(outPath, JSON.stringify(this.cache.get(id)));
52481
+ await import_promises15.default.writeFile(outPath, JSON.stringify(this.cache.get(id)));
52233
52482
  manifest.push({ id, consumer: ref.consumer, key: ref.key, value: ref.value, path: import_path21.default.resolve(outPath) });
52234
52483
  }
52235
52484
  for (const capturePath of captureByConsumer.values())
52236
- await import_promises14.default.rm(capturePath, { force: true });
52485
+ await import_promises15.default.rm(capturePath, { force: true });
52237
52486
  return manifest;
52238
52487
  };
52239
52488
  // Runs the source consumer through the real pipeline, capturing its merged output before cleanup.
@@ -52251,7 +52500,7 @@ var init_LookupResolver = __esm({
52251
52500
  };
52252
52501
  // Projects the captured dataset to a { code: value } dict, bounded by MAX_LOOKUP_ROWS.
52253
52502
  this.buildDict = async (lookupConsumer, capturePath, ref) => {
52254
- const format3 = OutputExecutor_default._getInternalRecordFormat(lookupConsumer);
52503
+ const format4 = OutputExecutor_default._getInternalRecordFormat(lookupConsumer);
52255
52504
  const visibleFields = ConsumerManager_default.getExpandedFields(lookupConsumer).filter((f7) => !f7.cField.hidden);
52256
52505
  const finalKeys = visibleFields.map((f7) => f7.finalKey);
52257
52506
  Affirm_default(finalKeys.includes(ref.key), `code_lookup key column "${ref.key}" is not in the output of consumer "${ref.consumer}"`);
@@ -52264,7 +52513,7 @@ var init_LookupResolver = __esm({
52264
52513
  if (!line.length) continue;
52265
52514
  rowsRead++;
52266
52515
  Affirm_default(rowsRead <= Constants_default.defaults.MAX_LOOKUP_ROWS, `code_lookup table from consumer "${ref.consumer}" exceeds MAX_LOOKUP_ROWS (${Constants_default.defaults.MAX_LOOKUP_ROWS})`);
52267
- const record = this.parseLine(line, format3, visibleFields);
52516
+ const record = this.parseLine(line, format4, visibleFields);
52268
52517
  const code = String(record[ref.key]);
52269
52518
  if (code in dict && !warnedDup) {
52270
52519
  Logger_default.warn(`code_lookup: duplicate key(s) in consumer "${ref.consumer}" for "${ref.key}"; last value wins`);
@@ -52275,8 +52524,8 @@ var init_LookupResolver = __esm({
52275
52524
  Logger_default.log(`[lookup] Built table "${ref.consumer}" (${ref.key}->${ref.value}): ${Object.keys(dict).length} entr(ies) from ${rowsRead} row(s)`);
52276
52525
  return dict;
52277
52526
  };
52278
- this.parseLine = (line, format3, visibleFields) => {
52279
- if (format3 === "CSV") return LineParser_default._internalParseCSV(line, visibleFields, ",");
52527
+ this.parseLine = (line, format4, visibleFields) => {
52528
+ if (format4 === "CSV") return LineParser_default._internalParseCSV(line, visibleFields, ",");
52280
52529
  return JSON.parse(line);
52281
52530
  };
52282
52531
  this.getCapturePath = (scope, consumerName) => {
@@ -52303,11 +52552,11 @@ var init_LookupResolver = __esm({
52303
52552
  });
52304
52553
 
52305
52554
  // ../../packages/executors/src/ConsumerInputResolver.ts
52306
- var import_fs16, import_promises15, import_path22, ConsumerInputResolverClass, ConsumerInputResolver, ConsumerInputResolver_default;
52555
+ var import_fs16, import_promises16, import_path22, ConsumerInputResolverClass, ConsumerInputResolver, ConsumerInputResolver_default;
52307
52556
  var init_ConsumerInputResolver = __esm({
52308
52557
  "../../packages/executors/src/ConsumerInputResolver.ts"() {
52309
52558
  import_fs16 = __toESM(require("fs"));
52310
- import_promises15 = __toESM(require("fs/promises"));
52559
+ import_promises16 = __toESM(require("fs/promises"));
52311
52560
  import_path22 = __toESM(require("path"));
52312
52561
  init_src();
52313
52562
  init_src3();
@@ -52338,7 +52587,7 @@ var init_ConsumerInputResolver = __esm({
52338
52587
  const capturePath = ExecutorScope_default.getConsumerInputPath(scope, name);
52339
52588
  ExecutorScope_default.ensurePath(capturePath);
52340
52589
  await this.runUpstreamConsumer(upstream, capturePath, stack, request);
52341
- const { size } = await import_promises15.default.stat(capturePath);
52590
+ const { size } = await import_promises16.default.stat(capturePath);
52342
52591
  this.cache.set(name, { consumer: name, path: import_path22.default.resolve(capturePath), fileSize: size });
52343
52592
  }
52344
52593
  manifest.set(name, this.cache.get(name));
@@ -52401,11 +52650,11 @@ var ExecutorOrchestrator_exports = {};
52401
52650
  __export(ExecutorOrchestrator_exports, {
52402
52651
  default: () => ExecutorOrchestrator_default
52403
52652
  });
52404
- var import_fs17, import_promises16, import_path23, import_readline10, import_workerpool, import_promises17, ExecutorOrchestratorClass, ExecutorOrchestrator, ExecutorOrchestrator_default;
52653
+ var import_fs17, import_promises17, import_path23, import_readline10, import_workerpool, import_promises18, ExecutorOrchestratorClass, ExecutorOrchestrator, ExecutorOrchestrator_default;
52405
52654
  var init_ExecutorOrchestrator = __esm({
52406
52655
  "../../packages/executors/src/ExecutorOrchestrator.ts"() {
52407
52656
  import_fs17 = __toESM(require("fs"));
52408
- import_promises16 = __toESM(require("fs/promises"));
52657
+ import_promises17 = __toESM(require("fs/promises"));
52409
52658
  import_path23 = __toESM(require("path"));
52410
52659
  import_readline10 = __toESM(require("readline"));
52411
52660
  import_workerpool = __toESM(require("workerpool"));
@@ -52423,7 +52672,7 @@ var init_ExecutorOrchestrator = __esm({
52423
52672
  init_src();
52424
52673
  init_src10();
52425
52674
  init_ExecutorWriter();
52426
- import_promises17 = require("stream/promises");
52675
+ import_promises18 = require("stream/promises");
52427
52676
  init_src2();
52428
52677
  init_ExecutorProgress2();
52429
52678
  init_src5();
@@ -52940,10 +53189,10 @@ var init_ExecutorOrchestrator = __esm({
52940
53189
  * format has no header row, so each row is reprojected. Without a captureFormat it's a verbatim copy.
52941
53190
  */
52942
53191
  this.captureDataset = async (consumer, fields, sourcePath, targetPath, captureFormat) => {
52943
- await import_promises16.default.mkdir(import_path23.default.dirname(targetPath), { recursive: true });
53192
+ await import_promises17.default.mkdir(import_path23.default.dirname(targetPath), { recursive: true });
52944
53193
  const internalFormat = OutputExecutor_default._getInternalRecordFormat(consumer);
52945
53194
  if (captureFormat !== "JSONL" || internalFormat !== "CSV") {
52946
- await import_promises16.default.copyFile(sourcePath, targetPath);
53195
+ await import_promises17.default.copyFile(sourcePath, targetPath);
52947
53196
  return;
52948
53197
  }
52949
53198
  const visibleFields = fields.filter((field) => !field.cField.hidden);
@@ -53046,22 +53295,22 @@ var init_ExecutorOrchestrator = __esm({
53046
53295
  startRow: prod.settings.startRow,
53047
53296
  startColumn: prod.settings.startColumn
53048
53297
  });
53049
- await (0, import_promises17.pipeline)(
53298
+ await (0, import_promises18.pipeline)(
53050
53299
  xlsCsvStream,
53051
53300
  import_fs17.default.createWriteStream(decodedPath)
53052
53301
  );
53053
- const fileStats = await import_promises16.default.stat(decodedPath);
53302
+ const fileStats = await import_promises17.default.stat(decodedPath);
53054
53303
  decodedFiles.push({ fullUri: decodedPath, fileSize: fileStats.size });
53055
53304
  decodedCount++;
53056
53305
  reportFile();
53057
53306
  continue;
53058
53307
  }
53059
53308
  if (inferredType === "XML") {
53060
- const fileContent = await import_promises16.default.readFile(file.fullUri, "utf-8");
53309
+ const fileContent = await import_promises17.default.readFile(file.fullUri, "utf-8");
53061
53310
  const jsonData = XMLParser_default.xmlToJson(fileContent);
53062
53311
  const records = normalizeXmlRows(jsonData);
53063
53312
  if (records.length === 0) {
53064
- await import_promises16.default.writeFile(decodedPath, "", "utf-8");
53313
+ await import_promises17.default.writeFile(decodedPath, "", "utf-8");
53065
53314
  } else {
53066
53315
  const columns = [];
53067
53316
  for (const record of records) {
@@ -53077,9 +53326,9 @@ var init_ExecutorOrchestrator = __esm({
53077
53326
  const row = columns.map((column) => csvSafeValue(record[column]));
53078
53327
  lines.push(CSVParser_default.stringifyRow(row));
53079
53328
  }
53080
- await import_promises16.default.writeFile(decodedPath, lines.join("\n"), "utf-8");
53329
+ await import_promises17.default.writeFile(decodedPath, lines.join("\n"), "utf-8");
53081
53330
  }
53082
- const fileStats = await import_promises16.default.stat(decodedPath);
53331
+ const fileStats = await import_promises17.default.stat(decodedPath);
53083
53332
  decodedFiles.push({ fullUri: decodedPath, fileSize: fileStats.size });
53084
53333
  decodedCount++;
53085
53334
  reportFile();
@@ -53107,20 +53356,20 @@ var init_ExecutorOrchestrator = __esm({
53107
53356
  Logger_default.log(`[${scope.id}] Merging ${executorResults.length} worker output files into ${mainPath}`);
53108
53357
  const perf = performance.now();
53109
53358
  for (const workerResult of executorResults) {
53110
- await (0, import_promises17.pipeline)(
53359
+ await (0, import_promises18.pipeline)(
53111
53360
  import_fs17.default.createReadStream(workerResult.resultUri),
53112
53361
  import_fs17.default.createWriteStream(mainPath, { flags: "a" })
53113
53362
  );
53114
- await import_promises16.default.unlink(workerResult.resultUri);
53363
+ await import_promises17.default.unlink(workerResult.resultUri);
53115
53364
  }
53116
53365
  tracker.measure("merge-workers", performance.now() - perf);
53117
53366
  Logger_default.log(`[${scope.id}] Merge complete in ${Math.round(performance.now() - perf)}ms`);
53118
53367
  } else if (executorResults.length === 1) {
53119
53368
  Logger_default.log(`[${scope.id}] Single worker \u2014 renaming output to ${mainPath}`);
53120
- await import_promises16.default.rename(executorResults[0].resultUri, mainPath);
53369
+ await import_promises17.default.rename(executorResults[0].resultUri, mainPath);
53121
53370
  } else {
53122
53371
  Logger_default.log(`[${scope.id}] No worker output \u2014 writing an empty dataset to ${mainPath}`);
53123
- await import_promises16.default.writeFile(mainPath, "");
53372
+ await import_promises17.default.writeFile(mainPath, "");
53124
53373
  }
53125
53374
  return mainPath;
53126
53375
  };
@@ -53538,6 +53787,7 @@ var runExecutorTask = async (workerData) => {
53538
53787
  Logger_default.initFromEnv();
53539
53788
  if (workerData.loggerConfig)
53540
53789
  Logger_default.initFromConfig(workerData.loggerConfig);
53790
+ Logger_default.captureConsole();
53541
53791
  const envLoadMS = prepareEnvironment();
53542
53792
  try {
53543
53793
  const {
@@ -53597,7 +53847,7 @@ init_ProducerExecutor();
53597
53847
 
53598
53848
  // ../../packages/executors/src/SampleRunner.ts
53599
53849
  var import_fs18 = __toESM(require("fs"));
53600
- var import_promises18 = __toESM(require("fs/promises"));
53850
+ var import_promises19 = __toESM(require("fs/promises"));
53601
53851
  var import_path24 = __toESM(require("path"));
53602
53852
  var import_readline11 = __toESM(require("readline"));
53603
53853
  init_src();
@@ -53671,7 +53921,7 @@ var SampleRunnerClass = class {
53671
53921
  note: `${records.length} row(s) from the real pipeline \u2014 filters, transformations, masking and validation all applied, exactly as in a run. Nothing was written to the destination.`
53672
53922
  };
53673
53923
  } finally {
53674
- await import_promises18.default.rm(capturePath, { force: true });
53924
+ await import_promises19.default.rm(capturePath, { force: true });
53675
53925
  }
53676
53926
  };
53677
53927
  /**