@ai-sdk/provider-utils 5.0.46 → 5.0.49

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/dist/index.js CHANGED
@@ -8,7 +8,7 @@ function combineHeaders(...headers) {
8
8
  return headers.reduce(
9
9
  (combinedHeaders, currentHeaders) => ({
10
10
  ...combinedHeaders,
11
- ...currentHeaders != null ? currentHeaders : {}
11
+ ...currentHeaders
12
12
  }),
13
13
  {}
14
14
  );
@@ -24,11 +24,11 @@ function removeUndefinedEntries(record) {
24
24
  // src/delay.ts
25
25
  async function delay(delayInMs, options) {
26
26
  if (delayInMs == null) {
27
- return Promise.resolve();
27
+ return;
28
28
  }
29
- const signal = options == null ? void 0 : options.abortSignal;
29
+ const signal = options?.abortSignal;
30
30
  return new Promise((resolve2, reject) => {
31
- if (signal == null ? void 0 : signal.aborted) {
31
+ if (signal?.aborted) {
32
32
  reject(createAbortError());
33
33
  return;
34
34
  }
@@ -38,13 +38,13 @@ async function delay(delayInMs, options) {
38
38
  }, delayInMs);
39
39
  const cleanup = () => {
40
40
  clearTimeout(timeoutId);
41
- signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
41
+ signal?.removeEventListener("abort", onAbort);
42
42
  };
43
43
  const onAbort = () => {
44
44
  cleanup();
45
45
  reject(createAbortError());
46
46
  };
47
- signal == null ? void 0 : signal.addEventListener("abort", onAbort);
47
+ signal?.addEventListener("abort", onAbort);
48
48
  });
49
49
  }
50
50
  function createAbortError() {
@@ -53,7 +53,7 @@ function createAbortError() {
53
53
 
54
54
  // src/websocket.ts
55
55
  function getWebSocketConstructor(webSocket) {
56
- const WebSocketConstructor = webSocket != null ? webSocket : globalThis.WebSocket;
56
+ const WebSocketConstructor = webSocket ?? globalThis.WebSocket;
57
57
  if (WebSocketConstructor == null) {
58
58
  throw new Error("No WebSocket implementation available.");
59
59
  }
@@ -86,9 +86,8 @@ async function waitForWebSocketBufferDrain(socket, {
86
86
  pollIntervalMs = 20,
87
87
  abortSignal
88
88
  } = {}) {
89
- var _a3;
90
- while (socket.readyState === WEBSOCKET_OPEN_STATE && ((_a3 = socket.bufferedAmount) != null ? _a3 : 0) > highWaterMark) {
91
- if ((abortSignal == null ? void 0 : abortSignal.aborted) === true) {
89
+ while (socket.readyState === WEBSOCKET_OPEN_STATE && (socket.bufferedAmount ?? 0) > highWaterMark) {
90
+ if (abortSignal?.aborted === true) {
92
91
  return;
93
92
  }
94
93
  await delay(pollIntervalMs);
@@ -109,43 +108,39 @@ function connectToWebSocket({
109
108
  onClose,
110
109
  onAbort
111
110
  }) {
112
- var _a3;
113
111
  let socket;
114
112
  let abortListener;
115
113
  const close = (code) => {
116
114
  if (abortListener != null) {
117
- abortSignal == null ? void 0 : abortSignal.removeEventListener("abort", abortListener);
115
+ abortSignal?.removeEventListener("abort", abortListener);
118
116
  abortListener = void 0;
119
117
  }
120
118
  try {
121
- socket == null ? void 0 : socket.close(code);
122
- } catch (e) {
119
+ socket?.close(code);
120
+ } catch {
123
121
  }
124
122
  };
125
- if (abortSignal == null ? void 0 : abortSignal.aborted) {
126
- onAbort == null ? void 0 : onAbort((_a3 = abortSignal.reason) != null ? _a3 : new Error("Aborted"));
123
+ if (abortSignal?.aborted) {
124
+ onAbort?.(abortSignal.reason ?? new Error("Aborted"));
127
125
  return { socket: void 0, close };
128
126
  }
129
127
  try {
130
128
  const WebSocketConstructor = getWebSocketConstructor(webSocket);
131
129
  socket = new WebSocketConstructor(url, protocols, {
132
- headers: removeUndefinedEntries(headers != null ? headers : {})
130
+ headers: removeUndefinedEntries(headers ?? {})
133
131
  });
134
132
  } catch (error) {
135
133
  onProcessingError(error);
136
134
  return { socket: void 0, close };
137
135
  }
138
136
  if (abortSignal != null && onAbort != null) {
139
- abortListener = () => {
140
- var _a4;
141
- return onAbort((_a4 = abortSignal.reason) != null ? _a4 : new Error("Aborted"));
142
- };
137
+ abortListener = () => onAbort(abortSignal.reason ?? new Error("Aborted"));
143
138
  abortSignal.addEventListener("abort", abortListener, { once: true });
144
139
  }
145
140
  const openedSocket = socket;
146
141
  socket.onopen = () => {
147
142
  try {
148
- onOpen == null ? void 0 : onOpen(openedSocket);
143
+ onOpen?.(openedSocket);
149
144
  } catch (error) {
150
145
  onProcessingError(error);
151
146
  }
@@ -155,13 +150,13 @@ function connectToWebSocket({
155
150
  tail = tail.then(() => readWebSocketMessageText(event.data)).then((text) => onMessageText(text)).catch(onProcessingError);
156
151
  };
157
152
  socket.onerror = () => {
158
- tail = tail.then(() => onSocketError == null ? void 0 : onSocketError()).catch(onProcessingError);
153
+ tail = tail.then(() => onSocketError?.()).catch(onProcessingError);
159
154
  };
160
155
  socket.onclose = (event) => {
161
156
  const closeEvent = event;
162
- const code = typeof (closeEvent == null ? void 0 : closeEvent.code) === "number" ? closeEvent.code : void 0;
163
- const reason = typeof (closeEvent == null ? void 0 : closeEvent.reason) === "string" ? closeEvent.reason : void 0;
164
- tail = tail.then(() => onClose == null ? void 0 : onClose({ code, reason })).catch(onProcessingError);
157
+ const code = typeof closeEvent?.code === "number" ? closeEvent.code : void 0;
158
+ const reason = typeof closeEvent?.reason === "string" ? closeEvent.reason : void 0;
159
+ tail = tail.then(() => onClose?.({ code, reason })).catch(onProcessingError);
165
160
  };
166
161
  return { socket, close };
167
162
  }
@@ -197,7 +192,7 @@ function convertAsyncIteratorToReadableStream(iterator) {
197
192
  if (iterator.return) {
198
193
  try {
199
194
  await iterator.return(reason);
200
- } catch (e) {
195
+ } catch {
201
196
  }
202
197
  }
203
198
  }
@@ -285,8 +280,8 @@ function createLanguageModelResponseMetadata({
285
280
  created
286
281
  }) {
287
282
  return {
288
- id: id != null ? id : void 0,
289
- modelId: model != null ? model : void 0,
283
+ id: id ?? void 0,
284
+ modelId: model ?? void 0,
290
285
  timestamp: created != null ? new Date(created * 1e3) : void 0
291
286
  };
292
287
  }
@@ -324,14 +319,8 @@ function createToolNameMapping({
324
319
  }
325
320
  }
326
321
  return {
327
- toProviderToolName: (customToolName) => {
328
- var _a3;
329
- return (_a3 = customToolNameToProviderToolName[customToolName]) != null ? _a3 : customToolName;
330
- },
331
- toCustomToolName: (providerToolName) => {
332
- var _a3;
333
- return (_a3 = providerToolNameToCustomToolName[providerToolName]) != null ? _a3 : providerToolName;
334
- }
322
+ toProviderToolName: (customToolName) => customToolNameToProviderToolName[customToolName] ?? customToolName,
323
+ toCustomToolName: (providerToolName) => providerToolNameToCustomToolName[providerToolName] ?? providerToolName
335
324
  };
336
325
  }
337
326
 
@@ -383,17 +372,15 @@ var DelayedPromise = class {
383
372
  return this._promise;
384
373
  }
385
374
  resolve(value) {
386
- var _a3;
387
375
  this.status = { type: "resolved", value };
388
376
  if (this._promise) {
389
- (_a3 = this._resolve) == null ? void 0 : _a3.call(this, value);
377
+ this._resolve?.(value);
390
378
  }
391
379
  }
392
380
  reject(error) {
393
- var _a3;
394
381
  this.status = { type: "rejected", error };
395
382
  if (this._promise) {
396
- (_a3 = this._reject) == null ? void 0 : _a3.call(this, error);
383
+ this._reject?.(error);
397
384
  }
398
385
  }
399
386
  isResolved() {
@@ -417,14 +404,13 @@ function extractResponseHeaders(response) {
417
404
 
418
405
  // src/get-runtime-environment-user-agent.ts
419
406
  function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
420
- var _a3, _b3, _c;
421
407
  if (globalThisAny.window) {
422
408
  return `runtime/browser`;
423
409
  }
424
- if ((_a3 = globalThisAny.navigator) == null ? void 0 : _a3.userAgent) {
410
+ if (globalThisAny.navigator?.userAgent) {
425
411
  return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
426
412
  }
427
- if ((_c = (_b3 = globalThisAny.process) == null ? void 0 : _b3.versions) == null ? void 0 : _c.node) {
413
+ if (globalThisAny.process?.versions?.node) {
428
414
  return `runtime/node.js/${globalThisAny.process.version.substring(0)}`;
429
415
  }
430
416
  if (globalThisAny.EdgeRuntime) {
@@ -468,7 +454,6 @@ function findNetworkError(error) {
468
454
  }
469
455
  current = current.cause;
470
456
  }
471
- return void 0;
472
457
  }
473
458
  function handleFetchError({
474
459
  error,
@@ -518,7 +503,7 @@ function handleFetchError({
518
503
  }
519
504
 
520
505
  // src/version.ts
521
- var VERSION = true ? "5.0.46" : "0.0.0-test";
506
+ var VERSION = true ? "5.0.49" : "0.0.0-test";
522
507
 
523
508
  // src/normalize-headers.ts
524
509
  function normalizeHeaders(headers) {
@@ -906,7 +891,6 @@ function detectMediaTypeBySignatures({
906
891
  return signature.mediaType;
907
892
  }
908
893
  }
909
- return void 0;
910
894
  }
911
895
  var topLevelSignatureTables = {
912
896
  image: imageMediaTypeSignatures,
@@ -952,10 +936,9 @@ function isFullMediaType(mediaType) {
952
936
 
953
937
  // src/cancel-response-body.ts
954
938
  async function cancelResponseBody(response) {
955
- var _a3;
956
939
  try {
957
- await ((_a3 = response.body) == null ? void 0 : _a3.cancel());
958
- } catch (e) {
940
+ await response.body?.cancel();
941
+ } catch {
959
942
  }
960
943
  }
961
944
 
@@ -993,7 +976,7 @@ function isBrowserRuntime(globalThisAny = globalThis) {
993
976
  function isSameOrigin(url, baseUrl) {
994
977
  try {
995
978
  return new URL(url).origin === new URL(baseUrl).origin;
996
- } catch (e) {
979
+ } catch {
997
980
  return false;
998
981
  }
999
982
  }
@@ -1003,7 +986,7 @@ function validateDownloadUrl(url) {
1003
986
  let parsed;
1004
987
  try {
1005
988
  parsed = new URL(url);
1006
- } catch (e) {
989
+ } catch {
1007
990
  throw new DownloadError({
1008
991
  url,
1009
992
  message: `Invalid URL: ${url}`
@@ -1048,7 +1031,6 @@ function validateDownloadUrl(url) {
1048
1031
  message: `URL with IP address ${hostname} is not allowed`
1049
1032
  });
1050
1033
  }
1051
- return;
1052
1034
  }
1053
1035
  }
1054
1036
  function validateDownloadAddress({
@@ -1190,15 +1172,14 @@ function createSafeLookup(lookup) {
1190
1172
  }
1191
1173
  var safeNodeFetchPromise;
1192
1174
  function isNodeRuntime() {
1193
- var _a3, _b3, _c;
1194
1175
  const runtimeProcess = globalThis.process;
1195
- return ((_a3 = runtimeProcess == null ? void 0 : runtimeProcess.release) == null ? void 0 : _a3.name) === "node" && ((_b3 = runtimeProcess.versions) == null ? void 0 : _b3.bun) == null && ((_c = runtimeProcess.versions) == null ? void 0 : _c.deno) == null && runtimeProcess.title !== "workerd" && globalThis.EdgeRuntime == null;
1176
+ return runtimeProcess?.release?.name === "node" && runtimeProcess.versions?.bun == null && runtimeProcess.versions?.deno == null && runtimeProcess.title !== "workerd" && globalThis.EdgeRuntime == null;
1196
1177
  }
1197
1178
  async function getDefaultDownloadFetch() {
1198
1179
  if (!isNodeRuntime()) {
1199
1180
  return globalThis.fetch;
1200
1181
  }
1201
- return safeNodeFetchPromise != null ? safeNodeFetchPromise : safeNodeFetchPromise = Promise.resolve().then(createSafeNodeFetch);
1182
+ return safeNodeFetchPromise ??= Promise.resolve().then(createSafeNodeFetch);
1202
1183
  }
1203
1184
  function createSafeNodeFetch() {
1204
1185
  const module = loadBuiltinModule("node:module");
@@ -1219,9 +1200,8 @@ function createSafeNodeFetch() {
1219
1200
  ));
1220
1201
  }
1221
1202
  function loadBuiltinModule(id) {
1222
- var _a3;
1223
1203
  const processWithBuiltins = globalThis.process;
1224
- const builtinModule = (_a3 = processWithBuiltins == null ? void 0 : processWithBuiltins.getBuiltinModule) == null ? void 0 : _a3.call(processWithBuiltins, id);
1204
+ const builtinModule = processWithBuiltins?.getBuiltinModule?.(id);
1225
1205
  if (builtinModule == null) {
1226
1206
  throw new Error(`Node.js built-in module ${id} is unavailable`);
1227
1207
  }
@@ -1234,7 +1214,7 @@ function getCurrentModulePath() {
1234
1214
  const error = new Error("Capture current module path");
1235
1215
  Error.captureStackTrace(error, getCurrentModulePath);
1236
1216
  const [caller] = error.stack;
1237
- const fileName = caller == null ? void 0 : caller.getFileName();
1217
+ const fileName = caller?.getFileName();
1238
1218
  if (fileName == null) {
1239
1219
  throw new Error("Unable to determine the current module path");
1240
1220
  }
@@ -1312,7 +1292,6 @@ async function fetchWithValidatedRedirects({
1312
1292
  fetch: customFetch,
1313
1293
  trustedOrigin
1314
1294
  }) {
1315
- var _a3;
1316
1295
  let currentHeaders = headers === void 0 ? void 0 : sanitizeRequestHeaders(headers);
1317
1296
  const perHopInit = (redirect) => {
1318
1297
  const init = { signal: abortSignal, redirect };
@@ -1338,7 +1317,7 @@ async function fetchWithValidatedRedirects({
1338
1317
  }
1339
1318
  return await fetch(currentUrl, perHopInit("follow"));
1340
1319
  }
1341
- const location = (_a3 = response.headers) == null ? void 0 : _a3.get("location");
1320
+ const location = response.headers?.get("location");
1342
1321
  if (REDIRECT_STATUS_CODES.has(response.status) && location) {
1343
1322
  void cancelResponseBody(response);
1344
1323
  const nextUrl = new URL(location, currentUrl).toString();
@@ -1359,6 +1338,52 @@ async function fetchWithValidatedRedirects({
1359
1338
  });
1360
1339
  }
1361
1340
 
1341
+ // src/fetch-untrusted-url.ts
1342
+ var SAFE_UNTRUSTED_FIRST_HOP_HEADERS = /* @__PURE__ */ new Set([
1343
+ "accept",
1344
+ "accept-language",
1345
+ "baggage",
1346
+ "cache-control",
1347
+ "idempotency-key",
1348
+ "if-match",
1349
+ "if-modified-since",
1350
+ "if-none-match",
1351
+ "if-range",
1352
+ "if-unmodified-since",
1353
+ "pragma",
1354
+ "range",
1355
+ "traceparent",
1356
+ "tracestate",
1357
+ "user-agent",
1358
+ "x-correlation-id",
1359
+ "x-request-id"
1360
+ ]);
1361
+ async function fetchUntrustedUrl({
1362
+ headers,
1363
+ credentialedOrigin,
1364
+ untrustedFirstHopHeaders,
1365
+ ...options
1366
+ }) {
1367
+ let firstHopHeaders;
1368
+ if (headers !== void 0) {
1369
+ firstHopHeaders = sanitizeRequestHeaders(headers);
1370
+ const origin = credentialedOrigin ?? options.trustedOrigin;
1371
+ if (origin === void 0 || !isSameOrigin(options.url, origin)) {
1372
+ const allowedHeaders = /* @__PURE__ */ new Set([
1373
+ ...SAFE_UNTRUSTED_FIRST_HOP_HEADERS,
1374
+ ...(untrustedFirstHopHeaders ?? []).map((name3) => name3.toLowerCase())
1375
+ ]);
1376
+ firstHopHeaders = new Headers(
1377
+ [...firstHopHeaders].filter(([name3]) => allowedHeaders.has(name3))
1378
+ );
1379
+ }
1380
+ }
1381
+ return fetchWithValidatedRedirects({
1382
+ ...options,
1383
+ headers: firstHopHeaders
1384
+ });
1385
+ }
1386
+
1362
1387
  // src/read-response-with-size-limit.ts
1363
1388
  var DEFAULT_MAX_DOWNLOAD_SIZE = 2 * 1024 * 1024 * 1024;
1364
1389
  async function readResponseWithSizeLimit({
@@ -1402,7 +1427,7 @@ async function readResponseWithSizeLimit({
1402
1427
  } finally {
1403
1428
  try {
1404
1429
  await reader.cancel();
1405
- } catch (e) {
1430
+ } catch {
1406
1431
  } finally {
1407
1432
  reader.releaseLock();
1408
1433
  }
@@ -1418,11 +1443,10 @@ async function readResponseWithSizeLimit({
1418
1443
 
1419
1444
  // src/download-blob.ts
1420
1445
  async function downloadBlob(url, options) {
1421
- var _a3, _b3;
1422
1446
  try {
1423
- const response = await fetchWithValidatedRedirects({
1447
+ const response = await fetchUntrustedUrl({
1424
1448
  url,
1425
- abortSignal: options == null ? void 0 : options.abortSignal
1449
+ abortSignal: options?.abortSignal
1426
1450
  });
1427
1451
  if (!response.ok) {
1428
1452
  await cancelResponseBody(response);
@@ -1435,9 +1459,9 @@ async function downloadBlob(url, options) {
1435
1459
  const data = await readResponseWithSizeLimit({
1436
1460
  response,
1437
1461
  url,
1438
- maxBytes: (_a3 = options == null ? void 0 : options.maxBytes) != null ? _a3 : DEFAULT_MAX_DOWNLOAD_SIZE
1462
+ maxBytes: options?.maxBytes ?? DEFAULT_MAX_DOWNLOAD_SIZE
1439
1463
  });
1440
- const contentType = (_b3 = response.headers.get("content-type")) != null ? _b3 : void 0;
1464
+ const contentType = response.headers.get("content-type") ?? void 0;
1441
1465
  return new Blob([data], contentType ? { type: contentType } : void 0);
1442
1466
  } catch (error) {
1443
1467
  if (DownloadError.isInstance(error)) {
@@ -1451,6 +1475,9 @@ async function downloadBlob(url, options) {
1451
1475
  var EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL = /* @__PURE__ */ Symbol.for(
1452
1476
  "vercel.ai.embeddingModel.maxInputBytesPerCall"
1453
1477
  );
1478
+ var EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER = /* @__PURE__ */ Symbol.for(
1479
+ "vercel.ai.embeddingModel.providerOptionsTransformer"
1480
+ );
1454
1481
 
1455
1482
  // src/extract-lines.ts
1456
1483
  function extractLines({
@@ -1461,8 +1488,8 @@ function extractLines({
1461
1488
  if (startLine == null && endLine == null) return text;
1462
1489
  const lineEnding = text.includes("\r\n") ? "\r\n" : text.includes("\n") ? "\n" : text.includes("\r") ? "\r" : "\n";
1463
1490
  const lines = text.split(lineEnding);
1464
- const start = Math.max(1, startLine != null ? startLine : 1) - 1;
1465
- const end = Math.min(lines.length, endLine != null ? endLine : lines.length);
1491
+ const start = Math.max(1, startLine ?? 1) - 1;
1492
+ const end = Math.min(lines.length, endLine ?? lines.length);
1466
1493
  return lines.slice(start, end).join(lineEnding);
1467
1494
  }
1468
1495
 
@@ -1518,7 +1545,7 @@ var getFromApi = async ({
1518
1545
  trustedOrigin
1519
1546
  }) => {
1520
1547
  try {
1521
- const requestFetch = fetch != null ? fetch : getOriginalFetch2();
1548
+ const requestFetch = fetch ?? getOriginalFetch2();
1522
1549
  const outgoingHeaders = credentialedOrigin !== void 0 && !isSameOrigin(url, credentialedOrigin) ? {} : headers;
1523
1550
  const requestHeaders = withUserAgentSuffix(
1524
1551
  outgoingHeaders,
@@ -1611,8 +1638,7 @@ function injectJsonInstructionIntoMessages({
1611
1638
  schemaPrefix,
1612
1639
  schemaSuffix
1613
1640
  }) {
1614
- var _a3, _b3;
1615
- const systemMessage = ((_a3 = messages[0]) == null ? void 0 : _a3.role) === "system" ? { ...messages[0] } : { role: "system", content: "" };
1641
+ const systemMessage = messages[0]?.role === "system" ? { ...messages[0] } : { role: "system", content: "" };
1616
1642
  systemMessage.content = injectJsonInstruction({
1617
1643
  prompt: systemMessage.content,
1618
1644
  schema,
@@ -1621,14 +1647,13 @@ function injectJsonInstructionIntoMessages({
1621
1647
  });
1622
1648
  return [
1623
1649
  systemMessage,
1624
- ...((_b3 = messages[0]) == null ? void 0 : _b3.role) === "system" ? messages.slice(1) : messages
1650
+ ...messages[0]?.role === "system" ? messages.slice(1) : messages
1625
1651
  ];
1626
1652
  }
1627
1653
 
1628
1654
  // src/is-buffer.ts
1629
1655
  function isBuffer(value) {
1630
- var _a3, _b3;
1631
- return (_b3 = (_a3 = globalThis.Buffer) == null ? void 0 : _a3.isBuffer(value)) != null ? _b3 : false;
1656
+ return globalThis.Buffer?.isBuffer(value) ?? false;
1632
1657
  }
1633
1658
 
1634
1659
  // src/is-non-nullable.ts
@@ -1665,7 +1690,7 @@ function isUrlSupported({
1665
1690
  if (isTopLevelOnly) {
1666
1691
  return `${mediaType}/` === mediaTypePrefix;
1667
1692
  }
1668
- return mediaType.startsWith(mediaTypePrefix);
1693
+ return mediaTypePrefix.endsWith("/") ? mediaType.startsWith(mediaTypePrefix) : mediaType === mediaTypePrefix;
1669
1694
  }).flatMap(({ regexes }) => regexes).some((pattern) => testRegExpFromStart(pattern, url));
1670
1695
  }
1671
1696
  function testRegExpFromStart(pattern, value) {
@@ -1828,15 +1853,14 @@ function mapReasoningToProviderBudget({
1828
1853
 
1829
1854
  // src/media-type-to-extension.ts
1830
1855
  function mediaTypeToExtension(mediaType) {
1831
- var _a3;
1832
1856
  const [_type, subtype = ""] = mediaType.toLowerCase().split("/");
1833
- return (_a3 = {
1857
+ return {
1834
1858
  mpeg: "mp3",
1835
1859
  "x-wav": "wav",
1836
1860
  opus: "ogg",
1837
1861
  mp4: "m4a",
1838
1862
  "x-m4a": "m4a"
1839
- }[subtype]) != null ? _a3 : subtype;
1863
+ }[subtype] ?? subtype;
1840
1864
  }
1841
1865
 
1842
1866
  // src/normalize-batch-request-counts.ts
@@ -1854,7 +1878,6 @@ function normalizeBatchRequestCounts({
1854
1878
  failed
1855
1879
  };
1856
1880
  }
1857
- return void 0;
1858
1881
  }
1859
1882
  function isNonNegativeSafeInteger(value) {
1860
1883
  return value != null && Number.isSafeInteger(value) && value >= 0;
@@ -1905,7 +1928,7 @@ function secureJsonParse(text) {
1905
1928
  const { stackTraceLimit } = Error;
1906
1929
  try {
1907
1930
  Error.stackTraceLimit = 0;
1908
- } catch (e) {
1931
+ } catch {
1909
1932
  return _parse(text);
1910
1933
  }
1911
1934
  try {
@@ -2002,11 +2025,10 @@ function parseAnyDef() {
2002
2025
 
2003
2026
  // src/to-json-schema/zod3-to-json-schema/parsers/array.ts
2004
2027
  function parseArrayDef(def, refs) {
2005
- var _a3, _b3, _c;
2006
2028
  const res = {
2007
2029
  type: "array"
2008
2030
  };
2009
- if (((_a3 = def.type) == null ? void 0 : _a3._def) && ((_c = (_b3 = def.type) == null ? void 0 : _b3._def) == null ? void 0 : _c.typeName) !== "ZodAny") {
2031
+ if (def.type?._def && def.type?._def?.typeName !== "ZodAny") {
2010
2032
  res.items = parseDef(def.type._def, {
2011
2033
  ...refs,
2012
2034
  currentPath: [...refs.currentPath, "items"]
@@ -2073,7 +2095,7 @@ var parseCatchDef = (def, refs) => {
2073
2095
 
2074
2096
  // src/to-json-schema/zod3-to-json-schema/parsers/date.ts
2075
2097
  function parseDateDef(def, refs, overrideDateStrategy) {
2076
- const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
2098
+ const strategy = overrideDateStrategy ?? refs.dateStrategy;
2077
2099
  if (Array.isArray(strategy)) {
2078
2100
  return {
2079
2101
  anyOf: strategy.map((item) => parseDateDef(def, refs, item))
@@ -2192,7 +2214,7 @@ var zodPatterns = {
2192
2214
  /**
2193
2215
  * `a-z` was added to replicate /i flag
2194
2216
  */
2195
- email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
2217
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9-]*\.)+[a-zA-Z]{2,}$/,
2196
2218
  /**
2197
2219
  * Constructed a valid Unicode RegExp
2198
2220
  *
@@ -2394,8 +2416,7 @@ function escapeNonAlphaNumeric(source) {
2394
2416
  return result;
2395
2417
  }
2396
2418
  function addFormat(schema, value, message, refs) {
2397
- var _a3;
2398
- if (schema.format || ((_a3 = schema.anyOf) == null ? void 0 : _a3.some((x) => x.format))) {
2419
+ if (schema.format || schema.anyOf?.some((x) => x.format)) {
2399
2420
  if (!schema.anyOf) {
2400
2421
  schema.anyOf = [];
2401
2422
  }
@@ -2414,8 +2435,7 @@ function addFormat(schema, value, message, refs) {
2414
2435
  }
2415
2436
  }
2416
2437
  function addPattern(schema, regex, message, refs) {
2417
- var _a3;
2418
- if (schema.pattern || ((_a3 = schema.allOf) == null ? void 0 : _a3.some((x) => x.pattern))) {
2438
+ if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
2419
2439
  if (!schema.allOf) {
2420
2440
  schema.allOf = [];
2421
2441
  }
@@ -2434,7 +2454,6 @@ function addPattern(schema, regex, message, refs) {
2434
2454
  }
2435
2455
  }
2436
2456
  function stringifyRegExpWithFlags(regex, refs) {
2437
- var _a3;
2438
2457
  if (!refs.applyRegexFlags || !regex.flags) {
2439
2458
  return regex.source;
2440
2459
  }
@@ -2464,7 +2483,7 @@ function stringifyRegExpWithFlags(regex, refs) {
2464
2483
  pattern += source[i];
2465
2484
  pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
2466
2485
  inCharRange = false;
2467
- } else if (source[i + 1] === "-" && ((_a3 = source[i + 2]) == null ? void 0 : _a3.match(/[a-z]/))) {
2486
+ } else if (source[i + 1] === "-" && source[i + 2]?.match(/[a-z]/)) {
2468
2487
  pattern += source[i];
2469
2488
  inCharRange = true;
2470
2489
  } else {
@@ -2505,7 +2524,7 @@ function stringifyRegExpWithFlags(regex, refs) {
2505
2524
  }
2506
2525
  try {
2507
2526
  new RegExp(pattern);
2508
- } catch (e) {
2527
+ } catch {
2509
2528
  console.warn(
2510
2529
  `Could not convert regex pattern at ${refs.currentPath.join(
2511
2530
  "/"
@@ -2518,28 +2537,27 @@ function stringifyRegExpWithFlags(regex, refs) {
2518
2537
 
2519
2538
  // src/to-json-schema/zod3-to-json-schema/parsers/record.ts
2520
2539
  function parseRecordDef(def, refs) {
2521
- var _a3, _b3, _c, _d, _e, _f;
2522
2540
  const schema = {
2523
2541
  type: "object",
2524
- additionalProperties: (_a3 = parseDef(def.valueType._def, {
2542
+ additionalProperties: parseDef(def.valueType._def, {
2525
2543
  ...refs,
2526
2544
  currentPath: [...refs.currentPath, "additionalProperties"]
2527
- })) != null ? _a3 : refs.allowedAdditionalProperties
2545
+ }) ?? refs.allowedAdditionalProperties
2528
2546
  };
2529
- if (((_b3 = def.keyType) == null ? void 0 : _b3._def.typeName) === "ZodString" && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
2547
+ if (def.keyType?._def.typeName === "ZodString" && def.keyType._def.checks?.length) {
2530
2548
  const { type: _type, ...keyType } = parseStringDef(def.keyType._def, refs);
2531
2549
  return {
2532
2550
  ...schema,
2533
2551
  propertyNames: keyType
2534
2552
  };
2535
- } else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === "ZodEnum") {
2553
+ } else if (def.keyType?._def.typeName === "ZodEnum") {
2536
2554
  return {
2537
2555
  ...schema,
2538
2556
  propertyNames: {
2539
2557
  enum: def.keyType._def.values
2540
2558
  }
2541
2559
  };
2542
- } else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === "ZodBranded" && def.keyType._def.type._def.typeName === "ZodString" && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
2560
+ } else if (def.keyType?._def.typeName === "ZodBranded" && def.keyType._def.type._def.typeName === "ZodString" && def.keyType._def.type._def.checks?.length) {
2543
2561
  const { type: _type, ...keyType } = parseBrandedDef(
2544
2562
  def.keyType._def,
2545
2563
  refs
@@ -2792,15 +2810,14 @@ function decideAdditionalProperties(def, refs) {
2792
2810
  function safeIsOptional(schema) {
2793
2811
  try {
2794
2812
  return schema.isOptional();
2795
- } catch (e) {
2813
+ } catch {
2796
2814
  return true;
2797
2815
  }
2798
2816
  }
2799
2817
 
2800
2818
  // src/to-json-schema/zod3-to-json-schema/parsers/optional.ts
2801
2819
  var parseOptionalDef = (def, refs) => {
2802
- var _a3;
2803
- if (refs.currentPath.toString() === ((_a3 = refs.propertyPath) == null ? void 0 : _a3.toString())) {
2820
+ if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
2804
2821
  return parseDef(def.innerType._def, refs);
2805
2822
  }
2806
2823
  const innerSchema = parseDef(def.innerType._def, {
@@ -2999,11 +3016,9 @@ var getRelativePath = (pathA, pathB) => {
2999
3016
 
3000
3017
  // src/to-json-schema/zod3-to-json-schema/parse-def.ts
3001
3018
  function parseDef(def, refs, forceResolution = false) {
3002
- var _a3;
3003
3019
  const seenItem = refs.seen.get(def);
3004
3020
  if (refs.override) {
3005
- const overrideResult = (_a3 = refs.override) == null ? void 0 : _a3.call(
3006
- refs,
3021
+ const overrideResult = refs.override?.(
3007
3022
  def,
3008
3023
  refs,
3009
3024
  seenItem,
@@ -3085,34 +3100,30 @@ var getRefs = (options) => {
3085
3100
 
3086
3101
  // src/to-json-schema/zod3-to-json-schema/zod3-to-json-schema.ts
3087
3102
  var zod3ToJsonSchema = (schema, options) => {
3088
- var _a3;
3089
3103
  const refs = getRefs(options);
3090
3104
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
3091
- (acc, [name4, schema2]) => {
3092
- var _a4;
3093
- return {
3094
- ...acc,
3095
- [name4]: (_a4 = parseDef(
3096
- schema2._def,
3097
- {
3098
- ...refs,
3099
- currentPath: [...refs.basePath, refs.definitionPath, name4]
3100
- },
3101
- true
3102
- )) != null ? _a4 : parseAnyDef()
3103
- };
3104
- },
3105
+ (acc, [name4, schema2]) => ({
3106
+ ...acc,
3107
+ [name4]: parseDef(
3108
+ schema2._def,
3109
+ {
3110
+ ...refs,
3111
+ currentPath: [...refs.basePath, refs.definitionPath, name4]
3112
+ },
3113
+ true
3114
+ ) ?? parseAnyDef()
3115
+ }),
3105
3116
  {}
3106
3117
  ) : void 0;
3107
- const name3 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
3108
- const main = (_a3 = parseDef(
3118
+ const name3 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
3119
+ const main = parseDef(
3109
3120
  schema._def,
3110
3121
  name3 === void 0 ? refs : {
3111
3122
  ...refs,
3112
3123
  currentPath: [...refs.basePath, refs.definitionPath, name3]
3113
3124
  },
3114
3125
  false
3115
- )) != null ? _a3 : parseAnyDef();
3126
+ ) ?? parseAnyDef();
3116
3127
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
3117
3128
  if (title !== void 0) {
3118
3129
  main.title = title;
@@ -3204,8 +3215,7 @@ function hasStandardJsonSchema(schema) {
3204
3215
  return schema["~standard"].jsonSchema != null;
3205
3216
  }
3206
3217
  function zod3Schema(zodSchema2, options) {
3207
- var _a3;
3208
- const useReferences = (_a3 = options == null ? void 0 : options.useReferences) != null ? _a3 : false;
3218
+ const useReferences = options?.useReferences ?? false;
3209
3219
  return jsonSchema(
3210
3220
  // defer json schema creation to avoid unnecessary computation when only validation is needed
3211
3221
  () => zod3ToJsonSchema(zodSchema2, {
@@ -3220,8 +3230,7 @@ function zod3Schema(zodSchema2, options) {
3220
3230
  );
3221
3231
  }
3222
3232
  function zod4Schema(zodSchema2, options) {
3223
- var _a3;
3224
- const useReferences = (_a3 = options == null ? void 0 : options.useReferences) != null ? _a3 : false;
3233
+ const useReferences = options?.useReferences ?? false;
3225
3234
  return jsonSchema(
3226
3235
  // defer json schema creation to avoid unnecessary computation when only validation is needed
3227
3236
  () => addAdditionalPropertiesToJsonSchema(
@@ -3330,7 +3339,7 @@ function isParsableJson(input) {
3330
3339
  try {
3331
3340
  secureJsonParse(input);
3332
3341
  return true;
3333
- } catch (e) {
3342
+ } catch {
3334
3343
  return false;
3335
3344
  }
3336
3345
  }
@@ -3362,7 +3371,7 @@ async function parseProviderOptions({
3362
3371
  providerOptions,
3363
3372
  schema
3364
3373
  }) {
3365
- if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
3374
+ if (providerOptions?.[provider] == null) {
3366
3375
  return void 0;
3367
3376
  }
3368
3377
  const parsedProviderOptions = await safeValidateTypes({
@@ -3391,7 +3400,6 @@ function createMultipartBody(parts, boundary) {
3391
3400
  let activeReader;
3392
3401
  const enteredStreams = /* @__PURE__ */ new Set();
3393
3402
  async function* emitParts() {
3394
- var _a3, _b3;
3395
3403
  for (const part of parts) {
3396
3404
  if (disposed) return;
3397
3405
  const disposition = `--${boundary}\r
@@ -3404,9 +3412,9 @@ ${part.value}\r
3404
3412
  continue;
3405
3413
  }
3406
3414
  const filenameParameter = `; filename="${escapeMultipartHeaderValue(
3407
- (_a3 = part.filename) != null ? _a3 : "blob"
3415
+ part.filename ?? "blob"
3408
3416
  )}"`;
3409
- const mediaType = ((_b3 = part.mediaType) != null ? _b3 : "application/octet-stream").replace(
3417
+ const mediaType = (part.mediaType ?? "application/octet-stream").replace(
3410
3418
  /[\r\n]/g,
3411
3419
  ""
3412
3420
  );
@@ -3477,13 +3485,10 @@ var postMultipartStreamToApi = async ({
3477
3485
  }) => {
3478
3486
  const boundary = `ai-sdk-multipart-${generateId()}`;
3479
3487
  const requestBodyValues = Object.fromEntries(
3480
- parts.map((part) => {
3481
- var _a3;
3482
- return [
3483
- part.name,
3484
- part.type === "field" ? part.value : `<file:${(_a3 = part.filename) != null ? _a3 : part.name}>`
3485
- ];
3486
- })
3488
+ parts.map((part) => [
3489
+ part.name,
3490
+ part.type === "field" ? part.value : `<file:${part.filename ?? part.name}>`
3491
+ ])
3487
3492
  );
3488
3493
  const body = createMultipartBody(parts, boundary);
3489
3494
  try {
@@ -3766,7 +3771,7 @@ async function resolve(value) {
3766
3771
  if (typeof value === "function") {
3767
3772
  value = value();
3768
3773
  }
3769
- return Promise.resolve(value);
3774
+ return value;
3770
3775
  }
3771
3776
 
3772
3777
  // src/resolve-full-media-type.ts
@@ -3980,7 +3985,7 @@ var createJsonErrorResponseHandler = ({
3980
3985
  statusCode: response.status,
3981
3986
  responseHeaders,
3982
3987
  responseBody,
3983
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
3988
+ isRetryable: isRetryable?.(response)
3984
3989
  })
3985
3990
  };
3986
3991
  }
@@ -3999,10 +4004,10 @@ var createJsonErrorResponseHandler = ({
3999
4004
  responseHeaders,
4000
4005
  responseBody,
4001
4006
  data: parsedError,
4002
- isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
4007
+ isRetryable: isRetryable?.(response, parsedError)
4003
4008
  })
4004
4009
  };
4005
- } catch (e) {
4010
+ } catch {
4006
4011
  return {
4007
4012
  responseHeaders,
4008
4013
  value: new APICallError6({
@@ -4012,7 +4017,7 @@ var createJsonErrorResponseHandler = ({
4012
4017
  statusCode: response.status,
4013
4018
  responseHeaders,
4014
4019
  responseBody,
4015
- isRetryable: isRetryable == null ? void 0 : isRetryable(response)
4020
+ isRetryable: isRetryable?.(response)
4016
4021
  })
4017
4022
  };
4018
4023
  }
@@ -4249,10 +4254,9 @@ var StreamingToolCallTracker = class {
4249
4254
  this.toolCalls = /* @__PURE__ */ new Set();
4250
4255
  this.toolCallsById = /* @__PURE__ */ new Map();
4251
4256
  this.toolCallsByIndex = /* @__PURE__ */ new Map();
4252
- var _a3, _b3;
4253
4257
  this.controller = controller;
4254
- this._generateId = (_a3 = options.generateId) != null ? _a3 : generateId;
4255
- this.typeValidation = (_b3 = options.typeValidation) != null ? _b3 : "none";
4258
+ this._generateId = options.generateId ?? generateId;
4259
+ this.typeValidation = options.typeValidation ?? "none";
4256
4260
  this.extractMetadata = options.extractMetadata;
4257
4261
  this.buildToolCallProviderMetadata = options.buildToolCallProviderMetadata;
4258
4262
  }
@@ -4286,7 +4290,6 @@ var StreamingToolCallTracker = class {
4286
4290
  }
4287
4291
  }
4288
4292
  processNewToolCall(toolCallDelta) {
4289
- var _a3, _b3, _c;
4290
4293
  if (this.typeValidation === "required") {
4291
4294
  if (toolCallDelta.type !== "function") {
4292
4295
  throw new InvalidResponseDataError({
@@ -4308,7 +4311,7 @@ var StreamingToolCallTracker = class {
4308
4311
  message: `Expected 'id' to be a string.`
4309
4312
  });
4310
4313
  }
4311
- if (((_a3 = toolCallDelta.function) == null ? void 0 : _a3.name) == null) {
4314
+ if (toolCallDelta.function?.name == null) {
4312
4315
  throw new InvalidResponseDataError({
4313
4316
  data: toolCallDelta,
4314
4317
  message: `Expected 'function.name' to be a string.`
@@ -4319,13 +4322,13 @@ var StreamingToolCallTracker = class {
4319
4322
  id: toolCallDelta.id,
4320
4323
  toolName: toolCallDelta.function.name
4321
4324
  });
4322
- const metadata = (_b3 = this.extractMetadata) == null ? void 0 : _b3.call(this, toolCallDelta);
4325
+ const metadata = this.extractMetadata?.(toolCallDelta);
4323
4326
  const toolCall = {
4324
4327
  id: toolCallDelta.id,
4325
4328
  type: "function",
4326
4329
  function: {
4327
4330
  name: toolCallDelta.function.name,
4328
- arguments: (_c = toolCallDelta.function.arguments) != null ? _c : ""
4331
+ arguments: toolCallDelta.function.arguments ?? ""
4329
4332
  },
4330
4333
  hasFinished: false,
4331
4334
  metadata
@@ -4344,11 +4347,10 @@ var StreamingToolCallTracker = class {
4344
4347
  return toolCall;
4345
4348
  }
4346
4349
  processExistingToolCall(toolCall, toolCallDelta) {
4347
- var _a3;
4348
4350
  if (toolCall.hasFinished) {
4349
4351
  return;
4350
4352
  }
4351
- if (((_a3 = toolCallDelta.function) == null ? void 0 : _a3.arguments) != null) {
4353
+ if (toolCallDelta.function?.arguments != null) {
4352
4354
  toolCall.function.arguments += toolCallDelta.function.arguments;
4353
4355
  this.controller.enqueue({
4354
4356
  type: "tool-input-delta",
@@ -4358,18 +4360,16 @@ var StreamingToolCallTracker = class {
4358
4360
  }
4359
4361
  }
4360
4362
  finishToolCall(toolCall) {
4361
- var _a3, _b3;
4362
4363
  this.controller.enqueue({
4363
4364
  type: "tool-input-end",
4364
4365
  id: toolCall.id
4365
4366
  });
4366
- const providerMetadata = (_a3 = this.buildToolCallProviderMetadata) == null ? void 0 : _a3.call(
4367
- this,
4367
+ const providerMetadata = this.buildToolCallProviderMetadata?.(
4368
4368
  toolCall.metadata
4369
4369
  );
4370
4370
  this.controller.enqueue({
4371
4371
  type: "tool-call",
4372
- toolCallId: (_b3 = toolCall.id) != null ? _b3 : this._generateId(),
4372
+ toolCallId: toolCall.id ?? this._generateId(),
4373
4373
  toolName: toolCall.function.name,
4374
4374
  input: toolCall.function.arguments,
4375
4375
  ...providerMetadata ? { providerMetadata } : {}
@@ -4391,7 +4391,7 @@ function parseTranscriptionStreamClientFrame(text) {
4391
4391
  let value;
4392
4392
  try {
4393
4393
  value = secureJsonParse(text);
4394
- } catch (e) {
4394
+ } catch {
4395
4395
  return { type: "invalid", message: "malformed JSON" };
4396
4396
  }
4397
4397
  if (value == null || typeof value !== "object" || Array.isArray(value)) {
@@ -4448,7 +4448,7 @@ function serializeTranscriptionStreamPart(part) {
4448
4448
  });
4449
4449
  }
4450
4450
  return JSON.stringify(part);
4451
- } catch (e) {
4451
+ } catch {
4452
4452
  return void 0;
4453
4453
  }
4454
4454
  }
@@ -4459,7 +4459,7 @@ function parseTranscriptionStreamPart(text) {
4459
4459
  let value;
4460
4460
  try {
4461
4461
  value = secureJsonParse(text);
4462
- } catch (e) {
4462
+ } catch {
4463
4463
  return void 0;
4464
4464
  }
4465
4465
  if (value == null || typeof value !== "object" || Array.isArray(value)) {
@@ -4518,7 +4518,7 @@ function isSegment(value) {
4518
4518
  // src/validate-base-url.ts
4519
4519
  import { InvalidArgumentError as InvalidArgumentError3 } from "@ai-sdk/provider";
4520
4520
  function validateBaseURL(baseURL) {
4521
- if ((baseURL == null ? void 0 : baseURL.trim()) === "") {
4521
+ if (baseURL?.trim() === "") {
4522
4522
  throw new InvalidArgumentError3({
4523
4523
  argument: "baseURL",
4524
4524
  message: "baseURL must be a non-empty string."
@@ -4529,7 +4529,7 @@ function validateBaseURL(baseURL) {
4529
4529
 
4530
4530
  // src/without-trailing-slash.ts
4531
4531
  function withoutTrailingSlash(url) {
4532
- return url == null ? void 0 : url.replace(/\/$/, "");
4532
+ return url?.replace(/\/$/, "");
4533
4533
  }
4534
4534
 
4535
4535
  // src/types/executable-tool.ts
@@ -4568,7 +4568,7 @@ function toolCaller(tool2, definition) {
4568
4568
  });
4569
4569
  }
4570
4570
  function getToolCaller(tool2) {
4571
- return tool2 == null ? void 0 : tool2.experimental_toolCaller;
4571
+ return tool2?.experimental_toolCaller;
4572
4572
  }
4573
4573
 
4574
4574
  // src/index.ts
@@ -4581,6 +4581,7 @@ export {
4581
4581
  DelayedPromise,
4582
4582
  DownloadError,
4583
4583
  EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL as EXPERIMENTAL_EMBEDDING_MODEL_MAX_INPUT_BYTES_PER_CALL,
4584
+ EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER as EXPERIMENTAL_EMBEDDING_MODEL_PROVIDER_OPTIONS_TRANSFORMER,
4584
4585
  TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_AUDIO_DONE_FRAME_TYPE,
4585
4586
  TRANSCRIPTION_STREAM_START_FRAME_TYPE as EXPERIMENTAL_TRANSCRIPTION_STREAM_START_FRAME_TYPE,
4586
4587
  EventSourceParserStream2 as EventSourceParserStream,
@@ -4629,6 +4630,7 @@ export {
4629
4630
  toolCaller as experimental_toolCaller,
4630
4631
  extractLines,
4631
4632
  extractResponseHeaders,
4633
+ fetchUntrustedUrl,
4632
4634
  fetchWithValidatedEndpoint,
4633
4635
  fetchWithValidatedRedirects,
4634
4636
  filterNullable,