@kky42/pievo-server 1.0.0
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/.output/nitro.json +17 -0
- package/.output/public/assets/CodeField-dOzyFQNH.js +34 -0
- package/.output/public/assets/LoopView-B4H9QibC.js +55 -0
- package/.output/public/assets/Modal-D33gNSgx.js +1 -0
- package/.output/public/assets/SignIn-SHuRRyOv.js +1 -0
- package/.output/public/assets/actionUi-ChGGALzg.js +1 -0
- package/.output/public/assets/app-DElSo_jy.css +2 -0
- package/.output/public/assets/artifactView-DFuubXLJ.js +66 -0
- package/.output/public/assets/index-DfpTWRSz.js +12 -0
- package/.output/public/assets/invite._token-DJtd-XE2.js +1 -0
- package/.output/public/assets/invite._token-T8oo4Qtw.js +1 -0
- package/.output/public/assets/jsx-runtime-BseJUIpC.js +1 -0
- package/.output/public/assets/lifecycleUi-DKkChdnU.js +1 -0
- package/.output/public/assets/loopApi-BM2nj71x.js +3 -0
- package/.output/public/assets/loops._loopId-B19Jw7jC.js +5 -0
- package/.output/public/assets/loops._loopId_.runs._runId-_CflHV38.js +3 -0
- package/.output/public/assets/notifyFns-DCubjpRy.js +1 -0
- package/.output/public/assets/preload-helper-CKUiEq3b.js +3 -0
- package/.output/public/assets/routes-B9tgli5f.js +1 -0
- package/.output/public/assets/routes-CTtlM_qt.js +1 -0
- package/.output/public/assets/t._teamId-Bm21mngW.js +1 -0
- package/.output/public/assets/t._teamId-gR7BVKkR.js +1 -0
- package/.output/public/assets/ui-Dp88qUWh.js +1 -0
- package/.output/public/assets/useRouter-DsjH8G0p.js +1 -0
- package/.output/public/favicon.svg +12 -0
- package/.output/public/fonts/GeistPixel-Square.woff2 +0 -0
- package/.output/server/_chunks/ssr-renderer.mjs +26 -0
- package/.output/server/_libs/@aws-crypto/crc32+[...].mjs +419 -0
- package/.output/server/_libs/@aws-sdk/checksums+[...].mjs +10732 -0
- package/.output/server/_libs/@aws-sdk/client-s3+[...].mjs +9475 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-http+[...].mjs +137 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-ini+[...].mjs +440 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-process+[...].mjs +62 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-sso+[...].mjs +818 -0
- package/.output/server/_libs/@aws-sdk/credential-provider-web-identity+[...].mjs +59 -0
- package/.output/server/_libs/@base-ui/react+[...].mjs +11125 -0
- package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +19713 -0
- package/.output/server/_libs/@codemirror/lang-css+[...].mjs +2636 -0
- package/.output/server/_libs/@codemirror/lang-html+[...].mjs +2247 -0
- package/.output/server/_libs/@codemirror/lang-json+[...].mjs +79 -0
- package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1736 -0
- package/.output/server/_libs/@smithy/credential-provider-imds+[...].mjs +342 -0
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +14300 -0
- package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +76 -0
- package/.output/server/_libs/atomic-sleep.mjs +27 -0
- package/.output/server/_libs/aws-crypto__crc32c.mjs +314 -0
- package/.output/server/_libs/aws-sdk__nested-clients.mjs +2671 -0
- package/.output/server/_libs/babel__runtime.mjs +30 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/codemirror__commands.mjs +1725 -0
- package/.output/server/_libs/codemirror__lint.mjs +565 -0
- package/.output/server/_libs/codemirror__search.mjs +1138 -0
- package/.output/server/_libs/codemirror__theme-one-dark.mjs +161 -0
- package/.output/server/_libs/colorette.mjs +129 -0
- package/.output/server/_libs/croner.mjs +735 -0
- package/.output/server/_libs/d3-array.mjs +231 -0
- package/.output/server/_libs/d3-color.mjs +330 -0
- package/.output/server/_libs/d3-format.mjs +252 -0
- package/.output/server/_libs/d3-interpolate.mjs +163 -0
- package/.output/server/_libs/d3-path.mjs +77 -0
- package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
- package/.output/server/_libs/d3-shape.mjs +689 -0
- package/.output/server/_libs/dateformat.mjs +341 -0
- package/.output/server/_libs/decimal.js-light.mjs +884 -0
- package/.output/server/_libs/diff.mjs +732 -0
- package/.output/server/_libs/dom-serializer+[...].mjs +708 -0
- package/.output/server/_libs/domhandler.mjs +461 -0
- package/.output/server/_libs/dompurify.mjs +2111 -0
- package/.output/server/_libs/domutils.mjs +868 -0
- package/.output/server/_libs/drizzle-orm+postgres.mjs +7689 -0
- package/.output/server/_libs/electric-sql__pglite.mjs +14674 -0
- package/.output/server/_libs/end-of-stream+once+wrappy.mjs +145 -0
- package/.output/server/_libs/es-toolkit.mjs +1737 -0
- package/.output/server/_libs/eventemitter3.mjs +236 -0
- package/.output/server/_libs/fast-copy.mjs +285 -0
- package/.output/server/_libs/fast-safe-stringify.mjs +172 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +1201 -0
- package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +1560 -0
- package/.output/server/_libs/html-react-parser+[...].mjs +1360 -0
- package/.output/server/_libs/initdb.wasm +0 -0
- package/.output/server/_libs/marked.mjs +1548 -0
- package/.output/server/_libs/on-exit-leak-free.mjs +80 -0
- package/.output/server/_libs/pglite.data +37667 -8
- package/.output/server/_libs/pglite.wasm +0 -0
- package/.output/server/_libs/pino+[...].mjs +3196 -0
- package/.output/server/_libs/pino-abstract-transport+split2.mjs +194 -0
- package/.output/server/_libs/pino-pretty+[...].mjs +1623 -0
- package/.output/server/_libs/pinojs__redact.mjs +280 -0
- package/.output/server/_libs/react-redux+[...].mjs +205 -0
- package/.output/server/_libs/recharts+victory-vendor.mjs +15875 -0
- package/.output/server/_libs/tanstack__history.mjs +342 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/uiw__codemirror-themes.mjs +32 -0
- package/.output/server/_libs/uiw__react-codemirror.mjs +354 -0
- package/.output/server/_runtime.mjs +37 -0
- package/.output/server/_ssr/CodeField-tm4rr6G3.mjs +143 -0
- package/.output/server/_ssr/DashboardView-CC7htv28.mjs +2795 -0
- package/.output/server/_ssr/LoopPlaybook-BXH8mhiX.mjs +2105 -0
- package/.output/server/_ssr/LoopView-DCugEbHx.mjs +1106 -0
- package/.output/server/_ssr/Modal-DpKZHLZK.mjs +49 -0
- package/.output/server/_ssr/SignIn-dTndU6Hw.mjs +67 -0
- package/.output/server/_ssr/actionUi-CZbEixbf.mjs +119 -0
- package/.output/server/_ssr/adapters-BS8XosjF.mjs +130 -0
- package/.output/server/_ssr/artifactFiles-Cagtj7J0.mjs +61 -0
- package/.output/server/_ssr/artifactKind-BW0isV8L.mjs +37 -0
- package/.output/server/_ssr/artifactView-DS4O22wl.mjs +304 -0
- package/.output/server/_ssr/artifacts-DngKyW2u.mjs +2 -0
- package/.output/server/_ssr/auth-DY1DuYZd.mjs +38429 -0
- package/.output/server/_ssr/boot-BbtG0ImW.mjs +9010 -0
- package/.output/server/_ssr/boot-CMHTxQpJ.mjs +2 -0
- package/.output/server/_ssr/bun-sqlite-dialect-BW9W1_Ps-CU1Spd6z.mjs +162 -0
- package/.output/server/_ssr/core-RrmWoKne.mjs +5 -0
- package/.output/server/_ssr/createServerRpc-BD8Xn_0_.mjs +12 -0
- package/.output/server/_ssr/d1-sqlite-dialect-BLC8LXE6-DfG7tB8s.mjs +112 -0
- package/.output/server/_ssr/db-DWAuZq1o.mjs +2 -0
- package/.output/server/_ssr/dist-BIxFFVZg.mjs +342 -0
- package/.output/server/_ssr/empty-plugin-adapters-DKUlnwwl.mjs +5 -0
- package/.output/server/_ssr/factory-Blq0DYfT.mjs +6903 -0
- package/.output/server/_ssr/invite._token-BRCo9LGB.mjs +36 -0
- package/.output/server/_ssr/invite._token-DJxGLILJ.mjs +28 -0
- package/.output/server/_ssr/invite._token-NewFt27g.mjs +92 -0
- package/.output/server/_ssr/kysely-adapter-D3XTe64J.mjs +2 -0
- package/.output/server/_ssr/kysely-migration-tables-JkVUjPF_-bPAX9LR_.mjs +19 -0
- package/.output/server/_ssr/lifecycleUi-C9lg1r3r.mjs +38 -0
- package/.output/server/_ssr/logger-Dw82jNjH.mjs +2 -0
- package/.output/server/_ssr/loopApi-BtfkZQYK.mjs +532 -0
- package/.output/server/_ssr/loopApi-Cxe8WyOB.mjs +105 -0
- package/.output/server/_ssr/loops._loopId-7NQJPB9W.mjs +30 -0
- package/.output/server/_ssr/loops._loopId-DhnArGdL.mjs +1635 -0
- package/.output/server/_ssr/loops._loopId_.runs._runId-Bvuo2nki.mjs +29 -0
- package/.output/server/_ssr/loops._loopId_.runs._runId-Dip5Xk-q.mjs +674 -0
- package/.output/server/_ssr/machineFns-Dvr5ICUy.mjs +266 -0
- package/.output/server/_ssr/node-sqlite-dialect-DhyOpJTX.mjs +162 -0
- package/.output/server/_ssr/notifyFns-BcMRY5kP.mjs +118 -0
- package/.output/server/_ssr/notifyFns-Q458pZmE.mjs +580 -0
- package/.output/server/_ssr/router-J8KZ30xw.mjs +678 -0
- package/.output/server/_ssr/routes-Bcs4T1ox.mjs +28 -0
- package/.output/server/_ssr/routes-BoGrcf-b.mjs +43 -0
- package/.output/server/_ssr/routes-D4am3Zff.mjs +28 -0
- package/.output/server/_ssr/runDiff-CpEFqo7G.mjs +113 -0
- package/.output/server/_ssr/ssr.mjs +5837 -0
- package/.output/server/_ssr/start-4ifArtKx.mjs +4 -0
- package/.output/server/_ssr/store-b3JcQ08F.mjs +2 -0
- package/.output/server/_ssr/t._teamId-CeUhzgzT.mjs +32 -0
- package/.output/server/_ssr/t._teamId-DR-hQK7o.mjs +47 -0
- package/.output/server/_ssr/t._teamId-Dy_McbRt.mjs +31 -0
- package/.output/server/_ssr/teamCookie-B7hLOIie.mjs +10 -0
- package/.output/server/_ssr/teamFns-BIDnsg2A.mjs +473 -0
- package/.output/server/_ssr/teamFns-DA4ovI5g.mjs +33 -0
- package/.output/server/_ssr/tokens-ytd60FUt.mjs +2 -0
- package/.output/server/_ssr/ui-Dej2qjuS.mjs +267 -0
- package/.output/server/_tanstack-start-manifest_v-CVS6c7re.mjs +95 -0
- package/.output/server/drizzle/0000_round_marauders.sql +193 -0
- package/.output/server/drizzle/0001_naive_silver_fox.sql +25 -0
- package/.output/server/drizzle/0002_funny_sage.sql +12 -0
- package/.output/server/drizzle/0003_optimal_slapstick.sql +102 -0
- package/.output/server/drizzle/0004_remove_grok_agent.sql +5 -0
- package/.output/server/drizzle/0005_heavy_gauntlet.sql +8 -0
- package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +1 -0
- package/.output/server/drizzle/0007_faulty_starbolt.sql +30 -0
- package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
- package/.output/server/drizzle/meta/0000_snapshot.json +1333 -0
- package/.output/server/drizzle/meta/0001_snapshot.json +1498 -0
- package/.output/server/drizzle/meta/0002_snapshot.json +1576 -0
- package/.output/server/drizzle/meta/0003_snapshot.json +1666 -0
- package/.output/server/drizzle/meta/0005_snapshot.json +1666 -0
- package/.output/server/drizzle/meta/0006_snapshot.json +1672 -0
- package/.output/server/drizzle/meta/0007_snapshot.json +1787 -0
- package/.output/server/drizzle/meta/_journal.json +69 -0
- package/.output/server/index.mjs +464 -0
- package/.output/server/node_modules/tslib/modules/index.js +70 -0
- package/.output/server/node_modules/tslib/modules/package.json +3 -0
- package/.output/server/node_modules/tslib/package.json +47 -0
- package/.output/server/node_modules/tslib/tslib.js +484 -0
- package/.output/server/package.json +9 -0
- package/LICENSE +21 -0
- package/drizzle/0000_round_marauders.sql +193 -0
- package/drizzle/0001_naive_silver_fox.sql +25 -0
- package/drizzle/0002_funny_sage.sql +12 -0
- package/drizzle/0003_optimal_slapstick.sql +102 -0
- package/drizzle/0004_remove_grok_agent.sql +5 -0
- package/drizzle/0005_heavy_gauntlet.sql +8 -0
- package/drizzle/0006_tranquil_sharon_carter.sql +1 -0
- package/drizzle/0007_faulty_starbolt.sql +30 -0
- package/drizzle/0008_durable_lifecycle_evidence.sql +15 -0
- package/drizzle/meta/0000_snapshot.json +1333 -0
- package/drizzle/meta/0001_snapshot.json +1498 -0
- package/drizzle/meta/0002_snapshot.json +1576 -0
- package/drizzle/meta/0003_snapshot.json +1666 -0
- package/drizzle/meta/0005_snapshot.json +1666 -0
- package/drizzle/meta/0006_snapshot.json +1672 -0
- package/drizzle/meta/0007_snapshot.json +1787 -0
- package/drizzle/meta/_journal.json +69 -0
- package/package.json +84 -0
- package/scripts/pievo-server.mjs +390 -0
- package/scripts/prestart.mjs +66 -0
- package/scripts/server-cli-lib.mjs +451 -0
|
@@ -0,0 +1,3196 @@
|
|
|
1
|
+
import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "../_runtime.mjs";
|
|
2
|
+
import { t as require_redact } from "./pinojs__redact.mjs";
|
|
3
|
+
import { t as require_atomic_sleep } from "./atomic-sleep.mjs";
|
|
4
|
+
import { t as require_on_exit_leak_free } from "./on-exit-leak-free.mjs";
|
|
5
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-helpers.js
|
|
6
|
+
var require_err_helpers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
7
|
+
var isErrorLike = (err) => {
|
|
8
|
+
return err && typeof err.message === "string";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @param {Error|{ cause?: unknown|(()=>err)}} err
|
|
12
|
+
* @returns {Error|Object|undefined}
|
|
13
|
+
*/
|
|
14
|
+
var getErrorCause = (err) => {
|
|
15
|
+
if (!err) return;
|
|
16
|
+
/** @type {unknown} */
|
|
17
|
+
const cause = err.cause;
|
|
18
|
+
if (typeof cause === "function") {
|
|
19
|
+
const causeResult = err.cause();
|
|
20
|
+
return isErrorLike(causeResult) ? causeResult : void 0;
|
|
21
|
+
} else return isErrorLike(cause) ? cause : void 0;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Internal method that keeps a track of which error we have already added, to avoid circular recursion
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
* @param {Error} err
|
|
28
|
+
* @param {Set<Error>} seen
|
|
29
|
+
* @returns {string}
|
|
30
|
+
*/
|
|
31
|
+
var _stackWithCauses = (err, seen) => {
|
|
32
|
+
if (!isErrorLike(err)) return "";
|
|
33
|
+
const stack = err.stack || "";
|
|
34
|
+
if (seen.has(err)) return stack + "\ncauses have become circular...";
|
|
35
|
+
const cause = getErrorCause(err);
|
|
36
|
+
if (cause) {
|
|
37
|
+
seen.add(err);
|
|
38
|
+
return stack + "\ncaused by: " + _stackWithCauses(cause, seen);
|
|
39
|
+
} else return stack;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @param {Error} err
|
|
43
|
+
* @returns {string}
|
|
44
|
+
*/
|
|
45
|
+
var stackWithCauses = (err) => _stackWithCauses(err, /* @__PURE__ */ new Set());
|
|
46
|
+
/**
|
|
47
|
+
* Internal method that keeps a track of which error we have already added, to avoid circular recursion
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
* @param {Error} err
|
|
51
|
+
* @param {Set<Error>} seen
|
|
52
|
+
* @param {boolean} [skip]
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
var _messageWithCauses = (err, seen, skip) => {
|
|
56
|
+
if (!isErrorLike(err)) return "";
|
|
57
|
+
const message = skip ? "" : err.message || "";
|
|
58
|
+
if (seen.has(err)) return message + ": ...";
|
|
59
|
+
const cause = getErrorCause(err);
|
|
60
|
+
if (cause) {
|
|
61
|
+
seen.add(err);
|
|
62
|
+
const skipIfVErrorStyleCause = typeof err.cause === "function";
|
|
63
|
+
return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause);
|
|
64
|
+
} else return message;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* @param {Error} err
|
|
68
|
+
* @returns {string}
|
|
69
|
+
*/
|
|
70
|
+
var messageWithCauses = (err) => _messageWithCauses(err, /* @__PURE__ */ new Set());
|
|
71
|
+
module.exports = {
|
|
72
|
+
isErrorLike,
|
|
73
|
+
getErrorCause,
|
|
74
|
+
stackWithCauses,
|
|
75
|
+
messageWithCauses
|
|
76
|
+
};
|
|
77
|
+
}));
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-proto.js
|
|
80
|
+
var require_err_proto = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
81
|
+
var seen = Symbol("circular-ref-tag");
|
|
82
|
+
var rawSymbol = Symbol("pino-raw-err-ref");
|
|
83
|
+
var pinoErrProto = Object.create({}, {
|
|
84
|
+
type: {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: void 0
|
|
88
|
+
},
|
|
89
|
+
message: {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
writable: true,
|
|
92
|
+
value: void 0
|
|
93
|
+
},
|
|
94
|
+
stack: {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
writable: true,
|
|
97
|
+
value: void 0
|
|
98
|
+
},
|
|
99
|
+
aggregateErrors: {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
writable: true,
|
|
102
|
+
value: void 0
|
|
103
|
+
},
|
|
104
|
+
raw: {
|
|
105
|
+
enumerable: false,
|
|
106
|
+
get: function() {
|
|
107
|
+
return this[rawSymbol];
|
|
108
|
+
},
|
|
109
|
+
set: function(val) {
|
|
110
|
+
this[rawSymbol] = val;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(pinoErrProto, rawSymbol, {
|
|
115
|
+
writable: true,
|
|
116
|
+
value: {}
|
|
117
|
+
});
|
|
118
|
+
module.exports = {
|
|
119
|
+
pinoErrProto,
|
|
120
|
+
pinoErrorSymbols: {
|
|
121
|
+
seen,
|
|
122
|
+
rawSymbol
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}));
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err.js
|
|
128
|
+
var require_err = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
129
|
+
module.exports = errSerializer;
|
|
130
|
+
var { messageWithCauses, stackWithCauses, isErrorLike } = require_err_helpers();
|
|
131
|
+
var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
|
|
132
|
+
var { seen } = pinoErrorSymbols;
|
|
133
|
+
var { toString } = Object.prototype;
|
|
134
|
+
function errSerializer(err) {
|
|
135
|
+
if (!isErrorLike(err)) return err;
|
|
136
|
+
err[seen] = void 0;
|
|
137
|
+
const _err = Object.create(pinoErrProto);
|
|
138
|
+
_err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
|
|
139
|
+
_err.message = messageWithCauses(err);
|
|
140
|
+
_err.stack = stackWithCauses(err);
|
|
141
|
+
if (Array.isArray(err.errors)) _err.aggregateErrors = err.errors.map((err) => errSerializer(err));
|
|
142
|
+
for (const key in err) if (_err[key] === void 0) {
|
|
143
|
+
const val = err[key];
|
|
144
|
+
if (isErrorLike(val)) {
|
|
145
|
+
if (key !== "cause" && !Object.prototype.hasOwnProperty.call(val, seen)) _err[key] = errSerializer(val);
|
|
146
|
+
} else _err[key] = val;
|
|
147
|
+
}
|
|
148
|
+
delete err[seen];
|
|
149
|
+
_err.raw = err;
|
|
150
|
+
return _err;
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
//#endregion
|
|
154
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/err-with-cause.js
|
|
155
|
+
var require_err_with_cause = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
156
|
+
module.exports = errWithCauseSerializer;
|
|
157
|
+
var { isErrorLike } = require_err_helpers();
|
|
158
|
+
var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
|
|
159
|
+
var { seen } = pinoErrorSymbols;
|
|
160
|
+
var { toString } = Object.prototype;
|
|
161
|
+
function errWithCauseSerializer(err) {
|
|
162
|
+
if (!isErrorLike(err)) return err;
|
|
163
|
+
err[seen] = void 0;
|
|
164
|
+
const _err = Object.create(pinoErrProto);
|
|
165
|
+
_err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
|
|
166
|
+
_err.message = err.message;
|
|
167
|
+
_err.stack = err.stack;
|
|
168
|
+
if (Array.isArray(err.errors)) _err.aggregateErrors = err.errors.map((err) => errWithCauseSerializer(err));
|
|
169
|
+
if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) _err.cause = errWithCauseSerializer(err.cause);
|
|
170
|
+
for (const key in err) if (_err[key] === void 0) {
|
|
171
|
+
const val = err[key];
|
|
172
|
+
if (isErrorLike(val)) {
|
|
173
|
+
if (!Object.prototype.hasOwnProperty.call(val, seen)) _err[key] = errWithCauseSerializer(val);
|
|
174
|
+
} else _err[key] = val;
|
|
175
|
+
}
|
|
176
|
+
delete err[seen];
|
|
177
|
+
_err.raw = err;
|
|
178
|
+
return _err;
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/req.js
|
|
183
|
+
var require_req = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
184
|
+
module.exports = {
|
|
185
|
+
mapHttpRequest,
|
|
186
|
+
reqSerializer
|
|
187
|
+
};
|
|
188
|
+
var rawSymbol = Symbol("pino-raw-req-ref");
|
|
189
|
+
var pinoReqProto = Object.create({}, {
|
|
190
|
+
id: {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
writable: true,
|
|
193
|
+
value: ""
|
|
194
|
+
},
|
|
195
|
+
method: {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
writable: true,
|
|
198
|
+
value: ""
|
|
199
|
+
},
|
|
200
|
+
url: {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
writable: true,
|
|
203
|
+
value: ""
|
|
204
|
+
},
|
|
205
|
+
query: {
|
|
206
|
+
enumerable: true,
|
|
207
|
+
writable: true,
|
|
208
|
+
value: ""
|
|
209
|
+
},
|
|
210
|
+
params: {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
writable: true,
|
|
213
|
+
value: ""
|
|
214
|
+
},
|
|
215
|
+
headers: {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
writable: true,
|
|
218
|
+
value: {}
|
|
219
|
+
},
|
|
220
|
+
remoteAddress: {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
writable: true,
|
|
223
|
+
value: ""
|
|
224
|
+
},
|
|
225
|
+
remotePort: {
|
|
226
|
+
enumerable: true,
|
|
227
|
+
writable: true,
|
|
228
|
+
value: ""
|
|
229
|
+
},
|
|
230
|
+
raw: {
|
|
231
|
+
enumerable: false,
|
|
232
|
+
get: function() {
|
|
233
|
+
return this[rawSymbol];
|
|
234
|
+
},
|
|
235
|
+
set: function(val) {
|
|
236
|
+
this[rawSymbol] = val;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(pinoReqProto, rawSymbol, {
|
|
241
|
+
writable: true,
|
|
242
|
+
value: {}
|
|
243
|
+
});
|
|
244
|
+
function reqSerializer(req) {
|
|
245
|
+
const connection = req.info || req.socket;
|
|
246
|
+
const _req = Object.create(pinoReqProto);
|
|
247
|
+
_req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0);
|
|
248
|
+
_req.method = req.method;
|
|
249
|
+
if (req.originalUrl) _req.url = req.originalUrl;
|
|
250
|
+
else {
|
|
251
|
+
const path = req.path;
|
|
252
|
+
_req.url = typeof path === "string" ? path : req.url ? req.url.path || req.url : void 0;
|
|
253
|
+
}
|
|
254
|
+
if (req.query) _req.query = req.query;
|
|
255
|
+
if (req.params) _req.params = req.params;
|
|
256
|
+
_req.headers = req.headers;
|
|
257
|
+
_req.remoteAddress = connection && connection.remoteAddress;
|
|
258
|
+
_req.remotePort = connection && connection.remotePort;
|
|
259
|
+
_req.raw = req.raw || req;
|
|
260
|
+
return _req;
|
|
261
|
+
}
|
|
262
|
+
function mapHttpRequest(req) {
|
|
263
|
+
return { req: reqSerializer(req) };
|
|
264
|
+
}
|
|
265
|
+
}));
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/lib/res.js
|
|
268
|
+
var require_res = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
269
|
+
module.exports = {
|
|
270
|
+
mapHttpResponse,
|
|
271
|
+
resSerializer
|
|
272
|
+
};
|
|
273
|
+
var rawSymbol = Symbol("pino-raw-res-ref");
|
|
274
|
+
var pinoResProto = Object.create({}, {
|
|
275
|
+
statusCode: {
|
|
276
|
+
enumerable: true,
|
|
277
|
+
writable: true,
|
|
278
|
+
value: 0
|
|
279
|
+
},
|
|
280
|
+
headers: {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
writable: true,
|
|
283
|
+
value: ""
|
|
284
|
+
},
|
|
285
|
+
raw: {
|
|
286
|
+
enumerable: false,
|
|
287
|
+
get: function() {
|
|
288
|
+
return this[rawSymbol];
|
|
289
|
+
},
|
|
290
|
+
set: function(val) {
|
|
291
|
+
this[rawSymbol] = val;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
Object.defineProperty(pinoResProto, rawSymbol, {
|
|
296
|
+
writable: true,
|
|
297
|
+
value: {}
|
|
298
|
+
});
|
|
299
|
+
function resSerializer(res) {
|
|
300
|
+
const _res = Object.create(pinoResProto);
|
|
301
|
+
_res.statusCode = res.headersSent ? res.statusCode : null;
|
|
302
|
+
_res.headers = res.getHeaders ? res.getHeaders() : res._headers;
|
|
303
|
+
_res.raw = res;
|
|
304
|
+
return _res;
|
|
305
|
+
}
|
|
306
|
+
function mapHttpResponse(res) {
|
|
307
|
+
return { res: resSerializer(res) };
|
|
308
|
+
}
|
|
309
|
+
}));
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region ../../node_modules/.pnpm/pino-std-serializers@7.1.0/node_modules/pino-std-serializers/index.js
|
|
312
|
+
var require_pino_std_serializers = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
313
|
+
var errSerializer = require_err();
|
|
314
|
+
var errWithCauseSerializer = require_err_with_cause();
|
|
315
|
+
var reqSerializers = require_req();
|
|
316
|
+
var resSerializers = require_res();
|
|
317
|
+
module.exports = {
|
|
318
|
+
err: errSerializer,
|
|
319
|
+
errWithCause: errWithCauseSerializer,
|
|
320
|
+
mapHttpRequest: reqSerializers.mapHttpRequest,
|
|
321
|
+
mapHttpResponse: resSerializers.mapHttpResponse,
|
|
322
|
+
req: reqSerializers.reqSerializer,
|
|
323
|
+
res: resSerializers.resSerializer,
|
|
324
|
+
wrapErrorSerializer: function wrapErrorSerializer(customSerializer) {
|
|
325
|
+
if (customSerializer === errSerializer) return customSerializer;
|
|
326
|
+
return function wrapErrSerializer(err) {
|
|
327
|
+
return customSerializer(errSerializer(err));
|
|
328
|
+
};
|
|
329
|
+
},
|
|
330
|
+
wrapRequestSerializer: function wrapRequestSerializer(customSerializer) {
|
|
331
|
+
if (customSerializer === reqSerializers.reqSerializer) return customSerializer;
|
|
332
|
+
return function wrappedReqSerializer(req) {
|
|
333
|
+
return customSerializer(reqSerializers.reqSerializer(req));
|
|
334
|
+
};
|
|
335
|
+
},
|
|
336
|
+
wrapResponseSerializer: function wrapResponseSerializer(customSerializer) {
|
|
337
|
+
if (customSerializer === resSerializers.resSerializer) return customSerializer;
|
|
338
|
+
return function wrappedResSerializer(res) {
|
|
339
|
+
return customSerializer(resSerializers.resSerializer(res));
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}));
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/caller.js
|
|
346
|
+
var require_caller = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
347
|
+
function noOpPrepareStackTrace(_, stack) {
|
|
348
|
+
return stack;
|
|
349
|
+
}
|
|
350
|
+
module.exports = function getCallers() {
|
|
351
|
+
const originalPrepare = Error.prepareStackTrace;
|
|
352
|
+
Error.prepareStackTrace = noOpPrepareStackTrace;
|
|
353
|
+
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
354
|
+
Error.prepareStackTrace = originalPrepare;
|
|
355
|
+
if (!Array.isArray(stack)) return;
|
|
356
|
+
const entries = stack.slice(2);
|
|
357
|
+
const fileNames = [];
|
|
358
|
+
for (const entry of entries) {
|
|
359
|
+
if (!entry) continue;
|
|
360
|
+
fileNames.push(entry.getFileName());
|
|
361
|
+
}
|
|
362
|
+
return fileNames;
|
|
363
|
+
};
|
|
364
|
+
}));
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/symbols.js
|
|
367
|
+
var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
368
|
+
var setLevelSym = Symbol("pino.setLevel");
|
|
369
|
+
var getLevelSym = Symbol("pino.getLevel");
|
|
370
|
+
var levelValSym = Symbol("pino.levelVal");
|
|
371
|
+
var levelCompSym = Symbol("pino.levelComp");
|
|
372
|
+
var useLevelLabelsSym = Symbol("pino.useLevelLabels");
|
|
373
|
+
var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels");
|
|
374
|
+
var mixinSym = Symbol("pino.mixin");
|
|
375
|
+
var lsCacheSym = Symbol("pino.lsCache");
|
|
376
|
+
var chindingsSym = Symbol("pino.chindings");
|
|
377
|
+
var asJsonSym = Symbol("pino.asJson");
|
|
378
|
+
var writeSym = Symbol("pino.write");
|
|
379
|
+
var redactFmtSym = Symbol("pino.redactFmt");
|
|
380
|
+
var timeSym = Symbol("pino.time");
|
|
381
|
+
var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
|
|
382
|
+
var streamSym = Symbol("pino.stream");
|
|
383
|
+
var stringifySym = Symbol("pino.stringify");
|
|
384
|
+
var stringifySafeSym = Symbol("pino.stringifySafe");
|
|
385
|
+
var stringifiersSym = Symbol("pino.stringifiers");
|
|
386
|
+
var endSym = Symbol("pino.end");
|
|
387
|
+
var formatOptsSym = Symbol("pino.formatOpts");
|
|
388
|
+
var messageKeySym = Symbol("pino.messageKey");
|
|
389
|
+
var errorKeySym = Symbol("pino.errorKey");
|
|
390
|
+
var nestedKeySym = Symbol("pino.nestedKey");
|
|
391
|
+
var nestedKeyStrSym = Symbol("pino.nestedKeyStr");
|
|
392
|
+
var mixinMergeStrategySym = Symbol("pino.mixinMergeStrategy");
|
|
393
|
+
var msgPrefixSym = Symbol("pino.msgPrefix");
|
|
394
|
+
var wildcardFirstSym = Symbol("pino.wildcardFirst");
|
|
395
|
+
var serializersSym = Symbol.for("pino.serializers");
|
|
396
|
+
var formattersSym = Symbol.for("pino.formatters");
|
|
397
|
+
var hooksSym = Symbol.for("pino.hooks");
|
|
398
|
+
module.exports = {
|
|
399
|
+
setLevelSym,
|
|
400
|
+
getLevelSym,
|
|
401
|
+
levelValSym,
|
|
402
|
+
levelCompSym,
|
|
403
|
+
useLevelLabelsSym,
|
|
404
|
+
mixinSym,
|
|
405
|
+
lsCacheSym,
|
|
406
|
+
chindingsSym,
|
|
407
|
+
asJsonSym,
|
|
408
|
+
writeSym,
|
|
409
|
+
serializersSym,
|
|
410
|
+
redactFmtSym,
|
|
411
|
+
timeSym,
|
|
412
|
+
timeSliceIndexSym,
|
|
413
|
+
streamSym,
|
|
414
|
+
stringifySym,
|
|
415
|
+
stringifySafeSym,
|
|
416
|
+
stringifiersSym,
|
|
417
|
+
endSym,
|
|
418
|
+
formatOptsSym,
|
|
419
|
+
messageKeySym,
|
|
420
|
+
errorKeySym,
|
|
421
|
+
nestedKeySym,
|
|
422
|
+
wildcardFirstSym,
|
|
423
|
+
needsMetadataGsym: Symbol.for("pino.metadata"),
|
|
424
|
+
useOnlyCustomLevelsSym,
|
|
425
|
+
formattersSym,
|
|
426
|
+
hooksSym,
|
|
427
|
+
nestedKeyStrSym,
|
|
428
|
+
mixinMergeStrategySym,
|
|
429
|
+
msgPrefixSym
|
|
430
|
+
};
|
|
431
|
+
}));
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/redaction.js
|
|
434
|
+
var require_redaction = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
435
|
+
var Redact = require_redact();
|
|
436
|
+
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
|
437
|
+
var rx = /[^.[\]]+|\[([^[\]]*?)\]/g;
|
|
438
|
+
var CENSOR = "[Redacted]";
|
|
439
|
+
var strict = false;
|
|
440
|
+
function redaction(opts, serialize) {
|
|
441
|
+
const { paths, censor, remove } = handle(opts);
|
|
442
|
+
const shape = paths.reduce((o, str) => {
|
|
443
|
+
rx.lastIndex = 0;
|
|
444
|
+
const first = rx.exec(str);
|
|
445
|
+
const next = rx.exec(str);
|
|
446
|
+
let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
|
|
447
|
+
if (ns === "*") ns = wildcardFirstSym;
|
|
448
|
+
if (next === null) {
|
|
449
|
+
o[ns] = null;
|
|
450
|
+
return o;
|
|
451
|
+
}
|
|
452
|
+
if (o[ns] === null) return o;
|
|
453
|
+
const { index } = next;
|
|
454
|
+
const nextPath = `${str.substr(index, str.length - 1)}`;
|
|
455
|
+
o[ns] = o[ns] || [];
|
|
456
|
+
if (ns !== wildcardFirstSym && o[ns].length === 0) o[ns].push(...o[wildcardFirstSym] || []);
|
|
457
|
+
if (ns === wildcardFirstSym) Object.keys(o).forEach(function(k) {
|
|
458
|
+
if (o[k]) o[k].push(nextPath);
|
|
459
|
+
});
|
|
460
|
+
o[ns].push(nextPath);
|
|
461
|
+
return o;
|
|
462
|
+
}, {});
|
|
463
|
+
const result = { [redactFmtSym]: Redact({
|
|
464
|
+
paths,
|
|
465
|
+
censor,
|
|
466
|
+
serialize,
|
|
467
|
+
strict,
|
|
468
|
+
remove
|
|
469
|
+
}) };
|
|
470
|
+
const topCensor = (...args) => {
|
|
471
|
+
return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
|
|
472
|
+
};
|
|
473
|
+
return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
|
|
474
|
+
if (shape[k] === null) o[k] = (value) => topCensor(value, [k]);
|
|
475
|
+
else {
|
|
476
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
|
477
|
+
return censor(value, [k, ...path]);
|
|
478
|
+
} : censor;
|
|
479
|
+
o[k] = Redact({
|
|
480
|
+
paths: shape[k],
|
|
481
|
+
censor: wrappedCensor,
|
|
482
|
+
serialize,
|
|
483
|
+
strict,
|
|
484
|
+
remove
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
return o;
|
|
488
|
+
}, result);
|
|
489
|
+
}
|
|
490
|
+
function handle(opts) {
|
|
491
|
+
if (Array.isArray(opts)) {
|
|
492
|
+
opts = {
|
|
493
|
+
paths: opts,
|
|
494
|
+
censor: CENSOR
|
|
495
|
+
};
|
|
496
|
+
return opts;
|
|
497
|
+
}
|
|
498
|
+
let { paths, censor = CENSOR, remove } = opts;
|
|
499
|
+
if (Array.isArray(paths) === false) throw Error("pino – redact must contain an array of strings");
|
|
500
|
+
if (remove === true) censor = void 0;
|
|
501
|
+
return {
|
|
502
|
+
paths,
|
|
503
|
+
censor,
|
|
504
|
+
remove
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
module.exports = redaction;
|
|
508
|
+
}));
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/time.js
|
|
511
|
+
var require_time = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
512
|
+
var nullTime = () => "";
|
|
513
|
+
var epochTime = () => `,"time":${Date.now()}`;
|
|
514
|
+
var unixTime = () => `,"time":${Math.round(Date.now() / 1e3)}`;
|
|
515
|
+
var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
|
|
516
|
+
var NS_PER_MS = 1000000n;
|
|
517
|
+
var NS_PER_SEC = 1000000000n;
|
|
518
|
+
var startWallTimeNs = BigInt(Date.now()) * NS_PER_MS;
|
|
519
|
+
var startHrTime = process.hrtime.bigint();
|
|
520
|
+
var isoTimeNano = () => {
|
|
521
|
+
const currentTimeNs = startWallTimeNs + (process.hrtime.bigint() - startHrTime);
|
|
522
|
+
const secondsSinceEpoch = currentTimeNs / NS_PER_SEC;
|
|
523
|
+
const nanosWithinSecond = currentTimeNs % NS_PER_SEC;
|
|
524
|
+
const msSinceEpoch = Number(secondsSinceEpoch * 1000n + nanosWithinSecond / 1000000n);
|
|
525
|
+
const date = new Date(msSinceEpoch);
|
|
526
|
+
return `,"time":"${date.getUTCFullYear()}-${(date.getUTCMonth() + 1).toString().padStart(2, "0")}-${date.getUTCDate().toString().padStart(2, "0")}T${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}:${date.getUTCSeconds().toString().padStart(2, "0")}.${nanosWithinSecond.toString().padStart(9, "0")}Z"`;
|
|
527
|
+
};
|
|
528
|
+
module.exports = {
|
|
529
|
+
nullTime,
|
|
530
|
+
epochTime,
|
|
531
|
+
unixTime,
|
|
532
|
+
isoTime,
|
|
533
|
+
isoTimeNano
|
|
534
|
+
};
|
|
535
|
+
}));
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region ../../node_modules/.pnpm/quick-format-unescaped@4.0.4/node_modules/quick-format-unescaped/index.js
|
|
538
|
+
var require_quick_format_unescaped = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
539
|
+
function tryStringify(o) {
|
|
540
|
+
try {
|
|
541
|
+
return JSON.stringify(o);
|
|
542
|
+
} catch (e) {
|
|
543
|
+
return "\"[Circular]\"";
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
module.exports = format;
|
|
547
|
+
function format(f, args, opts) {
|
|
548
|
+
var ss = opts && opts.stringify || tryStringify;
|
|
549
|
+
var offset = 1;
|
|
550
|
+
if (typeof f === "object" && f !== null) {
|
|
551
|
+
var len = args.length + offset;
|
|
552
|
+
if (len === 1) return f;
|
|
553
|
+
var objects = new Array(len);
|
|
554
|
+
objects[0] = ss(f);
|
|
555
|
+
for (var index = 1; index < len; index++) objects[index] = ss(args[index]);
|
|
556
|
+
return objects.join(" ");
|
|
557
|
+
}
|
|
558
|
+
if (typeof f !== "string") return f;
|
|
559
|
+
var argLen = args.length;
|
|
560
|
+
if (argLen === 0) return f;
|
|
561
|
+
var str = "";
|
|
562
|
+
var a = 1 - offset;
|
|
563
|
+
var lastPos = -1;
|
|
564
|
+
var flen = f && f.length || 0;
|
|
565
|
+
for (var i = 0; i < flen;) {
|
|
566
|
+
if (f.charCodeAt(i) === 37 && i + 1 < flen) {
|
|
567
|
+
lastPos = lastPos > -1 ? lastPos : 0;
|
|
568
|
+
switch (f.charCodeAt(i + 1)) {
|
|
569
|
+
case 100:
|
|
570
|
+
case 102:
|
|
571
|
+
if (a >= argLen) break;
|
|
572
|
+
if (args[a] == null) break;
|
|
573
|
+
if (lastPos < i) str += f.slice(lastPos, i);
|
|
574
|
+
str += Number(args[a]);
|
|
575
|
+
lastPos = i + 2;
|
|
576
|
+
i++;
|
|
577
|
+
break;
|
|
578
|
+
case 105:
|
|
579
|
+
if (a >= argLen) break;
|
|
580
|
+
if (args[a] == null) break;
|
|
581
|
+
if (lastPos < i) str += f.slice(lastPos, i);
|
|
582
|
+
str += Math.floor(Number(args[a]));
|
|
583
|
+
lastPos = i + 2;
|
|
584
|
+
i++;
|
|
585
|
+
break;
|
|
586
|
+
case 79:
|
|
587
|
+
case 111:
|
|
588
|
+
case 106:
|
|
589
|
+
if (a >= argLen) break;
|
|
590
|
+
if (args[a] === void 0) break;
|
|
591
|
+
if (lastPos < i) str += f.slice(lastPos, i);
|
|
592
|
+
var type = typeof args[a];
|
|
593
|
+
if (type === "string") {
|
|
594
|
+
str += "'" + args[a] + "'";
|
|
595
|
+
lastPos = i + 2;
|
|
596
|
+
i++;
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
if (type === "function") {
|
|
600
|
+
str += args[a].name || "<anonymous>";
|
|
601
|
+
lastPos = i + 2;
|
|
602
|
+
i++;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
str += ss(args[a]);
|
|
606
|
+
lastPos = i + 2;
|
|
607
|
+
i++;
|
|
608
|
+
break;
|
|
609
|
+
case 115:
|
|
610
|
+
if (a >= argLen) break;
|
|
611
|
+
if (lastPos < i) str += f.slice(lastPos, i);
|
|
612
|
+
str += String(args[a]);
|
|
613
|
+
lastPos = i + 2;
|
|
614
|
+
i++;
|
|
615
|
+
break;
|
|
616
|
+
case 37:
|
|
617
|
+
if (lastPos < i) str += f.slice(lastPos, i);
|
|
618
|
+
str += "%";
|
|
619
|
+
lastPos = i + 2;
|
|
620
|
+
i++;
|
|
621
|
+
a--;
|
|
622
|
+
break;
|
|
623
|
+
}
|
|
624
|
+
++a;
|
|
625
|
+
}
|
|
626
|
+
++i;
|
|
627
|
+
}
|
|
628
|
+
if (lastPos === -1) return f;
|
|
629
|
+
else if (lastPos < flen) str += f.slice(lastPos);
|
|
630
|
+
return str;
|
|
631
|
+
}
|
|
632
|
+
}));
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region ../../node_modules/.pnpm/sonic-boom@4.2.1/node_modules/sonic-boom/index.js
|
|
635
|
+
var require_sonic_boom = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
636
|
+
var fs = __require("fs");
|
|
637
|
+
var EventEmitter$2 = __require("events");
|
|
638
|
+
var inherits = __require("util").inherits;
|
|
639
|
+
var path = __require("path");
|
|
640
|
+
var sleep = require_atomic_sleep();
|
|
641
|
+
var assert$1 = __require("assert");
|
|
642
|
+
var BUSY_WRITE_TIMEOUT = 100;
|
|
643
|
+
var kEmptyBuffer = Buffer.allocUnsafe(0);
|
|
644
|
+
var MAX_WRITE = 16 * 1024;
|
|
645
|
+
var kContentModeBuffer = "buffer";
|
|
646
|
+
var kContentModeUtf8 = "utf8";
|
|
647
|
+
var [major, minor] = (process.versions.node || "0.0").split(".").map(Number);
|
|
648
|
+
var kCopyBuffer = major >= 22 && minor >= 7;
|
|
649
|
+
function openFile(file, sonic) {
|
|
650
|
+
sonic._opening = true;
|
|
651
|
+
sonic._writing = true;
|
|
652
|
+
sonic._asyncDrainScheduled = false;
|
|
653
|
+
function fileOpened(err, fd) {
|
|
654
|
+
if (err) {
|
|
655
|
+
sonic._reopening = false;
|
|
656
|
+
sonic._writing = false;
|
|
657
|
+
sonic._opening = false;
|
|
658
|
+
if (sonic.sync) process.nextTick(() => {
|
|
659
|
+
if (sonic.listenerCount("error") > 0) sonic.emit("error", err);
|
|
660
|
+
});
|
|
661
|
+
else sonic.emit("error", err);
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
const reopening = sonic._reopening;
|
|
665
|
+
sonic.fd = fd;
|
|
666
|
+
sonic.file = file;
|
|
667
|
+
sonic._reopening = false;
|
|
668
|
+
sonic._opening = false;
|
|
669
|
+
sonic._writing = false;
|
|
670
|
+
if (sonic.sync) process.nextTick(() => sonic.emit("ready"));
|
|
671
|
+
else sonic.emit("ready");
|
|
672
|
+
if (sonic.destroyed) return;
|
|
673
|
+
if (!sonic._writing && sonic._len > sonic.minLength || sonic._flushPending) sonic._actualWrite();
|
|
674
|
+
else if (reopening) process.nextTick(() => sonic.emit("drain"));
|
|
675
|
+
}
|
|
676
|
+
const flags = sonic.append ? "a" : "w";
|
|
677
|
+
const mode = sonic.mode;
|
|
678
|
+
if (sonic.sync) try {
|
|
679
|
+
if (sonic.mkdir) fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
680
|
+
fileOpened(null, fs.openSync(file, flags, mode));
|
|
681
|
+
} catch (err) {
|
|
682
|
+
fileOpened(err);
|
|
683
|
+
throw err;
|
|
684
|
+
}
|
|
685
|
+
else if (sonic.mkdir) fs.mkdir(path.dirname(file), { recursive: true }, (err) => {
|
|
686
|
+
if (err) return fileOpened(err);
|
|
687
|
+
fs.open(file, flags, mode, fileOpened);
|
|
688
|
+
});
|
|
689
|
+
else fs.open(file, flags, mode, fileOpened);
|
|
690
|
+
}
|
|
691
|
+
function SonicBoom(opts) {
|
|
692
|
+
if (!(this instanceof SonicBoom)) return new SonicBoom(opts);
|
|
693
|
+
let { fd, dest, minLength, maxLength, maxWrite, periodicFlush, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
|
|
694
|
+
fd = fd || dest;
|
|
695
|
+
this._len = 0;
|
|
696
|
+
this.fd = -1;
|
|
697
|
+
this._bufs = [];
|
|
698
|
+
this._lens = [];
|
|
699
|
+
this._writing = false;
|
|
700
|
+
this._ending = false;
|
|
701
|
+
this._reopening = false;
|
|
702
|
+
this._asyncDrainScheduled = false;
|
|
703
|
+
this._flushPending = false;
|
|
704
|
+
this._hwm = Math.max(minLength || 0, 16387);
|
|
705
|
+
this.file = null;
|
|
706
|
+
this.destroyed = false;
|
|
707
|
+
this.minLength = minLength || 0;
|
|
708
|
+
this.maxLength = maxLength || 0;
|
|
709
|
+
this.maxWrite = maxWrite || MAX_WRITE;
|
|
710
|
+
this._periodicFlush = periodicFlush || 0;
|
|
711
|
+
this._periodicFlushTimer = void 0;
|
|
712
|
+
this.sync = sync || false;
|
|
713
|
+
this.writable = true;
|
|
714
|
+
this._fsync = fsync || false;
|
|
715
|
+
this.append = append || false;
|
|
716
|
+
this.mode = mode;
|
|
717
|
+
this.retryEAGAIN = retryEAGAIN || (() => true);
|
|
718
|
+
this.mkdir = mkdir || false;
|
|
719
|
+
let fsWriteSync;
|
|
720
|
+
let fsWrite;
|
|
721
|
+
if (contentMode === kContentModeBuffer) {
|
|
722
|
+
this._writingBuf = kEmptyBuffer;
|
|
723
|
+
this.write = writeBuffer;
|
|
724
|
+
this.flush = flushBuffer;
|
|
725
|
+
this.flushSync = flushBufferSync;
|
|
726
|
+
this._actualWrite = actualWriteBuffer;
|
|
727
|
+
fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf);
|
|
728
|
+
fsWrite = () => fs.write(this.fd, this._writingBuf, this.release);
|
|
729
|
+
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
|
730
|
+
this._writingBuf = "";
|
|
731
|
+
this.write = write;
|
|
732
|
+
this.flush = flush;
|
|
733
|
+
this.flushSync = flushSync;
|
|
734
|
+
this._actualWrite = actualWrite;
|
|
735
|
+
fsWriteSync = () => {
|
|
736
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs.writeSync(this.fd, this._writingBuf);
|
|
737
|
+
return fs.writeSync(this.fd, this._writingBuf, "utf8");
|
|
738
|
+
};
|
|
739
|
+
fsWrite = () => {
|
|
740
|
+
if (Buffer.isBuffer(this._writingBuf)) return fs.write(this.fd, this._writingBuf, this.release);
|
|
741
|
+
return fs.write(this.fd, this._writingBuf, "utf8", this.release);
|
|
742
|
+
};
|
|
743
|
+
} else throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
|
744
|
+
if (typeof fd === "number") {
|
|
745
|
+
this.fd = fd;
|
|
746
|
+
process.nextTick(() => this.emit("ready"));
|
|
747
|
+
} else if (typeof fd === "string") openFile(fd, this);
|
|
748
|
+
else throw new Error("SonicBoom supports only file descriptors and files");
|
|
749
|
+
if (this.minLength >= this.maxWrite) throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);
|
|
750
|
+
this.release = (err, n) => {
|
|
751
|
+
if (err) {
|
|
752
|
+
if ((err.code === "EAGAIN" || err.code === "EBUSY") && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) if (this.sync) try {
|
|
753
|
+
sleep(BUSY_WRITE_TIMEOUT);
|
|
754
|
+
this.release(void 0, 0);
|
|
755
|
+
} catch (err) {
|
|
756
|
+
this.release(err);
|
|
757
|
+
}
|
|
758
|
+
else setTimeout(fsWrite, BUSY_WRITE_TIMEOUT);
|
|
759
|
+
else {
|
|
760
|
+
this._writing = false;
|
|
761
|
+
this.emit("error", err);
|
|
762
|
+
}
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
this.emit("write", n);
|
|
766
|
+
const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n);
|
|
767
|
+
this._len = releasedBufObj.len;
|
|
768
|
+
this._writingBuf = releasedBufObj.writingBuf;
|
|
769
|
+
if (this._writingBuf.length) {
|
|
770
|
+
if (!this.sync) {
|
|
771
|
+
fsWrite();
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
try {
|
|
775
|
+
do {
|
|
776
|
+
const n = fsWriteSync();
|
|
777
|
+
const releasedBufObj = releaseWritingBuf(this._writingBuf, this._len, n);
|
|
778
|
+
this._len = releasedBufObj.len;
|
|
779
|
+
this._writingBuf = releasedBufObj.writingBuf;
|
|
780
|
+
} while (this._writingBuf.length);
|
|
781
|
+
} catch (err) {
|
|
782
|
+
this.release(err);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
if (this._fsync) fs.fsyncSync(this.fd);
|
|
787
|
+
const len = this._len;
|
|
788
|
+
if (this._reopening) {
|
|
789
|
+
this._writing = false;
|
|
790
|
+
this._reopening = false;
|
|
791
|
+
this.reopen();
|
|
792
|
+
} else if (len > this.minLength) this._actualWrite();
|
|
793
|
+
else if (this._ending) if (len > 0) this._actualWrite();
|
|
794
|
+
else {
|
|
795
|
+
this._writing = false;
|
|
796
|
+
actualClose(this);
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
this._writing = false;
|
|
800
|
+
if (this.sync) {
|
|
801
|
+
if (!this._asyncDrainScheduled) {
|
|
802
|
+
this._asyncDrainScheduled = true;
|
|
803
|
+
process.nextTick(emitDrain, this);
|
|
804
|
+
}
|
|
805
|
+
} else this.emit("drain");
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
this.on("newListener", function(name) {
|
|
809
|
+
if (name === "drain") this._asyncDrainScheduled = false;
|
|
810
|
+
});
|
|
811
|
+
if (this._periodicFlush !== 0) {
|
|
812
|
+
this._periodicFlushTimer = setInterval(() => this.flush(null), this._periodicFlush);
|
|
813
|
+
this._periodicFlushTimer.unref();
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Release the writingBuf after fs.write n bytes data
|
|
818
|
+
* @param {string | Buffer} writingBuf - currently writing buffer, usually be instance._writingBuf.
|
|
819
|
+
* @param {number} len - currently buffer length, usually be instance._len.
|
|
820
|
+
* @param {number} n - number of bytes fs already written
|
|
821
|
+
* @returns {{writingBuf: string | Buffer, len: number}} released writingBuf and length
|
|
822
|
+
*/
|
|
823
|
+
function releaseWritingBuf(writingBuf, len, n) {
|
|
824
|
+
if (typeof writingBuf === "string") writingBuf = Buffer.from(writingBuf);
|
|
825
|
+
len = Math.max(len - n, 0);
|
|
826
|
+
writingBuf = writingBuf.subarray(n);
|
|
827
|
+
return {
|
|
828
|
+
writingBuf,
|
|
829
|
+
len
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
function emitDrain(sonic) {
|
|
833
|
+
if (!(sonic.listenerCount("drain") > 0)) return;
|
|
834
|
+
sonic._asyncDrainScheduled = false;
|
|
835
|
+
sonic.emit("drain");
|
|
836
|
+
}
|
|
837
|
+
inherits(SonicBoom, EventEmitter$2);
|
|
838
|
+
function mergeBuf(bufs, len) {
|
|
839
|
+
if (bufs.length === 0) return kEmptyBuffer;
|
|
840
|
+
if (bufs.length === 1) return bufs[0];
|
|
841
|
+
return Buffer.concat(bufs, len);
|
|
842
|
+
}
|
|
843
|
+
function write(data) {
|
|
844
|
+
if (this.destroyed) throw new Error("SonicBoom destroyed");
|
|
845
|
+
data = "" + data;
|
|
846
|
+
const dataLen = Buffer.byteLength(data);
|
|
847
|
+
const len = this._len + dataLen;
|
|
848
|
+
const bufs = this._bufs;
|
|
849
|
+
if (this.maxLength && len > this.maxLength) {
|
|
850
|
+
this.emit("drop", data);
|
|
851
|
+
return this._len < this._hwm;
|
|
852
|
+
}
|
|
853
|
+
if (bufs.length === 0 || Buffer.byteLength(bufs[bufs.length - 1]) + dataLen > this.maxWrite) bufs.push(data);
|
|
854
|
+
else bufs[bufs.length - 1] += data;
|
|
855
|
+
this._len = len;
|
|
856
|
+
if (!this._writing && this._len >= this.minLength) this._actualWrite();
|
|
857
|
+
return this._len < this._hwm;
|
|
858
|
+
}
|
|
859
|
+
function writeBuffer(data) {
|
|
860
|
+
if (this.destroyed) throw new Error("SonicBoom destroyed");
|
|
861
|
+
const len = this._len + data.length;
|
|
862
|
+
const bufs = this._bufs;
|
|
863
|
+
const lens = this._lens;
|
|
864
|
+
if (this.maxLength && len > this.maxLength) {
|
|
865
|
+
this.emit("drop", data);
|
|
866
|
+
return this._len < this._hwm;
|
|
867
|
+
}
|
|
868
|
+
if (bufs.length === 0 || lens[lens.length - 1] + data.length > this.maxWrite) {
|
|
869
|
+
bufs.push([data]);
|
|
870
|
+
lens.push(data.length);
|
|
871
|
+
} else {
|
|
872
|
+
bufs[bufs.length - 1].push(data);
|
|
873
|
+
lens[lens.length - 1] += data.length;
|
|
874
|
+
}
|
|
875
|
+
this._len = len;
|
|
876
|
+
if (!this._writing && this._len >= this.minLength) this._actualWrite();
|
|
877
|
+
return this._len < this._hwm;
|
|
878
|
+
}
|
|
879
|
+
function callFlushCallbackOnDrain(cb) {
|
|
880
|
+
this._flushPending = true;
|
|
881
|
+
const onDrain = () => {
|
|
882
|
+
if (!this._fsync) try {
|
|
883
|
+
fs.fsync(this.fd, (err) => {
|
|
884
|
+
this._flushPending = false;
|
|
885
|
+
cb(err);
|
|
886
|
+
});
|
|
887
|
+
} catch (err) {
|
|
888
|
+
cb(err);
|
|
889
|
+
}
|
|
890
|
+
else {
|
|
891
|
+
this._flushPending = false;
|
|
892
|
+
cb();
|
|
893
|
+
}
|
|
894
|
+
this.off("error", onError);
|
|
895
|
+
};
|
|
896
|
+
const onError = (err) => {
|
|
897
|
+
this._flushPending = false;
|
|
898
|
+
cb(err);
|
|
899
|
+
this.off("drain", onDrain);
|
|
900
|
+
};
|
|
901
|
+
this.once("drain", onDrain);
|
|
902
|
+
this.once("error", onError);
|
|
903
|
+
}
|
|
904
|
+
function flush(cb) {
|
|
905
|
+
if (cb != null && typeof cb !== "function") throw new Error("flush cb must be a function");
|
|
906
|
+
if (this.destroyed) {
|
|
907
|
+
const error = /* @__PURE__ */ new Error("SonicBoom destroyed");
|
|
908
|
+
if (cb) {
|
|
909
|
+
cb(error);
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
throw error;
|
|
913
|
+
}
|
|
914
|
+
if (this.minLength <= 0) {
|
|
915
|
+
cb?.();
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
if (cb) callFlushCallbackOnDrain.call(this, cb);
|
|
919
|
+
if (this._writing) return;
|
|
920
|
+
if (this._bufs.length === 0) this._bufs.push("");
|
|
921
|
+
this._actualWrite();
|
|
922
|
+
}
|
|
923
|
+
function flushBuffer(cb) {
|
|
924
|
+
if (cb != null && typeof cb !== "function") throw new Error("flush cb must be a function");
|
|
925
|
+
if (this.destroyed) {
|
|
926
|
+
const error = /* @__PURE__ */ new Error("SonicBoom destroyed");
|
|
927
|
+
if (cb) {
|
|
928
|
+
cb(error);
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
throw error;
|
|
932
|
+
}
|
|
933
|
+
if (this.minLength <= 0) {
|
|
934
|
+
cb?.();
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
937
|
+
if (cb) callFlushCallbackOnDrain.call(this, cb);
|
|
938
|
+
if (this._writing) return;
|
|
939
|
+
if (this._bufs.length === 0) {
|
|
940
|
+
this._bufs.push([]);
|
|
941
|
+
this._lens.push(0);
|
|
942
|
+
}
|
|
943
|
+
this._actualWrite();
|
|
944
|
+
}
|
|
945
|
+
SonicBoom.prototype.reopen = function(file) {
|
|
946
|
+
if (this.destroyed) throw new Error("SonicBoom destroyed");
|
|
947
|
+
if (this._opening) {
|
|
948
|
+
this.once("ready", () => {
|
|
949
|
+
this.reopen(file);
|
|
950
|
+
});
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
953
|
+
if (this._ending) return;
|
|
954
|
+
if (!this.file) throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
|
|
955
|
+
if (file) this.file = file;
|
|
956
|
+
this._reopening = true;
|
|
957
|
+
if (this._writing) return;
|
|
958
|
+
const fd = this.fd;
|
|
959
|
+
this.once("ready", () => {
|
|
960
|
+
if (fd !== this.fd) fs.close(fd, (err) => {
|
|
961
|
+
if (err) return this.emit("error", err);
|
|
962
|
+
});
|
|
963
|
+
});
|
|
964
|
+
openFile(this.file, this);
|
|
965
|
+
};
|
|
966
|
+
SonicBoom.prototype.end = function() {
|
|
967
|
+
if (this.destroyed) throw new Error("SonicBoom destroyed");
|
|
968
|
+
if (this._opening) {
|
|
969
|
+
this.once("ready", () => {
|
|
970
|
+
this.end();
|
|
971
|
+
});
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
if (this._ending) return;
|
|
975
|
+
this._ending = true;
|
|
976
|
+
if (this._writing) return;
|
|
977
|
+
if (this._len > 0 && this.fd >= 0) this._actualWrite();
|
|
978
|
+
else actualClose(this);
|
|
979
|
+
};
|
|
980
|
+
function flushSync() {
|
|
981
|
+
if (this.destroyed) throw new Error("SonicBoom destroyed");
|
|
982
|
+
if (this.fd < 0) throw new Error("sonic boom is not ready yet");
|
|
983
|
+
if (!this._writing && this._writingBuf.length > 0) {
|
|
984
|
+
this._bufs.unshift(this._writingBuf);
|
|
985
|
+
this._writingBuf = "";
|
|
986
|
+
}
|
|
987
|
+
let buf = "";
|
|
988
|
+
while (this._bufs.length || buf.length) {
|
|
989
|
+
if (buf.length <= 0) buf = this._bufs[0];
|
|
990
|
+
try {
|
|
991
|
+
const n = Buffer.isBuffer(buf) ? fs.writeSync(this.fd, buf) : fs.writeSync(this.fd, buf, "utf8");
|
|
992
|
+
const releasedBufObj = releaseWritingBuf(buf, this._len, n);
|
|
993
|
+
buf = releasedBufObj.writingBuf;
|
|
994
|
+
this._len = releasedBufObj.len;
|
|
995
|
+
if (buf.length <= 0) this._bufs.shift();
|
|
996
|
+
} catch (err) {
|
|
997
|
+
if ((err.code === "EAGAIN" || err.code === "EBUSY") && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) throw err;
|
|
998
|
+
sleep(BUSY_WRITE_TIMEOUT);
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
try {
|
|
1002
|
+
fs.fsyncSync(this.fd);
|
|
1003
|
+
} catch {}
|
|
1004
|
+
}
|
|
1005
|
+
function flushBufferSync() {
|
|
1006
|
+
if (this.destroyed) throw new Error("SonicBoom destroyed");
|
|
1007
|
+
if (this.fd < 0) throw new Error("sonic boom is not ready yet");
|
|
1008
|
+
if (!this._writing && this._writingBuf.length > 0) {
|
|
1009
|
+
this._bufs.unshift([this._writingBuf]);
|
|
1010
|
+
this._writingBuf = kEmptyBuffer;
|
|
1011
|
+
}
|
|
1012
|
+
let buf = kEmptyBuffer;
|
|
1013
|
+
while (this._bufs.length || buf.length) {
|
|
1014
|
+
if (buf.length <= 0) buf = mergeBuf(this._bufs[0], this._lens[0]);
|
|
1015
|
+
try {
|
|
1016
|
+
const n = fs.writeSync(this.fd, buf);
|
|
1017
|
+
buf = buf.subarray(n);
|
|
1018
|
+
this._len = Math.max(this._len - n, 0);
|
|
1019
|
+
if (buf.length <= 0) {
|
|
1020
|
+
this._bufs.shift();
|
|
1021
|
+
this._lens.shift();
|
|
1022
|
+
}
|
|
1023
|
+
} catch (err) {
|
|
1024
|
+
if ((err.code === "EAGAIN" || err.code === "EBUSY") && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) throw err;
|
|
1025
|
+
sleep(BUSY_WRITE_TIMEOUT);
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
SonicBoom.prototype.destroy = function() {
|
|
1030
|
+
if (this.destroyed) return;
|
|
1031
|
+
actualClose(this);
|
|
1032
|
+
};
|
|
1033
|
+
function actualWrite() {
|
|
1034
|
+
const release = this.release;
|
|
1035
|
+
this._writing = true;
|
|
1036
|
+
this._writingBuf = this._writingBuf.length ? this._writingBuf : this._bufs.shift() || "";
|
|
1037
|
+
if (this.sync) try {
|
|
1038
|
+
release(null, Buffer.isBuffer(this._writingBuf) ? fs.writeSync(this.fd, this._writingBuf) : fs.writeSync(this.fd, this._writingBuf, "utf8"));
|
|
1039
|
+
} catch (err) {
|
|
1040
|
+
release(err);
|
|
1041
|
+
}
|
|
1042
|
+
else fs.write(this.fd, this._writingBuf, release);
|
|
1043
|
+
}
|
|
1044
|
+
function actualWriteBuffer() {
|
|
1045
|
+
const release = this.release;
|
|
1046
|
+
this._writing = true;
|
|
1047
|
+
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
|
1048
|
+
if (this.sync) try {
|
|
1049
|
+
release(null, fs.writeSync(this.fd, this._writingBuf));
|
|
1050
|
+
} catch (err) {
|
|
1051
|
+
release(err);
|
|
1052
|
+
}
|
|
1053
|
+
else {
|
|
1054
|
+
if (kCopyBuffer) this._writingBuf = Buffer.from(this._writingBuf);
|
|
1055
|
+
fs.write(this.fd, this._writingBuf, release);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function actualClose(sonic) {
|
|
1059
|
+
if (sonic.fd === -1) {
|
|
1060
|
+
sonic.once("ready", actualClose.bind(null, sonic));
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
if (sonic._periodicFlushTimer !== void 0) clearInterval(sonic._periodicFlushTimer);
|
|
1064
|
+
sonic.destroyed = true;
|
|
1065
|
+
sonic._bufs = [];
|
|
1066
|
+
sonic._lens = [];
|
|
1067
|
+
assert$1(typeof sonic.fd === "number", `sonic.fd must be a number, got ${typeof sonic.fd}`);
|
|
1068
|
+
try {
|
|
1069
|
+
fs.fsync(sonic.fd, closeWrapped);
|
|
1070
|
+
} catch {}
|
|
1071
|
+
function closeWrapped() {
|
|
1072
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) fs.close(sonic.fd, done);
|
|
1073
|
+
else done();
|
|
1074
|
+
}
|
|
1075
|
+
function done(err) {
|
|
1076
|
+
if (err) {
|
|
1077
|
+
sonic.emit("error", err);
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
if (sonic._ending && !sonic._writing) sonic.emit("finish");
|
|
1081
|
+
sonic.emit("close");
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* These export configurations enable JS and TS developers
|
|
1086
|
+
* to consumer SonicBoom in whatever way best suits their needs.
|
|
1087
|
+
* Some examples of supported import syntax includes:
|
|
1088
|
+
* - `const SonicBoom = require('SonicBoom')`
|
|
1089
|
+
* - `const { SonicBoom } = require('SonicBoom')`
|
|
1090
|
+
* - `import * as SonicBoom from 'SonicBoom'`
|
|
1091
|
+
* - `import { SonicBoom } from 'SonicBoom'`
|
|
1092
|
+
* - `import SonicBoom from 'SonicBoom'`
|
|
1093
|
+
*/
|
|
1094
|
+
SonicBoom.SonicBoom = SonicBoom;
|
|
1095
|
+
SonicBoom.default = SonicBoom;
|
|
1096
|
+
module.exports = SonicBoom;
|
|
1097
|
+
}));
|
|
1098
|
+
//#endregion
|
|
1099
|
+
//#region ../../node_modules/.pnpm/thread-stream@4.2.0/node_modules/thread-stream/package.json
|
|
1100
|
+
var package_exports = /* @__PURE__ */ __exportAll({
|
|
1101
|
+
author: () => author,
|
|
1102
|
+
bugs: () => bugs,
|
|
1103
|
+
default: () => package_default,
|
|
1104
|
+
dependencies: () => dependencies,
|
|
1105
|
+
description: () => description,
|
|
1106
|
+
devDependencies: () => devDependencies,
|
|
1107
|
+
engines: () => engines,
|
|
1108
|
+
homepage: () => homepage,
|
|
1109
|
+
keywords: () => keywords,
|
|
1110
|
+
license: () => "MIT",
|
|
1111
|
+
main: () => main,
|
|
1112
|
+
name: () => name,
|
|
1113
|
+
repository: () => repository,
|
|
1114
|
+
scripts: () => scripts,
|
|
1115
|
+
types: () => types,
|
|
1116
|
+
version: () => version
|
|
1117
|
+
}), name, version, description, main, types, engines, dependencies, devDependencies, scripts, repository, keywords, author, bugs, homepage, package_default;
|
|
1118
|
+
var init_package = __esmMin((() => {
|
|
1119
|
+
name = "thread-stream";
|
|
1120
|
+
version = "4.2.0";
|
|
1121
|
+
description = "A streaming way to send data to a Node.js Worker Thread";
|
|
1122
|
+
main = "index.js";
|
|
1123
|
+
types = "index.d.ts";
|
|
1124
|
+
engines = { "node": ">=20" };
|
|
1125
|
+
dependencies = { "real-require": "^1.0.0" };
|
|
1126
|
+
devDependencies = {
|
|
1127
|
+
"@types/node": "^25.0.2",
|
|
1128
|
+
"@yao-pkg/pkg": "^6.0.0",
|
|
1129
|
+
"borp": "^1.0.0",
|
|
1130
|
+
"desm": "^1.3.0",
|
|
1131
|
+
"eslint": "^9.39.1",
|
|
1132
|
+
"fastbench": "^1.0.1",
|
|
1133
|
+
"neostandard": "^0.13.0",
|
|
1134
|
+
"pino-elasticsearch": "^9.0.0",
|
|
1135
|
+
"sonic-boom": "^5.0.0",
|
|
1136
|
+
"ts-node": "^10.8.0",
|
|
1137
|
+
"typescript": "~5.7.3"
|
|
1138
|
+
};
|
|
1139
|
+
scripts = {
|
|
1140
|
+
"build": "tsc --noEmit",
|
|
1141
|
+
"lint": "eslint",
|
|
1142
|
+
"test": "npm run lint && npm run build && npm run transpile && borp --pattern \"test/*.test.{js,mjs}\"",
|
|
1143
|
+
"test:ci": "npm run lint && npm run transpile && borp --pattern \"test/*.test.{js,mjs}\"",
|
|
1144
|
+
"test:yarn": "npm run transpile && borp --pattern \"test/*.test.js\"",
|
|
1145
|
+
"transpile": "sh ./test/ts/transpile.sh"
|
|
1146
|
+
};
|
|
1147
|
+
repository = {
|
|
1148
|
+
"type": "git",
|
|
1149
|
+
"url": "git+https://github.com/mcollina/thread-stream.git"
|
|
1150
|
+
};
|
|
1151
|
+
keywords = [
|
|
1152
|
+
"worker",
|
|
1153
|
+
"thread",
|
|
1154
|
+
"threads",
|
|
1155
|
+
"stream"
|
|
1156
|
+
];
|
|
1157
|
+
author = "Matteo Collina <hello@matteocollina.com>";
|
|
1158
|
+
bugs = { "url": "https://github.com/mcollina/thread-stream/issues" };
|
|
1159
|
+
homepage = "https://github.com/mcollina/thread-stream#readme";
|
|
1160
|
+
package_default = {
|
|
1161
|
+
name,
|
|
1162
|
+
version,
|
|
1163
|
+
description,
|
|
1164
|
+
main,
|
|
1165
|
+
types,
|
|
1166
|
+
engines,
|
|
1167
|
+
dependencies,
|
|
1168
|
+
devDependencies,
|
|
1169
|
+
scripts,
|
|
1170
|
+
repository,
|
|
1171
|
+
keywords,
|
|
1172
|
+
author,
|
|
1173
|
+
license: "MIT",
|
|
1174
|
+
bugs,
|
|
1175
|
+
homepage
|
|
1176
|
+
};
|
|
1177
|
+
}));
|
|
1178
|
+
//#endregion
|
|
1179
|
+
//#region ../../node_modules/.pnpm/thread-stream@4.2.0/node_modules/thread-stream/lib/wait.js
|
|
1180
|
+
var require_wait = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1181
|
+
var WAIT_MS = 1e4;
|
|
1182
|
+
function wait(state, index, expected, timeout, done) {
|
|
1183
|
+
const max = timeout === Infinity ? Infinity : Date.now() + timeout;
|
|
1184
|
+
const check = () => {
|
|
1185
|
+
const current = Atomics.load(state, index);
|
|
1186
|
+
if (current === expected) {
|
|
1187
|
+
done(null, "ok");
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
if (max !== Infinity && Date.now() > max) {
|
|
1191
|
+
done(null, "timed-out");
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
1195
|
+
const result = Atomics.waitAsync(state, index, current, remaining);
|
|
1196
|
+
if (result.async) result.value.then(check);
|
|
1197
|
+
else setImmediate(check);
|
|
1198
|
+
};
|
|
1199
|
+
check();
|
|
1200
|
+
}
|
|
1201
|
+
function waitDiff(state, index, expected, timeout, done) {
|
|
1202
|
+
const max = timeout === Infinity ? Infinity : Date.now() + timeout;
|
|
1203
|
+
const check = () => {
|
|
1204
|
+
if (Atomics.load(state, index) !== expected) {
|
|
1205
|
+
done(null, "ok");
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
if (max !== Infinity && Date.now() > max) {
|
|
1209
|
+
done(null, "timed-out");
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
1213
|
+
const result = Atomics.waitAsync(state, index, expected, remaining);
|
|
1214
|
+
if (result.async) result.value.then((res) => {
|
|
1215
|
+
if (res === "ok") {
|
|
1216
|
+
done(null, "ok");
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
check();
|
|
1220
|
+
});
|
|
1221
|
+
else setImmediate(check);
|
|
1222
|
+
};
|
|
1223
|
+
check();
|
|
1224
|
+
}
|
|
1225
|
+
module.exports = {
|
|
1226
|
+
wait,
|
|
1227
|
+
waitDiff
|
|
1228
|
+
};
|
|
1229
|
+
}));
|
|
1230
|
+
//#endregion
|
|
1231
|
+
//#region ../../node_modules/.pnpm/thread-stream@4.2.0/node_modules/thread-stream/lib/indexes.js
|
|
1232
|
+
var require_indexes = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1233
|
+
module.exports = {
|
|
1234
|
+
WRITE_INDEX: 4,
|
|
1235
|
+
READ_INDEX: 8,
|
|
1236
|
+
SEQ_INDEX: 2
|
|
1237
|
+
};
|
|
1238
|
+
}));
|
|
1239
|
+
//#endregion
|
|
1240
|
+
//#region ../../node_modules/.pnpm/thread-stream@4.2.0/node_modules/thread-stream/index.js
|
|
1241
|
+
var require_thread_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1242
|
+
var { version } = (init_package(), __toCommonJS(package_exports).default);
|
|
1243
|
+
var { EventEmitter: EventEmitter$1 } = __require("events");
|
|
1244
|
+
var { Worker } = __require("worker_threads");
|
|
1245
|
+
var { join: join$1 } = __require("path");
|
|
1246
|
+
var { pathToFileURL } = __require("url");
|
|
1247
|
+
var { wait } = require_wait();
|
|
1248
|
+
var { WRITE_INDEX, READ_INDEX, SEQ_INDEX } = require_indexes();
|
|
1249
|
+
var buffer = __require("buffer");
|
|
1250
|
+
var assert = __require("assert");
|
|
1251
|
+
var kImpl = Symbol("kImpl");
|
|
1252
|
+
var MAX_STRING = buffer.constants.MAX_STRING_LENGTH;
|
|
1253
|
+
function noop() {}
|
|
1254
|
+
function updateState(stream, fn) {
|
|
1255
|
+
Atomics.add(stream[kImpl].state, SEQ_INDEX, 1);
|
|
1256
|
+
fn();
|
|
1257
|
+
Atomics.add(stream[kImpl].state, SEQ_INDEX, 1);
|
|
1258
|
+
Atomics.notify(stream[kImpl].state, SEQ_INDEX);
|
|
1259
|
+
}
|
|
1260
|
+
function resetIndexes(stream) {
|
|
1261
|
+
updateState(stream, () => {
|
|
1262
|
+
Atomics.store(stream[kImpl].state, READ_INDEX, 0);
|
|
1263
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
var FakeWeakRef = class {
|
|
1267
|
+
constructor(value) {
|
|
1268
|
+
this._value = value;
|
|
1269
|
+
}
|
|
1270
|
+
deref() {
|
|
1271
|
+
return this._value;
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
var FakeFinalizationRegistry = class {
|
|
1275
|
+
register() {}
|
|
1276
|
+
unregister() {}
|
|
1277
|
+
};
|
|
1278
|
+
var FinalizationRegistry = process.env.NODE_V8_COVERAGE ? FakeFinalizationRegistry : global.FinalizationRegistry || FakeFinalizationRegistry;
|
|
1279
|
+
var WeakRef = process.env.NODE_V8_COVERAGE ? FakeWeakRef : global.WeakRef || FakeWeakRef;
|
|
1280
|
+
var registry = new FinalizationRegistry((worker) => {
|
|
1281
|
+
if (worker.exited) return;
|
|
1282
|
+
worker.terminate();
|
|
1283
|
+
});
|
|
1284
|
+
function createWorker(stream, opts) {
|
|
1285
|
+
const { filename, workerData } = opts;
|
|
1286
|
+
const worker = new Worker(("__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {})["thread-stream-worker"] || join$1(__dirname, "lib", "worker.js"), {
|
|
1287
|
+
...opts.workerOpts,
|
|
1288
|
+
name: opts.workerOpts?.name || "thread-stream",
|
|
1289
|
+
trackUnmanagedFds: false,
|
|
1290
|
+
workerData: {
|
|
1291
|
+
filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
|
|
1292
|
+
dataBuf: stream[kImpl].dataBuf,
|
|
1293
|
+
stateBuf: stream[kImpl].stateBuf,
|
|
1294
|
+
workerData: {
|
|
1295
|
+
$context: { threadStreamVersion: version },
|
|
1296
|
+
...workerData
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
worker.stream = new FakeWeakRef(stream);
|
|
1301
|
+
worker.on("message", onWorkerMessage);
|
|
1302
|
+
worker.on("exit", onWorkerExit);
|
|
1303
|
+
registry.register(stream, worker);
|
|
1304
|
+
return worker;
|
|
1305
|
+
}
|
|
1306
|
+
function drain(stream) {
|
|
1307
|
+
assert(!stream[kImpl].sync);
|
|
1308
|
+
if (stream[kImpl].needDrain) {
|
|
1309
|
+
stream[kImpl].needDrain = false;
|
|
1310
|
+
stream.emit("drain");
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
function nextFlush(stream) {
|
|
1314
|
+
while (true) {
|
|
1315
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
1316
|
+
const leftover = stream[kImpl].data.length - writeIndex;
|
|
1317
|
+
if (leftover > 0) {
|
|
1318
|
+
if (stream[kImpl].bufLen === 0) {
|
|
1319
|
+
stream[kImpl].flushing = false;
|
|
1320
|
+
if (stream[kImpl].ending) end(stream);
|
|
1321
|
+
else if (stream[kImpl].needDrain) process.nextTick(drain, stream);
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
write(stream, leftover, noop);
|
|
1325
|
+
continue;
|
|
1326
|
+
}
|
|
1327
|
+
if (leftover === 0) {
|
|
1328
|
+
if (writeIndex === 0 && stream[kImpl].bufLen === 0) return;
|
|
1329
|
+
waitForRead(stream, () => {
|
|
1330
|
+
if (stream.destroyed) return;
|
|
1331
|
+
resetIndexes(stream);
|
|
1332
|
+
nextFlush(stream);
|
|
1333
|
+
});
|
|
1334
|
+
return;
|
|
1335
|
+
}
|
|
1336
|
+
destroy(stream, /* @__PURE__ */ new Error("overwritten"));
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
function onWorkerMessage(msg) {
|
|
1341
|
+
const stream = this.stream.deref();
|
|
1342
|
+
if (stream === void 0) {
|
|
1343
|
+
this.exited = true;
|
|
1344
|
+
this.terminate();
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
if (msg?.code == null) return;
|
|
1348
|
+
switch (msg.code) {
|
|
1349
|
+
case "READY":
|
|
1350
|
+
this.stream = new WeakRef(stream);
|
|
1351
|
+
waitForRead(stream, () => {
|
|
1352
|
+
stream[kImpl].ready = true;
|
|
1353
|
+
stream.emit("ready");
|
|
1354
|
+
});
|
|
1355
|
+
break;
|
|
1356
|
+
case "ERROR":
|
|
1357
|
+
destroy(stream, msg.err);
|
|
1358
|
+
break;
|
|
1359
|
+
case "EVENT":
|
|
1360
|
+
if (Array.isArray(msg.args)) stream.emit(msg.name, ...msg.args);
|
|
1361
|
+
else stream.emit(msg.name, msg.args);
|
|
1362
|
+
break;
|
|
1363
|
+
case "FLUSHED": {
|
|
1364
|
+
if (msg.context !== "thread-stream") {
|
|
1365
|
+
destroy(stream, /* @__PURE__ */ new Error("this should not happen: " + msg.code));
|
|
1366
|
+
break;
|
|
1367
|
+
}
|
|
1368
|
+
const cb = stream[kImpl].flushCallbacks.get(msg.id);
|
|
1369
|
+
if (cb) {
|
|
1370
|
+
stream[kImpl].flushCallbacks.delete(msg.id);
|
|
1371
|
+
process.nextTick(cb);
|
|
1372
|
+
}
|
|
1373
|
+
break;
|
|
1374
|
+
}
|
|
1375
|
+
case "WARNING":
|
|
1376
|
+
process.emitWarning(msg.err);
|
|
1377
|
+
break;
|
|
1378
|
+
default: destroy(stream, /* @__PURE__ */ new Error("this should not happen: " + msg.code));
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function onWorkerExit(code) {
|
|
1382
|
+
const stream = this.stream.deref();
|
|
1383
|
+
if (stream === void 0) return;
|
|
1384
|
+
registry.unregister(stream);
|
|
1385
|
+
stream.worker.exited = true;
|
|
1386
|
+
stream.worker.off("exit", onWorkerExit);
|
|
1387
|
+
destroy(stream, code !== 0 ? /* @__PURE__ */ new Error("the worker thread exited") : null);
|
|
1388
|
+
}
|
|
1389
|
+
var ThreadStream = class extends EventEmitter$1 {
|
|
1390
|
+
constructor(opts = {}) {
|
|
1391
|
+
super();
|
|
1392
|
+
if (opts.bufferSize < 4) throw new Error("bufferSize must at least fit a 4-byte utf-8 char");
|
|
1393
|
+
this[kImpl] = {};
|
|
1394
|
+
this[kImpl].stateBuf = new SharedArrayBuffer(128);
|
|
1395
|
+
this[kImpl].state = new Int32Array(this[kImpl].stateBuf);
|
|
1396
|
+
this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024);
|
|
1397
|
+
this[kImpl].data = Buffer.from(this[kImpl].dataBuf);
|
|
1398
|
+
this[kImpl].sync = opts.sync || false;
|
|
1399
|
+
this[kImpl].ending = false;
|
|
1400
|
+
this[kImpl].ended = false;
|
|
1401
|
+
this[kImpl].needDrain = false;
|
|
1402
|
+
this[kImpl].destroyed = false;
|
|
1403
|
+
this[kImpl].flushing = false;
|
|
1404
|
+
this[kImpl].ready = false;
|
|
1405
|
+
this[kImpl].finished = false;
|
|
1406
|
+
this[kImpl].errored = null;
|
|
1407
|
+
this[kImpl].closed = false;
|
|
1408
|
+
this[kImpl].buf = [];
|
|
1409
|
+
this[kImpl].bufHead = 0;
|
|
1410
|
+
this[kImpl].bufLen = 0;
|
|
1411
|
+
this[kImpl].flushCallbacks = /* @__PURE__ */ new Map();
|
|
1412
|
+
this[kImpl].nextFlushId = 0;
|
|
1413
|
+
this.worker = createWorker(this, opts);
|
|
1414
|
+
this.on("message", (message, transferList) => {
|
|
1415
|
+
this.worker.postMessage(message, transferList);
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
write(data) {
|
|
1419
|
+
const dataBuf = Buffer.isBuffer(data) ? data : Buffer.from(data);
|
|
1420
|
+
if (this[kImpl].destroyed) {
|
|
1421
|
+
error(this, /* @__PURE__ */ new Error("the worker has exited"));
|
|
1422
|
+
return false;
|
|
1423
|
+
}
|
|
1424
|
+
if (this[kImpl].ending) {
|
|
1425
|
+
error(this, /* @__PURE__ */ new Error("the worker is ending"));
|
|
1426
|
+
return false;
|
|
1427
|
+
}
|
|
1428
|
+
if (this[kImpl].flushing && this[kImpl].bufLen + dataBuf.length >= MAX_STRING) try {
|
|
1429
|
+
writeSync(this);
|
|
1430
|
+
this[kImpl].flushing = true;
|
|
1431
|
+
} catch (err) {
|
|
1432
|
+
destroy(this, err);
|
|
1433
|
+
return false;
|
|
1434
|
+
}
|
|
1435
|
+
this[kImpl].buf.push(dataBuf);
|
|
1436
|
+
this[kImpl].bufLen += dataBuf.length;
|
|
1437
|
+
if (this[kImpl].sync) try {
|
|
1438
|
+
writeSync(this);
|
|
1439
|
+
return true;
|
|
1440
|
+
} catch (err) {
|
|
1441
|
+
destroy(this, err);
|
|
1442
|
+
return false;
|
|
1443
|
+
}
|
|
1444
|
+
if (!this[kImpl].flushing) {
|
|
1445
|
+
this[kImpl].flushing = true;
|
|
1446
|
+
setImmediate(nextFlush, this);
|
|
1447
|
+
}
|
|
1448
|
+
this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].bufLen - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0;
|
|
1449
|
+
return !this[kImpl].needDrain;
|
|
1450
|
+
}
|
|
1451
|
+
end() {
|
|
1452
|
+
if (this[kImpl].destroyed) return;
|
|
1453
|
+
this[kImpl].ending = true;
|
|
1454
|
+
end(this);
|
|
1455
|
+
}
|
|
1456
|
+
flush(cb) {
|
|
1457
|
+
cb = typeof cb === "function" ? cb : noop;
|
|
1458
|
+
flushBuffer(this, (err) => {
|
|
1459
|
+
if (err) {
|
|
1460
|
+
process.nextTick(cb, err);
|
|
1461
|
+
return;
|
|
1462
|
+
}
|
|
1463
|
+
requestWorkerFlush(this, cb);
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
flushSync() {
|
|
1467
|
+
if (this[kImpl].destroyed) return;
|
|
1468
|
+
writeSync(this);
|
|
1469
|
+
flushSync(this);
|
|
1470
|
+
}
|
|
1471
|
+
unref() {
|
|
1472
|
+
this.worker.unref();
|
|
1473
|
+
}
|
|
1474
|
+
ref() {
|
|
1475
|
+
this.worker.ref();
|
|
1476
|
+
}
|
|
1477
|
+
get ready() {
|
|
1478
|
+
return this[kImpl].ready;
|
|
1479
|
+
}
|
|
1480
|
+
get destroyed() {
|
|
1481
|
+
return this[kImpl].destroyed;
|
|
1482
|
+
}
|
|
1483
|
+
get closed() {
|
|
1484
|
+
return this[kImpl].closed;
|
|
1485
|
+
}
|
|
1486
|
+
get writable() {
|
|
1487
|
+
return !this[kImpl].destroyed && !this[kImpl].ending;
|
|
1488
|
+
}
|
|
1489
|
+
get writableEnded() {
|
|
1490
|
+
return this[kImpl].ending;
|
|
1491
|
+
}
|
|
1492
|
+
get writableFinished() {
|
|
1493
|
+
return this[kImpl].finished;
|
|
1494
|
+
}
|
|
1495
|
+
get writableNeedDrain() {
|
|
1496
|
+
return this[kImpl].needDrain;
|
|
1497
|
+
}
|
|
1498
|
+
get writableObjectMode() {
|
|
1499
|
+
return false;
|
|
1500
|
+
}
|
|
1501
|
+
get writableErrored() {
|
|
1502
|
+
return this[kImpl].errored;
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
function flushBuffer(stream, cb) {
|
|
1506
|
+
if (stream[kImpl].destroyed) {
|
|
1507
|
+
process.nextTick(cb, /* @__PURE__ */ new Error("the worker has exited"));
|
|
1508
|
+
return;
|
|
1509
|
+
}
|
|
1510
|
+
if (!stream[kImpl].sync && (stream[kImpl].flushing || stream[kImpl].bufLen > 0)) {
|
|
1511
|
+
setImmediate(flushBuffer, stream, cb);
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
waitForRead(stream, cb);
|
|
1515
|
+
}
|
|
1516
|
+
function waitForRead(stream, cb) {
|
|
1517
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
1518
|
+
wait(stream[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
|
|
1519
|
+
if (err) {
|
|
1520
|
+
destroy(stream, err);
|
|
1521
|
+
cb(err);
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (res !== "ok") {
|
|
1525
|
+
waitForRead(stream, cb);
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
cb();
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
function requestWorkerFlush(stream, cb) {
|
|
1532
|
+
if (stream[kImpl].destroyed) {
|
|
1533
|
+
process.nextTick(cb, /* @__PURE__ */ new Error("the worker has exited"));
|
|
1534
|
+
return;
|
|
1535
|
+
}
|
|
1536
|
+
if (!stream[kImpl].ready) {
|
|
1537
|
+
const onReady = () => {
|
|
1538
|
+
cleanup();
|
|
1539
|
+
requestWorkerFlush(stream, cb);
|
|
1540
|
+
};
|
|
1541
|
+
const onClose = () => {
|
|
1542
|
+
cleanup();
|
|
1543
|
+
process.nextTick(cb, /* @__PURE__ */ new Error("the worker has exited"));
|
|
1544
|
+
};
|
|
1545
|
+
const cleanup = () => {
|
|
1546
|
+
stream.off("ready", onReady);
|
|
1547
|
+
stream.off("close", onClose);
|
|
1548
|
+
};
|
|
1549
|
+
stream.once("ready", onReady);
|
|
1550
|
+
stream.once("close", onClose);
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
const id = ++stream[kImpl].nextFlushId;
|
|
1554
|
+
stream[kImpl].flushCallbacks.set(id, cb);
|
|
1555
|
+
try {
|
|
1556
|
+
stream.worker.postMessage({
|
|
1557
|
+
code: "FLUSH",
|
|
1558
|
+
context: "thread-stream",
|
|
1559
|
+
id
|
|
1560
|
+
});
|
|
1561
|
+
} catch (err) {
|
|
1562
|
+
stream[kImpl].flushCallbacks.delete(id);
|
|
1563
|
+
destroy(stream, err);
|
|
1564
|
+
process.nextTick(cb, err);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
function failPendingFlushCallbacks(stream, err) {
|
|
1568
|
+
const callbacks = stream[kImpl].flushCallbacks;
|
|
1569
|
+
if (callbacks.size === 0) return;
|
|
1570
|
+
const flushErr = err || /* @__PURE__ */ new Error("the worker has exited");
|
|
1571
|
+
for (const cb of callbacks.values()) process.nextTick(cb, flushErr);
|
|
1572
|
+
callbacks.clear();
|
|
1573
|
+
}
|
|
1574
|
+
function error(stream, err) {
|
|
1575
|
+
setImmediate(() => {
|
|
1576
|
+
stream.emit("error", err);
|
|
1577
|
+
});
|
|
1578
|
+
}
|
|
1579
|
+
function destroy(stream, err) {
|
|
1580
|
+
if (stream[kImpl].destroyed) return;
|
|
1581
|
+
stream[kImpl].destroyed = true;
|
|
1582
|
+
failPendingFlushCallbacks(stream, err);
|
|
1583
|
+
if (err) {
|
|
1584
|
+
stream[kImpl].errored = err;
|
|
1585
|
+
error(stream, err);
|
|
1586
|
+
}
|
|
1587
|
+
if (!stream.worker.exited) stream.worker.terminate().catch(() => {}).then(() => {
|
|
1588
|
+
stream[kImpl].closed = true;
|
|
1589
|
+
stream.emit("close");
|
|
1590
|
+
});
|
|
1591
|
+
else setImmediate(() => {
|
|
1592
|
+
stream[kImpl].closed = true;
|
|
1593
|
+
stream.emit("close");
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
function write(stream, maxBytes, cb) {
|
|
1597
|
+
let offset = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
1598
|
+
let remaining = maxBytes;
|
|
1599
|
+
while (remaining > 0 && stream[kImpl].bufLen !== 0) {
|
|
1600
|
+
const head = stream[kImpl].bufHead;
|
|
1601
|
+
const buf = stream[kImpl].buf[head];
|
|
1602
|
+
if (buf.length <= remaining) {
|
|
1603
|
+
buf.copy(stream[kImpl].data, offset);
|
|
1604
|
+
offset += buf.length;
|
|
1605
|
+
remaining -= buf.length;
|
|
1606
|
+
stream[kImpl].bufLen -= buf.length;
|
|
1607
|
+
stream[kImpl].bufHead = head + 1;
|
|
1608
|
+
if (stream[kImpl].bufHead === stream[kImpl].buf.length) {
|
|
1609
|
+
stream[kImpl].buf.length = 0;
|
|
1610
|
+
stream[kImpl].bufHead = 0;
|
|
1611
|
+
} else if (stream[kImpl].bufHead >= 1024 && stream[kImpl].bufHead * 2 >= stream[kImpl].buf.length) {
|
|
1612
|
+
stream[kImpl].buf.splice(0, stream[kImpl].bufHead);
|
|
1613
|
+
stream[kImpl].bufHead = 0;
|
|
1614
|
+
}
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
buf.copy(stream[kImpl].data, offset, 0, remaining);
|
|
1618
|
+
stream[kImpl].buf[head] = buf.subarray(remaining);
|
|
1619
|
+
stream[kImpl].bufLen -= remaining;
|
|
1620
|
+
offset += remaining;
|
|
1621
|
+
remaining = 0;
|
|
1622
|
+
}
|
|
1623
|
+
updateState(stream, () => {
|
|
1624
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, offset);
|
|
1625
|
+
});
|
|
1626
|
+
cb();
|
|
1627
|
+
return true;
|
|
1628
|
+
}
|
|
1629
|
+
function end(stream) {
|
|
1630
|
+
if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) return;
|
|
1631
|
+
stream[kImpl].ended = true;
|
|
1632
|
+
try {
|
|
1633
|
+
stream.flushSync();
|
|
1634
|
+
let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
|
1635
|
+
updateState(stream, () => {
|
|
1636
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, -1);
|
|
1637
|
+
});
|
|
1638
|
+
let spins = 0;
|
|
1639
|
+
while (readIndex !== -1) {
|
|
1640
|
+
Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
|
|
1641
|
+
readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
|
1642
|
+
if (readIndex === -2) {
|
|
1643
|
+
destroy(stream, /* @__PURE__ */ new Error("end() failed"));
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
if (++spins === 10) {
|
|
1647
|
+
destroy(stream, /* @__PURE__ */ new Error("end() took too long (10s)"));
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
process.nextTick(() => {
|
|
1652
|
+
stream[kImpl].finished = true;
|
|
1653
|
+
stream.emit("finish");
|
|
1654
|
+
});
|
|
1655
|
+
} catch (err) {
|
|
1656
|
+
destroy(stream, err);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
function writeSync(stream) {
|
|
1660
|
+
const cb = () => {
|
|
1661
|
+
if (stream[kImpl].ending) end(stream);
|
|
1662
|
+
else if (stream[kImpl].needDrain) process.nextTick(drain, stream);
|
|
1663
|
+
};
|
|
1664
|
+
stream[kImpl].flushing = false;
|
|
1665
|
+
while (stream[kImpl].bufLen !== 0) {
|
|
1666
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
1667
|
+
const leftover = stream[kImpl].data.length - writeIndex;
|
|
1668
|
+
if (leftover === 0) {
|
|
1669
|
+
flushSync(stream);
|
|
1670
|
+
resetIndexes(stream);
|
|
1671
|
+
continue;
|
|
1672
|
+
} else if (leftover < 0) throw new Error("overwritten");
|
|
1673
|
+
write(stream, leftover, cb);
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
function flushSync(stream) {
|
|
1677
|
+
if (stream[kImpl].flushing) throw new Error("unable to flush while flushing");
|
|
1678
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
1679
|
+
let spins = 0;
|
|
1680
|
+
while (true) {
|
|
1681
|
+
const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
|
1682
|
+
if (readIndex === -2) throw Error("_flushSync failed");
|
|
1683
|
+
if (readIndex !== writeIndex) Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
|
|
1684
|
+
else break;
|
|
1685
|
+
if (++spins === 10) throw new Error("_flushSync took too long (10s)");
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
module.exports = ThreadStream;
|
|
1689
|
+
}));
|
|
1690
|
+
//#endregion
|
|
1691
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/transport.js
|
|
1692
|
+
var require_transport = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1693
|
+
var { createRequire } = __require("module");
|
|
1694
|
+
var { existsSync } = __require("node:fs");
|
|
1695
|
+
var getCallers = require_caller();
|
|
1696
|
+
var { join, isAbsolute, sep } = __require("node:path");
|
|
1697
|
+
var { fileURLToPath } = __require("node:url");
|
|
1698
|
+
var sleep = require_atomic_sleep();
|
|
1699
|
+
var onExit = require_on_exit_leak_free();
|
|
1700
|
+
var ThreadStream = require_thread_stream();
|
|
1701
|
+
function setupOnExit(stream) {
|
|
1702
|
+
onExit.register(stream, autoEnd);
|
|
1703
|
+
onExit.registerBeforeExit(stream, flush);
|
|
1704
|
+
stream.on("close", function() {
|
|
1705
|
+
onExit.unregister(stream);
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
function hasPreloadFlags() {
|
|
1709
|
+
const execArgv = process.execArgv;
|
|
1710
|
+
for (let i = 0; i < execArgv.length; i++) {
|
|
1711
|
+
const arg = execArgv[i];
|
|
1712
|
+
if (arg === "--import" || arg === "--require" || arg === "-r") return true;
|
|
1713
|
+
if (arg.startsWith("--import=") || arg.startsWith("--require=") || arg.startsWith("-r=")) return true;
|
|
1714
|
+
}
|
|
1715
|
+
return false;
|
|
1716
|
+
}
|
|
1717
|
+
function sanitizeNodeOptions(nodeOptions) {
|
|
1718
|
+
const tokens = nodeOptions.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);
|
|
1719
|
+
if (!tokens) return nodeOptions;
|
|
1720
|
+
const sanitized = [];
|
|
1721
|
+
let changed = false;
|
|
1722
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
1723
|
+
const token = tokens[i];
|
|
1724
|
+
if (token === "--require" || token === "-r" || token === "--import") {
|
|
1725
|
+
const next = tokens[i + 1];
|
|
1726
|
+
if (next && shouldDropPreload(next)) {
|
|
1727
|
+
changed = true;
|
|
1728
|
+
i++;
|
|
1729
|
+
continue;
|
|
1730
|
+
}
|
|
1731
|
+
sanitized.push(token);
|
|
1732
|
+
if (next) {
|
|
1733
|
+
sanitized.push(next);
|
|
1734
|
+
i++;
|
|
1735
|
+
}
|
|
1736
|
+
continue;
|
|
1737
|
+
}
|
|
1738
|
+
if (token.startsWith("--require=") || token.startsWith("-r=") || token.startsWith("--import=")) {
|
|
1739
|
+
if (shouldDropPreload(token.slice(token.indexOf("=") + 1))) {
|
|
1740
|
+
changed = true;
|
|
1741
|
+
continue;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
sanitized.push(token);
|
|
1745
|
+
}
|
|
1746
|
+
return changed ? sanitized.join(" ") : nodeOptions;
|
|
1747
|
+
}
|
|
1748
|
+
function shouldDropPreload(value) {
|
|
1749
|
+
const unquoted = stripQuotes(value);
|
|
1750
|
+
if (!unquoted) return false;
|
|
1751
|
+
let path = unquoted;
|
|
1752
|
+
if (path.startsWith("file://")) try {
|
|
1753
|
+
path = fileURLToPath(path);
|
|
1754
|
+
} catch {
|
|
1755
|
+
return false;
|
|
1756
|
+
}
|
|
1757
|
+
return isAbsolute(path) && !existsSync(path);
|
|
1758
|
+
}
|
|
1759
|
+
function stripQuotes(value) {
|
|
1760
|
+
const first = value[0];
|
|
1761
|
+
const last = value[value.length - 1];
|
|
1762
|
+
if (first === "\"" && last === "\"" || first === "'" && last === "'") return value.slice(1, -1);
|
|
1763
|
+
return value;
|
|
1764
|
+
}
|
|
1765
|
+
function buildStream(filename, workerData, workerOpts, sync, name) {
|
|
1766
|
+
if (!workerOpts.execArgv && hasPreloadFlags() && __require.main === void 0) workerOpts = {
|
|
1767
|
+
...workerOpts,
|
|
1768
|
+
execArgv: []
|
|
1769
|
+
};
|
|
1770
|
+
if (!workerOpts.env && process.env.NODE_OPTIONS) {
|
|
1771
|
+
const nodeOptions = sanitizeNodeOptions(process.env.NODE_OPTIONS);
|
|
1772
|
+
if (nodeOptions !== process.env.NODE_OPTIONS) workerOpts = {
|
|
1773
|
+
...workerOpts,
|
|
1774
|
+
env: {
|
|
1775
|
+
...process.env,
|
|
1776
|
+
NODE_OPTIONS: nodeOptions
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
workerOpts = {
|
|
1781
|
+
...workerOpts,
|
|
1782
|
+
name
|
|
1783
|
+
};
|
|
1784
|
+
const stream = new ThreadStream({
|
|
1785
|
+
filename,
|
|
1786
|
+
workerData,
|
|
1787
|
+
workerOpts,
|
|
1788
|
+
sync
|
|
1789
|
+
});
|
|
1790
|
+
stream.on("ready", onReady);
|
|
1791
|
+
stream.on("close", function() {
|
|
1792
|
+
process.removeListener("exit", onExit);
|
|
1793
|
+
});
|
|
1794
|
+
process.on("exit", onExit);
|
|
1795
|
+
function onReady() {
|
|
1796
|
+
process.removeListener("exit", onExit);
|
|
1797
|
+
stream.unref();
|
|
1798
|
+
if (workerOpts.autoEnd !== false) setupOnExit(stream);
|
|
1799
|
+
}
|
|
1800
|
+
function onExit() {
|
|
1801
|
+
/* istanbul ignore next */
|
|
1802
|
+
if (stream.closed) return;
|
|
1803
|
+
stream.flushSync();
|
|
1804
|
+
sleep(100);
|
|
1805
|
+
stream.end();
|
|
1806
|
+
}
|
|
1807
|
+
return stream;
|
|
1808
|
+
}
|
|
1809
|
+
function autoEnd(stream) {
|
|
1810
|
+
stream.ref();
|
|
1811
|
+
stream.flushSync();
|
|
1812
|
+
stream.end();
|
|
1813
|
+
stream.once("close", function() {
|
|
1814
|
+
stream.unref();
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
function flush(stream) {
|
|
1818
|
+
stream.flushSync();
|
|
1819
|
+
}
|
|
1820
|
+
function transport(fullOptions) {
|
|
1821
|
+
const { pipeline, targets, levels, dedupe, worker = {}, caller = getCallers(), sync = false } = fullOptions;
|
|
1822
|
+
const options = { ...fullOptions.options };
|
|
1823
|
+
const callers = typeof caller === "string" ? [caller] : caller;
|
|
1824
|
+
const bundlerOverrides = typeof globalThis === "object" && Object.prototype.hasOwnProperty.call(globalThis, "__bundlerPathsOverrides") && globalThis.__bundlerPathsOverrides && typeof globalThis.__bundlerPathsOverrides === "object" ? globalThis.__bundlerPathsOverrides : Object.create(null);
|
|
1825
|
+
let target = fullOptions.target;
|
|
1826
|
+
if (target && targets) throw new Error("only one of target or targets can be specified");
|
|
1827
|
+
if (targets) {
|
|
1828
|
+
target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js");
|
|
1829
|
+
options.targets = targets.filter((dest) => dest.target).map((dest) => {
|
|
1830
|
+
return {
|
|
1831
|
+
...dest,
|
|
1832
|
+
target: fixTarget(dest.target)
|
|
1833
|
+
};
|
|
1834
|
+
});
|
|
1835
|
+
options.pipelines = targets.filter((dest) => dest.pipeline).map((dest) => {
|
|
1836
|
+
return dest.pipeline.map((t) => {
|
|
1837
|
+
return {
|
|
1838
|
+
...t,
|
|
1839
|
+
level: dest.level,
|
|
1840
|
+
target: fixTarget(t.target)
|
|
1841
|
+
};
|
|
1842
|
+
});
|
|
1843
|
+
});
|
|
1844
|
+
} else if (pipeline) {
|
|
1845
|
+
target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js");
|
|
1846
|
+
options.pipelines = [pipeline.map((dest) => {
|
|
1847
|
+
return {
|
|
1848
|
+
...dest,
|
|
1849
|
+
target: fixTarget(dest.target)
|
|
1850
|
+
};
|
|
1851
|
+
})];
|
|
1852
|
+
}
|
|
1853
|
+
if (levels) options.levels = levels;
|
|
1854
|
+
if (dedupe) options.dedupe = dedupe;
|
|
1855
|
+
options.pinoWillSendConfig = true;
|
|
1856
|
+
const name = targets || pipeline ? "pino.transport" : target;
|
|
1857
|
+
return buildStream(fixTarget(target), options, worker, sync, name);
|
|
1858
|
+
function fixTarget(origin) {
|
|
1859
|
+
origin = bundlerOverrides[origin] || origin;
|
|
1860
|
+
if (isAbsolute(origin) || origin.indexOf("file://") === 0) return origin;
|
|
1861
|
+
if (origin === "pino/file") return join(__dirname, "..", "file.js");
|
|
1862
|
+
let fixTarget;
|
|
1863
|
+
for (const filePath of callers) try {
|
|
1864
|
+
fixTarget = createRequire(filePath === "node:repl" ? process.cwd() + sep : filePath).resolve(origin);
|
|
1865
|
+
break;
|
|
1866
|
+
} catch (err) {
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
if (!fixTarget) throw new Error(`unable to determine transport target for "${origin}"`);
|
|
1870
|
+
return fixTarget;
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
module.exports = transport;
|
|
1874
|
+
}));
|
|
1875
|
+
//#endregion
|
|
1876
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/tools.js
|
|
1877
|
+
var require_tools = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1878
|
+
var diagChan = __require("node:diagnostics_channel");
|
|
1879
|
+
var format = require_quick_format_unescaped();
|
|
1880
|
+
var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
|
|
1881
|
+
var SonicBoom = require_sonic_boom();
|
|
1882
|
+
var onExit = require_on_exit_leak_free();
|
|
1883
|
+
var { lsCacheSym, chindingsSym, writeSym, serializersSym, formatOptsSym, endSym, stringifiersSym, stringifySym, stringifySafeSym, wildcardFirstSym, nestedKeySym, formattersSym, messageKeySym, errorKeySym, nestedKeyStrSym, msgPrefixSym } = require_symbols();
|
|
1884
|
+
var { isMainThread } = __require("worker_threads");
|
|
1885
|
+
var transport = require_transport();
|
|
1886
|
+
var [nodeMajor] = process.versions.node.split(".").map((v) => Number(v));
|
|
1887
|
+
var asJsonChan = diagChan.tracingChannel("pino_asJson");
|
|
1888
|
+
var asString = nodeMajor >= 25 ? (str) => JSON.stringify(str) : _asString;
|
|
1889
|
+
function noop() {}
|
|
1890
|
+
function genLog(level, hook) {
|
|
1891
|
+
if (!hook) return LOG;
|
|
1892
|
+
return function hookWrappedLog(...args) {
|
|
1893
|
+
hook.call(this, args, LOG, level);
|
|
1894
|
+
};
|
|
1895
|
+
function LOG(o, ...n) {
|
|
1896
|
+
if (typeof o === "object") {
|
|
1897
|
+
let msg = o;
|
|
1898
|
+
if (o !== null) {
|
|
1899
|
+
if (o.method && o.headers && o.socket) o = mapHttpRequest(o);
|
|
1900
|
+
else if (typeof o.setHeader === "function") o = mapHttpResponse(o);
|
|
1901
|
+
}
|
|
1902
|
+
let formatParams;
|
|
1903
|
+
if (msg === null && n.length === 0) formatParams = [null];
|
|
1904
|
+
else {
|
|
1905
|
+
msg = n.shift();
|
|
1906
|
+
formatParams = n;
|
|
1907
|
+
}
|
|
1908
|
+
if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) msg = this[msgPrefixSym] + msg;
|
|
1909
|
+
this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level);
|
|
1910
|
+
} else {
|
|
1911
|
+
let msg = o === void 0 ? n.shift() : o;
|
|
1912
|
+
if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) msg = this[msgPrefixSym] + msg;
|
|
1913
|
+
this[writeSym](null, format(msg, n, this[formatOptsSym]), level);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function _asString(str) {
|
|
1918
|
+
let result = "";
|
|
1919
|
+
let last = 0;
|
|
1920
|
+
let found = false;
|
|
1921
|
+
let point = 255;
|
|
1922
|
+
const l = str.length;
|
|
1923
|
+
if (l > 100) return JSON.stringify(str);
|
|
1924
|
+
for (var i = 0; i < l && point >= 32; i++) {
|
|
1925
|
+
point = str.charCodeAt(i);
|
|
1926
|
+
if (point === 34 || point === 92) {
|
|
1927
|
+
result += str.slice(last, i) + "\\";
|
|
1928
|
+
last = i;
|
|
1929
|
+
found = true;
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
if (!found) result = str;
|
|
1933
|
+
else result += str.slice(last);
|
|
1934
|
+
return point < 32 ? JSON.stringify(str) : "\"" + result + "\"";
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* `asJson` wraps `_asJson` in order to facilitate generating diagnostics.
|
|
1938
|
+
*
|
|
1939
|
+
* @param {object} obj The merging object passed to the log method.
|
|
1940
|
+
* @param {string} msg The log message passed to the log method.
|
|
1941
|
+
* @param {number} num The log level number.
|
|
1942
|
+
* @param {number} time The log time in milliseconds.
|
|
1943
|
+
*
|
|
1944
|
+
* @returns {string}
|
|
1945
|
+
*/
|
|
1946
|
+
function asJson(obj, msg, num, time) {
|
|
1947
|
+
if (asJsonChan.hasSubscribers === false) return _asJson.call(this, obj, msg, num, time);
|
|
1948
|
+
const store = {
|
|
1949
|
+
instance: this,
|
|
1950
|
+
arguments
|
|
1951
|
+
};
|
|
1952
|
+
return asJsonChan.traceSync(_asJson, store, this, obj, msg, num, time);
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* `_asJson` parses all collected data and generates the finalized newline
|
|
1956
|
+
* delimited JSON string.
|
|
1957
|
+
*
|
|
1958
|
+
* @param {object} obj The merging object passed to the log method.
|
|
1959
|
+
* @param {string} msg The log message passed to the log method.
|
|
1960
|
+
* @param {number} num The log level number.
|
|
1961
|
+
* @param {number} time The log time in milliseconds.
|
|
1962
|
+
*
|
|
1963
|
+
* @returns {string} The finalized log string terminated with a newline.
|
|
1964
|
+
* @private
|
|
1965
|
+
*/
|
|
1966
|
+
function _asJson(obj, msg, num, time) {
|
|
1967
|
+
const stringify = this[stringifySym];
|
|
1968
|
+
const stringifySafe = this[stringifySafeSym];
|
|
1969
|
+
const stringifiers = this[stringifiersSym];
|
|
1970
|
+
const end = this[endSym];
|
|
1971
|
+
const chindings = this[chindingsSym];
|
|
1972
|
+
const serializers = this[serializersSym];
|
|
1973
|
+
const formatters = this[formattersSym];
|
|
1974
|
+
const messageKey = this[messageKeySym];
|
|
1975
|
+
const errorKey = this[errorKeySym];
|
|
1976
|
+
let data = this[lsCacheSym][num] + time;
|
|
1977
|
+
data = data + chindings;
|
|
1978
|
+
let value;
|
|
1979
|
+
if (formatters.log) obj = formatters.log(obj);
|
|
1980
|
+
const wildcardStringifier = stringifiers[wildcardFirstSym];
|
|
1981
|
+
let propStr = "";
|
|
1982
|
+
for (const key in obj) {
|
|
1983
|
+
value = obj[key];
|
|
1984
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && value !== void 0) {
|
|
1985
|
+
if (serializers[key]) value = serializers[key](value);
|
|
1986
|
+
else if (key === errorKey && serializers.err) value = serializers.err(value);
|
|
1987
|
+
const stringifier = stringifiers[key] || wildcardStringifier;
|
|
1988
|
+
switch (typeof value) {
|
|
1989
|
+
case "undefined":
|
|
1990
|
+
case "function": continue;
|
|
1991
|
+
case "number": if (Number.isFinite(value) === false) value = null;
|
|
1992
|
+
case "boolean":
|
|
1993
|
+
if (stringifier) value = stringifier(value);
|
|
1994
|
+
break;
|
|
1995
|
+
case "string":
|
|
1996
|
+
value = (stringifier || asString)(value);
|
|
1997
|
+
break;
|
|
1998
|
+
default: value = (stringifier || stringify)(value, stringifySafe);
|
|
1999
|
+
}
|
|
2000
|
+
if (value === void 0) continue;
|
|
2001
|
+
const strKey = asString(key);
|
|
2002
|
+
propStr += "," + strKey + ":" + value;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
let msgStr = "";
|
|
2006
|
+
if (msg !== void 0) {
|
|
2007
|
+
value = serializers[messageKey] ? serializers[messageKey](msg) : msg;
|
|
2008
|
+
const stringifier = stringifiers[messageKey] || wildcardStringifier;
|
|
2009
|
+
switch (typeof value) {
|
|
2010
|
+
case "function": break;
|
|
2011
|
+
case "number": if (Number.isFinite(value) === false) value = null;
|
|
2012
|
+
case "boolean":
|
|
2013
|
+
if (stringifier) value = stringifier(value);
|
|
2014
|
+
msgStr = ",\"" + messageKey + "\":" + value;
|
|
2015
|
+
break;
|
|
2016
|
+
case "string":
|
|
2017
|
+
value = (stringifier || asString)(value);
|
|
2018
|
+
msgStr = ",\"" + messageKey + "\":" + value;
|
|
2019
|
+
break;
|
|
2020
|
+
default:
|
|
2021
|
+
value = (stringifier || stringify)(value, stringifySafe);
|
|
2022
|
+
msgStr = ",\"" + messageKey + "\":" + value;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
if (this[nestedKeySym] && propStr) return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end;
|
|
2026
|
+
else return data + propStr + msgStr + end;
|
|
2027
|
+
}
|
|
2028
|
+
function asChindings(instance, bindings) {
|
|
2029
|
+
let value;
|
|
2030
|
+
let data = instance[chindingsSym];
|
|
2031
|
+
const stringify = instance[stringifySym];
|
|
2032
|
+
const stringifySafe = instance[stringifySafeSym];
|
|
2033
|
+
const stringifiers = instance[stringifiersSym];
|
|
2034
|
+
const wildcardStringifier = stringifiers[wildcardFirstSym];
|
|
2035
|
+
const serializers = instance[serializersSym];
|
|
2036
|
+
const formatter = instance[formattersSym].bindings;
|
|
2037
|
+
bindings = formatter(bindings);
|
|
2038
|
+
for (const key in bindings) {
|
|
2039
|
+
value = bindings[key];
|
|
2040
|
+
if (((key.length < 5 || key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels") && bindings.hasOwnProperty(key) && value !== void 0) === true) {
|
|
2041
|
+
value = serializers[key] ? serializers[key](value) : value;
|
|
2042
|
+
value = (stringifiers[key] || wildcardStringifier || stringify)(value, stringifySafe);
|
|
2043
|
+
if (value === void 0) continue;
|
|
2044
|
+
data += ",\"" + key + "\":" + value;
|
|
2045
|
+
}
|
|
2046
|
+
}
|
|
2047
|
+
return data;
|
|
2048
|
+
}
|
|
2049
|
+
function hasBeenTampered(stream) {
|
|
2050
|
+
return stream.write !== stream.constructor.prototype.write;
|
|
2051
|
+
}
|
|
2052
|
+
function buildSafeSonicBoom(opts) {
|
|
2053
|
+
const stream = new SonicBoom(opts);
|
|
2054
|
+
stream.on("error", filterBrokenPipe);
|
|
2055
|
+
if (!opts.sync && isMainThread) {
|
|
2056
|
+
onExit.register(stream, autoEnd);
|
|
2057
|
+
stream.on("close", function() {
|
|
2058
|
+
onExit.unregister(stream);
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
return stream;
|
|
2062
|
+
function filterBrokenPipe(err) {
|
|
2063
|
+
/* istanbul ignore next */
|
|
2064
|
+
if (err.code === "EPIPE") {
|
|
2065
|
+
stream.write = noop;
|
|
2066
|
+
stream.end = noop;
|
|
2067
|
+
stream.flushSync = noop;
|
|
2068
|
+
stream.destroy = noop;
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
stream.removeListener("error", filterBrokenPipe);
|
|
2072
|
+
stream.emit("error", err);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
function autoEnd(stream, eventName) {
|
|
2076
|
+
/* istanbul ignore next */
|
|
2077
|
+
if (stream.destroyed) return;
|
|
2078
|
+
if (eventName === "beforeExit") {
|
|
2079
|
+
stream.flush();
|
|
2080
|
+
stream.on("drain", function() {
|
|
2081
|
+
stream.end();
|
|
2082
|
+
});
|
|
2083
|
+
} else
|
|
2084
|
+
/* istanbul ignore next */
|
|
2085
|
+
stream.flushSync();
|
|
2086
|
+
}
|
|
2087
|
+
function createArgsNormalizer(defaultOptions) {
|
|
2088
|
+
return function normalizeArgs(instance, caller, opts = {}, stream) {
|
|
2089
|
+
if (typeof opts === "string") {
|
|
2090
|
+
stream = buildSafeSonicBoom({ dest: opts });
|
|
2091
|
+
opts = {};
|
|
2092
|
+
} else if (typeof stream === "string") {
|
|
2093
|
+
if (opts && opts.transport) throw Error("only one of option.transport or stream can be specified");
|
|
2094
|
+
stream = buildSafeSonicBoom({ dest: stream });
|
|
2095
|
+
} else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
|
|
2096
|
+
stream = opts;
|
|
2097
|
+
opts = {};
|
|
2098
|
+
} else if (opts.transport) {
|
|
2099
|
+
if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");
|
|
2100
|
+
if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === "function") throw Error("option.transport.targets do not allow custom level formatters");
|
|
2101
|
+
let customLevels;
|
|
2102
|
+
if (opts.customLevels) customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels);
|
|
2103
|
+
stream = transport({
|
|
2104
|
+
caller,
|
|
2105
|
+
...opts.transport,
|
|
2106
|
+
levels: customLevels
|
|
2107
|
+
});
|
|
2108
|
+
}
|
|
2109
|
+
opts = Object.assign({}, defaultOptions, opts);
|
|
2110
|
+
opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
|
|
2111
|
+
opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters);
|
|
2112
|
+
if (opts.prettyPrint) throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");
|
|
2113
|
+
const { enabled, onChild } = opts;
|
|
2114
|
+
if (enabled === false) opts.level = "silent";
|
|
2115
|
+
if (!onChild) opts.onChild = noop;
|
|
2116
|
+
if (!stream) if (!hasBeenTampered(process.stdout)) stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 });
|
|
2117
|
+
else stream = process.stdout;
|
|
2118
|
+
return {
|
|
2119
|
+
opts,
|
|
2120
|
+
stream
|
|
2121
|
+
};
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
function stringify(obj, stringifySafeFn) {
|
|
2125
|
+
try {
|
|
2126
|
+
return JSON.stringify(obj);
|
|
2127
|
+
} catch (_) {
|
|
2128
|
+
try {
|
|
2129
|
+
return (stringifySafeFn || this[stringifySafeSym])(obj);
|
|
2130
|
+
} catch (_) {
|
|
2131
|
+
return "\"[unable to serialize, circular reference is too complex to analyze]\"";
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
function buildFormatters(level, bindings, log) {
|
|
2136
|
+
return {
|
|
2137
|
+
level,
|
|
2138
|
+
bindings,
|
|
2139
|
+
log
|
|
2140
|
+
};
|
|
2141
|
+
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Convert a string integer file descriptor to a proper native integer
|
|
2144
|
+
* file descriptor.
|
|
2145
|
+
*
|
|
2146
|
+
* @param {string} destination The file descriptor string to attempt to convert.
|
|
2147
|
+
*
|
|
2148
|
+
* @returns {Number}
|
|
2149
|
+
*/
|
|
2150
|
+
function normalizeDestFileDescriptor(destination) {
|
|
2151
|
+
const fd = Number(destination);
|
|
2152
|
+
if (typeof destination === "string" && Number.isFinite(fd)) return fd;
|
|
2153
|
+
if (destination === void 0) return 1;
|
|
2154
|
+
return destination;
|
|
2155
|
+
}
|
|
2156
|
+
module.exports = {
|
|
2157
|
+
noop,
|
|
2158
|
+
buildSafeSonicBoom,
|
|
2159
|
+
asChindings,
|
|
2160
|
+
asJson,
|
|
2161
|
+
genLog,
|
|
2162
|
+
createArgsNormalizer,
|
|
2163
|
+
stringify,
|
|
2164
|
+
buildFormatters,
|
|
2165
|
+
normalizeDestFileDescriptor
|
|
2166
|
+
};
|
|
2167
|
+
}));
|
|
2168
|
+
//#endregion
|
|
2169
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/constants.js
|
|
2170
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2171
|
+
module.exports = {
|
|
2172
|
+
DEFAULT_LEVELS: {
|
|
2173
|
+
trace: 10,
|
|
2174
|
+
debug: 20,
|
|
2175
|
+
info: 30,
|
|
2176
|
+
warn: 40,
|
|
2177
|
+
error: 50,
|
|
2178
|
+
fatal: 60
|
|
2179
|
+
},
|
|
2180
|
+
SORTING_ORDER: {
|
|
2181
|
+
ASC: "ASC",
|
|
2182
|
+
DESC: "DESC"
|
|
2183
|
+
}
|
|
2184
|
+
};
|
|
2185
|
+
}));
|
|
2186
|
+
//#endregion
|
|
2187
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/levels.js
|
|
2188
|
+
var require_levels = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2189
|
+
var { lsCacheSym, levelValSym, useOnlyCustomLevelsSym, streamSym, formattersSym, hooksSym, levelCompSym } = require_symbols();
|
|
2190
|
+
var { noop, genLog } = require_tools();
|
|
2191
|
+
var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
|
|
2192
|
+
var levelMethods = {
|
|
2193
|
+
fatal: (hook) => {
|
|
2194
|
+
const logFatal = genLog(DEFAULT_LEVELS.fatal, hook);
|
|
2195
|
+
return function(...args) {
|
|
2196
|
+
const stream = this[streamSym];
|
|
2197
|
+
logFatal.call(this, ...args);
|
|
2198
|
+
if (typeof stream.flushSync === "function") try {
|
|
2199
|
+
stream.flushSync();
|
|
2200
|
+
} catch (e) {}
|
|
2201
|
+
};
|
|
2202
|
+
},
|
|
2203
|
+
error: (hook) => genLog(DEFAULT_LEVELS.error, hook),
|
|
2204
|
+
warn: (hook) => genLog(DEFAULT_LEVELS.warn, hook),
|
|
2205
|
+
info: (hook) => genLog(DEFAULT_LEVELS.info, hook),
|
|
2206
|
+
debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook),
|
|
2207
|
+
trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook)
|
|
2208
|
+
};
|
|
2209
|
+
var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
|
|
2210
|
+
o[DEFAULT_LEVELS[k]] = k;
|
|
2211
|
+
return o;
|
|
2212
|
+
}, {});
|
|
2213
|
+
var initialLsCache = Object.keys(nums).reduce((o, k) => {
|
|
2214
|
+
o[k] = "{\"level\":" + Number(k);
|
|
2215
|
+
return o;
|
|
2216
|
+
}, {});
|
|
2217
|
+
function genLsCache(instance) {
|
|
2218
|
+
const formatter = instance[formattersSym].level;
|
|
2219
|
+
const { labels } = instance.levels;
|
|
2220
|
+
const cache = {};
|
|
2221
|
+
for (const label in labels) {
|
|
2222
|
+
const level = formatter(labels[label], Number(label));
|
|
2223
|
+
cache[label] = JSON.stringify(level).slice(0, -1);
|
|
2224
|
+
}
|
|
2225
|
+
instance[lsCacheSym] = cache;
|
|
2226
|
+
return instance;
|
|
2227
|
+
}
|
|
2228
|
+
function isStandardLevel(level, useOnlyCustomLevels) {
|
|
2229
|
+
if (useOnlyCustomLevels) return false;
|
|
2230
|
+
switch (level) {
|
|
2231
|
+
case "fatal":
|
|
2232
|
+
case "error":
|
|
2233
|
+
case "warn":
|
|
2234
|
+
case "info":
|
|
2235
|
+
case "debug":
|
|
2236
|
+
case "trace": return true;
|
|
2237
|
+
default: return false;
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
function setLevel(level) {
|
|
2241
|
+
const { labels, values } = this.levels;
|
|
2242
|
+
if (typeof level === "number") {
|
|
2243
|
+
if (labels[level] === void 0) throw Error("unknown level value" + level);
|
|
2244
|
+
level = labels[level];
|
|
2245
|
+
}
|
|
2246
|
+
if (values[level] === void 0) throw Error("unknown level " + level);
|
|
2247
|
+
const preLevelVal = this[levelValSym];
|
|
2248
|
+
const levelVal = this[levelValSym] = values[level];
|
|
2249
|
+
const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym];
|
|
2250
|
+
const levelComparison = this[levelCompSym];
|
|
2251
|
+
const hook = this[hooksSym].logMethod;
|
|
2252
|
+
for (const key in values) {
|
|
2253
|
+
if (levelComparison(values[key], levelVal) === false) {
|
|
2254
|
+
this[key] = noop;
|
|
2255
|
+
continue;
|
|
2256
|
+
}
|
|
2257
|
+
this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook);
|
|
2258
|
+
}
|
|
2259
|
+
this.emit("level-change", level, levelVal, labels[preLevelVal], preLevelVal, this);
|
|
2260
|
+
}
|
|
2261
|
+
function getLevel(level) {
|
|
2262
|
+
const { levels, levelVal } = this;
|
|
2263
|
+
return levels && levels.labels ? levels.labels[levelVal] : "";
|
|
2264
|
+
}
|
|
2265
|
+
function isLevelEnabled(logLevel) {
|
|
2266
|
+
const { values } = this.levels;
|
|
2267
|
+
const logLevelVal = values[logLevel];
|
|
2268
|
+
return logLevelVal !== void 0 && this[levelCompSym](logLevelVal, this[levelValSym]);
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Determine if the given `current` level is enabled by comparing it
|
|
2272
|
+
* against the current threshold (`expected`).
|
|
2273
|
+
*
|
|
2274
|
+
* @param {SORTING_ORDER} direction comparison direction "ASC" or "DESC"
|
|
2275
|
+
* @param {number} current current log level number representation
|
|
2276
|
+
* @param {number} expected threshold value to compare with
|
|
2277
|
+
* @returns {boolean}
|
|
2278
|
+
*/
|
|
2279
|
+
function compareLevel(direction, current, expected) {
|
|
2280
|
+
if (direction === SORTING_ORDER.DESC) return current <= expected;
|
|
2281
|
+
return current >= expected;
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Create a level comparison function based on `levelComparison`
|
|
2285
|
+
* it could a default function which compares levels either in "ascending" or "descending" order or custom comparison function
|
|
2286
|
+
*
|
|
2287
|
+
* @param {SORTING_ORDER | Function} levelComparison sort levels order direction or custom comparison function
|
|
2288
|
+
* @returns Function
|
|
2289
|
+
*/
|
|
2290
|
+
function genLevelComparison(levelComparison) {
|
|
2291
|
+
if (typeof levelComparison === "string") return compareLevel.bind(null, levelComparison);
|
|
2292
|
+
return levelComparison;
|
|
2293
|
+
}
|
|
2294
|
+
function mappings(customLevels = null, useOnlyCustomLevels = false) {
|
|
2295
|
+
const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
|
|
2296
|
+
o[customLevels[k]] = k;
|
|
2297
|
+
return o;
|
|
2298
|
+
}, {}) : null;
|
|
2299
|
+
return {
|
|
2300
|
+
labels: Object.assign(Object.create(Object.prototype, { Infinity: { value: "silent" } }), useOnlyCustomLevels ? null : nums, customNums),
|
|
2301
|
+
values: Object.assign(Object.create(Object.prototype, { silent: { value: Infinity } }), useOnlyCustomLevels ? null : DEFAULT_LEVELS, customLevels)
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
function assertDefaultLevelFound(defaultLevel, customLevels, useOnlyCustomLevels) {
|
|
2305
|
+
if (typeof defaultLevel === "number") {
|
|
2306
|
+
if (![].concat(Object.keys(customLevels || {}).map((key) => customLevels[key]), useOnlyCustomLevels ? [] : Object.keys(nums).map((level) => +level), Infinity).includes(defaultLevel)) throw Error(`default level:${defaultLevel} must be included in custom levels`);
|
|
2307
|
+
return;
|
|
2308
|
+
}
|
|
2309
|
+
if (!(defaultLevel in Object.assign(Object.create(Object.prototype, { silent: { value: Infinity } }), useOnlyCustomLevels ? null : DEFAULT_LEVELS, customLevels))) throw Error(`default level:${defaultLevel} must be included in custom levels`);
|
|
2310
|
+
}
|
|
2311
|
+
function assertNoLevelCollisions(levels, customLevels) {
|
|
2312
|
+
const { labels, values } = levels;
|
|
2313
|
+
for (const k in customLevels) {
|
|
2314
|
+
if (k in values) throw Error("levels cannot be overridden");
|
|
2315
|
+
if (customLevels[k] in labels) throw Error("pre-existing level values cannot be used for new levels");
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
/**
|
|
2319
|
+
* Validates whether `levelComparison` is correct
|
|
2320
|
+
*
|
|
2321
|
+
* @throws Error
|
|
2322
|
+
* @param {SORTING_ORDER | Function} levelComparison - value to validate
|
|
2323
|
+
* @returns
|
|
2324
|
+
*/
|
|
2325
|
+
function assertLevelComparison(levelComparison) {
|
|
2326
|
+
if (typeof levelComparison === "function") return;
|
|
2327
|
+
if (typeof levelComparison === "string" && Object.values(SORTING_ORDER).includes(levelComparison)) return;
|
|
2328
|
+
throw new Error("Levels comparison should be one of \"ASC\", \"DESC\" or \"function\" type");
|
|
2329
|
+
}
|
|
2330
|
+
module.exports = {
|
|
2331
|
+
initialLsCache,
|
|
2332
|
+
genLsCache,
|
|
2333
|
+
levelMethods,
|
|
2334
|
+
getLevel,
|
|
2335
|
+
setLevel,
|
|
2336
|
+
isLevelEnabled,
|
|
2337
|
+
mappings,
|
|
2338
|
+
assertNoLevelCollisions,
|
|
2339
|
+
assertDefaultLevelFound,
|
|
2340
|
+
genLevelComparison,
|
|
2341
|
+
assertLevelComparison
|
|
2342
|
+
};
|
|
2343
|
+
}));
|
|
2344
|
+
//#endregion
|
|
2345
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/meta.js
|
|
2346
|
+
var require_meta = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2347
|
+
module.exports = { version: "10.3.1" };
|
|
2348
|
+
}));
|
|
2349
|
+
//#endregion
|
|
2350
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/proto.js
|
|
2351
|
+
var require_proto = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2352
|
+
var { EventEmitter } = __require("node:events");
|
|
2353
|
+
var { lsCacheSym, levelValSym, setLevelSym, getLevelSym, chindingsSym, mixinSym, asJsonSym, writeSym, mixinMergeStrategySym, timeSym, timeSliceIndexSym, streamSym, serializersSym, formattersSym, errorKeySym, messageKeySym, useOnlyCustomLevelsSym, needsMetadataGsym, redactFmtSym, stringifySym, formatOptsSym, stringifiersSym, msgPrefixSym, hooksSym } = require_symbols();
|
|
2354
|
+
var { getLevel, setLevel, isLevelEnabled, mappings, initialLsCache, genLsCache, assertNoLevelCollisions } = require_levels();
|
|
2355
|
+
var { asChindings, asJson, buildFormatters, stringify, noop } = require_tools();
|
|
2356
|
+
var { version } = require_meta();
|
|
2357
|
+
var redaction = require_redaction();
|
|
2358
|
+
var prototype = {
|
|
2359
|
+
constructor: class Pino {},
|
|
2360
|
+
child,
|
|
2361
|
+
bindings,
|
|
2362
|
+
setBindings,
|
|
2363
|
+
flush,
|
|
2364
|
+
isLevelEnabled,
|
|
2365
|
+
version,
|
|
2366
|
+
get level() {
|
|
2367
|
+
return this[getLevelSym]();
|
|
2368
|
+
},
|
|
2369
|
+
set level(lvl) {
|
|
2370
|
+
this[setLevelSym](lvl);
|
|
2371
|
+
},
|
|
2372
|
+
get levelVal() {
|
|
2373
|
+
return this[levelValSym];
|
|
2374
|
+
},
|
|
2375
|
+
set levelVal(n) {
|
|
2376
|
+
throw Error("levelVal is read-only");
|
|
2377
|
+
},
|
|
2378
|
+
get msgPrefix() {
|
|
2379
|
+
return this[msgPrefixSym];
|
|
2380
|
+
},
|
|
2381
|
+
get [Symbol.toStringTag]() {
|
|
2382
|
+
return "Pino";
|
|
2383
|
+
},
|
|
2384
|
+
[lsCacheSym]: initialLsCache,
|
|
2385
|
+
[writeSym]: write,
|
|
2386
|
+
[asJsonSym]: asJson,
|
|
2387
|
+
[getLevelSym]: getLevel,
|
|
2388
|
+
[setLevelSym]: setLevel
|
|
2389
|
+
};
|
|
2390
|
+
Object.setPrototypeOf(prototype, EventEmitter.prototype);
|
|
2391
|
+
module.exports = function() {
|
|
2392
|
+
return Object.create(prototype);
|
|
2393
|
+
};
|
|
2394
|
+
var resetChildingsFormatter = (bindings) => bindings;
|
|
2395
|
+
function child(bindings, options) {
|
|
2396
|
+
if (!bindings) throw Error("missing bindings for child Pino");
|
|
2397
|
+
const serializers = this[serializersSym];
|
|
2398
|
+
const formatters = this[formattersSym];
|
|
2399
|
+
const instance = Object.create(this);
|
|
2400
|
+
if (options == null) {
|
|
2401
|
+
if (instance[formattersSym].bindings !== resetChildingsFormatter) instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
2402
|
+
instance[chindingsSym] = asChindings(instance, bindings);
|
|
2403
|
+
if (this.onChild !== noop) this.onChild(instance);
|
|
2404
|
+
return instance;
|
|
2405
|
+
}
|
|
2406
|
+
if (options.hasOwnProperty("serializers") === true) {
|
|
2407
|
+
instance[serializersSym] = Object.create(null);
|
|
2408
|
+
for (const k in serializers) instance[serializersSym][k] = serializers[k];
|
|
2409
|
+
const parentSymbols = Object.getOwnPropertySymbols(serializers);
|
|
2410
|
+
for (var i = 0; i < parentSymbols.length; i++) {
|
|
2411
|
+
const ks = parentSymbols[i];
|
|
2412
|
+
instance[serializersSym][ks] = serializers[ks];
|
|
2413
|
+
}
|
|
2414
|
+
for (const bk in options.serializers) instance[serializersSym][bk] = options.serializers[bk];
|
|
2415
|
+
const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
|
|
2416
|
+
for (var bi = 0; bi < bindingsSymbols.length; bi++) {
|
|
2417
|
+
const bks = bindingsSymbols[bi];
|
|
2418
|
+
instance[serializersSym][bks] = options.serializers[bks];
|
|
2419
|
+
}
|
|
2420
|
+
} else instance[serializersSym] = serializers;
|
|
2421
|
+
if (options.hasOwnProperty("formatters")) {
|
|
2422
|
+
const { level, bindings: chindings, log } = options.formatters;
|
|
2423
|
+
instance[formattersSym] = buildFormatters(level || formatters.level, chindings || resetChildingsFormatter, log || formatters.log);
|
|
2424
|
+
} else instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
|
|
2425
|
+
if (options.hasOwnProperty("customLevels") === true) {
|
|
2426
|
+
assertNoLevelCollisions(this.levels, options.customLevels);
|
|
2427
|
+
instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]);
|
|
2428
|
+
genLsCache(instance);
|
|
2429
|
+
}
|
|
2430
|
+
if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) {
|
|
2431
|
+
instance.redact = options.redact;
|
|
2432
|
+
const stringifiers = redaction(instance.redact, stringify);
|
|
2433
|
+
const formatOpts = { stringify: stringifiers[redactFmtSym] };
|
|
2434
|
+
instance[stringifySym] = stringify;
|
|
2435
|
+
instance[stringifiersSym] = stringifiers;
|
|
2436
|
+
instance[formatOptsSym] = formatOpts;
|
|
2437
|
+
}
|
|
2438
|
+
if (typeof options.msgPrefix === "string") instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
|
|
2439
|
+
instance[chindingsSym] = asChindings(instance, bindings);
|
|
2440
|
+
if (options.level !== void 0 && options.level !== this.level || options.hasOwnProperty("customLevels")) {
|
|
2441
|
+
const childLevel = options.level || this.level;
|
|
2442
|
+
instance[setLevelSym](childLevel);
|
|
2443
|
+
}
|
|
2444
|
+
this.onChild(instance);
|
|
2445
|
+
return instance;
|
|
2446
|
+
}
|
|
2447
|
+
function bindings() {
|
|
2448
|
+
const chindingsJson = `{${this[chindingsSym].substr(1)}}`;
|
|
2449
|
+
const bindingsFromJson = JSON.parse(chindingsJson);
|
|
2450
|
+
delete bindingsFromJson.pid;
|
|
2451
|
+
delete bindingsFromJson.hostname;
|
|
2452
|
+
return bindingsFromJson;
|
|
2453
|
+
}
|
|
2454
|
+
function setBindings(newBindings) {
|
|
2455
|
+
const chindings = asChindings(this, newBindings);
|
|
2456
|
+
this[chindingsSym] = chindings;
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Default strategy for creating `mergeObject` from arguments and the result from `mixin()`.
|
|
2460
|
+
* Fields from `mergeObject` have higher priority in this strategy.
|
|
2461
|
+
*
|
|
2462
|
+
* @param {Object} mergeObject The object a user has supplied to the logging function.
|
|
2463
|
+
* @param {Object} mixinObject The result of the `mixin` method.
|
|
2464
|
+
* @return {Object}
|
|
2465
|
+
*/
|
|
2466
|
+
function defaultMixinMergeStrategy(mergeObject, mixinObject) {
|
|
2467
|
+
return Object.assign(mixinObject, mergeObject);
|
|
2468
|
+
}
|
|
2469
|
+
function write(_obj, msg, num) {
|
|
2470
|
+
const t = this[timeSym]();
|
|
2471
|
+
const mixin = this[mixinSym];
|
|
2472
|
+
const errorKey = this[errorKeySym];
|
|
2473
|
+
const messageKey = this[messageKeySym];
|
|
2474
|
+
const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy;
|
|
2475
|
+
let obj;
|
|
2476
|
+
const streamWriteHook = this[hooksSym].streamWrite;
|
|
2477
|
+
if (_obj === void 0 || _obj === null) obj = {};
|
|
2478
|
+
else if (_obj instanceof Error) {
|
|
2479
|
+
obj = { [errorKey]: _obj };
|
|
2480
|
+
if (msg === void 0) msg = _obj.message;
|
|
2481
|
+
} else {
|
|
2482
|
+
obj = _obj;
|
|
2483
|
+
if (msg === void 0 && _obj[messageKey] === void 0 && _obj[errorKey]) msg = _obj[errorKey].message;
|
|
2484
|
+
}
|
|
2485
|
+
if (mixin) obj = mixinMergeStrategy(obj, mixin(obj, num, this));
|
|
2486
|
+
const s = this[asJsonSym](obj, msg, num, t);
|
|
2487
|
+
const stream = this[streamSym];
|
|
2488
|
+
if (stream[needsMetadataGsym] === true) {
|
|
2489
|
+
stream.lastLevel = num;
|
|
2490
|
+
stream.lastObj = obj;
|
|
2491
|
+
stream.lastMsg = msg;
|
|
2492
|
+
stream.lastTime = t.slice(this[timeSliceIndexSym]);
|
|
2493
|
+
stream.lastLogger = this;
|
|
2494
|
+
}
|
|
2495
|
+
stream.write(streamWriteHook ? streamWriteHook(s) : s);
|
|
2496
|
+
}
|
|
2497
|
+
function flush(cb) {
|
|
2498
|
+
if (cb != null && typeof cb !== "function") throw Error("callback must be a function");
|
|
2499
|
+
const stream = this[streamSym];
|
|
2500
|
+
if (typeof stream.flush === "function") stream.flush(cb || noop);
|
|
2501
|
+
else if (cb) cb();
|
|
2502
|
+
}
|
|
2503
|
+
}));
|
|
2504
|
+
//#endregion
|
|
2505
|
+
//#region ../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js
|
|
2506
|
+
var require_safe_stable_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2507
|
+
var { hasOwnProperty } = Object.prototype;
|
|
2508
|
+
var stringify = configure();
|
|
2509
|
+
stringify.configure = configure;
|
|
2510
|
+
stringify.stringify = stringify;
|
|
2511
|
+
stringify.default = stringify;
|
|
2512
|
+
exports.stringify = stringify;
|
|
2513
|
+
exports.configure = configure;
|
|
2514
|
+
module.exports = stringify;
|
|
2515
|
+
var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;
|
|
2516
|
+
function strEscape(str) {
|
|
2517
|
+
if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) return `"${str}"`;
|
|
2518
|
+
return JSON.stringify(str);
|
|
2519
|
+
}
|
|
2520
|
+
function sort(array, comparator) {
|
|
2521
|
+
if (array.length > 200 || comparator) return array.sort(comparator);
|
|
2522
|
+
for (let i = 1; i < array.length; i++) {
|
|
2523
|
+
const currentValue = array[i];
|
|
2524
|
+
let position = i;
|
|
2525
|
+
while (position !== 0 && array[position - 1] > currentValue) {
|
|
2526
|
+
array[position] = array[position - 1];
|
|
2527
|
+
position--;
|
|
2528
|
+
}
|
|
2529
|
+
array[position] = currentValue;
|
|
2530
|
+
}
|
|
2531
|
+
return array;
|
|
2532
|
+
}
|
|
2533
|
+
var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array())), Symbol.toStringTag).get;
|
|
2534
|
+
function isTypedArrayWithEntries(value) {
|
|
2535
|
+
return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
|
|
2536
|
+
}
|
|
2537
|
+
function stringifyTypedArray(array, separator, maximumBreadth) {
|
|
2538
|
+
if (array.length < maximumBreadth) maximumBreadth = array.length;
|
|
2539
|
+
const whitespace = separator === "," ? "" : " ";
|
|
2540
|
+
let res = `"0":${whitespace}${array[0]}`;
|
|
2541
|
+
for (let i = 1; i < maximumBreadth; i++) res += `${separator}"${i}":${whitespace}${array[i]}`;
|
|
2542
|
+
return res;
|
|
2543
|
+
}
|
|
2544
|
+
function getCircularValueOption(options) {
|
|
2545
|
+
if (hasOwnProperty.call(options, "circularValue")) {
|
|
2546
|
+
const circularValue = options.circularValue;
|
|
2547
|
+
if (typeof circularValue === "string") return `"${circularValue}"`;
|
|
2548
|
+
if (circularValue == null) return circularValue;
|
|
2549
|
+
if (circularValue === Error || circularValue === TypeError) return { toString() {
|
|
2550
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
2551
|
+
} };
|
|
2552
|
+
throw new TypeError("The \"circularValue\" argument must be of type string or the value null or undefined");
|
|
2553
|
+
}
|
|
2554
|
+
return "\"[Circular]\"";
|
|
2555
|
+
}
|
|
2556
|
+
function getDeterministicOption(options) {
|
|
2557
|
+
let value;
|
|
2558
|
+
if (hasOwnProperty.call(options, "deterministic")) {
|
|
2559
|
+
value = options.deterministic;
|
|
2560
|
+
if (typeof value !== "boolean" && typeof value !== "function") throw new TypeError("The \"deterministic\" argument must be of type boolean or comparator function");
|
|
2561
|
+
}
|
|
2562
|
+
return value === void 0 ? true : value;
|
|
2563
|
+
}
|
|
2564
|
+
function getBooleanOption(options, key) {
|
|
2565
|
+
let value;
|
|
2566
|
+
if (hasOwnProperty.call(options, key)) {
|
|
2567
|
+
value = options[key];
|
|
2568
|
+
if (typeof value !== "boolean") throw new TypeError(`The "${key}" argument must be of type boolean`);
|
|
2569
|
+
}
|
|
2570
|
+
return value === void 0 ? true : value;
|
|
2571
|
+
}
|
|
2572
|
+
function getPositiveIntegerOption(options, key) {
|
|
2573
|
+
let value;
|
|
2574
|
+
if (hasOwnProperty.call(options, key)) {
|
|
2575
|
+
value = options[key];
|
|
2576
|
+
if (typeof value !== "number") throw new TypeError(`The "${key}" argument must be of type number`);
|
|
2577
|
+
if (!Number.isInteger(value)) throw new TypeError(`The "${key}" argument must be an integer`);
|
|
2578
|
+
if (value < 1) throw new RangeError(`The "${key}" argument must be >= 1`);
|
|
2579
|
+
}
|
|
2580
|
+
return value === void 0 ? Infinity : value;
|
|
2581
|
+
}
|
|
2582
|
+
function getItemCount(number) {
|
|
2583
|
+
if (number === 1) return "1 item";
|
|
2584
|
+
return `${number} items`;
|
|
2585
|
+
}
|
|
2586
|
+
function getUniqueReplacerSet(replacerArray) {
|
|
2587
|
+
const replacerSet = /* @__PURE__ */ new Set();
|
|
2588
|
+
for (const value of replacerArray) if (typeof value === "string" || typeof value === "number") replacerSet.add(String(value));
|
|
2589
|
+
return replacerSet;
|
|
2590
|
+
}
|
|
2591
|
+
function getStrictOption(options) {
|
|
2592
|
+
if (hasOwnProperty.call(options, "strict")) {
|
|
2593
|
+
const value = options.strict;
|
|
2594
|
+
if (typeof value !== "boolean") throw new TypeError("The \"strict\" argument must be of type boolean");
|
|
2595
|
+
if (value) return (value) => {
|
|
2596
|
+
let message = `Object can not safely be stringified. Received type ${typeof value}`;
|
|
2597
|
+
if (typeof value !== "function") message += ` (${value.toString()})`;
|
|
2598
|
+
throw new Error(message);
|
|
2599
|
+
};
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
function configure(options) {
|
|
2603
|
+
options = { ...options };
|
|
2604
|
+
const fail = getStrictOption(options);
|
|
2605
|
+
if (fail) {
|
|
2606
|
+
if (options.bigint === void 0) options.bigint = false;
|
|
2607
|
+
if (!("circularValue" in options)) options.circularValue = Error;
|
|
2608
|
+
}
|
|
2609
|
+
const circularValue = getCircularValueOption(options);
|
|
2610
|
+
const bigint = getBooleanOption(options, "bigint");
|
|
2611
|
+
const deterministic = getDeterministicOption(options);
|
|
2612
|
+
const comparator = typeof deterministic === "function" ? deterministic : void 0;
|
|
2613
|
+
const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
|
|
2614
|
+
const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
|
|
2615
|
+
function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
|
|
2616
|
+
let value = parent[key];
|
|
2617
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") value = value.toJSON(key);
|
|
2618
|
+
value = replacer.call(parent, key, value);
|
|
2619
|
+
switch (typeof value) {
|
|
2620
|
+
case "string": return strEscape(value);
|
|
2621
|
+
case "object": {
|
|
2622
|
+
if (value === null) return "null";
|
|
2623
|
+
if (stack.indexOf(value) !== -1) return circularValue;
|
|
2624
|
+
let res = "";
|
|
2625
|
+
let join = ",";
|
|
2626
|
+
const originalIndentation = indentation;
|
|
2627
|
+
if (Array.isArray(value)) {
|
|
2628
|
+
if (value.length === 0) return "[]";
|
|
2629
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2630
|
+
stack.push(value);
|
|
2631
|
+
if (spacer !== "") {
|
|
2632
|
+
indentation += spacer;
|
|
2633
|
+
res += `\n${indentation}`;
|
|
2634
|
+
join = `,\n${indentation}`;
|
|
2635
|
+
}
|
|
2636
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2637
|
+
let i = 0;
|
|
2638
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2639
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
2640
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2641
|
+
res += join;
|
|
2642
|
+
}
|
|
2643
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
|
2644
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2645
|
+
if (value.length - 1 > maximumBreadth) {
|
|
2646
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
2647
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2648
|
+
}
|
|
2649
|
+
if (spacer !== "") res += `\n${originalIndentation}`;
|
|
2650
|
+
stack.pop();
|
|
2651
|
+
return `[${res}]`;
|
|
2652
|
+
}
|
|
2653
|
+
let keys = Object.keys(value);
|
|
2654
|
+
const keyLength = keys.length;
|
|
2655
|
+
if (keyLength === 0) return "{}";
|
|
2656
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
2657
|
+
let whitespace = "";
|
|
2658
|
+
let separator = "";
|
|
2659
|
+
if (spacer !== "") {
|
|
2660
|
+
indentation += spacer;
|
|
2661
|
+
join = `,\n${indentation}`;
|
|
2662
|
+
whitespace = " ";
|
|
2663
|
+
}
|
|
2664
|
+
const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
2665
|
+
if (deterministic && !isTypedArrayWithEntries(value)) keys = sort(keys, comparator);
|
|
2666
|
+
stack.push(value);
|
|
2667
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
2668
|
+
const key = keys[i];
|
|
2669
|
+
const tmp = stringifyFnReplacer(key, value, stack, replacer, spacer, indentation);
|
|
2670
|
+
if (tmp !== void 0) {
|
|
2671
|
+
res += `${separator}${strEscape(key)}:${whitespace}${tmp}`;
|
|
2672
|
+
separator = join;
|
|
2673
|
+
}
|
|
2674
|
+
}
|
|
2675
|
+
if (keyLength > maximumBreadth) {
|
|
2676
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
2677
|
+
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
|
2678
|
+
separator = join;
|
|
2679
|
+
}
|
|
2680
|
+
if (spacer !== "" && separator.length > 1) res = `\n${indentation}${res}\n${originalIndentation}`;
|
|
2681
|
+
stack.pop();
|
|
2682
|
+
return `{${res}}`;
|
|
2683
|
+
}
|
|
2684
|
+
case "number": return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
2685
|
+
case "boolean": return value === true ? "true" : "false";
|
|
2686
|
+
case "undefined": return;
|
|
2687
|
+
case "bigint": if (bigint) return String(value);
|
|
2688
|
+
default: return fail ? fail(value) : void 0;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
|
|
2692
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") value = value.toJSON(key);
|
|
2693
|
+
switch (typeof value) {
|
|
2694
|
+
case "string": return strEscape(value);
|
|
2695
|
+
case "object": {
|
|
2696
|
+
if (value === null) return "null";
|
|
2697
|
+
if (stack.indexOf(value) !== -1) return circularValue;
|
|
2698
|
+
const originalIndentation = indentation;
|
|
2699
|
+
let res = "";
|
|
2700
|
+
let join = ",";
|
|
2701
|
+
if (Array.isArray(value)) {
|
|
2702
|
+
if (value.length === 0) return "[]";
|
|
2703
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2704
|
+
stack.push(value);
|
|
2705
|
+
if (spacer !== "") {
|
|
2706
|
+
indentation += spacer;
|
|
2707
|
+
res += `\n${indentation}`;
|
|
2708
|
+
join = `,\n${indentation}`;
|
|
2709
|
+
}
|
|
2710
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2711
|
+
let i = 0;
|
|
2712
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2713
|
+
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
2714
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2715
|
+
res += join;
|
|
2716
|
+
}
|
|
2717
|
+
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
|
2718
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2719
|
+
if (value.length - 1 > maximumBreadth) {
|
|
2720
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
2721
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2722
|
+
}
|
|
2723
|
+
if (spacer !== "") res += `\n${originalIndentation}`;
|
|
2724
|
+
stack.pop();
|
|
2725
|
+
return `[${res}]`;
|
|
2726
|
+
}
|
|
2727
|
+
stack.push(value);
|
|
2728
|
+
let whitespace = "";
|
|
2729
|
+
if (spacer !== "") {
|
|
2730
|
+
indentation += spacer;
|
|
2731
|
+
join = `,\n${indentation}`;
|
|
2732
|
+
whitespace = " ";
|
|
2733
|
+
}
|
|
2734
|
+
let separator = "";
|
|
2735
|
+
for (const key of replacer) {
|
|
2736
|
+
const tmp = stringifyArrayReplacer(key, value[key], stack, replacer, spacer, indentation);
|
|
2737
|
+
if (tmp !== void 0) {
|
|
2738
|
+
res += `${separator}${strEscape(key)}:${whitespace}${tmp}`;
|
|
2739
|
+
separator = join;
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
if (spacer !== "" && separator.length > 1) res = `\n${indentation}${res}\n${originalIndentation}`;
|
|
2743
|
+
stack.pop();
|
|
2744
|
+
return `{${res}}`;
|
|
2745
|
+
}
|
|
2746
|
+
case "number": return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
2747
|
+
case "boolean": return value === true ? "true" : "false";
|
|
2748
|
+
case "undefined": return;
|
|
2749
|
+
case "bigint": if (bigint) return String(value);
|
|
2750
|
+
default: return fail ? fail(value) : void 0;
|
|
2751
|
+
}
|
|
2752
|
+
}
|
|
2753
|
+
function stringifyIndent(key, value, stack, spacer, indentation) {
|
|
2754
|
+
switch (typeof value) {
|
|
2755
|
+
case "string": return strEscape(value);
|
|
2756
|
+
case "object": {
|
|
2757
|
+
if (value === null) return "null";
|
|
2758
|
+
if (typeof value.toJSON === "function") {
|
|
2759
|
+
value = value.toJSON(key);
|
|
2760
|
+
if (typeof value !== "object") return stringifyIndent(key, value, stack, spacer, indentation);
|
|
2761
|
+
if (value === null) return "null";
|
|
2762
|
+
}
|
|
2763
|
+
if (stack.indexOf(value) !== -1) return circularValue;
|
|
2764
|
+
const originalIndentation = indentation;
|
|
2765
|
+
if (Array.isArray(value)) {
|
|
2766
|
+
if (value.length === 0) return "[]";
|
|
2767
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2768
|
+
stack.push(value);
|
|
2769
|
+
indentation += spacer;
|
|
2770
|
+
let res = `\n${indentation}`;
|
|
2771
|
+
const join = `,\n${indentation}`;
|
|
2772
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2773
|
+
let i = 0;
|
|
2774
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2775
|
+
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
2776
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2777
|
+
res += join;
|
|
2778
|
+
}
|
|
2779
|
+
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
|
2780
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2781
|
+
if (value.length - 1 > maximumBreadth) {
|
|
2782
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
2783
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2784
|
+
}
|
|
2785
|
+
res += `\n${originalIndentation}`;
|
|
2786
|
+
stack.pop();
|
|
2787
|
+
return `[${res}]`;
|
|
2788
|
+
}
|
|
2789
|
+
let keys = Object.keys(value);
|
|
2790
|
+
const keyLength = keys.length;
|
|
2791
|
+
if (keyLength === 0) return "{}";
|
|
2792
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
2793
|
+
indentation += spacer;
|
|
2794
|
+
const join = `,\n${indentation}`;
|
|
2795
|
+
let res = "";
|
|
2796
|
+
let separator = "";
|
|
2797
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
2798
|
+
if (isTypedArrayWithEntries(value)) {
|
|
2799
|
+
res += stringifyTypedArray(value, join, maximumBreadth);
|
|
2800
|
+
keys = keys.slice(value.length);
|
|
2801
|
+
maximumPropertiesToStringify -= value.length;
|
|
2802
|
+
separator = join;
|
|
2803
|
+
}
|
|
2804
|
+
if (deterministic) keys = sort(keys, comparator);
|
|
2805
|
+
stack.push(value);
|
|
2806
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
2807
|
+
const key = keys[i];
|
|
2808
|
+
const tmp = stringifyIndent(key, value[key], stack, spacer, indentation);
|
|
2809
|
+
if (tmp !== void 0) {
|
|
2810
|
+
res += `${separator}${strEscape(key)}: ${tmp}`;
|
|
2811
|
+
separator = join;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
if (keyLength > maximumBreadth) {
|
|
2815
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
2816
|
+
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
|
2817
|
+
separator = join;
|
|
2818
|
+
}
|
|
2819
|
+
if (separator !== "") res = `\n${indentation}${res}\n${originalIndentation}`;
|
|
2820
|
+
stack.pop();
|
|
2821
|
+
return `{${res}}`;
|
|
2822
|
+
}
|
|
2823
|
+
case "number": return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
2824
|
+
case "boolean": return value === true ? "true" : "false";
|
|
2825
|
+
case "undefined": return;
|
|
2826
|
+
case "bigint": if (bigint) return String(value);
|
|
2827
|
+
default: return fail ? fail(value) : void 0;
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
function stringifySimple(key, value, stack) {
|
|
2831
|
+
switch (typeof value) {
|
|
2832
|
+
case "string": return strEscape(value);
|
|
2833
|
+
case "object": {
|
|
2834
|
+
if (value === null) return "null";
|
|
2835
|
+
if (typeof value.toJSON === "function") {
|
|
2836
|
+
value = value.toJSON(key);
|
|
2837
|
+
if (typeof value !== "object") return stringifySimple(key, value, stack);
|
|
2838
|
+
if (value === null) return "null";
|
|
2839
|
+
}
|
|
2840
|
+
if (stack.indexOf(value) !== -1) return circularValue;
|
|
2841
|
+
let res = "";
|
|
2842
|
+
const hasLength = value.length !== void 0;
|
|
2843
|
+
if (hasLength && Array.isArray(value)) {
|
|
2844
|
+
if (value.length === 0) return "[]";
|
|
2845
|
+
if (maximumDepth < stack.length + 1) return "\"[Array]\"";
|
|
2846
|
+
stack.push(value);
|
|
2847
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
|
2848
|
+
let i = 0;
|
|
2849
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
|
2850
|
+
const tmp = stringifySimple(String(i), value[i], stack);
|
|
2851
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2852
|
+
res += ",";
|
|
2853
|
+
}
|
|
2854
|
+
const tmp = stringifySimple(String(i), value[i], stack);
|
|
2855
|
+
res += tmp !== void 0 ? tmp : "null";
|
|
2856
|
+
if (value.length - 1 > maximumBreadth) {
|
|
2857
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
|
2858
|
+
res += `,"... ${getItemCount(removedKeys)} not stringified"`;
|
|
2859
|
+
}
|
|
2860
|
+
stack.pop();
|
|
2861
|
+
return `[${res}]`;
|
|
2862
|
+
}
|
|
2863
|
+
let keys = Object.keys(value);
|
|
2864
|
+
const keyLength = keys.length;
|
|
2865
|
+
if (keyLength === 0) return "{}";
|
|
2866
|
+
if (maximumDepth < stack.length + 1) return "\"[Object]\"";
|
|
2867
|
+
let separator = "";
|
|
2868
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
|
2869
|
+
if (hasLength && isTypedArrayWithEntries(value)) {
|
|
2870
|
+
res += stringifyTypedArray(value, ",", maximumBreadth);
|
|
2871
|
+
keys = keys.slice(value.length);
|
|
2872
|
+
maximumPropertiesToStringify -= value.length;
|
|
2873
|
+
separator = ",";
|
|
2874
|
+
}
|
|
2875
|
+
if (deterministic) keys = sort(keys, comparator);
|
|
2876
|
+
stack.push(value);
|
|
2877
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
|
2878
|
+
const key = keys[i];
|
|
2879
|
+
const tmp = stringifySimple(key, value[key], stack);
|
|
2880
|
+
if (tmp !== void 0) {
|
|
2881
|
+
res += `${separator}${strEscape(key)}:${tmp}`;
|
|
2882
|
+
separator = ",";
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
if (keyLength > maximumBreadth) {
|
|
2886
|
+
const removedKeys = keyLength - maximumBreadth;
|
|
2887
|
+
res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
|
|
2888
|
+
}
|
|
2889
|
+
stack.pop();
|
|
2890
|
+
return `{${res}}`;
|
|
2891
|
+
}
|
|
2892
|
+
case "number": return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
|
2893
|
+
case "boolean": return value === true ? "true" : "false";
|
|
2894
|
+
case "undefined": return;
|
|
2895
|
+
case "bigint": if (bigint) return String(value);
|
|
2896
|
+
default: return fail ? fail(value) : void 0;
|
|
2897
|
+
}
|
|
2898
|
+
}
|
|
2899
|
+
function stringify(value, replacer, space) {
|
|
2900
|
+
if (arguments.length > 1) {
|
|
2901
|
+
let spacer = "";
|
|
2902
|
+
if (typeof space === "number") spacer = " ".repeat(Math.min(space, 10));
|
|
2903
|
+
else if (typeof space === "string") spacer = space.slice(0, 10);
|
|
2904
|
+
if (replacer != null) {
|
|
2905
|
+
if (typeof replacer === "function") return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
|
|
2906
|
+
if (Array.isArray(replacer)) return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
|
|
2907
|
+
}
|
|
2908
|
+
if (spacer.length !== 0) return stringifyIndent("", value, [], spacer, "");
|
|
2909
|
+
}
|
|
2910
|
+
return stringifySimple("", value, []);
|
|
2911
|
+
}
|
|
2912
|
+
return stringify;
|
|
2913
|
+
}
|
|
2914
|
+
}));
|
|
2915
|
+
//#endregion
|
|
2916
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/lib/multistream.js
|
|
2917
|
+
var require_multistream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2918
|
+
var metadata = Symbol.for("pino.metadata");
|
|
2919
|
+
var { DEFAULT_LEVELS } = require_constants();
|
|
2920
|
+
var DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info;
|
|
2921
|
+
function multistream(streamsArray, opts) {
|
|
2922
|
+
streamsArray = streamsArray || [];
|
|
2923
|
+
opts = opts || { dedupe: false };
|
|
2924
|
+
const streamLevels = Object.create(DEFAULT_LEVELS);
|
|
2925
|
+
streamLevels.silent = Infinity;
|
|
2926
|
+
if (opts.levels && typeof opts.levels === "object") Object.keys(opts.levels).forEach((i) => {
|
|
2927
|
+
streamLevels[i] = opts.levels[i];
|
|
2928
|
+
});
|
|
2929
|
+
const res = {
|
|
2930
|
+
write,
|
|
2931
|
+
add,
|
|
2932
|
+
remove,
|
|
2933
|
+
emit,
|
|
2934
|
+
flushSync,
|
|
2935
|
+
end,
|
|
2936
|
+
minLevel: 0,
|
|
2937
|
+
lastId: 0,
|
|
2938
|
+
streams: [],
|
|
2939
|
+
clone,
|
|
2940
|
+
[metadata]: true,
|
|
2941
|
+
streamLevels
|
|
2942
|
+
};
|
|
2943
|
+
if (Array.isArray(streamsArray)) streamsArray.forEach(add, res);
|
|
2944
|
+
else add.call(res, streamsArray);
|
|
2945
|
+
streamsArray = null;
|
|
2946
|
+
return res;
|
|
2947
|
+
function write(data) {
|
|
2948
|
+
let dest;
|
|
2949
|
+
const level = this.lastLevel;
|
|
2950
|
+
const { streams } = this;
|
|
2951
|
+
let recordedLevel = 0;
|
|
2952
|
+
let stream;
|
|
2953
|
+
for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) {
|
|
2954
|
+
dest = streams[i];
|
|
2955
|
+
if (dest.level <= level) {
|
|
2956
|
+
if (recordedLevel !== 0 && recordedLevel !== dest.level) break;
|
|
2957
|
+
stream = dest.stream;
|
|
2958
|
+
if (stream[metadata]) {
|
|
2959
|
+
const { lastTime, lastMsg, lastObj, lastLogger } = this;
|
|
2960
|
+
stream.lastLevel = level;
|
|
2961
|
+
stream.lastTime = lastTime;
|
|
2962
|
+
stream.lastMsg = lastMsg;
|
|
2963
|
+
stream.lastObj = lastObj;
|
|
2964
|
+
stream.lastLogger = lastLogger;
|
|
2965
|
+
}
|
|
2966
|
+
stream.write(data);
|
|
2967
|
+
if (opts.dedupe) recordedLevel = dest.level;
|
|
2968
|
+
} else if (!opts.dedupe) break;
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
function emit(...args) {
|
|
2972
|
+
for (const { stream } of this.streams) if (typeof stream.emit === "function") stream.emit(...args);
|
|
2973
|
+
}
|
|
2974
|
+
function flushSync() {
|
|
2975
|
+
for (const { stream } of this.streams) if (typeof stream.flushSync === "function") stream.flushSync();
|
|
2976
|
+
}
|
|
2977
|
+
function add(dest) {
|
|
2978
|
+
if (!dest) return res;
|
|
2979
|
+
const isStream = typeof dest.write === "function" || dest.stream;
|
|
2980
|
+
const stream_ = dest.write ? dest : dest.stream;
|
|
2981
|
+
if (!isStream) throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");
|
|
2982
|
+
const { streams, streamLevels } = this;
|
|
2983
|
+
let level;
|
|
2984
|
+
if (typeof dest.levelVal === "number") level = dest.levelVal;
|
|
2985
|
+
else if (typeof dest.level === "string") level = streamLevels[dest.level];
|
|
2986
|
+
else if (typeof dest.level === "number") level = dest.level;
|
|
2987
|
+
else level = DEFAULT_INFO_LEVEL;
|
|
2988
|
+
const dest_ = {
|
|
2989
|
+
stream: stream_,
|
|
2990
|
+
level,
|
|
2991
|
+
levelVal: void 0,
|
|
2992
|
+
id: ++res.lastId
|
|
2993
|
+
};
|
|
2994
|
+
streams.unshift(dest_);
|
|
2995
|
+
streams.sort(compareByLevel);
|
|
2996
|
+
this.minLevel = streams[0].level;
|
|
2997
|
+
return res;
|
|
2998
|
+
}
|
|
2999
|
+
function remove(id) {
|
|
3000
|
+
const { streams } = this;
|
|
3001
|
+
const index = streams.findIndex((s) => s.id === id);
|
|
3002
|
+
if (index >= 0) {
|
|
3003
|
+
streams.splice(index, 1);
|
|
3004
|
+
streams.sort(compareByLevel);
|
|
3005
|
+
this.minLevel = streams.length > 0 ? streams[0].level : -1;
|
|
3006
|
+
}
|
|
3007
|
+
return res;
|
|
3008
|
+
}
|
|
3009
|
+
function end() {
|
|
3010
|
+
for (const { stream } of this.streams) {
|
|
3011
|
+
if (typeof stream.flushSync === "function") stream.flushSync();
|
|
3012
|
+
stream.end();
|
|
3013
|
+
}
|
|
3014
|
+
}
|
|
3015
|
+
function clone(level) {
|
|
3016
|
+
const streams = new Array(this.streams.length);
|
|
3017
|
+
for (let i = 0; i < streams.length; i++) streams[i] = {
|
|
3018
|
+
level,
|
|
3019
|
+
stream: this.streams[i].stream
|
|
3020
|
+
};
|
|
3021
|
+
return {
|
|
3022
|
+
write,
|
|
3023
|
+
add,
|
|
3024
|
+
remove,
|
|
3025
|
+
minLevel: level,
|
|
3026
|
+
streams,
|
|
3027
|
+
clone,
|
|
3028
|
+
emit,
|
|
3029
|
+
flushSync,
|
|
3030
|
+
[metadata]: true
|
|
3031
|
+
};
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
function compareByLevel(a, b) {
|
|
3035
|
+
return a.level - b.level;
|
|
3036
|
+
}
|
|
3037
|
+
function initLoopVar(length, dedupe) {
|
|
3038
|
+
return dedupe ? length - 1 : 0;
|
|
3039
|
+
}
|
|
3040
|
+
function adjustLoopVar(i, dedupe) {
|
|
3041
|
+
return dedupe ? i - 1 : i + 1;
|
|
3042
|
+
}
|
|
3043
|
+
function checkLoopVar(i, length, dedupe) {
|
|
3044
|
+
return dedupe ? i >= 0 : i < length;
|
|
3045
|
+
}
|
|
3046
|
+
module.exports = multistream;
|
|
3047
|
+
}));
|
|
3048
|
+
//#endregion
|
|
3049
|
+
//#region ../../node_modules/.pnpm/pino@10.3.1/node_modules/pino/pino.js
|
|
3050
|
+
var require_pino = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
3051
|
+
var os = __require("node:os");
|
|
3052
|
+
var stdSerializers = require_pino_std_serializers();
|
|
3053
|
+
var caller = require_caller();
|
|
3054
|
+
var redaction = require_redaction();
|
|
3055
|
+
var time = require_time();
|
|
3056
|
+
var proto = require_proto();
|
|
3057
|
+
var symbols = require_symbols();
|
|
3058
|
+
var { configure } = require_safe_stable_stringify();
|
|
3059
|
+
var { assertDefaultLevelFound, mappings, genLsCache, genLevelComparison, assertLevelComparison } = require_levels();
|
|
3060
|
+
var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
|
|
3061
|
+
var { createArgsNormalizer, asChindings, buildSafeSonicBoom, buildFormatters, stringify, normalizeDestFileDescriptor, noop } = require_tools();
|
|
3062
|
+
var { version } = require_meta();
|
|
3063
|
+
var { chindingsSym, redactFmtSym, serializersSym, timeSym, timeSliceIndexSym, streamSym, stringifySym, stringifySafeSym, stringifiersSym, setLevelSym, endSym, formatOptsSym, messageKeySym, errorKeySym, nestedKeySym, mixinSym, levelCompSym, useOnlyCustomLevelsSym, formattersSym, hooksSym, nestedKeyStrSym, mixinMergeStrategySym, msgPrefixSym } = symbols;
|
|
3064
|
+
var { epochTime, nullTime } = time;
|
|
3065
|
+
var { pid } = process;
|
|
3066
|
+
var hostname = os.hostname();
|
|
3067
|
+
var defaultErrorSerializer = stdSerializers.err;
|
|
3068
|
+
var normalize = createArgsNormalizer({
|
|
3069
|
+
level: "info",
|
|
3070
|
+
levelComparison: SORTING_ORDER.ASC,
|
|
3071
|
+
levels: DEFAULT_LEVELS,
|
|
3072
|
+
messageKey: "msg",
|
|
3073
|
+
errorKey: "err",
|
|
3074
|
+
nestedKey: null,
|
|
3075
|
+
enabled: true,
|
|
3076
|
+
base: {
|
|
3077
|
+
pid,
|
|
3078
|
+
hostname
|
|
3079
|
+
},
|
|
3080
|
+
serializers: Object.assign(Object.create(null), { err: defaultErrorSerializer }),
|
|
3081
|
+
formatters: Object.assign(Object.create(null), {
|
|
3082
|
+
bindings(bindings) {
|
|
3083
|
+
return bindings;
|
|
3084
|
+
},
|
|
3085
|
+
level(label, number) {
|
|
3086
|
+
return { level: number };
|
|
3087
|
+
}
|
|
3088
|
+
}),
|
|
3089
|
+
hooks: {
|
|
3090
|
+
logMethod: void 0,
|
|
3091
|
+
streamWrite: void 0
|
|
3092
|
+
},
|
|
3093
|
+
timestamp: epochTime,
|
|
3094
|
+
name: void 0,
|
|
3095
|
+
redact: null,
|
|
3096
|
+
customLevels: null,
|
|
3097
|
+
useOnlyCustomLevels: false,
|
|
3098
|
+
depthLimit: 5,
|
|
3099
|
+
edgeLimit: 100
|
|
3100
|
+
});
|
|
3101
|
+
var serializers = Object.assign(Object.create(null), stdSerializers);
|
|
3102
|
+
function pino(...args) {
|
|
3103
|
+
const instance = {};
|
|
3104
|
+
const { opts, stream } = normalize(instance, caller(), ...args);
|
|
3105
|
+
if (opts.level && typeof opts.level === "string" && DEFAULT_LEVELS[opts.level.toLowerCase()] !== void 0) opts.level = opts.level.toLowerCase();
|
|
3106
|
+
const { redact, crlf, serializers, timestamp, messageKey, errorKey, nestedKey, base, name, level, customLevels, levelComparison, mixin, mixinMergeStrategy, useOnlyCustomLevels, formatters, hooks, depthLimit, edgeLimit, onChild, msgPrefix } = opts;
|
|
3107
|
+
const stringifySafe = configure({
|
|
3108
|
+
maximumDepth: depthLimit,
|
|
3109
|
+
maximumBreadth: edgeLimit
|
|
3110
|
+
});
|
|
3111
|
+
const allFormatters = buildFormatters(formatters.level, formatters.bindings, formatters.log);
|
|
3112
|
+
const stringifyFn = stringify.bind({ [stringifySafeSym]: stringifySafe });
|
|
3113
|
+
const stringifiers = redact ? redaction(redact, stringifyFn) : {};
|
|
3114
|
+
const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify: stringifyFn };
|
|
3115
|
+
const end = "}" + (crlf ? "\r\n" : "\n");
|
|
3116
|
+
const coreChindings = asChindings.bind(null, {
|
|
3117
|
+
[chindingsSym]: "",
|
|
3118
|
+
[serializersSym]: serializers,
|
|
3119
|
+
[stringifiersSym]: stringifiers,
|
|
3120
|
+
[stringifySym]: stringify,
|
|
3121
|
+
[stringifySafeSym]: stringifySafe,
|
|
3122
|
+
[formattersSym]: allFormatters
|
|
3123
|
+
});
|
|
3124
|
+
let chindings = "";
|
|
3125
|
+
if (base !== null) if (name === void 0) chindings = coreChindings(base);
|
|
3126
|
+
else chindings = coreChindings(Object.assign({}, base, { name }));
|
|
3127
|
+
const time = timestamp instanceof Function ? timestamp : timestamp ? epochTime : nullTime;
|
|
3128
|
+
const timeSliceIndex = time().indexOf(":") + 1;
|
|
3129
|
+
if (useOnlyCustomLevels && !customLevels) throw Error("customLevels is required if useOnlyCustomLevels is set true");
|
|
3130
|
+
if (mixin && typeof mixin !== "function") throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`);
|
|
3131
|
+
if (msgPrefix && typeof msgPrefix !== "string") throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
|
|
3132
|
+
assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
|
|
3133
|
+
const levels = mappings(customLevels, useOnlyCustomLevels);
|
|
3134
|
+
if (typeof stream.emit === "function") stream.emit("message", {
|
|
3135
|
+
code: "PINO_CONFIG",
|
|
3136
|
+
config: {
|
|
3137
|
+
levels,
|
|
3138
|
+
messageKey,
|
|
3139
|
+
errorKey
|
|
3140
|
+
}
|
|
3141
|
+
});
|
|
3142
|
+
assertLevelComparison(levelComparison);
|
|
3143
|
+
const levelCompFunc = genLevelComparison(levelComparison);
|
|
3144
|
+
Object.assign(instance, {
|
|
3145
|
+
levels,
|
|
3146
|
+
[levelCompSym]: levelCompFunc,
|
|
3147
|
+
[useOnlyCustomLevelsSym]: useOnlyCustomLevels,
|
|
3148
|
+
[streamSym]: stream,
|
|
3149
|
+
[timeSym]: time,
|
|
3150
|
+
[timeSliceIndexSym]: timeSliceIndex,
|
|
3151
|
+
[stringifySym]: stringify,
|
|
3152
|
+
[stringifySafeSym]: stringifySafe,
|
|
3153
|
+
[stringifiersSym]: stringifiers,
|
|
3154
|
+
[endSym]: end,
|
|
3155
|
+
[formatOptsSym]: formatOpts,
|
|
3156
|
+
[messageKeySym]: messageKey,
|
|
3157
|
+
[errorKeySym]: errorKey,
|
|
3158
|
+
[nestedKeySym]: nestedKey,
|
|
3159
|
+
[nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
|
|
3160
|
+
[serializersSym]: serializers,
|
|
3161
|
+
[mixinSym]: mixin,
|
|
3162
|
+
[mixinMergeStrategySym]: mixinMergeStrategy,
|
|
3163
|
+
[chindingsSym]: chindings,
|
|
3164
|
+
[formattersSym]: allFormatters,
|
|
3165
|
+
[hooksSym]: hooks,
|
|
3166
|
+
silent: noop,
|
|
3167
|
+
onChild,
|
|
3168
|
+
[msgPrefixSym]: msgPrefix
|
|
3169
|
+
});
|
|
3170
|
+
Object.setPrototypeOf(instance, proto());
|
|
3171
|
+
genLsCache(instance);
|
|
3172
|
+
instance[setLevelSym](level);
|
|
3173
|
+
return instance;
|
|
3174
|
+
}
|
|
3175
|
+
module.exports = pino;
|
|
3176
|
+
module.exports.destination = (dest = process.stdout.fd) => {
|
|
3177
|
+
if (typeof dest === "object") {
|
|
3178
|
+
dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
|
|
3179
|
+
return buildSafeSonicBoom(dest);
|
|
3180
|
+
} else return buildSafeSonicBoom({
|
|
3181
|
+
dest: normalizeDestFileDescriptor(dest),
|
|
3182
|
+
minLength: 0
|
|
3183
|
+
});
|
|
3184
|
+
};
|
|
3185
|
+
module.exports.transport = require_transport();
|
|
3186
|
+
module.exports.multistream = require_multistream();
|
|
3187
|
+
module.exports.levels = mappings();
|
|
3188
|
+
module.exports.stdSerializers = serializers;
|
|
3189
|
+
module.exports.stdTimeFunctions = Object.assign({}, time);
|
|
3190
|
+
module.exports.symbols = symbols;
|
|
3191
|
+
module.exports.version = version;
|
|
3192
|
+
module.exports.default = pino;
|
|
3193
|
+
module.exports.pino = pino;
|
|
3194
|
+
}));
|
|
3195
|
+
//#endregion
|
|
3196
|
+
export { require_sonic_boom as n, require_pino as t };
|