@ai-sdk/provider-utils 2.0.6 → 2.0.8
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 +14 -0
- package/dist/index.d.mts +16 -10
- package/dist/index.d.ts +16 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/test/dist/index.d.mts +87 -20
- package/test/dist/index.d.ts +87 -20
- package/test/dist/index.js +397 -257
- package/test/dist/index.js.map +1 -1
- package/test/dist/index.mjs +396 -256
- package/test/dist/index.mjs.map +1 -1
package/test/dist/index.js
CHANGED
@@ -57,7 +57,6 @@ var __privateMethod = (obj, member, method) => {
|
|
57
57
|
// src/test/index.ts
|
58
58
|
var test_exports = {};
|
59
59
|
__export(test_exports, {
|
60
|
-
BinaryTestServer: () => BinaryTestServer,
|
61
60
|
JsonTestServer: () => JsonTestServer,
|
62
61
|
StreamingTestServer: () => StreamingTestServer,
|
63
62
|
convertArrayToAsyncIterable: () => convertArrayToAsyncIterable,
|
@@ -65,11 +64,67 @@ __export(test_exports, {
|
|
65
64
|
convertAsyncIterableToArray: () => convertAsyncIterableToArray,
|
66
65
|
convertReadableStreamToArray: () => convertReadableStreamToArray,
|
67
66
|
convertResponseStreamToArray: () => convertResponseStreamToArray,
|
67
|
+
createTestServer: () => createTestServer,
|
68
68
|
describeWithTestServer: () => describeWithTestServer,
|
69
69
|
withTestServer: () => withTestServer
|
70
70
|
});
|
71
71
|
module.exports = __toCommonJS(test_exports);
|
72
72
|
|
73
|
+
// src/test/convert-array-to-async-iterable.ts
|
74
|
+
function convertArrayToAsyncIterable(values) {
|
75
|
+
return {
|
76
|
+
async *[Symbol.asyncIterator]() {
|
77
|
+
for (const value of values) {
|
78
|
+
yield value;
|
79
|
+
}
|
80
|
+
}
|
81
|
+
};
|
82
|
+
}
|
83
|
+
|
84
|
+
// src/test/convert-array-to-readable-stream.ts
|
85
|
+
function convertArrayToReadableStream(values) {
|
86
|
+
return new ReadableStream({
|
87
|
+
start(controller) {
|
88
|
+
try {
|
89
|
+
for (const value of values) {
|
90
|
+
controller.enqueue(value);
|
91
|
+
}
|
92
|
+
} finally {
|
93
|
+
controller.close();
|
94
|
+
}
|
95
|
+
}
|
96
|
+
});
|
97
|
+
}
|
98
|
+
|
99
|
+
// src/test/convert-async-iterable-to-array.ts
|
100
|
+
async function convertAsyncIterableToArray(iterable) {
|
101
|
+
const result = [];
|
102
|
+
for await (const item of iterable) {
|
103
|
+
result.push(item);
|
104
|
+
}
|
105
|
+
return result;
|
106
|
+
}
|
107
|
+
|
108
|
+
// src/test/convert-readable-stream-to-array.ts
|
109
|
+
async function convertReadableStreamToArray(stream) {
|
110
|
+
const reader = stream.getReader();
|
111
|
+
const result = [];
|
112
|
+
while (true) {
|
113
|
+
const { done, value } = await reader.read();
|
114
|
+
if (done)
|
115
|
+
break;
|
116
|
+
result.push(value);
|
117
|
+
}
|
118
|
+
return result;
|
119
|
+
}
|
120
|
+
|
121
|
+
// src/test/convert-response-stream-to-array.ts
|
122
|
+
async function convertResponseStreamToArray(response) {
|
123
|
+
return convertReadableStreamToArray(
|
124
|
+
response.body.pipeThrough(new TextDecoderStream())
|
125
|
+
);
|
126
|
+
}
|
127
|
+
|
73
128
|
// ../../node_modules/.pnpm/outvariant@1.4.3/node_modules/outvariant/lib/index.mjs
|
74
129
|
var POSITIONALS_EXP = /(%?)(%([sdijo]))/g;
|
75
130
|
function serializePositional(positional, flag) {
|
@@ -154,7 +209,7 @@ invariant.as = (ErrorConstructor, predicate, message3, ...positionals) => {
|
|
154
209
|
}
|
155
210
|
};
|
156
211
|
|
157
|
-
// ../../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
|
158
213
|
var LIBRARY_PREFIX = "[MSW]";
|
159
214
|
function formatMessage(message3, ...positionals) {
|
160
215
|
const interpolatedMessage = format(message3, ...positionals);
|
@@ -178,7 +233,7 @@ var InternalError = class extends Error {
|
|
178
233
|
}
|
179
234
|
};
|
180
235
|
|
181
|
-
// ../../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
|
182
237
|
function checkGlobals() {
|
183
238
|
invariant(
|
184
239
|
typeof URL !== "undefined",
|
@@ -353,7 +408,7 @@ var _Emitter = class {
|
|
353
408
|
var Emitter = _Emitter;
|
354
409
|
Emitter.defaultMaxListeners = 10;
|
355
410
|
|
356
|
-
// ../../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
|
357
412
|
function pipeEvents(source, destination) {
|
358
413
|
const rawEmit = source.emit;
|
359
414
|
if (rawEmit._isPiped) {
|
@@ -367,14 +422,14 @@ function pipeEvents(source, destination) {
|
|
367
422
|
source.emit = sourceEmit;
|
368
423
|
}
|
369
424
|
|
370
|
-
// ../../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
|
371
426
|
function toReadonlyArray(source) {
|
372
427
|
const clone = [...source];
|
373
428
|
Object.freeze(clone);
|
374
429
|
return clone;
|
375
430
|
}
|
376
431
|
|
377
|
-
// ../../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
|
378
433
|
var Disposable = class {
|
379
434
|
constructor() {
|
380
435
|
__publicField(this, "subscriptions", []);
|
@@ -387,7 +442,7 @@ var Disposable = class {
|
|
387
442
|
}
|
388
443
|
};
|
389
444
|
|
390
|
-
// ../../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
|
391
446
|
var InMemoryHandlersController = class {
|
392
447
|
constructor(initialHandlers) {
|
393
448
|
__publicField(this, "handlers");
|
@@ -467,7 +522,7 @@ var SetupApi = class extends Disposable {
|
|
467
522
|
}
|
468
523
|
};
|
469
524
|
|
470
|
-
// ../../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
|
471
526
|
var SOURCE_FRAME = /[\/\\]msw[\/\\]src[\/\\](.+)/;
|
472
527
|
var BUILD_FRAME = /(node_modules)?[\/\\]lib[\/\\](core|browser|node|native|iife)[\/\\]|^[^\/\\]*$/;
|
473
528
|
function getCallFrame(error3) {
|
@@ -486,7 +541,7 @@ function getCallFrame(error3) {
|
|
486
541
|
return declarationPath;
|
487
542
|
}
|
488
543
|
|
489
|
-
// ../../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
|
490
545
|
function isIterable(fn) {
|
491
546
|
if (!fn) {
|
492
547
|
return false;
|
@@ -494,7 +549,7 @@ function isIterable(fn) {
|
|
494
549
|
return Reflect.has(fn, Symbol.iterator) || Reflect.has(fn, Symbol.asyncIterator);
|
495
550
|
}
|
496
551
|
|
497
|
-
// ../../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
|
498
553
|
var _RequestHandler = class _RequestHandler {
|
499
554
|
constructor(args) {
|
500
555
|
__publicField(this, "__kind");
|
@@ -646,12 +701,12 @@ var _RequestHandler = class _RequestHandler {
|
|
646
701
|
__publicField(_RequestHandler, "cache", /* @__PURE__ */ new WeakMap());
|
647
702
|
var RequestHandler = _RequestHandler;
|
648
703
|
|
649
|
-
// ../../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
|
650
705
|
function isStringEqual(actual, expected) {
|
651
706
|
return actual.toLowerCase() === expected.toLowerCase();
|
652
707
|
}
|
653
708
|
|
654
|
-
// ../../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
|
655
710
|
function getStatusCodeColor(status) {
|
656
711
|
if (status < 300) {
|
657
712
|
return "#69AB32";
|
@@ -662,7 +717,7 @@ function getStatusCodeColor(status) {
|
|
662
717
|
return "#E95F5D";
|
663
718
|
}
|
664
719
|
|
665
|
-
// ../../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
|
666
721
|
function getTimestamp(options) {
|
667
722
|
const now = /* @__PURE__ */ new Date();
|
668
723
|
const timestamp = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;
|
@@ -672,7 +727,7 @@ function getTimestamp(options) {
|
|
672
727
|
return timestamp;
|
673
728
|
}
|
674
729
|
|
675
|
-
// ../../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
|
676
731
|
async function serializeRequest(request) {
|
677
732
|
const requestClone = request.clone();
|
678
733
|
const requestText = await requestClone.text();
|
@@ -851,7 +906,7 @@ var require_statuses = __commonJS({
|
|
851
906
|
var import_statuses = __toESM2(require_statuses(), 1);
|
852
907
|
var source_default = import_statuses.default;
|
853
908
|
|
854
|
-
// ../../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
|
855
910
|
var { message } = source_default;
|
856
911
|
async function serializeResponse(response) {
|
857
912
|
const responseClone = response.clone();
|
@@ -1469,7 +1524,7 @@ function serializeInput(message3) {
|
|
1469
1524
|
return message3.toString();
|
1470
1525
|
}
|
1471
1526
|
|
1472
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1527
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-I7HQIBT7.mjs
|
1473
1528
|
var INTERNAL_REQUEST_ID_HEADER_NAME = "x-interceptors-internal-request-id";
|
1474
1529
|
function getGlobalSymbol(symbol) {
|
1475
1530
|
return (
|
@@ -1624,54 +1679,77 @@ var Interceptor = class {
|
|
1624
1679
|
function createRequestId() {
|
1625
1680
|
return Math.random().toString(16).slice(2);
|
1626
1681
|
}
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
return true;
|
1631
|
-
} catch (e) {
|
1632
|
-
return false;
|
1682
|
+
var _FetchResponse = class extends Response {
|
1683
|
+
static isConfigurableStatusCode(status) {
|
1684
|
+
return status >= 200 && status <= 599;
|
1633
1685
|
}
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
headers
|
1665
|
-
|
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
|
+
});
|
1666
1743
|
}
|
1667
1744
|
}
|
1668
|
-
|
1669
|
-
}
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
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];
|
1673
1751
|
|
1674
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1752
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-PJA4E426.mjs
|
1675
1753
|
var BatchInterceptor = class extends Interceptor {
|
1676
1754
|
constructor(options) {
|
1677
1755
|
BatchInterceptor.symbol = Symbol(options.name);
|
@@ -1714,7 +1792,7 @@ var BatchInterceptor = class extends Interceptor {
|
|
1714
1792
|
}
|
1715
1793
|
};
|
1716
1794
|
|
1717
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1795
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-6HYIRFX2.mjs
|
1718
1796
|
var encoder = new TextEncoder();
|
1719
1797
|
function encodeBuffer(text) {
|
1720
1798
|
return encoder.encode(text);
|
@@ -1730,15 +1808,15 @@ function toArrayBuffer(array) {
|
|
1730
1808
|
);
|
1731
1809
|
}
|
1732
1810
|
|
1733
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1811
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-6YM4PLBI.mjs
|
1734
1812
|
var IS_PATCHED_MODULE = Symbol("isPatchedModule");
|
1735
1813
|
|
1736
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
1814
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/index.mjs
|
1737
1815
|
function getCleanUrl(url, isAbsolute = true) {
|
1738
1816
|
return [isAbsolute && url.origin, url.pathname].filter(Boolean).join("");
|
1739
1817
|
}
|
1740
1818
|
|
1741
|
-
// ../../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
|
1742
1820
|
var REDUNDANT_CHARACTERS_EXP = /[\?|#].*$/g;
|
1743
1821
|
function getSearchParams(path) {
|
1744
1822
|
return new URL(`/${path}`, "http://localhost").searchParams;
|
@@ -1750,12 +1828,12 @@ function cleanUrl(path) {
|
|
1750
1828
|
return path.replace(REDUNDANT_CHARACTERS_EXP, "");
|
1751
1829
|
}
|
1752
1830
|
|
1753
|
-
// ../../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
|
1754
1832
|
function isAbsoluteUrl(url) {
|
1755
1833
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1756
1834
|
}
|
1757
1835
|
|
1758
|
-
// ../../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
|
1759
1837
|
function getAbsoluteUrl(path, baseUrl) {
|
1760
1838
|
if (isAbsoluteUrl(path)) {
|
1761
1839
|
return path;
|
@@ -1770,7 +1848,7 @@ function getAbsoluteUrl(path, baseUrl) {
|
|
1770
1848
|
) : path;
|
1771
1849
|
}
|
1772
1850
|
|
1773
|
-
// ../../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
|
1774
1852
|
function normalizePath(path, baseUrl) {
|
1775
1853
|
if (path instanceof RegExp) {
|
1776
1854
|
return path;
|
@@ -1779,7 +1857,7 @@ function normalizePath(path, baseUrl) {
|
|
1779
1857
|
return cleanUrl(maybeAbsoluteUrl);
|
1780
1858
|
}
|
1781
1859
|
|
1782
|
-
// ../../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
|
1783
1861
|
function coercePath(path) {
|
1784
1862
|
return path.replace(
|
1785
1863
|
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
@@ -1804,7 +1882,7 @@ function matchRequestUrl(url, path, baseUrl) {
|
|
1804
1882
|
};
|
1805
1883
|
}
|
1806
1884
|
|
1807
|
-
// ../../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
|
1808
1886
|
function toPublicUrl(url) {
|
1809
1887
|
if (typeof location === "undefined") {
|
1810
1888
|
return url.toString();
|
@@ -13854,7 +13932,7 @@ var require_cookie2 = __commonJS3({
|
|
13854
13932
|
var import_tough_cookie = __toESM4(require_cookie2(), 1);
|
13855
13933
|
var source_default3 = import_tough_cookie.default;
|
13856
13934
|
|
13857
|
-
// ../../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
|
13858
13936
|
var { Cookie, CookieJar, Store, MemoryCookieStore, domainMatch, pathMatch } = source_default3;
|
13859
13937
|
var WebStorageCookieStore = class extends Store {
|
13860
13938
|
constructor() {
|
@@ -14006,7 +14084,7 @@ var WebStorageCookieStore = class extends Store {
|
|
14006
14084
|
var store = isNodeProcess() ? new MemoryCookieStore() : new WebStorageCookieStore();
|
14007
14085
|
var cookieStore = new CookieJar(store);
|
14008
14086
|
|
14009
|
-
// ../../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
|
14010
14088
|
function parseCookies(input) {
|
14011
14089
|
const parsedCookies = source_default2.parse(input);
|
14012
14090
|
const cookies = {};
|
@@ -14061,7 +14139,7 @@ function getAllRequestCookies(request) {
|
|
14061
14139
|
};
|
14062
14140
|
}
|
14063
14141
|
|
14064
|
-
// ../../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
|
14065
14143
|
var HttpMethods = /* @__PURE__ */ ((HttpMethods2) => {
|
14066
14144
|
HttpMethods2["HEAD"] = "HEAD";
|
14067
14145
|
HttpMethods2["GET"] = "GET";
|
@@ -14151,7 +14229,7 @@ var HttpHandler = class extends RequestHandler {
|
|
14151
14229
|
}
|
14152
14230
|
};
|
14153
14231
|
|
14154
|
-
// ../../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
|
14155
14233
|
function createHttpHandler(method) {
|
14156
14234
|
return (path, resolver, options = {}) => {
|
14157
14235
|
return new HttpHandler(method, path, resolver, options);
|
@@ -14582,7 +14660,7 @@ var Headers2 = class _Headers {
|
|
14582
14660
|
}
|
14583
14661
|
};
|
14584
14662
|
|
14585
|
-
// ../../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
|
14586
14664
|
var kEmitter = Symbol("kEmitter");
|
14587
14665
|
var kDispatchEvent = Symbol("kDispatchEvent");
|
14588
14666
|
var kSender = Symbol("kSender");
|
@@ -14756,7 +14834,7 @@ var until = async (promise) => {
|
|
14756
14834
|
}
|
14757
14835
|
};
|
14758
14836
|
|
14759
|
-
// ../../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
|
14760
14838
|
var executeHandlers = async ({
|
14761
14839
|
request,
|
14762
14840
|
requestId,
|
@@ -14784,7 +14862,7 @@ var executeHandlers = async ({
|
|
14784
14862
|
return null;
|
14785
14863
|
};
|
14786
14864
|
|
14787
|
-
// ../../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
|
14788
14866
|
async function onUnhandledRequest(request, strategy = "warn") {
|
14789
14867
|
const url = new URL(request.url);
|
14790
14868
|
const publicUrl = toPublicUrl(url) + url.search;
|
@@ -14836,7 +14914,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
|
|
14836
14914
|
applyStrategy(strategy);
|
14837
14915
|
}
|
14838
14916
|
|
14839
|
-
// ../../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
|
14840
14918
|
var { message: message2 } = source_default;
|
14841
14919
|
var kSetCookie = Symbol("kSetCookie");
|
14842
14920
|
function normalizeResponseInit(init = {}) {
|
@@ -14877,7 +14955,7 @@ function decorateResponse(response, init) {
|
|
14877
14955
|
return response;
|
14878
14956
|
}
|
14879
14957
|
|
14880
|
-
// ../../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
|
14881
14959
|
function storeResponseCookies(request, response) {
|
14882
14960
|
const responseCookies = Reflect.get(response, kSetCookie);
|
14883
14961
|
if (responseCookies) {
|
@@ -14885,7 +14963,7 @@ function storeResponseCookies(request, response) {
|
|
14885
14963
|
}
|
14886
14964
|
}
|
14887
14965
|
|
14888
|
-
// ../../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
|
14889
14967
|
async function handleRequest(request, requestId, handlers, options, emitter, handleRequestOptions) {
|
14890
14968
|
var _a4, _b2, _c2, _d, _e, _f;
|
14891
14969
|
emitter.emit("request:start", { request, requestId });
|
@@ -14936,7 +15014,7 @@ async function handleRequest(request, requestId, handlers, options, emitter, han
|
|
14936
15014
|
return response;
|
14937
15015
|
}
|
14938
15016
|
|
14939
|
-
// ../../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
|
14940
15018
|
var HttpResponse = class _HttpResponse extends Response {
|
14941
15019
|
constructor(body, init) {
|
14942
15020
|
const responseInit = normalizeResponseInit(init);
|
@@ -15022,6 +15100,9 @@ var HttpResponse = class _HttpResponse extends Response {
|
|
15022
15100
|
*/
|
15023
15101
|
static arrayBuffer(body, init) {
|
15024
15102
|
const responseInit = normalizeResponseInit(init);
|
15103
|
+
if (!responseInit.headers.has("Content-Type")) {
|
15104
|
+
responseInit.headers.set("Content-Type", "application/octet-stream");
|
15105
|
+
}
|
15025
15106
|
if (body && !responseInit.headers.has("Content-Length")) {
|
15026
15107
|
responseInit.headers.set("Content-Length", body.byteLength.toString());
|
15027
15108
|
}
|
@@ -15040,13 +15121,13 @@ var HttpResponse = class _HttpResponse extends Response {
|
|
15040
15121
|
}
|
15041
15122
|
};
|
15042
15123
|
|
15043
|
-
// ../../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
|
15044
15125
|
checkGlobals();
|
15045
15126
|
|
15046
|
-
// ../../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
|
15047
15128
|
var import_node_async_hooks = require("async_hooks");
|
15048
15129
|
|
15049
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
15130
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-5KMS5CTP.mjs
|
15050
15131
|
var InterceptorError = class extends Error {
|
15051
15132
|
constructor(message3) {
|
15052
15133
|
super(message3);
|
@@ -15107,6 +15188,35 @@ async function emitAsync(emitter, eventName, ...data) {
|
|
15107
15188
|
await listener.apply(emitter, data);
|
15108
15189
|
}
|
15109
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
|
+
}
|
15110
15220
|
function isNodeLikeError(error3) {
|
15111
15221
|
if (error3 == null) {
|
15112
15222
|
return false;
|
@@ -15218,7 +15328,7 @@ async function handleRequest2(options) {
|
|
15218
15328
|
return false;
|
15219
15329
|
}
|
15220
15330
|
|
15221
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
15331
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-QFFDMWKW.mjs
|
15222
15332
|
var import_http2 = __toESM(require("http"), 1);
|
15223
15333
|
var import_https = __toESM(require("https"), 1);
|
15224
15334
|
var import_net = __toESM(require("net"), 1);
|
@@ -15298,13 +15408,6 @@ function baseUrlFromConnectionOptions(options) {
|
|
15298
15408
|
}
|
15299
15409
|
return url;
|
15300
15410
|
}
|
15301
|
-
function parseRawHeaders(rawHeaders) {
|
15302
|
-
const headers = new Headers();
|
15303
|
-
for (let line = 0; line < rawHeaders.length; line += 2) {
|
15304
|
-
headers.append(rawHeaders[line], rawHeaders[line + 1]);
|
15305
|
-
}
|
15306
|
-
return headers;
|
15307
|
-
}
|
15308
15411
|
var kRawHeaders = Symbol("kRawHeaders");
|
15309
15412
|
var kRestorePatches = Symbol("kRestorePatches");
|
15310
15413
|
function recordRawHeader(headers, args, behavior) {
|
@@ -15374,7 +15477,14 @@ function recordRawFetchHeaders() {
|
|
15374
15477
|
[Reflect.get(headersInit, kRawHeaders)],
|
15375
15478
|
newTarget
|
15376
15479
|
);
|
15377
|
-
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
|
+
]);
|
15378
15488
|
return headers2;
|
15379
15489
|
}
|
15380
15490
|
const headers = Reflect.construct(target, args, newTarget);
|
@@ -15472,8 +15582,14 @@ var MockHttpSocket = class extends MockSocket {
|
|
15472
15582
|
constructor(options) {
|
15473
15583
|
super({
|
15474
15584
|
write: (chunk, encoding, callback) => {
|
15475
|
-
|
15585
|
+
var _a4;
|
15586
|
+
if (this.socketState !== "passthrough") {
|
15587
|
+
this.writeBuffer.push([chunk, encoding, callback]);
|
15588
|
+
}
|
15476
15589
|
if (chunk) {
|
15590
|
+
if (this.socketState === "passthrough") {
|
15591
|
+
(_a4 = this.originalSocket) == null ? void 0 : _a4.write(chunk, encoding, callback);
|
15592
|
+
}
|
15477
15593
|
this.requestParser.execute(
|
15478
15594
|
Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk, encoding)
|
15479
15595
|
);
|
@@ -15488,13 +15604,13 @@ var MockHttpSocket = class extends MockSocket {
|
|
15488
15604
|
}
|
15489
15605
|
});
|
15490
15606
|
this.writeBuffer = [];
|
15491
|
-
this.
|
15607
|
+
this.socketState = "unknown";
|
15492
15608
|
this.onRequestStart = (versionMajor, versionMinor, rawHeaders, _, path, __, ___, ____, shouldKeepAlive) => {
|
15493
15609
|
var _a4;
|
15494
15610
|
this.shouldKeepAlive = shouldKeepAlive;
|
15495
15611
|
const url = new URL(path, this.baseUrl);
|
15496
15612
|
const method = ((_a4 = this.connectionOptions.method) == null ? void 0 : _a4.toUpperCase()) || "GET";
|
15497
|
-
const headers = parseRawHeaders(rawHeaders);
|
15613
|
+
const headers = FetchResponse.parseRawHeaders(rawHeaders);
|
15498
15614
|
const canHaveBody = method !== "GET" && method !== "HEAD";
|
15499
15615
|
if (url.username || url.password) {
|
15500
15616
|
if (!headers.has("authorization")) {
|
@@ -15536,13 +15652,8 @@ var MockHttpSocket = class extends MockSocket {
|
|
15536
15652
|
});
|
15537
15653
|
};
|
15538
15654
|
this.onResponseStart = (versionMajor, versionMinor, rawHeaders, method, url, status, statusText) => {
|
15539
|
-
const headers = parseRawHeaders(rawHeaders);
|
15540
|
-
const
|
15541
|
-
if (canHaveBody) {
|
15542
|
-
this.responseStream = new import_stream.Readable({ read() {
|
15543
|
-
} });
|
15544
|
-
}
|
15545
|
-
const response = new Response(
|
15655
|
+
const headers = FetchResponse.parseRawHeaders(rawHeaders);
|
15656
|
+
const response = new FetchResponse(
|
15546
15657
|
/**
|
15547
15658
|
* @note The Fetch API response instance exposed to the consumer
|
15548
15659
|
* is created over the response stream of the HTTP parser. It is NOT
|
@@ -15550,8 +15661,12 @@ var MockHttpSocket = class extends MockSocket {
|
|
15550
15661
|
* in response listener while the Socket instance delays the emission
|
15551
15662
|
* of "end" and other events until those response listeners are finished.
|
15552
15663
|
*/
|
15553
|
-
|
15664
|
+
FetchResponse.isResponseWithBody(status) ? import_stream.Readable.toWeb(
|
15665
|
+
this.responseStream = new import_stream.Readable({ read() {
|
15666
|
+
} })
|
15667
|
+
) : null,
|
15554
15668
|
{
|
15669
|
+
url,
|
15555
15670
|
status,
|
15556
15671
|
statusText,
|
15557
15672
|
headers
|
@@ -15566,7 +15681,7 @@ var MockHttpSocket = class extends MockSocket {
|
|
15566
15681
|
}
|
15567
15682
|
this.responseListenersPromise = this.onResponse({
|
15568
15683
|
response,
|
15569
|
-
isMockedResponse: this.
|
15684
|
+
isMockedResponse: this.socketState === "mock",
|
15570
15685
|
requestId: Reflect.get(this.request, kRequestId),
|
15571
15686
|
request: this.request,
|
15572
15687
|
socket: this
|
@@ -15616,10 +15731,12 @@ var MockHttpSocket = class extends MockSocket {
|
|
15616
15731
|
* its data/events through this Socket.
|
15617
15732
|
*/
|
15618
15733
|
passthrough() {
|
15734
|
+
this.socketState = "passthrough";
|
15619
15735
|
if (this.destroyed) {
|
15620
15736
|
return;
|
15621
15737
|
}
|
15622
15738
|
const socket = this.createConnection();
|
15739
|
+
this.originalSocket = socket;
|
15623
15740
|
this.once("error", (error3) => {
|
15624
15741
|
socket.destroy(error3);
|
15625
15742
|
});
|
@@ -15692,7 +15809,7 @@ var MockHttpSocket = class extends MockSocket {
|
|
15692
15809
|
return;
|
15693
15810
|
}
|
15694
15811
|
this.mockConnect();
|
15695
|
-
this.
|
15812
|
+
this.socketState = "mock";
|
15696
15813
|
this.flushWriteBuffer();
|
15697
15814
|
const serverResponse = new import_http3.ServerResponse(new import_http3.IncomingMessage(this));
|
15698
15815
|
serverResponse.assignSocket(
|
@@ -15775,8 +15892,11 @@ var MockHttpSocket = class extends MockSocket {
|
|
15775
15892
|
}
|
15776
15893
|
}
|
15777
15894
|
flushWriteBuffer() {
|
15778
|
-
for (const
|
15779
|
-
|
15895
|
+
for (const writeCall of this.writeBuffer) {
|
15896
|
+
if (typeof writeCall[2] === "function") {
|
15897
|
+
writeCall[2]();
|
15898
|
+
writeCall[2] = void 0;
|
15899
|
+
}
|
15780
15900
|
}
|
15781
15901
|
}
|
15782
15902
|
onRequestBody(chunk) {
|
@@ -16200,7 +16320,7 @@ var _ClientRequestInterceptor = class extends Interceptor {
|
|
16200
16320
|
var ClientRequestInterceptor = _ClientRequestInterceptor;
|
16201
16321
|
ClientRequestInterceptor.symbol = Symbol("client-request-interceptor");
|
16202
16322
|
|
16203
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
16323
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-TX5GBTFY.mjs
|
16204
16324
|
function hasConfigurableGlobal(propertyName) {
|
16205
16325
|
const descriptor = Object.getOwnPropertyDescriptor(globalThis, propertyName);
|
16206
16326
|
if (typeof descriptor === "undefined") {
|
@@ -16221,7 +16341,7 @@ function hasConfigurableGlobal(propertyName) {
|
|
16221
16341
|
return true;
|
16222
16342
|
}
|
16223
16343
|
|
16224
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
16344
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-OMWE7UVM.mjs
|
16225
16345
|
function concatArrayBuffer(left, right) {
|
16226
16346
|
const result = new Uint8Array(left.byteLength + right.byteLength);
|
16227
16347
|
result.set(left, 0);
|
@@ -16384,8 +16504,9 @@ function parseJson(data) {
|
|
16384
16504
|
}
|
16385
16505
|
}
|
16386
16506
|
function createResponse(request, body) {
|
16387
|
-
const responseBodyOrNull =
|
16388
|
-
return new
|
16507
|
+
const responseBodyOrNull = FetchResponse.isResponseWithBody(request.status) ? body : null;
|
16508
|
+
return new FetchResponse(responseBodyOrNull, {
|
16509
|
+
url: request.responseURL,
|
16389
16510
|
status: request.status,
|
16390
16511
|
statusText: request.statusText,
|
16391
16512
|
headers: createHeadersFromXMLHttpReqestHeaders(
|
@@ -17006,7 +17127,7 @@ var _XMLHttpRequestInterceptor = class extends Interceptor {
|
|
17006
17127
|
var XMLHttpRequestInterceptor = _XMLHttpRequestInterceptor;
|
17007
17128
|
XMLHttpRequestInterceptor.interceptorSymbol = Symbol("xhr");
|
17008
17129
|
|
17009
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17130
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-CTGTMEFD.mjs
|
17010
17131
|
var import_zlib = __toESM(require("zlib"), 1);
|
17011
17132
|
function canParseUrl(url) {
|
17012
17133
|
try {
|
@@ -17197,8 +17318,9 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17197
17318
|
rawResponse
|
17198
17319
|
});
|
17199
17320
|
const decompressedStream = decompressResponse(rawResponse);
|
17200
|
-
const response = decompressedStream === null ? rawResponse : new
|
17201
|
-
|
17321
|
+
const response = decompressedStream === null ? rawResponse : new FetchResponse(decompressedStream, rawResponse);
|
17322
|
+
FetchResponse.setUrl(request.url, response);
|
17323
|
+
if (FetchResponse.isRedirectResponse(response.status)) {
|
17202
17324
|
if (request.redirect === "error") {
|
17203
17325
|
responsePromise.reject(createNetworkError("unexpected redirect"));
|
17204
17326
|
return;
|
@@ -17215,12 +17337,6 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17215
17337
|
return;
|
17216
17338
|
}
|
17217
17339
|
}
|
17218
|
-
Object.defineProperty(response, "url", {
|
17219
|
-
writable: false,
|
17220
|
-
enumerable: true,
|
17221
|
-
configurable: false,
|
17222
|
-
value: request.url
|
17223
|
-
});
|
17224
17340
|
if (this.emitter.listenerCount("response") > 0) {
|
17225
17341
|
this.logger.info('emitting the "response" event...');
|
17226
17342
|
await emitAsync(this.emitter, "response", {
|
@@ -17286,12 +17402,12 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17286
17402
|
var FetchInterceptor = _FetchInterceptor;
|
17287
17403
|
FetchInterceptor.symbol = Symbol("fetch");
|
17288
17404
|
|
17289
|
-
// ../../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
|
17290
17406
|
function isObject2(value) {
|
17291
17407
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
17292
17408
|
}
|
17293
17409
|
|
17294
|
-
// ../../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
|
17295
17411
|
function mergeRight(left, right) {
|
17296
17412
|
return Object.entries(right).reduce(
|
17297
17413
|
(result, [key, rightValue]) => {
|
@@ -17311,7 +17427,7 @@ function mergeRight(left, right) {
|
|
17311
17427
|
);
|
17312
17428
|
}
|
17313
17429
|
|
17314
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17430
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/browser/chunk-TX5GBTFY.mjs
|
17315
17431
|
function hasConfigurableGlobal2(propertyName) {
|
17316
17432
|
const descriptor = Object.getOwnPropertyDescriptor(globalThis, propertyName);
|
17317
17433
|
if (typeof descriptor === "undefined") {
|
@@ -17332,7 +17448,7 @@ function hasConfigurableGlobal2(propertyName) {
|
|
17332
17448
|
return true;
|
17333
17449
|
}
|
17334
17450
|
|
17335
|
-
// ../../node_modules/.pnpm/@mswjs+interceptors@0.
|
17451
|
+
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/browser/chunk-QED3Q6Z2.mjs
|
17336
17452
|
function getGlobalSymbol2(symbol) {
|
17337
17453
|
return (
|
17338
17454
|
// @ts-ignore https://github.com/Microsoft/TypeScript/issues/24587
|
@@ -17479,7 +17595,7 @@ function createRequestId2() {
|
|
17479
17595
|
return Math.random().toString(16).slice(2);
|
17480
17596
|
}
|
17481
17597
|
|
17482
|
-
// ../../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
|
17483
17599
|
function bindEvent(target, event) {
|
17484
17600
|
Object.defineProperties(event, {
|
17485
17601
|
target: {
|
@@ -18042,23 +18158,39 @@ var WebSocketClassTransport = class extends EventTarget {
|
|
18042
18158
|
}
|
18043
18159
|
send(data) {
|
18044
18160
|
queueMicrotask(() => {
|
18045
|
-
this.socket.
|
18046
|
-
|
18047
|
-
|
18048
|
-
|
18049
|
-
|
18050
|
-
|
18051
|
-
|
18052
|
-
|
18053
|
-
|
18054
|
-
|
18055
|
-
|
18056
|
-
|
18057
|
-
|
18058
|
-
|
18059
|
-
|
18060
|
-
|
18061
|
-
|
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
|
+
}
|
18062
18194
|
});
|
18063
18195
|
}
|
18064
18196
|
close(code, reason) {
|
@@ -18140,17 +18272,17 @@ var _WebSocketInterceptor = class extends Interceptor2 {
|
|
18140
18272
|
var WebSocketInterceptor = _WebSocketInterceptor;
|
18141
18273
|
WebSocketInterceptor.symbol = Symbol("websocket");
|
18142
18274
|
|
18143
|
-
// ../../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
|
18144
18276
|
var webSocketInterceptor = new WebSocketInterceptor();
|
18145
18277
|
|
18146
|
-
// ../../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
|
18147
18279
|
function isHandlerKind(kind) {
|
18148
18280
|
return (input) => {
|
18149
18281
|
return input != null && typeof input === "object" && "__kind" in input && input.__kind === kind;
|
18150
18282
|
};
|
18151
18283
|
}
|
18152
18284
|
|
18153
|
-
// ../../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
|
18154
18286
|
function handleWebSocketEvent(options) {
|
18155
18287
|
webSocketInterceptor.on("connection", async (connection) => {
|
18156
18288
|
const handlers = options.getHandlers();
|
@@ -18198,7 +18330,7 @@ function handleWebSocketEvent(options) {
|
|
18198
18330
|
});
|
18199
18331
|
}
|
18200
18332
|
|
18201
|
-
// ../../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
|
18202
18334
|
var DEFAULT_LISTEN_OPTIONS = {
|
18203
18335
|
onUnhandledRequest: "warn"
|
18204
18336
|
};
|
@@ -18212,7 +18344,6 @@ var SetupServerCommonApi = class extends SetupApi {
|
|
18212
18344
|
interceptors: interceptors.map((Interceptor3) => new Interceptor3())
|
18213
18345
|
});
|
18214
18346
|
this.resolvedOptions = {};
|
18215
|
-
this.init();
|
18216
18347
|
}
|
18217
18348
|
/**
|
18218
18349
|
* Subscribe to all requests that are using the interceptor object
|
@@ -18287,6 +18418,7 @@ var SetupServerCommonApi = class extends SetupApi {
|
|
18287
18418
|
options
|
18288
18419
|
);
|
18289
18420
|
this.interceptor.apply();
|
18421
|
+
this.init();
|
18290
18422
|
this.subscriptions.push(() => this.interceptor.dispose());
|
18291
18423
|
webSocketInterceptor.apply();
|
18292
18424
|
this.subscriptions.push(() => webSocketInterceptor.dispose());
|
@@ -18355,116 +18487,11 @@ var setupServer = (...handlers) => {
|
|
18355
18487
|
return new SetupServerApi(handlers);
|
18356
18488
|
};
|
18357
18489
|
|
18358
|
-
// src/test/binary-test-server.ts
|
18359
|
-
var BinaryTestServer = class {
|
18360
|
-
constructor(url) {
|
18361
|
-
this.responseBody = null;
|
18362
|
-
this.responseHeaders = {};
|
18363
|
-
this.responseStatus = 200;
|
18364
|
-
this.server = setupServer(
|
18365
|
-
http.post(url, ({ request }) => {
|
18366
|
-
this.request = request;
|
18367
|
-
if (this.responseBody === null) {
|
18368
|
-
return new HttpResponse(null, { status: this.responseStatus });
|
18369
|
-
}
|
18370
|
-
return new HttpResponse(this.responseBody, {
|
18371
|
-
status: this.responseStatus,
|
18372
|
-
headers: this.responseHeaders
|
18373
|
-
});
|
18374
|
-
})
|
18375
|
-
);
|
18376
|
-
}
|
18377
|
-
async getRequestBodyJson() {
|
18378
|
-
expect(this.request).toBeDefined();
|
18379
|
-
return JSON.parse(await this.request.text());
|
18380
|
-
}
|
18381
|
-
async getRequestHeaders() {
|
18382
|
-
expect(this.request).toBeDefined();
|
18383
|
-
const requestHeaders = this.request.headers;
|
18384
|
-
const headersObject = {};
|
18385
|
-
requestHeaders.forEach((value, key) => {
|
18386
|
-
headersObject[key] = value;
|
18387
|
-
});
|
18388
|
-
return headersObject;
|
18389
|
-
}
|
18390
|
-
async getRequestUrlSearchParams() {
|
18391
|
-
expect(this.request).toBeDefined();
|
18392
|
-
return new URL(this.request.url).searchParams;
|
18393
|
-
}
|
18394
|
-
async getRequestUrl() {
|
18395
|
-
expect(this.request).toBeDefined();
|
18396
|
-
return new URL(this.request.url).toString();
|
18397
|
-
}
|
18398
|
-
setupTestEnvironment() {
|
18399
|
-
beforeAll(() => this.server.listen());
|
18400
|
-
beforeEach(() => {
|
18401
|
-
this.responseBody = null;
|
18402
|
-
this.request = void 0;
|
18403
|
-
this.responseHeaders = {};
|
18404
|
-
this.responseStatus = 200;
|
18405
|
-
});
|
18406
|
-
afterEach(() => this.server.resetHandlers());
|
18407
|
-
afterAll(() => this.server.close());
|
18408
|
-
}
|
18409
|
-
};
|
18410
|
-
|
18411
|
-
// src/test/convert-array-to-async-iterable.ts
|
18412
|
-
function convertArrayToAsyncIterable(values) {
|
18413
|
-
return {
|
18414
|
-
async *[Symbol.asyncIterator]() {
|
18415
|
-
for (const value of values) {
|
18416
|
-
yield value;
|
18417
|
-
}
|
18418
|
-
}
|
18419
|
-
};
|
18420
|
-
}
|
18421
|
-
|
18422
|
-
// src/test/convert-array-to-readable-stream.ts
|
18423
|
-
function convertArrayToReadableStream(values) {
|
18424
|
-
return new ReadableStream({
|
18425
|
-
start(controller) {
|
18426
|
-
try {
|
18427
|
-
for (const value of values) {
|
18428
|
-
controller.enqueue(value);
|
18429
|
-
}
|
18430
|
-
} finally {
|
18431
|
-
controller.close();
|
18432
|
-
}
|
18433
|
-
}
|
18434
|
-
});
|
18435
|
-
}
|
18436
|
-
|
18437
|
-
// src/test/convert-async-iterable-to-array.ts
|
18438
|
-
async function convertAsyncIterableToArray(iterable) {
|
18439
|
-
const result = [];
|
18440
|
-
for await (const item of iterable) {
|
18441
|
-
result.push(item);
|
18442
|
-
}
|
18443
|
-
return result;
|
18444
|
-
}
|
18445
|
-
|
18446
|
-
// src/test/convert-readable-stream-to-array.ts
|
18447
|
-
async function convertReadableStreamToArray(stream) {
|
18448
|
-
const reader = stream.getReader();
|
18449
|
-
const result = [];
|
18450
|
-
while (true) {
|
18451
|
-
const { done, value } = await reader.read();
|
18452
|
-
if (done)
|
18453
|
-
break;
|
18454
|
-
result.push(value);
|
18455
|
-
}
|
18456
|
-
return result;
|
18457
|
-
}
|
18458
|
-
|
18459
|
-
// src/test/convert-response-stream-to-array.ts
|
18460
|
-
async function convertResponseStreamToArray(response) {
|
18461
|
-
return convertReadableStreamToArray(
|
18462
|
-
response.body.pipeThrough(new TextDecoderStream())
|
18463
|
-
);
|
18464
|
-
}
|
18465
|
-
|
18466
18490
|
// src/test/json-test-server.ts
|
18467
18491
|
var JsonTestServer = class {
|
18492
|
+
/**
|
18493
|
+
* @deprecated Use createTestServer instead
|
18494
|
+
*/
|
18468
18495
|
constructor(url) {
|
18469
18496
|
this.responseHeaders = {};
|
18470
18497
|
this.responseBodyJson = {};
|
@@ -18515,6 +18542,9 @@ var JsonTestServer = class {
|
|
18515
18542
|
|
18516
18543
|
// src/test/streaming-test-server.ts
|
18517
18544
|
var StreamingTestServer = class {
|
18545
|
+
/**
|
18546
|
+
* @deprecated Use createTestServer instead
|
18547
|
+
*/
|
18518
18548
|
constructor(url) {
|
18519
18549
|
this.responseHeaders = {};
|
18520
18550
|
this.responseChunks = [];
|
@@ -18633,7 +18663,10 @@ function createServer({
|
|
18633
18663
|
var _a4, _b2;
|
18634
18664
|
pushCall(new TestServerCall(request));
|
18635
18665
|
const invocationCount = urlInvocationCounts[url]++;
|
18636
|
-
const response = responses2[
|
18666
|
+
const response = responses2[
|
18667
|
+
// TODO bug needs to be >=
|
18668
|
+
invocationCount > responses2.length ? responses2.length - 1 : invocationCount
|
18669
|
+
];
|
18637
18670
|
switch (response.type) {
|
18638
18671
|
case "json-value":
|
18639
18672
|
return HttpResponse.json(response.content, {
|
@@ -18745,9 +18778,115 @@ function describeWithTestServer(description, responses, testFunction) {
|
|
18745
18778
|
});
|
18746
18779
|
});
|
18747
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
|
+
}
|
18748
18888
|
// Annotate the CommonJS export names for ESM import in node:
|
18749
18889
|
0 && (module.exports = {
|
18750
|
-
BinaryTestServer,
|
18751
18890
|
JsonTestServer,
|
18752
18891
|
StreamingTestServer,
|
18753
18892
|
convertArrayToAsyncIterable,
|
@@ -18755,6 +18894,7 @@ function describeWithTestServer(description, responses, testFunction) {
|
|
18755
18894
|
convertAsyncIterableToArray,
|
18756
18895
|
convertReadableStreamToArray,
|
18757
18896
|
convertResponseStreamToArray,
|
18897
|
+
createTestServer,
|
18758
18898
|
describeWithTestServer,
|
18759
18899
|
withTestServer
|
18760
18900
|
});
|