@ai-sdk/provider-utils 2.0.5 → 2.0.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/CHANGELOG.md +18 -0
- package/package.json +3 -3
- package/test/dist/index.d.mts +87 -6
- package/test/dist/index.d.ts +87 -6
- package/test/dist/index.js +342 -147
- package/test/dist/index.js.map +1 -1
- package/test/dist/index.mjs +341 -147
- package/test/dist/index.mjs.map +1 -1
package/test/dist/index.js
CHANGED
@@ -64,6 +64,7 @@ __export(test_exports, {
|
|
64
64
|
convertAsyncIterableToArray: () => convertAsyncIterableToArray,
|
65
65
|
convertReadableStreamToArray: () => convertReadableStreamToArray,
|
66
66
|
convertResponseStreamToArray: () => convertResponseStreamToArray,
|
67
|
+
createTestServer: () => createTestServer,
|
67
68
|
describeWithTestServer: () => describeWithTestServer,
|
68
69
|
withTestServer: () => withTestServer
|
69
70
|
});
|
@@ -208,7 +209,7 @@ invariant.as = (ErrorConstructor, predicate, message3, ...positionals) => {
|
|
208
209
|
}
|
209
210
|
};
|
210
211
|
|
211
|
-
// ../../node_modules/.pnpm/msw@2.
|
212
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/devUtils.mjs
|
212
213
|
var LIBRARY_PREFIX = "[MSW]";
|
213
214
|
function formatMessage(message3, ...positionals) {
|
214
215
|
const interpolatedMessage = format(message3, ...positionals);
|
@@ -232,7 +233,7 @@ var InternalError = class extends Error {
|
|
232
233
|
}
|
233
234
|
};
|
234
235
|
|
235
|
-
// ../../node_modules/.pnpm/msw@2.
|
236
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/checkGlobals.mjs
|
236
237
|
function checkGlobals() {
|
237
238
|
invariant(
|
238
239
|
typeof URL !== "undefined",
|
@@ -407,7 +408,7 @@ var _Emitter = class {
|
|
407
408
|
var Emitter = _Emitter;
|
408
409
|
Emitter.defaultMaxListeners = 10;
|
409
410
|
|
410
|
-
// ../../node_modules/.pnpm/msw@2.
|
411
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/pipeEvents.mjs
|
411
412
|
function pipeEvents(source, destination) {
|
412
413
|
const rawEmit = source.emit;
|
413
414
|
if (rawEmit._isPiped) {
|
@@ -421,14 +422,14 @@ function pipeEvents(source, destination) {
|
|
421
422
|
source.emit = sourceEmit;
|
422
423
|
}
|
423
424
|
|
424
|
-
// ../../node_modules/.pnpm/msw@2.
|
425
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/toReadonlyArray.mjs
|
425
426
|
function toReadonlyArray(source) {
|
426
427
|
const clone = [...source];
|
427
428
|
Object.freeze(clone);
|
428
429
|
return clone;
|
429
430
|
}
|
430
431
|
|
431
|
-
// ../../node_modules/.pnpm/msw@2.
|
432
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/Disposable.mjs
|
432
433
|
var Disposable = class {
|
433
434
|
constructor() {
|
434
435
|
__publicField(this, "subscriptions", []);
|
@@ -441,7 +442,7 @@ var Disposable = class {
|
|
441
442
|
}
|
442
443
|
};
|
443
444
|
|
444
|
-
// ../../node_modules/.pnpm/msw@2.
|
445
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/SetupApi.mjs
|
445
446
|
var InMemoryHandlersController = class {
|
446
447
|
constructor(initialHandlers) {
|
447
448
|
__publicField(this, "handlers");
|
@@ -521,7 +522,7 @@ var SetupApi = class extends Disposable {
|
|
521
522
|
}
|
522
523
|
};
|
523
524
|
|
524
|
-
// ../../node_modules/.pnpm/msw@2.
|
525
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/getCallFrame.mjs
|
525
526
|
var SOURCE_FRAME = /[\/\\]msw[\/\\]src[\/\\](.+)/;
|
526
527
|
var BUILD_FRAME = /(node_modules)?[\/\\]lib[\/\\](core|browser|node|native|iife)[\/\\]|^[^\/\\]*$/;
|
527
528
|
function getCallFrame(error3) {
|
@@ -540,7 +541,7 @@ function getCallFrame(error3) {
|
|
540
541
|
return declarationPath;
|
541
542
|
}
|
542
543
|
|
543
|
-
// ../../node_modules/.pnpm/msw@2.
|
544
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/isIterable.mjs
|
544
545
|
function isIterable(fn) {
|
545
546
|
if (!fn) {
|
546
547
|
return false;
|
@@ -548,7 +549,7 @@ function isIterable(fn) {
|
|
548
549
|
return Reflect.has(fn, Symbol.iterator) || Reflect.has(fn, Symbol.asyncIterator);
|
549
550
|
}
|
550
551
|
|
551
|
-
// ../../node_modules/.pnpm/msw@2.
|
552
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/handlers/RequestHandler.mjs
|
552
553
|
var _RequestHandler = class _RequestHandler {
|
553
554
|
constructor(args) {
|
554
555
|
__publicField(this, "__kind");
|
@@ -700,12 +701,12 @@ var _RequestHandler = class _RequestHandler {
|
|
700
701
|
__publicField(_RequestHandler, "cache", /* @__PURE__ */ new WeakMap());
|
701
702
|
var RequestHandler = _RequestHandler;
|
702
703
|
|
703
|
-
// ../../node_modules/.pnpm/msw@2.
|
704
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/isStringEqual.mjs
|
704
705
|
function isStringEqual(actual, expected) {
|
705
706
|
return actual.toLowerCase() === expected.toLowerCase();
|
706
707
|
}
|
707
708
|
|
708
|
-
// ../../node_modules/.pnpm/msw@2.
|
709
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/logging/getStatusCodeColor.mjs
|
709
710
|
function getStatusCodeColor(status) {
|
710
711
|
if (status < 300) {
|
711
712
|
return "#69AB32";
|
@@ -716,7 +717,7 @@ function getStatusCodeColor(status) {
|
|
716
717
|
return "#E95F5D";
|
717
718
|
}
|
718
719
|
|
719
|
-
// ../../node_modules/.pnpm/msw@2.
|
720
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/logging/getTimestamp.mjs
|
720
721
|
function getTimestamp(options) {
|
721
722
|
const now = /* @__PURE__ */ new Date();
|
722
723
|
const timestamp = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;
|
@@ -726,7 +727,7 @@ function getTimestamp(options) {
|
|
726
727
|
return timestamp;
|
727
728
|
}
|
728
729
|
|
729
|
-
// ../../node_modules/.pnpm/msw@2.
|
730
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/logging/serializeRequest.mjs
|
730
731
|
async function serializeRequest(request) {
|
731
732
|
const requestClone = request.clone();
|
732
733
|
const requestText = await requestClone.text();
|
@@ -905,7 +906,7 @@ var require_statuses = __commonJS({
|
|
905
906
|
var import_statuses = __toESM2(require_statuses(), 1);
|
906
907
|
var source_default = import_statuses.default;
|
907
908
|
|
908
|
-
// ../../node_modules/.pnpm/msw@2.
|
909
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/logging/serializeResponse.mjs
|
909
910
|
var { message } = source_default;
|
910
911
|
async function serializeResponse(response) {
|
911
912
|
const responseClone = response.clone();
|
@@ -1523,7 +1524,7 @@ function serializeInput(message3) {
|
|
1523
1524
|
return message3.toString();
|
1524
1525
|
}
|
1525
1526
|
|
1526
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1527
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-I7HQIBT7.mjs
|
1527
1528
|
var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
|
1528
1529
|
function getGlobalSymbol(symbol) {
|
1529
1530
|
return (
|
@@ -1678,54 +1679,77 @@ var Interceptor = class {
|
|
1678
1679
|
function createRequestId() {
|
1679
1680
|
return Math.random().toString(16).slice(2);
|
1680
1681
|
}
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
return true;
|
1685
|
-
} catch (e) {
|
1686
|
-
return false;
|
1682
|
+
var _FetchResponse = class extends Response {
|
1683
|
+
static isConfigurableStatusCode(status) {
|
1684
|
+
return status >= 200 && status <= 599;
|
1687
1685
|
}
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
headers
|
1719
|
-
|
1686
|
+
static isRedirectResponse(status) {
|
1687
|
+
return _FetchResponse.STATUS_CODES_WITH_REDIRECT.includes(status);
|
1688
|
+
}
|
1689
|
+
/**
|
1690
|
+
* Returns a boolean indicating whether the given response status
|
1691
|
+
* code represents a response that can have a body.
|
1692
|
+
*/
|
1693
|
+
static isResponseWithBody(status) {
|
1694
|
+
return !_FetchResponse.STATUS_CODES_WITHOUT_BODY.includes(status);
|
1695
|
+
}
|
1696
|
+
static setUrl(url, response) {
|
1697
|
+
if (!url) {
|
1698
|
+
return;
|
1699
|
+
}
|
1700
|
+
if (response.url != "") {
|
1701
|
+
return;
|
1702
|
+
}
|
1703
|
+
Object.defineProperty(response, "url", {
|
1704
|
+
value: url,
|
1705
|
+
enumerable: true,
|
1706
|
+
configurable: true,
|
1707
|
+
writable: false
|
1708
|
+
});
|
1709
|
+
}
|
1710
|
+
/**
|
1711
|
+
* Parses the given raw HTTP headers into a Fetch API `Headers` instance.
|
1712
|
+
*/
|
1713
|
+
static parseRawHeaders(rawHeaders) {
|
1714
|
+
const headers = new Headers();
|
1715
|
+
for (let line = 0; line < rawHeaders.length; line += 2) {
|
1716
|
+
headers.append(rawHeaders[line], rawHeaders[line + 1]);
|
1717
|
+
}
|
1718
|
+
return headers;
|
1719
|
+
}
|
1720
|
+
constructor(body, init = {}) {
|
1721
|
+
var _a4;
|
1722
|
+
const status = (_a4 = init.status) != null ? _a4 : 200;
|
1723
|
+
const safeStatus = _FetchResponse.isConfigurableStatusCode(status) ? status : 200;
|
1724
|
+
const finalBody = _FetchResponse.isResponseWithBody(status) ? body : null;
|
1725
|
+
super(finalBody, {
|
1726
|
+
...init,
|
1727
|
+
status: safeStatus
|
1728
|
+
});
|
1729
|
+
if (status !== safeStatus) {
|
1730
|
+
const stateSymbol = Object.getOwnPropertySymbols(this).find(
|
1731
|
+
(symbol) => symbol.description === "state"
|
1732
|
+
);
|
1733
|
+
if (stateSymbol) {
|
1734
|
+
const state = Reflect.get(this, stateSymbol);
|
1735
|
+
Reflect.set(state, "status", status);
|
1736
|
+
} else {
|
1737
|
+
Object.defineProperty(this, "status", {
|
1738
|
+
value: status,
|
1739
|
+
enumerable: true,
|
1740
|
+
configurable: true,
|
1741
|
+
writable: false
|
1742
|
+
});
|
1720
1743
|
}
|
1721
1744
|
}
|
1722
|
-
|
1723
|
-
}
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1745
|
+
_FetchResponse.setUrl(init.url, this);
|
1746
|
+
}
|
1747
|
+
};
|
1748
|
+
var FetchResponse = _FetchResponse;
|
1749
|
+
FetchResponse.STATUS_CODES_WITHOUT_BODY = [101, 103, 204, 205, 304];
|
1750
|
+
FetchResponse.STATUS_CODES_WITH_REDIRECT = [301, 302, 303, 307, 308];
|
1727
1751
|
|
1728
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1752
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-PJA4E426.mjs
|
1729
1753
|
var BatchInterceptor = class extends Interceptor {
|
1730
1754
|
constructor(options) {
|
1731
1755
|
BatchInterceptor.symbol = Symbol(options.name);
|
@@ -1768,7 +1792,7 @@ var BatchInterceptor = class extends Interceptor {
|
|
1768
1792
|
}
|
1769
1793
|
};
|
1770
1794
|
|
1771
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1795
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-6HYIRFX2.mjs
|
1772
1796
|
var encoder = new TextEncoder();
|
1773
1797
|
function encodeBuffer(text) {
|
1774
1798
|
return encoder.encode(text);
|
@@ -1784,15 +1808,15 @@ function toArrayBuffer(array) {
|
|
1784
1808
|
);
|
1785
1809
|
}
|
1786
1810
|
|
1787
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1811
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-6YM4PLBI.mjs
|
1788
1812
|
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
1789
1813
|
|
1790
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1814
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/index.mjs
|
1791
1815
|
function getCleanUrl(url, isAbsolute = true) {
|
1792
1816
|
return [isAbsolute && url.origin, url.pathname].filter(Boolean).join("");
|
1793
1817
|
}
|
1794
1818
|
|
1795
|
-
// ../../node_modules/.pnpm/msw@2.
|
1819
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/url/cleanUrl.mjs
|
1796
1820
|
var REDUNDANT_CHARACTERS_EXP = /[\?|#].*$/g;
|
1797
1821
|
function getSearchParams(path) {
|
1798
1822
|
return new URL(`/${path}`, "http://localhost").searchParams;
|
@@ -1804,12 +1828,12 @@ function cleanUrl(path) {
|
|
1804
1828
|
return path.replace(REDUNDANT_CHARACTERS_EXP, "");
|
1805
1829
|
}
|
1806
1830
|
|
1807
|
-
// ../../node_modules/.pnpm/msw@2.
|
1831
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/url/isAbsoluteUrl.mjs
|
1808
1832
|
function isAbsoluteUrl(url) {
|
1809
1833
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1810
1834
|
}
|
1811
1835
|
|
1812
|
-
// ../../node_modules/.pnpm/msw@2.
|
1836
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/url/getAbsoluteUrl.mjs
|
1813
1837
|
function getAbsoluteUrl(path, baseUrl) {
|
1814
1838
|
if (isAbsoluteUrl(path)) {
|
1815
1839
|
return path;
|
@@ -1824,7 +1848,7 @@ function getAbsoluteUrl(path, baseUrl) {
|
|
1824
1848
|
) : path;
|
1825
1849
|
}
|
1826
1850
|
|
1827
|
-
// ../../node_modules/.pnpm/msw@2.
|
1851
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/matching/normalizePath.mjs
|
1828
1852
|
function normalizePath(path, baseUrl) {
|
1829
1853
|
if (path instanceof RegExp) {
|
1830
1854
|
return path;
|
@@ -1833,7 +1857,7 @@ function normalizePath(path, baseUrl) {
|
|
1833
1857
|
return cleanUrl(maybeAbsoluteUrl);
|
1834
1858
|
}
|
1835
1859
|
|
1836
|
-
// ../../node_modules/.pnpm/msw@2.
|
1860
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/matching/matchRequestUrl.mjs
|
1837
1861
|
function coercePath(path) {
|
1838
1862
|
return path.replace(
|
1839
1863
|
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
@@ -1858,7 +1882,7 @@ function matchRequestUrl(url, path, baseUrl) {
|
|
1858
1882
|
};
|
1859
1883
|
}
|
1860
1884
|
|
1861
|
-
// ../../node_modules/.pnpm/msw@2.
|
1885
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/request/toPublicUrl.mjs
|
1862
1886
|
function toPublicUrl(url) {
|
1863
1887
|
if (typeof location === "undefined") {
|
1864
1888
|
return url.toString();
|
@@ -13908,7 +13932,7 @@ var require_cookie2 = __commonJS3({
|
|
13908
13932
|
var import_tough_cookie = __toESM4(require_cookie2(), 1);
|
13909
13933
|
var source_default3 = import_tough_cookie.default;
|
13910
13934
|
|
13911
|
-
// ../../node_modules/.pnpm/msw@2.
|
13935
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/cookieStore.mjs
|
13912
13936
|
var { Cookie, CookieJar, Store, MemoryCookieStore, domainMatch, pathMatch } = source_default3;
|
13913
13937
|
var WebStorageCookieStore = class extends Store {
|
13914
13938
|
constructor() {
|
@@ -14060,7 +14084,7 @@ var WebStorageCookieStore = class extends Store {
|
|
14060
14084
|
var store = isNodeProcess() ? new MemoryCookieStore() : new WebStorageCookieStore();
|
14061
14085
|
var cookieStore = new CookieJar(store);
|
14062
14086
|
|
14063
|
-
// ../../node_modules/.pnpm/msw@2.
|
14087
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/request/getRequestCookies.mjs
|
14064
14088
|
function parseCookies(input) {
|
14065
14089
|
const parsedCookies = source_default2.parse(input);
|
14066
14090
|
const cookies = {};
|
@@ -14115,7 +14139,7 @@ function getAllRequestCookies(request) {
|
|
14115
14139
|
};
|
14116
14140
|
}
|
14117
14141
|
|
14118
|
-
// ../../node_modules/.pnpm/msw@2.
|
14142
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/handlers/HttpHandler.mjs
|
14119
14143
|
var HttpMethods = /* @__PURE__ */ ((HttpMethods2) => {
|
14120
14144
|
HttpMethods2["HEAD"] = "HEAD";
|
14121
14145
|
HttpMethods2["GET"] = "GET";
|
@@ -14205,7 +14229,7 @@ var HttpHandler = class extends RequestHandler {
|
|
14205
14229
|
}
|
14206
14230
|
};
|
14207
14231
|
|
14208
|
-
// ../../node_modules/.pnpm/msw@2.
|
14232
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/http.mjs
|
14209
14233
|
function createHttpHandler(method) {
|
14210
14234
|
return (path, resolver, options = {}) => {
|
14211
14235
|
return new HttpHandler(method, path, resolver, options);
|
@@ -14636,7 +14660,7 @@ var Headers2 = class _Headers {
|
|
14636
14660
|
}
|
14637
14661
|
};
|
14638
14662
|
|
14639
|
-
// ../../node_modules/.pnpm/msw@2.
|
14663
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/handlers/WebSocketHandler.mjs
|
14640
14664
|
var kEmitter = Symbol("kEmitter");
|
14641
14665
|
var kDispatchEvent = Symbol("kDispatchEvent");
|
14642
14666
|
var kSender = Symbol("kSender");
|
@@ -14810,7 +14834,7 @@ var until = async (promise) => {
|
|
14810
14834
|
}
|
14811
14835
|
};
|
14812
14836
|
|
14813
|
-
// ../../node_modules/.pnpm/msw@2.
|
14837
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/executeHandlers.mjs
|
14814
14838
|
var executeHandlers = async ({
|
14815
14839
|
request,
|
14816
14840
|
requestId,
|
@@ -14838,7 +14862,7 @@ var executeHandlers = async ({
|
|
14838
14862
|
return null;
|
14839
14863
|
};
|
14840
14864
|
|
14841
|
-
// ../../node_modules/.pnpm/msw@2.
|
14865
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/request/onUnhandledRequest.mjs
|
14842
14866
|
async function onUnhandledRequest(request, strategy = "warn") {
|
14843
14867
|
const url = new URL(request.url);
|
14844
14868
|
const publicUrl = toPublicUrl(url) + url.search;
|
@@ -14890,7 +14914,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
|
|
14890
14914
|
applyStrategy(strategy);
|
14891
14915
|
}
|
14892
14916
|
|
14893
|
-
// ../../node_modules/.pnpm/msw@2.
|
14917
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/HttpResponse/decorators.mjs
|
14894
14918
|
var { message: message2 } = source_default;
|
14895
14919
|
var kSetCookie = Symbol("kSetCookie");
|
14896
14920
|
function normalizeResponseInit(init = {}) {
|
@@ -14931,7 +14955,7 @@ function decorateResponse(response, init) {
|
|
14931
14955
|
return response;
|
14932
14956
|
}
|
14933
14957
|
|
14934
|
-
// ../../node_modules/.pnpm/msw@2.
|
14958
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/request/storeResponseCookies.mjs
|
14935
14959
|
function storeResponseCookies(request, response) {
|
14936
14960
|
const responseCookies = Reflect.get(response, kSetCookie);
|
14937
14961
|
if (responseCookies) {
|
@@ -14939,7 +14963,7 @@ function storeResponseCookies(request, response) {
|
|
14939
14963
|
}
|
14940
14964
|
}
|
14941
14965
|
|
14942
|
-
// ../../node_modules/.pnpm/msw@2.
|
14966
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/handleRequest.mjs
|
14943
14967
|
async function handleRequest(request, requestId, handlers, options, emitter, handleRequestOptions) {
|
14944
14968
|
var _a4, _b2, _c2, _d, _e, _f;
|
14945
14969
|
emitter.emit("request:start", { request, requestId });
|
@@ -14990,7 +15014,7 @@ async function handleRequest(request, requestId, handlers, options, emitter, han
|
|
14990
15014
|
return response;
|
14991
15015
|
}
|
14992
15016
|
|
14993
|
-
// ../../node_modules/.pnpm/msw@2.
|
15017
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/HttpResponse.mjs
|
14994
15018
|
var HttpResponse = class _HttpResponse extends Response {
|
14995
15019
|
constructor(body, init) {
|
14996
15020
|
const responseInit = normalizeResponseInit(init);
|
@@ -15076,6 +15100,9 @@ var HttpResponse = class _HttpResponse extends Response {
|
|
15076
15100
|
*/
|
15077
15101
|
static arrayBuffer(body, init) {
|
15078
15102
|
const responseInit = normalizeResponseInit(init);
|
15103
|
+
if (!responseInit.headers.has("Content-Type")) {
|
15104
|
+
responseInit.headers.set("Content-Type", "application/octet-stream");
|
15105
|
+
}
|
15079
15106
|
if (body && !responseInit.headers.has("Content-Length")) {
|
15080
15107
|
responseInit.headers.set("Content-Length", body.byteLength.toString());
|
15081
15108
|
}
|
@@ -15094,13 +15121,13 @@ var HttpResponse = class _HttpResponse extends Response {
|
|
15094
15121
|
}
|
15095
15122
|
};
|
15096
15123
|
|
15097
|
-
// ../../node_modules/.pnpm/msw@2.
|
15124
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/index.mjs
|
15098
15125
|
checkGlobals();
|
15099
15126
|
|
15100
|
-
// ../../node_modules/.pnpm/msw@2.
|
15127
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/node/index.mjs
|
15101
15128
|
var import_node_async_hooks = require("async_hooks");
|
15102
15129
|
|
15103
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
15130
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-5KMS5CTP.mjs
|
15104
15131
|
var InterceptorError = class extends Error {
|
15105
15132
|
constructor(message3) {
|
15106
15133
|
super(message3);
|
@@ -15161,6 +15188,35 @@ async function emitAsync(emitter, eventName, ...data) {
|
|
15161
15188
|
await listener.apply(emitter, data);
|
15162
15189
|
}
|
15163
15190
|
}
|
15191
|
+
function isPropertyAccessible(obj, key) {
|
15192
|
+
try {
|
15193
|
+
obj[key];
|
15194
|
+
return true;
|
15195
|
+
} catch (e) {
|
15196
|
+
return false;
|
15197
|
+
}
|
15198
|
+
}
|
15199
|
+
function createServerErrorResponse(body) {
|
15200
|
+
return new Response(
|
15201
|
+
JSON.stringify(
|
15202
|
+
body instanceof Error ? {
|
15203
|
+
name: body.name,
|
15204
|
+
message: body.message,
|
15205
|
+
stack: body.stack
|
15206
|
+
} : body
|
15207
|
+
),
|
15208
|
+
{
|
15209
|
+
status: 500,
|
15210
|
+
statusText: "Unhandled Exception",
|
15211
|
+
headers: {
|
15212
|
+
"Content-Type": "application/json"
|
15213
|
+
}
|
15214
|
+
}
|
15215
|
+
);
|
15216
|
+
}
|
15217
|
+
function isResponseError(response) {
|
15218
|
+
return isPropertyAccessible(response, "type") && response.type === "error";
|
15219
|
+
}
|
15164
15220
|
function isNodeLikeError(error3) {
|
15165
15221
|
if (error3 == null) {
|
15166
15222
|
return false;
|
@@ -15272,7 +15328,7 @@ async function handleRequest2(options) {
|
|
15272
15328
|
return false;
|
15273
15329
|
}
|
15274
15330
|
|
15275
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
15331
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-QFFDMWKW.mjs
|
15276
15332
|
var import_http2 = __toESM(require("http"), 1);
|
15277
15333
|
var import_https = __toESM(require("https"), 1);
|
15278
15334
|
var import_net = __toESM(require("net"), 1);
|
@@ -15352,13 +15408,6 @@ function baseUrlFromConnectionOptions(options) {
|
|
15352
15408
|
}
|
15353
15409
|
return url;
|
15354
15410
|
}
|
15355
|
-
function parseRawHeaders(rawHeaders) {
|
15356
|
-
const headers = new Headers();
|
15357
|
-
for (let line = 0; line < rawHeaders.length; line += 2) {
|
15358
|
-
headers.append(rawHeaders[line], rawHeaders[line + 1]);
|
15359
|
-
}
|
15360
|
-
return headers;
|
15361
|
-
}
|
15362
15411
|
var kRawHeaders = Symbol("kRawHeaders");
|
15363
15412
|
var kRestorePatches = Symbol("kRestorePatches");
|
15364
15413
|
function recordRawHeader(headers, args, behavior) {
|
@@ -15428,7 +15477,14 @@ function recordRawFetchHeaders() {
|
|
15428
15477
|
[Reflect.get(headersInit, kRawHeaders)],
|
15429
15478
|
newTarget
|
15430
15479
|
);
|
15431
|
-
ensureRawHeadersSymbol(headers2,
|
15480
|
+
ensureRawHeadersSymbol(headers2, [
|
15481
|
+
/**
|
15482
|
+
* @note Spread the retrieved headers to clone them.
|
15483
|
+
* This prevents multiple Headers instances from pointing
|
15484
|
+
* at the same internal "rawHeaders" array.
|
15485
|
+
*/
|
15486
|
+
...Reflect.get(headersInit, kRawHeaders)
|
15487
|
+
]);
|
15432
15488
|
return headers2;
|
15433
15489
|
}
|
15434
15490
|
const headers = Reflect.construct(target, args, newTarget);
|
@@ -15526,8 +15582,14 @@ var MockHttpSocket = class extends MockSocket {
|
|
15526
15582
|
constructor(options) {
|
15527
15583
|
super({
|
15528
15584
|
write: (chunk, encoding, callback) => {
|
15529
|
-
|
15585
|
+
var _a4;
|
15586
|
+
if (this.socketState !== "passthrough") {
|
15587
|
+
this.writeBuffer.push([chunk, encoding, callback]);
|
15588
|
+
}
|
15530
15589
|
if (chunk) {
|
15590
|
+
if (this.socketState === "passthrough") {
|
15591
|
+
(_a4 = this.originalSocket) == null ? void 0 : _a4.write(chunk, encoding, callback);
|
15592
|
+
}
|
15531
15593
|
this.requestParser.execute(
|
15532
15594
|
Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding)
|
15533
15595
|
);
|
@@ -15542,13 +15604,13 @@ var MockHttpSocket = class extends MockSocket {
|
|
15542
15604
|
}
|
15543
15605
|
});
|
15544
15606
|
this.writeBuffer = [];
|
15545
|
-
this.
|
15607
|
+
this.socketState = "unknown";
|
15546
15608
|
this.onRequestStart = (versionMajor, versionMinor, rawHeaders, _, path, __, ___, ____, shouldKeepAlive) => {
|
15547
15609
|
var _a4;
|
15548
15610
|
this.shouldKeepAlive = shouldKeepAlive;
|
15549
15611
|
const url = new URL(path, this.baseUrl);
|
15550
15612
|
const method = ((_a4 = this.connectionOptions.method) == null ? void 0 : _a4.toUpperCase()) || "GET";
|
15551
|
-
const headers = parseRawHeaders(rawHeaders);
|
15613
|
+
const headers = FetchResponse.parseRawHeaders(rawHeaders);
|
15552
15614
|
const canHaveBody = method !== "GET" && method !== "HEAD";
|
15553
15615
|
if (url.username || url.password) {
|
15554
15616
|
if (!headers.has("authorization")) {
|
@@ -15590,13 +15652,8 @@ var MockHttpSocket = class extends MockSocket {
|
|
15590
15652
|
});
|
15591
15653
|
};
|
15592
15654
|
this.onResponseStart = (versionMajor, versionMinor, rawHeaders, method, url, status, statusText) => {
|
15593
|
-
const headers = parseRawHeaders(rawHeaders);
|
15594
|
-
const
|
15595
|
-
if (canHaveBody) {
|
15596
|
-
this.responseStream = new import_stream.Readable({ read() {
|
15597
|
-
} });
|
15598
|
-
}
|
15599
|
-
const response = new Response(
|
15655
|
+
const headers = FetchResponse.parseRawHeaders(rawHeaders);
|
15656
|
+
const response = new FetchResponse(
|
15600
15657
|
/**
|
15601
15658
|
* @note The Fetch API response instance exposed to the consumer
|
15602
15659
|
* is created over the response stream of the HTTP parser. It is NOT
|
@@ -15604,8 +15661,12 @@ var MockHttpSocket = class extends MockSocket {
|
|
15604
15661
|
* in response listener while the Socket instance delays the emission
|
15605
15662
|
* of "end" and other events until those response listeners are finished.
|
15606
15663
|
*/
|
15607
|
-
|
15664
|
+
FetchResponse.isResponseWithBody(status) ? import_stream.Readable.toWeb(
|
15665
|
+
this.responseStream = new import_stream.Readable({ read() {
|
15666
|
+
} })
|
15667
|
+
) : null,
|
15608
15668
|
{
|
15669
|
+
url,
|
15609
15670
|
status,
|
15610
15671
|
statusText,
|
15611
15672
|
headers
|
@@ -15620,7 +15681,7 @@ var MockHttpSocket = class extends MockSocket {
|
|
15620
15681
|
}
|
15621
15682
|
this.responseListenersPromise = this.onResponse({
|
15622
15683
|
response,
|
15623
|
-
isMockedResponse: this.
|
15684
|
+
isMockedResponse: this.socketState === "mock",
|
15624
15685
|
requestId: Reflect.get(this.request, kRequestId),
|
15625
15686
|
request: this.request,
|
15626
15687
|
socket: this
|
@@ -15670,10 +15731,12 @@ var MockHttpSocket = class extends MockSocket {
|
|
15670
15731
|
* its data/events through this Socket.
|
15671
15732
|
*/
|
15672
15733
|
passthrough() {
|
15734
|
+
this.socketState = "passthrough";
|
15673
15735
|
if (this.destroyed) {
|
15674
15736
|
return;
|
15675
15737
|
}
|
15676
15738
|
const socket = this.createConnection();
|
15739
|
+
this.originalSocket = socket;
|
15677
15740
|
this.once("error", (error3) => {
|
15678
15741
|
socket.destroy(error3);
|
15679
15742
|
});
|
@@ -15746,7 +15809,7 @@ var MockHttpSocket = class extends MockSocket {
|
|
15746
15809
|
return;
|
15747
15810
|
}
|
15748
15811
|
this.mockConnect();
|
15749
|
-
this.
|
15812
|
+
this.socketState = "mock";
|
15750
15813
|
this.flushWriteBuffer();
|
15751
15814
|
const serverResponse = new import_http3.ServerResponse(new import_http3.IncomingMessage(this));
|
15752
15815
|
serverResponse.assignSocket(
|
@@ -15829,8 +15892,11 @@ var MockHttpSocket = class extends MockSocket {
|
|
15829
15892
|
}
|
15830
15893
|
}
|
15831
15894
|
flushWriteBuffer() {
|
15832
|
-
for (const
|
15833
|
-
|
15895
|
+
for (const writeCall of this.writeBuffer) {
|
15896
|
+
if (typeof writeCall[2] === "function") {
|
15897
|
+
writeCall[2]();
|
15898
|
+
writeCall[2] = void 0;
|
15899
|
+
}
|
15834
15900
|
}
|
15835
15901
|
}
|
15836
15902
|
onRequestBody(chunk) {
|
@@ -16254,7 +16320,7 @@ var _ClientRequestInterceptor = class extends Interceptor {
|
|
16254
16320
|
var ClientRequestInterceptor = _ClientRequestInterceptor;
|
16255
16321
|
ClientRequestInterceptor.symbol = Symbol("client-request-interceptor");
|
16256
16322
|
|
16257
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
16323
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-TX5GBTFY.mjs
|
16258
16324
|
function hasConfigurableGlobal(propertyName) {
|
16259
16325
|
const descriptor = Object.getOwnPropertyDescriptor(globalThis, propertyName);
|
16260
16326
|
if (typeof descriptor === "undefined") {
|
@@ -16275,7 +16341,7 @@ function hasConfigurableGlobal(propertyName) {
|
|
16275
16341
|
return true;
|
16276
16342
|
}
|
16277
16343
|
|
16278
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
16344
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-OMWE7UVM.mjs
|
16279
16345
|
function concatArrayBuffer(left, right) {
|
16280
16346
|
const result = new Uint8Array(left.byteLength + right.byteLength);
|
16281
16347
|
result.set(left, 0);
|
@@ -16438,8 +16504,9 @@ function parseJson(data) {
|
|
16438
16504
|
}
|
16439
16505
|
}
|
16440
16506
|
function createResponse(request, body) {
|
16441
|
-
const responseBodyOrNull =
|
16442
|
-
return new
|
16507
|
+
const responseBodyOrNull = FetchResponse.isResponseWithBody(request.status) ? body : null;
|
16508
|
+
return new FetchResponse(responseBodyOrNull, {
|
16509
|
+
url: request.responseURL,
|
16443
16510
|
status: request.status,
|
16444
16511
|
statusText: request.statusText,
|
16445
16512
|
headers: createHeadersFromXMLHttpReqestHeaders(
|
@@ -17060,7 +17127,7 @@ var _XMLHttpRequestInterceptor = class extends Interceptor {
|
|
17060
17127
|
var XMLHttpRequestInterceptor = _XMLHttpRequestInterceptor;
|
17061
17128
|
XMLHttpRequestInterceptor.interceptorSymbol = Symbol("xhr");
|
17062
17129
|
|
17063
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17130
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-CTGTMEFD.mjs
|
17064
17131
|
var import_zlib = __toESM(require("zlib"), 1);
|
17065
17132
|
function canParseUrl(url) {
|
17066
17133
|
try {
|
@@ -17251,8 +17318,9 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17251
17318
|
rawResponse
|
17252
17319
|
});
|
17253
17320
|
const decompressedStream = decompressResponse(rawResponse);
|
17254
|
-
const response = decompressedStream === null ? rawResponse : new
|
17255
|
-
|
17321
|
+
const response = decompressedStream === null ? rawResponse : new FetchResponse(decompressedStream, rawResponse);
|
17322
|
+
FetchResponse.setUrl(request.url, response);
|
17323
|
+
if (FetchResponse.isRedirectResponse(response.status)) {
|
17256
17324
|
if (request.redirect === "error") {
|
17257
17325
|
responsePromise.reject(createNetworkError("unexpected redirect"));
|
17258
17326
|
return;
|
@@ -17269,12 +17337,6 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17269
17337
|
return;
|
17270
17338
|
}
|
17271
17339
|
}
|
17272
|
-
Object.defineProperty(response, "url", {
|
17273
|
-
writable: false,
|
17274
|
-
enumerable: true,
|
17275
|
-
configurable: false,
|
17276
|
-
value: request.url
|
17277
|
-
});
|
17278
17340
|
if (this.emitter.listenerCount("response") > 0) {
|
17279
17341
|
this.logger.info('emitting the "response" event...');
|
17280
17342
|
await emitAsync(this.emitter, "response", {
|
@@ -17340,12 +17402,12 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17340
17402
|
var FetchInterceptor = _FetchInterceptor;
|
17341
17403
|
FetchInterceptor.symbol = Symbol("fetch");
|
17342
17404
|
|
17343
|
-
// ../../node_modules/.pnpm/msw@2.
|
17405
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/isObject.mjs
|
17344
17406
|
function isObject2(value) {
|
17345
17407
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
17346
17408
|
}
|
17347
17409
|
|
17348
|
-
// ../../node_modules/.pnpm/msw@2.
|
17410
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/mergeRight.mjs
|
17349
17411
|
function mergeRight(left, right) {
|
17350
17412
|
return Object.entries(right).reduce(
|
17351
17413
|
(result, [key, rightValue]) => {
|
@@ -17365,7 +17427,7 @@ function mergeRight(left, right) {
|
|
17365
17427
|
);
|
17366
17428
|
}
|
17367
17429
|
|
17368
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17430
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/browser/chunk-TX5GBTFY.mjs
|
17369
17431
|
function hasConfigurableGlobal2(propertyName) {
|
17370
17432
|
const descriptor = Object.getOwnPropertyDescriptor(globalThis, propertyName);
|
17371
17433
|
if (typeof descriptor === "undefined") {
|
@@ -17386,7 +17448,7 @@ function hasConfigurableGlobal2(propertyName) {
|
|
17386
17448
|
return true;
|
17387
17449
|
}
|
17388
17450
|
|
17389
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17451
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
|
17390
17452
|
function getGlobalSymbol2(symbol) {
|
17391
17453
|
return (
|
17392
17454
|
// @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
|
@@ -17533,7 +17595,7 @@ function createRequestId2() {
|
|
17533
17595
|
return Math.random().toString(16).slice(2);
|
17534
17596
|
}
|
17535
17597
|
|
17536
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17598
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/browser/interceptors/WebSocket/index.mjs
|
17537
17599
|
function bindEvent(target, event) {
|
17538
17600
|
Object.defineProperties(event, {
|
17539
17601
|
target: {
|
@@ -18096,23 +18158,39 @@ var WebSocketClassTransport = class extends EventTarget {
|
|
18096
18158
|
}
|
18097
18159
|
send(data) {
|
18098
18160
|
queueMicrotask(() => {
|
18099
|
-
this.socket.
|
18100
|
-
|
18101
|
-
|
18102
|
-
|
18103
|
-
|
18104
|
-
|
18105
|
-
|
18106
|
-
|
18107
|
-
|
18108
|
-
|
18109
|
-
|
18110
|
-
|
18111
|
-
|
18112
|
-
|
18113
|
-
|
18114
|
-
|
18115
|
-
|
18161
|
+
if (this.socket.readyState === this.socket.CLOSING || this.socket.readyState === this.socket.CLOSED) {
|
18162
|
+
return;
|
18163
|
+
}
|
18164
|
+
const dispatchEvent = () => {
|
18165
|
+
this.socket.dispatchEvent(
|
18166
|
+
bindEvent(
|
18167
|
+
/**
|
18168
|
+
* @note Setting this event's "target" to the
|
18169
|
+
* WebSocket override instance is important.
|
18170
|
+
* This way it can tell apart original incoming events
|
18171
|
+
* (must be forwarded to the transport) from the
|
18172
|
+
* mocked message events like the one below
|
18173
|
+
* (must be dispatched on the client instance).
|
18174
|
+
*/
|
18175
|
+
this.socket,
|
18176
|
+
new MessageEvent("message", {
|
18177
|
+
data,
|
18178
|
+
origin: this.socket.url
|
18179
|
+
})
|
18180
|
+
)
|
18181
|
+
);
|
18182
|
+
};
|
18183
|
+
if (this.socket.readyState === this.socket.CONNECTING) {
|
18184
|
+
this.socket.addEventListener(
|
18185
|
+
"open",
|
18186
|
+
() => {
|
18187
|
+
dispatchEvent();
|
18188
|
+
},
|
18189
|
+
{ once: true }
|
18190
|
+
);
|
18191
|
+
} else {
|
18192
|
+
dispatchEvent();
|
18193
|
+
}
|
18116
18194
|
});
|
18117
18195
|
}
|
18118
18196
|
close(code, reason) {
|
@@ -18194,17 +18272,17 @@ var _WebSocketInterceptor = class extends Interceptor2 {
|
|
18194
18272
|
var WebSocketInterceptor = _WebSocketInterceptor;
|
18195
18273
|
WebSocketInterceptor.symbol = Symbol("websocket");
|
18196
18274
|
|
18197
|
-
// ../../node_modules/.pnpm/msw@2.
|
18275
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/ws/webSocketInterceptor.mjs
|
18198
18276
|
var webSocketInterceptor = new WebSocketInterceptor();
|
18199
18277
|
|
18200
|
-
// ../../node_modules/.pnpm/msw@2.
|
18278
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/utils/internal/isHandlerKind.mjs
|
18201
18279
|
function isHandlerKind(kind) {
|
18202
18280
|
return (input) => {
|
18203
18281
|
return input != null && typeof input === "object" && "__kind" in input && input.__kind === kind;
|
18204
18282
|
};
|
18205
18283
|
}
|
18206
18284
|
|
18207
|
-
// ../../node_modules/.pnpm/msw@2.
|
18285
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/core/ws/handleWebSocketEvent.mjs
|
18208
18286
|
function handleWebSocketEvent(options) {
|
18209
18287
|
webSocketInterceptor.on("connection", async (connection) => {
|
18210
18288
|
const handlers = options.getHandlers();
|
@@ -18252,7 +18330,7 @@ function handleWebSocketEvent(options) {
|
|
18252
18330
|
});
|
18253
18331
|
}
|
18254
18332
|
|
18255
|
-
// ../../node_modules/.pnpm/msw@2.
|
18333
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@18.18.9_typescript@5.6.3/node_modules/msw/lib/node/index.mjs
|
18256
18334
|
var DEFAULT_LISTEN_OPTIONS = {
|
18257
18335
|
onUnhandledRequest: "warn"
|
18258
18336
|
};
|
@@ -18266,7 +18344,6 @@ var SetupServerCommonApi = class extends SetupApi {
|
|
18266
18344
|
interceptors: interceptors.map((Interceptor3) => new Interceptor3())
|
18267
18345
|
});
|
18268
18346
|
this.resolvedOptions = {};
|
18269
|
-
this.init();
|
18270
18347
|
}
|
18271
18348
|
/**
|
18272
18349
|
* Subscribe to all requests that are using the interceptor object
|
@@ -18341,6 +18418,7 @@ var SetupServerCommonApi = class extends SetupApi {
|
|
18341
18418
|
options
|
18342
18419
|
);
|
18343
18420
|
this.interceptor.apply();
|
18421
|
+
this.init();
|
18344
18422
|
this.subscriptions.push(() => this.interceptor.dispose());
|
18345
18423
|
webSocketInterceptor.apply();
|
18346
18424
|
this.subscriptions.push(() => webSocketInterceptor.dispose());
|
@@ -18411,6 +18489,9 @@ var setupServer = (...handlers) => {
|
|
18411
18489
|
|
18412
18490
|
// src/test/json-test-server.ts
|
18413
18491
|
var JsonTestServer = class {
|
18492
|
+
/**
|
18493
|
+
* @deprecated Use createTestServer instead
|
18494
|
+
*/
|
18414
18495
|
constructor(url) {
|
18415
18496
|
this.responseHeaders = {};
|
18416
18497
|
this.responseBodyJson = {};
|
@@ -18461,6 +18542,9 @@ var JsonTestServer = class {
|
|
18461
18542
|
|
18462
18543
|
// src/test/streaming-test-server.ts
|
18463
18544
|
var StreamingTestServer = class {
|
18545
|
+
/**
|
18546
|
+
* @deprecated Use createTestServer instead
|
18547
|
+
*/
|
18464
18548
|
constructor(url) {
|
18465
18549
|
this.responseHeaders = {};
|
18466
18550
|
this.responseChunks = [];
|
@@ -18579,7 +18663,10 @@ function createServer({
|
|
18579
18663
|
var _a4, _b2;
|
18580
18664
|
pushCall(new TestServerCall(request));
|
18581
18665
|
const invocationCount = urlInvocationCounts[url]++;
|
18582
|
-
const response = responses2[
|
18666
|
+
const response = responses2[
|
18667
|
+
// TODO bug needs to be >=
|
18668
|
+
invocationCount > responses2.length ? responses2.length - 1 : invocationCount
|
18669
|
+
];
|
18583
18670
|
switch (response.type) {
|
18584
18671
|
case "json-value":
|
18585
18672
|
return HttpResponse.json(response.content, {
|
@@ -18691,6 +18778,113 @@ function describeWithTestServer(description, responses, testFunction) {
|
|
18691
18778
|
});
|
18692
18779
|
});
|
18693
18780
|
}
|
18781
|
+
|
18782
|
+
// src/test/unified-test-server.ts
|
18783
|
+
var TestServerCall2 = class {
|
18784
|
+
constructor(request) {
|
18785
|
+
this.request = request;
|
18786
|
+
}
|
18787
|
+
get requestBody() {
|
18788
|
+
return this.request.text().then(JSON.parse);
|
18789
|
+
}
|
18790
|
+
get requestHeaders() {
|
18791
|
+
const requestHeaders = this.request.headers;
|
18792
|
+
const headersObject = {};
|
18793
|
+
requestHeaders.forEach((value, key) => {
|
18794
|
+
headersObject[key] = value;
|
18795
|
+
});
|
18796
|
+
return headersObject;
|
18797
|
+
}
|
18798
|
+
get requestUrlSearchParams() {
|
18799
|
+
return new URL(this.request.url).searchParams;
|
18800
|
+
}
|
18801
|
+
get requestUrl() {
|
18802
|
+
return this.request.url;
|
18803
|
+
}
|
18804
|
+
get requestMethod() {
|
18805
|
+
return this.request.method;
|
18806
|
+
}
|
18807
|
+
};
|
18808
|
+
function createTestServer(routes) {
|
18809
|
+
const originalRoutes = structuredClone(routes);
|
18810
|
+
const mswServer = setupServer(
|
18811
|
+
...Object.entries(routes).map(([url, handler]) => {
|
18812
|
+
return http.all(url, ({ request, params }) => {
|
18813
|
+
var _a4, _b2, _c2, _d, _e;
|
18814
|
+
calls.push(new TestServerCall2(request));
|
18815
|
+
const response = handler.response;
|
18816
|
+
if (response === void 0) {
|
18817
|
+
return HttpResponse.json({ error: "Not Found" }, { status: 404 });
|
18818
|
+
}
|
18819
|
+
const handlerType = response.type;
|
18820
|
+
switch (handlerType) {
|
18821
|
+
case "json-value":
|
18822
|
+
return HttpResponse.json(response.body, {
|
18823
|
+
status: 200,
|
18824
|
+
headers: {
|
18825
|
+
"Content-Type": "application/json",
|
18826
|
+
...(_a4 = handler.response) == null ? void 0 : _a4.headers
|
18827
|
+
}
|
18828
|
+
});
|
18829
|
+
case "stream-chunks":
|
18830
|
+
return new HttpResponse(
|
18831
|
+
convertArrayToReadableStream(response.chunks).pipeThrough(
|
18832
|
+
new TextEncoderStream()
|
18833
|
+
),
|
18834
|
+
{
|
18835
|
+
status: 200,
|
18836
|
+
headers: {
|
18837
|
+
"Content-Type": "text/event-stream",
|
18838
|
+
"Cache-Control": "no-cache",
|
18839
|
+
Connection: "keep-alive",
|
18840
|
+
...response.headers
|
18841
|
+
}
|
18842
|
+
}
|
18843
|
+
);
|
18844
|
+
case "binary": {
|
18845
|
+
return HttpResponse.arrayBuffer(response.body, {
|
18846
|
+
status: 200,
|
18847
|
+
headers: (_b2 = handler.response) == null ? void 0 : _b2.headers
|
18848
|
+
});
|
18849
|
+
}
|
18850
|
+
case "error":
|
18851
|
+
return HttpResponse.text((_c2 = response.body) != null ? _c2 : "Error", {
|
18852
|
+
status: (_d = response.status) != null ? _d : 500,
|
18853
|
+
headers: response.headers
|
18854
|
+
});
|
18855
|
+
case "empty":
|
18856
|
+
return new HttpResponse(null, {
|
18857
|
+
status: (_e = response.status) != null ? _e : 200
|
18858
|
+
});
|
18859
|
+
default: {
|
18860
|
+
const _exhaustiveCheck = handlerType;
|
18861
|
+
throw new Error(`Unknown response type: ${_exhaustiveCheck}`);
|
18862
|
+
}
|
18863
|
+
}
|
18864
|
+
});
|
18865
|
+
})
|
18866
|
+
);
|
18867
|
+
let calls = [];
|
18868
|
+
beforeAll(() => {
|
18869
|
+
mswServer.listen();
|
18870
|
+
});
|
18871
|
+
beforeEach(() => {
|
18872
|
+
mswServer.resetHandlers();
|
18873
|
+
Object.entries(originalRoutes).forEach(([url, handler]) => {
|
18874
|
+
routes[url].response = handler.response;
|
18875
|
+
});
|
18876
|
+
calls = [];
|
18877
|
+
});
|
18878
|
+
afterAll(() => {
|
18879
|
+
mswServer.close();
|
18880
|
+
});
|
18881
|
+
return {
|
18882
|
+
urls: routes,
|
18883
|
+
get calls() {
|
18884
|
+
return calls;
|
18885
|
+
}
|
18886
|
+
};
|
18887
|
+
}
|
18694
18888
|
// Annotate the CommonJS export names for ESM import in node:
|
18695
18889
|
0 && (module.exports = {
|
18696
18890
|
JsonTestServer,
|
@@ -18700,6 +18894,7 @@ function describeWithTestServer(description, responses, testFunction) {
|
|
18700
18894
|
convertAsyncIterableToArray,
|
18701
18895
|
convertReadableStreamToArray,
|
18702
18896
|
convertResponseStreamToArray,
|
18897
|
+
createTestServer,
|
18703
18898
|
describeWithTestServer,
|
18704
18899
|
withTestServer
|
18705
18900
|
});
|