msw 0.48.2 → 0.49.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.
@@ -2,7 +2,7 @@
2
2
  /* tslint:disable */
3
3
 
4
4
  /**
5
- * Mock Service Worker (0.48.2).
5
+ * Mock Service Worker (0.49.0).
6
6
  * @see https://github.com/mswjs/msw
7
7
  * - Please do NOT modify this file.
8
8
  * - Please do NOT serve this file on production.
@@ -1,5 +1,5 @@
1
- import { b as RequestHandler } from '../SetupApi-75fbec12.js';
2
- import { S as SetupServerApi } from '../SetupServerApi-49722346.js';
1
+ import { b as RequestHandler } from '../SetupApi-0d3126ba.js';
2
+ import { S as SetupServerApi } from '../SetupServerApi-3406bf53.js';
3
3
  import 'strict-event-emitter';
4
4
  import 'headers-polyfill';
5
5
  import '@mswjs/interceptors';
@@ -106,8 +106,8 @@ function toReadonlyArray(source) {
106
106
 
107
107
  // src/SetupApi.ts
108
108
  var SetupApi = class {
109
- constructor(initialHandlers) {
110
- this.validateHandlers(initialHandlers);
109
+ constructor(...initialHandlers) {
110
+ this.validateHandlers(...initialHandlers);
111
111
  this.initialHandlers = toReadonlyArray(initialHandlers);
112
112
  this.currentHandlers = [...initialHandlers];
113
113
  this.emitter = new import_strict_event_emitter.StrictEventEmitter();
@@ -115,7 +115,7 @@ var SetupApi = class {
115
115
  pipeEvents(this.emitter, this.publicEmitter);
116
116
  this.events = this.createLifeCycleEvents();
117
117
  }
118
- validateHandlers(handlers) {
118
+ validateHandlers(...handlers) {
119
119
  for (const handler of handlers) {
120
120
  (0, import_outvariant2.invariant)(!Array.isArray(handler), devUtils.formatMessage('Failed to construct "%s" given an Array of request handlers. Make sure you spread the request handlers when calling the respective setup function.'), this.constructor.name);
121
121
  }
@@ -505,12 +505,141 @@ function parseGraphQLRequest(request) {
505
505
  };
506
506
  }
507
507
 
508
+ // node_modules/statuses/codes.json
509
+ var _00 = "Continue";
510
+ var _01 = "Switching Protocols";
511
+ var _02 = "Processing";
512
+ var _03 = "Early Hints";
513
+ var _002 = "OK";
514
+ var _012 = "Created";
515
+ var _022 = "Accepted";
516
+ var _032 = "Non-Authoritative Information";
517
+ var _04 = "No Content";
518
+ var _05 = "Reset Content";
519
+ var _06 = "Partial Content";
520
+ var _07 = "Multi-Status";
521
+ var _08 = "Already Reported";
522
+ var _26 = "IM Used";
523
+ var _003 = "Multiple Choices";
524
+ var _013 = "Moved Permanently";
525
+ var _023 = "Found";
526
+ var _033 = "See Other";
527
+ var _042 = "Not Modified";
528
+ var _052 = "Use Proxy";
529
+ var _072 = "Temporary Redirect";
530
+ var _082 = "Permanent Redirect";
531
+ var _004 = "Bad Request";
532
+ var _014 = "Unauthorized";
533
+ var _024 = "Payment Required";
534
+ var _034 = "Forbidden";
535
+ var _043 = "Not Found";
536
+ var _053 = "Method Not Allowed";
537
+ var _062 = "Not Acceptable";
538
+ var _073 = "Proxy Authentication Required";
539
+ var _083 = "Request Timeout";
540
+ var _09 = "Conflict";
541
+ var _10 = "Gone";
542
+ var _11 = "Length Required";
543
+ var _12 = "Precondition Failed";
544
+ var _13 = "Payload Too Large";
545
+ var _14 = "URI Too Long";
546
+ var _15 = "Unsupported Media Type";
547
+ var _16 = "Range Not Satisfiable";
548
+ var _17 = "Expectation Failed";
549
+ var _18 = "I'm a Teapot";
550
+ var _21 = "Misdirected Request";
551
+ var _22 = "Unprocessable Entity";
552
+ var _23 = "Locked";
553
+ var _24 = "Failed Dependency";
554
+ var _25 = "Too Early";
555
+ var _262 = "Upgrade Required";
556
+ var _28 = "Precondition Required";
557
+ var _29 = "Too Many Requests";
558
+ var _31 = "Request Header Fields Too Large";
559
+ var _51 = "Unavailable For Legal Reasons";
560
+ var _005 = "Internal Server Error";
561
+ var _015 = "Not Implemented";
562
+ var _025 = "Bad Gateway";
563
+ var _035 = "Service Unavailable";
564
+ var _044 = "Gateway Timeout";
565
+ var _054 = "HTTP Version Not Supported";
566
+ var _063 = "Variant Also Negotiates";
567
+ var _074 = "Insufficient Storage";
568
+ var _084 = "Loop Detected";
569
+ var _092 = "Bandwidth Limit Exceeded";
570
+ var _102 = "Not Extended";
571
+ var _112 = "Network Authentication Required";
572
+ var codes_default = {
573
+ "100": _00,
574
+ "101": _01,
575
+ "102": _02,
576
+ "103": _03,
577
+ "200": _002,
578
+ "201": _012,
579
+ "202": _022,
580
+ "203": _032,
581
+ "204": _04,
582
+ "205": _05,
583
+ "206": _06,
584
+ "207": _07,
585
+ "208": _08,
586
+ "226": _26,
587
+ "300": _003,
588
+ "301": _013,
589
+ "302": _023,
590
+ "303": _033,
591
+ "304": _042,
592
+ "305": _052,
593
+ "307": _072,
594
+ "308": _082,
595
+ "400": _004,
596
+ "401": _014,
597
+ "402": _024,
598
+ "403": _034,
599
+ "404": _043,
600
+ "405": _053,
601
+ "406": _062,
602
+ "407": _073,
603
+ "408": _083,
604
+ "409": _09,
605
+ "410": _10,
606
+ "411": _11,
607
+ "412": _12,
608
+ "413": _13,
609
+ "414": _14,
610
+ "415": _15,
611
+ "416": _16,
612
+ "417": _17,
613
+ "418": _18,
614
+ "421": _21,
615
+ "422": _22,
616
+ "423": _23,
617
+ "424": _24,
618
+ "425": _25,
619
+ "426": _262,
620
+ "428": _28,
621
+ "429": _29,
622
+ "431": _31,
623
+ "451": _51,
624
+ "500": _005,
625
+ "501": _015,
626
+ "502": _025,
627
+ "503": _035,
628
+ "504": _044,
629
+ "505": _054,
630
+ "506": _063,
631
+ "507": _074,
632
+ "508": _084,
633
+ "509": _092,
634
+ "510": _102,
635
+ "511": _112
636
+ };
637
+
508
638
  // src/context/status.ts
509
- var import_codes = __toESM(require("statuses/codes.json"));
510
639
  var status = (statusCode, statusText) => {
511
640
  return (res) => {
512
641
  res.status = statusCode;
513
- res.statusText = statusText || import_codes.default[String(statusCode)];
642
+ res.statusText = statusText || codes_default[String(statusCode)];
514
643
  return res;
515
644
  };
516
645
  };
@@ -1282,8 +1411,8 @@ var DEFAULT_LISTEN_OPTIONS = {
1282
1411
  onUnhandledRequest: "warn"
1283
1412
  };
1284
1413
  var SetupServerApi = class extends SetupApi {
1285
- constructor(interceptors, handlers) {
1286
- super(handlers);
1414
+ constructor(interceptors, ...handlers) {
1415
+ super(...handlers);
1287
1416
  this.interceptor = new import_interceptors2.BatchInterceptor({
1288
1417
  name: "setup-server",
1289
1418
  interceptors: interceptors.map((Interceptor2) => new Interceptor2())
@@ -1351,7 +1480,7 @@ var SetupServerApi = class extends SetupApi {
1351
1480
 
1352
1481
  // src/native/index.ts
1353
1482
  function setupServer(...handlers) {
1354
- return new SetupServerApi([import_XMLHttpRequest.XMLHttpRequestInterceptor], handlers);
1483
+ return new SetupServerApi([import_XMLHttpRequest.XMLHttpRequestInterceptor], ...handlers);
1355
1484
  }
1356
1485
  // Annotate the CommonJS export names for ESM import in node:
1357
1486
  0 && (module.exports = {
@@ -106,8 +106,8 @@ function toReadonlyArray(source) {
106
106
 
107
107
  // src/SetupApi.ts
108
108
  var SetupApi = class {
109
- constructor(initialHandlers) {
110
- this.validateHandlers(initialHandlers);
109
+ constructor(...initialHandlers) {
110
+ this.validateHandlers(...initialHandlers);
111
111
  this.initialHandlers = toReadonlyArray(initialHandlers);
112
112
  this.currentHandlers = [...initialHandlers];
113
113
  this.emitter = new StrictEventEmitter();
@@ -115,7 +115,7 @@ var SetupApi = class {
115
115
  pipeEvents(this.emitter, this.publicEmitter);
116
116
  this.events = this.createLifeCycleEvents();
117
117
  }
118
- validateHandlers(handlers) {
118
+ validateHandlers(...handlers) {
119
119
  for (const handler of handlers) {
120
120
  invariant(!Array.isArray(handler), devUtils.formatMessage('Failed to construct "%s" given an Array of request handlers. Make sure you spread the request handlers when calling the respective setup function.'), this.constructor.name);
121
121
  }
@@ -505,12 +505,141 @@ function parseGraphQLRequest(request) {
505
505
  };
506
506
  }
507
507
 
508
+ // node_modules/statuses/codes.json
509
+ var _00 = "Continue";
510
+ var _01 = "Switching Protocols";
511
+ var _02 = "Processing";
512
+ var _03 = "Early Hints";
513
+ var _002 = "OK";
514
+ var _012 = "Created";
515
+ var _022 = "Accepted";
516
+ var _032 = "Non-Authoritative Information";
517
+ var _04 = "No Content";
518
+ var _05 = "Reset Content";
519
+ var _06 = "Partial Content";
520
+ var _07 = "Multi-Status";
521
+ var _08 = "Already Reported";
522
+ var _26 = "IM Used";
523
+ var _003 = "Multiple Choices";
524
+ var _013 = "Moved Permanently";
525
+ var _023 = "Found";
526
+ var _033 = "See Other";
527
+ var _042 = "Not Modified";
528
+ var _052 = "Use Proxy";
529
+ var _072 = "Temporary Redirect";
530
+ var _082 = "Permanent Redirect";
531
+ var _004 = "Bad Request";
532
+ var _014 = "Unauthorized";
533
+ var _024 = "Payment Required";
534
+ var _034 = "Forbidden";
535
+ var _043 = "Not Found";
536
+ var _053 = "Method Not Allowed";
537
+ var _062 = "Not Acceptable";
538
+ var _073 = "Proxy Authentication Required";
539
+ var _083 = "Request Timeout";
540
+ var _09 = "Conflict";
541
+ var _10 = "Gone";
542
+ var _11 = "Length Required";
543
+ var _12 = "Precondition Failed";
544
+ var _13 = "Payload Too Large";
545
+ var _14 = "URI Too Long";
546
+ var _15 = "Unsupported Media Type";
547
+ var _16 = "Range Not Satisfiable";
548
+ var _17 = "Expectation Failed";
549
+ var _18 = "I'm a Teapot";
550
+ var _21 = "Misdirected Request";
551
+ var _22 = "Unprocessable Entity";
552
+ var _23 = "Locked";
553
+ var _24 = "Failed Dependency";
554
+ var _25 = "Too Early";
555
+ var _262 = "Upgrade Required";
556
+ var _28 = "Precondition Required";
557
+ var _29 = "Too Many Requests";
558
+ var _31 = "Request Header Fields Too Large";
559
+ var _51 = "Unavailable For Legal Reasons";
560
+ var _005 = "Internal Server Error";
561
+ var _015 = "Not Implemented";
562
+ var _025 = "Bad Gateway";
563
+ var _035 = "Service Unavailable";
564
+ var _044 = "Gateway Timeout";
565
+ var _054 = "HTTP Version Not Supported";
566
+ var _063 = "Variant Also Negotiates";
567
+ var _074 = "Insufficient Storage";
568
+ var _084 = "Loop Detected";
569
+ var _092 = "Bandwidth Limit Exceeded";
570
+ var _102 = "Not Extended";
571
+ var _112 = "Network Authentication Required";
572
+ var codes_default = {
573
+ "100": _00,
574
+ "101": _01,
575
+ "102": _02,
576
+ "103": _03,
577
+ "200": _002,
578
+ "201": _012,
579
+ "202": _022,
580
+ "203": _032,
581
+ "204": _04,
582
+ "205": _05,
583
+ "206": _06,
584
+ "207": _07,
585
+ "208": _08,
586
+ "226": _26,
587
+ "300": _003,
588
+ "301": _013,
589
+ "302": _023,
590
+ "303": _033,
591
+ "304": _042,
592
+ "305": _052,
593
+ "307": _072,
594
+ "308": _082,
595
+ "400": _004,
596
+ "401": _014,
597
+ "402": _024,
598
+ "403": _034,
599
+ "404": _043,
600
+ "405": _053,
601
+ "406": _062,
602
+ "407": _073,
603
+ "408": _083,
604
+ "409": _09,
605
+ "410": _10,
606
+ "411": _11,
607
+ "412": _12,
608
+ "413": _13,
609
+ "414": _14,
610
+ "415": _15,
611
+ "416": _16,
612
+ "417": _17,
613
+ "418": _18,
614
+ "421": _21,
615
+ "422": _22,
616
+ "423": _23,
617
+ "424": _24,
618
+ "425": _25,
619
+ "426": _262,
620
+ "428": _28,
621
+ "429": _29,
622
+ "431": _31,
623
+ "451": _51,
624
+ "500": _005,
625
+ "501": _015,
626
+ "502": _025,
627
+ "503": _035,
628
+ "504": _044,
629
+ "505": _054,
630
+ "506": _063,
631
+ "507": _074,
632
+ "508": _084,
633
+ "509": _092,
634
+ "510": _102,
635
+ "511": _112
636
+ };
637
+
508
638
  // src/context/status.ts
509
- import statuses from "statuses/codes.json";
510
639
  var status = (statusCode, statusText) => {
511
640
  return (res) => {
512
641
  res.status = statusCode;
513
- res.statusText = statusText || statuses[String(statusCode)];
642
+ res.statusText = statusText || codes_default[String(statusCode)];
514
643
  return res;
515
644
  };
516
645
  };
@@ -1282,8 +1411,8 @@ var DEFAULT_LISTEN_OPTIONS = {
1282
1411
  onUnhandledRequest: "warn"
1283
1412
  };
1284
1413
  var SetupServerApi = class extends SetupApi {
1285
- constructor(interceptors, handlers) {
1286
- super(handlers);
1414
+ constructor(interceptors, ...handlers) {
1415
+ super(...handlers);
1287
1416
  this.interceptor = new BatchInterceptor({
1288
1417
  name: "setup-server",
1289
1418
  interceptors: interceptors.map((Interceptor2) => new Interceptor2())
@@ -1351,7 +1480,7 @@ var SetupServerApi = class extends SetupApi {
1351
1480
 
1352
1481
  // src/native/index.ts
1353
1482
  function setupServer(...handlers) {
1354
- return new SetupServerApi([XMLHttpRequestInterceptor], handlers);
1483
+ return new SetupServerApi([XMLHttpRequestInterceptor], ...handlers);
1355
1484
  }
1356
1485
  export {
1357
1486
  setupServer
@@ -1,7 +1,7 @@
1
- import { S as SetupServerApi } from '../SetupServerApi-49722346.js';
2
- export { a as ServerLifecycleEventsMap } from '../SetupServerApi-49722346.js';
3
- import { b as RequestHandler } from '../SetupApi-75fbec12.js';
4
- export { a as SetupServerApi } from '../glossary-a22f5c13.js';
1
+ import { S as SetupServerApi } from '../SetupServerApi-3406bf53.js';
2
+ export { a as ServerLifecycleEventsMap } from '../SetupServerApi-3406bf53.js';
3
+ import { b as RequestHandler } from '../SetupApi-0d3126ba.js';
4
+ export { a as SetupServerApi } from '../glossary-6a87827e.js';
5
5
  import '@mswjs/interceptors';
6
6
  import 'strict-event-emitter';
7
7
  import 'headers-polyfill';
package/lib/node/index.js CHANGED
@@ -109,8 +109,8 @@ function toReadonlyArray(source) {
109
109
 
110
110
  // src/SetupApi.ts
111
111
  var SetupApi = class {
112
- constructor(initialHandlers) {
113
- this.validateHandlers(initialHandlers);
112
+ constructor(...initialHandlers) {
113
+ this.validateHandlers(...initialHandlers);
114
114
  this.initialHandlers = toReadonlyArray(initialHandlers);
115
115
  this.currentHandlers = [...initialHandlers];
116
116
  this.emitter = new import_strict_event_emitter.StrictEventEmitter();
@@ -118,7 +118,7 @@ var SetupApi = class {
118
118
  pipeEvents(this.emitter, this.publicEmitter);
119
119
  this.events = this.createLifeCycleEvents();
120
120
  }
121
- validateHandlers(handlers) {
121
+ validateHandlers(...handlers) {
122
122
  for (const handler of handlers) {
123
123
  (0, import_outvariant2.invariant)(!Array.isArray(handler), devUtils.formatMessage('Failed to construct "%s" given an Array of request handlers. Make sure you spread the request handlers when calling the respective setup function.'), this.constructor.name);
124
124
  }
@@ -508,12 +508,141 @@ function parseGraphQLRequest(request) {
508
508
  };
509
509
  }
510
510
 
511
+ // node_modules/statuses/codes.json
512
+ var _00 = "Continue";
513
+ var _01 = "Switching Protocols";
514
+ var _02 = "Processing";
515
+ var _03 = "Early Hints";
516
+ var _002 = "OK";
517
+ var _012 = "Created";
518
+ var _022 = "Accepted";
519
+ var _032 = "Non-Authoritative Information";
520
+ var _04 = "No Content";
521
+ var _05 = "Reset Content";
522
+ var _06 = "Partial Content";
523
+ var _07 = "Multi-Status";
524
+ var _08 = "Already Reported";
525
+ var _26 = "IM Used";
526
+ var _003 = "Multiple Choices";
527
+ var _013 = "Moved Permanently";
528
+ var _023 = "Found";
529
+ var _033 = "See Other";
530
+ var _042 = "Not Modified";
531
+ var _052 = "Use Proxy";
532
+ var _072 = "Temporary Redirect";
533
+ var _082 = "Permanent Redirect";
534
+ var _004 = "Bad Request";
535
+ var _014 = "Unauthorized";
536
+ var _024 = "Payment Required";
537
+ var _034 = "Forbidden";
538
+ var _043 = "Not Found";
539
+ var _053 = "Method Not Allowed";
540
+ var _062 = "Not Acceptable";
541
+ var _073 = "Proxy Authentication Required";
542
+ var _083 = "Request Timeout";
543
+ var _09 = "Conflict";
544
+ var _10 = "Gone";
545
+ var _11 = "Length Required";
546
+ var _12 = "Precondition Failed";
547
+ var _13 = "Payload Too Large";
548
+ var _14 = "URI Too Long";
549
+ var _15 = "Unsupported Media Type";
550
+ var _16 = "Range Not Satisfiable";
551
+ var _17 = "Expectation Failed";
552
+ var _18 = "I'm a Teapot";
553
+ var _21 = "Misdirected Request";
554
+ var _22 = "Unprocessable Entity";
555
+ var _23 = "Locked";
556
+ var _24 = "Failed Dependency";
557
+ var _25 = "Too Early";
558
+ var _262 = "Upgrade Required";
559
+ var _28 = "Precondition Required";
560
+ var _29 = "Too Many Requests";
561
+ var _31 = "Request Header Fields Too Large";
562
+ var _51 = "Unavailable For Legal Reasons";
563
+ var _005 = "Internal Server Error";
564
+ var _015 = "Not Implemented";
565
+ var _025 = "Bad Gateway";
566
+ var _035 = "Service Unavailable";
567
+ var _044 = "Gateway Timeout";
568
+ var _054 = "HTTP Version Not Supported";
569
+ var _063 = "Variant Also Negotiates";
570
+ var _074 = "Insufficient Storage";
571
+ var _084 = "Loop Detected";
572
+ var _092 = "Bandwidth Limit Exceeded";
573
+ var _102 = "Not Extended";
574
+ var _112 = "Network Authentication Required";
575
+ var codes_default = {
576
+ "100": _00,
577
+ "101": _01,
578
+ "102": _02,
579
+ "103": _03,
580
+ "200": _002,
581
+ "201": _012,
582
+ "202": _022,
583
+ "203": _032,
584
+ "204": _04,
585
+ "205": _05,
586
+ "206": _06,
587
+ "207": _07,
588
+ "208": _08,
589
+ "226": _26,
590
+ "300": _003,
591
+ "301": _013,
592
+ "302": _023,
593
+ "303": _033,
594
+ "304": _042,
595
+ "305": _052,
596
+ "307": _072,
597
+ "308": _082,
598
+ "400": _004,
599
+ "401": _014,
600
+ "402": _024,
601
+ "403": _034,
602
+ "404": _043,
603
+ "405": _053,
604
+ "406": _062,
605
+ "407": _073,
606
+ "408": _083,
607
+ "409": _09,
608
+ "410": _10,
609
+ "411": _11,
610
+ "412": _12,
611
+ "413": _13,
612
+ "414": _14,
613
+ "415": _15,
614
+ "416": _16,
615
+ "417": _17,
616
+ "418": _18,
617
+ "421": _21,
618
+ "422": _22,
619
+ "423": _23,
620
+ "424": _24,
621
+ "425": _25,
622
+ "426": _262,
623
+ "428": _28,
624
+ "429": _29,
625
+ "431": _31,
626
+ "451": _51,
627
+ "500": _005,
628
+ "501": _015,
629
+ "502": _025,
630
+ "503": _035,
631
+ "504": _044,
632
+ "505": _054,
633
+ "506": _063,
634
+ "507": _074,
635
+ "508": _084,
636
+ "509": _092,
637
+ "510": _102,
638
+ "511": _112
639
+ };
640
+
511
641
  // src/context/status.ts
512
- var import_codes = __toESM(require("statuses/codes.json"));
513
642
  var status = (statusCode, statusText) => {
514
643
  return (res) => {
515
644
  res.status = statusCode;
516
- res.statusText = statusText || import_codes.default[String(statusCode)];
645
+ res.statusText = statusText || codes_default[String(statusCode)];
517
646
  return res;
518
647
  };
519
648
  };
@@ -1285,8 +1414,8 @@ var DEFAULT_LISTEN_OPTIONS = {
1285
1414
  onUnhandledRequest: "warn"
1286
1415
  };
1287
1416
  var SetupServerApi = class extends SetupApi {
1288
- constructor(interceptors, handlers) {
1289
- super(handlers);
1417
+ constructor(interceptors, ...handlers) {
1418
+ super(...handlers);
1290
1419
  this.interceptor = new import_interceptors2.BatchInterceptor({
1291
1420
  name: "setup-server",
1292
1421
  interceptors: interceptors.map((Interceptor2) => new Interceptor2())
@@ -1356,7 +1485,7 @@ var SetupServerApi = class extends SetupApi {
1356
1485
  var import_ClientRequest = require("@mswjs/interceptors/lib/interceptors/ClientRequest/index.js");
1357
1486
  var import_XMLHttpRequest = require("@mswjs/interceptors/lib/interceptors/XMLHttpRequest/index.js");
1358
1487
  var setupServer = (...handlers) => {
1359
- return new SetupServerApi([import_ClientRequest.ClientRequestInterceptor, import_XMLHttpRequest.XMLHttpRequestInterceptor], handlers);
1488
+ return new SetupServerApi([import_ClientRequest.ClientRequestInterceptor, import_XMLHttpRequest.XMLHttpRequestInterceptor], ...handlers);
1360
1489
  };
1361
1490
  // Annotate the CommonJS export names for ESM import in node:
1362
1491
  0 && (module.exports = {