@supercharge/promise-pool
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -1,2 +0,2 @@ | ||
export declare class PromisePoolError<T> extends Error { | ||
export declare class PromisePoolError<T, E = any> extends Error { | ||
/** | ||
@@ -6,2 +6,3 @@ * Returns the item that caused this error. | ||
item: T; | ||
raw: E; | ||
/** | ||
@@ -13,3 +14,3 @@ * Create a new instance for the given `message` and `item`. | ||
*/ | ||
constructor(error: any, item: T); | ||
constructor(error: E, item: T); | ||
/** | ||
@@ -23,3 +24,3 @@ * Returns a new promise pool error instance wrapping the `error` and `item`. | ||
*/ | ||
static createFrom<T>(error: any, item: T): PromisePoolError<T>; | ||
static createFrom<T, E = any>(error: E, item: T): PromisePoolError<T>; | ||
/** | ||
@@ -26,0 +27,0 @@ * Returns the error message from the given `error`. |
@@ -13,2 +13,3 @@ 'use strict'; | ||
super(); | ||
this.raw = error; | ||
this.item = item; | ||
@@ -15,0 +16,0 @@ this.name = this.constructor.name; |
@@ -70,3 +70,3 @@ import { ReturnValue } from './return-value'; | ||
*/ | ||
process<R>(callback: ProcessHandler<T, R>): Promise<ReturnValue<T, R>>; | ||
process<ResultType, ErrorType = any>(callback: ProcessHandler<T, ResultType>): Promise<ReturnValue<T, ResultType, ErrorType>>; | ||
} |
import { PromisePoolError } from './promise-pool-error'; | ||
export interface ReturnValue<T, R> { | ||
export interface ReturnValue<T, R, E = any> { | ||
/** | ||
* The list of processed items. | ||
* The list of results returned by the processing function. | ||
*/ | ||
@@ -12,3 +12,3 @@ results: R[]; | ||
*/ | ||
errors: Array<PromisePoolError<T>>; | ||
errors: Array<PromisePoolError<T, E>>; | ||
} |
{ | ||
"name": "@supercharge/promise-pool", | ||
"description": "Map-like, concurrent promise processing for Node.js", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Marcus Pöhls <marcus@superchargejs.com>", | ||
@@ -12,10 +12,10 @@ "bugs": { | ||
"@supercharge/tsconfig": "~1.0.0", | ||
"@typescript-eslint/eslint-plugin": "~4.31.2", | ||
"@typescript-eslint/eslint-plugin": "~4.33.0", | ||
"c8": "~7.10.0", | ||
"eslint": "~7.32.0", | ||
"eslint-config-standard-with-typescript": "~21.0.1", | ||
"eslint-plugin-import": "~2.25.2", | ||
"eslint-plugin-import": "~2.25.3", | ||
"eslint-plugin-node": "~11.1.0", | ||
"eslint-plugin-promise": "~5.1.1", | ||
"expect": "~27.3.1", | ||
"eslint-plugin-promise": "~5.2.0", | ||
"expect": "~27.4.2", | ||
"typescript": "~4.4.4", | ||
@@ -22,0 +22,0 @@ "uvu": "~0.5.2" |
31223
854