@ai-sdk/provider-utils 0.0.14 → 0.0.16
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/dist/index.d.mts +13 -2
- package/test/dist/index.d.ts +13 -2
- package/test/dist/index.js +46 -3
- package/test/dist/index.js.map +1 -1
- package/test/dist/index.mjs +42 -3
- package/test/dist/index.mjs.map +1 -1
package/test/dist/index.mjs
CHANGED
@@ -27,12 +27,44 @@ var __privateMethod = (obj, member, method) => {
|
|
27
27
|
return method;
|
28
28
|
};
|
29
29
|
|
30
|
-
// src/test/convert-
|
31
|
-
|
30
|
+
// src/test/convert-array-to-readable-stream.ts
|
31
|
+
function convertArrayToReadableStream(values) {
|
32
|
+
return new ReadableStream({
|
33
|
+
start(controller) {
|
34
|
+
for (const value of values) {
|
35
|
+
controller.enqueue(value);
|
36
|
+
}
|
37
|
+
controller.close();
|
38
|
+
}
|
39
|
+
});
|
40
|
+
}
|
41
|
+
|
42
|
+
// src/test/convert-array-to-async-iterable.ts
|
43
|
+
function convertArrayToAsyncIterable(values) {
|
44
|
+
return {
|
45
|
+
async *[Symbol.asyncIterator]() {
|
46
|
+
for (const value of values) {
|
47
|
+
yield value;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
};
|
51
|
+
}
|
52
|
+
|
53
|
+
// src/test/convert-async-iterable-to-array.ts
|
54
|
+
async function convertAsyncIterableToArray(iterable) {
|
32
55
|
const result = [];
|
56
|
+
for await (const item of iterable) {
|
57
|
+
result.push(item);
|
58
|
+
}
|
59
|
+
return result;
|
60
|
+
}
|
61
|
+
|
62
|
+
// src/test/convert-readable-stream-to-array.ts
|
63
|
+
async function convertReadableStreamToArray(stream) {
|
33
64
|
const reader = stream.getReader();
|
65
|
+
const result = [];
|
34
66
|
while (true) {
|
35
|
-
const {
|
67
|
+
const { done, value } = await reader.read();
|
36
68
|
if (done)
|
37
69
|
break;
|
38
70
|
result.push(value);
|
@@ -8256,9 +8288,16 @@ var StreamingTestServer = class {
|
|
8256
8288
|
afterAll(() => this.server.close());
|
8257
8289
|
}
|
8258
8290
|
};
|
8291
|
+
|
8292
|
+
// src/test/index.ts
|
8293
|
+
var convertStreamToArray = convertReadableStreamToArray;
|
8259
8294
|
export {
|
8260
8295
|
JsonTestServer,
|
8261
8296
|
StreamingTestServer,
|
8297
|
+
convertArrayToAsyncIterable,
|
8298
|
+
convertArrayToReadableStream,
|
8299
|
+
convertAsyncIterableToArray,
|
8300
|
+
convertReadableStreamToArray,
|
8262
8301
|
convertStreamToArray
|
8263
8302
|
};
|
8264
8303
|
/*! Bundled license information:
|