@chatbotkit/fetch
Advanced tools
+15
-13
@@ -124,3 +124,3 @@ "use strict"; | ||
| } | ||
| catch (_a) { | ||
| catch { | ||
| json = { message: text, code: exports.statusToCodeMap[status] }; | ||
@@ -180,4 +180,3 @@ } | ||
| return async function fetchWithTimeout(url, options) { | ||
| var _a, _b; | ||
| const timeout = (_b = (_a = options === null || options === void 0 ? void 0 : options.timeout) !== null && _a !== void 0 ? _a : defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.timeout) !== null && _b !== void 0 ? _b : exports.DEFAULT_TIMEOUT; | ||
| const timeout = options?.timeout ?? defaultOptions?.timeout ?? exports.DEFAULT_TIMEOUT; | ||
| let signal; | ||
@@ -192,3 +191,3 @@ let handler; | ||
| }, timeout); | ||
| signal = (options === null || options === void 0 ? void 0 : options.signal) | ||
| signal = options?.signal | ||
| ? anySignal([abortController.signal, options.signal]) | ||
@@ -198,3 +197,3 @@ : abortController.signal; | ||
| else { | ||
| signal = options === null || options === void 0 ? void 0 : options.signal; | ||
| signal = options?.signal; | ||
| } | ||
@@ -209,3 +208,3 @@ let response; | ||
| catch (error) { | ||
| 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 ([error?.name, error?.message].includes(exports.ABORT_ERROR_NAME)) { | ||
| if (isTimeOutAbort) { | ||
@@ -225,7 +224,10 @@ throw new TimeoutError(); | ||
| return async function fetchWithRetry(url, options) { | ||
| var _a, _b, _c, _d, _e, _f, _g, _h; | ||
| const retries = (_b = (_a = options === null || options === void 0 ? void 0 : options.retries) !== null && _a !== void 0 ? _a : defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.retries) !== null && _b !== void 0 ? _b : exports.DEFAULT_RETRIES; | ||
| const retryDelay = (_d = (_c = options === null || options === void 0 ? void 0 : options.retryDelay) !== null && _c !== void 0 ? _c : defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.retryDelay) !== null && _d !== void 0 ? _d : exports.DEFAULT_RETRY_DELAY; | ||
| const retryTimeout = (_f = (_e = options === null || options === void 0 ? void 0 : options.retryTimeout) !== null && _e !== void 0 ? _e : defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.retryTimeout) !== null && _f !== void 0 ? _f : exports.DEFAULT_RETRY_TIMEOUT; | ||
| const retryStatuses = (_h = (_g = options === null || options === void 0 ? void 0 : options.retryStatuses) !== null && _g !== void 0 ? _g : defaultOptions === null || defaultOptions === void 0 ? void 0 : defaultOptions.retryStatuses) !== null && _h !== void 0 ? _h : exports.DEFAULT_RETRY_STATUSES; | ||
| const retries = options?.retries ?? defaultOptions?.retries ?? exports.DEFAULT_RETRIES; | ||
| const retryDelay = options?.retryDelay ?? defaultOptions?.retryDelay ?? exports.DEFAULT_RETRY_DELAY; | ||
| const retryTimeout = options?.retryTimeout ?? | ||
| defaultOptions?.retryTimeout ?? | ||
| exports.DEFAULT_RETRY_TIMEOUT; | ||
| const retryStatuses = options?.retryStatuses ?? | ||
| defaultOptions?.retryStatuses ?? | ||
| exports.DEFAULT_RETRY_STATUSES; | ||
| let response; | ||
@@ -249,3 +251,3 @@ try { | ||
| switch (true) { | ||
| case [error === null || error === void 0 ? void 0 : error.name, error === null || error === void 0 ? void 0 : error.message].includes(exports.TIMEOUT_ERROR_NAME) && | ||
| case [error?.name, error?.message].includes(exports.TIMEOUT_ERROR_NAME) && | ||
| !retryTimeout: | ||
@@ -293,3 +295,3 @@ { | ||
| catch (error) { | ||
| if ((error === null || error === void 0 ? void 0 : error.name) !== exports.ABORT_ERROR_NAME) { | ||
| if (error?.name !== exports.ABORT_ERROR_NAME) { | ||
| throw error; | ||
@@ -296,0 +298,0 @@ } |
+1
-1
| { | ||
| "name": "@chatbotkit/fetch", | ||
| "version": "1.19.0", | ||
| "version": "1.21.6", | ||
| "description": "Isomorphic implenetation for fetch specifically designed for @chatbotkit/sdk.", | ||
@@ -5,0 +5,0 @@ "license": "ISC", |
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
777
0.26%103126
-1.22%