@nxtedition/lib 24.1.1 → 24.1.2

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.
Files changed (2) hide show
  1. package/http.js +49 -43
  2. package/package.json +1 -1
package/http.js CHANGED
@@ -391,15 +391,18 @@ export class IncomingMessage extends http.IncomingMessage {
391
391
  export class ServerResponse extends http.ServerResponse {
392
392
  #created = 0
393
393
  #bytesWritten = 0
394
- #timing = {
395
- connect: -1,
396
- headers: -1,
397
- data: -1,
398
- end: -1,
399
- }
394
+ #connect = -1
395
+ #headers = -1
396
+ #data = -1
397
+ #end = -1
400
398
 
401
399
  get timing() {
402
- return this.#timing
400
+ return {
401
+ connect: this.#connect,
402
+ headers: this.#headers,
403
+ data: this.#data,
404
+ end: this.#end,
405
+ }
403
406
  }
404
407
 
405
408
  get bytesWritten() {
@@ -414,8 +417,8 @@ export class ServerResponse extends http.ServerResponse {
414
417
 
415
418
  assignSocket(socket) {
416
419
  if (!this.destroyed) {
417
- if (this.#timing.connect === -1) {
418
- this.#timing.connect = performance.now() - this.#created
420
+ if (this.#connect === -1) {
421
+ this.#connect = performance.now() - this.#created
419
422
  }
420
423
  }
421
424
  return super.assignSocket(socket)
@@ -423,8 +426,8 @@ export class ServerResponse extends http.ServerResponse {
423
426
 
424
427
  flushHeaders() {
425
428
  if (!this.destroyed) {
426
- if (this.#timing.headers === -1) {
427
- this.#timing.headers = performance.now() - this.#created
429
+ if (this.#headers === -1) {
430
+ this.#headers = performance.now() - this.#created
428
431
  }
429
432
  }
430
433
  return super.flushHeaders()
@@ -432,12 +435,12 @@ export class ServerResponse extends http.ServerResponse {
432
435
 
433
436
  write(chunk, encoding, callback) {
434
437
  if (!this.destroyed) {
435
- if (this.#timing.data === -1) {
436
- this.#timing.data = performance.now() - this.#created
438
+ if (this.#data === -1) {
439
+ this.#data = performance.now() - this.#created
437
440
  }
438
441
 
439
- if (this.#timing.headers === -1) {
440
- this.#timing.headers = this.#timing.data
442
+ if (this.#headers === -1) {
443
+ this.#headers = this.#data
441
444
  }
442
445
  }
443
446
 
@@ -454,14 +457,14 @@ export class ServerResponse extends http.ServerResponse {
454
457
 
455
458
  end(chunk, encoding, callback) {
456
459
  if (!this.destroyed) {
457
- this.#timing.end = performance.now() - this.#created
460
+ this.#end = performance.now() - this.#created
458
461
 
459
- if (this.#timing.data === -1) {
460
- this.#timing.data = this.#timing.end
462
+ if (this.#data === -1) {
463
+ this.#data = this.#end
461
464
  }
462
465
 
463
- if (this.#timing.headers === -1) {
464
- this.#timing.headers = this.#timing.end
466
+ if (this.#headers === -1) {
467
+ this.#headers = this.#end
465
468
  }
466
469
  }
467
470
 
@@ -478,8 +481,8 @@ export class ServerResponse extends http.ServerResponse {
478
481
 
479
482
  destroy(err) {
480
483
  if (!this.destroyed) {
481
- if (this.#timing.end === -1) {
482
- this.#timing.end = performance.now() - this.#created
484
+ if (this.#end === -1) {
485
+ this.#end = performance.now() - this.#created
483
486
  }
484
487
  }
485
488
 
@@ -537,15 +540,18 @@ export class Http2ServerRequest extends http2.Http2ServerRequest {
537
540
  export class Http2ServerResponse extends http2.Http2ServerResponse {
538
541
  #created = 0
539
542
  #bytesWritten = 0
540
- #timing = {
541
- connect: -1,
542
- headers: -1,
543
- data: -1,
544
- end: -1,
545
- }
543
+ #connect = -1
544
+ #headers = -1
545
+ #data = -1
546
+ #end = -1
546
547
 
547
548
  get timing() {
548
- return this.#timing
549
+ return {
550
+ connect: this.#connect,
551
+ headers: this.#headers,
552
+ data: this.#data,
553
+ end: this.#end,
554
+ }
549
555
  }
550
556
 
551
557
  get bytesWritten() {
@@ -556,13 +562,13 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
556
562
  super(req)
557
563
 
558
564
  this.#created = performance.now()
559
- this.#timing.connect = 0
565
+ this.#connect = 0
560
566
  }
561
567
 
562
568
  flushHeaders() {
563
569
  if (!this.destroyed) {
564
- if (this.#timing.headers === -1) {
565
- this.#timing.headers = performance.now() - this.#created
570
+ if (this.#headers === -1) {
571
+ this.#headers = performance.now() - this.#created
566
572
  }
567
573
  }
568
574
  return super.flushHeaders()
@@ -570,12 +576,12 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
570
576
 
571
577
  write(chunk, encoding, callback) {
572
578
  if (!this.destroyed) {
573
- if (this.#timing.data === -1) {
574
- this.#timing.data = performance.now() - this.#created
579
+ if (this.#data === -1) {
580
+ this.#data = performance.now() - this.#created
575
581
  }
576
582
 
577
- if (this.#timing.headers === -1) {
578
- this.#timing.headers = this.#timing.data
583
+ if (this.#headers === -1) {
584
+ this.#headers = this.#data
579
585
  }
580
586
  }
581
587
 
@@ -592,14 +598,14 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
592
598
 
593
599
  end(chunk, encoding, callback) {
594
600
  if (!this.destroyed) {
595
- this.#timing.end = performance.now() - this.#created
601
+ this.#end = performance.now() - this.#created
596
602
 
597
- if (this.#timing.data === -1) {
598
- this.#timing.data = this.#timing.end
603
+ if (this.#data === -1) {
604
+ this.#data = this.#end
599
605
  }
600
606
 
601
- if (this.#timing.headers === -1) {
602
- this.#timing.headers = this.#timing.end
607
+ if (this.#headers === -1) {
608
+ this.#headers = this.#end
603
609
  }
604
610
  }
605
611
 
@@ -616,8 +622,8 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
616
622
 
617
623
  destroy(err) {
618
624
  if (!this.destroyed) {
619
- if (this.#timing.end === -1) {
620
- this.#timing.end = performance.now() - this.#created
625
+ if (this.#end === -1) {
626
+ this.#end = performance.now() - this.#created
621
627
  }
622
628
  }
623
629
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "24.1.1",
3
+ "version": "24.1.2",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",