Initial commit of working RSS Aggregator build
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
import { BackoffStrategy, RepeatStrategy } from '../types';
|
||||
export interface AdvancedRepeatOptions {
|
||||
/**
|
||||
* A custom cron strategy.
|
||||
*/
|
||||
repeatStrategy?: RepeatStrategy;
|
||||
/**
|
||||
* A hash algorithm to be used when trying to create the job redis key.
|
||||
* Default - md5
|
||||
*/
|
||||
repeatKeyHashAlgorithm?: string;
|
||||
}
|
||||
export interface AdvancedOptions extends AdvancedRepeatOptions {
|
||||
/**
|
||||
* A custom backoff strategy.
|
||||
*/
|
||||
backoffStrategy?: BackoffStrategy;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=advanced-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"advanced-options.js","sourceRoot":"","sources":["../../../src/interfaces/advanced-options.ts"],"names":[],"mappings":""}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Settings for backing off failed jobs.
|
||||
*
|
||||
* @see {@link https://docs.bullmq.io/guide/retrying-failing-jobs}
|
||||
*/
|
||||
export interface BackoffOptions {
|
||||
/**
|
||||
* Name of the backoff strategy.
|
||||
*/
|
||||
type: 'fixed' | 'exponential' | (string & {});
|
||||
/**
|
||||
* Delay in milliseconds.
|
||||
*/
|
||||
delay?: number;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=backoff-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"backoff-options.js","sourceRoot":"","sources":["../../../src/interfaces/backoff-options.ts"],"names":[],"mappings":""}
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
import { RepeatOptions, KeepJobs, BackoffOptions } from './';
|
||||
export interface DefaultJobOptions {
|
||||
/**
|
||||
* Timestamp when the job was created.
|
||||
* @defaultValue Date.now()
|
||||
*/
|
||||
timestamp?: number;
|
||||
/**
|
||||
* Ranges from 1 (highest priority) to 2 097 152 (lowest priority). Note that
|
||||
* using priorities has a slight impact on performance,
|
||||
* so do not use it if not required.
|
||||
*/
|
||||
priority?: number;
|
||||
/**
|
||||
* An amount of milliseconds to wait until this job can be processed.
|
||||
* Note that for accurate delays, worker and producers
|
||||
* should have their clocks synchronized.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
delay?: number;
|
||||
/**
|
||||
* The total number of attempts to try the job until it completes.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
attempts?: number;
|
||||
/**
|
||||
* Backoff setting for automatic retries if the job fails
|
||||
*/
|
||||
backoff?: number | BackoffOptions;
|
||||
/**
|
||||
* If true, adds the job to the right of the queue instead of the left (default false)
|
||||
*
|
||||
* @see {@link https://docs.bullmq.io/guide/jobs/lifo}
|
||||
*/
|
||||
lifo?: boolean;
|
||||
/**
|
||||
* If true, removes the job when it successfully completes
|
||||
* When given a number, it specifies the maximum amount of
|
||||
* jobs to keep, or you can provide an object specifying max
|
||||
* age and/or count to keep. It overrides whatever setting is used in the worker.
|
||||
* Default behavior is to keep the job in the completed set.
|
||||
*/
|
||||
removeOnComplete?: boolean | number | KeepJobs;
|
||||
/**
|
||||
* If true, removes the job when it fails after all attempts.
|
||||
* When given a number, it specifies the maximum amount of
|
||||
* jobs to keep, or you can provide an object specifying max
|
||||
* age and/or count to keep. It overrides whatever setting is used in the worker.
|
||||
* Default behavior is to keep the job in the failed set.
|
||||
*/
|
||||
removeOnFail?: boolean | number | KeepJobs;
|
||||
/**
|
||||
* Maximum amount of log entries that will be preserved
|
||||
*/
|
||||
keepLogs?: number;
|
||||
/**
|
||||
* Limits the amount of stack trace lines that will be recorded in the stacktrace.
|
||||
*/
|
||||
stackTraceLimit?: number;
|
||||
/**
|
||||
* Limits the size in bytes of the job's data payload (as a JSON serialized string).
|
||||
*/
|
||||
sizeLimit?: number;
|
||||
}
|
||||
export interface BaseJobOptions extends DefaultJobOptions {
|
||||
/**
|
||||
* Repeat this job, for example based on a `cron` schedule.
|
||||
*/
|
||||
repeat?: RepeatOptions;
|
||||
/**
|
||||
* Internal property used by repeatable jobs to save base repeat job key.
|
||||
*/
|
||||
repeatJobKey?: string;
|
||||
/**
|
||||
* Override the job ID - by default, the job ID is a unique
|
||||
* integer, but you can use this setting to override it.
|
||||
* If you use this option, it is up to you to ensure the
|
||||
* jobId is unique. If you attempt to add a job with an id that
|
||||
* already exists, it will not be added.
|
||||
*/
|
||||
jobId?: string;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
parent?: {
|
||||
id: string;
|
||||
/**
|
||||
* It includes the prefix, the namespace separator :, and queue name.
|
||||
* @see https://www.gnu.org/software/gawk/manual/html_node/Qualified-Names.html
|
||||
*/
|
||||
queue: string;
|
||||
};
|
||||
/**
|
||||
* Internal property used by repeatable jobs.
|
||||
*/
|
||||
prevMillis?: number;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=base-job-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"base-job-options.js","sourceRoot":"","sources":["../../../src/interfaces/base-job-options.ts"],"names":[],"mappings":""}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
import { ParentCommand } from '../enums/parent-command';
|
||||
export interface ChildMessage {
|
||||
cmd: ParentCommand;
|
||||
value?: any;
|
||||
err?: Record<string, any>;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=child-message.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"child-message.js","sourceRoot":"","sources":["../../../src/interfaces/child-message.ts"],"names":[],"mappings":""}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
import { Cluster, Redis } from 'ioredis';
|
||||
export type RedisClient = Redis | Cluster;
|
||||
export interface IConnection extends EventEmitter {
|
||||
waitUntilReady(): Promise<boolean>;
|
||||
client: Promise<RedisClient>;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=connection.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../src/interfaces/connection.ts"],"names":[],"mappings":""}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
import { JobsOptions } from '../types';
|
||||
import { QueueOptions } from './queue-options';
|
||||
export interface FlowJobBase<T> {
|
||||
name: string;
|
||||
queueName: string;
|
||||
data?: any;
|
||||
prefix?: string;
|
||||
opts?: Omit<T, 'repeat'>;
|
||||
children?: FlowChildJob[];
|
||||
}
|
||||
export type FlowChildJob = FlowJobBase<Omit<JobsOptions, 'parent'>>;
|
||||
export type FlowJob = FlowJobBase<JobsOptions>;
|
||||
export type FlowQueuesOpts = Record<string, Omit<QueueOptions, 'connection' | 'prefix'>>;
|
||||
export interface FlowOpts {
|
||||
/**
|
||||
* Map of options for Queue classes.
|
||||
*/
|
||||
queuesOptions: FlowQueuesOpts;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=flow-job.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"flow-job.js","sourceRoot":"","sources":["../../../src/interfaces/flow-job.ts"],"names":[],"mappings":""}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
export * from './advanced-options';
|
||||
export * from './backoff-options';
|
||||
export * from './base-job-options';
|
||||
export * from './child-message';
|
||||
export * from './connection';
|
||||
export * from './flow-job';
|
||||
export * from './ioredis-events';
|
||||
export * from './job-json';
|
||||
export * from './keep-jobs';
|
||||
export * from './metrics-options';
|
||||
export * from './metrics';
|
||||
export * from './minimal-job';
|
||||
export * from './parent-message';
|
||||
export * from './parent';
|
||||
export * from './queue-options';
|
||||
export * from './rate-limiter-options';
|
||||
export * from './redis-options';
|
||||
export * from './redis-streams';
|
||||
export * from './repeatable-job';
|
||||
export * from './repeat-options';
|
||||
export * from './sandboxed-job-processor';
|
||||
export * from './sandboxed-job';
|
||||
export * from './worker-options';
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
export * from './advanced-options';
|
||||
export * from './backoff-options';
|
||||
export * from './base-job-options';
|
||||
export * from './child-message';
|
||||
export * from './connection';
|
||||
export * from './flow-job';
|
||||
export * from './ioredis-events';
|
||||
export * from './job-json';
|
||||
export * from './keep-jobs';
|
||||
export * from './metrics-options';
|
||||
export * from './metrics';
|
||||
export * from './minimal-job';
|
||||
export * from './parent-message';
|
||||
export * from './parent';
|
||||
export * from './queue-options';
|
||||
export * from './rate-limiter-options';
|
||||
export * from './redis-options';
|
||||
export * from './redis-streams';
|
||||
export * from './repeatable-job';
|
||||
export * from './repeat-options';
|
||||
export * from './sandboxed-job-processor';
|
||||
export * from './sandboxed-job';
|
||||
export * from './worker-options';
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export interface IoredisListener {
|
||||
/**
|
||||
* Listen to 'ioredis:close' event.
|
||||
*
|
||||
* This event is triggered when ioredis is closed.
|
||||
*/
|
||||
'ioredis:close': () => void;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=ioredis-events.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ioredis-events.js","sourceRoot":"","sources":["../../../src/interfaces/ioredis-events.ts"],"names":[],"mappings":""}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
import { RedisJobOptions } from '../types';
|
||||
import { ParentKeys } from './parent';
|
||||
export interface JobJson {
|
||||
id: string;
|
||||
name: string;
|
||||
data: string;
|
||||
opts: RedisJobOptions;
|
||||
progress: number | object;
|
||||
attemptsMade: number;
|
||||
finishedOn?: number;
|
||||
processedOn?: number;
|
||||
timestamp: number;
|
||||
failedReason: string;
|
||||
stacktrace: string;
|
||||
returnvalue: string;
|
||||
parent?: ParentKeys;
|
||||
parentKey?: string;
|
||||
repeatJobKey?: string;
|
||||
}
|
||||
export interface JobJsonRaw {
|
||||
id: string;
|
||||
name: string;
|
||||
data: string;
|
||||
delay: string;
|
||||
opts: string;
|
||||
progress: string;
|
||||
attemptsMade: string;
|
||||
finishedOn?: string;
|
||||
processedOn?: string;
|
||||
timestamp: string;
|
||||
failedReason: string;
|
||||
stacktrace: string[];
|
||||
returnvalue: string;
|
||||
parentKey?: string;
|
||||
parent?: string;
|
||||
rjk?: string;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=job-json.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"job-json.js","sourceRoot":"","sources":["../../../src/interfaces/job-json.ts"],"names":[],"mappings":""}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* KeepJobs
|
||||
*
|
||||
* Specify which jobs to keep after finishing. If both age and count are
|
||||
* specified, then the jobs kept will be the ones that satisfies both
|
||||
* properties.
|
||||
*/
|
||||
export interface KeepJobs {
|
||||
/**
|
||||
* Maximum age in seconds for job to be kept.
|
||||
*/
|
||||
age?: number;
|
||||
/**
|
||||
* Maximum count of jobs to be kept.
|
||||
*/
|
||||
count?: number;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=keep-jobs.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"keep-jobs.js","sourceRoot":"","sources":["../../../src/interfaces/keep-jobs.ts"],"names":[],"mappings":""}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
export interface MetricsOptions {
|
||||
/**
|
||||
* Enable gathering metrics for finished jobs.
|
||||
* Output refers to all finished jobs, completed or
|
||||
* failed.
|
||||
*/
|
||||
maxDataPoints?: number;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=metrics-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"metrics-options.js","sourceRoot":"","sources":["../../../src/interfaces/metrics-options.ts"],"names":[],"mappings":""}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
export interface Metrics {
|
||||
meta: {
|
||||
count: number;
|
||||
prevTS: number;
|
||||
prevCount: number;
|
||||
};
|
||||
data: number[];
|
||||
count: number;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=metrics.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/interfaces/metrics.ts"],"names":[],"mappings":""}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
import { JobsOptions, JobJsonSandbox } from '../types';
|
||||
import { JobJson } from './job-json';
|
||||
import { ParentKeys } from './parent';
|
||||
export type BulkJobOptions = Omit<JobsOptions, 'repeat'>;
|
||||
export interface MoveToWaitingChildrenOpts {
|
||||
child?: {
|
||||
id: string;
|
||||
queue: string;
|
||||
};
|
||||
}
|
||||
export interface DependenciesOpts {
|
||||
processed?: {
|
||||
cursor?: number;
|
||||
count?: number;
|
||||
};
|
||||
unprocessed?: {
|
||||
cursor?: number;
|
||||
count?: number;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MinimalJob
|
||||
*/
|
||||
export interface MinimalJob<DataType = any, ReturnType = any, NameType extends string = string> {
|
||||
/**
|
||||
* The name of the Job
|
||||
*/
|
||||
name: NameType;
|
||||
/**
|
||||
* The payload for this job.
|
||||
*/
|
||||
data: DataType;
|
||||
/**
|
||||
* The options object for this job.
|
||||
*/
|
||||
opts: JobsOptions;
|
||||
id?: string;
|
||||
/**
|
||||
* The progress a job has performed so far.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
progress: number | object;
|
||||
/**
|
||||
* The value returned by the processor when processing this job.
|
||||
* @defaultValue null
|
||||
*/
|
||||
returnvalue: ReturnType;
|
||||
/**
|
||||
* Stacktrace for the error (for failed jobs).
|
||||
* @defaultValue null
|
||||
*/
|
||||
stacktrace: string[];
|
||||
/**
|
||||
* An amount of milliseconds to wait until this job can be processed.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
delay: number;
|
||||
/**
|
||||
* Timestamp when the job was created (unless overridden with job options).
|
||||
*/
|
||||
timestamp: number;
|
||||
/**
|
||||
* Number of attempts after the job has failed.
|
||||
* @defaultValue 0
|
||||
*/
|
||||
attemptsMade: number;
|
||||
/**
|
||||
* Reason for failing.
|
||||
*/
|
||||
failedReason: string;
|
||||
/**
|
||||
* Timestamp for when the job finished (completed or failed).
|
||||
*/
|
||||
finishedOn?: number;
|
||||
/**
|
||||
* Timestamp for when the job was processed.
|
||||
*/
|
||||
processedOn?: number;
|
||||
/**
|
||||
* Fully qualified key (including the queue prefix) pointing to the parent of this job.
|
||||
*/
|
||||
parentKey?: string;
|
||||
/**
|
||||
* Object that contains parentId (id) and parent queueKey.
|
||||
*/
|
||||
parent?: ParentKeys;
|
||||
/**
|
||||
* Base repeat job key.
|
||||
*/
|
||||
repeatJobKey?: string;
|
||||
/**
|
||||
* Prepares a job to be serialized for storage in Redis.
|
||||
* @returns
|
||||
*/
|
||||
asJSON(): JobJson;
|
||||
/**
|
||||
* Prepares a job to be passed to Sandbox.
|
||||
* @returns
|
||||
*/
|
||||
asJSONSandbox(): JobJsonSandbox;
|
||||
/**
|
||||
* Updates a job's data
|
||||
*
|
||||
* @param data - the data that will replace the current jobs data.
|
||||
*/
|
||||
updateData(data: DataType): Promise<void>;
|
||||
/**
|
||||
* Updates a job's progress
|
||||
*
|
||||
* @param progress - number or object to be saved as progress.
|
||||
*/
|
||||
updateProgress(progress: number | object): Promise<void>;
|
||||
/**
|
||||
* Logs one row of log data.
|
||||
*
|
||||
* @param logRow - string with log data to be logged.
|
||||
*/
|
||||
log(logRow: string): Promise<number>;
|
||||
get queueName(): string;
|
||||
/**
|
||||
* @returns the prefix that is used.
|
||||
*/
|
||||
get prefix(): string;
|
||||
/**
|
||||
* @returns it includes the prefix, the namespace separator :, and queue name.
|
||||
* @see https://www.gnu.org/software/gawk/manual/html_node/Qualified-Names.html
|
||||
*/
|
||||
get queueQualifiedName(): string;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=minimal-job.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"minimal-job.js","sourceRoot":"","sources":["../../../src/interfaces/minimal-job.ts"],"names":[],"mappings":""}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import { ChildCommand } from '../enums/child-command';
|
||||
import { JobJson } from './job-json';
|
||||
export interface ParentMessage {
|
||||
cmd: ChildCommand;
|
||||
value?: any;
|
||||
err?: Error;
|
||||
job?: JobJson;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=parent-message.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parent-message.js","sourceRoot":"","sources":["../../../src/interfaces/parent-message.ts"],"names":[],"mappings":""}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { JobsOptions } from '../types';
|
||||
/**
|
||||
* Describes the parent for a Job.
|
||||
*/
|
||||
export interface Parent<T> {
|
||||
name: string;
|
||||
prefix?: string;
|
||||
queue?: string;
|
||||
data?: T;
|
||||
opts?: JobsOptions;
|
||||
}
|
||||
export interface ParentKeys {
|
||||
id: string;
|
||||
queueKey: string;
|
||||
}
|
||||
export type ParentOpts = {
|
||||
waitChildrenKey?: string;
|
||||
parentDependenciesKey?: string;
|
||||
parentKey?: string;
|
||||
};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=parent.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parent.js","sourceRoot":"","sources":["../../../src/interfaces/parent.ts"],"names":[],"mappings":""}
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
import { AdvancedRepeatOptions } from './advanced-options';
|
||||
import { DefaultJobOptions } from './base-job-options';
|
||||
import { ConnectionOptions } from './redis-options';
|
||||
export declare enum ClientType {
|
||||
blocking = "blocking",
|
||||
normal = "normal"
|
||||
}
|
||||
/**
|
||||
* Base Queue options
|
||||
*/
|
||||
export interface QueueBaseOptions {
|
||||
/**
|
||||
* Options for connecting to a Redis instance.
|
||||
*/
|
||||
connection?: ConnectionOptions;
|
||||
/**
|
||||
* Denotes commands should retry indefinitely.
|
||||
*/
|
||||
blockingConnection?: boolean;
|
||||
/**
|
||||
* Prefix for all queue keys.
|
||||
*/
|
||||
prefix?: string;
|
||||
/**
|
||||
* Avoid version validation to be greater or equal than v5.0.0.
|
||||
* @defaultValue false
|
||||
*/
|
||||
skipVersionCheck?: boolean;
|
||||
}
|
||||
/**
|
||||
* Options for the Queue class.
|
||||
*/
|
||||
export interface QueueOptions extends QueueBaseOptions {
|
||||
defaultJobOptions?: DefaultJobOptions;
|
||||
/**
|
||||
* Options for the streams used internally in BullMQ.
|
||||
*/
|
||||
streams?: {
|
||||
/**
|
||||
* Options for the events stream.
|
||||
*/
|
||||
events: {
|
||||
/**
|
||||
* Max approximated length for streams. Default is 10 000 events.
|
||||
*/
|
||||
maxLen: number;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Skip Meta update.
|
||||
*
|
||||
* If true, the queue will not update the metadata of the queue.
|
||||
* Useful for read-only systems that do should not update the metadata.
|
||||
*
|
||||
* @defaultValue false
|
||||
*/
|
||||
skipMetasUpdate?: boolean;
|
||||
/**
|
||||
* Advanced options for the repeatable jobs.
|
||||
*/
|
||||
settings?: AdvancedRepeatOptions;
|
||||
}
|
||||
/**
|
||||
* Options for the Repeat class.
|
||||
*/
|
||||
export interface RepeatBaseOptions extends QueueBaseOptions {
|
||||
settings?: AdvancedRepeatOptions;
|
||||
}
|
||||
/**
|
||||
* Options for QueueEvents
|
||||
*/
|
||||
export interface QueueEventsOptions extends QueueBaseOptions {
|
||||
/**
|
||||
* Condition to start listening to events at instance creation.
|
||||
*/
|
||||
autorun?: boolean;
|
||||
/**
|
||||
* Last event Id. If provided it is possible to continue
|
||||
* consuming events from a known Id instead of from the last
|
||||
* produced event.
|
||||
*/
|
||||
lastEventId?: string;
|
||||
/**
|
||||
* Timeout for the blocking XREAD call to the events stream.
|
||||
*/
|
||||
blockingTimeout?: number;
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
export var ClientType;
|
||||
(function (ClientType) {
|
||||
ClientType["blocking"] = "blocking";
|
||||
ClientType["normal"] = "normal";
|
||||
})(ClientType || (ClientType = {}));
|
||||
//# sourceMappingURL=queue-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"queue-options.js","sourceRoot":"","sources":["../../../src/interfaces/queue-options.ts"],"names":[],"mappings":"AAIA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,mCAAqB,CAAA;IACrB,+BAAiB,CAAA;AACnB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export interface RateLimiterOptions {
|
||||
/**
|
||||
* Max number of jobs to process in the time period
|
||||
* specified in `duration`.
|
||||
*/
|
||||
max: number;
|
||||
/**
|
||||
* Time in milliseconds. During this time, a maximum
|
||||
* of `max` jobs will be processed.
|
||||
*/
|
||||
duration: number;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=rate-limiter-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"rate-limiter-options.js","sourceRoot":"","sources":["../../../src/interfaces/rate-limiter-options.ts"],"names":[],"mappings":""}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import type * as IORedis from 'ioredis';
|
||||
export interface BaseOptions {
|
||||
skipVersionCheck?: boolean;
|
||||
}
|
||||
export type RedisOptions = IORedis.RedisOptions & BaseOptions;
|
||||
export type ClusterOptions = IORedis.ClusterOptions & BaseOptions;
|
||||
export type ConnectionOptions = RedisOptions | ClusterOptions | IORedis.Redis | IORedis.Cluster;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=redis-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"redis-options.js","sourceRoot":"","sources":["../../../src/interfaces/redis-options.ts"],"names":[],"mappings":""}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export type StreamName = string;
|
||||
export type EntryId = string;
|
||||
export type EntryRaw = [EntryId, string[]];
|
||||
export type StreamReadRaw = [StreamName, EntryRaw[]][] | null | undefined;
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=redis-streams.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"redis-streams.js","sourceRoot":"","sources":["../../../src/interfaces/redis-streams.ts"],"names":[],"mappings":""}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
import { ParserOptions } from 'cron-parser';
|
||||
/**
|
||||
* Settings for repeatable jobs
|
||||
*
|
||||
* @see {@link https://docs.bullmq.io/guide/jobs/repeatable}
|
||||
*/
|
||||
export interface RepeatOptions extends Omit<ParserOptions, 'iterator'> {
|
||||
/**
|
||||
* A repeat pattern
|
||||
*/
|
||||
pattern?: string;
|
||||
/**
|
||||
* Number of times the job should repeat at max.
|
||||
*/
|
||||
limit?: number;
|
||||
/**
|
||||
* Repeat after this amount of milliseconds
|
||||
* (`pattern` setting cannot be used together with this setting.)
|
||||
*/
|
||||
every?: number;
|
||||
/**
|
||||
* Repeated job should start right now
|
||||
* ( work only with every settings)
|
||||
*/
|
||||
immediately?: boolean;
|
||||
/**
|
||||
* The start value for the repeat iteration count.
|
||||
*/
|
||||
count?: number;
|
||||
prevMillis?: number;
|
||||
offset?: number;
|
||||
jobId?: string;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=repeat-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeat-options.js","sourceRoot":"","sources":["../../../src/interfaces/repeat-options.ts"],"names":[],"mappings":""}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
export type RepeatableJob = {
|
||||
key: string;
|
||||
name: string;
|
||||
id: string | null;
|
||||
endDate: number | null;
|
||||
tz: string | null;
|
||||
pattern: string;
|
||||
next: number;
|
||||
};
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=repeatable-job.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"repeatable-job.js","sourceRoot":"","sources":["../../../src/interfaces/repeatable-job.ts"],"names":[],"mappings":""}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { SandboxedJob } from './sandboxed-job';
|
||||
/**
|
||||
* @see {@link https://docs.bullmq.io/guide/workers/sandboxed-processors}
|
||||
*/
|
||||
export type SandboxedJobProcessor<T = any, R = any> = ((job: SandboxedJob<T, R>) => R | PromiseLike<R>) | ((job: SandboxedJob<T, R>, callback: (error: unknown, result: R) => void) => void);
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=sandboxed-job-processor.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sandboxed-job-processor.js","sourceRoot":"","sources":["../../../src/interfaces/sandboxed-job-processor.ts"],"names":[],"mappings":""}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import { JobsOptions } from '../types';
|
||||
import { JobJson } from './job-json';
|
||||
/**
|
||||
* @see {@link https://docs.bullmq.io/guide/workers/sandboxed-processors}
|
||||
*/
|
||||
export interface SandboxedJob<T = any, R = any> extends Omit<JobJson, 'data' | 'opts' | 'returnValue'> {
|
||||
data: T;
|
||||
opts: JobsOptions;
|
||||
moveToDelayed: (timestamp: number, token?: string) => Promise<void>;
|
||||
log: (row: any) => void;
|
||||
updateData: (data: any) => Promise<void>;
|
||||
updateProgress: (value: object | number) => Promise<void>;
|
||||
returnValue: R;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=sandboxed-job.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sandboxed-job.js","sourceRoot":"","sources":["../../../src/interfaces/sandboxed-job.ts"],"names":[],"mappings":""}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
import { Job } from '../classes/job';
|
||||
import { AdvancedOptions } from './advanced-options';
|
||||
import { QueueBaseOptions } from './queue-options';
|
||||
import { RateLimiterOptions } from './rate-limiter-options';
|
||||
import { MetricsOptions } from './metrics-options';
|
||||
import { KeepJobs } from './keep-jobs';
|
||||
/**
|
||||
* An async function that receives `Job`s and handles them.
|
||||
*/
|
||||
export type Processor<T = any, R = any, N extends string = string> = (job: Job<T, R, N>, token?: string) => Promise<R>;
|
||||
export interface WorkerOptions extends QueueBaseOptions {
|
||||
/**
|
||||
* Condition to start processor at instance creation.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
autorun?: boolean;
|
||||
/**
|
||||
* Amount of jobs that a single worker is allowed to work on
|
||||
* in parallel.
|
||||
*
|
||||
* @default 1
|
||||
* @see {@link https://docs.bullmq.io/guide/workers/concurrency}
|
||||
*/
|
||||
concurrency?: number;
|
||||
/**
|
||||
* Enable rate limiter
|
||||
* @see {@link https://docs.bullmq.io/guide/rate-limiting}
|
||||
*/
|
||||
limiter?: RateLimiterOptions;
|
||||
/**
|
||||
* Enable collect metrics.
|
||||
* @see {@link https://docs.bullmq.io/guide/metrics}
|
||||
*/
|
||||
metrics?: MetricsOptions;
|
||||
/**
|
||||
* Amount of times a job can be recovered from a stalled state
|
||||
* to the `wait` state. If this is exceeded, the job is moved
|
||||
* to `failed`.
|
||||
*
|
||||
* @default 1
|
||||
*/
|
||||
maxStalledCount?: number;
|
||||
/**
|
||||
* Number of milliseconds between stallness checks.
|
||||
*
|
||||
* @default 30000
|
||||
*/
|
||||
stalledInterval?: number;
|
||||
/**
|
||||
* You can provide an object specifying max
|
||||
* age and/or count to keep.
|
||||
* Default behavior is to keep the job in the completed set.
|
||||
*/
|
||||
removeOnComplete?: KeepJobs;
|
||||
/**
|
||||
* You can provide an object specifying max
|
||||
* age and/or count to keep.
|
||||
* Default behavior is to keep the job in the failed set.
|
||||
*/
|
||||
removeOnFail?: KeepJobs;
|
||||
/**
|
||||
* Skip stalled check for this worker. Note that other workers could still
|
||||
* perform stalled checkd and move jobs back to wait for jobs being processed
|
||||
* by this worker.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
skipStalledCheck?: boolean;
|
||||
/**
|
||||
* Skip lock renewal for this worker. If set to true, the lock will expire
|
||||
* after lockDuration and moved back to the wait queue (if the stalled check is
|
||||
* not disabled)
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
skipLockRenewal?: boolean;
|
||||
/**
|
||||
*
|
||||
* Number of seconds to long poll for jobs when the queue is empty.
|
||||
*
|
||||
* @default 5
|
||||
*/
|
||||
drainDelay?: number;
|
||||
/**
|
||||
*
|
||||
* Duration of the lock for the job in milliseconds. The lock represents that
|
||||
* a worker is processing the job. If the lock is lost, the job will be eventually
|
||||
* be picked up by the stalled checker and move back to wait so that another worker
|
||||
* can process it again.
|
||||
*
|
||||
* @default 30000
|
||||
*/
|
||||
lockDuration?: number;
|
||||
/**
|
||||
* The time in milliseconds before the lock is automatically renewed.
|
||||
*
|
||||
* It is not recommended to modify this value, which is by default set to
|
||||
* halv the lockDuration value, which is optimal for most use cases.
|
||||
*/
|
||||
lockRenewTime?: number;
|
||||
/**
|
||||
* This is an internal option that should not be modified.
|
||||
*
|
||||
* @default 15000
|
||||
*/
|
||||
runRetryDelay?: number;
|
||||
/**
|
||||
* More advanced options.
|
||||
*/
|
||||
settings?: AdvancedOptions;
|
||||
/**
|
||||
* Use Worker Threads instead of Child Processes.
|
||||
* Note: This option can only be used when specifying
|
||||
* a file for the processor argument.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
useWorkerThreads?: boolean;
|
||||
}
|
||||
export interface GetNextJobOptions {
|
||||
block?: boolean;
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export {};
|
||||
//# sourceMappingURL=worker-options.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"worker-options.js","sourceRoot":"","sources":["../../../src/interfaces/worker-options.ts"],"names":[],"mappings":""}
|
||||
Reference in New Issue
Block a user