Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@types/async-retry
Advanced tools
TypeScript definitions for async-retry
npm install --save @types/async-retry
This package contains type definitions for async-retry (https://github.com/vercel/async-retry).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async-retry.
import { WrapOptions } from "retry";
/**
* Retrying made simple, easy, and async.
*
* @example
* import retry = require('async-retry');
* import fetch from 'node-fetch';
*
* await retry(
* async (bail) => {
* // if anything throws, we retry
* const res = await fetch('https://google.com');
*
* if (403 === res.status) {
* // don't retry upon 403
* bail(new Error('Unauthorized'));
* return;
* }
*
* const data = await res.text();
* return data.substr(0, 500);
* },
* {
* retries: 5,
* }
* );
*/
declare function AsyncRetry<TRet, TErr = unknown>(
fn: AsyncRetry.RetryFunction<TRet, TErr>,
opts?: AsyncRetry.Options<TErr> | number[],
): Promise<TRet>;
declare namespace AsyncRetry {
interface Options<TErr = unknown> extends Omit<WrapOptions, "randomize"> {
/**
* An optional function that is invoked after a new retry is performed. It's passed the
* `Error` that triggered it as a parameter.
*/
onRetry?: ((e: TErr, attempt: number) => any) | undefined;
/**
* Randomizes the timeouts by multiplying a factor between 1-2.
* @default true
*/
randomize?: boolean | undefined;
}
/**
* @param bail A function you can invoke to abort the retrying (bail).
* @param attempt The attempt number. The absolute first attempt (before any retries) is `1`.
*/
type RetryFunction<TRet, TErr = unknown> = (bail: (e: TErr) => void, attempt: number) => TRet | Promise<TRet>;
}
export = AsyncRetry;
These definitions were written by Albert Wu, Pablo Rodríguez, Rafał Sawicki, and BendingBender.
FAQs
TypeScript definitions for async-retry
The npm package @types/async-retry receives a total of 963,561 weekly downloads. As such, @types/async-retry popularity was classified as popular.
We found that @types/async-retry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.