@ai-sdk/provider-utils 3.0.0-canary.1 → 3.0.0-canary.10
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 +91 -0
- package/dist/index.d.mts +33 -10
- package/dist/index.d.ts +33 -10
- package/dist/index.js +91 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -4
- package/dist/index.mjs.map +1 -1
- package/{test/dist → dist/test}/index.d.mts +4 -1
- package/{test/dist → dist/test}/index.d.ts +4 -1
- package/{test/dist → dist/test}/index.js +63 -39
- package/dist/test/index.js.map +1 -0
- package/{test/dist → dist/test}/index.mjs +62 -39
- package/dist/test/index.mjs.map +1 -0
- package/package.json +13 -13
- 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
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,96 @@
|
|
1
1
|
# @ai-sdk/provider-utils
|
2
2
|
|
3
|
+
## 3.0.0-canary.10
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies [e86be6f]
|
8
|
+
- @ai-sdk/provider@2.0.0-canary.9
|
9
|
+
|
10
|
+
## 3.0.0-canary.9
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- Updated dependencies [95857aa]
|
15
|
+
- Updated dependencies [7ea4132]
|
16
|
+
- @ai-sdk/provider@2.0.0-canary.8
|
17
|
+
|
18
|
+
## 3.0.0-canary.8
|
19
|
+
|
20
|
+
### Major Changes
|
21
|
+
|
22
|
+
- 5d142ab: remove deprecated `CoreToolCall` and `CoreToolResult` types
|
23
|
+
|
24
|
+
### Patch Changes
|
25
|
+
|
26
|
+
- Updated dependencies [b6b43c7]
|
27
|
+
- Updated dependencies [8aa9e20]
|
28
|
+
- Updated dependencies [3795467]
|
29
|
+
- @ai-sdk/provider@2.0.0-canary.7
|
30
|
+
|
31
|
+
## 3.0.0-canary.7
|
32
|
+
|
33
|
+
### Patch Changes
|
34
|
+
|
35
|
+
- Updated dependencies [26735b5]
|
36
|
+
- Updated dependencies [443d8ec]
|
37
|
+
- Updated dependencies [14c9410]
|
38
|
+
- Updated dependencies [d9c98f4]
|
39
|
+
- Updated dependencies [c4a2fec]
|
40
|
+
- Updated dependencies [0054544]
|
41
|
+
- Updated dependencies [9e9c809]
|
42
|
+
- Updated dependencies [32831c6]
|
43
|
+
- Updated dependencies [d0f9495]
|
44
|
+
- Updated dependencies [fd65bc6]
|
45
|
+
- Updated dependencies [393138b]
|
46
|
+
- Updated dependencies [7182d14]
|
47
|
+
- @ai-sdk/provider@2.0.0-canary.6
|
48
|
+
|
49
|
+
## 3.0.0-canary.6
|
50
|
+
|
51
|
+
### Patch Changes
|
52
|
+
|
53
|
+
- Updated dependencies [411e483]
|
54
|
+
- Updated dependencies [79457bd]
|
55
|
+
- Updated dependencies [ad80501]
|
56
|
+
- Updated dependencies [1766ede]
|
57
|
+
- Updated dependencies [f10304b]
|
58
|
+
- @ai-sdk/provider@2.0.0-canary.5
|
59
|
+
|
60
|
+
## 3.0.0-canary.5
|
61
|
+
|
62
|
+
### Patch Changes
|
63
|
+
|
64
|
+
- Updated dependencies [6f6bb89]
|
65
|
+
- @ai-sdk/provider@2.0.0-canary.4
|
66
|
+
|
67
|
+
## 3.0.0-canary.4
|
68
|
+
|
69
|
+
### Patch Changes
|
70
|
+
|
71
|
+
- Updated dependencies [d1a1aa1]
|
72
|
+
- @ai-sdk/provider@2.0.0-canary.3
|
73
|
+
|
74
|
+
## 3.0.0-canary.3
|
75
|
+
|
76
|
+
### Patch Changes
|
77
|
+
|
78
|
+
- a166433: feat: add transcription with experimental_transcribe
|
79
|
+
- 9f95b35: refactor (provider-utils): copy relevant code from `secure-json-parse` into codebase
|
80
|
+
- Updated dependencies [a166433]
|
81
|
+
- Updated dependencies [abf9a79]
|
82
|
+
- Updated dependencies [0a87932]
|
83
|
+
- Updated dependencies [6dc848c]
|
84
|
+
- @ai-sdk/provider@2.0.0-canary.2
|
85
|
+
|
86
|
+
## 3.0.0-canary.2
|
87
|
+
|
88
|
+
### Patch Changes
|
89
|
+
|
90
|
+
- Updated dependencies [c57e248]
|
91
|
+
- Updated dependencies [33f4a6a]
|
92
|
+
- @ai-sdk/provider@2.0.0-canary.1
|
93
|
+
|
3
94
|
## 3.0.0-canary.1
|
4
95
|
|
5
96
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
@@ -190,6 +190,23 @@ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedR
|
|
190
190
|
|
191
191
|
declare function isAbortError(error: unknown): error is Error;
|
192
192
|
|
193
|
+
/**
|
194
|
+
* Checks if the given URL is supported natively by the model.
|
195
|
+
*
|
196
|
+
* @param mediaType - The media type of the URL. Case-sensitive.
|
197
|
+
* @param url - The URL to check.
|
198
|
+
* @param supportedUrls - A record where keys are case-sensitive media types (or '*')
|
199
|
+
* and values are arrays of RegExp patterns for URLs.
|
200
|
+
*
|
201
|
+
* @returns `true` if the URL matches a pattern under the specific media type
|
202
|
+
* or the wildcard '*', `false` otherwise.
|
203
|
+
*/
|
204
|
+
declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
|
205
|
+
mediaType: string;
|
206
|
+
url: string;
|
207
|
+
supportedUrls: Record<string, RegExp[]>;
|
208
|
+
}): boolean;
|
209
|
+
|
193
210
|
declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description, }: {
|
194
211
|
apiKey: string | undefined;
|
195
212
|
environmentVariableName: string;
|
@@ -244,6 +261,19 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
244
261
|
rawValue?: unknown;
|
245
262
|
responseHeaders?: Record<string, string>;
|
246
263
|
}>;
|
264
|
+
declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
265
|
+
url: string;
|
266
|
+
headers?: Record<string, string | undefined>;
|
267
|
+
formData: FormData;
|
268
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
269
|
+
successfulResponseHandler: ResponseHandler<T>;
|
270
|
+
abortSignal?: AbortSignal;
|
271
|
+
fetch?: FetchFunction;
|
272
|
+
}) => Promise<{
|
273
|
+
value: T;
|
274
|
+
rawValue?: unknown;
|
275
|
+
responseHeaders?: Record<string, string>;
|
276
|
+
}>;
|
247
277
|
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
248
278
|
url: string;
|
249
279
|
headers?: Record<string, string | undefined>;
|
@@ -275,8 +305,9 @@ type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
|
|
275
305
|
*/
|
276
306
|
declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
277
307
|
|
278
|
-
declare function convertBase64ToUint8Array(base64String: string): Uint8Array
|
308
|
+
declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
279
309
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
310
|
+
declare function convertToBase64(value: string | Uint8Array): string;
|
280
311
|
|
281
312
|
/**
|
282
313
|
* Validates the types of an unknown object using a schema and
|
@@ -331,10 +362,6 @@ interface ToolCall<NAME extends string, ARGS> {
|
|
331
362
|
*/
|
332
363
|
args: ARGS;
|
333
364
|
}
|
334
|
-
/**
|
335
|
-
* @deprecated Use `ToolCall` instead.
|
336
|
-
*/
|
337
|
-
type CoreToolCall<NAME extends string, ARGS> = ToolCall<NAME, ARGS>;
|
338
365
|
|
339
366
|
/**
|
340
367
|
Typed tool result that is returned by `generateText` and `streamText`.
|
@@ -358,9 +385,5 @@ interface ToolResult<NAME extends string, ARGS, RESULT> {
|
|
358
385
|
*/
|
359
386
|
result: RESULT;
|
360
387
|
}
|
361
|
-
/**
|
362
|
-
* @deprecated Use `ToolResult` instead.
|
363
|
-
*/
|
364
|
-
type CoreToolResult<NAME extends string, ARGS, RESULT> = ToolResult<NAME, ARGS, RESULT>;
|
365
388
|
|
366
|
-
export { type
|
389
|
+
export { type EventSourceChunk, type FetchFunction, type IDGenerator, type ParseResult, type Resolvable, type ResponseHandler, type ToolCall, type ToolResult, type ValidationResult, type Validator, asValidator, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceParserStream, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createStatusCodeErrorResponseHandler, delay, extractResponseHeaders, generateId, getErrorMessage, getFromApi, isAbortError, isParsableJson, isUrlSupported, isValidator, loadApiKey, loadOptionalSetting, loadSetting, parseJSON, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, validateTypes, validator, validatorSymbol, withoutTrailingSlash, zodValidator };
|
package/dist/index.d.ts
CHANGED
@@ -190,6 +190,23 @@ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedR
|
|
190
190
|
|
191
191
|
declare function isAbortError(error: unknown): error is Error;
|
192
192
|
|
193
|
+
/**
|
194
|
+
* Checks if the given URL is supported natively by the model.
|
195
|
+
*
|
196
|
+
* @param mediaType - The media type of the URL. Case-sensitive.
|
197
|
+
* @param url - The URL to check.
|
198
|
+
* @param supportedUrls - A record where keys are case-sensitive media types (or '*')
|
199
|
+
* and values are arrays of RegExp patterns for URLs.
|
200
|
+
*
|
201
|
+
* @returns `true` if the URL matches a pattern under the specific media type
|
202
|
+
* or the wildcard '*', `false` otherwise.
|
203
|
+
*/
|
204
|
+
declare function isUrlSupported({ mediaType, url, supportedUrls, }: {
|
205
|
+
mediaType: string;
|
206
|
+
url: string;
|
207
|
+
supportedUrls: Record<string, RegExp[]>;
|
208
|
+
}): boolean;
|
209
|
+
|
193
210
|
declare function loadApiKey({ apiKey, environmentVariableName, apiKeyParameterName, description, }: {
|
194
211
|
apiKey: string | undefined;
|
195
212
|
environmentVariableName: string;
|
@@ -244,6 +261,19 @@ declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, su
|
|
244
261
|
rawValue?: unknown;
|
245
262
|
responseHeaders?: Record<string, string>;
|
246
263
|
}>;
|
264
|
+
declare const postFormDataToApi: <T>({ url, headers, formData, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
|
265
|
+
url: string;
|
266
|
+
headers?: Record<string, string | undefined>;
|
267
|
+
formData: FormData;
|
268
|
+
failedResponseHandler: ResponseHandler<APICallError>;
|
269
|
+
successfulResponseHandler: ResponseHandler<T>;
|
270
|
+
abortSignal?: AbortSignal;
|
271
|
+
fetch?: FetchFunction;
|
272
|
+
}) => Promise<{
|
273
|
+
value: T;
|
274
|
+
rawValue?: unknown;
|
275
|
+
responseHeaders?: Record<string, string>;
|
276
|
+
}>;
|
247
277
|
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
|
248
278
|
url: string;
|
249
279
|
headers?: Record<string, string | undefined>;
|
@@ -275,8 +305,9 @@ type Resolvable<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
|
|
275
305
|
*/
|
276
306
|
declare function resolve<T>(value: Resolvable<T>): Promise<T>;
|
277
307
|
|
278
|
-
declare function convertBase64ToUint8Array(base64String: string): Uint8Array
|
308
|
+
declare function convertBase64ToUint8Array(base64String: string): Uint8Array<ArrayBuffer>;
|
279
309
|
declare function convertUint8ArrayToBase64(array: Uint8Array): string;
|
310
|
+
declare function convertToBase64(value: string | Uint8Array): string;
|
280
311
|
|
281
312
|
/**
|
282
313
|
* Validates the types of an unknown object using a schema and
|
@@ -331,10 +362,6 @@ interface ToolCall<NAME extends string, ARGS> {
|
|
331
362
|
*/
|
332
363
|
args: ARGS;
|
333
364
|
}
|
334
|
-
/**
|
335
|
-
* @deprecated Use `ToolCall` instead.
|
336
|
-
*/
|
337
|
-
type CoreToolCall<NAME extends string, ARGS> = ToolCall<NAME, ARGS>;
|
338
365
|
|
339
366
|
/**
|
340
367
|
Typed tool result that is returned by `generateText` and `streamText`.
|
@@ -358,9 +385,5 @@ interface ToolResult<NAME extends string, ARGS, RESULT> {
|
|
358
385
|
*/
|
359
386
|
result: RESULT;
|
360
387
|
}
|
361
|
-
/**
|
362
|
-
* @deprecated Use `ToolResult` instead.
|
363
|
-
*/
|
364
|
-
type CoreToolResult<NAME extends string, ARGS, RESULT> = ToolResult<NAME, ARGS, RESULT>;
|
365
388
|
|
366
|
-
export { type
|
389
|
+
export { type EventSourceChunk, type FetchFunction, type IDGenerator, type ParseResult, type Resolvable, type ResponseHandler, type ToolCall, type ToolResult, type ValidationResult, type Validator, asValidator, combineHeaders, convertAsyncIteratorToReadableStream, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createBinaryResponseHandler, createEventSourceParserStream, createEventSourceResponseHandler, createIdGenerator, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, createStatusCodeErrorResponseHandler, delay, extractResponseHeaders, generateId, getErrorMessage, getFromApi, isAbortError, isParsableJson, isUrlSupported, isValidator, loadApiKey, loadOptionalSetting, loadSetting, parseJSON, parseProviderOptions, postFormDataToApi, postJsonToApi, postToApi, removeUndefinedEntries, resolve, safeParseJSON, safeValidateTypes, validateTypes, validator, validatorSymbol, withoutTrailingSlash, zodValidator };
|
package/dist/index.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __create = Object.create;
|
3
2
|
var __defProp = Object.defineProperty;
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
6
|
var __export = (target, all) => {
|
9
7
|
for (var name in all)
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
17
15
|
}
|
18
16
|
return to;
|
19
17
|
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
19
|
|
30
20
|
// src/index.ts
|
@@ -34,6 +24,7 @@ __export(src_exports, {
|
|
34
24
|
combineHeaders: () => combineHeaders,
|
35
25
|
convertAsyncIteratorToReadableStream: () => convertAsyncIteratorToReadableStream,
|
36
26
|
convertBase64ToUint8Array: () => convertBase64ToUint8Array,
|
27
|
+
convertToBase64: () => convertToBase64,
|
37
28
|
convertUint8ArrayToBase64: () => convertUint8ArrayToBase64,
|
38
29
|
createBinaryResponseHandler: () => createBinaryResponseHandler,
|
39
30
|
createEventSourceParserStream: () => createEventSourceParserStream,
|
@@ -50,12 +41,14 @@ __export(src_exports, {
|
|
50
41
|
getFromApi: () => getFromApi,
|
51
42
|
isAbortError: () => isAbortError,
|
52
43
|
isParsableJson: () => isParsableJson,
|
44
|
+
isUrlSupported: () => isUrlSupported,
|
53
45
|
isValidator: () => isValidator,
|
54
46
|
loadApiKey: () => loadApiKey,
|
55
47
|
loadOptionalSetting: () => loadOptionalSetting,
|
56
48
|
loadSetting: () => loadSetting,
|
57
49
|
parseJSON: () => parseJSON,
|
58
50
|
parseProviderOptions: () => parseProviderOptions,
|
51
|
+
postFormDataToApi: () => postFormDataToApi,
|
59
52
|
postJsonToApi: () => postJsonToApi,
|
60
53
|
postToApi: () => postToApi,
|
61
54
|
removeUndefinedEntries: () => removeUndefinedEntries,
|
@@ -362,6 +355,20 @@ var getFromApi = async ({
|
|
362
355
|
}
|
363
356
|
};
|
364
357
|
|
358
|
+
// src/is-url-supported.ts
|
359
|
+
function isUrlSupported({
|
360
|
+
mediaType,
|
361
|
+
url,
|
362
|
+
supportedUrls
|
363
|
+
}) {
|
364
|
+
url = url.toLowerCase();
|
365
|
+
mediaType = mediaType.toLowerCase();
|
366
|
+
return Object.entries(supportedUrls).map(([key, value]) => {
|
367
|
+
const mediaType2 = key.toLowerCase();
|
368
|
+
return mediaType2 === "*" || mediaType2 === "*/*" ? { mediaTypePrefix: "", regexes: value } : { mediaTypePrefix: mediaType2.replace(/\*/, ""), regexes: value };
|
369
|
+
}).filter(({ mediaTypePrefix }) => mediaType.startsWith(mediaTypePrefix)).flatMap(({ regexes }) => regexes).some((pattern) => pattern.test(url));
|
370
|
+
}
|
371
|
+
|
365
372
|
// src/load-api-key.ts
|
366
373
|
var import_provider3 = require("@ai-sdk/provider");
|
367
374
|
function loadApiKey({
|
@@ -452,7 +459,51 @@ function loadSetting({
|
|
452
459
|
|
453
460
|
// src/parse-json.ts
|
454
461
|
var import_provider6 = require("@ai-sdk/provider");
|
455
|
-
|
462
|
+
|
463
|
+
// src/secure-json-parse.ts
|
464
|
+
var suspectProtoRx = /"__proto__"\s*:/;
|
465
|
+
var suspectConstructorRx = /"constructor"\s*:/;
|
466
|
+
function _parse(text) {
|
467
|
+
const obj = JSON.parse(text);
|
468
|
+
if (obj === null || typeof obj !== "object") {
|
469
|
+
return obj;
|
470
|
+
}
|
471
|
+
if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
|
472
|
+
return obj;
|
473
|
+
}
|
474
|
+
return filter(obj);
|
475
|
+
}
|
476
|
+
function filter(obj) {
|
477
|
+
let next = [obj];
|
478
|
+
while (next.length) {
|
479
|
+
const nodes = next;
|
480
|
+
next = [];
|
481
|
+
for (const node of nodes) {
|
482
|
+
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
483
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
484
|
+
}
|
485
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
486
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
487
|
+
}
|
488
|
+
for (const key in node) {
|
489
|
+
const value = node[key];
|
490
|
+
if (value && typeof value === "object") {
|
491
|
+
next.push(value);
|
492
|
+
}
|
493
|
+
}
|
494
|
+
}
|
495
|
+
}
|
496
|
+
return obj;
|
497
|
+
}
|
498
|
+
function secureJsonParse(text) {
|
499
|
+
const { stackTraceLimit } = Error;
|
500
|
+
Error.stackTraceLimit = 0;
|
501
|
+
try {
|
502
|
+
return _parse(text);
|
503
|
+
} finally {
|
504
|
+
Error.stackTraceLimit = stackTraceLimit;
|
505
|
+
}
|
506
|
+
}
|
456
507
|
|
457
508
|
// src/validate-types.ts
|
458
509
|
var import_provider5 = require("@ai-sdk/provider");
|
@@ -517,7 +568,7 @@ function parseJSON({
|
|
517
568
|
schema
|
518
569
|
}) {
|
519
570
|
try {
|
520
|
-
const value =
|
571
|
+
const value = secureJsonParse(text);
|
521
572
|
if (schema == null) {
|
522
573
|
return value;
|
523
574
|
}
|
@@ -534,7 +585,7 @@ function safeParseJSON({
|
|
534
585
|
schema
|
535
586
|
}) {
|
536
587
|
try {
|
537
|
-
const value =
|
588
|
+
const value = secureJsonParse(text);
|
538
589
|
if (schema == null) {
|
539
590
|
return { success: true, value, rawValue: value };
|
540
591
|
}
|
@@ -549,7 +600,7 @@ function safeParseJSON({
|
|
549
600
|
}
|
550
601
|
function isParsableJson(input) {
|
551
602
|
try {
|
552
|
-
|
603
|
+
secureJsonParse(input);
|
553
604
|
return true;
|
554
605
|
} catch (e) {
|
555
606
|
return false;
|
@@ -606,6 +657,26 @@ var postJsonToApi = async ({
|
|
606
657
|
abortSignal,
|
607
658
|
fetch
|
608
659
|
});
|
660
|
+
var postFormDataToApi = async ({
|
661
|
+
url,
|
662
|
+
headers,
|
663
|
+
formData,
|
664
|
+
failedResponseHandler,
|
665
|
+
successfulResponseHandler,
|
666
|
+
abortSignal,
|
667
|
+
fetch
|
668
|
+
}) => postToApi({
|
669
|
+
url,
|
670
|
+
headers,
|
671
|
+
body: {
|
672
|
+
content: formData,
|
673
|
+
values: Object.fromEntries(formData.entries())
|
674
|
+
},
|
675
|
+
failedResponseHandler,
|
676
|
+
successfulResponseHandler,
|
677
|
+
abortSignal,
|
678
|
+
fetch
|
679
|
+
});
|
609
680
|
var postToApi = async ({
|
610
681
|
url,
|
611
682
|
headers = {},
|
@@ -887,6 +958,9 @@ function convertUint8ArrayToBase64(array) {
|
|
887
958
|
}
|
888
959
|
return btoa(latin1string);
|
889
960
|
}
|
961
|
+
function convertToBase64(value) {
|
962
|
+
return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
|
963
|
+
}
|
890
964
|
|
891
965
|
// src/without-trailing-slash.ts
|
892
966
|
function withoutTrailingSlash(url) {
|
@@ -898,6 +972,7 @@ function withoutTrailingSlash(url) {
|
|
898
972
|
combineHeaders,
|
899
973
|
convertAsyncIteratorToReadableStream,
|
900
974
|
convertBase64ToUint8Array,
|
975
|
+
convertToBase64,
|
901
976
|
convertUint8ArrayToBase64,
|
902
977
|
createBinaryResponseHandler,
|
903
978
|
createEventSourceParserStream,
|
@@ -914,12 +989,14 @@ function withoutTrailingSlash(url) {
|
|
914
989
|
getFromApi,
|
915
990
|
isAbortError,
|
916
991
|
isParsableJson,
|
992
|
+
isUrlSupported,
|
917
993
|
isValidator,
|
918
994
|
loadApiKey,
|
919
995
|
loadOptionalSetting,
|
920
996
|
loadSetting,
|
921
997
|
parseJSON,
|
922
998
|
parseProviderOptions,
|
999
|
+
postFormDataToApi,
|
923
1000
|
postJsonToApi,
|
924
1001
|
postToApi,
|
925
1002
|
removeUndefinedEntries,
|