Comparing version 4.2.0 to 4.2.1
@@ -0,1 +1,4 @@ | ||
# 4.2.1 | ||
Addexport of retryUntilDefined and retryAsyncUntilDefinedDecorator | ||
# 4.2.0 | ||
@@ -2,0 +5,0 @@ Add onError to RetryOptions |
export type { RetryOptions } from "./retry"; | ||
export type { TooManyTries } from "./retry"; | ||
export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, setDefaultRetryOptions, createExponetialDelay, createMutiplicableDelay, createRandomDelay } from "./retry"; | ||
export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryUntilDefined, retryAsyncUntilDefinedDecorator, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, setDefaultRetryOptions, createExponetialDelay, createMutiplicableDelay, createRandomDelay } from "./retry"; | ||
export type { TimeoutError } from "./wait"; | ||
export { getDefaultDuration, isTimeoutError, setDefaultDuration, wait, waitUntil, waitUntilAsync, } from "./wait"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.waitUntilAsync = exports.waitUntil = exports.wait = exports.setDefaultDuration = exports.isTimeoutError = exports.getDefaultDuration = exports.createRandomDelay = exports.createMutiplicableDelay = exports.createExponetialDelay = exports.setDefaultRetryOptions = exports.retryUntilTruthyDecorator = exports.retryUntilTruthy = exports.retryAsyncUntilTruthyDecorator = exports.retryAsyncUntilTruthy = exports.retryAsyncUntilResponseDecorator = exports.retryAsyncUntilResponse = exports.retryAsync = exports.retry = exports.isTooManyTries = exports.getDefaultRetryOptions = void 0; | ||
exports.waitUntilAsync = exports.waitUntil = exports.wait = exports.setDefaultDuration = exports.isTimeoutError = exports.getDefaultDuration = exports.createRandomDelay = exports.createMutiplicableDelay = exports.createExponetialDelay = exports.setDefaultRetryOptions = exports.retryUntilTruthyDecorator = exports.retryUntilTruthy = exports.retryAsyncUntilTruthyDecorator = exports.retryAsyncUntilTruthy = exports.retryAsyncUntilResponseDecorator = exports.retryAsyncUntilResponse = exports.retryAsyncUntilDefinedDecorator = exports.retryUntilDefined = exports.retryAsync = exports.retry = exports.isTooManyTries = exports.getDefaultRetryOptions = void 0; | ||
var retry_1 = require("./retry"); | ||
@@ -9,2 +9,4 @@ Object.defineProperty(exports, "getDefaultRetryOptions", { enumerable: true, get: function () { return retry_1.getDefaultRetryOptions; } }); | ||
Object.defineProperty(exports, "retryAsync", { enumerable: true, get: function () { return retry_1.retryAsync; } }); | ||
Object.defineProperty(exports, "retryUntilDefined", { enumerable: true, get: function () { return retry_1.retryUntilDefined; } }); | ||
Object.defineProperty(exports, "retryAsyncUntilDefinedDecorator", { enumerable: true, get: function () { return retry_1.retryAsyncUntilDefinedDecorator; } }); | ||
Object.defineProperty(exports, "retryAsyncUntilResponse", { enumerable: true, get: function () { return retry_1.retryAsyncUntilResponse; } }); | ||
@@ -11,0 +13,0 @@ Object.defineProperty(exports, "retryAsyncUntilResponseDecorator", { enumerable: true, get: function () { return retry_1.retryAsyncUntilResponseDecorator; } }); |
@@ -13,2 +13,3 @@ export type UNTIL<RETURN_TYPE> = (result: RETURN_TYPE) => boolean; | ||
until?: UNTIL<RETURN_TYPE> | null; | ||
onError?: (err: Error) => void; | ||
onMaxRetryFunc?: (err: Error) => void; | ||
@@ -15,0 +16,0 @@ } |
@@ -9,3 +9,4 @@ import { DELAY, RetryOptions, UNTIL } from "./options"; | ||
onMaxRetryFunc?: (err: Error) => void; | ||
onError?: (err: Error) => void; | ||
} | ||
export declare function getRetryParameters<RETURN_TYPE>(currentTry: number, retryOptions?: RetryOptions<RETURN_TYPE>): Readonly<RetryParameters<RETURN_TYPE>>; |
@@ -48,6 +48,9 @@ "use strict"; | ||
if (!(0, tooManyTries_1.isTooManyTries)(err) && canRecall) { | ||
if (retryParameters.onError) { | ||
retryParameters.onError(err); | ||
} | ||
return yield recall(fn, retryParameters); | ||
} | ||
else { | ||
if (retryParameters.onMaxRetryFunc !== undefined) { | ||
if (retryParameters.onMaxRetryFunc) { | ||
retryParameters.onMaxRetryFunc(err); | ||
@@ -54,0 +57,0 @@ } |
export type { RetryOptions } from "./retry"; | ||
export type { TooManyTries } from "./retry"; | ||
export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, setDefaultRetryOptions, createExponetialDelay, createMutiplicableDelay, createRandomDelay } from "./retry"; | ||
export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryUntilDefined, retryAsyncUntilDefinedDecorator, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, setDefaultRetryOptions, createExponetialDelay, createMutiplicableDelay, createRandomDelay } from "./retry"; | ||
export type { TimeoutError } from "./wait"; | ||
export { getDefaultDuration, isTimeoutError, setDefaultDuration, wait, waitUntil, waitUntilAsync, } from "./wait"; |
@@ -1,2 +0,2 @@ | ||
export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, setDefaultRetryOptions, createExponetialDelay, createMutiplicableDelay, createRandomDelay } from "./retry"; | ||
export { getDefaultRetryOptions, isTooManyTries, retry, retryAsync, retryUntilDefined, retryAsyncUntilDefinedDecorator, retryAsyncUntilResponse, retryAsyncUntilResponseDecorator, retryAsyncUntilTruthy, retryAsyncUntilTruthyDecorator, retryUntilTruthy, retryUntilTruthyDecorator, setDefaultRetryOptions, createExponetialDelay, createMutiplicableDelay, createRandomDelay } from "./retry"; | ||
export { getDefaultDuration, isTimeoutError, setDefaultDuration, wait, waitUntil, waitUntilAsync, } from "./wait"; |
@@ -13,2 +13,3 @@ export type UNTIL<RETURN_TYPE> = (result: RETURN_TYPE) => boolean; | ||
until?: UNTIL<RETURN_TYPE> | null; | ||
onError?: (err: Error) => void; | ||
onMaxRetryFunc?: (err: Error) => void; | ||
@@ -15,0 +16,0 @@ } |
@@ -9,3 +9,4 @@ import { DELAY, RetryOptions, UNTIL } from "./options"; | ||
onMaxRetryFunc?: (err: Error) => void; | ||
onError?: (err: Error) => void; | ||
} | ||
export declare function getRetryParameters<RETURN_TYPE>(currentTry: number, retryOptions?: RetryOptions<RETURN_TYPE>): Readonly<RetryParameters<RETURN_TYPE>>; |
@@ -43,6 +43,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (!isTooManyTries(err) && canRecall) { | ||
if (retryParameters.onError) { | ||
retryParameters.onError(err); | ||
} | ||
return yield recall(fn, retryParameters); | ||
} | ||
else { | ||
if (retryParameters.onMaxRetryFunc !== undefined) { | ||
if (retryParameters.onMaxRetryFunc) { | ||
retryParameters.onMaxRetryFunc(err); | ||
@@ -49,0 +52,0 @@ } |
{ | ||
"name": "ts-retry", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"main": "lib/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "lib/esm/index.js", |
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
90440
1195