undici-retry
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -1,8 +0,8 @@ | ||
export { ResponseError } from './lib/ResponseError'; | ||
export { UnprocessableResponseError } from './lib/UnprocessableResponseError'; | ||
export { UndiciRetryRequestError } from './lib/UndiciRetryRequestError'; | ||
export { sendWithRetry, DEFAULT_RETRY_CONFIG, NO_RETRY_CONFIG } from './lib/undiciRetry'; | ||
export { createDelayToNextMinuteResolver } from './lib/delayResolvers'; | ||
export { isInternalRequestError, isRequestResult, isResponseError } from './lib/typeGuards'; | ||
export { isInternalRequestError, isRequestResult, isUnprocessableResponseError } from './lib/typeGuards'; | ||
export type { CreateDelayToNextMinuteResolverConfig } from './lib/delayResolvers'; | ||
export type { RetryConfig, RequestResult, DelayResolver, RequestParams } from './lib/undiciRetry'; | ||
export type { Either } from './lib/either'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isResponseError = exports.isRequestResult = exports.isInternalRequestError = exports.createDelayToNextMinuteResolver = exports.NO_RETRY_CONFIG = exports.DEFAULT_RETRY_CONFIG = exports.sendWithRetry = exports.UndiciRetryRequestError = exports.ResponseError = void 0; | ||
var ResponseError_1 = require("./lib/ResponseError"); | ||
Object.defineProperty(exports, "ResponseError", { enumerable: true, get: function () { return ResponseError_1.ResponseError; } }); | ||
exports.isUnprocessableResponseError = exports.isRequestResult = exports.isInternalRequestError = exports.createDelayToNextMinuteResolver = exports.NO_RETRY_CONFIG = exports.DEFAULT_RETRY_CONFIG = exports.sendWithRetry = exports.UndiciRetryRequestError = exports.UnprocessableResponseError = void 0; | ||
var UnprocessableResponseError_1 = require("./lib/UnprocessableResponseError"); | ||
Object.defineProperty(exports, "UnprocessableResponseError", { enumerable: true, get: function () { return UnprocessableResponseError_1.UnprocessableResponseError; } }); | ||
var UndiciRetryRequestError_1 = require("./lib/UndiciRetryRequestError"); | ||
@@ -17,3 +17,3 @@ Object.defineProperty(exports, "UndiciRetryRequestError", { enumerable: true, get: function () { return UndiciRetryRequestError_1.UndiciRetryRequestError; } }); | ||
Object.defineProperty(exports, "isRequestResult", { enumerable: true, get: function () { return typeGuards_1.isRequestResult; } }); | ||
Object.defineProperty(exports, "isResponseError", { enumerable: true, get: function () { return typeGuards_1.isResponseError; } }); | ||
Object.defineProperty(exports, "isUnprocessableResponseError", { enumerable: true, get: function () { return typeGuards_1.isUnprocessableResponseError; } }); | ||
//# sourceMappingURL=index.js.map |
import { RequestResult } from './undiciRetry'; | ||
import { ResponseError } from './ResponseError'; | ||
import { UnprocessableResponseError } from './UnprocessableResponseError'; | ||
import { InternalRequestError } from './UndiciRetryRequestError'; | ||
export declare function isInternalRequestError(entity: unknown): entity is InternalRequestError; | ||
export declare function isRequestResult(entity: unknown): entity is RequestResult<unknown>; | ||
export declare function isResponseError(entity: unknown): entity is ResponseError; | ||
export declare function isUnprocessableResponseError(entity: unknown): entity is UnprocessableResponseError; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isResponseError = exports.isRequestResult = exports.isInternalRequestError = void 0; | ||
exports.isUnprocessableResponseError = exports.isRequestResult = exports.isInternalRequestError = void 0; | ||
function isInternalRequestError(entity) { | ||
@@ -12,6 +12,6 @@ return 'isInternalRequestError' in entity; | ||
exports.isRequestResult = isRequestResult; | ||
function isResponseError(entity) { | ||
return 'isResponseError' in entity; | ||
function isUnprocessableResponseError(entity) { | ||
return 'isUnprocessableResponseError' in entity; | ||
} | ||
exports.isResponseError = isResponseError; | ||
exports.isUnprocessableResponseError = isUnprocessableResponseError; | ||
//# sourceMappingURL=typeGuards.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.sendWithRetry = exports.DEFAULT_REQUEST_PARAMS = exports.NO_RETRY_CONFIG = exports.DEFAULT_RETRY_CONFIG = void 0; | ||
const ResponseError_1 = require("./ResponseError"); | ||
const UnprocessableResponseError_1 = require("./UnprocessableResponseError"); | ||
const promises_1 = require("node:timers/promises"); | ||
@@ -106,3 +106,3 @@ const undici_1 = require("undici"); | ||
if (!requestParams.throwOnInternalError) { | ||
if (!(0, typeGuards_1.isResponseError)(err)) { | ||
if (!(0, typeGuards_1.isUnprocessableResponseError)(err)) { | ||
err.requestLabel = requestParams.requestLabel; | ||
@@ -116,3 +116,3 @@ err.isInternalRequestError = true; | ||
else { | ||
if ((0, typeGuards_1.isResponseError)(err)) { | ||
if ((0, typeGuards_1.isUnprocessableResponseError)(err)) { | ||
throw err; | ||
@@ -146,9 +146,7 @@ } | ||
catch (err) { | ||
throw new ResponseError_1.ResponseError({ | ||
throw new UnprocessableResponseError_1.UnprocessableResponseError({ | ||
message: 'Error while parsing HTTP JSON response', | ||
errorCode: 'INVALID_HTTP_RESPONSE_JSON', | ||
requestLabel, | ||
details: { | ||
rawBody, | ||
}, | ||
rawBody, | ||
}); | ||
@@ -155,0 +153,0 @@ } |
{ | ||
"name": "undici-retry", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Library for handling retry logic with undici HTTP client", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32789
36
439