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
package/dist/nestjs/index.js
CHANGED
|
@@ -11966,11 +11966,14 @@ var init_client = __esm({
|
|
|
11966
11966
|
if (_ApitallyClient.instance) {
|
|
11967
11967
|
throw new Error("Apitally client is already initialized");
|
|
11968
11968
|
}
|
|
11969
|
+
this.logger = logger ?? getLogger();
|
|
11969
11970
|
if (!isValidClientId(clientId)) {
|
|
11970
|
-
|
|
11971
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
11972
|
+
this.enabled = false;
|
|
11971
11973
|
}
|
|
11972
11974
|
if (!isValidEnv(env)) {
|
|
11973
|
-
|
|
11975
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
11976
|
+
this.enabled = false;
|
|
11974
11977
|
}
|
|
11975
11978
|
if (requestLoggingConfig && !requestLogging) {
|
|
11976
11979
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -11985,8 +11988,6 @@ var init_client = __esm({
|
|
|
11985
11988
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
11986
11989
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
11987
11990
|
this.consumerRegistry = new ConsumerRegistry();
|
|
11988
|
-
this.logger = logger ?? getLogger();
|
|
11989
|
-
this.startSync();
|
|
11990
11991
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
11991
11992
|
}
|
|
11992
11993
|
static getInstance() {
|
|
@@ -12041,15 +12042,20 @@ var init_client = __esm({
|
|
|
12041
12042
|
}
|
|
12042
12043
|
}
|
|
12043
12044
|
startSync() {
|
|
12045
|
+
if (!this.enabled) {
|
|
12046
|
+
return;
|
|
12047
|
+
}
|
|
12044
12048
|
this.sync();
|
|
12045
12049
|
this.syncIntervalId = setInterval(() => {
|
|
12046
12050
|
this.sync();
|
|
12047
12051
|
}, INITIAL_SYNC_INTERVAL);
|
|
12048
12052
|
setTimeout(() => {
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
this.
|
|
12052
|
-
|
|
12053
|
+
if (this.syncIntervalId) {
|
|
12054
|
+
clearInterval(this.syncIntervalId);
|
|
12055
|
+
this.syncIntervalId = setInterval(() => {
|
|
12056
|
+
this.sync();
|
|
12057
|
+
}, SYNC_INTERVAL);
|
|
12058
|
+
}
|
|
12053
12059
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
12054
12060
|
}
|
|
12055
12061
|
async sync() {
|
|
@@ -12077,7 +12083,6 @@ var init_client = __esm({
|
|
|
12077
12083
|
setStartupData(data) {
|
|
12078
12084
|
this.startupData = data;
|
|
12079
12085
|
this.startupDataSent = false;
|
|
12080
|
-
this.sendStartupData();
|
|
12081
12086
|
}
|
|
12082
12087
|
async sendStartupData() {
|
|
12083
12088
|
if (this.startupData) {
|
|
@@ -12825,619 +12830,458 @@ var require_caller = __commonJS({
|
|
|
12825
12830
|
}
|
|
12826
12831
|
});
|
|
12827
12832
|
|
|
12828
|
-
// node_modules/
|
|
12829
|
-
var
|
|
12830
|
-
"node_modules/
|
|
12833
|
+
// node_modules/@pinojs/redact/index.js
|
|
12834
|
+
var require_redact = __commonJS({
|
|
12835
|
+
"node_modules/@pinojs/redact/index.js"(exports, module) {
|
|
12831
12836
|
"use strict";
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12837
|
+
function deepClone(obj) {
|
|
12838
|
+
if (obj === null || typeof obj !== "object") {
|
|
12839
|
+
return obj;
|
|
12840
|
+
}
|
|
12841
|
+
if (obj instanceof Date) {
|
|
12842
|
+
return new Date(obj.getTime());
|
|
12843
|
+
}
|
|
12844
|
+
if (obj instanceof Array) {
|
|
12845
|
+
const cloned = [];
|
|
12846
|
+
for (let i = 0; i < obj.length; i++) {
|
|
12847
|
+
cloned[i] = deepClone(obj[i]);
|
|
12848
|
+
}
|
|
12849
|
+
return cloned;
|
|
12850
|
+
}
|
|
12851
|
+
if (typeof obj === "object") {
|
|
12852
|
+
const cloned = Object.create(Object.getPrototypeOf(obj));
|
|
12853
|
+
for (const key in obj) {
|
|
12854
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
12855
|
+
cloned[key] = deepClone(obj[key]);
|
|
12839
12856
|
}
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12857
|
+
}
|
|
12858
|
+
return cloned;
|
|
12859
|
+
}
|
|
12860
|
+
return obj;
|
|
12861
|
+
}
|
|
12862
|
+
__name(deepClone, "deepClone");
|
|
12863
|
+
function parsePath(path) {
|
|
12864
|
+
const parts = [];
|
|
12865
|
+
let current = "";
|
|
12866
|
+
let inBrackets = false;
|
|
12867
|
+
let inQuotes = false;
|
|
12868
|
+
let quoteChar = "";
|
|
12869
|
+
for (let i = 0; i < path.length; i++) {
|
|
12870
|
+
const char = path[i];
|
|
12871
|
+
if (!inBrackets && char === ".") {
|
|
12872
|
+
if (current) {
|
|
12873
|
+
parts.push(current);
|
|
12874
|
+
current = "";
|
|
12875
|
+
}
|
|
12876
|
+
} else if (char === "[") {
|
|
12877
|
+
if (current) {
|
|
12878
|
+
parts.push(current);
|
|
12879
|
+
current = "";
|
|
12880
|
+
}
|
|
12881
|
+
inBrackets = true;
|
|
12882
|
+
} else if (char === "]" && inBrackets) {
|
|
12883
|
+
parts.push(current);
|
|
12884
|
+
current = "";
|
|
12885
|
+
inBrackets = false;
|
|
12886
|
+
inQuotes = false;
|
|
12887
|
+
} else if ((char === '"' || char === "'") && inBrackets) {
|
|
12888
|
+
if (!inQuotes) {
|
|
12889
|
+
inQuotes = true;
|
|
12890
|
+
quoteChar = char;
|
|
12891
|
+
} else if (char === quoteChar) {
|
|
12892
|
+
inQuotes = false;
|
|
12893
|
+
quoteChar = "";
|
|
12894
|
+
} else {
|
|
12895
|
+
current += char;
|
|
12853
12896
|
}
|
|
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
12897
|
} else {
|
|
12899
|
-
|
|
12900
|
-
path,
|
|
12901
|
-
val: void 0,
|
|
12902
|
-
precensored: false,
|
|
12903
|
-
circle: "",
|
|
12904
|
-
escPath: JSON.stringify(strPath),
|
|
12905
|
-
leadingBracket
|
|
12906
|
-
};
|
|
12898
|
+
current += char;
|
|
12907
12899
|
}
|
|
12908
|
-
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
secret
|
|
12914
|
-
};
|
|
12900
|
+
}
|
|
12901
|
+
if (current) {
|
|
12902
|
+
parts.push(current);
|
|
12903
|
+
}
|
|
12904
|
+
return parts;
|
|
12915
12905
|
}
|
|
12916
|
-
__name(
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
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}
|
|
12906
|
+
__name(parsePath, "parsePath");
|
|
12907
|
+
function setValue(obj, parts, value) {
|
|
12908
|
+
let current = obj;
|
|
12909
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
12910
|
+
const key = parts[i];
|
|
12911
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
12912
|
+
return false;
|
|
12913
|
+
}
|
|
12914
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
12915
|
+
return false;
|
|
12985
12916
|
}
|
|
12917
|
+
current = current[key];
|
|
12986
12918
|
}
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
12919
|
+
const lastKey = parts[parts.length - 1];
|
|
12920
|
+
if (lastKey === "*") {
|
|
12921
|
+
if (Array.isArray(current)) {
|
|
12922
|
+
for (let i = 0; i < current.length; i++) {
|
|
12923
|
+
current[i] = value;
|
|
12924
|
+
}
|
|
12925
|
+
} else if (typeof current === "object" && current !== null) {
|
|
12926
|
+
for (const key in current) {
|
|
12927
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
12928
|
+
current[key] = value;
|
|
12929
|
+
}
|
|
12930
|
+
}
|
|
12931
|
+
}
|
|
12932
|
+
} else {
|
|
12933
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
12934
|
+
current[lastKey] = value;
|
|
12935
|
+
}
|
|
13001
12936
|
}
|
|
12937
|
+
return true;
|
|
13002
12938
|
}
|
|
13003
|
-
|
|
12939
|
+
__name(setValue, "setValue");
|
|
12940
|
+
function removeKey(obj, parts) {
|
|
12941
|
+
let current = obj;
|
|
12942
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
12943
|
+
const key = parts[i];
|
|
12944
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
12945
|
+
return false;
|
|
12946
|
+
}
|
|
12947
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
12948
|
+
return false;
|
|
12949
|
+
}
|
|
12950
|
+
current = current[key];
|
|
12951
|
+
}
|
|
12952
|
+
const lastKey = parts[parts.length - 1];
|
|
12953
|
+
if (lastKey === "*") {
|
|
12954
|
+
if (Array.isArray(current)) {
|
|
12955
|
+
for (let i = 0; i < current.length; i++) {
|
|
12956
|
+
current[i] = void 0;
|
|
12957
|
+
}
|
|
12958
|
+
} else if (typeof current === "object" && current !== null) {
|
|
12959
|
+
for (const key in current) {
|
|
12960
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
12961
|
+
delete current[key];
|
|
12962
|
+
}
|
|
12963
|
+
}
|
|
12964
|
+
}
|
|
12965
|
+
} else {
|
|
12966
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
12967
|
+
delete current[lastKey];
|
|
12968
|
+
}
|
|
12969
|
+
}
|
|
12970
|
+
return true;
|
|
13004
12971
|
}
|
|
13005
|
-
__name(
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
12972
|
+
__name(removeKey, "removeKey");
|
|
12973
|
+
var PATH_NOT_FOUND = Symbol("PATH_NOT_FOUND");
|
|
12974
|
+
function getValueIfExists(obj, parts) {
|
|
12975
|
+
let current = obj;
|
|
12976
|
+
for (const part of parts) {
|
|
12977
|
+
if (current === null || current === void 0) {
|
|
12978
|
+
return PATH_NOT_FOUND;
|
|
12979
|
+
}
|
|
12980
|
+
if (typeof current !== "object" || current === null) {
|
|
12981
|
+
return PATH_NOT_FOUND;
|
|
12982
|
+
}
|
|
12983
|
+
if (!(part in current)) {
|
|
12984
|
+
return PATH_NOT_FOUND;
|
|
12985
|
+
}
|
|
12986
|
+
current = current[part];
|
|
12987
|
+
}
|
|
12988
|
+
return current;
|
|
13012
12989
|
}
|
|
13013
|
-
__name(
|
|
13014
|
-
function
|
|
13015
|
-
|
|
12990
|
+
__name(getValueIfExists, "getValueIfExists");
|
|
12991
|
+
function getValue(obj, parts) {
|
|
12992
|
+
let current = obj;
|
|
12993
|
+
for (const part of parts) {
|
|
12994
|
+
if (current === null || current === void 0) {
|
|
12995
|
+
return void 0;
|
|
12996
|
+
}
|
|
12997
|
+
if (typeof current !== "object" || current === null) {
|
|
12998
|
+
return void 0;
|
|
12999
|
+
}
|
|
13000
|
+
current = current[part];
|
|
13001
|
+
}
|
|
13002
|
+
return current;
|
|
13016
13003
|
}
|
|
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]);
|
|
13004
|
+
__name(getValue, "getValue");
|
|
13005
|
+
function redactPaths(obj, paths, censor, remove = false) {
|
|
13006
|
+
for (const path of paths) {
|
|
13007
|
+
const parts = parsePath(path);
|
|
13008
|
+
if (parts.includes("*")) {
|
|
13009
|
+
redactWildcardPath(obj, parts, censor, path, remove);
|
|
13063
13010
|
} else {
|
|
13064
|
-
|
|
13011
|
+
if (remove) {
|
|
13012
|
+
removeKey(obj, parts);
|
|
13013
|
+
} else {
|
|
13014
|
+
const value = getValueIfExists(obj, parts);
|
|
13015
|
+
if (value === PATH_NOT_FOUND) {
|
|
13016
|
+
continue;
|
|
13017
|
+
}
|
|
13018
|
+
const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
|
|
13019
|
+
setValue(obj, parts, actualCensor);
|
|
13020
|
+
}
|
|
13065
13021
|
}
|
|
13066
13022
|
}
|
|
13067
|
-
return {
|
|
13068
|
-
keys,
|
|
13069
|
-
values,
|
|
13070
|
-
target,
|
|
13071
|
-
flat: true
|
|
13072
|
-
};
|
|
13073
13023
|
}
|
|
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;
|
|
13024
|
+
__name(redactPaths, "redactPaths");
|
|
13025
|
+
function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
|
|
13026
|
+
const wildcardIndex = parts.indexOf("*");
|
|
13027
|
+
if (wildcardIndex === parts.length - 1) {
|
|
13028
|
+
const parentParts = parts.slice(0, -1);
|
|
13029
|
+
let current = obj;
|
|
13030
|
+
for (const part of parentParts) {
|
|
13031
|
+
if (current === null || current === void 0) return;
|
|
13032
|
+
if (typeof current !== "object" || current === null) return;
|
|
13033
|
+
current = current[part];
|
|
13126
13034
|
}
|
|
13127
|
-
if (
|
|
13128
|
-
if (
|
|
13129
|
-
|
|
13035
|
+
if (Array.isArray(current)) {
|
|
13036
|
+
if (remove) {
|
|
13037
|
+
for (let i = 0; i < current.length; i++) {
|
|
13038
|
+
current[i] = void 0;
|
|
13039
|
+
}
|
|
13040
|
+
} else {
|
|
13041
|
+
for (let i = 0; i < current.length; i++) {
|
|
13042
|
+
const indexPath = [
|
|
13043
|
+
...parentParts,
|
|
13044
|
+
i.toString()
|
|
13045
|
+
];
|
|
13046
|
+
const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor;
|
|
13047
|
+
current[i] = actualCensor;
|
|
13048
|
+
}
|
|
13130
13049
|
}
|
|
13131
|
-
|
|
13132
|
-
if (
|
|
13133
|
-
|
|
13050
|
+
} else if (typeof current === "object" && current !== null) {
|
|
13051
|
+
if (remove) {
|
|
13052
|
+
const keysToDelete = [];
|
|
13053
|
+
for (const key in current) {
|
|
13054
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
13055
|
+
keysToDelete.push(key);
|
|
13056
|
+
}
|
|
13057
|
+
}
|
|
13058
|
+
for (const key of keysToDelete) {
|
|
13059
|
+
delete current[key];
|
|
13060
|
+
}
|
|
13061
|
+
} else {
|
|
13062
|
+
for (const key in current) {
|
|
13063
|
+
const keyPath = [
|
|
13064
|
+
...parentParts,
|
|
13065
|
+
key
|
|
13066
|
+
];
|
|
13067
|
+
const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor;
|
|
13068
|
+
current[key] = actualCensor;
|
|
13069
|
+
}
|
|
13134
13070
|
}
|
|
13135
13071
|
}
|
|
13136
|
-
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
ov = wcov[k];
|
|
13152
|
-
}
|
|
13153
|
-
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [
|
|
13154
|
-
...path,
|
|
13155
|
-
originalKey,
|
|
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
|
-
}
|
|
13072
|
+
} else {
|
|
13073
|
+
redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
|
|
13074
|
+
}
|
|
13075
|
+
}
|
|
13076
|
+
__name(redactWildcardPath, "redactWildcardPath");
|
|
13077
|
+
function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
|
|
13078
|
+
const beforeWildcard = parts.slice(0, wildcardIndex);
|
|
13079
|
+
const afterWildcard = parts.slice(wildcardIndex + 1);
|
|
13080
|
+
const pathArray = [];
|
|
13081
|
+
function traverse(current, pathLength) {
|
|
13082
|
+
if (pathLength === beforeWildcard.length) {
|
|
13083
|
+
if (Array.isArray(current)) {
|
|
13084
|
+
for (let i = 0; i < current.length; i++) {
|
|
13085
|
+
pathArray[pathLength] = i.toString();
|
|
13086
|
+
traverse(current[i], pathLength + 1);
|
|
13174
13087
|
}
|
|
13088
|
+
} else if (typeof current === "object" && current !== null) {
|
|
13089
|
+
for (const key in current) {
|
|
13090
|
+
pathArray[pathLength] = key;
|
|
13091
|
+
traverse(current[key], pathLength + 1);
|
|
13092
|
+
}
|
|
13093
|
+
}
|
|
13094
|
+
} else if (pathLength < beforeWildcard.length) {
|
|
13095
|
+
const nextKey = beforeWildcard[pathLength];
|
|
13096
|
+
if (current && typeof current === "object" && current !== null && nextKey in current) {
|
|
13097
|
+
pathArray[pathLength] = nextKey;
|
|
13098
|
+
traverse(current[nextKey], pathLength + 1);
|
|
13175
13099
|
}
|
|
13176
|
-
wc = null;
|
|
13177
13100
|
} else {
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13101
|
+
if (afterWildcard.includes("*")) {
|
|
13102
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
13103
|
+
const fullPath = [
|
|
13104
|
+
...pathArray.slice(0, pathLength),
|
|
13105
|
+
...path
|
|
13106
|
+
];
|
|
13107
|
+
return censor(value, fullPath);
|
|
13108
|
+
} : censor;
|
|
13109
|
+
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
13186
13110
|
} else {
|
|
13187
|
-
|
|
13188
|
-
|
|
13189
|
-
|
|
13111
|
+
if (remove) {
|
|
13112
|
+
removeKey(current, afterWildcard);
|
|
13113
|
+
} else {
|
|
13114
|
+
const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [
|
|
13115
|
+
...pathArray.slice(0, pathLength),
|
|
13116
|
+
...afterWildcard
|
|
13117
|
+
]) : censor;
|
|
13118
|
+
setValue(current, afterWildcard, actualCensor);
|
|
13119
|
+
}
|
|
13190
13120
|
}
|
|
13191
|
-
n = n[k];
|
|
13192
13121
|
}
|
|
13193
|
-
|
|
13194
|
-
|
|
13122
|
+
}
|
|
13123
|
+
__name(traverse, "traverse");
|
|
13124
|
+
if (beforeWildcard.length === 0) {
|
|
13125
|
+
traverse(obj, 0);
|
|
13126
|
+
} else {
|
|
13127
|
+
let current = obj;
|
|
13128
|
+
for (let i = 0; i < beforeWildcard.length; i++) {
|
|
13129
|
+
const part = beforeWildcard[i];
|
|
13130
|
+
if (current === null || current === void 0) return;
|
|
13131
|
+
if (typeof current !== "object" || current === null) return;
|
|
13132
|
+
current = current[part];
|
|
13133
|
+
pathArray[i] = part;
|
|
13134
|
+
}
|
|
13135
|
+
if (current !== null && current !== void 0) {
|
|
13136
|
+
traverse(current, beforeWildcard.length);
|
|
13137
|
+
}
|
|
13138
|
+
}
|
|
13139
|
+
}
|
|
13140
|
+
__name(redactIntermediateWildcard, "redactIntermediateWildcard");
|
|
13141
|
+
function buildPathStructure(pathsToClone) {
|
|
13142
|
+
if (pathsToClone.length === 0) {
|
|
13143
|
+
return null;
|
|
13144
|
+
}
|
|
13145
|
+
const pathStructure = /* @__PURE__ */ new Map();
|
|
13146
|
+
for (const path of pathsToClone) {
|
|
13147
|
+
const parts = parsePath(path);
|
|
13148
|
+
let current = pathStructure;
|
|
13149
|
+
for (let i = 0; i < parts.length; i++) {
|
|
13150
|
+
const part = parts[i];
|
|
13151
|
+
if (!current.has(part)) {
|
|
13152
|
+
current.set(part, /* @__PURE__ */ new Map());
|
|
13153
|
+
}
|
|
13154
|
+
current = current.get(part);
|
|
13195
13155
|
}
|
|
13196
13156
|
}
|
|
13157
|
+
return pathStructure;
|
|
13197
13158
|
}
|
|
13198
|
-
__name(
|
|
13199
|
-
function
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
var n = o;
|
|
13203
|
-
while (n != null && ++i < l) {
|
|
13204
|
-
n = n[p[i]];
|
|
13159
|
+
__name(buildPathStructure, "buildPathStructure");
|
|
13160
|
+
function selectiveClone(obj, pathStructure) {
|
|
13161
|
+
if (!pathStructure) {
|
|
13162
|
+
return obj;
|
|
13205
13163
|
}
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13164
|
+
function cloneSelectively(source, pathMap, depth = 0) {
|
|
13165
|
+
if (!pathMap || pathMap.size === 0) {
|
|
13166
|
+
return source;
|
|
13167
|
+
}
|
|
13168
|
+
if (source === null || typeof source !== "object") {
|
|
13169
|
+
return source;
|
|
13170
|
+
}
|
|
13171
|
+
if (source instanceof Date) {
|
|
13172
|
+
return new Date(source.getTime());
|
|
13173
|
+
}
|
|
13174
|
+
if (Array.isArray(source)) {
|
|
13175
|
+
const cloned2 = [];
|
|
13176
|
+
for (let i = 0; i < source.length; i++) {
|
|
13177
|
+
const indexStr = i.toString();
|
|
13178
|
+
if (pathMap.has(indexStr) || pathMap.has("*")) {
|
|
13179
|
+
cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*"));
|
|
13180
|
+
} else {
|
|
13181
|
+
cloned2[i] = source[i];
|
|
13182
|
+
}
|
|
13216
13183
|
}
|
|
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) {
|
|
13184
|
+
return cloned2;
|
|
13185
|
+
}
|
|
13186
|
+
const cloned = Object.create(Object.getPrototypeOf(source));
|
|
13187
|
+
for (const key in source) {
|
|
13188
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13189
|
+
if (pathMap.has(key) || pathMap.has("*")) {
|
|
13190
|
+
cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*"));
|
|
13229
13191
|
} else {
|
|
13230
|
-
|
|
13231
|
-
store.push(rv);
|
|
13232
|
-
wcov[k] = nv;
|
|
13192
|
+
cloned[key] = source[key];
|
|
13233
13193
|
}
|
|
13234
13194
|
}
|
|
13235
13195
|
}
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13196
|
+
return cloned;
|
|
13197
|
+
}
|
|
13198
|
+
__name(cloneSelectively, "cloneSelectively");
|
|
13199
|
+
return cloneSelectively(obj, pathStructure);
|
|
13200
|
+
}
|
|
13201
|
+
__name(selectiveClone, "selectiveClone");
|
|
13202
|
+
function validatePath(path) {
|
|
13203
|
+
if (typeof path !== "string") {
|
|
13204
|
+
throw new Error("Paths must be (non-empty) strings");
|
|
13205
|
+
}
|
|
13206
|
+
if (path === "") {
|
|
13207
|
+
throw new Error("Invalid redaction path ()");
|
|
13208
|
+
}
|
|
13209
|
+
if (path.includes("..")) {
|
|
13210
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13211
|
+
}
|
|
13212
|
+
if (path.includes(",")) {
|
|
13213
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13214
|
+
}
|
|
13215
|
+
let bracketCount = 0;
|
|
13216
|
+
let inQuotes = false;
|
|
13217
|
+
let quoteChar = "";
|
|
13218
|
+
for (let i = 0; i < path.length; i++) {
|
|
13219
|
+
const char = path[i];
|
|
13220
|
+
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
13221
|
+
if (!inQuotes) {
|
|
13222
|
+
inQuotes = true;
|
|
13223
|
+
quoteChar = char;
|
|
13224
|
+
} else if (char === quoteChar) {
|
|
13225
|
+
inQuotes = false;
|
|
13226
|
+
quoteChar = "";
|
|
13227
|
+
}
|
|
13228
|
+
} else if (char === "[" && !inQuotes) {
|
|
13229
|
+
bracketCount++;
|
|
13230
|
+
} else if (char === "]" && !inQuotes) {
|
|
13231
|
+
bracketCount--;
|
|
13232
|
+
if (bracketCount < 0) {
|
|
13233
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13234
|
+
}
|
|
13241
13235
|
}
|
|
13242
13236
|
}
|
|
13237
|
+
if (bracketCount !== 0) {
|
|
13238
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13239
|
+
}
|
|
13243
13240
|
}
|
|
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);
|
|
13241
|
+
__name(validatePath, "validatePath");
|
|
13242
|
+
function validatePaths(paths) {
|
|
13243
|
+
if (!Array.isArray(paths)) {
|
|
13244
|
+
throw new TypeError("paths must be an array");
|
|
13245
|
+
}
|
|
13246
|
+
for (const path of paths) {
|
|
13247
|
+
validatePath(path);
|
|
13257
13248
|
}
|
|
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
13249
|
}
|
|
13281
|
-
__name(
|
|
13282
|
-
|
|
13283
|
-
}
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
this.restore.state.secret = this.secret;
|
|
13295
|
-
return;
|
|
13250
|
+
__name(validatePaths, "validatePaths");
|
|
13251
|
+
function slowRedact(options = {}) {
|
|
13252
|
+
const { paths = [], censor = "[REDACTED]", serialize = JSON.stringify, strict = true, remove = false } = options;
|
|
13253
|
+
validatePaths(paths);
|
|
13254
|
+
const pathStructure = buildPathStructure(paths);
|
|
13255
|
+
return /* @__PURE__ */ __name(function redact(obj) {
|
|
13256
|
+
if (strict && (obj === null || typeof obj !== "object")) {
|
|
13257
|
+
if (obj === null || obj === void 0) {
|
|
13258
|
+
return serialize ? serialize(obj) : obj;
|
|
13259
|
+
}
|
|
13260
|
+
if (typeof obj !== "object") {
|
|
13261
|
+
return serialize ? serialize(obj) : obj;
|
|
13262
|
+
}
|
|
13296
13263
|
}
|
|
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
|
|
13264
|
+
const cloned = selectiveClone(obj, pathStructure);
|
|
13265
|
+
const original = obj;
|
|
13266
|
+
let actualCensor = censor;
|
|
13267
|
+
if (typeof censor === "function") {
|
|
13268
|
+
actualCensor = censor;
|
|
13365
13269
|
}
|
|
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
|
-
}));
|
|
13270
|
+
redactPaths(cloned, paths, actualCensor, remove);
|
|
13271
|
+
if (serialize === false) {
|
|
13272
|
+
cloned.restore = function() {
|
|
13273
|
+
return deepClone(original);
|
|
13274
|
+
};
|
|
13275
|
+
return cloned;
|
|
13276
|
+
}
|
|
13277
|
+
if (typeof serialize === "function") {
|
|
13278
|
+
return serialize(cloned);
|
|
13279
|
+
}
|
|
13280
|
+
return JSON.stringify(cloned);
|
|
13281
|
+
}, "redact");
|
|
13439
13282
|
}
|
|
13440
|
-
__name(
|
|
13283
|
+
__name(slowRedact, "slowRedact");
|
|
13284
|
+
module.exports = slowRedact;
|
|
13441
13285
|
}
|
|
13442
13286
|
});
|
|
13443
13287
|
|
|
@@ -13516,17 +13360,13 @@ var require_symbols = __commonJS({
|
|
|
13516
13360
|
var require_redaction = __commonJS({
|
|
13517
13361
|
"node_modules/pino/lib/redaction.js"(exports, module) {
|
|
13518
13362
|
"use strict";
|
|
13519
|
-
var
|
|
13363
|
+
var Redact = require_redact();
|
|
13520
13364
|
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
|
-
});
|
|
13365
|
+
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
13526
13366
|
var CENSOR = "[Redacted]";
|
|
13527
13367
|
var strict = false;
|
|
13528
13368
|
function redaction(opts, serialize) {
|
|
13529
|
-
const { paths, censor } = handle(opts);
|
|
13369
|
+
const { paths, censor, remove } = handle(opts);
|
|
13530
13370
|
const shape = paths.reduce((o, str) => {
|
|
13531
13371
|
rx.lastIndex = 0;
|
|
13532
13372
|
const first = rx.exec(str);
|
|
@@ -13559,11 +13399,12 @@ var require_redaction = __commonJS({
|
|
|
13559
13399
|
return o;
|
|
13560
13400
|
}, {});
|
|
13561
13401
|
const result = {
|
|
13562
|
-
[redactFmtSym]:
|
|
13402
|
+
[redactFmtSym]: Redact({
|
|
13563
13403
|
paths,
|
|
13564
13404
|
censor,
|
|
13565
13405
|
serialize,
|
|
13566
|
-
strict
|
|
13406
|
+
strict,
|
|
13407
|
+
remove
|
|
13567
13408
|
})
|
|
13568
13409
|
};
|
|
13569
13410
|
const topCensor = /* @__PURE__ */ __name((...args) => {
|
|
@@ -13584,11 +13425,12 @@ var require_redaction = __commonJS({
|
|
|
13584
13425
|
...path
|
|
13585
13426
|
]);
|
|
13586
13427
|
} : censor;
|
|
13587
|
-
o[k] =
|
|
13428
|
+
o[k] = Redact({
|
|
13588
13429
|
paths: shape[k],
|
|
13589
13430
|
censor: wrappedCensor,
|
|
13590
13431
|
serialize,
|
|
13591
|
-
strict
|
|
13432
|
+
strict,
|
|
13433
|
+
remove
|
|
13592
13434
|
});
|
|
13593
13435
|
}
|
|
13594
13436
|
return o;
|
|
@@ -13601,7 +13443,6 @@ var require_redaction = __commonJS({
|
|
|
13601
13443
|
paths: opts,
|
|
13602
13444
|
censor: CENSOR
|
|
13603
13445
|
};
|
|
13604
|
-
validate(opts);
|
|
13605
13446
|
return opts;
|
|
13606
13447
|
}
|
|
13607
13448
|
let { paths, censor = CENSOR, remove } = opts;
|
|
@@ -13609,13 +13450,10 @@ var require_redaction = __commonJS({
|
|
|
13609
13450
|
throw Error("pino \u2013 redact must contain an array of strings");
|
|
13610
13451
|
}
|
|
13611
13452
|
if (remove === true) censor = void 0;
|
|
13612
|
-
validate({
|
|
13613
|
-
paths,
|
|
13614
|
-
censor
|
|
13615
|
-
});
|
|
13616
13453
|
return {
|
|
13617
13454
|
paths,
|
|
13618
|
-
censor
|
|
13455
|
+
censor,
|
|
13456
|
+
remove
|
|
13619
13457
|
};
|
|
13620
13458
|
}
|
|
13621
13459
|
__name(handle, "handle");
|
|
@@ -15430,7 +15268,7 @@ var require_tools = __commonJS({
|
|
|
15430
15268
|
bindings = formatter(bindings);
|
|
15431
15269
|
for (const key in bindings) {
|
|
15432
15270
|
value = bindings[key];
|
|
15433
|
-
const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
|
|
15271
|
+
const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0;
|
|
15434
15272
|
if (valid === true) {
|
|
15435
15273
|
value = serializers[key] ? serializers[key](value) : value;
|
|
15436
15274
|
value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
|
|
@@ -15804,7 +15642,7 @@ var require_meta = __commonJS({
|
|
|
15804
15642
|
"node_modules/pino/lib/meta.js"(exports, module) {
|
|
15805
15643
|
"use strict";
|
|
15806
15644
|
module.exports = {
|
|
15807
|
-
version: "9.
|
|
15645
|
+
version: "9.14.0"
|
|
15808
15646
|
};
|
|
15809
15647
|
}
|
|
15810
15648
|
});
|
|
@@ -15816,7 +15654,7 @@ var require_proto = __commonJS({
|
|
|
15816
15654
|
var { EventEmitter } = __require("events");
|
|
15817
15655
|
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();
|
|
15818
15656
|
var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
|
|
15819
|
-
var { asChindings, asJson, buildFormatters, stringify } = require_tools();
|
|
15657
|
+
var { asChindings, asJson, buildFormatters, stringify, noop } = require_tools();
|
|
15820
15658
|
var { version } = require_meta();
|
|
15821
15659
|
var redaction = require_redaction();
|
|
15822
15660
|
var _a4;
|
|
@@ -15863,10 +15701,20 @@ var require_proto = __commonJS({
|
|
|
15863
15701
|
if (!bindings2) {
|
|
15864
15702
|
throw Error("missing bindings for child Pino");
|
|
15865
15703
|
}
|
|
15866
|
-
options = options || {};
|
|
15867
15704
|
const serializers = this[serializersSym];
|
|
15868
15705
|
const formatters = this[formattersSym];
|
|
15869
15706
|
const instance = Object.create(this);
|
|
15707
|
+
if (options == null) {
|
|
15708
|
+
if (instance[formattersSym].bindings !== resetChildingsFormatter) {
|
|
15709
|
+
instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
15710
|
+
}
|
|
15711
|
+
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
15712
|
+
instance[setLevelSym](this.level);
|
|
15713
|
+
if (this.onChild !== noop) {
|
|
15714
|
+
this.onChild(instance);
|
|
15715
|
+
}
|
|
15716
|
+
return instance;
|
|
15717
|
+
}
|
|
15870
15718
|
if (options.hasOwnProperty("serializers") === true) {
|
|
15871
15719
|
instance[serializersSym] = /* @__PURE__ */ Object.create(null);
|
|
15872
15720
|
for (const k in serializers) {
|
|
@@ -15911,10 +15759,8 @@ var require_proto = __commonJS({
|
|
|
15911
15759
|
instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
|
|
15912
15760
|
}
|
|
15913
15761
|
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
15914
|
-
|
|
15915
|
-
|
|
15916
|
-
instance[setLevelSym](childLevel);
|
|
15917
|
-
}
|
|
15762
|
+
const childLevel = options.level || this.level;
|
|
15763
|
+
instance[setLevelSym](childLevel);
|
|
15918
15764
|
this.onChild(instance);
|
|
15919
15765
|
return instance;
|
|
15920
15766
|
}
|
|
@@ -15976,9 +15822,6 @@ var require_proto = __commonJS({
|
|
|
15976
15822
|
stream.write(streamWriteHook ? streamWriteHook(s) : s);
|
|
15977
15823
|
}
|
|
15978
15824
|
__name(write, "write");
|
|
15979
|
-
function noop() {
|
|
15980
|
-
}
|
|
15981
|
-
__name(noop, "noop");
|
|
15982
15825
|
function flush(cb) {
|
|
15983
15826
|
if (cb != null && typeof cb !== "function") {
|
|
15984
15827
|
throw Error("callback must be a function");
|
|
@@ -17338,6 +17181,7 @@ function useApitally(app, config) {
|
|
|
17338
17181
|
const appInfo = getAppInfo(app, config.basePath, config.appVersion);
|
|
17339
17182
|
if (appInfo.paths.length > 0 || attempt >= 10) {
|
|
17340
17183
|
client.setStartupData(appInfo);
|
|
17184
|
+
client.startSync();
|
|
17341
17185
|
} else {
|
|
17342
17186
|
setTimeout(() => setStartupData(attempt + 1), 500);
|
|
17343
17187
|
}
|
|
@@ -17814,6 +17658,7 @@ var init_plugin = __esm({
|
|
|
17814
17658
|
});
|
|
17815
17659
|
fastify.addHook("onReady", () => {
|
|
17816
17660
|
client.setStartupData(getAppInfo2(routes, config.appVersion));
|
|
17661
|
+
client.startSync();
|
|
17817
17662
|
});
|
|
17818
17663
|
fastify.addHook("onClose", async () => {
|
|
17819
17664
|
await client.handleShutdown();
|