msw 0.36.2 → 0.36.7
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/README.md +45 -6
- package/lib/esm/RequestHandler-deps.js +24 -9
- package/lib/esm/fetch-deps.js +3 -1
- package/lib/esm/index.js +1 -11
- package/lib/esm/mockServiceWorker.js +1 -1
- package/lib/iife/index.js +3 -3
- package/lib/iife/mockServiceWorker.js +1 -1
- package/lib/types/handlers/RequestHandler.d.ts +1 -1
- package/lib/types/utils/handleRequest.d.ts +1 -1
- package/lib/types/utils/logging/prepareResponse.d.ts +1 -1
- package/lib/types/utils/matching/matchRequestUrl.d.ts +1 -1
- package/lib/types/utils/request/parseBody.d.ts +1 -1
- package/lib/types/utils/url/isAbsoluteUrl.d.ts +4 -0
- package/lib/umd/index.js +300 -140
- package/lib/umd/mockServiceWorker.js +1 -1
- package/native/lib/index.js +31 -25
- package/node/lib/index.js +31 -25
- package/package.json +15 -6
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
1056
|
+
const useFetch = lib$6.exports.isNodeProcess() ? require('node-fetch') : window.fetch;
|
|
1057
1057
|
const augmentRequestInit = (requestInit) => {
|
|
1058
|
-
const headers = new lib$
|
|
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
|
};
|
|
@@ -1065,7 +1065,9 @@
|
|
|
1065
1065
|
if (['GET', 'HEAD'].includes(method)) {
|
|
1066
1066
|
return requestParameters;
|
|
1067
1067
|
}
|
|
1068
|
-
if (typeof body === 'object' ||
|
|
1068
|
+
if (typeof body === 'object' ||
|
|
1069
|
+
typeof body === 'number' ||
|
|
1070
|
+
typeof body === 'boolean') {
|
|
1069
1071
|
requestParameters.body = JSON.stringify(body);
|
|
1070
1072
|
}
|
|
1071
1073
|
else {
|
|
@@ -1133,7 +1135,7 @@
|
|
|
1133
1135
|
xml: xml
|
|
1134
1136
|
});
|
|
1135
1137
|
|
|
1136
|
-
var lib$
|
|
1138
|
+
var lib$5 = {};
|
|
1137
1139
|
|
|
1138
1140
|
var StrictEventEmitter$1 = {};
|
|
1139
1141
|
|
|
@@ -1613,7 +1615,7 @@
|
|
|
1613
1615
|
}
|
|
1614
1616
|
}
|
|
1615
1617
|
|
|
1616
|
-
var __extends$
|
|
1618
|
+
var __extends$3 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
1617
1619
|
var extendStatics = function (d, b) {
|
|
1618
1620
|
extendStatics = Object.setPrototypeOf ||
|
|
1619
1621
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -1637,7 +1639,7 @@
|
|
|
1637
1639
|
StrictEventEmitter$1.StrictEventEmitter = void 0;
|
|
1638
1640
|
var events_1 = events.exports;
|
|
1639
1641
|
var StrictEventEmitter = /** @class */ (function (_super) {
|
|
1640
|
-
__extends$
|
|
1642
|
+
__extends$3(StrictEventEmitter, _super);
|
|
1641
1643
|
function StrictEventEmitter() {
|
|
1642
1644
|
return _super.call(this) || this;
|
|
1643
1645
|
}
|
|
@@ -1679,7 +1681,7 @@
|
|
|
1679
1681
|
exports.StrictEventEmitter = void 0;
|
|
1680
1682
|
var StrictEventEmitter_1 = StrictEventEmitter$1;
|
|
1681
1683
|
__createBinding(exports, StrictEventEmitter_1, "StrictEventEmitter");
|
|
1682
|
-
}(lib$
|
|
1684
|
+
}(lib$5));
|
|
1683
1685
|
|
|
1684
1686
|
/*! *****************************************************************************
|
|
1685
1687
|
Copyright (c) Microsoft Corporation.
|
|
@@ -1718,7 +1720,7 @@
|
|
|
1718
1720
|
});
|
|
1719
1721
|
}
|
|
1720
1722
|
|
|
1721
|
-
var lib$
|
|
1723
|
+
var lib$4 = {};
|
|
1722
1724
|
|
|
1723
1725
|
var until$1 = {};
|
|
1724
1726
|
|
|
@@ -1740,9 +1742,9 @@
|
|
|
1740
1742
|
}
|
|
1741
1743
|
};
|
|
1742
1744
|
|
|
1743
|
-
Object.defineProperty(lib$
|
|
1745
|
+
Object.defineProperty(lib$4, "__esModule", { value: true });
|
|
1744
1746
|
var until_1$1 = until$1;
|
|
1745
|
-
var until = lib$
|
|
1747
|
+
var until = lib$4.until = until_1$1.until;
|
|
1746
1748
|
|
|
1747
1749
|
/**
|
|
1748
1750
|
* Attempts to resolve a Service Worker instance from a given registration,
|
|
@@ -1769,16 +1771,16 @@
|
|
|
1769
1771
|
return new URL(relativeUrl, location.origin).href;
|
|
1770
1772
|
}
|
|
1771
1773
|
|
|
1772
|
-
var lib$
|
|
1774
|
+
var lib$3 = {};
|
|
1773
1775
|
|
|
1774
|
-
var invariant$
|
|
1776
|
+
var invariant$5 = {};
|
|
1775
1777
|
|
|
1776
|
-
var format$
|
|
1778
|
+
var format$3 = {};
|
|
1777
1779
|
|
|
1778
|
-
Object.defineProperty(format$
|
|
1779
|
-
format$
|
|
1780
|
-
var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
|
|
1781
|
-
function serializePositional(positional, flag) {
|
|
1780
|
+
Object.defineProperty(format$3, "__esModule", { value: true });
|
|
1781
|
+
format$3.format = void 0;
|
|
1782
|
+
var POSITIONALS_EXP$1 = /(%?)(%([sdjo]))/g;
|
|
1783
|
+
function serializePositional$1(positional, flag) {
|
|
1782
1784
|
switch (flag) {
|
|
1783
1785
|
// Strings.
|
|
1784
1786
|
case 's':
|
|
@@ -1805,7 +1807,7 @@
|
|
|
1805
1807
|
}
|
|
1806
1808
|
}
|
|
1807
1809
|
}
|
|
1808
|
-
function format(message) {
|
|
1810
|
+
function format$2(message) {
|
|
1809
1811
|
var positionals = [];
|
|
1810
1812
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1811
1813
|
positionals[_i - 1] = arguments[_i];
|
|
@@ -1814,9 +1816,9 @@
|
|
|
1814
1816
|
return message;
|
|
1815
1817
|
}
|
|
1816
1818
|
var positionalIndex = 0;
|
|
1817
|
-
var formattedMessage = message.replace(POSITIONALS_EXP, function (match, isEscaped, _, flag) {
|
|
1819
|
+
var formattedMessage = message.replace(POSITIONALS_EXP$1, function (match, isEscaped, _, flag) {
|
|
1818
1820
|
var positional = positionals[positionalIndex];
|
|
1819
|
-
var value = serializePositional(positional, flag);
|
|
1821
|
+
var value = serializePositional$1(positional, flag);
|
|
1820
1822
|
if (!isEscaped) {
|
|
1821
1823
|
positionalIndex++;
|
|
1822
1824
|
return value;
|
|
@@ -1830,9 +1832,9 @@
|
|
|
1830
1832
|
formattedMessage = formattedMessage.replace(/%{2,2}/g, '%');
|
|
1831
1833
|
return formattedMessage;
|
|
1832
1834
|
}
|
|
1833
|
-
format$
|
|
1835
|
+
format$3.format = format$2;
|
|
1834
1836
|
|
|
1835
|
-
var __extends$
|
|
1837
|
+
var __extends$2 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
1836
1838
|
var extendStatics = function (d, b) {
|
|
1837
1839
|
extendStatics = Object.setPrototypeOf ||
|
|
1838
1840
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
@@ -1847,17 +1849,17 @@
|
|
|
1847
1849
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
1848
1850
|
};
|
|
1849
1851
|
})();
|
|
1850
|
-
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
|
|
1852
|
+
var __spreadArray$1 = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
|
|
1851
1853
|
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
1852
1854
|
to[j] = from[i];
|
|
1853
1855
|
return to;
|
|
1854
1856
|
};
|
|
1855
|
-
Object.defineProperty(invariant$
|
|
1856
|
-
invariant$
|
|
1857
|
-
var format_1 = format$
|
|
1858
|
-
var STACK_FRAMES_TO_IGNORE = 2;
|
|
1859
|
-
var InvariantError = /** @class */ (function (_super) {
|
|
1860
|
-
__extends$
|
|
1857
|
+
Object.defineProperty(invariant$5, "__esModule", { value: true });
|
|
1858
|
+
invariant$5.invariant = invariant$5.InvariantError = void 0;
|
|
1859
|
+
var format_1$1 = format$3;
|
|
1860
|
+
var STACK_FRAMES_TO_IGNORE$1 = 2;
|
|
1861
|
+
var InvariantError$1 = /** @class */ (function (_super) {
|
|
1862
|
+
__extends$2(InvariantError, _super);
|
|
1861
1863
|
function InvariantError(message) {
|
|
1862
1864
|
var positionals = [];
|
|
1863
1865
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -1865,29 +1867,27 @@
|
|
|
1865
1867
|
}
|
|
1866
1868
|
var _this = _super.call(this, message) || this;
|
|
1867
1869
|
_this.name = 'Invariant Violation';
|
|
1868
|
-
_this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
|
|
1870
|
+
_this.message = format_1$1.format.apply(void 0, __spreadArray$1([message], positionals));
|
|
1869
1871
|
if (_this.stack) {
|
|
1870
|
-
var
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
.slice(STACK_FRAMES_TO_IGNORE)
|
|
1874
|
-
.join('\n');
|
|
1872
|
+
var nextStack = _this.stack.split('\n');
|
|
1873
|
+
nextStack.splice(1, STACK_FRAMES_TO_IGNORE$1);
|
|
1874
|
+
_this.stack = nextStack.join('\n');
|
|
1875
1875
|
}
|
|
1876
1876
|
return _this;
|
|
1877
1877
|
}
|
|
1878
1878
|
return InvariantError;
|
|
1879
1879
|
}(Error));
|
|
1880
|
-
invariant$
|
|
1881
|
-
function invariant$
|
|
1880
|
+
invariant$5.InvariantError = InvariantError$1;
|
|
1881
|
+
function invariant$4(predicate, message) {
|
|
1882
1882
|
var positionals = [];
|
|
1883
1883
|
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1884
1884
|
positionals[_i - 2] = arguments[_i];
|
|
1885
1885
|
}
|
|
1886
1886
|
if (!predicate) {
|
|
1887
|
-
throw new (InvariantError.bind.apply(InvariantError, __spreadArray([void 0, message], positionals)))();
|
|
1887
|
+
throw new (InvariantError$1.bind.apply(InvariantError$1, __spreadArray$1([void 0, message], positionals)))();
|
|
1888
1888
|
}
|
|
1889
1889
|
}
|
|
1890
|
-
invariant$
|
|
1890
|
+
invariant$5.invariant = invariant$4;
|
|
1891
1891
|
|
|
1892
1892
|
(function (exports) {
|
|
1893
1893
|
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -1901,16 +1901,16 @@
|
|
|
1901
1901
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1902
1902
|
};
|
|
1903
1903
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1904
|
-
__exportStar(invariant$
|
|
1905
|
-
__exportStar(format$
|
|
1906
|
-
}(lib$
|
|
1904
|
+
__exportStar(invariant$5, exports);
|
|
1905
|
+
__exportStar(format$3, exports);
|
|
1906
|
+
}(lib$3));
|
|
1907
1907
|
|
|
1908
1908
|
const LIBRARY_PREFIX = '[MSW]';
|
|
1909
1909
|
/**
|
|
1910
1910
|
* Formats a given message by appending the library's prefix string.
|
|
1911
1911
|
*/
|
|
1912
1912
|
function formatMessage(message, ...positionals) {
|
|
1913
|
-
const interpolatedMessage = lib$
|
|
1913
|
+
const interpolatedMessage = lib$3.format(message, ...positionals);
|
|
1914
1914
|
return `${LIBRARY_PREFIX} ${interpolatedMessage}`;
|
|
1915
1915
|
}
|
|
1916
1916
|
/**
|
|
@@ -2041,7 +2041,7 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
|
|
2044
|
-
var lib$
|
|
2044
|
+
var lib$2 = {};
|
|
2045
2045
|
|
|
2046
2046
|
var CookieStore = {};
|
|
2047
2047
|
|
|
@@ -2261,10 +2261,22 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
2261
2261
|
return t;
|
|
2262
2262
|
};
|
|
2263
2263
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2264
|
-
exports.PERSISTENCY_KEY = void 0;
|
|
2264
|
+
exports.store = exports.PERSISTENCY_KEY = void 0;
|
|
2265
2265
|
const set_cookie_parser_1 = setCookie.exports;
|
|
2266
2266
|
exports.PERSISTENCY_KEY = 'MSW_COOKIE_STORE';
|
|
2267
|
-
|
|
2267
|
+
function supportsLocalStorage() {
|
|
2268
|
+
try {
|
|
2269
|
+
if (localStorage == null) {
|
|
2270
|
+
return false;
|
|
2271
|
+
}
|
|
2272
|
+
localStorage.setItem('test', 'test');
|
|
2273
|
+
localStorage.getItem('test');
|
|
2274
|
+
return true;
|
|
2275
|
+
}
|
|
2276
|
+
catch (error) {
|
|
2277
|
+
return false;
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2268
2280
|
class CookieStore {
|
|
2269
2281
|
constructor() {
|
|
2270
2282
|
this.store = new Map();
|
|
@@ -2339,27 +2351,29 @@ Learn more about creating the Service Worker script: https://mswjs.io/docs/cli/i
|
|
|
2339
2351
|
* Hydrates the virtual cookie store from the `localStorage` if defined.
|
|
2340
2352
|
*/
|
|
2341
2353
|
hydrate() {
|
|
2342
|
-
if (!
|
|
2354
|
+
if (!supportsLocalStorage()) {
|
|
2343
2355
|
return;
|
|
2344
2356
|
}
|
|
2345
2357
|
const persistedCookies = localStorage.getItem(exports.PERSISTENCY_KEY);
|
|
2346
|
-
if (persistedCookies) {
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2358
|
+
if (!persistedCookies) {
|
|
2359
|
+
return;
|
|
2360
|
+
}
|
|
2361
|
+
try {
|
|
2362
|
+
const parsedCookies = JSON.parse(persistedCookies);
|
|
2363
|
+
parsedCookies.forEach(([origin, cookies]) => {
|
|
2364
|
+
this.store.set(origin, new Map(cookies.map((_a) => {
|
|
2365
|
+
var [token, _b] = _a, { expires } = _b, cookie = __rest(_b, ["expires"]);
|
|
2366
|
+
return [
|
|
2367
|
+
token,
|
|
2368
|
+
expires === undefined
|
|
2369
|
+
? cookie
|
|
2370
|
+
: Object.assign(Object.assign({}, cookie), { expires: new Date(expires) }),
|
|
2371
|
+
];
|
|
2372
|
+
})));
|
|
2373
|
+
});
|
|
2374
|
+
}
|
|
2375
|
+
catch (error) {
|
|
2376
|
+
console.warn(`
|
|
2363
2377
|
[virtual-cookie] Failed to parse a stored cookie from the localStorage (key "${exports.PERSISTENCY_KEY}").
|
|
2364
2378
|
|
|
2365
2379
|
Stored value:
|
|
@@ -2369,8 +2383,7 @@ Thrown exception:
|
|
|
2369
2383
|
${error}
|
|
2370
2384
|
|
|
2371
2385
|
Invalid value has been removed from localStorage to prevent subsequent failed parsing attempts.`);
|
|
2372
|
-
|
|
2373
|
-
}
|
|
2386
|
+
localStorage.removeItem(exports.PERSISTENCY_KEY);
|
|
2374
2387
|
}
|
|
2375
2388
|
}
|
|
2376
2389
|
/**
|
|
@@ -2378,7 +2391,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2378
2391
|
* so they are available on the next page load.
|
|
2379
2392
|
*/
|
|
2380
2393
|
persist() {
|
|
2381
|
-
if (!
|
|
2394
|
+
if (!supportsLocalStorage()) {
|
|
2382
2395
|
return;
|
|
2383
2396
|
}
|
|
2384
2397
|
const serializedCookies = Array.from(this.store.entries()).map(([origin, cookies]) => {
|
|
@@ -2400,19 +2413,23 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2400
2413
|
});
|
|
2401
2414
|
}
|
|
2402
2415
|
}
|
|
2403
|
-
exports.
|
|
2416
|
+
exports.store = new CookieStore();
|
|
2404
2417
|
}(CookieStore));
|
|
2405
2418
|
|
|
2406
2419
|
(function (exports) {
|
|
2407
|
-
var
|
|
2408
|
-
|
|
2420
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
2421
|
+
if (k2 === undefined) k2 = k;
|
|
2422
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
2423
|
+
}) : (function(o, m, k, k2) {
|
|
2424
|
+
if (k2 === undefined) k2 = k;
|
|
2425
|
+
o[k2] = m[k];
|
|
2426
|
+
}));
|
|
2427
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
2428
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2409
2429
|
};
|
|
2410
2430
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
Object.defineProperty(exports, "store", { enumerable: true, get: function () { return __importDefault(CookieStore_1).default; } });
|
|
2414
|
-
Object.defineProperty(exports, "PERSISTENCY_KEY", { enumerable: true, get: function () { return CookieStore_1.PERSISTENCY_KEY; } });
|
|
2415
|
-
}(lib$1));
|
|
2431
|
+
__exportStar(CookieStore, exports);
|
|
2432
|
+
}(lib$2));
|
|
2416
2433
|
|
|
2417
2434
|
function getAllCookies() {
|
|
2418
2435
|
return parse_1(document.cookie);
|
|
@@ -2445,8 +2462,8 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2445
2462
|
|
|
2446
2463
|
function setRequestCookies(request) {
|
|
2447
2464
|
var _a;
|
|
2448
|
-
lib$
|
|
2449
|
-
request.cookies = Object.assign(Object.assign({}, getRequestCookies(request)), Array.from((_a = lib$
|
|
2465
|
+
lib$2.store.hydrate();
|
|
2466
|
+
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
2467
|
request.headers.set('cookie', Object.entries(request.cookies)
|
|
2451
2468
|
.map(([name, value]) => `${name}=${value}`)
|
|
2452
2469
|
.join('; '));
|
|
@@ -2454,7 +2471,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2454
2471
|
|
|
2455
2472
|
function parseContentHeaders(headersString) {
|
|
2456
2473
|
var _a, _b;
|
|
2457
|
-
const headers = lib$
|
|
2474
|
+
const headers = lib$7.stringToHeaders(headersString);
|
|
2458
2475
|
const contentType = headers.get('content-type') || 'text/plain';
|
|
2459
2476
|
const disposition = headers.get('content-disposition');
|
|
2460
2477
|
if (!disposition) {
|
|
@@ -2528,11 +2545,12 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2528
2545
|
* Parses a given request/response body based on the "Content-Type" header.
|
|
2529
2546
|
*/
|
|
2530
2547
|
function parseBody(body, headers) {
|
|
2548
|
+
var _a;
|
|
2531
2549
|
// Return whatever falsey body value is given.
|
|
2532
2550
|
if (!body) {
|
|
2533
2551
|
return body;
|
|
2534
2552
|
}
|
|
2535
|
-
const contentType = (headers === null || headers === void 0 ? void 0 : headers.get('content-type')) || '';
|
|
2553
|
+
const contentType = ((_a = headers === null || headers === void 0 ? void 0 : headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
2536
2554
|
// If the body has a Multipart Content-Type
|
|
2537
2555
|
// parse it into an object.
|
|
2538
2556
|
const hasMultipartContent = contentType.startsWith('multipart/form-data');
|
|
@@ -2590,7 +2608,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
2590
2608
|
destination: rawRequest.destination,
|
|
2591
2609
|
body: pruneGetRequestBody(rawRequest),
|
|
2592
2610
|
bodyUsed: rawRequest.bodyUsed,
|
|
2593
|
-
headers: new lib$
|
|
2611
|
+
headers: new lib$7.Headers(rawRequest.headers),
|
|
2594
2612
|
};
|
|
2595
2613
|
// Set document cookies on the request.
|
|
2596
2614
|
setRequestCookies(request);
|
|
@@ -3331,14 +3349,14 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3331
3349
|
|
|
3332
3350
|
var defineInspect$1 = {};
|
|
3333
3351
|
|
|
3334
|
-
var invariant$
|
|
3352
|
+
var invariant$3 = {};
|
|
3335
3353
|
|
|
3336
|
-
Object.defineProperty(invariant$
|
|
3354
|
+
Object.defineProperty(invariant$3, "__esModule", {
|
|
3337
3355
|
value: true
|
|
3338
3356
|
});
|
|
3339
|
-
invariant$
|
|
3357
|
+
invariant$3.default = invariant$2;
|
|
3340
3358
|
|
|
3341
|
-
function invariant(condition, message) {
|
|
3359
|
+
function invariant$2(condition, message) {
|
|
3342
3360
|
var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')
|
|
3343
3361
|
|
|
3344
3362
|
if (!booleanCondition) {
|
|
@@ -3362,7 +3380,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
3362
3380
|
});
|
|
3363
3381
|
defineInspect$1.default = defineInspect;
|
|
3364
3382
|
|
|
3365
|
-
var _invariant$f = _interopRequireDefault$M(invariant$
|
|
3383
|
+
var _invariant$f = _interopRequireDefault$M(invariant$3);
|
|
3366
3384
|
|
|
3367
3385
|
var _nodejsCustomInspectSymbol$1 = _interopRequireDefault$M(nodejsCustomInspectSymbol$1);
|
|
3368
3386
|
|
|
@@ -7503,7 +7521,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
7503
7521
|
|
|
7504
7522
|
var _inspect$q = _interopRequireDefault$B(inspect$1);
|
|
7505
7523
|
|
|
7506
|
-
var _invariant$e = _interopRequireDefault$B(invariant$
|
|
7524
|
+
var _invariant$e = _interopRequireDefault$B(invariant$3);
|
|
7507
7525
|
|
|
7508
7526
|
var _keyValMap$3 = _interopRequireDefault$B(keyValMap$1);
|
|
7509
7527
|
|
|
@@ -9367,7 +9385,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
9367
9385
|
|
|
9368
9386
|
var _inspect$n = _interopRequireDefault$y(inspect$1);
|
|
9369
9387
|
|
|
9370
|
-
var _invariant$d = _interopRequireDefault$y(invariant$
|
|
9388
|
+
var _invariant$d = _interopRequireDefault$y(invariant$3);
|
|
9371
9389
|
|
|
9372
9390
|
var _isObjectLike$5 = _interopRequireDefault$y(isObjectLike$1);
|
|
9373
9391
|
|
|
@@ -9561,7 +9579,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
9561
9579
|
|
|
9562
9580
|
var _inspect$m = _interopRequireDefault$x(inspect$1);
|
|
9563
9581
|
|
|
9564
|
-
var _invariant$c = _interopRequireDefault$x(invariant$
|
|
9582
|
+
var _invariant$c = _interopRequireDefault$x(invariant$3);
|
|
9565
9583
|
|
|
9566
9584
|
var _printer$8 = printer;
|
|
9567
9585
|
|
|
@@ -11313,7 +11331,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
11313
11331
|
|
|
11314
11332
|
var _inspect$i = _interopRequireDefault$t(inspect$1);
|
|
11315
11333
|
|
|
11316
|
-
var _invariant$b = _interopRequireDefault$t(invariant$
|
|
11334
|
+
var _invariant$b = _interopRequireDefault$t(invariant$3);
|
|
11317
11335
|
|
|
11318
11336
|
var _kinds$j = kinds;
|
|
11319
11337
|
|
|
@@ -12642,7 +12660,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
12642
12660
|
|
|
12643
12661
|
var _inspect$f = _interopRequireDefault$n(inspect$1);
|
|
12644
12662
|
|
|
12645
|
-
var _invariant$a = _interopRequireDefault$n(invariant$
|
|
12663
|
+
var _invariant$a = _interopRequireDefault$n(invariant$3);
|
|
12646
12664
|
|
|
12647
12665
|
var _GraphQLError$n = GraphQLError$1;
|
|
12648
12666
|
|
|
@@ -14302,7 +14320,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
14302
14320
|
|
|
14303
14321
|
var _inspect$a = _interopRequireDefault$h(inspect$1);
|
|
14304
14322
|
|
|
14305
|
-
var _invariant$9 = _interopRequireDefault$h(invariant$
|
|
14323
|
+
var _invariant$9 = _interopRequireDefault$h(invariant$3);
|
|
14306
14324
|
|
|
14307
14325
|
var _didYouMean$1 = _interopRequireDefault$h(didYouMean$1);
|
|
14308
14326
|
|
|
@@ -15131,7 +15149,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
15131
15149
|
|
|
15132
15150
|
var _inspect$9 = _interopRequireDefault$e(inspect$1);
|
|
15133
15151
|
|
|
15134
|
-
var _invariant$8 = _interopRequireDefault$e(invariant$
|
|
15152
|
+
var _invariant$8 = _interopRequireDefault$e(invariant$3);
|
|
15135
15153
|
|
|
15136
15154
|
var _kinds$6 = kinds;
|
|
15137
15155
|
|
|
@@ -15316,7 +15334,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
15316
15334
|
|
|
15317
15335
|
var _inspect$8 = _interopRequireDefault$d(inspect$1);
|
|
15318
15336
|
|
|
15319
|
-
var _invariant$7 = _interopRequireDefault$d(invariant$
|
|
15337
|
+
var _invariant$7 = _interopRequireDefault$d(invariant$3);
|
|
15320
15338
|
|
|
15321
15339
|
var _didYouMean = _interopRequireDefault$d(didYouMean$1);
|
|
15322
15340
|
|
|
@@ -15697,7 +15715,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
15697
15715
|
|
|
15698
15716
|
var _memoize = _interopRequireDefault$b(memoize3$1);
|
|
15699
15717
|
|
|
15700
|
-
var _invariant$6 = _interopRequireDefault$b(invariant$
|
|
15718
|
+
var _invariant$6 = _interopRequireDefault$b(invariant$3);
|
|
15701
15719
|
|
|
15702
15720
|
var _devAssert$4 = _interopRequireDefault$b(devAssert$1);
|
|
15703
15721
|
|
|
@@ -17748,7 +17766,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
17748
17766
|
});
|
|
17749
17767
|
NoDeprecatedCustomRule$1.NoDeprecatedCustomRule = NoDeprecatedCustomRule;
|
|
17750
17768
|
|
|
17751
|
-
var _invariant$5 = _interopRequireDefault$8(invariant$
|
|
17769
|
+
var _invariant$5 = _interopRequireDefault$8(invariant$3);
|
|
17752
17770
|
|
|
17753
17771
|
var _GraphQLError$1 = GraphQLError$1;
|
|
17754
17772
|
|
|
@@ -18333,7 +18351,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
18333
18351
|
});
|
|
18334
18352
|
introspectionFromSchema$1.introspectionFromSchema = introspectionFromSchema;
|
|
18335
18353
|
|
|
18336
|
-
var _invariant$4 = _interopRequireDefault$6(invariant$
|
|
18354
|
+
var _invariant$4 = _interopRequireDefault$6(invariant$3);
|
|
18337
18355
|
|
|
18338
18356
|
var _parser$2 = parser;
|
|
18339
18357
|
|
|
@@ -18730,7 +18748,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
18730
18748
|
|
|
18731
18749
|
var _mapValue = _interopRequireDefault$4(mapValue$1);
|
|
18732
18750
|
|
|
18733
|
-
var _invariant$3 = _interopRequireDefault$4(invariant$
|
|
18751
|
+
var _invariant$3 = _interopRequireDefault$4(invariant$3);
|
|
18734
18752
|
|
|
18735
18753
|
var _devAssert$1 = _interopRequireDefault$4(devAssert$1);
|
|
18736
18754
|
|
|
@@ -19560,7 +19578,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
19560
19578
|
|
|
19561
19579
|
var _inspect$2 = _interopRequireDefault$2(inspect$1);
|
|
19562
19580
|
|
|
19563
|
-
var _invariant$2 = _interopRequireDefault$2(invariant$
|
|
19581
|
+
var _invariant$2 = _interopRequireDefault$2(invariant$3);
|
|
19564
19582
|
|
|
19565
19583
|
var _keyValMap = _interopRequireDefault$2(keyValMap$1);
|
|
19566
19584
|
|
|
@@ -19765,7 +19783,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
19765
19783
|
|
|
19766
19784
|
var _inspect$1 = _interopRequireDefault$1(inspect$1);
|
|
19767
19785
|
|
|
19768
|
-
var _invariant$1 = _interopRequireDefault$1(invariant$
|
|
19786
|
+
var _invariant$1 = _interopRequireDefault$1(invariant$3);
|
|
19769
19787
|
|
|
19770
19788
|
var _printer$1 = printer;
|
|
19771
19789
|
|
|
@@ -20300,7 +20318,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
20300
20318
|
|
|
20301
20319
|
var _inspect = _interopRequireDefault(inspect$1);
|
|
20302
20320
|
|
|
20303
|
-
var _invariant = _interopRequireDefault(invariant$
|
|
20321
|
+
var _invariant = _interopRequireDefault(invariant$3);
|
|
20304
20322
|
|
|
20305
20323
|
var _naturalCompare = _interopRequireDefault(naturalCompare$1);
|
|
20306
20324
|
|
|
@@ -22446,7 +22464,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22446
22464
|
* Formats a mocked response for introspection in the browser's console.
|
|
22447
22465
|
*/
|
|
22448
22466
|
function prepareResponse(res) {
|
|
22449
|
-
const responseHeaders = lib$
|
|
22467
|
+
const responseHeaders = lib$7.objectToHeaders(res.headers);
|
|
22450
22468
|
return Object.assign(Object.assign({}, res), {
|
|
22451
22469
|
// Parse a response JSON body for preview in the logs
|
|
22452
22470
|
body: parseBody(res.body, responseHeaders) });
|
|
@@ -22885,12 +22903,23 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22885
22903
|
return path.replace(REDUNDANT_CHARACTERS_EXP, '');
|
|
22886
22904
|
}
|
|
22887
22905
|
|
|
22906
|
+
/**
|
|
22907
|
+
* Determines if the given URL string is an absolute URL.
|
|
22908
|
+
*/
|
|
22909
|
+
function isAbsoluteUrl(url) {
|
|
22910
|
+
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
22911
|
+
}
|
|
22912
|
+
|
|
22888
22913
|
/**
|
|
22889
22914
|
* Returns an absolute URL based on the given path.
|
|
22890
22915
|
*/
|
|
22891
22916
|
function getAbsoluteUrl(path, baseUrl) {
|
|
22892
|
-
//
|
|
22893
|
-
if (
|
|
22917
|
+
// already absolute URL
|
|
22918
|
+
if (isAbsoluteUrl(path)) {
|
|
22919
|
+
return path;
|
|
22920
|
+
}
|
|
22921
|
+
// Ignore path with pattern start with *
|
|
22922
|
+
if (path.startsWith('*')) {
|
|
22894
22923
|
return path;
|
|
22895
22924
|
}
|
|
22896
22925
|
// Resolve a relative request URL against a given custom "baseUrl"
|
|
@@ -22938,12 +22967,17 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22938
22967
|
? `${parameterName}${wildcard}`
|
|
22939
22968
|
: `${parameterName}${expression}`;
|
|
22940
22969
|
})
|
|
22970
|
+
/**
|
|
22971
|
+
* Escape the port so that "path-to-regexp" can match
|
|
22972
|
+
* absolute URLs including port numbers.
|
|
22973
|
+
*/
|
|
22974
|
+
.replace(/([^\/])(:)(?=\d+)/, '$1\\$2')
|
|
22941
22975
|
/**
|
|
22942
22976
|
* Escape the protocol so that "path-to-regexp" could match
|
|
22943
22977
|
* absolute URL.
|
|
22944
22978
|
* @see https://github.com/pillarjs/path-to-regexp/issues/259
|
|
22945
22979
|
*/
|
|
22946
|
-
.replace(/^([^\/]+)(:)(?=\/\/)
|
|
22980
|
+
.replace(/^([^\/]+)(:)(?=\/\/)/, '$1\\$2'));
|
|
22947
22981
|
}
|
|
22948
22982
|
/**
|
|
22949
22983
|
* Returns the result of matching given request URL against a mask.
|
|
@@ -22987,7 +23021,7 @@ Invalid value has been removed from localStorage to prevent subsequent failed pa
|
|
|
22987
23021
|
function createResponseComposition(responseOverrides, defaultTransformers = defaultResponseTransformers) {
|
|
22988
23022
|
return (...transformers) => __awaiter$3(this, void 0, void 0, function* () {
|
|
22989
23023
|
const initialResponse = Object.assign({}, defaultResponse, {
|
|
22990
|
-
headers: new lib$
|
|
23024
|
+
headers: new lib$7.Headers({
|
|
22991
23025
|
'x-powered-by': 'msw',
|
|
22992
23026
|
}),
|
|
22993
23027
|
}, responseOverrides);
|
|
@@ -23433,8 +23467,8 @@ Read more: https://mswjs.io/docs/getting-started/mocks\
|
|
|
23433
23467
|
}
|
|
23434
23468
|
|
|
23435
23469
|
function readResponseCookies(request, response) {
|
|
23436
|
-
lib$
|
|
23437
|
-
lib$
|
|
23470
|
+
lib$2.store.add(Object.assign(Object.assign({}, request), { url: request.url.toString() }), response);
|
|
23471
|
+
lib$2.store.persist();
|
|
23438
23472
|
}
|
|
23439
23473
|
|
|
23440
23474
|
function handleRequest(request, handlers, options, emitter, handleRequestOptions) {
|
|
@@ -23755,13 +23789,13 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
23755
23789
|
};
|
|
23756
23790
|
}
|
|
23757
23791
|
|
|
23758
|
-
var lib = {};
|
|
23792
|
+
var lib$1 = {};
|
|
23759
23793
|
|
|
23760
23794
|
var createInterceptor$1 = {};
|
|
23761
23795
|
|
|
23762
23796
|
Object.defineProperty(createInterceptor$1, "__esModule", { value: true });
|
|
23763
23797
|
createInterceptor$1.createInterceptor = void 0;
|
|
23764
|
-
var strict_event_emitter_1$1 = lib$
|
|
23798
|
+
var strict_event_emitter_1$1 = lib$5;
|
|
23765
23799
|
function createInterceptor(options) {
|
|
23766
23800
|
var observer = new strict_event_emitter_1$1.StrictEventEmitter();
|
|
23767
23801
|
var cleanupFns = [];
|
|
@@ -23787,11 +23821,147 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
23787
23821
|
|
|
23788
23822
|
var remote = {};
|
|
23789
23823
|
|
|
23824
|
+
var lib = {};
|
|
23825
|
+
|
|
23826
|
+
var invariant$1 = {};
|
|
23827
|
+
|
|
23828
|
+
var format$1 = {};
|
|
23829
|
+
|
|
23830
|
+
Object.defineProperty(format$1, "__esModule", { value: true });
|
|
23831
|
+
format$1.format = void 0;
|
|
23832
|
+
var POSITIONALS_EXP = /(%?)(%([sdjo]))/g;
|
|
23833
|
+
function serializePositional(positional, flag) {
|
|
23834
|
+
switch (flag) {
|
|
23835
|
+
// Strings.
|
|
23836
|
+
case 's':
|
|
23837
|
+
return positional;
|
|
23838
|
+
// Digits.
|
|
23839
|
+
case 'd':
|
|
23840
|
+
case 'i':
|
|
23841
|
+
return Number(positional);
|
|
23842
|
+
// JSON.
|
|
23843
|
+
case 'j':
|
|
23844
|
+
return JSON.stringify(positional);
|
|
23845
|
+
// Objects.
|
|
23846
|
+
case 'o': {
|
|
23847
|
+
// Preserve stings to prevent extra quotes around them.
|
|
23848
|
+
if (typeof positional === 'string') {
|
|
23849
|
+
return positional;
|
|
23850
|
+
}
|
|
23851
|
+
var json = JSON.stringify(positional);
|
|
23852
|
+
// If the positional isn't serializable, return it as-is.
|
|
23853
|
+
if (json === '{}' || json === '[]' || /^\[object .+?\]$/.test(json)) {
|
|
23854
|
+
return positional;
|
|
23855
|
+
}
|
|
23856
|
+
return json;
|
|
23857
|
+
}
|
|
23858
|
+
}
|
|
23859
|
+
}
|
|
23860
|
+
function format(message) {
|
|
23861
|
+
var positionals = [];
|
|
23862
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
23863
|
+
positionals[_i - 1] = arguments[_i];
|
|
23864
|
+
}
|
|
23865
|
+
if (positionals.length === 0) {
|
|
23866
|
+
return message;
|
|
23867
|
+
}
|
|
23868
|
+
var positionalIndex = 0;
|
|
23869
|
+
var formattedMessage = message.replace(POSITIONALS_EXP, function (match, isEscaped, _, flag) {
|
|
23870
|
+
var positional = positionals[positionalIndex];
|
|
23871
|
+
var value = serializePositional(positional, flag);
|
|
23872
|
+
if (!isEscaped) {
|
|
23873
|
+
positionalIndex++;
|
|
23874
|
+
return value;
|
|
23875
|
+
}
|
|
23876
|
+
return match;
|
|
23877
|
+
});
|
|
23878
|
+
// Append unresolved positionals to string as-is.
|
|
23879
|
+
if (positionalIndex < positionals.length) {
|
|
23880
|
+
formattedMessage += " " + positionals.slice(positionalIndex).join(' ');
|
|
23881
|
+
}
|
|
23882
|
+
formattedMessage = formattedMessage.replace(/%{2,2}/g, '%');
|
|
23883
|
+
return formattedMessage;
|
|
23884
|
+
}
|
|
23885
|
+
format$1.format = format;
|
|
23886
|
+
|
|
23887
|
+
var __extends$1 = (commonjsGlobal && commonjsGlobal.__extends) || (function () {
|
|
23888
|
+
var extendStatics = function (d, b) {
|
|
23889
|
+
extendStatics = Object.setPrototypeOf ||
|
|
23890
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
23891
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
23892
|
+
return extendStatics(d, b);
|
|
23893
|
+
};
|
|
23894
|
+
return function (d, b) {
|
|
23895
|
+
if (typeof b !== "function" && b !== null)
|
|
23896
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
23897
|
+
extendStatics(d, b);
|
|
23898
|
+
function __() { this.constructor = d; }
|
|
23899
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
23900
|
+
};
|
|
23901
|
+
})();
|
|
23902
|
+
var __spreadArray = (commonjsGlobal && commonjsGlobal.__spreadArray) || function (to, from) {
|
|
23903
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
23904
|
+
to[j] = from[i];
|
|
23905
|
+
return to;
|
|
23906
|
+
};
|
|
23907
|
+
Object.defineProperty(invariant$1, "__esModule", { value: true });
|
|
23908
|
+
invariant$1.invariant = invariant$1.InvariantError = void 0;
|
|
23909
|
+
var format_1 = format$1;
|
|
23910
|
+
var STACK_FRAMES_TO_IGNORE = 2;
|
|
23911
|
+
var InvariantError = /** @class */ (function (_super) {
|
|
23912
|
+
__extends$1(InvariantError, _super);
|
|
23913
|
+
function InvariantError(message) {
|
|
23914
|
+
var positionals = [];
|
|
23915
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
23916
|
+
positionals[_i - 1] = arguments[_i];
|
|
23917
|
+
}
|
|
23918
|
+
var _this = _super.call(this, message) || this;
|
|
23919
|
+
_this.name = 'Invariant Violation';
|
|
23920
|
+
_this.message = format_1.format.apply(void 0, __spreadArray([message], positionals));
|
|
23921
|
+
if (_this.stack) {
|
|
23922
|
+
var prevStack = _this.stack;
|
|
23923
|
+
_this.stack = prevStack
|
|
23924
|
+
.split('\n')
|
|
23925
|
+
.slice(STACK_FRAMES_TO_IGNORE)
|
|
23926
|
+
.join('\n');
|
|
23927
|
+
}
|
|
23928
|
+
return _this;
|
|
23929
|
+
}
|
|
23930
|
+
return InvariantError;
|
|
23931
|
+
}(Error));
|
|
23932
|
+
invariant$1.InvariantError = InvariantError;
|
|
23933
|
+
function invariant(predicate, message) {
|
|
23934
|
+
var positionals = [];
|
|
23935
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
23936
|
+
positionals[_i - 2] = arguments[_i];
|
|
23937
|
+
}
|
|
23938
|
+
if (!predicate) {
|
|
23939
|
+
throw new (InvariantError.bind.apply(InvariantError, __spreadArray([void 0, message], positionals)))();
|
|
23940
|
+
}
|
|
23941
|
+
}
|
|
23942
|
+
invariant$1.invariant = invariant;
|
|
23943
|
+
|
|
23944
|
+
(function (exports) {
|
|
23945
|
+
var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23946
|
+
if (k2 === undefined) k2 = k;
|
|
23947
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
23948
|
+
}) : (function(o, m, k, k2) {
|
|
23949
|
+
if (k2 === undefined) k2 = k;
|
|
23950
|
+
o[k2] = m[k];
|
|
23951
|
+
}));
|
|
23952
|
+
var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
|
|
23953
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
23954
|
+
};
|
|
23955
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23956
|
+
__exportStar(invariant$1, exports);
|
|
23957
|
+
__exportStar(format$1, exports);
|
|
23958
|
+
}(lib));
|
|
23959
|
+
|
|
23790
23960
|
var toIsoResponse$1 = {};
|
|
23791
23961
|
|
|
23792
23962
|
Object.defineProperty(toIsoResponse$1, "__esModule", { value: true });
|
|
23793
23963
|
toIsoResponse$1.toIsoResponse = void 0;
|
|
23794
|
-
var headers_utils_1$3 = lib$
|
|
23964
|
+
var headers_utils_1$3 = lib$7;
|
|
23795
23965
|
/**
|
|
23796
23966
|
* Converts a given mocked response object into an isomorphic response.
|
|
23797
23967
|
*/
|
|
@@ -23870,9 +24040,9 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
23870
24040
|
};
|
|
23871
24041
|
Object.defineProperty(remote, "__esModule", { value: true });
|
|
23872
24042
|
remote.createRemoteResolver = remote.createRemoteInterceptor = void 0;
|
|
23873
|
-
var headers_utils_1$2 = lib$
|
|
23874
|
-
var outvariant_1 = lib
|
|
23875
|
-
var strict_event_emitter_1 = lib$
|
|
24043
|
+
var headers_utils_1$2 = lib$7;
|
|
24044
|
+
var outvariant_1 = lib;
|
|
24045
|
+
var strict_event_emitter_1 = lib$5;
|
|
23876
24046
|
var createInterceptor_1 = createInterceptor$1;
|
|
23877
24047
|
var toIsoResponse_1$2 = toIsoResponse$1;
|
|
23878
24048
|
function requestReviver(key, value) {
|
|
@@ -24001,7 +24171,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
24001
24171
|
var getCleanUrl_1 = getCleanUrl$1;
|
|
24002
24172
|
Object.defineProperty(exports, "getCleanUrl", { enumerable: true, get: function () { return getCleanUrl_1.getCleanUrl; } });
|
|
24003
24173
|
|
|
24004
|
-
}(lib));
|
|
24174
|
+
}(lib$1));
|
|
24005
24175
|
|
|
24006
24176
|
var fetch = {};
|
|
24007
24177
|
|
|
@@ -24009,14 +24179,14 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
24009
24179
|
|
|
24010
24180
|
Object.defineProperty(uuid, "__esModule", { value: true });
|
|
24011
24181
|
uuid.uuidv4 = void 0;
|
|
24012
|
-
function uuidv4
|
|
24182
|
+
function uuidv4() {
|
|
24013
24183
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
24014
24184
|
var r = (Math.random() * 16) | 0;
|
|
24015
24185
|
var v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
24016
24186
|
return v.toString(16);
|
|
24017
24187
|
});
|
|
24018
24188
|
}
|
|
24019
|
-
uuid.uuidv4 = uuidv4
|
|
24189
|
+
uuid.uuidv4 = uuidv4;
|
|
24020
24190
|
|
|
24021
24191
|
var browser = {exports: {}};
|
|
24022
24192
|
|
|
@@ -24778,7 +24948,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
24778
24948
|
};
|
|
24779
24949
|
Object.defineProperty(fetch, "__esModule", { value: true });
|
|
24780
24950
|
var interceptFetch_1 = fetch.interceptFetch = void 0;
|
|
24781
|
-
var headers_utils_1$1 = lib$
|
|
24951
|
+
var headers_utils_1$1 = lib$7;
|
|
24782
24952
|
var toIsoResponse_1$1 = toIsoResponse$1;
|
|
24783
24953
|
var uuid_1$1 = uuid;
|
|
24784
24954
|
var debug$1 = browser.exports('fetch');
|
|
@@ -27880,8 +28050,8 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
27880
28050
|
* XMLHttpRequest override class.
|
|
27881
28051
|
* Inspired by https://github.com/marvinhagemeister/xhr-mocklet.
|
|
27882
28052
|
*/
|
|
27883
|
-
var until_1 = lib$
|
|
27884
|
-
var headers_utils_1 = lib$
|
|
28053
|
+
var until_1 = lib$4;
|
|
28054
|
+
var headers_utils_1 = lib$7;
|
|
27885
28055
|
var xmldom_1 = domParser;
|
|
27886
28056
|
var parseJson_1 = parseJson$1;
|
|
27887
28057
|
var toIsoResponse_1 = toIsoResponse$1;
|
|
@@ -28294,22 +28464,12 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28294
28464
|
};
|
|
28295
28465
|
interceptXMLHttpRequest_1 = XMLHttpRequest.interceptXMLHttpRequest = interceptXMLHttpRequest;
|
|
28296
28466
|
|
|
28297
|
-
function uuidv4() {
|
|
28298
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
28299
|
-
const r = (Math.random() * 16) | 0;
|
|
28300
|
-
const v = c == 'x' ? r : (r & 0x3) | 0x8;
|
|
28301
|
-
return v.toString(16);
|
|
28302
|
-
});
|
|
28303
|
-
}
|
|
28304
|
-
|
|
28305
28467
|
/**
|
|
28306
28468
|
* Converts a given isomorphic request to a `MockedRequest` instance.
|
|
28307
28469
|
*/
|
|
28308
28470
|
function parseIsomorphicRequest(request) {
|
|
28309
|
-
const requestId = uuidv4();
|
|
28310
|
-
request.headers.set('x-msw-request-id', requestId);
|
|
28311
28471
|
const mockedRequest = {
|
|
28312
|
-
id:
|
|
28472
|
+
id: request.id,
|
|
28313
28473
|
url: request.url,
|
|
28314
28474
|
method: request.method,
|
|
28315
28475
|
body: parseBody(request.body, request.headers),
|
|
@@ -28343,7 +28503,7 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28343
28503
|
}
|
|
28344
28504
|
|
|
28345
28505
|
function createFallbackRequestListener(context, options) {
|
|
28346
|
-
const interceptor = lib.createInterceptor({
|
|
28506
|
+
const interceptor = lib$1.createInterceptor({
|
|
28347
28507
|
modules: [interceptFetch_1, interceptXMLHttpRequest_1],
|
|
28348
28508
|
resolver(request) {
|
|
28349
28509
|
return __awaiter$3(this, void 0, void 0, function* () {
|
|
@@ -28423,11 +28583,11 @@ If this message still persists after updating, please report an issue: https://g
|
|
|
28423
28583
|
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).'));
|
|
28424
28584
|
});
|
|
28425
28585
|
// Error when attempting to run this function in a Node.js environment.
|
|
28426
|
-
if (lib$
|
|
28586
|
+
if (lib$6.exports.isNodeProcess()) {
|
|
28427
28587
|
throw new Error(devUtils.formatMessage('Failed to execute `setupWorker` in a non-browser environment. Consider using `setupServer` for Node.js environment instead.'));
|
|
28428
28588
|
}
|
|
28429
|
-
const emitter = new lib$
|
|
28430
|
-
const publicEmitter = new lib$
|
|
28589
|
+
const emitter = new lib$5.StrictEventEmitter();
|
|
28590
|
+
const publicEmitter = new lib$5.StrictEventEmitter();
|
|
28431
28591
|
pipeEvents(emitter, publicEmitter);
|
|
28432
28592
|
const context = {
|
|
28433
28593
|
startOptions: undefined,
|