Comparing version 2.3.5 to 2.3.6
@@ -8,3 +8,3 @@ "use strict"; | ||
const wrappedFn = () => fn(...args); | ||
return _1.retryAsync(wrappedFn, retryOptions); | ||
return (0, _1.retryAsync)(wrappedFn, retryOptions); | ||
}; | ||
@@ -16,5 +16,5 @@ } | ||
const wrappedFn = () => fn(...args); | ||
return _1.retry(wrappedFn, retryOptions); | ||
return (0, _1.retry)(wrappedFn, retryOptions); | ||
}; | ||
} | ||
exports.retryDecorator = retryDecorator; |
@@ -19,3 +19,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fnAsync = misc_1.asyncDecorator(fn); | ||
const fnAsync = (0, misc_1.asyncDecorator)(fn); | ||
return yield retryAsync(fnAsync, retryOptions); | ||
@@ -27,8 +27,8 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const { maxTry, delay, until } = Object.assign(Object.assign({}, options_1.getDefaultRetryOptions()), retryOptions); | ||
misc_1.assertDefined(maxTry, `maxTry must be defined`); | ||
misc_1.assertDefined(delay, `delay must be defined`); | ||
const { maxTry, delay, until } = Object.assign(Object.assign({}, (0, options_1.getDefaultRetryOptions)()), retryOptions); | ||
(0, misc_1.assertDefined)(maxTry, `maxTry must be defined`); | ||
(0, misc_1.assertDefined)(delay, `delay must be defined`); | ||
const canRecall = () => maxTry > 1; | ||
const recall = () => __awaiter(this, void 0, void 0, function* () { | ||
yield wait_1.wait(delay); | ||
yield (0, wait_1.wait)(delay); | ||
return yield retryAsync(fn, { delay, maxTry: maxTry - 1, until }); | ||
@@ -50,3 +50,3 @@ }); | ||
catch (err) { | ||
if (!tooManyTries_1.isTooManyTries(err) && canRecall()) { | ||
if (!(0, tooManyTries_1.isTooManyTries)(err) && canRecall()) { | ||
return yield recall(); | ||
@@ -53,0 +53,0 @@ } |
@@ -5,2 +5,2 @@ export declare class TooManyTries extends Error { | ||
} | ||
export declare function isTooManyTries(error: Error): error is TooManyTries; | ||
export declare function isTooManyTries(error: unknown): error is TooManyTries; |
@@ -17,3 +17,3 @@ "use strict"; | ||
const wrappedFn = () => fn(...args); | ||
return yield retry_1.retryUntilDefined(wrappedFn, retryOptions); | ||
return yield (0, retry_1.retryUntilDefined)(wrappedFn, retryOptions); | ||
}); | ||
@@ -25,5 +25,5 @@ } | ||
const wrappedFn = () => __awaiter(this, void 0, void 0, function* () { return yield fn(...args); }); | ||
return yield retry_1.retryAsyncUntilDefined(wrappedFn, retryOptions); | ||
return yield (0, retry_1.retryAsyncUntilDefined)(wrappedFn, retryOptions); | ||
}); | ||
} | ||
exports.retryAsyncUntilDefinedDecorator = retryAsyncUntilDefinedDecorator; |
@@ -16,7 +16,7 @@ "use strict"; | ||
const until = (lastResult) => lastResult !== undefined && lastResult !== null; | ||
const getOptions = options_1.retryUntilOptionsToRetryOptionsHof(until); | ||
const getOptions = (0, options_1.retryUntilOptionsToRetryOptionsHof)(until); | ||
function retryUntilDefined(fn, retryOptions) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const options = getOptions(retryOptions); | ||
return (yield retry_1.retry(fn, options)); | ||
return (yield (0, retry_1.retry)(fn, options)); | ||
}); | ||
@@ -28,5 +28,5 @@ } | ||
const options = getOptions(retryOptions); | ||
return (yield retry_1.retryAsync(fn, options)); | ||
return (yield (0, retry_1.retryAsync)(fn, options)); | ||
}); | ||
} | ||
exports.retryAsyncUntilDefined = retryAsyncUntilDefined; |
@@ -17,5 +17,5 @@ "use strict"; | ||
const wrappedFn = () => __awaiter(this, void 0, void 0, function* () { return yield fn(...args); }); | ||
return yield retry_1.retryAsyncUntilResponse(wrappedFn, retryOptions); | ||
return yield (0, retry_1.retryAsyncUntilResponse)(wrappedFn, retryOptions); | ||
}); | ||
} | ||
exports.retryAsyncUntilResponseDecorator = retryAsyncUntilResponseDecorator; |
@@ -16,9 +16,9 @@ "use strict"; | ||
const until = (lastResult) => lastResult.ok; | ||
const getOptions = options_1.retryUntilOptionsToRetryOptionsHof(until); | ||
const getOptions = (0, options_1.retryUntilOptionsToRetryOptionsHof)(until); | ||
function retryAsyncUntilResponse(fn, retryOptions) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const options = getOptions(retryOptions); | ||
return yield retry_1.retryAsync(fn, options); | ||
return yield (0, retry_1.retryAsync)(fn, options); | ||
}); | ||
} | ||
exports.retryAsyncUntilResponse = retryAsyncUntilResponse; |
@@ -17,3 +17,3 @@ "use strict"; | ||
const wrappedFn = () => fn(...args); | ||
return yield retry_1.retryUntilTruthy(wrappedFn, retryOptions); | ||
return yield (0, retry_1.retryUntilTruthy)(wrappedFn, retryOptions); | ||
}); | ||
@@ -25,5 +25,5 @@ } | ||
const wrappedFn = () => __awaiter(this, void 0, void 0, function* () { return yield fn(...args); }); | ||
return yield retry_1.retryAsyncUntilTruthy(wrappedFn, retryOptions); | ||
return yield (0, retry_1.retryAsyncUntilTruthy)(wrappedFn, retryOptions); | ||
}); | ||
} | ||
exports.retryAsyncUntilTruthyDecorator = retryAsyncUntilTruthyDecorator; |
@@ -18,7 +18,7 @@ "use strict"; | ||
lastResult == true; | ||
const getOptions = options_1.retryUntilOptionsToRetryOptionsHof(until); | ||
const getOptions = (0, options_1.retryUntilOptionsToRetryOptionsHof)(until); | ||
function retryUntilTruthy(fn, retryOptions) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const options = getOptions(retryOptions); | ||
return yield __1.retry(fn, options); | ||
return yield (0, __1.retry)(fn, options); | ||
}); | ||
@@ -30,5 +30,5 @@ } | ||
const options = getOptions(retryOptions); | ||
return yield __1.retryAsync(fn, options); | ||
return yield (0, __1.retryAsync)(fn, options); | ||
}); | ||
} | ||
exports.retryAsyncUntilTruthy = retryAsyncUntilTruthy; |
@@ -8,3 +8,3 @@ "use strict"; | ||
const wrappedFn = () => fn(...args); | ||
return wait_1.waitUntilAsync(wrappedFn, duration, error); | ||
return (0, wait_1.waitUntilAsync)(wrappedFn, duration, error); | ||
}; | ||
@@ -22,5 +22,5 @@ } | ||
const wrappedFn = () => fn(...args); | ||
return wait_1.waitUntil(wrappedFn, duration, error); | ||
return (0, wait_1.waitUntil)(wrappedFn, duration, error); | ||
}; | ||
} | ||
exports.waitUntilDecorator = waitUntilDecorator; |
@@ -21,3 +21,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fnAsync = misc_1.asyncDecorator(fn); | ||
const fnAsync = (0, misc_1.asyncDecorator)(fn); | ||
return yield waitUntilAsync(fnAsync, duration, error); | ||
@@ -24,0 +24,0 @@ }); |
@@ -5,2 +5,2 @@ export declare class TooManyTries extends Error { | ||
} | ||
export declare function isTooManyTries(error: Error): error is TooManyTries; | ||
export declare function isTooManyTries(error: unknown): error is TooManyTries; |
{ | ||
"name": "ts-retry", | ||
"version": "2.3.5", | ||
"version": "2.3.6", | ||
"main": "lib/cjs/index.js", | ||
@@ -12,18 +12,18 @@ "module": "lib/esm/index.js", | ||
"devDependencies": { | ||
"@types/chai": "4.2.21", | ||
"@types/chai": "4.2.22", | ||
"@types/mocha": "9.0.0", | ||
"@types/node": "16.7.1", | ||
"@types/sinon": "10.0.2", | ||
"@types/node": "16.10.2", | ||
"@types/sinon": "10.0.4", | ||
"@types/sinon-chai": "3.2.5", | ||
"chai": "^4.2.0", | ||
"cross-env": "7.0.3", | ||
"mocha": "9.1.0", | ||
"mocha": "9.1.2", | ||
"nyc": "^15.1.0", | ||
"rimraf": "3.0.2", | ||
"sinon": "10.0.0", | ||
"sinon": "11.1.2", | ||
"sinon-chai": "3.7.0", | ||
"ts-mocha": "8.0.0", | ||
"ts-node": "10.2.1", | ||
"typescript": "4.3.5", | ||
"yarn": "1.22.11" | ||
"typescript": "4.4.3", | ||
"yarn": "1.22.13" | ||
}, | ||
@@ -30,0 +30,0 @@ "files": [ |
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
74403