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.cjs
CHANGED
|
@@ -11963,11 +11963,14 @@ var init_client = __esm({
|
|
|
11963
11963
|
if (_ApitallyClient.instance) {
|
|
11964
11964
|
throw new Error("Apitally client is already initialized");
|
|
11965
11965
|
}
|
|
11966
|
+
this.logger = logger ?? getLogger();
|
|
11966
11967
|
if (!isValidClientId(clientId)) {
|
|
11967
|
-
|
|
11968
|
+
this.logger.error(`Invalid Apitally client ID '${clientId}' (expecting hexadecimal UUID format)`);
|
|
11969
|
+
this.enabled = false;
|
|
11968
11970
|
}
|
|
11969
11971
|
if (!isValidEnv(env)) {
|
|
11970
|
-
|
|
11972
|
+
this.logger.error(`Invalid Apitally env '${env}' (expecting 1-32 alphanumeric characters and hyphens only)`);
|
|
11973
|
+
this.enabled = false;
|
|
11971
11974
|
}
|
|
11972
11975
|
if (requestLoggingConfig && !requestLogging) {
|
|
11973
11976
|
console.warn("requestLoggingConfig is deprecated, use requestLogging instead.");
|
|
@@ -11982,8 +11985,6 @@ var init_client = __esm({
|
|
|
11982
11985
|
this.validationErrorCounter = new ValidationErrorCounter();
|
|
11983
11986
|
this.serverErrorCounter = new ServerErrorCounter();
|
|
11984
11987
|
this.consumerRegistry = new ConsumerRegistry();
|
|
11985
|
-
this.logger = logger ?? getLogger();
|
|
11986
|
-
this.startSync();
|
|
11987
11988
|
this.handleShutdown = this.handleShutdown.bind(this);
|
|
11988
11989
|
}
|
|
11989
11990
|
static getInstance() {
|
|
@@ -12038,15 +12039,20 @@ var init_client = __esm({
|
|
|
12038
12039
|
}
|
|
12039
12040
|
}
|
|
12040
12041
|
startSync() {
|
|
12042
|
+
if (!this.enabled) {
|
|
12043
|
+
return;
|
|
12044
|
+
}
|
|
12041
12045
|
this.sync();
|
|
12042
12046
|
this.syncIntervalId = setInterval(() => {
|
|
12043
12047
|
this.sync();
|
|
12044
12048
|
}, INITIAL_SYNC_INTERVAL);
|
|
12045
12049
|
setTimeout(() => {
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
this.
|
|
12049
|
-
|
|
12050
|
+
if (this.syncIntervalId) {
|
|
12051
|
+
clearInterval(this.syncIntervalId);
|
|
12052
|
+
this.syncIntervalId = setInterval(() => {
|
|
12053
|
+
this.sync();
|
|
12054
|
+
}, SYNC_INTERVAL);
|
|
12055
|
+
}
|
|
12050
12056
|
}, INITIAL_SYNC_INTERVAL_DURATION);
|
|
12051
12057
|
}
|
|
12052
12058
|
async sync() {
|
|
@@ -12074,7 +12080,6 @@ var init_client = __esm({
|
|
|
12074
12080
|
setStartupData(data) {
|
|
12075
12081
|
this.startupData = data;
|
|
12076
12082
|
this.startupDataSent = false;
|
|
12077
|
-
this.sendStartupData();
|
|
12078
12083
|
}
|
|
12079
12084
|
async sendStartupData() {
|
|
12080
12085
|
if (this.startupData) {
|
|
@@ -12826,619 +12831,458 @@ var require_caller = __commonJS({
|
|
|
12826
12831
|
}
|
|
12827
12832
|
});
|
|
12828
12833
|
|
|
12829
|
-
// node_modules/
|
|
12830
|
-
var
|
|
12831
|
-
"node_modules/
|
|
12834
|
+
// node_modules/@pinojs/redact/index.js
|
|
12835
|
+
var require_redact = __commonJS({
|
|
12836
|
+
"node_modules/@pinojs/redact/index.js"(exports2, module2) {
|
|
12832
12837
|
"use strict";
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12838
|
-
|
|
12839
|
-
|
|
12838
|
+
function deepClone(obj) {
|
|
12839
|
+
if (obj === null || typeof obj !== "object") {
|
|
12840
|
+
return obj;
|
|
12841
|
+
}
|
|
12842
|
+
if (obj instanceof Date) {
|
|
12843
|
+
return new Date(obj.getTime());
|
|
12844
|
+
}
|
|
12845
|
+
if (obj instanceof Array) {
|
|
12846
|
+
const cloned = [];
|
|
12847
|
+
for (let i = 0; i < obj.length; i++) {
|
|
12848
|
+
cloned[i] = deepClone(obj[i]);
|
|
12849
|
+
}
|
|
12850
|
+
return cloned;
|
|
12851
|
+
}
|
|
12852
|
+
if (typeof obj === "object") {
|
|
12853
|
+
const cloned = Object.create(Object.getPrototypeOf(obj));
|
|
12854
|
+
for (const key in obj) {
|
|
12855
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
12856
|
+
cloned[key] = deepClone(obj[key]);
|
|
12840
12857
|
}
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12858
|
+
}
|
|
12859
|
+
return cloned;
|
|
12860
|
+
}
|
|
12861
|
+
return obj;
|
|
12862
|
+
}
|
|
12863
|
+
__name(deepClone, "deepClone");
|
|
12864
|
+
function parsePath(path) {
|
|
12865
|
+
const parts = [];
|
|
12866
|
+
let current = "";
|
|
12867
|
+
let inBrackets = false;
|
|
12868
|
+
let inQuotes = false;
|
|
12869
|
+
let quoteChar = "";
|
|
12870
|
+
for (let i = 0; i < path.length; i++) {
|
|
12871
|
+
const char = path[i];
|
|
12872
|
+
if (!inBrackets && char === ".") {
|
|
12873
|
+
if (current) {
|
|
12874
|
+
parts.push(current);
|
|
12875
|
+
current = "";
|
|
12876
|
+
}
|
|
12877
|
+
} else if (char === "[") {
|
|
12878
|
+
if (current) {
|
|
12879
|
+
parts.push(current);
|
|
12880
|
+
current = "";
|
|
12881
|
+
}
|
|
12882
|
+
inBrackets = true;
|
|
12883
|
+
} else if (char === "]" && inBrackets) {
|
|
12884
|
+
parts.push(current);
|
|
12885
|
+
current = "";
|
|
12886
|
+
inBrackets = false;
|
|
12887
|
+
inQuotes = false;
|
|
12888
|
+
} else if ((char === '"' || char === "'") && inBrackets) {
|
|
12889
|
+
if (!inQuotes) {
|
|
12890
|
+
inQuotes = true;
|
|
12891
|
+
quoteChar = char;
|
|
12892
|
+
} else if (char === quoteChar) {
|
|
12893
|
+
inQuotes = false;
|
|
12894
|
+
quoteChar = "";
|
|
12895
|
+
} else {
|
|
12896
|
+
current += char;
|
|
12854
12897
|
}
|
|
12855
|
-
});
|
|
12856
|
-
}, "validate");
|
|
12857
|
-
}
|
|
12858
|
-
__name(validator, "validator");
|
|
12859
|
-
}
|
|
12860
|
-
});
|
|
12861
|
-
|
|
12862
|
-
// node_modules/fast-redact/lib/rx.js
|
|
12863
|
-
var require_rx = __commonJS({
|
|
12864
|
-
"node_modules/fast-redact/lib/rx.js"(exports2, module2) {
|
|
12865
|
-
"use strict";
|
|
12866
|
-
module2.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
|
|
12867
|
-
}
|
|
12868
|
-
});
|
|
12869
|
-
|
|
12870
|
-
// node_modules/fast-redact/lib/parse.js
|
|
12871
|
-
var require_parse = __commonJS({
|
|
12872
|
-
"node_modules/fast-redact/lib/parse.js"(exports2, module2) {
|
|
12873
|
-
"use strict";
|
|
12874
|
-
var rx = require_rx();
|
|
12875
|
-
module2.exports = parse;
|
|
12876
|
-
function parse({ paths }) {
|
|
12877
|
-
const wildcards = [];
|
|
12878
|
-
var wcLen = 0;
|
|
12879
|
-
const secret = paths.reduce(function(o, strPath, ix) {
|
|
12880
|
-
var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
|
|
12881
|
-
const leadingBracket = strPath[0] === "[";
|
|
12882
|
-
path = path.map((p) => {
|
|
12883
|
-
if (p[0] === "[") return p.substr(1, p.length - 2);
|
|
12884
|
-
else return p;
|
|
12885
|
-
});
|
|
12886
|
-
const star = path.indexOf("*");
|
|
12887
|
-
if (star > -1) {
|
|
12888
|
-
const before = path.slice(0, star);
|
|
12889
|
-
const beforeStr = before.join(".");
|
|
12890
|
-
const after = path.slice(star + 1, path.length);
|
|
12891
|
-
const nested = after.length > 0;
|
|
12892
|
-
wcLen++;
|
|
12893
|
-
wildcards.push({
|
|
12894
|
-
before,
|
|
12895
|
-
beforeStr,
|
|
12896
|
-
after,
|
|
12897
|
-
nested
|
|
12898
|
-
});
|
|
12899
12898
|
} else {
|
|
12900
|
-
|
|
12901
|
-
path,
|
|
12902
|
-
val: void 0,
|
|
12903
|
-
precensored: false,
|
|
12904
|
-
circle: "",
|
|
12905
|
-
escPath: JSON.stringify(strPath),
|
|
12906
|
-
leadingBracket
|
|
12907
|
-
};
|
|
12899
|
+
current += char;
|
|
12908
12900
|
}
|
|
12909
|
-
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
secret
|
|
12915
|
-
};
|
|
12901
|
+
}
|
|
12902
|
+
if (current) {
|
|
12903
|
+
parts.push(current);
|
|
12904
|
+
}
|
|
12905
|
+
return parts;
|
|
12916
12906
|
}
|
|
12917
|
-
__name(
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
12922
|
-
|
|
12923
|
-
|
|
12924
|
-
|
|
12925
|
-
|
|
12926
|
-
|
|
12927
|
-
function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) {
|
|
12928
|
-
const redact = Function("o", `
|
|
12929
|
-
if (typeof o !== 'object' || o == null) {
|
|
12930
|
-
${strictImpl(strict, serialize)}
|
|
12931
|
-
}
|
|
12932
|
-
const { censor, secret } = this
|
|
12933
|
-
const originalSecret = {}
|
|
12934
|
-
const secretKeys = Object.keys(secret)
|
|
12935
|
-
for (var i = 0; i < secretKeys.length; i++) {
|
|
12936
|
-
originalSecret[secretKeys[i]] = secret[secretKeys[i]]
|
|
12937
|
-
}
|
|
12938
|
-
|
|
12939
|
-
${redactTmpl(secret, isCensorFct, censorFctTakesPath)}
|
|
12940
|
-
this.compileRestore()
|
|
12941
|
-
${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)}
|
|
12942
|
-
this.secret = originalSecret
|
|
12943
|
-
${resultTmpl(serialize)}
|
|
12944
|
-
`).bind(state);
|
|
12945
|
-
redact.state = state;
|
|
12946
|
-
if (serialize === false) {
|
|
12947
|
-
redact.restore = (o) => state.restore(o);
|
|
12948
|
-
}
|
|
12949
|
-
return redact;
|
|
12950
|
-
}
|
|
12951
|
-
__name(redactor, "redactor");
|
|
12952
|
-
function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
|
|
12953
|
-
return Object.keys(secret).map((path) => {
|
|
12954
|
-
const { escPath, leadingBracket, path: arrPath } = secret[path];
|
|
12955
|
-
const skip = leadingBracket ? 1 : 0;
|
|
12956
|
-
const delim = leadingBracket ? "" : ".";
|
|
12957
|
-
const hops = [];
|
|
12958
|
-
var match;
|
|
12959
|
-
while ((match = rx.exec(path)) !== null) {
|
|
12960
|
-
const [, ix] = match;
|
|
12961
|
-
const { index, input } = match;
|
|
12962
|
-
if (index > skip) hops.push(input.substring(0, index - (ix ? 0 : 1)));
|
|
12963
|
-
}
|
|
12964
|
-
var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
|
|
12965
|
-
if (existence.length === 0) existence += `o${delim}${path} != null`;
|
|
12966
|
-
else existence += ` && o${delim}${path} != null`;
|
|
12967
|
-
const circularDetection = `
|
|
12968
|
-
switch (true) {
|
|
12969
|
-
${hops.reverse().map((p) => `
|
|
12970
|
-
case o${delim}${p} === censor:
|
|
12971
|
-
secret[${escPath}].circle = ${JSON.stringify(p)}
|
|
12972
|
-
break
|
|
12973
|
-
`).join("\n")}
|
|
12974
|
-
}
|
|
12975
|
-
`;
|
|
12976
|
-
const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
|
|
12977
|
-
return `
|
|
12978
|
-
if (${existence}) {
|
|
12979
|
-
const val = o${delim}${path}
|
|
12980
|
-
if (val === censor) {
|
|
12981
|
-
secret[${escPath}].precensored = true
|
|
12982
|
-
} else {
|
|
12983
|
-
secret[${escPath}].val = val
|
|
12984
|
-
o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
|
|
12985
|
-
${circularDetection}
|
|
12907
|
+
__name(parsePath, "parsePath");
|
|
12908
|
+
function setValue(obj, parts, value) {
|
|
12909
|
+
let current = obj;
|
|
12910
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
12911
|
+
const key = parts[i];
|
|
12912
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
12913
|
+
return false;
|
|
12914
|
+
}
|
|
12915
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
12916
|
+
return false;
|
|
12986
12917
|
}
|
|
12918
|
+
current = current[key];
|
|
12987
12919
|
}
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
13001
|
-
|
|
12920
|
+
const lastKey = parts[parts.length - 1];
|
|
12921
|
+
if (lastKey === "*") {
|
|
12922
|
+
if (Array.isArray(current)) {
|
|
12923
|
+
for (let i = 0; i < current.length; i++) {
|
|
12924
|
+
current[i] = value;
|
|
12925
|
+
}
|
|
12926
|
+
} else if (typeof current === "object" && current !== null) {
|
|
12927
|
+
for (const key in current) {
|
|
12928
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
12929
|
+
current[key] = value;
|
|
12930
|
+
}
|
|
12931
|
+
}
|
|
12932
|
+
}
|
|
12933
|
+
} else {
|
|
12934
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
12935
|
+
current[lastKey] = value;
|
|
12936
|
+
}
|
|
13002
12937
|
}
|
|
12938
|
+
return true;
|
|
13003
12939
|
}
|
|
13004
|
-
|
|
12940
|
+
__name(setValue, "setValue");
|
|
12941
|
+
function removeKey(obj, parts) {
|
|
12942
|
+
let current = obj;
|
|
12943
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
12944
|
+
const key = parts[i];
|
|
12945
|
+
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
12946
|
+
return false;
|
|
12947
|
+
}
|
|
12948
|
+
if (typeof current[key] !== "object" || current[key] === null) {
|
|
12949
|
+
return false;
|
|
12950
|
+
}
|
|
12951
|
+
current = current[key];
|
|
12952
|
+
}
|
|
12953
|
+
const lastKey = parts[parts.length - 1];
|
|
12954
|
+
if (lastKey === "*") {
|
|
12955
|
+
if (Array.isArray(current)) {
|
|
12956
|
+
for (let i = 0; i < current.length; i++) {
|
|
12957
|
+
current[i] = void 0;
|
|
12958
|
+
}
|
|
12959
|
+
} else if (typeof current === "object" && current !== null) {
|
|
12960
|
+
for (const key in current) {
|
|
12961
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
12962
|
+
delete current[key];
|
|
12963
|
+
}
|
|
12964
|
+
}
|
|
12965
|
+
}
|
|
12966
|
+
} else {
|
|
12967
|
+
if (typeof current === "object" && current !== null && lastKey in current && Object.prototype.hasOwnProperty.call(current, lastKey)) {
|
|
12968
|
+
delete current[lastKey];
|
|
12969
|
+
}
|
|
12970
|
+
}
|
|
12971
|
+
return true;
|
|
13005
12972
|
}
|
|
13006
|
-
__name(
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
12973
|
+
__name(removeKey, "removeKey");
|
|
12974
|
+
var PATH_NOT_FOUND = Symbol("PATH_NOT_FOUND");
|
|
12975
|
+
function getValueIfExists(obj, parts) {
|
|
12976
|
+
let current = obj;
|
|
12977
|
+
for (const part of parts) {
|
|
12978
|
+
if (current === null || current === void 0) {
|
|
12979
|
+
return PATH_NOT_FOUND;
|
|
12980
|
+
}
|
|
12981
|
+
if (typeof current !== "object" || current === null) {
|
|
12982
|
+
return PATH_NOT_FOUND;
|
|
12983
|
+
}
|
|
12984
|
+
if (!(part in current)) {
|
|
12985
|
+
return PATH_NOT_FOUND;
|
|
12986
|
+
}
|
|
12987
|
+
current = current[part];
|
|
12988
|
+
}
|
|
12989
|
+
return current;
|
|
13013
12990
|
}
|
|
13014
|
-
__name(
|
|
13015
|
-
function
|
|
13016
|
-
|
|
12991
|
+
__name(getValueIfExists, "getValueIfExists");
|
|
12992
|
+
function getValue(obj, parts) {
|
|
12993
|
+
let current = obj;
|
|
12994
|
+
for (const part of parts) {
|
|
12995
|
+
if (current === null || current === void 0) {
|
|
12996
|
+
return void 0;
|
|
12997
|
+
}
|
|
12998
|
+
if (typeof current !== "object" || current === null) {
|
|
12999
|
+
return void 0;
|
|
13000
|
+
}
|
|
13001
|
+
current = current[part];
|
|
13002
|
+
}
|
|
13003
|
+
return current;
|
|
13017
13004
|
}
|
|
13018
|
-
__name(
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
"node_modules/fast-redact/lib/modifiers.js"(exports2, module2) {
|
|
13025
|
-
"use strict";
|
|
13026
|
-
module2.exports = {
|
|
13027
|
-
groupRedact,
|
|
13028
|
-
groupRestore,
|
|
13029
|
-
nestedRedact,
|
|
13030
|
-
nestedRestore
|
|
13031
|
-
};
|
|
13032
|
-
function groupRestore({ keys, values, target }) {
|
|
13033
|
-
if (target == null || typeof target === "string") return;
|
|
13034
|
-
const length = keys.length;
|
|
13035
|
-
for (var i = 0; i < length; i++) {
|
|
13036
|
-
const k = keys[i];
|
|
13037
|
-
target[k] = values[i];
|
|
13038
|
-
}
|
|
13039
|
-
}
|
|
13040
|
-
__name(groupRestore, "groupRestore");
|
|
13041
|
-
function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
|
|
13042
|
-
const target = get(o, path);
|
|
13043
|
-
if (target == null || typeof target === "string") return {
|
|
13044
|
-
keys: null,
|
|
13045
|
-
values: null,
|
|
13046
|
-
target,
|
|
13047
|
-
flat: true
|
|
13048
|
-
};
|
|
13049
|
-
const keys = Object.keys(target);
|
|
13050
|
-
const keysLength = keys.length;
|
|
13051
|
-
const pathLength = path.length;
|
|
13052
|
-
const pathWithKey = censorFctTakesPath ? [
|
|
13053
|
-
...path
|
|
13054
|
-
] : void 0;
|
|
13055
|
-
const values = new Array(keysLength);
|
|
13056
|
-
for (var i = 0; i < keysLength; i++) {
|
|
13057
|
-
const key = keys[i];
|
|
13058
|
-
values[i] = target[key];
|
|
13059
|
-
if (censorFctTakesPath) {
|
|
13060
|
-
pathWithKey[pathLength] = key;
|
|
13061
|
-
target[key] = censor(target[key], pathWithKey);
|
|
13062
|
-
} else if (isCensorFct) {
|
|
13063
|
-
target[key] = censor(target[key]);
|
|
13005
|
+
__name(getValue, "getValue");
|
|
13006
|
+
function redactPaths(obj, paths, censor, remove = false) {
|
|
13007
|
+
for (const path of paths) {
|
|
13008
|
+
const parts = parsePath(path);
|
|
13009
|
+
if (parts.includes("*")) {
|
|
13010
|
+
redactWildcardPath(obj, parts, censor, path, remove);
|
|
13064
13011
|
} else {
|
|
13065
|
-
|
|
13012
|
+
if (remove) {
|
|
13013
|
+
removeKey(obj, parts);
|
|
13014
|
+
} else {
|
|
13015
|
+
const value = getValueIfExists(obj, parts);
|
|
13016
|
+
if (value === PATH_NOT_FOUND) {
|
|
13017
|
+
continue;
|
|
13018
|
+
}
|
|
13019
|
+
const actualCensor = typeof censor === "function" ? censor(value, parts) : censor;
|
|
13020
|
+
setValue(obj, parts, actualCensor);
|
|
13021
|
+
}
|
|
13066
13022
|
}
|
|
13067
13023
|
}
|
|
13068
|
-
return {
|
|
13069
|
-
keys,
|
|
13070
|
-
values,
|
|
13071
|
-
target,
|
|
13072
|
-
flat: true
|
|
13073
|
-
};
|
|
13074
13024
|
}
|
|
13075
|
-
__name(
|
|
13076
|
-
function
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13083
|
-
|
|
13084
|
-
|
|
13085
|
-
}
|
|
13086
|
-
__name(nestedRestore, "nestedRestore");
|
|
13087
|
-
function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
|
|
13088
|
-
const target = get(o, path);
|
|
13089
|
-
if (target == null) return;
|
|
13090
|
-
const keys = Object.keys(target);
|
|
13091
|
-
const keysLength = keys.length;
|
|
13092
|
-
for (var i = 0; i < keysLength; i++) {
|
|
13093
|
-
const key = keys[i];
|
|
13094
|
-
specialSet(store, target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
|
|
13095
|
-
}
|
|
13096
|
-
return store;
|
|
13097
|
-
}
|
|
13098
|
-
__name(nestedRedact, "nestedRedact");
|
|
13099
|
-
function has(obj, prop) {
|
|
13100
|
-
return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
|
|
13101
|
-
}
|
|
13102
|
-
__name(has, "has");
|
|
13103
|
-
function specialSet(store, o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
|
|
13104
|
-
const afterPathLen = afterPath.length;
|
|
13105
|
-
const lastPathIndex = afterPathLen - 1;
|
|
13106
|
-
const originalKey = k;
|
|
13107
|
-
var i = -1;
|
|
13108
|
-
var n;
|
|
13109
|
-
var nv;
|
|
13110
|
-
var ov;
|
|
13111
|
-
var oov = null;
|
|
13112
|
-
var wc = null;
|
|
13113
|
-
var kIsWc;
|
|
13114
|
-
var wcov;
|
|
13115
|
-
var consecutive = false;
|
|
13116
|
-
var level = 0;
|
|
13117
|
-
var depth = 0;
|
|
13118
|
-
var redactPathCurrent = tree();
|
|
13119
|
-
ov = n = o[k];
|
|
13120
|
-
if (typeof n !== "object") return;
|
|
13121
|
-
while (n != null && ++i < afterPathLen) {
|
|
13122
|
-
depth += 1;
|
|
13123
|
-
k = afterPath[i];
|
|
13124
|
-
oov = ov;
|
|
13125
|
-
if (k !== "*" && !wc && !(typeof n === "object" && k in n)) {
|
|
13126
|
-
break;
|
|
13025
|
+
__name(redactPaths, "redactPaths");
|
|
13026
|
+
function redactWildcardPath(obj, parts, censor, originalPath, remove = false) {
|
|
13027
|
+
const wildcardIndex = parts.indexOf("*");
|
|
13028
|
+
if (wildcardIndex === parts.length - 1) {
|
|
13029
|
+
const parentParts = parts.slice(0, -1);
|
|
13030
|
+
let current = obj;
|
|
13031
|
+
for (const part of parentParts) {
|
|
13032
|
+
if (current === null || current === void 0) return;
|
|
13033
|
+
if (typeof current !== "object" || current === null) return;
|
|
13034
|
+
current = current[part];
|
|
13127
13035
|
}
|
|
13128
|
-
if (
|
|
13129
|
-
if (
|
|
13130
|
-
|
|
13036
|
+
if (Array.isArray(current)) {
|
|
13037
|
+
if (remove) {
|
|
13038
|
+
for (let i = 0; i < current.length; i++) {
|
|
13039
|
+
current[i] = void 0;
|
|
13040
|
+
}
|
|
13041
|
+
} else {
|
|
13042
|
+
for (let i = 0; i < current.length; i++) {
|
|
13043
|
+
const indexPath = [
|
|
13044
|
+
...parentParts,
|
|
13045
|
+
i.toString()
|
|
13046
|
+
];
|
|
13047
|
+
const actualCensor = typeof censor === "function" ? censor(current[i], indexPath) : censor;
|
|
13048
|
+
current[i] = actualCensor;
|
|
13049
|
+
}
|
|
13131
13050
|
}
|
|
13132
|
-
|
|
13133
|
-
if (
|
|
13134
|
-
|
|
13051
|
+
} else if (typeof current === "object" && current !== null) {
|
|
13052
|
+
if (remove) {
|
|
13053
|
+
const keysToDelete = [];
|
|
13054
|
+
for (const key in current) {
|
|
13055
|
+
if (Object.prototype.hasOwnProperty.call(current, key)) {
|
|
13056
|
+
keysToDelete.push(key);
|
|
13057
|
+
}
|
|
13058
|
+
}
|
|
13059
|
+
for (const key of keysToDelete) {
|
|
13060
|
+
delete current[key];
|
|
13061
|
+
}
|
|
13062
|
+
} else {
|
|
13063
|
+
for (const key in current) {
|
|
13064
|
+
const keyPath = [
|
|
13065
|
+
...parentParts,
|
|
13066
|
+
key
|
|
13067
|
+
];
|
|
13068
|
+
const actualCensor = typeof censor === "function" ? censor(current[key], keyPath) : censor;
|
|
13069
|
+
current[key] = actualCensor;
|
|
13070
|
+
}
|
|
13135
13071
|
}
|
|
13136
13072
|
}
|
|
13137
|
-
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
ov = wcov[k];
|
|
13153
|
-
}
|
|
13154
|
-
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [
|
|
13155
|
-
...path,
|
|
13156
|
-
originalKey,
|
|
13157
|
-
...afterPath
|
|
13158
|
-
]) : censor(ov) : censor;
|
|
13159
|
-
if (kIsWc) {
|
|
13160
|
-
const rv = restoreInstr(node(redactPathCurrent, wck, depth), ov, o[originalKey]);
|
|
13161
|
-
store.push(rv);
|
|
13162
|
-
n[wck] = nv;
|
|
13163
|
-
} else {
|
|
13164
|
-
if (wcov[k] === nv) {
|
|
13165
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
13166
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
13167
|
-
} else {
|
|
13168
|
-
redactPathCurrent = node(redactPathCurrent, wck, depth);
|
|
13169
|
-
const rv = restoreInstr(node(redactPathCurrent, k, depth + 1), ov, o[originalKey]);
|
|
13170
|
-
store.push(rv);
|
|
13171
|
-
wcov[k] = nv;
|
|
13172
|
-
}
|
|
13173
|
-
}
|
|
13174
|
-
}
|
|
13073
|
+
} else {
|
|
13074
|
+
redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove);
|
|
13075
|
+
}
|
|
13076
|
+
}
|
|
13077
|
+
__name(redactWildcardPath, "redactWildcardPath");
|
|
13078
|
+
function redactIntermediateWildcard(obj, parts, censor, wildcardIndex, originalPath, remove = false) {
|
|
13079
|
+
const beforeWildcard = parts.slice(0, wildcardIndex);
|
|
13080
|
+
const afterWildcard = parts.slice(wildcardIndex + 1);
|
|
13081
|
+
const pathArray = [];
|
|
13082
|
+
function traverse(current, pathLength) {
|
|
13083
|
+
if (pathLength === beforeWildcard.length) {
|
|
13084
|
+
if (Array.isArray(current)) {
|
|
13085
|
+
for (let i = 0; i < current.length; i++) {
|
|
13086
|
+
pathArray[pathLength] = i.toString();
|
|
13087
|
+
traverse(current[i], pathLength + 1);
|
|
13175
13088
|
}
|
|
13089
|
+
} else if (typeof current === "object" && current !== null) {
|
|
13090
|
+
for (const key in current) {
|
|
13091
|
+
pathArray[pathLength] = key;
|
|
13092
|
+
traverse(current[key], pathLength + 1);
|
|
13093
|
+
}
|
|
13094
|
+
}
|
|
13095
|
+
} else if (pathLength < beforeWildcard.length) {
|
|
13096
|
+
const nextKey = beforeWildcard[pathLength];
|
|
13097
|
+
if (current && typeof current === "object" && current !== null && nextKey in current) {
|
|
13098
|
+
pathArray[pathLength] = nextKey;
|
|
13099
|
+
traverse(current[nextKey], pathLength + 1);
|
|
13176
13100
|
}
|
|
13177
|
-
wc = null;
|
|
13178
13101
|
} else {
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13102
|
+
if (afterWildcard.includes("*")) {
|
|
13103
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
13104
|
+
const fullPath = [
|
|
13105
|
+
...pathArray.slice(0, pathLength),
|
|
13106
|
+
...path
|
|
13107
|
+
];
|
|
13108
|
+
return censor(value, fullPath);
|
|
13109
|
+
} : censor;
|
|
13110
|
+
redactWildcardPath(current, afterWildcard, wrappedCensor, originalPath, remove);
|
|
13187
13111
|
} else {
|
|
13188
|
-
|
|
13189
|
-
|
|
13190
|
-
|
|
13112
|
+
if (remove) {
|
|
13113
|
+
removeKey(current, afterWildcard);
|
|
13114
|
+
} else {
|
|
13115
|
+
const actualCensor = typeof censor === "function" ? censor(getValue(current, afterWildcard), [
|
|
13116
|
+
...pathArray.slice(0, pathLength),
|
|
13117
|
+
...afterWildcard
|
|
13118
|
+
]) : censor;
|
|
13119
|
+
setValue(current, afterWildcard, actualCensor);
|
|
13120
|
+
}
|
|
13191
13121
|
}
|
|
13192
|
-
n = n[k];
|
|
13193
13122
|
}
|
|
13194
|
-
|
|
13195
|
-
|
|
13123
|
+
}
|
|
13124
|
+
__name(traverse, "traverse");
|
|
13125
|
+
if (beforeWildcard.length === 0) {
|
|
13126
|
+
traverse(obj, 0);
|
|
13127
|
+
} else {
|
|
13128
|
+
let current = obj;
|
|
13129
|
+
for (let i = 0; i < beforeWildcard.length; i++) {
|
|
13130
|
+
const part = beforeWildcard[i];
|
|
13131
|
+
if (current === null || current === void 0) return;
|
|
13132
|
+
if (typeof current !== "object" || current === null) return;
|
|
13133
|
+
current = current[part];
|
|
13134
|
+
pathArray[i] = part;
|
|
13135
|
+
}
|
|
13136
|
+
if (current !== null && current !== void 0) {
|
|
13137
|
+
traverse(current, beforeWildcard.length);
|
|
13138
|
+
}
|
|
13139
|
+
}
|
|
13140
|
+
}
|
|
13141
|
+
__name(redactIntermediateWildcard, "redactIntermediateWildcard");
|
|
13142
|
+
function buildPathStructure(pathsToClone) {
|
|
13143
|
+
if (pathsToClone.length === 0) {
|
|
13144
|
+
return null;
|
|
13145
|
+
}
|
|
13146
|
+
const pathStructure = /* @__PURE__ */ new Map();
|
|
13147
|
+
for (const path of pathsToClone) {
|
|
13148
|
+
const parts = parsePath(path);
|
|
13149
|
+
let current = pathStructure;
|
|
13150
|
+
for (let i = 0; i < parts.length; i++) {
|
|
13151
|
+
const part = parts[i];
|
|
13152
|
+
if (!current.has(part)) {
|
|
13153
|
+
current.set(part, /* @__PURE__ */ new Map());
|
|
13154
|
+
}
|
|
13155
|
+
current = current.get(part);
|
|
13196
13156
|
}
|
|
13197
13157
|
}
|
|
13158
|
+
return pathStructure;
|
|
13198
13159
|
}
|
|
13199
|
-
__name(
|
|
13200
|
-
function
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
var n = o;
|
|
13204
|
-
while (n != null && ++i < l) {
|
|
13205
|
-
n = n[p[i]];
|
|
13160
|
+
__name(buildPathStructure, "buildPathStructure");
|
|
13161
|
+
function selectiveClone(obj, pathStructure) {
|
|
13162
|
+
if (!pathStructure) {
|
|
13163
|
+
return obj;
|
|
13206
13164
|
}
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13165
|
+
function cloneSelectively(source, pathMap, depth = 0) {
|
|
13166
|
+
if (!pathMap || pathMap.size === 0) {
|
|
13167
|
+
return source;
|
|
13168
|
+
}
|
|
13169
|
+
if (source === null || typeof source !== "object") {
|
|
13170
|
+
return source;
|
|
13171
|
+
}
|
|
13172
|
+
if (source instanceof Date) {
|
|
13173
|
+
return new Date(source.getTime());
|
|
13174
|
+
}
|
|
13175
|
+
if (Array.isArray(source)) {
|
|
13176
|
+
const cloned2 = [];
|
|
13177
|
+
for (let i = 0; i < source.length; i++) {
|
|
13178
|
+
const indexStr = i.toString();
|
|
13179
|
+
if (pathMap.has(indexStr) || pathMap.has("*")) {
|
|
13180
|
+
cloned2[i] = cloneSelectively(source[i], pathMap.get(indexStr) || pathMap.get("*"));
|
|
13181
|
+
} else {
|
|
13182
|
+
cloned2[i] = source[i];
|
|
13183
|
+
}
|
|
13217
13184
|
}
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
store.push(rv);
|
|
13226
|
-
n[wck] = nv;
|
|
13227
|
-
} else {
|
|
13228
|
-
if (wcov[k] === nv) {
|
|
13229
|
-
} else if (nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov) {
|
|
13185
|
+
return cloned2;
|
|
13186
|
+
}
|
|
13187
|
+
const cloned = Object.create(Object.getPrototypeOf(source));
|
|
13188
|
+
for (const key in source) {
|
|
13189
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13190
|
+
if (pathMap.has(key) || pathMap.has("*")) {
|
|
13191
|
+
cloned[key] = cloneSelectively(source[key], pathMap.get(key) || pathMap.get("*"));
|
|
13230
13192
|
} else {
|
|
13231
|
-
|
|
13232
|
-
store.push(rv);
|
|
13233
|
-
wcov[k] = nv;
|
|
13193
|
+
cloned[key] = source[key];
|
|
13234
13194
|
}
|
|
13235
13195
|
}
|
|
13236
13196
|
}
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13197
|
+
return cloned;
|
|
13198
|
+
}
|
|
13199
|
+
__name(cloneSelectively, "cloneSelectively");
|
|
13200
|
+
return cloneSelectively(obj, pathStructure);
|
|
13201
|
+
}
|
|
13202
|
+
__name(selectiveClone, "selectiveClone");
|
|
13203
|
+
function validatePath(path) {
|
|
13204
|
+
if (typeof path !== "string") {
|
|
13205
|
+
throw new Error("Paths must be (non-empty) strings");
|
|
13206
|
+
}
|
|
13207
|
+
if (path === "") {
|
|
13208
|
+
throw new Error("Invalid redaction path ()");
|
|
13209
|
+
}
|
|
13210
|
+
if (path.includes("..")) {
|
|
13211
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13212
|
+
}
|
|
13213
|
+
if (path.includes(",")) {
|
|
13214
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13215
|
+
}
|
|
13216
|
+
let bracketCount = 0;
|
|
13217
|
+
let inQuotes = false;
|
|
13218
|
+
let quoteChar = "";
|
|
13219
|
+
for (let i = 0; i < path.length; i++) {
|
|
13220
|
+
const char = path[i];
|
|
13221
|
+
if ((char === '"' || char === "'") && bracketCount > 0) {
|
|
13222
|
+
if (!inQuotes) {
|
|
13223
|
+
inQuotes = true;
|
|
13224
|
+
quoteChar = char;
|
|
13225
|
+
} else if (char === quoteChar) {
|
|
13226
|
+
inQuotes = false;
|
|
13227
|
+
quoteChar = "";
|
|
13228
|
+
}
|
|
13229
|
+
} else if (char === "[" && !inQuotes) {
|
|
13230
|
+
bracketCount++;
|
|
13231
|
+
} else if (char === "]" && !inQuotes) {
|
|
13232
|
+
bracketCount--;
|
|
13233
|
+
if (bracketCount < 0) {
|
|
13234
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13235
|
+
}
|
|
13242
13236
|
}
|
|
13243
13237
|
}
|
|
13238
|
+
if (bracketCount !== 0) {
|
|
13239
|
+
throw new Error(`Invalid redaction path (${path})`);
|
|
13240
|
+
}
|
|
13244
13241
|
}
|
|
13245
|
-
__name(
|
|
13246
|
-
function
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
};
|
|
13253
|
-
}
|
|
13254
|
-
__name(tree, "tree");
|
|
13255
|
-
function node(parent, key, depth) {
|
|
13256
|
-
if (parent.depth === depth) {
|
|
13257
|
-
return node(parent.parent, key, depth);
|
|
13242
|
+
__name(validatePath, "validatePath");
|
|
13243
|
+
function validatePaths(paths) {
|
|
13244
|
+
if (!Array.isArray(paths)) {
|
|
13245
|
+
throw new TypeError("paths must be an array");
|
|
13246
|
+
}
|
|
13247
|
+
for (const path of paths) {
|
|
13248
|
+
validatePath(path);
|
|
13258
13249
|
}
|
|
13259
|
-
var child = {
|
|
13260
|
-
parent,
|
|
13261
|
-
key,
|
|
13262
|
-
depth,
|
|
13263
|
-
children: []
|
|
13264
|
-
};
|
|
13265
|
-
parent.children.push(child);
|
|
13266
|
-
return child;
|
|
13267
|
-
}
|
|
13268
|
-
__name(node, "node");
|
|
13269
|
-
function restoreInstr(node2, value, target) {
|
|
13270
|
-
let current = node2;
|
|
13271
|
-
const path = [];
|
|
13272
|
-
do {
|
|
13273
|
-
path.push(current.key);
|
|
13274
|
-
current = current.parent;
|
|
13275
|
-
} while (current.parent != null);
|
|
13276
|
-
return {
|
|
13277
|
-
path,
|
|
13278
|
-
value,
|
|
13279
|
-
target
|
|
13280
|
-
};
|
|
13281
13250
|
}
|
|
13282
|
-
__name(
|
|
13283
|
-
|
|
13284
|
-
}
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
this.restore.state.secret = this.secret;
|
|
13296
|
-
return;
|
|
13251
|
+
__name(validatePaths, "validatePaths");
|
|
13252
|
+
function slowRedact(options = {}) {
|
|
13253
|
+
const { paths = [], censor = "[REDACTED]", serialize = JSON.stringify, strict = true, remove = false } = options;
|
|
13254
|
+
validatePaths(paths);
|
|
13255
|
+
const pathStructure = buildPathStructure(paths);
|
|
13256
|
+
return /* @__PURE__ */ __name(function redact(obj) {
|
|
13257
|
+
if (strict && (obj === null || typeof obj !== "object")) {
|
|
13258
|
+
if (obj === null || obj === void 0) {
|
|
13259
|
+
return serialize ? serialize(obj) : obj;
|
|
13260
|
+
}
|
|
13261
|
+
if (typeof obj !== "object") {
|
|
13262
|
+
return serialize ? serialize(obj) : obj;
|
|
13263
|
+
}
|
|
13297
13264
|
}
|
|
13298
|
-
const
|
|
13299
|
-
const
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
|
|
13303
|
-
secret,
|
|
13304
|
-
groupRestore,
|
|
13305
|
-
nestedRestore
|
|
13306
|
-
} : {
|
|
13307
|
-
secret
|
|
13308
|
-
};
|
|
13309
|
-
this.restore = Function("o", restoreTmpl(resetters, paths, hasWildcards)).bind(state);
|
|
13310
|
-
this.restore.state = state;
|
|
13311
|
-
}, "compileRestore");
|
|
13312
|
-
}
|
|
13313
|
-
__name(restorer, "restorer");
|
|
13314
|
-
function resetTmpl(secret, paths) {
|
|
13315
|
-
return paths.map((path) => {
|
|
13316
|
-
const { circle, escPath, leadingBracket } = secret[path];
|
|
13317
|
-
const delim = leadingBracket ? "" : ".";
|
|
13318
|
-
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
|
|
13319
|
-
const clear = `secret[${escPath}].val = undefined`;
|
|
13320
|
-
return `
|
|
13321
|
-
if (secret[${escPath}].val !== undefined) {
|
|
13322
|
-
try { ${reset} } catch (e) {}
|
|
13323
|
-
${clear}
|
|
13324
|
-
}
|
|
13325
|
-
`;
|
|
13326
|
-
}).join("");
|
|
13327
|
-
}
|
|
13328
|
-
__name(resetTmpl, "resetTmpl");
|
|
13329
|
-
function restoreTmpl(resetters, paths, hasWildcards) {
|
|
13330
|
-
const dynamicReset = hasWildcards === true ? `
|
|
13331
|
-
const keys = Object.keys(secret)
|
|
13332
|
-
const len = keys.length
|
|
13333
|
-
for (var i = len - 1; i >= ${paths.length}; i--) {
|
|
13334
|
-
const k = keys[i]
|
|
13335
|
-
const o = secret[k]
|
|
13336
|
-
if (o) {
|
|
13337
|
-
if (o.flat === true) this.groupRestore(o)
|
|
13338
|
-
else this.nestedRestore(o)
|
|
13339
|
-
secret[k] = null
|
|
13340
|
-
}
|
|
13341
|
-
}
|
|
13342
|
-
` : "";
|
|
13343
|
-
return `
|
|
13344
|
-
const secret = this.secret
|
|
13345
|
-
${dynamicReset}
|
|
13346
|
-
${resetters}
|
|
13347
|
-
return o
|
|
13348
|
-
`;
|
|
13349
|
-
}
|
|
13350
|
-
__name(restoreTmpl, "restoreTmpl");
|
|
13351
|
-
}
|
|
13352
|
-
});
|
|
13353
|
-
|
|
13354
|
-
// node_modules/fast-redact/lib/state.js
|
|
13355
|
-
var require_state = __commonJS({
|
|
13356
|
-
"node_modules/fast-redact/lib/state.js"(exports2, module2) {
|
|
13357
|
-
"use strict";
|
|
13358
|
-
module2.exports = state;
|
|
13359
|
-
function state(o) {
|
|
13360
|
-
const { secret, censor, compileRestore, serialize, groupRedact, nestedRedact, wildcards, wcLen } = o;
|
|
13361
|
-
const builder = [
|
|
13362
|
-
{
|
|
13363
|
-
secret,
|
|
13364
|
-
censor,
|
|
13365
|
-
compileRestore
|
|
13265
|
+
const cloned = selectiveClone(obj, pathStructure);
|
|
13266
|
+
const original = obj;
|
|
13267
|
+
let actualCensor = censor;
|
|
13268
|
+
if (typeof censor === "function") {
|
|
13269
|
+
actualCensor = censor;
|
|
13366
13270
|
}
|
|
13367
|
-
|
|
13368
|
-
|
|
13369
|
-
|
|
13370
|
-
|
|
13371
|
-
|
|
13372
|
-
|
|
13373
|
-
|
|
13374
|
-
|
|
13375
|
-
|
|
13376
|
-
|
|
13377
|
-
|
|
13378
|
-
|
|
13379
|
-
__name(state, "state");
|
|
13380
|
-
}
|
|
13381
|
-
});
|
|
13382
|
-
|
|
13383
|
-
// node_modules/fast-redact/index.js
|
|
13384
|
-
var require_fast_redact = __commonJS({
|
|
13385
|
-
"node_modules/fast-redact/index.js"(exports2, module2) {
|
|
13386
|
-
"use strict";
|
|
13387
|
-
var validator = require_validator();
|
|
13388
|
-
var parse = require_parse();
|
|
13389
|
-
var redactor = require_redactor();
|
|
13390
|
-
var restorer = require_restorer();
|
|
13391
|
-
var { groupRedact, nestedRedact } = require_modifiers();
|
|
13392
|
-
var state = require_state();
|
|
13393
|
-
var rx = require_rx();
|
|
13394
|
-
var validate = validator();
|
|
13395
|
-
var noop = /* @__PURE__ */ __name((o) => o, "noop");
|
|
13396
|
-
noop.restore = noop;
|
|
13397
|
-
var DEFAULT_CENSOR = "[REDACTED]";
|
|
13398
|
-
fastRedact.rx = rx;
|
|
13399
|
-
fastRedact.validator = validator;
|
|
13400
|
-
module2.exports = fastRedact;
|
|
13401
|
-
function fastRedact(opts = {}) {
|
|
13402
|
-
const paths = Array.from(new Set(opts.paths || []));
|
|
13403
|
-
const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
|
|
13404
|
-
const remove = opts.remove;
|
|
13405
|
-
if (remove === true && serialize !== JSON.stringify) {
|
|
13406
|
-
throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
|
|
13407
|
-
}
|
|
13408
|
-
const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR;
|
|
13409
|
-
const isCensorFct = typeof censor === "function";
|
|
13410
|
-
const censorFctTakesPath = isCensorFct && censor.length > 1;
|
|
13411
|
-
if (paths.length === 0) return serialize || noop;
|
|
13412
|
-
validate({
|
|
13413
|
-
paths,
|
|
13414
|
-
serialize,
|
|
13415
|
-
censor
|
|
13416
|
-
});
|
|
13417
|
-
const { wildcards, wcLen, secret } = parse({
|
|
13418
|
-
paths,
|
|
13419
|
-
censor
|
|
13420
|
-
});
|
|
13421
|
-
const compileRestore = restorer();
|
|
13422
|
-
const strict = "strict" in opts ? opts.strict : true;
|
|
13423
|
-
return redactor({
|
|
13424
|
-
secret,
|
|
13425
|
-
wcLen,
|
|
13426
|
-
serialize,
|
|
13427
|
-
strict,
|
|
13428
|
-
isCensorFct,
|
|
13429
|
-
censorFctTakesPath
|
|
13430
|
-
}, state({
|
|
13431
|
-
secret,
|
|
13432
|
-
censor,
|
|
13433
|
-
compileRestore,
|
|
13434
|
-
serialize,
|
|
13435
|
-
groupRedact,
|
|
13436
|
-
nestedRedact,
|
|
13437
|
-
wildcards,
|
|
13438
|
-
wcLen
|
|
13439
|
-
}));
|
|
13271
|
+
redactPaths(cloned, paths, actualCensor, remove);
|
|
13272
|
+
if (serialize === false) {
|
|
13273
|
+
cloned.restore = function() {
|
|
13274
|
+
return deepClone(original);
|
|
13275
|
+
};
|
|
13276
|
+
return cloned;
|
|
13277
|
+
}
|
|
13278
|
+
if (typeof serialize === "function") {
|
|
13279
|
+
return serialize(cloned);
|
|
13280
|
+
}
|
|
13281
|
+
return JSON.stringify(cloned);
|
|
13282
|
+
}, "redact");
|
|
13440
13283
|
}
|
|
13441
|
-
__name(
|
|
13284
|
+
__name(slowRedact, "slowRedact");
|
|
13285
|
+
module2.exports = slowRedact;
|
|
13442
13286
|
}
|
|
13443
13287
|
});
|
|
13444
13288
|
|
|
@@ -13517,17 +13361,13 @@ var require_symbols = __commonJS({
|
|
|
13517
13361
|
var require_redaction = __commonJS({
|
|
13518
13362
|
"node_modules/pino/lib/redaction.js"(exports2, module2) {
|
|
13519
13363
|
"use strict";
|
|
13520
|
-
var
|
|
13364
|
+
var Redact = require_redact();
|
|
13521
13365
|
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
|
13522
|
-
var
|
|
13523
|
-
var validate = validator({
|
|
13524
|
-
ERR_PATHS_MUST_BE_STRINGS: /* @__PURE__ */ __name(() => "pino \u2013 redacted paths must be strings", "ERR_PATHS_MUST_BE_STRINGS"),
|
|
13525
|
-
ERR_INVALID_PATH: /* @__PURE__ */ __name((s) => `pino \u2013 redact paths array contains an invalid path (${s})`, "ERR_INVALID_PATH")
|
|
13526
|
-
});
|
|
13366
|
+
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
13527
13367
|
var CENSOR = "[Redacted]";
|
|
13528
13368
|
var strict = false;
|
|
13529
13369
|
function redaction(opts, serialize) {
|
|
13530
|
-
const { paths, censor } = handle(opts);
|
|
13370
|
+
const { paths, censor, remove } = handle(opts);
|
|
13531
13371
|
const shape = paths.reduce((o, str) => {
|
|
13532
13372
|
rx.lastIndex = 0;
|
|
13533
13373
|
const first = rx.exec(str);
|
|
@@ -13560,11 +13400,12 @@ var require_redaction = __commonJS({
|
|
|
13560
13400
|
return o;
|
|
13561
13401
|
}, {});
|
|
13562
13402
|
const result = {
|
|
13563
|
-
[redactFmtSym]:
|
|
13403
|
+
[redactFmtSym]: Redact({
|
|
13564
13404
|
paths,
|
|
13565
13405
|
censor,
|
|
13566
13406
|
serialize,
|
|
13567
|
-
strict
|
|
13407
|
+
strict,
|
|
13408
|
+
remove
|
|
13568
13409
|
})
|
|
13569
13410
|
};
|
|
13570
13411
|
const topCensor = /* @__PURE__ */ __name((...args) => {
|
|
@@ -13585,11 +13426,12 @@ var require_redaction = __commonJS({
|
|
|
13585
13426
|
...path
|
|
13586
13427
|
]);
|
|
13587
13428
|
} : censor;
|
|
13588
|
-
o[k] =
|
|
13429
|
+
o[k] = Redact({
|
|
13589
13430
|
paths: shape[k],
|
|
13590
13431
|
censor: wrappedCensor,
|
|
13591
13432
|
serialize,
|
|
13592
|
-
strict
|
|
13433
|
+
strict,
|
|
13434
|
+
remove
|
|
13593
13435
|
});
|
|
13594
13436
|
}
|
|
13595
13437
|
return o;
|
|
@@ -13602,7 +13444,6 @@ var require_redaction = __commonJS({
|
|
|
13602
13444
|
paths: opts,
|
|
13603
13445
|
censor: CENSOR
|
|
13604
13446
|
};
|
|
13605
|
-
validate(opts);
|
|
13606
13447
|
return opts;
|
|
13607
13448
|
}
|
|
13608
13449
|
let { paths, censor = CENSOR, remove } = opts;
|
|
@@ -13610,13 +13451,10 @@ var require_redaction = __commonJS({
|
|
|
13610
13451
|
throw Error("pino \u2013 redact must contain an array of strings");
|
|
13611
13452
|
}
|
|
13612
13453
|
if (remove === true) censor = void 0;
|
|
13613
|
-
validate({
|
|
13614
|
-
paths,
|
|
13615
|
-
censor
|
|
13616
|
-
});
|
|
13617
13454
|
return {
|
|
13618
13455
|
paths,
|
|
13619
|
-
censor
|
|
13456
|
+
censor,
|
|
13457
|
+
remove
|
|
13620
13458
|
};
|
|
13621
13459
|
}
|
|
13622
13460
|
__name(handle, "handle");
|
|
@@ -15431,7 +15269,7 @@ var require_tools = __commonJS({
|
|
|
15431
15269
|
bindings = formatter(bindings);
|
|
15432
15270
|
for (const key in bindings) {
|
|
15433
15271
|
value = bindings[key];
|
|
15434
|
-
const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
|
|
15272
|
+
const valid = (key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0;
|
|
15435
15273
|
if (valid === true) {
|
|
15436
15274
|
value = serializers[key] ? serializers[key](value) : value;
|
|
15437
15275
|
value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
|
|
@@ -15805,7 +15643,7 @@ var require_meta = __commonJS({
|
|
|
15805
15643
|
"node_modules/pino/lib/meta.js"(exports2, module2) {
|
|
15806
15644
|
"use strict";
|
|
15807
15645
|
module2.exports = {
|
|
15808
|
-
version: "9.
|
|
15646
|
+
version: "9.14.0"
|
|
15809
15647
|
};
|
|
15810
15648
|
}
|
|
15811
15649
|
});
|
|
@@ -15817,7 +15655,7 @@ var require_proto = __commonJS({
|
|
|
15817
15655
|
var { EventEmitter } = require("events");
|
|
15818
15656
|
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();
|
|
15819
15657
|
var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
|
|
15820
|
-
var { asChindings, asJson, buildFormatters, stringify } = require_tools();
|
|
15658
|
+
var { asChindings, asJson, buildFormatters, stringify, noop } = require_tools();
|
|
15821
15659
|
var { version } = require_meta();
|
|
15822
15660
|
var redaction = require_redaction();
|
|
15823
15661
|
var _a4;
|
|
@@ -15864,10 +15702,20 @@ var require_proto = __commonJS({
|
|
|
15864
15702
|
if (!bindings2) {
|
|
15865
15703
|
throw Error("missing bindings for child Pino");
|
|
15866
15704
|
}
|
|
15867
|
-
options = options || {};
|
|
15868
15705
|
const serializers = this[serializersSym];
|
|
15869
15706
|
const formatters = this[formattersSym];
|
|
15870
15707
|
const instance = Object.create(this);
|
|
15708
|
+
if (options == null) {
|
|
15709
|
+
if (instance[formattersSym].bindings !== resetChildingsFormatter) {
|
|
15710
|
+
instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
15711
|
+
}
|
|
15712
|
+
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
15713
|
+
instance[setLevelSym](this.level);
|
|
15714
|
+
if (this.onChild !== noop) {
|
|
15715
|
+
this.onChild(instance);
|
|
15716
|
+
}
|
|
15717
|
+
return instance;
|
|
15718
|
+
}
|
|
15871
15719
|
if (options.hasOwnProperty("serializers") === true) {
|
|
15872
15720
|
instance[serializersSym] = /* @__PURE__ */ Object.create(null);
|
|
15873
15721
|
for (const k in serializers) {
|
|
@@ -15912,10 +15760,8 @@ var require_proto = __commonJS({
|
|
|
15912
15760
|
instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
|
|
15913
15761
|
}
|
|
15914
15762
|
instance[chindingsSym] = asChindings(instance, bindings2);
|
|
15915
|
-
|
|
15916
|
-
|
|
15917
|
-
instance[setLevelSym](childLevel);
|
|
15918
|
-
}
|
|
15763
|
+
const childLevel = options.level || this.level;
|
|
15764
|
+
instance[setLevelSym](childLevel);
|
|
15919
15765
|
this.onChild(instance);
|
|
15920
15766
|
return instance;
|
|
15921
15767
|
}
|
|
@@ -15977,9 +15823,6 @@ var require_proto = __commonJS({
|
|
|
15977
15823
|
stream.write(streamWriteHook ? streamWriteHook(s) : s);
|
|
15978
15824
|
}
|
|
15979
15825
|
__name(write, "write");
|
|
15980
|
-
function noop() {
|
|
15981
|
-
}
|
|
15982
|
-
__name(noop, "noop");
|
|
15983
15826
|
function flush(cb) {
|
|
15984
15827
|
if (cb != null && typeof cb !== "function") {
|
|
15985
15828
|
throw Error("callback must be a function");
|
|
@@ -17337,6 +17180,7 @@ function useApitally(app, config) {
|
|
|
17337
17180
|
const appInfo = getAppInfo(app, config.basePath, config.appVersion);
|
|
17338
17181
|
if (appInfo.paths.length > 0 || attempt >= 10) {
|
|
17339
17182
|
client.setStartupData(appInfo);
|
|
17183
|
+
client.startSync();
|
|
17340
17184
|
} else {
|
|
17341
17185
|
setTimeout(() => setStartupData(attempt + 1), 500);
|
|
17342
17186
|
}
|
|
@@ -17816,6 +17660,7 @@ var init_plugin = __esm({
|
|
|
17816
17660
|
});
|
|
17817
17661
|
fastify.addHook("onReady", () => {
|
|
17818
17662
|
client.setStartupData(getAppInfo2(routes, config.appVersion));
|
|
17663
|
+
client.startSync();
|
|
17819
17664
|
});
|
|
17820
17665
|
fastify.addHook("onClose", async () => {
|
|
17821
17666
|
await client.handleShutdown();
|