@basemaps/lambda-tiler 6.16.0 → 6.19.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
@@ -58,9 +58,9 @@ var __privateWrapper = (obj, member, setter, getter) => {
58
58
  };
59
59
  };
60
60
 
61
- // ../../node_modules/pino-std-serializers/lib/err.js
61
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/err.js
62
62
  var require_err = __commonJS({
63
- "../../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) {
64
64
  "use strict";
65
65
  module2.exports = errSerializer;
66
66
  var { toString } = Object.prototype;
@@ -124,9 +124,9 @@ var require_err = __commonJS({
124
124
  }
125
125
  });
126
126
 
127
- // ../../node_modules/pino-std-serializers/lib/req.js
127
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/req.js
128
128
  var require_req = __commonJS({
129
- "../../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) {
130
130
  "use strict";
131
131
  module2.exports = {
132
132
  mapHttpRequest,
@@ -202,9 +202,9 @@ var require_req = __commonJS({
202
202
  }
203
203
  });
204
204
 
205
- // ../../node_modules/pino-std-serializers/lib/res.js
205
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/lib/res.js
206
206
  var require_res = __commonJS({
207
- "../../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) {
208
208
  "use strict";
209
209
  module2.exports = {
210
210
  mapHttpResponse,
@@ -251,9 +251,9 @@ var require_res = __commonJS({
251
251
  }
252
252
  });
253
253
 
254
- // ../../node_modules/pino-std-serializers/index.js
254
+ // ../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/index.js
255
255
  var require_pino_std_serializers = __commonJS({
256
- "../../node_modules/pino-std-serializers/index.js"(exports, module2) {
256
+ "../../node_modules/@linzjs/lambda/node_modules/pino-std-serializers/index.js"(exports, module2) {
257
257
  "use strict";
258
258
  var errSerializer = require_err();
259
259
  var reqSerializers = require_req();
@@ -891,9 +891,9 @@ var require_flatstr = __commonJS({
891
891
  }
892
892
  });
893
893
 
894
- // ../../node_modules/atomic-sleep/index.js
894
+ // ../../node_modules/@linzjs/lambda/node_modules/atomic-sleep/index.js
895
895
  var require_atomic_sleep = __commonJS({
896
- "../../node_modules/atomic-sleep/index.js"(exports, module2) {
896
+ "../../node_modules/@linzjs/lambda/node_modules/atomic-sleep/index.js"(exports, module2) {
897
897
  "use strict";
898
898
  if (typeof SharedArrayBuffer !== "undefined" && typeof Atomics !== "undefined") {
899
899
  let sleep = function(ms) {
@@ -926,9 +926,9 @@ var require_atomic_sleep = __commonJS({
926
926
  }
927
927
  });
928
928
 
929
- // ../../node_modules/sonic-boom/index.js
929
+ // ../../node_modules/@linzjs/lambda/node_modules/sonic-boom/index.js
930
930
  var require_sonic_boom = __commonJS({
931
- "../../node_modules/sonic-boom/index.js"(exports, module2) {
931
+ "../../node_modules/@linzjs/lambda/node_modules/sonic-boom/index.js"(exports, module2) {
932
932
  "use strict";
933
933
  var fs4 = require("fs");
934
934
  var EventEmitter = require("events");
@@ -1399,9 +1399,9 @@ var require_quick_format_unescaped = __commonJS({
1399
1399
  }
1400
1400
  });
1401
1401
 
1402
- // ../../node_modules/@linzjs/lambda/node_modules/fast-safe-stringify/index.js
1402
+ // ../../node_modules/fast-safe-stringify/index.js
1403
1403
  var require_fast_safe_stringify = __commonJS({
1404
- "../../node_modules/@linzjs/lambda/node_modules/fast-safe-stringify/index.js"(exports, module2) {
1404
+ "../../node_modules/fast-safe-stringify/index.js"(exports, module2) {
1405
1405
  module2.exports = stringify;
1406
1406
  stringify.default = stringify;
1407
1407
  stringify.stable = deterministicStringify;
@@ -3260,6 +3260,273 @@ var require_src = __commonJS({
3260
3260
  }
3261
3261
  });
3262
3262
 
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) {
3266
+ "use strict";
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;
3294
+ }
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);
3316
+ }
3317
+ } else {
3318
+ _err[key] = val;
3319
+ }
3320
+ }
3321
+ }
3322
+ delete err[seen];
3323
+ _err.raw = err;
3324
+ return _err;
3325
+ }
3326
+ }
3327
+ });
3328
+
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) {
3332
+ "use strict";
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
+
3263
3530
  // ../../node_modules/pino/lib/symbols.js
3264
3531
  var require_symbols2 = __commonJS({
3265
3532
  "../../node_modules/pino/lib/symbols.js"(exports, module2) {
@@ -3280,11 +3547,13 @@ var require_symbols2 = __commonJS({
3280
3547
  var timeSliceIndexSym = Symbol("pino.timeSliceIndex");
3281
3548
  var streamSym = Symbol("pino.stream");
3282
3549
  var stringifySym = Symbol("pino.stringify");
3550
+ var stringifySafeSym = Symbol("pino.stringifySafe");
3283
3551
  var stringifiersSym = Symbol("pino.stringifiers");
3284
3552
  var endSym = Symbol("pino.end");
3285
3553
  var formatOptsSym = Symbol("pino.formatOpts");
3286
3554
  var messageKeySym = Symbol("pino.messageKey");
3287
3555
  var nestedKeySym = Symbol("pino.nestedKey");
3556
+ var nestedKeyStrSym = Symbol("pino.nestedKeyStr");
3288
3557
  var wildcardFirstSym = Symbol("pino.wildcardFirst");
3289
3558
  var serializersSym = Symbol.for("pino.serializers");
3290
3559
  var formattersSym = Symbol.for("pino.formatters");
@@ -3307,6 +3576,7 @@ var require_symbols2 = __commonJS({
3307
3576
  timeSliceIndexSym,
3308
3577
  streamSym,
3309
3578
  stringifySym,
3579
+ stringifySafeSym,
3310
3580
  stringifiersSym,
3311
3581
  endSym,
3312
3582
  formatOptsSym,
@@ -3316,7 +3586,8 @@ var require_symbols2 = __commonJS({
3316
3586
  needsMetadataGsym,
3317
3587
  useOnlyCustomLevelsSym,
3318
3588
  formattersSym,
3319
- hooksSym
3589
+ hooksSym,
3590
+ nestedKeyStrSym
3320
3591
  };
3321
3592
  }
3322
3593
  });
@@ -3421,159 +3692,1002 @@ var require_time2 = __commonJS({
3421
3692
  }
3422
3693
  });
3423
3694
 
3424
- // ../../node_modules/fast-safe-stringify/index.js
3425
- var require_fast_safe_stringify2 = __commonJS({
3426
- "../../node_modules/fast-safe-stringify/index.js"(exports, module2) {
3427
- module2.exports = stringify;
3428
- stringify.default = stringify;
3429
- stringify.stable = deterministicStringify;
3430
- stringify.stableStringify = deterministicStringify;
3431
- var arr = [];
3432
- var replacerStack = [];
3433
- function stringify(obj, replacer, spacer) {
3434
- decirc(obj, "", [], void 0);
3435
- var res;
3436
- if (replacerStack.length === 0) {
3437
- res = JSON.stringify(obj, replacer, spacer);
3438
- } else {
3439
- res = JSON.stringify(obj, replaceGetterValues(replacer), spacer);
3440
- }
3441
- while (arr.length !== 0) {
3442
- var part = arr.pop();
3443
- if (part.length === 4) {
3444
- Object.defineProperty(part[0], part[1], part[3]);
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"));
3445
3768
  } else {
3446
- part[0][part[1]] = part[2];
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);
3447
3776
  }
3448
3777
  }
3449
- return res;
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
+ }
3450
3798
  }
3451
- function decirc(val, k, stack, parent) {
3452
- var i;
3453
- if (typeof val === "object" && val !== null) {
3454
- for (i = 0; i < stack.length; i++) {
3455
- if (stack[i] === val) {
3456
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
3457
- if (propertyDescriptor.get !== void 0) {
3458
- if (propertyDescriptor.configurable) {
3459
- Object.defineProperty(parent, k, { value: "[Circular]" });
3460
- arr.push([parent, k, val, propertyDescriptor]);
3461
- } else {
3462
- replacerStack.push([val, k]);
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);
3463
3842
  }
3464
3843
  } else {
3465
- parent[k] = "[Circular]";
3466
- arr.push([parent, k, val]);
3844
+ setTimeout(() => {
3845
+ fs4.write(this.fd, this._writingBuf, "utf8", this.release);
3846
+ }, BUSY_WRITE_TIMEOUT);
3467
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);
3859
+ return;
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);
3468
3869
  return;
3469
3870
  }
3470
3871
  }
3471
- stack.push(val);
3472
- if (Array.isArray(val)) {
3473
- for (i = 0; i < val.length; i++) {
3474
- decirc(val[i], i, stack, val);
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);
3475
3885
  }
3476
3886
  } else {
3477
- var keys = Object.keys(val);
3478
- for (i = 0; i < keys.length; i++) {
3479
- var key = keys[i];
3480
- decirc(val[key], key, stack, val);
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");
3481
3895
  }
3482
3896
  }
3483
- stack.pop();
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);
3484
4045
  }
3485
4046
  }
3486
- function compareFunction(a, b) {
3487
- if (a < b) {
3488
- return -1;
4047
+ function actualClose(sonic) {
4048
+ if (sonic.fd === -1) {
4049
+ sonic.once("ready", actualClose.bind(null, sonic));
4050
+ return;
3489
4051
  }
3490
- if (a > b) {
3491
- return 1;
4052
+ fs4.close(sonic.fd, (err) => {
4053
+ if (err) {
4054
+ sonic.emit("error", err);
4055
+ return;
4056
+ }
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);
4092
+ }
3492
4093
  }
3493
- return 0;
4094
+ wraps[event] = wrap;
4095
+ process.once(event, wrap);
3494
4096
  }
3495
- function deterministicStringify(obj, replacer, spacer) {
3496
- var tmp = deterministicDecirc(obj, "", [], void 0) || obj;
3497
- var res;
3498
- if (replacerStack.length === 0) {
3499
- res = JSON.stringify(tmp, replacer, spacer);
3500
- } else {
3501
- res = JSON.stringify(tmp, replaceGetterValues(replacer), spacer);
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");
4106
+ }
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);
3502
4119
  }
3503
- while (arr.length !== 0) {
3504
- var part = arr.pop();
3505
- if (part.length === 4) {
3506
- Object.defineProperty(part[0], part[1], part[3]);
4120
+ registry.unregister(obj);
4121
+ }
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;
4140
+ }
4141
+ let prior = current;
4142
+ const check = (backoff) => {
4143
+ if (Date.now() > max) {
4144
+ done(null, "timed-out");
3507
4145
  } else {
3508
- 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);
3509
4158
  }
3510
- }
3511
- return res;
4159
+ };
4160
+ check(1);
3512
4161
  }
3513
- function deterministicDecirc(val, k, stack, parent) {
3514
- var i;
3515
- if (typeof val === "object" && val !== null) {
3516
- for (i = 0; i < stack.length; i++) {
3517
- if (stack[i] === val) {
3518
- var propertyDescriptor = Object.getOwnPropertyDescriptor(parent, k);
3519
- if (propertyDescriptor.get !== void 0) {
3520
- if (propertyDescriptor.configurable) {
3521
- Object.defineProperty(parent, k, { value: "[Circular]" });
3522
- arr.push([parent, k, val, propertyDescriptor]);
3523
- } else {
3524
- replacerStack.push([val, k]);
3525
- }
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");
3526
4177
  } else {
3527
- parent[k] = "[Circular]";
3528
- arr.push([parent, k, val]);
4178
+ check(backoff >= MAX_TIMEOUT ? MAX_TIMEOUT : backoff * 2);
3529
4179
  }
3530
- 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);
3531
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
+ });
3532
4296
  }
3533
- if (typeof val.toJSON === "function") {
4297
+ } else if (leftover === 0) {
4298
+ if (writeIndex === 0 && stream[kImpl].buf.length === 0) {
3534
4299
  return;
3535
4300
  }
3536
- stack.push(val);
3537
- if (Array.isArray(val)) {
3538
- for (i = 0; i < val.length; i++) {
3539
- 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;
3540
4380
  }
3541
- } else {
3542
- var tmp = {};
3543
- var keys = Object.keys(val).sort(compareFunction);
3544
- for (i = 0; i < keys.length; i++) {
3545
- var key = keys[i];
3546
- deterministicDecirc(val[key], key, stack, val);
3547
- 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;
3548
4390
  }
3549
- if (parent !== void 0) {
3550
- arr.push([parent, k, val]);
3551
- parent[k] = tmp;
3552
- } else {
3553
- 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;
4420
+ }
4421
+ process.nextTick(cb);
4422
+ });
4423
+ }
4424
+ flushSync() {
4425
+ if (this[kImpl].destroyed) {
4426
+ throw new Error("the worker has exited");
4427
+ }
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
+ });
4485
+ }
4486
+ }
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
+ }
4532
+ };
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);
3554
4558
  }
4559
+ stream[kImpl].buf = stream[kImpl].buf.slice(leftover);
4560
+ write(stream, toWrite, cb);
4561
+ }
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);
3555
4633
  }
3556
- stack.pop();
3557
4634
  }
4635
+ function onExit2() {
4636
+ if (stream.closed) {
4637
+ return;
4638
+ }
4639
+ stream.flushSync();
4640
+ }
4641
+ return stream;
3558
4642
  }
3559
- function replaceGetterValues(replacer) {
3560
- replacer = replacer !== void 0 ? replacer : function(k, v) {
3561
- return v;
3562
- };
3563
- return function(key, val) {
3564
- if (replacerStack.length > 0) {
3565
- for (var i = 0; i < replacerStack.length; i++) {
3566
- var part = replacerStack[i];
3567
- if (part[1] === key && part[0] === val) {
3568
- val = "[Circular]";
3569
- replacerStack.splice(i, 1);
3570
- break;
3571
- }
3572
- }
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;
3573
4681
  }
3574
- return replacer.call(this, key, val);
3575
- };
4682
+ switch (origin) {
4683
+ case "pino/file":
4684
+ return join2(__dirname, "..", "file.js");
4685
+ default:
4686
+ return callerRequire.resolve(origin);
4687
+ }
4688
+ }
3576
4689
  }
4690
+ module2.exports = transport;
3577
4691
  }
3578
4692
  });
3579
4693
 
@@ -3582,9 +4696,9 @@ var require_tools2 = __commonJS({
3582
4696
  "../../node_modules/pino/lib/tools.js"(exports, module2) {
3583
4697
  "use strict";
3584
4698
  var format = require_quick_format_unescaped();
3585
- var { mapHttpRequest, mapHttpResponse } = require_pino_std_serializers();
3586
- var SonicBoom = require_sonic_boom();
3587
- 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();
3588
4702
  var {
3589
4703
  lsCacheSym,
3590
4704
  chindingsSym,
@@ -3595,14 +4709,18 @@ var require_tools2 = __commonJS({
3595
4709
  endSym,
3596
4710
  stringifiersSym,
3597
4711
  stringifySym,
4712
+ stringifySafeSym,
3598
4713
  wildcardFirstSym,
3599
4714
  needsMetadataGsym,
3600
4715
  redactFmtSym,
3601
4716
  streamSym,
3602
4717
  nestedKeySym,
3603
4718
  formattersSym,
3604
- messageKeySym
4719
+ messageKeySym,
4720
+ nestedKeyStrSym
3605
4721
  } = require_symbols2();
4722
+ var { isMainThread } = require("worker_threads");
4723
+ var transport = require_transport();
3606
4724
  function noop() {
3607
4725
  }
3608
4726
  function genLog(level, hook) {
@@ -3621,8 +4739,6 @@ var require_tools2 = __commonJS({
3621
4739
  o = mapHttpResponse(o);
3622
4740
  }
3623
4741
  }
3624
- if (this[nestedKeySym])
3625
- o = { [this[nestedKeySym]]: o };
3626
4742
  let formatParams;
3627
4743
  if (msg === null && n.length === 0) {
3628
4744
  formatParams = [null];
@@ -3662,6 +4778,7 @@ var require_tools2 = __commonJS({
3662
4778
  }
3663
4779
  function asJson(obj, msg, num, time) {
3664
4780
  const stringify2 = this[stringifySym];
4781
+ const stringifySafe = this[stringifySafeSym];
3665
4782
  const stringifiers = this[stringifiersSym];
3666
4783
  const end = this[endSym];
3667
4784
  const chindings = this[chindingsSym];
@@ -3675,10 +4792,8 @@ var require_tools2 = __commonJS({
3675
4792
  if (formatters.log) {
3676
4793
  obj = formatters.log(obj);
3677
4794
  }
3678
- if (msg !== void 0) {
3679
- obj[messageKey] = msg;
3680
- }
3681
4795
  const wildcardStringifier = stringifiers[wildcardFirstSym];
4796
+ let propStr = "";
3682
4797
  for (const key in obj) {
3683
4798
  value = obj[key];
3684
4799
  if ((notHasOwnProperty || obj.hasOwnProperty(key)) && value !== void 0) {
@@ -3700,19 +4815,49 @@ var require_tools2 = __commonJS({
3700
4815
  value = (stringifier || asString)(value);
3701
4816
  break;
3702
4817
  default:
3703
- value = (stringifier || stringify2)(value);
4818
+ value = (stringifier || stringify2)(value, stringifySafe);
3704
4819
  }
3705
4820
  if (value === void 0)
3706
4821
  continue;
3707
- data += ',"' + key + '":' + value;
4822
+ propStr += ',"' + key + '":' + value;
3708
4823
  }
3709
4824
  }
3710
- 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
+ }
3711
4855
  }
3712
4856
  function asChindings(instance, bindings) {
3713
4857
  let value;
3714
4858
  let data = instance[chindingsSym];
3715
4859
  const stringify2 = instance[stringifySym];
4860
+ const stringifySafe = instance[stringifySafeSym];
3716
4861
  const stringifiers = instance[stringifiersSym];
3717
4862
  const wildcardStringifier = stringifiers[wildcardFirstSym];
3718
4863
  const serializers = instance[serializersSym];
@@ -3723,7 +4868,7 @@ var require_tools2 = __commonJS({
3723
4868
  const valid = key !== "level" && key !== "serializers" && key !== "formatters" && key !== "customLevels" && bindings.hasOwnProperty(key) && value !== void 0;
3724
4869
  if (valid === true) {
3725
4870
  value = serializers[key] ? serializers[key](value) : value;
3726
- value = (stringifiers[key] || wildcardStringifier || stringify2)(value);
4871
+ value = (stringifiers[key] || wildcardStringifier || stringify2)(value, stringifySafe);
3727
4872
  if (value === void 0)
3728
4873
  continue;
3729
4874
  data += ',"' + key + '":' + value;
@@ -3737,7 +4882,7 @@ var require_tools2 = __commonJS({
3737
4882
  return prettifierMetaWrapper(prettifier(opts), dest, opts);
3738
4883
  }
3739
4884
  try {
3740
- const prettyFactory = require("pino-pretty");
4885
+ const prettyFactory = require("pino-pretty").prettyFactory;
3741
4886
  prettyFactory.asMetaWrapper = prettifierMetaWrapper;
3742
4887
  return prettifierMetaWrapper(prettyFactory(opts), dest, opts);
3743
4888
  } catch (e) {
@@ -3787,7 +4932,8 @@ var require_tools2 = __commonJS({
3787
4932
  const lastLogger = this.lastLogger;
3788
4933
  const chindings = this.chindings();
3789
4934
  let time = this.lastTime;
3790
- if (time.match(/^\d+/)) {
4935
+ if (typeof time === "number") {
4936
+ } else if (time.match(/^\d+/)) {
3791
4937
  time = parseInt(time);
3792
4938
  } else {
3793
4939
  time = time.slice(1, -1);
@@ -3834,6 +4980,9 @@ var require_tools2 = __commonJS({
3834
4980
  function buildSafeSonicBoom(opts) {
3835
4981
  const stream = new SonicBoom(opts);
3836
4982
  stream.on("error", filterBrokenPipe);
4983
+ if (!opts.sync && isMainThread) {
4984
+ setupOnExit(stream);
4985
+ }
3837
4986
  return stream;
3838
4987
  function filterBrokenPipe(err) {
3839
4988
  if (err.code === "EPIPE") {
@@ -3847,21 +4996,46 @@ var require_tools2 = __commonJS({
3847
4996
  stream.emit("error", err);
3848
4997
  }
3849
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
+ }
3850
5021
  function createArgsNormalizer(defaultOptions) {
3851
- return function normalizeArgs(instance, opts = {}, stream) {
5022
+ return function normalizeArgs(instance, caller, opts = {}, stream) {
3852
5023
  if (typeof opts === "string") {
3853
5024
  stream = buildSafeSonicBoom({ dest: opts, sync: true });
3854
5025
  opts = {};
3855
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
+ }
3856
5030
  stream = buildSafeSonicBoom({ dest: stream, sync: true });
3857
5031
  } else if (opts instanceof SonicBoom || opts.writable || opts._writableState) {
3858
5032
  stream = opts;
3859
- opts = null;
5033
+ opts = {};
5034
+ } else if (opts.transport) {
5035
+ stream = transport({ caller, ...opts.transport });
3860
5036
  }
3861
5037
  opts = Object.assign({}, defaultOptions, opts);
3862
- if ("extreme" in opts) {
3863
- throw Error("The extreme option has been removed, use pino.destination({ sync: false }) instead");
3864
- }
5038
+ opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers);
3865
5039
  if ("onTerminated" in opts) {
3866
5040
  throw Error("The onTerminated option has been removed, use pino.final instead");
3867
5041
  }
@@ -3878,6 +5052,7 @@ var require_tools2 = __commonJS({
3878
5052
  stream = buildSafeSonicBoom({ fd: stream.fd, sync: true });
3879
5053
  }
3880
5054
  if (prettyPrint) {
5055
+ warning.emit("PINODEP008");
3881
5056
  const prettyOpts = Object.assign({ messageKey }, prettyPrint);
3882
5057
  stream = getPrettyStream(prettyOpts, prettifier, stream, instance);
3883
5058
  }
@@ -3885,6 +5060,9 @@ var require_tools2 = __commonJS({
3885
5060
  };
3886
5061
  }
3887
5062
  function final(logger, handler2) {
5063
+ const major = Number(process.versions.node.split(".")[0]);
5064
+ if (major >= 14)
5065
+ warning.emit("PINODEP009");
3888
5066
  if (typeof logger === "undefined" || typeof logger.child !== "function") {
3889
5067
  throw Error("expected a pino logger instance");
3890
5068
  }
@@ -3908,6 +5086,10 @@ var require_tools2 = __commonJS({
3908
5086
  }
3909
5087
  });
3910
5088
  if (!hasHandler) {
5089
+ try {
5090
+ stream.flushSync();
5091
+ } catch {
5092
+ }
3911
5093
  return finalLogger;
3912
5094
  }
3913
5095
  return (err = null, ...args) => {
@@ -3918,11 +5100,16 @@ var require_tools2 = __commonJS({
3918
5100
  return handler2(err, finalLogger, ...args);
3919
5101
  };
3920
5102
  }
3921
- function stringify(obj) {
5103
+ function stringify(obj, stringifySafeFn) {
3922
5104
  try {
3923
5105
  return JSON.stringify(obj);
3924
5106
  } catch (_) {
3925
- 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
+ }
3926
5113
  }
3927
5114
  }
3928
5115
  function buildFormatters(level, bindings, log) {
@@ -3941,6 +5128,13 @@ var require_tools2 = __commonJS({
3941
5128
  dest.lastLogger = that.lastLogger;
3942
5129
  }
3943
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
+ }
3944
5138
  module2.exports = {
3945
5139
  noop,
3946
5140
  buildSafeSonicBoom,
@@ -3951,7 +5145,8 @@ var require_tools2 = __commonJS({
3951
5145
  createArgsNormalizer,
3952
5146
  final,
3953
5147
  stringify,
3954
- buildFormatters
5148
+ buildFormatters,
5149
+ normalizeDestFileDescriptor
3955
5150
  };
3956
5151
  }
3957
5152
  });
@@ -3960,7 +5155,6 @@ var require_tools2 = __commonJS({
3960
5155
  var require_levels2 = __commonJS({
3961
5156
  "../../node_modules/pino/lib/levels.js"(exports, module2) {
3962
5157
  "use strict";
3963
- var flatstr = require_flatstr();
3964
5158
  var {
3965
5159
  lsCacheSym,
3966
5160
  levelValSym,
@@ -4003,7 +5197,7 @@ var require_levels2 = __commonJS({
4003
5197
  return o;
4004
5198
  }, {});
4005
5199
  var initialLsCache = Object.keys(nums).reduce((o, k) => {
4006
- o[k] = flatstr('{"level":' + Number(k));
5200
+ o[k] = '{"level":' + Number(k);
4007
5201
  return o;
4008
5202
  }, {});
4009
5203
  function genLsCache(instance) {
@@ -4105,6 +5299,7 @@ var require_levels2 = __commonJS({
4105
5299
  setLevel,
4106
5300
  isLevelEnabled,
4107
5301
  mappings,
5302
+ levels,
4108
5303
  assertNoLevelCollisions,
4109
5304
  assertDefaultLevelFound
4110
5305
  };
@@ -4116,12 +5311,16 @@ var require_package2 = __commonJS({
4116
5311
  "../../node_modules/pino/package.json"(exports, module2) {
4117
5312
  module2.exports = {
4118
5313
  name: "pino",
4119
- version: "6.11.3",
5314
+ version: "7.5.0",
4120
5315
  description: "super fast, all natural json logger",
4121
5316
  main: "pino.js",
5317
+ type: "commonjs",
5318
+ types: "pino.d.ts",
4122
5319
  browser: "./browser.js",
4123
5320
  files: [
4124
5321
  "pino.js",
5322
+ "file.js",
5323
+ "pino.d.ts",
4125
5324
  "bin.js",
4126
5325
  "browser.js",
4127
5326
  "pretty.js",
@@ -4135,8 +5334,11 @@ var require_package2 = __commonJS({
4135
5334
  docs: "docsify serve",
4136
5335
  "browser-test": "airtap --local 8080 test/browser*test.js",
4137
5336
  lint: "eslint .",
4138
- test: "npm run lint && tap --100 test/*test.js test/*/*test.js",
4139
- "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",
4140
5342
  "cov-ui": "tap --coverage-report=html test/*test.js test/*/*test.js",
4141
5343
  bench: "node benchmarks/utils/runbench all",
4142
5344
  "bench-basic": "node benchmarks/utils/runbench basic",
@@ -4176,42 +5378,55 @@ var require_package2 = __commonJS({
4176
5378
  },
4177
5379
  homepage: "http://getpino.io",
4178
5380
  devDependencies: {
5381
+ "@types/node": "^16.11.0",
4179
5382
  airtap: "4.0.3",
4180
5383
  benchmark: "^2.1.4",
4181
5384
  bole: "^4.0.0",
4182
5385
  bunyan: "^1.8.14",
4183
5386
  "docsify-cli": "^4.4.1",
4184
5387
  eslint: "^7.17.0",
4185
- "eslint-config-standard": "^16.0.2",
5388
+ "eslint-config-standard": "^16.0.3",
4186
5389
  "eslint-plugin-import": "^2.22.1",
4187
5390
  "eslint-plugin-node": "^11.1.0",
4188
- "eslint-plugin-promise": "^4.2.1",
5391
+ "eslint-plugin-promise": "^5.1.0",
4189
5392
  execa: "^5.0.0",
4190
5393
  fastbench: "^1.0.1",
4191
5394
  "flush-write-stream": "^2.0.0",
4192
5395
  "import-fresh": "^3.2.1",
5396
+ jest: "^27.3.1",
4193
5397
  log: "^6.0.0",
4194
5398
  loglevel: "^1.6.7",
4195
- "pino-pretty": "^4.1.0",
5399
+ "pino-pretty": "^v7.1.0",
4196
5400
  "pre-commit": "^1.2.2",
4197
5401
  proxyquire: "^2.1.3",
4198
5402
  pump: "^3.0.0",
4199
5403
  semver: "^7.0.0",
4200
- split2: "^3.1.1",
5404
+ split2: "^4.0.0",
4201
5405
  steed: "^1.1.3",
4202
5406
  "strip-ansi": "^6.0.0",
4203
5407
  tap: "^15.0.1",
4204
5408
  tape: "^5.0.0",
4205
5409
  through2: "^4.0.0",
5410
+ "ts-node": "^10.3.0",
5411
+ tsd: "^0.19.0",
5412
+ typescript: "^4.4.4",
4206
5413
  winston: "^3.3.3"
4207
5414
  },
4208
5415
  dependencies: {
4209
5416
  "fast-redact": "^3.0.0",
4210
- "fast-safe-stringify": "^2.0.7",
4211
- flatstr: "^1.0.12",
4212
- "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",
4213
5422
  "quick-format-unescaped": "^4.0.3",
4214
- "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"
4215
5430
  }
4216
5431
  };
4217
5432
  }
@@ -4231,8 +5446,6 @@ var require_proto2 = __commonJS({
4231
5446
  "../../node_modules/pino/lib/proto.js"(exports, module2) {
4232
5447
  "use strict";
4233
5448
  var { EventEmitter } = require("events");
4234
- var SonicBoom = require_sonic_boom();
4235
- var flatstr = require_flatstr();
4236
5449
  var {
4237
5450
  lsCacheSym,
4238
5451
  levelValSym,
@@ -4249,7 +5462,11 @@ var require_proto2 = __commonJS({
4249
5462
  serializersSym,
4250
5463
  formattersSym,
4251
5464
  useOnlyCustomLevelsSym,
4252
- needsMetadataGsym
5465
+ needsMetadataGsym,
5466
+ redactFmtSym,
5467
+ stringifySym,
5468
+ formatOptsSym,
5469
+ stringifiersSym
4253
5470
  } = require_symbols2();
4254
5471
  var {
4255
5472
  getLevel,
@@ -4263,11 +5480,13 @@ var require_proto2 = __commonJS({
4263
5480
  var {
4264
5481
  asChindings,
4265
5482
  asJson,
4266
- buildFormatters
5483
+ buildFormatters,
5484
+ stringify
4267
5485
  } = require_tools2();
4268
5486
  var {
4269
5487
  version: version2
4270
5488
  } = require_meta2();
5489
+ var redaction = require_redaction2();
4271
5490
  var constructor = class Pino {
4272
5491
  };
4273
5492
  var prototype = {
@@ -4301,100 +5520,879 @@ var require_proto2 = __commonJS({
4301
5520
  return Object.create(prototype);
4302
5521
  };
4303
5522
  var resetChildingsFormatter = (bindings2) => bindings2;
4304
- function child(bindings2) {
5523
+ function child(bindings2, options) {
4305
5524
  if (!bindings2) {
4306
5525
  throw Error("missing bindings for child Pino");
4307
5526
  }
5527
+ options = options || {};
4308
5528
  const serializers = this[serializersSym];
4309
5529
  const formatters = this[formattersSym];
4310
5530
  const instance = Object.create(this);
4311
- if (bindings2.hasOwnProperty("serializers") === true) {
5531
+ if (options.hasOwnProperty("serializers") === true) {
4312
5532
  instance[serializersSym] = Object.create(null);
4313
5533
  for (const k in serializers) {
4314
5534
  instance[serializersSym][k] = serializers[k];
4315
5535
  }
4316
- const parentSymbols = Object.getOwnPropertySymbols(serializers);
4317
- for (var i = 0; i < parentSymbols.length; i++) {
4318
- const ks = parentSymbols[i];
4319
- instance[serializersSym][ks] = serializers[ks];
5536
+ const parentSymbols = Object.getOwnPropertySymbols(serializers);
5537
+ for (var i = 0; i < parentSymbols.length; i++) {
5538
+ const ks = parentSymbols[i];
5539
+ instance[serializersSym][ks] = serializers[ks];
5540
+ }
5541
+ for (const bk in options.serializers) {
5542
+ instance[serializersSym][bk] = options.serializers[bk];
5543
+ }
5544
+ const bindingsSymbols = Object.getOwnPropertySymbols(options.serializers);
5545
+ for (var bi = 0; bi < bindingsSymbols.length; bi++) {
5546
+ const bks = bindingsSymbols[bi];
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;
4320
5972
  }
4321
- for (const bk in bindings2.serializers) {
4322
- instance[serializersSym][bk] = bindings2.serializers[bk];
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);
4323
5977
  }
4324
- const bindingsSymbols = Object.getOwnPropertySymbols(bindings2.serializers);
4325
- for (var bi = 0; bi < bindingsSymbols.length; bi++) {
4326
- const bks = bindingsSymbols[bi];
4327
- instance[serializersSym][bks] = bindings2.serializers[bks];
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;
4328
6059
  }
4329
- } else
4330
- instance[serializersSym] = serializers;
4331
- if (bindings2.hasOwnProperty("formatters")) {
4332
- const { level, bindings: chindings, log } = bindings2.formatters;
4333
- instance[formattersSym] = buildFormatters(level || formatters.level, chindings || resetChildingsFormatter, log || formatters.log);
4334
- } else {
4335
- instance[formattersSym] = buildFormatters(formatters.level, resetChildingsFormatter, formatters.log);
4336
6060
  }
4337
- if (bindings2.hasOwnProperty("customLevels") === true) {
4338
- assertNoLevelCollisions(this.levels, bindings2.customLevels);
4339
- instance.levels = mappings(bindings2.customLevels, instance[useOnlyCustomLevelsSym]);
4340
- genLsCache(instance);
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;
6164
+ }
4341
6165
  }
4342
- instance[chindingsSym] = asChindings(instance, bindings2);
4343
- const childLevel = bindings2.level || this.level;
4344
- instance[setLevelSym](childLevel);
4345
- return instance;
4346
- }
4347
- function bindings() {
4348
- const chindings = this[chindingsSym];
4349
- const chindingsJson = `{${chindings.substr(1)}}`;
4350
- const bindingsFromJson = JSON.parse(chindingsJson);
4351
- delete bindingsFromJson.pid;
4352
- delete bindingsFromJson.hostname;
4353
- return bindingsFromJson;
4354
- }
4355
- function setBindings(newBindings) {
4356
- const chindings = asChindings(this, newBindings);
4357
- this[chindingsSym] = chindings;
4358
- delete this[parsedChindingsSym];
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, []);
6275
+ }
6276
+ return stringify2;
4359
6277
  }
4360
- function write(_obj, msg, num) {
4361
- const t = this[timeSym]();
4362
- const mixin = this[mixinSym];
4363
- const objError = _obj instanceof Error;
4364
- let obj;
4365
- if (_obj === void 0 || _obj === null) {
4366
- 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);
4367
6309
  } else {
4368
- obj = Object.assign(mixin ? mixin(_obj) : {}, _obj);
4369
- if (!msg && objError) {
4370
- 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
+ }
4371
6337
  }
4372
- if (objError) {
4373
- obj.stack = _obj.stack;
4374
- if (!obj.type) {
4375
- obj.type = "Error";
6338
+ }
6339
+ function flushSync() {
6340
+ for (const { stream } of this.streams) {
6341
+ if (typeof stream.flushSync === "function") {
6342
+ stream.flushSync();
4376
6343
  }
4377
6344
  }
4378
6345
  }
4379
- const s = this[asJsonSym](obj, msg, num, t);
4380
- const stream = this[streamSym];
4381
- if (stream[needsMetadataGsym] === true) {
4382
- stream.lastLevel = num;
4383
- stream.lastObj = obj;
4384
- stream.lastMsg = msg;
4385
- stream.lastTime = t.slice(this[timeSliceIndexSym]);
4386
- 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
+ };
4387
6390
  }
4388
- if (stream instanceof SonicBoom)
4389
- stream.write(s);
4390
- else
4391
- stream.write(flatstr(s));
4392
6391
  }
4393
- function flush() {
4394
- const stream = this[streamSym];
4395
- if ("flush" in stream)
4396
- stream.flush();
6392
+ function compareByLevel(a, b) {
6393
+ return a.level - b.level;
4397
6394
  }
6395
+ module2.exports = multistream;
4398
6396
  }
4399
6397
  });
4400
6398
 
@@ -4403,19 +6401,22 @@ var require_pino2 = __commonJS({
4403
6401
  "../../node_modules/pino/pino.js"(exports, module2) {
4404
6402
  "use strict";
4405
6403
  var os = require("os");
4406
- var stdSerializers = require_pino_std_serializers();
6404
+ var stdSerializers = require_pino_std_serializers2();
6405
+ var caller = require_get_caller_file();
4407
6406
  var redaction = require_redaction2();
4408
6407
  var time = require_time2();
4409
6408
  var proto = require_proto2();
4410
6409
  var symbols = require_symbols2();
6410
+ var { configure: configure2 } = require_safe_stable_stringify();
4411
6411
  var { assertDefaultLevelFound, mappings, genLsCache } = require_levels2();
4412
6412
  var {
4413
6413
  createArgsNormalizer,
4414
6414
  asChindings,
4415
6415
  final,
4416
- stringify,
4417
6416
  buildSafeSonicBoom,
4418
6417
  buildFormatters,
6418
+ stringify,
6419
+ normalizeDestFileDescriptor,
4419
6420
  noop
4420
6421
  } = require_tools2();
4421
6422
  var { version: version2 } = require_meta2();
@@ -4427,6 +6428,7 @@ var require_pino2 = __commonJS({
4427
6428
  timeSliceIndexSym,
4428
6429
  streamSym,
4429
6430
  stringifySym,
6431
+ stringifySafeSym,
4430
6432
  stringifiersSym,
4431
6433
  setLevelSym,
4432
6434
  endSym,
@@ -4436,7 +6438,8 @@ var require_pino2 = __commonJS({
4436
6438
  mixinSym,
4437
6439
  useOnlyCustomLevelsSym,
4438
6440
  formattersSym,
4439
- hooksSym
6441
+ hooksSym,
6442
+ nestedKeyStrSym
4440
6443
  } = symbols;
4441
6444
  var { epochTime, nullTime } = time;
4442
6445
  var { pid } = process;
@@ -4467,14 +6470,15 @@ var require_pino2 = __commonJS({
4467
6470
  name: void 0,
4468
6471
  redact: null,
4469
6472
  customLevels: null,
4470
- levelKey: void 0,
4471
- useOnlyCustomLevels: false
6473
+ useOnlyCustomLevels: false,
6474
+ depthLimit: 5,
6475
+ edgeLimit: 100
4472
6476
  };
4473
6477
  var normalize = createArgsNormalizer(defaultOptions);
4474
6478
  var serializers = Object.assign(Object.create(null), stdSerializers);
4475
6479
  function pino3(...args) {
4476
6480
  const instance = {};
4477
- const { opts, stream } = normalize(instance, ...args);
6481
+ const { opts, stream } = normalize(instance, caller(), ...args);
4478
6482
  const {
4479
6483
  redact,
4480
6484
  crlf,
@@ -4486,30 +6490,18 @@ var require_pino2 = __commonJS({
4486
6490
  name,
4487
6491
  level,
4488
6492
  customLevels,
4489
- useLevelLabels,
4490
- changeLevelName,
4491
- levelKey,
4492
6493
  mixin,
4493
6494
  useOnlyCustomLevels,
4494
6495
  formatters,
4495
- hooks
6496
+ hooks,
6497
+ depthLimit,
6498
+ edgeLimit
4496
6499
  } = opts;
6500
+ const stringifySafe = configure2({
6501
+ maximumDepth: depthLimit,
6502
+ maximumBreadth: edgeLimit
6503
+ });
4497
6504
  const allFormatters = buildFormatters(formatters.level, formatters.bindings, formatters.log);
4498
- if (useLevelLabels && !(changeLevelName || levelKey)) {
4499
- process.emitWarning("useLevelLabels is deprecated, use the formatters.level option instead", "Warning", "PINODEP001");
4500
- allFormatters.level = labelsFormatter;
4501
- } else if ((changeLevelName || levelKey) && !useLevelLabels) {
4502
- process.emitWarning("changeLevelName and levelKey are deprecated, use the formatters.level option instead", "Warning", "PINODEP002");
4503
- allFormatters.level = levelNameFormatter(changeLevelName || levelKey);
4504
- } else if ((changeLevelName || levelKey) && useLevelLabels) {
4505
- process.emitWarning("useLevelLabels is deprecated, use the formatters.level option instead", "Warning", "PINODEP001");
4506
- process.emitWarning("changeLevelName and levelKey are deprecated, use the formatters.level option instead", "Warning", "PINODEP002");
4507
- allFormatters.level = levelNameLabelFormatter(changeLevelName || levelKey);
4508
- }
4509
- if (serializers2[Symbol.for("pino.*")]) {
4510
- process.emitWarning("The pino.* serializer is deprecated, use the formatters.log options instead", "Warning", "PINODEP003");
4511
- allFormatters.log = serializers2[Symbol.for("pino.*")];
4512
- }
4513
6505
  if (!allFormatters.bindings) {
4514
6506
  allFormatters.bindings = defaultOptions.formatters.bindings;
4515
6507
  }
@@ -4517,13 +6509,17 @@ var require_pino2 = __commonJS({
4517
6509
  allFormatters.level = defaultOptions.formatters.level;
4518
6510
  }
4519
6511
  const stringifiers = redact ? redaction(redact, stringify) : {};
4520
- 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 };
4521
6516
  const end = "}" + (crlf ? "\r\n" : "\n");
4522
6517
  const coreChindings = asChindings.bind(null, {
4523
6518
  [chindingsSym]: "",
4524
6519
  [serializersSym]: serializers2,
4525
6520
  [stringifiersSym]: stringifiers,
4526
6521
  [stringifySym]: stringify,
6522
+ [stringifySafeSym]: stringifySafe,
4527
6523
  [formattersSym]: allFormatters
4528
6524
  });
4529
6525
  let chindings = "";
@@ -4549,11 +6545,13 @@ var require_pino2 = __commonJS({
4549
6545
  [timeSym]: time2,
4550
6546
  [timeSliceIndexSym]: timeSliceIndex,
4551
6547
  [stringifySym]: stringify,
6548
+ [stringifySafeSym]: stringifySafe,
4552
6549
  [stringifiersSym]: stringifiers,
4553
6550
  [endSym]: end,
4554
6551
  [formatOptsSym]: formatOpts,
4555
6552
  [messageKeySym]: messageKey,
4556
6553
  [nestedKeySym]: nestedKey,
6554
+ [nestedKeyStrSym]: nestedKey ? `,${JSON.stringify(nestedKey)}:{` : "",
4557
6555
  [serializersSym]: serializers2,
4558
6556
  [mixinSym]: mixin,
4559
6557
  [chindingsSym]: chindings,
@@ -4566,32 +6564,17 @@ var require_pino2 = __commonJS({
4566
6564
  instance[setLevelSym](level);
4567
6565
  return instance;
4568
6566
  }
4569
- function labelsFormatter(label, number) {
4570
- return { level: label };
4571
- }
4572
- function levelNameFormatter(name) {
4573
- return function(label, number) {
4574
- return { [name]: number };
4575
- };
4576
- }
4577
- function levelNameLabelFormatter(name) {
4578
- return function(label, number) {
4579
- return { [name]: label };
4580
- };
4581
- }
4582
6567
  module2.exports = pino3;
4583
- module2.exports.extreme = (dest = process.stdout.fd) => {
4584
- process.emitWarning("The pino.extreme() option is deprecated and will be removed in v7. Use pino.destination({ sync: false }) instead.", { code: "extreme_deprecation" });
4585
- return buildSafeSonicBoom({ dest, minLength: 4096, sync: false });
4586
- };
4587
6568
  module2.exports.destination = (dest = process.stdout.fd) => {
4588
6569
  if (typeof dest === "object") {
4589
- dest.dest = dest.dest || process.stdout.fd;
6570
+ dest.dest = normalizeDestFileDescriptor(dest.dest || process.stdout.fd);
4590
6571
  return buildSafeSonicBoom(dest);
4591
6572
  } else {
4592
- return buildSafeSonicBoom({ dest, minLength: 0, sync: true });
6573
+ return buildSafeSonicBoom({ dest: normalizeDestFileDescriptor(dest), minLength: 0, sync: true });
4593
6574
  }
4594
6575
  };
6576
+ module2.exports.transport = require_transport();
6577
+ module2.exports.multistream = require_multistream();
4595
6578
  module2.exports.final = final;
4596
6579
  module2.exports.levels = mappings();
4597
6580
  module2.exports.stdSerializers = serializers;
@@ -22291,8 +24274,8 @@ var LambdaHttpResponse = class {
22291
24274
  };
22292
24275
 
22293
24276
  // ../../node_modules/@linzjs/lambda/build/src/function.js
22294
- var version = "v6.16.0";
22295
- var hash = "75bda15568c94ebe89af4c179c0e80226bfabd3f";
24277
+ var version = "v6.19.0";
24278
+ var hash = "87d778480368585d0f4a5a7546a2858882d8ab39";
22296
24279
  var versionInfo = { version, hash };
22297
24280
  async function runFunction(req, fn) {
22298
24281
  try {
@@ -25205,9 +27188,9 @@ fsa2.readJson = async function readJson(filePath) {
25205
27188
  fsa2.writeJson = async function writeJson(filePath, obj) {
25206
27189
  const json = Buffer.from(JSON.stringify(obj, void 0, 2));
25207
27190
  if (filePath.endsWith(".gz")) {
25208
- const gzip = (0, import_zlib.createGzip)();
25209
- gzip.end(json);
25210
- return this.write(filePath, gzip);
27191
+ const gzip2 = (0, import_zlib.createGzip)();
27192
+ gzip2.end(json);
27193
+ return this.write(filePath, gzip2);
25211
27194
  } else {
25212
27195
  return this.write(filePath, json);
25213
27196
  }
@@ -25255,7 +27238,7 @@ async function Ping() {
25255
27238
  async function Version() {
25256
27239
  const response = new LambdaHttpResponse(200, "ok");
25257
27240
  response.header(HttpHeader.CacheControl, "no-store");
25258
- response.json({ version: "v6.16.0", hash: "75bda15568c94ebe89af4c179c0e80226bfabd3f" });
27241
+ response.json({ version: "v6.19.0", hash: "87d778480368585d0f4a5a7546a2858882d8ab39" });
25259
27242
  return response;
25260
27243
  }
25261
27244
 
@@ -26425,6 +28408,7 @@ var import_sharp = __toModule(require("sharp"));
26425
28408
  function notEmpty(value) {
26426
28409
  return value != null;
26427
28410
  }
28411
+ var EmptyImage = new Map();
26428
28412
  var TileMakerSharp = class {
26429
28413
  constructor(tileSize) {
26430
28414
  this.tileSize = tileSize;
@@ -26440,8 +28424,18 @@ var TileMakerSharp = class {
26440
28424
  }
26441
28425
  return false;
26442
28426
  }
26443
- async getImageBuffer(layers, format, background) {
26444
- 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) {
26445
28439
  switch (format) {
26446
28440
  case ImageFormat.JPEG:
26447
28441
  return pipeline2.jpeg().toBuffer();
@@ -26455,14 +28449,47 @@ var TileMakerSharp = class {
26455
28449
  throw new Error(`Invalid image format "${format}"`);
26456
28450
  }
26457
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
+ }
26458
28476
  async compose(ctx) {
26459
28477
  const metrics = new Metrics();
26460
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
+ }
26461
28489
  const todo = [];
26462
28490
  for (const comp of ctx.layers) {
26463
- if (this.isTooLarge(comp)) {
28491
+ if (this.isTooLarge(comp))
26464
28492
  continue;
26465
- }
26466
28493
  todo.push(this.composeTile(comp, ctx.resizeKernel));
26467
28494
  }
26468
28495
  const overlays = await Promise.all(todo).then((items) => items.filter(notEmpty));
@@ -27040,16 +29067,16 @@ var TileRoute = {
27040
29067
  const sources = {};
27041
29068
  for (const [key, value] of Object.entries(style.sources)) {
27042
29069
  if (value.type === "vector") {
27043
- if (value.url.includes(host)) {
27044
- const url2 = new import_url4.URL(value.url);
29070
+ if (value.url.startsWith("/")) {
29071
+ const url2 = new import_url4.URL(fsa.join(host, value.url));
27045
29072
  url2.searchParams.set("api", apiKey);
27046
29073
  value.url = url2.toString().replace(/%7B/g, "{").replace(/%7D/g, "}");
27047
29074
  }
27048
29075
  } else if (value.type === "raster" && Array.isArray(value.tiles)) {
27049
29076
  for (let i = 0; i < value.tiles.length; i++) {
27050
29077
  const tile = value.tiles[i];
27051
- if (tile.includes(host)) {
27052
- const url2 = new import_url4.URL(tile);
29078
+ if (tile.startsWith("/")) {
29079
+ const url2 = new import_url4.URL(fsa.join(host, tile));
27053
29080
  url2.searchParams.set("api", apiKey);
27054
29081
  value.tiles[i] = url2.toString().replace(/%7B/g, "{").replace(/%7D/g, "}");
27055
29082
  }
@@ -27074,7 +29101,7 @@ var TileRoute = {
27074
29101
  return NotModified;
27075
29102
  const response = new LambdaHttpResponse(200, "ok");
27076
29103
  response.header(HttpHeader.ETag, cacheKey);
27077
- response.header(HttpHeader.CacheControl, "max-age=120");
29104
+ response.header(HttpHeader.CacheControl, "no-store");
27078
29105
  response.buffer(data, "application/json");
27079
29106
  req.set("bytes", data.byteLength);
27080
29107
  return response;
@@ -27085,8 +29112,6 @@ async function Tiles(req) {
27085
29112
  if (rest.length < 1)
27086
29113
  return NotFound2;
27087
29114
  const apiKey = Router.apiKey(req);
27088
- const apiKeyHash = (0, import_crypto3.createHash)("sha256").update(apiKey ?? "").digest("base64");
27089
- req.set("api", apiKeyHash);
27090
29115
  if (!isValidApiKey(apiKey))
27091
29116
  return new LambdaHttpResponse(400, "Invalid API Key");
27092
29117
  const fileName = rest[rest.length - 1].toLowerCase();
@@ -27629,12 +29654,54 @@ async function Health(req) {
27629
29654
  return OkResponse2;
27630
29655
  }
27631
29656
 
29657
+ // src/index.ts
29658
+ var import_crypto5 = __toModule(require("crypto"));
29659
+
29660
+ // src/routes/imagery.ts
29661
+ var import_crypto4 = __toModule(require("crypto"));
29662
+ var import_util2 = __toModule(require("util"));
29663
+ var import_zlib2 = __toModule(require("zlib"));
29664
+ var gzipP = (0, import_util2.promisify)(import_zlib2.gzip);
29665
+ function isAllowedFile(f) {
29666
+ if (f.endsWith(".geojson"))
29667
+ return true;
29668
+ if (f.endsWith(".json"))
29669
+ return true;
29670
+ return false;
29671
+ }
29672
+ async function Imagery(req) {
29673
+ const { rest } = Router.action(req);
29674
+ const [imageryId, requestType] = rest;
29675
+ if (!isAllowedFile(requestType))
29676
+ return new LambdaHttpResponse(404, "Not found");
29677
+ const imagery = await Config.Imagery.get(imageryId);
29678
+ if (imagery == null)
29679
+ return new LambdaHttpResponse(404, "Not found");
29680
+ const targetPath = fsa2.join(imagery.uri, requestType);
29681
+ try {
29682
+ const buf = await fsa2.read(targetPath);
29683
+ const cacheKey = (0, import_crypto4.createHash)("sha256").update(buf).digest("base64");
29684
+ if (TileEtag.isNotModified(req, cacheKey))
29685
+ return NotModified;
29686
+ const response = new LambdaHttpResponse(200, "ok");
29687
+ response.header(HttpHeader.ETag, cacheKey);
29688
+ response.header(HttpHeader.ContentEncoding, "gzip");
29689
+ response.buffer(await gzipP(buf), "application/json");
29690
+ req.set("bytes", buf.byteLength);
29691
+ return response;
29692
+ } catch (e) {
29693
+ req.log.warn({ targetPath }, "ImageryMetadata:Failed");
29694
+ return new LambdaHttpResponse(404, "Not found");
29695
+ }
29696
+ }
29697
+
27632
29698
  // src/index.ts
27633
29699
  var app = new Router();
27634
29700
  app.get("ping", Ping);
27635
29701
  app.get("health", Health);
27636
29702
  app.get("version", Version);
27637
29703
  app.get("tiles", Tiles);
29704
+ app.get("imagery", Imagery);
27638
29705
  var slowTimer = null;
27639
29706
  async function handleRequest(req) {
27640
29707
  if (slowTimer)
@@ -27643,6 +29710,11 @@ async function handleRequest(req) {
27643
29710
  slowTimer.unref();
27644
29711
  req.set("name", "LambdaTiler");
27645
29712
  try {
29713
+ const apiKey = Router.apiKey(req);
29714
+ if (apiKey != null) {
29715
+ const apiKeyHash = (0, import_crypto5.createHash)("sha256").update(apiKey).digest("base64");
29716
+ req.set("api", apiKeyHash);
29717
+ }
27646
29718
  return await app.handle(req);
27647
29719
  } finally {
27648
29720
  if (slowTimer)