@collabland/common
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [0.8.0](https://github.com/abridged/collabland-monorepo/compare/@collabland/common@0.7.0...@collabland/common@0.8.0) (2021-03-30) | ||
### Features | ||
* re-enable kchannel readiness check ([c300614](https://github.com/abridged/collabland-monorepo/commit/c3006146b39ea42aed954052228383ca1d93497e)) | ||
# [0.7.0](https://github.com/abridged/collabland-monorepo/compare/@collabland/common@0.6.0...@collabland/common@0.7.0) (2021-03-16) | ||
@@ -8,0 +19,0 @@ |
{ | ||
"name": "@collabland/common", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "CollabLand common utilities", | ||
@@ -47,12 +47,11 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@loopback/build": "^6.2.9", | ||
"@loopback/eslint-config": "^10.0.5", | ||
"@loopback/testlab": "^3.2.12", | ||
"@types/node": "^12.19.14", | ||
"@loopback/build": "^6.3.0", | ||
"@loopback/eslint-config": "^10.1.0", | ||
"@loopback/testlab": "^3.3.0", | ||
"@types/node": "^10.17.55", | ||
"source-map-support": "^0.5.19", | ||
"typescript": "^4.1.4" | ||
"typescript": "~4.2.3" | ||
}, | ||
"copyright.owner": "Abridged, Inc.", | ||
"author": "Abridged, Inc.", | ||
"gitHead": "11b009fdc594d9dfd365b2cb81e6264ef59c3f52" | ||
"author": "Abridged, Inc." | ||
} |
@@ -57,5 +57,5 @@ // Copyright Abridged, Inc. 2021. All Rights Reserved. | ||
*/ | ||
export type RetryOptions = { | ||
export type RetryOptions<T = unknown> = { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
shouldRetry?: (err: any) => boolean; | ||
shouldRetry?: (err?: any, data?: T) => boolean; | ||
waitInMs?: number | ((retries: number) => number); | ||
@@ -72,5 +72,5 @@ maxRetries?: number; | ||
fn: () => Promise<T>, | ||
options?: RetryOptions, | ||
options?: RetryOptions<T>, | ||
) { | ||
const shouldRetry = options?.shouldRetry ?? (() => true); | ||
const shouldRetry = options?.shouldRetry ?? ((err, data) => err != null); | ||
const waitInMs = options?.waitInMs ?? exponentialBackoff(50); | ||
@@ -83,3 +83,6 @@ const maxRetries = options?.maxRetries ?? 5; | ||
const result = await fn(); | ||
return result; | ||
if (!shouldRetry(undefined, result)) { | ||
return result; | ||
} | ||
// Let's retry | ||
} catch (err) { | ||
@@ -86,0 +89,0 @@ if (retries >= maxRetries) { |
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
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 5 instances in 1 package
0
0
23108
14
573