@fre4x/yahoo-finance 1.0.50 → 1.0.54

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.
Files changed (2) hide show
  1. package/dist/index.js +555 -423
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -3229,8 +3229,8 @@ var require_utils = __commonJS({
3229
3229
  }
3230
3230
  return ind;
3231
3231
  }
3232
- function removeDotSegments(path) {
3233
- let input = path;
3232
+ function removeDotSegments(path2) {
3233
+ let input = path2;
3234
3234
  const output = [];
3235
3235
  let nextSlash = -1;
3236
3236
  let len = 0;
@@ -3429,8 +3429,8 @@ var require_schemes = __commonJS({
3429
3429
  wsComponent.secure = void 0;
3430
3430
  }
3431
3431
  if (wsComponent.resourceName) {
3432
- const [path, query] = wsComponent.resourceName.split("?");
3433
- wsComponent.path = path && path !== "/" ? path : void 0;
3432
+ const [path2, query] = wsComponent.resourceName.split("?");
3433
+ wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
3434
3434
  wsComponent.query = query;
3435
3435
  wsComponent.resourceName = void 0;
3436
3436
  }
@@ -6792,12 +6792,12 @@ var require_dist = __commonJS({
6792
6792
  throw new Error(`Unknown format "${name}"`);
6793
6793
  return f;
6794
6794
  };
6795
- function addFormats(ajv, list, fs, exportName) {
6795
+ function addFormats(ajv, list, fs2, exportName) {
6796
6796
  var _a2;
6797
6797
  var _b;
6798
6798
  (_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
6799
6799
  for (const f of list)
6800
- ajv.addFormat(f, fs[f]);
6800
+ ajv.addFormat(f, fs2[f]);
6801
6801
  }
6802
6802
  module.exports = exports = formatsPlugin;
6803
6803
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6963,9 +6963,9 @@ var require_stat = __commonJS({
6963
6963
  Object.defineProperty(exports, "__esModule", { value: true });
6964
6964
  exports.stat = exports.denoifyFileInfo = void 0;
6965
6965
  var promises_1 = __require("node:fs/promises");
6966
- var os = __importStar(__require("node:os"));
6966
+ var os2 = __importStar(__require("node:os"));
6967
6967
  var errorMap_js_1 = __importDefault(require_errorMap());
6968
- var isWindows = os.platform() === "win32";
6968
+ var isWindows = os2.platform() === "win32";
6969
6969
  function denoifyFileInfo(s) {
6970
6970
  return {
6971
6971
  atime: s.atime,
@@ -6991,9 +6991,9 @@ var require_stat = __commonJS({
6991
6991
  };
6992
6992
  }
6993
6993
  exports.denoifyFileInfo = denoifyFileInfo;
6994
- var stat = async (path) => {
6994
+ var stat = async (path2) => {
6995
6995
  try {
6996
- return denoifyFileInfo(await (0, promises_1.stat)(path));
6996
+ return denoifyFileInfo(await (0, promises_1.stat)(path2));
6997
6997
  } catch (e) {
6998
6998
  throw (0, errorMap_js_1.default)(e);
6999
6999
  }
@@ -7038,11 +7038,11 @@ var require_fstat = __commonJS({
7038
7038
  };
7039
7039
  Object.defineProperty(exports, "__esModule", { value: true });
7040
7040
  exports.fstat = void 0;
7041
- var fs = __importStar(__require("fs"));
7041
+ var fs2 = __importStar(__require("fs"));
7042
7042
  var util_1 = __require("util");
7043
7043
  var stat_js_1 = require_stat();
7044
7044
  var errorMap_js_1 = __importDefault(require_errorMap());
7045
- var nodeFstat = (0, util_1.promisify)(fs.fstat);
7045
+ var nodeFstat = (0, util_1.promisify)(fs2.fstat);
7046
7046
  var fstat = async function(fd) {
7047
7047
  try {
7048
7048
  return (0, stat_js_1.denoifyFileInfo)(await nodeFstat(fd));
@@ -7181,9 +7181,9 @@ var require_readSync = __commonJS({
7181
7181
  };
7182
7182
  Object.defineProperty(exports, "__esModule", { value: true });
7183
7183
  exports.readSync = void 0;
7184
- var fs = __importStar(__require("fs"));
7184
+ var fs2 = __importStar(__require("fs"));
7185
7185
  var readSync = (fd, buffer) => {
7186
- const bytesRead = fs.readSync(fd, buffer);
7186
+ const bytesRead = fs2.readSync(fd, buffer);
7187
7187
  return bytesRead === 0 ? null : bytesRead;
7188
7188
  };
7189
7189
  exports.readSync = readSync;
@@ -7223,9 +7223,9 @@ var require_write = __commonJS({
7223
7223
  };
7224
7224
  Object.defineProperty(exports, "__esModule", { value: true });
7225
7225
  exports.write = void 0;
7226
- var fs = __importStar(__require("fs"));
7226
+ var fs2 = __importStar(__require("fs"));
7227
7227
  var util_1 = __require("util");
7228
- var nodeWrite = (0, util_1.promisify)(fs.write);
7228
+ var nodeWrite = (0, util_1.promisify)(fs2.write);
7229
7229
  var write = async (fd, data) => {
7230
7230
  const { bytesWritten } = await nodeWrite(fd, data);
7231
7231
  return bytesWritten;
@@ -7267,8 +7267,8 @@ var require_writeSync = __commonJS({
7267
7267
  };
7268
7268
  Object.defineProperty(exports, "__esModule", { value: true });
7269
7269
  exports.writeSync = void 0;
7270
- var fs = __importStar(__require("fs"));
7271
- exports.writeSync = fs.writeSync;
7270
+ var fs2 = __importStar(__require("fs"));
7271
+ exports.writeSync = fs2.writeSync;
7272
7272
  }
7273
7273
  });
7274
7274
 
@@ -7323,7 +7323,7 @@ var require_FsFile = __commonJS({
7323
7323
  var _FsFile_writableStream;
7324
7324
  Object.defineProperty(exports, "__esModule", { value: true });
7325
7325
  exports.File = exports.FsFile = void 0;
7326
- var fs = __importStar(__require("node:fs"));
7326
+ var fs2 = __importStar(__require("node:fs"));
7327
7327
  var stream = __importStar(__require("node:stream"));
7328
7328
  var fstat_js_1 = require_fstat();
7329
7329
  var fstatSync_js_1 = require_fstatSync();
@@ -7399,11 +7399,11 @@ var require_FsFile = __commonJS({
7399
7399
  }
7400
7400
  close() {
7401
7401
  __classPrivateFieldSet(this, _FsFile_closed, true, "f");
7402
- fs.closeSync(this.rid);
7402
+ fs2.closeSync(this.rid);
7403
7403
  }
7404
7404
  get readable() {
7405
7405
  if (__classPrivateFieldGet(this, _FsFile_readableStream, "f") == null) {
7406
- const nodeStream = fs.createReadStream(null, {
7406
+ const nodeStream = fs2.createReadStream(null, {
7407
7407
  fd: this.rid,
7408
7408
  autoClose: false
7409
7409
  });
@@ -7413,7 +7413,7 @@ var require_FsFile = __commonJS({
7413
7413
  }
7414
7414
  get writable() {
7415
7415
  if (__classPrivateFieldGet(this, _FsFile_writableStream, "f") == null) {
7416
- const nodeStream = fs.createWriteStream(null, {
7416
+ const nodeStream = fs2.createWriteStream(null, {
7417
7417
  fd: this.rid,
7418
7418
  autoClose: false
7419
7419
  });
@@ -7567,12 +7567,12 @@ var require_build = __commonJS({
7567
7567
  };
7568
7568
  Object.defineProperty(exports, "__esModule", { value: true });
7569
7569
  exports.build = void 0;
7570
- var os = __importStar(__require("os"));
7570
+ var os2 = __importStar(__require("os"));
7571
7571
  exports.build = {
7572
7572
  arch: "x86_64",
7573
- os: /* @__PURE__ */ ((p) => p === "win32" ? "windows" : p === "darwin" ? "darwin" : "linux")(os.platform()),
7573
+ os: /* @__PURE__ */ ((p) => p === "win32" ? "windows" : p === "darwin" ? "darwin" : "linux")(os2.platform()),
7574
7574
  vendor: "pc",
7575
- target: /* @__PURE__ */ ((p) => p === "win32" ? "x86_64-pc-windows-msvc" : p === "darwin" ? "x86_64-apple-darwin" : "x86_64-unknown-linux-gnu")(os.platform())
7575
+ target: /* @__PURE__ */ ((p) => p === "win32" ? "x86_64-pc-windows-msvc" : p === "darwin" ? "x86_64-apple-darwin" : "x86_64-unknown-linux-gnu")(os2.platform())
7576
7576
  };
7577
7577
  }
7578
7578
  });
@@ -8015,12 +8015,12 @@ var require_chdir = __commonJS({
8015
8015
  var url_1 = __require("url");
8016
8016
  var errorMap_js_1 = __importDefault(require_errorMap());
8017
8017
  var variables_js_1 = require_variables();
8018
- var chdir = function(path) {
8018
+ var chdir = function(path2) {
8019
8019
  try {
8020
- return process.chdir(path instanceof URL ? (0, url_1.fileURLToPath)(path) : path);
8020
+ return process.chdir(path2 instanceof URL ? (0, url_1.fileURLToPath)(path2) : path2);
8021
8021
  } catch (error48) {
8022
8022
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
8023
- throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), chdir '${path}'`);
8023
+ throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), chdir '${path2}'`);
8024
8024
  }
8025
8025
  throw (0, errorMap_js_1.default)(error48);
8026
8026
  }
@@ -8062,8 +8062,8 @@ var require_chmod = __commonJS({
8062
8062
  };
8063
8063
  Object.defineProperty(exports, "__esModule", { value: true });
8064
8064
  exports.chmod = void 0;
8065
- var fs = __importStar(__require("fs/promises"));
8066
- exports.chmod = fs.chmod;
8065
+ var fs2 = __importStar(__require("fs/promises"));
8066
+ exports.chmod = fs2.chmod;
8067
8067
  }
8068
8068
  });
8069
8069
 
@@ -8100,8 +8100,8 @@ var require_chmodSync = __commonJS({
8100
8100
  };
8101
8101
  Object.defineProperty(exports, "__esModule", { value: true });
8102
8102
  exports.chmodSync = void 0;
8103
- var fs = __importStar(__require("fs"));
8104
- exports.chmodSync = fs.chmodSync;
8103
+ var fs2 = __importStar(__require("fs"));
8104
+ exports.chmodSync = fs2.chmodSync;
8105
8105
  }
8106
8106
  });
8107
8107
 
@@ -8138,8 +8138,8 @@ var require_chown = __commonJS({
8138
8138
  };
8139
8139
  Object.defineProperty(exports, "__esModule", { value: true });
8140
8140
  exports.chown = void 0;
8141
- var fs = __importStar(__require("fs/promises"));
8142
- var chown = async (path, uid, gid) => await fs.chown(path, uid !== null && uid !== void 0 ? uid : -1, gid !== null && gid !== void 0 ? gid : -1);
8141
+ var fs2 = __importStar(__require("fs/promises"));
8142
+ var chown = async (path2, uid, gid) => await fs2.chown(path2, uid !== null && uid !== void 0 ? uid : -1, gid !== null && gid !== void 0 ? gid : -1);
8143
8143
  exports.chown = chown;
8144
8144
  }
8145
8145
  });
@@ -8177,8 +8177,8 @@ var require_chownSync = __commonJS({
8177
8177
  };
8178
8178
  Object.defineProperty(exports, "__esModule", { value: true });
8179
8179
  exports.chownSync = void 0;
8180
- var fs = __importStar(__require("fs"));
8181
- var chownSync = (path, uid, gid) => fs.chownSync(path, uid !== null && uid !== void 0 ? uid : -1, gid !== null && gid !== void 0 ? gid : -1);
8180
+ var fs2 = __importStar(__require("fs"));
8181
+ var chownSync = (path2, uid, gid) => fs2.chownSync(path2, uid !== null && uid !== void 0 ? uid : -1, gid !== null && gid !== void 0 ? gid : -1);
8182
8182
  exports.chownSync = chownSync;
8183
8183
  }
8184
8184
  });
@@ -8216,8 +8216,8 @@ var require_close = __commonJS({
8216
8216
  };
8217
8217
  Object.defineProperty(exports, "__esModule", { value: true });
8218
8218
  exports.close = void 0;
8219
- var fs = __importStar(__require("fs"));
8220
- exports.close = fs.closeSync;
8219
+ var fs2 = __importStar(__require("fs"));
8220
+ exports.close = fs2.closeSync;
8221
8221
  }
8222
8222
  });
8223
8223
 
@@ -8334,9 +8334,9 @@ var require_readTextFile = __commonJS({
8334
8334
  exports.readTextFile = void 0;
8335
8335
  var promises_1 = __require("fs/promises");
8336
8336
  var errorMap_js_1 = __importDefault(require_errorMap());
8337
- var readTextFile = async (path, { signal } = {}) => {
8337
+ var readTextFile = async (path2, { signal } = {}) => {
8338
8338
  try {
8339
- return await (0, promises_1.readFile)(path, { encoding: "utf8", signal });
8339
+ return await (0, promises_1.readFile)(path2, { encoding: "utf8", signal });
8340
8340
  } catch (e) {
8341
8341
  throw (0, errorMap_js_1.default)(e);
8342
8342
  }
@@ -8477,12 +8477,12 @@ var require_copyFile = __commonJS({
8477
8477
  };
8478
8478
  Object.defineProperty(exports, "__esModule", { value: true });
8479
8479
  exports.copyFile = void 0;
8480
- var fs = __importStar(__require("fs/promises"));
8480
+ var fs2 = __importStar(__require("fs/promises"));
8481
8481
  var errorMap_js_1 = __importDefault(require_errorMap());
8482
8482
  var errors2 = __importStar(require_errors2());
8483
8483
  var copyFile = async (src, dest) => {
8484
8484
  try {
8485
- await fs.copyFile(src, dest);
8485
+ await fs2.copyFile(src, dest);
8486
8486
  } catch (error48) {
8487
8487
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
8488
8488
  throw new errors2.NotFound(`File not found, copy '${src}' -> '${dest}'`);
@@ -8530,12 +8530,12 @@ var require_copyFileSync = __commonJS({
8530
8530
  };
8531
8531
  Object.defineProperty(exports, "__esModule", { value: true });
8532
8532
  exports.copyFileSync = void 0;
8533
- var fs = __importStar(__require("fs"));
8533
+ var fs2 = __importStar(__require("fs"));
8534
8534
  var errorMap_js_1 = __importDefault(require_errorMap());
8535
8535
  var errors2 = __importStar(require_errors2());
8536
8536
  var copyFileSync = (src, dest) => {
8537
8537
  try {
8538
- fs.copyFileSync(src, dest);
8538
+ fs2.copyFileSync(src, dest);
8539
8539
  } catch (error48) {
8540
8540
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
8541
8541
  throw new errors2.NotFound(`File not found, copy '${src}' -> '${dest}'`);
@@ -8656,7 +8656,7 @@ var require_open = __commonJS({
8656
8656
  var fs_flags_js_1 = require_fs_flags();
8657
8657
  var errorMap_js_1 = __importDefault(require_errorMap());
8658
8658
  var nodeOpen = (0, util_1.promisify)(fs_1.open);
8659
- var open = async function open2(path, { read, write, append, truncate, create, createNew, mode = 438 } = {
8659
+ var open = async function open2(path2, { read, write, append, truncate, create, createNew, mode = 438 } = {
8660
8660
  read: true
8661
8661
  }) {
8662
8662
  const flagMode = (0, fs_flags_js_1.getFsFlag)({
@@ -8668,7 +8668,7 @@ var require_open = __commonJS({
8668
8668
  createNew
8669
8669
  });
8670
8670
  try {
8671
- const fd = await nodeOpen(path, flagMode, mode);
8671
+ const fd = await nodeOpen(path2, flagMode, mode);
8672
8672
  return new FsFile_js_1.File(fd);
8673
8673
  } catch (err) {
8674
8674
  throw (0, errorMap_js_1.default)(err);
@@ -8685,8 +8685,8 @@ var require_create = __commonJS({
8685
8685
  Object.defineProperty(exports, "__esModule", { value: true });
8686
8686
  exports.create = void 0;
8687
8687
  var open_js_1 = require_open();
8688
- var create = async function create2(path) {
8689
- return await (0, open_js_1.open)(path, { write: true, create: true, truncate: true });
8688
+ var create = async function create2(path2) {
8689
+ return await (0, open_js_1.open)(path2, { write: true, create: true, truncate: true });
8690
8690
  };
8691
8691
  exports.create = create;
8692
8692
  }
@@ -8705,7 +8705,7 @@ var require_openSync = __commonJS({
8705
8705
  var FsFile_js_1 = require_FsFile();
8706
8706
  var fs_flags_js_1 = require_fs_flags();
8707
8707
  var errorMap_js_1 = __importDefault(require_errorMap());
8708
- var openSync = function openSync2(path, { read, write, append, truncate, create, createNew, mode = 438 } = {
8708
+ var openSync = function openSync2(path2, { read, write, append, truncate, create, createNew, mode = 438 } = {
8709
8709
  read: true
8710
8710
  }) {
8711
8711
  const flagMode = (0, fs_flags_js_1.getFsFlag)({
@@ -8717,7 +8717,7 @@ var require_openSync = __commonJS({
8717
8717
  createNew
8718
8718
  });
8719
8719
  try {
8720
- const fd = (0, fs_1.openSync)(path, flagMode, mode);
8720
+ const fd = (0, fs_1.openSync)(path2, flagMode, mode);
8721
8721
  return new FsFile_js_1.File(fd);
8722
8722
  } catch (err) {
8723
8723
  throw (0, errorMap_js_1.default)(err);
@@ -8734,8 +8734,8 @@ var require_createSync = __commonJS({
8734
8734
  Object.defineProperty(exports, "__esModule", { value: true });
8735
8735
  exports.createSync = void 0;
8736
8736
  var openSync_js_1 = require_openSync();
8737
- var createSync = function createSync2(path) {
8738
- return (0, openSync_js_1.openSync)(path, {
8737
+ var createSync = function createSync2(path2) {
8738
+ return (0, openSync_js_1.openSync)(path2, {
8739
8739
  create: true,
8740
8740
  truncate: true,
8741
8741
  read: true,
@@ -8884,7 +8884,7 @@ var require_index_min = __commonJS({
8884
8884
  var require_lib = __commonJS({
8885
8885
  "../node_modules/@deno/shim-deno/node_modules/which/lib/index.js"(exports, module) {
8886
8886
  var { isexe, sync: isexeSync } = require_index_min();
8887
- var { join, delimiter, sep, posix } = __require("path");
8887
+ var { join: join2, delimiter, sep, posix } = __require("path");
8888
8888
  var isWindows = process.platform === "win32";
8889
8889
  var rSlash = new RegExp(`[${posix.sep}${sep === posix.sep ? "" : sep}]`.replace(/(\\)/g, "\\$1"));
8890
8890
  var rRel = new RegExp(`^\\.${rSlash.source}`);
@@ -8913,7 +8913,7 @@ var require_lib = __commonJS({
8913
8913
  var getPathPart = (raw, cmd) => {
8914
8914
  const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
8915
8915
  const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
8916
- return prefix + join(pathPart, cmd);
8916
+ return prefix + join2(pathPart, cmd);
8917
8917
  };
8918
8918
  var which = async (cmd, opt = {}) => {
8919
8919
  const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
@@ -9073,9 +9073,9 @@ var require_hostname = __commonJS({
9073
9073
  };
9074
9074
  Object.defineProperty(exports, "__esModule", { value: true });
9075
9075
  exports.hostname = void 0;
9076
- var os = __importStar(__require("os"));
9076
+ var os2 = __importStar(__require("os"));
9077
9077
  var hostname3 = function hostname4() {
9078
- return os.hostname();
9078
+ return os2.hostname();
9079
9079
  };
9080
9080
  exports.hostname = hostname3;
9081
9081
  }
@@ -9174,8 +9174,8 @@ var require_link = __commonJS({
9174
9174
  };
9175
9175
  Object.defineProperty(exports, "__esModule", { value: true });
9176
9176
  exports.link = void 0;
9177
- var fs = __importStar(__require("fs/promises"));
9178
- exports.link = fs.link;
9177
+ var fs2 = __importStar(__require("fs/promises"));
9178
+ exports.link = fs2.link;
9179
9179
  }
9180
9180
  });
9181
9181
 
@@ -9212,8 +9212,8 @@ var require_linkSync = __commonJS({
9212
9212
  };
9213
9213
  Object.defineProperty(exports, "__esModule", { value: true });
9214
9214
  exports.linkSync = void 0;
9215
- var fs = __importStar(__require("fs"));
9216
- exports.linkSync = fs.linkSync;
9215
+ var fs2 = __importStar(__require("fs"));
9216
+ exports.linkSync = fs2.linkSync;
9217
9217
  }
9218
9218
  });
9219
9219
 
@@ -9408,11 +9408,11 @@ var require_readTextFileSync = __commonJS({
9408
9408
  };
9409
9409
  Object.defineProperty(exports, "__esModule", { value: true });
9410
9410
  exports.readTextFileSync = void 0;
9411
- var fs = __importStar(__require("fs"));
9411
+ var fs2 = __importStar(__require("fs"));
9412
9412
  var errorMap_js_1 = __importDefault(require_errorMap());
9413
- var readTextFileSync = function(path) {
9413
+ var readTextFileSync = function(path2) {
9414
9414
  try {
9415
- return fs.readFileSync(path, "utf8");
9415
+ return fs2.readFileSync(path2, "utf8");
9416
9416
  } catch (e) {
9417
9417
  throw (0, errorMap_js_1.default)(e);
9418
9418
  }
@@ -9507,9 +9507,9 @@ var require_loadavg = __commonJS({
9507
9507
  };
9508
9508
  Object.defineProperty(exports, "__esModule", { value: true });
9509
9509
  exports.loadavg = void 0;
9510
- var os = __importStar(__require("os"));
9510
+ var os2 = __importStar(__require("os"));
9511
9511
  var loadavg = function loadavg2() {
9512
- return os.loadavg();
9512
+ return os2.loadavg();
9513
9513
  };
9514
9514
  exports.loadavg = loadavg;
9515
9515
  }
@@ -9551,12 +9551,12 @@ var require_lstat = __commonJS({
9551
9551
  };
9552
9552
  Object.defineProperty(exports, "__esModule", { value: true });
9553
9553
  exports.lstat = void 0;
9554
- var fs = __importStar(__require("fs/promises"));
9554
+ var fs2 = __importStar(__require("fs/promises"));
9555
9555
  var stat_js_1 = require_stat();
9556
9556
  var errorMap_js_1 = __importDefault(require_errorMap());
9557
- var lstat = async (path) => {
9557
+ var lstat = async (path2) => {
9558
9558
  try {
9559
- return (0, stat_js_1.denoifyFileInfo)(await fs.lstat(path));
9559
+ return (0, stat_js_1.denoifyFileInfo)(await fs2.lstat(path2));
9560
9560
  } catch (e) {
9561
9561
  throw (0, errorMap_js_1.default)(e);
9562
9562
  }
@@ -9601,12 +9601,12 @@ var require_lstatSync = __commonJS({
9601
9601
  };
9602
9602
  Object.defineProperty(exports, "__esModule", { value: true });
9603
9603
  exports.lstatSync = void 0;
9604
- var fs = __importStar(__require("fs"));
9604
+ var fs2 = __importStar(__require("fs"));
9605
9605
  var stat_js_1 = require_stat();
9606
9606
  var errorMap_js_1 = __importDefault(require_errorMap());
9607
- var lstatSync = (path) => {
9607
+ var lstatSync = (path2) => {
9608
9608
  try {
9609
- return (0, stat_js_1.denoifyFileInfo)(fs.lstatSync(path));
9609
+ return (0, stat_js_1.denoifyFileInfo)(fs2.lstatSync(path2));
9610
9610
  } catch (err) {
9611
9611
  throw (0, errorMap_js_1.default)(err);
9612
9612
  }
@@ -9697,10 +9697,10 @@ var require_writeTextFile = __commonJS({
9697
9697
  };
9698
9698
  Object.defineProperty(exports, "__esModule", { value: true });
9699
9699
  exports.writeTextFile = void 0;
9700
- var fs = __importStar(__require("fs/promises"));
9700
+ var fs2 = __importStar(__require("fs/promises"));
9701
9701
  var errorMap_js_1 = __importDefault(require_errorMap());
9702
9702
  var fs_flags_js_1 = require_fs_flags();
9703
- var writeTextFile = async function writeTextFile2(path, data, { append = false, create = true, createNew = false, mode, signal } = {}) {
9703
+ var writeTextFile = async function writeTextFile2(path2, data, { append = false, create = true, createNew = false, mode, signal } = {}) {
9704
9704
  const truncate = create && !append;
9705
9705
  const flag = (0, fs_flags_js_1.getFsFlag)({
9706
9706
  append,
@@ -9710,9 +9710,9 @@ var require_writeTextFile = __commonJS({
9710
9710
  write: true
9711
9711
  });
9712
9712
  try {
9713
- await fs.writeFile(path, data, { flag, mode, signal });
9713
+ await fs2.writeFile(path2, data, { flag, mode, signal });
9714
9714
  if (mode !== void 0)
9715
- await fs.chmod(path, mode);
9715
+ await fs2.chmod(path2, mode);
9716
9716
  } catch (error48) {
9717
9717
  throw (0, errorMap_js_1.default)(error48);
9718
9718
  }
@@ -9776,14 +9776,14 @@ var require_writeTextFileSync = __commonJS({
9776
9776
  };
9777
9777
  Object.defineProperty(exports, "__esModule", { value: true });
9778
9778
  exports.writeTextFileSync = void 0;
9779
- var fs = __importStar(__require("fs"));
9779
+ var fs2 = __importStar(__require("fs"));
9780
9780
  var errorMap_js_1 = __importDefault(require_errorMap());
9781
- var writeTextFileSync = (path, data, { append = false, create = true, mode } = {}) => {
9781
+ var writeTextFileSync = (path2, data, { append = false, create = true, mode } = {}) => {
9782
9782
  const flag = create ? append ? "a" : "w" : "r+";
9783
9783
  try {
9784
- fs.writeFileSync(path, data, { flag, mode });
9784
+ fs2.writeFileSync(path2, data, { flag, mode });
9785
9785
  if (mode !== void 0)
9786
- fs.chmodSync(path, mode);
9786
+ fs2.chmodSync(path2, mode);
9787
9787
  } catch (error48) {
9788
9788
  throw (0, errorMap_js_1.default)(error48);
9789
9789
  }
@@ -9833,17 +9833,17 @@ var require_mkdir = __commonJS({
9833
9833
  var promises_1 = __require("fs/promises");
9834
9834
  var errorMap_js_1 = __importDefault(require_errorMap());
9835
9835
  var variables_js_1 = require_variables();
9836
- var mkdir = async function mkdir2(path, options3) {
9836
+ var mkdir2 = async function mkdir3(path2, options3) {
9837
9837
  try {
9838
- await (0, promises_1.mkdir)(path, options3);
9838
+ await (0, promises_1.mkdir)(path2, options3);
9839
9839
  } catch (error48) {
9840
9840
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "EEXIST") {
9841
- throw new variables_js_1.errors.AlreadyExists(`File exists (os error 17), mkdir '${path}'`);
9841
+ throw new variables_js_1.errors.AlreadyExists(`File exists (os error 17), mkdir '${path2}'`);
9842
9842
  }
9843
9843
  throw (0, errorMap_js_1.default)(error48);
9844
9844
  }
9845
9845
  };
9846
- exports.mkdir = mkdir;
9846
+ exports.mkdir = mkdir2;
9847
9847
  }
9848
9848
  });
9849
9849
 
@@ -9883,15 +9883,15 @@ var require_mkdirSync = __commonJS({
9883
9883
  };
9884
9884
  Object.defineProperty(exports, "__esModule", { value: true });
9885
9885
  exports.mkdirSync = void 0;
9886
- var fs = __importStar(__require("fs"));
9886
+ var fs2 = __importStar(__require("fs"));
9887
9887
  var errorMap_js_1 = __importDefault(require_errorMap());
9888
9888
  var variables_js_1 = require_variables();
9889
- var mkdirSync = (path, options3) => {
9889
+ var mkdirSync = (path2, options3) => {
9890
9890
  try {
9891
- fs.mkdirSync(path, options3);
9891
+ fs2.mkdirSync(path2, options3);
9892
9892
  } catch (error48) {
9893
9893
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "EEXIST") {
9894
- throw new variables_js_1.errors.AlreadyExists(`File exists (os error 17), mkdir '${path}'`);
9894
+ throw new variables_js_1.errors.AlreadyExists(`File exists (os error 17), mkdir '${path2}'`);
9895
9895
  }
9896
9896
  throw (0, errorMap_js_1.default)(error48);
9897
9897
  }
@@ -9939,9 +9939,9 @@ var require_readDir = __commonJS({
9939
9939
  exports.readDir = void 0;
9940
9940
  var promises_1 = __require("fs/promises");
9941
9941
  var errorMap_js_1 = __importDefault(require_errorMap());
9942
- var readDir = async function* readDir2(path) {
9942
+ var readDir = async function* readDir2(path2) {
9943
9943
  try {
9944
- for await (const e of await (0, promises_1.opendir)(String(path))) {
9944
+ for await (const e of await (0, promises_1.opendir)(String(path2))) {
9945
9945
  const ent = {
9946
9946
  name: e.name,
9947
9947
  isFile: e.isFile(),
@@ -9969,9 +9969,9 @@ var require_readDirSync = __commonJS({
9969
9969
  exports.readDirSync = void 0;
9970
9970
  var fs_1 = __require("fs");
9971
9971
  var errorMap_js_1 = __importDefault(require_errorMap());
9972
- var readDirSync = function* readDir(path) {
9972
+ var readDirSync = function* readDir(path2) {
9973
9973
  try {
9974
- for (const e of (0, fs_1.readdirSync)(String(path), { withFileTypes: true })) {
9974
+ for (const e of (0, fs_1.readdirSync)(String(path2), { withFileTypes: true })) {
9975
9975
  const ent = {
9976
9976
  name: e.name,
9977
9977
  isFile: e.isFile(),
@@ -9999,15 +9999,15 @@ var require_readFile = __commonJS({
9999
9999
  exports.readFile = void 0;
10000
10000
  var promises_1 = __require("fs/promises");
10001
10001
  var errorMap_js_1 = __importDefault(require_errorMap());
10002
- var readFile = async function readFile2(path, { signal } = {}) {
10002
+ var readFile2 = async function readFile3(path2, { signal } = {}) {
10003
10003
  try {
10004
- const buf = await (0, promises_1.readFile)(path, { signal });
10004
+ const buf = await (0, promises_1.readFile)(path2, { signal });
10005
10005
  return new Uint8Array(buf.buffer, buf.byteOffset, buf.length);
10006
10006
  } catch (e) {
10007
10007
  throw (0, errorMap_js_1.default)(e);
10008
10008
  }
10009
10009
  };
10010
- exports.readFile = readFile;
10010
+ exports.readFile = readFile2;
10011
10011
  }
10012
10012
  });
10013
10013
 
@@ -10022,9 +10022,9 @@ var require_readFileSync = __commonJS({
10022
10022
  exports.readFileSync = void 0;
10023
10023
  var fs_1 = __require("fs");
10024
10024
  var errorMap_js_1 = __importDefault(require_errorMap());
10025
- var readFileSync = function readFileSync2(path) {
10025
+ var readFileSync = function readFileSync2(path2) {
10026
10026
  try {
10027
- const buf = (0, fs_1.readFileSync)(path);
10027
+ const buf = (0, fs_1.readFileSync)(path2);
10028
10028
  return new Uint8Array(buf.buffer, buf.byteOffset, buf.length);
10029
10029
  } catch (e) {
10030
10030
  throw (0, errorMap_js_1.default)(e);
@@ -10067,8 +10067,8 @@ var require_readLink = __commonJS({
10067
10067
  };
10068
10068
  Object.defineProperty(exports, "__esModule", { value: true });
10069
10069
  exports.readLink = void 0;
10070
- var fs = __importStar(__require("fs/promises"));
10071
- exports.readLink = fs.readlink;
10070
+ var fs2 = __importStar(__require("fs/promises"));
10071
+ exports.readLink = fs2.readlink;
10072
10072
  }
10073
10073
  });
10074
10074
 
@@ -10105,8 +10105,8 @@ var require_readLinkSync = __commonJS({
10105
10105
  };
10106
10106
  Object.defineProperty(exports, "__esModule", { value: true });
10107
10107
  exports.readLinkSync = void 0;
10108
- var fs = __importStar(__require("fs"));
10109
- exports.readLinkSync = fs.readlinkSync;
10108
+ var fs2 = __importStar(__require("fs"));
10109
+ exports.readLinkSync = fs2.readlinkSync;
10110
10110
  }
10111
10111
  });
10112
10112
 
@@ -10143,8 +10143,8 @@ var require_realPath = __commonJS({
10143
10143
  };
10144
10144
  Object.defineProperty(exports, "__esModule", { value: true });
10145
10145
  exports.realPath = void 0;
10146
- var fs = __importStar(__require("fs/promises"));
10147
- exports.realPath = fs.realpath;
10146
+ var fs2 = __importStar(__require("fs/promises"));
10147
+ exports.realPath = fs2.realpath;
10148
10148
  }
10149
10149
  });
10150
10150
 
@@ -10181,8 +10181,8 @@ var require_realPathSync = __commonJS({
10181
10181
  };
10182
10182
  Object.defineProperty(exports, "__esModule", { value: true });
10183
10183
  exports.realPathSync = void 0;
10184
- var fs = __importStar(__require("fs"));
10185
- exports.realPathSync = fs.realpathSync;
10184
+ var fs2 = __importStar(__require("fs"));
10185
+ exports.realPathSync = fs2.realpathSync;
10186
10186
  }
10187
10187
  });
10188
10188
 
@@ -10193,13 +10193,13 @@ var require_remove = __commonJS({
10193
10193
  Object.defineProperty(exports, "__esModule", { value: true });
10194
10194
  exports.remove = void 0;
10195
10195
  var promises_1 = __require("fs/promises");
10196
- var remove = async function remove2(path, options3 = {}) {
10196
+ var remove = async function remove2(path2, options3 = {}) {
10197
10197
  const innerOptions = options3.recursive ? { recursive: true, force: true } : {};
10198
10198
  try {
10199
- return await (0, promises_1.rm)(path, innerOptions);
10199
+ return await (0, promises_1.rm)(path2, innerOptions);
10200
10200
  } catch (err) {
10201
10201
  if (err.code === "ERR_FS_EISDIR") {
10202
- return await (0, promises_1.rmdir)(path, innerOptions);
10202
+ return await (0, promises_1.rmdir)(path2, innerOptions);
10203
10203
  } else {
10204
10204
  throw err;
10205
10205
  }
@@ -10259,14 +10259,14 @@ var require_removeSync = __commonJS({
10259
10259
  };
10260
10260
  Object.defineProperty(exports, "__esModule", { value: true });
10261
10261
  exports.removeSync = void 0;
10262
- var fs = __importStar(__require("fs"));
10263
- var removeSync = (path, options3 = {}) => {
10262
+ var fs2 = __importStar(__require("fs"));
10263
+ var removeSync = (path2, options3 = {}) => {
10264
10264
  const innerOptions = options3.recursive ? { recursive: true, force: true } : {};
10265
10265
  try {
10266
- fs.rmSync(path, innerOptions);
10266
+ fs2.rmSync(path2, innerOptions);
10267
10267
  } catch (err) {
10268
10268
  if (err.code === "ERR_FS_EISDIR") {
10269
- fs.rmdirSync(path, innerOptions);
10269
+ fs2.rmdirSync(path2, innerOptions);
10270
10270
  } else {
10271
10271
  throw err;
10272
10272
  }
@@ -10323,8 +10323,8 @@ var require_renameSync = __commonJS({
10323
10323
  };
10324
10324
  Object.defineProperty(exports, "__esModule", { value: true });
10325
10325
  exports.renameSync = void 0;
10326
- var fs = __importStar(__require("fs"));
10327
- exports.renameSync = fs.renameSync;
10326
+ var fs2 = __importStar(__require("fs"));
10327
+ exports.renameSync = fs2.renameSync;
10328
10328
  }
10329
10329
  });
10330
10330
 
@@ -10820,12 +10820,12 @@ var require_statSync = __commonJS({
10820
10820
  };
10821
10821
  Object.defineProperty(exports, "__esModule", { value: true });
10822
10822
  exports.statSync = void 0;
10823
- var fs = __importStar(__require("fs"));
10823
+ var fs2 = __importStar(__require("fs"));
10824
10824
  var stat_js_1 = require_stat();
10825
10825
  var errorMap_js_1 = __importDefault(require_errorMap());
10826
- var statSync = (path) => {
10826
+ var statSync = (path2) => {
10827
10827
  try {
10828
- return (0, stat_js_1.denoifyFileInfo)(fs.statSync(path));
10828
+ return (0, stat_js_1.denoifyFileInfo)(fs2.statSync(path2));
10829
10829
  } catch (err) {
10830
10830
  throw (0, errorMap_js_1.default)(err);
10831
10831
  }
@@ -10867,8 +10867,8 @@ var require_symlink = __commonJS({
10867
10867
  };
10868
10868
  Object.defineProperty(exports, "__esModule", { value: true });
10869
10869
  exports.symlink = void 0;
10870
- var fs = __importStar(__require("fs/promises"));
10871
- var symlink = async (oldpath, newpath, options3) => await fs.symlink(oldpath, newpath, options3 === null || options3 === void 0 ? void 0 : options3.type);
10870
+ var fs2 = __importStar(__require("fs/promises"));
10871
+ var symlink = async (oldpath, newpath, options3) => await fs2.symlink(oldpath, newpath, options3 === null || options3 === void 0 ? void 0 : options3.type);
10872
10872
  exports.symlink = symlink;
10873
10873
  }
10874
10874
  });
@@ -10906,8 +10906,8 @@ var require_symlinkSync = __commonJS({
10906
10906
  };
10907
10907
  Object.defineProperty(exports, "__esModule", { value: true });
10908
10908
  exports.symlinkSync = void 0;
10909
- var fs = __importStar(__require("fs"));
10910
- var symlinkSync = (oldpath, newpath, options3) => fs.symlinkSync(oldpath, newpath, options3 === null || options3 === void 0 ? void 0 : options3.type);
10909
+ var fs2 = __importStar(__require("fs"));
10910
+ var symlinkSync = (oldpath, newpath, options3) => fs2.symlinkSync(oldpath, newpath, options3 === null || options3 === void 0 ? void 0 : options3.type);
10911
10911
  exports.symlinkSync = symlinkSync;
10912
10912
  }
10913
10913
  });
@@ -11085,12 +11085,12 @@ var require_truncate = __commonJS({
11085
11085
  };
11086
11086
  Object.defineProperty(exports, "__esModule", { value: true });
11087
11087
  exports.truncate = void 0;
11088
- var fs = __importStar(__require("fs/promises"));
11088
+ var fs2 = __importStar(__require("fs/promises"));
11089
11089
  var errorMap_js_1 = __importDefault(require_errorMap());
11090
11090
  var variables_js_1 = require_variables();
11091
11091
  var truncate = async (name, len) => {
11092
11092
  try {
11093
- return await fs.truncate(name, len);
11093
+ return await fs2.truncate(name, len);
11094
11094
  } catch (error48) {
11095
11095
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
11096
11096
  throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), truncate '${name}'`);
@@ -11138,12 +11138,12 @@ var require_truncateSync = __commonJS({
11138
11138
  };
11139
11139
  Object.defineProperty(exports, "__esModule", { value: true });
11140
11140
  exports.truncateSync = void 0;
11141
- var fs = __importStar(__require("fs"));
11141
+ var fs2 = __importStar(__require("fs"));
11142
11142
  var errorMap_js_1 = __importDefault(require_errorMap());
11143
11143
  var variables_js_1 = require_variables();
11144
11144
  var truncateSync = (name, len) => {
11145
11145
  try {
11146
- return fs.truncateSync(name, len);
11146
+ return fs2.truncateSync(name, len);
11147
11147
  } catch (error48) {
11148
11148
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
11149
11149
  throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), truncate '${name}'`);
@@ -11226,9 +11226,9 @@ var require_watchFs = __commonJS({
11226
11226
  const ac = new AbortController();
11227
11227
  const { signal } = ac;
11228
11228
  const rid = -1;
11229
- const masterWatcher = (0, iterutil_js_1.merge)(paths.map((path) => (0, iterutil_js_1.mapAsync)((0, iterutil_js_1.filterAsync)((0, promises_1.watch)(path, { recursive: options3 === null || options3 === void 0 ? void 0 : options3.recursive, signal }), (info) => info.filename != null), (info) => ({
11229
+ const masterWatcher = (0, iterutil_js_1.merge)(paths.map((path2) => (0, iterutil_js_1.mapAsync)((0, iterutil_js_1.filterAsync)((0, promises_1.watch)(path2, { recursive: options3 === null || options3 === void 0 ? void 0 : options3.recursive, signal }), (info) => info.filename != null), (info) => ({
11230
11230
  kind: "modify",
11231
- paths: [(0, path_1.resolve)(path, info.filename)]
11231
+ paths: [(0, path_1.resolve)(path2, info.filename)]
11232
11232
  }))));
11233
11233
  function close() {
11234
11234
  ac.abort();
@@ -11279,21 +11279,21 @@ var require_writeFile = __commonJS({
11279
11279
  };
11280
11280
  Object.defineProperty(exports, "__esModule", { value: true });
11281
11281
  exports.writeFile = void 0;
11282
- var fs = __importStar(__require("fs/promises"));
11282
+ var fs2 = __importStar(__require("fs/promises"));
11283
11283
  var errorMap_js_1 = __importDefault(require_errorMap());
11284
11284
  var fs_flags_js_1 = require_fs_flags();
11285
- var writeFile = async function writeFile2(path, data, { append = false, create = true, createNew = false, mode, signal } = {}) {
11285
+ var writeFile2 = async function writeFile3(path2, data, { append = false, create = true, createNew = false, mode, signal } = {}) {
11286
11286
  const truncate = create && !append;
11287
11287
  const flag = (0, fs_flags_js_1.getFsFlag)({ append, create, createNew, truncate, write: true });
11288
11288
  try {
11289
- await fs.writeFile(path, data, { flag, signal });
11289
+ await fs2.writeFile(path2, data, { flag, signal });
11290
11290
  if (mode != null)
11291
- await fs.chmod(path, mode);
11291
+ await fs2.chmod(path2, mode);
11292
11292
  } catch (error48) {
11293
11293
  throw (0, errorMap_js_1.default)(error48);
11294
11294
  }
11295
11295
  };
11296
- exports.writeFile = writeFile;
11296
+ exports.writeFile = writeFile2;
11297
11297
  }
11298
11298
  });
11299
11299
 
@@ -11311,12 +11311,12 @@ var require_writeFileSync = __commonJS({
11311
11311
  var errorMap_js_1 = __importDefault(require_errorMap());
11312
11312
  var statSync_js_1 = require_statSync();
11313
11313
  var chmodSync_js_1 = require_chmodSync();
11314
- var writeFileSync = function writeFileSync2(path, data, options3 = {}) {
11314
+ var writeFileSync = function writeFileSync2(path2, data, options3 = {}) {
11315
11315
  try {
11316
11316
  if (options3.create !== void 0) {
11317
11317
  const create = !!options3.create;
11318
11318
  if (!create) {
11319
- (0, statSync_js_1.statSync)(path);
11319
+ (0, statSync_js_1.statSync)(path2);
11320
11320
  }
11321
11321
  }
11322
11322
  const openOptions = {
@@ -11326,9 +11326,9 @@ var require_writeFileSync = __commonJS({
11326
11326
  append: !!options3.append,
11327
11327
  truncate: !options3.append
11328
11328
  };
11329
- const file2 = (0, openSync_js_1.openSync)(path, openOptions);
11329
+ const file2 = (0, openSync_js_1.openSync)(path2, openOptions);
11330
11330
  if (options3.mode !== void 0 && options3.mode !== null && (0, os_1.platform)() !== "win32") {
11331
- (0, chmodSync_js_1.chmodSync)(path, options3.mode);
11331
+ (0, chmodSync_js_1.chmodSync)(path2, options3.mode);
11332
11332
  }
11333
11333
  let nwritten = 0;
11334
11334
  while (nwritten < data.length) {
@@ -11733,23 +11733,23 @@ var require_functions = __commonJS({
11733
11733
  }
11734
11734
  };
11735
11735
  exports.futimeSync = futimeSync;
11736
- var utime = async function(path, atime, mtime) {
11736
+ var utime = async function(path2, atime, mtime) {
11737
11737
  try {
11738
- await fs_1.default.promises.utimes(path, atime, mtime);
11738
+ await fs_1.default.promises.utimes(path2, atime, mtime);
11739
11739
  } catch (error48) {
11740
11740
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
11741
- throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), utime '${path}'`);
11741
+ throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), utime '${path2}'`);
11742
11742
  }
11743
11743
  throw (0, errorMap_js_1.default)(error48);
11744
11744
  }
11745
11745
  };
11746
11746
  exports.utime = utime;
11747
- var utimeSync = function(path, atime, mtime) {
11747
+ var utimeSync = function(path2, atime, mtime) {
11748
11748
  try {
11749
- fs_1.default.utimesSync(path, atime, mtime);
11749
+ fs_1.default.utimesSync(path2, atime, mtime);
11750
11750
  } catch (error48) {
11751
11751
  if ((error48 === null || error48 === void 0 ? void 0 : error48.code) === "ENOENT") {
11752
- throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), utime '${path}'`);
11752
+ throw new variables_js_1.errors.NotFound(`No such file or directory (os error 2), utime '${path2}'`);
11753
11753
  }
11754
11754
  throw (0, errorMap_js_1.default)(error48);
11755
11755
  }
@@ -12576,18 +12576,18 @@ var require_memstore = __commonJS({
12576
12576
  /**
12577
12577
  * @internal No doc because this is an overload that supports the implementation
12578
12578
  */
12579
- findCookie(domain2, path, key, callback) {
12579
+ findCookie(domain2, path2, key, callback) {
12580
12580
  const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
12581
- if (domain2 == null || path == null || key == null) {
12581
+ if (domain2 == null || path2 == null || key == null) {
12582
12582
  return promiseCallback.resolve(void 0);
12583
12583
  }
12584
- const result = this.idx[domain2]?.[path]?.[key];
12584
+ const result = this.idx[domain2]?.[path2]?.[key];
12585
12585
  return promiseCallback.resolve(result);
12586
12586
  }
12587
12587
  /**
12588
12588
  * @internal No doc because this is an overload that supports the implementation
12589
12589
  */
12590
- findCookies(domain2, path, allowSpecialUseDomain = false, callback) {
12590
+ findCookies(domain2, path2, allowSpecialUseDomain = false, callback) {
12591
12591
  if (typeof allowSpecialUseDomain === "function") {
12592
12592
  callback = allowSpecialUseDomain;
12593
12593
  allowSpecialUseDomain = true;
@@ -12598,7 +12598,7 @@ var require_memstore = __commonJS({
12598
12598
  return promiseCallback.resolve([]);
12599
12599
  }
12600
12600
  let pathMatcher;
12601
- if (!path) {
12601
+ if (!path2) {
12602
12602
  pathMatcher = function matchAll(domainIndex) {
12603
12603
  for (const curPath in domainIndex) {
12604
12604
  const pathIndex = domainIndex[curPath];
@@ -12613,7 +12613,7 @@ var require_memstore = __commonJS({
12613
12613
  } else {
12614
12614
  pathMatcher = function matchRFC(domainIndex) {
12615
12615
  for (const cookiePath in domainIndex) {
12616
- if ((0, pathMatch_1.pathMatch)(path, cookiePath)) {
12616
+ if ((0, pathMatch_1.pathMatch)(path2, cookiePath)) {
12617
12617
  const pathIndex = domainIndex[cookiePath];
12618
12618
  for (const key in pathIndex) {
12619
12619
  const value = pathIndex[key];
@@ -12641,14 +12641,14 @@ var require_memstore = __commonJS({
12641
12641
  */
12642
12642
  putCookie(cookie, callback) {
12643
12643
  const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
12644
- const { domain: domain2, path, key } = cookie;
12645
- if (domain2 == null || path == null || key == null) {
12644
+ const { domain: domain2, path: path2, key } = cookie;
12645
+ if (domain2 == null || path2 == null || key == null) {
12646
12646
  return promiseCallback.resolve(void 0);
12647
12647
  }
12648
12648
  const domainEntry = this.idx[domain2] ?? /* @__PURE__ */ Object.create(null);
12649
12649
  this.idx[domain2] = domainEntry;
12650
- const pathEntry = domainEntry[path] ?? /* @__PURE__ */ Object.create(null);
12651
- domainEntry[path] = pathEntry;
12650
+ const pathEntry = domainEntry[path2] ?? /* @__PURE__ */ Object.create(null);
12651
+ domainEntry[path2] = pathEntry;
12652
12652
  pathEntry[key] = cookie;
12653
12653
  return promiseCallback.resolve(void 0);
12654
12654
  }
@@ -12664,20 +12664,20 @@ var require_memstore = __commonJS({
12664
12664
  /**
12665
12665
  * @internal No doc because this is an overload that supports the implementation
12666
12666
  */
12667
- removeCookie(domain2, path, key, callback) {
12667
+ removeCookie(domain2, path2, key, callback) {
12668
12668
  const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
12669
- delete this.idx[domain2]?.[path]?.[key];
12669
+ delete this.idx[domain2]?.[path2]?.[key];
12670
12670
  return promiseCallback.resolve(void 0);
12671
12671
  }
12672
12672
  /**
12673
12673
  * @internal No doc because this is an overload that supports the implementation
12674
12674
  */
12675
- removeCookies(domain2, path, callback) {
12675
+ removeCookies(domain2, path2, callback) {
12676
12676
  const promiseCallback = (0, utils_1.createPromiseCallback)(callback);
12677
12677
  const domainEntry = this.idx[domain2];
12678
12678
  if (domainEntry) {
12679
- if (path) {
12680
- delete domainEntry[path];
12679
+ if (path2) {
12680
+ delete domainEntry[path2];
12681
12681
  } else {
12682
12682
  delete this.idx[domain2];
12683
12683
  }
@@ -12703,8 +12703,8 @@ var require_memstore = __commonJS({
12703
12703
  domains.forEach((domain2) => {
12704
12704
  const domainEntry = idx[domain2] ?? {};
12705
12705
  const paths = Object.keys(domainEntry);
12706
- paths.forEach((path) => {
12707
- const pathEntry = domainEntry[path] ?? {};
12706
+ paths.forEach((path2) => {
12707
+ const pathEntry = domainEntry[path2] ?? {};
12708
12708
  const keys = Object.keys(pathEntry);
12709
12709
  keys.forEach((key) => {
12710
12710
  const keyEntry = pathEntry[key];
@@ -13722,18 +13722,18 @@ var require_defaultPath = __commonJS({
13722
13722
  "use strict";
13723
13723
  Object.defineProperty(exports, "__esModule", { value: true });
13724
13724
  exports.defaultPath = defaultPath;
13725
- function defaultPath(path) {
13726
- if (!path || path.slice(0, 1) !== "/") {
13725
+ function defaultPath(path2) {
13726
+ if (!path2 || path2.slice(0, 1) !== "/") {
13727
13727
  return "/";
13728
13728
  }
13729
- if (path === "/") {
13730
- return path;
13729
+ if (path2 === "/") {
13730
+ return path2;
13731
13731
  }
13732
- const rightSlash = path.lastIndexOf("/");
13732
+ const rightSlash = path2.lastIndexOf("/");
13733
13733
  if (rightSlash === 0) {
13734
13734
  return "/";
13735
13735
  }
13736
- return path.slice(0, rightSlash);
13736
+ return path2.slice(0, rightSlash);
13737
13737
  }
13738
13738
  }
13739
13739
  });
@@ -14127,7 +14127,7 @@ var require_cookieJar = __commonJS({
14127
14127
  return promiseCallback.reject(parameterError);
14128
14128
  }
14129
14129
  const host = (0, canonicalDomain_1.canonicalDomain)(context.hostname);
14130
- const path = context.pathname || "/";
14130
+ const path2 = context.pathname || "/";
14131
14131
  const secure = context.protocol && (context.protocol == "https:" || context.protocol == "wss:");
14132
14132
  let sameSiteLevel = 0;
14133
14133
  if (options3.sameSiteContext) {
@@ -14155,7 +14155,7 @@ var require_cookieJar = __commonJS({
14155
14155
  return false;
14156
14156
  }
14157
14157
  }
14158
- if (!allPaths && typeof c.path === "string" && !(0, pathMatch_1.pathMatch)(path, c.path)) {
14158
+ if (!allPaths && typeof c.path === "string" && !(0, pathMatch_1.pathMatch)(path2, c.path)) {
14159
14159
  return false;
14160
14160
  }
14161
14161
  if (c.secure && !secure) {
@@ -14185,7 +14185,7 @@ var require_cookieJar = __commonJS({
14185
14185
  }
14186
14186
  return true;
14187
14187
  }
14188
- store.findCookies(host, allPaths ? null : path, this.allowSpecialUseDomain, (err, cookies) => {
14188
+ store.findCookies(host, allPaths ? null : path2, this.allowSpecialUseDomain, (err, cookies) => {
14189
14189
  if (err) {
14190
14190
  cb(err);
14191
14191
  return;
@@ -14620,18 +14620,18 @@ var require_permutePath = __commonJS({
14620
14620
  "use strict";
14621
14621
  Object.defineProperty(exports, "__esModule", { value: true });
14622
14622
  exports.permutePath = permutePath;
14623
- function permutePath(path) {
14624
- if (path === "/") {
14623
+ function permutePath(path2) {
14624
+ if (path2 === "/") {
14625
14625
  return ["/"];
14626
14626
  }
14627
- const permutations = [path];
14628
- while (path.length > 1) {
14629
- const lindex = path.lastIndexOf("/");
14627
+ const permutations = [path2];
14628
+ while (path2.length > 1) {
14629
+ const lindex = path2.lastIndexOf("/");
14630
14630
  if (lindex === 0) {
14631
14631
  break;
14632
14632
  }
14633
- path = path.slice(0, lindex);
14634
- permutations.push(path);
14633
+ path2 = path2.slice(0, lindex);
14634
+ permutations.push(path2);
14635
14635
  }
14636
14636
  permutations.push("/");
14637
14637
  return permutations;
@@ -15084,8 +15084,8 @@ function getErrorMap() {
15084
15084
 
15085
15085
  // ../node_modules/zod/v3/helpers/parseUtil.js
15086
15086
  var makeIssue = (params) => {
15087
- const { data, path, errorMaps, issueData } = params;
15088
- const fullPath = [...path, ...issueData.path || []];
15087
+ const { data, path: path2, errorMaps, issueData } = params;
15088
+ const fullPath = [...path2, ...issueData.path || []];
15089
15089
  const fullIssue = {
15090
15090
  ...issueData,
15091
15091
  path: fullPath
@@ -15200,11 +15200,11 @@ var errorUtil;
15200
15200
 
15201
15201
  // ../node_modules/zod/v3/types.js
15202
15202
  var ParseInputLazyPath = class {
15203
- constructor(parent, value, path, key) {
15203
+ constructor(parent, value, path2, key) {
15204
15204
  this._cachedPath = [];
15205
15205
  this.parent = parent;
15206
15206
  this.data = value;
15207
- this._path = path;
15207
+ this._path = path2;
15208
15208
  this._key = key;
15209
15209
  }
15210
15210
  get path() {
@@ -19127,10 +19127,10 @@ function mergeDefs(...defs) {
19127
19127
  function cloneDef(schema) {
19128
19128
  return mergeDefs(schema._zod.def);
19129
19129
  }
19130
- function getElementAtPath(obj, path) {
19131
- if (!path)
19130
+ function getElementAtPath(obj, path2) {
19131
+ if (!path2)
19132
19132
  return obj;
19133
- return path.reduce((acc, key) => acc?.[key], obj);
19133
+ return path2.reduce((acc, key) => acc?.[key], obj);
19134
19134
  }
19135
19135
  function promiseAllObject(promisesObj) {
19136
19136
  const keys = Object.keys(promisesObj);
@@ -19513,11 +19513,11 @@ function aborted(x, startIndex = 0) {
19513
19513
  }
19514
19514
  return false;
19515
19515
  }
19516
- function prefixIssues(path, issues) {
19516
+ function prefixIssues(path2, issues) {
19517
19517
  return issues.map((iss) => {
19518
19518
  var _a2;
19519
19519
  (_a2 = iss).path ?? (_a2.path = []);
19520
- iss.path.unshift(path);
19520
+ iss.path.unshift(path2);
19521
19521
  return iss;
19522
19522
  });
19523
19523
  }
@@ -19700,7 +19700,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
19700
19700
  }
19701
19701
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
19702
19702
  const result = { errors: [] };
19703
- const processError = (error49, path = []) => {
19703
+ const processError = (error49, path2 = []) => {
19704
19704
  var _a2, _b;
19705
19705
  for (const issue2 of error49.issues) {
19706
19706
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -19710,7 +19710,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
19710
19710
  } else if (issue2.code === "invalid_element") {
19711
19711
  processError({ issues: issue2.issues }, issue2.path);
19712
19712
  } else {
19713
- const fullpath = [...path, ...issue2.path];
19713
+ const fullpath = [...path2, ...issue2.path];
19714
19714
  if (fullpath.length === 0) {
19715
19715
  result.errors.push(mapper(issue2));
19716
19716
  continue;
@@ -19742,8 +19742,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
19742
19742
  }
19743
19743
  function toDotPath(_path) {
19744
19744
  const segs = [];
19745
- const path = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
19746
- for (const seg of path) {
19745
+ const path2 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
19746
+ for (const seg of path2) {
19747
19747
  if (typeof seg === "number")
19748
19748
  segs.push(`[${seg}]`);
19749
19749
  else if (typeof seg === "symbol")
@@ -32149,13 +32149,13 @@ function resolveRef(ref, ctx) {
32149
32149
  if (!ref.startsWith("#")) {
32150
32150
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
32151
32151
  }
32152
- const path = ref.slice(1).split("/").filter(Boolean);
32153
- if (path.length === 0) {
32152
+ const path2 = ref.slice(1).split("/").filter(Boolean);
32153
+ if (path2.length === 0) {
32154
32154
  return ctx.rootSchema;
32155
32155
  }
32156
32156
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
32157
- if (path[0] === defsKey) {
32158
- const key = path[1];
32157
+ if (path2[0] === defsKey) {
32158
+ const key = path2[1];
32159
32159
  if (!key || !ctx.defs[key]) {
32160
32160
  throw new Error(`Reference not found: ${ref}`);
32161
32161
  }
@@ -38318,6 +38318,13 @@ function truncateToLimit(text, maxChars = 12e3) {
38318
38318
  return text;
38319
38319
  return text.slice(0, maxChars) + "\n\n_...response truncated to fit context window. Use pagination to retrieve more results._";
38320
38320
  }
38321
+ function formatPaginationFooter(offset, limit, total) {
38322
+ const start = offset + 1;
38323
+ const end = Math.min(offset + limit, total);
38324
+ return `
38325
+ ---
38326
+ _Showing ${start}\u2013${end} of ${total}. Use \`offset: ${offset + limit}\` for the next page._`;
38327
+ }
38321
38328
 
38322
38329
  // ../packages/shared/dist/pagination.js
38323
38330
  var z2 = external_exports3 || zod_default || zod_exports;
@@ -38338,141 +38345,110 @@ function applyPagination(items, params) {
38338
38345
  };
38339
38346
  }
38340
38347
 
38341
- // src/mock.ts
38342
- var IS_MOCK = process.env.MOCK === "true" || process.env.YAHOO_FINANCE_MOCK === "true";
38343
- var MOCK_FIXTURES = {
38344
- getHistoricalPrices: {
38345
- quotes: [
38346
- {
38347
- date: /* @__PURE__ */ new Date("2023-01-01"),
38348
- open: 150,
38349
- high: 155,
38350
- low: 149,
38351
- close: 154,
38352
- volume: 1e6,
38353
- adjclose: 154
38354
- },
38355
- {
38356
- date: /* @__PURE__ */ new Date("2023-01-02"),
38357
- open: 154,
38358
- high: 158,
38359
- low: 153,
38360
- close: 157,
38361
- volume: 12e5,
38362
- adjclose: 157
38363
- }
38364
- ]
38365
- },
38366
- getStockInfo: {
38367
- price: {
38368
- longName: "Apple Inc.",
38369
- regularMarketPrice: 150,
38370
- currency: "USD",
38371
- regularMarketChange: 1.5,
38372
- regularMarketChangePercent: 1,
38373
- marketCap: 25e11,
38374
- exchangeName: "NasdaqGS"
38375
- },
38376
- summaryProfile: {
38377
- sector: "Technology",
38378
- industry: "Consumer Electronics",
38379
- country: "United States",
38380
- fullTimeEmployees: 147e3,
38381
- longBusinessSummary: "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide."
38382
- },
38383
- financialData: {
38384
- totalRevenue: 365817e6,
38385
- grossProfits: 152836e6,
38386
- ebitda: 120233e6,
38387
- freeCashflow: 92953e6,
38388
- returnOnEquity: 1.4744,
38389
- recommendationKey: "buy"
38390
- },
38391
- defaultKeyStatistics: {
38392
- beta: 1.2,
38393
- forwardPE: 25.5,
38394
- forwardEps: 6,
38395
- sharesOutstanding: 164e8,
38396
- floatShares: 1638e7
38397
- },
38398
- summaryDetail: {
38399
- fiftyTwoWeekHigh: 182.94,
38400
- fiftyTwoWeekLow: 129.04
38401
- }
38402
- },
38403
- getNews: [
38404
- {
38405
- title: "Apple announces new iPhone",
38406
- publisher: "TechNews",
38407
- link: "http://technews.com/apple",
38408
- providerPublishTime: /* @__PURE__ */ new Date("2023-01-01")
38409
- }
38410
- ],
38411
- getStockActions: {
38412
- dividends: [{ date: /* @__PURE__ */ new Date("2023-01-01"), amount: 0.23 }],
38413
- splits: [
38414
- {
38415
- date: /* @__PURE__ */ new Date("2023-01-01"),
38416
- numerator: 4,
38417
- denominator: 1,
38418
- splitRatio: "4:1"
38348
+ // ../packages/shared/dist/cache.js
38349
+ import * as fs from "node:fs/promises";
38350
+ import * as path from "node:path";
38351
+ import * as os from "node:os";
38352
+ import * as crypto from "node:crypto";
38353
+ var PersistentCache = class {
38354
+ cacheDir;
38355
+ memoryCache = /* @__PURE__ */ new Map();
38356
+ constructor(namespace) {
38357
+ const baseDir = process.env.FRE4X_CACHE_DIR || path.join(os.homedir(), ".fre4x-cache");
38358
+ this.cacheDir = path.join(baseDir, namespace);
38359
+ }
38360
+ async ensureDir() {
38361
+ await fs.mkdir(this.cacheDir, { recursive: true });
38362
+ }
38363
+ getFilePath(key) {
38364
+ const safeKey = crypto.createHash("sha256").update(key).digest("hex");
38365
+ return path.join(this.cacheDir, `${safeKey}.json`);
38366
+ }
38367
+ async get(key) {
38368
+ const now = Date.now();
38369
+ const memEntry = this.memoryCache.get(key);
38370
+ if (memEntry) {
38371
+ if (now - memEntry.timestamp < memEntry.ttlMs) {
38372
+ return memEntry.data;
38373
+ }
38374
+ this.memoryCache.delete(key);
38375
+ }
38376
+ const fpath = this.getFilePath(key);
38377
+ try {
38378
+ const raw = await fs.readFile(fpath, "utf8");
38379
+ const entry = JSON.parse(raw);
38380
+ if (now - entry.timestamp < entry.ttlMs) {
38381
+ this.memoryCache.set(key, entry);
38382
+ return entry.data;
38419
38383
  }
38420
- ]
38421
- },
38422
- getFinancialStatement: [
38423
- {
38424
- endDate: /* @__PURE__ */ new Date("2023-01-01"),
38425
- totalRevenue: 1e6,
38426
- grossProfit: 5e5
38427
- }
38428
- ],
38429
- getHolderInfo: [
38430
- { name: "Vanguard Group", pctHeld: 0.08, shares: 1e7 }
38431
- ],
38432
- getOptionDates: ["2023-01-20", "2023-02-17"],
38433
- getOptionChain: [
38434
- {
38435
- contractSymbol: "AAPL230120C00150000",
38436
- strike: 150,
38437
- lastPrice: 5.5,
38438
- bid: 5.4,
38439
- ask: 5.6,
38440
- volume: 1e3,
38441
- openInterest: 5e3,
38442
- impliedVolatility: 0.25
38384
+ await fs.unlink(fpath).catch(() => {
38385
+ });
38386
+ } catch {
38443
38387
  }
38444
- ],
38445
- getRecommendations: [
38446
- {
38447
- epochGradeDate: /* @__PURE__ */ new Date("2023-01-01"),
38448
- firm: "Morgan Stanley",
38449
- toGrade: "Overweight",
38450
- fromGrade: "Equal-Weight",
38451
- action: "up"
38388
+ return null;
38389
+ }
38390
+ async set(key, data, ttlMs) {
38391
+ const entry = {
38392
+ data,
38393
+ timestamp: Date.now(),
38394
+ ttlMs
38395
+ };
38396
+ this.memoryCache.set(key, entry);
38397
+ try {
38398
+ await this.ensureDir();
38399
+ const fpath = this.getFilePath(key);
38400
+ await fs.writeFile(fpath, JSON.stringify(entry), "utf8");
38401
+ } catch (error48) {
38402
+ console.error(`[Cache] Failed to save to disk: ${error48}`);
38452
38403
  }
38453
- ],
38454
- getQuotes: [
38455
- {
38456
- symbol: "AAPL",
38457
- shortName: "Apple Inc.",
38458
- regularMarketPrice: 150,
38459
- regularMarketChange: 1.5,
38460
- regularMarketChangePercent: 1,
38461
- currency: "USD",
38462
- market: "us_market"
38463
- },
38464
- {
38465
- symbol: "MSFT",
38466
- shortName: "Microsoft Corporation",
38467
- regularMarketPrice: 280,
38468
- regularMarketChange: 2,
38469
- regularMarketChangePercent: 0.72,
38470
- currency: "USD",
38471
- market: "us_market"
38404
+ }
38405
+ async wrap(key, ttlMs, fetchFn) {
38406
+ const cached2 = await this.get(key);
38407
+ if (cached2 !== null)
38408
+ return cached2;
38409
+ const data = await fetchFn();
38410
+ await this.set(key, data, ttlMs);
38411
+ return data;
38412
+ }
38413
+ async clear() {
38414
+ this.memoryCache.clear();
38415
+ try {
38416
+ await fs.rm(this.cacheDir, { recursive: true, force: true });
38417
+ } catch {
38472
38418
  }
38473
- ]
38419
+ }
38474
38420
  };
38475
38421
 
38422
+ // ../packages/shared/dist/package.js
38423
+ import { createRequire as createJsonRequire } from "node:module";
38424
+ function getPackageVersion(moduleUrl) {
38425
+ const require2 = createJsonRequire(moduleUrl);
38426
+ const packageJson = require2("../package.json");
38427
+ return packageJson.version ?? "0.0.0";
38428
+ }
38429
+
38430
+ // ../packages/shared/dist/data.js
38431
+ function ensureNewestFirst(items, dateKey) {
38432
+ if (items.length < 2)
38433
+ return items;
38434
+ const keys = Array.isArray(dateKey) ? dateKey : [dateKey];
38435
+ return [...items].sort((a, b) => {
38436
+ const getVal = (obj) => {
38437
+ for (const key of keys) {
38438
+ const v = obj[key];
38439
+ if (v !== void 0 && v !== null)
38440
+ return v;
38441
+ }
38442
+ return void 0;
38443
+ };
38444
+ const ad = getVal(a);
38445
+ const bd = getVal(b);
38446
+ const at = ad instanceof Date ? ad.getTime() : typeof ad === "number" ? ad : ad ? new Date(String(ad)).getTime() : 0;
38447
+ const bt = bd instanceof Date ? bd.getTime() : typeof bd === "number" ? bd : bd ? new Date(String(bd)).getTime() : 0;
38448
+ return (Number.isNaN(bt) ? 0 : bt) - (Number.isNaN(at) ? 0 : at);
38449
+ });
38450
+ }
38451
+
38476
38452
  // ../node_modules/yahoo-finance2/esm/_dnt.shims.js
38477
38453
  var import_shim_deno = __toESM(require_dist3(), 1);
38478
38454
  var import_shim_deno2 = __toESM(require_dist3(), 1);
@@ -40544,7 +40520,7 @@ function set2(dataCtx, value, instancePath) {
40544
40520
  }
40545
40521
  function schemaFromSchemaOrSchemaKey(schemaOrSchemaKey, definitions12) {
40546
40522
  let schema;
40547
- let path = "";
40523
+ let path2 = "";
40548
40524
  if (!definitions12) {
40549
40525
  throw new Error("No definitions provided");
40550
40526
  }
@@ -40554,14 +40530,14 @@ function schemaFromSchemaOrSchemaKey(schemaOrSchemaKey, definitions12) {
40554
40530
  throw new Error("No such schema with key: " + schemaOrSchemaKey);
40555
40531
  }
40556
40532
  schema = definitions12[definition];
40557
- path = schemaOrSchemaKey;
40533
+ path2 = schemaOrSchemaKey;
40558
40534
  if (!schema) {
40559
40535
  throw new Error(`No such schema with key: ${definition}`);
40560
40536
  }
40561
40537
  } else {
40562
40538
  schema = schemaOrSchemaKey;
40563
40539
  if (schema.$id)
40564
- path = schema.$id;
40540
+ path2 = schema.$id;
40565
40541
  }
40566
40542
  let refs;
40567
40543
  while (schema.$ref) {
@@ -40570,9 +40546,9 @@ function schemaFromSchemaOrSchemaKey(schemaOrSchemaKey, definitions12) {
40570
40546
  const ref = schema.$ref.replace("#/definitions/", "");
40571
40547
  refs.push(ref);
40572
40548
  schema = definitions12[ref];
40573
- path = schema.$ref;
40549
+ path2 = schema.$ref;
40574
40550
  }
40575
- return [schema, path, refs];
40551
+ return [schema, path2, refs];
40576
40552
  }
40577
40553
  function validateAndCoerce(input, schemaOrSchemaKey, ctx, errors2 = [], instancePath = "", dataCtx, schemaPath = null) {
40578
40554
  const [schema, foundSchemaPath, refs] = schemaFromSchemaOrSchemaKey(schemaOrSchemaKey, ctx.definitions);
@@ -41539,8 +41515,8 @@ function checkSupport(policy = {}) {
41539
41515
  reason
41540
41516
  });
41541
41517
  const pass = () => ({ ok: true, info });
41542
- const hasGlobalPath = (path) => {
41543
- const parts = path.split(".");
41518
+ const hasGlobalPath = (path2) => {
41519
+ const parts = path2.split(".");
41544
41520
  let cur = dntGlobalThis;
41545
41521
  for (const p of parts) {
41546
41522
  if (cur == null || !(p in cur))
@@ -68281,6 +68257,159 @@ var createOpts = { modules: allModules };
68281
68257
  var YahooFinance2 = createYahooFinance(createOpts);
68282
68258
  var src_default = YahooFinance2;
68283
68259
 
68260
+ // src/mock.ts
68261
+ function isMock() {
68262
+ return process.env.MOCK === "true" || process.env.YAHOO_FINANCE_MOCK === "true";
68263
+ }
68264
+ var IS_MOCK = isMock();
68265
+ var MOCK_FIXTURES = {
68266
+ getHistoricalPrices: {
68267
+ quotes: [
68268
+ {
68269
+ date: /* @__PURE__ */ new Date("2023-01-01"),
68270
+ open: 150,
68271
+ high: 155,
68272
+ low: 149,
68273
+ close: 154,
68274
+ volume: 1e6,
68275
+ adjclose: 154
68276
+ },
68277
+ {
68278
+ date: /* @__PURE__ */ new Date("2023-01-02"),
68279
+ open: 154,
68280
+ high: 158,
68281
+ low: 153,
68282
+ close: 157,
68283
+ volume: 12e5,
68284
+ adjclose: 157
68285
+ }
68286
+ ]
68287
+ },
68288
+ getStockInfo: {
68289
+ price: {
68290
+ longName: "Apple Inc.",
68291
+ regularMarketPrice: 150,
68292
+ currency: "USD",
68293
+ regularMarketChange: 1.5,
68294
+ regularMarketChangePercent: 1,
68295
+ marketCap: 25e11,
68296
+ exchangeName: "NasdaqGS"
68297
+ },
68298
+ summaryProfile: {
68299
+ sector: "Technology",
68300
+ industry: "Consumer Electronics",
68301
+ country: "United States",
68302
+ fullTimeEmployees: 147e3,
68303
+ longBusinessSummary: "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide."
68304
+ },
68305
+ financialData: {
68306
+ totalRevenue: 365817e6,
68307
+ grossProfits: 152836e6,
68308
+ ebitda: 120233e6,
68309
+ freeCashflow: 92953e6,
68310
+ returnOnEquity: 1.4744,
68311
+ recommendationKey: "buy"
68312
+ },
68313
+ defaultKeyStatistics: {
68314
+ beta: 1.2,
68315
+ forwardPE: 25.5,
68316
+ forwardEps: 6,
68317
+ sharesOutstanding: 164e8,
68318
+ floatShares: 1638e7
68319
+ },
68320
+ summaryDetail: {
68321
+ fiftyTwoWeekHigh: 182.94,
68322
+ fiftyTwoWeekLow: 129.04
68323
+ }
68324
+ },
68325
+ getNews: [
68326
+ {
68327
+ title: "Old News",
68328
+ publisher: "TechNews",
68329
+ link: "http://technews.com/apple-old",
68330
+ providerPublishTime: /* @__PURE__ */ new Date("2023-01-01")
68331
+ },
68332
+ {
68333
+ title: "New News",
68334
+ publisher: "TechNews",
68335
+ link: "http://technews.com/apple-new",
68336
+ providerPublishTime: /* @__PURE__ */ new Date("2023-01-05")
68337
+ }
68338
+ ],
68339
+ getStockActions: {
68340
+ dividends: [
68341
+ { date: /* @__PURE__ */ new Date("2023-01-01"), amount: 0.1 },
68342
+ { date: /* @__PURE__ */ new Date("2023-01-10"), amount: 0.2 }
68343
+ ],
68344
+ splits: [
68345
+ {
68346
+ date: /* @__PURE__ */ new Date("2023-01-01"),
68347
+ numerator: 2,
68348
+ denominator: 1,
68349
+ splitRatio: "2:1"
68350
+ }
68351
+ ]
68352
+ },
68353
+ getFinancialStatement: [
68354
+ {
68355
+ endDate: /* @__PURE__ */ new Date("2022-12-31"),
68356
+ totalRevenue: 1e3
68357
+ },
68358
+ {
68359
+ endDate: /* @__PURE__ */ new Date("2023-03-31"),
68360
+ totalRevenue: 1100
68361
+ }
68362
+ ],
68363
+ getHolderInfo: [
68364
+ { name: "Vanguard Group", pctHeld: 0.08, shares: 1e7 }
68365
+ ],
68366
+ getOptionDates: ["2023-01-20", "2023-02-17"],
68367
+ getRecommendations: [
68368
+ {
68369
+ epochGradeDate: /* @__PURE__ */ new Date("2023-01-01"),
68370
+ firm: "Firm A",
68371
+ action: "up"
68372
+ },
68373
+ {
68374
+ epochGradeDate: /* @__PURE__ */ new Date("2023-02-01"),
68375
+ firm: "Firm B",
68376
+ action: "down"
68377
+ }
68378
+ ],
68379
+ getQuotes: [
68380
+ {
68381
+ symbol: "AAPL",
68382
+ shortName: "Apple Inc.",
68383
+ regularMarketPrice: 150,
68384
+ regularMarketChange: 1.5,
68385
+ regularMarketChangePercent: 1,
68386
+ currency: "USD",
68387
+ market: "us_market"
68388
+ },
68389
+ {
68390
+ symbol: "MSFT",
68391
+ shortName: "Microsoft Corporation",
68392
+ regularMarketPrice: 280,
68393
+ regularMarketChange: 2,
68394
+ regularMarketChangePercent: 0.72,
68395
+ currency: "USD",
68396
+ market: "us_market"
68397
+ }
68398
+ ],
68399
+ getOptionChain: [
68400
+ {
68401
+ contractSymbol: "AAPL230120C00150000",
68402
+ strike: 150,
68403
+ lastPrice: 5.5,
68404
+ bid: 5.4,
68405
+ ask: 5.6,
68406
+ volume: 1e3,
68407
+ openInterest: 5e3,
68408
+ impliedVolatility: 0.25
68409
+ }
68410
+ ]
68411
+ };
68412
+
68284
68413
  // src/api.ts
68285
68414
  var API_DELAY_MS = 1e3;
68286
68415
  var lastCallTimestamp = 0;
@@ -68319,40 +68448,29 @@ var config2 = {
68319
68448
  }
68320
68449
  };
68321
68450
  var yahooFinanceClient = new src_default(config2);
68322
- var MAX_CACHE_SIZE = 1e3;
68323
- var cache = /* @__PURE__ */ new Map();
68324
- var CACHE_TTL_MS = 60 * 1e3;
68325
- function sweepExpiredFromCache() {
68326
- const now = Date.now();
68327
- for (const [key, value] of cache) {
68328
- if (now - value.timestamp >= CACHE_TTL_MS) {
68329
- cache.delete(key);
68330
- }
68331
- }
68332
- }
68333
- async function withCache(key, fetchFn) {
68334
- const now = Date.now();
68335
- const cached2 = cache.get(key);
68336
- if (cached2) {
68337
- if (now - cached2.timestamp < CACHE_TTL_MS) {
68338
- return cached2.data;
68339
- }
68340
- cache.delete(key);
68341
- }
68342
- cache.delete(key);
68343
- if (cache.size >= MAX_CACHE_SIZE) {
68344
- sweepExpiredFromCache();
68345
- }
68346
- if (cache.size >= MAX_CACHE_SIZE) {
68347
- const oldestKey = cache.keys().next().value;
68348
- if (oldestKey !== void 0) {
68349
- cache.delete(oldestKey);
68350
- }
68451
+ var cache = new PersistentCache("yahoo-finance");
68452
+ var CACHE_TTL = {
68453
+ QUOTE: 60 * 1e3,
68454
+ // 1 minute
68455
+ HISTORICAL: 60 * 60 * 1e3,
68456
+ // 1 hour
68457
+ INFO: 24 * 60 * 60 * 1e3,
68458
+ // 24 hours
68459
+ NEWS: 30 * 60 * 1e3,
68460
+ // 30 minutes
68461
+ OPTIONS: 4 * 60 * 60 * 1e3,
68462
+ // 4 hours
68463
+ RECOMMENDATIONS: 12 * 60 * 60 * 1e3
68464
+ // 12 hours
68465
+ };
68466
+ async function withCache(key, ttlMs, fetchFn) {
68467
+ if (isMock()) {
68468
+ return fetchFn();
68351
68469
  }
68352
- await waitIfNeeded();
68353
- const data = await fetchFn();
68354
- cache.set(key, { data, timestamp: Date.now() });
68355
- return data;
68470
+ return cache.wrap(key, ttlMs, async () => {
68471
+ await waitIfNeeded();
68472
+ return fetchFn();
68473
+ });
68356
68474
  }
68357
68475
  function periodToStartDate(period) {
68358
68476
  const now = /* @__PURE__ */ new Date();
@@ -68392,7 +68510,9 @@ async function callQuoteSummary(ticker, modules) {
68392
68510
  ticker,
68393
68511
  modules
68394
68512
  });
68395
- return withCache(cacheKey, async () => {
68513
+ return withCache(cacheKey, CACHE_TTL.INFO, async () => {
68514
+ if (isMock())
68515
+ return MOCK_FIXTURES.getStockInfo;
68396
68516
  const result = await yahooFinanceClient.quoteSummary(ticker, {
68397
68517
  modules
68398
68518
  });
@@ -68406,7 +68526,8 @@ async function getHistoricalPrices(ticker, period, interval) {
68406
68526
  period,
68407
68527
  interval
68408
68528
  });
68409
- return withCache(cacheKey, async () => {
68529
+ return withCache(cacheKey, CACHE_TTL.HISTORICAL, async () => {
68530
+ if (isMock()) return MOCK_FIXTURES.getHistoricalPrices;
68410
68531
  const period1 = periodToStartDate(period);
68411
68532
  return yahooFinanceClient.chart(ticker, {
68412
68533
  period1,
@@ -68428,23 +68549,40 @@ async function getQuotes(tickers) {
68428
68549
  fn: "getQuotes",
68429
68550
  tickers: tickers.sort()
68430
68551
  });
68431
- return withCache(cacheKey, async () => {
68552
+ return withCache(cacheKey, CACHE_TTL.QUOTE, async () => {
68553
+ if (isMock()) {
68554
+ const requested = new Set(
68555
+ tickers.map((ticker) => ticker.toUpperCase())
68556
+ );
68557
+ return MOCK_FIXTURES.getQuotes.filter(
68558
+ (quote2) => requested.has(quote2.symbol.toUpperCase())
68559
+ );
68560
+ }
68432
68561
  const results = await yahooFinanceClient.quote(tickers);
68433
68562
  return Array.isArray(results) ? results : [results];
68434
68563
  });
68435
68564
  }
68436
68565
  async function getNews(ticker) {
68437
68566
  const cacheKey = JSON.stringify({ fn: "getNews", ticker });
68438
- return withCache(cacheKey, async () => {
68439
- const result = await yahooFinanceClient.search(ticker, {
68440
- newsCount: 20
68441
- });
68567
+ return withCache(cacheKey, CACHE_TTL.NEWS, async () => {
68568
+ if (isMock()) return [...MOCK_FIXTURES.getNews];
68569
+ const result = await yahooFinanceClient.search(
68570
+ ticker,
68571
+ { newsCount: 20 },
68572
+ { validateResult: false }
68573
+ );
68442
68574
  return result.news ?? [];
68443
68575
  });
68444
68576
  }
68445
68577
  async function getStockActions(ticker) {
68446
68578
  const cacheKey = JSON.stringify({ fn: "getStockActions", ticker });
68447
- return withCache(cacheKey, async () => {
68579
+ return withCache(cacheKey, CACHE_TTL.INFO, async () => {
68580
+ if (isMock()) {
68581
+ return {
68582
+ dividends: [...MOCK_FIXTURES.getStockActions.dividends],
68583
+ splits: [...MOCK_FIXTURES.getStockActions.splits]
68584
+ };
68585
+ }
68448
68586
  const result = await yahooFinanceClient.chart(ticker, {
68449
68587
  period1: new Date(1970, 0, 1),
68450
68588
  interval: "1d"
@@ -68477,7 +68615,8 @@ async function getFinancialStatement(ticker, financialType) {
68477
68615
  ticker,
68478
68616
  financialType
68479
68617
  });
68480
- return withCache(cacheKey, async () => {
68618
+ return withCache(cacheKey, CACHE_TTL.INFO, async () => {
68619
+ if (isMock()) return [...MOCK_FIXTURES.getFinancialStatement];
68481
68620
  const summary = await callQuoteSummary(ticker, [module]);
68482
68621
  const moduleData = summary[module];
68483
68622
  if (!moduleData || typeof moduleData !== "object") return [];
@@ -68508,7 +68647,8 @@ async function getHolderInfo(ticker, holderType) {
68508
68647
  ticker,
68509
68648
  holderType
68510
68649
  });
68511
- return withCache(cacheKey, async () => {
68650
+ return withCache(cacheKey, CACHE_TTL.INFO, async () => {
68651
+ if (isMock()) return MOCK_FIXTURES.getHolderInfo;
68512
68652
  const summary = await callQuoteSummary(ticker, [module]);
68513
68653
  const moduleData = summary[module];
68514
68654
  if (!moduleData) return null;
@@ -68519,7 +68659,8 @@ async function getHolderInfo(ticker, holderType) {
68519
68659
  }
68520
68660
  async function getOptionDates(ticker) {
68521
68661
  const cacheKey = JSON.stringify({ fn: "getOptionDates", ticker });
68522
- return withCache(cacheKey, async () => {
68662
+ return withCache(cacheKey, CACHE_TTL.OPTIONS, async () => {
68663
+ if (isMock()) return [...MOCK_FIXTURES.getOptionDates];
68523
68664
  const result = await yahooFinanceClient.options(ticker, {});
68524
68665
  return (result.expirationDates ?? []).map(
68525
68666
  (d) => d instanceof Date ? d.toISOString().split("T")[0] : String(d)
@@ -68530,16 +68671,19 @@ async function getOptionChain(ticker, expirationDate, optionType) {
68530
68671
  const cacheKey = JSON.stringify({
68531
68672
  fn: "getOptionChain",
68532
68673
  ticker,
68533
- expirationDate
68674
+ expirationDate,
68675
+ optionType
68676
+ // Include optionType in cache key now that it returns the final array
68534
68677
  });
68535
- const chain = await withCache(cacheKey, async () => {
68678
+ return withCache(cacheKey, CACHE_TTL.OPTIONS, async () => {
68679
+ if (isMock()) return [...MOCK_FIXTURES.getOptionChain];
68536
68680
  const result = await yahooFinanceClient.options(ticker, {
68537
68681
  date: new Date(expirationDate)
68538
68682
  });
68539
- return result.options?.[0] ?? null;
68683
+ const chain = result.options?.[0] ?? null;
68684
+ if (!chain) return [];
68685
+ return optionType === "calls" ? chain.calls : chain.puts;
68540
68686
  });
68541
- if (!chain) return [];
68542
- return optionType === "calls" ? chain.calls : chain.puts;
68543
68687
  }
68544
68688
  async function getRecommendations(ticker, recommendationType) {
68545
68689
  const cacheKey = JSON.stringify({
@@ -68547,7 +68691,10 @@ async function getRecommendations(ticker, recommendationType) {
68547
68691
  ticker,
68548
68692
  recommendationType
68549
68693
  });
68550
- return withCache(cacheKey, async () => {
68694
+ return withCache(cacheKey, CACHE_TTL.RECOMMENDATIONS, async () => {
68695
+ if (isMock()) {
68696
+ return recommendationType === "recommendations" ? MOCK_FIXTURES.getRecommendations : MOCK_FIXTURES.getRecommendations;
68697
+ }
68551
68698
  if (recommendationType === "recommendations") {
68552
68699
  const summary = await callQuoteSummary(ticker, [
68553
68700
  "recommendationTrend"
@@ -68573,9 +68720,10 @@ console.warn = (...args) => console.error(...args);
68573
68720
  process.on("exit", () => {
68574
68721
  console.log = origLog;
68575
68722
  });
68723
+ var PACKAGE_VERSION = getPackageVersion(import.meta.url);
68576
68724
  var server = new McpServer({
68577
68725
  name: "yahoo-finance-mcp-server",
68578
- version: "1.0.0"
68726
+ version: PACKAGE_VERSION
68579
68727
  });
68580
68728
  function handleToolError(err) {
68581
68729
  if (typeof err === "object" && err !== null) {
@@ -68659,11 +68807,7 @@ server.registerTool(
68659
68807
  },
68660
68808
  async ({ tickers }) => {
68661
68809
  try {
68662
- const results = IS_MOCK ? MOCK_FIXTURES.getQuotes.filter(
68663
- (quote2) => tickers.some(
68664
- (ticker) => String(quote2.symbol ?? "").toUpperCase() === ticker.toUpperCase()
68665
- )
68666
- ) : await getQuotes(tickers);
68810
+ const results = await getQuotes(tickers);
68667
68811
  if (!results || results.length === 0) {
68668
68812
  return createNotFoundError(
68669
68813
  "No quotes found for provided tickers."
@@ -68726,12 +68870,15 @@ server.registerTool(
68726
68870
  },
68727
68871
  async ({ ticker, period, interval, limit, offset }) => {
68728
68872
  try {
68729
- const result = IS_MOCK ? MOCK_FIXTURES.getHistoricalPrices : await getHistoricalPrices(
68873
+ const result = await getHistoricalPrices(
68730
68874
  ticker,
68731
68875
  period,
68732
68876
  interval
68733
68877
  );
68734
- const quotes = (result.quotes ?? []).slice().reverse();
68878
+ const quotes = ensureNewestFirst(
68879
+ result.quotes ?? [],
68880
+ "date"
68881
+ );
68735
68882
  if (quotes.length === 0) {
68736
68883
  return createNotFoundError(
68737
68884
  `No historical data for '${ticker}'.`
@@ -68774,7 +68921,7 @@ server.registerTool(
68774
68921
  },
68775
68922
  async ({ ticker }) => {
68776
68923
  try {
68777
- const rawSummary = IS_MOCK ? MOCK_FIXTURES.getStockInfo : await getStockInfo(ticker);
68924
+ const rawSummary = await getStockInfo(ticker);
68778
68925
  const summary = rawSummary;
68779
68926
  const sections = [];
68780
68927
  const price = summary.price;
@@ -68845,15 +68992,11 @@ server.registerTool(
68845
68992
  },
68846
68993
  async ({ ticker, limit, offset }) => {
68847
68994
  try {
68848
- const news = IS_MOCK ? MOCK_FIXTURES.getNews : await getNews(ticker);
68995
+ const news = await getNews(ticker);
68849
68996
  if (!news || news.length === 0) {
68850
68997
  return createNotFoundError(`No news found for '${ticker}'.`);
68851
68998
  }
68852
- const sortedNews = news.slice().sort((a, b) => {
68853
- const at = a.providerPublishTime instanceof Date ? a.providerPublishTime.getTime() : Number(a.providerPublishTime ?? 0);
68854
- const bt = b.providerPublishTime instanceof Date ? b.providerPublishTime.getTime() : Number(b.providerPublishTime ?? 0);
68855
- return bt - at;
68856
- });
68999
+ const sortedNews = ensureNewestFirst(news, "providerPublishTime");
68857
69000
  const { items, total } = applyPagination(sortedNews, {
68858
69001
  limit,
68859
69002
  offset
@@ -68864,9 +69007,7 @@ server.registerTool(
68864
69007
  link: n.link ?? "",
68865
69008
  published: n.providerPublishTime instanceof Date ? n.providerPublishTime.toISOString().split("T")[0] : String(n.providerPublishTime ?? "")
68866
69009
  }));
68867
- const text = formatTable(rows, `News \u2014 ${ticker}`) + `
68868
-
68869
- *Showing ${items.length}/${total} articles*`;
69010
+ const text = formatTable(rows, `News \u2014 ${ticker}`) + formatPaginationFooter(offset, limit, total);
68870
69011
  return { content: [{ type: "text", text: truncateToLimit(text) }] };
68871
69012
  } catch (err) {
68872
69013
  return handleToolError(err);
@@ -68885,13 +69026,9 @@ server.registerTool(
68885
69026
  },
68886
69027
  async ({ ticker }) => {
68887
69028
  try {
68888
- const { dividends, splits } = IS_MOCK ? MOCK_FIXTURES.getStockActions : await getStockActions(ticker);
68889
- const sortedDividends = dividends.slice().sort(
68890
- (a, b) => (b.date instanceof Date ? b.date.getTime() : Number(b.date)) - (a.date instanceof Date ? a.date.getTime() : Number(a.date))
68891
- );
68892
- const sortedSplits = splits.slice().sort(
68893
- (a, b) => (b.date instanceof Date ? b.date.getTime() : Number(b.date)) - (a.date instanceof Date ? a.date.getTime() : Number(a.date))
68894
- );
69029
+ const { dividends, splits } = await getStockActions(ticker);
69030
+ const sortedDividends = ensureNewestFirst(dividends, "date");
69031
+ const sortedSplits = ensureNewestFirst(splits, "date");
68895
69032
  const sections = [];
68896
69033
  if (sortedDividends.length > 0) {
68897
69034
  const divRows = sortedDividends.map((d) => ({
@@ -68944,7 +69081,7 @@ server.registerTool(
68944
69081
  },
68945
69082
  async ({ ticker, financial_type }) => {
68946
69083
  try {
68947
- const statements = IS_MOCK ? MOCK_FIXTURES.getFinancialStatement : await getFinancialStatement(
69084
+ const statements = await getFinancialStatement(
68948
69085
  ticker,
68949
69086
  financial_type
68950
69087
  );
@@ -68953,15 +69090,10 @@ server.registerTool(
68953
69090
  `No ${financial_type} data for '${ticker}'.`
68954
69091
  );
68955
69092
  }
68956
- const sorted = statements.slice().sort((a, b) => {
68957
- const av = a;
68958
- const bv = b;
68959
- const ad = av.endDate ?? av.date;
68960
- const bd = bv.endDate ?? bv.date;
68961
- const at = ad instanceof Date ? ad.getTime() : 0;
68962
- const bt = bd instanceof Date ? bd.getTime() : 0;
68963
- return bt - at;
68964
- });
69093
+ const sorted = ensureNewestFirst(statements, [
69094
+ "endDate",
69095
+ "date"
69096
+ ]);
68965
69097
  const rows = sorted.map((s) => flattenFinancialItem(s));
68966
69098
  const text = formatTable(
68967
69099
  rows,
@@ -68993,7 +69125,7 @@ server.registerTool(
68993
69125
  },
68994
69126
  async ({ ticker, holder_type }) => {
68995
69127
  try {
68996
- const data = IS_MOCK ? MOCK_FIXTURES.getHolderInfo : await getHolderInfo(ticker, holder_type);
69128
+ const data = await getHolderInfo(ticker, holder_type);
68997
69129
  if (!data) {
68998
69130
  return createNotFoundError(
68999
69131
  `No ${holder_type} data for '${ticker}'.`
@@ -69038,7 +69170,7 @@ server.registerTool(
69038
69170
  },
69039
69171
  async ({ ticker }) => {
69040
69172
  try {
69041
- const dates = IS_MOCK ? MOCK_FIXTURES.getOptionDates : await getOptionDates(ticker);
69173
+ const dates = await getOptionDates(ticker);
69042
69174
  if (!dates || dates.length === 0) {
69043
69175
  return createNotFoundError(`No option dates for '${ticker}'.`);
69044
69176
  }
@@ -69066,7 +69198,7 @@ server.registerTool(
69066
69198
  },
69067
69199
  async ({ ticker, expiration_date, option_type, limit, offset }) => {
69068
69200
  try {
69069
- const chain = IS_MOCK ? MOCK_FIXTURES.getOptionChain : await getOptionChain(
69201
+ const chain = await getOptionChain(
69070
69202
  ticker,
69071
69203
  expiration_date,
69072
69204
  option_type
@@ -69114,7 +69246,10 @@ server.registerTool(
69114
69246
  },
69115
69247
  async ({ ticker, recommendation_type, months_back, limit, offset }) => {
69116
69248
  try {
69117
- let data = IS_MOCK ? MOCK_FIXTURES.getRecommendations : await getRecommendations(ticker, recommendation_type);
69249
+ let data = await getRecommendations(
69250
+ ticker,
69251
+ recommendation_type
69252
+ );
69118
69253
  if (!data || data.length === 0) {
69119
69254
  return createNotFoundError(
69120
69255
  `No ${recommendation_type} data for '${ticker}'.`
@@ -69130,13 +69265,10 @@ server.registerTool(
69130
69265
  return new Date(d * 1e3) >= cutoff;
69131
69266
  return true;
69132
69267
  });
69133
- data = data.slice().sort((a, b) => {
69134
- const ad = a.epochGradeDate;
69135
- const bd = b.epochGradeDate;
69136
- const at = ad instanceof Date ? ad.getTime() : typeof ad === "number" ? ad * 1e3 : 0;
69137
- const bt = bd instanceof Date ? bd.getTime() : typeof bd === "number" ? bd * 1e3 : 0;
69138
- return bt - at;
69139
- });
69268
+ data = ensureNewestFirst(
69269
+ data,
69270
+ "epochGradeDate"
69271
+ );
69140
69272
  }
69141
69273
  const { items, total } = applyPagination(data, { limit, offset });
69142
69274
  const rows = items.map(