Socket
Socket
Sign inDemoInstall

@ai-sdk/provider-utils

Package Overview
Dependencies
Maintainers
2
Versions
38
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 1.0.11 to 1.0.12

10

./dist/index.js

@@ -329,3 +329,3 @@ "use strict";

// src/post-to-api.ts
var getOriginalFetch = () => fetch;
var getOriginalFetch = () => globalThis.fetch;
var postJsonToApi = async ({

@@ -338,3 +338,3 @@ url,

abortSignal,
fetch: fetch2
fetch
}) => postToApi({

@@ -353,3 +353,3 @@ url,

abortSignal,
fetch: fetch2
fetch
});

@@ -363,6 +363,6 @@ var postToApi = async ({

abortSignal,
fetch: fetch2 = getOriginalFetch()
fetch = getOriginalFetch()
}) => {
try {
const response = await fetch2(url, {
const response = await fetch(url, {
method: "POST",

@@ -369,0 +369,0 @@ headers: removeUndefinedEntries(headers),

import { JSONParseError, TypeValidationError, APICallError } from '@ai-sdk/provider';
import * as zod from 'zod';
import { z, ZodSchema } from 'zod';

@@ -25,5 +24,10 @@

/**
* Fetch function type (standardizes the version of fetch used).
*/
type FetchFunction = typeof globalThis.fetch;
/**
* Generates a 7-character random string to use for IDs. Not secure.
*/
declare const generateId: (size?: number | undefined) => string;
declare const generateId: (size?: number) => string;

@@ -144,25 +148,25 @@ declare function getErrorMessage(error: unknown | undefined): string;

declare const createJsonErrorResponseHandler: <T>({ errorSchema, errorToMessage, isRetryable, }: {
errorSchema: ZodSchema<T, zod.ZodTypeDef, T>;
errorSchema: ZodSchema<T>;
errorToMessage: (error: T) => string;
isRetryable?: ((response: Response, error?: T | undefined) => boolean) | undefined;
isRetryable?: (response: Response, error?: T) => boolean;
}) => ResponseHandler<APICallError>;
declare const createEventSourceResponseHandler: <T>(chunkSchema: ZodSchema<T, zod.ZodTypeDef, T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
declare const createJsonStreamResponseHandler: <T>(chunkSchema: ZodSchema<T, zod.ZodTypeDef, T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
declare const createJsonResponseHandler: <T>(responseSchema: ZodSchema<T, zod.ZodTypeDef, T>) => ResponseHandler<T>;
declare const createEventSourceResponseHandler: <T>(chunkSchema: ZodSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
declare const createJsonStreamResponseHandler: <T>(chunkSchema: ZodSchema<T>) => ResponseHandler<ReadableStream<ParseResult<T>>>;
declare const createJsonResponseHandler: <T>(responseSchema: ZodSchema<T>) => ResponseHandler<T>;
declare const postJsonToApi: <T>({ url, headers, body, failedResponseHandler, successfulResponseHandler, abortSignal, fetch, }: {
url: string;
headers?: Record<string, string | undefined> | undefined;
headers?: Record<string, string | undefined>;
body: unknown;
failedResponseHandler: ResponseHandler<APICallError>;
successfulResponseHandler: ResponseHandler<T>;
abortSignal?: AbortSignal | undefined;
fetch?: typeof fetch | undefined;
abortSignal?: AbortSignal;
fetch?: FetchFunction;
}) => Promise<{
value: T;
responseHeaders?: Record<string, string> | undefined;
responseHeaders?: Record<string, string>;
}>;
declare const postToApi: <T>({ url, headers, body, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
url: string;
headers?: Record<string, string | undefined> | undefined;
headers?: Record<string, string | undefined>;
body: {

@@ -174,7 +178,7 @@ content: string | FormData | Uint8Array;

successfulResponseHandler: ResponseHandler<T>;
abortSignal?: AbortSignal | undefined;
fetch?: typeof fetch | undefined;
abortSignal?: AbortSignal;
fetch?: FetchFunction;
}) => Promise<{
value: T;
responseHeaders?: Record<string, string> | undefined;
responseHeaders?: Record<string, string>;
}>;

@@ -220,2 +224,2 @@

export { type ParseResult, type ResponseHandler, type ValidationResult, type Validator, asValidator, combineHeaders, convertAsyncGeneratorToReadableStream, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, extractResponseHeaders, generateId, getErrorMessage, isAbortError, isParsableJson, isParseableJson, isValidator, loadApiKey, loadSetting, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, validateTypes, validator, validatorSymbol, withoutTrailingSlash, zodValidator };
export { type FetchFunction, type ParseResult, type ResponseHandler, type ValidationResult, type Validator, asValidator, combineHeaders, convertAsyncGeneratorToReadableStream, convertBase64ToUint8Array, convertUint8ArrayToBase64, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createJsonStreamResponseHandler, extractResponseHeaders, generateId, getErrorMessage, isAbortError, isParsableJson, isParseableJson, isValidator, loadApiKey, loadSetting, parseJSON, postJsonToApi, postToApi, safeParseJSON, safeValidateTypes, validateTypes, validator, validatorSymbol, withoutTrailingSlash, zodValidator };

@@ -329,3 +329,3 @@ "use strict";

// src/post-to-api.ts
var getOriginalFetch = () => fetch;
var getOriginalFetch = () => globalThis.fetch;
var postJsonToApi = async ({

@@ -338,3 +338,3 @@ url,

abortSignal,
fetch: fetch2
fetch
}) => postToApi({

@@ -353,3 +353,3 @@ url,

abortSignal,
fetch: fetch2
fetch
});

@@ -363,6 +363,6 @@ var postToApi = async ({

abortSignal,
fetch: fetch2 = getOriginalFetch()
fetch = getOriginalFetch()
}) => {
try {
const response = await fetch2(url, {
const response = await fetch(url, {
method: "POST",

@@ -369,0 +369,0 @@ headers: removeUndefinedEntries(headers),

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

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

"tsup": "^8",
"typescript": "5.1.3",
"typescript": "5.5.4",
"zod": "3.23.8",

@@ -40,0 +40,0 @@ "@vercel/ai-tsconfig": "0.0.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 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