@ai-sdk/provider-utils 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/package.json +2 -2
- package/test/dist/index.d.mts +15 -1
- package/test/dist/index.d.ts +15 -1
- package/test/dist/index.js +110 -55
- package/test/dist/index.js.map +1 -1
- package/test/dist/index.mjs +109 -55
- package/test/dist/index.mjs.map +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @ai-sdk/provider-utils
|
2
2
|
|
3
|
+
## 2.0.6
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 19a2ce7: feat (provider/fireworks): Add image model support.
|
8
|
+
- 6337688: feat: change image generation errors to warnings
|
9
|
+
- Updated dependencies [19a2ce7]
|
10
|
+
- Updated dependencies [6337688]
|
11
|
+
- @ai-sdk/provider@1.0.4
|
12
|
+
|
13
|
+
## 2.0.5
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- 5ed5e45: chore (config): Use ts-library.json tsconfig for no-UI libs.
|
18
|
+
- Updated dependencies [5ed5e45]
|
19
|
+
- @ai-sdk/provider@1.0.3
|
20
|
+
|
3
21
|
## 2.0.4
|
4
22
|
|
5
23
|
### Patch Changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ai-sdk/provider-utils",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.6",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"sideEffects": false,
|
6
6
|
"main": "./dist/index.js",
|
@@ -26,7 +26,7 @@
|
|
26
26
|
}
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ai-sdk/provider": "1.0.
|
29
|
+
"@ai-sdk/provider": "1.0.4",
|
30
30
|
"eventsource-parser": "^3.0.0",
|
31
31
|
"nanoid": "^3.3.8",
|
32
32
|
"secure-json-parse": "^2.7.0"
|
package/test/dist/index.d.mts
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
import { SetupServer } from 'msw/node';
|
2
2
|
import { JsonBodyType } from 'msw';
|
3
3
|
|
4
|
+
declare class BinaryTestServer {
|
5
|
+
readonly server: SetupServer;
|
6
|
+
responseBody: Buffer | null;
|
7
|
+
responseHeaders: Record<string, string>;
|
8
|
+
responseStatus: number;
|
9
|
+
request: Request | undefined;
|
10
|
+
constructor(url: string);
|
11
|
+
getRequestBodyJson(): Promise<any>;
|
12
|
+
getRequestHeaders(): Promise<Record<string, string>>;
|
13
|
+
getRequestUrlSearchParams(): Promise<URLSearchParams>;
|
14
|
+
getRequestUrl(): Promise<string>;
|
15
|
+
setupTestEnvironment(): void;
|
16
|
+
}
|
17
|
+
|
4
18
|
declare function convertArrayToAsyncIterable<T>(values: T[]): AsyncIterable<T>;
|
5
19
|
|
6
20
|
declare function convertArrayToReadableStream<T>(values: T[]): ReadableStream<T>;
|
@@ -74,4 +88,4 @@ declare function describeWithTestServer(description: string, responses: Array<Te
|
|
74
88
|
streamController: ReadableStreamDefaultController<string>;
|
75
89
|
}) => void): void;
|
76
90
|
|
77
|
-
export { JsonTestServer, StreamingTestServer, type TestServerJsonBodyType, type TestServerResponse, convertArrayToAsyncIterable, convertArrayToReadableStream, convertAsyncIterableToArray, convertReadableStreamToArray, convertResponseStreamToArray, describeWithTestServer, withTestServer };
|
91
|
+
export { BinaryTestServer, JsonTestServer, StreamingTestServer, type TestServerJsonBodyType, type TestServerResponse, convertArrayToAsyncIterable, convertArrayToReadableStream, convertAsyncIterableToArray, convertReadableStreamToArray, convertResponseStreamToArray, describeWithTestServer, withTestServer };
|
package/test/dist/index.d.ts
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
import { SetupServer } from 'msw/node';
|
2
2
|
import { JsonBodyType } from 'msw';
|
3
3
|
|
4
|
+
declare class BinaryTestServer {
|
5
|
+
readonly server: SetupServer;
|
6
|
+
responseBody: Buffer | null;
|
7
|
+
responseHeaders: Record<string, string>;
|
8
|
+
responseStatus: number;
|
9
|
+
request: Request | undefined;
|
10
|
+
constructor(url: string);
|
11
|
+
getRequestBodyJson(): Promise<any>;
|
12
|
+
getRequestHeaders(): Promise<Record<string, string>>;
|
13
|
+
getRequestUrlSearchParams(): Promise<URLSearchParams>;
|
14
|
+
getRequestUrl(): Promise<string>;
|
15
|
+
setupTestEnvironment(): void;
|
16
|
+
}
|
17
|
+
|
4
18
|
declare function convertArrayToAsyncIterable<T>(values: T[]): AsyncIterable<T>;
|
5
19
|
|
6
20
|
declare function convertArrayToReadableStream<T>(values: T[]): ReadableStream<T>;
|
@@ -74,4 +88,4 @@ declare function describeWithTestServer(description: string, responses: Array<Te
|
|
74
88
|
streamController: ReadableStreamDefaultController<string>;
|
75
89
|
}) => void): void;
|
76
90
|
|
77
|
-
export { JsonTestServer, StreamingTestServer, type TestServerJsonBodyType, type TestServerResponse, convertArrayToAsyncIterable, convertArrayToReadableStream, convertAsyncIterableToArray, convertReadableStreamToArray, convertResponseStreamToArray, describeWithTestServer, withTestServer };
|
91
|
+
export { BinaryTestServer, JsonTestServer, StreamingTestServer, type TestServerJsonBodyType, type TestServerResponse, convertArrayToAsyncIterable, convertArrayToReadableStream, convertAsyncIterableToArray, convertReadableStreamToArray, convertResponseStreamToArray, describeWithTestServer, withTestServer };
|
package/test/dist/index.js
CHANGED
@@ -57,6 +57,7 @@ var __privateMethod = (obj, member, method) => {
|
|
57
57
|
// src/test/index.ts
|
58
58
|
var test_exports = {};
|
59
59
|
__export(test_exports, {
|
60
|
+
BinaryTestServer: () => BinaryTestServer,
|
60
61
|
JsonTestServer: () => JsonTestServer,
|
61
62
|
StreamingTestServer: () => StreamingTestServer,
|
62
63
|
convertArrayToAsyncIterable: () => convertArrayToAsyncIterable,
|
@@ -69,61 +70,6 @@ __export(test_exports, {
|
|
69
70
|
});
|
70
71
|
module.exports = __toCommonJS(test_exports);
|
71
72
|
|
72
|
-
// src/test/convert-array-to-async-iterable.ts
|
73
|
-
function convertArrayToAsyncIterable(values) {
|
74
|
-
return {
|
75
|
-
async *[Symbol.asyncIterator]() {
|
76
|
-
for (const value of values) {
|
77
|
-
yield value;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
};
|
81
|
-
}
|
82
|
-
|
83
|
-
// src/test/convert-array-to-readable-stream.ts
|
84
|
-
function convertArrayToReadableStream(values) {
|
85
|
-
return new ReadableStream({
|
86
|
-
start(controller) {
|
87
|
-
try {
|
88
|
-
for (const value of values) {
|
89
|
-
controller.enqueue(value);
|
90
|
-
}
|
91
|
-
} finally {
|
92
|
-
controller.close();
|
93
|
-
}
|
94
|
-
}
|
95
|
-
});
|
96
|
-
}
|
97
|
-
|
98
|
-
// src/test/convert-async-iterable-to-array.ts
|
99
|
-
async function convertAsyncIterableToArray(iterable) {
|
100
|
-
const result = [];
|
101
|
-
for await (const item of iterable) {
|
102
|
-
result.push(item);
|
103
|
-
}
|
104
|
-
return result;
|
105
|
-
}
|
106
|
-
|
107
|
-
// src/test/convert-readable-stream-to-array.ts
|
108
|
-
async function convertReadableStreamToArray(stream) {
|
109
|
-
const reader = stream.getReader();
|
110
|
-
const result = [];
|
111
|
-
while (true) {
|
112
|
-
const { done, value } = await reader.read();
|
113
|
-
if (done)
|
114
|
-
break;
|
115
|
-
result.push(value);
|
116
|
-
}
|
117
|
-
return result;
|
118
|
-
}
|
119
|
-
|
120
|
-
// src/test/convert-response-stream-to-array.ts
|
121
|
-
async function convertResponseStreamToArray(response) {
|
122
|
-
return convertReadableStreamToArray(
|
123
|
-
response.body.pipeThrough(new TextDecoderStream())
|
124
|
-
);
|
125
|
-
}
|
126
|
-
|
127
73
|
// ../../node_modules/.pnpm/outvariant@1.4.3/node_modules/outvariant/lib/index.mjs
|
128
74
|
var POSITIONALS_EXP = /(%?)(%([sdijo]))/g;
|
129
75
|
function serializePositional(positional, flag) {
|
@@ -18409,6 +18355,114 @@ var setupServer = (...handlers) => {
|
|
18409
18355
|
return new SetupServerApi(handlers);
|
18410
18356
|
};
|
18411
18357
|
|
18358
|
+
// src/test/binary-test-server.ts
|
18359
|
+
var BinaryTestServer = class {
|
18360
|
+
constructor(url) {
|
18361
|
+
this.responseBody = null;
|
18362
|
+
this.responseHeaders = {};
|
18363
|
+
this.responseStatus = 200;
|
18364
|
+
this.server = setupServer(
|
18365
|
+
http.post(url, ({ request }) => {
|
18366
|
+
this.request = request;
|
18367
|
+
if (this.responseBody === null) {
|
18368
|
+
return new HttpResponse(null, { status: this.responseStatus });
|
18369
|
+
}
|
18370
|
+
return new HttpResponse(this.responseBody, {
|
18371
|
+
status: this.responseStatus,
|
18372
|
+
headers: this.responseHeaders
|
18373
|
+
});
|
18374
|
+
})
|
18375
|
+
);
|
18376
|
+
}
|
18377
|
+
async getRequestBodyJson() {
|
18378
|
+
expect(this.request).toBeDefined();
|
18379
|
+
return JSON.parse(await this.request.text());
|
18380
|
+
}
|
18381
|
+
async getRequestHeaders() {
|
18382
|
+
expect(this.request).toBeDefined();
|
18383
|
+
const requestHeaders = this.request.headers;
|
18384
|
+
const headersObject = {};
|
18385
|
+
requestHeaders.forEach((value, key) => {
|
18386
|
+
headersObject[key] = value;
|
18387
|
+
});
|
18388
|
+
return headersObject;
|
18389
|
+
}
|
18390
|
+
async getRequestUrlSearchParams() {
|
18391
|
+
expect(this.request).toBeDefined();
|
18392
|
+
return new URL(this.request.url).searchParams;
|
18393
|
+
}
|
18394
|
+
async getRequestUrl() {
|
18395
|
+
expect(this.request).toBeDefined();
|
18396
|
+
return new URL(this.request.url).toString();
|
18397
|
+
}
|
18398
|
+
setupTestEnvironment() {
|
18399
|
+
beforeAll(() => this.server.listen());
|
18400
|
+
beforeEach(() => {
|
18401
|
+
this.responseBody = null;
|
18402
|
+
this.request = void 0;
|
18403
|
+
this.responseHeaders = {};
|
18404
|
+
this.responseStatus = 200;
|
18405
|
+
});
|
18406
|
+
afterEach(() => this.server.resetHandlers());
|
18407
|
+
afterAll(() => this.server.close());
|
18408
|
+
}
|
18409
|
+
};
|
18410
|
+
|
18411
|
+
// src/test/convert-array-to-async-iterable.ts
|
18412
|
+
function convertArrayToAsyncIterable(values) {
|
18413
|
+
return {
|
18414
|
+
async *[Symbol.asyncIterator]() {
|
18415
|
+
for (const value of values) {
|
18416
|
+
yield value;
|
18417
|
+
}
|
18418
|
+
}
|
18419
|
+
};
|
18420
|
+
}
|
18421
|
+
|
18422
|
+
// src/test/convert-array-to-readable-stream.ts
|
18423
|
+
function convertArrayToReadableStream(values) {
|
18424
|
+
return new ReadableStream({
|
18425
|
+
start(controller) {
|
18426
|
+
try {
|
18427
|
+
for (const value of values) {
|
18428
|
+
controller.enqueue(value);
|
18429
|
+
}
|
18430
|
+
} finally {
|
18431
|
+
controller.close();
|
18432
|
+
}
|
18433
|
+
}
|
18434
|
+
});
|
18435
|
+
}
|
18436
|
+
|
18437
|
+
// src/test/convert-async-iterable-to-array.ts
|
18438
|
+
async function convertAsyncIterableToArray(iterable) {
|
18439
|
+
const result = [];
|
18440
|
+
for await (const item of iterable) {
|
18441
|
+
result.push(item);
|
18442
|
+
}
|
18443
|
+
return result;
|
18444
|
+
}
|
18445
|
+
|
18446
|
+
// src/test/convert-readable-stream-to-array.ts
|
18447
|
+
async function convertReadableStreamToArray(stream) {
|
18448
|
+
const reader = stream.getReader();
|
18449
|
+
const result = [];
|
18450
|
+
while (true) {
|
18451
|
+
const { done, value } = await reader.read();
|
18452
|
+
if (done)
|
18453
|
+
break;
|
18454
|
+
result.push(value);
|
18455
|
+
}
|
18456
|
+
return result;
|
18457
|
+
}
|
18458
|
+
|
18459
|
+
// src/test/convert-response-stream-to-array.ts
|
18460
|
+
async function convertResponseStreamToArray(response) {
|
18461
|
+
return convertReadableStreamToArray(
|
18462
|
+
response.body.pipeThrough(new TextDecoderStream())
|
18463
|
+
);
|
18464
|
+
}
|
18465
|
+
|
18412
18466
|
// src/test/json-test-server.ts
|
18413
18467
|
var JsonTestServer = class {
|
18414
18468
|
constructor(url) {
|
@@ -18693,6 +18747,7 @@ function describeWithTestServer(description, responses, testFunction) {
|
|
18693
18747
|
}
|
18694
18748
|
// Annotate the CommonJS export names for ESM import in node:
|
18695
18749
|
0 && (module.exports = {
|
18750
|
+
BinaryTestServer,
|
18696
18751
|
JsonTestServer,
|
18697
18752
|
StreamingTestServer,
|
18698
18753
|
convertArrayToAsyncIterable,
|