apitally 0.21.0 → 0.21.2
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/adonisjs/configure.cjs +6 -1
- package/dist/adonisjs/configure.cjs.map +1 -1
- package/dist/adonisjs/configure.js +6 -1
- package/dist/adonisjs/configure.js.map +1 -1
- package/dist/adonisjs/index.cjs +6 -1
- package/dist/adonisjs/index.cjs.map +1 -1
- package/dist/adonisjs/index.js +6 -1
- package/dist/adonisjs/index.js.map +1 -1
- package/dist/adonisjs/provider.cjs +487 -601
- package/dist/adonisjs/provider.cjs.map +1 -1
- package/dist/adonisjs/provider.js +487 -601
- package/dist/adonisjs/provider.js.map +1 -1
- package/dist/adonisjs/stubs/config/apitally.stub +9 -0
- package/dist/elysia/plugin.d.cts +3 -0
- package/dist/elysia/plugin.d.ts +3 -0
- package/dist/express/index.cjs +481 -595
- package/dist/express/index.cjs.map +1 -1
- package/dist/express/index.js +481 -595
- package/dist/express/index.js.map +1 -1
- package/dist/express/middleware.cjs +481 -595
- package/dist/express/middleware.cjs.map +1 -1
- package/dist/express/middleware.js +481 -595
- package/dist/express/middleware.js.map +1 -1
- package/dist/fastify/index.cjs +481 -595
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.js +481 -595
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/plugin.cjs +481 -595
- package/dist/fastify/plugin.cjs.map +1 -1
- package/dist/fastify/plugin.js +481 -595
- package/dist/fastify/plugin.js.map +1 -1
- package/dist/hapi/index.cjs +487 -601
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.js +487 -601
- package/dist/hapi/index.js.map +1 -1
- package/dist/hapi/plugin.cjs +487 -601
- package/dist/hapi/plugin.cjs.map +1 -1
- package/dist/hapi/plugin.js +487 -601
- package/dist/hapi/plugin.js.map +1 -1
- package/dist/hono/index.cjs +14 -10
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.js +14 -10
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +14 -10
- package/dist/hono/middleware.cjs.map +1 -1
- package/dist/hono/middleware.js +14 -10
- package/dist/hono/middleware.js.map +1 -1
- package/dist/hono/utils.cjs +14 -10
- package/dist/hono/utils.cjs.map +1 -1
- package/dist/hono/utils.js +14 -10
- package/dist/hono/utils.js.map +1 -1
- package/dist/loggers/index.cjs +487 -601
- package/dist/loggers/index.cjs.map +1 -1
- package/dist/loggers/index.js +487 -601
- package/dist/loggers/index.js.map +1 -1
- package/dist/loggers/pino.cjs +481 -595
- package/dist/loggers/pino.cjs.map +1 -1
- package/dist/loggers/pino.js +481 -595
- package/dist/loggers/pino.js.map +1 -1
- package/dist/nestjs/index.cjs +482 -596
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.js +482 -596
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +4 -3
package/dist/loggers/pino.cjs
CHANGED
|
@@ -438,619 +438,458 @@ var require_caller = __commonJS({
|
|
|
438
438
|
}
|
|
439
439
|
});
|
|
440
440
|
|
|
441
|
-
// node_modules/
|
|
442
|
-
var
|
|
443
|
-
"node_modules/
|
|
441
|
+
// node_modules/@pinojs/redact/index.js
|
|
442
|
+
var require_redact = __commonJS({
|
|
443
|
+
"node_modules/@pinojs/redact/index.js"(exports2, module2) {
|
|
444
444
|
"use strict";
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
445
|
+
function deepClone(obj) {
|
|
446
|
+
if (obj === null || typeof obj !== "object") {
|
|
447
|
+
return obj;
|
|
448
|
+
}
|
|
449
|
+
if (obj instanceof Date) {
|
|
450
|
+
return new Date(obj.getTime());
|
|
451
|
+
}
|
|
452
|
+
if (obj instanceof Array) {
|
|
453
|
+
const cloned = [];
|
|
454
|
+
for (let i = 0; i < obj.length; i++) {
|
|
455
|
+
cloned[i] = deepClone(obj[i]);
|
|
456
|
+
}
|
|
457
|
+
return cloned;
|
|
458
|
+
}
|
|
459
|
+
if (typeof obj === "object") {
|
|
460
|
+
const cloned = Object.create(Object.getPrototypeOf(obj));
|
|
461
|
+
for (const key in obj) {
|
|
462
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
463
|
+
cloned[key] = deepClone(obj[key]);
|
|
452
464
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
465
|
+
}
|
|
466
|
+
return cloned;
|
|
467
|
+
}
|
|
468
|
+
return obj;
|
|
469
|
+
}
|
|
470
|
+
__name(deepClone, "deepClone");
|
|
471
|
+
function parsePath(path) {
|
|
472
|
+
const parts = [];
|
|
473
|
+
let current = "";
|
|
474
|
+
let inBrackets = false;
|
|
475
|
+
let inQuotes = false;
|
|
476
|
+
let quoteChar = "";
|
|
477
|
+
for (let i = 0; i < path.length; i++) {
|
|
478
|
+
const char = path[i];
|
|
479
|
+
if (!inBrackets && char === ".") {
|
|
480
|
+
if (current) {
|
|
481
|
+
parts.push(current);
|
|
482
|
+
current = "";
|
|
483
|
+
}
|
|
484
|
+
} else if (char === "[") {
|
|
485
|
+
if (current) {
|
|
486
|
+
parts.push(current);
|
|
487
|
+
current = "";
|
|
488
|
+
}
|
|
489
|
+
inBrackets = true;
|
|
490
|
+
} else if (char === "]" && inBrackets) {
|
|
491
|
+
parts.push(current);
|
|
492
|
+
current = "";
|
|
493
|
+
inBrackets = false;
|
|
494
|
+
inQuotes = false;
|
|
495
|
+
} else if ((char === '"' || char === "'") && inBrackets) {
|
|
496
|
+
if (!inQuotes) {
|
|
497
|
+
inQuotes = true;
|
|
498
|
+
quoteChar = char;
|
|
499
|
+
} else if (char === quoteChar) {
|
|
500
|
+
inQuotes = false;
|
|
501
|
+
quoteChar = "";
|
|
502
|
+
} else {
|
|
503
|
+
current += char;
|
|
466
504
|
}
|
|
467
|
-
});
|
|
468
|
-
}, "validate");
|
|
469
|
-
}
|
|
470
|
-
__name(validator, "validator");
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
// node_modules/fast-redact/lib/rx.js
|
|
475
|
-
var require_rx = __commonJS({
|
|
476
|
-
"node_modules/fast-redact/lib/rx.js"(exports2, module2) {
|
|
477
|
-
"use strict";
|
|
478
|
-
module2.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
|
|
479
|
-
}
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
// node_modules/fast-redact/lib/parse.js
|
|
483
|
-
var require_parse = __commonJS({
|
|
484
|
-
"node_modules/fast-redact/lib/parse.js"(exports2, module2) {
|
|
485
|
-
"use strict";
|
|
486
|
-
var rx = require_rx();
|
|
487
|
-
module2.exports = parse;
|
|
488
|
-
function parse({ paths }) {
|
|
489
|
-
const wildcards = [];
|
|
490
|
-
var wcLen = 0;
|
|
491
|
-
const secret = paths.reduce(function(o, strPath, ix) {
|
|
492
|
-
var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
|
|
493
|
-
const leadingBracket = strPath[0] === "[";
|
|
494
|
-
path = path.map((p) => {
|
|
495
|
-
if (p[0] === "[") return p.substr(1, p.length - 2);
|
|
496
|
-
else return p;
|
|
497
|
-
});
|
|
498
|
-
const star = path.indexOf("*");
|
|
499
|
-
if (star > -1) {
|
|
500
|
-
const before = path.slice(0, star);
|
|
501
|
-
const beforeStr = before.join(".");
|
|
502
|
-
const after = path.slice(star + 1, path.length);
|
|
503
|
-
const nested = after.length > 0;
|
|
504
|
-
wcLen++;
|
|
505
|
-
wildcards.push({
|
|
506
|
-
before,
|
|
507
|
-
beforeStr,
|
|
508
|
-
after,
|
|
509
|
-
nested
|
|
510
|
-
});
|
|
511
505
|
} else {
|
|
512
|
-
|
|
513
|
-
path,
|
|
514
|
-
val: void 0,
|
|
515
|
-
precensored: false,
|
|
516
|
-
circle: "",
|
|
517
|
-
escPath: JSON.stringify(strPath),
|
|
518
|
-
leadingBracket
|
|
519
|
-
};
|
|
506
|
+
current += char;
|
|
520
507
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
secret
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
__name(parse, "parse");
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
// node_modules/fast-redact/lib/redactor.js
|
|
534
|
-
var require_redactor = __commonJS({
|
|
535
|
-
"node_modules/fast-redact/lib/redactor.js"(exports2, module2) {
|
|
536
|
-
"use strict";
|
|
537
|
-
var rx = require_rx();
|
|
538
|
-
module2.exports = redactor;
|
|
539
|
-
function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) {
|
|
540
|
-
const redact = Function("o", `
|
|
541
|
-
if (typeof o !== 'object' || o == null) {
|
|
542
|
-
${strictImpl(strict, serialize)}
|
|
543
|
-
}
|
|
544
|
-
const { censor, secret } = this
|
|
545
|
-
const originalSecret = {}
|
|
546
|
-
const secretKeys = Object.keys(secret)
|
|
547
|
-
for (var i = 0; i < secretKeys.length; i++) {
|
|
548
|
-
originalSecret[secretKeys[i]] = secret[secretKeys[i]]
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
${redactTmpl(secret, isCensorFct, censorFctTakesPath)}
|
|
552
|
-
this.compileRestore()
|
|
553
|
-
${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)}
|
|
554
|
-
this.secret = originalSecret
|
|
555
|
-
${resultTmpl(serialize)}
|
|
556
|
-
`).bind(state);
|
|
557
|
-
redact.state = state;
|
|
558
|
-
if (serialize === false) {
|
|
559
|
-
redact.restore = (o) => state.restore(o);
|
|
560
|
-
}
|
|
561
|
-
return redact;
|
|
508
|
+
}
|
|
509
|
+
if (current) {
|
|
510
|
+
parts.push(current);
|
|
511
|
+
}
|
|
512
|
+
return parts;
|
|
562
513
|
}
|
|
563
|
-
__name(
|
|
564
|
-
function
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
var match;
|
|
571
|
-
while ((match = rx.exec(path)) !== null) {
|
|
572
|
-
const [, ix] = match;
|
|
573
|
-
const { index, input } = match;
|
|
574
|
-
if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1)));
|
|
575
|
-
}
|
|
576
|
-
var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
|
|
577
|
-
if (existence.length === 0) existence += `o${delim}${path} != null`;
|
|
578
|
-
else existence += ` && o${delim}${path} != null`;
|
|
579
|
-
const circularDetection = `
|
|
580
|
-
switch (true) {
|
|
581
|
-
${hops.reverse().map((p) => `
|
|
582
|
-
case o${delim}${p} === censor:
|
|
583
|
-
secret[${escPath}].circle = ${JSON.stringify(p)}
|
|
584
|
-
break
|
|
585
|
-
`).join("\n")}
|
|
586
|
-
}
|
|
587
|
-
`;
|
|
588
|
-
const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
|
|
589
|
-
return `
|
|
590
|
-
if (${existence}) {
|
|
591
|
-
const val = o${delim}${path}
|
|
592
|
-
if (val === censor) {
|
|
593
|
-
secret[${escPath}].precensored = true
|
|
594
|
-
} else {
|
|
595
|
-
secret[${escPath}].val = val
|
|
596
|
-
o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
|
|
597
|
-
${circularDetection}
|
|
514
|
+
__name(parsePath, "parsePath");
|
|
515
|
+
function setValue(obj, parts, value) {
|
|
516
|
+
let current = obj;
|
|
517
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
518
|
+
const key = parts[i];
|
|
519
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
520
|
+
return false;
|
|
598
521
|
}
|
|
522
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
current = current[key];
|
|
599
526
|
}
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
527
|
+
const lastKey = parts[parts.length - 1];
|
|
528
|
+
if (lastKey === "*") {
|
|
529
|
+
if (Array.isArray(current)) {
|
|
530
|
+
for (let i = 0; i < current.length; i++) {
|
|
531
|
+
current[i] = value;
|
|
532
|
+
}
|
|
533
|
+
} else if (typeof current === "object" && current !== null) {
|
|
534
|
+
for (const key in current) {
|
|
535
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
536
|
+
current[key] = value;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
} else {
|
|
541
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
542
|
+
current[lastKey] = value;
|
|
543
|
+
}
|
|
614
544
|
}
|
|
545
|
+
return true;
|
|
615
546
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
return strict === true ? `throw Error('fast-redact: primitives cannot be redacted')` : serialize === false ? `return o` : `return this.serialize(o)`;
|
|
629
|
-
}
|
|
630
|
-
__name(strictImpl, "strictImpl");
|
|
631
|
-
}
|
|
632
|
-
});
|
|
633
|
-
|
|
634
|
-
// node_modules/fast-redact/lib/modifiers.js
|
|
635
|
-
var require_modifiers = __commonJS({
|
|
636
|
-
"node_modules/fast-redact/lib/modifiers.js"(exports2, module2) {
|
|
637
|
-
"use strict";
|
|
638
|
-
module2.exports = {
|
|
639
|
-
groupRedact,
|
|
640
|
-
groupRestore,
|
|
641
|
-
nestedRedact,
|
|
642
|
-
nestedRestore
|
|
643
|
-
};
|
|
644
|
-
function groupRestore({ keys, values, target }) {
|
|
645
|
-
if (target == null || typeof target === "string") return;
|
|
646
|
-
const length = keys.length;
|
|
647
|
-
for (var i = 0; i < length; i++) {
|
|
648
|
-
const k = keys[i];
|
|
649
|
-
target[k] = values[i];
|
|
547
|
+
__name(setValue, "setValue");
|
|
548
|
+
function removeKey(obj, parts) {
|
|
549
|
+
let current = obj;
|
|
550
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
551
|
+
const key = parts[i];
|
|
552
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
current = current[key];
|
|
650
559
|
}
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
const values = new Array(keysLength);
|
|
668
|
-
for (var i = 0; i < keysLength; i++) {
|
|
669
|
-
const key = keys[i];
|
|
670
|
-
values[i] = target[key];
|
|
671
|
-
if (censorFctTakesPath) {
|
|
672
|
-
pathWithKey[pathLength] = key;
|
|
673
|
-
target[key] = censor(target[key], pathWithKey);
|
|
674
|
-
} else if (isCensorFct) {
|
|
675
|
-
target[key] = censor(target[key]);
|
|
676
|
-
} else {
|
|
677
|
-
target[key] = censor;
|
|
560
|
+
const lastKey = parts[parts.length - 1];
|
|
561
|
+
if (lastKey === "*") {
|
|
562
|
+
if (Array.isArray(current)) {
|
|
563
|
+
for (let i = 0; i < current.length; i++) {
|
|
564
|
+
current[i] = void 0;
|
|
565
|
+
}
|
|
566
|
+
} else if (typeof current === "object" && current !== null) {
|
|
567
|
+
for (const key in current) {
|
|
568
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
569
|
+
delete current[key];
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
} else {
|
|
574
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
575
|
+
delete current[lastKey];
|
|
678
576
|
}
|
|
679
577
|
}
|
|
680
|
-
return
|
|
681
|
-
keys,
|
|
682
|
-
values,
|
|
683
|
-
target,
|
|
684
|
-
flat: true
|
|
685
|
-
};
|
|
578
|
+
return true;
|
|
686
579
|
}
|
|
687
|
-
__name(
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
580
|
+
__name(removeKey, "removeKey");
|
|
581
|
+
var PATH_NOT_FOUND = Symbol("PATH_NOT_FOUND");
|
|
582
|
+
function getValueIfExists(obj, parts) {
|
|
583
|
+
let current = obj;
|
|
584
|
+
for (const part of parts) {
|
|
585
|
+
if (current === null || current === void 0) {
|
|
586
|
+
return PATH_NOT_FOUND;
|
|
694
587
|
}
|
|
695
|
-
current
|
|
588
|
+
if (typeof current !== "object" || current === null) {
|
|
589
|
+
return PATH_NOT_FOUND;
|
|
590
|
+
}
|
|
591
|
+
if (!(part in current)) {
|
|
592
|
+
return PATH_NOT_FOUND;
|
|
593
|
+
}
|
|
594
|
+
current = current[part];
|
|
696
595
|
}
|
|
596
|
+
return current;
|
|
697
597
|
}
|
|
698
|
-
__name(
|
|
699
|
-
function
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
598
|
+
__name(getValueIfExists, "getValueIfExists");
|
|
599
|
+
function getValue(obj, parts) {
|
|
600
|
+
let current = obj;
|
|
601
|
+
for (const part of parts) {
|
|
602
|
+
if (current === null || current === void 0) {
|
|
603
|
+
return void 0;
|
|
604
|
+
}
|
|
605
|
+
if (typeof current !== "object" || current === null) {
|
|
606
|
+
return void 0;
|
|
607
|
+
}
|
|
608
|
+
current = current[part];
|
|
609
|
+
}
|
|
610
|
+
return current;
|
|
709
611
|
}
|
|
710
|
-
__name(
|
|
711
|
-
function
|
|
712
|
-
|
|
612
|
+
__name(getValue, "getValue");
|
|
613
|
+
function redactPaths(obj, paths, censor, remove = false) {
|
|
614
|
+
for (const path of paths) {
|
|
615
|
+
const parts = parsePath(path);
|
|
616
|
+
if (parts.includes("*")) {
|
|
617
|
+
redactWildcardPath(obj, parts, censor, path, remove);
|
|
618
|
+
} else {
|
|
619
|
+
if (remove) {
|
|
620
|
+
removeKey(obj, parts);
|
|
621
|
+
} else {
|
|
622
|
+
const value = getValueIfExists(obj, parts);
|
|
623
|
+
if (value === PATH_NOT_FOUND) {
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
|
|
627
|
+
setValue(obj, parts, actualCensor);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
713
631
|
}
|
|
714
|
-
__name(
|
|
715
|
-
function
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
var wc = null;
|
|
725
|
-
var kIsWc;
|
|
726
|
-
var wcov;
|
|
727
|
-
var consecutive = false;
|
|
728
|
-
var level = 0;
|
|
729
|
-
var depth = 0;
|
|
730
|
-
var redactPathCurrent = tree();
|
|
731
|
-
ov = n = o[k];
|
|
732
|
-
if (typeof n !== "object") return;
|
|
733
|
-
while (n != null && ++i < afterPathLen) {
|
|
734
|
-
depth += 1;
|
|
735
|
-
k = afterPath[i];
|
|
736
|
-
oov = ov;
|
|
737
|
-
if (k !== "*" && !wc && !(typeof n === "object" && k in n)) {
|
|
738
|
-
break;
|
|
632
|
+
__name(redactPaths, "redactPaths");
|
|
633
|
+
function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
|
|
634
|
+
const wildcardIndex = parts.indexOf("*");
|
|
635
|
+
if (wildcardIndex === parts.length - 1) {
|
|
636
|
+
const parentParts = parts.slice(0, -1);
|
|
637
|
+
let current = obj;
|
|
638
|
+
for (const part of parentParts) {
|
|
639
|
+
if (current === null || current === void 0) return;
|
|
640
|
+
if (typeof current !== "object" || current === null) return;
|
|
641
|
+
current = current[part];
|
|
739
642
|
}
|
|
740
|
-
if (
|
|
741
|
-
if (
|
|
742
|
-
|
|
643
|
+
if (Array.isArray(current)) {
|
|
644
|
+
if (remove) {
|
|
645
|
+
for (let i = 0; i < current.length; i++) {
|
|
646
|
+
current[i] = void 0;
|
|
647
|
+
}
|
|
648
|
+
} else {
|
|
649
|
+
for (let i = 0; i < current.length; i++) {
|
|
650
|
+
const indexPath = [
|
|
651
|
+
...parentParts,
|
|
652
|
+
i.toString()
|
|
653
|
+
];
|
|
654
|
+
const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor;
|
|
655
|
+
current[i] = actualCensor;
|
|
656
|
+
}
|
|
743
657
|
}
|
|
744
|
-
|
|
745
|
-
if (
|
|
746
|
-
|
|
658
|
+
} else if (typeof current === "object" && current !== null) {
|
|
659
|
+
if (remove) {
|
|
660
|
+
const keysToDelete = [];
|
|
661
|
+
for (const key in current) {
|
|
662
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
663
|
+
keysToDelete.push(key);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
for (const key of keysToDelete) {
|
|
667
|
+
delete current[key];
|
|
668
|
+
}
|
|
669
|
+
} else {
|
|
670
|
+
for (const key in current) {
|
|
671
|
+
const keyPath = [
|
|
672
|
+
...parentParts,
|
|
673
|
+
key
|
|
674
|
+
];
|
|
675
|
+
const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor;
|
|
676
|
+
current[key] = actualCensor;
|
|
677
|
+
}
|
|
747
678
|
}
|
|
748
679
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
ov = wcov[k];
|
|
765
|
-
}
|
|
766
|
-
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [
|
|
767
|
-
...path,
|
|
768
|
-
originalKey,
|
|
769
|
-
...afterPath
|
|
770
|
-
]) : censor(ov) : censor;
|
|
771
|
-
if (kIsWc) {
|
|
772
|
-
const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
|
|
773
|
-
store.push(rv);
|
|
774
|
-
n[wck] = nv;
|
|
775
|
-
} else {
|
|
776
|
-
if (wcov[k] === nv) {
|
|
777
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
778
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
779
|
-
} else {
|
|
780
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
781
|
-
const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]);
|
|
782
|
-
store.push(rv);
|
|
783
|
-
wcov[k] = nv;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
}
|
|
680
|
+
} else {
|
|
681
|
+
redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
__name(redactWildcardPath, "redactWildcardPath");
|
|
685
|
+
function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
|
|
686
|
+
const beforeWildcard = parts.slice(0, wildcardIndex);
|
|
687
|
+
const afterWildcard = parts.slice(wildcardIndex + 1);
|
|
688
|
+
const pathArray = [];
|
|
689
|
+
function traverse(current, pathLength) {
|
|
690
|
+
if (pathLength === beforeWildcard.length) {
|
|
691
|
+
if (Array.isArray(current)) {
|
|
692
|
+
for (let i = 0; i < current.length; i++) {
|
|
693
|
+
pathArray[pathLength] = i.toString();
|
|
694
|
+
traverse(current[i], pathLength + 1);
|
|
787
695
|
}
|
|
696
|
+
} else if (typeof current === "object" && current !== null) {
|
|
697
|
+
for (const key in current) {
|
|
698
|
+
pathArray[pathLength] = key;
|
|
699
|
+
traverse(current[key], pathLength + 1);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
} else if (pathLength < beforeWildcard.length) {
|
|
703
|
+
const nextKey = beforeWildcard[pathLength];
|
|
704
|
+
if (current && typeof current === "object" && current !== null && nextKey in current) {
|
|
705
|
+
pathArray[pathLength] = nextKey;
|
|
706
|
+
traverse(current[nextKey], pathLength + 1);
|
|
788
707
|
}
|
|
789
|
-
wc = null;
|
|
790
708
|
} else {
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
709
|
+
if (afterWildcard.includes("*")) {
|
|
710
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
711
|
+
const fullPath = [
|
|
712
|
+
...pathArray.slice(0, pathLength),
|
|
713
|
+
...path
|
|
714
|
+
];
|
|
715
|
+
return censor(value, fullPath);
|
|
716
|
+
} : censor;
|
|
717
|
+
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
799
718
|
} else {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
719
|
+
if (remove) {
|
|
720
|
+
removeKey(current, afterWildcard);
|
|
721
|
+
} else {
|
|
722
|
+
const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [
|
|
723
|
+
...pathArray.slice(0, pathLength),
|
|
724
|
+
...afterWildcard
|
|
725
|
+
]) : censor;
|
|
726
|
+
setValue(current, afterWildcard, actualCensor);
|
|
727
|
+
}
|
|
803
728
|
}
|
|
804
|
-
n = n[k];
|
|
805
729
|
}
|
|
806
|
-
|
|
807
|
-
|
|
730
|
+
}
|
|
731
|
+
__name(traverse, "traverse");
|
|
732
|
+
if (beforeWildcard.length === 0) {
|
|
733
|
+
traverse(obj, 0);
|
|
734
|
+
} else {
|
|
735
|
+
let current = obj;
|
|
736
|
+
for (let i = 0; i < beforeWildcard.length; i++) {
|
|
737
|
+
const part = beforeWildcard[i];
|
|
738
|
+
if (current === null || current === void 0) return;
|
|
739
|
+
if (typeof current !== "object" || current === null) return;
|
|
740
|
+
current = current[part];
|
|
741
|
+
pathArray[i] = part;
|
|
742
|
+
}
|
|
743
|
+
if (current !== null && current !== void 0) {
|
|
744
|
+
traverse(current, beforeWildcard.length);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
__name(redactIntermediateWildcard, "redactIntermediateWildcard");
|
|
749
|
+
function buildPathStructure(pathsToClone) {
|
|
750
|
+
if (pathsToClone.length === 0) {
|
|
751
|
+
return null;
|
|
752
|
+
}
|
|
753
|
+
const pathStructure = /* @__PURE__ */ new Map();
|
|
754
|
+
for (const path of pathsToClone) {
|
|
755
|
+
const parts = parsePath(path);
|
|
756
|
+
let current = pathStructure;
|
|
757
|
+
for (let i = 0; i < parts.length; i++) {
|
|
758
|
+
const part = parts[i];
|
|
759
|
+
if (!current.has(part)) {
|
|
760
|
+
current.set(part, /* @__PURE__ */ new Map());
|
|
761
|
+
}
|
|
762
|
+
current = current.get(part);
|
|
808
763
|
}
|
|
809
764
|
}
|
|
765
|
+
return pathStructure;
|
|
810
766
|
}
|
|
811
|
-
__name(
|
|
812
|
-
function
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
767
|
+
__name(buildPathStructure, "buildPathStructure");
|
|
768
|
+
function selectiveClone(obj, pathStructure) {
|
|
769
|
+
if (!pathStructure) {
|
|
770
|
+
return obj;
|
|
771
|
+
}
|
|
772
|
+
function cloneSelectively(source, pathMap, depth = 0) {
|
|
773
|
+
if (!pathMap || pathMap.size === 0) {
|
|
774
|
+
return source;
|
|
775
|
+
}
|
|
776
|
+
if (source === null || typeof source !== "object") {
|
|
777
|
+
return source;
|
|
778
|
+
}
|
|
779
|
+
if (source instanceof Date) {
|
|
780
|
+
return new Date(source.getTime());
|
|
781
|
+
}
|
|
782
|
+
if (Array.isArray(source)) {
|
|
783
|
+
const cloned2 = [];
|
|
784
|
+
for (let i = 0; i < source.length; i++) {
|
|
785
|
+
const indexStr = i.toString();
|
|
786
|
+
if (pathMap.has(indexStr) || pathMap.has("*")) {
|
|
787
|
+
cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*"));
|
|
788
|
+
} else {
|
|
789
|
+
cloned2[i] = source[i];
|
|
790
|
+
}
|
|
829
791
|
}
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
store.push(rv);
|
|
838
|
-
n[wck] = nv;
|
|
839
|
-
} else {
|
|
840
|
-
if (wcov[k] === nv) {
|
|
841
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
792
|
+
return cloned2;
|
|
793
|
+
}
|
|
794
|
+
const cloned = Object.create(Object.getPrototypeOf(source));
|
|
795
|
+
for (const key in source) {
|
|
796
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
797
|
+
if (pathMap.has(key) || pathMap.has("*")) {
|
|
798
|
+
cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*"));
|
|
842
799
|
} else {
|
|
843
|
-
|
|
844
|
-
store.push(rv);
|
|
845
|
-
wcov[k] = nv;
|
|
800
|
+
cloned[key] = source[key];
|
|
846
801
|
}
|
|
847
802
|
}
|
|
848
803
|
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
804
|
+
return cloned;
|
|
805
|
+
}
|
|
806
|
+
__name(cloneSelectively, "cloneSelectively");
|
|
807
|
+
return cloneSelectively(obj, pathStructure);
|
|
808
|
+
}
|
|
809
|
+
__name(selectiveClone, "selectiveClone");
|
|
810
|
+
function validatePath(path) {
|
|
811
|
+
if (typeof path !== "string") {
|
|
812
|
+
throw new Error("Paths must be (non-empty) strings");
|
|
813
|
+
}
|
|
814
|
+
if (path === "") {
|
|
815
|
+
throw new Error("Invalid redaction path ()");
|
|
816
|
+
}
|
|
817
|
+
if (path.includes("..")) {
|
|
818
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
819
|
+
}
|
|
820
|
+
if (path.includes(",")) {
|
|
821
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
822
|
+
}
|
|
823
|
+
let bracketCount = 0;
|
|
824
|
+
let inQuotes = false;
|
|
825
|
+
let quoteChar = "";
|
|
826
|
+
for (let i = 0; i < path.length; i++) {
|
|
827
|
+
const char = path[i];
|
|
828
|
+
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
829
|
+
if (!inQuotes) {
|
|
830
|
+
inQuotes = true;
|
|
831
|
+
quoteChar = char;
|
|
832
|
+
} else if (char === quoteChar) {
|
|
833
|
+
inQuotes = false;
|
|
834
|
+
quoteChar = "";
|
|
835
|
+
}
|
|
836
|
+
} else if (char === "[" && !inQuotes) {
|
|
837
|
+
bracketCount++;
|
|
838
|
+
} else if (char === "]" && !inQuotes) {
|
|
839
|
+
bracketCount--;
|
|
840
|
+
if (bracketCount < 0) {
|
|
841
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
842
|
+
}
|
|
854
843
|
}
|
|
855
844
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
function tree() {
|
|
859
|
-
return {
|
|
860
|
-
parent: null,
|
|
861
|
-
key: null,
|
|
862
|
-
children: [],
|
|
863
|
-
depth: 0
|
|
864
|
-
};
|
|
865
|
-
}
|
|
866
|
-
__name(tree, "tree");
|
|
867
|
-
function node(parent, key, depth) {
|
|
868
|
-
if (parent.depth === depth) {
|
|
869
|
-
return node(parent.parent, key, depth);
|
|
870
|
-
}
|
|
871
|
-
var child = {
|
|
872
|
-
parent,
|
|
873
|
-
key,
|
|
874
|
-
depth,
|
|
875
|
-
children: []
|
|
876
|
-
};
|
|
877
|
-
parent.children.push(child);
|
|
878
|
-
return child;
|
|
879
|
-
}
|
|
880
|
-
__name(node, "node");
|
|
881
|
-
function restoreInstr(node2, value, target) {
|
|
882
|
-
let current = node2;
|
|
883
|
-
const path = [];
|
|
884
|
-
do {
|
|
885
|
-
path.push(current.key);
|
|
886
|
-
current = current.parent;
|
|
887
|
-
} while (current.parent != null);
|
|
888
|
-
return {
|
|
889
|
-
path,
|
|
890
|
-
value,
|
|
891
|
-
target
|
|
892
|
-
};
|
|
893
|
-
}
|
|
894
|
-
__name(restoreInstr, "restoreInstr");
|
|
895
|
-
}
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
// node_modules/fast-redact/lib/restorer.js
|
|
899
|
-
var require_restorer = __commonJS({
|
|
900
|
-
"node_modules/fast-redact/lib/restorer.js"(exports2, module2) {
|
|
901
|
-
"use strict";
|
|
902
|
-
var { groupRestore, nestedRestore } = require_modifiers();
|
|
903
|
-
module2.exports = restorer;
|
|
904
|
-
function restorer() {
|
|
905
|
-
return /* @__PURE__ */ __name(function compileRestore() {
|
|
906
|
-
if (this.restore) {
|
|
907
|
-
this.restore.state.secret = this.secret;
|
|
908
|
-
return;
|
|
909
|
-
}
|
|
910
|
-
const { secret, wcLen } = this;
|
|
911
|
-
const paths = Object.keys(secret);
|
|
912
|
-
const resetters = resetTmpl(secret, paths);
|
|
913
|
-
const hasWildcards = wcLen > 0;
|
|
914
|
-
const state = hasWildcards ? {
|
|
915
|
-
secret,
|
|
916
|
-
groupRestore,
|
|
917
|
-
nestedRestore
|
|
918
|
-
} : {
|
|
919
|
-
secret
|
|
920
|
-
};
|
|
921
|
-
this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state);
|
|
922
|
-
this.restore.state = state;
|
|
923
|
-
}, "compileRestore");
|
|
924
|
-
}
|
|
925
|
-
__name(restorer, "restorer");
|
|
926
|
-
function resetTmpl(secret, paths) {
|
|
927
|
-
return paths.map((path) => {
|
|
928
|
-
const { circle, escPath, leadingBracket } = secret[path];
|
|
929
|
-
const delim = leadingBracket ? "" : ".";
|
|
930
|
-
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
|
|
931
|
-
const clear = `secret[${escPath}].val = undefined`;
|
|
932
|
-
return `
|
|
933
|
-
if (secret[${escPath}].val !== undefined) {
|
|
934
|
-
try { ${reset} } catch (e) {}
|
|
935
|
-
${clear}
|
|
936
|
-
}
|
|
937
|
-
`;
|
|
938
|
-
}).join("");
|
|
939
|
-
}
|
|
940
|
-
__name(resetTmpl, "resetTmpl");
|
|
941
|
-
function restoreTmpl(resetters, paths, hasWildcards) {
|
|
942
|
-
const dynamicReset = hasWildcards === true ? `
|
|
943
|
-
const keys = Object.keys(secret)
|
|
944
|
-
const len = keys.length
|
|
945
|
-
for (var i = len - 1; i >= ${paths.length}; i--) {
|
|
946
|
-
const k = keys[i]
|
|
947
|
-
const o = secret[k]
|
|
948
|
-
if (o) {
|
|
949
|
-
if (o.flat === true) this.groupRestore(o)
|
|
950
|
-
else this.nestedRestore(o)
|
|
951
|
-
secret[k] = null
|
|
845
|
+
if (bracketCount !== 0) {
|
|
846
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
952
847
|
}
|
|
953
848
|
}
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
849
|
+
__name(validatePath, "validatePath");
|
|
850
|
+
function validatePaths(paths) {
|
|
851
|
+
if (!Array.isArray(paths)) {
|
|
852
|
+
throw new TypeError("paths must be an array");
|
|
853
|
+
}
|
|
854
|
+
for (const path of paths) {
|
|
855
|
+
validatePath(path);
|
|
856
|
+
}
|
|
961
857
|
}
|
|
962
|
-
__name(
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
secret,
|
|
976
|
-
censor,
|
|
977
|
-
compileRestore
|
|
858
|
+
__name(validatePaths, "validatePaths");
|
|
859
|
+
function slowRedact(options = {}) {
|
|
860
|
+
const { paths = [], censor = "[REDACTED]", serialize = JSON.stringify, strict = true, remove = false } = options;
|
|
861
|
+
validatePaths(paths);
|
|
862
|
+
const pathStructure = buildPathStructure(paths);
|
|
863
|
+
return /* @__PURE__ */ __name(function redact(obj) {
|
|
864
|
+
if (strict && (obj === null || typeof obj !== "object")) {
|
|
865
|
+
if (obj === null || obj === void 0) {
|
|
866
|
+
return serialize ? serialize(obj) : obj;
|
|
867
|
+
}
|
|
868
|
+
if (typeof obj !== "object") {
|
|
869
|
+
return serialize ? serialize(obj) : obj;
|
|
870
|
+
}
|
|
978
871
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
"node_modules/fast-redact/index.js"(exports2, module2) {
|
|
998
|
-
"use strict";
|
|
999
|
-
var validator = require_validator();
|
|
1000
|
-
var parse = require_parse();
|
|
1001
|
-
var redactor = require_redactor();
|
|
1002
|
-
var restorer = require_restorer();
|
|
1003
|
-
var { groupRedact, nestedRedact } = require_modifiers();
|
|
1004
|
-
var state = require_state();
|
|
1005
|
-
var rx = require_rx();
|
|
1006
|
-
var validate = validator();
|
|
1007
|
-
var noop = /* @__PURE__ */ __name((o) => o, "noop");
|
|
1008
|
-
noop.restore = noop;
|
|
1009
|
-
var DEFAULT_CENSOR = "[REDACTED]";
|
|
1010
|
-
fastRedact.rx = rx;
|
|
1011
|
-
fastRedact.validator = validator;
|
|
1012
|
-
module2.exports = fastRedact;
|
|
1013
|
-
function fastRedact(opts = {}) {
|
|
1014
|
-
const paths = Array.from(new Set(opts.paths || []));
|
|
1015
|
-
const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
|
|
1016
|
-
const remove = opts.remove;
|
|
1017
|
-
if (remove === true && serialize !== JSON.stringify) {
|
|
1018
|
-
throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
|
|
1019
|
-
}
|
|
1020
|
-
const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR;
|
|
1021
|
-
const isCensorFct = typeof censor === "function";
|
|
1022
|
-
const censorFctTakesPath = isCensorFct && censor.length > 1;
|
|
1023
|
-
if (paths.length === 0) return serialize || noop;
|
|
1024
|
-
validate({
|
|
1025
|
-
paths,
|
|
1026
|
-
serialize,
|
|
1027
|
-
censor
|
|
1028
|
-
});
|
|
1029
|
-
const { wildcards, wcLen, secret } = parse({
|
|
1030
|
-
paths,
|
|
1031
|
-
censor
|
|
1032
|
-
});
|
|
1033
|
-
const compileRestore = restorer();
|
|
1034
|
-
const strict = "strict" in opts ? opts.strict : true;
|
|
1035
|
-
return redactor({
|
|
1036
|
-
secret,
|
|
1037
|
-
wcLen,
|
|
1038
|
-
serialize,
|
|
1039
|
-
strict,
|
|
1040
|
-
isCensorFct,
|
|
1041
|
-
censorFctTakesPath
|
|
1042
|
-
}, state({
|
|
1043
|
-
secret,
|
|
1044
|
-
censor,
|
|
1045
|
-
compileRestore,
|
|
1046
|
-
serialize,
|
|
1047
|
-
groupRedact,
|
|
1048
|
-
nestedRedact,
|
|
1049
|
-
wildcards,
|
|
1050
|
-
wcLen
|
|
1051
|
-
}));
|
|
872
|
+
const cloned = selectiveClone(obj, pathStructure);
|
|
873
|
+
const original = obj;
|
|
874
|
+
let actualCensor = censor;
|
|
875
|
+
if (typeof censor === "function") {
|
|
876
|
+
actualCensor = censor;
|
|
877
|
+
}
|
|
878
|
+
redactPaths(cloned, paths, actualCensor, remove);
|
|
879
|
+
if (serialize === false) {
|
|
880
|
+
cloned.restore = function() {
|
|
881
|
+
return deepClone(original);
|
|
882
|
+
};
|
|
883
|
+
return cloned;
|
|
884
|
+
}
|
|
885
|
+
if (typeof serialize === "function") {
|
|
886
|
+
return serialize(cloned);
|
|
887
|
+
}
|
|
888
|
+
return JSON.stringify(cloned);
|
|
889
|
+
}, "redact");
|
|
1052
890
|
}
|
|
1053
|
-
__name(
|
|
891
|
+
__name(slowRedact, "slowRedact");
|
|
892
|
+
module2.exports = slowRedact;
|
|
1054
893
|
}
|
|
1055
894
|
});
|
|
1056
895
|
|
|
@@ -1129,17 +968,13 @@ var require_symbols = __commonJS({
|
|
|
1129
968
|
var require_redaction = __commonJS({
|
|
1130
969
|
"node_modules/pino/lib/redaction.js"(exports2, module2) {
|
|
1131
970
|
"use strict";
|
|
1132
|
-
var
|
|
971
|
+
var Redact = require_redact();
|
|
1133
972
|
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
|
1134
|
-
var
|
|
1135
|
-
var validate = validator({
|
|
1136
|
-
ERR_PATHS_MUST_BE_STRINGS: /* @__PURE__ */ __name(() => "pino \u2013 redacted paths must be strings", "ERR_PATHS_MUST_BE_STRINGS"),
|
|
1137
|
-
ERR_INVALID_PATH: /* @__PURE__ */ __name((s) => `pino \u2013 redact paths array contains an invalid path (${s})`, "ERR_INVALID_PATH")
|
|
1138
|
-
});
|
|
973
|
+
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
1139
974
|
var CENSOR = "[Redacted]";
|
|
1140
975
|
var strict = false;
|
|
1141
976
|
function redaction(opts, serialize) {
|
|
1142
|
-
const { paths, censor } = handle(opts);
|
|
977
|
+
const { paths, censor, remove } = handle(opts);
|
|
1143
978
|
const shape = paths.reduce((o, str) => {
|
|
1144
979
|
rx.lastIndex = 0;
|
|
1145
980
|
const first = rx.exec(str);
|
|
@@ -1172,11 +1007,12 @@ var require_redaction = __commonJS({
|
|
|
1172
1007
|
return o;
|
|
1173
1008
|
}, {});
|
|
1174
1009
|
const result = {
|
|
1175
|
-
[redactFmtSym]:
|
|
1010
|
+
[redactFmtSym]: Redact({
|
|
1176
1011
|
paths,
|
|
1177
1012
|
censor,
|
|
1178
1013
|
serialize,
|
|
1179
|
-
strict
|
|
1014
|
+
strict,
|
|
1015
|
+
remove
|
|
1180
1016
|
})
|
|
1181
1017
|
};
|
|
1182
1018
|
const topCensor = /* @__PURE__ */ __name((...args) => {
|
|
@@ -1197,11 +1033,12 @@ var require_redaction = __commonJS({
|
|
|
1197
1033
|
...path
|
|
1198
1034
|
]);
|
|
1199
1035
|
} : censor;
|
|
1200
|
-
o[k] =
|
|
1036
|
+
o[k] = Redact({
|
|
1201
1037
|
paths: shape[k],
|
|
1202
1038
|
censor: wrappedCensor,
|
|
1203
1039
|
serialize,
|
|
1204
|
-
strict
|
|
1040
|
+
strict,
|
|
1041
|
+
remove
|
|
1205
1042
|
});
|
|
1206
1043
|
}
|
|
1207
1044
|
return o;
|
|
@@ -1214,7 +1051,6 @@ var require_redaction = __commonJS({
|
|
|
1214
1051
|
paths: opts,
|
|
1215
1052
|
censor: CENSOR
|
|
1216
1053
|
};
|
|
1217
|
-
validate(opts);
|
|
1218
1054
|
return opts;
|
|
1219
1055
|
}
|
|
1220
1056
|
let { paths, censor = CENSOR, remove } = opts;
|
|
@@ -1222,13 +1058,10 @@ var require_redaction = __commonJS({
|
|
|
1222
1058
|
throw Error("pino \u2013 redact must contain an array of strings");
|
|
1223
1059
|
}
|
|
1224
1060
|
if (remove === true) censor = void 0;
|
|
1225
|
-
validate({
|
|
1226
|
-
paths,
|
|
1227
|
-
censor
|
|
1228
|
-
});
|
|
1229
1061
|
return {
|
|
1230
1062
|
paths,
|
|
1231
|
-
censor
|
|
1063
|
+
censor,
|
|
1064
|
+
remove
|
|
1232
1065
|
};
|
|
1233
1066
|
}
|
|
1234
1067
|
__name(handle, "handle");
|
|
@@ -1244,11 +1077,31 @@ var require_time = __commonJS({
|
|
|
1244
1077
|
var epochTime = /* @__PURE__ */ __name(() => `,"time":${Date.now()}`, "epochTime");
|
|
1245
1078
|
var unixTime = /* @__PURE__ */ __name(() => `,"time":${Math.round(Date.now() / 1e3)}`, "unixTime");
|
|
1246
1079
|
var isoTime = /* @__PURE__ */ __name(() => `,"time":"${new Date(Date.now()).toISOString()}"`, "isoTime");
|
|
1080
|
+
var NS_PER_MS = 1000000n;
|
|
1081
|
+
var NS_PER_SEC = 1000000000n;
|
|
1082
|
+
var startWallTimeNs = BigInt(Date.now()) * NS_PER_MS;
|
|
1083
|
+
var startHrTime = process.hrtime.bigint();
|
|
1084
|
+
var isoTimeNano = /* @__PURE__ */ __name(() => {
|
|
1085
|
+
const elapsedNs = process.hrtime.bigint() - startHrTime;
|
|
1086
|
+
const currentTimeNs = startWallTimeNs + elapsedNs;
|
|
1087
|
+
const secondsSinceEpoch = currentTimeNs / NS_PER_SEC;
|
|
1088
|
+
const nanosWithinSecond = currentTimeNs % NS_PER_SEC;
|
|
1089
|
+
const msSinceEpoch = Number(secondsSinceEpoch * 1000n + nanosWithinSecond / 1000000n);
|
|
1090
|
+
const date = new Date(msSinceEpoch);
|
|
1091
|
+
const year = date.getUTCFullYear();
|
|
1092
|
+
const month = (date.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
1093
|
+
const day = date.getUTCDate().toString().padStart(2, "0");
|
|
1094
|
+
const hours = date.getUTCHours().toString().padStart(2, "0");
|
|
1095
|
+
const minutes = date.getUTCMinutes().toString().padStart(2, "0");
|
|
1096
|
+
const seconds = date.getUTCSeconds().toString().padStart(2, "0");
|
|
1097
|
+
return `,"time":"${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${nanosWithinSecond.toString().padStart(9, "0")}Z"`;
|
|
1098
|
+
}, "isoTimeNano");
|
|
1247
1099
|
module2.exports = {
|
|
1248
1100
|
nullTime,
|
|
1249
1101
|
epochTime,
|
|
1250
1102
|
unixTime,
|
|
1251
|
-
isoTime
|
|
1103
|
+
isoTime,
|
|
1104
|
+
isoTimeNano
|
|
1252
1105
|
};
|
|
1253
1106
|
}
|
|
1254
1107
|
});
|
|
@@ -2832,6 +2685,7 @@ var require_transport = __commonJS({
|
|
|
2832
2685
|
var require_tools = __commonJS({
|
|
2833
2686
|
"node_modules/pino/lib/tools.js"(exports2, module2) {
|
|
2834
2687
|
"use strict";
|
|
2688
|
+
var diagChan = require("diagnostics_channel");
|
|
2835
2689
|
var format2 = require_quick_format_unescaped();
|
|
2836
2690
|
var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
|
|
2837
2691
|
var SonicBoom = require_sonic_boom();
|
|
@@ -2839,6 +2693,17 @@ var require_tools = __commonJS({
|
|
|
2839
2693
|
var { lsCacheSym, chindingsSym, writeSym, serializersSym, formatOptsSym, endSym, stringifiersSym, stringifySym, stringifySafeSym, wildcardFirstSym, nestedKeySym, formattersSym, messageKeySym, errorKeySym, nestedKeyStrSym, msgPrefixSym } = require_symbols();
|
|
2840
2694
|
var { isMainThread } = require("worker_threads");
|
|
2841
2695
|
var transport = require_transport();
|
|
2696
|
+
var asJsonChan;
|
|
2697
|
+
if (typeof diagChan.tracingChannel === "function") {
|
|
2698
|
+
asJsonChan = diagChan.tracingChannel("pino_asJson");
|
|
2699
|
+
} else {
|
|
2700
|
+
asJsonChan = {
|
|
2701
|
+
hasSubscribers: false,
|
|
2702
|
+
traceSync(fn, store, thisArg, ...args) {
|
|
2703
|
+
return fn.call(thisArg, ...args);
|
|
2704
|
+
}
|
|
2705
|
+
};
|
|
2706
|
+
}
|
|
2842
2707
|
function noop() {
|
|
2843
2708
|
}
|
|
2844
2709
|
__name(noop, "noop");
|
|
@@ -2907,6 +2772,17 @@ var require_tools = __commonJS({
|
|
|
2907
2772
|
}
|
|
2908
2773
|
__name(asString, "asString");
|
|
2909
2774
|
function asJson(obj, msg, num, time) {
|
|
2775
|
+
if (asJsonChan.hasSubscribers === false) {
|
|
2776
|
+
return _asJson.call(this, obj, msg, num, time);
|
|
2777
|
+
}
|
|
2778
|
+
const store = {
|
|
2779
|
+
instance: this,
|
|
2780
|
+
arguments
|
|
2781
|
+
};
|
|
2782
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time);
|
|
2783
|
+
}
|
|
2784
|
+
__name(asJson, "asJson");
|
|
2785
|
+
function _asJson(obj, msg, num, time) {
|
|
2910
2786
|
const stringify2 = this[stringifySym];
|
|
2911
2787
|
const stringifySafe = this[stringifySafeSym];
|
|
2912
2788
|
const stringifiers = this[stringifiersSym];
|
|
@@ -2987,7 +2863,7 @@ var require_tools = __commonJS({
|
|
|
2987
2863
|
return data + propStr + msgStr + end;
|
|
2988
2864
|
}
|
|
2989
2865
|
}
|
|
2990
|
-
__name(
|
|
2866
|
+
__name(_asJson, "_asJson");
|
|
2991
2867
|
function asChindings(instance, bindings) {
|
|
2992
2868
|
let value;
|
|
2993
2869
|
let data = instance[chindingsSym];
|
|
@@ -3000,7 +2876,7 @@ var require_tools = __commonJS({
|
|
|
3000
2876
|
bindings = formatter(bindings);
|
|
3001
2877
|
for (const key in bindings) {
|
|
3002
2878
|
value = bindings[key];
|
|
3003
|
-
const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
|
|
2879
|
+
const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0;
|
|
3004
2880
|
if (valid === true) {
|
|
3005
2881
|
value = serializers[key] ? serializers[key](value) : value;
|
|
3006
2882
|
value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
|
|
@@ -3374,7 +3250,7 @@ var require_meta = __commonJS({
|
|
|
3374
3250
|
"node_modules/pino/lib/meta.js"(exports2, module2) {
|
|
3375
3251
|
"use strict";
|
|
3376
3252
|
module2.exports = {
|
|
3377
|
-
version: "9.
|
|
3253
|
+
version: "9.14.0"
|
|
3378
3254
|
};
|
|
3379
3255
|
}
|
|
3380
3256
|
});
|
|
@@ -3386,7 +3262,7 @@ var require_proto = __commonJS({
|
|
|
3386
3262
|
var { EventEmitter } = require("events");
|
|
3387
3263
|
var { lsCacheSym, levelValSym, setLevelSym, getLevelSym, chindingsSym, parsedChindingsSym, mixinSym, asJsonSym, writeSym, mixinMergeStrategySym, timeSym, timeSliceIndexSym, streamSym, serializersSym, formattersSym, errorKeySym, messageKeySym, useOnlyCustomLevelsSym, needsMetadataGsym, redactFmtSym, stringifySym, formatOptsSym, stringifiersSym, msgPrefixSym, hooksSym } = require_symbols();
|
|
3388
3264
|
var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
|
|
3389
|
-
var { asChindings, asJson, buildFormatters, stringify } = require_tools();
|
|
3265
|
+
var { asChindings, asJson, buildFormatters, stringify, noop } = require_tools();
|
|
3390
3266
|
var { version } = require_meta();
|
|
3391
3267
|
var redaction = require_redaction();
|
|
3392
3268
|
var _a2;
|
|
@@ -3415,6 +3291,9 @@ var require_proto = __commonJS({
|
|
|
3415
3291
|
get msgPrefix() {
|
|
3416
3292
|
return this[msgPrefixSym];
|
|
3417
3293
|
},
|
|
3294
|
+
get [Symbol.toStringTag]() {
|
|
3295
|
+
return "Pino";
|
|
3296
|
+
},
|
|
3418
3297
|
[lsCacheSym]: initialLsCache,
|
|
3419
3298
|
[writeSym]: write,
|
|
3420
3299
|
[asJsonSym]: asJson,
|
|
@@ -3430,10 +3309,20 @@ var require_proto = __commonJS({
|
|
|
3430
3309
|
if (!bindings2) {
|
|
3431
3310
|
throw Error("missing bindings for child Pino");
|
|
3432
3311
|
}
|
|
3433
|
-
options = options || {};
|
|
3434
3312
|
const serializers = this[serializersSym];
|
|
3435
3313
|
const formatters = this[formattersSym];
|
|
3436
3314
|
const instance = Object.create(this);
|
|
3315
|
+
if (options == null) {
|
|
3316
|
+
if (instance[formattersSym].bindings !== resetChildingsFormatter) {
|
|
3317
|
+
instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
3318
|
+
}
|
|
3319
|
+
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
3320
|
+
instance[setLevelSym](this.level);
|
|
3321
|
+
if (this.onChild !== noop) {
|
|
3322
|
+
this.onChild(instance);
|
|
3323
|
+
}
|
|
3324
|
+
return instance;
|
|
3325
|
+
}
|
|
3437
3326
|
if (options.hasOwnProperty("serializers") === true) {
|
|
3438
3327
|
instance[serializersSym] = /* @__PURE__ */ Object.create(null);
|
|
3439
3328
|
for (const k in serializers) {
|
|
@@ -3541,9 +3430,6 @@ var require_proto = __commonJS({
|
|
|
3541
3430
|
stream.write(streamWriteHook ? streamWriteHook(s) : s);
|
|
3542
3431
|
}
|
|
3543
3432
|
__name(write, "write");
|
|
3544
|
-
function noop() {
|
|
3545
|
-
}
|
|
3546
|
-
__name(noop, "noop");
|
|
3547
3433
|
function flush(cb) {
|
|
3548
3434
|
if (cb != null && typeof cb !== "function") {
|
|
3549
3435
|
throw Error("callback must be a function");
|