New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@chatbotkit/fetch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chatbotkit/fetch - npm Package Compare versions

Comparing version
1.18.3
to
1.19.0
+25
-20
dist/cjs/index.cjs
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TOO_MANY_REQUESTS_CODE = exports.UNPROCESSABLE_ENTITY_CODE = exports.CONFLICT_CODE = exports.TIMEOUT_CODE = exports.METHOD_NOT_ALLOWED_CODE = exports.NOT_FOUND_CODE = exports.NO_SUBSCRIPTION_CODE = exports.NOT_AUTHORIZED_CODE = exports.NOT_AUTHENTICATED_CODE = exports.BAD_REQUEST_CODE = exports.NOT_MODIFIED_CODE = exports.OK_CODE = exports.GATEWAY_TIMEOUT_MESSAGE = exports.SERVICE_UNAVAILABLE_MESSAGE = exports.BAD_GATEWAY_MESSAGE = exports.NOT_IMPLEMENTED_MESSAGE = exports.INTERNAL_SERVER_ERROR_MESSAGE = exports.LIMITS_REACHED_MESSAGE = exports.TOO_MANY_REQUESTS_MESSAGE = exports.UNPROCESSABLE_ENTITY_STATUS_MESSAGE = exports.CONFLICT_MESSAGE = exports.TIMEOUT_MESSAGE = exports.METHOD_NOT_ALLOWED_MESSAGE = exports.NOT_FOUND_MESSAGE = exports.NO_SUBSCRIPTION_MESSAGE = exports.NOT_AUTHORIZED_MESSAGE = exports.NOT_AUTHENTICATED_MESSAGE = exports.BAD_REQUEST_MESSAGE = exports.NOT_MODIFIED_MESSAGE = exports.OK_MESSAGE = exports.GATEWAY_TIMEOUT_STATUS = exports.SERVICE_UNAVAILABLE_STATUS = exports.BAD_GATEWAY_STATUS = exports.NOT_IMPLEMENTED_STATUS = exports.INTERNAL_SERVER_ERROR_STATUS = exports.LIMITS_REACHED_STATUS = exports.TOO_MANY_REQUESTS_STATUS = exports.UNPROCESSABLE_ENTITY_STATUS = exports.CONFLICT_STATUS = exports.TIMEOUT_STATUS = exports.METHOD_NOT_ALLOWED_STATUS = exports.NOT_FOUND_STATUS = exports.NOT_AUTHORIZED_STATUS = exports.NO_SUBSCRIPTION_STATUS = exports.NOT_AUTHENTICATED_STATUS = exports.BAD_REQUEST_STATUS = exports.NOT_MODIFIED_STATUS = exports.OK_STATUS = exports.FormData = exports.Blob = void 0;
exports.jsonl = exports.withRetry = exports.withTimeout = exports.anySignal = exports.fetch = exports.TimeoutError = exports.AbortError = exports.DEFAULT_RETRY_STATUSES = exports.DEFAULT_RETRY_TIMEOUT = exports.DEFAULT_RETRY_DELAY = exports.DEFAULT_RETRIES = exports.DEFAULT_TIMEOUT = exports.TIMEOUT_ERROR_NAME = exports.ABORT_ERROR_NAME = exports.getFetchError = exports.FetchError = exports.statusToCodeMap = exports.GATEWAY_TIMEOUT_CODE = exports.SERVICE_UNAVAILABLE_CODE = exports.BAD_GATEWAY_CODE = exports.NOT_IMPLEMENTED_CODE = exports.INTERNAL_SERVER_ERROR_CODE = exports.LIMITS_REACHED_CODE = void 0;
const node_fetch_native_1 = require("node-fetch-native");
Object.defineProperty(exports, "Blob", { enumerable: true, get: function () { return node_fetch_native_1.Blob; } });
Object.defineProperty(exports, "FormData", { enumerable: true, get: function () { return node_fetch_native_1.FormData; } });
exports.TimeoutError = exports.AbortError = exports.DEFAULT_RETRY_STATUSES = exports.DEFAULT_RETRY_TIMEOUT = exports.DEFAULT_RETRY_DELAY = exports.DEFAULT_RETRIES = exports.DEFAULT_TIMEOUT = exports.TIMEOUT_ERROR_NAME = exports.ABORT_ERROR_NAME = exports.FetchError = exports.statusToCodeMap = exports.GATEWAY_TIMEOUT_CODE = exports.SERVICE_UNAVAILABLE_CODE = exports.BAD_GATEWAY_CODE = exports.NOT_IMPLEMENTED_CODE = exports.INTERNAL_SERVER_ERROR_CODE = exports.LIMITS_REACHED_CODE = void 0;
exports.getFetchError = getFetchError;
exports.fetch = fetch;
exports.anySignal = anySignal;
exports.withTimeout = withTimeout;
exports.withRetry = withRetry;
exports.jsonl = jsonl;
const globalObject = typeof global !== 'undefined' ? global : globalThis;
{
if (typeof globalThis.ReadableStream === 'function' &&
typeof globalThis.ReadableStream.prototype[Symbol.asyncIterator] !==
if (typeof globalObject !== 'undefined' &&
typeof globalObject.ReadableStream === 'function' &&
typeof globalObject.ReadableStream.prototype[Symbol.asyncIterator] !==
'function') {
globalThis.ReadableStream.prototype[Symbol.asyncIterator] = function () {
globalObject.ReadableStream.prototype[Symbol.asyncIterator] = function () {
const reader = this.getReader();

@@ -24,2 +29,4 @@ return {

}
exports.Blob = globalObject.Blob;
exports.FormData = globalObject.FormData;
exports.OK_STATUS = 200;

@@ -118,3 +125,3 @@ exports.NOT_MODIFIED_STATUS = 304;

}
catch (e) {
catch (_a) {
json = { message: text, code: exports.statusToCodeMap[status] };

@@ -124,3 +131,2 @@ }

}
exports.getFetchError = getFetchError;
exports.ABORT_ERROR_NAME = 'AbortError';

@@ -152,5 +158,8 @@ exports.TIMEOUT_ERROR_NAME = 'TimeoutError';

function fetch(url, init) {
return (0, node_fetch_native_1.fetch)(url, init);
const nativeFetch = typeof globalObject !== 'undefined' ? globalObject.fetch : undefined;
if (!nativeFetch) {
throw new Error(`No suitable fetch implementation found`);
}
return nativeFetch(url, init);
}
exports.fetch = fetch;
function anySignal(signals) {

@@ -172,3 +181,2 @@ const controller = new AbortController();

}
exports.anySignal = anySignal;
function withTimeout(fetch, defaultOptions) {

@@ -202,3 +210,3 @@ return async function fetchWithTimeout(url, options) {

catch (error) {
if ([error.name, error.message].includes(exports.ABORT_ERROR_NAME)) {
if ([error === null || error === void 0 ? void 0 : error.name, error === null || error === void 0 ? void 0 : error.message].includes(exports.ABORT_ERROR_NAME)) {
if (isTimeOutAbort) {

@@ -216,3 +224,2 @@ throw new TimeoutError();

}
exports.withTimeout = withTimeout;
function withRetry(fetch, defaultOptions) {

@@ -243,3 +250,3 @@ return async function fetchWithRetry(url, options) {

switch (true) {
case [error.name, error.message].includes(exports.TIMEOUT_ERROR_NAME) &&
case [error === null || error === void 0 ? void 0 : error.name, error === null || error === void 0 ? void 0 : error.message].includes(exports.TIMEOUT_ERROR_NAME) &&
!retryTimeout:

@@ -267,3 +274,2 @@ {

}
exports.withRetry = withRetry;
async function* jsonl(body) {

@@ -288,9 +294,8 @@ try {

}
catch (e) {
if (e.name !== exports.ABORT_ERROR_NAME) {
throw e;
catch (error) {
if ((error === null || error === void 0 ? void 0 : error.name) !== exports.ABORT_ERROR_NAME) {
throw error;
}
}
}
exports.jsonl = jsonl;
exports.default = fetch;

@@ -9,2 +9,10 @@ export function getFetchError(response: Response, meta?: Record<string, any>): Promise<FetchError>;

}): AsyncGenerator<Record<string, any>>;
export const Blob: {
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
prototype: Blob;
};
export const FormData: {
new (form?: HTMLFormElement, submitter?: HTMLElement | null): FormData;
prototype: FormData;
};
export const OK_STATUS: 200;

@@ -93,4 +101,1 @@ export const NOT_MODIFIED_STATUS: 304;

};
import { Blob } from 'node-fetch-native';
import { FormData } from 'node-fetch-native';
export { Blob, FormData };

@@ -1,9 +0,17 @@

export function getFetchError(response: Response, meta?: Record<string, any> | undefined): Promise<FetchError>;
export function fetch(url: string | URL, init?: RequestInit | undefined): Promise<Response>;
export function getFetchError(response: Response, meta?: Record<string, any>): Promise<FetchError>;
export function fetch(url: string | URL, init?: RequestInit): Promise<Response>;
export function anySignal(signals: (AbortSignal | null | undefined)[]): AbortSignal;
export function withTimeout(fetch: FetchFn<{}>, defaultOptions?: withTimeoutOptions | undefined): FetchFn<withTimeoutOptions>;
export function withRetry(fetch: FetchFn<{}>, defaultOptions?: withRetryOptions | undefined): FetchFn<withRetryOptions>;
export function withTimeout(fetch: FetchFn<{}>, defaultOptions?: withTimeoutOptions): FetchFn<withTimeoutOptions>;
export function withRetry(fetch: FetchFn<{}>, defaultOptions?: withRetryOptions): FetchFn<withRetryOptions>;
export function jsonl(body: ReadableStream<Uint8Array> & {
[Symbol.asyncIterator](): AsyncIterator<Uint8Array>;
}): AsyncGenerator<Record<string, any>>;
export const Blob: {
new (blobParts?: BlobPart[], options?: BlobPropertyBag): Blob;
prototype: Blob;
};
export const FormData: {
new (form?: HTMLFormElement, submitter?: HTMLElement | null): FormData;
prototype: FormData;
};
export const OK_STATUS: 200;

@@ -65,3 +73,3 @@ export const NOT_MODIFIED_STATUS: 304;

export class FetchError extends Error {
constructor(message: string, code: string, meta?: Record<string, any> | undefined);
constructor(message: string, code: string, meta?: Record<string, any>);
code: string;

@@ -93,4 +101,1 @@ }

};
import { Blob } from 'node-fetch-native';
import { FormData } from 'node-fetch-native';
export { Blob, FormData };

@@ -1,8 +0,8 @@

import { Blob, FormData, fetch as nativeFetch } from 'node-fetch-native';
export { Blob, FormData };
const globalObject = typeof global !== 'undefined' ? global : globalThis;
{
if (typeof globalThis.ReadableStream === 'function' &&
typeof globalThis.ReadableStream.prototype[Symbol.asyncIterator] !==
if (typeof globalObject !== 'undefined' &&
typeof globalObject.ReadableStream === 'function' &&
typeof globalObject.ReadableStream.prototype[Symbol.asyncIterator] !==
'function') {
globalThis.ReadableStream.prototype[Symbol.asyncIterator] = function () {
globalObject.ReadableStream.prototype[Symbol.asyncIterator] = function () {
const reader = this.getReader();

@@ -19,2 +19,4 @@ return {

}
export const Blob = globalObject.Blob;
export const FormData = globalObject.FormData;
export const OK_STATUS = 200;

@@ -112,3 +114,3 @@ export const NOT_MODIFIED_STATUS = 304;

}
catch (e) {
catch {
json = { message: text, code: statusToCodeMap[status] };

@@ -142,2 +144,6 @@ }

export function fetch(url, init) {
const nativeFetch = typeof globalObject !== 'undefined' ? globalObject.fetch : undefined;
if (!nativeFetch) {
throw new Error(`No suitable fetch implementation found`);
}
return nativeFetch(url, init);

@@ -188,3 +194,3 @@ }

catch (error) {
if ([error.name, error.message].includes(ABORT_ERROR_NAME)) {
if ([error?.name, error?.message].includes(ABORT_ERROR_NAME)) {
if (isTimeOutAbort) {

@@ -230,3 +236,3 @@ throw new TimeoutError();

switch (true) {
case [error.name, error.message].includes(TIMEOUT_ERROR_NAME) &&
case [error?.name, error?.message].includes(TIMEOUT_ERROR_NAME) &&
!retryTimeout:

@@ -273,5 +279,5 @@ {

}
catch (e) {
if (e.name !== ABORT_ERROR_NAME) {
throw e;
catch (error) {
if (error?.name !== ABORT_ERROR_NAME) {
throw error;
}

@@ -278,0 +284,0 @@ }

{
"name": "@chatbotkit/fetch",
"version": "1.18.3",
"version": "1.19.0",
"description": "Isomorphic implenetation for fetch specifically designed for @chatbotkit/sdk.",
"license": "ISC",
"engines": {
"node": ">=18.17.0"
"node": ">=20.0.0"
},

@@ -58,10 +58,16 @@ "repository": {

},
"files": [
"dist/**"
],
"types": "./dist/cjs/index.d.ts",
"dependencies": {
"node-fetch-native": "^1.6.6",
"tslib": "^2.6.2"
},
"devDependencies": {
"npm-run-all": "^4.1.5",
"typedoc": "^0.25.3",
"typedoc-plugin-markdown": "^3.17.1",
"typedoc-plugin-mdn-links": "^3.1.18",
"typescript": "^5.9"
},
"files": [
"dist/**"
],
"scripts": {

@@ -68,0 +74,0 @@ "build": "run-s build:*",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet