@types/better-queue
Advanced tools
Comparing version 3.8.3 to 3.8.4
@@ -14,128 +14,128 @@ // Type definitions for better-queue 3.8 | ||
import { EventEmitter } from 'events'; | ||
import { EventEmitter } from "events"; | ||
declare class BetterQueue<T = any, K = any> extends EventEmitter { | ||
constructor(options: BetterQueue.QueueOptions<T, K>); | ||
constructor(process: BetterQueue.ProcessFunction<T, K>, options?: Partial<BetterQueue.QueueOptions<T, K>>); | ||
constructor(options: BetterQueue.QueueOptions<T, K>); | ||
constructor(process: BetterQueue.ProcessFunction<T, K>, options?: Partial<BetterQueue.QueueOptions<T, K>>); | ||
push(task: T, cb?: (err: any, result: K) => void): BetterQueue.Ticket; | ||
push(task: T, cb?: (err: any, result: K) => void): BetterQueue.Ticket; | ||
cancel(taskId: any, cb?: () => void): void; | ||
cancel(taskId: any, cb?: () => void): void; | ||
pause(): void; | ||
pause(): void; | ||
resume(): void; | ||
resume(): void; | ||
destroy(cb: () => void): void; | ||
destroy(cb: () => void): void; | ||
use(store: BetterQueue.Store<T>): void; | ||
use(store: BetterQueue.Store<T>): void; | ||
getStats(): BetterQueue.QueueStats; | ||
getStats(): BetterQueue.QueueStats; | ||
resetStats(): void; | ||
resetStats(): void; | ||
on(event: 'task_finish', listener: (taskId: any, result: K) => void): this; | ||
on(event: 'task_failed', listener: (taskId: any, errorMessage: string) => void): this; | ||
on(event: 'task_progress', listener: (taskId: any, completed: number, total: number) => void): this; | ||
on(event: BetterQueue.QueueEvent, listener: (...args: any[]) => void): this; | ||
on(event: "task_finish", listener: (taskId: any, result: K) => void): this; | ||
on(event: "task_failed", listener: (taskId: any, errorMessage: string) => void): this; | ||
on(event: "task_progress", listener: (taskId: any, completed: number, total: number) => void): this; | ||
on(event: BetterQueue.QueueEvent, listener: (...args: any[]) => void): this; | ||
} | ||
declare namespace BetterQueue { | ||
interface QueueOptions<T, K> { | ||
process: ProcessFunction<T, K>; | ||
filter?(task: T, cb: (error: any, task: T) => void): void; | ||
merge?(oldTask: T, newTask: T, cb: (error: any, mergedTask: T) => void): void; | ||
priority?(task: T, cb: (error: any, priority: number) => void): void; | ||
precondition?(cb: (error: any, passOrFail: boolean) => void): void; | ||
id?: keyof T | ((task: T, cb: (error: any, id: keyof T) => void) => void) | undefined; | ||
cancelIfRunning?: boolean | undefined; | ||
autoResume?: boolean | undefined; | ||
failTaskOnProcessException?: boolean | undefined; | ||
filo?: boolean | undefined; | ||
batchSize?: number | undefined; | ||
batchDelay?: number | undefined; | ||
batchDelayTimeout?: number | undefined; | ||
concurrent?: number | undefined; | ||
maxTimeout?: number | undefined; | ||
afterProcessDelay?: number | undefined; | ||
maxRetries?: number | undefined; | ||
retryDelay?: number | undefined; | ||
storeMaxRetries?: number | undefined; | ||
storeRetryTimeout?: number | undefined; | ||
preconditionRetryTimeout?: number | undefined; | ||
store?: string | StoreOptions | Store<T> | undefined; | ||
} | ||
interface QueueOptions<T, K> { | ||
process: ProcessFunction<T, K>; | ||
filter?(task: T, cb: (error: any, task: T) => void): void; | ||
merge?(oldTask: T, newTask: T, cb: (error: any, mergedTask: T) => void): void; | ||
priority?(task: T, cb: (error: any, priority: number) => void): void; | ||
precondition?(cb: (error: any, passOrFail: boolean) => void): void; | ||
id?: keyof T | ((task: T, cb: (error: any, id: keyof T) => void) => void) | undefined; | ||
cancelIfRunning?: boolean | undefined; | ||
autoResume?: boolean | undefined; | ||
failTaskOnProcessException?: boolean | undefined; | ||
filo?: boolean | undefined; | ||
batchSize?: number | undefined; | ||
batchDelay?: number | undefined; | ||
batchDelayTimeout?: number | undefined; | ||
concurrent?: number | undefined; | ||
maxTimeout?: number | undefined; | ||
afterProcessDelay?: number | undefined; | ||
maxRetries?: number | undefined; | ||
retryDelay?: number | undefined; | ||
storeMaxRetries?: number | undefined; | ||
storeRetryTimeout?: number | undefined; | ||
preconditionRetryTimeout?: number | undefined; | ||
store?: string | StoreOptions | Store<T> | undefined; | ||
} | ||
// TODO reflect task types somehow (task: T | T[]) | ||
type ProcessFunction<T, K> = (task: any, cb: ProcessFunctionCb<K>) => void; | ||
// TODO reflect task types somehow (task: T | T[]) | ||
type ProcessFunction<T, K> = (task: any, cb: ProcessFunctionCb<K>) => void; | ||
type ProcessFunctionCb<K> = (error?: any, result?: K) => void; | ||
type ProcessFunctionCb<K> = (error?: any, result?: K) => void; | ||
type QueueEvent = | ||
'task_queued' | ||
| 'task_accepted' | ||
| 'task_started' | ||
| 'task_finish' | ||
| 'task_failed' | ||
| 'task_progress' | ||
| 'batch_finish' | ||
| 'batch_failed' | ||
| 'batch_progress' | ||
| 'drain' | ||
| 'empty' | ||
| 'error'; | ||
type QueueEvent = | ||
| "task_queued" | ||
| "task_accepted" | ||
| "task_started" | ||
| "task_finish" | ||
| "task_failed" | ||
| "task_progress" | ||
| "batch_finish" | ||
| "batch_failed" | ||
| "batch_progress" | ||
| "drain" | ||
| "empty" | ||
| "error"; | ||
type TicketEvent = | ||
'accept' | ||
| 'queued' | ||
| 'started' | ||
| 'progress' | ||
| 'finish' | ||
| 'failed' | ||
| 'error'; | ||
type TicketEvent = | ||
| "accept" | ||
| "queued" | ||
| "started" | ||
| "progress" | ||
| "finish" | ||
| "failed" | ||
| "error"; | ||
interface Store<T> { | ||
connect(cb: (error: any, length: number) => void): void; | ||
interface Store<T> { | ||
connect(cb: (error: any, length: number) => void): void; | ||
getTask(taskId: any, cb: (error: any, task: T) => void): void; | ||
getTask(taskId: any, cb: (error: any, task: T) => void): void; | ||
deleteTask(taskId: any, cb: () => void): void; | ||
deleteTask(taskId: any, cb: () => void): void; | ||
putTask(taskId: any, task: T, priority: number, cb: (error: any) => void): void; | ||
putTask(taskId: any, task: T, priority: number, cb: (error: any) => void): void; | ||
takeFirstN(n: number, cb: (error: any, lockId: string) => void): void; | ||
takeFirstN(n: number, cb: (error: any, lockId: string) => void): void; | ||
takeLastN(n: number, cb: (error: any, lockId: string) => void): void; | ||
takeLastN(n: number, cb: (error: any, lockId: string) => void): void; | ||
getLock(lockId: string, cb: (error: any, tasks: { [taskId: string]: T }) => void): void; | ||
getLock(lockId: string, cb: (error: any, tasks: { [taskId: string]: T }) => void): void; | ||
releaseLock(lockId: string, cb: (error: any) => void): void; | ||
} | ||
releaseLock(lockId: string, cb: (error: any) => void): void; | ||
} | ||
interface StoreOptions { | ||
type: string; | ||
// store-specific options | ||
[key: string]: any; | ||
} | ||
interface StoreOptions { | ||
type: string; | ||
// store-specific options | ||
[key: string]: any; | ||
} | ||
class Ticket extends EventEmitter { | ||
on(event: TicketEvent, listener: (...args: any[]) => void): this; | ||
} | ||
class Ticket extends EventEmitter { | ||
on(event: TicketEvent, listener: (...args: any[]) => void): this; | ||
} | ||
interface TickerProgress { | ||
eta: string; | ||
pct: number; | ||
complete: number; | ||
total: number; | ||
message: string; | ||
} | ||
interface TickerProgress { | ||
eta: string; | ||
pct: number; | ||
complete: number; | ||
total: number; | ||
message: string; | ||
} | ||
interface QueueStats { | ||
total: number; | ||
average: number; | ||
successRate: number; | ||
peak: number; | ||
} | ||
interface QueueStats { | ||
total: number; | ||
average: number; | ||
successRate: number; | ||
peak: number; | ||
} | ||
} | ||
export = BetterQueue; |
{ | ||
"name": "@types/better-queue", | ||
"version": "3.8.3", | ||
"version": "3.8.4", | ||
"description": "TypeScript definitions for better-queue", | ||
@@ -25,4 +25,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/better-queue", | ||
}, | ||
"typesPublisherContentHash": "5ab905da1d24283b04e3af8edc29dc707a8ba016956263f8eedc62023a0a9aac", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "2405098ee941ef17019dc097a019b96f5fb507d295a7ecb9a339590b6ff455c9", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Wed, 07 Jul 2021 21:44:55 GMT | ||
* Last updated: Fri, 15 Sep 2023 19:06:48 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -14,0 +14,0 @@ * Global values: none |
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
7080