Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/provider-utils

Package Overview
Dependencies
Maintainers
0
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/provider-utils - npm Package Compare versions

Comparing version 0.0.16 to 1.0.0

31

./dist/index.js

@@ -33,2 +33,3 @@ "use strict";

__export(src_exports, {
combineHeaders: () => combineHeaders,
convertAsyncGeneratorToReadableStream: () => convertAsyncGeneratorToReadableStream,

@@ -60,2 +61,13 @@ convertBase64ToUint8Array: () => convertBase64ToUint8Array,

// src/combine-headers.ts
function combineHeaders(...headers) {
return headers.reduce(
(combinedHeaders, currentHeaders) => ({
...combinedHeaders,
...currentHeaders != null ? currentHeaders : {}
}),
{}
);
}
// src/convert-async-generator-to-readable-stream.ts

@@ -317,2 +329,11 @@ function convertAsyncGeneratorToReadableStream(stream) {

var import_provider6 = require("@ai-sdk/provider");
// src/remove-undefined-entries.ts
function removeUndefinedEntries(record) {
return Object.fromEntries(
Object.entries(record).filter(([_key, value]) => value != null)
);
}
// src/post-to-api.ts
var getOriginalFetch = () => fetch;

@@ -330,4 +351,4 @@ var postJsonToApi = async ({

headers: {
...headers,
"Content-Type": "application/json"
"Content-Type": "application/json",
...headers
},

@@ -353,8 +374,5 @@ body: {

try {
const definedHeaders = Object.fromEntries(
Object.entries(headers).filter(([_key, value]) => value != null)
);
const response = await fetch2(url, {
method: "POST",
headers: definedHeaders,
headers: removeUndefinedEntries(headers),
body: body.content,

@@ -581,2 +599,3 @@ signal: abortSignal

0 && (module.exports = {
combineHeaders,
convertAsyncGeneratorToReadableStream,

@@ -583,0 +602,0 @@ convertBase64ToUint8Array,

4

dist/index.d.ts

@@ -5,2 +5,4 @@ import { JSONParseError, TypeValidationError, APICallError } from '@ai-sdk/provider';

declare function combineHeaders(...headers: Array<Record<string, string | undefined> | undefined>): Record<string, string | undefined>;
/**

@@ -192,2 +194,2 @@ * Converts an AsyncGenerator to a ReadableStream.

export { type ParseResult, type ResponseHandler, convertAsyncGeneratorToReadableStream, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, download, extractResponseHeaders, generateId, getErrorMessage, isAbortError, isParsableJson, isParseableJson, loadApiKey, loadSetting, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, validateTypes, withoutTrailingSlash };
export { type ParseResult, type ResponseHandler, combineHeaders, convertAsyncGeneratorToReadableStream, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, download, extractResponseHeaders, generateId, getErrorMessage, isAbortError, isParsableJson, isParseableJson, loadApiKey, loadSetting, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, validateTypes, withoutTrailingSlash };

@@ -33,2 +33,3 @@ "use strict";

__export(src_exports, {
combineHeaders: () => combineHeaders,
convertAsyncGeneratorToReadableStream: () => convertAsyncGeneratorToReadableStream,

@@ -60,2 +61,13 @@ convertBase64ToUint8Array: () => convertBase64ToUint8Array,

// src/combine-headers.ts
function combineHeaders(...headers) {
return headers.reduce(
(combinedHeaders, currentHeaders) => ({
...combinedHeaders,
...currentHeaders != null ? currentHeaders : {}
}),
{}
);
}
// src/convert-async-generator-to-readable-stream.ts

@@ -317,2 +329,11 @@ function convertAsyncGeneratorToReadableStream(stream) {

var import_provider6 = require("@ai-sdk/provider");
// src/remove-undefined-entries.ts
function removeUndefinedEntries(record) {
return Object.fromEntries(
Object.entries(record).filter(([_key, value]) => value != null)
);
}
// src/post-to-api.ts
var getOriginalFetch = () => fetch;

@@ -330,4 +351,4 @@ var postJsonToApi = async ({

headers: {
...headers,
"Content-Type": "application/json"
"Content-Type": "application/json",
...headers
},

@@ -353,8 +374,5 @@ body: {

try {
const definedHeaders = Object.fromEntries(
Object.entries(headers).filter(([_key, value]) => value != null)
);
const response = await fetch2(url, {
method: "POST",
headers: definedHeaders,
headers: removeUndefinedEntries(headers),
body: body.content,

@@ -581,2 +599,3 @@ signal: abortSignal

0 && (module.exports = {
combineHeaders,
convertAsyncGeneratorToReadableStream,

@@ -583,0 +602,0 @@ convertBase64ToUint8Array,

{
"name": "@ai-sdk/provider-utils",
"version": "0.0.16",
"version": "1.0.0",
"license": "Apache-2.0",

@@ -28,3 +28,3 @@ "sideEffects": false,

"dependencies": {
"@ai-sdk/provider": "0.0.10",
"@ai-sdk/provider": "0.0.11",
"eventsource-parser": "1.1.2",

@@ -31,0 +31,0 @@ "nanoid": "3.3.6",

@@ -18,3 +18,3 @@ import { SetupServer } from 'msw/node';

getRequestBodyJson(): Promise<any>;
getRequestHeaders(): Promise<Headers>;
getRequestHeaders(): Promise<Record<string, string>>;
setupTestEnvironment(): void;

@@ -30,3 +30,3 @@ }

getRequestBodyJson(): Promise<any>;
getRequestHeaders(): Promise<Headers>;
getRequestHeaders(): Promise<Record<string, string>>;
setupTestEnvironment(): void;

@@ -33,0 +33,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc