@ai-sdk/provider-utils 2.2.7 → 3.0.0-alpha.1
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 +175 -12
- package/dist/index.d.mts +140 -61
- package/dist/index.d.ts +140 -61
- package/dist/index.js +217 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +189 -54
- package/dist/index.mjs.map +1 -1
- package/dist/test/index.d.mts +87 -0
- package/dist/test/index.d.ts +87 -0
- package/{test/dist → dist/test}/index.js +66 -358
- package/dist/test/index.js.map +1 -0
- package/{test/dist → dist/test}/index.mjs +64 -353
- package/dist/test/index.mjs.map +1 -0
- package/package.json +19 -17
- package/test.d.ts +1 -0
- package/test/dist/index.d.mts +0 -162
- package/test/dist/index.d.ts +0 -162
- package/test/dist/index.js.map +0 -1
- package/test/dist/index.mjs.map +0 -1
- /package/{test/dist → dist/test}/chunk-D6YTI3O5.mjs +0 -0
- /package/{test/dist → dist/test}/chunk-D6YTI3O5.mjs.map +0 -0
- /package/{test/dist → dist/test}/graphql-6JDEV3ML.mjs +0 -0
- /package/{test/dist → dist/test}/graphql-6JDEV3ML.mjs.map +0 -0
@@ -57,8 +57,6 @@ var __privateMethod = (obj, member, method) => {
|
|
57
57
|
// src/test/index.ts
|
58
58
|
var test_exports = {};
|
59
59
|
__export(test_exports, {
|
60
|
-
JsonTestServer: () => JsonTestServer,
|
61
|
-
StreamingTestServer: () => StreamingTestServer,
|
62
60
|
TestResponseController: () => TestResponseController,
|
63
61
|
convertArrayToAsyncIterable: () => convertArrayToAsyncIterable,
|
64
62
|
convertArrayToReadableStream: () => convertArrayToReadableStream,
|
@@ -66,9 +64,8 @@ __export(test_exports, {
|
|
66
64
|
convertReadableStreamToArray: () => convertReadableStreamToArray,
|
67
65
|
convertResponseStreamToArray: () => convertResponseStreamToArray,
|
68
66
|
createTestServer: () => createTestServer,
|
69
|
-
|
70
|
-
mockId: () => mockId
|
71
|
-
withTestServer: () => withTestServer
|
67
|
+
isNodeVersion: () => isNodeVersion,
|
68
|
+
mockId: () => mockId
|
72
69
|
});
|
73
70
|
module.exports = __toCommonJS(test_exports);
|
74
71
|
|
@@ -127,6 +124,20 @@ async function convertResponseStreamToArray(response) {
|
|
127
124
|
);
|
128
125
|
}
|
129
126
|
|
127
|
+
// src/test/is-node-version.ts
|
128
|
+
function isNodeVersion(version) {
|
129
|
+
const nodeMajorVersion = parseInt(process.version.slice(1).split(".")[0], 10);
|
130
|
+
return nodeMajorVersion === version;
|
131
|
+
}
|
132
|
+
|
133
|
+
// src/test/mock-id.ts
|
134
|
+
function mockId({
|
135
|
+
prefix = "id"
|
136
|
+
} = {}) {
|
137
|
+
let counter = 0;
|
138
|
+
return () => `${prefix}-${counter++}`;
|
139
|
+
}
|
140
|
+
|
130
141
|
// ../../node_modules/.pnpm/outvariant@1.4.3/node_modules/outvariant/lib/index.mjs
|
131
142
|
var POSITIONALS_EXP = /(%?)(%([sdijo]))/g;
|
132
143
|
function serializePositional(positional, flag) {
|
@@ -211,7 +222,7 @@ invariant.as = (ErrorConstructor, predicate, message3, ...positionals) => {
|
|
211
222
|
}
|
212
223
|
};
|
213
224
|
|
214
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
225
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/devUtils.mjs
|
215
226
|
var LIBRARY_PREFIX = "[MSW]";
|
216
227
|
function formatMessage(message3, ...positionals) {
|
217
228
|
const interpolatedMessage = format(message3, ...positionals);
|
@@ -235,7 +246,7 @@ var InternalError = class extends Error {
|
|
235
246
|
}
|
236
247
|
};
|
237
248
|
|
238
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
249
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/checkGlobals.mjs
|
239
250
|
function checkGlobals() {
|
240
251
|
invariant(
|
241
252
|
typeof URL !== "undefined",
|
@@ -410,7 +421,7 @@ var _Emitter = class {
|
|
410
421
|
var Emitter = _Emitter;
|
411
422
|
Emitter.defaultMaxListeners = 10;
|
412
423
|
|
413
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
424
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/pipeEvents.mjs
|
414
425
|
function pipeEvents(source, destination) {
|
415
426
|
const rawEmit = source.emit;
|
416
427
|
if (rawEmit._isPiped) {
|
@@ -424,14 +435,14 @@ function pipeEvents(source, destination) {
|
|
424
435
|
source.emit = sourceEmit;
|
425
436
|
}
|
426
437
|
|
427
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
438
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/toReadonlyArray.mjs
|
428
439
|
function toReadonlyArray(source) {
|
429
440
|
const clone = [...source];
|
430
441
|
Object.freeze(clone);
|
431
442
|
return clone;
|
432
443
|
}
|
433
444
|
|
434
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
445
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/Disposable.mjs
|
435
446
|
var Disposable = class {
|
436
447
|
constructor() {
|
437
448
|
__publicField(this, "subscriptions", []);
|
@@ -444,7 +455,7 @@ var Disposable = class {
|
|
444
455
|
}
|
445
456
|
};
|
446
457
|
|
447
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
458
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/SetupApi.mjs
|
448
459
|
var InMemoryHandlersController = class {
|
449
460
|
constructor(initialHandlers) {
|
450
461
|
__publicField(this, "handlers");
|
@@ -524,7 +535,7 @@ var SetupApi = class extends Disposable {
|
|
524
535
|
}
|
525
536
|
};
|
526
537
|
|
527
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
538
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/getCallFrame.mjs
|
528
539
|
var SOURCE_FRAME = /[\/\\]msw[\/\\]src[\/\\](.+)/;
|
529
540
|
var BUILD_FRAME = /(node_modules)?[\/\\]lib[\/\\](core|browser|node|native|iife)[\/\\]|^[^\/\\]*$/;
|
530
541
|
function getCallFrame(error3) {
|
@@ -543,7 +554,7 @@ function getCallFrame(error3) {
|
|
543
554
|
return declarationPath;
|
544
555
|
}
|
545
556
|
|
546
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
557
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/isIterable.mjs
|
547
558
|
function isIterable(fn) {
|
548
559
|
if (!fn) {
|
549
560
|
return false;
|
@@ -551,7 +562,7 @@ function isIterable(fn) {
|
|
551
562
|
return Reflect.has(fn, Symbol.iterator) || Reflect.has(fn, Symbol.asyncIterator);
|
552
563
|
}
|
553
564
|
|
554
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
565
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/handlers/RequestHandler.mjs
|
555
566
|
var _RequestHandler = class _RequestHandler {
|
556
567
|
constructor(args) {
|
557
568
|
__publicField(this, "__kind");
|
@@ -703,12 +714,12 @@ var _RequestHandler = class _RequestHandler {
|
|
703
714
|
__publicField(_RequestHandler, "cache", /* @__PURE__ */ new WeakMap());
|
704
715
|
var RequestHandler = _RequestHandler;
|
705
716
|
|
706
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
717
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/isStringEqual.mjs
|
707
718
|
function isStringEqual(actual, expected) {
|
708
719
|
return actual.toLowerCase() === expected.toLowerCase();
|
709
720
|
}
|
710
721
|
|
711
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
722
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/logging/getStatusCodeColor.mjs
|
712
723
|
function getStatusCodeColor(status) {
|
713
724
|
if (status < 300) {
|
714
725
|
return "#69AB32";
|
@@ -719,7 +730,7 @@ function getStatusCodeColor(status) {
|
|
719
730
|
return "#E95F5D";
|
720
731
|
}
|
721
732
|
|
722
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
733
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/logging/getTimestamp.mjs
|
723
734
|
function getTimestamp(options) {
|
724
735
|
const now = /* @__PURE__ */ new Date();
|
725
736
|
const timestamp = `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}:${now.getSeconds().toString().padStart(2, "0")}`;
|
@@ -729,7 +740,7 @@ function getTimestamp(options) {
|
|
729
740
|
return timestamp;
|
730
741
|
}
|
731
742
|
|
732
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
743
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/logging/serializeRequest.mjs
|
733
744
|
async function serializeRequest(request) {
|
734
745
|
const requestClone = request.clone();
|
735
746
|
const requestText = await requestClone.text();
|
@@ -908,7 +919,7 @@ var require_statuses = __commonJS({
|
|
908
919
|
var import_statuses = __toESM2(require_statuses(), 1);
|
909
920
|
var source_default = import_statuses.default;
|
910
921
|
|
911
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
922
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/logging/serializeResponse.mjs
|
912
923
|
var { message } = source_default;
|
913
924
|
async function serializeResponse(response) {
|
914
925
|
const responseClone = response.clone();
|
@@ -1818,7 +1829,7 @@ function getCleanUrl(url, isAbsolute = true) {
|
|
1818
1829
|
return [isAbsolute && url.origin, url.pathname].filter(Boolean).join("");
|
1819
1830
|
}
|
1820
1831
|
|
1821
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
1832
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/url/cleanUrl.mjs
|
1822
1833
|
var REDUNDANT_CHARACTERS_EXP = /[\?|#].*$/g;
|
1823
1834
|
function getSearchParams(path) {
|
1824
1835
|
return new URL(`/${path}`, "http://localhost").searchParams;
|
@@ -1830,12 +1841,12 @@ function cleanUrl(path) {
|
|
1830
1841
|
return path.replace(REDUNDANT_CHARACTERS_EXP, "");
|
1831
1842
|
}
|
1832
1843
|
|
1833
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
1844
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/url/isAbsoluteUrl.mjs
|
1834
1845
|
function isAbsoluteUrl(url) {
|
1835
1846
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
1836
1847
|
}
|
1837
1848
|
|
1838
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
1849
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/url/getAbsoluteUrl.mjs
|
1839
1850
|
function getAbsoluteUrl(path, baseUrl) {
|
1840
1851
|
if (isAbsoluteUrl(path)) {
|
1841
1852
|
return path;
|
@@ -1850,7 +1861,7 @@ function getAbsoluteUrl(path, baseUrl) {
|
|
1850
1861
|
) : path;
|
1851
1862
|
}
|
1852
1863
|
|
1853
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
1864
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/matching/normalizePath.mjs
|
1854
1865
|
function normalizePath(path, baseUrl) {
|
1855
1866
|
if (path instanceof RegExp) {
|
1856
1867
|
return path;
|
@@ -1859,7 +1870,7 @@ function normalizePath(path, baseUrl) {
|
|
1859
1870
|
return cleanUrl(maybeAbsoluteUrl);
|
1860
1871
|
}
|
1861
1872
|
|
1862
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
1873
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/matching/matchRequestUrl.mjs
|
1863
1874
|
function coercePath(path) {
|
1864
1875
|
return path.replace(
|
1865
1876
|
/([:a-zA-Z_-]*)(\*{1,2})+/g,
|
@@ -1884,7 +1895,7 @@ function matchRequestUrl(url, path, baseUrl) {
|
|
1884
1895
|
};
|
1885
1896
|
}
|
1886
1897
|
|
1887
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
1898
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/request/toPublicUrl.mjs
|
1888
1899
|
function toPublicUrl(url) {
|
1889
1900
|
if (typeof location === "undefined") {
|
1890
1901
|
return url.toString();
|
@@ -13934,7 +13945,7 @@ var require_cookie2 = __commonJS3({
|
|
13934
13945
|
var import_tough_cookie = __toESM4(require_cookie2(), 1);
|
13935
13946
|
var source_default3 = import_tough_cookie.default;
|
13936
13947
|
|
13937
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
13948
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/cookieStore.mjs
|
13938
13949
|
var { Cookie, CookieJar, Store, MemoryCookieStore, domainMatch, pathMatch } = source_default3;
|
13939
13950
|
var WebStorageCookieStore = class extends Store {
|
13940
13951
|
constructor() {
|
@@ -14086,7 +14097,7 @@ var WebStorageCookieStore = class extends Store {
|
|
14086
14097
|
var store = isNodeProcess() ? new MemoryCookieStore() : new WebStorageCookieStore();
|
14087
14098
|
var cookieStore = new CookieJar(store);
|
14088
14099
|
|
14089
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14100
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/request/getRequestCookies.mjs
|
14090
14101
|
function parseCookies(input) {
|
14091
14102
|
const parsedCookies = source_default2.parse(input);
|
14092
14103
|
const cookies = {};
|
@@ -14141,7 +14152,7 @@ function getAllRequestCookies(request) {
|
|
14141
14152
|
};
|
14142
14153
|
}
|
14143
14154
|
|
14144
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14155
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/handlers/HttpHandler.mjs
|
14145
14156
|
var HttpMethods = /* @__PURE__ */ ((HttpMethods2) => {
|
14146
14157
|
HttpMethods2["HEAD"] = "HEAD";
|
14147
14158
|
HttpMethods2["GET"] = "GET";
|
@@ -14231,7 +14242,7 @@ var HttpHandler = class extends RequestHandler {
|
|
14231
14242
|
}
|
14232
14243
|
};
|
14233
14244
|
|
14234
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14245
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/http.mjs
|
14235
14246
|
function createHttpHandler(method) {
|
14236
14247
|
return (path, resolver, options = {}) => {
|
14237
14248
|
return new HttpHandler(method, path, resolver, options);
|
@@ -14662,7 +14673,7 @@ var Headers2 = class _Headers {
|
|
14662
14673
|
}
|
14663
14674
|
};
|
14664
14675
|
|
14665
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14676
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/handlers/WebSocketHandler.mjs
|
14666
14677
|
var kEmitter = Symbol("kEmitter");
|
14667
14678
|
var kDispatchEvent = Symbol("kDispatchEvent");
|
14668
14679
|
var kSender = Symbol("kSender");
|
@@ -14836,7 +14847,7 @@ var until = async (promise) => {
|
|
14836
14847
|
}
|
14837
14848
|
};
|
14838
14849
|
|
14839
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14850
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/executeHandlers.mjs
|
14840
14851
|
var executeHandlers = async ({
|
14841
14852
|
request,
|
14842
14853
|
requestId,
|
@@ -14864,7 +14875,7 @@ var executeHandlers = async ({
|
|
14864
14875
|
return null;
|
14865
14876
|
};
|
14866
14877
|
|
14867
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14878
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/request/onUnhandledRequest.mjs
|
14868
14879
|
async function onUnhandledRequest(request, strategy = "warn") {
|
14869
14880
|
const url = new URL(request.url);
|
14870
14881
|
const publicUrl = toPublicUrl(url) + url.search;
|
@@ -14916,7 +14927,7 @@ Read more: https://mswjs.io/docs/getting-started/mocks`;
|
|
14916
14927
|
applyStrategy(strategy);
|
14917
14928
|
}
|
14918
14929
|
|
14919
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14930
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/HttpResponse/decorators.mjs
|
14920
14931
|
var { message: message2 } = source_default;
|
14921
14932
|
var kSetCookie = Symbol("kSetCookie");
|
14922
14933
|
function normalizeResponseInit(init = {}) {
|
@@ -14957,7 +14968,7 @@ function decorateResponse(response, init) {
|
|
14957
14968
|
return response;
|
14958
14969
|
}
|
14959
14970
|
|
14960
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14971
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/request/storeResponseCookies.mjs
|
14961
14972
|
function storeResponseCookies(request, response) {
|
14962
14973
|
const responseCookies = Reflect.get(response, kSetCookie);
|
14963
14974
|
if (responseCookies) {
|
@@ -14965,7 +14976,7 @@ function storeResponseCookies(request, response) {
|
|
14965
14976
|
}
|
14966
14977
|
}
|
14967
14978
|
|
14968
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
14979
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/handleRequest.mjs
|
14969
14980
|
async function handleRequest(request, requestId, handlers, options, emitter, handleRequestOptions) {
|
14970
14981
|
var _a4, _b2, _c2, _d, _e, _f;
|
14971
14982
|
emitter.emit("request:start", { request, requestId });
|
@@ -15016,7 +15027,7 @@ async function handleRequest(request, requestId, handlers, options, emitter, han
|
|
15016
15027
|
return response;
|
15017
15028
|
}
|
15018
15029
|
|
15019
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
15030
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/HttpResponse.mjs
|
15020
15031
|
var HttpResponse = class _HttpResponse extends Response {
|
15021
15032
|
constructor(body, init) {
|
15022
15033
|
const responseInit = normalizeResponseInit(init);
|
@@ -15123,10 +15134,10 @@ var HttpResponse = class _HttpResponse extends Response {
|
|
15123
15134
|
}
|
15124
15135
|
};
|
15125
15136
|
|
15126
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
15137
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/index.mjs
|
15127
15138
|
checkGlobals();
|
15128
15139
|
|
15129
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
15140
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/node/index.mjs
|
15130
15141
|
var import_node_async_hooks = require("async_hooks");
|
15131
15142
|
|
15132
15143
|
// ../../node_modules/.pnpm/@mswjs+interceptors@0.37.5/node_modules/@mswjs/interceptors/lib/node/chunk-5KMS5CTP.mjs
|
@@ -17404,12 +17415,12 @@ var _FetchInterceptor = class extends Interceptor {
|
|
17404
17415
|
var FetchInterceptor = _FetchInterceptor;
|
17405
17416
|
FetchInterceptor.symbol = Symbol("fetch");
|
17406
17417
|
|
17407
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
17418
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/isObject.mjs
|
17408
17419
|
function isObject2(value) {
|
17409
17420
|
return value != null && typeof value === "object" && !Array.isArray(value);
|
17410
17421
|
}
|
17411
17422
|
|
17412
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
17423
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/mergeRight.mjs
|
17413
17424
|
function mergeRight(left, right) {
|
17414
17425
|
return Object.entries(right).reduce(
|
17415
17426
|
(result, [key, rightValue]) => {
|
@@ -18274,17 +18285,17 @@ var _WebSocketInterceptor = class extends Interceptor2 {
|
|
18274
18285
|
var WebSocketInterceptor = _WebSocketInterceptor;
|
18275
18286
|
WebSocketInterceptor.symbol = Symbol("websocket");
|
18276
18287
|
|
18277
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
18288
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/ws/webSocketInterceptor.mjs
|
18278
18289
|
var webSocketInterceptor = new WebSocketInterceptor();
|
18279
18290
|
|
18280
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
18291
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/utils/internal/isHandlerKind.mjs
|
18281
18292
|
function isHandlerKind(kind) {
|
18282
18293
|
return (input) => {
|
18283
18294
|
return input != null && typeof input === "object" && "__kind" in input && input.__kind === kind;
|
18284
18295
|
};
|
18285
18296
|
}
|
18286
18297
|
|
18287
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
18298
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/core/ws/handleWebSocketEvent.mjs
|
18288
18299
|
function handleWebSocketEvent(options) {
|
18289
18300
|
webSocketInterceptor.on("connection", async (connection) => {
|
18290
18301
|
const handlers = options.getHandlers();
|
@@ -18332,7 +18343,7 @@ function handleWebSocketEvent(options) {
|
|
18332
18343
|
});
|
18333
18344
|
}
|
18334
18345
|
|
18335
|
-
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.
|
18346
|
+
// ../../node_modules/.pnpm/msw@2.7.0_@types+node@20.17.24_typescript@5.8.3/node_modules/msw/lib/node/index.mjs
|
18336
18347
|
var DEFAULT_LISTEN_OPTIONS = {
|
18337
18348
|
onUnhandledRequest: "warn"
|
18338
18349
|
};
|
@@ -18489,319 +18500,12 @@ var setupServer = (...handlers) => {
|
|
18489
18500
|
return new SetupServerApi(handlers);
|
18490
18501
|
};
|
18491
18502
|
|
18492
|
-
// src/test/json-test-server.ts
|
18493
|
-
var JsonTestServer = class {
|
18494
|
-
/**
|
18495
|
-
* @deprecated Use createTestServer instead
|
18496
|
-
*/
|
18497
|
-
constructor(url) {
|
18498
|
-
this.responseHeaders = {};
|
18499
|
-
this.responseBodyJson = {};
|
18500
|
-
const responseBodyJson = () => this.responseBodyJson;
|
18501
|
-
this.server = setupServer(
|
18502
|
-
http.post(url, ({ request }) => {
|
18503
|
-
this.request = request;
|
18504
|
-
return HttpResponse.json(responseBodyJson(), {
|
18505
|
-
headers: {
|
18506
|
-
"Content-Type": "application/json",
|
18507
|
-
...this.responseHeaders
|
18508
|
-
}
|
18509
|
-
});
|
18510
|
-
})
|
18511
|
-
);
|
18512
|
-
}
|
18513
|
-
async getRequestBodyJson() {
|
18514
|
-
expect(this.request).toBeDefined();
|
18515
|
-
return JSON.parse(await this.request.text());
|
18516
|
-
}
|
18517
|
-
async getRequestHeaders() {
|
18518
|
-
expect(this.request).toBeDefined();
|
18519
|
-
const requestHeaders = this.request.headers;
|
18520
|
-
const headersObject = {};
|
18521
|
-
requestHeaders.forEach((value, key) => {
|
18522
|
-
headersObject[key] = value;
|
18523
|
-
});
|
18524
|
-
return headersObject;
|
18525
|
-
}
|
18526
|
-
async getRequestUrlSearchParams() {
|
18527
|
-
expect(this.request).toBeDefined();
|
18528
|
-
return new URL(this.request.url).searchParams;
|
18529
|
-
}
|
18530
|
-
async getRequestUrl() {
|
18531
|
-
expect(this.request).toBeDefined();
|
18532
|
-
return new URL(this.request.url).toString();
|
18533
|
-
}
|
18534
|
-
setupTestEnvironment() {
|
18535
|
-
beforeAll(() => this.server.listen());
|
18536
|
-
beforeEach(() => {
|
18537
|
-
this.responseBodyJson = {};
|
18538
|
-
this.request = void 0;
|
18539
|
-
});
|
18540
|
-
afterEach(() => this.server.resetHandlers());
|
18541
|
-
afterAll(() => this.server.close());
|
18542
|
-
}
|
18543
|
-
};
|
18544
|
-
|
18545
|
-
// src/test/mock-id.ts
|
18546
|
-
function mockId({
|
18547
|
-
prefix = "id"
|
18548
|
-
} = {}) {
|
18549
|
-
let counter = 0;
|
18550
|
-
return () => `${prefix}-${counter++}`;
|
18551
|
-
}
|
18552
|
-
|
18553
|
-
// src/test/streaming-test-server.ts
|
18554
|
-
var StreamingTestServer = class {
|
18555
|
-
/**
|
18556
|
-
* @deprecated Use createTestServer instead
|
18557
|
-
*/
|
18558
|
-
constructor(url) {
|
18559
|
-
this.responseHeaders = {};
|
18560
|
-
this.responseChunks = [];
|
18561
|
-
const responseChunks = () => this.responseChunks;
|
18562
|
-
this.server = setupServer(
|
18563
|
-
http.post(url, ({ request }) => {
|
18564
|
-
this.request = request;
|
18565
|
-
const encoder2 = new TextEncoder();
|
18566
|
-
const stream = new ReadableStream({
|
18567
|
-
async start(controller) {
|
18568
|
-
try {
|
18569
|
-
for (const chunk of responseChunks()) {
|
18570
|
-
controller.enqueue(encoder2.encode(chunk));
|
18571
|
-
}
|
18572
|
-
} finally {
|
18573
|
-
controller.close();
|
18574
|
-
}
|
18575
|
-
}
|
18576
|
-
});
|
18577
|
-
return new HttpResponse(stream, {
|
18578
|
-
status: 200,
|
18579
|
-
headers: {
|
18580
|
-
"Content-Type": "text/event-stream",
|
18581
|
-
"Cache-Control": "no-cache",
|
18582
|
-
Connection: "keep-alive",
|
18583
|
-
...this.responseHeaders
|
18584
|
-
}
|
18585
|
-
});
|
18586
|
-
})
|
18587
|
-
);
|
18588
|
-
}
|
18589
|
-
async getRequestBodyJson() {
|
18590
|
-
expect(this.request).toBeDefined();
|
18591
|
-
return JSON.parse(await this.request.text());
|
18592
|
-
}
|
18593
|
-
async getRequestHeaders() {
|
18594
|
-
expect(this.request).toBeDefined();
|
18595
|
-
const requestHeaders = this.request.headers;
|
18596
|
-
const headersObject = {};
|
18597
|
-
requestHeaders.forEach((value, key) => {
|
18598
|
-
headersObject[key] = value;
|
18599
|
-
});
|
18600
|
-
return headersObject;
|
18601
|
-
}
|
18602
|
-
async getRequestUrlSearchParams() {
|
18603
|
-
expect(this.request).toBeDefined();
|
18604
|
-
return new URL(this.request.url).searchParams;
|
18605
|
-
}
|
18606
|
-
setupTestEnvironment() {
|
18607
|
-
beforeAll(() => this.server.listen());
|
18608
|
-
beforeEach(() => {
|
18609
|
-
this.responseChunks = [];
|
18610
|
-
this.request = void 0;
|
18611
|
-
});
|
18612
|
-
afterEach(() => this.server.resetHandlers());
|
18613
|
-
afterAll(() => this.server.close());
|
18614
|
-
}
|
18615
|
-
};
|
18616
|
-
|
18617
18503
|
// src/test/test-server.ts
|
18618
18504
|
var TestServerCall = class {
|
18619
18505
|
constructor(request) {
|
18620
18506
|
this.request = request;
|
18621
18507
|
}
|
18622
|
-
|
18623
|
-
expect(this.request).toBeDefined();
|
18624
|
-
return JSON.parse(await this.request.text());
|
18625
|
-
}
|
18626
|
-
getRequestCredentials() {
|
18627
|
-
expect(this.request).toBeDefined();
|
18628
|
-
return this.request.credentials;
|
18629
|
-
}
|
18630
|
-
getRequestHeaders() {
|
18631
|
-
expect(this.request).toBeDefined();
|
18632
|
-
const requestHeaders = this.request.headers;
|
18633
|
-
const headersObject = {};
|
18634
|
-
requestHeaders.forEach((value, key) => {
|
18635
|
-
headersObject[key] = value;
|
18636
|
-
});
|
18637
|
-
return headersObject;
|
18638
|
-
}
|
18639
|
-
getRequestUrlSearchParams() {
|
18640
|
-
expect(this.request).toBeDefined();
|
18641
|
-
return new URL(this.request.url).searchParams;
|
18642
|
-
}
|
18643
|
-
};
|
18644
|
-
function createServer({
|
18645
|
-
responses,
|
18646
|
-
pushCall,
|
18647
|
-
pushController
|
18648
|
-
}) {
|
18649
|
-
const responsesArray = Array.isArray(responses) ? responses : [responses];
|
18650
|
-
const responsesByUrl = responsesArray.reduce(
|
18651
|
-
(responsesByUrl2, response) => {
|
18652
|
-
if (!responsesByUrl2[response.url]) {
|
18653
|
-
responsesByUrl2[response.url] = [];
|
18654
|
-
}
|
18655
|
-
responsesByUrl2[response.url].push(response);
|
18656
|
-
return responsesByUrl2;
|
18657
|
-
},
|
18658
|
-
{}
|
18659
|
-
);
|
18660
|
-
const streams = {};
|
18661
|
-
responsesArray.filter(
|
18662
|
-
(response) => response.type === "controlled-stream"
|
18663
|
-
).forEach((response) => {
|
18664
|
-
var _a4, _b2;
|
18665
|
-
let streamController;
|
18666
|
-
const stream = new ReadableStream({
|
18667
|
-
start(controller) {
|
18668
|
-
streamController = controller;
|
18669
|
-
}
|
18670
|
-
});
|
18671
|
-
pushController((_a4 = response.id) != null ? _a4 : "", () => streamController);
|
18672
|
-
streams[(_b2 = response.id) != null ? _b2 : ""] = stream;
|
18673
|
-
});
|
18674
|
-
const urlInvocationCounts = Object.fromEntries(
|
18675
|
-
Object.entries(responsesByUrl).map(([url]) => [url, 0])
|
18676
|
-
);
|
18677
|
-
return setupServer(
|
18678
|
-
...Object.entries(responsesByUrl).map(([url, responses2]) => {
|
18679
|
-
return http.post(url, ({ request }) => {
|
18680
|
-
var _a4, _b2;
|
18681
|
-
pushCall(new TestServerCall(request));
|
18682
|
-
const invocationCount = urlInvocationCounts[url]++;
|
18683
|
-
const response = responses2[
|
18684
|
-
// TODO bug needs to be >=
|
18685
|
-
invocationCount > responses2.length ? responses2.length - 1 : invocationCount
|
18686
|
-
];
|
18687
|
-
switch (response.type) {
|
18688
|
-
case "json-value":
|
18689
|
-
return HttpResponse.json(response.content, {
|
18690
|
-
status: 200,
|
18691
|
-
headers: {
|
18692
|
-
"Content-Type": "application/json",
|
18693
|
-
...response.headers
|
18694
|
-
}
|
18695
|
-
});
|
18696
|
-
case "stream-values":
|
18697
|
-
return new HttpResponse(
|
18698
|
-
convertArrayToReadableStream(response.content).pipeThrough(
|
18699
|
-
new TextEncoderStream()
|
18700
|
-
),
|
18701
|
-
{
|
18702
|
-
status: 200,
|
18703
|
-
headers: {
|
18704
|
-
"Content-Type": "text/event-stream",
|
18705
|
-
"Cache-Control": "no-cache",
|
18706
|
-
Connection: "keep-alive",
|
18707
|
-
...response.headers
|
18708
|
-
}
|
18709
|
-
}
|
18710
|
-
);
|
18711
|
-
case "controlled-stream": {
|
18712
|
-
return new HttpResponse(
|
18713
|
-
streams[(_a4 = response.id) != null ? _a4 : ""].pipeThrough(new TextEncoderStream()),
|
18714
|
-
{
|
18715
|
-
status: 200,
|
18716
|
-
headers: {
|
18717
|
-
"Content-Type": "text/event-stream",
|
18718
|
-
"Cache-Control": "no-cache",
|
18719
|
-
Connection: "keep-alive",
|
18720
|
-
...response.headers
|
18721
|
-
}
|
18722
|
-
}
|
18723
|
-
);
|
18724
|
-
}
|
18725
|
-
case "error":
|
18726
|
-
return HttpResponse.text((_b2 = response.content) != null ? _b2 : "Error", {
|
18727
|
-
status: response.status,
|
18728
|
-
headers: {
|
18729
|
-
...response.headers
|
18730
|
-
}
|
18731
|
-
});
|
18732
|
-
}
|
18733
|
-
});
|
18734
|
-
})
|
18735
|
-
);
|
18736
|
-
}
|
18737
|
-
function withTestServer(responses, testFunction) {
|
18738
|
-
return async () => {
|
18739
|
-
const calls = [];
|
18740
|
-
const controllers = {};
|
18741
|
-
const server = createServer({
|
18742
|
-
responses,
|
18743
|
-
pushCall: (call) => calls.push(call),
|
18744
|
-
pushController: (id, controller) => {
|
18745
|
-
controllers[id] = controller;
|
18746
|
-
}
|
18747
|
-
});
|
18748
|
-
try {
|
18749
|
-
server.listen();
|
18750
|
-
await testFunction({
|
18751
|
-
calls: () => calls,
|
18752
|
-
call: (index) => calls[index],
|
18753
|
-
getStreamController: (id) => {
|
18754
|
-
return controllers[id]();
|
18755
|
-
},
|
18756
|
-
get streamController() {
|
18757
|
-
return controllers[""]();
|
18758
|
-
}
|
18759
|
-
});
|
18760
|
-
} finally {
|
18761
|
-
server.close();
|
18762
|
-
}
|
18763
|
-
};
|
18764
|
-
}
|
18765
|
-
function describeWithTestServer(description, responses, testFunction) {
|
18766
|
-
describe(description, () => {
|
18767
|
-
let calls;
|
18768
|
-
let controllers;
|
18769
|
-
let server;
|
18770
|
-
beforeAll(() => {
|
18771
|
-
server = createServer({
|
18772
|
-
responses,
|
18773
|
-
pushCall: (call) => calls.push(call),
|
18774
|
-
pushController: (id, controller) => {
|
18775
|
-
controllers[id] = controller;
|
18776
|
-
}
|
18777
|
-
});
|
18778
|
-
server.listen();
|
18779
|
-
});
|
18780
|
-
beforeEach(() => {
|
18781
|
-
calls = [];
|
18782
|
-
controllers = {};
|
18783
|
-
server.resetHandlers();
|
18784
|
-
});
|
18785
|
-
afterAll(() => {
|
18786
|
-
server.close();
|
18787
|
-
});
|
18788
|
-
testFunction({
|
18789
|
-
calls: () => calls,
|
18790
|
-
call: (index) => calls[index],
|
18791
|
-
getStreamController: (id) => controllers[id](),
|
18792
|
-
get streamController() {
|
18793
|
-
return controllers[""]();
|
18794
|
-
}
|
18795
|
-
});
|
18796
|
-
});
|
18797
|
-
}
|
18798
|
-
|
18799
|
-
// src/test/unified-test-server.ts
|
18800
|
-
var TestServerCall2 = class {
|
18801
|
-
constructor(request) {
|
18802
|
-
this.request = request;
|
18803
|
-
}
|
18804
|
-
get requestBody() {
|
18508
|
+
get requestBodyJson() {
|
18805
18509
|
return this.request.text().then(JSON.parse);
|
18806
18510
|
}
|
18807
18511
|
get requestBodyMultipart() {
|
@@ -18847,7 +18551,7 @@ function createTestServer(routes) {
|
|
18847
18551
|
return http.all(url, ({ request }) => {
|
18848
18552
|
var _a4, _b2, _c2;
|
18849
18553
|
const callNumber = calls.length;
|
18850
|
-
calls.push(new
|
18554
|
+
calls.push(new TestServerCall(request));
|
18851
18555
|
const response = typeof handler.response === "function" ? handler.response({ callNumber }) : Array.isArray(handler.response) ? handler.response[callNumber] : handler.response;
|
18852
18556
|
if (response === void 0) {
|
18853
18557
|
return HttpResponse.json({ error: "Not Found" }, { status: 404 });
|
@@ -18878,6 +18582,13 @@ function createTestServer(routes) {
|
|
18878
18582
|
}
|
18879
18583
|
);
|
18880
18584
|
case "controlled-stream": {
|
18585
|
+
if (request.signal) {
|
18586
|
+
request.signal.addEventListener("abort", () => {
|
18587
|
+
response.controller.error(
|
18588
|
+
new DOMException("Aborted", "AbortError")
|
18589
|
+
);
|
18590
|
+
});
|
18591
|
+
}
|
18881
18592
|
return new HttpResponse(
|
18882
18593
|
response.controller.stream.pipeThrough(new TextEncoderStream()),
|
18883
18594
|
{
|
@@ -18955,8 +18666,6 @@ var TestResponseController = class {
|
|
18955
18666
|
};
|
18956
18667
|
// Annotate the CommonJS export names for ESM import in node:
|
18957
18668
|
0 && (module.exports = {
|
18958
|
-
JsonTestServer,
|
18959
|
-
StreamingTestServer,
|
18960
18669
|
TestResponseController,
|
18961
18670
|
convertArrayToAsyncIterable,
|
18962
18671
|
convertArrayToReadableStream,
|
@@ -18964,9 +18673,8 @@ var TestResponseController = class {
|
|
18964
18673
|
convertReadableStreamToArray,
|
18965
18674
|
convertResponseStreamToArray,
|
18966
18675
|
createTestServer,
|
18967
|
-
|
18968
|
-
mockId
|
18969
|
-
withTestServer
|
18676
|
+
isNodeVersion,
|
18677
|
+
mockId
|
18970
18678
|
});
|
18971
18679
|
/*! Bundled license information:
|
18972
18680
|
|