apitally 0.21.1 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adonisjs/provider.cjs +456 -612
- package/dist/adonisjs/provider.cjs.map +1 -1
- package/dist/adonisjs/provider.js +456 -612
- package/dist/adonisjs/provider.js.map +1 -1
- package/dist/common/client.cjs +14 -9
- package/dist/common/client.cjs.map +1 -1
- package/dist/common/client.d.cts +1 -1
- package/dist/common/client.d.ts +1 -1
- package/dist/common/client.js +14 -9
- package/dist/common/client.js.map +1 -1
- package/dist/common/response.cjs +21 -2
- package/dist/common/response.cjs.map +1 -1
- package/dist/common/response.d.cts +2 -1
- package/dist/common/response.d.ts +2 -1
- package/dist/common/response.js +19 -1
- package/dist/common/response.js.map +1 -1
- package/dist/elysia/index.cjs +40 -16
- package/dist/elysia/index.cjs.map +1 -1
- package/dist/elysia/index.js +40 -16
- package/dist/elysia/index.js.map +1 -1
- package/dist/elysia/plugin.cjs +40 -16
- package/dist/elysia/plugin.cjs.map +1 -1
- package/dist/elysia/plugin.js +40 -16
- package/dist/elysia/plugin.js.map +1 -1
- package/dist/express/index.cjs +450 -606
- package/dist/express/index.cjs.map +1 -1
- package/dist/express/index.js +450 -606
- package/dist/express/index.js.map +1 -1
- package/dist/express/middleware.cjs +450 -606
- package/dist/express/middleware.cjs.map +1 -1
- package/dist/express/middleware.js +450 -606
- package/dist/express/middleware.js.map +1 -1
- package/dist/fastify/index.cjs +450 -606
- package/dist/fastify/index.cjs.map +1 -1
- package/dist/fastify/index.js +450 -606
- package/dist/fastify/index.js.map +1 -1
- package/dist/fastify/plugin.cjs +450 -606
- package/dist/fastify/plugin.cjs.map +1 -1
- package/dist/fastify/plugin.js +450 -606
- package/dist/fastify/plugin.js.map +1 -1
- package/dist/h3/index.cjs +15 -9
- package/dist/h3/index.cjs.map +1 -1
- package/dist/h3/index.js +15 -9
- package/dist/h3/index.js.map +1 -1
- package/dist/h3/plugin.cjs +15 -9
- package/dist/h3/plugin.cjs.map +1 -1
- package/dist/h3/plugin.js +15 -9
- package/dist/h3/plugin.js.map +1 -1
- package/dist/hapi/index.cjs +456 -612
- package/dist/hapi/index.cjs.map +1 -1
- package/dist/hapi/index.js +456 -612
- package/dist/hapi/index.js.map +1 -1
- package/dist/hapi/plugin.cjs +456 -612
- package/dist/hapi/plugin.cjs.map +1 -1
- package/dist/hapi/plugin.js +456 -612
- package/dist/hapi/plugin.js.map +1 -1
- package/dist/hono/index.cjs +29 -19
- package/dist/hono/index.cjs.map +1 -1
- package/dist/hono/index.js +29 -19
- package/dist/hono/index.js.map +1 -1
- package/dist/hono/middleware.cjs +29 -19
- package/dist/hono/middleware.cjs.map +1 -1
- package/dist/hono/middleware.js +29 -19
- 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/koa/index.cjs +15 -9
- package/dist/koa/index.cjs.map +1 -1
- package/dist/koa/index.js +15 -9
- package/dist/koa/index.js.map +1 -1
- package/dist/koa/middleware.cjs +15 -9
- package/dist/koa/middleware.cjs.map +1 -1
- package/dist/koa/middleware.js +15 -9
- package/dist/koa/middleware.js.map +1 -1
- package/dist/loggers/index.cjs +441 -603
- package/dist/loggers/index.cjs.map +1 -1
- package/dist/loggers/index.js +441 -603
- package/dist/loggers/index.js.map +1 -1
- package/dist/loggers/pino.cjs +435 -597
- package/dist/loggers/pino.cjs.map +1 -1
- package/dist/loggers/pino.js +435 -597
- package/dist/loggers/pino.js.map +1 -1
- package/dist/nestjs/index.cjs +451 -606
- package/dist/nestjs/index.cjs.map +1 -1
- package/dist/nestjs/index.js +451 -606
- package/dist/nestjs/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -440,619 +440,458 @@ var require_caller = __commonJS({
|
|
|
440
440
|
}
|
|
441
441
|
});
|
|
442
442
|
|
|
443
|
-
// node_modules/
|
|
444
|
-
var
|
|
445
|
-
"node_modules/
|
|
443
|
+
// node_modules/@pinojs/redact/index.js
|
|
444
|
+
var require_redact = __commonJS({
|
|
445
|
+
"node_modules/@pinojs/redact/index.js"(exports2, module2) {
|
|
446
446
|
"use strict";
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
447
|
+
function deepClone(obj) {
|
|
448
|
+
if (obj === null || typeof obj !== "object") {
|
|
449
|
+
return obj;
|
|
450
|
+
}
|
|
451
|
+
if (obj instanceof Date) {
|
|
452
|
+
return new Date(obj.getTime());
|
|
453
|
+
}
|
|
454
|
+
if (obj instanceof Array) {
|
|
455
|
+
const cloned = [];
|
|
456
|
+
for (let i = 0; i < obj.length; i++) {
|
|
457
|
+
cloned[i] = deepClone(obj[i]);
|
|
458
|
+
}
|
|
459
|
+
return cloned;
|
|
460
|
+
}
|
|
461
|
+
if (typeof obj === "object") {
|
|
462
|
+
const cloned = Object.create(Object.getPrototypeOf(obj));
|
|
463
|
+
for (const key in obj) {
|
|
464
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
465
|
+
cloned[key] = deepClone(obj[key]);
|
|
454
466
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
467
|
+
}
|
|
468
|
+
return cloned;
|
|
469
|
+
}
|
|
470
|
+
return obj;
|
|
471
|
+
}
|
|
472
|
+
__name(deepClone, "deepClone");
|
|
473
|
+
function parsePath(path) {
|
|
474
|
+
const parts = [];
|
|
475
|
+
let current = "";
|
|
476
|
+
let inBrackets = false;
|
|
477
|
+
let inQuotes = false;
|
|
478
|
+
let quoteChar = "";
|
|
479
|
+
for (let i = 0; i < path.length; i++) {
|
|
480
|
+
const char = path[i];
|
|
481
|
+
if (!inBrackets && char === ".") {
|
|
482
|
+
if (current) {
|
|
483
|
+
parts.push(current);
|
|
484
|
+
current = "";
|
|
485
|
+
}
|
|
486
|
+
} else if (char === "[") {
|
|
487
|
+
if (current) {
|
|
488
|
+
parts.push(current);
|
|
489
|
+
current = "";
|
|
490
|
+
}
|
|
491
|
+
inBrackets = true;
|
|
492
|
+
} else if (char === "]" && inBrackets) {
|
|
493
|
+
parts.push(current);
|
|
494
|
+
current = "";
|
|
495
|
+
inBrackets = false;
|
|
496
|
+
inQuotes = false;
|
|
497
|
+
} else if ((char === '"' || char === "'") && inBrackets) {
|
|
498
|
+
if (!inQuotes) {
|
|
499
|
+
inQuotes = true;
|
|
500
|
+
quoteChar = char;
|
|
501
|
+
} else if (char === quoteChar) {
|
|
502
|
+
inQuotes = false;
|
|
503
|
+
quoteChar = "";
|
|
504
|
+
} else {
|
|
505
|
+
current += char;
|
|
468
506
|
}
|
|
469
|
-
});
|
|
470
|
-
}, "validate");
|
|
471
|
-
}
|
|
472
|
-
__name(validator, "validator");
|
|
473
|
-
}
|
|
474
|
-
});
|
|
475
|
-
|
|
476
|
-
// node_modules/fast-redact/lib/rx.js
|
|
477
|
-
var require_rx = __commonJS({
|
|
478
|
-
"node_modules/fast-redact/lib/rx.js"(exports2, module2) {
|
|
479
|
-
"use strict";
|
|
480
|
-
module2.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
|
|
484
|
-
// node_modules/fast-redact/lib/parse.js
|
|
485
|
-
var require_parse = __commonJS({
|
|
486
|
-
"node_modules/fast-redact/lib/parse.js"(exports2, module2) {
|
|
487
|
-
"use strict";
|
|
488
|
-
var rx = require_rx();
|
|
489
|
-
module2.exports = parse;
|
|
490
|
-
function parse({ paths }) {
|
|
491
|
-
const wildcards = [];
|
|
492
|
-
var wcLen = 0;
|
|
493
|
-
const secret = paths.reduce(function(o, strPath, ix) {
|
|
494
|
-
var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
|
|
495
|
-
const leadingBracket = strPath[0] === "[";
|
|
496
|
-
path = path.map((p) => {
|
|
497
|
-
if (p[0] === "[") return p.substr(1, p.length - 2);
|
|
498
|
-
else return p;
|
|
499
|
-
});
|
|
500
|
-
const star = path.indexOf("*");
|
|
501
|
-
if (star > -1) {
|
|
502
|
-
const before = path.slice(0, star);
|
|
503
|
-
const beforeStr = before.join(".");
|
|
504
|
-
const after = path.slice(star + 1, path.length);
|
|
505
|
-
const nested = after.length > 0;
|
|
506
|
-
wcLen++;
|
|
507
|
-
wildcards.push({
|
|
508
|
-
before,
|
|
509
|
-
beforeStr,
|
|
510
|
-
after,
|
|
511
|
-
nested
|
|
512
|
-
});
|
|
513
507
|
} else {
|
|
514
|
-
|
|
515
|
-
path,
|
|
516
|
-
val: void 0,
|
|
517
|
-
precensored: false,
|
|
518
|
-
circle: "",
|
|
519
|
-
escPath: JSON.stringify(strPath),
|
|
520
|
-
leadingBracket
|
|
521
|
-
};
|
|
508
|
+
current += char;
|
|
522
509
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
secret
|
|
529
|
-
};
|
|
510
|
+
}
|
|
511
|
+
if (current) {
|
|
512
|
+
parts.push(current);
|
|
513
|
+
}
|
|
514
|
+
return parts;
|
|
530
515
|
}
|
|
531
|
-
__name(
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
516
|
+
__name(parsePath, "parsePath");
|
|
517
|
+
function setValue(obj, parts, value) {
|
|
518
|
+
let current = obj;
|
|
519
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
520
|
+
const key = parts[i];
|
|
521
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
522
|
+
return false;
|
|
523
|
+
}
|
|
524
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
525
|
+
return false;
|
|
526
|
+
}
|
|
527
|
+
current = current[key];
|
|
528
|
+
}
|
|
529
|
+
const lastKey = parts[parts.length - 1];
|
|
530
|
+
if (lastKey === "*") {
|
|
531
|
+
if (Array.isArray(current)) {
|
|
532
|
+
for (let i = 0; i < current.length; i++) {
|
|
533
|
+
current[i] = value;
|
|
534
|
+
}
|
|
535
|
+
} else if (typeof current === "object" && current !== null) {
|
|
536
|
+
for (const key in current) {
|
|
537
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
538
|
+
current[key] = value;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
} else {
|
|
543
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
544
|
+
current[lastKey] = value;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return true;
|
|
551
548
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
if (
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
var s = this.serialize(o)
|
|
624
|
-
this.restore(o)
|
|
625
|
-
return s
|
|
626
|
-
`;
|
|
627
|
-
}
|
|
628
|
-
__name(resultTmpl, "resultTmpl");
|
|
629
|
-
function strictImpl(strict, serialize) {
|
|
630
|
-
return strict === true ? `throw Error('fast-redact: primitives cannot be redacted')` : serialize === false ? `return o` : `return this.serialize(o)`;
|
|
631
|
-
}
|
|
632
|
-
__name(strictImpl, "strictImpl");
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
|
|
636
|
-
// node_modules/fast-redact/lib/modifiers.js
|
|
637
|
-
var require_modifiers = __commonJS({
|
|
638
|
-
"node_modules/fast-redact/lib/modifiers.js"(exports2, module2) {
|
|
639
|
-
"use strict";
|
|
640
|
-
module2.exports = {
|
|
641
|
-
groupRedact,
|
|
642
|
-
groupRestore,
|
|
643
|
-
nestedRedact,
|
|
644
|
-
nestedRestore
|
|
645
|
-
};
|
|
646
|
-
function groupRestore({ keys, values, target }) {
|
|
647
|
-
if (target == null || typeof target === "string") return;
|
|
648
|
-
const length = keys.length;
|
|
649
|
-
for (var i = 0; i < length; i++) {
|
|
650
|
-
const k = keys[i];
|
|
651
|
-
target[k] = values[i];
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
__name(groupRestore, "groupRestore");
|
|
655
|
-
function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
|
|
656
|
-
const target = get(o, path);
|
|
657
|
-
if (target == null || typeof target === "string") return {
|
|
658
|
-
keys: null,
|
|
659
|
-
values: null,
|
|
660
|
-
target,
|
|
661
|
-
flat: true
|
|
662
|
-
};
|
|
663
|
-
const keys = Object.keys(target);
|
|
664
|
-
const keysLength = keys.length;
|
|
665
|
-
const pathLength = path.length;
|
|
666
|
-
const pathWithKey = censorFctTakesPath ? [
|
|
667
|
-
...path
|
|
668
|
-
] : void 0;
|
|
669
|
-
const values = new Array(keysLength);
|
|
670
|
-
for (var i = 0; i < keysLength; i++) {
|
|
671
|
-
const key = keys[i];
|
|
672
|
-
values[i] = target[key];
|
|
673
|
-
if (censorFctTakesPath) {
|
|
674
|
-
pathWithKey[pathLength] = key;
|
|
675
|
-
target[key] = censor(target[key], pathWithKey);
|
|
676
|
-
} else if (isCensorFct) {
|
|
677
|
-
target[key] = censor(target[key]);
|
|
549
|
+
__name(setValue, "setValue");
|
|
550
|
+
function removeKey(obj, parts) {
|
|
551
|
+
let current = obj;
|
|
552
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
553
|
+
const key = parts[i];
|
|
554
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
555
|
+
return false;
|
|
556
|
+
}
|
|
557
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
558
|
+
return false;
|
|
559
|
+
}
|
|
560
|
+
current = current[key];
|
|
561
|
+
}
|
|
562
|
+
const lastKey = parts[parts.length - 1];
|
|
563
|
+
if (lastKey === "*") {
|
|
564
|
+
if (Array.isArray(current)) {
|
|
565
|
+
for (let i = 0; i < current.length; i++) {
|
|
566
|
+
current[i] = void 0;
|
|
567
|
+
}
|
|
568
|
+
} else if (typeof current === "object" && current !== null) {
|
|
569
|
+
for (const key in current) {
|
|
570
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
571
|
+
delete current[key];
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
} else {
|
|
576
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
577
|
+
delete current[lastKey];
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
__name(removeKey, "removeKey");
|
|
583
|
+
var PATH_NOT_FOUND = Symbol("PATH_NOT_FOUND");
|
|
584
|
+
function getValueIfExists(obj, parts) {
|
|
585
|
+
let current = obj;
|
|
586
|
+
for (const part of parts) {
|
|
587
|
+
if (current === null || current === void 0) {
|
|
588
|
+
return PATH_NOT_FOUND;
|
|
589
|
+
}
|
|
590
|
+
if (typeof current !== "object" || current === null) {
|
|
591
|
+
return PATH_NOT_FOUND;
|
|
592
|
+
}
|
|
593
|
+
if (!(part in current)) {
|
|
594
|
+
return PATH_NOT_FOUND;
|
|
595
|
+
}
|
|
596
|
+
current = current[part];
|
|
597
|
+
}
|
|
598
|
+
return current;
|
|
599
|
+
}
|
|
600
|
+
__name(getValueIfExists, "getValueIfExists");
|
|
601
|
+
function getValue(obj, parts) {
|
|
602
|
+
let current = obj;
|
|
603
|
+
for (const part of parts) {
|
|
604
|
+
if (current === null || current === void 0) {
|
|
605
|
+
return void 0;
|
|
606
|
+
}
|
|
607
|
+
if (typeof current !== "object" || current === null) {
|
|
608
|
+
return void 0;
|
|
609
|
+
}
|
|
610
|
+
current = current[part];
|
|
611
|
+
}
|
|
612
|
+
return current;
|
|
613
|
+
}
|
|
614
|
+
__name(getValue, "getValue");
|
|
615
|
+
function redactPaths(obj, paths, censor, remove = false) {
|
|
616
|
+
for (const path of paths) {
|
|
617
|
+
const parts = parsePath(path);
|
|
618
|
+
if (parts.includes("*")) {
|
|
619
|
+
redactWildcardPath(obj, parts, censor, path, remove);
|
|
678
620
|
} else {
|
|
679
|
-
|
|
621
|
+
if (remove) {
|
|
622
|
+
removeKey(obj, parts);
|
|
623
|
+
} else {
|
|
624
|
+
const value = getValueIfExists(obj, parts);
|
|
625
|
+
if (value === PATH_NOT_FOUND) {
|
|
626
|
+
continue;
|
|
627
|
+
}
|
|
628
|
+
const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
|
|
629
|
+
setValue(obj, parts, actualCensor);
|
|
630
|
+
}
|
|
680
631
|
}
|
|
681
632
|
}
|
|
682
|
-
return {
|
|
683
|
-
keys,
|
|
684
|
-
values,
|
|
685
|
-
target,
|
|
686
|
-
flat: true
|
|
687
|
-
};
|
|
688
633
|
}
|
|
689
|
-
__name(
|
|
690
|
-
function
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
__name(nestedRestore, "nestedRestore");
|
|
701
|
-
function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
|
|
702
|
-
const target = get(o, path);
|
|
703
|
-
if (target == null) return;
|
|
704
|
-
const keys = Object.keys(target);
|
|
705
|
-
const keysLength = keys.length;
|
|
706
|
-
for (var i = 0; i < keysLength; i++) {
|
|
707
|
-
const key = keys[i];
|
|
708
|
-
specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
|
|
709
|
-
}
|
|
710
|
-
return store;
|
|
711
|
-
}
|
|
712
|
-
__name(nestedRedact, "nestedRedact");
|
|
713
|
-
function has(obj, prop) {
|
|
714
|
-
return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
|
|
715
|
-
}
|
|
716
|
-
__name(has, "has");
|
|
717
|
-
function specialSet(store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
|
|
718
|
-
const afterPathLen = afterPath.length;
|
|
719
|
-
const lastPathIndex = afterPathLen - 1;
|
|
720
|
-
const originalKey = k;
|
|
721
|
-
var i = -1;
|
|
722
|
-
var n;
|
|
723
|
-
var nv;
|
|
724
|
-
var ov;
|
|
725
|
-
var oov = null;
|
|
726
|
-
var wc = null;
|
|
727
|
-
var kIsWc;
|
|
728
|
-
var wcov;
|
|
729
|
-
var consecutive = false;
|
|
730
|
-
var level = 0;
|
|
731
|
-
var depth = 0;
|
|
732
|
-
var redactPathCurrent = tree();
|
|
733
|
-
ov = n = o[k];
|
|
734
|
-
if (typeof n !== "object") return;
|
|
735
|
-
while (n != null && ++i < afterPathLen) {
|
|
736
|
-
depth += 1;
|
|
737
|
-
k = afterPath[i];
|
|
738
|
-
oov = ov;
|
|
739
|
-
if (k !== "*" && !wc && !(typeof n === "object" && k in n)) {
|
|
740
|
-
break;
|
|
634
|
+
__name(redactPaths, "redactPaths");
|
|
635
|
+
function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
|
|
636
|
+
const wildcardIndex = parts.indexOf("*");
|
|
637
|
+
if (wildcardIndex === parts.length - 1) {
|
|
638
|
+
const parentParts = parts.slice(0, -1);
|
|
639
|
+
let current = obj;
|
|
640
|
+
for (const part of parentParts) {
|
|
641
|
+
if (current === null || current === void 0) return;
|
|
642
|
+
if (typeof current !== "object" || current === null) return;
|
|
643
|
+
current = current[part];
|
|
741
644
|
}
|
|
742
|
-
if (
|
|
743
|
-
if (
|
|
744
|
-
|
|
645
|
+
if (Array.isArray(current)) {
|
|
646
|
+
if (remove) {
|
|
647
|
+
for (let i = 0; i < current.length; i++) {
|
|
648
|
+
current[i] = void 0;
|
|
649
|
+
}
|
|
650
|
+
} else {
|
|
651
|
+
for (let i = 0; i < current.length; i++) {
|
|
652
|
+
const indexPath = [
|
|
653
|
+
...parentParts,
|
|
654
|
+
i.toString()
|
|
655
|
+
];
|
|
656
|
+
const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor;
|
|
657
|
+
current[i] = actualCensor;
|
|
658
|
+
}
|
|
745
659
|
}
|
|
746
|
-
|
|
747
|
-
if (
|
|
748
|
-
|
|
660
|
+
} else if (typeof current === "object" && current !== null) {
|
|
661
|
+
if (remove) {
|
|
662
|
+
const keysToDelete = [];
|
|
663
|
+
for (const key in current) {
|
|
664
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
665
|
+
keysToDelete.push(key);
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
for (const key of keysToDelete) {
|
|
669
|
+
delete current[key];
|
|
670
|
+
}
|
|
671
|
+
} else {
|
|
672
|
+
for (const key in current) {
|
|
673
|
+
const keyPath = [
|
|
674
|
+
...parentParts,
|
|
675
|
+
key
|
|
676
|
+
];
|
|
677
|
+
const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor;
|
|
678
|
+
current[key] = actualCensor;
|
|
679
|
+
}
|
|
749
680
|
}
|
|
750
681
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
...afterPath
|
|
772
|
-
]) : censor(ov) : censor;
|
|
773
|
-
if (kIsWc) {
|
|
774
|
-
const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
|
|
775
|
-
store.push(rv);
|
|
776
|
-
n[wck] = nv;
|
|
777
|
-
} else {
|
|
778
|
-
if (wcov[k] === nv) {
|
|
779
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
780
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
781
|
-
} else {
|
|
782
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
783
|
-
const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]);
|
|
784
|
-
store.push(rv);
|
|
785
|
-
wcov[k] = nv;
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
}
|
|
682
|
+
} else {
|
|
683
|
+
redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
__name(redactWildcardPath, "redactWildcardPath");
|
|
687
|
+
function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
|
|
688
|
+
const beforeWildcard = parts.slice(0, wildcardIndex);
|
|
689
|
+
const afterWildcard = parts.slice(wildcardIndex + 1);
|
|
690
|
+
const pathArray = [];
|
|
691
|
+
function traverse(current, pathLength) {
|
|
692
|
+
if (pathLength === beforeWildcard.length) {
|
|
693
|
+
if (Array.isArray(current)) {
|
|
694
|
+
for (let i = 0; i < current.length; i++) {
|
|
695
|
+
pathArray[pathLength] = i.toString();
|
|
696
|
+
traverse(current[i], pathLength + 1);
|
|
697
|
+
}
|
|
698
|
+
} else if (typeof current === "object" && current !== null) {
|
|
699
|
+
for (const key in current) {
|
|
700
|
+
pathArray[pathLength] = key;
|
|
701
|
+
traverse(current[key], pathLength + 1);
|
|
789
702
|
}
|
|
790
703
|
}
|
|
791
|
-
|
|
704
|
+
} else if (pathLength < beforeWildcard.length) {
|
|
705
|
+
const nextKey = beforeWildcard[pathLength];
|
|
706
|
+
if (current && typeof current === "object" && current !== null && nextKey in current) {
|
|
707
|
+
pathArray[pathLength] = nextKey;
|
|
708
|
+
traverse(current[nextKey], pathLength + 1);
|
|
709
|
+
}
|
|
792
710
|
} else {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
711
|
+
if (afterWildcard.includes("*")) {
|
|
712
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
713
|
+
const fullPath = [
|
|
714
|
+
...pathArray.slice(0, pathLength),
|
|
715
|
+
...path
|
|
716
|
+
];
|
|
717
|
+
return censor(value, fullPath);
|
|
718
|
+
} : censor;
|
|
719
|
+
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
801
720
|
} else {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
721
|
+
if (remove) {
|
|
722
|
+
removeKey(current, afterWildcard);
|
|
723
|
+
} else {
|
|
724
|
+
const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [
|
|
725
|
+
...pathArray.slice(0, pathLength),
|
|
726
|
+
...afterWildcard
|
|
727
|
+
]) : censor;
|
|
728
|
+
setValue(current, afterWildcard, actualCensor);
|
|
729
|
+
}
|
|
805
730
|
}
|
|
806
|
-
n = n[k];
|
|
807
731
|
}
|
|
808
|
-
|
|
809
|
-
|
|
732
|
+
}
|
|
733
|
+
__name(traverse, "traverse");
|
|
734
|
+
if (beforeWildcard.length === 0) {
|
|
735
|
+
traverse(obj, 0);
|
|
736
|
+
} else {
|
|
737
|
+
let current = obj;
|
|
738
|
+
for (let i = 0; i < beforeWildcard.length; i++) {
|
|
739
|
+
const part = beforeWildcard[i];
|
|
740
|
+
if (current === null || current === void 0) return;
|
|
741
|
+
if (typeof current !== "object" || current === null) return;
|
|
742
|
+
current = current[part];
|
|
743
|
+
pathArray[i] = part;
|
|
744
|
+
}
|
|
745
|
+
if (current !== null && current !== void 0) {
|
|
746
|
+
traverse(current, beforeWildcard.length);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
__name(redactIntermediateWildcard, "redactIntermediateWildcard");
|
|
751
|
+
function buildPathStructure(pathsToClone) {
|
|
752
|
+
if (pathsToClone.length === 0) {
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
const pathStructure = /* @__PURE__ */ new Map();
|
|
756
|
+
for (const path of pathsToClone) {
|
|
757
|
+
const parts = parsePath(path);
|
|
758
|
+
let current = pathStructure;
|
|
759
|
+
for (let i = 0; i < parts.length; i++) {
|
|
760
|
+
const part = parts[i];
|
|
761
|
+
if (!current.has(part)) {
|
|
762
|
+
current.set(part, /* @__PURE__ */ new Map());
|
|
763
|
+
}
|
|
764
|
+
current = current.get(part);
|
|
810
765
|
}
|
|
811
766
|
}
|
|
767
|
+
return pathStructure;
|
|
812
768
|
}
|
|
813
|
-
__name(
|
|
814
|
-
function
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
var n = o;
|
|
818
|
-
while (n != null && ++i < l) {
|
|
819
|
-
n = n[p[i]];
|
|
769
|
+
__name(buildPathStructure, "buildPathStructure");
|
|
770
|
+
function selectiveClone(obj, pathStructure) {
|
|
771
|
+
if (!pathStructure) {
|
|
772
|
+
return obj;
|
|
820
773
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
774
|
+
function cloneSelectively(source, pathMap, depth = 0) {
|
|
775
|
+
if (!pathMap || pathMap.size === 0) {
|
|
776
|
+
return source;
|
|
777
|
+
}
|
|
778
|
+
if (source === null || typeof source !== "object") {
|
|
779
|
+
return source;
|
|
780
|
+
}
|
|
781
|
+
if (source instanceof Date) {
|
|
782
|
+
return new Date(source.getTime());
|
|
783
|
+
}
|
|
784
|
+
if (Array.isArray(source)) {
|
|
785
|
+
const cloned2 = [];
|
|
786
|
+
for (let i = 0; i < source.length; i++) {
|
|
787
|
+
const indexStr = i.toString();
|
|
788
|
+
if (pathMap.has(indexStr) || pathMap.has("*")) {
|
|
789
|
+
cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*"));
|
|
790
|
+
} else {
|
|
791
|
+
cloned2[i] = source[i];
|
|
792
|
+
}
|
|
831
793
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
store.push(rv);
|
|
840
|
-
n[wck] = nv;
|
|
841
|
-
} else {
|
|
842
|
-
if (wcov[k] === nv) {
|
|
843
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
794
|
+
return cloned2;
|
|
795
|
+
}
|
|
796
|
+
const cloned = Object.create(Object.getPrototypeOf(source));
|
|
797
|
+
for (const key in source) {
|
|
798
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
799
|
+
if (pathMap.has(key) || pathMap.has("*")) {
|
|
800
|
+
cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*"));
|
|
844
801
|
} else {
|
|
845
|
-
|
|
846
|
-
store.push(rv);
|
|
847
|
-
wcov[k] = nv;
|
|
802
|
+
cloned[key] = source[key];
|
|
848
803
|
}
|
|
849
804
|
}
|
|
850
805
|
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
806
|
+
return cloned;
|
|
807
|
+
}
|
|
808
|
+
__name(cloneSelectively, "cloneSelectively");
|
|
809
|
+
return cloneSelectively(obj, pathStructure);
|
|
810
|
+
}
|
|
811
|
+
__name(selectiveClone, "selectiveClone");
|
|
812
|
+
function validatePath(path) {
|
|
813
|
+
if (typeof path !== "string") {
|
|
814
|
+
throw new Error("Paths must be (non-empty) strings");
|
|
815
|
+
}
|
|
816
|
+
if (path === "") {
|
|
817
|
+
throw new Error("Invalid redaction path ()");
|
|
818
|
+
}
|
|
819
|
+
if (path.includes("..")) {
|
|
820
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
821
|
+
}
|
|
822
|
+
if (path.includes(",")) {
|
|
823
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
824
|
+
}
|
|
825
|
+
let bracketCount = 0;
|
|
826
|
+
let inQuotes = false;
|
|
827
|
+
let quoteChar = "";
|
|
828
|
+
for (let i = 0; i < path.length; i++) {
|
|
829
|
+
const char = path[i];
|
|
830
|
+
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
831
|
+
if (!inQuotes) {
|
|
832
|
+
inQuotes = true;
|
|
833
|
+
quoteChar = char;
|
|
834
|
+
} else if (char === quoteChar) {
|
|
835
|
+
inQuotes = false;
|
|
836
|
+
quoteChar = "";
|
|
837
|
+
}
|
|
838
|
+
} else if (char === "[" && !inQuotes) {
|
|
839
|
+
bracketCount++;
|
|
840
|
+
} else if (char === "]" && !inQuotes) {
|
|
841
|
+
bracketCount--;
|
|
842
|
+
if (bracketCount < 0) {
|
|
843
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
844
|
+
}
|
|
856
845
|
}
|
|
857
846
|
}
|
|
847
|
+
if (bracketCount !== 0) {
|
|
848
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
849
|
+
}
|
|
858
850
|
}
|
|
859
|
-
__name(
|
|
860
|
-
function
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
__name(tree, "tree");
|
|
869
|
-
function node(parent, key, depth) {
|
|
870
|
-
if (parent.depth === depth) {
|
|
871
|
-
return node(parent.parent, key, depth);
|
|
851
|
+
__name(validatePath, "validatePath");
|
|
852
|
+
function validatePaths(paths) {
|
|
853
|
+
if (!Array.isArray(paths)) {
|
|
854
|
+
throw new TypeError("paths must be an array");
|
|
855
|
+
}
|
|
856
|
+
for (const path of paths) {
|
|
857
|
+
validatePath(path);
|
|
872
858
|
}
|
|
873
|
-
var child = {
|
|
874
|
-
parent,
|
|
875
|
-
key,
|
|
876
|
-
depth,
|
|
877
|
-
children: []
|
|
878
|
-
};
|
|
879
|
-
parent.children.push(child);
|
|
880
|
-
return child;
|
|
881
|
-
}
|
|
882
|
-
__name(node, "node");
|
|
883
|
-
function restoreInstr(node2, value, target) {
|
|
884
|
-
let current = node2;
|
|
885
|
-
const path = [];
|
|
886
|
-
do {
|
|
887
|
-
path.push(current.key);
|
|
888
|
-
current = current.parent;
|
|
889
|
-
} while (current.parent != null);
|
|
890
|
-
return {
|
|
891
|
-
path,
|
|
892
|
-
value,
|
|
893
|
-
target
|
|
894
|
-
};
|
|
895
859
|
}
|
|
896
|
-
__name(
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
this.restore.state.secret = this.secret;
|
|
910
|
-
return;
|
|
860
|
+
__name(validatePaths, "validatePaths");
|
|
861
|
+
function slowRedact(options = {}) {
|
|
862
|
+
const { paths = [], censor = "[REDACTED]", serialize = JSON.stringify, strict = true, remove = false } = options;
|
|
863
|
+
validatePaths(paths);
|
|
864
|
+
const pathStructure = buildPathStructure(paths);
|
|
865
|
+
return /* @__PURE__ */ __name(function redact(obj) {
|
|
866
|
+
if (strict && (obj === null || typeof obj !== "object")) {
|
|
867
|
+
if (obj === null || obj === void 0) {
|
|
868
|
+
return serialize ? serialize(obj) : obj;
|
|
869
|
+
}
|
|
870
|
+
if (typeof obj !== "object") {
|
|
871
|
+
return serialize ? serialize(obj) : obj;
|
|
872
|
+
}
|
|
911
873
|
}
|
|
912
|
-
const
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
secret,
|
|
918
|
-
groupRestore,
|
|
919
|
-
nestedRestore
|
|
920
|
-
} : {
|
|
921
|
-
secret
|
|
922
|
-
};
|
|
923
|
-
this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state);
|
|
924
|
-
this.restore.state = state;
|
|
925
|
-
}, "compileRestore");
|
|
926
|
-
}
|
|
927
|
-
__name(restorer, "restorer");
|
|
928
|
-
function resetTmpl(secret, paths) {
|
|
929
|
-
return paths.map((path) => {
|
|
930
|
-
const { circle, escPath, leadingBracket } = secret[path];
|
|
931
|
-
const delim = leadingBracket ? "" : ".";
|
|
932
|
-
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
|
|
933
|
-
const clear = `secret[${escPath}].val = undefined`;
|
|
934
|
-
return `
|
|
935
|
-
if (secret[${escPath}].val !== undefined) {
|
|
936
|
-
try { ${reset} } catch (e) {}
|
|
937
|
-
${clear}
|
|
938
|
-
}
|
|
939
|
-
`;
|
|
940
|
-
}).join("");
|
|
941
|
-
}
|
|
942
|
-
__name(resetTmpl, "resetTmpl");
|
|
943
|
-
function restoreTmpl(resetters, paths, hasWildcards) {
|
|
944
|
-
const dynamicReset = hasWildcards === true ? `
|
|
945
|
-
const keys = Object.keys(secret)
|
|
946
|
-
const len = keys.length
|
|
947
|
-
for (var i = len - 1; i >= ${paths.length}; i--) {
|
|
948
|
-
const k = keys[i]
|
|
949
|
-
const o = secret[k]
|
|
950
|
-
if (o) {
|
|
951
|
-
if (o.flat === true) this.groupRestore(o)
|
|
952
|
-
else this.nestedRestore(o)
|
|
953
|
-
secret[k] = null
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
` : "";
|
|
957
|
-
return `
|
|
958
|
-
const secret = this.secret
|
|
959
|
-
${dynamicReset}
|
|
960
|
-
${resetters}
|
|
961
|
-
return o
|
|
962
|
-
`;
|
|
963
|
-
}
|
|
964
|
-
__name(restoreTmpl, "restoreTmpl");
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
|
|
968
|
-
// node_modules/fast-redact/lib/state.js
|
|
969
|
-
var require_state = __commonJS({
|
|
970
|
-
"node_modules/fast-redact/lib/state.js"(exports2, module2) {
|
|
971
|
-
"use strict";
|
|
972
|
-
module2.exports = state;
|
|
973
|
-
function state(o) {
|
|
974
|
-
const { secret, censor, compileRestore, serialize, groupRedact, nestedRedact, wildcards, wcLen } = o;
|
|
975
|
-
const builder = [
|
|
976
|
-
{
|
|
977
|
-
secret,
|
|
978
|
-
censor,
|
|
979
|
-
compileRestore
|
|
874
|
+
const cloned = selectiveClone(obj, pathStructure);
|
|
875
|
+
const original = obj;
|
|
876
|
+
let actualCensor = censor;
|
|
877
|
+
if (typeof censor === "function") {
|
|
878
|
+
actualCensor = censor;
|
|
980
879
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
__name(state, "state");
|
|
994
|
-
}
|
|
995
|
-
});
|
|
996
|
-
|
|
997
|
-
// node_modules/fast-redact/index.js
|
|
998
|
-
var require_fast_redact = __commonJS({
|
|
999
|
-
"node_modules/fast-redact/index.js"(exports2, module2) {
|
|
1000
|
-
"use strict";
|
|
1001
|
-
var validator = require_validator();
|
|
1002
|
-
var parse = require_parse();
|
|
1003
|
-
var redactor = require_redactor();
|
|
1004
|
-
var restorer = require_restorer();
|
|
1005
|
-
var { groupRedact, nestedRedact } = require_modifiers();
|
|
1006
|
-
var state = require_state();
|
|
1007
|
-
var rx = require_rx();
|
|
1008
|
-
var validate = validator();
|
|
1009
|
-
var noop = /* @__PURE__ */ __name((o) => o, "noop");
|
|
1010
|
-
noop.restore = noop;
|
|
1011
|
-
var DEFAULT_CENSOR = "[REDACTED]";
|
|
1012
|
-
fastRedact.rx = rx;
|
|
1013
|
-
fastRedact.validator = validator;
|
|
1014
|
-
module2.exports = fastRedact;
|
|
1015
|
-
function fastRedact(opts = {}) {
|
|
1016
|
-
const paths = Array.from(new Set(opts.paths || []));
|
|
1017
|
-
const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
|
|
1018
|
-
const remove = opts.remove;
|
|
1019
|
-
if (remove === true && serialize !== JSON.stringify) {
|
|
1020
|
-
throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
|
|
1021
|
-
}
|
|
1022
|
-
const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR;
|
|
1023
|
-
const isCensorFct = typeof censor === "function";
|
|
1024
|
-
const censorFctTakesPath = isCensorFct && censor.length > 1;
|
|
1025
|
-
if (paths.length === 0) return serialize || noop;
|
|
1026
|
-
validate({
|
|
1027
|
-
paths,
|
|
1028
|
-
serialize,
|
|
1029
|
-
censor
|
|
1030
|
-
});
|
|
1031
|
-
const { wildcards, wcLen, secret } = parse({
|
|
1032
|
-
paths,
|
|
1033
|
-
censor
|
|
1034
|
-
});
|
|
1035
|
-
const compileRestore = restorer();
|
|
1036
|
-
const strict = "strict" in opts ? opts.strict : true;
|
|
1037
|
-
return redactor({
|
|
1038
|
-
secret,
|
|
1039
|
-
wcLen,
|
|
1040
|
-
serialize,
|
|
1041
|
-
strict,
|
|
1042
|
-
isCensorFct,
|
|
1043
|
-
censorFctTakesPath
|
|
1044
|
-
}, state({
|
|
1045
|
-
secret,
|
|
1046
|
-
censor,
|
|
1047
|
-
compileRestore,
|
|
1048
|
-
serialize,
|
|
1049
|
-
groupRedact,
|
|
1050
|
-
nestedRedact,
|
|
1051
|
-
wildcards,
|
|
1052
|
-
wcLen
|
|
1053
|
-
}));
|
|
880
|
+
redactPaths(cloned, paths, actualCensor, remove);
|
|
881
|
+
if (serialize === false) {
|
|
882
|
+
cloned.restore = function() {
|
|
883
|
+
return deepClone(original);
|
|
884
|
+
};
|
|
885
|
+
return cloned;
|
|
886
|
+
}
|
|
887
|
+
if (typeof serialize === "function") {
|
|
888
|
+
return serialize(cloned);
|
|
889
|
+
}
|
|
890
|
+
return JSON.stringify(cloned);
|
|
891
|
+
}, "redact");
|
|
1054
892
|
}
|
|
1055
|
-
__name(
|
|
893
|
+
__name(slowRedact, "slowRedact");
|
|
894
|
+
module2.exports = slowRedact;
|
|
1056
895
|
}
|
|
1057
896
|
});
|
|
1058
897
|
|
|
@@ -1131,17 +970,13 @@ var require_symbols = __commonJS({
|
|
|
1131
970
|
var require_redaction = __commonJS({
|
|
1132
971
|
"node_modules/pino/lib/redaction.js"(exports2, module2) {
|
|
1133
972
|
"use strict";
|
|
1134
|
-
var
|
|
973
|
+
var Redact = require_redact();
|
|
1135
974
|
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
|
1136
|
-
var
|
|
1137
|
-
var validate = validator({
|
|
1138
|
-
ERR_PATHS_MUST_BE_STRINGS: /* @__PURE__ */ __name(() => "pino \u2013 redacted paths must be strings", "ERR_PATHS_MUST_BE_STRINGS"),
|
|
1139
|
-
ERR_INVALID_PATH: /* @__PURE__ */ __name((s) => `pino \u2013 redact paths array contains an invalid path (${s})`, "ERR_INVALID_PATH")
|
|
1140
|
-
});
|
|
975
|
+
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
1141
976
|
var CENSOR = "[Redacted]";
|
|
1142
977
|
var strict = false;
|
|
1143
978
|
function redaction(opts, serialize) {
|
|
1144
|
-
const { paths, censor } = handle(opts);
|
|
979
|
+
const { paths, censor, remove } = handle(opts);
|
|
1145
980
|
const shape = paths.reduce((o, str) => {
|
|
1146
981
|
rx.lastIndex = 0;
|
|
1147
982
|
const first = rx.exec(str);
|
|
@@ -1174,11 +1009,12 @@ var require_redaction = __commonJS({
|
|
|
1174
1009
|
return o;
|
|
1175
1010
|
}, {});
|
|
1176
1011
|
const result = {
|
|
1177
|
-
[redactFmtSym]:
|
|
1012
|
+
[redactFmtSym]: Redact({
|
|
1178
1013
|
paths,
|
|
1179
1014
|
censor,
|
|
1180
1015
|
serialize,
|
|
1181
|
-
strict
|
|
1016
|
+
strict,
|
|
1017
|
+
remove
|
|
1182
1018
|
})
|
|
1183
1019
|
};
|
|
1184
1020
|
const topCensor = /* @__PURE__ */ __name((...args) => {
|
|
@@ -1199,11 +1035,12 @@ var require_redaction = __commonJS({
|
|
|
1199
1035
|
...path
|
|
1200
1036
|
]);
|
|
1201
1037
|
} : censor;
|
|
1202
|
-
o[k] =
|
|
1038
|
+
o[k] = Redact({
|
|
1203
1039
|
paths: shape[k],
|
|
1204
1040
|
censor: wrappedCensor,
|
|
1205
1041
|
serialize,
|
|
1206
|
-
strict
|
|
1042
|
+
strict,
|
|
1043
|
+
remove
|
|
1207
1044
|
});
|
|
1208
1045
|
}
|
|
1209
1046
|
return o;
|
|
@@ -1216,7 +1053,6 @@ var require_redaction = __commonJS({
|
|
|
1216
1053
|
paths: opts,
|
|
1217
1054
|
censor: CENSOR
|
|
1218
1055
|
};
|
|
1219
|
-
validate(opts);
|
|
1220
1056
|
return opts;
|
|
1221
1057
|
}
|
|
1222
1058
|
let { paths, censor = CENSOR, remove } = opts;
|
|
@@ -1224,13 +1060,10 @@ var require_redaction = __commonJS({
|
|
|
1224
1060
|
throw Error("pino \u2013 redact must contain an array of strings");
|
|
1225
1061
|
}
|
|
1226
1062
|
if (remove === true) censor = void 0;
|
|
1227
|
-
validate({
|
|
1228
|
-
paths,
|
|
1229
|
-
censor
|
|
1230
|
-
});
|
|
1231
1063
|
return {
|
|
1232
1064
|
paths,
|
|
1233
|
-
censor
|
|
1065
|
+
censor,
|
|
1066
|
+
remove
|
|
1234
1067
|
};
|
|
1235
1068
|
}
|
|
1236
1069
|
__name(handle, "handle");
|
|
@@ -3045,7 +2878,7 @@ var require_tools = __commonJS({
|
|
|
3045
2878
|
bindings = formatter(bindings);
|
|
3046
2879
|
for (const key in bindings) {
|
|
3047
2880
|
value = bindings[key];
|
|
3048
|
-
const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
|
|
2881
|
+
const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0;
|
|
3049
2882
|
if (valid === true) {
|
|
3050
2883
|
value = serializers[key] ? serializers[key](value) : value;
|
|
3051
2884
|
value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
|
|
@@ -3419,7 +3252,7 @@ var require_meta = __commonJS({
|
|
|
3419
3252
|
"node_modules/pino/lib/meta.js"(exports2, module2) {
|
|
3420
3253
|
"use strict";
|
|
3421
3254
|
module2.exports = {
|
|
3422
|
-
version: "9.
|
|
3255
|
+
version: "9.14.0"
|
|
3423
3256
|
};
|
|
3424
3257
|
}
|
|
3425
3258
|
});
|
|
@@ -3431,7 +3264,7 @@ var require_proto = __commonJS({
|
|
|
3431
3264
|
var { EventEmitter } = require("events");
|
|
3432
3265
|
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();
|
|
3433
3266
|
var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
|
|
3434
|
-
var { asChindings, asJson, buildFormatters, stringify } = require_tools();
|
|
3267
|
+
var { asChindings, asJson, buildFormatters, stringify, noop } = require_tools();
|
|
3435
3268
|
var { version } = require_meta();
|
|
3436
3269
|
var redaction = require_redaction();
|
|
3437
3270
|
var _a3;
|
|
@@ -3478,10 +3311,20 @@ var require_proto = __commonJS({
|
|
|
3478
3311
|
if (!bindings2) {
|
|
3479
3312
|
throw Error("missing bindings for child Pino");
|
|
3480
3313
|
}
|
|
3481
|
-
options = options || {};
|
|
3482
3314
|
const serializers = this[serializersSym];
|
|
3483
3315
|
const formatters = this[formattersSym];
|
|
3484
3316
|
const instance = Object.create(this);
|
|
3317
|
+
if (options == null) {
|
|
3318
|
+
if (instance[formattersSym].bindings !== resetChildingsFormatter) {
|
|
3319
|
+
instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
3320
|
+
}
|
|
3321
|
+
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
3322
|
+
instance[setLevelSym](this.level);
|
|
3323
|
+
if (this.onChild !== noop) {
|
|
3324
|
+
this.onChild(instance);
|
|
3325
|
+
}
|
|
3326
|
+
return instance;
|
|
3327
|
+
}
|
|
3485
3328
|
if (options.hasOwnProperty("serializers") === true) {
|
|
3486
3329
|
instance[serializersSym] = /* @__PURE__ */ Object.create(null);
|
|
3487
3330
|
for (const k in serializers) {
|
|
@@ -3526,10 +3369,8 @@ var require_proto = __commonJS({
|
|
|
3526
3369
|
instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
|
|
3527
3370
|
}
|
|
3528
3371
|
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
instance[setLevelSym](childLevel);
|
|
3532
|
-
}
|
|
3372
|
+
const childLevel = options.level || this.level;
|
|
3373
|
+
instance[setLevelSym](childLevel);
|
|
3533
3374
|
this.onChild(instance);
|
|
3534
3375
|
return instance;
|
|
3535
3376
|
}
|
|
@@ -3591,9 +3432,6 @@ var require_proto = __commonJS({
|
|
|
3591
3432
|
stream.write(streamWriteHook ? streamWriteHook(s) : s);
|
|
3592
3433
|
}
|
|
3593
3434
|
__name(write, "write");
|
|
3594
|
-
function noop() {
|
|
3595
|
-
}
|
|
3596
|
-
__name(noop, "noop");
|
|
3597
3435
|
function flush(cb) {
|
|
3598
3436
|
if (cb != null && typeof cb !== "function") {
|
|
3599
3437
|
throw Error("callback must be a function");
|
|
@@ -5387,11 +5225,14 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5387
5225
|
if (_ApitallyClient.instance) {
|
|
5388
5226
|
throw new Error("Apitally client is already initialized");
|
|
5389
5227
|
}
|
|
5228
|
+
this.logger = logger ?? getLogger();
|
|
5390
5229
|
if (!isValidClientId(clientId)) {
|
|
5391
|
-
|
|
5230
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
5231
|
+
this.enabled = false;
|
|
5392
5232
|
}
|
|
5393
5233
|
if (!isValidEnv(env)) {
|
|
5394
|
-
|
|
5234
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
5235
|
+
this.enabled = false;
|
|
5395
5236
|
}
|
|
5396
5237
|
if (requestLoggingConfig && !requestLogging) {
|
|
5397
5238
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -5406,8 +5247,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5406
5247
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
5407
5248
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
5408
5249
|
this.consumerRegistry = new ConsumerRegistry();
|
|
5409
|
-
this.logger = logger ?? getLogger();
|
|
5410
|
-
this.startSync();
|
|
5411
5250
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
5412
5251
|
}
|
|
5413
5252
|
static getInstance() {
|
|
@@ -5462,15 +5301,20 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5462
5301
|
}
|
|
5463
5302
|
}
|
|
5464
5303
|
startSync() {
|
|
5304
|
+
if (!this.enabled) {
|
|
5305
|
+
return;
|
|
5306
|
+
}
|
|
5465
5307
|
this.sync();
|
|
5466
5308
|
this.syncIntervalId = setInterval(() => {
|
|
5467
5309
|
this.sync();
|
|
5468
5310
|
}, INITIAL_SYNC_INTERVAL);
|
|
5469
5311
|
setTimeout(() => {
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
this.
|
|
5473
|
-
|
|
5312
|
+
if (this.syncIntervalId) {
|
|
5313
|
+
clearInterval(this.syncIntervalId);
|
|
5314
|
+
this.syncIntervalId = setInterval(() => {
|
|
5315
|
+
this.sync();
|
|
5316
|
+
}, SYNC_INTERVAL);
|
|
5317
|
+
}
|
|
5474
5318
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
5475
5319
|
}
|
|
5476
5320
|
async sync() {
|
|
@@ -5498,7 +5342,6 @@ var _ApitallyClient = class _ApitallyClient {
|
|
|
5498
5342
|
setStartupData(data) {
|
|
5499
5343
|
this.startupData = data;
|
|
5500
5344
|
this.startupDataSent = false;
|
|
5501
|
-
this.sendStartupData();
|
|
5502
5345
|
}
|
|
5503
5346
|
async sendStartupData() {
|
|
5504
5347
|
if (this.startupData) {
|
|
@@ -5871,6 +5714,7 @@ var _ApitallyProvider = class _ApitallyProvider {
|
|
|
5871
5714
|
client: "js:adonisjs"
|
|
5872
5715
|
};
|
|
5873
5716
|
client.setStartupData(startupData);
|
|
5717
|
+
client.startSync();
|
|
5874
5718
|
}
|
|
5875
5719
|
async shutdown() {
|
|
5876
5720
|
const client = await this.app.container.make("apitallyClient");
|