lakutata
Version:
An IoC-based universal application framework.
2,126 lines (1,837 loc) • 378 kB
JavaScript
"use strict";
const e = require("./Package.1.cjs");
const t = require("../src/lib/core/Component.cjs");
const n = require("../src/decorators/di/Lifetime.cjs");
const r = require("../src/decorators/di/Configurable.cjs");
const i = require("./Package.2.cjs");
const s = require("./Package.5.cjs");
require("./Package.8.cjs");
require("./Package.10.cjs");
const o = require("fs");
const a = require("events");
const l = require("util");
const u = require("path");
const f = require("worker_threads");
const c = require("./Package.132.cjs");
require("./Package.11.cjs");
require("./Package.14.cjs");
require("./Package.18.cjs");
const d = require("url");
const h = require("buffer");
const p = require("assert");
const g = require("module");
const y = require("os");
const b = require("../src/lib/base/internal/BasicInfo.cjs");
const m = require("tty");
const w = require("stream");
const _ = require("string_decoder");
const v = require("../src/lib/helpers/As.cjs");
const S = require("node:stream");
const E = e => e && e.__esModule ? e : {
default: e
};
const A = E(o);
const x = E(a);
const O = E(l);
const j = E(u);
const L = E(f);
const R = E(d);
const k = E(h);
const T = E(p);
const D = E(g);
const C = E(y);
const N = E(m);
const P = E(w);
const M = E(_);
var B = {
exports: {}
};
"use strict";
const I = e => e && typeof e.message === "string";
const $ = e => {
if (!e) return;
const t = e.cause;
if (typeof t === "function") {
const t = e.cause();
return I(t) ? t : undefined;
} else {
return I(t) ? t : undefined;
}
};
const F = (e, t) => {
if (!I(e)) return "";
const n = e.stack || "";
if (t.has(e)) {
return n + "\ncauses have become circular...";
}
const r = $(e);
if (r) {
t.add(e);
return n + "\ncaused by: " + F(r, t);
} else {
return n;
}
};
const W = e => F(e, new Set);
const U = (e, t, n) => {
if (!I(e)) return "";
const r = n ? "" : e.message || "";
if (t.has(e)) {
return r + ": ...";
}
const i = $(e);
if (i) {
t.add(e);
const n = typeof e.cause === "function";
return r + (n ? "" : ": ") + U(i, t, n);
} else {
return r;
}
};
const G = e => U(e, new Set);
var K = {
isErrorLike: I,
getErrorCause: $,
stackWithCauses: W,
messageWithCauses: G
};
const V = s.getDefaultExportFromCjs(K);
"use strict";
const z = Symbol("circular-ref-tag");
const H = Symbol("pino-raw-err-ref");
const q = Object.create({}, {
type: {
enumerable: true,
writable: true,
value: undefined
},
message: {
enumerable: true,
writable: true,
value: undefined
},
stack: {
enumerable: true,
writable: true,
value: undefined
},
aggregateErrors: {
enumerable: true,
writable: true,
value: undefined
},
raw: {
enumerable: false,
get: function() {
return this[H];
},
set: function(e) {
this[H] = e;
}
}
});
Object.defineProperty(q, H, {
writable: true,
value: {}
});
var Y = {
pinoErrProto: q,
pinoErrorSymbols: {
seen: z,
rawSymbol: H
}
};
const J = s.getDefaultExportFromCjs(Y);
"use strict";
var X = se;
const {messageWithCauses: Z, stackWithCauses: Q, isErrorLike: ee} = K;
const {pinoErrProto: te, pinoErrorSymbols: ne} = Y;
const {seen: re} = ne;
const {toString: ie} = Object.prototype;
function se(e) {
if (!ee(e)) {
return e;
}
e[re] = undefined;
const t = Object.create(te);
t.type = ie.call(e.constructor) === "[object Function]" ? e.constructor.name : e.name;
t.message = Z(e);
t.stack = Q(e);
if (Array.isArray(e.errors)) {
t.aggregateErrors = e.errors.map((e => se(e)));
}
for (const n in e) {
if (t[n] === undefined) {
const r = e[n];
if (ee(r)) {
if (n !== "cause" && !Object.prototype.hasOwnProperty.call(r, re)) {
t[n] = se(r);
}
} else {
t[n] = r;
}
}
}
delete e[re];
t.raw = e;
return t;
}
const oe = s.getDefaultExportFromCjs(X);
"use strict";
var ae = he;
const {isErrorLike: le} = K;
const {pinoErrProto: ue, pinoErrorSymbols: fe} = Y;
const {seen: ce} = fe;
const {toString: de} = Object.prototype;
function he(e) {
if (!le(e)) {
return e;
}
e[ce] = undefined;
const t = Object.create(ue);
t.type = de.call(e.constructor) === "[object Function]" ? e.constructor.name : e.name;
t.message = e.message;
t.stack = e.stack;
if (Array.isArray(e.errors)) {
t.aggregateErrors = e.errors.map((e => he(e)));
}
if (le(e.cause) && !Object.prototype.hasOwnProperty.call(e.cause, ce)) {
t.cause = he(e.cause);
}
for (const n in e) {
if (t[n] === undefined) {
const r = e[n];
if (le(r)) {
if (!Object.prototype.hasOwnProperty.call(r, ce)) {
t[n] = he(r);
}
} else {
t[n] = r;
}
}
}
delete e[ce];
t.raw = e;
return t;
}
const pe = s.getDefaultExportFromCjs(ae);
"use strict";
var ge = {
mapHttpRequest: we,
reqSerializer: me
};
const ye = Symbol("pino-raw-req-ref");
const be = Object.create({}, {
id: {
enumerable: true,
writable: true,
value: ""
},
method: {
enumerable: true,
writable: true,
value: ""
},
url: {
enumerable: true,
writable: true,
value: ""
},
query: {
enumerable: true,
writable: true,
value: ""
},
params: {
enumerable: true,
writable: true,
value: ""
},
headers: {
enumerable: true,
writable: true,
value: {}
},
remoteAddress: {
enumerable: true,
writable: true,
value: ""
},
remotePort: {
enumerable: true,
writable: true,
value: ""
},
raw: {
enumerable: false,
get: function() {
return this[ye];
},
set: function(e) {
this[ye] = e;
}
}
});
Object.defineProperty(be, ye, {
writable: true,
value: {}
});
function me(e) {
const t = e.info || e.socket;
const n = Object.create(be);
n.id = typeof e.id === "function" ? e.id() : e.id || (e.info ? e.info.id : undefined);
n.method = e.method;
if (e.originalUrl) {
n.url = e.originalUrl;
} else {
const t = e.path;
n.url = typeof t === "string" ? t : e.url ? e.url.path || e.url : undefined;
}
if (e.query) {
n.query = e.query;
}
if (e.params) {
n.params = e.params;
}
n.headers = e.headers;
n.remoteAddress = t && t.remoteAddress;
n.remotePort = t && t.remotePort;
n.raw = e.raw || e;
return n;
}
function we(e) {
return {
req: me(e)
};
}
const _e = s.getDefaultExportFromCjs(ge);
"use strict";
var ve = {
mapHttpResponse: xe,
resSerializer: Ae
};
const Se = Symbol("pino-raw-res-ref");
const Ee = Object.create({}, {
statusCode: {
enumerable: true,
writable: true,
value: 0
},
headers: {
enumerable: true,
writable: true,
value: ""
},
raw: {
enumerable: false,
get: function() {
return this[Se];
},
set: function(e) {
this[Se] = e;
}
}
});
Object.defineProperty(Ee, Se, {
writable: true,
value: {}
});
function Ae(e) {
const t = Object.create(Ee);
t.statusCode = e.headersSent ? e.statusCode : null;
t.headers = e.getHeaders ? e.getHeaders() : e._headers;
t.raw = e;
return t;
}
function xe(e) {
return {
res: Ae(e)
};
}
const Oe = s.getDefaultExportFromCjs(ve);
"use strict";
const je = X;
const Le = ae;
const Re = ge;
const ke = ve;
var Te = {
err: je,
errWithCause: Le,
mapHttpRequest: Re.mapHttpRequest,
mapHttpResponse: ke.mapHttpResponse,
req: Re.reqSerializer,
res: ke.resSerializer,
wrapErrorSerializer: function e(t) {
if (t === je) return t;
return function e(n) {
return t(je(n));
};
},
wrapRequestSerializer: function e(t) {
if (t === Re.reqSerializer) return t;
return function e(n) {
return t(Re.reqSerializer(n));
};
},
wrapResponseSerializer: function e(t) {
if (t === ke.resSerializer) return t;
return function e(n) {
return t(ke.resSerializer(n));
};
}
};
const De = s.getDefaultExportFromCjs(Te);
"use strict";
function Ce(e, t) {
return t;
}
var Ne = function e() {
const t = Error.prepareStackTrace;
Error.prepareStackTrace = Ce;
const n = (new Error).stack;
Error.prepareStackTrace = t;
if (!Array.isArray(n)) {
return undefined;
}
const r = n.slice(2);
const i = [];
for (const e of r) {
if (!e) {
continue;
}
i.push(e.getFileName());
}
return i;
};
const Pe = s.getDefaultExportFromCjs(Ne);
"use strict";
var Me = Be;
function Be(e = {}) {
const {ERR_PATHS_MUST_BE_STRINGS: t = () => "fast-redact - Paths must be (non-empty) strings", ERR_INVALID_PATH: n = e => `fast-redact – Invalid path (${e})`} = e;
return function e({paths: r}) {
r.forEach((e => {
if (typeof e !== "string") {
throw Error(t());
}
try {
if (/〇/.test(e)) throw Error();
const t = (e[0] === "[" ? "" : ".") + e.replace(/^\*/, "〇").replace(/\.\*/g, ".〇").replace(/\[\*\]/g, "[〇]");
if (/\n|\r|;/.test(t)) throw Error();
if (/\/\*/.test(t)) throw Error();
Function(`\n 'use strict'\n const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });\n const 〇 = null;\n o${t}\n if ([o${t}].length !== 1) throw Error()`)();
} catch (t) {
throw Error(n(e));
}
}));
};
}
const Ie = s.getDefaultExportFromCjs(Me);
"use strict";
var $e = /[^.[\]]+|\[((?:.)*?)\]/g;
const Fe = s.getDefaultExportFromCjs($e);
"use strict";
const We = $e;
var Ue = Ge;
function Ge({paths: e}) {
const t = [];
var n = 0;
const r = e.reduce((function(e, r, i) {
var s = r.match(We).map((e => e.replace(/'|"|`/g, "")));
const o = r[0] === "[";
s = s.map((e => {
if (e[0] === "[") return e.substr(1, e.length - 2); else return e;
}));
const a = s.indexOf("*");
if (a > -1) {
const e = s.slice(0, a);
const r = e.join(".");
const i = s.slice(a + 1, s.length);
const o = i.length > 0;
n++;
t.push({
before: e,
beforeStr: r,
after: i,
nested: o
});
} else {
e[r] = {
path: s,
val: undefined,
precensored: false,
circle: "",
escPath: JSON.stringify(r),
leadingBracket: o
};
}
return e;
}), {});
return {
wildcards: t,
wcLen: n,
secret: r
};
}
const Ke = s.getDefaultExportFromCjs(Ue);
"use strict";
const Ve = $e;
var ze = He;
function He({secret: e, serialize: t, wcLen: n, strict: r, isCensorFct: i, censorFctTakesPath: s}, o) {
const a = Function("o", `\n if (typeof o !== 'object' || o == null) {\n ${Xe(r, t)}\n }\n const { censor, secret } = this\n const originalSecret = {}\n const secretKeys = Object.keys(secret)\n for (var i = 0; i < secretKeys.length; i++) {\n originalSecret[secretKeys[i]] = secret[secretKeys[i]]\n }\n\n ${qe(e, i, s)}\n this.compileRestore()\n ${Ye(n > 0, i, s)}\n this.secret = originalSecret\n ${Je(t)}\n `).bind(o);
a.state = o;
if (t === false) {
a.restore = e => o.restore(e);
}
return a;
}
function qe(e, t, n) {
return Object.keys(e).map((r => {
const {escPath: i, leadingBracket: s, path: o} = e[r];
const a = s ? 1 : 0;
const l = s ? "" : ".";
const u = [];
var f;
while ((f = Ve.exec(r)) !== null) {
const [, e] = f;
const {index: t, input: n} = f;
if (t > a) u.push(n.substring(0, t - (e ? 0 : 1)));
}
var c = u.map((e => `o${l}${e}`)).join(" && ");
if (c.length === 0) c += `o${l}${r} != null`; else c += ` && o${l}${r} != null`;
const d = `\n switch (true) {\n ${u.reverse().map((e => `\n case o${l}${e} === censor:\n secret[${i}].circle = ${JSON.stringify(e)}\n break\n `)).join("\n")}\n }\n `;
const h = n ? `val, ${JSON.stringify(o)}` : `val`;
return `\n if (${c}) {\n const val = o${l}${r}\n if (val === censor) {\n secret[${i}].precensored = true\n } else {\n secret[${i}].val = val\n o${l}${r} = ${t ? `censor(${h})` : "censor"}\n ${d}\n }\n }\n `;
})).join("\n");
}
function Ye(e, t, n) {
return e === true ? `\n {\n const { wildcards, wcLen, groupRedact, nestedRedact } = this\n for (var i = 0; i < wcLen; i++) {\n const { before, beforeStr, after, nested } = wildcards[i]\n if (nested === true) {\n secret[beforeStr] = secret[beforeStr] || []\n nestedRedact(secret[beforeStr], o, before, after, censor, ${t}, ${n})\n } else secret[beforeStr] = groupRedact(o, before, censor, ${t}, ${n})\n }\n }\n ` : "";
}
function Je(e) {
return e === false ? `return o` : `\n var s = this.serialize(o)\n this.restore(o)\n return s\n `;
}
function Xe(e, t) {
return e === true ? `throw Error('fast-redact: primitives cannot be redacted')` : t === false ? `return o` : `return this.serialize(o)`;
}
const Ze = s.getDefaultExportFromCjs(ze);
"use strict";
var Qe = {
groupRedact: tt,
groupRestore: et,
nestedRedact: rt,
nestedRestore: nt
};
function et({keys: e, values: t, target: n}) {
if (n == null || typeof n === "string") return;
const r = e.length;
for (var i = 0; i < r; i++) {
const r = e[i];
n[r] = t[i];
}
}
function tt(e, t, n, r, i) {
const s = ot(e, t);
if (s == null || typeof s === "string") return {
keys: null,
values: null,
target: s,
flat: true
};
const o = Object.keys(s);
const a = o.length;
const l = t.length;
const u = i ? [ ...t ] : undefined;
const f = new Array(a);
for (var c = 0; c < a; c++) {
const e = o[c];
f[c] = s[e];
if (i) {
u[l] = e;
s[e] = n(s[e], u);
} else if (r) {
s[e] = n(s[e]);
} else {
s[e] = n;
}
}
return {
keys: o,
values: f,
target: s,
flat: true
};
}
function nt(e) {
for (let t = 0; t < e.length; t++) {
const {target: n, path: r, value: i} = e[t];
let s = n;
for (let e = r.length - 1; e > 0; e--) {
s = s[r[e]];
}
s[r[0]] = i;
}
}
function rt(e, t, n, r, i, s, o) {
const a = ot(t, n);
if (a == null) return;
const l = Object.keys(a);
const u = l.length;
for (var f = 0; f < u; f++) {
const t = l[f];
st(e, a, t, n, r, i, s, o);
}
return e;
}
function it(e, t) {
return e !== undefined && e !== null ? "hasOwn" in Object ? Object.hasOwn(e, t) : Object.prototype.hasOwnProperty.call(e, t) : false;
}
function st(e, t, n, r, i, s, o, a) {
const l = i.length;
const u = l - 1;
const f = n;
var c = -1;
var d;
var h;
var p;
var g = null;
var y = null;
var b;
var m;
var w = false;
var _ = 0;
var v = 0;
var S = lt();
p = d = t[n];
if (typeof d !== "object") return;
while (d != null && ++c < l) {
v += 1;
n = i[c];
g = p;
if (n !== "*" && !y && !(typeof d === "object" && n in d)) {
break;
}
if (n === "*") {
if (y === "*") {
w = true;
}
y = n;
if (c !== u) {
continue;
}
}
if (y) {
const l = Object.keys(d);
for (var E = 0; E < l.length; E++) {
const g = l[E];
m = d[g];
b = n === "*";
if (w) {
S = ut(S, g, v);
_ = c;
p = at(m, _ - 1, n, r, i, s, o, a, f, d, h, p, b, g, c, u, S, e, t[f], v + 1);
} else {
if (b || typeof m === "object" && m !== null && n in m) {
if (b) {
p = m;
} else {
p = m[n];
}
h = c !== u ? p : o ? a ? s(p, [ ...r, f, ...i ]) : s(p) : s;
if (b) {
const n = ft(ut(S, g, v), p, t[f]);
e.push(n);
d[g] = h;
} else {
if (m[n] === h) {} else if (h === undefined && s !== undefined || it(m, n) && h === p) {
S = ut(S, g, v);
} else {
S = ut(S, g, v);
const r = ft(ut(S, n, v + 1), p, t[f]);
e.push(r);
m[n] = h;
}
}
}
}
}
y = null;
} else {
p = d[n];
S = ut(S, n, v);
h = c !== u ? p : o ? a ? s(p, [ ...r, f, ...i ]) : s(p) : s;
if (it(d, n) && h === p || h === undefined && s !== undefined) {} else {
const r = ft(S, p, t[f]);
e.push(r);
d[n] = h;
}
d = d[n];
}
if (typeof d !== "object") break;
if (p === g || typeof p === "undefined") {}
}
}
function ot(e, t) {
var n = -1;
var r = t.length;
var i = e;
while (i != null && ++n < r) {
i = i[t[n]];
}
return i;
}
function at(e, t, n, r, i, s, o, a, l, u, f, c, d, h, p, g, y, b, m, w) {
if (t === 0) {
if (d || typeof e === "object" && e !== null && n in e) {
if (d) {
c = e;
} else {
c = e[n];
}
f = p !== g ? c : o ? a ? s(c, [ ...r, l, ...i ]) : s(c) : s;
if (d) {
const e = ft(y, c, m);
b.push(e);
u[h] = f;
} else {
if (e[n] === f) {} else if (f === undefined && s !== undefined || it(e, n) && f === c) {} else {
const t = ft(ut(y, n, w + 1), c, m);
b.push(t);
e[n] = f;
}
}
}
}
for (const _ in e) {
if (typeof e[_] === "object") {
y = ut(y, _, w);
at(e[_], t - 1, n, r, i, s, o, a, l, u, f, c, d, h, p, g, y, b, m, w + 1);
}
}
}
function lt() {
return {
parent: null,
key: null,
children: [],
depth: 0
};
}
function ut(e, t, n) {
if (e.depth === n) {
return ut(e.parent, t, n);
}
var r = {
parent: e,
key: t,
depth: n,
children: []
};
e.children.push(r);
return r;
}
function ft(e, t, n) {
let r = e;
const i = [];
do {
i.push(r.key);
r = r.parent;
} while (r.parent != null);
return {
path: i,
value: t,
target: n
};
}
const ct = s.getDefaultExportFromCjs(Qe);
"use strict";
const {groupRestore: dt, nestedRestore: ht} = Qe;
var pt = gt;
function gt() {
return function e() {
if (this.restore) {
this.restore.state.secret = this.secret;
return;
}
const {secret: t, wcLen: n} = this;
const r = Object.keys(t);
const i = yt(t, r);
const s = n > 0;
const o = s ? {
secret: t,
groupRestore: dt,
nestedRestore: ht
} : {
secret: t
};
this.restore = Function("o", bt(i, r, s)).bind(o);
this.restore.state = o;
};
}
function yt(e, t) {
return t.map((t => {
const {circle: n, escPath: r, leadingBracket: i} = e[t];
const s = i ? "" : ".";
const o = n ? `o.${n} = secret[${r}].val` : `o${s}${t} = secret[${r}].val`;
const a = `secret[${r}].val = undefined`;
return `\n if (secret[${r}].val !== undefined) {\n try { ${o} } catch (e) {}\n ${a}\n }\n `;
})).join("");
}
function bt(e, t, n) {
const r = n === true ? `\n const keys = Object.keys(secret)\n const len = keys.length\n for (var i = len - 1; i >= ${t.length}; i--) {\n const k = keys[i]\n const o = secret[k]\n if (o) {\n if (o.flat === true) this.groupRestore(o)\n else this.nestedRestore(o)\n secret[k] = null\n }\n }\n ` : "";
return `\n const secret = this.secret\n ${r}\n ${e}\n return o\n `;
}
const mt = s.getDefaultExportFromCjs(pt);
"use strict";
var wt = _t;
function _t(e) {
const {secret: t, censor: n, compileRestore: r, serialize: i, groupRedact: s, nestedRedact: o, wildcards: a, wcLen: l} = e;
const u = [ {
secret: t,
censor: n,
compileRestore: r
} ];
if (i !== false) u.push({
serialize: i
});
if (l > 0) u.push({
groupRedact: s,
nestedRedact: o,
wildcards: a,
wcLen: l
});
return Object.assign(...u);
}
const vt = s.getDefaultExportFromCjs(wt);
"use strict";
const St = Me;
const Et = Ue;
const At = ze;
const xt = pt;
const {groupRedact: Ot, nestedRedact: jt} = Qe;
const Lt = wt;
const Rt = $e;
const kt = St();
const Tt = e => e;
Tt.restore = Tt;
const Dt = "[REDACTED]";
Nt.rx = Rt;
Nt.validator = St;
var Ct = Nt;
function Nt(e = {}) {
const t = Array.from(new Set(e.paths || []));
const n = "serialize" in e ? e.serialize === false ? e.serialize : typeof e.serialize === "function" ? e.serialize : JSON.stringify : JSON.stringify;
const r = e.remove;
if (r === true && n !== JSON.stringify) {
throw Error("fast-redact – remove option may only be set when serializer is JSON.stringify");
}
const i = r === true ? undefined : "censor" in e ? e.censor : Dt;
const s = typeof i === "function";
const o = s && i.length > 1;
if (t.length === 0) return n || Tt;
kt({
paths: t,
serialize: n,
censor: i
});
const {wildcards: a, wcLen: l, secret: u} = Et({
paths: t,
censor: i
});
const f = xt();
const c = "strict" in e ? e.strict : true;
return At({
secret: u,
wcLen: l,
serialize: n,
strict: c,
isCensorFct: s,
censorFctTakesPath: o
}, Lt({
secret: u,
censor: i,
compileRestore: f,
serialize: n,
groupRedact: Ot,
nestedRedact: jt,
wildcards: a,
wcLen: l
}));
}
const Pt = s.getDefaultExportFromCjs(Ct);
"use strict";
const Mt = Symbol("pino.setLevel");
const Bt = Symbol("pino.getLevel");
const It = Symbol("pino.levelVal");
const $t = Symbol("pino.levelComp");
const Ft = Symbol("pino.useLevelLabels");
const Wt = Symbol("pino.useOnlyCustomLevels");
const Ut = Symbol("pino.mixin");
const Gt = Symbol("pino.lsCache");
const Kt = Symbol("pino.chindings");
const Vt = Symbol("pino.asJson");
const zt = Symbol("pino.write");
const Ht = Symbol("pino.redactFmt");
const qt = Symbol("pino.time");
const Yt = Symbol("pino.timeSliceIndex");
const Jt = Symbol("pino.stream");
const Xt = Symbol("pino.stringify");
const Zt = Symbol("pino.stringifySafe");
const Qt = Symbol("pino.stringifiers");
const en = Symbol("pino.end");
const tn = Symbol("pino.formatOpts");
const nn = Symbol("pino.messageKey");
const rn = Symbol("pino.errorKey");
const sn = Symbol("pino.nestedKey");
const on = Symbol("pino.nestedKeyStr");
const an = Symbol("pino.mixinMergeStrategy");
const ln = Symbol("pino.msgPrefix");
const un = Symbol("pino.wildcardFirst");
const fn = Symbol.for("pino.serializers");
const cn = Symbol.for("pino.formatters");
const dn = Symbol.for("pino.hooks");
const hn = Symbol.for("pino.metadata");
var pn = {
setLevelSym: Mt,
getLevelSym: Bt,
levelValSym: It,
levelCompSym: $t,
useLevelLabelsSym: Ft,
mixinSym: Ut,
lsCacheSym: Gt,
chindingsSym: Kt,
asJsonSym: Vt,
writeSym: zt,
serializersSym: fn,
redactFmtSym: Ht,
timeSym: qt,
timeSliceIndexSym: Yt,
streamSym: Jt,
stringifySym: Xt,
stringifySafeSym: Zt,
stringifiersSym: Qt,
endSym: en,
formatOptsSym: tn,
messageKeySym: nn,
errorKeySym: rn,
nestedKeySym: sn,
wildcardFirstSym: un,
needsMetadataGsym: hn,
useOnlyCustomLevelsSym: Wt,
formattersSym: cn,
hooksSym: dn,
nestedKeyStrSym: on,
mixinMergeStrategySym: an,
msgPrefixSym: ln
};
const gn = s.getDefaultExportFromCjs(pn);
"use strict";
const yn = Ct;
const {redactFmtSym: bn, wildcardFirstSym: mn} = pn;
const {rx: wn, validator: _n} = yn;
const vn = _n({
ERR_PATHS_MUST_BE_STRINGS: () => "pino – redacted paths must be strings",
ERR_INVALID_PATH: e => `pino – redact paths array contains an invalid path (${e})`
});
const Sn = "[Redacted]";
const En = false;
function An(e, t) {
const {paths: n, censor: r} = xn(e);
const i = n.reduce(((e, t) => {
wn.lastIndex = 0;
const n = wn.exec(t);
const r = wn.exec(t);
let i = n[1] !== undefined ? n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : n[0];
if (i === "*") {
i = mn;
}
if (r === null) {
e[i] = null;
return e;
}
if (e[i] === null) {
return e;
}
const {index: s} = r;
const o = `${t.substr(s, t.length - 1)}`;
e[i] = e[i] || [];
if (i !== mn && e[i].length === 0) {
e[i].push(...e[mn] || []);
}
if (i === mn) {
Object.keys(e).forEach((function(t) {
if (e[t]) {
e[t].push(o);
}
}));
}
e[i].push(o);
return e;
}), {});
const s = {
[bn]: yn({
paths: n,
censor: r,
serialize: t,
strict: En
})
};
const o = (...e) => typeof r === "function" ? t(r(...e)) : t(r);
return [ ...Object.keys(i), ...Object.getOwnPropertySymbols(i) ].reduce(((e, n) => {
if (i[n] === null) {
e[n] = e => o(e, [ n ]);
} else {
const s = typeof r === "function" ? (e, t) => r(e, [ n, ...t ]) : r;
e[n] = yn({
paths: i[n],
censor: s,
serialize: t,
strict: En
});
}
return e;
}), s);
}
function xn(e) {
if (Array.isArray(e)) {
e = {
paths: e,
censor: Sn
};
vn(e);
return e;
}
let {paths: t, censor: n = Sn, remove: r} = e;
if (Array.isArray(t) === false) {
throw Error("pino – redact must contain an array of strings");
}
if (r === true) n = undefined;
vn({
paths: t,
censor: n
});
return {
paths: t,
censor: n
};
}
var On = An;
const jn = s.getDefaultExportFromCjs(On);
"use strict";
const Ln = () => "";
const Rn = () => `,"time":${Date.now()}`;
const kn = () => `,"time":${Math.round(Date.now() / 1e3)}`;
const Tn = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
var Dn = {
nullTime: Ln,
epochTime: Rn,
unixTime: kn,
isoTime: Tn
};
const Cn = s.getDefaultExportFromCjs(Dn);
"use strict";
function Nn(e) {
try {
return JSON.stringify(e);
} catch (e) {
return '"[Circular]"';
}
}
var Pn = Mn;
function Mn(e, t, n) {
var r = n && n.stringify || Nn;
var i = 1;
if (typeof e === "object" && e !== null) {
var s = t.length + i;
if (s === 1) return e;
var o = new Array(s);
o[0] = r(e);
for (var a = 1; a < s; a++) {
o[a] = r(t[a]);
}
return o.join(" ");
}
if (typeof e !== "string") {
return e;
}
var l = t.length;
if (l === 0) return e;
var u = "";
var f = 1 - i;
var c = -1;
var d = e && e.length || 0;
for (var h = 0; h < d; ) {
if (e.charCodeAt(h) === 37 && h + 1 < d) {
c = c > -1 ? c : 0;
switch (e.charCodeAt(h + 1)) {
case 100:
case 102:
if (f >= l) break;
if (t[f] == null) break;
if (c < h) u += e.slice(c, h);
u += Number(t[f]);
c = h + 2;
h++;
break;
case 105:
if (f >= l) break;
if (t[f] == null) break;
if (c < h) u += e.slice(c, h);
u += Math.floor(Number(t[f]));
c = h + 2;
h++;
break;
case 79:
case 111:
case 106:
if (f >= l) break;
if (t[f] === undefined) break;
if (c < h) u += e.slice(c, h);
var p = typeof t[f];
if (p === "string") {
u += "'" + t[f] + "'";
c = h + 2;
h++;
break;
}
if (p === "function") {
u += t[f].name || "<anonymous>";
c = h + 2;
h++;
break;
}
u += r(t[f]);
c = h + 2;
h++;
break;
case 115:
if (f >= l) break;
if (c < h) u += e.slice(c, h);
u += String(t[f]);
c = h + 2;
h++;
break;
case 37:
if (c < h) u += e.slice(c, h);
u += "%";
c = h + 2;
h++;
f--;
break;
}
++f;
}
++h;
}
if (c === -1) return e; else if (c < d) {
u += e.slice(c);
}
return u;
}
const Bn = s.getDefaultExportFromCjs(Pn);
var In = {
exports: {}
};
var $n = In.exports;
var Fn;
function Wn() {
if (Fn) return In.exports;
Fn = 1;
"use strict";
if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
const e = new Int32Array(new SharedArrayBuffer(4));
function t(t) {
const n = t > 0 && t < Infinity;
if (n === false) {
if (typeof t !== "number" && typeof t !== "bigint") {
throw TypeError("sleep: ms must be a number");
}
throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
}
Atomics.wait(e, 0, 0, Number(t));
}
In.exports = t;
} else {
function n(e) {
const t = e > 0 && e < Infinity;
if (t === false) {
if (typeof e !== "number" && typeof e !== "bigint") {
throw TypeError("sleep: ms must be a number");
}
throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
}
const n = Date.now() + Number(e);
while (n > Date.now()) {}
}
In.exports = n;
}
return In.exports;
}
"use strict";
const Un = A.default;
const Gn = x.default;
const Kn = O.default.inherits;
const Vn = j.default;
const zn = Wn();
const Hn = 100;
const qn = Buffer.allocUnsafe(0);
const Yn = 16 * 1024;
const Jn = "buffer";
const Xn = "utf8";
function Zn(e, t) {
t._opening = true;
t._writing = true;
t._asyncDrainScheduled = false;
function n(n, r) {
if (n) {
t._reopening = false;
t._writing = false;
t._opening = false;
if (t.sync) {
process.nextTick((() => {
if (t.listenerCount("error") > 0) {
t.emit("error", n);
}
}));
} else {
t.emit("error", n);
}
return;
}
const i = t._reopening;
t.fd = r;
t.file = e;
t._reopening = false;
t._opening = false;
t._writing = false;
if (t.sync) {
process.nextTick((() => t.emit("ready")));
} else {
t.emit("ready");
}
if (t.destroyed) {
return;
}
if (!t._writing && t._len > t.minLength || t._flushPending) {
t._actualWrite();
} else if (i) {
process.nextTick((() => t.emit("drain")));
}
}
const r = t.append ? "a" : "w";
const i = t.mode;
if (t.sync) {
try {
if (t.mkdir) Un.mkdirSync(Vn.dirname(e), {
recursive: true
});
const s = Un.openSync(e, r, i);
n(null, s);
} catch (e) {
n(e);
throw e;
}
} else if (t.mkdir) {
Un.mkdir(Vn.dirname(e), {
recursive: true
}, (t => {
if (t) return n(t);
Un.open(e, r, i, n);
}));
} else {
Un.open(e, r, i, n);
}
}
function Qn(e) {
if (!(this instanceof Qn)) {
return new Qn(e);
}
let {fd: t, dest: n, minLength: r, maxLength: i, maxWrite: s, sync: o, append: a = true, mkdir: l, retryEAGAIN: u, fsync: f, contentMode: c, mode: d} = e || {};
t = t || n;
this._len = 0;
this.fd = -1;
this._bufs = [];
this._lens = [];
this._writing = false;
this._ending = false;
this._reopening = false;
this._asyncDrainScheduled = false;
this._flushPending = false;
this._hwm = Math.max(r || 0, 16387);
this.file = null;
this.destroyed = false;
this.minLength = r || 0;
this.maxLength = i || 0;
this.maxWrite = s || Yn;
this.sync = o || false;
this.writable = true;
this._fsync = f || false;
this.append = a || false;
this.mode = d;
this.retryEAGAIN = u || (() => true);
this.mkdir = l || false;
let h;
let p;
if (c === Jn) {
this._writingBuf = qn;
this.write = ir;
this.flush = ar;
this.flushSync = ur;
this._actualWrite = cr;
h = () => Un.writeSync(this.fd, this._writingBuf);
p = () => Un.write(this.fd, this._writingBuf, this.release);
} else if (c === undefined || c === Xn) {
this._writingBuf = "";
this.write = rr;
this.flush = or;
this.flushSync = lr;
this._actualWrite = fr;
h = () => Un.writeSync(this.fd, this._writingBuf, "utf8");
p = () => Un.write(this.fd, this._writingBuf, "utf8", this.release);
} else {
throw new Error(`SonicBoom supports "${Xn}" and "${Jn}", but passed ${c}`);
}
if (typeof t === "number") {
this.fd = t;
process.nextTick((() => this.emit("ready")));
} else if (typeof t === "string") {
Zn(t, this);
} else {
throw new Error("SonicBoom supports only file descriptors and files");
}
if (this.minLength >= this.maxWrite) {
throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);
}
this.release = (e, t) => {
if (e) {
if ((e.code === "EAGAIN" || e.code === "EBUSY") && this.retryEAGAIN(e, this._writingBuf.length, this._len - this._writingBuf.length)) {
if (this.sync) {
try {
zn(Hn);
this.release(undefined, 0);
} catch (e) {
this.release(e);
}
} else {
setTimeout(p, Hn);
}
} else {
this._writing = false;
this.emit("error", e);
}
return;
}
this.emit("write", t);
const n = er(this._writingBuf, this._len, t);
this._len = n.len;
this._writingBuf = n.writingBuf;
if (this._writingBuf.length) {
if (!this.sync) {
p();
return;
}
try {
do {
const e = h();
const t = er(this._writingBuf, this._len, e);
this._len = t.len;
this._writingBuf = t.writingBuf;
} while (this._writingBuf.length);
} catch (e) {
this.release(e);
return;
}
}
if (this._fsync) {
Un.fsyncSync(this.fd);
}
const r = this._len;
if (this._reopening) {
this._writing = false;
this._reopening = false;
this.reopen();
} else if (r > this.minLength) {
this._actualWrite();
} else if (this._ending) {
if (r > 0) {
this._actualWrite();
} else {
this._writing = false;
dr(this);
}
} else {
this._writing = false;
if (this.sync) {
if (!this._asyncDrainScheduled) {
this._asyncDrainScheduled = true;
process.nextTick(tr, this);
}
} else {
this.emit("drain");
}
}
};
this.on("newListener", (function(e) {
if (e === "drain") {
this._asyncDrainScheduled = false;
}
}));
}
function er(e, t, n) {
if (typeof e === "string" && Buffer.byteLength(e) !== n) {
n = Buffer.from(e).subarray(0, n).toString().length;
}
t = Math.max(t - n, 0);
e = e.slice(n);
return {
writingBuf: e,
len: t
};
}
function tr(e) {
const t = e.listenerCount("drain") > 0;
if (!t) return;
e._asyncDrainScheduled = false;
e.emit("drain");
}
Kn(Qn, Gn);
function nr(e, t) {
if (e.length === 0) {
return qn;
}
if (e.length === 1) {
return e[0];
}
return Buffer.concat(e, t);
}
function rr(e) {
if (this.destroyed) {
throw new Error("SonicBoom destroyed");
}
const t = this._len + e.length;
const n = this._bufs;
if (this.maxLength && t > this.maxLength) {
this.emit("drop", e);
return this._len < this._hwm;
}
if (n.length === 0 || n[n.length - 1].length + e.length > this.maxWrite) {
n.push("" + e);
} else {
n[n.length - 1] += e;
}
this._len = t;
if (!this._writing && this._len >= this.minLength) {
this._actualWrite();
}
return this._len < this._hwm;
}
function ir(e) {
if (this.destroyed) {
throw new Error("SonicBoom destroyed");
}
const t = this._len + e.length;
const n = this._bufs;
const r = this._lens;
if (this.maxLength && t > this.maxLength) {
this.emit("drop", e);
return this._len < this._hwm;
}
if (n.length === 0 || r[r.length - 1] + e.length > this.maxWrite) {
n.push([ e ]);
r.push(e.length);
} else {
n[n.length - 1].push(e);
r[r.length - 1] += e.length;
}
this._len = t;
if (!this._writing && this._len >= this.minLength) {
this._actualWrite();
}
return this._len < this._hwm;
}
function sr(e) {
this._flushPending = true;
const t = () => {
if (!this._fsync) {
Un.fsync(this.fd, (t => {
this._flushPending = false;
e(t);
}));
} else {
this._flushPending = false;
e();
}
this.off("error", n);
};
const n = n => {
this._flushPending = false;
e(n);
this.off("drain", t);
};
this.once("drain", t);
this.once("error", n);
}
function or(e) {
if (e != null && typeof e !== "function") {
throw new Error("flush cb must be a function");
}
if (this.destroyed) {
const t = new Error("SonicBoom destroyed");
if (e) {
e(t);
return;
}
throw t;
}
if (this.minLength <= 0) {
e?.();
return;
}
if (e) {
sr.call(this, e);
}
if (this._writing) {
return;
}
if (this._bufs.length === 0) {
this._bufs.push("");
}
this._actualWrite();
}
function ar(e) {
if (e != null && typeof e !== "function") {
throw new Error("flush cb must be a function");
}
if (this.destroyed) {
const t = new Error("SonicBoom destroyed");
if (e) {
e(t);
return;
}
throw t;
}
if (this.minLength <= 0) {
e?.();
return;
}
if (e) {
sr.call(this, e);
}
if (this._writing) {
return;
}
if (this._bufs.length === 0) {
this._bufs.push([]);
this._lens.push(0);
}
this._actualWrite();
}
Qn.prototype.reopen = function(e) {
if (this.destroyed) {
throw new Error("SonicBoom destroyed");
}
if (this._opening) {
this.once("ready", (() => {
this.reopen(e);
}));
return;
}
if (this._ending) {
return;
}
if (!this.file) {
throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
}
if (e) {
this.file = e;
}
this._reopening = true;
if (this._writing) {
return;
}
const t = this.fd;
this.once("ready", (() => {
if (t !== this.fd) {
Un.close(t, (e => {
if (e) {
return this.emit("error", e);
}
}));
}
}));
Zn(this.file, this);
};
Qn.prototype.end = function() {
if (this.destroyed) {
throw new Error("SonicBoom destroyed");
}
if (this._opening) {
this.once("ready", (() => {
this.end();
}));
return;
}
if (this._ending) {
return;
}
this._ending = true;
if (this._writing) {
return;
}
if (this._len > 0 && this.fd >= 0) {
this._actualWrite();
} else {
dr(this);
}
};
function lr() {
if (this.destroyed) {
throw new Error("SonicBoom destroyed");
}
if (this.fd < 0) {
throw new Error("sonic boom is not ready yet");
}
if (!this._writing && this._writingBuf.length > 0) {
this._bufs.unshift(this._writingBuf);
this._writingBuf = "";
}
let e = "";
while (this._bufs.length || e) {
if (e.length <= 0) {
e = this._bufs[0];
}
try {
const t = Un.writeSync(this.fd, e, "utf8");
const n = er(e, this._len, t);
e = n.writingBuf;
this._len = n.len;
if (e.length <= 0) {
this._bufs.shift();
}
} catch (t) {
const n = t.code === "EAGAIN" || t.code === "EBUSY";
if (n && !this.retryEAGAIN(t, e.length, this._len - e.length)) {
throw t;
}
zn(Hn);
}
}
try {
Un.fsyncSync(this.fd);
} catch {}
}
function ur() {
if (this.destroyed) {
throw new Error("SonicBoom destroyed");
}
if (this.fd < 0) {
throw new Error("sonic boom is not ready yet");
}
if (!this._writing && this._writingBuf.length > 0) {
this._bufs.unshift([ this._writingBuf ]);
this._writingBuf = qn;
}
let e = qn;
while (this._bufs.length || e.length) {
if (e.length <= 0) {
e = nr(this._bufs[0], this._lens[0]);
}
try {
const t = Un.writeSync(this.fd, e);
e = e.subarray(t);
this._len = Math.max(this._len - t, 0);
if (e.length <= 0) {
this._bufs.shift();
this._lens.shift();
}
} catch (t) {
const n = t.code === "EAGAIN" || t.code === "EBUSY";
if (n && !this.retryEAGAIN(t, e.length, this._len - e.length)) {
throw t;
}
zn(Hn);
}
}
}
Qn.prototype.destroy = function() {
if (this.destroyed) {
return;
}
dr(this);
};
function fr() {
const e = this.release;
this._writing = true;
this._writingBuf = this._writingBuf || this._bufs.shift() || "";
if (this.sync) {
try {
const t = Un.writeSync(this.fd, this._writingBuf, "utf8");
e(null, t);
} catch (t) {
e(t);
}
} else {
Un.write(this.fd, this._writingBuf, "utf8", e);
}
}
function cr() {
const e = this.release;
this._writing = true;
this._writingBuf = this._writingBuf.length ? this._writingBuf : nr(this._bufs.shift(), this._lens.shift());
if (this.sync) {
try {
const t = Un.writeSync(this.fd, this._writingBuf);
e(null, t);
} catch (t) {
e(t);
}
} else {
Un.write(this.fd, this._writingBuf, e);
}
}
function dr(e) {
if (e.fd === -1) {
e.once("ready", dr.bind(null, e));
return;
}
e.destroyed = true;
e._bufs = [];
e._lens = [];
Un.fsync(e.fd, t);
function t() {
if (e.fd !== 1 && e.fd !== 2) {
Un.close(e.fd, n);
} else {
n();
}
}
function n(t) {
if (t) {
e.emit("error", t);
return;
}
if (e._ending && !e._writing) {
e.emit("finish");
}
e.emit("close");
}
}
Qn.SonicBoom = Qn;
Qn.default = Qn;
var hr = Qn;
const pr = s.getDefaultExportFromCjs(hr);
"use strict";
const gr = {
exit: [],
beforeExit: []
};
const yr = {
exit: vr,
beforeExit: Sr
};
let br;
function mr() {
if (br === undefined) {
br = new FinalizationRegistry(Ar);
}
}
function wr(e) {
if (gr[e].length > 0) {
return;
}
process.on(e, yr[e]);
}
function _r(e) {
if (gr[e].length > 0) {
return;
}
process.removeListener(e, yr[e]);
if (gr.exit.length === 0 && gr.beforeExit.length === 0) {
br = undefined;
}
}
function vr() {
Er("exit");
}
function Sr() {
Er("beforeExit");
}
function Er(e) {
for (const t of gr[e]) {
const n = t.deref();
const r = t.fn;
if (n !== undefined) {
r(n, e);
}
}
gr[e] = [];
}
function Ar(e) {
for (const t of [ "exit", "beforeExit" ]) {
const n = gr[t].indexOf(e);
gr[t].splice(n, n + 1);
_r(t);
}
}
function xr(e, t, n) {
if (t === undefined) {
throw new Error("the object can't be undefined");
}
wr(e);
const r = new WeakRef(t);
r.fn = n;
mr();
br.register(t, r);
gr[e].push(r);
}
function Or(e, t) {
xr("exit", e, t);
}
function jr(e, t) {
xr("beforeExit", e, t);
}
function Lr(e) {
if (br === undefined) {
return;
}
br.unregister(e);
for (const t of [ "exit", "beforeExit" ]) {
gr[t] = gr[t].filter((t => {
const n = t.deref();
return n && n !== e;
}));
_r(t);
}
}
var Rr = {
register: Or,
registerBeforeExit: jr,
unregister: Lr
};
const kr = s.getDefaultExportFromCjs(Rr);
var Tr = "thread-stream";
var Dr = "2.7.0";
var Cr = "A streaming way to send data to a Node.js Worker Thread";
var Nr = "index.js";
var Pr = "index.d.ts";
var Mr = {
"real-require": "^0.2.0"
};
var Br = {
"@types/node": "^20.1.0",
"@types/tap": "^15.0.0",
"@yao-pkg/pkg": "^5.11.5",
desm: "^1.3.0",
fastbench: "^1.0.1",
husky: "^9.0.6",
"pino-elasticsearch": "^8.0.0",
"sonic-boom": "^3.0.0",
standard: "^17.0.0",
tap: "^16.2.0",
"ts-node": "^10.8.0",
typescript: "^5.3.2",
"why-is-node-running": "^2.2.2"
};
var Ir = {
test: 'standard && npm run transpile && tap "test/**/*.test.*js" && tap --ts test/*.test.*ts',
"test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
"test:ci:js": 'tap --no-check-coverage --timeout=120 --coverage-report=lcovonly "test/**/*.test.*js"',
"test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test