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/nestjs/index.js
CHANGED
|
@@ -12825,619 +12825,458 @@ var require_caller = __commonJS({
|
|
|
12825
12825
|
}
|
|
12826
12826
|
});
|
|
12827
12827
|
|
|
12828
|
-
// node_modules/
|
|
12829
|
-
var
|
|
12830
|
-
"node_modules/
|
|
12831
|
-
"use strict";
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12828
|
+
// node_modules/@pinojs/redact/index.js
|
|
12829
|
+
var require_redact = __commonJS({
|
|
12830
|
+
"node_modules/@pinojs/redact/index.js"(exports, module) {
|
|
12831
|
+
"use strict";
|
|
12832
|
+
function deepClone(obj) {
|
|
12833
|
+
if (obj === null || typeof obj !== "object") {
|
|
12834
|
+
return obj;
|
|
12835
|
+
}
|
|
12836
|
+
if (obj instanceof Date) {
|
|
12837
|
+
return new Date(obj.getTime());
|
|
12838
|
+
}
|
|
12839
|
+
if (obj instanceof Array) {
|
|
12840
|
+
const cloned = [];
|
|
12841
|
+
for (let i = 0; i < obj.length; i++) {
|
|
12842
|
+
cloned[i] = deepClone(obj[i]);
|
|
12843
|
+
}
|
|
12844
|
+
return cloned;
|
|
12845
|
+
}
|
|
12846
|
+
if (typeof obj === "object") {
|
|
12847
|
+
const cloned = Object.create(Object.getPrototypeOf(obj));
|
|
12848
|
+
for (const key in obj) {
|
|
12849
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
12850
|
+
cloned[key] = deepClone(obj[key]);
|
|
12839
12851
|
}
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12852
|
+
}
|
|
12853
|
+
return cloned;
|
|
12854
|
+
}
|
|
12855
|
+
return obj;
|
|
12856
|
+
}
|
|
12857
|
+
__name(deepClone, "deepClone");
|
|
12858
|
+
function parsePath(path) {
|
|
12859
|
+
const parts = [];
|
|
12860
|
+
let current = "";
|
|
12861
|
+
let inBrackets = false;
|
|
12862
|
+
let inQuotes = false;
|
|
12863
|
+
let quoteChar = "";
|
|
12864
|
+
for (let i = 0; i < path.length; i++) {
|
|
12865
|
+
const char = path[i];
|
|
12866
|
+
if (!inBrackets && char === ".") {
|
|
12867
|
+
if (current) {
|
|
12868
|
+
parts.push(current);
|
|
12869
|
+
current = "";
|
|
12870
|
+
}
|
|
12871
|
+
} else if (char === "[") {
|
|
12872
|
+
if (current) {
|
|
12873
|
+
parts.push(current);
|
|
12874
|
+
current = "";
|
|
12875
|
+
}
|
|
12876
|
+
inBrackets = true;
|
|
12877
|
+
} else if (char === "]" && inBrackets) {
|
|
12878
|
+
parts.push(current);
|
|
12879
|
+
current = "";
|
|
12880
|
+
inBrackets = false;
|
|
12881
|
+
inQuotes = false;
|
|
12882
|
+
} else if ((char === '"' || char === "'") && inBrackets) {
|
|
12883
|
+
if (!inQuotes) {
|
|
12884
|
+
inQuotes = true;
|
|
12885
|
+
quoteChar = char;
|
|
12886
|
+
} else if (char === quoteChar) {
|
|
12887
|
+
inQuotes = false;
|
|
12888
|
+
quoteChar = "";
|
|
12889
|
+
} else {
|
|
12890
|
+
current += char;
|
|
12853
12891
|
}
|
|
12854
|
-
});
|
|
12855
|
-
}, "validate");
|
|
12856
|
-
}
|
|
12857
|
-
__name(validator, "validator");
|
|
12858
|
-
}
|
|
12859
|
-
});
|
|
12860
|
-
|
|
12861
|
-
// node_modules/fast-redact/lib/rx.js
|
|
12862
|
-
var require_rx = __commonJS({
|
|
12863
|
-
"node_modules/fast-redact/lib/rx.js"(exports, module) {
|
|
12864
|
-
"use strict";
|
|
12865
|
-
module.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
|
|
12866
|
-
}
|
|
12867
|
-
});
|
|
12868
|
-
|
|
12869
|
-
// node_modules/fast-redact/lib/parse.js
|
|
12870
|
-
var require_parse = __commonJS({
|
|
12871
|
-
"node_modules/fast-redact/lib/parse.js"(exports, module) {
|
|
12872
|
-
"use strict";
|
|
12873
|
-
var rx = require_rx();
|
|
12874
|
-
module.exports = parse;
|
|
12875
|
-
function parse({ paths }) {
|
|
12876
|
-
const wildcards = [];
|
|
12877
|
-
var wcLen = 0;
|
|
12878
|
-
const secret = paths.reduce(function(o, strPath, ix) {
|
|
12879
|
-
var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
|
|
12880
|
-
const leadingBracket = strPath[0] === "[";
|
|
12881
|
-
path = path.map((p) => {
|
|
12882
|
-
if (p[0] === "[") return p.substr(1, p.length - 2);
|
|
12883
|
-
else return p;
|
|
12884
|
-
});
|
|
12885
|
-
const star = path.indexOf("*");
|
|
12886
|
-
if (star > -1) {
|
|
12887
|
-
const before = path.slice(0, star);
|
|
12888
|
-
const beforeStr = before.join(".");
|
|
12889
|
-
const after = path.slice(star + 1, path.length);
|
|
12890
|
-
const nested = after.length > 0;
|
|
12891
|
-
wcLen++;
|
|
12892
|
-
wildcards.push({
|
|
12893
|
-
before,
|
|
12894
|
-
beforeStr,
|
|
12895
|
-
after,
|
|
12896
|
-
nested
|
|
12897
|
-
});
|
|
12898
12892
|
} else {
|
|
12899
|
-
|
|
12900
|
-
path,
|
|
12901
|
-
val: void 0,
|
|
12902
|
-
precensored: false,
|
|
12903
|
-
circle: "",
|
|
12904
|
-
escPath: JSON.stringify(strPath),
|
|
12905
|
-
leadingBracket
|
|
12906
|
-
};
|
|
12893
|
+
current += char;
|
|
12907
12894
|
}
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
secret
|
|
12914
|
-
};
|
|
12895
|
+
}
|
|
12896
|
+
if (current) {
|
|
12897
|
+
parts.push(current);
|
|
12898
|
+
}
|
|
12899
|
+
return parts;
|
|
12915
12900
|
}
|
|
12916
|
-
__name(
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
"use strict";
|
|
12924
|
-
var rx = require_rx();
|
|
12925
|
-
module.exports = redactor;
|
|
12926
|
-
function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) {
|
|
12927
|
-
const redact = Function("o", `
|
|
12928
|
-
if (typeof o !== 'object' || o == null) {
|
|
12929
|
-
${strictImpl(strict, serialize)}
|
|
12930
|
-
}
|
|
12931
|
-
const { censor, secret } = this
|
|
12932
|
-
const originalSecret = {}
|
|
12933
|
-
const secretKeys = Object.keys(secret)
|
|
12934
|
-
for (var i = 0; i < secretKeys.length; i++) {
|
|
12935
|
-
originalSecret[secretKeys[i]] = secret[secretKeys[i]]
|
|
12936
|
-
}
|
|
12937
|
-
|
|
12938
|
-
${redactTmpl(secret, isCensorFct, censorFctTakesPath)}
|
|
12939
|
-
this.compileRestore()
|
|
12940
|
-
${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)}
|
|
12941
|
-
this.secret = originalSecret
|
|
12942
|
-
${resultTmpl(serialize)}
|
|
12943
|
-
`).bind(state);
|
|
12944
|
-
redact.state = state;
|
|
12945
|
-
if (serialize === false) {
|
|
12946
|
-
redact.restore = (o) => state.restore(o);
|
|
12947
|
-
}
|
|
12948
|
-
return redact;
|
|
12949
|
-
}
|
|
12950
|
-
__name(redactor, "redactor");
|
|
12951
|
-
function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
|
|
12952
|
-
return Object.keys(secret).map((path) => {
|
|
12953
|
-
const { escPath, leadingBracket, path: arrPath } = secret[path];
|
|
12954
|
-
const skip = leadingBracket ? 1 : 0;
|
|
12955
|
-
const delim = leadingBracket ? "" : ".";
|
|
12956
|
-
const hops = [];
|
|
12957
|
-
var match;
|
|
12958
|
-
while ((match = rx.exec(path)) !== null) {
|
|
12959
|
-
const [, ix] = match;
|
|
12960
|
-
const { index, input } = match;
|
|
12961
|
-
if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1)));
|
|
12962
|
-
}
|
|
12963
|
-
var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
|
|
12964
|
-
if (existence.length === 0) existence += `o${delim}${path} != null`;
|
|
12965
|
-
else existence += ` && o${delim}${path} != null`;
|
|
12966
|
-
const circularDetection = `
|
|
12967
|
-
switch (true) {
|
|
12968
|
-
${hops.reverse().map((p) => `
|
|
12969
|
-
case o${delim}${p} === censor:
|
|
12970
|
-
secret[${escPath}].circle = ${JSON.stringify(p)}
|
|
12971
|
-
break
|
|
12972
|
-
`).join("\n")}
|
|
12973
|
-
}
|
|
12974
|
-
`;
|
|
12975
|
-
const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
|
|
12976
|
-
return `
|
|
12977
|
-
if (${existence}) {
|
|
12978
|
-
const val = o${delim}${path}
|
|
12979
|
-
if (val === censor) {
|
|
12980
|
-
secret[${escPath}].precensored = true
|
|
12981
|
-
} else {
|
|
12982
|
-
secret[${escPath}].val = val
|
|
12983
|
-
o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
|
|
12984
|
-
${circularDetection}
|
|
12901
|
+
__name(parsePath, "parsePath");
|
|
12902
|
+
function setValue(obj, parts, value) {
|
|
12903
|
+
let current = obj;
|
|
12904
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
12905
|
+
const key = parts[i];
|
|
12906
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
12907
|
+
return false;
|
|
12985
12908
|
}
|
|
12909
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
12910
|
+
return false;
|
|
12911
|
+
}
|
|
12912
|
+
current = current[key];
|
|
12986
12913
|
}
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
12914
|
+
const lastKey = parts[parts.length - 1];
|
|
12915
|
+
if (lastKey === "*") {
|
|
12916
|
+
if (Array.isArray(current)) {
|
|
12917
|
+
for (let i = 0; i < current.length; i++) {
|
|
12918
|
+
current[i] = value;
|
|
12919
|
+
}
|
|
12920
|
+
} else if (typeof current === "object" && current !== null) {
|
|
12921
|
+
for (const key in current) {
|
|
12922
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
12923
|
+
current[key] = value;
|
|
12924
|
+
}
|
|
12925
|
+
}
|
|
12926
|
+
}
|
|
12927
|
+
} else {
|
|
12928
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
12929
|
+
current[lastKey] = value;
|
|
12930
|
+
}
|
|
13001
12931
|
}
|
|
12932
|
+
return true;
|
|
13002
12933
|
}
|
|
13003
|
-
|
|
12934
|
+
__name(setValue, "setValue");
|
|
12935
|
+
function removeKey(obj, parts) {
|
|
12936
|
+
let current = obj;
|
|
12937
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
12938
|
+
const key = parts[i];
|
|
12939
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
12940
|
+
return false;
|
|
12941
|
+
}
|
|
12942
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
12943
|
+
return false;
|
|
12944
|
+
}
|
|
12945
|
+
current = current[key];
|
|
12946
|
+
}
|
|
12947
|
+
const lastKey = parts[parts.length - 1];
|
|
12948
|
+
if (lastKey === "*") {
|
|
12949
|
+
if (Array.isArray(current)) {
|
|
12950
|
+
for (let i = 0; i < current.length; i++) {
|
|
12951
|
+
current[i] = void 0;
|
|
12952
|
+
}
|
|
12953
|
+
} else if (typeof current === "object" && current !== null) {
|
|
12954
|
+
for (const key in current) {
|
|
12955
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
12956
|
+
delete current[key];
|
|
12957
|
+
}
|
|
12958
|
+
}
|
|
12959
|
+
}
|
|
12960
|
+
} else {
|
|
12961
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
12962
|
+
delete current[lastKey];
|
|
12963
|
+
}
|
|
12964
|
+
}
|
|
12965
|
+
return true;
|
|
13004
12966
|
}
|
|
13005
|
-
__name(
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
12967
|
+
__name(removeKey, "removeKey");
|
|
12968
|
+
var PATH_NOT_FOUND = Symbol("PATH_NOT_FOUND");
|
|
12969
|
+
function getValueIfExists(obj, parts) {
|
|
12970
|
+
let current = obj;
|
|
12971
|
+
for (const part of parts) {
|
|
12972
|
+
if (current === null || current === void 0) {
|
|
12973
|
+
return PATH_NOT_FOUND;
|
|
12974
|
+
}
|
|
12975
|
+
if (typeof current !== "object" || current === null) {
|
|
12976
|
+
return PATH_NOT_FOUND;
|
|
12977
|
+
}
|
|
12978
|
+
if (!(part in current)) {
|
|
12979
|
+
return PATH_NOT_FOUND;
|
|
12980
|
+
}
|
|
12981
|
+
current = current[part];
|
|
12982
|
+
}
|
|
12983
|
+
return current;
|
|
13012
12984
|
}
|
|
13013
|
-
__name(
|
|
13014
|
-
function
|
|
13015
|
-
|
|
12985
|
+
__name(getValueIfExists, "getValueIfExists");
|
|
12986
|
+
function getValue(obj, parts) {
|
|
12987
|
+
let current = obj;
|
|
12988
|
+
for (const part of parts) {
|
|
12989
|
+
if (current === null || current === void 0) {
|
|
12990
|
+
return void 0;
|
|
12991
|
+
}
|
|
12992
|
+
if (typeof current !== "object" || current === null) {
|
|
12993
|
+
return void 0;
|
|
12994
|
+
}
|
|
12995
|
+
current = current[part];
|
|
12996
|
+
}
|
|
12997
|
+
return current;
|
|
13016
12998
|
}
|
|
13017
|
-
__name(
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
"node_modules/fast-redact/lib/modifiers.js"(exports, module) {
|
|
13024
|
-
"use strict";
|
|
13025
|
-
module.exports = {
|
|
13026
|
-
groupRedact,
|
|
13027
|
-
groupRestore,
|
|
13028
|
-
nestedRedact,
|
|
13029
|
-
nestedRestore
|
|
13030
|
-
};
|
|
13031
|
-
function groupRestore({ keys, values, target }) {
|
|
13032
|
-
if (target == null || typeof target === "string") return;
|
|
13033
|
-
const length = keys.length;
|
|
13034
|
-
for (var i = 0; i < length; i++) {
|
|
13035
|
-
const k = keys[i];
|
|
13036
|
-
target[k] = values[i];
|
|
13037
|
-
}
|
|
13038
|
-
}
|
|
13039
|
-
__name(groupRestore, "groupRestore");
|
|
13040
|
-
function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
|
|
13041
|
-
const target = get(o, path);
|
|
13042
|
-
if (target == null || typeof target === "string") return {
|
|
13043
|
-
keys: null,
|
|
13044
|
-
values: null,
|
|
13045
|
-
target,
|
|
13046
|
-
flat: true
|
|
13047
|
-
};
|
|
13048
|
-
const keys = Object.keys(target);
|
|
13049
|
-
const keysLength = keys.length;
|
|
13050
|
-
const pathLength = path.length;
|
|
13051
|
-
const pathWithKey = censorFctTakesPath ? [
|
|
13052
|
-
...path
|
|
13053
|
-
] : void 0;
|
|
13054
|
-
const values = new Array(keysLength);
|
|
13055
|
-
for (var i = 0; i < keysLength; i++) {
|
|
13056
|
-
const key = keys[i];
|
|
13057
|
-
values[i] = target[key];
|
|
13058
|
-
if (censorFctTakesPath) {
|
|
13059
|
-
pathWithKey[pathLength] = key;
|
|
13060
|
-
target[key] = censor(target[key], pathWithKey);
|
|
13061
|
-
} else if (isCensorFct) {
|
|
13062
|
-
target[key] = censor(target[key]);
|
|
12999
|
+
__name(getValue, "getValue");
|
|
13000
|
+
function redactPaths(obj, paths, censor, remove = false) {
|
|
13001
|
+
for (const path of paths) {
|
|
13002
|
+
const parts = parsePath(path);
|
|
13003
|
+
if (parts.includes("*")) {
|
|
13004
|
+
redactWildcardPath(obj, parts, censor, path, remove);
|
|
13063
13005
|
} else {
|
|
13064
|
-
|
|
13006
|
+
if (remove) {
|
|
13007
|
+
removeKey(obj, parts);
|
|
13008
|
+
} else {
|
|
13009
|
+
const value = getValueIfExists(obj, parts);
|
|
13010
|
+
if (value === PATH_NOT_FOUND) {
|
|
13011
|
+
continue;
|
|
13012
|
+
}
|
|
13013
|
+
const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
|
|
13014
|
+
setValue(obj, parts, actualCensor);
|
|
13015
|
+
}
|
|
13065
13016
|
}
|
|
13066
13017
|
}
|
|
13067
|
-
return {
|
|
13068
|
-
keys,
|
|
13069
|
-
values,
|
|
13070
|
-
target,
|
|
13071
|
-
flat: true
|
|
13072
|
-
};
|
|
13073
13018
|
}
|
|
13074
|
-
__name(
|
|
13075
|
-
function
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
}
|
|
13085
|
-
__name(nestedRestore, "nestedRestore");
|
|
13086
|
-
function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
|
|
13087
|
-
const target = get(o, path);
|
|
13088
|
-
if (target == null) return;
|
|
13089
|
-
const keys = Object.keys(target);
|
|
13090
|
-
const keysLength = keys.length;
|
|
13091
|
-
for (var i = 0; i < keysLength; i++) {
|
|
13092
|
-
const key = keys[i];
|
|
13093
|
-
specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
|
|
13094
|
-
}
|
|
13095
|
-
return store;
|
|
13096
|
-
}
|
|
13097
|
-
__name(nestedRedact, "nestedRedact");
|
|
13098
|
-
function has(obj, prop) {
|
|
13099
|
-
return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
|
|
13100
|
-
}
|
|
13101
|
-
__name(has, "has");
|
|
13102
|
-
function specialSet(store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
|
|
13103
|
-
const afterPathLen = afterPath.length;
|
|
13104
|
-
const lastPathIndex = afterPathLen - 1;
|
|
13105
|
-
const originalKey = k;
|
|
13106
|
-
var i = -1;
|
|
13107
|
-
var n;
|
|
13108
|
-
var nv;
|
|
13109
|
-
var ov;
|
|
13110
|
-
var oov = null;
|
|
13111
|
-
var wc = null;
|
|
13112
|
-
var kIsWc;
|
|
13113
|
-
var wcov;
|
|
13114
|
-
var consecutive = false;
|
|
13115
|
-
var level = 0;
|
|
13116
|
-
var depth = 0;
|
|
13117
|
-
var redactPathCurrent = tree();
|
|
13118
|
-
ov = n = o[k];
|
|
13119
|
-
if (typeof n !== "object") return;
|
|
13120
|
-
while (n != null && ++i < afterPathLen) {
|
|
13121
|
-
depth += 1;
|
|
13122
|
-
k = afterPath[i];
|
|
13123
|
-
oov = ov;
|
|
13124
|
-
if (k !== "*" && !wc && !(typeof n === "object" && k in n)) {
|
|
13125
|
-
break;
|
|
13019
|
+
__name(redactPaths, "redactPaths");
|
|
13020
|
+
function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
|
|
13021
|
+
const wildcardIndex = parts.indexOf("*");
|
|
13022
|
+
if (wildcardIndex === parts.length - 1) {
|
|
13023
|
+
const parentParts = parts.slice(0, -1);
|
|
13024
|
+
let current = obj;
|
|
13025
|
+
for (const part of parentParts) {
|
|
13026
|
+
if (current === null || current === void 0) return;
|
|
13027
|
+
if (typeof current !== "object" || current === null) return;
|
|
13028
|
+
current = current[part];
|
|
13126
13029
|
}
|
|
13127
|
-
if (
|
|
13128
|
-
if (
|
|
13129
|
-
|
|
13030
|
+
if (Array.isArray(current)) {
|
|
13031
|
+
if (remove) {
|
|
13032
|
+
for (let i = 0; i < current.length; i++) {
|
|
13033
|
+
current[i] = void 0;
|
|
13034
|
+
}
|
|
13035
|
+
} else {
|
|
13036
|
+
for (let i = 0; i < current.length; i++) {
|
|
13037
|
+
const indexPath = [
|
|
13038
|
+
...parentParts,
|
|
13039
|
+
i.toString()
|
|
13040
|
+
];
|
|
13041
|
+
const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor;
|
|
13042
|
+
current[i] = actualCensor;
|
|
13043
|
+
}
|
|
13130
13044
|
}
|
|
13131
|
-
|
|
13132
|
-
if (
|
|
13133
|
-
|
|
13045
|
+
} else if (typeof current === "object" && current !== null) {
|
|
13046
|
+
if (remove) {
|
|
13047
|
+
const keysToDelete = [];
|
|
13048
|
+
for (const key in current) {
|
|
13049
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
13050
|
+
keysToDelete.push(key);
|
|
13051
|
+
}
|
|
13052
|
+
}
|
|
13053
|
+
for (const key of keysToDelete) {
|
|
13054
|
+
delete current[key];
|
|
13055
|
+
}
|
|
13056
|
+
} else {
|
|
13057
|
+
for (const key in current) {
|
|
13058
|
+
const keyPath = [
|
|
13059
|
+
...parentParts,
|
|
13060
|
+
key
|
|
13061
|
+
];
|
|
13062
|
+
const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor;
|
|
13063
|
+
current[key] = actualCensor;
|
|
13064
|
+
}
|
|
13134
13065
|
}
|
|
13135
13066
|
}
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
...afterPath
|
|
13157
|
-
]) : censor(ov) : censor;
|
|
13158
|
-
if (kIsWc) {
|
|
13159
|
-
const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
|
|
13160
|
-
store.push(rv);
|
|
13161
|
-
n[wck] = nv;
|
|
13162
|
-
} else {
|
|
13163
|
-
if (wcov[k] === nv) {
|
|
13164
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
13165
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
13166
|
-
} else {
|
|
13167
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
13168
|
-
const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]);
|
|
13169
|
-
store.push(rv);
|
|
13170
|
-
wcov[k] = nv;
|
|
13171
|
-
}
|
|
13172
|
-
}
|
|
13173
|
-
}
|
|
13067
|
+
} else {
|
|
13068
|
+
redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
|
|
13069
|
+
}
|
|
13070
|
+
}
|
|
13071
|
+
__name(redactWildcardPath, "redactWildcardPath");
|
|
13072
|
+
function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
|
|
13073
|
+
const beforeWildcard = parts.slice(0, wildcardIndex);
|
|
13074
|
+
const afterWildcard = parts.slice(wildcardIndex + 1);
|
|
13075
|
+
const pathArray = [];
|
|
13076
|
+
function traverse(current, pathLength) {
|
|
13077
|
+
if (pathLength === beforeWildcard.length) {
|
|
13078
|
+
if (Array.isArray(current)) {
|
|
13079
|
+
for (let i = 0; i < current.length; i++) {
|
|
13080
|
+
pathArray[pathLength] = i.toString();
|
|
13081
|
+
traverse(current[i], pathLength + 1);
|
|
13082
|
+
}
|
|
13083
|
+
} else if (typeof current === "object" && current !== null) {
|
|
13084
|
+
for (const key in current) {
|
|
13085
|
+
pathArray[pathLength] = key;
|
|
13086
|
+
traverse(current[key], pathLength + 1);
|
|
13174
13087
|
}
|
|
13175
13088
|
}
|
|
13176
|
-
|
|
13089
|
+
} else if (pathLength < beforeWildcard.length) {
|
|
13090
|
+
const nextKey = beforeWildcard[pathLength];
|
|
13091
|
+
if (current && typeof current === "object" && current !== null && nextKey in current) {
|
|
13092
|
+
pathArray[pathLength] = nextKey;
|
|
13093
|
+
traverse(current[nextKey], pathLength + 1);
|
|
13094
|
+
}
|
|
13177
13095
|
} else {
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13096
|
+
if (afterWildcard.includes("*")) {
|
|
13097
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
13098
|
+
const fullPath = [
|
|
13099
|
+
...pathArray.slice(0, pathLength),
|
|
13100
|
+
...path
|
|
13101
|
+
];
|
|
13102
|
+
return censor(value, fullPath);
|
|
13103
|
+
} : censor;
|
|
13104
|
+
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
13186
13105
|
} else {
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13106
|
+
if (remove) {
|
|
13107
|
+
removeKey(current, afterWildcard);
|
|
13108
|
+
} else {
|
|
13109
|
+
const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [
|
|
13110
|
+
...pathArray.slice(0, pathLength),
|
|
13111
|
+
...afterWildcard
|
|
13112
|
+
]) : censor;
|
|
13113
|
+
setValue(current, afterWildcard, actualCensor);
|
|
13114
|
+
}
|
|
13190
13115
|
}
|
|
13191
|
-
n = n[k];
|
|
13192
13116
|
}
|
|
13193
|
-
|
|
13194
|
-
|
|
13117
|
+
}
|
|
13118
|
+
__name(traverse, "traverse");
|
|
13119
|
+
if (beforeWildcard.length === 0) {
|
|
13120
|
+
traverse(obj, 0);
|
|
13121
|
+
} else {
|
|
13122
|
+
let current = obj;
|
|
13123
|
+
for (let i = 0; i < beforeWildcard.length; i++) {
|
|
13124
|
+
const part = beforeWildcard[i];
|
|
13125
|
+
if (current === null || current === void 0) return;
|
|
13126
|
+
if (typeof current !== "object" || current === null) return;
|
|
13127
|
+
current = current[part];
|
|
13128
|
+
pathArray[i] = part;
|
|
13129
|
+
}
|
|
13130
|
+
if (current !== null && current !== void 0) {
|
|
13131
|
+
traverse(current, beforeWildcard.length);
|
|
13132
|
+
}
|
|
13133
|
+
}
|
|
13134
|
+
}
|
|
13135
|
+
__name(redactIntermediateWildcard, "redactIntermediateWildcard");
|
|
13136
|
+
function buildPathStructure(pathsToClone) {
|
|
13137
|
+
if (pathsToClone.length === 0) {
|
|
13138
|
+
return null;
|
|
13139
|
+
}
|
|
13140
|
+
const pathStructure = /* @__PURE__ */ new Map();
|
|
13141
|
+
for (const path of pathsToClone) {
|
|
13142
|
+
const parts = parsePath(path);
|
|
13143
|
+
let current = pathStructure;
|
|
13144
|
+
for (let i = 0; i < parts.length; i++) {
|
|
13145
|
+
const part = parts[i];
|
|
13146
|
+
if (!current.has(part)) {
|
|
13147
|
+
current.set(part, /* @__PURE__ */ new Map());
|
|
13148
|
+
}
|
|
13149
|
+
current = current.get(part);
|
|
13195
13150
|
}
|
|
13196
13151
|
}
|
|
13152
|
+
return pathStructure;
|
|
13197
13153
|
}
|
|
13198
|
-
__name(
|
|
13199
|
-
function
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
var n = o;
|
|
13203
|
-
while (n != null && ++i < l) {
|
|
13204
|
-
n = n[p[i]];
|
|
13154
|
+
__name(buildPathStructure, "buildPathStructure");
|
|
13155
|
+
function selectiveClone(obj, pathStructure) {
|
|
13156
|
+
if (!pathStructure) {
|
|
13157
|
+
return obj;
|
|
13205
13158
|
}
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13159
|
+
function cloneSelectively(source, pathMap, depth = 0) {
|
|
13160
|
+
if (!pathMap || pathMap.size === 0) {
|
|
13161
|
+
return source;
|
|
13162
|
+
}
|
|
13163
|
+
if (source === null || typeof source !== "object") {
|
|
13164
|
+
return source;
|
|
13165
|
+
}
|
|
13166
|
+
if (source instanceof Date) {
|
|
13167
|
+
return new Date(source.getTime());
|
|
13168
|
+
}
|
|
13169
|
+
if (Array.isArray(source)) {
|
|
13170
|
+
const cloned2 = [];
|
|
13171
|
+
for (let i = 0; i < source.length; i++) {
|
|
13172
|
+
const indexStr = i.toString();
|
|
13173
|
+
if (pathMap.has(indexStr) || pathMap.has("*")) {
|
|
13174
|
+
cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*"));
|
|
13175
|
+
} else {
|
|
13176
|
+
cloned2[i] = source[i];
|
|
13177
|
+
}
|
|
13216
13178
|
}
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
store.push(rv);
|
|
13225
|
-
n[wck] = nv;
|
|
13226
|
-
} else {
|
|
13227
|
-
if (wcov[k] === nv) {
|
|
13228
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
13179
|
+
return cloned2;
|
|
13180
|
+
}
|
|
13181
|
+
const cloned = Object.create(Object.getPrototypeOf(source));
|
|
13182
|
+
for (const key in source) {
|
|
13183
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13184
|
+
if (pathMap.has(key) || pathMap.has("*")) {
|
|
13185
|
+
cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*"));
|
|
13229
13186
|
} else {
|
|
13230
|
-
|
|
13231
|
-
store.push(rv);
|
|
13232
|
-
wcov[k] = nv;
|
|
13187
|
+
cloned[key] = source[key];
|
|
13233
13188
|
}
|
|
13234
13189
|
}
|
|
13235
13190
|
}
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13191
|
+
return cloned;
|
|
13192
|
+
}
|
|
13193
|
+
__name(cloneSelectively, "cloneSelectively");
|
|
13194
|
+
return cloneSelectively(obj, pathStructure);
|
|
13195
|
+
}
|
|
13196
|
+
__name(selectiveClone, "selectiveClone");
|
|
13197
|
+
function validatePath(path) {
|
|
13198
|
+
if (typeof path !== "string") {
|
|
13199
|
+
throw new Error("Paths must be (non-empty) strings");
|
|
13200
|
+
}
|
|
13201
|
+
if (path === "") {
|
|
13202
|
+
throw new Error("Invalid redaction path ()");
|
|
13203
|
+
}
|
|
13204
|
+
if (path.includes("..")) {
|
|
13205
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13206
|
+
}
|
|
13207
|
+
if (path.includes(",")) {
|
|
13208
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13209
|
+
}
|
|
13210
|
+
let bracketCount = 0;
|
|
13211
|
+
let inQuotes = false;
|
|
13212
|
+
let quoteChar = "";
|
|
13213
|
+
for (let i = 0; i < path.length; i++) {
|
|
13214
|
+
const char = path[i];
|
|
13215
|
+
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
13216
|
+
if (!inQuotes) {
|
|
13217
|
+
inQuotes = true;
|
|
13218
|
+
quoteChar = char;
|
|
13219
|
+
} else if (char === quoteChar) {
|
|
13220
|
+
inQuotes = false;
|
|
13221
|
+
quoteChar = "";
|
|
13222
|
+
}
|
|
13223
|
+
} else if (char === "[" && !inQuotes) {
|
|
13224
|
+
bracketCount++;
|
|
13225
|
+
} else if (char === "]" && !inQuotes) {
|
|
13226
|
+
bracketCount--;
|
|
13227
|
+
if (bracketCount < 0) {
|
|
13228
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13229
|
+
}
|
|
13241
13230
|
}
|
|
13242
13231
|
}
|
|
13232
|
+
if (bracketCount !== 0) {
|
|
13233
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13234
|
+
}
|
|
13243
13235
|
}
|
|
13244
|
-
__name(
|
|
13245
|
-
function
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
};
|
|
13252
|
-
}
|
|
13253
|
-
__name(tree, "tree");
|
|
13254
|
-
function node(parent, key, depth) {
|
|
13255
|
-
if (parent.depth === depth) {
|
|
13256
|
-
return node(parent.parent, key, depth);
|
|
13236
|
+
__name(validatePath, "validatePath");
|
|
13237
|
+
function validatePaths(paths) {
|
|
13238
|
+
if (!Array.isArray(paths)) {
|
|
13239
|
+
throw new TypeError("paths must be an array");
|
|
13240
|
+
}
|
|
13241
|
+
for (const path of paths) {
|
|
13242
|
+
validatePath(path);
|
|
13257
13243
|
}
|
|
13258
|
-
var child = {
|
|
13259
|
-
parent,
|
|
13260
|
-
key,
|
|
13261
|
-
depth,
|
|
13262
|
-
children: []
|
|
13263
|
-
};
|
|
13264
|
-
parent.children.push(child);
|
|
13265
|
-
return child;
|
|
13266
|
-
}
|
|
13267
|
-
__name(node, "node");
|
|
13268
|
-
function restoreInstr(node2, value, target) {
|
|
13269
|
-
let current = node2;
|
|
13270
|
-
const path = [];
|
|
13271
|
-
do {
|
|
13272
|
-
path.push(current.key);
|
|
13273
|
-
current = current.parent;
|
|
13274
|
-
} while (current.parent != null);
|
|
13275
|
-
return {
|
|
13276
|
-
path,
|
|
13277
|
-
value,
|
|
13278
|
-
target
|
|
13279
|
-
};
|
|
13280
13244
|
}
|
|
13281
|
-
__name(
|
|
13282
|
-
|
|
13283
|
-
}
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
this.restore.state.secret = this.secret;
|
|
13295
|
-
return;
|
|
13245
|
+
__name(validatePaths, "validatePaths");
|
|
13246
|
+
function slowRedact(options = {}) {
|
|
13247
|
+
const { paths = [], censor = "[REDACTED]", serialize = JSON.stringify, strict = true, remove = false } = options;
|
|
13248
|
+
validatePaths(paths);
|
|
13249
|
+
const pathStructure = buildPathStructure(paths);
|
|
13250
|
+
return /* @__PURE__ */ __name(function redact(obj) {
|
|
13251
|
+
if (strict && (obj === null || typeof obj !== "object")) {
|
|
13252
|
+
if (obj === null || obj === void 0) {
|
|
13253
|
+
return serialize ? serialize(obj) : obj;
|
|
13254
|
+
}
|
|
13255
|
+
if (typeof obj !== "object") {
|
|
13256
|
+
return serialize ? serialize(obj) : obj;
|
|
13257
|
+
}
|
|
13296
13258
|
}
|
|
13297
|
-
const
|
|
13298
|
-
const
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
secret,
|
|
13303
|
-
groupRestore,
|
|
13304
|
-
nestedRestore
|
|
13305
|
-
} : {
|
|
13306
|
-
secret
|
|
13307
|
-
};
|
|
13308
|
-
this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state);
|
|
13309
|
-
this.restore.state = state;
|
|
13310
|
-
}, "compileRestore");
|
|
13311
|
-
}
|
|
13312
|
-
__name(restorer, "restorer");
|
|
13313
|
-
function resetTmpl(secret, paths) {
|
|
13314
|
-
return paths.map((path) => {
|
|
13315
|
-
const { circle, escPath, leadingBracket } = secret[path];
|
|
13316
|
-
const delim = leadingBracket ? "" : ".";
|
|
13317
|
-
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
|
|
13318
|
-
const clear = `secret[${escPath}].val = undefined`;
|
|
13319
|
-
return `
|
|
13320
|
-
if (secret[${escPath}].val !== undefined) {
|
|
13321
|
-
try { ${reset} } catch (e) {}
|
|
13322
|
-
${clear}
|
|
13323
|
-
}
|
|
13324
|
-
`;
|
|
13325
|
-
}).join("");
|
|
13326
|
-
}
|
|
13327
|
-
__name(resetTmpl, "resetTmpl");
|
|
13328
|
-
function restoreTmpl(resetters, paths, hasWildcards) {
|
|
13329
|
-
const dynamicReset = hasWildcards === true ? `
|
|
13330
|
-
const keys = Object.keys(secret)
|
|
13331
|
-
const len = keys.length
|
|
13332
|
-
for (var i = len - 1; i >= ${paths.length}; i--) {
|
|
13333
|
-
const k = keys[i]
|
|
13334
|
-
const o = secret[k]
|
|
13335
|
-
if (o) {
|
|
13336
|
-
if (o.flat === true) this.groupRestore(o)
|
|
13337
|
-
else this.nestedRestore(o)
|
|
13338
|
-
secret[k] = null
|
|
13339
|
-
}
|
|
13340
|
-
}
|
|
13341
|
-
` : "";
|
|
13342
|
-
return `
|
|
13343
|
-
const secret = this.secret
|
|
13344
|
-
${dynamicReset}
|
|
13345
|
-
${resetters}
|
|
13346
|
-
return o
|
|
13347
|
-
`;
|
|
13348
|
-
}
|
|
13349
|
-
__name(restoreTmpl, "restoreTmpl");
|
|
13350
|
-
}
|
|
13351
|
-
});
|
|
13352
|
-
|
|
13353
|
-
// node_modules/fast-redact/lib/state.js
|
|
13354
|
-
var require_state = __commonJS({
|
|
13355
|
-
"node_modules/fast-redact/lib/state.js"(exports, module) {
|
|
13356
|
-
"use strict";
|
|
13357
|
-
module.exports = state;
|
|
13358
|
-
function state(o) {
|
|
13359
|
-
const { secret, censor, compileRestore, serialize, groupRedact, nestedRedact, wildcards, wcLen } = o;
|
|
13360
|
-
const builder = [
|
|
13361
|
-
{
|
|
13362
|
-
secret,
|
|
13363
|
-
censor,
|
|
13364
|
-
compileRestore
|
|
13259
|
+
const cloned = selectiveClone(obj, pathStructure);
|
|
13260
|
+
const original = obj;
|
|
13261
|
+
let actualCensor = censor;
|
|
13262
|
+
if (typeof censor === "function") {
|
|
13263
|
+
actualCensor = censor;
|
|
13365
13264
|
}
|
|
13366
|
-
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
__name(state, "state");
|
|
13379
|
-
}
|
|
13380
|
-
});
|
|
13381
|
-
|
|
13382
|
-
// node_modules/fast-redact/index.js
|
|
13383
|
-
var require_fast_redact = __commonJS({
|
|
13384
|
-
"node_modules/fast-redact/index.js"(exports, module) {
|
|
13385
|
-
"use strict";
|
|
13386
|
-
var validator = require_validator();
|
|
13387
|
-
var parse = require_parse();
|
|
13388
|
-
var redactor = require_redactor();
|
|
13389
|
-
var restorer = require_restorer();
|
|
13390
|
-
var { groupRedact, nestedRedact } = require_modifiers();
|
|
13391
|
-
var state = require_state();
|
|
13392
|
-
var rx = require_rx();
|
|
13393
|
-
var validate = validator();
|
|
13394
|
-
var noop = /* @__PURE__ */ __name((o) => o, "noop");
|
|
13395
|
-
noop.restore = noop;
|
|
13396
|
-
var DEFAULT_CENSOR = "[REDACTED]";
|
|
13397
|
-
fastRedact.rx = rx;
|
|
13398
|
-
fastRedact.validator = validator;
|
|
13399
|
-
module.exports = fastRedact;
|
|
13400
|
-
function fastRedact(opts = {}) {
|
|
13401
|
-
const paths = Array.from(new Set(opts.paths || []));
|
|
13402
|
-
const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
|
|
13403
|
-
const remove = opts.remove;
|
|
13404
|
-
if (remove === true && serialize !== JSON.stringify) {
|
|
13405
|
-
throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
|
|
13406
|
-
}
|
|
13407
|
-
const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR;
|
|
13408
|
-
const isCensorFct = typeof censor === "function";
|
|
13409
|
-
const censorFctTakesPath = isCensorFct && censor.length > 1;
|
|
13410
|
-
if (paths.length === 0) return serialize || noop;
|
|
13411
|
-
validate({
|
|
13412
|
-
paths,
|
|
13413
|
-
serialize,
|
|
13414
|
-
censor
|
|
13415
|
-
});
|
|
13416
|
-
const { wildcards, wcLen, secret } = parse({
|
|
13417
|
-
paths,
|
|
13418
|
-
censor
|
|
13419
|
-
});
|
|
13420
|
-
const compileRestore = restorer();
|
|
13421
|
-
const strict = "strict" in opts ? opts.strict : true;
|
|
13422
|
-
return redactor({
|
|
13423
|
-
secret,
|
|
13424
|
-
wcLen,
|
|
13425
|
-
serialize,
|
|
13426
|
-
strict,
|
|
13427
|
-
isCensorFct,
|
|
13428
|
-
censorFctTakesPath
|
|
13429
|
-
}, state({
|
|
13430
|
-
secret,
|
|
13431
|
-
censor,
|
|
13432
|
-
compileRestore,
|
|
13433
|
-
serialize,
|
|
13434
|
-
groupRedact,
|
|
13435
|
-
nestedRedact,
|
|
13436
|
-
wildcards,
|
|
13437
|
-
wcLen
|
|
13438
|
-
}));
|
|
13265
|
+
redactPaths(cloned, paths, actualCensor, remove);
|
|
13266
|
+
if (serialize === false) {
|
|
13267
|
+
cloned.restore = function() {
|
|
13268
|
+
return deepClone(original);
|
|
13269
|
+
};
|
|
13270
|
+
return cloned;
|
|
13271
|
+
}
|
|
13272
|
+
if (typeof serialize === "function") {
|
|
13273
|
+
return serialize(cloned);
|
|
13274
|
+
}
|
|
13275
|
+
return JSON.stringify(cloned);
|
|
13276
|
+
}, "redact");
|
|
13439
13277
|
}
|
|
13440
|
-
__name(
|
|
13278
|
+
__name(slowRedact, "slowRedact");
|
|
13279
|
+
module.exports = slowRedact;
|
|
13441
13280
|
}
|
|
13442
13281
|
});
|
|
13443
13282
|
|
|
@@ -13516,17 +13355,13 @@ var require_symbols = __commonJS({
|
|
|
13516
13355
|
var require_redaction = __commonJS({
|
|
13517
13356
|
"node_modules/pino/lib/redaction.js"(exports, module) {
|
|
13518
13357
|
"use strict";
|
|
13519
|
-
var
|
|
13358
|
+
var Redact = require_redact();
|
|
13520
13359
|
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
|
13521
|
-
var
|
|
13522
|
-
var validate = validator({
|
|
13523
|
-
ERR_PATHS_MUST_BE_STRINGS: /* @__PURE__ */ __name(() => "pino \u2013 redacted paths must be strings", "ERR_PATHS_MUST_BE_STRINGS"),
|
|
13524
|
-
ERR_INVALID_PATH: /* @__PURE__ */ __name((s) => `pino \u2013 redact paths array contains an invalid path (${s})`, "ERR_INVALID_PATH")
|
|
13525
|
-
});
|
|
13360
|
+
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
13526
13361
|
var CENSOR = "[Redacted]";
|
|
13527
13362
|
var strict = false;
|
|
13528
13363
|
function redaction(opts, serialize) {
|
|
13529
|
-
const { paths, censor } = handle(opts);
|
|
13364
|
+
const { paths, censor, remove } = handle(opts);
|
|
13530
13365
|
const shape = paths.reduce((o, str) => {
|
|
13531
13366
|
rx.lastIndex = 0;
|
|
13532
13367
|
const first = rx.exec(str);
|
|
@@ -13559,11 +13394,12 @@ var require_redaction = __commonJS({
|
|
|
13559
13394
|
return o;
|
|
13560
13395
|
}, {});
|
|
13561
13396
|
const result = {
|
|
13562
|
-
[redactFmtSym]:
|
|
13397
|
+
[redactFmtSym]: Redact({
|
|
13563
13398
|
paths,
|
|
13564
13399
|
censor,
|
|
13565
13400
|
serialize,
|
|
13566
|
-
strict
|
|
13401
|
+
strict,
|
|
13402
|
+
remove
|
|
13567
13403
|
})
|
|
13568
13404
|
};
|
|
13569
13405
|
const topCensor = /* @__PURE__ */ __name((...args) => {
|
|
@@ -13584,11 +13420,12 @@ var require_redaction = __commonJS({
|
|
|
13584
13420
|
...path
|
|
13585
13421
|
]);
|
|
13586
13422
|
} : censor;
|
|
13587
|
-
o[k] =
|
|
13423
|
+
o[k] = Redact({
|
|
13588
13424
|
paths: shape[k],
|
|
13589
13425
|
censor: wrappedCensor,
|
|
13590
13426
|
serialize,
|
|
13591
|
-
strict
|
|
13427
|
+
strict,
|
|
13428
|
+
remove
|
|
13592
13429
|
});
|
|
13593
13430
|
}
|
|
13594
13431
|
return o;
|
|
@@ -13601,7 +13438,6 @@ var require_redaction = __commonJS({
|
|
|
13601
13438
|
paths: opts,
|
|
13602
13439
|
censor: CENSOR
|
|
13603
13440
|
};
|
|
13604
|
-
validate(opts);
|
|
13605
13441
|
return opts;
|
|
13606
13442
|
}
|
|
13607
13443
|
let { paths, censor = CENSOR, remove } = opts;
|
|
@@ -13609,13 +13445,10 @@ var require_redaction = __commonJS({
|
|
|
13609
13445
|
throw Error("pino \u2013 redact must contain an array of strings");
|
|
13610
13446
|
}
|
|
13611
13447
|
if (remove === true) censor = void 0;
|
|
13612
|
-
validate({
|
|
13613
|
-
paths,
|
|
13614
|
-
censor
|
|
13615
|
-
});
|
|
13616
13448
|
return {
|
|
13617
13449
|
paths,
|
|
13618
|
-
censor
|
|
13450
|
+
censor,
|
|
13451
|
+
remove
|
|
13619
13452
|
};
|
|
13620
13453
|
}
|
|
13621
13454
|
__name(handle, "handle");
|
|
@@ -13631,11 +13464,31 @@ var require_time = __commonJS({
|
|
|
13631
13464
|
var epochTime = /* @__PURE__ */ __name(() => `,"time":${Date.now()}`, "epochTime");
|
|
13632
13465
|
var unixTime = /* @__PURE__ */ __name(() => `,"time":${Math.round(Date.now() / 1e3)}`, "unixTime");
|
|
13633
13466
|
var isoTime = /* @__PURE__ */ __name(() => `,"time":"${new Date(Date.now()).toISOString()}"`, "isoTime");
|
|
13467
|
+
var NS_PER_MS = 1000000n;
|
|
13468
|
+
var NS_PER_SEC = 1000000000n;
|
|
13469
|
+
var startWallTimeNs = BigInt(Date.now()) * NS_PER_MS;
|
|
13470
|
+
var startHrTime = process.hrtime.bigint();
|
|
13471
|
+
var isoTimeNano = /* @__PURE__ */ __name(() => {
|
|
13472
|
+
const elapsedNs = process.hrtime.bigint() - startHrTime;
|
|
13473
|
+
const currentTimeNs = startWallTimeNs + elapsedNs;
|
|
13474
|
+
const secondsSinceEpoch = currentTimeNs / NS_PER_SEC;
|
|
13475
|
+
const nanosWithinSecond = currentTimeNs % NS_PER_SEC;
|
|
13476
|
+
const msSinceEpoch = Number(secondsSinceEpoch * 1000n + nanosWithinSecond / 1000000n);
|
|
13477
|
+
const date = new Date(msSinceEpoch);
|
|
13478
|
+
const year = date.getUTCFullYear();
|
|
13479
|
+
const month = (date.getUTCMonth() + 1).toString().padStart(2, "0");
|
|
13480
|
+
const day = date.getUTCDate().toString().padStart(2, "0");
|
|
13481
|
+
const hours = date.getUTCHours().toString().padStart(2, "0");
|
|
13482
|
+
const minutes = date.getUTCMinutes().toString().padStart(2, "0");
|
|
13483
|
+
const seconds = date.getUTCSeconds().toString().padStart(2, "0");
|
|
13484
|
+
return `,"time":"${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${nanosWithinSecond.toString().padStart(9, "0")}Z"`;
|
|
13485
|
+
}, "isoTimeNano");
|
|
13634
13486
|
module.exports = {
|
|
13635
13487
|
nullTime,
|
|
13636
13488
|
epochTime,
|
|
13637
13489
|
unixTime,
|
|
13638
|
-
isoTime
|
|
13490
|
+
isoTime,
|
|
13491
|
+
isoTimeNano
|
|
13639
13492
|
};
|
|
13640
13493
|
}
|
|
13641
13494
|
});
|
|
@@ -15219,6 +15072,7 @@ var require_transport = __commonJS({
|
|
|
15219
15072
|
var require_tools = __commonJS({
|
|
15220
15073
|
"node_modules/pino/lib/tools.js"(exports, module) {
|
|
15221
15074
|
"use strict";
|
|
15075
|
+
var diagChan = __require("diagnostics_channel");
|
|
15222
15076
|
var format5 = require_quick_format_unescaped();
|
|
15223
15077
|
var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
|
|
15224
15078
|
var SonicBoom = require_sonic_boom();
|
|
@@ -15226,6 +15080,17 @@ var require_tools = __commonJS({
|
|
|
15226
15080
|
var { lsCacheSym, chindingsSym, writeSym, serializersSym, formatOptsSym, endSym, stringifiersSym, stringifySym, stringifySafeSym, wildcardFirstSym, nestedKeySym, formattersSym, messageKeySym, errorKeySym, nestedKeyStrSym, msgPrefixSym } = require_symbols();
|
|
15227
15081
|
var { isMainThread } = __require("worker_threads");
|
|
15228
15082
|
var transport = require_transport();
|
|
15083
|
+
var asJsonChan;
|
|
15084
|
+
if (typeof diagChan.tracingChannel === "function") {
|
|
15085
|
+
asJsonChan = diagChan.tracingChannel("pino_asJson");
|
|
15086
|
+
} else {
|
|
15087
|
+
asJsonChan = {
|
|
15088
|
+
hasSubscribers: false,
|
|
15089
|
+
traceSync(fn, store, thisArg, ...args) {
|
|
15090
|
+
return fn.call(thisArg, ...args);
|
|
15091
|
+
}
|
|
15092
|
+
};
|
|
15093
|
+
}
|
|
15229
15094
|
function noop() {
|
|
15230
15095
|
}
|
|
15231
15096
|
__name(noop, "noop");
|
|
@@ -15294,6 +15159,17 @@ var require_tools = __commonJS({
|
|
|
15294
15159
|
}
|
|
15295
15160
|
__name(asString, "asString");
|
|
15296
15161
|
function asJson(obj, msg, num, time) {
|
|
15162
|
+
if (asJsonChan.hasSubscribers === false) {
|
|
15163
|
+
return _asJson.call(this, obj, msg, num, time);
|
|
15164
|
+
}
|
|
15165
|
+
const store = {
|
|
15166
|
+
instance: this,
|
|
15167
|
+
arguments
|
|
15168
|
+
};
|
|
15169
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time);
|
|
15170
|
+
}
|
|
15171
|
+
__name(asJson, "asJson");
|
|
15172
|
+
function _asJson(obj, msg, num, time) {
|
|
15297
15173
|
const stringify2 = this[stringifySym];
|
|
15298
15174
|
const stringifySafe = this[stringifySafeSym];
|
|
15299
15175
|
const stringifiers = this[stringifiersSym];
|
|
@@ -15374,7 +15250,7 @@ var require_tools = __commonJS({
|
|
|
15374
15250
|
return data + propStr + msgStr + end;
|
|
15375
15251
|
}
|
|
15376
15252
|
}
|
|
15377
|
-
__name(
|
|
15253
|
+
__name(_asJson, "_asJson");
|
|
15378
15254
|
function asChindings(instance, bindings) {
|
|
15379
15255
|
let value;
|
|
15380
15256
|
let data = instance[chindingsSym];
|
|
@@ -15387,7 +15263,7 @@ var require_tools = __commonJS({
|
|
|
15387
15263
|
bindings = formatter(bindings);
|
|
15388
15264
|
for (const key in bindings) {
|
|
15389
15265
|
value = bindings[key];
|
|
15390
|
-
const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
|
|
15266
|
+
const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0;
|
|
15391
15267
|
if (valid === true) {
|
|
15392
15268
|
value = serializers[key] ? serializers[key](value) : value;
|
|
15393
15269
|
value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
|
|
@@ -15761,7 +15637,7 @@ var require_meta = __commonJS({
|
|
|
15761
15637
|
"node_modules/pino/lib/meta.js"(exports, module) {
|
|
15762
15638
|
"use strict";
|
|
15763
15639
|
module.exports = {
|
|
15764
|
-
version: "9.
|
|
15640
|
+
version: "9.14.0"
|
|
15765
15641
|
};
|
|
15766
15642
|
}
|
|
15767
15643
|
});
|
|
@@ -15773,7 +15649,7 @@ var require_proto = __commonJS({
|
|
|
15773
15649
|
var { EventEmitter } = __require("events");
|
|
15774
15650
|
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();
|
|
15775
15651
|
var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
|
|
15776
|
-
var { asChindings, asJson, buildFormatters, stringify } = require_tools();
|
|
15652
|
+
var { asChindings, asJson, buildFormatters, stringify, noop } = require_tools();
|
|
15777
15653
|
var { version } = require_meta();
|
|
15778
15654
|
var redaction = require_redaction();
|
|
15779
15655
|
var _a4;
|
|
@@ -15802,6 +15678,9 @@ var require_proto = __commonJS({
|
|
|
15802
15678
|
get msgPrefix() {
|
|
15803
15679
|
return this[msgPrefixSym];
|
|
15804
15680
|
},
|
|
15681
|
+
get [Symbol.toStringTag]() {
|
|
15682
|
+
return "Pino";
|
|
15683
|
+
},
|
|
15805
15684
|
[lsCacheSym]: initialLsCache,
|
|
15806
15685
|
[writeSym]: write,
|
|
15807
15686
|
[asJsonSym]: asJson,
|
|
@@ -15817,10 +15696,20 @@ var require_proto = __commonJS({
|
|
|
15817
15696
|
if (!bindings2) {
|
|
15818
15697
|
throw Error("missing bindings for child Pino");
|
|
15819
15698
|
}
|
|
15820
|
-
options = options || {};
|
|
15821
15699
|
const serializers = this[serializersSym];
|
|
15822
15700
|
const formatters = this[formattersSym];
|
|
15823
15701
|
const instance = Object.create(this);
|
|
15702
|
+
if (options == null) {
|
|
15703
|
+
if (instance[formattersSym].bindings !== resetChildingsFormatter) {
|
|
15704
|
+
instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
15705
|
+
}
|
|
15706
|
+
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
15707
|
+
instance[setLevelSym](this.level);
|
|
15708
|
+
if (this.onChild !== noop) {
|
|
15709
|
+
this.onChild(instance);
|
|
15710
|
+
}
|
|
15711
|
+
return instance;
|
|
15712
|
+
}
|
|
15824
15713
|
if (options.hasOwnProperty("serializers") === true) {
|
|
15825
15714
|
instance[serializersSym] = /* @__PURE__ */ Object.create(null);
|
|
15826
15715
|
for (const k in serializers) {
|
|
@@ -15928,9 +15817,6 @@ var require_proto = __commonJS({
|
|
|
15928
15817
|
stream.write(streamWriteHook ? streamWriteHook(s) : s);
|
|
15929
15818
|
}
|
|
15930
15819
|
__name(write, "write");
|
|
15931
|
-
function noop() {
|
|
15932
|
-
}
|
|
15933
|
-
__name(noop, "noop");
|
|
15934
15820
|
function flush(cb) {
|
|
15935
15821
|
if (cb != null && typeof cb !== "function") {
|
|
15936
15822
|
throw Error("callback must be a function");
|