@basemaps/lambda-tiler 6.15.0 → 6.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
8
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
9
  var __commonJS = (cb, mod) => function __require() {
9
10
  return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
@@ -24,10 +25,42 @@ var __reExport = (target, module2, desc) => {
24
25
  var __toModule = (module2) => {
25
26
  return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
26
27
  };
28
+ var __publicField = (obj, key, value) => {
29
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
30
+ return value;
31
+ };
32
+ var __accessCheck = (obj, member, msg) => {
33
+ if (!member.has(obj))
34
+ throw TypeError("Cannot " + msg);
35
+ };
36
+ var __privateGet = (obj, member, getter) => {
37
+ __accessCheck(obj, member, "read from private field");
38
+ return getter ? getter.call(obj) : member.get(obj);
39
+ };
40
+ var __privateAdd = (obj, member, value) => {
41
+ if (member.has(obj))
42
+ throw TypeError("Cannot add the same private member more than once");
43
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
44
+ };
45
+ var __privateSet = (obj, member, value, setter) => {
46
+ __accessCheck(obj, member, "write to private field");
47
+ setter ? setter.call(obj, value) : member.set(obj, value);
48
+ return value;
49
+ };
50
+ var __privateWrapper = (obj, member, setter, getter) => {
51
+ return {
52
+ set _(value) {
53
+ __privateSet(obj, member, value, setter);
54
+ },
55
+ get _() {
56
+ return __privateGet(obj, member, getter);
57
+ }
58
+ };
59
+ };
27
60
 
28
- // ../../node_modules/pino-std-serializers/lib/err.js
61
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/err.js
29
62
  var require_err = __commonJS({
30
- "../../node_modules/pino-std-serializers/lib/err.js"(exports, module2) {
63
+ "../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/err.js"(exports, module2) {
31
64
  "use strict";
32
65
  module2.exports = errSerializer;
33
66
  var { toString } = Object.prototype;
@@ -91,9 +124,9 @@ var require_err = __commonJS({
91
124
  }
92
125
  });
93
126
 
94
- // ../../node_modules/pino-std-serializers/lib/req.js
127
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/req.js
95
128
  var require_req = __commonJS({
96
- "../../node_modules/pino-std-serializers/lib/req.js"(exports, module2) {
129
+ "../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/req.js"(exports, module2) {
97
130
  "use strict";
98
131
  module2.exports = {
99
132
  mapHttpRequest,
@@ -169,9 +202,9 @@ var require_req = __commonJS({
169
202
  }
170
203
  });
171
204
 
172
- // ../../node_modules/pino-std-serializers/lib/res.js
205
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/res.js
173
206
  var require_res = __commonJS({
174
- "../../node_modules/pino-std-serializers/lib/res.js"(exports, module2) {
207
+ "../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/res.js"(exports, module2) {
175
208
  "use strict";
176
209
  module2.exports = {
177
210
  mapHttpResponse,
@@ -218,9 +251,9 @@ var require_res = __commonJS({
218
251
  }
219
252
  });
220
253
 
221
- // ../../node_modules/pino-std-serializers/index.js
254
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/index.js
222
255
  var require_pino_std_serializers = __commonJS({
223
- "../../node_modules/pino-std-serializers/index.js"(exports, module2) {
256
+ "../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/index.js"(exports, module2) {
224
257
  "use strict";
225
258
  var errSerializer = require_err();
226
259
  var reqSerializers = require_req();
@@ -858,9 +891,9 @@ var require_flatstr = __commonJS({
858
891
  }
859
892
  });
860
893
 
861
- // ../../node_modules/atomic-sleep/index.js
894
+ // ../../node_modules/@linzjs/lambda/node_modules/atomic-sleep/index.js
862
895
  var require_atomic_sleep = __commonJS({
863
- "../../node_modules/atomic-sleep/index.js"(exports, module2) {
896
+ "../../node_modules/@linzjs/lambda/node_modules/atomic-sleep/index.js"(exports, module2) {
864
897
  "use strict";
865
898
  if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
866
899
  let sleep = function(ms) {
@@ -893,9 +926,9 @@ var require_atomic_sleep = __commonJS({
893
926
  }
894
927
  });
895
928
 
896
- // ../../node_modules/sonic-boom/index.js
929
+ // ../../node_modules/@linzjs/lambda/node_modules/sonic-boom/index.js
897
930
  var require_sonic_boom = __commonJS({
898
- "../../node_modules/sonic-boom/index.js"(exports, module2) {
931
+ "../../node_modules/@linzjs/lambda/node_modules/sonic-boom/index.js"(exports, module2) {
899
932
  "use strict";
900
933
  var fs4 = require("fs");
901
934
  var EventEmitter = require("events");
@@ -1366,9 +1399,9 @@ var require_quick_format_unescaped = __commonJS({
1366
1399
  }
1367
1400
  });
1368
1401
 
1369
- // ../../node_modules/@linzjs/lambda/node_modules/fast-safe-stringify/index.js
1402
+ // ../../node_modules/fast-safe-stringify/index.js
1370
1403
  var require_fast_safe_stringify = __commonJS({
1371
- "../../node_modules/@linzjs/lambda/node_modules/fast-safe-stringify/index.js"(exports, module2) {
1404
+ "../../node_modules/fast-safe-stringify/index.js"(exports, module2) {
1372
1405
  module2.exports = stringify;
1373
1406
  stringify.default = stringify;
1374
1407
  stringify.stable = deterministicStringify;
@@ -3227,320 +3260,1434 @@ var require_src = __commonJS({
3227
3260
  }
3228
3261
  });
3229
3262
 
3230
- // ../../node_modules/pino/lib/symbols.js
3231
- var require_symbols2 = __commonJS({
3232
- "../../node_modules/pino/lib/symbols.js"(exports, module2) {
3233
- "use strict";
3234
- var setLevelSym = Symbol("pino.setLevel");
3235
- var getLevelSym = Symbol("pino.getLevel");
3236
- var levelValSym = Symbol("pino.levelVal");
3237
- var useLevelLabelsSym = Symbol("pino.useLevelLabels");
3238
- var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels");
3239
- var mixinSym = Symbol("pino.mixin");
3240
- var lsCacheSym = Symbol("pino.lsCache");
3241
- var chindingsSym = Symbol("pino.chindings");
3242
- var parsedChindingsSym = Symbol("pino.parsedChindings");
3243
- var asJsonSym = Symbol("pino.asJson");
3244
- var writeSym = Symbol("pino.write");
3245
- var redactFmtSym = Symbol("pino.redactFmt");
3246
- var timeSym = Symbol("pino.time");
3247
- var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
3248
- var streamSym = Symbol("pino.stream");
3249
- var stringifySym = Symbol("pino.stringify");
3250
- var stringifiersSym = Symbol("pino.stringifiers");
3251
- var endSym = Symbol("pino.end");
3252
- var formatOptsSym = Symbol("pino.formatOpts");
3253
- var messageKeySym = Symbol("pino.messageKey");
3254
- var nestedKeySym = Symbol("pino.nestedKey");
3255
- var wildcardFirstSym = Symbol("pino.wildcardFirst");
3256
- var serializersSym = Symbol.for("pino.serializers");
3257
- var formattersSym = Symbol.for("pino.formatters");
3258
- var hooksSym = Symbol.for("pino.hooks");
3259
- var needsMetadataGsym = Symbol.for("pino.metadata");
3260
- module2.exports = {
3261
- setLevelSym,
3262
- getLevelSym,
3263
- levelValSym,
3264
- useLevelLabelsSym,
3265
- mixinSym,
3266
- lsCacheSym,
3267
- chindingsSym,
3268
- parsedChindingsSym,
3269
- asJsonSym,
3270
- writeSym,
3271
- serializersSym,
3272
- redactFmtSym,
3273
- timeSym,
3274
- timeSliceIndexSym,
3275
- streamSym,
3276
- stringifySym,
3277
- stringifiersSym,
3278
- endSym,
3279
- formatOptsSym,
3280
- messageKeySym,
3281
- nestedKeySym,
3282
- wildcardFirstSym,
3283
- needsMetadataGsym,
3284
- useOnlyCustomLevelsSym,
3285
- formattersSym,
3286
- hooksSym
3287
- };
3288
- }
3289
- });
3290
-
3291
- // ../../node_modules/pino/lib/redaction.js
3292
- var require_redaction2 = __commonJS({
3293
- "../../node_modules/pino/lib/redaction.js"(exports, module2) {
3263
+ // ../../node_modules/pino-std-serializers/lib/err.js
3264
+ var require_err2 = __commonJS({
3265
+ "../../node_modules/pino-std-serializers/lib/err.js"(exports, module2) {
3294
3266
  "use strict";
3295
- var fastRedact = require_fast_redact();
3296
- var { redactFmtSym, wildcardFirstSym } = require_symbols2();
3297
- var { rx, validator } = fastRedact;
3298
- var validate = validator({
3299
- ERR_PATHS_MUST_BE_STRINGS: () => "pino \u2013 redacted paths must be strings",
3300
- ERR_INVALID_PATH: (s) => `pino \u2013 redact paths array contains an invalid path (${s})`
3301
- });
3302
- var CENSOR = "[Redacted]";
3303
- var strict = false;
3304
- function redaction(opts, serialize) {
3305
- const { paths, censor } = handle(opts);
3306
- const shape = paths.reduce((o, str) => {
3307
- rx.lastIndex = 0;
3308
- const first = rx.exec(str);
3309
- const next = rx.exec(str);
3310
- let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
3311
- if (ns === "*") {
3312
- ns = wildcardFirstSym;
3313
- }
3314
- if (next === null) {
3315
- o[ns] = null;
3316
- return o;
3317
- }
3318
- if (o[ns] === null) {
3319
- return o;
3320
- }
3321
- const { index } = next;
3322
- const nextPath = `${str.substr(index, str.length - 1)}`;
3323
- o[ns] = o[ns] || [];
3324
- if (ns !== wildcardFirstSym && o[ns].length === 0) {
3325
- o[ns].push(...o[wildcardFirstSym] || []);
3267
+ module2.exports = errSerializer;
3268
+ var { toString } = Object.prototype;
3269
+ var seen = Symbol("circular-ref-tag");
3270
+ var rawSymbol = Symbol("pino-raw-err-ref");
3271
+ var pinoErrProto = Object.create({}, {
3272
+ type: {
3273
+ enumerable: true,
3274
+ writable: true,
3275
+ value: void 0
3276
+ },
3277
+ message: {
3278
+ enumerable: true,
3279
+ writable: true,
3280
+ value: void 0
3281
+ },
3282
+ stack: {
3283
+ enumerable: true,
3284
+ writable: true,
3285
+ value: void 0
3286
+ },
3287
+ raw: {
3288
+ enumerable: false,
3289
+ get: function() {
3290
+ return this[rawSymbol];
3291
+ },
3292
+ set: function(val) {
3293
+ this[rawSymbol] = val;
3326
3294
  }
3327
- if (ns === wildcardFirstSym) {
3328
- Object.keys(o).forEach(function(k) {
3329
- if (o[k]) {
3330
- o[k].push(nextPath);
3295
+ }
3296
+ });
3297
+ Object.defineProperty(pinoErrProto, rawSymbol, {
3298
+ writable: true,
3299
+ value: {}
3300
+ });
3301
+ function errSerializer(err) {
3302
+ if (!(err instanceof Error)) {
3303
+ return err;
3304
+ }
3305
+ err[seen] = void 0;
3306
+ const _err = Object.create(pinoErrProto);
3307
+ _err.type = toString.call(err.constructor) === "[object Function]" ? err.constructor.name : err.name;
3308
+ _err.message = err.message;
3309
+ _err.stack = err.stack;
3310
+ for (const key in err) {
3311
+ if (_err[key] === void 0) {
3312
+ const val = err[key];
3313
+ if (val instanceof Error) {
3314
+ if (!val.hasOwnProperty(seen)) {
3315
+ _err[key] = errSerializer(val);
3331
3316
  }
3332
- });
3333
- }
3334
- o[ns].push(nextPath);
3335
- return o;
3336
- }, {});
3337
- const result = {
3338
- [redactFmtSym]: fastRedact({ paths, censor, serialize, strict })
3339
- };
3340
- const topCensor = (...args) => {
3341
- return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
3342
- };
3343
- return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
3344
- if (shape[k] === null) {
3345
- o[k] = (value) => topCensor(value, [k]);
3346
- } else {
3347
- const wrappedCensor = typeof censor === "function" ? (value, path3) => {
3348
- return censor(value, [k, ...path3]);
3349
- } : censor;
3350
- o[k] = fastRedact({
3351
- paths: shape[k],
3352
- censor: wrappedCensor,
3353
- serialize,
3354
- strict
3355
- });
3317
+ } else {
3318
+ _err[key] = val;
3319
+ }
3356
3320
  }
3357
- return o;
3358
- }, result);
3359
- }
3360
- function handle(opts) {
3361
- if (Array.isArray(opts)) {
3362
- opts = { paths: opts, censor: CENSOR };
3363
- validate(opts);
3364
- return opts;
3365
- }
3366
- let { paths, censor = CENSOR, remove } = opts;
3367
- if (Array.isArray(paths) === false) {
3368
- throw Error("pino \u2013 redact must contain an array of strings");
3369
3321
  }
3370
- if (remove === true)
3371
- censor = void 0;
3372
- validate({ paths, censor });
3373
- return { paths, censor };
3322
+ delete err[seen];
3323
+ _err.raw = err;
3324
+ return _err;
3374
3325
  }
3375
- module2.exports = redaction;
3376
3326
  }
3377
3327
  });
3378
3328
 
3379
- // ../../node_modules/pino/lib/time.js
3380
- var require_time2 = __commonJS({
3381
- "../../node_modules/pino/lib/time.js"(exports, module2) {
3329
+ // ../../node_modules/pino-std-serializers/lib/req.js
3330
+ var require_req2 = __commonJS({
3331
+ "../../node_modules/pino-std-serializers/lib/req.js"(exports, module2) {
3382
3332
  "use strict";
3383
- var nullTime = () => "";
3384
- var epochTime = () => `,"time":${Date.now()}`;
3385
- var unixTime = () => `,"time":${Math.round(Date.now() / 1e3)}`;
3386
- var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
3387
- module2.exports = { nullTime, epochTime, unixTime, isoTime };
3388
- }
3389
- });
3390
-
3391
- // ../../node_modules/fast-safe-stringify/index.js
3392
- var require_fast_safe_stringify2 = __commonJS({
3393
- "../../node_modules/fast-safe-stringify/index.js"(exports, module2) {
3394
- module2.exports = stringify;
3395
- stringify.default = stringify;
3396
- stringify.stable = deterministicStringify;
3397
- stringify.stableStringify = deterministicStringify;
3398
- var arr = [];
3399
- var replacerStack = [];
3400
- function stringify(obj, replacer, spacer) {
3401
- decirc(obj, "", [], void 0);
3402
- var res;
3403
- if (replacerStack.length === 0) {
3404
- res = JSON.stringify(obj, replacer, spacer);
3405
- } else {
3406
- res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
3407
- }
3408
- while (arr.length !== 0) {
3409
- var part = arr.pop();
3410
- if (part.length === 4) {
3411
- Object.defineProperty(part[0], part[1], part[3]);
3412
- } else {
3413
- part[0][part[1]] = part[2];
3414
- }
3415
- }
3416
- return res;
3417
- }
3418
- function decirc(val, k, stack, parent) {
3419
- var i;
3420
- if (typeof val === "object" && val !== null) {
3421
- for (i = 0; i < stack.length; i++) {
3422
- if (stack[i] === val) {
3423
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
3424
- if (propertyDescriptor.get !== void 0) {
3425
- if (propertyDescriptor.configurable) {
3426
- Object.defineProperty(parent, k, { value: "[Circular]" });
3427
- arr.push([parent, k, val, propertyDescriptor]);
3428
- } else {
3429
- replacerStack.push([val, k]);
3333
+ module2.exports = {
3334
+ mapHttpRequest,
3335
+ reqSerializer
3336
+ };
3337
+ var rawSymbol = Symbol("pino-raw-req-ref");
3338
+ var pinoReqProto = Object.create({}, {
3339
+ id: {
3340
+ enumerable: true,
3341
+ writable: true,
3342
+ value: ""
3343
+ },
3344
+ method: {
3345
+ enumerable: true,
3346
+ writable: true,
3347
+ value: ""
3348
+ },
3349
+ url: {
3350
+ enumerable: true,
3351
+ writable: true,
3352
+ value: ""
3353
+ },
3354
+ query: {
3355
+ enumerable: true,
3356
+ writable: true,
3357
+ value: ""
3358
+ },
3359
+ params: {
3360
+ enumerable: true,
3361
+ writable: true,
3362
+ value: ""
3363
+ },
3364
+ headers: {
3365
+ enumerable: true,
3366
+ writable: true,
3367
+ value: {}
3368
+ },
3369
+ remoteAddress: {
3370
+ enumerable: true,
3371
+ writable: true,
3372
+ value: ""
3373
+ },
3374
+ remotePort: {
3375
+ enumerable: true,
3376
+ writable: true,
3377
+ value: ""
3378
+ },
3379
+ raw: {
3380
+ enumerable: false,
3381
+ get: function() {
3382
+ return this[rawSymbol];
3383
+ },
3384
+ set: function(val) {
3385
+ this[rawSymbol] = val;
3386
+ }
3387
+ }
3388
+ });
3389
+ Object.defineProperty(pinoReqProto, rawSymbol, {
3390
+ writable: true,
3391
+ value: {}
3392
+ });
3393
+ function reqSerializer(req) {
3394
+ const connection = req.info || req.socket;
3395
+ const _req = Object.create(pinoReqProto);
3396
+ _req.id = typeof req.id === "function" ? req.id() : req.id || (req.info ? req.info.id : void 0);
3397
+ _req.method = req.method;
3398
+ if (req.originalUrl) {
3399
+ _req.url = req.originalUrl;
3400
+ _req.query = req.query;
3401
+ _req.params = req.params;
3402
+ } else {
3403
+ _req.url = req.path || (req.url ? req.url.path || req.url : void 0);
3404
+ }
3405
+ _req.headers = req.headers;
3406
+ _req.remoteAddress = connection && connection.remoteAddress;
3407
+ _req.remotePort = connection && connection.remotePort;
3408
+ _req.raw = req.raw || req;
3409
+ return _req;
3410
+ }
3411
+ function mapHttpRequest(req) {
3412
+ return {
3413
+ req: reqSerializer(req)
3414
+ };
3415
+ }
3416
+ }
3417
+ });
3418
+
3419
+ // ../../node_modules/pino-std-serializers/lib/res.js
3420
+ var require_res2 = __commonJS({
3421
+ "../../node_modules/pino-std-serializers/lib/res.js"(exports, module2) {
3422
+ "use strict";
3423
+ module2.exports = {
3424
+ mapHttpResponse,
3425
+ resSerializer
3426
+ };
3427
+ var rawSymbol = Symbol("pino-raw-res-ref");
3428
+ var pinoResProto = Object.create({}, {
3429
+ statusCode: {
3430
+ enumerable: true,
3431
+ writable: true,
3432
+ value: 0
3433
+ },
3434
+ headers: {
3435
+ enumerable: true,
3436
+ writable: true,
3437
+ value: ""
3438
+ },
3439
+ raw: {
3440
+ enumerable: false,
3441
+ get: function() {
3442
+ return this[rawSymbol];
3443
+ },
3444
+ set: function(val) {
3445
+ this[rawSymbol] = val;
3446
+ }
3447
+ }
3448
+ });
3449
+ Object.defineProperty(pinoResProto, rawSymbol, {
3450
+ writable: true,
3451
+ value: {}
3452
+ });
3453
+ function resSerializer(res) {
3454
+ const _res = Object.create(pinoResProto);
3455
+ _res.statusCode = res.statusCode;
3456
+ _res.headers = res.getHeaders ? res.getHeaders() : res._headers;
3457
+ _res.raw = res;
3458
+ return _res;
3459
+ }
3460
+ function mapHttpResponse(res) {
3461
+ return {
3462
+ res: resSerializer(res)
3463
+ };
3464
+ }
3465
+ }
3466
+ });
3467
+
3468
+ // ../../node_modules/pino-std-serializers/index.js
3469
+ var require_pino_std_serializers2 = __commonJS({
3470
+ "../../node_modules/pino-std-serializers/index.js"(exports, module2) {
3471
+ "use strict";
3472
+ var errSerializer = require_err2();
3473
+ var reqSerializers = require_req2();
3474
+ var resSerializers = require_res2();
3475
+ module2.exports = {
3476
+ err: errSerializer,
3477
+ mapHttpRequest: reqSerializers.mapHttpRequest,
3478
+ mapHttpResponse: resSerializers.mapHttpResponse,
3479
+ req: reqSerializers.reqSerializer,
3480
+ res: resSerializers.resSerializer,
3481
+ wrapErrorSerializer: function wrapErrorSerializer(customSerializer) {
3482
+ if (customSerializer === errSerializer)
3483
+ return customSerializer;
3484
+ return function wrapErrSerializer(err) {
3485
+ return customSerializer(errSerializer(err));
3486
+ };
3487
+ },
3488
+ wrapRequestSerializer: function wrapRequestSerializer(customSerializer) {
3489
+ if (customSerializer === reqSerializers.reqSerializer)
3490
+ return customSerializer;
3491
+ return function wrappedReqSerializer(req) {
3492
+ return customSerializer(reqSerializers.reqSerializer(req));
3493
+ };
3494
+ },
3495
+ wrapResponseSerializer: function wrapResponseSerializer(customSerializer) {
3496
+ if (customSerializer === resSerializers.resSerializer)
3497
+ return customSerializer;
3498
+ return function wrappedResSerializer(res) {
3499
+ return customSerializer(resSerializers.resSerializer(res));
3500
+ };
3501
+ }
3502
+ };
3503
+ }
3504
+ });
3505
+
3506
+ // ../../node_modules/get-caller-file/index.js
3507
+ var require_get_caller_file = __commonJS({
3508
+ "../../node_modules/get-caller-file/index.js"(exports, module2) {
3509
+ "use strict";
3510
+ module2.exports = function getCallerFile(position) {
3511
+ if (position === void 0) {
3512
+ position = 2;
3513
+ }
3514
+ if (position >= Error.stackTraceLimit) {
3515
+ throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `" + position + "` and Error.stackTraceLimit was: `" + Error.stackTraceLimit + "`");
3516
+ }
3517
+ var oldPrepareStackTrace = Error.prepareStackTrace;
3518
+ Error.prepareStackTrace = function(_, stack2) {
3519
+ return stack2;
3520
+ };
3521
+ var stack = new Error().stack;
3522
+ Error.prepareStackTrace = oldPrepareStackTrace;
3523
+ if (stack !== null && typeof stack === "object") {
3524
+ return stack[position] ? stack[position].getFileName() : void 0;
3525
+ }
3526
+ };
3527
+ }
3528
+ });
3529
+
3530
+ // ../../node_modules/pino/lib/symbols.js
3531
+ var require_symbols2 = __commonJS({
3532
+ "../../node_modules/pino/lib/symbols.js"(exports, module2) {
3533
+ "use strict";
3534
+ var setLevelSym = Symbol("pino.setLevel");
3535
+ var getLevelSym = Symbol("pino.getLevel");
3536
+ var levelValSym = Symbol("pino.levelVal");
3537
+ var useLevelLabelsSym = Symbol("pino.useLevelLabels");
3538
+ var useOnlyCustomLevelsSym = Symbol("pino.useOnlyCustomLevels");
3539
+ var mixinSym = Symbol("pino.mixin");
3540
+ var lsCacheSym = Symbol("pino.lsCache");
3541
+ var chindingsSym = Symbol("pino.chindings");
3542
+ var parsedChindingsSym = Symbol("pino.parsedChindings");
3543
+ var asJsonSym = Symbol("pino.asJson");
3544
+ var writeSym = Symbol("pino.write");
3545
+ var redactFmtSym = Symbol("pino.redactFmt");
3546
+ var timeSym = Symbol("pino.time");
3547
+ var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
3548
+ var streamSym = Symbol("pino.stream");
3549
+ var stringifySym = Symbol("pino.stringify");
3550
+ var stringifySafeSym = Symbol("pino.stringifySafe");
3551
+ var stringifiersSym = Symbol("pino.stringifiers");
3552
+ var endSym = Symbol("pino.end");
3553
+ var formatOptsSym = Symbol("pino.formatOpts");
3554
+ var messageKeySym = Symbol("pino.messageKey");
3555
+ var nestedKeySym = Symbol("pino.nestedKey");
3556
+ var nestedKeyStrSym = Symbol("pino.nestedKeyStr");
3557
+ var wildcardFirstSym = Symbol("pino.wildcardFirst");
3558
+ var serializersSym = Symbol.for("pino.serializers");
3559
+ var formattersSym = Symbol.for("pino.formatters");
3560
+ var hooksSym = Symbol.for("pino.hooks");
3561
+ var needsMetadataGsym = Symbol.for("pino.metadata");
3562
+ module2.exports = {
3563
+ setLevelSym,
3564
+ getLevelSym,
3565
+ levelValSym,
3566
+ useLevelLabelsSym,
3567
+ mixinSym,
3568
+ lsCacheSym,
3569
+ chindingsSym,
3570
+ parsedChindingsSym,
3571
+ asJsonSym,
3572
+ writeSym,
3573
+ serializersSym,
3574
+ redactFmtSym,
3575
+ timeSym,
3576
+ timeSliceIndexSym,
3577
+ streamSym,
3578
+ stringifySym,
3579
+ stringifySafeSym,
3580
+ stringifiersSym,
3581
+ endSym,
3582
+ formatOptsSym,
3583
+ messageKeySym,
3584
+ nestedKeySym,
3585
+ wildcardFirstSym,
3586
+ needsMetadataGsym,
3587
+ useOnlyCustomLevelsSym,
3588
+ formattersSym,
3589
+ hooksSym,
3590
+ nestedKeyStrSym
3591
+ };
3592
+ }
3593
+ });
3594
+
3595
+ // ../../node_modules/pino/lib/redaction.js
3596
+ var require_redaction2 = __commonJS({
3597
+ "../../node_modules/pino/lib/redaction.js"(exports, module2) {
3598
+ "use strict";
3599
+ var fastRedact = require_fast_redact();
3600
+ var { redactFmtSym, wildcardFirstSym } = require_symbols2();
3601
+ var { rx, validator } = fastRedact;
3602
+ var validate = validator({
3603
+ ERR_PATHS_MUST_BE_STRINGS: () => "pino \u2013 redacted paths must be strings",
3604
+ ERR_INVALID_PATH: (s) => `pino \u2013 redact paths array contains an invalid path (${s})`
3605
+ });
3606
+ var CENSOR = "[Redacted]";
3607
+ var strict = false;
3608
+ function redaction(opts, serialize) {
3609
+ const { paths, censor } = handle(opts);
3610
+ const shape = paths.reduce((o, str) => {
3611
+ rx.lastIndex = 0;
3612
+ const first = rx.exec(str);
3613
+ const next = rx.exec(str);
3614
+ let ns = first[1] !== void 0 ? first[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/, "$1") : first[0];
3615
+ if (ns === "*") {
3616
+ ns = wildcardFirstSym;
3617
+ }
3618
+ if (next === null) {
3619
+ o[ns] = null;
3620
+ return o;
3621
+ }
3622
+ if (o[ns] === null) {
3623
+ return o;
3624
+ }
3625
+ const { index } = next;
3626
+ const nextPath = `${str.substr(index, str.length - 1)}`;
3627
+ o[ns] = o[ns] || [];
3628
+ if (ns !== wildcardFirstSym && o[ns].length === 0) {
3629
+ o[ns].push(...o[wildcardFirstSym] || []);
3630
+ }
3631
+ if (ns === wildcardFirstSym) {
3632
+ Object.keys(o).forEach(function(k) {
3633
+ if (o[k]) {
3634
+ o[k].push(nextPath);
3635
+ }
3636
+ });
3637
+ }
3638
+ o[ns].push(nextPath);
3639
+ return o;
3640
+ }, {});
3641
+ const result = {
3642
+ [redactFmtSym]: fastRedact({ paths, censor, serialize, strict })
3643
+ };
3644
+ const topCensor = (...args) => {
3645
+ return typeof censor === "function" ? serialize(censor(...args)) : serialize(censor);
3646
+ };
3647
+ return [...Object.keys(shape), ...Object.getOwnPropertySymbols(shape)].reduce((o, k) => {
3648
+ if (shape[k] === null) {
3649
+ o[k] = (value) => topCensor(value, [k]);
3650
+ } else {
3651
+ const wrappedCensor = typeof censor === "function" ? (value, path3) => {
3652
+ return censor(value, [k, ...path3]);
3653
+ } : censor;
3654
+ o[k] = fastRedact({
3655
+ paths: shape[k],
3656
+ censor: wrappedCensor,
3657
+ serialize,
3658
+ strict
3659
+ });
3660
+ }
3661
+ return o;
3662
+ }, result);
3663
+ }
3664
+ function handle(opts) {
3665
+ if (Array.isArray(opts)) {
3666
+ opts = { paths: opts, censor: CENSOR };
3667
+ validate(opts);
3668
+ return opts;
3669
+ }
3670
+ let { paths, censor = CENSOR, remove } = opts;
3671
+ if (Array.isArray(paths) === false) {
3672
+ throw Error("pino \u2013 redact must contain an array of strings");
3673
+ }
3674
+ if (remove === true)
3675
+ censor = void 0;
3676
+ validate({ paths, censor });
3677
+ return { paths, censor };
3678
+ }
3679
+ module2.exports = redaction;
3680
+ }
3681
+ });
3682
+
3683
+ // ../../node_modules/pino/lib/time.js
3684
+ var require_time2 = __commonJS({
3685
+ "../../node_modules/pino/lib/time.js"(exports, module2) {
3686
+ "use strict";
3687
+ var nullTime = () => "";
3688
+ var epochTime = () => `,"time":${Date.now()}`;
3689
+ var unixTime = () => `,"time":${Math.round(Date.now() / 1e3)}`;
3690
+ var isoTime = () => `,"time":"${new Date(Date.now()).toISOString()}"`;
3691
+ module2.exports = { nullTime, epochTime, unixTime, isoTime };
3692
+ }
3693
+ });
3694
+
3695
+ // ../../node_modules/atomic-sleep/index.js
3696
+ var require_atomic_sleep2 = __commonJS({
3697
+ "../../node_modules/atomic-sleep/index.js"(exports, module2) {
3698
+ "use strict";
3699
+ if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
3700
+ let sleep = function(ms) {
3701
+ const valid = ms > 0 && ms < Infinity;
3702
+ if (valid === false) {
3703
+ if (typeof ms !== "number" && typeof ms !== "bigint") {
3704
+ throw TypeError("sleep: ms must be a number");
3705
+ }
3706
+ throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
3707
+ }
3708
+ Atomics.wait(nil, 0, 0, Number(ms));
3709
+ };
3710
+ const nil = new Int32Array(new SharedArrayBuffer(4));
3711
+ module2.exports = sleep;
3712
+ } else {
3713
+ let sleep = function(ms) {
3714
+ const valid = ms > 0 && ms < Infinity;
3715
+ if (valid === false) {
3716
+ if (typeof ms !== "number" && typeof ms !== "bigint") {
3717
+ throw TypeError("sleep: ms must be a number");
3718
+ }
3719
+ throw RangeError("sleep: ms must be a number that is greater than 0 but less than Infinity");
3720
+ }
3721
+ const target = Date.now() + Number(ms);
3722
+ while (target > Date.now()) {
3723
+ }
3724
+ };
3725
+ module2.exports = sleep;
3726
+ }
3727
+ }
3728
+ });
3729
+
3730
+ // ../../node_modules/sonic-boom/index.js
3731
+ var require_sonic_boom2 = __commonJS({
3732
+ "../../node_modules/sonic-boom/index.js"(exports, module2) {
3733
+ "use strict";
3734
+ var fs4 = require("fs");
3735
+ var EventEmitter = require("events");
3736
+ var inherits = require("util").inherits;
3737
+ var path3 = require("path");
3738
+ var sleep = require_atomic_sleep2();
3739
+ var BUSY_WRITE_TIMEOUT = 100;
3740
+ var MAX_WRITE = 16 * 1024 * 1024;
3741
+ function openFile(file, sonic) {
3742
+ sonic._opening = true;
3743
+ sonic._writing = true;
3744
+ sonic._asyncDrainScheduled = false;
3745
+ function fileOpened(err, fd) {
3746
+ if (err) {
3747
+ sonic._reopening = false;
3748
+ sonic._writing = false;
3749
+ sonic._opening = false;
3750
+ if (sonic.sync) {
3751
+ process.nextTick(() => {
3752
+ if (sonic.listenerCount("error") > 0) {
3753
+ sonic.emit("error", err);
3754
+ }
3755
+ });
3756
+ } else {
3757
+ sonic.emit("error", err);
3758
+ }
3759
+ return;
3760
+ }
3761
+ sonic.fd = fd;
3762
+ sonic.file = file;
3763
+ sonic._reopening = false;
3764
+ sonic._opening = false;
3765
+ sonic._writing = false;
3766
+ if (sonic.sync) {
3767
+ process.nextTick(() => sonic.emit("ready"));
3768
+ } else {
3769
+ sonic.emit("ready");
3770
+ }
3771
+ if (sonic._reopening) {
3772
+ return;
3773
+ }
3774
+ if (!sonic._writing && sonic._len > sonic.minLength && !sonic.destroyed) {
3775
+ actualWrite(sonic);
3776
+ }
3777
+ }
3778
+ const mode = sonic.append ? "a" : "w";
3779
+ if (sonic.sync) {
3780
+ try {
3781
+ if (sonic.mkdir)
3782
+ fs4.mkdirSync(path3.dirname(file), { recursive: true });
3783
+ const fd = fs4.openSync(file, mode);
3784
+ fileOpened(null, fd);
3785
+ } catch (err) {
3786
+ fileOpened(err);
3787
+ throw err;
3788
+ }
3789
+ } else if (sonic.mkdir) {
3790
+ fs4.mkdir(path3.dirname(file), { recursive: true }, (err) => {
3791
+ if (err)
3792
+ return fileOpened(err);
3793
+ fs4.open(file, mode, fileOpened);
3794
+ });
3795
+ } else {
3796
+ fs4.open(file, mode, fileOpened);
3797
+ }
3798
+ }
3799
+ function SonicBoom(opts) {
3800
+ if (!(this instanceof SonicBoom)) {
3801
+ return new SonicBoom(opts);
3802
+ }
3803
+ let { fd, dest, minLength, maxLength, sync, append = true, mkdir, retryEAGAIN } = opts || {};
3804
+ fd = fd || dest;
3805
+ this._bufs = [];
3806
+ this._len = 0;
3807
+ this.fd = -1;
3808
+ this._writing = false;
3809
+ this._writingBuf = "";
3810
+ this._ending = false;
3811
+ this._reopening = false;
3812
+ this._asyncDrainScheduled = false;
3813
+ this._hwm = Math.max(minLength || 0, 16387);
3814
+ this.file = null;
3815
+ this.destroyed = false;
3816
+ this.minLength = minLength || 0;
3817
+ this.maxLength = maxLength || 0;
3818
+ this.sync = sync || false;
3819
+ this.append = append || false;
3820
+ this.retryEAGAIN = retryEAGAIN || (() => true);
3821
+ this.mkdir = mkdir || false;
3822
+ if (typeof fd === "number") {
3823
+ this.fd = fd;
3824
+ process.nextTick(() => this.emit("ready"));
3825
+ } else if (typeof fd === "string") {
3826
+ openFile(fd, this);
3827
+ } else {
3828
+ throw new Error("SonicBoom supports only file descriptors and files");
3829
+ }
3830
+ if (this.minLength >= MAX_WRITE) {
3831
+ throw new Error(`minLength should be smaller than MAX_WRITE (${MAX_WRITE})`);
3832
+ }
3833
+ this.release = (err, n) => {
3834
+ if (err) {
3835
+ if (err.code === "EAGAIN" && this.retryEAGAIN(err, this._writingBuf.length, this._len - this._writingBuf.length)) {
3836
+ if (this.sync) {
3837
+ try {
3838
+ sleep(BUSY_WRITE_TIMEOUT);
3839
+ this.release(void 0, 0);
3840
+ } catch (err2) {
3841
+ this.release(err2);
3430
3842
  }
3431
3843
  } else {
3432
- parent[k] = "[Circular]";
3433
- arr.push([parent, k, val]);
3844
+ setTimeout(() => {
3845
+ fs4.write(this.fd, this._writingBuf, "utf8", this.release);
3846
+ }, BUSY_WRITE_TIMEOUT);
3434
3847
  }
3848
+ } else {
3849
+ this._writing = false;
3850
+ this.emit("error", err);
3851
+ }
3852
+ return;
3853
+ }
3854
+ this._len -= n;
3855
+ this._writingBuf = this._writingBuf.slice(n);
3856
+ if (this._writingBuf.length) {
3857
+ if (!this.sync) {
3858
+ fs4.write(this.fd, this._writingBuf, "utf8", this.release);
3435
3859
  return;
3436
3860
  }
3861
+ try {
3862
+ do {
3863
+ const n2 = fs4.writeSync(this.fd, this._writingBuf, "utf8");
3864
+ this._len -= n2;
3865
+ this._writingBuf = this._writingBuf.slice(n2);
3866
+ } while (this._writingBuf);
3867
+ } catch (err2) {
3868
+ this.release(err2);
3869
+ return;
3870
+ }
3871
+ }
3872
+ const len = this._len;
3873
+ if (this._reopening) {
3874
+ this._writing = false;
3875
+ this._reopening = false;
3876
+ this.reopen();
3877
+ } else if (len > this.minLength) {
3878
+ actualWrite(this);
3879
+ } else if (this._ending) {
3880
+ if (len > 0) {
3881
+ actualWrite(this);
3882
+ } else {
3883
+ this._writing = false;
3884
+ actualClose(this);
3885
+ }
3886
+ } else {
3887
+ this._writing = false;
3888
+ if (this.sync) {
3889
+ if (!this._asyncDrainScheduled) {
3890
+ this._asyncDrainScheduled = true;
3891
+ process.nextTick(emitDrain, this);
3892
+ }
3893
+ } else {
3894
+ this.emit("drain");
3895
+ }
3896
+ }
3897
+ };
3898
+ this.on("newListener", function(name) {
3899
+ if (name === "drain") {
3900
+ this._asyncDrainScheduled = false;
3901
+ }
3902
+ });
3903
+ }
3904
+ function emitDrain(sonic) {
3905
+ const hasListeners = sonic.listenerCount("drain") > 0;
3906
+ if (!hasListeners)
3907
+ return;
3908
+ sonic._asyncDrainScheduled = false;
3909
+ sonic.emit("drain");
3910
+ }
3911
+ inherits(SonicBoom, EventEmitter);
3912
+ SonicBoom.prototype.write = function(data) {
3913
+ if (this.destroyed) {
3914
+ throw new Error("SonicBoom destroyed");
3915
+ }
3916
+ const len = this._len + data.length;
3917
+ const bufs = this._bufs;
3918
+ if (this.maxLength && len > this.maxLength) {
3919
+ this.emit("drop", data);
3920
+ return this._len < this._hwm;
3921
+ }
3922
+ if (!this._writing && len > MAX_WRITE) {
3923
+ bufs.push(data);
3924
+ } else if (bufs.length === 0) {
3925
+ bufs[0] = "" + data;
3926
+ } else {
3927
+ bufs[bufs.length - 1] += data;
3928
+ }
3929
+ this._len = len;
3930
+ if (!this._writing && this._len >= this.minLength) {
3931
+ actualWrite(this);
3932
+ }
3933
+ return this._len < this._hwm;
3934
+ };
3935
+ SonicBoom.prototype.flush = function() {
3936
+ if (this.destroyed) {
3937
+ throw new Error("SonicBoom destroyed");
3938
+ }
3939
+ if (this._writing || this.minLength <= 0) {
3940
+ return;
3941
+ }
3942
+ if (this._bufs.length === 0) {
3943
+ this._bufs.push("");
3944
+ }
3945
+ actualWrite(this);
3946
+ };
3947
+ SonicBoom.prototype.reopen = function(file) {
3948
+ if (this.destroyed) {
3949
+ throw new Error("SonicBoom destroyed");
3950
+ }
3951
+ if (this._opening) {
3952
+ this.once("ready", () => {
3953
+ this.reopen(file);
3954
+ });
3955
+ return;
3956
+ }
3957
+ if (this._ending) {
3958
+ return;
3959
+ }
3960
+ if (!this.file) {
3961
+ throw new Error("Unable to reopen a file descriptor, you must pass a file to SonicBoom");
3962
+ }
3963
+ this._reopening = true;
3964
+ if (this._writing) {
3965
+ return;
3966
+ }
3967
+ const fd = this.fd;
3968
+ this.once("ready", () => {
3969
+ if (fd !== this.fd) {
3970
+ fs4.close(fd, (err) => {
3971
+ if (err) {
3972
+ return this.emit("error", err);
3973
+ }
3974
+ });
3975
+ }
3976
+ });
3977
+ openFile(file || this.file, this);
3978
+ };
3979
+ SonicBoom.prototype.end = function() {
3980
+ if (this.destroyed) {
3981
+ throw new Error("SonicBoom destroyed");
3982
+ }
3983
+ if (this._opening) {
3984
+ this.once("ready", () => {
3985
+ this.end();
3986
+ });
3987
+ return;
3988
+ }
3989
+ if (this._ending) {
3990
+ return;
3991
+ }
3992
+ this._ending = true;
3993
+ if (this._writing) {
3994
+ return;
3995
+ }
3996
+ if (this._len > 0 && this.fd >= 0) {
3997
+ actualWrite(this);
3998
+ } else {
3999
+ actualClose(this);
4000
+ }
4001
+ };
4002
+ SonicBoom.prototype.flushSync = function() {
4003
+ if (this.destroyed) {
4004
+ throw new Error("SonicBoom destroyed");
4005
+ }
4006
+ if (this.fd < 0) {
4007
+ throw new Error("sonic boom is not ready yet");
4008
+ }
4009
+ if (!this._writing && this._writingBuf.length > 0) {
4010
+ this._bufs.unshift(this._writingBuf);
4011
+ this._writingBuf = "";
4012
+ }
4013
+ while (this._bufs.length) {
4014
+ const buf = this._bufs[0];
4015
+ try {
4016
+ this._len -= fs4.writeSync(this.fd, buf, "utf8");
4017
+ this._bufs.shift();
4018
+ } catch (err) {
4019
+ if (err.code !== "EAGAIN" || !this.retryEAGAIN(err, buf.length, this._len - buf.length)) {
4020
+ throw err;
4021
+ }
4022
+ sleep(BUSY_WRITE_TIMEOUT);
4023
+ }
4024
+ }
4025
+ };
4026
+ SonicBoom.prototype.destroy = function() {
4027
+ if (this.destroyed) {
4028
+ return;
4029
+ }
4030
+ actualClose(this);
4031
+ };
4032
+ function actualWrite(sonic) {
4033
+ const release = sonic.release;
4034
+ sonic._writing = true;
4035
+ sonic._writingBuf = sonic._writingBuf || sonic._bufs.shift();
4036
+ if (sonic.sync) {
4037
+ try {
4038
+ const written = fs4.writeSync(sonic.fd, sonic._writingBuf, "utf8");
4039
+ release(null, written);
4040
+ } catch (err) {
4041
+ release(err);
4042
+ }
4043
+ } else {
4044
+ fs4.write(sonic.fd, sonic._writingBuf, "utf8", release);
4045
+ }
4046
+ }
4047
+ function actualClose(sonic) {
4048
+ if (sonic.fd === -1) {
4049
+ sonic.once("ready", actualClose.bind(null, sonic));
4050
+ return;
4051
+ }
4052
+ fs4.close(sonic.fd, (err) => {
4053
+ if (err) {
4054
+ sonic.emit("error", err);
4055
+ return;
3437
4056
  }
3438
- stack.push(val);
3439
- if (Array.isArray(val)) {
3440
- for (i = 0; i < val.length; i++) {
3441
- decirc(val[i], i, stack, val);
3442
- }
3443
- } else {
3444
- var keys = Object.keys(val);
3445
- for (i = 0; i < keys.length; i++) {
3446
- var key = keys[i];
3447
- decirc(val[key], key, stack, val);
3448
- }
4057
+ if (sonic._ending && !sonic._writing) {
4058
+ sonic.emit("finish");
4059
+ }
4060
+ sonic.emit("close");
4061
+ });
4062
+ sonic.destroyed = true;
4063
+ sonic._bufs = [];
4064
+ }
4065
+ SonicBoom.SonicBoom = SonicBoom;
4066
+ SonicBoom.default = SonicBoom;
4067
+ module2.exports = SonicBoom;
4068
+ }
4069
+ });
4070
+
4071
+ // ../../node_modules/pino/lib/deprecations.js
4072
+ var require_deprecations2 = __commonJS({
4073
+ "../../node_modules/pino/lib/deprecations.js"(exports, module2) {
4074
+ "use strict";
4075
+ var warning = require_fastify_warning()();
4076
+ module2.exports = warning;
4077
+ var warnName = "PinoWarning";
4078
+ warning.create(warnName, "PINODEP008", "prettyPrint is deprecated, look at https://github.com/pinojs/pino-pretty for alternatives.");
4079
+ warning.create(warnName, "PINODEP009", "The use of pino.final is discouraged in Node.js v14+ and not required. It will be removed in the next major version");
4080
+ }
4081
+ });
4082
+
4083
+ // ../../node_modules/on-exit-leak-free/index.js
4084
+ var require_on_exit_leak_free = __commonJS({
4085
+ "../../node_modules/on-exit-leak-free/index.js"(exports, module2) {
4086
+ "use strict";
4087
+ function genWrap(wraps, ref, fn, event) {
4088
+ function wrap() {
4089
+ const obj = ref.deref();
4090
+ if (obj !== void 0) {
4091
+ fn(obj, event);
3449
4092
  }
3450
- stack.pop();
3451
4093
  }
4094
+ wraps[event] = wrap;
4095
+ process.once(event, wrap);
3452
4096
  }
3453
- function compareFunction(a, b) {
3454
- if (a < b) {
3455
- return -1;
4097
+ var registry = new FinalizationRegistry(clear);
4098
+ var map = new WeakMap();
4099
+ function clear(wraps) {
4100
+ process.removeListener("exit", wraps.exit);
4101
+ process.removeListener("beforeExit", wraps.beforeExit);
4102
+ }
4103
+ function register(obj, fn) {
4104
+ if (obj === void 0) {
4105
+ throw new Error("the object can't be undefined");
3456
4106
  }
3457
- if (a > b) {
3458
- return 1;
4107
+ const ref = new WeakRef(obj);
4108
+ const wraps = {};
4109
+ map.set(obj, wraps);
4110
+ registry.register(obj, wraps);
4111
+ genWrap(wraps, ref, fn, "exit");
4112
+ genWrap(wraps, ref, fn, "beforeExit");
4113
+ }
4114
+ function unregister(obj) {
4115
+ const wraps = map.get(obj);
4116
+ map.delete(obj);
4117
+ if (wraps) {
4118
+ clear(wraps);
3459
4119
  }
3460
- return 0;
4120
+ registry.unregister(obj);
3461
4121
  }
3462
- function deterministicStringify(obj, replacer, spacer) {
3463
- var tmp = deterministicDecirc(obj, "", [], void 0) || obj;
3464
- var res;
3465
- if (replacerStack.length === 0) {
3466
- res = JSON.stringify(tmp, replacer, spacer);
3467
- } else {
3468
- res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
4122
+ module2.exports = {
4123
+ register,
4124
+ unregister
4125
+ };
4126
+ }
4127
+ });
4128
+
4129
+ // ../../node_modules/thread-stream/lib/wait.js
4130
+ var require_wait = __commonJS({
4131
+ "../../node_modules/thread-stream/lib/wait.js"(exports, module2) {
4132
+ "use strict";
4133
+ var MAX_TIMEOUT = 1e3;
4134
+ function wait(state, index, expected, timeout, done) {
4135
+ const max = Date.now() + timeout;
4136
+ let current = Atomics.load(state, index);
4137
+ if (current === expected) {
4138
+ done(null, "ok");
4139
+ return;
3469
4140
  }
3470
- while (arr.length !== 0) {
3471
- var part = arr.pop();
3472
- if (part.length === 4) {
3473
- Object.defineProperty(part[0], part[1], part[3]);
4141
+ let prior = current;
4142
+ const check = (backoff) => {
4143
+ if (Date.now() > max) {
4144
+ done(null, "timed-out");
3474
4145
  } else {
3475
- part[0][part[1]] = part[2];
4146
+ setTimeout(() => {
4147
+ prior = current;
4148
+ current = Atomics.load(state, index);
4149
+ if (current === prior) {
4150
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
4151
+ } else {
4152
+ if (current === expected)
4153
+ done(null, "ok");
4154
+ else
4155
+ done(null, "not-equal");
4156
+ }
4157
+ }, backoff);
3476
4158
  }
3477
- }
3478
- return res;
4159
+ };
4160
+ check(1);
3479
4161
  }
3480
- function deterministicDecirc(val, k, stack, parent) {
3481
- var i;
3482
- if (typeof val === "object" && val !== null) {
3483
- for (i = 0; i < stack.length; i++) {
3484
- if (stack[i] === val) {
3485
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
3486
- if (propertyDescriptor.get !== void 0) {
3487
- if (propertyDescriptor.configurable) {
3488
- Object.defineProperty(parent, k, { value: "[Circular]" });
3489
- arr.push([parent, k, val, propertyDescriptor]);
3490
- } else {
3491
- replacerStack.push([val, k]);
3492
- }
4162
+ function waitDiff(state, index, expected, timeout, done) {
4163
+ const max = Date.now() + timeout;
4164
+ let current = Atomics.load(state, index);
4165
+ if (current !== expected) {
4166
+ done(null, "ok");
4167
+ return;
4168
+ }
4169
+ const check = (backoff) => {
4170
+ if (Date.now() > max) {
4171
+ done(null, "timed-out");
4172
+ } else {
4173
+ setTimeout(() => {
4174
+ current = Atomics.load(state, index);
4175
+ if (current !== expected) {
4176
+ done(null, "ok");
3493
4177
  } else {
3494
- parent[k] = "[Circular]";
3495
- arr.push([parent, k, val]);
4178
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
3496
4179
  }
3497
- return;
4180
+ }, backoff);
4181
+ }
4182
+ };
4183
+ check(1);
4184
+ }
4185
+ module2.exports = { wait, waitDiff };
4186
+ }
4187
+ });
4188
+
4189
+ // ../../node_modules/thread-stream/lib/indexes.js
4190
+ var require_indexes = __commonJS({
4191
+ "../../node_modules/thread-stream/lib/indexes.js"(exports, module2) {
4192
+ "use strict";
4193
+ var WRITE_INDEX = 4;
4194
+ var READ_INDEX = 8;
4195
+ module2.exports = {
4196
+ WRITE_INDEX,
4197
+ READ_INDEX
4198
+ };
4199
+ }
4200
+ });
4201
+
4202
+ // ../../node_modules/thread-stream/index.js
4203
+ var require_thread_stream = __commonJS({
4204
+ "../../node_modules/thread-stream/index.js"(exports, module2) {
4205
+ "use strict";
4206
+ var { EventEmitter } = require("events");
4207
+ var { Worker } = require("worker_threads");
4208
+ var { join: join2 } = require("path");
4209
+ var { pathToFileURL } = require("url");
4210
+ var { wait } = require_wait();
4211
+ var {
4212
+ WRITE_INDEX,
4213
+ READ_INDEX
4214
+ } = require_indexes();
4215
+ var buffer = require("buffer");
4216
+ var assert = require("assert");
4217
+ var kImpl = Symbol("kImpl");
4218
+ var MAX_STRING = buffer.constants.MAX_STRING_LENGTH;
4219
+ var FakeWeakRef = class {
4220
+ constructor(value) {
4221
+ this._value = value;
4222
+ }
4223
+ deref() {
4224
+ return this._value;
4225
+ }
4226
+ };
4227
+ var FinalizationRegistry2 = global.FinalizationRegistry || class FakeFinalizationRegistry {
4228
+ register() {
4229
+ }
4230
+ unregister() {
4231
+ }
4232
+ };
4233
+ var WeakRef2 = global.WeakRef || FakeWeakRef;
4234
+ var registry = new FinalizationRegistry2((worker) => {
4235
+ if (worker.exited) {
4236
+ return;
4237
+ }
4238
+ worker.terminate();
4239
+ });
4240
+ function createWorker(stream, opts) {
4241
+ const { filename, workerData } = opts;
4242
+ const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
4243
+ const toExecute = bundlerOverrides["thread-stream-worker"] || join2(__dirname, "lib", "worker.js");
4244
+ const worker = new Worker(toExecute, {
4245
+ ...opts.workerOpts,
4246
+ workerData: {
4247
+ filename: filename.indexOf("file://") === 0 ? filename : pathToFileURL(filename).href,
4248
+ dataBuf: stream[kImpl].dataBuf,
4249
+ stateBuf: stream[kImpl].stateBuf,
4250
+ workerData
4251
+ }
4252
+ });
4253
+ worker.stream = new FakeWeakRef(stream);
4254
+ worker.on("message", onWorkerMessage);
4255
+ worker.on("exit", onWorkerExit);
4256
+ registry.register(stream, worker);
4257
+ return worker;
4258
+ }
4259
+ function drain(stream) {
4260
+ assert(!stream[kImpl].sync);
4261
+ if (stream[kImpl].needDrain) {
4262
+ stream[kImpl].needDrain = false;
4263
+ stream.emit("drain");
4264
+ }
4265
+ }
4266
+ function nextFlush(stream) {
4267
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
4268
+ let leftover = stream[kImpl].data.length - writeIndex;
4269
+ if (leftover > 0) {
4270
+ if (stream[kImpl].buf.length === 0) {
4271
+ stream[kImpl].flushing = false;
4272
+ if (stream[kImpl].ending) {
4273
+ end(stream);
4274
+ } else if (stream[kImpl].needDrain) {
4275
+ process.nextTick(drain, stream);
3498
4276
  }
4277
+ return;
4278
+ }
4279
+ let toWrite = stream[kImpl].buf.slice(0, leftover);
4280
+ let toWriteBytes = Buffer.byteLength(toWrite);
4281
+ if (toWriteBytes <= leftover) {
4282
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
4283
+ write(stream, toWrite, nextFlush.bind(null, stream));
4284
+ } else {
4285
+ stream.flush(() => {
4286
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
4287
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
4288
+ while (toWriteBytes > stream[kImpl].buf.length) {
4289
+ leftover = leftover / 2;
4290
+ toWrite = stream[kImpl].buf.slice(0, leftover);
4291
+ toWriteBytes = Buffer.byteLength(toWrite);
4292
+ }
4293
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
4294
+ write(stream, toWrite, nextFlush.bind(null, stream));
4295
+ });
3499
4296
  }
3500
- if (typeof val.toJSON === "function") {
4297
+ } else if (leftover === 0) {
4298
+ if (writeIndex === 0 && stream[kImpl].buf.length === 0) {
3501
4299
  return;
3502
4300
  }
3503
- stack.push(val);
3504
- if (Array.isArray(val)) {
3505
- for (i = 0; i < val.length; i++) {
3506
- deterministicDecirc(val[i], i, stack, val);
4301
+ stream.flush(() => {
4302
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
4303
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
4304
+ nextFlush(stream);
4305
+ });
4306
+ } else {
4307
+ throw new Error("overwritten");
4308
+ }
4309
+ }
4310
+ function onWorkerMessage(msg) {
4311
+ const stream = this.stream.deref();
4312
+ if (stream === void 0) {
4313
+ this.exited = true;
4314
+ this.terminate();
4315
+ return;
4316
+ }
4317
+ switch (msg.code) {
4318
+ case "READY":
4319
+ this.stream = new WeakRef2(stream);
4320
+ stream.flush(() => {
4321
+ stream[kImpl].ready = true;
4322
+ stream.emit("ready");
4323
+ });
4324
+ break;
4325
+ case "ERROR":
4326
+ destroy(stream, msg.err);
4327
+ break;
4328
+ default:
4329
+ throw new Error("this should not happen: " + msg.code);
4330
+ }
4331
+ }
4332
+ function onWorkerExit(code) {
4333
+ const stream = this.stream.deref();
4334
+ if (stream === void 0) {
4335
+ return;
4336
+ }
4337
+ registry.unregister(stream);
4338
+ stream.worker.exited = true;
4339
+ stream.worker.off("exit", onWorkerExit);
4340
+ destroy(stream, code !== 0 ? new Error("The worker thread exited") : null);
4341
+ }
4342
+ var ThreadStream = class extends EventEmitter {
4343
+ constructor(opts = {}) {
4344
+ super();
4345
+ if (opts.bufferSize < 4) {
4346
+ throw new Error("bufferSize must at least fit a 4-byte utf-8 char");
4347
+ }
4348
+ this[kImpl] = {};
4349
+ this[kImpl].stateBuf = new SharedArrayBuffer(128);
4350
+ this[kImpl].state = new Int32Array(this[kImpl].stateBuf);
4351
+ this[kImpl].dataBuf = new SharedArrayBuffer(opts.bufferSize || 4 * 1024 * 1024);
4352
+ this[kImpl].data = Buffer.from(this[kImpl].dataBuf);
4353
+ this[kImpl].sync = opts.sync || false;
4354
+ this[kImpl].ending = false;
4355
+ this[kImpl].ended = false;
4356
+ this[kImpl].needDrain = false;
4357
+ this[kImpl].destroyed = false;
4358
+ this[kImpl].flushing = false;
4359
+ this[kImpl].ready = false;
4360
+ this[kImpl].finished = false;
4361
+ this[kImpl].errored = null;
4362
+ this[kImpl].closed = false;
4363
+ this[kImpl].buf = "";
4364
+ this.worker = createWorker(this, opts);
4365
+ }
4366
+ write(data) {
4367
+ if (this[kImpl].destroyed) {
4368
+ throw new Error("the worker has exited");
4369
+ }
4370
+ if (this[kImpl].ending) {
4371
+ throw new Error("the worker is ending");
4372
+ }
4373
+ if (this[kImpl].flushing && this[kImpl].buf.length + data.length >= MAX_STRING) {
4374
+ try {
4375
+ writeSync(this);
4376
+ this[kImpl].flushing = true;
4377
+ } catch (err) {
4378
+ destroy(this, err);
4379
+ return false;
3507
4380
  }
3508
- } else {
3509
- var tmp = {};
3510
- var keys = Object.keys(val).sort(compareFunction);
3511
- for (i = 0; i < keys.length; i++) {
3512
- var key = keys[i];
3513
- deterministicDecirc(val[key], key, stack, val);
3514
- tmp[key] = val[key];
4381
+ }
4382
+ this[kImpl].buf += data;
4383
+ if (this[kImpl].sync) {
4384
+ try {
4385
+ writeSync(this);
4386
+ return true;
4387
+ } catch (err) {
4388
+ destroy(this, err);
4389
+ return false;
3515
4390
  }
3516
- if (parent !== void 0) {
3517
- arr.push([parent, k, val]);
3518
- parent[k] = tmp;
3519
- } else {
3520
- return tmp;
4391
+ }
4392
+ if (!this[kImpl].flushing) {
4393
+ this[kImpl].flushing = true;
4394
+ setImmediate(nextFlush, this);
4395
+ }
4396
+ this[kImpl].needDrain = this[kImpl].data.length - this[kImpl].buf.length - Atomics.load(this[kImpl].state, WRITE_INDEX) <= 0;
4397
+ return !this[kImpl].needDrain;
4398
+ }
4399
+ end() {
4400
+ if (this[kImpl].destroyed) {
4401
+ throw new Error("the worker has exited");
4402
+ }
4403
+ this[kImpl].ending = true;
4404
+ end(this);
4405
+ }
4406
+ flush(cb) {
4407
+ if (this[kImpl].destroyed) {
4408
+ throw new Error("the worker has exited");
4409
+ }
4410
+ const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
4411
+ wait(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
4412
+ if (err) {
4413
+ destroy(this, err);
4414
+ process.nextTick(cb, err);
4415
+ return;
4416
+ }
4417
+ if (res === "not-equal") {
4418
+ this.flush(cb);
4419
+ return;
3521
4420
  }
4421
+ process.nextTick(cb);
4422
+ });
4423
+ }
4424
+ flushSync() {
4425
+ if (this[kImpl].destroyed) {
4426
+ throw new Error("the worker has exited");
3522
4427
  }
3523
- stack.pop();
4428
+ writeSync(this);
4429
+ flushSync(this);
4430
+ }
4431
+ unref() {
4432
+ this.worker.unref();
4433
+ }
4434
+ ref() {
4435
+ this.worker.ref();
4436
+ }
4437
+ get ready() {
4438
+ return this[kImpl].ready;
4439
+ }
4440
+ get destroyed() {
4441
+ return this[kImpl].destroyed;
4442
+ }
4443
+ get closed() {
4444
+ return this[kImpl].closed;
4445
+ }
4446
+ get writable() {
4447
+ return !this[kImpl].destroyed && !this[kImpl].ending;
4448
+ }
4449
+ get writableEnded() {
4450
+ return this[kImpl].ending;
4451
+ }
4452
+ get writableFinished() {
4453
+ return this[kImpl].finished;
4454
+ }
4455
+ get writableNeedDrain() {
4456
+ return this[kImpl].needDrain;
4457
+ }
4458
+ get writableObjectMode() {
4459
+ return false;
4460
+ }
4461
+ get writableErrored() {
4462
+ return this[kImpl].errored;
4463
+ }
4464
+ };
4465
+ function destroy(stream, err) {
4466
+ if (stream[kImpl].destroyed) {
4467
+ return;
4468
+ }
4469
+ stream[kImpl].destroyed = true;
4470
+ if (err) {
4471
+ stream[kImpl].errored = err;
4472
+ stream.emit("error", err);
4473
+ }
4474
+ if (!stream.worker.exited) {
4475
+ stream.worker.terminate().catch(() => {
4476
+ }).then(() => {
4477
+ stream[kImpl].closed = true;
4478
+ stream.emit("close");
4479
+ });
4480
+ } else {
4481
+ setImmediate(() => {
4482
+ stream[kImpl].closed = true;
4483
+ stream.emit("close");
4484
+ });
3524
4485
  }
3525
4486
  }
3526
- function replaceGetterValues(replacer) {
3527
- replacer = replacer !== void 0 ? replacer : function(k, v) {
3528
- return v;
4487
+ function write(stream, data, cb) {
4488
+ const current = Atomics.load(stream[kImpl].state, WRITE_INDEX);
4489
+ const length = Buffer.byteLength(data);
4490
+ stream[kImpl].data.write(data, current);
4491
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, current + length);
4492
+ Atomics.notify(stream[kImpl].state, WRITE_INDEX);
4493
+ cb();
4494
+ return true;
4495
+ }
4496
+ function end(stream) {
4497
+ if (stream[kImpl].ended || !stream[kImpl].ending || stream[kImpl].flushing) {
4498
+ return;
4499
+ }
4500
+ stream[kImpl].ended = true;
4501
+ try {
4502
+ stream.flushSync();
4503
+ let readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
4504
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, -1);
4505
+ Atomics.notify(stream[kImpl].state, WRITE_INDEX);
4506
+ let spins = 0;
4507
+ while (readIndex !== -1) {
4508
+ Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
4509
+ readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
4510
+ if (readIndex === -2) {
4511
+ throw new Error("end() failed");
4512
+ }
4513
+ if (++spins === 10) {
4514
+ throw new Error("end() took too long (10s)");
4515
+ }
4516
+ }
4517
+ process.nextTick(() => {
4518
+ stream[kImpl].finished = true;
4519
+ stream.emit("finish");
4520
+ });
4521
+ } catch (err) {
4522
+ destroy(stream, err);
4523
+ }
4524
+ }
4525
+ function writeSync(stream) {
4526
+ const cb = () => {
4527
+ if (stream[kImpl].ending) {
4528
+ end(stream);
4529
+ } else if (stream[kImpl].needDrain) {
4530
+ process.nextTick(drain, stream);
4531
+ }
3529
4532
  };
3530
- return function(key, val) {
3531
- if (replacerStack.length > 0) {
3532
- for (var i = 0; i < replacerStack.length; i++) {
3533
- var part = replacerStack[i];
3534
- if (part[1] === key && part[0] === val) {
3535
- val = "[Circular]";
3536
- replacerStack.splice(i, 1);
3537
- break;
3538
- }
4533
+ stream[kImpl].flushing = false;
4534
+ while (stream[kImpl].buf.length !== 0) {
4535
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
4536
+ let leftover = stream[kImpl].data.length - writeIndex;
4537
+ if (leftover === 0) {
4538
+ flushSync(stream);
4539
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
4540
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
4541
+ continue;
4542
+ } else if (leftover < 0) {
4543
+ throw new Error("overwritten");
4544
+ }
4545
+ let toWrite = stream[kImpl].buf.slice(0, leftover);
4546
+ let toWriteBytes = Buffer.byteLength(toWrite);
4547
+ if (toWriteBytes <= leftover) {
4548
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
4549
+ write(stream, toWrite, cb);
4550
+ } else {
4551
+ flushSync(stream);
4552
+ Atomics.store(stream[kImpl].state, READ_INDEX, 0);
4553
+ Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
4554
+ while (toWriteBytes > stream[kImpl].buf.length) {
4555
+ leftover = leftover / 2;
4556
+ toWrite = stream[kImpl].buf.slice(0, leftover);
4557
+ toWriteBytes = Buffer.byteLength(toWrite);
3539
4558
  }
4559
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
4560
+ write(stream, toWrite, cb);
3540
4561
  }
3541
- return replacer.call(this, key, val);
3542
- };
4562
+ }
4563
+ }
4564
+ function flushSync(stream) {
4565
+ if (stream[kImpl].flushing) {
4566
+ throw new Error("unable to flush while flushing");
4567
+ }
4568
+ const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
4569
+ let spins = 0;
4570
+ while (true) {
4571
+ const readIndex = Atomics.load(stream[kImpl].state, READ_INDEX);
4572
+ if (readIndex === -2) {
4573
+ throw new Error("_flushSync failed");
4574
+ }
4575
+ if (readIndex !== writeIndex) {
4576
+ Atomics.wait(stream[kImpl].state, READ_INDEX, readIndex, 1e3);
4577
+ } else {
4578
+ break;
4579
+ }
4580
+ if (++spins === 10) {
4581
+ throw new Error("_flushSync took too long (10s)");
4582
+ }
4583
+ }
4584
+ }
4585
+ module2.exports = ThreadStream;
4586
+ }
4587
+ });
4588
+
4589
+ // ../../node_modules/pino/lib/transport.js
4590
+ var require_transport = __commonJS({
4591
+ "../../node_modules/pino/lib/transport.js"(exports, module2) {
4592
+ "use strict";
4593
+ var { createRequire } = require("module");
4594
+ var getCaller = require_get_caller_file();
4595
+ var { join: join2, isAbsolute } = require("path");
4596
+ var onExit;
4597
+ if (global.WeakRef && global.WeakMap && global.FinalizationRegistry) {
4598
+ onExit = require_on_exit_leak_free();
4599
+ }
4600
+ var ThreadStream = require_thread_stream();
4601
+ function setupOnExit(stream) {
4602
+ if (onExit) {
4603
+ onExit.register(stream, autoEnd);
4604
+ stream.on("close", function() {
4605
+ onExit.unregister(stream);
4606
+ });
4607
+ } else {
4608
+ const fn = autoEnd.bind(null, stream);
4609
+ process.once("beforeExit", fn);
4610
+ process.once("exit", fn);
4611
+ stream.on("close", function() {
4612
+ process.removeListener("beforeExit", fn);
4613
+ process.removeListener("exit", fn);
4614
+ });
4615
+ }
4616
+ }
4617
+ function buildStream(filename, workerData, workerOpts) {
4618
+ const stream = new ThreadStream({
4619
+ filename,
4620
+ workerData,
4621
+ workerOpts
4622
+ });
4623
+ stream.on("ready", onReady);
4624
+ stream.on("close", function() {
4625
+ process.removeListener("exit", onExit2);
4626
+ });
4627
+ process.on("exit", onExit2);
4628
+ function onReady() {
4629
+ process.removeListener("exit", onExit2);
4630
+ stream.unref();
4631
+ if (workerOpts.autoEnd !== false) {
4632
+ setupOnExit(stream);
4633
+ }
4634
+ }
4635
+ function onExit2() {
4636
+ if (stream.closed) {
4637
+ return;
4638
+ }
4639
+ stream.flushSync();
4640
+ }
4641
+ return stream;
4642
+ }
4643
+ function autoEnd(stream) {
4644
+ stream.ref();
4645
+ stream.flushSync();
4646
+ stream.end();
4647
+ stream.once("close", function() {
4648
+ stream.unref();
4649
+ });
4650
+ }
4651
+ function transport(fullOptions) {
4652
+ const { pipeline: pipeline2, targets, options = {}, worker = {}, caller = getCaller() } = fullOptions;
4653
+ const callerRequire = createRequire(caller);
4654
+ const bundlerOverrides = "__bundlerPathsOverrides" in globalThis ? globalThis.__bundlerPathsOverrides : {};
4655
+ let target = fullOptions.target;
4656
+ if (target && targets) {
4657
+ throw new Error("only one of target or targets can be specified");
4658
+ }
4659
+ if (targets) {
4660
+ target = bundlerOverrides["pino-worker"] || join2(__dirname, "worker.js");
4661
+ options.targets = targets.map((dest) => {
4662
+ return {
4663
+ ...dest,
4664
+ target: fixTarget(dest.target)
4665
+ };
4666
+ });
4667
+ } else if (fullOptions.pipeline) {
4668
+ target = bundlerOverrides["pino-pipeline-worker"] || join2(__dirname, "worker-pipeline.js");
4669
+ options.targets = pipeline2.map((dest) => {
4670
+ return {
4671
+ ...dest,
4672
+ target: fixTarget(dest.target)
4673
+ };
4674
+ });
4675
+ }
4676
+ return buildStream(fixTarget(target), options, worker);
4677
+ function fixTarget(origin) {
4678
+ origin = bundlerOverrides[origin] || origin;
4679
+ if (isAbsolute(origin) || origin.indexOf("file://") === 0) {
4680
+ return origin;
4681
+ }
4682
+ switch (origin) {
4683
+ case "pino/file":
4684
+ return join2(__dirname, "..", "file.js");
4685
+ default:
4686
+ return callerRequire.resolve(origin);
4687
+ }
4688
+ }
3543
4689
  }
4690
+ module2.exports = transport;
3544
4691
  }
3545
4692
  });
3546
4693
 
@@ -3549,9 +4696,9 @@ var require_tools2 = __commonJS({
3549
4696
  "../../node_modules/pino/lib/tools.js"(exports, module2) {
3550
4697
  "use strict";
3551
4698
  var format = require_quick_format_unescaped();
3552
- var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
3553
- var SonicBoom = require_sonic_boom();
3554
- var stringifySafe = require_fast_safe_stringify2();
4699
+ var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers2();
4700
+ var SonicBoom = require_sonic_boom2();
4701
+ var warning = require_deprecations2();
3555
4702
  var {
3556
4703
  lsCacheSym,
3557
4704
  chindingsSym,
@@ -3562,14 +4709,18 @@ var require_tools2 = __commonJS({
3562
4709
  endSym,
3563
4710
  stringifiersSym,
3564
4711
  stringifySym,
4712
+ stringifySafeSym,
3565
4713
  wildcardFirstSym,
3566
4714
  needsMetadataGsym,
3567
4715
  redactFmtSym,
3568
4716
  streamSym,
3569
4717
  nestedKeySym,
3570
4718
  formattersSym,
3571
- messageKeySym
4719
+ messageKeySym,
4720
+ nestedKeyStrSym
3572
4721
  } = require_symbols2();
4722
+ var { isMainThread } = require("worker_threads");
4723
+ var transport = require_transport();
3573
4724
  function noop() {
3574
4725
  }
3575
4726
  function genLog(level, hook) {
@@ -3588,8 +4739,6 @@ var require_tools2 = __commonJS({
3588
4739
  o = mapHttpResponse(o);
3589
4740
  }
3590
4741
  }
3591
- if (this[nestedKeySym])
3592
- o = { [this[nestedKeySym]]: o };
3593
4742
  let formatParams;
3594
4743
  if (msg === null && n.length === 0) {
3595
4744
  formatParams = [null];
@@ -3629,6 +4778,7 @@ var require_tools2 = __commonJS({
3629
4778
  }
3630
4779
  function asJson(obj, msg, num, time) {
3631
4780
  const stringify2 = this[stringifySym];
4781
+ const stringifySafe = this[stringifySafeSym];
3632
4782
  const stringifiers = this[stringifiersSym];
3633
4783
  const end = this[endSym];
3634
4784
  const chindings = this[chindingsSym];
@@ -3642,10 +4792,8 @@ var require_tools2 = __commonJS({
3642
4792
  if (formatters.log) {
3643
4793
  obj = formatters.log(obj);
3644
4794
  }
3645
- if (msg !== void 0) {
3646
- obj[messageKey] = msg;
3647
- }
3648
4795
  const wildcardStringifier = stringifiers[wildcardFirstSym];
4796
+ let propStr = "";
3649
4797
  for (const key in obj) {
3650
4798
  value = obj[key];
3651
4799
  if ((notHasOwnProperty || obj.hasOwnProperty(key)) && value !== void 0) {
@@ -3667,19 +4815,49 @@ var require_tools2 = __commonJS({
3667
4815
  value = (stringifier || asString)(value);
3668
4816
  break;
3669
4817
  default:
3670
- value = (stringifier || stringify2)(value);
4818
+ value = (stringifier || stringify2)(value, stringifySafe);
3671
4819
  }
3672
4820
  if (value === void 0)
3673
4821
  continue;
3674
- data += ',"' + key + '":' + value;
4822
+ propStr += ',"' + key + '":' + value;
3675
4823
  }
3676
4824
  }
3677
- return data + end;
4825
+ let msgStr = "";
4826
+ if (msg !== void 0) {
4827
+ value = serializers[messageKey] ? serializers[messageKey](msg) : msg;
4828
+ const stringifier = stringifiers[messageKey] || wildcardStringifier;
4829
+ switch (typeof value) {
4830
+ case "function":
4831
+ break;
4832
+ case "number":
4833
+ if (Number.isFinite(value) === false) {
4834
+ value = null;
4835
+ }
4836
+ case "boolean":
4837
+ if (stringifier)
4838
+ value = stringifier(value);
4839
+ msgStr = ',"' + messageKey + '":' + value;
4840
+ break;
4841
+ case "string":
4842
+ value = (stringifier || asString)(value);
4843
+ msgStr = ',"' + messageKey + '":' + value;
4844
+ break;
4845
+ default:
4846
+ value = (stringifier || stringify2)(value, stringifySafe);
4847
+ msgStr = ',"' + messageKey + '":' + value;
4848
+ }
4849
+ }
4850
+ if (this[nestedKeySym] && propStr) {
4851
+ return data + this[nestedKeyStrSym] + propStr.slice(1) + "}" + msgStr + end;
4852
+ } else {
4853
+ return data + propStr + msgStr + end;
4854
+ }
3678
4855
  }
3679
4856
  function asChindings(instance, bindings) {
3680
4857
  let value;
3681
4858
  let data = instance[chindingsSym];
3682
4859
  const stringify2 = instance[stringifySym];
4860
+ const stringifySafe = instance[stringifySafeSym];
3683
4861
  const stringifiers = instance[stringifiersSym];
3684
4862
  const wildcardStringifier = stringifiers[wildcardFirstSym];
3685
4863
  const serializers = instance[serializersSym];
@@ -3690,7 +4868,7 @@ var require_tools2 = __commonJS({
3690
4868
  const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
3691
4869
  if (valid === true) {
3692
4870
  value = serializers[key] ? serializers[key](value) : value;
3693
- value = (stringifiers[key] || wildcardStringifier || stringify2)(value);
4871
+ value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
3694
4872
  if (value === void 0)
3695
4873
  continue;
3696
4874
  data += ',"' + key + '":' + value;
@@ -3704,7 +4882,7 @@ var require_tools2 = __commonJS({
3704
4882
  return prettifierMetaWrapper(prettifier(opts), dest, opts);
3705
4883
  }
3706
4884
  try {
3707
- const prettyFactory = require("pino-pretty");
4885
+ const prettyFactory = require("pino-pretty").prettyFactory;
3708
4886
  prettyFactory.asMetaWrapper = prettifierMetaWrapper;
3709
4887
  return prettifierMetaWrapper(prettyFactory(opts), dest, opts);
3710
4888
  } catch (e) {
@@ -3754,7 +4932,8 @@ var require_tools2 = __commonJS({
3754
4932
  const lastLogger = this.lastLogger;
3755
4933
  const chindings = this.chindings();
3756
4934
  let time = this.lastTime;
3757
- if (time.match(/^\d+/)) {
4935
+ if (typeof time === "number") {
4936
+ } else if (time.match(/^\d+/)) {
3758
4937
  time = parseInt(time);
3759
4938
  } else {
3760
4939
  time = time.slice(1, -1);
@@ -3801,6 +4980,9 @@ var require_tools2 = __commonJS({
3801
4980
  function buildSafeSonicBoom(opts) {
3802
4981
  const stream = new SonicBoom(opts);
3803
4982
  stream.on("error", filterBrokenPipe);
4983
+ if (!opts.sync && isMainThread) {
4984
+ setupOnExit(stream);
4985
+ }
3804
4986
  return stream;
3805
4987
  function filterBrokenPipe(err) {
3806
4988
  if (err.code === "EPIPE") {
@@ -3814,21 +4996,46 @@ var require_tools2 = __commonJS({
3814
4996
  stream.emit("error", err);
3815
4997
  }
3816
4998
  }
4999
+ function setupOnExit(stream) {
5000
+ if (global.WeakRef && global.WeakMap && global.FinalizationRegistry) {
5001
+ const onExit = require_on_exit_leak_free();
5002
+ onExit.register(stream, autoEnd);
5003
+ stream.on("close", function() {
5004
+ onExit.unregister(stream);
5005
+ });
5006
+ }
5007
+ }
5008
+ function autoEnd(stream, eventName) {
5009
+ if (stream.destroyed) {
5010
+ return;
5011
+ }
5012
+ if (eventName === "beforeExit") {
5013
+ stream.flush();
5014
+ stream.on("drain", function() {
5015
+ stream.end();
5016
+ });
5017
+ } else {
5018
+ stream.flushSync();
5019
+ }
5020
+ }
3817
5021
  function createArgsNormalizer(defaultOptions) {
3818
- return function normalizeArgs(instance, opts = {}, stream) {
5022
+ return function normalizeArgs(instance, caller, opts = {}, stream) {
3819
5023
  if (typeof opts === "string") {
3820
5024
  stream = buildSafeSonicBoom({ dest: opts, sync: true });
3821
5025
  opts = {};
3822
5026
  } else if (typeof stream === "string") {
5027
+ if (opts && opts.transport) {
5028
+ throw Error("only one of option.transport or stream can be specified");
5029
+ }
3823
5030
  stream = buildSafeSonicBoom({ dest: stream, sync: true });
3824
5031
  } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
3825
5032
  stream = opts;
3826
- opts = null;
5033
+ opts = {};
5034
+ } else if (opts.transport) {
5035
+ stream = transport({ caller, ...opts.transport });
3827
5036
  }
3828
5037
  opts = Object.assign({}, defaultOptions, opts);
3829
- if ("extreme" in opts) {
3830
- throw Error("The extreme option has been removed, use pino.destination({ sync: false }) instead");
3831
- }
5038
+ opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
3832
5039
  if ("onTerminated" in opts) {
3833
5040
  throw Error("The onTerminated option has been removed, use pino.final instead");
3834
5041
  }
@@ -3845,6 +5052,7 @@ var require_tools2 = __commonJS({
3845
5052
  stream = buildSafeSonicBoom({ fd: stream.fd, sync: true });
3846
5053
  }
3847
5054
  if (prettyPrint) {
5055
+ warning.emit("PINODEP008");
3848
5056
  const prettyOpts = Object.assign({ messageKey }, prettyPrint);
3849
5057
  stream = getPrettyStream(prettyOpts, prettifier, stream, instance);
3850
5058
  }
@@ -3852,6 +5060,9 @@ var require_tools2 = __commonJS({
3852
5060
  };
3853
5061
  }
3854
5062
  function final(logger, handler2) {
5063
+ const major = Number(process.versions.node.split(".")[0]);
5064
+ if (major >= 14)
5065
+ warning.emit("PINODEP009");
3855
5066
  if (typeof logger === "undefined" || typeof logger.child !== "function") {
3856
5067
  throw Error("expected a pino logger instance");
3857
5068
  }
@@ -3875,6 +5086,10 @@ var require_tools2 = __commonJS({
3875
5086
  }
3876
5087
  });
3877
5088
  if (!hasHandler) {
5089
+ try {
5090
+ stream.flushSync();
5091
+ } catch {
5092
+ }
3878
5093
  return finalLogger;
3879
5094
  }
3880
5095
  return (err = null, ...args) => {
@@ -3885,11 +5100,16 @@ var require_tools2 = __commonJS({
3885
5100
  return handler2(err, finalLogger, ...args);
3886
5101
  };
3887
5102
  }
3888
- function stringify(obj) {
5103
+ function stringify(obj, stringifySafeFn) {
3889
5104
  try {
3890
5105
  return JSON.stringify(obj);
3891
5106
  } catch (_) {
3892
- return stringifySafe(obj);
5107
+ try {
5108
+ const stringify2 = stringifySafeFn || this[stringifySafeSym];
5109
+ return stringify2(obj);
5110
+ } catch (_2) {
5111
+ return '"[unable to serialize, circular reference is too complex to analyze]"';
5112
+ }
3893
5113
  }
3894
5114
  }
3895
5115
  function buildFormatters(level, bindings, log) {
@@ -3908,6 +5128,13 @@ var require_tools2 = __commonJS({
3908
5128
  dest.lastLogger = that.lastLogger;
3909
5129
  }
3910
5130
  }
5131
+ function normalizeDestFileDescriptor(destination) {
5132
+ const fd = Number(destination);
5133
+ if (typeof destination === "string" && Number.isFinite(fd)) {
5134
+ return fd;
5135
+ }
5136
+ return destination;
5137
+ }
3911
5138
  module2.exports = {
3912
5139
  noop,
3913
5140
  buildSafeSonicBoom,
@@ -3918,7 +5145,8 @@ var require_tools2 = __commonJS({
3918
5145
  createArgsNormalizer,
3919
5146
  final,
3920
5147
  stringify,
3921
- buildFormatters
5148
+ buildFormatters,
5149
+ normalizeDestFileDescriptor
3922
5150
  };
3923
5151
  }
3924
5152
  });
@@ -3927,7 +5155,6 @@ var require_tools2 = __commonJS({
3927
5155
  var require_levels2 = __commonJS({
3928
5156
  "../../node_modules/pino/lib/levels.js"(exports, module2) {
3929
5157
  "use strict";
3930
- var flatstr = require_flatstr();
3931
5158
  var {
3932
5159
  lsCacheSym,
3933
5160
  levelValSym,
@@ -3970,7 +5197,7 @@ var require_levels2 = __commonJS({
3970
5197
  return o;
3971
5198
  }, {});
3972
5199
  var initialLsCache = Object.keys(nums).reduce((o, k) => {
3973
- o[k] = flatstr('{"level":' + Number(k));
5200
+ o[k] = '{"level":' + Number(k);
3974
5201
  return o;
3975
5202
  }, {});
3976
5203
  function genLsCache(instance) {
@@ -4072,6 +5299,7 @@ var require_levels2 = __commonJS({
4072
5299
  setLevel,
4073
5300
  isLevelEnabled,
4074
5301
  mappings,
5302
+ levels,
4075
5303
  assertNoLevelCollisions,
4076
5304
  assertDefaultLevelFound
4077
5305
  };
@@ -4083,12 +5311,16 @@ var require_package2 = __commonJS({
4083
5311
  "../../node_modules/pino/package.json"(exports, module2) {
4084
5312
  module2.exports = {
4085
5313
  name: "pino",
4086
- version: "6.11.3",
5314
+ version: "7.5.0",
4087
5315
  description: "super fast, all natural json logger",
4088
5316
  main: "pino.js",
5317
+ type: "commonjs",
5318
+ types: "pino.d.ts",
4089
5319
  browser: "./browser.js",
4090
5320
  files: [
4091
5321
  "pino.js",
5322
+ "file.js",
5323
+ "pino.d.ts",
4092
5324
  "bin.js",
4093
5325
  "browser.js",
4094
5326
  "pretty.js",
@@ -4102,8 +5334,11 @@ var require_package2 = __commonJS({
4102
5334
  docs: "docsify serve",
4103
5335
  "browser-test": "airtap --local 8080 test/browser*test.js",
4104
5336
  lint: "eslint .",
4105
- test: "npm run lint && tap --100 test/*test.js test/*/*test.js",
4106
- "test-ci": "npm run lint && tap test/*test.js test/*/*test.js --coverage-report=lcovonly",
5337
+ test: "npm run lint && tap test/*test.js test/*/*test.js && jest test/jest && npm run test-types",
5338
+ "test-ci": "npm run lint && tap --no-check-coverage test/*test.js test/*/*test.js --coverage-report=lcovonly && npm run test-types",
5339
+ "test-ci-pnpm": "pnpm run lint && tap --no-coverage --no-check-coverage test/*test.js test/*/*test.js && pnpm run test-types",
5340
+ "test-ci-yarn-pnp": "yarn run lint && tap --no-check-coverage test/*test.js test/*/*test.js --coverage-report=lcovonly",
5341
+ "test-types": "tsc && tsd && ts-node test/types/pino.ts",
4107
5342
  "cov-ui": "tap --coverage-report=html test/*test.js test/*/*test.js",
4108
5343
  bench: "node benchmarks/utils/runbench all",
4109
5344
  "bench-basic": "node benchmarks/utils/runbench basic",
@@ -4143,42 +5378,55 @@ var require_package2 = __commonJS({
4143
5378
  },
4144
5379
  homepage: "http://getpino.io",
4145
5380
  devDependencies: {
5381
+ "@types/node": "^16.11.0",
4146
5382
  airtap: "4.0.3",
4147
5383
  benchmark: "^2.1.4",
4148
5384
  bole: "^4.0.0",
4149
5385
  bunyan: "^1.8.14",
4150
5386
  "docsify-cli": "^4.4.1",
4151
5387
  eslint: "^7.17.0",
4152
- "eslint-config-standard": "^16.0.2",
5388
+ "eslint-config-standard": "^16.0.3",
4153
5389
  "eslint-plugin-import": "^2.22.1",
4154
5390
  "eslint-plugin-node": "^11.1.0",
4155
- "eslint-plugin-promise": "^4.2.1",
5391
+ "eslint-plugin-promise": "^5.1.0",
4156
5392
  execa: "^5.0.0",
4157
5393
  fastbench: "^1.0.1",
4158
5394
  "flush-write-stream": "^2.0.0",
4159
5395
  "import-fresh": "^3.2.1",
5396
+ jest: "^27.3.1",
4160
5397
  log: "^6.0.0",
4161
5398
  loglevel: "^1.6.7",
4162
- "pino-pretty": "^4.1.0",
5399
+ "pino-pretty": "^v7.1.0",
4163
5400
  "pre-commit": "^1.2.2",
4164
5401
  proxyquire: "^2.1.3",
4165
5402
  pump: "^3.0.0",
4166
5403
  semver: "^7.0.0",
4167
- split2: "^3.1.1",
5404
+ split2: "^4.0.0",
4168
5405
  steed: "^1.1.3",
4169
5406
  "strip-ansi": "^6.0.0",
4170
5407
  tap: "^15.0.1",
4171
5408
  tape: "^5.0.0",
4172
5409
  through2: "^4.0.0",
5410
+ "ts-node": "^10.3.0",
5411
+ tsd: "^0.19.0",
5412
+ typescript: "^4.4.4",
4173
5413
  winston: "^3.3.3"
4174
5414
  },
4175
5415
  dependencies: {
4176
5416
  "fast-redact": "^3.0.0",
4177
- "fast-safe-stringify": "^2.0.7",
4178
- flatstr: "^1.0.12",
4179
- "pino-std-serializers": "^3.1.0",
5417
+ "fastify-warning": "^0.2.0",
5418
+ "get-caller-file": "^2.0.5",
5419
+ "on-exit-leak-free": "^0.2.0",
5420
+ "pino-abstract-transport": "v0.5.0",
5421
+ "pino-std-serializers": "^4.0.0",
4180
5422
  "quick-format-unescaped": "^4.0.3",
4181
- "sonic-boom": "^1.0.2"
5423
+ "real-require": "^0.1.0",
5424
+ "safe-stable-stringify": "^2.1.0",
5425
+ "sonic-boom": "^2.2.1",
5426
+ "thread-stream": "^0.13.0"
5427
+ },
5428
+ tsd: {
5429
+ directory: "test/types"
4182
5430
  }
4183
5431
  };
4184
5432
  }
@@ -4198,8 +5446,6 @@ var require_proto2 = __commonJS({
4198
5446
  "../../node_modules/pino/lib/proto.js"(exports, module2) {
4199
5447
  "use strict";
4200
5448
  var { EventEmitter } = require("events");
4201
- var SonicBoom = require_sonic_boom();
4202
- var flatstr = require_flatstr();
4203
5449
  var {
4204
5450
  lsCacheSym,
4205
5451
  levelValSym,
@@ -4216,7 +5462,11 @@ var require_proto2 = __commonJS({
4216
5462
  serializersSym,
4217
5463
  formattersSym,
4218
5464
  useOnlyCustomLevelsSym,
4219
- needsMetadataGsym
5465
+ needsMetadataGsym,
5466
+ redactFmtSym,
5467
+ stringifySym,
5468
+ formatOptsSym,
5469
+ stringifiersSym
4220
5470
  } = require_symbols2();
4221
5471
  var {
4222
5472
  getLevel,
@@ -4230,11 +5480,13 @@ var require_proto2 = __commonJS({
4230
5480
  var {
4231
5481
  asChindings,
4232
5482
  asJson,
4233
- buildFormatters
5483
+ buildFormatters,
5484
+ stringify
4234
5485
  } = require_tools2();
4235
5486
  var {
4236
5487
  version: version2
4237
5488
  } = require_meta2();
5489
+ var redaction = require_redaction2();
4238
5490
  var constructor = class Pino {
4239
5491
  };
4240
5492
  var prototype = {
@@ -4268,14 +5520,15 @@ var require_proto2 = __commonJS({
4268
5520
  return Object.create(prototype);
4269
5521
  };
4270
5522
  var resetChildingsFormatter = (bindings2) => bindings2;
4271
- function child(bindings2) {
5523
+ function child(bindings2, options) {
4272
5524
  if (!bindings2) {
4273
5525
  throw Error("missing bindings for child Pino");
4274
5526
  }
5527
+ options = options || {};
4275
5528
  const serializers = this[serializersSym];
4276
5529
  const formatters = this[formattersSym];
4277
5530
  const instance = Object.create(this);
4278
- if (bindings2.hasOwnProperty("serializers") === true) {
5531
+ if (options.hasOwnProperty("serializers") === true) {
4279
5532
  instance[serializersSym] = Object.create(null);
4280
5533
  for (const k in serializers) {
4281
5534
  instance[serializersSym][k] = serializers[k];
@@ -4285,83 +5538,861 @@ var require_proto2 = __commonJS({
4285
5538
  const ks = parentSymbols[i];
4286
5539
  instance[serializersSym][ks] = serializers[ks];
4287
5540
  }
4288
- for (const bk in bindings2.serializers) {
4289
- instance[serializersSym][bk] = bindings2.serializers[bk];
5541
+ for (const bk in options.serializers) {
5542
+ instance[serializersSym][bk] = options.serializers[bk];
4290
5543
  }
4291
- const bindingsSymbols = Object.getOwnPropertySymbols(bindings2.serializers);
5544
+ const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
4292
5545
  for (var bi = 0; bi < bindingsSymbols.length; bi++) {
4293
5546
  const bks = bindingsSymbols[bi];
4294
- instance[serializersSym][bks] = bindings2.serializers[bks];
5547
+ instance[serializersSym][bks] = options.serializers[bks];
5548
+ }
5549
+ } else
5550
+ instance[serializersSym] = serializers;
5551
+ if (options.hasOwnProperty("formatters")) {
5552
+ const { level, bindings: chindings, log } = options.formatters;
5553
+ instance[formattersSym] = buildFormatters(level || formatters.level, chindings || resetChildingsFormatter, log || formatters.log);
5554
+ } else {
5555
+ instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
5556
+ }
5557
+ if (options.hasOwnProperty("customLevels") === true) {
5558
+ assertNoLevelCollisions(this.levels, options.customLevels);
5559
+ instance.levels = mappings(options.customLevels, instance[useOnlyCustomLevelsSym]);
5560
+ genLsCache(instance);
5561
+ }
5562
+ if (typeof options.redact === "object" && options.redact !== null || Array.isArray(options.redact)) {
5563
+ instance.redact = options.redact;
5564
+ const stringifiers = redaction(instance.redact, stringify);
5565
+ const formatOpts = { stringify: stringifiers[redactFmtSym] };
5566
+ instance[stringifySym] = stringify;
5567
+ instance[stringifiersSym] = stringifiers;
5568
+ instance[formatOptsSym] = formatOpts;
5569
+ }
5570
+ instance[chindingsSym] = asChindings(instance, bindings2);
5571
+ const childLevel = options.level || this.level;
5572
+ instance[setLevelSym](childLevel);
5573
+ return instance;
5574
+ }
5575
+ function bindings() {
5576
+ const chindings = this[chindingsSym];
5577
+ const chindingsJson = `{${chindings.substr(1)}}`;
5578
+ const bindingsFromJson = JSON.parse(chindingsJson);
5579
+ delete bindingsFromJson.pid;
5580
+ delete bindingsFromJson.hostname;
5581
+ return bindingsFromJson;
5582
+ }
5583
+ function setBindings(newBindings) {
5584
+ const chindings = asChindings(this, newBindings);
5585
+ this[chindingsSym] = chindings;
5586
+ delete this[parsedChindingsSym];
5587
+ }
5588
+ function write(_obj, msg, num) {
5589
+ const t = this[timeSym]();
5590
+ const mixin = this[mixinSym];
5591
+ let obj;
5592
+ if (_obj === void 0 || _obj === null) {
5593
+ obj = mixin ? mixin({}) : {};
5594
+ } else if (_obj instanceof Error) {
5595
+ obj = Object.assign(mixin ? mixin({}) : {}, { err: _obj });
5596
+ if (msg === void 0) {
5597
+ msg = _obj.message;
5598
+ }
5599
+ } else {
5600
+ obj = Object.assign(mixin ? mixin({}) : {}, _obj);
5601
+ if (msg === void 0 && _obj.err) {
5602
+ msg = _obj.err.message;
5603
+ }
5604
+ }
5605
+ const s = this[asJsonSym](obj, msg, num, t);
5606
+ const stream = this[streamSym];
5607
+ if (stream[needsMetadataGsym] === true) {
5608
+ stream.lastLevel = num;
5609
+ stream.lastObj = obj;
5610
+ stream.lastMsg = msg;
5611
+ stream.lastTime = t.slice(this[timeSliceIndexSym]);
5612
+ stream.lastLogger = this;
5613
+ }
5614
+ stream.write(s);
5615
+ }
5616
+ function noop() {
5617
+ }
5618
+ function flush() {
5619
+ const stream = this[streamSym];
5620
+ if ("flush" in stream)
5621
+ stream.flush(noop);
5622
+ }
5623
+ }
5624
+ });
5625
+
5626
+ // ../../node_modules/safe-stable-stringify/index.js
5627
+ var require_safe_stable_stringify = __commonJS({
5628
+ "../../node_modules/safe-stable-stringify/index.js"(exports, module2) {
5629
+ "use strict";
5630
+ var stringify = configure2();
5631
+ stringify.configure = configure2;
5632
+ stringify.stringify = stringify;
5633
+ stringify.default = stringify;
5634
+ exports.stringify = stringify;
5635
+ exports.configure = configure2;
5636
+ module2.exports = stringify;
5637
+ var strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/;
5638
+ var strEscapeSequencesReplacer = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;
5639
+ var meta = [
5640
+ "\\u0000",
5641
+ "\\u0001",
5642
+ "\\u0002",
5643
+ "\\u0003",
5644
+ "\\u0004",
5645
+ "\\u0005",
5646
+ "\\u0006",
5647
+ "\\u0007",
5648
+ "\\b",
5649
+ "\\t",
5650
+ "\\n",
5651
+ "\\u000b",
5652
+ "\\f",
5653
+ "\\r",
5654
+ "\\u000e",
5655
+ "\\u000f",
5656
+ "\\u0010",
5657
+ "\\u0011",
5658
+ "\\u0012",
5659
+ "\\u0013",
5660
+ "\\u0014",
5661
+ "\\u0015",
5662
+ "\\u0016",
5663
+ "\\u0017",
5664
+ "\\u0018",
5665
+ "\\u0019",
5666
+ "\\u001a",
5667
+ "\\u001b",
5668
+ "\\u001c",
5669
+ "\\u001d",
5670
+ "\\u001e",
5671
+ "\\u001f",
5672
+ "",
5673
+ "",
5674
+ '\\"',
5675
+ "",
5676
+ "",
5677
+ "",
5678
+ "",
5679
+ "",
5680
+ "",
5681
+ "",
5682
+ "",
5683
+ "",
5684
+ "",
5685
+ "",
5686
+ "",
5687
+ "",
5688
+ "",
5689
+ "",
5690
+ "",
5691
+ "",
5692
+ "",
5693
+ "",
5694
+ "",
5695
+ "",
5696
+ "",
5697
+ "",
5698
+ "",
5699
+ "",
5700
+ "",
5701
+ "",
5702
+ "",
5703
+ "",
5704
+ "",
5705
+ "",
5706
+ "",
5707
+ "",
5708
+ "",
5709
+ "",
5710
+ "",
5711
+ "",
5712
+ "",
5713
+ "",
5714
+ "",
5715
+ "",
5716
+ "",
5717
+ "",
5718
+ "",
5719
+ "",
5720
+ "",
5721
+ "",
5722
+ "",
5723
+ "",
5724
+ "",
5725
+ "",
5726
+ "",
5727
+ "",
5728
+ "",
5729
+ "",
5730
+ "",
5731
+ "",
5732
+ "\\\\"
5733
+ ];
5734
+ function escapeFn(str) {
5735
+ const charCode = str.charCodeAt(0);
5736
+ return meta.length > charCode ? meta[charCode] : `\\u${charCode.toString(16)}`;
5737
+ }
5738
+ function strEscape(str) {
5739
+ if (str.length < 5e3 && !strEscapeSequencesRegExp.test(str)) {
5740
+ return str;
5741
+ }
5742
+ if (str.length > 100) {
5743
+ return str.replace(strEscapeSequencesReplacer, escapeFn);
5744
+ }
5745
+ let result = "";
5746
+ let last = 0;
5747
+ for (let i = 0; i < str.length; i++) {
5748
+ const point = str.charCodeAt(i);
5749
+ if (point === 34 || point === 92 || point < 32) {
5750
+ result += `${str.slice(last, i)}${meta[point]}`;
5751
+ last = i + 1;
5752
+ } else if (point >= 55296 && point <= 57343) {
5753
+ if (point <= 56319 && i + 1 < str.length) {
5754
+ const point2 = str.charCodeAt(i + 1);
5755
+ if (point2 >= 56320 && point2 <= 57343) {
5756
+ i++;
5757
+ continue;
5758
+ }
5759
+ }
5760
+ result += `${str.slice(last, i)}${`\\u${point.toString(16)}`}`;
5761
+ last = i + 1;
5762
+ }
5763
+ }
5764
+ result += str.slice(last);
5765
+ return result;
5766
+ }
5767
+ function insertSort(array) {
5768
+ if (array.length > 200) {
5769
+ return array.sort();
5770
+ }
5771
+ for (let i = 1; i < array.length; i++) {
5772
+ const currentValue = array[i];
5773
+ let position = i;
5774
+ while (position !== 0 && array[position - 1] > currentValue) {
5775
+ array[position] = array[position - 1];
5776
+ position--;
5777
+ }
5778
+ array[position] = currentValue;
5779
+ }
5780
+ return array;
5781
+ }
5782
+ var typedArrayPrototypeGetSymbolToStringTag = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Uint8Array())), Symbol.toStringTag).get;
5783
+ function isTypedArrayWithEntries(value) {
5784
+ return typedArrayPrototypeGetSymbolToStringTag.call(value) !== void 0 && value.length !== 0;
5785
+ }
5786
+ function stringifyTypedArray(array, separator, maximumBreadth) {
5787
+ if (array.length < maximumBreadth) {
5788
+ maximumBreadth = array.length;
5789
+ }
5790
+ const whitespace = separator === "," ? "" : " ";
5791
+ let res = `"0":${whitespace}${array[0]}`;
5792
+ for (let i = 1; i < maximumBreadth; i++) {
5793
+ res += `${separator}"${i}":${whitespace}${array[i]}`;
5794
+ }
5795
+ return res;
5796
+ }
5797
+ function getCircularValueOption(options) {
5798
+ if (options && Object.prototype.hasOwnProperty.call(options, "circularValue")) {
5799
+ var circularValue = options.circularValue;
5800
+ if (typeof circularValue === "string") {
5801
+ return `"${circularValue}"`;
5802
+ }
5803
+ if (circularValue == null) {
5804
+ return circularValue;
5805
+ }
5806
+ if (circularValue === Error || circularValue === TypeError) {
5807
+ return {
5808
+ toString() {
5809
+ throw new TypeError("Converting circular structure to JSON");
5810
+ }
5811
+ };
5812
+ }
5813
+ throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined');
5814
+ }
5815
+ return '"[Circular]"';
5816
+ }
5817
+ function getBooleanOption(options, key) {
5818
+ if (options && Object.prototype.hasOwnProperty.call(options, key)) {
5819
+ var value = options[key];
5820
+ if (typeof value !== "boolean") {
5821
+ throw new TypeError(`The "${key}" argument must be of type boolean`);
5822
+ }
5823
+ }
5824
+ return value === void 0 ? true : value;
5825
+ }
5826
+ function getPositiveIntegerOption(options, key) {
5827
+ if (options && Object.prototype.hasOwnProperty.call(options, key)) {
5828
+ var value = options[key];
5829
+ if (typeof value !== "number") {
5830
+ throw new TypeError(`The "${key}" argument must be of type number`);
5831
+ }
5832
+ if (!Number.isInteger(value)) {
5833
+ throw new TypeError(`The "${key}" argument must be an integer`);
5834
+ }
5835
+ if (value < 1) {
5836
+ throw new RangeError(`The "${key}" argument must be >= 1`);
5837
+ }
5838
+ }
5839
+ return value === void 0 ? Infinity : value;
5840
+ }
5841
+ function getItemCount(number) {
5842
+ if (number === 1) {
5843
+ return "1 item";
5844
+ }
5845
+ return `${number} items`;
5846
+ }
5847
+ function getUniqueReplacerSet(replacerArray) {
5848
+ const replacerSet = new Set();
5849
+ for (const value of replacerArray) {
5850
+ if (typeof value === "string") {
5851
+ replacerSet.add(value);
5852
+ } else if (typeof value === "number") {
5853
+ replacerSet.add(String(value));
5854
+ }
5855
+ }
5856
+ return replacerSet;
5857
+ }
5858
+ function configure2(options) {
5859
+ const circularValue = getCircularValueOption(options);
5860
+ const bigint = getBooleanOption(options, "bigint");
5861
+ const deterministic = getBooleanOption(options, "deterministic");
5862
+ const maximumDepth = getPositiveIntegerOption(options, "maximumDepth");
5863
+ const maximumBreadth = getPositiveIntegerOption(options, "maximumBreadth");
5864
+ function stringifyFnReplacer(key, parent, stack, replacer, spacer, indentation) {
5865
+ let value = parent[key];
5866
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
5867
+ value = value.toJSON(key);
5868
+ }
5869
+ value = replacer.call(parent, key, value);
5870
+ switch (typeof value) {
5871
+ case "string":
5872
+ return `"${strEscape(value)}"`;
5873
+ case "object": {
5874
+ if (value === null) {
5875
+ return "null";
5876
+ }
5877
+ if (stack.indexOf(value) !== -1) {
5878
+ return circularValue;
5879
+ }
5880
+ let res = "";
5881
+ let join2 = ",";
5882
+ const originalIndentation = indentation;
5883
+ if (Array.isArray(value)) {
5884
+ if (value.length === 0) {
5885
+ return "[]";
5886
+ }
5887
+ if (maximumDepth < stack.length + 1) {
5888
+ return '"[Array]"';
5889
+ }
5890
+ stack.push(value);
5891
+ if (spacer !== "") {
5892
+ indentation += spacer;
5893
+ res += `
5894
+ ${indentation}`;
5895
+ join2 = `,
5896
+ ${indentation}`;
5897
+ }
5898
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
5899
+ let i = 0;
5900
+ for (; i < maximumValuesToStringify - 1; i++) {
5901
+ const tmp2 = stringifyFnReplacer(i, value, stack, replacer, spacer, indentation);
5902
+ res += tmp2 !== void 0 ? tmp2 : "null";
5903
+ res += join2;
5904
+ }
5905
+ const tmp = stringifyFnReplacer(i, value, stack, replacer, spacer, indentation);
5906
+ res += tmp !== void 0 ? tmp : "null";
5907
+ if (value.length - 1 > maximumBreadth) {
5908
+ const removedKeys = value.length - maximumBreadth - 1;
5909
+ res += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
5910
+ }
5911
+ if (spacer !== "") {
5912
+ res += `
5913
+ ${originalIndentation}`;
5914
+ }
5915
+ stack.pop();
5916
+ return `[${res}]`;
5917
+ }
5918
+ let keys = Object.keys(value);
5919
+ const keyLength = keys.length;
5920
+ if (keyLength === 0) {
5921
+ return "{}";
5922
+ }
5923
+ if (maximumDepth < stack.length + 1) {
5924
+ return '"[Object]"';
5925
+ }
5926
+ let whitespace = "";
5927
+ let separator = "";
5928
+ if (spacer !== "") {
5929
+ indentation += spacer;
5930
+ join2 = `,
5931
+ ${indentation}`;
5932
+ whitespace = " ";
5933
+ }
5934
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
5935
+ if (isTypedArrayWithEntries(value)) {
5936
+ res += stringifyTypedArray(value, join2, maximumBreadth);
5937
+ keys = keys.slice(value.length);
5938
+ maximumPropertiesToStringify -= value.length;
5939
+ separator = join2;
5940
+ }
5941
+ if (deterministic) {
5942
+ keys = insertSort(keys);
5943
+ }
5944
+ stack.push(value);
5945
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
5946
+ const key2 = keys[i];
5947
+ const tmp = stringifyFnReplacer(key2, value, stack, replacer, spacer, indentation);
5948
+ if (tmp !== void 0) {
5949
+ res += `${separator}"${strEscape(key2)}":${whitespace}${tmp}`;
5950
+ separator = join2;
5951
+ }
5952
+ }
5953
+ if (keyLength > maximumBreadth) {
5954
+ const removedKeys = keyLength - maximumBreadth;
5955
+ res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"`;
5956
+ separator = join2;
5957
+ }
5958
+ if (spacer !== "" && separator.length > 1) {
5959
+ res = `
5960
+ ${indentation}${res}
5961
+ ${originalIndentation}`;
5962
+ }
5963
+ stack.pop();
5964
+ return `{${res}}`;
5965
+ }
5966
+ case "number":
5967
+ return isFinite(value) ? String(value) : "null";
5968
+ case "boolean":
5969
+ return value === true ? "true" : "false";
5970
+ case "bigint":
5971
+ return bigint ? String(value) : void 0;
5972
+ }
5973
+ }
5974
+ function stringifyArrayReplacer(key, value, stack, replacer, spacer, indentation) {
5975
+ if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
5976
+ value = value.toJSON(key);
5977
+ }
5978
+ switch (typeof value) {
5979
+ case "string":
5980
+ return `"${strEscape(value)}"`;
5981
+ case "object": {
5982
+ if (value === null) {
5983
+ return "null";
5984
+ }
5985
+ if (stack.indexOf(value) !== -1) {
5986
+ return circularValue;
5987
+ }
5988
+ const originalIndentation = indentation;
5989
+ let res = "";
5990
+ let join2 = ",";
5991
+ if (Array.isArray(value)) {
5992
+ if (value.length === 0) {
5993
+ return "[]";
5994
+ }
5995
+ if (maximumDepth < stack.length + 1) {
5996
+ return '"[Array]"';
5997
+ }
5998
+ stack.push(value);
5999
+ if (spacer !== "") {
6000
+ indentation += spacer;
6001
+ res += `
6002
+ ${indentation}`;
6003
+ join2 = `,
6004
+ ${indentation}`;
6005
+ }
6006
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
6007
+ let i = 0;
6008
+ for (; i < maximumValuesToStringify - 1; i++) {
6009
+ const tmp2 = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation);
6010
+ res += tmp2 !== void 0 ? tmp2 : "null";
6011
+ res += join2;
6012
+ }
6013
+ const tmp = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation);
6014
+ res += tmp !== void 0 ? tmp : "null";
6015
+ if (value.length - 1 > maximumBreadth) {
6016
+ const removedKeys = value.length - maximumBreadth - 1;
6017
+ res += `${join2}"... ${getItemCount(removedKeys)} not stringified"`;
6018
+ }
6019
+ if (spacer !== "") {
6020
+ res += `
6021
+ ${originalIndentation}`;
6022
+ }
6023
+ stack.pop();
6024
+ return `[${res}]`;
6025
+ }
6026
+ if (replacer.size === 0) {
6027
+ return "{}";
6028
+ }
6029
+ stack.push(value);
6030
+ let whitespace = "";
6031
+ if (spacer !== "") {
6032
+ indentation += spacer;
6033
+ join2 = `,
6034
+ ${indentation}`;
6035
+ whitespace = " ";
6036
+ }
6037
+ let separator = "";
6038
+ for (const key2 of replacer) {
6039
+ const tmp = stringifyArrayReplacer(key2, value[key2], stack, replacer, spacer, indentation);
6040
+ if (tmp !== void 0) {
6041
+ res += `${separator}"${strEscape(key2)}":${whitespace}${tmp}`;
6042
+ separator = join2;
6043
+ }
6044
+ }
6045
+ if (spacer !== "" && separator.length > 1) {
6046
+ res = `
6047
+ ${indentation}${res}
6048
+ ${originalIndentation}`;
6049
+ }
6050
+ stack.pop();
6051
+ return `{${res}}`;
6052
+ }
6053
+ case "number":
6054
+ return isFinite(value) ? String(value) : "null";
6055
+ case "boolean":
6056
+ return value === true ? "true" : "false";
6057
+ case "bigint":
6058
+ return bigint ? String(value) : void 0;
6059
+ }
6060
+ }
6061
+ function stringifyIndent(key, value, stack, spacer, indentation) {
6062
+ switch (typeof value) {
6063
+ case "string":
6064
+ return `"${strEscape(value)}"`;
6065
+ case "object": {
6066
+ if (value === null) {
6067
+ return "null";
6068
+ }
6069
+ if (typeof value.toJSON === "function") {
6070
+ value = value.toJSON(key);
6071
+ if (typeof value !== "object") {
6072
+ return stringifyIndent(key, value, stack, spacer, indentation);
6073
+ }
6074
+ if (value === null) {
6075
+ return "null";
6076
+ }
6077
+ }
6078
+ if (stack.indexOf(value) !== -1) {
6079
+ return circularValue;
6080
+ }
6081
+ const originalIndentation = indentation;
6082
+ if (Array.isArray(value)) {
6083
+ if (value.length === 0) {
6084
+ return "[]";
6085
+ }
6086
+ if (maximumDepth < stack.length + 1) {
6087
+ return '"[Array]"';
6088
+ }
6089
+ stack.push(value);
6090
+ indentation += spacer;
6091
+ let res2 = `
6092
+ ${indentation}`;
6093
+ const join3 = `,
6094
+ ${indentation}`;
6095
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
6096
+ let i = 0;
6097
+ for (; i < maximumValuesToStringify - 1; i++) {
6098
+ const tmp2 = stringifyIndent(i, value[i], stack, spacer, indentation);
6099
+ res2 += tmp2 !== void 0 ? tmp2 : "null";
6100
+ res2 += join3;
6101
+ }
6102
+ const tmp = stringifyIndent(i, value[i], stack, spacer, indentation);
6103
+ res2 += tmp !== void 0 ? tmp : "null";
6104
+ if (value.length - 1 > maximumBreadth) {
6105
+ const removedKeys = value.length - maximumBreadth - 1;
6106
+ res2 += `${join3}"... ${getItemCount(removedKeys)} not stringified"`;
6107
+ }
6108
+ res2 += `
6109
+ ${originalIndentation}`;
6110
+ stack.pop();
6111
+ return `[${res2}]`;
6112
+ }
6113
+ let keys = Object.keys(value);
6114
+ const keyLength = keys.length;
6115
+ if (keyLength === 0) {
6116
+ return "{}";
6117
+ }
6118
+ if (maximumDepth < stack.length + 1) {
6119
+ return '"[Object]"';
6120
+ }
6121
+ indentation += spacer;
6122
+ const join2 = `,
6123
+ ${indentation}`;
6124
+ let res = "";
6125
+ let separator = "";
6126
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
6127
+ if (isTypedArrayWithEntries(value)) {
6128
+ res += stringifyTypedArray(value, join2, maximumBreadth);
6129
+ keys = keys.slice(value.length);
6130
+ maximumPropertiesToStringify -= value.length;
6131
+ separator = join2;
6132
+ }
6133
+ if (deterministic) {
6134
+ keys = insertSort(keys);
6135
+ }
6136
+ stack.push(value);
6137
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
6138
+ const key2 = keys[i];
6139
+ const tmp = stringifyIndent(key2, value[key2], stack, spacer, indentation);
6140
+ if (tmp !== void 0) {
6141
+ res += `${separator}"${strEscape(key2)}": ${tmp}`;
6142
+ separator = join2;
6143
+ }
6144
+ }
6145
+ if (keyLength > maximumBreadth) {
6146
+ const removedKeys = keyLength - maximumBreadth;
6147
+ res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"`;
6148
+ separator = join2;
6149
+ }
6150
+ if (separator !== "") {
6151
+ res = `
6152
+ ${indentation}${res}
6153
+ ${originalIndentation}`;
6154
+ }
6155
+ stack.pop();
6156
+ return `{${res}}`;
6157
+ }
6158
+ case "number":
6159
+ return isFinite(value) ? String(value) : "null";
6160
+ case "boolean":
6161
+ return value === true ? "true" : "false";
6162
+ case "bigint":
6163
+ return bigint ? String(value) : void 0;
4295
6164
  }
4296
- } else
4297
- instance[serializersSym] = serializers;
4298
- if (bindings2.hasOwnProperty("formatters")) {
4299
- const { level, bindings: chindings, log } = bindings2.formatters;
4300
- instance[formattersSym] = buildFormatters(level || formatters.level, chindings || resetChildingsFormatter, log || formatters.log);
4301
- } else {
4302
- instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
4303
6165
  }
4304
- if (bindings2.hasOwnProperty("customLevels") === true) {
4305
- assertNoLevelCollisions(this.levels, bindings2.customLevels);
4306
- instance.levels = mappings(bindings2.customLevels, instance[useOnlyCustomLevelsSym]);
4307
- genLsCache(instance);
6166
+ function stringifySimple(key, value, stack) {
6167
+ switch (typeof value) {
6168
+ case "string":
6169
+ return `"${strEscape(value)}"`;
6170
+ case "object": {
6171
+ if (value === null) {
6172
+ return "null";
6173
+ }
6174
+ if (typeof value.toJSON === "function") {
6175
+ value = value.toJSON(key);
6176
+ if (typeof value !== "object") {
6177
+ return stringifySimple(key, value, stack);
6178
+ }
6179
+ if (value === null) {
6180
+ return "null";
6181
+ }
6182
+ }
6183
+ if (stack.indexOf(value) !== -1) {
6184
+ return circularValue;
6185
+ }
6186
+ let res = "";
6187
+ if (Array.isArray(value)) {
6188
+ if (value.length === 0) {
6189
+ return "[]";
6190
+ }
6191
+ if (maximumDepth < stack.length + 1) {
6192
+ return '"[Array]"';
6193
+ }
6194
+ stack.push(value);
6195
+ const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
6196
+ let i = 0;
6197
+ for (; i < maximumValuesToStringify - 1; i++) {
6198
+ const tmp2 = stringifySimple(i, value[i], stack);
6199
+ res += tmp2 !== void 0 ? tmp2 : "null";
6200
+ res += ",";
6201
+ }
6202
+ const tmp = stringifySimple(i, value[i], stack);
6203
+ res += tmp !== void 0 ? tmp : "null";
6204
+ if (value.length - 1 > maximumBreadth) {
6205
+ const removedKeys = value.length - maximumBreadth - 1;
6206
+ res += `,"... ${getItemCount(removedKeys)} not stringified"`;
6207
+ }
6208
+ stack.pop();
6209
+ return `[${res}]`;
6210
+ }
6211
+ let keys = Object.keys(value);
6212
+ const keyLength = keys.length;
6213
+ if (keyLength === 0) {
6214
+ return "{}";
6215
+ }
6216
+ if (maximumDepth < stack.length + 1) {
6217
+ return '"[Object]"';
6218
+ }
6219
+ let separator = "";
6220
+ let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth);
6221
+ if (isTypedArrayWithEntries(value)) {
6222
+ res += stringifyTypedArray(value, ",", maximumBreadth);
6223
+ keys = keys.slice(value.length);
6224
+ maximumPropertiesToStringify -= value.length;
6225
+ separator = ",";
6226
+ }
6227
+ if (deterministic) {
6228
+ keys = insertSort(keys);
6229
+ }
6230
+ stack.push(value);
6231
+ for (let i = 0; i < maximumPropertiesToStringify; i++) {
6232
+ const key2 = keys[i];
6233
+ const tmp = stringifySimple(key2, value[key2], stack);
6234
+ if (tmp !== void 0) {
6235
+ res += `${separator}"${strEscape(key2)}":${tmp}`;
6236
+ separator = ",";
6237
+ }
6238
+ }
6239
+ if (keyLength > maximumBreadth) {
6240
+ const removedKeys = keyLength - maximumBreadth;
6241
+ res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"`;
6242
+ }
6243
+ stack.pop();
6244
+ return `{${res}}`;
6245
+ }
6246
+ case "number":
6247
+ return isFinite(value) ? String(value) : "null";
6248
+ case "boolean":
6249
+ return value === true ? "true" : "false";
6250
+ case "bigint":
6251
+ return bigint ? String(value) : void 0;
6252
+ }
6253
+ }
6254
+ function stringify2(value, replacer, space) {
6255
+ if (arguments.length > 1) {
6256
+ let spacer = "";
6257
+ if (typeof space === "number") {
6258
+ spacer = " ".repeat(Math.min(space, 10));
6259
+ } else if (typeof space === "string") {
6260
+ spacer = space.slice(0, 10);
6261
+ }
6262
+ if (replacer != null) {
6263
+ if (typeof replacer === "function") {
6264
+ return stringifyFnReplacer("", { "": value }, [], replacer, spacer, "");
6265
+ }
6266
+ if (Array.isArray(replacer)) {
6267
+ return stringifyArrayReplacer("", value, [], getUniqueReplacerSet(replacer), spacer, "");
6268
+ }
6269
+ }
6270
+ if (spacer.length !== 0) {
6271
+ return stringifyIndent("", value, [], spacer, "");
6272
+ }
6273
+ }
6274
+ return stringifySimple("", value, []);
4308
6275
  }
4309
- instance[chindingsSym] = asChindings(instance, bindings2);
4310
- const childLevel = bindings2.level || this.level;
4311
- instance[setLevelSym](childLevel);
4312
- return instance;
4313
- }
4314
- function bindings() {
4315
- const chindings = this[chindingsSym];
4316
- const chindingsJson = `{${chindings.substr(1)}}`;
4317
- const bindingsFromJson = JSON.parse(chindingsJson);
4318
- delete bindingsFromJson.pid;
4319
- delete bindingsFromJson.hostname;
4320
- return bindingsFromJson;
4321
- }
4322
- function setBindings(newBindings) {
4323
- const chindings = asChindings(this, newBindings);
4324
- this[chindingsSym] = chindings;
4325
- delete this[parsedChindingsSym];
6276
+ return stringify2;
4326
6277
  }
4327
- function write(_obj, msg, num) {
4328
- const t = this[timeSym]();
4329
- const mixin = this[mixinSym];
4330
- const objError = _obj instanceof Error;
4331
- let obj;
4332
- if (_obj === void 0 || _obj === null) {
4333
- obj = mixin ? mixin({}) : {};
6278
+ }
6279
+ });
6280
+
6281
+ // ../../node_modules/pino/lib/multistream.js
6282
+ var require_multistream = __commonJS({
6283
+ "../../node_modules/pino/lib/multistream.js"(exports, module2) {
6284
+ "use strict";
6285
+ var metadata = Symbol.for("pino.metadata");
6286
+ var { levels } = require_levels2();
6287
+ var defaultLevels = Object.create(levels);
6288
+ defaultLevels.silent = Infinity;
6289
+ function multistream(streamsArray, opts) {
6290
+ let counter = 0;
6291
+ streamsArray = streamsArray || [];
6292
+ opts = opts || { dedupe: false };
6293
+ let levels2 = defaultLevels;
6294
+ if (opts.levels && typeof opts.levels === "object") {
6295
+ levels2 = opts.levels;
6296
+ }
6297
+ const res = {
6298
+ write,
6299
+ add,
6300
+ flushSync,
6301
+ end,
6302
+ minLevel: 0,
6303
+ streams: [],
6304
+ clone,
6305
+ [metadata]: true
6306
+ };
6307
+ if (Array.isArray(streamsArray)) {
6308
+ streamsArray.forEach(add, res);
4334
6309
  } else {
4335
- obj = Object.assign(mixin ? mixin(_obj) : {}, _obj);
4336
- if (!msg && objError) {
4337
- msg = _obj.message;
6310
+ add.call(res, streamsArray);
6311
+ }
6312
+ streamsArray = null;
6313
+ return res;
6314
+ function write(data) {
6315
+ let dest;
6316
+ const level = this.lastLevel;
6317
+ const { streams } = this;
6318
+ let stream;
6319
+ for (let i = 0; i < streams.length; i++) {
6320
+ dest = streams[i];
6321
+ if (dest.level <= level) {
6322
+ stream = dest.stream;
6323
+ if (stream[metadata]) {
6324
+ const { lastTime, lastMsg, lastObj, lastLogger } = this;
6325
+ stream.lastLevel = level;
6326
+ stream.lastTime = lastTime;
6327
+ stream.lastMsg = lastMsg;
6328
+ stream.lastObj = lastObj;
6329
+ stream.lastLogger = lastLogger;
6330
+ }
6331
+ if (!opts.dedupe || dest.level === level) {
6332
+ stream.write(data);
6333
+ }
6334
+ } else {
6335
+ break;
6336
+ }
4338
6337
  }
4339
- if (objError) {
4340
- obj.stack = _obj.stack;
4341
- if (!obj.type) {
4342
- obj.type = "Error";
6338
+ }
6339
+ function flushSync() {
6340
+ for (const { stream } of this.streams) {
6341
+ if (typeof stream.flushSync === "function") {
6342
+ stream.flushSync();
4343
6343
  }
4344
6344
  }
4345
6345
  }
4346
- const s = this[asJsonSym](obj, msg, num, t);
4347
- const stream = this[streamSym];
4348
- if (stream[needsMetadataGsym] === true) {
4349
- stream.lastLevel = num;
4350
- stream.lastObj = obj;
4351
- stream.lastMsg = msg;
4352
- stream.lastTime = t.slice(this[timeSliceIndexSym]);
4353
- stream.lastLogger = this;
6346
+ function add(dest) {
6347
+ const { streams } = this;
6348
+ if (typeof dest.write === "function") {
6349
+ return add.call(this, { stream: dest });
6350
+ } else if (typeof dest.levelVal === "number") {
6351
+ return add.call(this, Object.assign({}, dest, { level: dest.levelVal, levelVal: void 0 }));
6352
+ } else if (typeof dest.level === "string") {
6353
+ return add.call(this, Object.assign({}, dest, { level: levels2[dest.level] }));
6354
+ } else if (typeof dest.level !== "number") {
6355
+ dest = Object.assign({}, dest, { level: 30 });
6356
+ } else {
6357
+ dest = Object.assign({}, dest);
6358
+ }
6359
+ dest.id = counter++;
6360
+ streams.unshift(dest);
6361
+ streams.sort(compareByLevel);
6362
+ this.minLevel = streams[0].level;
6363
+ return res;
6364
+ }
6365
+ function end() {
6366
+ for (const { stream } of this.streams) {
6367
+ if (typeof stream.flushSync === "function") {
6368
+ stream.flushSync();
6369
+ }
6370
+ stream.end();
6371
+ }
6372
+ }
6373
+ function clone(level) {
6374
+ const streams = new Array(this.streams.length);
6375
+ for (let i = 0; i < streams.length; i++) {
6376
+ streams[i] = {
6377
+ level,
6378
+ stream: this.streams[i].stream
6379
+ };
6380
+ }
6381
+ return {
6382
+ write,
6383
+ add,
6384
+ minLevel: level,
6385
+ streams,
6386
+ clone,
6387
+ flushSync,
6388
+ [metadata]: true
6389
+ };
4354
6390
  }
4355
- if (stream instanceof SonicBoom)
4356
- stream.write(s);
4357
- else
4358
- stream.write(flatstr(s));
4359
6391
  }
4360
- function flush() {
4361
- const stream = this[streamSym];
4362
- if ("flush" in stream)
4363
- stream.flush();
6392
+ function compareByLevel(a, b) {
6393
+ return a.level - b.level;
4364
6394
  }
6395
+ module2.exports = multistream;
4365
6396
  }
4366
6397
  });
4367
6398
 
@@ -4370,19 +6401,22 @@ var require_pino2 = __commonJS({
4370
6401
  "../../node_modules/pino/pino.js"(exports, module2) {
4371
6402
  "use strict";
4372
6403
  var os = require("os");
4373
- var stdSerializers = require_pino_std_serializers();
6404
+ var stdSerializers = require_pino_std_serializers2();
6405
+ var caller = require_get_caller_file();
4374
6406
  var redaction = require_redaction2();
4375
6407
  var time = require_time2();
4376
6408
  var proto = require_proto2();
4377
6409
  var symbols = require_symbols2();
6410
+ var { configure: configure2 } = require_safe_stable_stringify();
4378
6411
  var { assertDefaultLevelFound, mappings, genLsCache } = require_levels2();
4379
6412
  var {
4380
6413
  createArgsNormalizer,
4381
6414
  asChindings,
4382
6415
  final,
4383
- stringify,
4384
6416
  buildSafeSonicBoom,
4385
6417
  buildFormatters,
6418
+ stringify,
6419
+ normalizeDestFileDescriptor,
4386
6420
  noop
4387
6421
  } = require_tools2();
4388
6422
  var { version: version2 } = require_meta2();
@@ -4394,6 +6428,7 @@ var require_pino2 = __commonJS({
4394
6428
  timeSliceIndexSym,
4395
6429
  streamSym,
4396
6430
  stringifySym,
6431
+ stringifySafeSym,
4397
6432
  stringifiersSym,
4398
6433
  setLevelSym,
4399
6434
  endSym,
@@ -4403,7 +6438,8 @@ var require_pino2 = __commonJS({
4403
6438
  mixinSym,
4404
6439
  useOnlyCustomLevelsSym,
4405
6440
  formattersSym,
4406
- hooksSym
6441
+ hooksSym,
6442
+ nestedKeyStrSym
4407
6443
  } = symbols;
4408
6444
  var { epochTime, nullTime } = time;
4409
6445
  var { pid } = process;
@@ -4434,14 +6470,15 @@ var require_pino2 = __commonJS({
4434
6470
  name: void 0,
4435
6471
  redact: null,
4436
6472
  customLevels: null,
4437
- levelKey: void 0,
4438
- useOnlyCustomLevels: false
6473
+ useOnlyCustomLevels: false,
6474
+ depthLimit: 5,
6475
+ edgeLimit: 100
4439
6476
  };
4440
6477
  var normalize = createArgsNormalizer(defaultOptions);
4441
6478
  var serializers = Object.assign(Object.create(null), stdSerializers);
4442
6479
  function pino3(...args) {
4443
6480
  const instance = {};
4444
- const { opts, stream } = normalize(instance, ...args);
6481
+ const { opts, stream } = normalize(instance, caller(), ...args);
4445
6482
  const {
4446
6483
  redact,
4447
6484
  crlf,
@@ -4453,30 +6490,18 @@ var require_pino2 = __commonJS({
4453
6490
  name,
4454
6491
  level,
4455
6492
  customLevels,
4456
- useLevelLabels,
4457
- changeLevelName,
4458
- levelKey,
4459
6493
  mixin,
4460
6494
  useOnlyCustomLevels,
4461
6495
  formatters,
4462
- hooks
6496
+ hooks,
6497
+ depthLimit,
6498
+ edgeLimit
4463
6499
  } = opts;
6500
+ const stringifySafe = configure2({
6501
+ maximumDepth: depthLimit,
6502
+ maximumBreadth: edgeLimit
6503
+ });
4464
6504
  const allFormatters = buildFormatters(formatters.level, formatters.bindings, formatters.log);
4465
- if (useLevelLabels && !(changeLevelName || levelKey)) {
4466
- process.emitWarning("useLevelLabels is deprecated, use the formatters.level option instead", "Warning", "PINODEP001");
4467
- allFormatters.level = labelsFormatter;
4468
- } else if ((changeLevelName || levelKey) && !useLevelLabels) {
4469
- process.emitWarning("changeLevelName and levelKey are deprecated, use the formatters.level option instead", "Warning", "PINODEP002");
4470
- allFormatters.level = levelNameFormatter(changeLevelName || levelKey);
4471
- } else if ((changeLevelName || levelKey) && useLevelLabels) {
4472
- process.emitWarning("useLevelLabels is deprecated, use the formatters.level option instead", "Warning", "PINODEP001");
4473
- process.emitWarning("changeLevelName and levelKey are deprecated, use the formatters.level option instead", "Warning", "PINODEP002");
4474
- allFormatters.level = levelNameLabelFormatter(changeLevelName || levelKey);
4475
- }
4476
- if (serializers2[Symbol.for("pino.*")]) {
4477
- process.emitWarning("The pino.* serializer is deprecated, use the formatters.log options instead", "Warning", "PINODEP003");
4478
- allFormatters.log = serializers2[Symbol.for("pino.*")];
4479
- }
4480
6505
  if (!allFormatters.bindings) {
4481
6506
  allFormatters.bindings = defaultOptions.formatters.bindings;
4482
6507
  }
@@ -4484,13 +6509,17 @@ var require_pino2 = __commonJS({
4484
6509
  allFormatters.level = defaultOptions.formatters.level;
4485
6510
  }
4486
6511
  const stringifiers = redact ? redaction(redact, stringify) : {};
4487
- const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify };
6512
+ const stringifyFn = stringify.bind({
6513
+ [stringifySafeSym]: stringifySafe
6514
+ });
6515
+ const formatOpts = redact ? { stringify: stringifiers[redactFmtSym] } : { stringify: stringifyFn };
4488
6516
  const end = "}" + (crlf ? "\r\n" : "\n");
4489
6517
  const coreChindings = asChindings.bind(null, {
4490
6518
  [chindingsSym]: "",
4491
6519
  [serializersSym]: serializers2,
4492
6520
  [stringifiersSym]: stringifiers,
4493
6521
  [stringifySym]: stringify,
6522
+ [stringifySafeSym]: stringifySafe,
4494
6523
  [formattersSym]: allFormatters
4495
6524
  });
4496
6525
  let chindings = "";
@@ -4516,11 +6545,13 @@ var require_pino2 = __commonJS({
4516
6545
  [timeSym]: time2,
4517
6546
  [timeSliceIndexSym]: timeSliceIndex,
4518
6547
  [stringifySym]: stringify,
6548
+ [stringifySafeSym]: stringifySafe,
4519
6549
  [stringifiersSym]: stringifiers,
4520
6550
  [endSym]: end,
4521
6551
  [formatOptsSym]: formatOpts,
4522
6552
  [messageKeySym]: messageKey,
4523
6553
  [nestedKeySym]: nestedKey,
6554
+ [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
4524
6555
  [serializersSym]: serializers2,
4525
6556
  [mixinSym]: mixin,
4526
6557
  [chindingsSym]: chindings,
@@ -4533,32 +6564,17 @@ var require_pino2 = __commonJS({
4533
6564
  instance[setLevelSym](level);
4534
6565
  return instance;
4535
6566
  }
4536
- function labelsFormatter(label, number) {
4537
- return { level: label };
4538
- }
4539
- function levelNameFormatter(name) {
4540
- return function(label, number) {
4541
- return { [name]: number };
4542
- };
4543
- }
4544
- function levelNameLabelFormatter(name) {
4545
- return function(label, number) {
4546
- return { [name]: label };
4547
- };
4548
- }
4549
6567
  module2.exports = pino3;
4550
- module2.exports.extreme = (dest = process.stdout.fd) => {
4551
- process.emitWarning("The pino.extreme() option is deprecated and will be removed in v7. Use pino.destination({ sync: false }) instead.", { code: "extreme_deprecation" });
4552
- return buildSafeSonicBoom({ dest, minLength: 4096, sync: false });
4553
- };
4554
6568
  module2.exports.destination = (dest = process.stdout.fd) => {
4555
6569
  if (typeof dest === "object") {
4556
- dest.dest = dest.dest || process.stdout.fd;
6570
+ dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
4557
6571
  return buildSafeSonicBoom(dest);
4558
6572
  } else {
4559
- return buildSafeSonicBoom({ dest, minLength: 0, sync: true });
6573
+ return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0, sync: true });
4560
6574
  }
4561
6575
  };
6576
+ module2.exports.transport = require_transport();
6577
+ module2.exports.multistream = require_multistream();
4562
6578
  module2.exports.final = final;
4563
6579
  module2.exports.levels = mappings();
4564
6580
  module2.exports.stdSerializers = serializers;
@@ -9204,21 +11220,21 @@ var require_splay = __commonJS({
9204
11220
  typeof exports === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.SplayTree = factory();
9205
11221
  })(exports, function() {
9206
11222
  "use strict";
9207
- var Node = function() {
9208
- function Node2(key, data) {
11223
+ var Node2 = function() {
11224
+ function Node3(key, data) {
9209
11225
  this.next = null;
9210
11226
  this.key = key;
9211
11227
  this.data = data;
9212
11228
  this.left = null;
9213
11229
  this.right = null;
9214
11230
  }
9215
- return Node2;
11231
+ return Node3;
9216
11232
  }();
9217
11233
  function DEFAULT_COMPARE(a, b) {
9218
11234
  return a > b ? 1 : a < b ? -1 : 0;
9219
11235
  }
9220
11236
  function splay(i, t, comparator) {
9221
- var N = new Node(null, null);
11237
+ var N = new Node2(null, null);
9222
11238
  var l = N;
9223
11239
  var r = N;
9224
11240
  while (true) {
@@ -9261,7 +11277,7 @@ var require_splay = __commonJS({
9261
11277
  return t;
9262
11278
  }
9263
11279
  function insert(i, data, t, comparator) {
9264
- var node = new Node(i, data);
11280
+ var node = new Node2(i, data);
9265
11281
  if (t === null) {
9266
11282
  node.left = node.right = null;
9267
11283
  return node;
@@ -9333,7 +11349,7 @@ var require_splay = __commonJS({
9333
11349
  return this._root = insert(key, data, this._root, this._comparator);
9334
11350
  };
9335
11351
  Tree2.prototype.add = function(key, data) {
9336
- var node = new Node(key, data);
11352
+ var node = new Node2(key, data);
9337
11353
  if (this._root === null) {
9338
11354
  node.left = node.right = null;
9339
11355
  this._size++;
@@ -9659,7 +11675,7 @@ var require_splay = __commonJS({
9659
11675
  var middle = start + Math.floor(size / 2);
9660
11676
  var key = keys[middle];
9661
11677
  var data = values[middle];
9662
- var node = new Node(key, data);
11678
+ var node = new Node2(key, data);
9663
11679
  node.left = loadRecursive(keys, values, start, middle);
9664
11680
  node.right = loadRecursive(keys, values, middle + 1, end);
9665
11681
  return node;
@@ -9667,10 +11683,10 @@ var require_splay = __commonJS({
9667
11683
  return null;
9668
11684
  }
9669
11685
  function createList(keys, values) {
9670
- var head = new Node(null, null);
11686
+ var head = new Node2(null, null);
9671
11687
  var p = head;
9672
11688
  for (var i = 0; i < keys.length; i++) {
9673
- p = p.next = new Node(keys[i], values[i]);
11689
+ p = p.next = new Node2(keys[i], values[i]);
9674
11690
  }
9675
11691
  p.next = null;
9676
11692
  return head.next;
@@ -9679,7 +11695,7 @@ var require_splay = __commonJS({
9679
11695
  var current = root;
9680
11696
  var Q = [];
9681
11697
  var done = false;
9682
- var head = new Node(null, null);
11698
+ var head = new Node2(null, null);
9683
11699
  var p = head;
9684
11700
  while (!done) {
9685
11701
  if (current) {
@@ -9710,7 +11726,7 @@ var require_splay = __commonJS({
9710
11726
  return null;
9711
11727
  }
9712
11728
  function mergeLists(l1, l2, compare) {
9713
- var head = new Node(null, null);
11729
+ var head = new Node2(null, null);
9714
11730
  var p = head;
9715
11731
  var p1 = l1;
9716
11732
  var p2 = l2;
@@ -21302,117 +23318,6 @@ var require_ieee754 = __commonJS({
21302
23318
  }
21303
23319
  });
21304
23320
 
21305
- // ../../node_modules/yocto-queue/index.js
21306
- var require_yocto_queue = __commonJS({
21307
- "../../node_modules/yocto-queue/index.js"(exports, module2) {
21308
- var Node = class {
21309
- constructor(value) {
21310
- this.value = value;
21311
- this.next = void 0;
21312
- }
21313
- };
21314
- var Queue = class {
21315
- constructor() {
21316
- this.clear();
21317
- }
21318
- enqueue(value) {
21319
- const node = new Node(value);
21320
- if (this._head) {
21321
- this._tail.next = node;
21322
- this._tail = node;
21323
- } else {
21324
- this._head = node;
21325
- this._tail = node;
21326
- }
21327
- this._size++;
21328
- }
21329
- dequeue() {
21330
- const current = this._head;
21331
- if (!current) {
21332
- return;
21333
- }
21334
- this._head = this._head.next;
21335
- this._size--;
21336
- return current.value;
21337
- }
21338
- clear() {
21339
- this._head = void 0;
21340
- this._tail = void 0;
21341
- this._size = 0;
21342
- }
21343
- get size() {
21344
- return this._size;
21345
- }
21346
- *[Symbol.iterator]() {
21347
- let current = this._head;
21348
- while (current) {
21349
- yield current.value;
21350
- current = current.next;
21351
- }
21352
- }
21353
- };
21354
- module2.exports = Queue;
21355
- }
21356
- });
21357
-
21358
- // ../../node_modules/p-limit/index.js
21359
- var require_p_limit = __commonJS({
21360
- "../../node_modules/p-limit/index.js"(exports, module2) {
21361
- "use strict";
21362
- var Queue = require_yocto_queue();
21363
- var pLimit2 = (concurrency) => {
21364
- if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
21365
- throw new TypeError("Expected `concurrency` to be a number from 1 and up");
21366
- }
21367
- const queue = new Queue();
21368
- let activeCount = 0;
21369
- const next = () => {
21370
- activeCount--;
21371
- if (queue.size > 0) {
21372
- queue.dequeue()();
21373
- }
21374
- };
21375
- const run = async (fn, resolve2, ...args) => {
21376
- activeCount++;
21377
- const result = (async () => fn(...args))();
21378
- resolve2(result);
21379
- try {
21380
- await result;
21381
- } catch {
21382
- }
21383
- next();
21384
- };
21385
- const enqueue = (fn, resolve2, ...args) => {
21386
- queue.enqueue(run.bind(null, fn, resolve2, ...args));
21387
- (async () => {
21388
- await Promise.resolve();
21389
- if (activeCount < concurrency && queue.size > 0) {
21390
- queue.dequeue()();
21391
- }
21392
- })();
21393
- };
21394
- const generator = (fn, ...args) => new Promise((resolve2) => {
21395
- enqueue(fn, resolve2, ...args);
21396
- });
21397
- Object.defineProperties(generator, {
21398
- activeCount: {
21399
- get: () => activeCount
21400
- },
21401
- pendingCount: {
21402
- get: () => queue.size
21403
- },
21404
- clearQueue: {
21405
- value: () => {
21406
- queue.clear();
21407
- }
21408
- }
21409
- });
21410
- return generator;
21411
- };
21412
- module2.exports = pLimit2;
21413
- }
21414
- });
21415
-
21416
23321
  // ../../node_modules/binparse/build/src/base.js
21417
23322
  var require_base = __commonJS({
21418
23323
  "../../node_modules/binparse/build/src/base.js"(exports) {
@@ -22369,8 +24274,8 @@ var LambdaHttpResponse = class {
22369
24274
  };
22370
24275
 
22371
24276
  // ../../node_modules/@linzjs/lambda/build/src/function.js
22372
- var version = "v6.15.0";
22373
- var hash = "69cf1c417a9de62e7ac38b8a4d9309a1359260fa";
24277
+ var version = "v6.18.0";
24278
+ var hash = "e87458ee8d0572780b9df074b718af0ecd72acc3";
22374
24279
  var versionInfo = { version, hash };
22375
24280
  async function runFunction(req, fn) {
22376
24281
  try {
@@ -25333,7 +27238,7 @@ async function Ping() {
25333
27238
  async function Version() {
25334
27239
  const response = new LambdaHttpResponse(200, "ok");
25335
27240
  response.header(HttpHeader.CacheControl, "no-store");
25336
- response.json({ version: "v6.15.0", hash: "69cf1c417a9de62e7ac38b8a4d9309a1359260fa" });
27241
+ response.json({ version: "v6.18.0", hash: "e87458ee8d0572780b9df074b718af0ecd72acc3" });
25337
27242
  return response;
25338
27243
  }
25339
27244
 
@@ -26366,8 +28271,112 @@ var CogTiff = class {
26366
28271
  }
26367
28272
  };
26368
28273
 
26369
- // src/tile.set.raster.ts
26370
- var import_p_limit = __toModule(require_p_limit());
28274
+ // ../../node_modules/yocto-queue/index.js
28275
+ var Node = class {
28276
+ constructor(value) {
28277
+ __publicField(this, "value");
28278
+ __publicField(this, "next");
28279
+ this.value = value;
28280
+ }
28281
+ };
28282
+ var _head, _tail, _size;
28283
+ var Queue = class {
28284
+ constructor() {
28285
+ __privateAdd(this, _head, void 0);
28286
+ __privateAdd(this, _tail, void 0);
28287
+ __privateAdd(this, _size, void 0);
28288
+ this.clear();
28289
+ }
28290
+ enqueue(value) {
28291
+ const node = new Node(value);
28292
+ if (__privateGet(this, _head)) {
28293
+ __privateGet(this, _tail).next = node;
28294
+ __privateSet(this, _tail, node);
28295
+ } else {
28296
+ __privateSet(this, _head, node);
28297
+ __privateSet(this, _tail, node);
28298
+ }
28299
+ __privateWrapper(this, _size)._++;
28300
+ }
28301
+ dequeue() {
28302
+ const current = __privateGet(this, _head);
28303
+ if (!current) {
28304
+ return;
28305
+ }
28306
+ __privateSet(this, _head, __privateGet(this, _head).next);
28307
+ __privateWrapper(this, _size)._--;
28308
+ return current.value;
28309
+ }
28310
+ clear() {
28311
+ __privateSet(this, _head, void 0);
28312
+ __privateSet(this, _tail, void 0);
28313
+ __privateSet(this, _size, 0);
28314
+ }
28315
+ get size() {
28316
+ return __privateGet(this, _size);
28317
+ }
28318
+ *[Symbol.iterator]() {
28319
+ let current = __privateGet(this, _head);
28320
+ while (current) {
28321
+ yield current.value;
28322
+ current = current.next;
28323
+ }
28324
+ }
28325
+ };
28326
+ _head = new WeakMap();
28327
+ _tail = new WeakMap();
28328
+ _size = new WeakMap();
28329
+
28330
+ // ../../node_modules/p-limit/index.js
28331
+ function pLimit(concurrency) {
28332
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
28333
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
28334
+ }
28335
+ const queue = new Queue();
28336
+ let activeCount = 0;
28337
+ const next = () => {
28338
+ activeCount--;
28339
+ if (queue.size > 0) {
28340
+ queue.dequeue()();
28341
+ }
28342
+ };
28343
+ const run = async (fn, resolve2, args) => {
28344
+ activeCount++;
28345
+ const result = (async () => fn(...args))();
28346
+ resolve2(result);
28347
+ try {
28348
+ await result;
28349
+ } catch {
28350
+ }
28351
+ next();
28352
+ };
28353
+ const enqueue = (fn, resolve2, args) => {
28354
+ queue.enqueue(run.bind(void 0, fn, resolve2, args));
28355
+ (async () => {
28356
+ await Promise.resolve();
28357
+ if (activeCount < concurrency && queue.size > 0) {
28358
+ queue.dequeue()();
28359
+ }
28360
+ })();
28361
+ };
28362
+ const generator = (fn, ...args) => new Promise((resolve2) => {
28363
+ enqueue(fn, resolve2, args);
28364
+ });
28365
+ Object.defineProperties(generator, {
28366
+ activeCount: {
28367
+ get: () => activeCount
28368
+ },
28369
+ pendingCount: {
28370
+ get: () => queue.size
28371
+ },
28372
+ clearQueue: {
28373
+ value: () => {
28374
+ queue.clear();
28375
+ }
28376
+ }
28377
+ });
28378
+ return generator;
28379
+ }
26371
28380
 
26372
28381
  // src/routes/tile.etag.ts
26373
28382
  var import_crypto = __toModule(require("crypto"));
@@ -26399,6 +28408,7 @@ var import_sharp = __toModule(require("sharp"));
26399
28408
  function notEmpty(value) {
26400
28409
  return value != null;
26401
28410
  }
28411
+ var EmptyImage = new Map();
26402
28412
  var TileMakerSharp = class {
26403
28413
  constructor(tileSize) {
26404
28414
  this.tileSize = tileSize;
@@ -26414,8 +28424,18 @@ var TileMakerSharp = class {
26414
28424
  }
26415
28425
  return false;
26416
28426
  }
26417
- async getImageBuffer(layers, format, background) {
26418
- const pipeline2 = this.createImage(background).composite(layers);
28427
+ getEmptyImage(format, background) {
28428
+ const imgKey = [format, background.r, background.g, background.b, background.alpha].join("-");
28429
+ let existing = EmptyImage.get(imgKey);
28430
+ if (existing)
28431
+ return existing;
28432
+ existing = this.toImage(format, this.createImage(background));
28433
+ if (EmptyImage.size > 128)
28434
+ EmptyImage.clear();
28435
+ EmptyImage.set(imgKey, existing);
28436
+ return existing;
28437
+ }
28438
+ toImage(format, pipeline2) {
26419
28439
  switch (format) {
26420
28440
  case ImageFormat.JPEG:
26421
28441
  return pipeline2.jpeg().toBuffer();
@@ -26429,14 +28449,47 @@ var TileMakerSharp = class {
26429
28449
  throw new Error(`Invalid image format "${format}"`);
26430
28450
  }
26431
28451
  }
28452
+ async getImageBuffer(layers, format, background) {
28453
+ if (layers.length === 0)
28454
+ return this.getEmptyImage(format, background);
28455
+ return this.toImage(format, this.createImage(background).composite(layers));
28456
+ }
28457
+ isDirectImage(ctx) {
28458
+ var _a;
28459
+ if (ctx.layers.length !== 1)
28460
+ return false;
28461
+ const firstLayer = ctx.layers[0];
28462
+ if (firstLayer.x !== 0 || firstLayer.y !== 0)
28463
+ return false;
28464
+ if (firstLayer.crop != null || firstLayer.extract != null || firstLayer.resize != null)
28465
+ return false;
28466
+ const img = firstLayer.tiff.getImage(firstLayer.source.imageId);
28467
+ const tileSize = img.tileSize;
28468
+ if (tileSize.height !== this.tileSize || tileSize.width !== this.tileSize)
28469
+ return false;
28470
+ if (!((_a = img.compression) === null || _a === void 0 ? void 0 : _a.includes(ctx.format)))
28471
+ return false;
28472
+ if (ctx.background.alpha !== 0)
28473
+ return false;
28474
+ return true;
28475
+ }
26432
28476
  async compose(ctx) {
26433
28477
  const metrics = new Metrics();
26434
28478
  metrics.start("compose:overlay");
28479
+ if (this.isDirectImage(ctx)) {
28480
+ const firstLayer = ctx.layers[0];
28481
+ const buf = await firstLayer.tiff.getTile(firstLayer.source.x, firstLayer.source.y, firstLayer.source.imageId);
28482
+ metrics.end("compose:overlay");
28483
+ if (buf == null)
28484
+ return { buffer: await this.getEmptyImage(ctx.format, ctx.background), metrics, layers: 0 };
28485
+ metrics.start("compose:direct");
28486
+ metrics.end("compose:direct");
28487
+ return { buffer: Buffer.from(buf.bytes), metrics, layers: 1 };
28488
+ }
26435
28489
  const todo = [];
26436
28490
  for (const comp of ctx.layers) {
26437
- if (this.isTooLarge(comp)) {
28491
+ if (this.isTooLarge(comp))
26438
28492
  continue;
26439
- }
26440
28493
  todo.push(this.composeTile(comp, ctx.resizeKernel));
26441
28494
  }
26442
28495
  const overlays = await Promise.all(todo).then((items) => items.filter(notEmpty));
@@ -27048,7 +29101,7 @@ var TileRoute = {
27048
29101
  return NotModified;
27049
29102
  const response = new LambdaHttpResponse(200, "ok");
27050
29103
  response.header(HttpHeader.ETag, cacheKey);
27051
- response.header(HttpHeader.CacheControl, "max-age=120");
29104
+ response.header(HttpHeader.CacheControl, "no-store");
27052
29105
  response.buffer(data, "application/json");
27053
29106
  req.set("bytes", data.byteLength);
27054
29107
  return response;
@@ -27138,7 +29191,7 @@ var TileSetHandler = class {
27138
29191
  };
27139
29192
 
27140
29193
  // src/tile.set.raster.ts
27141
- var LoadingQueue = (0, import_p_limit.default)(Env.getNumber(Env.TiffConcurrency, 5));
29194
+ var LoadingQueue = pLimit(Env.getNumber(Env.TiffConcurrency, 5));
27142
29195
  var DefaultResizeKernel = { in: "lanczos3", out: "lanczos3" };
27143
29196
  var DefaultBackground = { r: 0, g: 0, b: 0, alpha: 0 };
27144
29197
  var TileSetRaster = class extends TileSetHandler {