@librechat/data-schemas 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -10,20 +10,10 @@ var winston = require('winston');
10
10
  require('winston-daily-rotate-file');
11
11
  var path = require('path');
12
12
  var klona = require('klona');
13
- var traverseLib = require('traverse');
14
13
  var nanoid = require('nanoid');
15
14
 
16
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
-
18
- var jwt__default = /*#__PURE__*/_interopDefault(jwt);
19
- var mongoose__default = /*#__PURE__*/_interopDefault(mongoose);
20
- var ___default = /*#__PURE__*/_interopDefault(_);
21
- var winston__default = /*#__PURE__*/_interopDefault(winston);
22
- var path__default = /*#__PURE__*/_interopDefault(path);
23
- var traverseLib__default = /*#__PURE__*/_interopDefault(traverseLib);
24
-
25
15
  async function signPayload({ payload, secret, expirationTime, }) {
26
- return jwt__default.default.sign(payload, secret, { expiresIn: expirationTime });
16
+ return jwt.sign(payload, secret, { expiresIn: expirationTime });
27
17
  }
28
18
  async function hashToken(str) {
29
19
  const data = new TextEncoder().encode(str);
@@ -44,7 +34,7 @@ const AuthSchema = new mongoose.Schema({
44
34
  }, { _id: false });
45
35
  const Action = new mongoose.Schema({
46
36
  user: {
47
- type: mongoose__default.default.Schema.Types.ObjectId,
37
+ type: mongoose.Schema.Types.ObjectId,
48
38
  ref: 'User',
49
39
  index: true,
50
40
  required: true,
@@ -498,7 +488,7 @@ convoSchema.index({ conversationId: 1, user: 1 }, { unique: true });
498
488
 
499
489
  const file = new mongoose.Schema({
500
490
  user: {
501
- type: mongoose__default.default.Schema.Types.ObjectId,
491
+ type: mongoose.Schema.Types.ObjectId,
502
492
  ref: 'User',
503
493
  index: true,
504
494
  required: true,
@@ -574,7 +564,7 @@ file.index({ createdAt: 1, updatedAt: 1 });
574
564
 
575
565
  const keySchema = new mongoose.Schema({
576
566
  userId: {
577
- type: mongoose__default.default.Schema.Types.ObjectId,
567
+ type: mongoose.Schema.Types.ObjectId,
578
568
  ref: 'User',
579
569
  required: true,
580
570
  },
@@ -672,7 +662,7 @@ const messageSchema = new mongoose.Schema({
672
662
  required: true,
673
663
  },
674
664
  tag: {
675
- type: mongoose__default.default.Schema.Types.Mixed,
665
+ type: mongoose.Schema.Types.Mixed,
676
666
  required: false,
677
667
  },
678
668
  text: {
@@ -689,7 +679,7 @@ const messageSchema = new mongoose.Schema({
689
679
  select: false,
690
680
  default: false,
691
681
  },
692
- files: { type: [{ type: mongoose__default.default.Schema.Types.Mixed }], default: undefined },
682
+ files: { type: [{ type: mongoose.Schema.Types.Mixed }], default: undefined },
693
683
  plugin: {
694
684
  type: {
695
685
  latest: {
@@ -697,7 +687,7 @@ const messageSchema = new mongoose.Schema({
697
687
  required: false,
698
688
  },
699
689
  inputs: {
700
- type: [mongoose__default.default.Schema.Types.Mixed],
690
+ type: [mongoose.Schema.Types.Mixed],
701
691
  required: false,
702
692
  default: undefined,
703
693
  },
@@ -708,9 +698,9 @@ const messageSchema = new mongoose.Schema({
708
698
  },
709
699
  default: undefined,
710
700
  },
711
- plugins: { type: [{ type: mongoose__default.default.Schema.Types.Mixed }], default: undefined },
701
+ plugins: { type: [{ type: mongoose.Schema.Types.Mixed }], default: undefined },
712
702
  content: {
713
- type: [{ type: mongoose__default.default.Schema.Types.Mixed }],
703
+ type: [{ type: mongoose.Schema.Types.Mixed }],
714
704
  default: undefined,
715
705
  meiliIndex: true,
716
706
  },
@@ -721,7 +711,7 @@ const messageSchema = new mongoose.Schema({
721
711
  iconURL: {
722
712
  type: String,
723
713
  },
724
- attachments: { type: [{ type: mongoose__default.default.Schema.Types.Mixed }], default: undefined },
714
+ attachments: { type: [{ type: mongoose.Schema.Types.Mixed }], default: undefined },
725
715
  /*
726
716
  attachments: {
727
717
  type: [
@@ -794,7 +784,7 @@ const presetSchema = new mongoose.Schema({
794
784
  },
795
785
  ...conversationPreset,
796
786
  agentOptions: {
797
- type: mongoose__default.default.Schema.Types.Mixed,
787
+ type: mongoose.Schema.Types.Mixed,
798
788
  default: null,
799
789
  },
800
790
  }, { timestamps: true });
@@ -987,7 +977,7 @@ const sessionSchema = new mongoose.Schema({
987
977
  expires: 0,
988
978
  },
989
979
  user: {
990
- type: mongoose__default.default.Schema.Types.ObjectId,
980
+ type: mongoose.Schema.Types.ObjectId,
991
981
  ref: 'User',
992
982
  required: true,
993
983
  },
@@ -1006,7 +996,7 @@ const shareSchema = new mongoose.Schema({
1006
996
  type: String,
1007
997
  index: true,
1008
998
  },
1009
- messages: [{ type: mongoose__default.default.Schema.Types.ObjectId, ref: 'Message' }],
999
+ messages: [{ type: mongoose.Schema.Types.ObjectId, ref: 'Message' }],
1010
1000
  shareId: {
1011
1001
  type: String,
1012
1002
  index: true,
@@ -1066,15 +1056,15 @@ const toolCallSchema = new mongoose.Schema({
1066
1056
  required: true,
1067
1057
  },
1068
1058
  user: {
1069
- type: mongoose__default.default.Schema.Types.ObjectId,
1059
+ type: mongoose.Schema.Types.ObjectId,
1070
1060
  ref: 'User',
1071
1061
  required: true,
1072
1062
  },
1073
1063
  result: {
1074
- type: mongoose__default.default.Schema.Types.Mixed,
1064
+ type: mongoose.Schema.Types.Mixed,
1075
1065
  },
1076
1066
  attachments: {
1077
- type: mongoose__default.default.Schema.Types.Mixed,
1067
+ type: mongoose.Schema.Types.Mixed,
1078
1068
  },
1079
1069
  blockIndex: {
1080
1070
  type: Number,
@@ -1088,7 +1078,7 @@ toolCallSchema.index({ conversationId: 1, user: 1 });
1088
1078
 
1089
1079
  const transactionSchema = new mongoose.Schema({
1090
1080
  user: {
1091
- type: mongoose__default.default.Schema.Types.ObjectId,
1081
+ type: mongoose.Schema.Types.ObjectId,
1092
1082
  ref: 'User',
1093
1083
  index: true,
1094
1084
  required: true,
@@ -1325,18 +1315,18 @@ const getLogDirectory = () => {
1325
1315
  const cwd = process.cwd();
1326
1316
  // Check if we're running from within the api directory
1327
1317
  if (cwd.endsWith('/api') || cwd.endsWith('\\api')) {
1328
- return path__default.default.join(cwd, 'logs');
1318
+ return path.join(cwd, 'logs');
1329
1319
  }
1330
1320
  // Check if api/logs exists relative to current directory (running from project root)
1331
1321
  // We'll just use the path and let the file system create it if needed
1332
- const apiLogsPath = path__default.default.join(cwd, 'api', 'logs');
1322
+ const apiLogsPath = path.join(cwd, 'api', 'logs');
1333
1323
  // For LibreChat project structure, use api/logs
1334
1324
  // For external consumers, they should set LIBRECHAT_LOG_DIR
1335
1325
  if (cwd.includes('LibreChat')) {
1336
1326
  return apiLogsPath;
1337
1327
  }
1338
1328
  // Default to logs directory relative to current working directory
1339
- return path__default.default.join(cwd, 'logs');
1329
+ return path.join(cwd, 'logs');
1340
1330
  };
1341
1331
 
1342
1332
  const logDir$1 = getLogDirectory();
@@ -1353,7 +1343,7 @@ const levels$1 = {
1353
1343
  activity: 6,
1354
1344
  silly: 7,
1355
1345
  };
1356
- winston__default.default.addColors({
1346
+ winston.addColors({
1357
1347
  info: 'green',
1358
1348
  warn: 'italic yellow',
1359
1349
  error: 'red',
@@ -1364,10 +1354,10 @@ const level$1 = () => {
1364
1354
  const isDevelopment = env === 'development';
1365
1355
  return isDevelopment ? 'debug' : 'warn';
1366
1356
  };
1367
- const fileFormat$1 = winston__default.default.format.combine(winston__default.default.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston__default.default.format.errors({ stack: true }), winston__default.default.format.splat());
1357
+ const fileFormat$1 = winston.format.combine(winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.errors({ stack: true }), winston.format.splat());
1368
1358
  const logLevel = useDebugLogging$1 ? 'debug' : 'error';
1369
1359
  const transports$1 = [
1370
- new winston__default.default.transports.DailyRotateFile({
1360
+ new winston.transports.DailyRotateFile({
1371
1361
  level: logLevel,
1372
1362
  filename: `${logDir$1}/meiliSync-%DATE%.log`,
1373
1363
  datePattern: 'YYYY-MM-DD',
@@ -1377,12 +1367,12 @@ const transports$1 = [
1377
1367
  format: fileFormat$1,
1378
1368
  }),
1379
1369
  ];
1380
- const consoleFormat$1 = winston__default.default.format.combine(winston__default.default.format.colorize({ all: true }), winston__default.default.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston__default.default.format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`));
1381
- transports$1.push(new winston__default.default.transports.Console({
1370
+ const consoleFormat$1 = winston.format.combine(winston.format.colorize({ all: true }), winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.printf((info) => `${info.timestamp} ${info.level}: ${info.message}`));
1371
+ transports$1.push(new winston.transports.Console({
1382
1372
  level: 'info',
1383
1373
  format: consoleFormat$1,
1384
1374
  }));
1385
- const logger$1 = winston__default.default.createLogger({
1375
+ const logger$1 = winston.createLogger({
1386
1376
  level: level$1(),
1387
1377
  levels: levels$1,
1388
1378
  transports: transports$1,
@@ -1500,7 +1490,7 @@ const createMeiliMongooseModel = ({ index, attributesToIndex, syncOptions, }) =>
1500
1490
  .sort({ _id: 1 })
1501
1491
  .batchSize(batchSize)
1502
1492
  .cursor();
1503
- const format = (doc) => ___default.default.omitBy(___default.default.pick(doc, attributesToIndex), (v, k) => k.startsWith('$'));
1493
+ const format = (doc) => _.omitBy(_.pick(doc, attributesToIndex), (v, k) => k.startsWith('$'));
1504
1494
  let documentBatch = [];
1505
1495
  let updateOps = [];
1506
1496
  // Process documents in streaming fashion
@@ -1613,7 +1603,7 @@ const createMeiliMongooseModel = ({ index, attributesToIndex, syncOptions, }) =>
1613
1603
  const data = await index.search(q, params);
1614
1604
  if (populate) {
1615
1605
  const query = {};
1616
- query[primaryKey] = ___default.default.map(data.hits, (hit) => cleanUpPrimaryKeyValue(hit[primaryKey]));
1606
+ query[primaryKey] = _.map(data.hits, (hit) => cleanUpPrimaryKeyValue(hit[primaryKey]));
1617
1607
  const projection = Object.keys(this.schema.obj).reduce((results, key) => {
1618
1608
  if (!key.startsWith('$')) {
1619
1609
  results[key] = 1;
@@ -1623,7 +1613,7 @@ const createMeiliMongooseModel = ({ index, attributesToIndex, syncOptions, }) =>
1623
1613
  const hitsFromMongoose = await this.find(query, projection).lean();
1624
1614
  const populatedHits = data.hits.map((hit) => {
1625
1615
  hit[primaryKey];
1626
- const originalHit = ___default.default.find(hitsFromMongoose, (item) => {
1616
+ const originalHit = _.find(hitsFromMongoose, (item) => {
1627
1617
  const typedItem = item;
1628
1618
  return typedItem[primaryKey] === hit[primaryKey];
1629
1619
  });
@@ -1640,7 +1630,7 @@ const createMeiliMongooseModel = ({ index, attributesToIndex, syncOptions, }) =>
1640
1630
  * Preprocesses the current document for indexing
1641
1631
  */
1642
1632
  preprocessObjectForIndex() {
1643
- const object = ___default.default.omitBy(___default.default.pick(this.toJSON(), attributesToIndex), (v, k) => k.startsWith('$'));
1633
+ const object = _.omitBy(_.pick(this.toJSON(), attributesToIndex), (v, k) => k.startsWith('$'));
1644
1634
  if (object.conversationId &&
1645
1635
  typeof object.conversationId === 'string' &&
1646
1636
  object.conversationId.includes('|')) {
@@ -1688,7 +1678,7 @@ const createMeiliMongooseModel = ({ index, attributesToIndex, syncOptions, }) =>
1688
1678
  */
1689
1679
  async updateObjectToMeili(next) {
1690
1680
  try {
1691
- const object = ___default.default.omitBy(___default.default.pick(this.toJSON(), attributesToIndex), (v, k) => k.startsWith('$'));
1681
+ const object = _.omitBy(_.pick(this.toJSON(), attributesToIndex), (v, k) => k.startsWith('$'));
1692
1682
  await index.updateDocuments([object]);
1693
1683
  next();
1694
1684
  }
@@ -2260,12 +2250,158 @@ function createUserMethods(mongoose) {
2260
2250
  }
2261
2251
 
2262
2252
  /**
2263
- * Wrapper for the traverse module to handle CommonJS imports in ESM context
2253
+ * ESM-native object traversal utility
2254
+ * Simplified implementation focused on the forEach use case
2264
2255
  */
2265
- // @ts-ignore - traverse doesn't have proper ESM exports
2266
- // Handle both default export and named exports
2267
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2268
- const traverse = (traverseLib__default.default.default || traverseLib__default.default);
2256
+ function isObject(value) {
2257
+ if (value === null || typeof value !== 'object') {
2258
+ return false;
2259
+ }
2260
+ // Treat these built-in types as leaf nodes, not objects to traverse
2261
+ if (value instanceof Date)
2262
+ return false;
2263
+ if (value instanceof RegExp)
2264
+ return false;
2265
+ if (value instanceof Error)
2266
+ return false;
2267
+ if (value instanceof URL)
2268
+ return false;
2269
+ // Check for Buffer (Node.js)
2270
+ if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value))
2271
+ return false;
2272
+ // Check for TypedArrays and ArrayBuffer
2273
+ if (ArrayBuffer.isView(value))
2274
+ return false;
2275
+ if (value instanceof ArrayBuffer)
2276
+ return false;
2277
+ if (value instanceof SharedArrayBuffer)
2278
+ return false;
2279
+ // Check for other built-in types that shouldn't be traversed
2280
+ if (value instanceof Promise)
2281
+ return false;
2282
+ if (value instanceof WeakMap)
2283
+ return false;
2284
+ if (value instanceof WeakSet)
2285
+ return false;
2286
+ if (value instanceof Map)
2287
+ return false;
2288
+ if (value instanceof Set)
2289
+ return false;
2290
+ // Check if it's a primitive wrapper object
2291
+ const stringTag = Object.prototype.toString.call(value);
2292
+ if (stringTag === '[object Boolean]' ||
2293
+ stringTag === '[object Number]' ||
2294
+ stringTag === '[object String]') {
2295
+ return false;
2296
+ }
2297
+ return true;
2298
+ }
2299
+ // Helper to safely set a property on an object or array
2300
+ function setProperty(obj, key, value) {
2301
+ if (Array.isArray(obj) && typeof key === 'number') {
2302
+ obj[key] = value;
2303
+ }
2304
+ else if (!Array.isArray(obj) && typeof key === 'string') {
2305
+ obj[key] = value;
2306
+ }
2307
+ else if (!Array.isArray(obj) && typeof key === 'number') {
2308
+ // Handle numeric keys on objects
2309
+ obj[key] = value;
2310
+ }
2311
+ }
2312
+ // Helper to safely delete a property from an object
2313
+ function deleteProperty(obj, key) {
2314
+ if (Array.isArray(obj) && typeof key === 'number') {
2315
+ // For arrays, we should use splice, but this is handled in remove()
2316
+ // This function is only called for non-array deletion
2317
+ return;
2318
+ }
2319
+ if (!Array.isArray(obj)) {
2320
+ delete obj[key];
2321
+ }
2322
+ }
2323
+ function forEach(obj, callback) {
2324
+ const visited = new WeakSet();
2325
+ function walk(node, path = [], parent) {
2326
+ // Check for circular references
2327
+ let circular = null;
2328
+ if (isObject(node)) {
2329
+ if (visited.has(node)) {
2330
+ // Find the circular reference in the parent chain
2331
+ let p = parent;
2332
+ while (p) {
2333
+ if (p.node === node) {
2334
+ circular = p;
2335
+ break;
2336
+ }
2337
+ p = p.parent;
2338
+ }
2339
+ return; // Skip circular references
2340
+ }
2341
+ visited.add(node);
2342
+ }
2343
+ const key = path.length > 0 ? path[path.length - 1] : undefined;
2344
+ const isRoot = path.length === 0;
2345
+ const level = path.length;
2346
+ // Determine if this is a leaf node
2347
+ const isLeaf = !isObject(node) ||
2348
+ (Array.isArray(node) && node.length === 0) ||
2349
+ Object.keys(node).length === 0;
2350
+ // Create context
2351
+ const context = {
2352
+ node,
2353
+ path: [...path],
2354
+ parent,
2355
+ key,
2356
+ isLeaf,
2357
+ notLeaf: !isLeaf,
2358
+ isRoot,
2359
+ notRoot: !isRoot,
2360
+ level,
2361
+ circular,
2362
+ update(value) {
2363
+ if (!isRoot && parent && key !== undefined && isObject(parent.node)) {
2364
+ setProperty(parent.node, key, value);
2365
+ }
2366
+ this.node = value;
2367
+ },
2368
+ remove() {
2369
+ if (!isRoot && parent && key !== undefined && isObject(parent.node)) {
2370
+ if (Array.isArray(parent.node) && typeof key === 'number') {
2371
+ parent.node.splice(key, 1);
2372
+ }
2373
+ else {
2374
+ deleteProperty(parent.node, key);
2375
+ }
2376
+ }
2377
+ },
2378
+ };
2379
+ // Call the callback with the context
2380
+ callback.call(context, node);
2381
+ // Traverse children if not circular and is an object
2382
+ if (!circular && isObject(node) && !isLeaf) {
2383
+ if (Array.isArray(node)) {
2384
+ for (let i = 0; i < node.length; i++) {
2385
+ walk(node[i], [...path, i], context);
2386
+ }
2387
+ }
2388
+ else {
2389
+ for (const [childKey, childValue] of Object.entries(node)) {
2390
+ walk(childValue, [...path, childKey], context);
2391
+ }
2392
+ }
2393
+ }
2394
+ }
2395
+ walk(obj);
2396
+ }
2397
+ // Main traverse function that returns an object with forEach method
2398
+ function traverse(obj) {
2399
+ return {
2400
+ forEach(callback) {
2401
+ forEach(obj, callback);
2402
+ },
2403
+ };
2404
+ }
2269
2405
 
2270
2406
  const SPLAT_SYMBOL = Symbol.for('splat');
2271
2407
  const MESSAGE_SYMBOL = Symbol.for('message');
@@ -2311,7 +2447,7 @@ function redactMessage(str, trimLength) {
2311
2447
  * @param info - The log information object.
2312
2448
  * @returns The modified log information object.
2313
2449
  */
2314
- const redactFormat = winston__default.default.format((info) => {
2450
+ const redactFormat = winston.format((info) => {
2315
2451
  if (info.level === 'error') {
2316
2452
  // Type guard to ensure message is a string
2317
2453
  if (typeof info.message === 'string') {
@@ -2362,7 +2498,7 @@ const condenseArray = (item) => {
2362
2498
  * @param options - The options for formatting log messages.
2363
2499
  * @returns The formatted log message.
2364
2500
  */
2365
- const debugTraverse = winston__default.default.format.printf(({ level, message, timestamp, ...metadata }) => {
2501
+ const debugTraverse = winston.format.printf(({ level, message, timestamp, ...metadata }) => {
2366
2502
  if (!message) {
2367
2503
  return `${timestamp} ${level}`;
2368
2504
  }
@@ -2370,74 +2506,85 @@ const debugTraverse = winston__default.default.format.printf(({ level, message,
2370
2506
  if (typeof message !== 'string' || !message.trim) {
2371
2507
  return `${timestamp} ${level}: ${JSON.stringify(message)}`;
2372
2508
  }
2373
- let msg = `${timestamp} ${level}: ${truncateLongStrings(message.trim(), 150)}`;
2509
+ const msgParts = [
2510
+ `${timestamp} ${level}: ${truncateLongStrings(message.trim(), 150)}`,
2511
+ ];
2374
2512
  try {
2375
2513
  if (level !== 'debug') {
2376
- return msg;
2514
+ return msgParts[0];
2377
2515
  }
2378
2516
  if (!metadata) {
2379
- return msg;
2517
+ return msgParts[0];
2380
2518
  }
2381
2519
  // Type-safe access to SPLAT_SYMBOL using bracket notation
2382
2520
  const metadataRecord = metadata;
2383
2521
  const splatArray = metadataRecord[SPLAT_SYMBOL];
2384
2522
  const debugValue = Array.isArray(splatArray) ? splatArray[0] : undefined;
2385
2523
  if (!debugValue) {
2386
- return msg;
2524
+ return msgParts[0];
2387
2525
  }
2388
2526
  if (debugValue && Array.isArray(debugValue)) {
2389
- msg += `\n${JSON.stringify(debugValue.map(condenseArray))}`;
2390
- return msg;
2527
+ msgParts.push(`\n${JSON.stringify(debugValue.map(condenseArray))}`);
2528
+ return msgParts.join('');
2391
2529
  }
2392
2530
  if (typeof debugValue !== 'object') {
2393
- return (msg += ` ${debugValue}`);
2531
+ msgParts.push(` ${debugValue}`);
2532
+ return msgParts.join('');
2394
2533
  }
2395
- msg += '\n{';
2534
+ msgParts.push('\n{');
2396
2535
  const copy = klona.klona(metadata);
2397
- traverse(copy).forEach(function (value) {
2398
- var _a;
2399
- if (typeof (this === null || this === void 0 ? void 0 : this.key) === 'symbol') {
2400
- return;
2401
- }
2402
- let _parentKey = '';
2403
- const parent = this.parent;
2404
- if (typeof (parent === null || parent === void 0 ? void 0 : parent.key) !== 'symbol' && (parent === null || parent === void 0 ? void 0 : parent.key)) {
2405
- _parentKey = parent.key;
2406
- }
2407
- const parentKey = `${parent && parent.notRoot ? _parentKey + '.' : ''}`;
2408
- const tabs = `${parent && parent.notRoot ? ' ' : ' '}`;
2409
- const currentKey = (_a = this === null || this === void 0 ? void 0 : this.key) !== null && _a !== void 0 ? _a : 'unknown';
2410
- if (this.isLeaf && typeof value === 'string') {
2411
- const truncatedText = truncateLongStrings(value);
2412
- msg += `\n${tabs}${parentKey}${currentKey}: ${JSON.stringify(truncatedText)},`;
2413
- }
2414
- else if (this.notLeaf && Array.isArray(value) && value.length > 0) {
2415
- const currentMessage = `\n${tabs}// ${value.length} ${currentKey.replace(/s$/, '')}(s)`;
2416
- this.update(currentMessage, true);
2417
- msg += currentMessage;
2418
- const stringifiedArray = value.map(condenseArray);
2419
- msg += `\n${tabs}${parentKey}${currentKey}: [${stringifiedArray}],`;
2420
- }
2421
- else if (this.isLeaf && typeof value === 'function') {
2422
- msg += `\n${tabs}${parentKey}${currentKey}: function,`;
2423
- }
2424
- else if (this.isLeaf) {
2425
- msg += `\n${tabs}${parentKey}${currentKey}: ${value},`;
2426
- }
2427
- });
2428
- msg += '\n}';
2429
- return msg;
2536
+ try {
2537
+ const traversal = traverse(copy);
2538
+ traversal.forEach(function (value) {
2539
+ var _a;
2540
+ if (typeof (this === null || this === void 0 ? void 0 : this.key) === 'symbol') {
2541
+ return;
2542
+ }
2543
+ let _parentKey = '';
2544
+ const parent = this.parent;
2545
+ if (typeof (parent === null || parent === void 0 ? void 0 : parent.key) !== 'symbol' && (parent === null || parent === void 0 ? void 0 : parent.key) !== undefined) {
2546
+ _parentKey = String(parent.key);
2547
+ }
2548
+ const parentKey = `${parent && parent.notRoot ? _parentKey + '.' : ''}`;
2549
+ const tabs = `${parent && parent.notRoot ? ' ' : ' '}`;
2550
+ const currentKey = (_a = this === null || this === void 0 ? void 0 : this.key) !== null && _a !== void 0 ? _a : 'unknown';
2551
+ if (this.isLeaf && typeof value === 'string') {
2552
+ const truncatedText = truncateLongStrings(value);
2553
+ msgParts.push(`\n${tabs}${parentKey}${currentKey}: ${JSON.stringify(truncatedText)},`);
2554
+ }
2555
+ else if (this.notLeaf && Array.isArray(value) && value.length > 0) {
2556
+ const currentMessage = `\n${tabs}// ${value.length} ${String(currentKey).replace(/s$/, '')}(s)`;
2557
+ this.update(currentMessage);
2558
+ msgParts.push(currentMessage);
2559
+ const stringifiedArray = value.map(condenseArray);
2560
+ msgParts.push(`\n${tabs}${parentKey}${currentKey}: [${stringifiedArray}],`);
2561
+ }
2562
+ else if (this.isLeaf && typeof value === 'function') {
2563
+ msgParts.push(`\n${tabs}${parentKey}${currentKey}: function,`);
2564
+ }
2565
+ else if (this.isLeaf) {
2566
+ msgParts.push(`\n${tabs}${parentKey}${currentKey}: ${value},`);
2567
+ }
2568
+ });
2569
+ }
2570
+ catch (e) {
2571
+ const errorMessage = e instanceof Error ? e.message : 'Unknown error';
2572
+ msgParts.push(`\n[LOGGER TRAVERSAL ERROR] ${errorMessage}`);
2573
+ }
2574
+ msgParts.push('\n}');
2575
+ return msgParts.join('');
2430
2576
  }
2431
2577
  catch (e) {
2432
2578
  const errorMessage = e instanceof Error ? e.message : 'Unknown error';
2433
- return (msg += `\n[LOGGER PARSING ERROR] ${errorMessage}`);
2579
+ msgParts.push(`\n[LOGGER PARSING ERROR] ${errorMessage}`);
2580
+ return msgParts.join('');
2434
2581
  }
2435
2582
  });
2436
2583
  /**
2437
2584
  * Truncates long string values in JSON log objects.
2438
2585
  * Prevents outputting extremely long values (e.g., base64, blobs).
2439
2586
  */
2440
- const jsonTruncateFormat = winston__default.default.format((info) => {
2587
+ const jsonTruncateFormat = winston.format((info) => {
2441
2588
  const truncateLongStrings = (str, maxLength) => str.length > maxLength ? str.substring(0, maxLength) + '...' : str;
2442
2589
  const seen = new WeakSet();
2443
2590
  const truncateObject = (obj) => {
@@ -2483,7 +2630,7 @@ const levels = {
2483
2630
  activity: 6,
2484
2631
  silly: 7,
2485
2632
  };
2486
- winston__default.default.addColors({
2633
+ winston.addColors({
2487
2634
  info: 'green',
2488
2635
  warn: 'italic yellow',
2489
2636
  error: 'red',
@@ -2493,9 +2640,9 @@ const level = () => {
2493
2640
  const env = NODE_ENV || 'development';
2494
2641
  return env === 'development' ? 'debug' : 'warn';
2495
2642
  };
2496
- const fileFormat = winston__default.default.format.combine(redactFormat(), winston__default.default.format.timestamp({ format: () => new Date().toISOString() }), winston__default.default.format.errors({ stack: true }), winston__default.default.format.splat());
2643
+ const fileFormat = winston.format.combine(redactFormat(), winston.format.timestamp({ format: () => new Date().toISOString() }), winston.format.errors({ stack: true }), winston.format.splat());
2497
2644
  const transports = [
2498
- new winston__default.default.transports.DailyRotateFile({
2645
+ new winston.transports.DailyRotateFile({
2499
2646
  level: 'error',
2500
2647
  filename: `${logDir}/error-%DATE%.log`,
2501
2648
  datePattern: 'YYYY-MM-DD',
@@ -2506,17 +2653,17 @@ const transports = [
2506
2653
  }),
2507
2654
  ];
2508
2655
  if (useDebugLogging) {
2509
- transports.push(new winston__default.default.transports.DailyRotateFile({
2656
+ transports.push(new winston.transports.DailyRotateFile({
2510
2657
  level: 'debug',
2511
2658
  filename: `${logDir}/debug-%DATE%.log`,
2512
2659
  datePattern: 'YYYY-MM-DD',
2513
2660
  zippedArchive: true,
2514
2661
  maxSize: '20m',
2515
2662
  maxFiles: '14d',
2516
- format: winston__default.default.format.combine(fileFormat, debugTraverse),
2663
+ format: winston.format.combine(fileFormat, debugTraverse),
2517
2664
  }));
2518
2665
  }
2519
- const consoleFormat = winston__default.default.format.combine(redactFormat(), winston__default.default.format.colorize({ all: true }), winston__default.default.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston__default.default.format.printf((info) => {
2666
+ const consoleFormat = winston.format.combine(redactFormat(), winston.format.colorize({ all: true }), winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.printf((info) => {
2520
2667
  const message = `${info.timestamp} ${info.level}: ${info.message}`;
2521
2668
  return info.level.includes('error') ? redactMessage(message) : message;
2522
2669
  }));
@@ -2526,27 +2673,27 @@ if (useDebugConsole) {
2526
2673
  }
2527
2674
  // Add console transport
2528
2675
  if (useDebugConsole) {
2529
- transports.push(new winston__default.default.transports.Console({
2676
+ transports.push(new winston.transports.Console({
2530
2677
  level: consoleLogLevel,
2531
2678
  format: useConsoleJson
2532
- ? winston__default.default.format.combine(fileFormat, jsonTruncateFormat(), winston__default.default.format.json())
2533
- : winston__default.default.format.combine(fileFormat, debugTraverse),
2679
+ ? winston.format.combine(fileFormat, jsonTruncateFormat(), winston.format.json())
2680
+ : winston.format.combine(fileFormat, debugTraverse),
2534
2681
  }));
2535
2682
  }
2536
2683
  else if (useConsoleJson) {
2537
- transports.push(new winston__default.default.transports.Console({
2684
+ transports.push(new winston.transports.Console({
2538
2685
  level: consoleLogLevel,
2539
- format: winston__default.default.format.combine(fileFormat, jsonTruncateFormat(), winston__default.default.format.json()),
2686
+ format: winston.format.combine(fileFormat, jsonTruncateFormat(), winston.format.json()),
2540
2687
  }));
2541
2688
  }
2542
2689
  else {
2543
- transports.push(new winston__default.default.transports.Console({
2690
+ transports.push(new winston.transports.Console({
2544
2691
  level: consoleLogLevel,
2545
2692
  format: consoleFormat,
2546
2693
  }));
2547
2694
  }
2548
2695
  // Create logger
2549
- const logger = winston__default.default.createLogger({
2696
+ const logger = winston.createLogger({
2550
2697
  level: level(),
2551
2698
  levels,
2552
2699
  transports,