msw 0.36.1 → 0.36.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/umd/index.js CHANGED
@@ -88,7 +88,7 @@
88
88
 
89
89
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
90
90
 
91
- var lib$6 = {};
91
+ var lib$7 = {};
92
92
 
93
93
  var Headers = {};
94
94
 
@@ -612,7 +612,7 @@
612
612
  Object.defineProperty(exports, "flattenHeadersList", { enumerable: true, get: function () { return flattenHeadersList_1.flattenHeadersList; } });
613
613
  var flattenHeadersObject_1 = flattenHeadersObject$1;
614
614
  Object.defineProperty(exports, "flattenHeadersObject", { enumerable: true, get: function () { return flattenHeadersObject_1.flattenHeadersObject; } });
615
- }(lib$6));
615
+ }(lib$7));
616
616
 
617
617
  /**
618
618
  * Sets one or multiple response headers.
@@ -631,7 +631,7 @@
631
631
  res.headers.append(name, value);
632
632
  }
633
633
  else {
634
- const headers = lib$6.objectToHeaders(name);
634
+ const headers = lib$7.objectToHeaders(name);
635
635
  headers.forEach((value, name) => {
636
636
  res.headers.append(name, value);
637
637
  });
@@ -956,7 +956,7 @@
956
956
  };
957
957
  };
958
958
 
959
- var lib$5 = {exports: {}};
959
+ var lib$6 = {exports: {}};
960
960
 
961
961
  (function (module, exports) {
962
962
  (function (global, factory) {
@@ -979,14 +979,14 @@
979
979
  Object.defineProperty(exports, '__esModule', { value: true });
980
980
 
981
981
  })));
982
- }(lib$5, lib$5.exports));
982
+ }(lib$6, lib$6.exports));
983
983
 
984
984
  const SET_TIMEOUT_MAX_ALLOWED_INT = 2147483647;
985
985
  const MIN_SERVER_RESPONSE_TIME = 100;
986
986
  const MAX_SERVER_RESPONSE_TIME = 400;
987
987
  const NODE_SERVER_RESPONSE_TIME = 5;
988
988
  const getRandomServerResponseTime = () => {
989
- if (lib$5.exports.isNodeProcess()) {
989
+ if (lib$6.exports.isNodeProcess()) {
990
990
  return NODE_SERVER_RESPONSE_TIME;
991
991
  }
992
992
  return Math.floor(Math.random() * (MAX_SERVER_RESPONSE_TIME - MIN_SERVER_RESPONSE_TIME) +
@@ -1053,9 +1053,9 @@
1053
1053
  };
1054
1054
  };
1055
1055
 
1056
- const useFetch = lib$5.exports.isNodeProcess() ? require('node-fetch') : window.fetch;
1056
+ const useFetch = lib$6.exports.isNodeProcess() ? require('node-fetch') : window.fetch;
1057
1057
  const augmentRequestInit = (requestInit) => {
1058
- const headers = new lib$6.Headers(requestInit.headers);
1058
+ const headers = new lib$7.Headers(requestInit.headers);
1059
1059
  headers.set('x-msw-bypass', 'true');
1060
1060
  return Object.assign(Object.assign({}, requestInit), { headers: headers.all() });
1061
1061
  };
@@ -1133,7 +1133,7 @@
1133
1133
  xml: xml
1134
1134
  });
1135
1135
 
1136
- var lib$4 = {};
1136
+ var lib$5 = {};
1137
1137
 
1138
1138
  var StrictEventEmitter$1 = {};
1139
1139
 
@@ -1613,7 +1613,7 @@
1613
1613
  }
1614
1614
  }
1615
1615
 
1616
- var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
1616
+ var __extends$3 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
1617
1617
  var extendStatics = function (d, b) {
1618
1618
  extendStatics = Object.setPrototypeOf ||
1619
1619
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -1637,7 +1637,7 @@
1637
1637
  StrictEventEmitter$1.StrictEventEmitter = void 0;
1638
1638
  var events_1 = events.exports;
1639
1639
  var StrictEventEmitter = /** @class */ (function (_super) {
1640
- __extends$2(StrictEventEmitter, _super);
1640
+ __extends$3(StrictEventEmitter, _super);
1641
1641
  function StrictEventEmitter() {
1642
1642
  return _super.call(this) || this;
1643
1643
  }
@@ -1679,7 +1679,7 @@
1679
1679
  exports.StrictEventEmitter = void 0;
1680
1680
  var StrictEventEmitter_1 = StrictEventEmitter$1;
1681
1681
  __createBinding(exports, StrictEventEmitter_1, "StrictEventEmitter");
1682
- }(lib$4));
1682
+ }(lib$5));
1683
1683
 
1684
1684
  /*! *****************************************************************************
1685
1685
  Copyright (c) Microsoft Corporation.
@@ -1718,7 +1718,7 @@
1718
1718
  });
1719
1719
  }
1720
1720
 
1721
- var lib$3 = {};
1721
+ var lib$4 = {};
1722
1722
 
1723
1723
  var until$1 = {};
1724
1724
 
@@ -1740,9 +1740,9 @@
1740
1740
  }
1741
1741
  };
1742
1742
 
1743
- Object.defineProperty(lib$3, "__esModule", { value: true });
1743
+ Object.defineProperty(lib$4, "__esModule", { value: true });
1744
1744
  var until_1$1 = until$1;
1745
- var until = lib$3.until = until_1$1.until;
1745
+ var until = lib$4.until = until_1$1.until;
1746
1746
 
1747
1747
  /**
1748
1748
  * Attempts to resolve a Service Worker instance from a given registration,
@@ -1769,16 +1769,16 @@
1769
1769
  return new URL(relativeUrl, location.origin).href;
1770
1770
  }
1771
1771
 
1772
- var lib$2 = {};
1772
+ var lib$3 = {};
1773
1773
 
1774
- var invariant$3 = {};
1774
+ var invariant$5 = {};
1775
1775
 
1776
- var format$1 = {};
1776
+ var format$3 = {};
1777
1777
 
1778
- Object.defineProperty(format$1, "__esModule", { value: true });
1779
- format$1.format = void 0;
1780
- var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
1781
- function serializePositional(positional, flag) {
1778
+ Object.defineProperty(format$3, "__esModule", { value: true });
1779
+ format$3.format = void 0;
1780
+ var POSITIONALS_EXP$1 = /(%?)(%([sdjo]))/g;
1781
+ function serializePositional$1(positional, flag) {
1782
1782
  switch (flag) {
1783
1783
  // Strings.
1784
1784
  case 's':
@@ -1805,7 +1805,7 @@
1805
1805
  }
1806
1806
  }
1807
1807
  }
1808
- function format(message) {
1808
+ function format$2(message) {
1809
1809
  var positionals = [];
1810
1810
  for (var _i = 1; _i < arguments.length; _i++) {
1811
1811
  positionals[_i - 1] = arguments[_i];
@@ -1814,9 +1814,9 @@
1814
1814
  return message;
1815
1815
  }
1816
1816
  var positionalIndex = 0;
1817
- var formattedMessage = message.replace(POSITIONALS_EXP, function (match, isEscaped, _, flag) {
1817
+ var formattedMessage = message.replace(POSITIONALS_EXP$1, function (match, isEscaped, _, flag) {
1818
1818
  var positional = positionals[positionalIndex];
1819
- var value = serializePositional(positional, flag);
1819
+ var value = serializePositional$1(positional, flag);
1820
1820
  if (!isEscaped) {
1821
1821
  positionalIndex++;
1822
1822
  return value;
@@ -1830,9 +1830,9 @@
1830
1830
  formattedMessage = formattedMessage.replace(/%{2,2}/g, '%');
1831
1831
  return formattedMessage;
1832
1832
  }
1833
- format$1.format = format;
1833
+ format$3.format = format$2;
1834
1834
 
1835
- var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
1835
+ var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
1836
1836
  var extendStatics = function (d, b) {
1837
1837
  extendStatics = Object.setPrototypeOf ||
1838
1838
  ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
@@ -1847,17 +1847,17 @@
1847
1847
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1848
1848
  };
1849
1849
  })();
1850
- var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
1850
+ var __spreadArray$1 = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
1851
1851
  for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
1852
1852
  to[j] = from[i];
1853
1853
  return to;
1854
1854
  };
1855
- Object.defineProperty(invariant$3, "__esModule", { value: true });
1856
- invariant$3.invariant = invariant$3.InvariantError = void 0;
1857
- var format_1 = format$1;
1858
- var STACK_FRAMES_TO_IGNORE = 2;
1859
- var InvariantError = /** @class */ (function (_super) {
1860
- __extends$1(InvariantError, _super);
1855
+ Object.defineProperty(invariant$5, "__esModule", { value: true });
1856
+ invariant$5.invariant = invariant$5.InvariantError = void 0;
1857
+ var format_1$1 = format$3;
1858
+ var STACK_FRAMES_TO_IGNORE$1 = 2;
1859
+ var InvariantError$1 = /** @class */ (function (_super) {
1860
+ __extends$2(InvariantError, _super);
1861
1861
  function InvariantError(message) {
1862
1862
  var positionals = [];
1863
1863
  for (var _i = 1; _i < arguments.length; _i++) {
@@ -1865,29 +1865,27 @@
1865
1865
  }
1866
1866
  var _this = _super.call(this, message) || this;
1867
1867
  _this.name = 'Invariant Violation';
1868
- _this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
1868
+ _this.message = format_1$1.format.apply(void 0, __spreadArray$1([message], positionals));
1869
1869
  if (_this.stack) {
1870
- var prevStack = _this.stack;
1871
- _this.stack = prevStack
1872
- .split('\n')
1873
- .slice(STACK_FRAMES_TO_IGNORE)
1874
- .join('\n');
1870
+ var nextStack = _this.stack.split('\n');
1871
+ nextStack.splice(1, STACK_FRAMES_TO_IGNORE$1);
1872
+ _this.stack = nextStack.join('\n');
1875
1873
  }
1876
1874
  return _this;
1877
1875
  }
1878
1876
  return InvariantError;
1879
1877
  }(Error));
1880
- invariant$3.InvariantError = InvariantError;
1881
- function invariant$2(predicate, message) {
1878
+ invariant$5.InvariantError = InvariantError$1;
1879
+ function invariant$4(predicate, message) {
1882
1880
  var positionals = [];
1883
1881
  for (var _i = 2; _i < arguments.length; _i++) {
1884
1882
  positionals[_i - 2] = arguments[_i];
1885
1883
  }
1886
1884
  if (!predicate) {
1887
- throw new (InvariantError.bind.apply(InvariantError, __spreadArray([void 0, message], positionals)))();
1885
+ throw new (InvariantError$1.bind.apply(InvariantError$1, __spreadArray$1([void 0, message], positionals)))();
1888
1886
  }
1889
1887
  }
1890
- invariant$3.invariant = invariant$2;
1888
+ invariant$5.invariant = invariant$4;
1891
1889
 
1892
1890
  (function (exports) {
1893
1891
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -1901,16 +1899,16 @@
1901
1899
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
1902
1900
  };
1903
1901
  Object.defineProperty(exports, "__esModule", { value: true });
1904
- __exportStar(invariant$3, exports);
1905
- __exportStar(format$1, exports);
1906
- }(lib$2));
1902
+ __exportStar(invariant$5, exports);
1903
+ __exportStar(format$3, exports);
1904
+ }(lib$3));
1907
1905
 
1908
1906
  const LIBRARY_PREFIX = '[MSW]';
1909
1907
  /**
1910
1908
  * Formats a given message by appending the library's prefix string.
1911
1909
  */
1912
1910
  function formatMessage(message, ...positionals) {
1913
- const interpolatedMessage = lib$2.format(message, ...positionals);
1911
+ const interpolatedMessage = lib$3.format(message, ...positionals);
1914
1912
  return `${LIBRARY_PREFIX} ${interpolatedMessage}`;
1915
1913
  }
1916
1914
  /**
@@ -2041,7 +2039,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
2041
2039
  }
2042
2040
  }
2043
2041
 
2044
- var lib$1 = {};
2042
+ var lib$2 = {};
2045
2043
 
2046
2044
  var CookieStore = {};
2047
2045
 
@@ -2412,7 +2410,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
2412
2410
  var CookieStore_1 = CookieStore;
2413
2411
  Object.defineProperty(exports, "store", { enumerable: true, get: function () { return __importDefault(CookieStore_1).default; } });
2414
2412
  Object.defineProperty(exports, "PERSISTENCY_KEY", { enumerable: true, get: function () { return CookieStore_1.PERSISTENCY_KEY; } });
2415
- }(lib$1));
2413
+ }(lib$2));
2416
2414
 
2417
2415
  function getAllCookies() {
2418
2416
  return parse_1(document.cookie);
@@ -2445,8 +2443,8 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
2445
2443
 
2446
2444
  function setRequestCookies(request) {
2447
2445
  var _a;
2448
- lib$1.store.hydrate();
2449
- request.cookies = Object.assign(Object.assign({}, getRequestCookies(request)), Array.from((_a = lib$1.store.get(Object.assign(Object.assign({}, request), { url: request.url.toString() }))) === null || _a === void 0 ? void 0 : _a.entries()).reduce((cookies, [name, { value }]) => Object.assign(cookies, { [name]: value }), {}));
2446
+ lib$2.store.hydrate();
2447
+ request.cookies = Object.assign(Object.assign({}, getRequestCookies(request)), Array.from((_a = lib$2.store.get(Object.assign(Object.assign({}, request), { url: request.url.toString() }))) === null || _a === void 0 ? void 0 : _a.entries()).reduce((cookies, [name, { value }]) => Object.assign(cookies, { [name]: value }), {}));
2450
2448
  request.headers.set('cookie', Object.entries(request.cookies)
2451
2449
  .map(([name, value]) => `${name}=${value}`)
2452
2450
  .join('; '));
@@ -2454,7 +2452,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
2454
2452
 
2455
2453
  function parseContentHeaders(headersString) {
2456
2454
  var _a, _b;
2457
- const headers = lib$6.stringToHeaders(headersString);
2455
+ const headers = lib$7.stringToHeaders(headersString);
2458
2456
  const contentType = headers.get('content-type') || 'text/plain';
2459
2457
  const disposition = headers.get('content-disposition');
2460
2458
  if (!disposition) {
@@ -2528,11 +2526,12 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
2528
2526
  * Parses a given request/response body based on the "Content-Type" header.
2529
2527
  */
2530
2528
  function parseBody(body, headers) {
2529
+ var _a;
2531
2530
  // Return whatever falsey body value is given.
2532
2531
  if (!body) {
2533
2532
  return body;
2534
2533
  }
2535
- const contentType = (headers === null || headers === void 0 ? void 0 : headers.get('content-type')) || '';
2534
+ const contentType = ((_a = headers === null || headers === void 0 ? void 0 : headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
2536
2535
  // If the body has a Multipart Content-Type
2537
2536
  // parse it into an object.
2538
2537
  const hasMultipartContent = contentType.startsWith('multipart/form-data');
@@ -2590,7 +2589,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
2590
2589
  destination: rawRequest.destination,
2591
2590
  body: pruneGetRequestBody(rawRequest),
2592
2591
  bodyUsed: rawRequest.bodyUsed,
2593
- headers: new lib$6.Headers(rawRequest.headers),
2592
+ headers: new lib$7.Headers(rawRequest.headers),
2594
2593
  };
2595
2594
  // Set document cookies on the request.
2596
2595
  setRequestCookies(request);
@@ -3331,14 +3330,14 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
3331
3330
 
3332
3331
  var defineInspect$1 = {};
3333
3332
 
3334
- var invariant$1 = {};
3333
+ var invariant$3 = {};
3335
3334
 
3336
- Object.defineProperty(invariant$1, "__esModule", {
3335
+ Object.defineProperty(invariant$3, "__esModule", {
3337
3336
  value: true
3338
3337
  });
3339
- invariant$1.default = invariant;
3338
+ invariant$3.default = invariant$2;
3340
3339
 
3341
- function invariant(condition, message) {
3340
+ function invariant$2(condition, message) {
3342
3341
  var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')
3343
3342
 
3344
3343
  if (!booleanCondition) {
@@ -3362,7 +3361,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
3362
3361
  });
3363
3362
  defineInspect$1.default = defineInspect;
3364
3363
 
3365
- var _invariant$f = _interopRequireDefault$M(invariant$1);
3364
+ var _invariant$f = _interopRequireDefault$M(invariant$3);
3366
3365
 
3367
3366
  var _nodejsCustomInspectSymbol$1 = _interopRequireDefault$M(nodejsCustomInspectSymbol$1);
3368
3367
 
@@ -7503,7 +7502,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
7503
7502
 
7504
7503
  var _inspect$q = _interopRequireDefault$B(inspect$1);
7505
7504
 
7506
- var _invariant$e = _interopRequireDefault$B(invariant$1);
7505
+ var _invariant$e = _interopRequireDefault$B(invariant$3);
7507
7506
 
7508
7507
  var _keyValMap$3 = _interopRequireDefault$B(keyValMap$1);
7509
7508
 
@@ -9367,7 +9366,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
9367
9366
 
9368
9367
  var _inspect$n = _interopRequireDefault$y(inspect$1);
9369
9368
 
9370
- var _invariant$d = _interopRequireDefault$y(invariant$1);
9369
+ var _invariant$d = _interopRequireDefault$y(invariant$3);
9371
9370
 
9372
9371
  var _isObjectLike$5 = _interopRequireDefault$y(isObjectLike$1);
9373
9372
 
@@ -9561,7 +9560,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
9561
9560
 
9562
9561
  var _inspect$m = _interopRequireDefault$x(inspect$1);
9563
9562
 
9564
- var _invariant$c = _interopRequireDefault$x(invariant$1);
9563
+ var _invariant$c = _interopRequireDefault$x(invariant$3);
9565
9564
 
9566
9565
  var _printer$8 = printer;
9567
9566
 
@@ -11313,7 +11312,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
11313
11312
 
11314
11313
  var _inspect$i = _interopRequireDefault$t(inspect$1);
11315
11314
 
11316
- var _invariant$b = _interopRequireDefault$t(invariant$1);
11315
+ var _invariant$b = _interopRequireDefault$t(invariant$3);
11317
11316
 
11318
11317
  var _kinds$j = kinds;
11319
11318
 
@@ -12642,7 +12641,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
12642
12641
 
12643
12642
  var _inspect$f = _interopRequireDefault$n(inspect$1);
12644
12643
 
12645
- var _invariant$a = _interopRequireDefault$n(invariant$1);
12644
+ var _invariant$a = _interopRequireDefault$n(invariant$3);
12646
12645
 
12647
12646
  var _GraphQLError$n = GraphQLError$1;
12648
12647
 
@@ -14302,7 +14301,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
14302
14301
 
14303
14302
  var _inspect$a = _interopRequireDefault$h(inspect$1);
14304
14303
 
14305
- var _invariant$9 = _interopRequireDefault$h(invariant$1);
14304
+ var _invariant$9 = _interopRequireDefault$h(invariant$3);
14306
14305
 
14307
14306
  var _didYouMean$1 = _interopRequireDefault$h(didYouMean$1);
14308
14307
 
@@ -15131,7 +15130,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
15131
15130
 
15132
15131
  var _inspect$9 = _interopRequireDefault$e(inspect$1);
15133
15132
 
15134
- var _invariant$8 = _interopRequireDefault$e(invariant$1);
15133
+ var _invariant$8 = _interopRequireDefault$e(invariant$3);
15135
15134
 
15136
15135
  var _kinds$6 = kinds;
15137
15136
 
@@ -15316,7 +15315,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
15316
15315
 
15317
15316
  var _inspect$8 = _interopRequireDefault$d(inspect$1);
15318
15317
 
15319
- var _invariant$7 = _interopRequireDefault$d(invariant$1);
15318
+ var _invariant$7 = _interopRequireDefault$d(invariant$3);
15320
15319
 
15321
15320
  var _didYouMean = _interopRequireDefault$d(didYouMean$1);
15322
15321
 
@@ -15697,7 +15696,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
15697
15696
 
15698
15697
  var _memoize = _interopRequireDefault$b(memoize3$1);
15699
15698
 
15700
- var _invariant$6 = _interopRequireDefault$b(invariant$1);
15699
+ var _invariant$6 = _interopRequireDefault$b(invariant$3);
15701
15700
 
15702
15701
  var _devAssert$4 = _interopRequireDefault$b(devAssert$1);
15703
15702
 
@@ -17748,7 +17747,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
17748
17747
  });
17749
17748
  NoDeprecatedCustomRule$1.NoDeprecatedCustomRule = NoDeprecatedCustomRule;
17750
17749
 
17751
- var _invariant$5 = _interopRequireDefault$8(invariant$1);
17750
+ var _invariant$5 = _interopRequireDefault$8(invariant$3);
17752
17751
 
17753
17752
  var _GraphQLError$1 = GraphQLError$1;
17754
17753
 
@@ -18333,7 +18332,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
18333
18332
  });
18334
18333
  introspectionFromSchema$1.introspectionFromSchema = introspectionFromSchema;
18335
18334
 
18336
- var _invariant$4 = _interopRequireDefault$6(invariant$1);
18335
+ var _invariant$4 = _interopRequireDefault$6(invariant$3);
18337
18336
 
18338
18337
  var _parser$2 = parser;
18339
18338
 
@@ -18730,7 +18729,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
18730
18729
 
18731
18730
  var _mapValue = _interopRequireDefault$4(mapValue$1);
18732
18731
 
18733
- var _invariant$3 = _interopRequireDefault$4(invariant$1);
18732
+ var _invariant$3 = _interopRequireDefault$4(invariant$3);
18734
18733
 
18735
18734
  var _devAssert$1 = _interopRequireDefault$4(devAssert$1);
18736
18735
 
@@ -19560,7 +19559,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
19560
19559
 
19561
19560
  var _inspect$2 = _interopRequireDefault$2(inspect$1);
19562
19561
 
19563
- var _invariant$2 = _interopRequireDefault$2(invariant$1);
19562
+ var _invariant$2 = _interopRequireDefault$2(invariant$3);
19564
19563
 
19565
19564
  var _keyValMap = _interopRequireDefault$2(keyValMap$1);
19566
19565
 
@@ -19765,7 +19764,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
19765
19764
 
19766
19765
  var _inspect$1 = _interopRequireDefault$1(inspect$1);
19767
19766
 
19768
- var _invariant$1 = _interopRequireDefault$1(invariant$1);
19767
+ var _invariant$1 = _interopRequireDefault$1(invariant$3);
19769
19768
 
19770
19769
  var _printer$1 = printer;
19771
19770
 
@@ -20300,7 +20299,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
20300
20299
 
20301
20300
  var _inspect = _interopRequireDefault(inspect$1);
20302
20301
 
20303
- var _invariant = _interopRequireDefault(invariant$1);
20302
+ var _invariant = _interopRequireDefault(invariant$3);
20304
20303
 
20305
20304
  var _naturalCompare = _interopRequireDefault(naturalCompare$1);
20306
20305
 
@@ -22446,7 +22445,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
22446
22445
  * Formats a mocked response for introspection in the browser's console.
22447
22446
  */
22448
22447
  function prepareResponse(res) {
22449
- const responseHeaders = lib$6.objectToHeaders(res.headers);
22448
+ const responseHeaders = lib$7.objectToHeaders(res.headers);
22450
22449
  return Object.assign(Object.assign({}, res), {
22451
22450
  // Parse a response JSON body for preview in the logs
22452
22451
  body: parseBody(res.body, responseHeaders) });
@@ -22885,12 +22884,23 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
22885
22884
  return path.replace(REDUNDANT_CHARACTERS_EXP, '');
22886
22885
  }
22887
22886
 
22887
+ /**
22888
+ * Determines if the given URL string is an absolute URL.
22889
+ */
22890
+ function isAbsoluteUrl(url) {
22891
+ return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
22892
+ }
22893
+
22888
22894
  /**
22889
22895
  * Returns an absolute URL based on the given path.
22890
22896
  */
22891
22897
  function getAbsoluteUrl(path, baseUrl) {
22892
- // Ignore absolute URLs.
22893
- if (!path.startsWith('/')) {
22898
+ // already absolute URL
22899
+ if (isAbsoluteUrl(path)) {
22900
+ return path;
22901
+ }
22902
+ // Ignore path with pattern start with *
22903
+ if (path.startsWith('*')) {
22894
22904
  return path;
22895
22905
  }
22896
22906
  // Resolve a relative request URL against a given custom "baseUrl"
@@ -22938,12 +22948,17 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
22938
22948
  ? `${parameterName}${wildcard}`
22939
22949
  : `${parameterName}${expression}`;
22940
22950
  })
22951
+ /**
22952
+ * Escape the port so that "path-to-regexp" can match
22953
+ * absolute URLs including port numbers.
22954
+ */
22955
+ .replace(/([^\/])(:)(?=\d+)/, '$1\\$2')
22941
22956
  /**
22942
22957
  * Escape the protocol so that "path-to-regexp" could match
22943
22958
  * absolute URL.
22944
22959
  * @see https://github.com/pillarjs/path-to-regexp/issues/259
22945
22960
  */
22946
- .replace(/^([^\/]+)(:)(?=\/\/)/g, '$1\\$2'));
22961
+ .replace(/^([^\/]+)(:)(?=\/\/)/, '$1\\$2'));
22947
22962
  }
22948
22963
  /**
22949
22964
  * Returns the result of matching given request URL against a mask.
@@ -22987,7 +23002,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
22987
23002
  function createResponseComposition(responseOverrides, defaultTransformers = defaultResponseTransformers) {
22988
23003
  return (...transformers) => __awaiter$3(this, void 0, void 0, function* () {
22989
23004
  const initialResponse = Object.assign({}, defaultResponse, {
22990
- headers: new lib$6.Headers({
23005
+ headers: new lib$7.Headers({
22991
23006
  'x-powered-by': 'msw',
22992
23007
  }),
22993
23008
  }, responseOverrides);
@@ -23196,7 +23211,6 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
23196
23211
  const matchesMethod = this.info.method instanceof RegExp
23197
23212
  ? this.info.method.test(request.method)
23198
23213
  : isStringEqual(this.info.method, request.method);
23199
- // console.log({ request, matchesMethod, parsedResult })
23200
23214
  return matchesMethod && parsedResult.matches;
23201
23215
  }
23202
23216
  log(request, response) {
@@ -23329,10 +23343,10 @@ Consider naming this operation or using "graphql.operation" request handler to i
23329
23343
  graphql: [],
23330
23344
  });
23331
23345
  }
23332
- function getScoreForRestHandler() {
23346
+ function getRestHandlerScore() {
23333
23347
  return (request, handler) => {
23334
23348
  const { path, method } = handler.info;
23335
- if (path instanceof RegExp) {
23349
+ if (path instanceof RegExp || method instanceof RegExp) {
23336
23350
  return Infinity;
23337
23351
  }
23338
23352
  const hasSameMethod = isStringEqual(request.method, method);
@@ -23343,12 +23357,15 @@ Consider naming this operation or using "graphql.operation" request handler to i
23343
23357
  return score - methodScoreDelta;
23344
23358
  };
23345
23359
  }
23346
- function getScoreForGraphQLHandler(parsedQuery) {
23360
+ function getGraphQLHandlerScore(parsedQuery) {
23347
23361
  return (_, handler) => {
23348
23362
  if (typeof parsedQuery.operationName === 'undefined') {
23349
23363
  return Infinity;
23350
23364
  }
23351
23365
  const { operationType, operationName } = handler.info;
23366
+ if (typeof operationName !== 'string') {
23367
+ return Infinity;
23368
+ }
23352
23369
  const hasSameOperationType = parsedQuery.operationType === operationType;
23353
23370
  // Always treat a handler with the same operation type as a more similar one.
23354
23371
  const operationTypeScoreDelta = hasSameOperationType ? TYPE_MATCH_DELTA : 0;
@@ -23358,16 +23375,12 @@ Consider naming this operation or using "graphql.operation" request handler to i
23358
23375
  }
23359
23376
  function getSuggestedHandler(request, handlers, getScore) {
23360
23377
  const suggestedHandlers = handlers
23361
- .reduce((acc, handler) => {
23378
+ .reduce((suggestions, handler) => {
23362
23379
  const score = getScore(request, handler);
23363
- return acc.concat([[score, handler]]);
23380
+ return suggestions.concat([[score, handler]]);
23364
23381
  }, [])
23365
- .sort(([leftScore], [rightScore]) => {
23366
- return leftScore - rightScore;
23367
- })
23368
- .filter(([score]) => {
23369
- return score <= MAX_MATCH_SCORE;
23370
- })
23382
+ .sort(([leftScore], [rightScore]) => leftScore - rightScore)
23383
+ .filter(([score]) => score <= MAX_MATCH_SCORE)
23371
23384
  .slice(0, MAX_SUGGESTION_COUNT)
23372
23385
  .map(([, handler]) => handler);
23373
23386
  return suggestedHandlers;
@@ -23397,8 +23410,8 @@ ${handlers.map((handler) => ` • ${handler.info.header}`).join('\n')}`;
23397
23410
  ? handlerGroups.graphql
23398
23411
  : handlerGroups.rest;
23399
23412
  const suggestedHandlers = getSuggestedHandler(request, relevantHandlers, parsedGraphQLQuery
23400
- ? getScoreForGraphQLHandler(parsedGraphQLQuery)
23401
- : getScoreForRestHandler());
23413
+ ? getGraphQLHandlerScore(parsedGraphQLQuery)
23414
+ : getRestHandlerScore());
23402
23415
  const handlerSuggestion = suggestedHandlers.length > 0
23403
23416
  ? getSuggestedHandlersMessage(suggestedHandlers)
23404
23417
  : '';
@@ -23421,7 +23434,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
23421
23434
  // Print a developer-friendly error.
23422
23435
  devUtils.error('Error: %s', message);
23423
23436
  // Throw an exception to halt request processing and not perform the original request.
23424
- throw new Error('Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.');
23437
+ throw new Error(devUtils.formatMessage('Cannot bypass a request when using the "error" strategy for the "onUnhandledRequest" option.'));
23425
23438
  }
23426
23439
  case 'warn': {
23427
23440
  devUtils.warn('Warning: %s', message);
@@ -23435,8 +23448,8 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
23435
23448
  }
23436
23449
 
23437
23450
  function readResponseCookies(request, response) {
23438
- lib$1.store.add(Object.assign(Object.assign({}, request), { url: request.url.toString() }), response);
23439
- lib$1.store.persist();
23451
+ lib$2.store.add(Object.assign(Object.assign({}, request), { url: request.url.toString() }), response);
23452
+ lib$2.store.persist();
23440
23453
  }
23441
23454
 
23442
23455
  function handleRequest(request, handlers, options, emitter, handleRequestOptions) {
@@ -23757,13 +23770,13 @@ If this message still persists after updating, please report an issue: https://g
23757
23770
  };
23758
23771
  }
23759
23772
 
23760
- var lib = {};
23773
+ var lib$1 = {};
23761
23774
 
23762
23775
  var createInterceptor$1 = {};
23763
23776
 
23764
23777
  Object.defineProperty(createInterceptor$1, "__esModule", { value: true });
23765
23778
  createInterceptor$1.createInterceptor = void 0;
23766
- var strict_event_emitter_1$1 = lib$4;
23779
+ var strict_event_emitter_1$1 = lib$5;
23767
23780
  function createInterceptor(options) {
23768
23781
  var observer = new strict_event_emitter_1$1.StrictEventEmitter();
23769
23782
  var cleanupFns = [];
@@ -23789,11 +23802,147 @@ If this message still persists after updating, please report an issue: https://g
23789
23802
 
23790
23803
  var remote = {};
23791
23804
 
23805
+ var lib = {};
23806
+
23807
+ var invariant$1 = {};
23808
+
23809
+ var format$1 = {};
23810
+
23811
+ Object.defineProperty(format$1, "__esModule", { value: true });
23812
+ format$1.format = void 0;
23813
+ var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
23814
+ function serializePositional(positional, flag) {
23815
+ switch (flag) {
23816
+ // Strings.
23817
+ case 's':
23818
+ return positional;
23819
+ // Digits.
23820
+ case 'd':
23821
+ case 'i':
23822
+ return Number(positional);
23823
+ // JSON.
23824
+ case 'j':
23825
+ return JSON.stringify(positional);
23826
+ // Objects.
23827
+ case 'o': {
23828
+ // Preserve stings to prevent extra quotes around them.
23829
+ if (typeof positional === 'string') {
23830
+ return positional;
23831
+ }
23832
+ var json = JSON.stringify(positional);
23833
+ // If the positional isn't serializable, return it as-is.
23834
+ if (json === '{}' || json === '[]' || /^\[object .+?\]$/.test(json)) {
23835
+ return positional;
23836
+ }
23837
+ return json;
23838
+ }
23839
+ }
23840
+ }
23841
+ function format(message) {
23842
+ var positionals = [];
23843
+ for (var _i = 1; _i < arguments.length; _i++) {
23844
+ positionals[_i - 1] = arguments[_i];
23845
+ }
23846
+ if (positionals.length === 0) {
23847
+ return message;
23848
+ }
23849
+ var positionalIndex = 0;
23850
+ var formattedMessage = message.replace(POSITIONALS_EXP, function (match, isEscaped, _, flag) {
23851
+ var positional = positionals[positionalIndex];
23852
+ var value = serializePositional(positional, flag);
23853
+ if (!isEscaped) {
23854
+ positionalIndex++;
23855
+ return value;
23856
+ }
23857
+ return match;
23858
+ });
23859
+ // Append unresolved positionals to string as-is.
23860
+ if (positionalIndex < positionals.length) {
23861
+ formattedMessage += " " + positionals.slice(positionalIndex).join(' ');
23862
+ }
23863
+ formattedMessage = formattedMessage.replace(/%{2,2}/g, '%');
23864
+ return formattedMessage;
23865
+ }
23866
+ format$1.format = format;
23867
+
23868
+ var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
23869
+ var extendStatics = function (d, b) {
23870
+ extendStatics = Object.setPrototypeOf ||
23871
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
23872
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23873
+ return extendStatics(d, b);
23874
+ };
23875
+ return function (d, b) {
23876
+ if (typeof b !== "function" && b !== null)
23877
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
23878
+ extendStatics(d, b);
23879
+ function __() { this.constructor = d; }
23880
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
23881
+ };
23882
+ })();
23883
+ var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
23884
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
23885
+ to[j] = from[i];
23886
+ return to;
23887
+ };
23888
+ Object.defineProperty(invariant$1, "__esModule", { value: true });
23889
+ invariant$1.invariant = invariant$1.InvariantError = void 0;
23890
+ var format_1 = format$1;
23891
+ var STACK_FRAMES_TO_IGNORE = 2;
23892
+ var InvariantError = /** @class */ (function (_super) {
23893
+ __extends$1(InvariantError, _super);
23894
+ function InvariantError(message) {
23895
+ var positionals = [];
23896
+ for (var _i = 1; _i < arguments.length; _i++) {
23897
+ positionals[_i - 1] = arguments[_i];
23898
+ }
23899
+ var _this = _super.call(this, message) || this;
23900
+ _this.name = 'Invariant Violation';
23901
+ _this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
23902
+ if (_this.stack) {
23903
+ var prevStack = _this.stack;
23904
+ _this.stack = prevStack
23905
+ .split('\n')
23906
+ .slice(STACK_FRAMES_TO_IGNORE)
23907
+ .join('\n');
23908
+ }
23909
+ return _this;
23910
+ }
23911
+ return InvariantError;
23912
+ }(Error));
23913
+ invariant$1.InvariantError = InvariantError;
23914
+ function invariant(predicate, message) {
23915
+ var positionals = [];
23916
+ for (var _i = 2; _i < arguments.length; _i++) {
23917
+ positionals[_i - 2] = arguments[_i];
23918
+ }
23919
+ if (!predicate) {
23920
+ throw new (InvariantError.bind.apply(InvariantError, __spreadArray([void 0, message], positionals)))();
23921
+ }
23922
+ }
23923
+ invariant$1.invariant = invariant;
23924
+
23925
+ (function (exports) {
23926
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23927
+ if (k2 === undefined) k2 = k;
23928
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23929
+ }) : (function(o, m, k, k2) {
23930
+ if (k2 === undefined) k2 = k;
23931
+ o[k2] = m[k];
23932
+ }));
23933
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
23934
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23935
+ };
23936
+ Object.defineProperty(exports, "__esModule", { value: true });
23937
+ __exportStar(invariant$1, exports);
23938
+ __exportStar(format$1, exports);
23939
+ }(lib));
23940
+
23792
23941
  var toIsoResponse$1 = {};
23793
23942
 
23794
23943
  Object.defineProperty(toIsoResponse$1, "__esModule", { value: true });
23795
23944
  toIsoResponse$1.toIsoResponse = void 0;
23796
- var headers_utils_1$3 = lib$6;
23945
+ var headers_utils_1$3 = lib$7;
23797
23946
  /**
23798
23947
  * Converts a given mocked response object into an isomorphic response.
23799
23948
  */
@@ -23872,9 +24021,9 @@ If this message still persists after updating, please report an issue: https://g
23872
24021
  };
23873
24022
  Object.defineProperty(remote, "__esModule", { value: true });
23874
24023
  remote.createRemoteResolver = remote.createRemoteInterceptor = void 0;
23875
- var headers_utils_1$2 = lib$6;
23876
- var outvariant_1 = lib$2;
23877
- var strict_event_emitter_1 = lib$4;
24024
+ var headers_utils_1$2 = lib$7;
24025
+ var outvariant_1 = lib;
24026
+ var strict_event_emitter_1 = lib$5;
23878
24027
  var createInterceptor_1 = createInterceptor$1;
23879
24028
  var toIsoResponse_1$2 = toIsoResponse$1;
23880
24029
  function requestReviver(key, value) {
@@ -24003,7 +24152,7 @@ If this message still persists after updating, please report an issue: https://g
24003
24152
  var getCleanUrl_1 = getCleanUrl$1;
24004
24153
  Object.defineProperty(exports, "getCleanUrl", { enumerable: true, get: function () { return getCleanUrl_1.getCleanUrl; } });
24005
24154
 
24006
- }(lib));
24155
+ }(lib$1));
24007
24156
 
24008
24157
  var fetch = {};
24009
24158
 
@@ -24011,14 +24160,14 @@ If this message still persists after updating, please report an issue: https://g
24011
24160
 
24012
24161
  Object.defineProperty(uuid, "__esModule", { value: true });
24013
24162
  uuid.uuidv4 = void 0;
24014
- function uuidv4$1() {
24163
+ function uuidv4() {
24015
24164
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
24016
24165
  var r = (Math.random() * 16) | 0;
24017
24166
  var v = c == 'x' ? r : (r & 0x3) | 0x8;
24018
24167
  return v.toString(16);
24019
24168
  });
24020
24169
  }
24021
- uuid.uuidv4 = uuidv4$1;
24170
+ uuid.uuidv4 = uuidv4;
24022
24171
 
24023
24172
  var browser = {exports: {}};
24024
24173
 
@@ -24780,7 +24929,7 @@ If this message still persists after updating, please report an issue: https://g
24780
24929
  };
24781
24930
  Object.defineProperty(fetch, "__esModule", { value: true });
24782
24931
  var interceptFetch_1 = fetch.interceptFetch = void 0;
24783
- var headers_utils_1$1 = lib$6;
24932
+ var headers_utils_1$1 = lib$7;
24784
24933
  var toIsoResponse_1$1 = toIsoResponse$1;
24785
24934
  var uuid_1$1 = uuid;
24786
24935
  var debug$1 = browser.exports('fetch');
@@ -27882,8 +28031,8 @@ If this message still persists after updating, please report an issue: https://g
27882
28031
  * XMLHttpRequest override class.
27883
28032
  * Inspired by https://github.com/marvinhagemeister/xhr-mocklet.
27884
28033
  */
27885
- var until_1 = lib$3;
27886
- var headers_utils_1 = lib$6;
28034
+ var until_1 = lib$4;
28035
+ var headers_utils_1 = lib$7;
27887
28036
  var xmldom_1 = domParser;
27888
28037
  var parseJson_1 = parseJson$1;
27889
28038
  var toIsoResponse_1 = toIsoResponse$1;
@@ -28296,22 +28445,12 @@ If this message still persists after updating, please report an issue: https://g
28296
28445
  };
28297
28446
  interceptXMLHttpRequest_1 = XMLHttpRequest.interceptXMLHttpRequest = interceptXMLHttpRequest;
28298
28447
 
28299
- function uuidv4() {
28300
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
28301
- const r = (Math.random() * 16) | 0;
28302
- const v = c == 'x' ? r : (r & 0x3) | 0x8;
28303
- return v.toString(16);
28304
- });
28305
- }
28306
-
28307
28448
  /**
28308
28449
  * Converts a given isomorphic request to a `MockedRequest` instance.
28309
28450
  */
28310
28451
  function parseIsomorphicRequest(request) {
28311
- const requestId = uuidv4();
28312
- request.headers.set('x-msw-request-id', requestId);
28313
28452
  const mockedRequest = {
28314
- id: requestId,
28453
+ id: request.id,
28315
28454
  url: request.url,
28316
28455
  method: request.method,
28317
28456
  body: parseBody(request.body, request.headers),
@@ -28345,7 +28484,7 @@ If this message still persists after updating, please report an issue: https://g
28345
28484
  }
28346
28485
 
28347
28486
  function createFallbackRequestListener(context, options) {
28348
- const interceptor = lib.createInterceptor({
28487
+ const interceptor = lib$1.createInterceptor({
28349
28488
  modules: [interceptFetch_1, interceptXMLHttpRequest_1],
28350
28489
  resolver(request) {
28351
28490
  return __awaiter$3(this, void 0, void 0, function* () {
@@ -28425,11 +28564,11 @@ If this message still persists after updating, please report an issue: https://g
28425
28564
  throw new Error(devUtils.formatMessage('Failed to call "setupWorker" given an Array of request handlers (setupWorker([a, b])), expected to receive each handler individually: setupWorker(a, b).'));
28426
28565
  });
28427
28566
  // Error when attempting to run this function in a Node.js environment.
28428
- if (lib$5.exports.isNodeProcess()) {
28567
+ if (lib$6.exports.isNodeProcess()) {
28429
28568
  throw new Error(devUtils.formatMessage('Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead.'));
28430
28569
  }
28431
- const emitter = new lib$4.StrictEventEmitter();
28432
- const publicEmitter = new lib$4.StrictEventEmitter();
28570
+ const emitter = new lib$5.StrictEventEmitter();
28571
+ const publicEmitter = new lib$5.StrictEventEmitter();
28433
28572
  pipeEvents(emitter, publicEmitter);
28434
28573
  const context = {
28435
28574
  startOptions: undefined,