@salesforce/core-bundle 6.5.5
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/LICENSE.txt +12 -0
- package/README.md +81 -0
- package/lib/exported.d.ts +6597 -0
- package/lib/exported.js +120951 -0
- package/lib/pino-file.js +4265 -0
- package/lib/pino-pipeline-worker.js +87 -0
- package/lib/pino-pretty.js +14649 -0
- package/lib/pino-worker.js +10573 -0
- package/lib/thread-stream-worker.js +201 -0
- package/lib/transformStream.js +3 -0
- package/messages/auth.md +49 -0
- package/messages/config.md +160 -0
- package/messages/connection.md +30 -0
- package/messages/core.json +20 -0
- package/messages/core.md +67 -0
- package/messages/encryption.md +85 -0
- package/messages/envVars.md +317 -0
- package/messages/org.md +67 -0
- package/messages/permissionSetAssignment.md +31 -0
- package/messages/scratchOrgCreate.md +23 -0
- package/messages/scratchOrgErrorCodes.md +115 -0
- package/messages/scratchOrgFeatureDeprecation.md +11 -0
- package/messages/scratchOrgInfoApi.md +20 -0
- package/messages/scratchOrgInfoGenerator.md +27 -0
- package/messages/scratchOrgSettingsGenerator.md +4 -0
- package/messages/streaming.md +23 -0
- package/messages/user.md +35 -0
- package/package.json +155 -0
package/lib/pino-file.js
ADDED
@@ -0,0 +1,4265 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
3
|
+
var __commonJS = (cb, mod) => function __require() {
|
4
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
5
|
+
};
|
6
|
+
|
7
|
+
// node_modules/pino-std-serializers/lib/err-helpers.js
|
8
|
+
var require_err_helpers = __commonJS({
|
9
|
+
"node_modules/pino-std-serializers/lib/err-helpers.js"(exports2, module2) {
|
10
|
+
"use strict";
|
11
|
+
var isErrorLike = (err) => {
|
12
|
+
return err && typeof err.message === "string";
|
13
|
+
};
|
14
|
+
var getErrorCause = (err) => {
|
15
|
+
if (!err)
|
16
|
+
return;
|
17
|
+
const cause = err.cause;
|
18
|
+
if (typeof cause === "function") {
|
19
|
+
const causeResult = err.cause();
|
20
|
+
return isErrorLike(causeResult) ? causeResult : void 0;
|
21
|
+
} else {
|
22
|
+
return isErrorLike(cause) ? cause : void 0;
|
23
|
+
}
|
24
|
+
};
|
25
|
+
var _stackWithCauses = (err, seen) => {
|
26
|
+
if (!isErrorLike(err))
|
27
|
+
return "";
|
28
|
+
const stack = err.stack || "";
|
29
|
+
if (seen.has(err)) {
|
30
|
+
return stack + "\ncauses have become circular...";
|
31
|
+
}
|
32
|
+
const cause = getErrorCause(err);
|
33
|
+
if (cause) {
|
34
|
+
seen.add(err);
|
35
|
+
return stack + "\ncaused by: " + _stackWithCauses(cause, seen);
|
36
|
+
} else {
|
37
|
+
return stack;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
var stackWithCauses = (err) => _stackWithCauses(err, /* @__PURE__ */ new Set());
|
41
|
+
var _messageWithCauses = (err, seen, skip) => {
|
42
|
+
if (!isErrorLike(err))
|
43
|
+
return "";
|
44
|
+
const message = skip ? "" : err.message || "";
|
45
|
+
if (seen.has(err)) {
|
46
|
+
return message + ": ...";
|
47
|
+
}
|
48
|
+
const cause = getErrorCause(err);
|
49
|
+
if (cause) {
|
50
|
+
seen.add(err);
|
51
|
+
const skipIfVErrorStyleCause = typeof err.cause === "function";
|
52
|
+
return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause);
|
53
|
+
} else {
|
54
|
+
return message;
|
55
|
+
}
|
56
|
+
};
|
57
|
+
var messageWithCauses = (err) => _messageWithCauses(err, /* @__PURE__ */ new Set());
|
58
|
+
module2.exports = {
|
59
|
+
isErrorLike,
|
60
|
+
getErrorCause,
|
61
|
+
stackWithCauses,
|
62
|
+
messageWithCauses
|
63
|
+
};
|
64
|
+
}
|
65
|
+
});
|
66
|
+
|
67
|
+
// node_modules/pino-std-serializers/lib/err-proto.js
|
68
|
+
var require_err_proto = __commonJS({
|
69
|
+
"node_modules/pino-std-serializers/lib/err-proto.js"(exports2, module2) {
|
70
|
+
"use strict";
|
71
|
+
var seen = Symbol("circular-ref-tag");
|
72
|
+
var rawSymbol = Symbol("pino-raw-err-ref");
|
73
|
+
var pinoErrProto = Object.create({}, {
|
74
|
+
type: {
|
75
|
+
enumerable: true,
|
76
|
+
writable: true,
|
77
|
+
value: void 0
|
78
|
+
},
|
79
|
+
message: {
|
80
|
+
enumerable: true,
|
81
|
+
writable: true,
|
82
|
+
value: void 0
|
83
|
+
},
|
84
|
+
stack: {
|
85
|
+
enumerable: true,
|
86
|
+
writable: true,
|
87
|
+
value: void 0
|
88
|
+
},
|
89
|
+
aggregateErrors: {
|
90
|
+
enumerable: true,
|
91
|
+
writable: true,
|
92
|
+
value: void 0
|
93
|
+
},
|
94
|
+
raw: {
|
95
|
+
enumerable: false,
|
96
|
+
get: function() {
|
97
|
+
return this[rawSymbol];
|
98
|
+
},
|
99
|
+
set: function(val) {
|
100
|
+
this[rawSymbol] = val;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
});
|
104
|
+
Object.defineProperty(pinoErrProto, rawSymbol, {
|
105
|
+
writable: true,
|
106
|
+
value: {}
|
107
|
+
});
|
108
|
+
module2.exports = {
|
109
|
+
pinoErrProto,
|
110
|
+
pinoErrorSymbols: {
|
111
|
+
seen,
|
112
|
+
rawSymbol
|
113
|
+
}
|
114
|
+
};
|
115
|
+
}
|
116
|
+
});
|
117
|
+
|
118
|
+
// node_modules/pino-std-serializers/lib/err.js
|
119
|
+
var require_err = __commonJS({
|
120
|
+
"node_modules/pino-std-serializers/lib/err.js"(exports2, module2) {
|
121
|
+
"use strict";
|
122
|
+
module2.exports = errSerializer;
|
123
|
+
var { messageWithCauses, stackWithCauses, isErrorLike } = require_err_helpers();
|
124
|
+
var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
|
125
|
+
var { seen } = pinoErrorSymbols;
|
126
|
+
var { toString } = Object.prototype;
|
127
|
+
function errSerializer(err) {
|
128
|
+
if (!isErrorLike(err)) {
|
129
|
+
return err;
|
130
|
+
}
|
131
|
+
err[seen] = void 0;
|
132
|
+
const _err = Object.create(pinoErrProto);
|
133
|
+
_err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
|
134
|
+
_err.message = messageWithCauses(err);
|
135
|
+
_err.stack = stackWithCauses(err);
|
136
|
+
if (Array.isArray(err.errors)) {
|
137
|
+
_err.aggregateErrors = err.errors.map((err2) => errSerializer(err2));
|
138
|
+
}
|
139
|
+
for (const key in err) {
|
140
|
+
if (_err[key] === void 0) {
|
141
|
+
const val = err[key];
|
142
|
+
if (isErrorLike(val)) {
|
143
|
+
if (key !== "cause" && !Object.prototype.hasOwnProperty.call(val, seen)) {
|
144
|
+
_err[key] = errSerializer(val);
|
145
|
+
}
|
146
|
+
} else {
|
147
|
+
_err[key] = val;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
delete err[seen];
|
152
|
+
_err.raw = err;
|
153
|
+
return _err;
|
154
|
+
}
|
155
|
+
}
|
156
|
+
});
|
157
|
+
|
158
|
+
// node_modules/pino-std-serializers/lib/err-with-cause.js
|
159
|
+
var require_err_with_cause = __commonJS({
|
160
|
+
"node_modules/pino-std-serializers/lib/err-with-cause.js"(exports2, module2) {
|
161
|
+
"use strict";
|
162
|
+
module2.exports = errWithCauseSerializer;
|
163
|
+
var { isErrorLike } = require_err_helpers();
|
164
|
+
var { pinoErrProto, pinoErrorSymbols } = require_err_proto();
|
165
|
+
var { seen } = pinoErrorSymbols;
|
166
|
+
var { toString } = Object.prototype;
|
167
|
+
function errWithCauseSerializer(err) {
|
168
|
+
if (!isErrorLike(err)) {
|
169
|
+
return err;
|
170
|
+
}
|
171
|
+
err[seen] = void 0;
|
172
|
+
const _err = Object.create(pinoErrProto);
|
173
|
+
_err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
|
174
|
+
_err.message = err.message;
|
175
|
+
_err.stack = err.stack;
|
176
|
+
if (Array.isArray(err.errors)) {
|
177
|
+
_err.aggregateErrors = err.errors.map((err2) => errWithCauseSerializer(err2));
|
178
|
+
}
|
179
|
+
if (isErrorLike(err.cause) && !Object.prototype.hasOwnProperty.call(err.cause, seen)) {
|
180
|
+
_err.cause = errWithCauseSerializer(err.cause);
|
181
|
+
}
|
182
|
+
for (const key in err) {
|
183
|
+
if (_err[key] === void 0) {
|
184
|
+
const val = err[key];
|
185
|
+
if (isErrorLike(val)) {
|
186
|
+
if (!Object.prototype.hasOwnProperty.call(val, seen)) {
|
187
|
+
_err[key] = errWithCauseSerializer(val);
|
188
|
+
}
|
189
|
+
} else {
|
190
|
+
_err[key] = val;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
}
|
194
|
+
delete err[seen];
|
195
|
+
_err.raw = err;
|
196
|
+
return _err;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
});
|
200
|
+
|
201
|
+
// node_modules/pino-std-serializers/lib/req.js
|
202
|
+
var require_req = __commonJS({
|
203
|
+
"node_modules/pino-std-serializers/lib/req.js"(exports2, module2) {
|
204
|
+
"use strict";
|
205
|
+
module2.exports = {
|
206
|
+
mapHttpRequest,
|
207
|
+
reqSerializer
|
208
|
+
};
|
209
|
+
var rawSymbol = Symbol("pino-raw-req-ref");
|
210
|
+
var pinoReqProto = Object.create({}, {
|
211
|
+
id: {
|
212
|
+
enumerable: true,
|
213
|
+
writable: true,
|
214
|
+
value: ""
|
215
|
+
},
|
216
|
+
method: {
|
217
|
+
enumerable: true,
|
218
|
+
writable: true,
|
219
|
+
value: ""
|
220
|
+
},
|
221
|
+
url: {
|
222
|
+
enumerable: true,
|
223
|
+
writable: true,
|
224
|
+
value: ""
|
225
|
+
},
|
226
|
+
query: {
|
227
|
+
enumerable: true,
|
228
|
+
writable: true,
|
229
|
+
value: ""
|
230
|
+
},
|
231
|
+
params: {
|
232
|
+
enumerable: true,
|
233
|
+
writable: true,
|
234
|
+
value: ""
|
235
|
+
},
|
236
|
+
headers: {
|
237
|
+
enumerable: true,
|
238
|
+
writable: true,
|
239
|
+
value: {}
|
240
|
+
},
|
241
|
+
remoteAddress: {
|
242
|
+
enumerable: true,
|
243
|
+
writable: true,
|
244
|
+
value: ""
|
245
|
+
},
|
246
|
+
remotePort: {
|
247
|
+
enumerable: true,
|
248
|
+
writable: true,
|
249
|
+
value: ""
|
250
|
+
},
|
251
|
+
raw: {
|
252
|
+
enumerable: false,
|
253
|
+
get: function() {
|
254
|
+
return this[rawSymbol];
|
255
|
+
},
|
256
|
+
set: function(val) {
|
257
|
+
this[rawSymbol] = val;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
});
|
261
|
+
Object.defineProperty(pinoReqProto, rawSymbol, {
|
262
|
+
writable: true,
|
263
|
+
value: {}
|
264
|
+
});
|
265
|
+
function reqSerializer(req) {
|
266
|
+
const connection = req.info || req.socket;
|
267
|
+
const _req = Object.create(pinoReqProto);
|
268
|
+
_req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0);
|
269
|
+
_req.method = req.method;
|
270
|
+
if (req.originalUrl) {
|
271
|
+
_req.url = req.originalUrl;
|
272
|
+
} else {
|
273
|
+
const path = req.path;
|
274
|
+
_req.url = typeof path === "string" ? path : req.url ? req.url.path || req.url : void 0;
|
275
|
+
}
|
276
|
+
if (req.query) {
|
277
|
+
_req.query = req.query;
|
278
|
+
}
|
279
|
+
if (req.params) {
|
280
|
+
_req.params = req.params;
|
281
|
+
}
|
282
|
+
_req.headers = req.headers;
|
283
|
+
_req.remoteAddress = connection && connection.remoteAddress;
|
284
|
+
_req.remotePort = connection && connection.remotePort;
|
285
|
+
_req.raw = req.raw || req;
|
286
|
+
return _req;
|
287
|
+
}
|
288
|
+
function mapHttpRequest(req) {
|
289
|
+
return {
|
290
|
+
req: reqSerializer(req)
|
291
|
+
};
|
292
|
+
}
|
293
|
+
}
|
294
|
+
});
|
295
|
+
|
296
|
+
// node_modules/pino-std-serializers/lib/res.js
|
297
|
+
var require_res = __commonJS({
|
298
|
+
"node_modules/pino-std-serializers/lib/res.js"(exports2, module2) {
|
299
|
+
"use strict";
|
300
|
+
module2.exports = {
|
301
|
+
mapHttpResponse,
|
302
|
+
resSerializer
|
303
|
+
};
|
304
|
+
var rawSymbol = Symbol("pino-raw-res-ref");
|
305
|
+
var pinoResProto = Object.create({}, {
|
306
|
+
statusCode: {
|
307
|
+
enumerable: true,
|
308
|
+
writable: true,
|
309
|
+
value: 0
|
310
|
+
},
|
311
|
+
headers: {
|
312
|
+
enumerable: true,
|
313
|
+
writable: true,
|
314
|
+
value: ""
|
315
|
+
},
|
316
|
+
raw: {
|
317
|
+
enumerable: false,
|
318
|
+
get: function() {
|
319
|
+
return this[rawSymbol];
|
320
|
+
},
|
321
|
+
set: function(val) {
|
322
|
+
this[rawSymbol] = val;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
});
|
326
|
+
Object.defineProperty(pinoResProto, rawSymbol, {
|
327
|
+
writable: true,
|
328
|
+
value: {}
|
329
|
+
});
|
330
|
+
function resSerializer(res) {
|
331
|
+
const _res = Object.create(pinoResProto);
|
332
|
+
_res.statusCode = res.headersSent ? res.statusCode : null;
|
333
|
+
_res.headers = res.getHeaders ? res.getHeaders() : res._headers;
|
334
|
+
_res.raw = res;
|
335
|
+
return _res;
|
336
|
+
}
|
337
|
+
function mapHttpResponse(res) {
|
338
|
+
return {
|
339
|
+
res: resSerializer(res)
|
340
|
+
};
|
341
|
+
}
|
342
|
+
}
|
343
|
+
});
|
344
|
+
|
345
|
+
// node_modules/pino-std-serializers/index.js
|
346
|
+
var require_pino_std_serializers = __commonJS({
|
347
|
+
"node_modules/pino-std-serializers/index.js"(exports2, module2) {
|
348
|
+
"use strict";
|
349
|
+
var errSerializer = require_err();
|
350
|
+
var errWithCauseSerializer = require_err_with_cause();
|
351
|
+
var reqSerializers = require_req();
|
352
|
+
var resSerializers = require_res();
|
353
|
+
module2.exports = {
|
354
|
+
err: errSerializer,
|
355
|
+
errWithCause: errWithCauseSerializer,
|
356
|
+
mapHttpRequest: reqSerializers.mapHttpRequest,
|
357
|
+
mapHttpResponse: resSerializers.mapHttpResponse,
|
358
|
+
req: reqSerializers.reqSerializer,
|
359
|
+
res: resSerializers.resSerializer,
|
360
|
+
wrapErrorSerializer: function wrapErrorSerializer(customSerializer) {
|
361
|
+
if (customSerializer === errSerializer)
|
362
|
+
return customSerializer;
|
363
|
+
return function wrapErrSerializer(err) {
|
364
|
+
return customSerializer(errSerializer(err));
|
365
|
+
};
|
366
|
+
},
|
367
|
+
wrapRequestSerializer: function wrapRequestSerializer(customSerializer) {
|
368
|
+
if (customSerializer === reqSerializers.reqSerializer)
|
369
|
+
return customSerializer;
|
370
|
+
return function wrappedReqSerializer(req) {
|
371
|
+
return customSerializer(reqSerializers.reqSerializer(req));
|
372
|
+
};
|
373
|
+
},
|
374
|
+
wrapResponseSerializer: function wrapResponseSerializer(customSerializer) {
|
375
|
+
if (customSerializer === resSerializers.resSerializer)
|
376
|
+
return customSerializer;
|
377
|
+
return function wrappedResSerializer(res) {
|
378
|
+
return customSerializer(resSerializers.resSerializer(res));
|
379
|
+
};
|
380
|
+
}
|
381
|
+
};
|
382
|
+
}
|
383
|
+
});
|
384
|
+
|
385
|
+
// node_modules/pino/lib/caller.js
|
386
|
+
var require_caller = __commonJS({
|
387
|
+
"node_modules/pino/lib/caller.js"(exports2, module2) {
|
388
|
+
"use strict";
|
389
|
+
function noOpPrepareStackTrace(_, stack) {
|
390
|
+
return stack;
|
391
|
+
}
|
392
|
+
module2.exports = function getCallers() {
|
393
|
+
const originalPrepare = Error.prepareStackTrace;
|
394
|
+
Error.prepareStackTrace = noOpPrepareStackTrace;
|
395
|
+
const stack = new Error().stack;
|
396
|
+
Error.prepareStackTrace = originalPrepare;
|
397
|
+
if (!Array.isArray(stack)) {
|
398
|
+
return void 0;
|
399
|
+
}
|
400
|
+
const entries = stack.slice(2);
|
401
|
+
const fileNames = [];
|
402
|
+
for (const entry of entries) {
|
403
|
+
if (!entry) {
|
404
|
+
continue;
|
405
|
+
}
|
406
|
+
fileNames.push(entry.getFileName());
|
407
|
+
}
|
408
|
+
return fileNames;
|
409
|
+
};
|
410
|
+
}
|
411
|
+
});
|
412
|
+
|
413
|
+
// node_modules/fast-redact/lib/validator.js
|
414
|
+
var require_validator = __commonJS({
|
415
|
+
"node_modules/fast-redact/lib/validator.js"(exports2, module2) {
|
416
|
+
"use strict";
|
417
|
+
module2.exports = validator;
|
418
|
+
function validator(opts = {}) {
|
419
|
+
const {
|
420
|
+
ERR_PATHS_MUST_BE_STRINGS = () => "fast-redact - Paths must be (non-empty) strings",
|
421
|
+
ERR_INVALID_PATH = (s) => `fast-redact \u2013 Invalid path (${s})`
|
422
|
+
} = opts;
|
423
|
+
return function validate({ paths }) {
|
424
|
+
paths.forEach((s) => {
|
425
|
+
if (typeof s !== "string") {
|
426
|
+
throw Error(ERR_PATHS_MUST_BE_STRINGS());
|
427
|
+
}
|
428
|
+
try {
|
429
|
+
if (/〇/.test(s))
|
430
|
+
throw Error();
|
431
|
+
const expr = (s[0] === "[" ? "" : ".") + s.replace(/^\*/, "\u3007").replace(/\.\*/g, ".\u3007").replace(/\[\*\]/g, "[\u3007]");
|
432
|
+
if (/\n|\r|;/.test(expr))
|
433
|
+
throw Error();
|
434
|
+
if (/\/\*/.test(expr))
|
435
|
+
throw Error();
|
436
|
+
Function(`
|
437
|
+
'use strict'
|
438
|
+
const o = new Proxy({}, { get: () => o, set: () => { throw Error() } });
|
439
|
+
const \u3007 = null;
|
440
|
+
o${expr}
|
441
|
+
if ([o${expr}].length !== 1) throw Error()`)();
|
442
|
+
} catch (e) {
|
443
|
+
throw Error(ERR_INVALID_PATH(s));
|
444
|
+
}
|
445
|
+
});
|
446
|
+
};
|
447
|
+
}
|
448
|
+
}
|
449
|
+
});
|
450
|
+
|
451
|
+
// node_modules/fast-redact/lib/rx.js
|
452
|
+
var require_rx = __commonJS({
|
453
|
+
"node_modules/fast-redact/lib/rx.js"(exports2, module2) {
|
454
|
+
"use strict";
|
455
|
+
module2.exports = /[^.[\]]+|\[((?:.)*?)\]/g;
|
456
|
+
}
|
457
|
+
});
|
458
|
+
|
459
|
+
// node_modules/fast-redact/lib/parse.js
|
460
|
+
var require_parse = __commonJS({
|
461
|
+
"node_modules/fast-redact/lib/parse.js"(exports2, module2) {
|
462
|
+
"use strict";
|
463
|
+
var rx = require_rx();
|
464
|
+
module2.exports = parse;
|
465
|
+
function parse({ paths }) {
|
466
|
+
const wildcards = [];
|
467
|
+
var wcLen = 0;
|
468
|
+
const secret = paths.reduce(function(o, strPath, ix) {
|
469
|
+
var path = strPath.match(rx).map((p) => p.replace(/'|"|`/g, ""));
|
470
|
+
const leadingBracket = strPath[0] === "[";
|
471
|
+
path = path.map((p) => {
|
472
|
+
if (p[0] === "[")
|
473
|
+
return p.substr(1, p.length - 2);
|
474
|
+
else
|
475
|
+
return p;
|
476
|
+
});
|
477
|
+
const star = path.indexOf("*");
|
478
|
+
if (star > -1) {
|
479
|
+
const before = path.slice(0, star);
|
480
|
+
const beforeStr = before.join(".");
|
481
|
+
const after = path.slice(star + 1, path.length);
|
482
|
+
const nested = after.length > 0;
|
483
|
+
wcLen++;
|
484
|
+
wildcards.push({
|
485
|
+
before,
|
486
|
+
beforeStr,
|
487
|
+
after,
|
488
|
+
nested
|
489
|
+
});
|
490
|
+
} else {
|
491
|
+
o[strPath] = {
|
492
|
+
path,
|
493
|
+
val: void 0,
|
494
|
+
precensored: false,
|
495
|
+
circle: "",
|
496
|
+
escPath: JSON.stringify(strPath),
|
497
|
+
leadingBracket
|
498
|
+
};
|
499
|
+
}
|
500
|
+
return o;
|
501
|
+
}, {});
|
502
|
+
return { wildcards, wcLen, secret };
|
503
|
+
}
|
504
|
+
}
|
505
|
+
});
|
506
|
+
|
507
|
+
// node_modules/fast-redact/lib/redactor.js
|
508
|
+
var require_redactor = __commonJS({
|
509
|
+
"node_modules/fast-redact/lib/redactor.js"(exports2, module2) {
|
510
|
+
"use strict";
|
511
|
+
var rx = require_rx();
|
512
|
+
module2.exports = redactor;
|
513
|
+
function redactor({ secret, serialize, wcLen, strict, isCensorFct, censorFctTakesPath }, state) {
|
514
|
+
const redact = Function("o", `
|
515
|
+
if (typeof o !== 'object' || o == null) {
|
516
|
+
${strictImpl(strict, serialize)}
|
517
|
+
}
|
518
|
+
const { censor, secret } = this
|
519
|
+
${redactTmpl(secret, isCensorFct, censorFctTakesPath)}
|
520
|
+
this.compileRestore()
|
521
|
+
${dynamicRedactTmpl(wcLen > 0, isCensorFct, censorFctTakesPath)}
|
522
|
+
${resultTmpl(serialize)}
|
523
|
+
`).bind(state);
|
524
|
+
if (serialize === false) {
|
525
|
+
redact.restore = (o) => state.restore(o);
|
526
|
+
}
|
527
|
+
return redact;
|
528
|
+
}
|
529
|
+
function redactTmpl(secret, isCensorFct, censorFctTakesPath) {
|
530
|
+
return Object.keys(secret).map((path) => {
|
531
|
+
const { escPath, leadingBracket, path: arrPath } = secret[path];
|
532
|
+
const skip = leadingBracket ? 1 : 0;
|
533
|
+
const delim = leadingBracket ? "" : ".";
|
534
|
+
const hops = [];
|
535
|
+
var match;
|
536
|
+
while ((match = rx.exec(path)) !== null) {
|
537
|
+
const [, ix] = match;
|
538
|
+
const { index, input } = match;
|
539
|
+
if (index > skip)
|
540
|
+
hops.push(input.substring(0, index - (ix ? 0 : 1)));
|
541
|
+
}
|
542
|
+
var existence = hops.map((p) => `o${delim}${p}`).join(" && ");
|
543
|
+
if (existence.length === 0)
|
544
|
+
existence += `o${delim}${path} != null`;
|
545
|
+
else
|
546
|
+
existence += ` && o${delim}${path} != null`;
|
547
|
+
const circularDetection = `
|
548
|
+
switch (true) {
|
549
|
+
${hops.reverse().map((p) => `
|
550
|
+
case o${delim}${p} === censor:
|
551
|
+
secret[${escPath}].circle = ${JSON.stringify(p)}
|
552
|
+
break
|
553
|
+
`).join("\n")}
|
554
|
+
}
|
555
|
+
`;
|
556
|
+
const censorArgs = censorFctTakesPath ? `val, ${JSON.stringify(arrPath)}` : `val`;
|
557
|
+
return `
|
558
|
+
if (${existence}) {
|
559
|
+
const val = o${delim}${path}
|
560
|
+
if (val === censor) {
|
561
|
+
secret[${escPath}].precensored = true
|
562
|
+
} else {
|
563
|
+
secret[${escPath}].val = val
|
564
|
+
o${delim}${path} = ${isCensorFct ? `censor(${censorArgs})` : "censor"}
|
565
|
+
${circularDetection}
|
566
|
+
}
|
567
|
+
}
|
568
|
+
`;
|
569
|
+
}).join("\n");
|
570
|
+
}
|
571
|
+
function dynamicRedactTmpl(hasWildcards, isCensorFct, censorFctTakesPath) {
|
572
|
+
return hasWildcards === true ? `
|
573
|
+
{
|
574
|
+
const { wildcards, wcLen, groupRedact, nestedRedact } = this
|
575
|
+
for (var i = 0; i < wcLen; i++) {
|
576
|
+
const { before, beforeStr, after, nested } = wildcards[i]
|
577
|
+
if (nested === true) {
|
578
|
+
secret[beforeStr] = secret[beforeStr] || []
|
579
|
+
nestedRedact(secret[beforeStr], o, before, after, censor, ${isCensorFct}, ${censorFctTakesPath})
|
580
|
+
} else secret[beforeStr] = groupRedact(o, before, censor, ${isCensorFct}, ${censorFctTakesPath})
|
581
|
+
}
|
582
|
+
}
|
583
|
+
` : "";
|
584
|
+
}
|
585
|
+
function resultTmpl(serialize) {
|
586
|
+
return serialize === false ? `return o` : `
|
587
|
+
var s = this.serialize(o)
|
588
|
+
this.restore(o)
|
589
|
+
return s
|
590
|
+
`;
|
591
|
+
}
|
592
|
+
function strictImpl(strict, serialize) {
|
593
|
+
return strict === true ? `throw Error('fast-redact: primitives cannot be redacted')` : serialize === false ? `return o` : `return this.serialize(o)`;
|
594
|
+
}
|
595
|
+
}
|
596
|
+
});
|
597
|
+
|
598
|
+
// node_modules/fast-redact/lib/modifiers.js
|
599
|
+
var require_modifiers = __commonJS({
|
600
|
+
"node_modules/fast-redact/lib/modifiers.js"(exports2, module2) {
|
601
|
+
"use strict";
|
602
|
+
module2.exports = {
|
603
|
+
groupRedact,
|
604
|
+
groupRestore,
|
605
|
+
nestedRedact,
|
606
|
+
nestedRestore
|
607
|
+
};
|
608
|
+
function groupRestore({ keys, values, target }) {
|
609
|
+
if (target == null)
|
610
|
+
return;
|
611
|
+
const length = keys.length;
|
612
|
+
for (var i = 0; i < length; i++) {
|
613
|
+
const k = keys[i];
|
614
|
+
target[k] = values[i];
|
615
|
+
}
|
616
|
+
}
|
617
|
+
function groupRedact(o, path, censor, isCensorFct, censorFctTakesPath) {
|
618
|
+
const target = get(o, path);
|
619
|
+
if (target == null)
|
620
|
+
return { keys: null, values: null, target: null, flat: true };
|
621
|
+
const keys = Object.keys(target);
|
622
|
+
const keysLength = keys.length;
|
623
|
+
const pathLength = path.length;
|
624
|
+
const pathWithKey = censorFctTakesPath ? [...path] : void 0;
|
625
|
+
const values = new Array(keysLength);
|
626
|
+
for (var i = 0; i < keysLength; i++) {
|
627
|
+
const key = keys[i];
|
628
|
+
values[i] = target[key];
|
629
|
+
if (censorFctTakesPath) {
|
630
|
+
pathWithKey[pathLength] = key;
|
631
|
+
target[key] = censor(target[key], pathWithKey);
|
632
|
+
} else if (isCensorFct) {
|
633
|
+
target[key] = censor(target[key]);
|
634
|
+
} else {
|
635
|
+
target[key] = censor;
|
636
|
+
}
|
637
|
+
}
|
638
|
+
return { keys, values, target, flat: true };
|
639
|
+
}
|
640
|
+
function nestedRestore(arr) {
|
641
|
+
const length = arr.length;
|
642
|
+
for (var i = 0; i < length; i++) {
|
643
|
+
const { key, target, value, level } = arr[i];
|
644
|
+
if (level === 0 || level === 1) {
|
645
|
+
if (has(target, key)) {
|
646
|
+
target[key] = value;
|
647
|
+
}
|
648
|
+
if (typeof target === "object") {
|
649
|
+
const targetKeys = Object.keys(target);
|
650
|
+
for (var j = 0; j < targetKeys.length; j++) {
|
651
|
+
const tKey = targetKeys[j];
|
652
|
+
const subTarget = target[tKey];
|
653
|
+
if (has(subTarget, key)) {
|
654
|
+
subTarget[key] = value;
|
655
|
+
}
|
656
|
+
}
|
657
|
+
}
|
658
|
+
} else {
|
659
|
+
restoreNthLevel(key, target, value, level);
|
660
|
+
}
|
661
|
+
}
|
662
|
+
}
|
663
|
+
function nestedRedact(store, o, path, ns, censor, isCensorFct, censorFctTakesPath) {
|
664
|
+
const target = get(o, path);
|
665
|
+
if (target == null)
|
666
|
+
return;
|
667
|
+
const keys = Object.keys(target);
|
668
|
+
const keysLength = keys.length;
|
669
|
+
for (var i = 0; i < keysLength; i++) {
|
670
|
+
const key = keys[i];
|
671
|
+
const { value, parent, exists, level } = specialSet(target, key, path, ns, censor, isCensorFct, censorFctTakesPath);
|
672
|
+
if (exists === true && parent !== null) {
|
673
|
+
store.push({ key: ns[ns.length - 1], target: parent, value, level });
|
674
|
+
}
|
675
|
+
}
|
676
|
+
return store;
|
677
|
+
}
|
678
|
+
function has(obj, prop) {
|
679
|
+
return obj !== void 0 && obj !== null ? "hasOwn" in Object ? Object.hasOwn(obj, prop) : Object.prototype.hasOwnProperty.call(obj, prop) : false;
|
680
|
+
}
|
681
|
+
function specialSet(o, k, path, afterPath, censor, isCensorFct, censorFctTakesPath) {
|
682
|
+
const afterPathLen = afterPath.length;
|
683
|
+
const lastPathIndex = afterPathLen - 1;
|
684
|
+
const originalKey = k;
|
685
|
+
var i = -1;
|
686
|
+
var n;
|
687
|
+
var nv;
|
688
|
+
var ov;
|
689
|
+
var oov = null;
|
690
|
+
var exists = true;
|
691
|
+
var wc = null;
|
692
|
+
var kIsWc;
|
693
|
+
var wcov;
|
694
|
+
var consecutive = false;
|
695
|
+
var level = 0;
|
696
|
+
ov = n = o[k];
|
697
|
+
if (typeof n !== "object")
|
698
|
+
return { value: null, parent: null, exists };
|
699
|
+
while (n != null && ++i < afterPathLen) {
|
700
|
+
k = afterPath[i];
|
701
|
+
oov = ov;
|
702
|
+
if (k !== "*" && !wc && !(typeof n === "object" && k in n)) {
|
703
|
+
exists = false;
|
704
|
+
break;
|
705
|
+
}
|
706
|
+
if (k === "*") {
|
707
|
+
if (wc === "*") {
|
708
|
+
consecutive = true;
|
709
|
+
}
|
710
|
+
wc = k;
|
711
|
+
if (i !== lastPathIndex) {
|
712
|
+
continue;
|
713
|
+
}
|
714
|
+
}
|
715
|
+
if (wc) {
|
716
|
+
const wcKeys = Object.keys(n);
|
717
|
+
for (var j = 0; j < wcKeys.length; j++) {
|
718
|
+
const wck = wcKeys[j];
|
719
|
+
wcov = n[wck];
|
720
|
+
kIsWc = k === "*";
|
721
|
+
if (consecutive) {
|
722
|
+
level = i;
|
723
|
+
ov = iterateNthLevel(wcov, level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, exists);
|
724
|
+
} else {
|
725
|
+
if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
|
726
|
+
if (kIsWc) {
|
727
|
+
ov = wcov;
|
728
|
+
} else {
|
729
|
+
ov = wcov[k];
|
730
|
+
}
|
731
|
+
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
|
732
|
+
if (kIsWc) {
|
733
|
+
n[wck] = nv;
|
734
|
+
} else {
|
735
|
+
if (wcov[k] === nv) {
|
736
|
+
exists = false;
|
737
|
+
} else {
|
738
|
+
wcov[k] = nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov ? wcov[k] : nv;
|
739
|
+
}
|
740
|
+
}
|
741
|
+
}
|
742
|
+
}
|
743
|
+
}
|
744
|
+
wc = null;
|
745
|
+
} else {
|
746
|
+
ov = n[k];
|
747
|
+
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
|
748
|
+
n[k] = has(n, k) && nv === ov || nv === void 0 && censor !== void 0 ? n[k] : nv;
|
749
|
+
n = n[k];
|
750
|
+
}
|
751
|
+
if (typeof n !== "object")
|
752
|
+
break;
|
753
|
+
if (ov === oov || typeof ov === "undefined") {
|
754
|
+
exists = false;
|
755
|
+
}
|
756
|
+
}
|
757
|
+
return { value: ov, parent: oov, exists, level };
|
758
|
+
}
|
759
|
+
function get(o, p) {
|
760
|
+
var i = -1;
|
761
|
+
var l = p.length;
|
762
|
+
var n = o;
|
763
|
+
while (n != null && ++i < l) {
|
764
|
+
n = n[p[i]];
|
765
|
+
}
|
766
|
+
return n;
|
767
|
+
}
|
768
|
+
function iterateNthLevel(wcov, level, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, exists) {
|
769
|
+
if (level === 0) {
|
770
|
+
if (kIsWc || typeof wcov === "object" && wcov !== null && k in wcov) {
|
771
|
+
if (kIsWc) {
|
772
|
+
ov = wcov;
|
773
|
+
} else {
|
774
|
+
ov = wcov[k];
|
775
|
+
}
|
776
|
+
nv = i !== lastPathIndex ? ov : isCensorFct ? censorFctTakesPath ? censor(ov, [...path, originalKey, ...afterPath]) : censor(ov) : censor;
|
777
|
+
if (kIsWc) {
|
778
|
+
n[wck] = nv;
|
779
|
+
} else {
|
780
|
+
if (wcov[k] === nv) {
|
781
|
+
exists = false;
|
782
|
+
} else {
|
783
|
+
wcov[k] = nv === void 0 && censor !== void 0 || has(wcov, k) && nv === ov ? wcov[k] : nv;
|
784
|
+
}
|
785
|
+
}
|
786
|
+
}
|
787
|
+
return ov;
|
788
|
+
}
|
789
|
+
for (const key in wcov) {
|
790
|
+
if (typeof wcov[key] === "object") {
|
791
|
+
var temp = iterateNthLevel(wcov[key], level - 1, k, path, afterPath, censor, isCensorFct, censorFctTakesPath, originalKey, n, nv, ov, kIsWc, wck, i, lastPathIndex, exists);
|
792
|
+
return temp;
|
793
|
+
}
|
794
|
+
}
|
795
|
+
}
|
796
|
+
function restoreNthLevel(key, target, value, level) {
|
797
|
+
if (level === 0) {
|
798
|
+
if (has(target, key)) {
|
799
|
+
target[key] = value;
|
800
|
+
}
|
801
|
+
return;
|
802
|
+
}
|
803
|
+
for (const objKey in target) {
|
804
|
+
if (typeof target[objKey] === "object") {
|
805
|
+
restoreNthLevel(key, target[objKey], value, level - 1);
|
806
|
+
}
|
807
|
+
}
|
808
|
+
}
|
809
|
+
}
|
810
|
+
});
|
811
|
+
|
812
|
+
// node_modules/fast-redact/lib/restorer.js
|
813
|
+
var require_restorer = __commonJS({
|
814
|
+
"node_modules/fast-redact/lib/restorer.js"(exports2, module2) {
|
815
|
+
"use strict";
|
816
|
+
var { groupRestore, nestedRestore } = require_modifiers();
|
817
|
+
module2.exports = restorer;
|
818
|
+
function restorer({ secret, wcLen }) {
|
819
|
+
return function compileRestore() {
|
820
|
+
if (this.restore)
|
821
|
+
return;
|
822
|
+
const paths = Object.keys(secret);
|
823
|
+
const resetters = resetTmpl(secret, paths);
|
824
|
+
const hasWildcards = wcLen > 0;
|
825
|
+
const state = hasWildcards ? { secret, groupRestore, nestedRestore } : { secret };
|
826
|
+
this.restore = Function(
|
827
|
+
"o",
|
828
|
+
restoreTmpl(resetters, paths, hasWildcards)
|
829
|
+
).bind(state);
|
830
|
+
};
|
831
|
+
}
|
832
|
+
function resetTmpl(secret, paths) {
|
833
|
+
return paths.map((path) => {
|
834
|
+
const { circle, escPath, leadingBracket } = secret[path];
|
835
|
+
const delim = leadingBracket ? "" : ".";
|
836
|
+
const reset = circle ? `o.${circle} = secret[${escPath}].val` : `o${delim}${path} = secret[${escPath}].val`;
|
837
|
+
const clear = `secret[${escPath}].val = undefined`;
|
838
|
+
return `
|
839
|
+
if (secret[${escPath}].val !== undefined) {
|
840
|
+
try { ${reset} } catch (e) {}
|
841
|
+
${clear}
|
842
|
+
}
|
843
|
+
`;
|
844
|
+
}).join("");
|
845
|
+
}
|
846
|
+
function restoreTmpl(resetters, paths, hasWildcards) {
|
847
|
+
const dynamicReset = hasWildcards === true ? `
|
848
|
+
const keys = Object.keys(secret)
|
849
|
+
const len = keys.length
|
850
|
+
for (var i = len - 1; i >= ${paths.length}; i--) {
|
851
|
+
const k = keys[i]
|
852
|
+
const o = secret[k]
|
853
|
+
if (o.flat === true) this.groupRestore(o)
|
854
|
+
else this.nestedRestore(o)
|
855
|
+
secret[k] = null
|
856
|
+
}
|
857
|
+
` : "";
|
858
|
+
return `
|
859
|
+
const secret = this.secret
|
860
|
+
${dynamicReset}
|
861
|
+
${resetters}
|
862
|
+
return o
|
863
|
+
`;
|
864
|
+
}
|
865
|
+
}
|
866
|
+
});
|
867
|
+
|
868
|
+
// node_modules/fast-redact/lib/state.js
|
869
|
+
var require_state = __commonJS({
|
870
|
+
"node_modules/fast-redact/lib/state.js"(exports2, module2) {
|
871
|
+
"use strict";
|
872
|
+
module2.exports = state;
|
873
|
+
function state(o) {
|
874
|
+
const {
|
875
|
+
secret,
|
876
|
+
censor,
|
877
|
+
compileRestore,
|
878
|
+
serialize,
|
879
|
+
groupRedact,
|
880
|
+
nestedRedact,
|
881
|
+
wildcards,
|
882
|
+
wcLen
|
883
|
+
} = o;
|
884
|
+
const builder = [{ secret, censor, compileRestore }];
|
885
|
+
if (serialize !== false)
|
886
|
+
builder.push({ serialize });
|
887
|
+
if (wcLen > 0)
|
888
|
+
builder.push({ groupRedact, nestedRedact, wildcards, wcLen });
|
889
|
+
return Object.assign(...builder);
|
890
|
+
}
|
891
|
+
}
|
892
|
+
});
|
893
|
+
|
894
|
+
// node_modules/fast-redact/index.js
|
895
|
+
var require_fast_redact = __commonJS({
|
896
|
+
"node_modules/fast-redact/index.js"(exports2, module2) {
|
897
|
+
"use strict";
|
898
|
+
var validator = require_validator();
|
899
|
+
var parse = require_parse();
|
900
|
+
var redactor = require_redactor();
|
901
|
+
var restorer = require_restorer();
|
902
|
+
var { groupRedact, nestedRedact } = require_modifiers();
|
903
|
+
var state = require_state();
|
904
|
+
var rx = require_rx();
|
905
|
+
var validate = validator();
|
906
|
+
var noop = (o) => o;
|
907
|
+
noop.restore = noop;
|
908
|
+
var DEFAULT_CENSOR = "[REDACTED]";
|
909
|
+
fastRedact.rx = rx;
|
910
|
+
fastRedact.validator = validator;
|
911
|
+
module2.exports = fastRedact;
|
912
|
+
function fastRedact(opts = {}) {
|
913
|
+
const paths = Array.from(new Set(opts.paths || []));
|
914
|
+
const serialize = "serialize" in opts ? opts.serialize === false ? opts.serialize : typeof opts.serialize === "function" ? opts.serialize : JSON.stringify : JSON.stringify;
|
915
|
+
const remove = opts.remove;
|
916
|
+
if (remove === true && serialize !== JSON.stringify) {
|
917
|
+
throw Error("fast-redact \u2013 remove option may only be set when serializer is JSON.stringify");
|
918
|
+
}
|
919
|
+
const censor = remove === true ? void 0 : "censor" in opts ? opts.censor : DEFAULT_CENSOR;
|
920
|
+
const isCensorFct = typeof censor === "function";
|
921
|
+
const censorFctTakesPath = isCensorFct && censor.length > 1;
|
922
|
+
if (paths.length === 0)
|
923
|
+
return serialize || noop;
|
924
|
+
validate({ paths, serialize, censor });
|
925
|
+
const { wildcards, wcLen, secret } = parse({ paths, censor });
|
926
|
+
const compileRestore = restorer({ secret, wcLen });
|
927
|
+
const strict = "strict" in opts ? opts.strict : true;
|
928
|
+
return redactor({ secret, wcLen, serialize, strict, isCensorFct, censorFctTakesPath }, state({
|
929
|
+
secret,
|
930
|
+
censor,
|
931
|
+
compileRestore,
|
932
|
+
serialize,
|
933
|
+
groupRedact,
|
934
|
+
nestedRedact,
|
935
|
+
wildcards,
|
936
|
+
wcLen
|
937
|
+
}));
|
938
|
+
}
|
939
|
+
}
|
940
|
+
});
|
941
|
+
|
942
|
+
// node_modules/pino/lib/symbols.js
|
943
|
+
var require_symbols = __commonJS({
|
944
|
+
"node_modules/pino/lib/symbols.js"(exports2, module2) {
|
945
|
+
"use strict";
|
946
|
+
var setLevelSym = Symbol("pino.setLevel");
|
947
|
+
var getLevelSym = Symbol("pino.getLevel");
|
948
|
+
var levelValSym = Symbol("pino.levelVal");
|
949
|
+
var levelCompSym = Symbol("pino.levelComp");
|
950
|
+
var useLevelLabelsSym = Symbol("pino.useLevelLabels");
|
951
|
+
var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels");
|
952
|
+
var mixinSym = Symbol("pino.mixin");
|
953
|
+
var lsCacheSym = Symbol("pino.lsCache");
|
954
|
+
var chindingsSym = Symbol("pino.chindings");
|
955
|
+
var asJsonSym = Symbol("pino.asJson");
|
956
|
+
var writeSym = Symbol("pino.write");
|
957
|
+
var redactFmtSym = Symbol("pino.redactFmt");
|
958
|
+
var timeSym = Symbol("pino.time");
|
959
|
+
var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
|
960
|
+
var streamSym = Symbol("pino.stream");
|
961
|
+
var stringifySym = Symbol("pino.stringify");
|
962
|
+
var stringifySafeSym = Symbol("pino.stringifySafe");
|
963
|
+
var stringifiersSym = Symbol("pino.stringifiers");
|
964
|
+
var endSym = Symbol("pino.end");
|
965
|
+
var formatOptsSym = Symbol("pino.formatOpts");
|
966
|
+
var messageKeySym = Symbol("pino.messageKey");
|
967
|
+
var errorKeySym = Symbol("pino.errorKey");
|
968
|
+
var nestedKeySym = Symbol("pino.nestedKey");
|
969
|
+
var nestedKeyStrSym = Symbol("pino.nestedKeyStr");
|
970
|
+
var mixinMergeStrategySym = Symbol("pino.mixinMergeStrategy");
|
971
|
+
var msgPrefixSym = Symbol("pino.msgPrefix");
|
972
|
+
var wildcardFirstSym = Symbol("pino.wildcardFirst");
|
973
|
+
var serializersSym = Symbol.for("pino.serializers");
|
974
|
+
var formattersSym = Symbol.for("pino.formatters");
|
975
|
+
var hooksSym = Symbol.for("pino.hooks");
|
976
|
+
var needsMetadataGsym = Symbol.for("pino.metadata");
|
977
|
+
module2.exports = {
|
978
|
+
setLevelSym,
|
979
|
+
getLevelSym,
|
980
|
+
levelValSym,
|
981
|
+
levelCompSym,
|
982
|
+
useLevelLabelsSym,
|
983
|
+
mixinSym,
|
984
|
+
lsCacheSym,
|
985
|
+
chindingsSym,
|
986
|
+
asJsonSym,
|
987
|
+
writeSym,
|
988
|
+
serializersSym,
|
989
|
+
redactFmtSym,
|
990
|
+
timeSym,
|
991
|
+
timeSliceIndexSym,
|
992
|
+
streamSym,
|
993
|
+
stringifySym,
|
994
|
+
stringifySafeSym,
|
995
|
+
stringifiersSym,
|
996
|
+
endSym,
|
997
|
+
formatOptsSym,
|
998
|
+
messageKeySym,
|
999
|
+
errorKeySym,
|
1000
|
+
nestedKeySym,
|
1001
|
+
wildcardFirstSym,
|
1002
|
+
needsMetadataGsym,
|
1003
|
+
useOnlyCustomLevelsSym,
|
1004
|
+
formattersSym,
|
1005
|
+
hooksSym,
|
1006
|
+
nestedKeyStrSym,
|
1007
|
+
mixinMergeStrategySym,
|
1008
|
+
msgPrefixSym
|
1009
|
+
};
|
1010
|
+
}
|
1011
|
+
});
|
1012
|
+
|
1013
|
+
// node_modules/pino/lib/redaction.js
|
1014
|
+
var require_redaction = __commonJS({
|
1015
|
+
"node_modules/pino/lib/redaction.js"(exports2, module2) {
|
1016
|
+
"use strict";
|
1017
|
+
var fastRedact = require_fast_redact();
|
1018
|
+
var { redactFmtSym, wildcardFirstSym } = require_symbols();
|
1019
|
+
var { rx, validator } = fastRedact;
|
1020
|
+
var validate = validator({
|
1021
|
+
ERR_PATHS_MUST_BE_STRINGS: () => "pino \u2013 redacted paths must be strings",
|
1022
|
+
ERR_INVALID_PATH: (s) => `pino \u2013 redact paths array contains an invalid path (${s})`
|
1023
|
+
});
|
1024
|
+
var CENSOR = "[Redacted]";
|
1025
|
+
var strict = false;
|
1026
|
+
function redaction(opts, serialize) {
|
1027
|
+
const { paths, censor } = handle(opts);
|
1028
|
+
const shape = paths.reduce((o, str) => {
|
1029
|
+
rx.lastIndex = 0;
|
1030
|
+
const first = rx.exec(str);
|
1031
|
+
const next = rx.exec(str);
|
1032
|
+
let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
|
1033
|
+
if (ns === "*") {
|
1034
|
+
ns = wildcardFirstSym;
|
1035
|
+
}
|
1036
|
+
if (next === null) {
|
1037
|
+
o[ns] = null;
|
1038
|
+
return o;
|
1039
|
+
}
|
1040
|
+
if (o[ns] === null) {
|
1041
|
+
return o;
|
1042
|
+
}
|
1043
|
+
const { index } = next;
|
1044
|
+
const nextPath = `${str.substr(index, str.length - 1)}`;
|
1045
|
+
o[ns] = o[ns] || [];
|
1046
|
+
if (ns !== wildcardFirstSym && o[ns].length === 0) {
|
1047
|
+
o[ns].push(...o[wildcardFirstSym] || []);
|
1048
|
+
}
|
1049
|
+
if (ns === wildcardFirstSym) {
|
1050
|
+
Object.keys(o).forEach(function(k) {
|
1051
|
+
if (o[k]) {
|
1052
|
+
o[k].push(nextPath);
|
1053
|
+
}
|
1054
|
+
});
|
1055
|
+
}
|
1056
|
+
o[ns].push(nextPath);
|
1057
|
+
return o;
|
1058
|
+
}, {});
|
1059
|
+
const result = {
|
1060
|
+
[redactFmtSym]: fastRedact({ paths, censor, serialize, strict })
|
1061
|
+
};
|
1062
|
+
const topCensor = (...args) => {
|
1063
|
+
return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
|
1064
|
+
};
|
1065
|
+
return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
|
1066
|
+
if (shape[k] === null) {
|
1067
|
+
o[k] = (value) => topCensor(value, [k]);
|
1068
|
+
} else {
|
1069
|
+
const wrappedCensor = typeof censor === "function" ? (value, path) => {
|
1070
|
+
return censor(value, [k, ...path]);
|
1071
|
+
} : censor;
|
1072
|
+
o[k] = fastRedact({
|
1073
|
+
paths: shape[k],
|
1074
|
+
censor: wrappedCensor,
|
1075
|
+
serialize,
|
1076
|
+
strict
|
1077
|
+
});
|
1078
|
+
}
|
1079
|
+
return o;
|
1080
|
+
}, result);
|
1081
|
+
}
|
1082
|
+
function handle(opts) {
|
1083
|
+
if (Array.isArray(opts)) {
|
1084
|
+
opts = { paths: opts, censor: CENSOR };
|
1085
|
+
validate(opts);
|
1086
|
+
return opts;
|
1087
|
+
}
|
1088
|
+
let { paths, censor = CENSOR, remove } = opts;
|
1089
|
+
if (Array.isArray(paths) === false) {
|
1090
|
+
throw Error("pino \u2013 redact must contain an array of strings");
|
1091
|
+
}
|
1092
|
+
if (remove === true)
|
1093
|
+
censor = void 0;
|
1094
|
+
validate({ paths, censor });
|
1095
|
+
return { paths, censor };
|
1096
|
+
}
|
1097
|
+
module2.exports = redaction;
|
1098
|
+
}
|
1099
|
+
});
|
1100
|
+
|
1101
|
+
// node_modules/pino/lib/time.js
|
1102
|
+
var require_time = __commonJS({
|
1103
|
+
"node_modules/pino/lib/time.js"(exports2, module2) {
|
1104
|
+
"use strict";
|
1105
|
+
var nullTime = () => "";
|
1106
|
+
var epochTime = () => `,"time":${Date.now()}`;
|
1107
|
+
var unixTime = () => `,"time":${Math.round(Date.now() / 1e3)}`;
|
1108
|
+
var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
|
1109
|
+
module2.exports = { nullTime, epochTime, unixTime, isoTime };
|
1110
|
+
}
|
1111
|
+
});
|
1112
|
+
|
1113
|
+
// node_modules/quick-format-unescaped/index.js
|
1114
|
+
var require_quick_format_unescaped = __commonJS({
|
1115
|
+
"node_modules/quick-format-unescaped/index.js"(exports2, module2) {
|
1116
|
+
"use strict";
|
1117
|
+
function tryStringify(o) {
|
1118
|
+
try {
|
1119
|
+
return JSON.stringify(o);
|
1120
|
+
} catch (e) {
|
1121
|
+
return '"[Circular]"';
|
1122
|
+
}
|
1123
|
+
}
|
1124
|
+
module2.exports = format;
|
1125
|
+
function format(f, args, opts) {
|
1126
|
+
var ss = opts && opts.stringify || tryStringify;
|
1127
|
+
var offset = 1;
|
1128
|
+
if (typeof f === "object" && f !== null) {
|
1129
|
+
var len = args.length + offset;
|
1130
|
+
if (len === 1)
|
1131
|
+
return f;
|
1132
|
+
var objects = new Array(len);
|
1133
|
+
objects[0] = ss(f);
|
1134
|
+
for (var index = 1; index < len; index++) {
|
1135
|
+
objects[index] = ss(args[index]);
|
1136
|
+
}
|
1137
|
+
return objects.join(" ");
|
1138
|
+
}
|
1139
|
+
if (typeof f !== "string") {
|
1140
|
+
return f;
|
1141
|
+
}
|
1142
|
+
var argLen = args.length;
|
1143
|
+
if (argLen === 0)
|
1144
|
+
return f;
|
1145
|
+
var str = "";
|
1146
|
+
var a = 1 - offset;
|
1147
|
+
var lastPos = -1;
|
1148
|
+
var flen = f && f.length || 0;
|
1149
|
+
for (var i = 0; i < flen; ) {
|
1150
|
+
if (f.charCodeAt(i) === 37 && i + 1 < flen) {
|
1151
|
+
lastPos = lastPos > -1 ? lastPos : 0;
|
1152
|
+
switch (f.charCodeAt(i + 1)) {
|
1153
|
+
case 100:
|
1154
|
+
case 102:
|
1155
|
+
if (a >= argLen)
|
1156
|
+
break;
|
1157
|
+
if (args[a] == null)
|
1158
|
+
break;
|
1159
|
+
if (lastPos < i)
|
1160
|
+
str += f.slice(lastPos, i);
|
1161
|
+
str += Number(args[a]);
|
1162
|
+
lastPos = i + 2;
|
1163
|
+
i++;
|
1164
|
+
break;
|
1165
|
+
case 105:
|
1166
|
+
if (a >= argLen)
|
1167
|
+
break;
|
1168
|
+
if (args[a] == null)
|
1169
|
+
break;
|
1170
|
+
if (lastPos < i)
|
1171
|
+
str += f.slice(lastPos, i);
|
1172
|
+
str += Math.floor(Number(args[a]));
|
1173
|
+
lastPos = i + 2;
|
1174
|
+
i++;
|
1175
|
+
break;
|
1176
|
+
case 79:
|
1177
|
+
case 111:
|
1178
|
+
case 106:
|
1179
|
+
if (a >= argLen)
|
1180
|
+
break;
|
1181
|
+
if (args[a] === void 0)
|
1182
|
+
break;
|
1183
|
+
if (lastPos < i)
|
1184
|
+
str += f.slice(lastPos, i);
|
1185
|
+
var type = typeof args[a];
|
1186
|
+
if (type === "string") {
|
1187
|
+
str += "'" + args[a] + "'";
|
1188
|
+
lastPos = i + 2;
|
1189
|
+
i++;
|
1190
|
+
break;
|
1191
|
+
}
|
1192
|
+
if (type === "function") {
|
1193
|
+
str += args[a].name || "<anonymous>";
|
1194
|
+
lastPos = i + 2;
|
1195
|
+
i++;
|
1196
|
+
break;
|
1197
|
+
}
|
1198
|
+
str += ss(args[a]);
|
1199
|
+
lastPos = i + 2;
|
1200
|
+
i++;
|
1201
|
+
break;
|
1202
|
+
case 115:
|
1203
|
+
if (a >= argLen)
|
1204
|
+
break;
|
1205
|
+
if (lastPos < i)
|
1206
|
+
str += f.slice(lastPos, i);
|
1207
|
+
str += String(args[a]);
|
1208
|
+
lastPos = i + 2;
|
1209
|
+
i++;
|
1210
|
+
break;
|
1211
|
+
case 37:
|
1212
|
+
if (lastPos < i)
|
1213
|
+
str += f.slice(lastPos, i);
|
1214
|
+
str += "%";
|
1215
|
+
lastPos = i + 2;
|
1216
|
+
i++;
|
1217
|
+
a--;
|
1218
|
+
break;
|
1219
|
+
}
|
1220
|
+
++a;
|
1221
|
+
}
|
1222
|
+
++i;
|
1223
|
+
}
|
1224
|
+
if (lastPos === -1)
|
1225
|
+
return f;
|
1226
|
+
else if (lastPos < flen) {
|
1227
|
+
str += f.slice(lastPos);
|
1228
|
+
}
|
1229
|
+
return str;
|
1230
|
+
}
|
1231
|
+
}
|
1232
|
+
});
|
1233
|
+
|
1234
|
+
// node_modules/atomic-sleep/index.js
|
1235
|
+
var require_atomic_sleep = __commonJS({
|
1236
|
+
"node_modules/atomic-sleep/index.js"(exports2, module2) {
|
1237
|
+
"use strict";
|
1238
|
+
if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
|
1239
|
+
let sleep = function(ms) {
|
1240
|
+
const valid = ms > 0 && ms < Infinity;
|
1241
|
+
if (valid === false) {
|
1242
|
+
if (typeof ms !== "number" && typeof ms !== "bigint") {
|
1243
|
+
throw TypeError("sleep: ms must be a number");
|
1244
|
+
}
|
1245
|
+
throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
|
1246
|
+
}
|
1247
|
+
Atomics.wait(nil, 0, 0, Number(ms));
|
1248
|
+
};
|
1249
|
+
const nil = new Int32Array(new SharedArrayBuffer(4));
|
1250
|
+
module2.exports = sleep;
|
1251
|
+
} else {
|
1252
|
+
let sleep = function(ms) {
|
1253
|
+
const valid = ms > 0 && ms < Infinity;
|
1254
|
+
if (valid === false) {
|
1255
|
+
if (typeof ms !== "number" && typeof ms !== "bigint") {
|
1256
|
+
throw TypeError("sleep: ms must be a number");
|
1257
|
+
}
|
1258
|
+
throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
|
1259
|
+
}
|
1260
|
+
const target = Date.now() + Number(ms);
|
1261
|
+
while (target > Date.now()) {
|
1262
|
+
}
|
1263
|
+
};
|
1264
|
+
module2.exports = sleep;
|
1265
|
+
}
|
1266
|
+
}
|
1267
|
+
});
|
1268
|
+
|
1269
|
+
// node_modules/sonic-boom/index.js
|
1270
|
+
var require_sonic_boom = __commonJS({
|
1271
|
+
"node_modules/sonic-boom/index.js"(exports2, module2) {
|
1272
|
+
"use strict";
|
1273
|
+
var fs = require("fs");
|
1274
|
+
var EventEmitter = require("events");
|
1275
|
+
var inherits = require("util").inherits;
|
1276
|
+
var path = require("path");
|
1277
|
+
var sleep = require_atomic_sleep();
|
1278
|
+
var BUSY_WRITE_TIMEOUT = 100;
|
1279
|
+
var kEmptyBuffer = Buffer.allocUnsafe(0);
|
1280
|
+
var MAX_WRITE = 16 * 1024;
|
1281
|
+
var kContentModeBuffer = "buffer";
|
1282
|
+
var kContentModeUtf8 = "utf8";
|
1283
|
+
function openFile(file, sonic) {
|
1284
|
+
sonic._opening = true;
|
1285
|
+
sonic._writing = true;
|
1286
|
+
sonic._asyncDrainScheduled = false;
|
1287
|
+
function fileOpened(err, fd) {
|
1288
|
+
if (err) {
|
1289
|
+
sonic._reopening = false;
|
1290
|
+
sonic._writing = false;
|
1291
|
+
sonic._opening = false;
|
1292
|
+
if (sonic.sync) {
|
1293
|
+
process.nextTick(() => {
|
1294
|
+
if (sonic.listenerCount("error") > 0) {
|
1295
|
+
sonic.emit("error", err);
|
1296
|
+
}
|
1297
|
+
});
|
1298
|
+
} else {
|
1299
|
+
sonic.emit("error", err);
|
1300
|
+
}
|
1301
|
+
return;
|
1302
|
+
}
|
1303
|
+
sonic.fd = fd;
|
1304
|
+
sonic.file = file;
|
1305
|
+
sonic._reopening = false;
|
1306
|
+
sonic._opening = false;
|
1307
|
+
sonic._writing = false;
|
1308
|
+
if (sonic.sync) {
|
1309
|
+
process.nextTick(() => sonic.emit("ready"));
|
1310
|
+
} else {
|
1311
|
+
sonic.emit("ready");
|
1312
|
+
}
|
1313
|
+
if (sonic._reopening || sonic.destroyed) {
|
1314
|
+
return;
|
1315
|
+
}
|
1316
|
+
if (!sonic._writing && sonic._len > sonic.minLength || sonic._flushPending) {
|
1317
|
+
sonic._actualWrite();
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
const flags = sonic.append ? "a" : "w";
|
1321
|
+
const mode = sonic.mode;
|
1322
|
+
if (sonic.sync) {
|
1323
|
+
try {
|
1324
|
+
if (sonic.mkdir)
|
1325
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
1326
|
+
const fd = fs.openSync(file, flags, mode);
|
1327
|
+
fileOpened(null, fd);
|
1328
|
+
} catch (err) {
|
1329
|
+
fileOpened(err);
|
1330
|
+
throw err;
|
1331
|
+
}
|
1332
|
+
} else if (sonic.mkdir) {
|
1333
|
+
fs.mkdir(path.dirname(file), { recursive: true }, (err) => {
|
1334
|
+
if (err)
|
1335
|
+
return fileOpened(err);
|
1336
|
+
fs.open(file, flags, mode, fileOpened);
|
1337
|
+
});
|
1338
|
+
} else {
|
1339
|
+
fs.open(file, flags, mode, fileOpened);
|
1340
|
+
}
|
1341
|
+
}
|
1342
|
+
function SonicBoom(opts) {
|
1343
|
+
if (!(this instanceof SonicBoom)) {
|
1344
|
+
return new SonicBoom(opts);
|
1345
|
+
}
|
1346
|
+
let { fd, dest, minLength, maxLength, maxWrite, sync, append = true, mkdir, retryEAGAIN, fsync, contentMode, mode } = opts || {};
|
1347
|
+
fd = fd || dest;
|
1348
|
+
this._len = 0;
|
1349
|
+
this.fd = -1;
|
1350
|
+
this._bufs = [];
|
1351
|
+
this._lens = [];
|
1352
|
+
this._writing = false;
|
1353
|
+
this._ending = false;
|
1354
|
+
this._reopening = false;
|
1355
|
+
this._asyncDrainScheduled = false;
|
1356
|
+
this._flushPending = false;
|
1357
|
+
this._hwm = Math.max(minLength || 0, 16387);
|
1358
|
+
this.file = null;
|
1359
|
+
this.destroyed = false;
|
1360
|
+
this.minLength = minLength || 0;
|
1361
|
+
this.maxLength = maxLength || 0;
|
1362
|
+
this.maxWrite = maxWrite || MAX_WRITE;
|
1363
|
+
this.sync = sync || false;
|
1364
|
+
this.writable = true;
|
1365
|
+
this._fsync = fsync || false;
|
1366
|
+
this.append = append || false;
|
1367
|
+
this.mode = mode;
|
1368
|
+
this.retryEAGAIN = retryEAGAIN || (() => true);
|
1369
|
+
this.mkdir = mkdir || false;
|
1370
|
+
let fsWriteSync;
|
1371
|
+
let fsWrite;
|
1372
|
+
if (contentMode === kContentModeBuffer) {
|
1373
|
+
this._writingBuf = kEmptyBuffer;
|
1374
|
+
this.write = writeBuffer;
|
1375
|
+
this.flush = flushBuffer;
|
1376
|
+
this.flushSync = flushBufferSync;
|
1377
|
+
this._actualWrite = actualWriteBuffer;
|
1378
|
+
fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf);
|
1379
|
+
fsWrite = () => fs.write(this.fd, this._writingBuf, this.release);
|
1380
|
+
} else if (contentMode === void 0 || contentMode === kContentModeUtf8) {
|
1381
|
+
this._writingBuf = "";
|
1382
|
+
this.write = write;
|
1383
|
+
this.flush = flush;
|
1384
|
+
this.flushSync = flushSync;
|
1385
|
+
this._actualWrite = actualWrite;
|
1386
|
+
fsWriteSync = () => fs.writeSync(this.fd, this._writingBuf, "utf8");
|
1387
|
+
fsWrite = () => fs.write(this.fd, this._writingBuf, "utf8", this.release);
|
1388
|
+
} else {
|
1389
|
+
throw new Error(`SonicBoom supports "${kContentModeUtf8}" and "${kContentModeBuffer}", but passed ${contentMode}`);
|
1390
|
+
}
|
1391
|
+
if (typeof fd === "number") {
|
1392
|
+
this.fd = fd;
|
1393
|
+
process.nextTick(() => this.emit("ready"));
|
1394
|
+
} else if (typeof fd === "string") {
|
1395
|
+
openFile(fd, this);
|
1396
|
+
} else {
|
1397
|
+
throw new Error("SonicBoom supports only file descriptors and files");
|
1398
|
+
}
|
1399
|
+
if (this.minLength >= this.maxWrite) {
|
1400
|
+
throw new Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);
|
1401
|
+
}
|
1402
|
+
this.release = (err, n) => {
|
1403
|
+
if (err) {
|
1404
|
+
if ((err.code === "EAGAIN" || err.code === "EBUSY") && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
|
1405
|
+
if (this.sync) {
|
1406
|
+
try {
|
1407
|
+
sleep(BUSY_WRITE_TIMEOUT);
|
1408
|
+
this.release(void 0, 0);
|
1409
|
+
} catch (err2) {
|
1410
|
+
this.release(err2);
|
1411
|
+
}
|
1412
|
+
} else {
|
1413
|
+
setTimeout(fsWrite, BUSY_WRITE_TIMEOUT);
|
1414
|
+
}
|
1415
|
+
} else {
|
1416
|
+
this._writing = false;
|
1417
|
+
this.emit("error", err);
|
1418
|
+
}
|
1419
|
+
return;
|
1420
|
+
}
|
1421
|
+
this.emit("write", n);
|
1422
|
+
this._len -= n;
|
1423
|
+
if (this._len < 0) {
|
1424
|
+
this._len = 0;
|
1425
|
+
}
|
1426
|
+
this._writingBuf = this._writingBuf.slice(n);
|
1427
|
+
if (this._writingBuf.length) {
|
1428
|
+
if (!this.sync) {
|
1429
|
+
fsWrite();
|
1430
|
+
return;
|
1431
|
+
}
|
1432
|
+
try {
|
1433
|
+
do {
|
1434
|
+
const n2 = fsWriteSync();
|
1435
|
+
this._len -= n2;
|
1436
|
+
this._writingBuf = this._writingBuf.slice(n2);
|
1437
|
+
} while (this._writingBuf.length);
|
1438
|
+
} catch (err2) {
|
1439
|
+
this.release(err2);
|
1440
|
+
return;
|
1441
|
+
}
|
1442
|
+
}
|
1443
|
+
if (this._fsync) {
|
1444
|
+
fs.fsyncSync(this.fd);
|
1445
|
+
}
|
1446
|
+
const len = this._len;
|
1447
|
+
if (this._reopening) {
|
1448
|
+
this._writing = false;
|
1449
|
+
this._reopening = false;
|
1450
|
+
this.reopen();
|
1451
|
+
} else if (len > this.minLength) {
|
1452
|
+
this._actualWrite();
|
1453
|
+
} else if (this._ending) {
|
1454
|
+
if (len > 0) {
|
1455
|
+
this._actualWrite();
|
1456
|
+
} else {
|
1457
|
+
this._writing = false;
|
1458
|
+
actualClose(this);
|
1459
|
+
}
|
1460
|
+
} else {
|
1461
|
+
this._writing = false;
|
1462
|
+
if (this.sync) {
|
1463
|
+
if (!this._asyncDrainScheduled) {
|
1464
|
+
this._asyncDrainScheduled = true;
|
1465
|
+
process.nextTick(emitDrain, this);
|
1466
|
+
}
|
1467
|
+
} else {
|
1468
|
+
this.emit("drain");
|
1469
|
+
}
|
1470
|
+
}
|
1471
|
+
};
|
1472
|
+
this.on("newListener", function(name) {
|
1473
|
+
if (name === "drain") {
|
1474
|
+
this._asyncDrainScheduled = false;
|
1475
|
+
}
|
1476
|
+
});
|
1477
|
+
}
|
1478
|
+
function emitDrain(sonic) {
|
1479
|
+
const hasListeners = sonic.listenerCount("drain") > 0;
|
1480
|
+
if (!hasListeners)
|
1481
|
+
return;
|
1482
|
+
sonic._asyncDrainScheduled = false;
|
1483
|
+
sonic.emit("drain");
|
1484
|
+
}
|
1485
|
+
inherits(SonicBoom, EventEmitter);
|
1486
|
+
function mergeBuf(bufs, len) {
|
1487
|
+
if (bufs.length === 0) {
|
1488
|
+
return kEmptyBuffer;
|
1489
|
+
}
|
1490
|
+
if (bufs.length === 1) {
|
1491
|
+
return bufs[0];
|
1492
|
+
}
|
1493
|
+
return Buffer.concat(bufs, len);
|
1494
|
+
}
|
1495
|
+
function write(data) {
|
1496
|
+
if (this.destroyed) {
|
1497
|
+
throw new Error("SonicBoom destroyed");
|
1498
|
+
}
|
1499
|
+
const len = this._len + data.length;
|
1500
|
+
const bufs = this._bufs;
|
1501
|
+
if (this.maxLength && len > this.maxLength) {
|
1502
|
+
this.emit("drop", data);
|
1503
|
+
return this._len < this._hwm;
|
1504
|
+
}
|
1505
|
+
if (bufs.length === 0 || bufs[bufs.length - 1].length + data.length > this.maxWrite) {
|
1506
|
+
bufs.push("" + data);
|
1507
|
+
} else {
|
1508
|
+
bufs[bufs.length - 1] += data;
|
1509
|
+
}
|
1510
|
+
this._len = len;
|
1511
|
+
if (!this._writing && this._len >= this.minLength) {
|
1512
|
+
this._actualWrite();
|
1513
|
+
}
|
1514
|
+
return this._len < this._hwm;
|
1515
|
+
}
|
1516
|
+
function writeBuffer(data) {
|
1517
|
+
if (this.destroyed) {
|
1518
|
+
throw new Error("SonicBoom destroyed");
|
1519
|
+
}
|
1520
|
+
const len = this._len + data.length;
|
1521
|
+
const bufs = this._bufs;
|
1522
|
+
const lens = this._lens;
|
1523
|
+
if (this.maxLength && len > this.maxLength) {
|
1524
|
+
this.emit("drop", data);
|
1525
|
+
return this._len < this._hwm;
|
1526
|
+
}
|
1527
|
+
if (bufs.length === 0 || lens[lens.length - 1] + data.length > this.maxWrite) {
|
1528
|
+
bufs.push([data]);
|
1529
|
+
lens.push(data.length);
|
1530
|
+
} else {
|
1531
|
+
bufs[bufs.length - 1].push(data);
|
1532
|
+
lens[lens.length - 1] += data.length;
|
1533
|
+
}
|
1534
|
+
this._len = len;
|
1535
|
+
if (!this._writing && this._len >= this.minLength) {
|
1536
|
+
this._actualWrite();
|
1537
|
+
}
|
1538
|
+
return this._len < this._hwm;
|
1539
|
+
}
|
1540
|
+
function callFlushCallbackOnDrain(cb) {
|
1541
|
+
this._flushPending = true;
|
1542
|
+
const onDrain = () => {
|
1543
|
+
if (!this._fsync) {
|
1544
|
+
fs.fsync(this.fd, (err) => {
|
1545
|
+
this._flushPending = false;
|
1546
|
+
cb(err);
|
1547
|
+
});
|
1548
|
+
} else {
|
1549
|
+
this._flushPending = false;
|
1550
|
+
cb();
|
1551
|
+
}
|
1552
|
+
this.off("error", onError);
|
1553
|
+
};
|
1554
|
+
const onError = (err) => {
|
1555
|
+
this._flushPending = false;
|
1556
|
+
cb(err);
|
1557
|
+
this.off("drain", onDrain);
|
1558
|
+
};
|
1559
|
+
this.once("drain", onDrain);
|
1560
|
+
this.once("error", onError);
|
1561
|
+
}
|
1562
|
+
function flush(cb) {
|
1563
|
+
if (cb != null && typeof cb !== "function") {
|
1564
|
+
throw new Error("flush cb must be a function");
|
1565
|
+
}
|
1566
|
+
if (this.destroyed) {
|
1567
|
+
const error = new Error("SonicBoom destroyed");
|
1568
|
+
if (cb) {
|
1569
|
+
cb(error);
|
1570
|
+
return;
|
1571
|
+
}
|
1572
|
+
throw error;
|
1573
|
+
}
|
1574
|
+
if (this.minLength <= 0) {
|
1575
|
+
cb?.();
|
1576
|
+
return;
|
1577
|
+
}
|
1578
|
+
if (cb) {
|
1579
|
+
callFlushCallbackOnDrain.call(this, cb);
|
1580
|
+
}
|
1581
|
+
if (this._writing) {
|
1582
|
+
return;
|
1583
|
+
}
|
1584
|
+
if (this._bufs.length === 0) {
|
1585
|
+
this._bufs.push("");
|
1586
|
+
}
|
1587
|
+
this._actualWrite();
|
1588
|
+
}
|
1589
|
+
function flushBuffer(cb) {
|
1590
|
+
if (cb != null && typeof cb !== "function") {
|
1591
|
+
throw new Error("flush cb must be a function");
|
1592
|
+
}
|
1593
|
+
if (this.destroyed) {
|
1594
|
+
const error = new Error("SonicBoom destroyed");
|
1595
|
+
if (cb) {
|
1596
|
+
cb(error);
|
1597
|
+
return;
|
1598
|
+
}
|
1599
|
+
throw error;
|
1600
|
+
}
|
1601
|
+
if (this.minLength <= 0) {
|
1602
|
+
cb?.();
|
1603
|
+
return;
|
1604
|
+
}
|
1605
|
+
if (cb) {
|
1606
|
+
callFlushCallbackOnDrain.call(this, cb);
|
1607
|
+
}
|
1608
|
+
if (this._writing) {
|
1609
|
+
return;
|
1610
|
+
}
|
1611
|
+
if (this._bufs.length === 0) {
|
1612
|
+
this._bufs.push([]);
|
1613
|
+
this._lens.push(0);
|
1614
|
+
}
|
1615
|
+
this._actualWrite();
|
1616
|
+
}
|
1617
|
+
SonicBoom.prototype.reopen = function(file) {
|
1618
|
+
if (this.destroyed) {
|
1619
|
+
throw new Error("SonicBoom destroyed");
|
1620
|
+
}
|
1621
|
+
if (this._opening) {
|
1622
|
+
this.once("ready", () => {
|
1623
|
+
this.reopen(file);
|
1624
|
+
});
|
1625
|
+
return;
|
1626
|
+
}
|
1627
|
+
if (this._ending) {
|
1628
|
+
return;
|
1629
|
+
}
|
1630
|
+
if (!this.file) {
|
1631
|
+
throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
|
1632
|
+
}
|
1633
|
+
this._reopening = true;
|
1634
|
+
if (this._writing) {
|
1635
|
+
return;
|
1636
|
+
}
|
1637
|
+
const fd = this.fd;
|
1638
|
+
this.once("ready", () => {
|
1639
|
+
if (fd !== this.fd) {
|
1640
|
+
fs.close(fd, (err) => {
|
1641
|
+
if (err) {
|
1642
|
+
return this.emit("error", err);
|
1643
|
+
}
|
1644
|
+
});
|
1645
|
+
}
|
1646
|
+
});
|
1647
|
+
openFile(file || this.file, this);
|
1648
|
+
};
|
1649
|
+
SonicBoom.prototype.end = function() {
|
1650
|
+
if (this.destroyed) {
|
1651
|
+
throw new Error("SonicBoom destroyed");
|
1652
|
+
}
|
1653
|
+
if (this._opening) {
|
1654
|
+
this.once("ready", () => {
|
1655
|
+
this.end();
|
1656
|
+
});
|
1657
|
+
return;
|
1658
|
+
}
|
1659
|
+
if (this._ending) {
|
1660
|
+
return;
|
1661
|
+
}
|
1662
|
+
this._ending = true;
|
1663
|
+
if (this._writing) {
|
1664
|
+
return;
|
1665
|
+
}
|
1666
|
+
if (this._len > 0 && this.fd >= 0) {
|
1667
|
+
this._actualWrite();
|
1668
|
+
} else {
|
1669
|
+
actualClose(this);
|
1670
|
+
}
|
1671
|
+
};
|
1672
|
+
function flushSync() {
|
1673
|
+
if (this.destroyed) {
|
1674
|
+
throw new Error("SonicBoom destroyed");
|
1675
|
+
}
|
1676
|
+
if (this.fd < 0) {
|
1677
|
+
throw new Error("sonic boom is not ready yet");
|
1678
|
+
}
|
1679
|
+
if (!this._writing && this._writingBuf.length > 0) {
|
1680
|
+
this._bufs.unshift(this._writingBuf);
|
1681
|
+
this._writingBuf = "";
|
1682
|
+
}
|
1683
|
+
let buf = "";
|
1684
|
+
while (this._bufs.length || buf) {
|
1685
|
+
if (buf.length <= 0) {
|
1686
|
+
buf = this._bufs[0];
|
1687
|
+
}
|
1688
|
+
try {
|
1689
|
+
const n = fs.writeSync(this.fd, buf, "utf8");
|
1690
|
+
buf = buf.slice(n);
|
1691
|
+
this._len = Math.max(this._len - n, 0);
|
1692
|
+
if (buf.length <= 0) {
|
1693
|
+
this._bufs.shift();
|
1694
|
+
}
|
1695
|
+
} catch (err) {
|
1696
|
+
const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
|
1697
|
+
if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
|
1698
|
+
throw err;
|
1699
|
+
}
|
1700
|
+
sleep(BUSY_WRITE_TIMEOUT);
|
1701
|
+
}
|
1702
|
+
}
|
1703
|
+
try {
|
1704
|
+
fs.fsyncSync(this.fd);
|
1705
|
+
} catch {
|
1706
|
+
}
|
1707
|
+
}
|
1708
|
+
function flushBufferSync() {
|
1709
|
+
if (this.destroyed) {
|
1710
|
+
throw new Error("SonicBoom destroyed");
|
1711
|
+
}
|
1712
|
+
if (this.fd < 0) {
|
1713
|
+
throw new Error("sonic boom is not ready yet");
|
1714
|
+
}
|
1715
|
+
if (!this._writing && this._writingBuf.length > 0) {
|
1716
|
+
this._bufs.unshift([this._writingBuf]);
|
1717
|
+
this._writingBuf = kEmptyBuffer;
|
1718
|
+
}
|
1719
|
+
let buf = kEmptyBuffer;
|
1720
|
+
while (this._bufs.length || buf.length) {
|
1721
|
+
if (buf.length <= 0) {
|
1722
|
+
buf = mergeBuf(this._bufs[0], this._lens[0]);
|
1723
|
+
}
|
1724
|
+
try {
|
1725
|
+
const n = fs.writeSync(this.fd, buf);
|
1726
|
+
buf = buf.subarray(n);
|
1727
|
+
this._len = Math.max(this._len - n, 0);
|
1728
|
+
if (buf.length <= 0) {
|
1729
|
+
this._bufs.shift();
|
1730
|
+
this._lens.shift();
|
1731
|
+
}
|
1732
|
+
} catch (err) {
|
1733
|
+
const shouldRetry = err.code === "EAGAIN" || err.code === "EBUSY";
|
1734
|
+
if (shouldRetry && !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
|
1735
|
+
throw err;
|
1736
|
+
}
|
1737
|
+
sleep(BUSY_WRITE_TIMEOUT);
|
1738
|
+
}
|
1739
|
+
}
|
1740
|
+
}
|
1741
|
+
SonicBoom.prototype.destroy = function() {
|
1742
|
+
if (this.destroyed) {
|
1743
|
+
return;
|
1744
|
+
}
|
1745
|
+
actualClose(this);
|
1746
|
+
};
|
1747
|
+
function actualWrite() {
|
1748
|
+
const release = this.release;
|
1749
|
+
this._writing = true;
|
1750
|
+
this._writingBuf = this._writingBuf || this._bufs.shift() || "";
|
1751
|
+
if (this.sync) {
|
1752
|
+
try {
|
1753
|
+
const written = fs.writeSync(this.fd, this._writingBuf, "utf8");
|
1754
|
+
release(null, written);
|
1755
|
+
} catch (err) {
|
1756
|
+
release(err);
|
1757
|
+
}
|
1758
|
+
} else {
|
1759
|
+
fs.write(this.fd, this._writingBuf, "utf8", release);
|
1760
|
+
}
|
1761
|
+
}
|
1762
|
+
function actualWriteBuffer() {
|
1763
|
+
const release = this.release;
|
1764
|
+
this._writing = true;
|
1765
|
+
this._writingBuf = this._writingBuf.length ? this._writingBuf : mergeBuf(this._bufs.shift(), this._lens.shift());
|
1766
|
+
if (this.sync) {
|
1767
|
+
try {
|
1768
|
+
const written = fs.writeSync(this.fd, this._writingBuf);
|
1769
|
+
release(null, written);
|
1770
|
+
} catch (err) {
|
1771
|
+
release(err);
|
1772
|
+
}
|
1773
|
+
} else {
|
1774
|
+
fs.write(this.fd, this._writingBuf, release);
|
1775
|
+
}
|
1776
|
+
}
|
1777
|
+
function actualClose(sonic) {
|
1778
|
+
if (sonic.fd === -1) {
|
1779
|
+
sonic.once("ready", actualClose.bind(null, sonic));
|
1780
|
+
return;
|
1781
|
+
}
|
1782
|
+
sonic.destroyed = true;
|
1783
|
+
sonic._bufs = [];
|
1784
|
+
sonic._lens = [];
|
1785
|
+
fs.fsync(sonic.fd, closeWrapped);
|
1786
|
+
function closeWrapped() {
|
1787
|
+
if (sonic.fd !== 1 && sonic.fd !== 2) {
|
1788
|
+
fs.close(sonic.fd, done);
|
1789
|
+
} else {
|
1790
|
+
done();
|
1791
|
+
}
|
1792
|
+
}
|
1793
|
+
function done(err) {
|
1794
|
+
if (err) {
|
1795
|
+
sonic.emit("error", err);
|
1796
|
+
return;
|
1797
|
+
}
|
1798
|
+
if (sonic._ending && !sonic._writing) {
|
1799
|
+
sonic.emit("finish");
|
1800
|
+
}
|
1801
|
+
sonic.emit("close");
|
1802
|
+
}
|
1803
|
+
}
|
1804
|
+
SonicBoom.SonicBoom = SonicBoom;
|
1805
|
+
SonicBoom.default = SonicBoom;
|
1806
|
+
module2.exports = SonicBoom;
|
1807
|
+
}
|
1808
|
+
});
|
1809
|
+
|
1810
|
+
// node_modules/on-exit-leak-free/index.js
|
1811
|
+
var require_on_exit_leak_free = __commonJS({
|
1812
|
+
"node_modules/on-exit-leak-free/index.js"(exports2, module2) {
|
1813
|
+
"use strict";
|
1814
|
+
var refs = {
|
1815
|
+
exit: [],
|
1816
|
+
beforeExit: []
|
1817
|
+
};
|
1818
|
+
var functions = {
|
1819
|
+
exit: onExit,
|
1820
|
+
beforeExit: onBeforeExit
|
1821
|
+
};
|
1822
|
+
var registry = new FinalizationRegistry(clear);
|
1823
|
+
function install(event) {
|
1824
|
+
if (refs[event].length > 0) {
|
1825
|
+
return;
|
1826
|
+
}
|
1827
|
+
process.on(event, functions[event]);
|
1828
|
+
}
|
1829
|
+
function uninstall(event) {
|
1830
|
+
if (refs[event].length > 0) {
|
1831
|
+
return;
|
1832
|
+
}
|
1833
|
+
process.removeListener(event, functions[event]);
|
1834
|
+
}
|
1835
|
+
function onExit() {
|
1836
|
+
callRefs("exit");
|
1837
|
+
}
|
1838
|
+
function onBeforeExit() {
|
1839
|
+
callRefs("beforeExit");
|
1840
|
+
}
|
1841
|
+
function callRefs(event) {
|
1842
|
+
for (const ref of refs[event]) {
|
1843
|
+
const obj = ref.deref();
|
1844
|
+
const fn = ref.fn;
|
1845
|
+
if (obj !== void 0) {
|
1846
|
+
fn(obj, event);
|
1847
|
+
}
|
1848
|
+
}
|
1849
|
+
}
|
1850
|
+
function clear(ref) {
|
1851
|
+
for (const event of ["exit", "beforeExit"]) {
|
1852
|
+
const index = refs[event].indexOf(ref);
|
1853
|
+
refs[event].splice(index, index + 1);
|
1854
|
+
uninstall(event);
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
function _register(event, obj, fn) {
|
1858
|
+
if (obj === void 0) {
|
1859
|
+
throw new Error("the object can't be undefined");
|
1860
|
+
}
|
1861
|
+
install(event);
|
1862
|
+
const ref = new WeakRef(obj);
|
1863
|
+
ref.fn = fn;
|
1864
|
+
registry.register(obj, ref);
|
1865
|
+
refs[event].push(ref);
|
1866
|
+
}
|
1867
|
+
function register(obj, fn) {
|
1868
|
+
_register("exit", obj, fn);
|
1869
|
+
}
|
1870
|
+
function registerBeforeExit(obj, fn) {
|
1871
|
+
_register("beforeExit", obj, fn);
|
1872
|
+
}
|
1873
|
+
function unregister(obj) {
|
1874
|
+
registry.unregister(obj);
|
1875
|
+
for (const event of ["exit", "beforeExit"]) {
|
1876
|
+
refs[event] = refs[event].filter((ref) => {
|
1877
|
+
const _obj = ref.deref();
|
1878
|
+
return _obj && _obj !== obj;
|
1879
|
+
});
|
1880
|
+
uninstall(event);
|
1881
|
+
}
|
1882
|
+
}
|
1883
|
+
module2.exports = {
|
1884
|
+
register,
|
1885
|
+
registerBeforeExit,
|
1886
|
+
unregister
|
1887
|
+
};
|
1888
|
+
}
|
1889
|
+
});
|
1890
|
+
|
1891
|
+
// node_modules/thread-stream/package.json
|
1892
|
+
var require_package = __commonJS({
|
1893
|
+
"node_modules/thread-stream/package.json"(exports2, module2) {
|
1894
|
+
module2.exports = {
|
1895
|
+
name: "thread-stream",
|
1896
|
+
version: "2.3.0",
|
1897
|
+
description: "A streaming way to send data to a Node.js Worker Thread",
|
1898
|
+
main: "index.js",
|
1899
|
+
types: "index.d.ts",
|
1900
|
+
dependencies: {
|
1901
|
+
"real-require": "^0.2.0"
|
1902
|
+
},
|
1903
|
+
devDependencies: {
|
1904
|
+
"@types/node": "^18.0.0",
|
1905
|
+
"@types/tap": "^15.0.0",
|
1906
|
+
desm: "^1.3.0",
|
1907
|
+
fastbench: "^1.0.1",
|
1908
|
+
husky: "^8.0.1",
|
1909
|
+
"sonic-boom": "^3.0.0",
|
1910
|
+
standard: "^17.0.0",
|
1911
|
+
tap: "^16.2.0",
|
1912
|
+
"ts-node": "^10.8.0",
|
1913
|
+
typescript: "^4.7.2",
|
1914
|
+
"why-is-node-running": "^2.2.2"
|
1915
|
+
},
|
1916
|
+
scripts: {
|
1917
|
+
test: "standard && npm run transpile && tap test/*.test.*js && tap --ts test/*.test.*ts",
|
1918
|
+
"test:ci": "standard && npm run transpile && npm run test:ci:js && npm run test:ci:ts",
|
1919
|
+
"test:ci:js": 'tap --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*js"',
|
1920
|
+
"test:ci:ts": 'tap --ts --no-check-coverage --coverage-report=lcovonly "test/**/*.test.*ts"',
|
1921
|
+
"test:yarn": 'npm run transpile && tap "test/**/*.test.js" --no-check-coverage',
|
1922
|
+
transpile: "sh ./test/ts/transpile.sh",
|
1923
|
+
prepare: "husky install"
|
1924
|
+
},
|
1925
|
+
standard: { ignore: ["test/ts/**/*"] },
|
1926
|
+
repository: {
|
1927
|
+
type: "git",
|
1928
|
+
url: "git+https://github.com/mcollina/thread-stream.git"
|
1929
|
+
},
|
1930
|
+
keywords: [
|
1931
|
+
"worker",
|
1932
|
+
"thread",
|
1933
|
+
"threads",
|
1934
|
+
"stream"
|
1935
|
+
],
|
1936
|
+
author: "Matteo Collina <hello@matteocollina.com>",
|
1937
|
+
license: "MIT",
|
1938
|
+
bugs: {
|
1939
|
+
url: "https://github.com/mcollina/thread-stream/issues"
|
1940
|
+
},
|
1941
|
+
homepage: "https://github.com/mcollina/thread-stream#readme"
|
1942
|
+
};
|
1943
|
+
}
|
1944
|
+
});
|
1945
|
+
|
1946
|
+
// node_modules/thread-stream/lib/wait.js
|
1947
|
+
var require_wait = __commonJS({
|
1948
|
+
"node_modules/thread-stream/lib/wait.js"(exports2, module2) {
|
1949
|
+
"use strict";
|
1950
|
+
var MAX_TIMEOUT = 1e3;
|
1951
|
+
function wait(state, index, expected, timeout, done) {
|
1952
|
+
const max = Date.now() + timeout;
|
1953
|
+
let current = Atomics.load(state, index);
|
1954
|
+
if (current === expected) {
|
1955
|
+
done(null, "ok");
|
1956
|
+
return;
|
1957
|
+
}
|
1958
|
+
let prior = current;
|
1959
|
+
const check = (backoff) => {
|
1960
|
+
if (Date.now() > max) {
|
1961
|
+
done(null, "timed-out");
|
1962
|
+
} else {
|
1963
|
+
setTimeout(() => {
|
1964
|
+
prior = current;
|
1965
|
+
current = Atomics.load(state, index);
|
1966
|
+
if (current === prior) {
|
1967
|
+
check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
|
1968
|
+
} else {
|
1969
|
+
if (current === expected)
|
1970
|
+
done(null, "ok");
|
1971
|
+
else
|
1972
|
+
done(null, "not-equal");
|
1973
|
+
}
|
1974
|
+
}, backoff);
|
1975
|
+
}
|
1976
|
+
};
|
1977
|
+
check(1);
|
1978
|
+
}
|
1979
|
+
function waitDiff(state, index, expected, timeout, done) {
|
1980
|
+
const max = Date.now() + timeout;
|
1981
|
+
let current = Atomics.load(state, index);
|
1982
|
+
if (current !== expected) {
|
1983
|
+
done(null, "ok");
|
1984
|
+
return;
|
1985
|
+
}
|
1986
|
+
const check = (backoff) => {
|
1987
|
+
if (Date.now() > max) {
|
1988
|
+
done(null, "timed-out");
|
1989
|
+
} else {
|
1990
|
+
setTimeout(() => {
|
1991
|
+
current = Atomics.load(state, index);
|
1992
|
+
if (current !== expected) {
|
1993
|
+
done(null, "ok");
|
1994
|
+
} else {
|
1995
|
+
check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
|
1996
|
+
}
|
1997
|
+
}, backoff);
|
1998
|
+
}
|
1999
|
+
};
|
2000
|
+
check(1);
|
2001
|
+
}
|
2002
|
+
module2.exports = { wait, waitDiff };
|
2003
|
+
}
|
2004
|
+
});
|
2005
|
+
|
2006
|
+
// node_modules/thread-stream/lib/indexes.js
|
2007
|
+
var require_indexes = __commonJS({
|
2008
|
+
"node_modules/thread-stream/lib/indexes.js"(exports2, module2) {
|
2009
|
+
"use strict";
|
2010
|
+
var WRITE_INDEX = 4;
|
2011
|
+
var READ_INDEX = 8;
|
2012
|
+
module2.exports = {
|
2013
|
+
WRITE_INDEX,
|
2014
|
+
READ_INDEX
|
2015
|
+
};
|
2016
|
+
}
|
2017
|
+
});
|
2018
|
+
|
2019
|
+
// node_modules/thread-stream/index.js
|
2020
|
+
var require_thread_stream = __commonJS({
|
2021
|
+
"node_modules/thread-stream/index.js"(exports2, module2) {
|
2022
|
+
"use strict";
|
2023
|
+
var { version } = require_package();
|
2024
|
+
var { EventEmitter } = require("events");
|
2025
|
+
var { Worker } = require("worker_threads");
|
2026
|
+
var { join } = require("path");
|
2027
|
+
var { pathToFileURL } = require("url");
|
2028
|
+
var { wait } = require_wait();
|
2029
|
+
var {
|
2030
|
+
WRITE_INDEX,
|
2031
|
+
READ_INDEX
|
2032
|
+
} = require_indexes();
|
2033
|
+
var buffer = require("buffer");
|
2034
|
+
var assert = require("assert");
|
2035
|
+
var kImpl = Symbol("kImpl");
|
2036
|
+
var MAX_STRING = buffer.constants.MAX_STRING_LENGTH;
|
2037
|
+
var FakeWeakRef = class {
|
2038
|
+
constructor(value) {
|
2039
|
+
this._value = value;
|
2040
|
+
}
|
2041
|
+
deref() {
|
2042
|
+
return this._value;
|
2043
|
+
}
|
2044
|
+
};
|
2045
|
+
var FinalizationRegistry2 = global.FinalizationRegistry || class FakeFinalizationRegistry {
|
2046
|
+
register() {
|
2047
|
+
}
|
2048
|
+
unregister() {
|
2049
|
+
}
|
2050
|
+
};
|
2051
|
+
var WeakRef2 = global.WeakRef || FakeWeakRef;
|
2052
|
+
var registry = new FinalizationRegistry2((worker) => {
|
2053
|
+
if (worker.exited) {
|
2054
|
+
return;
|
2055
|
+
}
|
2056
|
+
worker.terminate();
|
2057
|
+
});
|
2058
|
+
function createWorker(stream, opts) {
|
2059
|
+
const { filename, workerData } = opts;
|
2060
|
+
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
2061
|
+
const toExecute = bundlerOverrides["thread-stream-worker"] || join(__dirname, "lib", "worker.js");
|
2062
|
+
const worker = new Worker(toExecute, {
|
2063
|
+
...opts.workerOpts,
|
2064
|
+
trackUnmanagedFds: false,
|
2065
|
+
workerData: {
|
2066
|
+
filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
|
2067
|
+
dataBuf: stream[kImpl].dataBuf,
|
2068
|
+
stateBuf: stream[kImpl].stateBuf,
|
2069
|
+
workerData: {
|
2070
|
+
$context: {
|
2071
|
+
threadStreamVersion: version
|
2072
|
+
},
|
2073
|
+
...workerData
|
2074
|
+
}
|
2075
|
+
}
|
2076
|
+
});
|
2077
|
+
worker.stream = new FakeWeakRef(stream);
|
2078
|
+
worker.on("message", onWorkerMessage);
|
2079
|
+
worker.on("exit", onWorkerExit);
|
2080
|
+
registry.register(stream, worker);
|
2081
|
+
return worker;
|
2082
|
+
}
|
2083
|
+
function drain(stream) {
|
2084
|
+
assert(!stream[kImpl].sync);
|
2085
|
+
if (stream[kImpl].needDrain) {
|
2086
|
+
stream[kImpl].needDrain = false;
|
2087
|
+
stream.emit("drain");
|
2088
|
+
}
|
2089
|
+
}
|
2090
|
+
function nextFlush(stream) {
|
2091
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
2092
|
+
let leftover = stream[kImpl].data.length - writeIndex;
|
2093
|
+
if (leftover > 0) {
|
2094
|
+
if (stream[kImpl].buf.length === 0) {
|
2095
|
+
stream[kImpl].flushing = false;
|
2096
|
+
if (stream[kImpl].ending) {
|
2097
|
+
end(stream);
|
2098
|
+
} else if (stream[kImpl].needDrain) {
|
2099
|
+
process.nextTick(drain, stream);
|
2100
|
+
}
|
2101
|
+
return;
|
2102
|
+
}
|
2103
|
+
let toWrite = stream[kImpl].buf.slice(0, leftover);
|
2104
|
+
let toWriteBytes = Buffer.byteLength(toWrite);
|
2105
|
+
if (toWriteBytes <= leftover) {
|
2106
|
+
stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
|
2107
|
+
write(stream, toWrite, nextFlush.bind(null, stream));
|
2108
|
+
} else {
|
2109
|
+
stream.flush(() => {
|
2110
|
+
if (stream.destroyed) {
|
2111
|
+
return;
|
2112
|
+
}
|
2113
|
+
Atomics.store(stream[kImpl].state, READ_INDEX, 0);
|
2114
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
|
2115
|
+
while (toWriteBytes > stream[kImpl].data.length) {
|
2116
|
+
leftover = leftover / 2;
|
2117
|
+
toWrite = stream[kImpl].buf.slice(0, leftover);
|
2118
|
+
toWriteBytes = Buffer.byteLength(toWrite);
|
2119
|
+
}
|
2120
|
+
stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
|
2121
|
+
write(stream, toWrite, nextFlush.bind(null, stream));
|
2122
|
+
});
|
2123
|
+
}
|
2124
|
+
} else if (leftover === 0) {
|
2125
|
+
if (writeIndex === 0 && stream[kImpl].buf.length === 0) {
|
2126
|
+
return;
|
2127
|
+
}
|
2128
|
+
stream.flush(() => {
|
2129
|
+
Atomics.store(stream[kImpl].state, READ_INDEX, 0);
|
2130
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
|
2131
|
+
nextFlush(stream);
|
2132
|
+
});
|
2133
|
+
} else {
|
2134
|
+
destroy(stream, new Error("overwritten"));
|
2135
|
+
}
|
2136
|
+
}
|
2137
|
+
function onWorkerMessage(msg) {
|
2138
|
+
const stream = this.stream.deref();
|
2139
|
+
if (stream === void 0) {
|
2140
|
+
this.exited = true;
|
2141
|
+
this.terminate();
|
2142
|
+
return;
|
2143
|
+
}
|
2144
|
+
switch (msg.code) {
|
2145
|
+
case "READY":
|
2146
|
+
this.stream = new WeakRef2(stream);
|
2147
|
+
stream.flush(() => {
|
2148
|
+
stream[kImpl].ready = true;
|
2149
|
+
stream.emit("ready");
|
2150
|
+
});
|
2151
|
+
break;
|
2152
|
+
case "ERROR":
|
2153
|
+
destroy(stream, msg.err);
|
2154
|
+
break;
|
2155
|
+
case "EVENT":
|
2156
|
+
if (Array.isArray(msg.args)) {
|
2157
|
+
stream.emit(msg.name, ...msg.args);
|
2158
|
+
} else {
|
2159
|
+
stream.emit(msg.name, msg.args);
|
2160
|
+
}
|
2161
|
+
break;
|
2162
|
+
default:
|
2163
|
+
destroy(stream, new Error("this should not happen: " + msg.code));
|
2164
|
+
}
|
2165
|
+
}
|
2166
|
+
function onWorkerExit(code) {
|
2167
|
+
const stream = this.stream.deref();
|
2168
|
+
if (stream === void 0) {
|
2169
|
+
return;
|
2170
|
+
}
|
2171
|
+
registry.unregister(stream);
|
2172
|
+
stream.worker.exited = true;
|
2173
|
+
stream.worker.off("exit", onWorkerExit);
|
2174
|
+
destroy(stream, code !== 0 ? new Error("the worker thread exited") : null);
|
2175
|
+
}
|
2176
|
+
var ThreadStream = class extends EventEmitter {
|
2177
|
+
constructor(opts = {}) {
|
2178
|
+
super();
|
2179
|
+
if (opts.bufferSize < 4) {
|
2180
|
+
throw new Error("bufferSize must at least fit a 4-byte utf-8 char");
|
2181
|
+
}
|
2182
|
+
this[kImpl] = {};
|
2183
|
+
this[kImpl].stateBuf = new SharedArrayBuffer(128);
|
2184
|
+
this[kImpl].state = new Int32Array(this[kImpl].stateBuf);
|
2185
|
+
this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024);
|
2186
|
+
this[kImpl].data = Buffer.from(this[kImpl].dataBuf);
|
2187
|
+
this[kImpl].sync = opts.sync || false;
|
2188
|
+
this[kImpl].ending = false;
|
2189
|
+
this[kImpl].ended = false;
|
2190
|
+
this[kImpl].needDrain = false;
|
2191
|
+
this[kImpl].destroyed = false;
|
2192
|
+
this[kImpl].flushing = false;
|
2193
|
+
this[kImpl].ready = false;
|
2194
|
+
this[kImpl].finished = false;
|
2195
|
+
this[kImpl].errored = null;
|
2196
|
+
this[kImpl].closed = false;
|
2197
|
+
this[kImpl].buf = "";
|
2198
|
+
this.worker = createWorker(this, opts);
|
2199
|
+
}
|
2200
|
+
write(data) {
|
2201
|
+
if (this[kImpl].destroyed) {
|
2202
|
+
error(this, new Error("the worker has exited"));
|
2203
|
+
return false;
|
2204
|
+
}
|
2205
|
+
if (this[kImpl].ending) {
|
2206
|
+
error(this, new Error("the worker is ending"));
|
2207
|
+
return false;
|
2208
|
+
}
|
2209
|
+
if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) {
|
2210
|
+
try {
|
2211
|
+
writeSync(this);
|
2212
|
+
this[kImpl].flushing = true;
|
2213
|
+
} catch (err) {
|
2214
|
+
destroy(this, err);
|
2215
|
+
return false;
|
2216
|
+
}
|
2217
|
+
}
|
2218
|
+
this[kImpl].buf += data;
|
2219
|
+
if (this[kImpl].sync) {
|
2220
|
+
try {
|
2221
|
+
writeSync(this);
|
2222
|
+
return true;
|
2223
|
+
} catch (err) {
|
2224
|
+
destroy(this, err);
|
2225
|
+
return false;
|
2226
|
+
}
|
2227
|
+
}
|
2228
|
+
if (!this[kImpl].flushing) {
|
2229
|
+
this[kImpl].flushing = true;
|
2230
|
+
setImmediate(nextFlush, this);
|
2231
|
+
}
|
2232
|
+
this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0;
|
2233
|
+
return !this[kImpl].needDrain;
|
2234
|
+
}
|
2235
|
+
end() {
|
2236
|
+
if (this[kImpl].destroyed) {
|
2237
|
+
return;
|
2238
|
+
}
|
2239
|
+
this[kImpl].ending = true;
|
2240
|
+
end(this);
|
2241
|
+
}
|
2242
|
+
flush(cb) {
|
2243
|
+
if (this[kImpl].destroyed) {
|
2244
|
+
if (typeof cb === "function") {
|
2245
|
+
process.nextTick(cb, new Error("the worker has exited"));
|
2246
|
+
}
|
2247
|
+
return;
|
2248
|
+
}
|
2249
|
+
const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
|
2250
|
+
wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
|
2251
|
+
if (err) {
|
2252
|
+
destroy(this, err);
|
2253
|
+
process.nextTick(cb, err);
|
2254
|
+
return;
|
2255
|
+
}
|
2256
|
+
if (res === "not-equal") {
|
2257
|
+
this.flush(cb);
|
2258
|
+
return;
|
2259
|
+
}
|
2260
|
+
process.nextTick(cb);
|
2261
|
+
});
|
2262
|
+
}
|
2263
|
+
flushSync() {
|
2264
|
+
if (this[kImpl].destroyed) {
|
2265
|
+
return;
|
2266
|
+
}
|
2267
|
+
writeSync(this);
|
2268
|
+
flushSync(this);
|
2269
|
+
}
|
2270
|
+
unref() {
|
2271
|
+
this.worker.unref();
|
2272
|
+
}
|
2273
|
+
ref() {
|
2274
|
+
this.worker.ref();
|
2275
|
+
}
|
2276
|
+
get ready() {
|
2277
|
+
return this[kImpl].ready;
|
2278
|
+
}
|
2279
|
+
get destroyed() {
|
2280
|
+
return this[kImpl].destroyed;
|
2281
|
+
}
|
2282
|
+
get closed() {
|
2283
|
+
return this[kImpl].closed;
|
2284
|
+
}
|
2285
|
+
get writable() {
|
2286
|
+
return !this[kImpl].destroyed && !this[kImpl].ending;
|
2287
|
+
}
|
2288
|
+
get writableEnded() {
|
2289
|
+
return this[kImpl].ending;
|
2290
|
+
}
|
2291
|
+
get writableFinished() {
|
2292
|
+
return this[kImpl].finished;
|
2293
|
+
}
|
2294
|
+
get writableNeedDrain() {
|
2295
|
+
return this[kImpl].needDrain;
|
2296
|
+
}
|
2297
|
+
get writableObjectMode() {
|
2298
|
+
return false;
|
2299
|
+
}
|
2300
|
+
get writableErrored() {
|
2301
|
+
return this[kImpl].errored;
|
2302
|
+
}
|
2303
|
+
};
|
2304
|
+
function error(stream, err) {
|
2305
|
+
setImmediate(() => {
|
2306
|
+
stream.emit("error", err);
|
2307
|
+
});
|
2308
|
+
}
|
2309
|
+
function destroy(stream, err) {
|
2310
|
+
if (stream[kImpl].destroyed) {
|
2311
|
+
return;
|
2312
|
+
}
|
2313
|
+
stream[kImpl].destroyed = true;
|
2314
|
+
if (err) {
|
2315
|
+
stream[kImpl].errored = err;
|
2316
|
+
error(stream, err);
|
2317
|
+
}
|
2318
|
+
if (!stream.worker.exited) {
|
2319
|
+
stream.worker.terminate().catch(() => {
|
2320
|
+
}).then(() => {
|
2321
|
+
stream[kImpl].closed = true;
|
2322
|
+
stream.emit("close");
|
2323
|
+
});
|
2324
|
+
} else {
|
2325
|
+
setImmediate(() => {
|
2326
|
+
stream[kImpl].closed = true;
|
2327
|
+
stream.emit("close");
|
2328
|
+
});
|
2329
|
+
}
|
2330
|
+
}
|
2331
|
+
function write(stream, data, cb) {
|
2332
|
+
const current = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
2333
|
+
const length = Buffer.byteLength(data);
|
2334
|
+
stream[kImpl].data.write(data, current);
|
2335
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length);
|
2336
|
+
Atomics.notify(stream[kImpl].state, WRITE_INDEX);
|
2337
|
+
cb();
|
2338
|
+
return true;
|
2339
|
+
}
|
2340
|
+
function end(stream) {
|
2341
|
+
if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) {
|
2342
|
+
return;
|
2343
|
+
}
|
2344
|
+
stream[kImpl].ended = true;
|
2345
|
+
try {
|
2346
|
+
stream.flushSync();
|
2347
|
+
let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
2348
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, -1);
|
2349
|
+
Atomics.notify(stream[kImpl].state, WRITE_INDEX);
|
2350
|
+
let spins = 0;
|
2351
|
+
while (readIndex !== -1) {
|
2352
|
+
Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
|
2353
|
+
readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
2354
|
+
if (readIndex === -2) {
|
2355
|
+
destroy(stream, new Error("end() failed"));
|
2356
|
+
return;
|
2357
|
+
}
|
2358
|
+
if (++spins === 10) {
|
2359
|
+
destroy(stream, new Error("end() took too long (10s)"));
|
2360
|
+
return;
|
2361
|
+
}
|
2362
|
+
}
|
2363
|
+
process.nextTick(() => {
|
2364
|
+
stream[kImpl].finished = true;
|
2365
|
+
stream.emit("finish");
|
2366
|
+
});
|
2367
|
+
} catch (err) {
|
2368
|
+
destroy(stream, err);
|
2369
|
+
}
|
2370
|
+
}
|
2371
|
+
function writeSync(stream) {
|
2372
|
+
const cb = () => {
|
2373
|
+
if (stream[kImpl].ending) {
|
2374
|
+
end(stream);
|
2375
|
+
} else if (stream[kImpl].needDrain) {
|
2376
|
+
process.nextTick(drain, stream);
|
2377
|
+
}
|
2378
|
+
};
|
2379
|
+
stream[kImpl].flushing = false;
|
2380
|
+
while (stream[kImpl].buf.length !== 0) {
|
2381
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
2382
|
+
let leftover = stream[kImpl].data.length - writeIndex;
|
2383
|
+
if (leftover === 0) {
|
2384
|
+
flushSync(stream);
|
2385
|
+
Atomics.store(stream[kImpl].state, READ_INDEX, 0);
|
2386
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
|
2387
|
+
continue;
|
2388
|
+
} else if (leftover < 0) {
|
2389
|
+
throw new Error("overwritten");
|
2390
|
+
}
|
2391
|
+
let toWrite = stream[kImpl].buf.slice(0, leftover);
|
2392
|
+
let toWriteBytes = Buffer.byteLength(toWrite);
|
2393
|
+
if (toWriteBytes <= leftover) {
|
2394
|
+
stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
|
2395
|
+
write(stream, toWrite, cb);
|
2396
|
+
} else {
|
2397
|
+
flushSync(stream);
|
2398
|
+
Atomics.store(stream[kImpl].state, READ_INDEX, 0);
|
2399
|
+
Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
|
2400
|
+
while (toWriteBytes > stream[kImpl].buf.length) {
|
2401
|
+
leftover = leftover / 2;
|
2402
|
+
toWrite = stream[kImpl].buf.slice(0, leftover);
|
2403
|
+
toWriteBytes = Buffer.byteLength(toWrite);
|
2404
|
+
}
|
2405
|
+
stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
|
2406
|
+
write(stream, toWrite, cb);
|
2407
|
+
}
|
2408
|
+
}
|
2409
|
+
}
|
2410
|
+
function flushSync(stream) {
|
2411
|
+
if (stream[kImpl].flushing) {
|
2412
|
+
throw new Error("unable to flush while flushing");
|
2413
|
+
}
|
2414
|
+
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
2415
|
+
let spins = 0;
|
2416
|
+
while (true) {
|
2417
|
+
const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
|
2418
|
+
if (readIndex === -2) {
|
2419
|
+
throw Error("_flushSync failed");
|
2420
|
+
}
|
2421
|
+
if (readIndex !== writeIndex) {
|
2422
|
+
Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
|
2423
|
+
} else {
|
2424
|
+
break;
|
2425
|
+
}
|
2426
|
+
if (++spins === 10) {
|
2427
|
+
throw new Error("_flushSync took too long (10s)");
|
2428
|
+
}
|
2429
|
+
}
|
2430
|
+
}
|
2431
|
+
module2.exports = ThreadStream;
|
2432
|
+
}
|
2433
|
+
});
|
2434
|
+
|
2435
|
+
// node_modules/pino/lib/transport.js
|
2436
|
+
var require_transport = __commonJS({
|
2437
|
+
"node_modules/pino/lib/transport.js"(exports2, module2) {
|
2438
|
+
"use strict";
|
2439
|
+
var { createRequire } = require("module");
|
2440
|
+
var getCallers = require_caller();
|
2441
|
+
var { join, isAbsolute, sep } = require("path");
|
2442
|
+
var sleep = require_atomic_sleep();
|
2443
|
+
var onExit = require_on_exit_leak_free();
|
2444
|
+
var ThreadStream = require_thread_stream();
|
2445
|
+
function setupOnExit(stream) {
|
2446
|
+
onExit.register(stream, autoEnd);
|
2447
|
+
onExit.registerBeforeExit(stream, flush);
|
2448
|
+
stream.on("close", function() {
|
2449
|
+
onExit.unregister(stream);
|
2450
|
+
});
|
2451
|
+
}
|
2452
|
+
function buildStream(filename, workerData, workerOpts) {
|
2453
|
+
const stream = new ThreadStream({
|
2454
|
+
filename,
|
2455
|
+
workerData,
|
2456
|
+
workerOpts
|
2457
|
+
});
|
2458
|
+
stream.on("ready", onReady);
|
2459
|
+
stream.on("close", function() {
|
2460
|
+
process.removeListener("exit", onExit2);
|
2461
|
+
});
|
2462
|
+
process.on("exit", onExit2);
|
2463
|
+
function onReady() {
|
2464
|
+
process.removeListener("exit", onExit2);
|
2465
|
+
stream.unref();
|
2466
|
+
if (workerOpts.autoEnd !== false) {
|
2467
|
+
setupOnExit(stream);
|
2468
|
+
}
|
2469
|
+
}
|
2470
|
+
function onExit2() {
|
2471
|
+
if (stream.closed) {
|
2472
|
+
return;
|
2473
|
+
}
|
2474
|
+
stream.flushSync();
|
2475
|
+
sleep(100);
|
2476
|
+
stream.end();
|
2477
|
+
}
|
2478
|
+
return stream;
|
2479
|
+
}
|
2480
|
+
function autoEnd(stream) {
|
2481
|
+
stream.ref();
|
2482
|
+
stream.flushSync();
|
2483
|
+
stream.end();
|
2484
|
+
stream.once("close", function() {
|
2485
|
+
stream.unref();
|
2486
|
+
});
|
2487
|
+
}
|
2488
|
+
function flush(stream) {
|
2489
|
+
stream.flushSync();
|
2490
|
+
}
|
2491
|
+
function transport(fullOptions) {
|
2492
|
+
const { pipeline, targets, levels, dedupe, options = {}, worker = {}, caller = getCallers() } = fullOptions;
|
2493
|
+
const callers = typeof caller === "string" ? [caller] : caller;
|
2494
|
+
const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
|
2495
|
+
let target = fullOptions.target;
|
2496
|
+
if (target && targets) {
|
2497
|
+
throw new Error("only one of target or targets can be specified");
|
2498
|
+
}
|
2499
|
+
if (targets) {
|
2500
|
+
target = bundlerOverrides["pino-worker"] || join(__dirname, "worker.js");
|
2501
|
+
options.targets = targets.map((dest) => {
|
2502
|
+
return {
|
2503
|
+
...dest,
|
2504
|
+
target: fixTarget(dest.target)
|
2505
|
+
};
|
2506
|
+
});
|
2507
|
+
} else if (pipeline) {
|
2508
|
+
target = bundlerOverrides["pino-pipeline-worker"] || join(__dirname, "worker-pipeline.js");
|
2509
|
+
options.targets = pipeline.map((dest) => {
|
2510
|
+
return {
|
2511
|
+
...dest,
|
2512
|
+
target: fixTarget(dest.target)
|
2513
|
+
};
|
2514
|
+
});
|
2515
|
+
}
|
2516
|
+
if (levels) {
|
2517
|
+
options.levels = levels;
|
2518
|
+
}
|
2519
|
+
if (dedupe) {
|
2520
|
+
options.dedupe = dedupe;
|
2521
|
+
}
|
2522
|
+
return buildStream(fixTarget(target), options, worker);
|
2523
|
+
function fixTarget(origin) {
|
2524
|
+
origin = bundlerOverrides[origin] || origin;
|
2525
|
+
if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
|
2526
|
+
return origin;
|
2527
|
+
}
|
2528
|
+
if (origin === "pino/file") {
|
2529
|
+
return join(__dirname, "..", "file.js");
|
2530
|
+
}
|
2531
|
+
let fixTarget2;
|
2532
|
+
for (const filePath of callers) {
|
2533
|
+
try {
|
2534
|
+
const context = filePath === "node:repl" ? process.cwd() + sep : filePath;
|
2535
|
+
fixTarget2 = createRequire(context).resolve(origin);
|
2536
|
+
break;
|
2537
|
+
} catch (err) {
|
2538
|
+
continue;
|
2539
|
+
}
|
2540
|
+
}
|
2541
|
+
if (!fixTarget2) {
|
2542
|
+
throw new Error(`unable to determine transport target for "${origin}"`);
|
2543
|
+
}
|
2544
|
+
return fixTarget2;
|
2545
|
+
}
|
2546
|
+
}
|
2547
|
+
module2.exports = transport;
|
2548
|
+
}
|
2549
|
+
});
|
2550
|
+
|
2551
|
+
// node_modules/pino/lib/tools.js
|
2552
|
+
var require_tools = __commonJS({
|
2553
|
+
"node_modules/pino/lib/tools.js"(exports2, module2) {
|
2554
|
+
"use strict";
|
2555
|
+
var format = require_quick_format_unescaped();
|
2556
|
+
var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
|
2557
|
+
var SonicBoom = require_sonic_boom();
|
2558
|
+
var onExit = require_on_exit_leak_free();
|
2559
|
+
var {
|
2560
|
+
lsCacheSym,
|
2561
|
+
chindingsSym,
|
2562
|
+
writeSym,
|
2563
|
+
serializersSym,
|
2564
|
+
formatOptsSym,
|
2565
|
+
endSym,
|
2566
|
+
stringifiersSym,
|
2567
|
+
stringifySym,
|
2568
|
+
stringifySafeSym,
|
2569
|
+
wildcardFirstSym,
|
2570
|
+
nestedKeySym,
|
2571
|
+
formattersSym,
|
2572
|
+
messageKeySym,
|
2573
|
+
errorKeySym,
|
2574
|
+
nestedKeyStrSym,
|
2575
|
+
msgPrefixSym
|
2576
|
+
} = require_symbols();
|
2577
|
+
var { isMainThread } = require("worker_threads");
|
2578
|
+
var transport = require_transport();
|
2579
|
+
function noop() {
|
2580
|
+
}
|
2581
|
+
function genLog(level, hook) {
|
2582
|
+
if (!hook)
|
2583
|
+
return LOG;
|
2584
|
+
return function hookWrappedLog(...args) {
|
2585
|
+
hook.call(this, args, LOG, level);
|
2586
|
+
};
|
2587
|
+
function LOG(o, ...n) {
|
2588
|
+
if (typeof o === "object") {
|
2589
|
+
let msg = o;
|
2590
|
+
if (o !== null) {
|
2591
|
+
if (o.method && o.headers && o.socket) {
|
2592
|
+
o = mapHttpRequest(o);
|
2593
|
+
} else if (typeof o.setHeader === "function") {
|
2594
|
+
o = mapHttpResponse(o);
|
2595
|
+
}
|
2596
|
+
}
|
2597
|
+
let formatParams;
|
2598
|
+
if (msg === null && n.length === 0) {
|
2599
|
+
formatParams = [null];
|
2600
|
+
} else {
|
2601
|
+
msg = n.shift();
|
2602
|
+
formatParams = n;
|
2603
|
+
}
|
2604
|
+
if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) {
|
2605
|
+
msg = this[msgPrefixSym] + msg;
|
2606
|
+
}
|
2607
|
+
this[writeSym](o, format(msg, formatParams, this[formatOptsSym]), level);
|
2608
|
+
} else {
|
2609
|
+
let msg = o === void 0 ? n.shift() : o;
|
2610
|
+
if (typeof this[msgPrefixSym] === "string" && msg !== void 0 && msg !== null) {
|
2611
|
+
msg = this[msgPrefixSym] + msg;
|
2612
|
+
}
|
2613
|
+
this[writeSym](null, format(msg, n, this[formatOptsSym]), level);
|
2614
|
+
}
|
2615
|
+
}
|
2616
|
+
}
|
2617
|
+
function asString(str) {
|
2618
|
+
let result = "";
|
2619
|
+
let last = 0;
|
2620
|
+
let found = false;
|
2621
|
+
let point = 255;
|
2622
|
+
const l = str.length;
|
2623
|
+
if (l > 100) {
|
2624
|
+
return JSON.stringify(str);
|
2625
|
+
}
|
2626
|
+
for (var i = 0; i < l && point >= 32; i++) {
|
2627
|
+
point = str.charCodeAt(i);
|
2628
|
+
if (point === 34 || point === 92) {
|
2629
|
+
result += str.slice(last, i) + "\\";
|
2630
|
+
last = i;
|
2631
|
+
found = true;
|
2632
|
+
}
|
2633
|
+
}
|
2634
|
+
if (!found) {
|
2635
|
+
result = str;
|
2636
|
+
} else {
|
2637
|
+
result += str.slice(last);
|
2638
|
+
}
|
2639
|
+
return point < 32 ? JSON.stringify(str) : '"' + result + '"';
|
2640
|
+
}
|
2641
|
+
function asJson(obj, msg, num, time) {
|
2642
|
+
const stringify2 = this[stringifySym];
|
2643
|
+
const stringifySafe = this[stringifySafeSym];
|
2644
|
+
const stringifiers = this[stringifiersSym];
|
2645
|
+
const end = this[endSym];
|
2646
|
+
const chindings = this[chindingsSym];
|
2647
|
+
const serializers = this[serializersSym];
|
2648
|
+
const formatters = this[formattersSym];
|
2649
|
+
const messageKey = this[messageKeySym];
|
2650
|
+
const errorKey = this[errorKeySym];
|
2651
|
+
let data = this[lsCacheSym][num] + time;
|
2652
|
+
data = data + chindings;
|
2653
|
+
let value;
|
2654
|
+
if (formatters.log) {
|
2655
|
+
obj = formatters.log(obj);
|
2656
|
+
}
|
2657
|
+
const wildcardStringifier = stringifiers[wildcardFirstSym];
|
2658
|
+
let propStr = "";
|
2659
|
+
for (const key in obj) {
|
2660
|
+
value = obj[key];
|
2661
|
+
if (Object.prototype.hasOwnProperty.call(obj, key) && value !== void 0) {
|
2662
|
+
if (serializers[key]) {
|
2663
|
+
value = serializers[key](value);
|
2664
|
+
} else if (key === errorKey && serializers.err) {
|
2665
|
+
value = serializers.err(value);
|
2666
|
+
}
|
2667
|
+
const stringifier = stringifiers[key] || wildcardStringifier;
|
2668
|
+
switch (typeof value) {
|
2669
|
+
case "undefined":
|
2670
|
+
case "function":
|
2671
|
+
continue;
|
2672
|
+
case "number":
|
2673
|
+
if (Number.isFinite(value) === false) {
|
2674
|
+
value = null;
|
2675
|
+
}
|
2676
|
+
case "boolean":
|
2677
|
+
if (stringifier)
|
2678
|
+
value = stringifier(value);
|
2679
|
+
break;
|
2680
|
+
case "string":
|
2681
|
+
value = (stringifier || asString)(value);
|
2682
|
+
break;
|
2683
|
+
default:
|
2684
|
+
value = (stringifier || stringify2)(value, stringifySafe);
|
2685
|
+
}
|
2686
|
+
if (value === void 0)
|
2687
|
+
continue;
|
2688
|
+
const strKey = asString(key);
|
2689
|
+
propStr += "," + strKey + ":" + value;
|
2690
|
+
}
|
2691
|
+
}
|
2692
|
+
let msgStr = "";
|
2693
|
+
if (msg !== void 0) {
|
2694
|
+
value = serializers[messageKey] ? serializers[messageKey](msg) : msg;
|
2695
|
+
const stringifier = stringifiers[messageKey] || wildcardStringifier;
|
2696
|
+
switch (typeof value) {
|
2697
|
+
case "function":
|
2698
|
+
break;
|
2699
|
+
case "number":
|
2700
|
+
if (Number.isFinite(value) === false) {
|
2701
|
+
value = null;
|
2702
|
+
}
|
2703
|
+
case "boolean":
|
2704
|
+
if (stringifier)
|
2705
|
+
value = stringifier(value);
|
2706
|
+
msgStr = ',"' + messageKey + '":' + value;
|
2707
|
+
break;
|
2708
|
+
case "string":
|
2709
|
+
value = (stringifier || asString)(value);
|
2710
|
+
msgStr = ',"' + messageKey + '":' + value;
|
2711
|
+
break;
|
2712
|
+
default:
|
2713
|
+
value = (stringifier || stringify2)(value, stringifySafe);
|
2714
|
+
msgStr = ',"' + messageKey + '":' + value;
|
2715
|
+
}
|
2716
|
+
}
|
2717
|
+
if (this[nestedKeySym] && propStr) {
|
2718
|
+
return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end;
|
2719
|
+
} else {
|
2720
|
+
return data + propStr + msgStr + end;
|
2721
|
+
}
|
2722
|
+
}
|
2723
|
+
function asChindings(instance, bindings) {
|
2724
|
+
let value;
|
2725
|
+
let data = instance[chindingsSym];
|
2726
|
+
const stringify2 = instance[stringifySym];
|
2727
|
+
const stringifySafe = instance[stringifySafeSym];
|
2728
|
+
const stringifiers = instance[stringifiersSym];
|
2729
|
+
const wildcardStringifier = stringifiers[wildcardFirstSym];
|
2730
|
+
const serializers = instance[serializersSym];
|
2731
|
+
const formatter = instance[formattersSym].bindings;
|
2732
|
+
bindings = formatter(bindings);
|
2733
|
+
for (const key in bindings) {
|
2734
|
+
value = bindings[key];
|
2735
|
+
const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
|
2736
|
+
if (valid === true) {
|
2737
|
+
value = serializers[key] ? serializers[key](value) : value;
|
2738
|
+
value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
|
2739
|
+
if (value === void 0)
|
2740
|
+
continue;
|
2741
|
+
data += ',"' + key + '":' + value;
|
2742
|
+
}
|
2743
|
+
}
|
2744
|
+
return data;
|
2745
|
+
}
|
2746
|
+
function hasBeenTampered(stream) {
|
2747
|
+
return stream.write !== stream.constructor.prototype.write;
|
2748
|
+
}
|
2749
|
+
var hasNodeCodeCoverage = process.env.NODE_V8_COVERAGE || process.env.V8_COVERAGE;
|
2750
|
+
function buildSafeSonicBoom(opts) {
|
2751
|
+
const stream = new SonicBoom(opts);
|
2752
|
+
stream.on("error", filterBrokenPipe);
|
2753
|
+
if (!hasNodeCodeCoverage && !opts.sync && isMainThread) {
|
2754
|
+
onExit.register(stream, autoEnd);
|
2755
|
+
stream.on("close", function() {
|
2756
|
+
onExit.unregister(stream);
|
2757
|
+
});
|
2758
|
+
}
|
2759
|
+
return stream;
|
2760
|
+
function filterBrokenPipe(err) {
|
2761
|
+
if (err.code === "EPIPE") {
|
2762
|
+
stream.write = noop;
|
2763
|
+
stream.end = noop;
|
2764
|
+
stream.flushSync = noop;
|
2765
|
+
stream.destroy = noop;
|
2766
|
+
return;
|
2767
|
+
}
|
2768
|
+
stream.removeListener("error", filterBrokenPipe);
|
2769
|
+
stream.emit("error", err);
|
2770
|
+
}
|
2771
|
+
}
|
2772
|
+
function autoEnd(stream, eventName) {
|
2773
|
+
if (stream.destroyed) {
|
2774
|
+
return;
|
2775
|
+
}
|
2776
|
+
if (eventName === "beforeExit") {
|
2777
|
+
stream.flush();
|
2778
|
+
stream.on("drain", function() {
|
2779
|
+
stream.end();
|
2780
|
+
});
|
2781
|
+
} else {
|
2782
|
+
stream.flushSync();
|
2783
|
+
}
|
2784
|
+
}
|
2785
|
+
function createArgsNormalizer(defaultOptions) {
|
2786
|
+
return function normalizeArgs(instance, caller, opts = {}, stream) {
|
2787
|
+
if (typeof opts === "string") {
|
2788
|
+
stream = buildSafeSonicBoom({ dest: opts });
|
2789
|
+
opts = {};
|
2790
|
+
} else if (typeof stream === "string") {
|
2791
|
+
if (opts && opts.transport) {
|
2792
|
+
throw Error("only one of option.transport or stream can be specified");
|
2793
|
+
}
|
2794
|
+
stream = buildSafeSonicBoom({ dest: stream });
|
2795
|
+
} else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
|
2796
|
+
stream = opts;
|
2797
|
+
opts = {};
|
2798
|
+
} else if (opts.transport) {
|
2799
|
+
if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) {
|
2800
|
+
throw Error("option.transport do not allow stream, please pass to option directly. e.g. pino(transport)");
|
2801
|
+
}
|
2802
|
+
if (opts.transport.targets && opts.transport.targets.length && opts.formatters && typeof opts.formatters.level === "function") {
|
2803
|
+
throw Error("option.transport.targets do not allow custom level formatters");
|
2804
|
+
}
|
2805
|
+
let customLevels;
|
2806
|
+
if (opts.customLevels) {
|
2807
|
+
customLevels = opts.useOnlyCustomLevels ? opts.customLevels : Object.assign({}, opts.levels, opts.customLevels);
|
2808
|
+
}
|
2809
|
+
stream = transport({ caller, ...opts.transport, levels: customLevels });
|
2810
|
+
}
|
2811
|
+
opts = Object.assign({}, defaultOptions, opts);
|
2812
|
+
opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
|
2813
|
+
opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters);
|
2814
|
+
if (opts.prettyPrint) {
|
2815
|
+
throw new Error("prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)");
|
2816
|
+
}
|
2817
|
+
const { enabled, onChild } = opts;
|
2818
|
+
if (enabled === false)
|
2819
|
+
opts.level = "silent";
|
2820
|
+
if (!onChild)
|
2821
|
+
opts.onChild = noop;
|
2822
|
+
if (!stream) {
|
2823
|
+
if (!hasBeenTampered(process.stdout)) {
|
2824
|
+
stream = buildSafeSonicBoom({ fd: process.stdout.fd || 1 });
|
2825
|
+
} else {
|
2826
|
+
stream = process.stdout;
|
2827
|
+
}
|
2828
|
+
}
|
2829
|
+
return { opts, stream };
|
2830
|
+
};
|
2831
|
+
}
|
2832
|
+
function stringify(obj, stringifySafeFn) {
|
2833
|
+
try {
|
2834
|
+
return JSON.stringify(obj);
|
2835
|
+
} catch (_) {
|
2836
|
+
try {
|
2837
|
+
const stringify2 = stringifySafeFn || this[stringifySafeSym];
|
2838
|
+
return stringify2(obj);
|
2839
|
+
} catch (_2) {
|
2840
|
+
return '"[unable to serialize, circular reference is too complex to analyze]"';
|
2841
|
+
}
|
2842
|
+
}
|
2843
|
+
}
|
2844
|
+
function buildFormatters(level, bindings, log) {
|
2845
|
+
return {
|
2846
|
+
level,
|
2847
|
+
bindings,
|
2848
|
+
log
|
2849
|
+
};
|
2850
|
+
}
|
2851
|
+
function normalizeDestFileDescriptor(destination) {
|
2852
|
+
const fd = Number(destination);
|
2853
|
+
if (typeof destination === "string" && Number.isFinite(fd)) {
|
2854
|
+
return fd;
|
2855
|
+
}
|
2856
|
+
if (destination === void 0) {
|
2857
|
+
return 1;
|
2858
|
+
}
|
2859
|
+
return destination;
|
2860
|
+
}
|
2861
|
+
module2.exports = {
|
2862
|
+
noop,
|
2863
|
+
buildSafeSonicBoom,
|
2864
|
+
asChindings,
|
2865
|
+
asJson,
|
2866
|
+
genLog,
|
2867
|
+
createArgsNormalizer,
|
2868
|
+
stringify,
|
2869
|
+
buildFormatters,
|
2870
|
+
normalizeDestFileDescriptor
|
2871
|
+
};
|
2872
|
+
}
|
2873
|
+
});
|
2874
|
+
|
2875
|
+
// node_modules/pino/lib/constants.js
|
2876
|
+
var require_constants = __commonJS({
|
2877
|
+
"node_modules/pino/lib/constants.js"(exports2, module2) {
|
2878
|
+
var DEFAULT_LEVELS = {
|
2879
|
+
trace: 10,
|
2880
|
+
debug: 20,
|
2881
|
+
info: 30,
|
2882
|
+
warn: 40,
|
2883
|
+
error: 50,
|
2884
|
+
fatal: 60
|
2885
|
+
};
|
2886
|
+
var SORTING_ORDER = {
|
2887
|
+
ASC: "ASC",
|
2888
|
+
DESC: "DESC"
|
2889
|
+
};
|
2890
|
+
module2.exports = {
|
2891
|
+
DEFAULT_LEVELS,
|
2892
|
+
SORTING_ORDER
|
2893
|
+
};
|
2894
|
+
}
|
2895
|
+
});
|
2896
|
+
|
2897
|
+
// node_modules/pino/lib/levels.js
|
2898
|
+
var require_levels = __commonJS({
|
2899
|
+
"node_modules/pino/lib/levels.js"(exports2, module2) {
|
2900
|
+
"use strict";
|
2901
|
+
var {
|
2902
|
+
lsCacheSym,
|
2903
|
+
levelValSym,
|
2904
|
+
useOnlyCustomLevelsSym,
|
2905
|
+
streamSym,
|
2906
|
+
formattersSym,
|
2907
|
+
hooksSym,
|
2908
|
+
levelCompSym
|
2909
|
+
} = require_symbols();
|
2910
|
+
var { noop, genLog } = require_tools();
|
2911
|
+
var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
|
2912
|
+
var levelMethods = {
|
2913
|
+
fatal: (hook) => {
|
2914
|
+
const logFatal = genLog(DEFAULT_LEVELS.fatal, hook);
|
2915
|
+
return function(...args) {
|
2916
|
+
const stream = this[streamSym];
|
2917
|
+
logFatal.call(this, ...args);
|
2918
|
+
if (typeof stream.flushSync === "function") {
|
2919
|
+
try {
|
2920
|
+
stream.flushSync();
|
2921
|
+
} catch (e) {
|
2922
|
+
}
|
2923
|
+
}
|
2924
|
+
};
|
2925
|
+
},
|
2926
|
+
error: (hook) => genLog(DEFAULT_LEVELS.error, hook),
|
2927
|
+
warn: (hook) => genLog(DEFAULT_LEVELS.warn, hook),
|
2928
|
+
info: (hook) => genLog(DEFAULT_LEVELS.info, hook),
|
2929
|
+
debug: (hook) => genLog(DEFAULT_LEVELS.debug, hook),
|
2930
|
+
trace: (hook) => genLog(DEFAULT_LEVELS.trace, hook)
|
2931
|
+
};
|
2932
|
+
var nums = Object.keys(DEFAULT_LEVELS).reduce((o, k) => {
|
2933
|
+
o[DEFAULT_LEVELS[k]] = k;
|
2934
|
+
return o;
|
2935
|
+
}, {});
|
2936
|
+
var initialLsCache = Object.keys(nums).reduce((o, k) => {
|
2937
|
+
o[k] = '{"level":' + Number(k);
|
2938
|
+
return o;
|
2939
|
+
}, {});
|
2940
|
+
function genLsCache(instance) {
|
2941
|
+
const formatter = instance[formattersSym].level;
|
2942
|
+
const { labels } = instance.levels;
|
2943
|
+
const cache = {};
|
2944
|
+
for (const label in labels) {
|
2945
|
+
const level = formatter(labels[label], Number(label));
|
2946
|
+
cache[label] = JSON.stringify(level).slice(0, -1);
|
2947
|
+
}
|
2948
|
+
instance[lsCacheSym] = cache;
|
2949
|
+
return instance;
|
2950
|
+
}
|
2951
|
+
function isStandardLevel(level, useOnlyCustomLevels) {
|
2952
|
+
if (useOnlyCustomLevels) {
|
2953
|
+
return false;
|
2954
|
+
}
|
2955
|
+
switch (level) {
|
2956
|
+
case "fatal":
|
2957
|
+
case "error":
|
2958
|
+
case "warn":
|
2959
|
+
case "info":
|
2960
|
+
case "debug":
|
2961
|
+
case "trace":
|
2962
|
+
return true;
|
2963
|
+
default:
|
2964
|
+
return false;
|
2965
|
+
}
|
2966
|
+
}
|
2967
|
+
function setLevel(level) {
|
2968
|
+
const { labels, values } = this.levels;
|
2969
|
+
if (typeof level === "number") {
|
2970
|
+
if (labels[level] === void 0)
|
2971
|
+
throw Error("unknown level value" + level);
|
2972
|
+
level = labels[level];
|
2973
|
+
}
|
2974
|
+
if (values[level] === void 0)
|
2975
|
+
throw Error("unknown level " + level);
|
2976
|
+
const preLevelVal = this[levelValSym];
|
2977
|
+
const levelVal = this[levelValSym] = values[level];
|
2978
|
+
const useOnlyCustomLevelsVal = this[useOnlyCustomLevelsSym];
|
2979
|
+
const levelComparison = this[levelCompSym];
|
2980
|
+
const hook = this[hooksSym].logMethod;
|
2981
|
+
for (const key in values) {
|
2982
|
+
if (levelComparison(values[key], levelVal) === false) {
|
2983
|
+
this[key] = noop;
|
2984
|
+
continue;
|
2985
|
+
}
|
2986
|
+
this[key] = isStandardLevel(key, useOnlyCustomLevelsVal) ? levelMethods[key](hook) : genLog(values[key], hook);
|
2987
|
+
}
|
2988
|
+
this.emit(
|
2989
|
+
"level-change",
|
2990
|
+
level,
|
2991
|
+
levelVal,
|
2992
|
+
labels[preLevelVal],
|
2993
|
+
preLevelVal,
|
2994
|
+
this
|
2995
|
+
);
|
2996
|
+
}
|
2997
|
+
function getLevel(level) {
|
2998
|
+
const { levels, levelVal } = this;
|
2999
|
+
return levels && levels.labels ? levels.labels[levelVal] : "";
|
3000
|
+
}
|
3001
|
+
function isLevelEnabled(logLevel) {
|
3002
|
+
const { values } = this.levels;
|
3003
|
+
const logLevelVal = values[logLevel];
|
3004
|
+
return logLevelVal !== void 0 && this[levelCompSym](logLevelVal, this[levelValSym]);
|
3005
|
+
}
|
3006
|
+
function compareLevel(direction, current, expected) {
|
3007
|
+
if (direction === SORTING_ORDER.DESC) {
|
3008
|
+
return current <= expected;
|
3009
|
+
}
|
3010
|
+
return current >= expected;
|
3011
|
+
}
|
3012
|
+
function genLevelComparison(levelComparison) {
|
3013
|
+
if (typeof levelComparison === "string") {
|
3014
|
+
return compareLevel.bind(null, levelComparison);
|
3015
|
+
}
|
3016
|
+
return levelComparison;
|
3017
|
+
}
|
3018
|
+
function mappings(customLevels = null, useOnlyCustomLevels = false) {
|
3019
|
+
const customNums = customLevels ? Object.keys(customLevels).reduce((o, k) => {
|
3020
|
+
o[customLevels[k]] = k;
|
3021
|
+
return o;
|
3022
|
+
}, {}) : null;
|
3023
|
+
const labels = Object.assign(
|
3024
|
+
Object.create(Object.prototype, { Infinity: { value: "silent" } }),
|
3025
|
+
useOnlyCustomLevels ? null : nums,
|
3026
|
+
customNums
|
3027
|
+
);
|
3028
|
+
const values = Object.assign(
|
3029
|
+
Object.create(Object.prototype, { silent: { value: Infinity } }),
|
3030
|
+
useOnlyCustomLevels ? null : DEFAULT_LEVELS,
|
3031
|
+
customLevels
|
3032
|
+
);
|
3033
|
+
return { labels, values };
|
3034
|
+
}
|
3035
|
+
function assertDefaultLevelFound(defaultLevel, customLevels, useOnlyCustomLevels) {
|
3036
|
+
if (typeof defaultLevel === "number") {
|
3037
|
+
const values = [].concat(
|
3038
|
+
Object.keys(customLevels || {}).map((key) => customLevels[key]),
|
3039
|
+
useOnlyCustomLevels ? [] : Object.keys(nums).map((level) => +level),
|
3040
|
+
Infinity
|
3041
|
+
);
|
3042
|
+
if (!values.includes(defaultLevel)) {
|
3043
|
+
throw Error(`default level:${defaultLevel} must be included in custom levels`);
|
3044
|
+
}
|
3045
|
+
return;
|
3046
|
+
}
|
3047
|
+
const labels = Object.assign(
|
3048
|
+
Object.create(Object.prototype, { silent: { value: Infinity } }),
|
3049
|
+
useOnlyCustomLevels ? null : DEFAULT_LEVELS,
|
3050
|
+
customLevels
|
3051
|
+
);
|
3052
|
+
if (!(defaultLevel in labels)) {
|
3053
|
+
throw Error(`default level:${defaultLevel} must be included in custom levels`);
|
3054
|
+
}
|
3055
|
+
}
|
3056
|
+
function assertNoLevelCollisions(levels, customLevels) {
|
3057
|
+
const { labels, values } = levels;
|
3058
|
+
for (const k in customLevels) {
|
3059
|
+
if (k in values) {
|
3060
|
+
throw Error("levels cannot be overridden");
|
3061
|
+
}
|
3062
|
+
if (customLevels[k] in labels) {
|
3063
|
+
throw Error("pre-existing level values cannot be used for new levels");
|
3064
|
+
}
|
3065
|
+
}
|
3066
|
+
}
|
3067
|
+
function assertLevelComparison(levelComparison) {
|
3068
|
+
if (typeof levelComparison === "function") {
|
3069
|
+
return;
|
3070
|
+
}
|
3071
|
+
if (typeof levelComparison === "string" && Object.values(SORTING_ORDER).includes(levelComparison)) {
|
3072
|
+
return;
|
3073
|
+
}
|
3074
|
+
throw new Error('Levels comparison should be one of "ASC", "DESC" or "function" type');
|
3075
|
+
}
|
3076
|
+
module2.exports = {
|
3077
|
+
initialLsCache,
|
3078
|
+
genLsCache,
|
3079
|
+
levelMethods,
|
3080
|
+
getLevel,
|
3081
|
+
setLevel,
|
3082
|
+
isLevelEnabled,
|
3083
|
+
mappings,
|
3084
|
+
assertNoLevelCollisions,
|
3085
|
+
assertDefaultLevelFound,
|
3086
|
+
genLevelComparison,
|
3087
|
+
assertLevelComparison
|
3088
|
+
};
|
3089
|
+
}
|
3090
|
+
});
|
3091
|
+
|
3092
|
+
// node_modules/pino/lib/meta.js
|
3093
|
+
var require_meta = __commonJS({
|
3094
|
+
"node_modules/pino/lib/meta.js"(exports2, module2) {
|
3095
|
+
"use strict";
|
3096
|
+
module2.exports = { version: "8.19.0" };
|
3097
|
+
}
|
3098
|
+
});
|
3099
|
+
|
3100
|
+
// node_modules/pino/lib/proto.js
|
3101
|
+
var require_proto = __commonJS({
|
3102
|
+
"node_modules/pino/lib/proto.js"(exports2, module2) {
|
3103
|
+
"use strict";
|
3104
|
+
var { EventEmitter } = require("events");
|
3105
|
+
var {
|
3106
|
+
lsCacheSym,
|
3107
|
+
levelValSym,
|
3108
|
+
setLevelSym,
|
3109
|
+
getLevelSym,
|
3110
|
+
chindingsSym,
|
3111
|
+
parsedChindingsSym,
|
3112
|
+
mixinSym,
|
3113
|
+
asJsonSym,
|
3114
|
+
writeSym,
|
3115
|
+
mixinMergeStrategySym,
|
3116
|
+
timeSym,
|
3117
|
+
timeSliceIndexSym,
|
3118
|
+
streamSym,
|
3119
|
+
serializersSym,
|
3120
|
+
formattersSym,
|
3121
|
+
errorKeySym,
|
3122
|
+
messageKeySym,
|
3123
|
+
useOnlyCustomLevelsSym,
|
3124
|
+
needsMetadataGsym,
|
3125
|
+
redactFmtSym,
|
3126
|
+
stringifySym,
|
3127
|
+
formatOptsSym,
|
3128
|
+
stringifiersSym,
|
3129
|
+
msgPrefixSym
|
3130
|
+
} = require_symbols();
|
3131
|
+
var {
|
3132
|
+
getLevel,
|
3133
|
+
setLevel,
|
3134
|
+
isLevelEnabled,
|
3135
|
+
mappings,
|
3136
|
+
initialLsCache,
|
3137
|
+
genLsCache,
|
3138
|
+
assertNoLevelCollisions
|
3139
|
+
} = require_levels();
|
3140
|
+
var {
|
3141
|
+
asChindings,
|
3142
|
+
asJson,
|
3143
|
+
buildFormatters,
|
3144
|
+
stringify
|
3145
|
+
} = require_tools();
|
3146
|
+
var {
|
3147
|
+
version
|
3148
|
+
} = require_meta();
|
3149
|
+
var redaction = require_redaction();
|
3150
|
+
var constructor = class Pino {
|
3151
|
+
};
|
3152
|
+
var prototype = {
|
3153
|
+
constructor,
|
3154
|
+
child,
|
3155
|
+
bindings,
|
3156
|
+
setBindings,
|
3157
|
+
flush,
|
3158
|
+
isLevelEnabled,
|
3159
|
+
version,
|
3160
|
+
get level() {
|
3161
|
+
return this[getLevelSym]();
|
3162
|
+
},
|
3163
|
+
set level(lvl) {
|
3164
|
+
this[setLevelSym](lvl);
|
3165
|
+
},
|
3166
|
+
get levelVal() {
|
3167
|
+
return this[levelValSym];
|
3168
|
+
},
|
3169
|
+
set levelVal(n) {
|
3170
|
+
throw Error("levelVal is read-only");
|
3171
|
+
},
|
3172
|
+
[lsCacheSym]: initialLsCache,
|
3173
|
+
[writeSym]: write,
|
3174
|
+
[asJsonSym]: asJson,
|
3175
|
+
[getLevelSym]: getLevel,
|
3176
|
+
[setLevelSym]: setLevel
|
3177
|
+
};
|
3178
|
+
Object.setPrototypeOf(prototype, EventEmitter.prototype);
|
3179
|
+
module2.exports = function() {
|
3180
|
+
return Object.create(prototype);
|
3181
|
+
};
|
3182
|
+
var resetChildingsFormatter = (bindings2) => bindings2;
|
3183
|
+
function child(bindings2, options) {
|
3184
|
+
if (!bindings2) {
|
3185
|
+
throw Error("missing bindings for child Pino");
|
3186
|
+
}
|
3187
|
+
options = options || {};
|
3188
|
+
const serializers = this[serializersSym];
|
3189
|
+
const formatters = this[formattersSym];
|
3190
|
+
const instance = Object.create(this);
|
3191
|
+
if (options.hasOwnProperty("serializers") === true) {
|
3192
|
+
instance[serializersSym] = /* @__PURE__ */ Object.create(null);
|
3193
|
+
for (const k in serializers) {
|
3194
|
+
instance[serializersSym][k] = serializers[k];
|
3195
|
+
}
|
3196
|
+
const parentSymbols = Object.getOwnPropertySymbols(serializers);
|
3197
|
+
for (var i = 0; i < parentSymbols.length; i++) {
|
3198
|
+
const ks = parentSymbols[i];
|
3199
|
+
instance[serializersSym][ks] = serializers[ks];
|
3200
|
+
}
|
3201
|
+
for (const bk in options.serializers) {
|
3202
|
+
instance[serializersSym][bk] = options.serializers[bk];
|
3203
|
+
}
|
3204
|
+
const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
|
3205
|
+
for (var bi = 0; bi < bindingsSymbols.length; bi++) {
|
3206
|
+
const bks = bindingsSymbols[bi];
|
3207
|
+
instance[serializersSym][bks] = options.serializers[bks];
|
3208
|
+
}
|
3209
|
+
} else
|
3210
|
+
instance[serializersSym] = serializers;
|
3211
|
+
if (options.hasOwnProperty("formatters")) {
|
3212
|
+
const { level, bindings: chindings, log } = options.formatters;
|
3213
|
+
instance[formattersSym] = buildFormatters(
|
3214
|
+
level || formatters.level,
|
3215
|
+
chindings || resetChildingsFormatter,
|
3216
|
+
log || formatters.log
|
3217
|
+
);
|
3218
|
+
} else {
|
3219
|
+
instance[formattersSym] = buildFormatters(
|
3220
|
+
formatters.level,
|
3221
|
+
resetChildingsFormatter,
|
3222
|
+
formatters.log
|
3223
|
+
);
|
3224
|
+
}
|
3225
|
+
if (options.hasOwnProperty("customLevels") === true) {
|
3226
|
+
assertNoLevelCollisions(this.levels, options.customLevels);
|
3227
|
+
instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]);
|
3228
|
+
genLsCache(instance);
|
3229
|
+
}
|
3230
|
+
if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) {
|
3231
|
+
instance.redact = options.redact;
|
3232
|
+
const stringifiers = redaction(instance.redact, stringify);
|
3233
|
+
const formatOpts = { stringify: stringifiers[redactFmtSym] };
|
3234
|
+
instance[stringifySym] = stringify;
|
3235
|
+
instance[stringifiersSym] = stringifiers;
|
3236
|
+
instance[formatOptsSym] = formatOpts;
|
3237
|
+
}
|
3238
|
+
if (typeof options.msgPrefix === "string") {
|
3239
|
+
instance[msgPrefixSym] = (this[msgPrefixSym] || "") + options.msgPrefix;
|
3240
|
+
}
|
3241
|
+
instance[chindingsSym] = asChindings(instance, bindings2);
|
3242
|
+
const childLevel = options.level || this.level;
|
3243
|
+
instance[setLevelSym](childLevel);
|
3244
|
+
this.onChild(instance);
|
3245
|
+
return instance;
|
3246
|
+
}
|
3247
|
+
function bindings() {
|
3248
|
+
const chindings = this[chindingsSym];
|
3249
|
+
const chindingsJson = `{${chindings.substr(1)}}`;
|
3250
|
+
const bindingsFromJson = JSON.parse(chindingsJson);
|
3251
|
+
delete bindingsFromJson.pid;
|
3252
|
+
delete bindingsFromJson.hostname;
|
3253
|
+
return bindingsFromJson;
|
3254
|
+
}
|
3255
|
+
function setBindings(newBindings) {
|
3256
|
+
const chindings = asChindings(this, newBindings);
|
3257
|
+
this[chindingsSym] = chindings;
|
3258
|
+
delete this[parsedChindingsSym];
|
3259
|
+
}
|
3260
|
+
function defaultMixinMergeStrategy(mergeObject, mixinObject) {
|
3261
|
+
return Object.assign(mixinObject, mergeObject);
|
3262
|
+
}
|
3263
|
+
function write(_obj, msg, num) {
|
3264
|
+
const t = this[timeSym]();
|
3265
|
+
const mixin = this[mixinSym];
|
3266
|
+
const errorKey = this[errorKeySym];
|
3267
|
+
const messageKey = this[messageKeySym];
|
3268
|
+
const mixinMergeStrategy = this[mixinMergeStrategySym] || defaultMixinMergeStrategy;
|
3269
|
+
let obj;
|
3270
|
+
if (_obj === void 0 || _obj === null) {
|
3271
|
+
obj = {};
|
3272
|
+
} else if (_obj instanceof Error) {
|
3273
|
+
obj = { [errorKey]: _obj };
|
3274
|
+
if (msg === void 0) {
|
3275
|
+
msg = _obj.message;
|
3276
|
+
}
|
3277
|
+
} else {
|
3278
|
+
obj = _obj;
|
3279
|
+
if (msg === void 0 && _obj[messageKey] === void 0 && _obj[errorKey]) {
|
3280
|
+
msg = _obj[errorKey].message;
|
3281
|
+
}
|
3282
|
+
}
|
3283
|
+
if (mixin) {
|
3284
|
+
obj = mixinMergeStrategy(obj, mixin(obj, num, this));
|
3285
|
+
}
|
3286
|
+
const s = this[asJsonSym](obj, msg, num, t);
|
3287
|
+
const stream = this[streamSym];
|
3288
|
+
if (stream[needsMetadataGsym] === true) {
|
3289
|
+
stream.lastLevel = num;
|
3290
|
+
stream.lastObj = obj;
|
3291
|
+
stream.lastMsg = msg;
|
3292
|
+
stream.lastTime = t.slice(this[timeSliceIndexSym]);
|
3293
|
+
stream.lastLogger = this;
|
3294
|
+
}
|
3295
|
+
stream.write(s);
|
3296
|
+
}
|
3297
|
+
function noop() {
|
3298
|
+
}
|
3299
|
+
function flush(cb) {
|
3300
|
+
if (cb != null && typeof cb !== "function") {
|
3301
|
+
throw Error("callback must be a function");
|
3302
|
+
}
|
3303
|
+
const stream = this[streamSym];
|
3304
|
+
if (typeof stream.flush === "function") {
|
3305
|
+
stream.flush(cb || noop);
|
3306
|
+
} else if (cb)
|
3307
|
+
cb();
|
3308
|
+
}
|
3309
|
+
}
|
3310
|
+
});
|
3311
|
+
|
3312
|
+
// node_modules/safe-stable-stringify/index.js
|
3313
|
+
var require_safe_stable_stringify = __commonJS({
|
3314
|
+
"node_modules/safe-stable-stringify/index.js"(exports2, module2) {
|
3315
|
+
"use strict";
|
3316
|
+
var { hasOwnProperty } = Object.prototype;
|
3317
|
+
var stringify = configure();
|
3318
|
+
stringify.configure = configure;
|
3319
|
+
stringify.stringify = stringify;
|
3320
|
+
stringify.default = stringify;
|
3321
|
+
exports2.stringify = stringify;
|
3322
|
+
exports2.configure = configure;
|
3323
|
+
module2.exports = stringify;
|
3324
|
+
var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;
|
3325
|
+
function strEscape(str) {
|
3326
|
+
if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
|
3327
|
+
return `"${str}"`;
|
3328
|
+
}
|
3329
|
+
return JSON.stringify(str);
|
3330
|
+
}
|
3331
|
+
function insertSort(array) {
|
3332
|
+
if (array.length > 200) {
|
3333
|
+
return array.sort();
|
3334
|
+
}
|
3335
|
+
for (let i = 1; i < array.length; i++) {
|
3336
|
+
const currentValue = array[i];
|
3337
|
+
let position = i;
|
3338
|
+
while (position !== 0 && array[position - 1] > currentValue) {
|
3339
|
+
array[position] = array[position - 1];
|
3340
|
+
position--;
|
3341
|
+
}
|
3342
|
+
array[position] = currentValue;
|
3343
|
+
}
|
3344
|
+
return array;
|
3345
|
+
}
|
3346
|
+
var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(
|
3347
|
+
Object.getPrototypeOf(
|
3348
|
+
Object.getPrototypeOf(
|
3349
|
+
new Int8Array()
|
3350
|
+
)
|
3351
|
+
),
|
3352
|
+
Symbol.toStringTag
|
3353
|
+
).get;
|
3354
|
+
function isTypedArrayWithEntries(value) {
|
3355
|
+
return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
|
3356
|
+
}
|
3357
|
+
function stringifyTypedArray(array, separator, maximumBreadth) {
|
3358
|
+
if (array.length < maximumBreadth) {
|
3359
|
+
maximumBreadth = array.length;
|
3360
|
+
}
|
3361
|
+
const whitespace = separator === "," ? "" : " ";
|
3362
|
+
let res = `"0":${whitespace}${array[0]}`;
|
3363
|
+
for (let i = 1; i < maximumBreadth; i++) {
|
3364
|
+
res += `${separator}"${i}":${whitespace}${array[i]}`;
|
3365
|
+
}
|
3366
|
+
return res;
|
3367
|
+
}
|
3368
|
+
function getCircularValueOption(options) {
|
3369
|
+
if (hasOwnProperty.call(options, "circularValue")) {
|
3370
|
+
const circularValue = options.circularValue;
|
3371
|
+
if (typeof circularValue === "string") {
|
3372
|
+
return `"${circularValue}"`;
|
3373
|
+
}
|
3374
|
+
if (circularValue == null) {
|
3375
|
+
return circularValue;
|
3376
|
+
}
|
3377
|
+
if (circularValue === Error || circularValue === TypeError) {
|
3378
|
+
return {
|
3379
|
+
toString() {
|
3380
|
+
throw new TypeError("Converting circular structure to JSON");
|
3381
|
+
}
|
3382
|
+
};
|
3383
|
+
}
|
3384
|
+
throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
|
3385
|
+
}
|
3386
|
+
return '"[Circular]"';
|
3387
|
+
}
|
3388
|
+
function getBooleanOption(options, key) {
|
3389
|
+
let value;
|
3390
|
+
if (hasOwnProperty.call(options, key)) {
|
3391
|
+
value = options[key];
|
3392
|
+
if (typeof value !== "boolean") {
|
3393
|
+
throw new TypeError(`The "${key}" argument must be of type boolean`);
|
3394
|
+
}
|
3395
|
+
}
|
3396
|
+
return value === void 0 ? true : value;
|
3397
|
+
}
|
3398
|
+
function getPositiveIntegerOption(options, key) {
|
3399
|
+
let value;
|
3400
|
+
if (hasOwnProperty.call(options, key)) {
|
3401
|
+
value = options[key];
|
3402
|
+
if (typeof value !== "number") {
|
3403
|
+
throw new TypeError(`The "${key}" argument must be of type number`);
|
3404
|
+
}
|
3405
|
+
if (!Number.isInteger(value)) {
|
3406
|
+
throw new TypeError(`The "${key}" argument must be an integer`);
|
3407
|
+
}
|
3408
|
+
if (value < 1) {
|
3409
|
+
throw new RangeError(`The "${key}" argument must be >= 1`);
|
3410
|
+
}
|
3411
|
+
}
|
3412
|
+
return value === void 0 ? Infinity : value;
|
3413
|
+
}
|
3414
|
+
function getItemCount(number) {
|
3415
|
+
if (number === 1) {
|
3416
|
+
return "1 item";
|
3417
|
+
}
|
3418
|
+
return `${number} items`;
|
3419
|
+
}
|
3420
|
+
function getUniqueReplacerSet(replacerArray) {
|
3421
|
+
const replacerSet = /* @__PURE__ */ new Set();
|
3422
|
+
for (const value of replacerArray) {
|
3423
|
+
if (typeof value === "string" || typeof value === "number") {
|
3424
|
+
replacerSet.add(String(value));
|
3425
|
+
}
|
3426
|
+
}
|
3427
|
+
return replacerSet;
|
3428
|
+
}
|
3429
|
+
function getStrictOption(options) {
|
3430
|
+
if (hasOwnProperty.call(options, "strict")) {
|
3431
|
+
const value = options.strict;
|
3432
|
+
if (typeof value !== "boolean") {
|
3433
|
+
throw new TypeError('The "strict" argument must be of type boolean');
|
3434
|
+
}
|
3435
|
+
if (value) {
|
3436
|
+
return (value2) => {
|
3437
|
+
let message = `Object can not safely be stringified. Received type ${typeof value2}`;
|
3438
|
+
if (typeof value2 !== "function")
|
3439
|
+
message += ` (${value2.toString()})`;
|
3440
|
+
throw new Error(message);
|
3441
|
+
};
|
3442
|
+
}
|
3443
|
+
}
|
3444
|
+
}
|
3445
|
+
function configure(options) {
|
3446
|
+
options = { ...options };
|
3447
|
+
const fail = getStrictOption(options);
|
3448
|
+
if (fail) {
|
3449
|
+
if (options.bigint === void 0) {
|
3450
|
+
options.bigint = false;
|
3451
|
+
}
|
3452
|
+
if (!("circularValue" in options)) {
|
3453
|
+
options.circularValue = Error;
|
3454
|
+
}
|
3455
|
+
}
|
3456
|
+
const circularValue = getCircularValueOption(options);
|
3457
|
+
const bigint = getBooleanOption(options, "bigint");
|
3458
|
+
const deterministic = getBooleanOption(options, "deterministic");
|
3459
|
+
const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
|
3460
|
+
const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
|
3461
|
+
function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
|
3462
|
+
let value = parent[key];
|
3463
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
|
3464
|
+
value = value.toJSON(key);
|
3465
|
+
}
|
3466
|
+
value = replacer.call(parent, key, value);
|
3467
|
+
switch (typeof value) {
|
3468
|
+
case "string":
|
3469
|
+
return strEscape(value);
|
3470
|
+
case "object": {
|
3471
|
+
if (value === null) {
|
3472
|
+
return "null";
|
3473
|
+
}
|
3474
|
+
if (stack.indexOf(value) !== -1) {
|
3475
|
+
return circularValue;
|
3476
|
+
}
|
3477
|
+
let res = "";
|
3478
|
+
let join = ",";
|
3479
|
+
const originalIndentation = indentation;
|
3480
|
+
if (Array.isArray(value)) {
|
3481
|
+
if (value.length === 0) {
|
3482
|
+
return "[]";
|
3483
|
+
}
|
3484
|
+
if (maximumDepth < stack.length + 1) {
|
3485
|
+
return '"[Array]"';
|
3486
|
+
}
|
3487
|
+
stack.push(value);
|
3488
|
+
if (spacer !== "") {
|
3489
|
+
indentation += spacer;
|
3490
|
+
res += `
|
3491
|
+
${indentation}`;
|
3492
|
+
join = `,
|
3493
|
+
${indentation}`;
|
3494
|
+
}
|
3495
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
3496
|
+
let i = 0;
|
3497
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
3498
|
+
const tmp2 = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
3499
|
+
res += tmp2 !== void 0 ? tmp2 : "null";
|
3500
|
+
res += join;
|
3501
|
+
}
|
3502
|
+
const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation);
|
3503
|
+
res += tmp !== void 0 ? tmp : "null";
|
3504
|
+
if (value.length - 1 > maximumBreadth) {
|
3505
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
3506
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
3507
|
+
}
|
3508
|
+
if (spacer !== "") {
|
3509
|
+
res += `
|
3510
|
+
${originalIndentation}`;
|
3511
|
+
}
|
3512
|
+
stack.pop();
|
3513
|
+
return `[${res}]`;
|
3514
|
+
}
|
3515
|
+
let keys = Object.keys(value);
|
3516
|
+
const keyLength = keys.length;
|
3517
|
+
if (keyLength === 0) {
|
3518
|
+
return "{}";
|
3519
|
+
}
|
3520
|
+
if (maximumDepth < stack.length + 1) {
|
3521
|
+
return '"[Object]"';
|
3522
|
+
}
|
3523
|
+
let whitespace = "";
|
3524
|
+
let separator = "";
|
3525
|
+
if (spacer !== "") {
|
3526
|
+
indentation += spacer;
|
3527
|
+
join = `,
|
3528
|
+
${indentation}`;
|
3529
|
+
whitespace = " ";
|
3530
|
+
}
|
3531
|
+
const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
3532
|
+
if (deterministic && !isTypedArrayWithEntries(value)) {
|
3533
|
+
keys = insertSort(keys);
|
3534
|
+
}
|
3535
|
+
stack.push(value);
|
3536
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
3537
|
+
const key2 = keys[i];
|
3538
|
+
const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
|
3539
|
+
if (tmp !== void 0) {
|
3540
|
+
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
3541
|
+
separator = join;
|
3542
|
+
}
|
3543
|
+
}
|
3544
|
+
if (keyLength > maximumBreadth) {
|
3545
|
+
const removedKeys = keyLength - maximumBreadth;
|
3546
|
+
res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
|
3547
|
+
separator = join;
|
3548
|
+
}
|
3549
|
+
if (spacer !== "" && separator.length > 1) {
|
3550
|
+
res = `
|
3551
|
+
${indentation}${res}
|
3552
|
+
${originalIndentation}`;
|
3553
|
+
}
|
3554
|
+
stack.pop();
|
3555
|
+
return `{${res}}`;
|
3556
|
+
}
|
3557
|
+
case "number":
|
3558
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
3559
|
+
case "boolean":
|
3560
|
+
return value === true ? "true" : "false";
|
3561
|
+
case "undefined":
|
3562
|
+
return void 0;
|
3563
|
+
case "bigint":
|
3564
|
+
if (bigint) {
|
3565
|
+
return String(value);
|
3566
|
+
}
|
3567
|
+
default:
|
3568
|
+
return fail ? fail(value) : void 0;
|
3569
|
+
}
|
3570
|
+
}
|
3571
|
+
function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
|
3572
|
+
if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
|
3573
|
+
value = value.toJSON(key);
|
3574
|
+
}
|
3575
|
+
switch (typeof value) {
|
3576
|
+
case "string":
|
3577
|
+
return strEscape(value);
|
3578
|
+
case "object": {
|
3579
|
+
if (value === null) {
|
3580
|
+
return "null";
|
3581
|
+
}
|
3582
|
+
if (stack.indexOf(value) !== -1) {
|
3583
|
+
return circularValue;
|
3584
|
+
}
|
3585
|
+
const originalIndentation = indentation;
|
3586
|
+
let res = "";
|
3587
|
+
let join = ",";
|
3588
|
+
if (Array.isArray(value)) {
|
3589
|
+
if (value.length === 0) {
|
3590
|
+
return "[]";
|
3591
|
+
}
|
3592
|
+
if (maximumDepth < stack.length + 1) {
|
3593
|
+
return '"[Array]"';
|
3594
|
+
}
|
3595
|
+
stack.push(value);
|
3596
|
+
if (spacer !== "") {
|
3597
|
+
indentation += spacer;
|
3598
|
+
res += `
|
3599
|
+
${indentation}`;
|
3600
|
+
join = `,
|
3601
|
+
${indentation}`;
|
3602
|
+
}
|
3603
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
3604
|
+
let i = 0;
|
3605
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
3606
|
+
const tmp2 = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
3607
|
+
res += tmp2 !== void 0 ? tmp2 : "null";
|
3608
|
+
res += join;
|
3609
|
+
}
|
3610
|
+
const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation);
|
3611
|
+
res += tmp !== void 0 ? tmp : "null";
|
3612
|
+
if (value.length - 1 > maximumBreadth) {
|
3613
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
3614
|
+
res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
|
3615
|
+
}
|
3616
|
+
if (spacer !== "") {
|
3617
|
+
res += `
|
3618
|
+
${originalIndentation}`;
|
3619
|
+
}
|
3620
|
+
stack.pop();
|
3621
|
+
return `[${res}]`;
|
3622
|
+
}
|
3623
|
+
stack.push(value);
|
3624
|
+
let whitespace = "";
|
3625
|
+
if (spacer !== "") {
|
3626
|
+
indentation += spacer;
|
3627
|
+
join = `,
|
3628
|
+
${indentation}`;
|
3629
|
+
whitespace = " ";
|
3630
|
+
}
|
3631
|
+
let separator = "";
|
3632
|
+
for (const key2 of replacer) {
|
3633
|
+
const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
|
3634
|
+
if (tmp !== void 0) {
|
3635
|
+
res += `${separator}${strEscape(key2)}:${whitespace}${tmp}`;
|
3636
|
+
separator = join;
|
3637
|
+
}
|
3638
|
+
}
|
3639
|
+
if (spacer !== "" && separator.length > 1) {
|
3640
|
+
res = `
|
3641
|
+
${indentation}${res}
|
3642
|
+
${originalIndentation}`;
|
3643
|
+
}
|
3644
|
+
stack.pop();
|
3645
|
+
return `{${res}}`;
|
3646
|
+
}
|
3647
|
+
case "number":
|
3648
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
3649
|
+
case "boolean":
|
3650
|
+
return value === true ? "true" : "false";
|
3651
|
+
case "undefined":
|
3652
|
+
return void 0;
|
3653
|
+
case "bigint":
|
3654
|
+
if (bigint) {
|
3655
|
+
return String(value);
|
3656
|
+
}
|
3657
|
+
default:
|
3658
|
+
return fail ? fail(value) : void 0;
|
3659
|
+
}
|
3660
|
+
}
|
3661
|
+
function stringifyIndent(key, value, stack, spacer, indentation) {
|
3662
|
+
switch (typeof value) {
|
3663
|
+
case "string":
|
3664
|
+
return strEscape(value);
|
3665
|
+
case "object": {
|
3666
|
+
if (value === null) {
|
3667
|
+
return "null";
|
3668
|
+
}
|
3669
|
+
if (typeof value.toJSON === "function") {
|
3670
|
+
value = value.toJSON(key);
|
3671
|
+
if (typeof value !== "object") {
|
3672
|
+
return stringifyIndent(key, value, stack, spacer, indentation);
|
3673
|
+
}
|
3674
|
+
if (value === null) {
|
3675
|
+
return "null";
|
3676
|
+
}
|
3677
|
+
}
|
3678
|
+
if (stack.indexOf(value) !== -1) {
|
3679
|
+
return circularValue;
|
3680
|
+
}
|
3681
|
+
const originalIndentation = indentation;
|
3682
|
+
if (Array.isArray(value)) {
|
3683
|
+
if (value.length === 0) {
|
3684
|
+
return "[]";
|
3685
|
+
}
|
3686
|
+
if (maximumDepth < stack.length + 1) {
|
3687
|
+
return '"[Array]"';
|
3688
|
+
}
|
3689
|
+
stack.push(value);
|
3690
|
+
indentation += spacer;
|
3691
|
+
let res2 = `
|
3692
|
+
${indentation}`;
|
3693
|
+
const join2 = `,
|
3694
|
+
${indentation}`;
|
3695
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
3696
|
+
let i = 0;
|
3697
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
3698
|
+
const tmp2 = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
3699
|
+
res2 += tmp2 !== void 0 ? tmp2 : "null";
|
3700
|
+
res2 += join2;
|
3701
|
+
}
|
3702
|
+
const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation);
|
3703
|
+
res2 += tmp !== void 0 ? tmp : "null";
|
3704
|
+
if (value.length - 1 > maximumBreadth) {
|
3705
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
3706
|
+
res2 += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
|
3707
|
+
}
|
3708
|
+
res2 += `
|
3709
|
+
${originalIndentation}`;
|
3710
|
+
stack.pop();
|
3711
|
+
return `[${res2}]`;
|
3712
|
+
}
|
3713
|
+
let keys = Object.keys(value);
|
3714
|
+
const keyLength = keys.length;
|
3715
|
+
if (keyLength === 0) {
|
3716
|
+
return "{}";
|
3717
|
+
}
|
3718
|
+
if (maximumDepth < stack.length + 1) {
|
3719
|
+
return '"[Object]"';
|
3720
|
+
}
|
3721
|
+
indentation += spacer;
|
3722
|
+
const join = `,
|
3723
|
+
${indentation}`;
|
3724
|
+
let res = "";
|
3725
|
+
let separator = "";
|
3726
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
3727
|
+
if (isTypedArrayWithEntries(value)) {
|
3728
|
+
res += stringifyTypedArray(value, join, maximumBreadth);
|
3729
|
+
keys = keys.slice(value.length);
|
3730
|
+
maximumPropertiesToStringify -= value.length;
|
3731
|
+
separator = join;
|
3732
|
+
}
|
3733
|
+
if (deterministic) {
|
3734
|
+
keys = insertSort(keys);
|
3735
|
+
}
|
3736
|
+
stack.push(value);
|
3737
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
3738
|
+
const key2 = keys[i];
|
3739
|
+
const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
|
3740
|
+
if (tmp !== void 0) {
|
3741
|
+
res += `${separator}${strEscape(key2)}: ${tmp}`;
|
3742
|
+
separator = join;
|
3743
|
+
}
|
3744
|
+
}
|
3745
|
+
if (keyLength > maximumBreadth) {
|
3746
|
+
const removedKeys = keyLength - maximumBreadth;
|
3747
|
+
res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
|
3748
|
+
separator = join;
|
3749
|
+
}
|
3750
|
+
if (separator !== "") {
|
3751
|
+
res = `
|
3752
|
+
${indentation}${res}
|
3753
|
+
${originalIndentation}`;
|
3754
|
+
}
|
3755
|
+
stack.pop();
|
3756
|
+
return `{${res}}`;
|
3757
|
+
}
|
3758
|
+
case "number":
|
3759
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
3760
|
+
case "boolean":
|
3761
|
+
return value === true ? "true" : "false";
|
3762
|
+
case "undefined":
|
3763
|
+
return void 0;
|
3764
|
+
case "bigint":
|
3765
|
+
if (bigint) {
|
3766
|
+
return String(value);
|
3767
|
+
}
|
3768
|
+
default:
|
3769
|
+
return fail ? fail(value) : void 0;
|
3770
|
+
}
|
3771
|
+
}
|
3772
|
+
function stringifySimple(key, value, stack) {
|
3773
|
+
switch (typeof value) {
|
3774
|
+
case "string":
|
3775
|
+
return strEscape(value);
|
3776
|
+
case "object": {
|
3777
|
+
if (value === null) {
|
3778
|
+
return "null";
|
3779
|
+
}
|
3780
|
+
if (typeof value.toJSON === "function") {
|
3781
|
+
value = value.toJSON(key);
|
3782
|
+
if (typeof value !== "object") {
|
3783
|
+
return stringifySimple(key, value, stack);
|
3784
|
+
}
|
3785
|
+
if (value === null) {
|
3786
|
+
return "null";
|
3787
|
+
}
|
3788
|
+
}
|
3789
|
+
if (stack.indexOf(value) !== -1) {
|
3790
|
+
return circularValue;
|
3791
|
+
}
|
3792
|
+
let res = "";
|
3793
|
+
if (Array.isArray(value)) {
|
3794
|
+
if (value.length === 0) {
|
3795
|
+
return "[]";
|
3796
|
+
}
|
3797
|
+
if (maximumDepth < stack.length + 1) {
|
3798
|
+
return '"[Array]"';
|
3799
|
+
}
|
3800
|
+
stack.push(value);
|
3801
|
+
const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
|
3802
|
+
let i = 0;
|
3803
|
+
for (; i < maximumValuesToStringify - 1; i++) {
|
3804
|
+
const tmp2 = stringifySimple(String(i), value[i], stack);
|
3805
|
+
res += tmp2 !== void 0 ? tmp2 : "null";
|
3806
|
+
res += ",";
|
3807
|
+
}
|
3808
|
+
const tmp = stringifySimple(String(i), value[i], stack);
|
3809
|
+
res += tmp !== void 0 ? tmp : "null";
|
3810
|
+
if (value.length - 1 > maximumBreadth) {
|
3811
|
+
const removedKeys = value.length - maximumBreadth - 1;
|
3812
|
+
res += `,"... ${getItemCount(removedKeys)} not stringified"`;
|
3813
|
+
}
|
3814
|
+
stack.pop();
|
3815
|
+
return `[${res}]`;
|
3816
|
+
}
|
3817
|
+
let keys = Object.keys(value);
|
3818
|
+
const keyLength = keys.length;
|
3819
|
+
if (keyLength === 0) {
|
3820
|
+
return "{}";
|
3821
|
+
}
|
3822
|
+
if (maximumDepth < stack.length + 1) {
|
3823
|
+
return '"[Object]"';
|
3824
|
+
}
|
3825
|
+
let separator = "";
|
3826
|
+
let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
|
3827
|
+
if (isTypedArrayWithEntries(value)) {
|
3828
|
+
res += stringifyTypedArray(value, ",", maximumBreadth);
|
3829
|
+
keys = keys.slice(value.length);
|
3830
|
+
maximumPropertiesToStringify -= value.length;
|
3831
|
+
separator = ",";
|
3832
|
+
}
|
3833
|
+
if (deterministic) {
|
3834
|
+
keys = insertSort(keys);
|
3835
|
+
}
|
3836
|
+
stack.push(value);
|
3837
|
+
for (let i = 0; i < maximumPropertiesToStringify; i++) {
|
3838
|
+
const key2 = keys[i];
|
3839
|
+
const tmp = stringifySimple(key2, value[key2], stack);
|
3840
|
+
if (tmp !== void 0) {
|
3841
|
+
res += `${separator}${strEscape(key2)}:${tmp}`;
|
3842
|
+
separator = ",";
|
3843
|
+
}
|
3844
|
+
}
|
3845
|
+
if (keyLength > maximumBreadth) {
|
3846
|
+
const removedKeys = keyLength - maximumBreadth;
|
3847
|
+
res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
|
3848
|
+
}
|
3849
|
+
stack.pop();
|
3850
|
+
return `{${res}}`;
|
3851
|
+
}
|
3852
|
+
case "number":
|
3853
|
+
return isFinite(value) ? String(value) : fail ? fail(value) : "null";
|
3854
|
+
case "boolean":
|
3855
|
+
return value === true ? "true" : "false";
|
3856
|
+
case "undefined":
|
3857
|
+
return void 0;
|
3858
|
+
case "bigint":
|
3859
|
+
if (bigint) {
|
3860
|
+
return String(value);
|
3861
|
+
}
|
3862
|
+
default:
|
3863
|
+
return fail ? fail(value) : void 0;
|
3864
|
+
}
|
3865
|
+
}
|
3866
|
+
function stringify2(value, replacer, space) {
|
3867
|
+
if (arguments.length > 1) {
|
3868
|
+
let spacer = "";
|
3869
|
+
if (typeof space === "number") {
|
3870
|
+
spacer = " ".repeat(Math.min(space, 10));
|
3871
|
+
} else if (typeof space === "string") {
|
3872
|
+
spacer = space.slice(0, 10);
|
3873
|
+
}
|
3874
|
+
if (replacer != null) {
|
3875
|
+
if (typeof replacer === "function") {
|
3876
|
+
return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
|
3877
|
+
}
|
3878
|
+
if (Array.isArray(replacer)) {
|
3879
|
+
return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
|
3880
|
+
}
|
3881
|
+
}
|
3882
|
+
if (spacer.length !== 0) {
|
3883
|
+
return stringifyIndent("", value, [], spacer, "");
|
3884
|
+
}
|
3885
|
+
}
|
3886
|
+
return stringifySimple("", value, []);
|
3887
|
+
}
|
3888
|
+
return stringify2;
|
3889
|
+
}
|
3890
|
+
}
|
3891
|
+
});
|
3892
|
+
|
3893
|
+
// node_modules/pino/lib/multistream.js
|
3894
|
+
var require_multistream = __commonJS({
|
3895
|
+
"node_modules/pino/lib/multistream.js"(exports2, module2) {
|
3896
|
+
"use strict";
|
3897
|
+
var metadata = Symbol.for("pino.metadata");
|
3898
|
+
var { DEFAULT_LEVELS } = require_constants();
|
3899
|
+
var DEFAULT_INFO_LEVEL = DEFAULT_LEVELS.info;
|
3900
|
+
function multistream(streamsArray, opts) {
|
3901
|
+
let counter = 0;
|
3902
|
+
streamsArray = streamsArray || [];
|
3903
|
+
opts = opts || { dedupe: false };
|
3904
|
+
const streamLevels = Object.create(DEFAULT_LEVELS);
|
3905
|
+
streamLevels.silent = Infinity;
|
3906
|
+
if (opts.levels && typeof opts.levels === "object") {
|
3907
|
+
Object.keys(opts.levels).forEach((i) => {
|
3908
|
+
streamLevels[i] = opts.levels[i];
|
3909
|
+
});
|
3910
|
+
}
|
3911
|
+
const res = {
|
3912
|
+
write,
|
3913
|
+
add,
|
3914
|
+
flushSync,
|
3915
|
+
end,
|
3916
|
+
minLevel: 0,
|
3917
|
+
streams: [],
|
3918
|
+
clone,
|
3919
|
+
[metadata]: true,
|
3920
|
+
streamLevels
|
3921
|
+
};
|
3922
|
+
if (Array.isArray(streamsArray)) {
|
3923
|
+
streamsArray.forEach(add, res);
|
3924
|
+
} else {
|
3925
|
+
add.call(res, streamsArray);
|
3926
|
+
}
|
3927
|
+
streamsArray = null;
|
3928
|
+
return res;
|
3929
|
+
function write(data) {
|
3930
|
+
let dest;
|
3931
|
+
const level = this.lastLevel;
|
3932
|
+
const { streams } = this;
|
3933
|
+
let recordedLevel = 0;
|
3934
|
+
let stream;
|
3935
|
+
for (let i = initLoopVar(streams.length, opts.dedupe); checkLoopVar(i, streams.length, opts.dedupe); i = adjustLoopVar(i, opts.dedupe)) {
|
3936
|
+
dest = streams[i];
|
3937
|
+
if (dest.level <= level) {
|
3938
|
+
if (recordedLevel !== 0 && recordedLevel !== dest.level) {
|
3939
|
+
break;
|
3940
|
+
}
|
3941
|
+
stream = dest.stream;
|
3942
|
+
if (stream[metadata]) {
|
3943
|
+
const { lastTime, lastMsg, lastObj, lastLogger } = this;
|
3944
|
+
stream.lastLevel = level;
|
3945
|
+
stream.lastTime = lastTime;
|
3946
|
+
stream.lastMsg = lastMsg;
|
3947
|
+
stream.lastObj = lastObj;
|
3948
|
+
stream.lastLogger = lastLogger;
|
3949
|
+
}
|
3950
|
+
stream.write(data);
|
3951
|
+
if (opts.dedupe) {
|
3952
|
+
recordedLevel = dest.level;
|
3953
|
+
}
|
3954
|
+
} else if (!opts.dedupe) {
|
3955
|
+
break;
|
3956
|
+
}
|
3957
|
+
}
|
3958
|
+
}
|
3959
|
+
function flushSync() {
|
3960
|
+
for (const { stream } of this.streams) {
|
3961
|
+
if (typeof stream.flushSync === "function") {
|
3962
|
+
stream.flushSync();
|
3963
|
+
}
|
3964
|
+
}
|
3965
|
+
}
|
3966
|
+
function add(dest) {
|
3967
|
+
if (!dest) {
|
3968
|
+
return res;
|
3969
|
+
}
|
3970
|
+
const isStream = typeof dest.write === "function" || dest.stream;
|
3971
|
+
const stream_ = dest.write ? dest : dest.stream;
|
3972
|
+
if (!isStream) {
|
3973
|
+
throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");
|
3974
|
+
}
|
3975
|
+
const { streams, streamLevels: streamLevels2 } = this;
|
3976
|
+
let level;
|
3977
|
+
if (typeof dest.levelVal === "number") {
|
3978
|
+
level = dest.levelVal;
|
3979
|
+
} else if (typeof dest.level === "string") {
|
3980
|
+
level = streamLevels2[dest.level];
|
3981
|
+
} else if (typeof dest.level === "number") {
|
3982
|
+
level = dest.level;
|
3983
|
+
} else {
|
3984
|
+
level = DEFAULT_INFO_LEVEL;
|
3985
|
+
}
|
3986
|
+
const dest_ = {
|
3987
|
+
stream: stream_,
|
3988
|
+
level,
|
3989
|
+
levelVal: void 0,
|
3990
|
+
id: counter++
|
3991
|
+
};
|
3992
|
+
streams.unshift(dest_);
|
3993
|
+
streams.sort(compareByLevel);
|
3994
|
+
this.minLevel = streams[0].level;
|
3995
|
+
return res;
|
3996
|
+
}
|
3997
|
+
function end() {
|
3998
|
+
for (const { stream } of this.streams) {
|
3999
|
+
if (typeof stream.flushSync === "function") {
|
4000
|
+
stream.flushSync();
|
4001
|
+
}
|
4002
|
+
stream.end();
|
4003
|
+
}
|
4004
|
+
}
|
4005
|
+
function clone(level) {
|
4006
|
+
const streams = new Array(this.streams.length);
|
4007
|
+
for (let i = 0; i < streams.length; i++) {
|
4008
|
+
streams[i] = {
|
4009
|
+
level,
|
4010
|
+
stream: this.streams[i].stream
|
4011
|
+
};
|
4012
|
+
}
|
4013
|
+
return {
|
4014
|
+
write,
|
4015
|
+
add,
|
4016
|
+
minLevel: level,
|
4017
|
+
streams,
|
4018
|
+
clone,
|
4019
|
+
flushSync,
|
4020
|
+
[metadata]: true
|
4021
|
+
};
|
4022
|
+
}
|
4023
|
+
}
|
4024
|
+
function compareByLevel(a, b) {
|
4025
|
+
return a.level - b.level;
|
4026
|
+
}
|
4027
|
+
function initLoopVar(length, dedupe) {
|
4028
|
+
return dedupe ? length - 1 : 0;
|
4029
|
+
}
|
4030
|
+
function adjustLoopVar(i, dedupe) {
|
4031
|
+
return dedupe ? i - 1 : i + 1;
|
4032
|
+
}
|
4033
|
+
function checkLoopVar(i, length, dedupe) {
|
4034
|
+
return dedupe ? i >= 0 : i < length;
|
4035
|
+
}
|
4036
|
+
module2.exports = multistream;
|
4037
|
+
}
|
4038
|
+
});
|
4039
|
+
|
4040
|
+
// node_modules/pino/pino.js
|
4041
|
+
var require_pino = __commonJS({
|
4042
|
+
"node_modules/pino/pino.js"(exports2, module2) {
|
4043
|
+
function pinoBundlerAbsolutePath(p) {
|
4044
|
+
try {
|
4045
|
+
return require("path").join(`${process.cwd()}${require("path").sep}lib`.replace(/\\/g, "/"), p);
|
4046
|
+
} catch (e) {
|
4047
|
+
const f = new Function("p", "return new URL(p, import.meta.url).pathname");
|
4048
|
+
return f(p);
|
4049
|
+
}
|
4050
|
+
}
|
4051
|
+
globalThis.__bundlerPathsOverrides = { ...globalThis.__bundlerPathsOverrides || {}, "thread-stream-worker": pinoBundlerAbsolutePath("./thread-stream-worker.js"), "pino-worker": pinoBundlerAbsolutePath("./pino-worker.js"), "pino-pipeline-worker": pinoBundlerAbsolutePath("./pino-pipeline-worker.js"), "pino/file": pinoBundlerAbsolutePath("./pino-file.js"), "pino-pretty": pinoBundlerAbsolutePath("./pino-pretty.js") };
|
4052
|
+
var os = require("os");
|
4053
|
+
var stdSerializers = require_pino_std_serializers();
|
4054
|
+
var caller = require_caller();
|
4055
|
+
var redaction = require_redaction();
|
4056
|
+
var time = require_time();
|
4057
|
+
var proto = require_proto();
|
4058
|
+
var symbols = require_symbols();
|
4059
|
+
var { configure } = require_safe_stable_stringify();
|
4060
|
+
var { assertDefaultLevelFound, mappings, genLsCache, genLevelComparison, assertLevelComparison } = require_levels();
|
4061
|
+
var { DEFAULT_LEVELS, SORTING_ORDER } = require_constants();
|
4062
|
+
var {
|
4063
|
+
createArgsNormalizer,
|
4064
|
+
asChindings,
|
4065
|
+
buildSafeSonicBoom,
|
4066
|
+
buildFormatters,
|
4067
|
+
stringify,
|
4068
|
+
normalizeDestFileDescriptor,
|
4069
|
+
noop
|
4070
|
+
} = require_tools();
|
4071
|
+
var { version } = require_meta();
|
4072
|
+
var {
|
4073
|
+
chindingsSym,
|
4074
|
+
redactFmtSym,
|
4075
|
+
serializersSym,
|
4076
|
+
timeSym,
|
4077
|
+
timeSliceIndexSym,
|
4078
|
+
streamSym,
|
4079
|
+
stringifySym,
|
4080
|
+
stringifySafeSym,
|
4081
|
+
stringifiersSym,
|
4082
|
+
setLevelSym,
|
4083
|
+
endSym,
|
4084
|
+
formatOptsSym,
|
4085
|
+
messageKeySym,
|
4086
|
+
errorKeySym,
|
4087
|
+
nestedKeySym,
|
4088
|
+
mixinSym,
|
4089
|
+
levelCompSym,
|
4090
|
+
useOnlyCustomLevelsSym,
|
4091
|
+
formattersSym,
|
4092
|
+
hooksSym,
|
4093
|
+
nestedKeyStrSym,
|
4094
|
+
mixinMergeStrategySym,
|
4095
|
+
msgPrefixSym
|
4096
|
+
} = symbols;
|
4097
|
+
var { epochTime, nullTime } = time;
|
4098
|
+
var { pid } = process;
|
4099
|
+
var hostname = os.hostname();
|
4100
|
+
var defaultErrorSerializer = stdSerializers.err;
|
4101
|
+
var defaultOptions = {
|
4102
|
+
level: "info",
|
4103
|
+
levelComparison: SORTING_ORDER.ASC,
|
4104
|
+
levels: DEFAULT_LEVELS,
|
4105
|
+
messageKey: "msg",
|
4106
|
+
errorKey: "err",
|
4107
|
+
nestedKey: null,
|
4108
|
+
enabled: true,
|
4109
|
+
base: { pid, hostname },
|
4110
|
+
serializers: Object.assign(/* @__PURE__ */ Object.create(null), {
|
4111
|
+
err: defaultErrorSerializer
|
4112
|
+
}),
|
4113
|
+
formatters: Object.assign(/* @__PURE__ */ Object.create(null), {
|
4114
|
+
bindings(bindings) {
|
4115
|
+
return bindings;
|
4116
|
+
},
|
4117
|
+
level(label, number) {
|
4118
|
+
return { level: number };
|
4119
|
+
}
|
4120
|
+
}),
|
4121
|
+
hooks: {
|
4122
|
+
logMethod: void 0
|
4123
|
+
},
|
4124
|
+
timestamp: epochTime,
|
4125
|
+
name: void 0,
|
4126
|
+
redact: null,
|
4127
|
+
customLevels: null,
|
4128
|
+
useOnlyCustomLevels: false,
|
4129
|
+
depthLimit: 5,
|
4130
|
+
edgeLimit: 100
|
4131
|
+
};
|
4132
|
+
var normalize = createArgsNormalizer(defaultOptions);
|
4133
|
+
var serializers = Object.assign(/* @__PURE__ */ Object.create(null), stdSerializers);
|
4134
|
+
function pino2(...args) {
|
4135
|
+
const instance = {};
|
4136
|
+
const { opts, stream } = normalize(instance, caller(), ...args);
|
4137
|
+
const {
|
4138
|
+
redact,
|
4139
|
+
crlf,
|
4140
|
+
serializers: serializers2,
|
4141
|
+
timestamp,
|
4142
|
+
messageKey,
|
4143
|
+
errorKey,
|
4144
|
+
nestedKey,
|
4145
|
+
base,
|
4146
|
+
name,
|
4147
|
+
level,
|
4148
|
+
customLevels,
|
4149
|
+
levelComparison,
|
4150
|
+
mixin,
|
4151
|
+
mixinMergeStrategy,
|
4152
|
+
useOnlyCustomLevels,
|
4153
|
+
formatters,
|
4154
|
+
hooks,
|
4155
|
+
depthLimit,
|
4156
|
+
edgeLimit,
|
4157
|
+
onChild,
|
4158
|
+
msgPrefix
|
4159
|
+
} = opts;
|
4160
|
+
const stringifySafe = configure({
|
4161
|
+
maximumDepth: depthLimit,
|
4162
|
+
maximumBreadth: edgeLimit
|
4163
|
+
});
|
4164
|
+
const allFormatters = buildFormatters(
|
4165
|
+
formatters.level,
|
4166
|
+
formatters.bindings,
|
4167
|
+
formatters.log
|
4168
|
+
);
|
4169
|
+
const stringifyFn = stringify.bind({
|
4170
|
+
[stringifySafeSym]: stringifySafe
|
4171
|
+
});
|
4172
|
+
const stringifiers = redact ? redaction(redact, stringifyFn) : {};
|
4173
|
+
const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify: stringifyFn };
|
4174
|
+
const end = "}" + (crlf ? "\r\n" : "\n");
|
4175
|
+
const coreChindings = asChindings.bind(null, {
|
4176
|
+
[chindingsSym]: "",
|
4177
|
+
[serializersSym]: serializers2,
|
4178
|
+
[stringifiersSym]: stringifiers,
|
4179
|
+
[stringifySym]: stringify,
|
4180
|
+
[stringifySafeSym]: stringifySafe,
|
4181
|
+
[formattersSym]: allFormatters
|
4182
|
+
});
|
4183
|
+
let chindings = "";
|
4184
|
+
if (base !== null) {
|
4185
|
+
if (name === void 0) {
|
4186
|
+
chindings = coreChindings(base);
|
4187
|
+
} else {
|
4188
|
+
chindings = coreChindings(Object.assign({}, base, { name }));
|
4189
|
+
}
|
4190
|
+
}
|
4191
|
+
const time2 = timestamp instanceof Function ? timestamp : timestamp ? epochTime : nullTime;
|
4192
|
+
const timeSliceIndex = time2().indexOf(":") + 1;
|
4193
|
+
if (useOnlyCustomLevels && !customLevels)
|
4194
|
+
throw Error("customLevels is required if useOnlyCustomLevels is set true");
|
4195
|
+
if (mixin && typeof mixin !== "function")
|
4196
|
+
throw Error(`Unknown mixin type "${typeof mixin}" - expected "function"`);
|
4197
|
+
if (msgPrefix && typeof msgPrefix !== "string")
|
4198
|
+
throw Error(`Unknown msgPrefix type "${typeof msgPrefix}" - expected "string"`);
|
4199
|
+
assertDefaultLevelFound(level, customLevels, useOnlyCustomLevels);
|
4200
|
+
const levels = mappings(customLevels, useOnlyCustomLevels);
|
4201
|
+
assertLevelComparison(levelComparison);
|
4202
|
+
const levelCompFunc = genLevelComparison(levelComparison);
|
4203
|
+
Object.assign(instance, {
|
4204
|
+
levels,
|
4205
|
+
[levelCompSym]: levelCompFunc,
|
4206
|
+
[useOnlyCustomLevelsSym]: useOnlyCustomLevels,
|
4207
|
+
[streamSym]: stream,
|
4208
|
+
[timeSym]: time2,
|
4209
|
+
[timeSliceIndexSym]: timeSliceIndex,
|
4210
|
+
[stringifySym]: stringify,
|
4211
|
+
[stringifySafeSym]: stringifySafe,
|
4212
|
+
[stringifiersSym]: stringifiers,
|
4213
|
+
[endSym]: end,
|
4214
|
+
[formatOptsSym]: formatOpts,
|
4215
|
+
[messageKeySym]: messageKey,
|
4216
|
+
[errorKeySym]: errorKey,
|
4217
|
+
[nestedKeySym]: nestedKey,
|
4218
|
+
// protect against injection
|
4219
|
+
[nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
|
4220
|
+
[serializersSym]: serializers2,
|
4221
|
+
[mixinSym]: mixin,
|
4222
|
+
[mixinMergeStrategySym]: mixinMergeStrategy,
|
4223
|
+
[chindingsSym]: chindings,
|
4224
|
+
[formattersSym]: allFormatters,
|
4225
|
+
[hooksSym]: hooks,
|
4226
|
+
silent: noop,
|
4227
|
+
onChild,
|
4228
|
+
[msgPrefixSym]: msgPrefix
|
4229
|
+
});
|
4230
|
+
Object.setPrototypeOf(instance, proto());
|
4231
|
+
genLsCache(instance);
|
4232
|
+
instance[setLevelSym](level);
|
4233
|
+
return instance;
|
4234
|
+
}
|
4235
|
+
module2.exports = pino2;
|
4236
|
+
module2.exports.destination = (dest = process.stdout.fd) => {
|
4237
|
+
if (typeof dest === "object") {
|
4238
|
+
dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
|
4239
|
+
return buildSafeSonicBoom(dest);
|
4240
|
+
} else {
|
4241
|
+
return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0 });
|
4242
|
+
}
|
4243
|
+
};
|
4244
|
+
module2.exports.transport = require_transport();
|
4245
|
+
module2.exports.multistream = require_multistream();
|
4246
|
+
module2.exports.levels = mappings();
|
4247
|
+
module2.exports.stdSerializers = serializers;
|
4248
|
+
module2.exports.stdTimeFunctions = Object.assign({}, time);
|
4249
|
+
module2.exports.symbols = symbols;
|
4250
|
+
module2.exports.version = version;
|
4251
|
+
module2.exports.default = pino2;
|
4252
|
+
module2.exports.pino = pino2;
|
4253
|
+
}
|
4254
|
+
});
|
4255
|
+
|
4256
|
+
// node_modules/pino/file.js
|
4257
|
+
var pino = require_pino();
|
4258
|
+
var { once } = require("events");
|
4259
|
+
module.exports = async function(opts = {}) {
|
4260
|
+
const destOpts = Object.assign({}, opts, { dest: opts.destination || 1, sync: false });
|
4261
|
+
delete destOpts.destination;
|
4262
|
+
const destination = pino.destination(destOpts);
|
4263
|
+
await once(destination, "ready");
|
4264
|
+
return destination;
|
4265
|
+
};
|