sidekiq-ts 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +686 -0
- package/dist/api.d.ts +172 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +679 -0
- package/dist/backtrace.d.ts +3 -0
- package/dist/backtrace.d.ts.map +1 -0
- package/dist/backtrace.js +16 -0
- package/dist/cli-helpers.d.ts +22 -0
- package/dist/cli-helpers.d.ts.map +1 -0
- package/dist/cli-helpers.js +152 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +143 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +212 -0
- package/dist/config-loader.d.ts +16 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +37 -0
- package/dist/config.d.ts +59 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +155 -0
- package/dist/context.d.ts +10 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +29 -0
- package/dist/cron.d.ts +44 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +173 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/interrupt-handler.d.ts +8 -0
- package/dist/interrupt-handler.d.ts.map +1 -0
- package/dist/interrupt-handler.js +24 -0
- package/dist/iterable-constants.d.ts +3 -0
- package/dist/iterable-constants.d.ts.map +1 -0
- package/dist/iterable-constants.js +2 -0
- package/dist/iterable-errors.d.ts +10 -0
- package/dist/iterable-errors.d.ts.map +1 -0
- package/dist/iterable-errors.js +18 -0
- package/dist/iterable.d.ts +44 -0
- package/dist/iterable.d.ts.map +1 -0
- package/dist/iterable.js +298 -0
- package/dist/job-logger.d.ts +12 -0
- package/dist/job-logger.d.ts.map +1 -0
- package/dist/job-logger.js +64 -0
- package/dist/job-util.d.ts +8 -0
- package/dist/job-util.d.ts.map +1 -0
- package/dist/job-util.js +158 -0
- package/dist/job.d.ts +73 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +200 -0
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +2 -0
- package/dist/leader.d.ts +63 -0
- package/dist/leader.d.ts.map +1 -0
- package/dist/leader.js +193 -0
- package/dist/logger.d.ts +53 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +143 -0
- package/dist/middleware.d.ts +23 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +92 -0
- package/dist/periodic.d.ts +80 -0
- package/dist/periodic.d.ts.map +1 -0
- package/dist/periodic.js +205 -0
- package/dist/redis.d.ts +3 -0
- package/dist/redis.d.ts.map +1 -0
- package/dist/redis.js +1 -0
- package/dist/registry.d.ts +11 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +8 -0
- package/dist/runner.d.ts +81 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +791 -0
- package/dist/sidekiq.d.ts +43 -0
- package/dist/sidekiq.d.ts.map +1 -0
- package/dist/sidekiq.js +189 -0
- package/dist/testing.d.ts +32 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +112 -0
- package/dist/types.d.ts +116 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Config } from "./config.js";
|
|
2
|
+
import type { MiddlewareConstructor } from "./middleware.js";
|
|
3
|
+
import type { RedisClient } from "./redis.js";
|
|
4
|
+
import { type RegisteredJobClass } from "./registry.js";
|
|
5
|
+
import type { ConfigOptions, JobOptions, JobPayload, SidekiqEventHandler, SidekiqEventName, StrictArgsMode } from "./types.js";
|
|
6
|
+
export declare class Sidekiq {
|
|
7
|
+
static readonly NAME = "Sidekiq";
|
|
8
|
+
static readonly LICENSE = "See LICENSE and the LGPL-3.0 for licensing details.";
|
|
9
|
+
private static config;
|
|
10
|
+
private static serverConfigQueue;
|
|
11
|
+
private static isServerMode;
|
|
12
|
+
private static defaultJobOpts;
|
|
13
|
+
static get defaultConfiguration(): Config;
|
|
14
|
+
static configureServer(options: ConfigOptions): void;
|
|
15
|
+
static configureClient(options: ConfigOptions): void;
|
|
16
|
+
static on<TEvent extends SidekiqEventName>(event: TEvent, handler: SidekiqEventHandler<TEvent>): void;
|
|
17
|
+
static useClientMiddleware(klass: MiddlewareConstructor<[
|
|
18
|
+
string | unknown,
|
|
19
|
+
JobPayload,
|
|
20
|
+
string,
|
|
21
|
+
RedisClient
|
|
22
|
+
], JobPayload | false | null | undefined>, ...args: unknown[]): void;
|
|
23
|
+
static useServerMiddleware(klass: MiddlewareConstructor<[unknown, JobPayload, string], unknown>, ...args: unknown[]): void;
|
|
24
|
+
static markServerMode(): void;
|
|
25
|
+
static defaultJobOptions(): JobOptions;
|
|
26
|
+
static setDefaultJobOptions(options: JobOptions): void;
|
|
27
|
+
static strictArgs(mode?: StrictArgsMode): void;
|
|
28
|
+
static logger(): import("./logger.js").Logger;
|
|
29
|
+
private static applyConfigOptions;
|
|
30
|
+
private static applyScalarOptions;
|
|
31
|
+
private static applyHandlerOptions;
|
|
32
|
+
private static applyLifecycleOptions;
|
|
33
|
+
private static setIfDefined;
|
|
34
|
+
static dumpJson(value: unknown): string;
|
|
35
|
+
static loadJson(value: string): unknown;
|
|
36
|
+
static redis<T>(fn: (client: Awaited<ReturnType<Config["getRedisClient"]>>) => Promise<T>): Promise<T>;
|
|
37
|
+
static registerJob(klass: RegisteredJobClass): void;
|
|
38
|
+
static registeredJobClass(name: string): RegisteredJobClass | undefined;
|
|
39
|
+
static run({ config }?: {
|
|
40
|
+
config?: Config;
|
|
41
|
+
}): Promise<import("./runner.js").Runner>;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=sidekiq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidekiq.d.ts","s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AAqB,CAAC,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EACpE,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,IAAI;IAIP,MAAM,CAAC,cAAc,IAAI,IAAI;IAO7B,MAAM,CAAC,iBAAiB,IAAI,UAAU;IAItC,MAAM,CAAC,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAOtD,MAAM,CAAC,UAAU,CAAC,IAAI,GAAE,cAAwB,GAAG,IAAI;IAIvD,MAAM,CAAC,MAAM;IAIb,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAMjC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAqEjC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IASlC,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAepC,OAAO,CAAC,MAAM,CAAC,YAAY;IAS3B,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAIvC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;WAI1B,KAAK,CAAC,CAAC,EAClB,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GACxE,OAAO,CAAC,CAAC,CAAC;IAKb,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI;IAInD,MAAM,CAAC,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;WAI1D,GAAG,CAAC,EAAE,MAAM,EAAE,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO;CAUtD"}
|
package/dist/sidekiq.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { Config } from "./config.js";
|
|
2
|
+
import { dumpJson, loadJson } from "./json.js";
|
|
3
|
+
import { registeredJob, registerJob, } from "./registry.js";
|
|
4
|
+
// biome-ignore lint/complexity/noStaticOnlyClass: Sidekiq class provides namespace for configuration and utilities
|
|
5
|
+
export class Sidekiq {
|
|
6
|
+
static NAME = "Sidekiq";
|
|
7
|
+
static LICENSE = "See LICENSE and the LGPL-3.0 for licensing details.";
|
|
8
|
+
static config = new Config();
|
|
9
|
+
static serverConfigQueue = [];
|
|
10
|
+
static isServerMode = false;
|
|
11
|
+
static defaultJobOpts = {
|
|
12
|
+
retry: true,
|
|
13
|
+
queue: "default",
|
|
14
|
+
};
|
|
15
|
+
static get defaultConfiguration() {
|
|
16
|
+
return this.config;
|
|
17
|
+
}
|
|
18
|
+
static configureServer(options) {
|
|
19
|
+
this.serverConfigQueue.push(options);
|
|
20
|
+
if (this.isServerMode) {
|
|
21
|
+
this.applyConfigOptions(options);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
static configureClient(options) {
|
|
25
|
+
if (!this.isServerMode) {
|
|
26
|
+
this.applyConfigOptions(options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
static on(event, handler) {
|
|
30
|
+
if (event === "error") {
|
|
31
|
+
this.config.errorHandlers.push(handler);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (event === "death") {
|
|
35
|
+
this.config.deathHandlers.push(handler);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.config.lifecycleEvents[event].push(handler);
|
|
39
|
+
}
|
|
40
|
+
static useClientMiddleware(klass, ...args) {
|
|
41
|
+
this.config.clientMiddleware.use(klass, ...args);
|
|
42
|
+
}
|
|
43
|
+
static useServerMiddleware(klass, ...args) {
|
|
44
|
+
this.config.serverMiddleware.use(klass, ...args);
|
|
45
|
+
}
|
|
46
|
+
static markServerMode() {
|
|
47
|
+
this.isServerMode = true;
|
|
48
|
+
for (const options of this.serverConfigQueue) {
|
|
49
|
+
this.applyConfigOptions(options);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
static defaultJobOptions() {
|
|
53
|
+
return { ...this.defaultJobOpts };
|
|
54
|
+
}
|
|
55
|
+
static setDefaultJobOptions(options) {
|
|
56
|
+
this.defaultJobOpts = {
|
|
57
|
+
...this.defaultJobOpts,
|
|
58
|
+
...options,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
static strictArgs(mode = "raise") {
|
|
62
|
+
this.config.strictArgs = mode;
|
|
63
|
+
}
|
|
64
|
+
static logger() {
|
|
65
|
+
return this.config.logger;
|
|
66
|
+
}
|
|
67
|
+
static applyConfigOptions(options) {
|
|
68
|
+
this.applyScalarOptions(options);
|
|
69
|
+
this.applyHandlerOptions(options);
|
|
70
|
+
this.applyLifecycleOptions(options.lifecycleEvents);
|
|
71
|
+
}
|
|
72
|
+
static applyScalarOptions(options) {
|
|
73
|
+
this.setIfDefined(options.redis, (value) => {
|
|
74
|
+
this.config.redis = value;
|
|
75
|
+
});
|
|
76
|
+
this.setIfDefined(options.concurrency, (value) => {
|
|
77
|
+
this.config.concurrency = value;
|
|
78
|
+
});
|
|
79
|
+
this.setIfDefined(options.queues, (value) => {
|
|
80
|
+
this.config.queues = value;
|
|
81
|
+
});
|
|
82
|
+
this.setIfDefined(options.timeout, (value) => {
|
|
83
|
+
this.config.timeout = value;
|
|
84
|
+
});
|
|
85
|
+
this.setIfDefined(options.pollIntervalAverage, (value) => {
|
|
86
|
+
this.config.pollIntervalAverage = value;
|
|
87
|
+
});
|
|
88
|
+
this.setIfDefined(options.averageScheduledPollInterval, (value) => {
|
|
89
|
+
this.config.averageScheduledPollInterval = value;
|
|
90
|
+
});
|
|
91
|
+
this.setIfDefined(options.heartbeatInterval, (value) => {
|
|
92
|
+
this.config.heartbeatInterval = value;
|
|
93
|
+
});
|
|
94
|
+
this.setIfDefined(options.tag, (value) => {
|
|
95
|
+
this.config.tag = value;
|
|
96
|
+
});
|
|
97
|
+
this.setIfDefined(options.labels, (value) => {
|
|
98
|
+
this.config.labels = value;
|
|
99
|
+
});
|
|
100
|
+
this.setIfDefined(options.maxRetries, (value) => {
|
|
101
|
+
this.config.maxRetries = value;
|
|
102
|
+
});
|
|
103
|
+
this.setIfDefined(options.deadMaxJobs, (value) => {
|
|
104
|
+
this.config.deadMaxJobs = value;
|
|
105
|
+
});
|
|
106
|
+
this.setIfDefined(options.deadTimeoutInSeconds, (value) => {
|
|
107
|
+
this.config.deadTimeoutInSeconds = value;
|
|
108
|
+
});
|
|
109
|
+
this.setIfDefined(options.backtraceCleaner, (value) => {
|
|
110
|
+
this.config.backtraceCleaner = value;
|
|
111
|
+
});
|
|
112
|
+
this.setIfDefined(options.maxIterationRuntime, (value) => {
|
|
113
|
+
this.config.maxIterationRuntime = value;
|
|
114
|
+
});
|
|
115
|
+
this.setIfDefined(options.skipDefaultJobLogging, (value) => {
|
|
116
|
+
this.config.skipDefaultJobLogging = value;
|
|
117
|
+
});
|
|
118
|
+
this.setIfDefined(options.loggedJobAttributes, (value) => {
|
|
119
|
+
this.config.loggedJobAttributes = value;
|
|
120
|
+
});
|
|
121
|
+
this.setIfDefined(options.profiler, (value) => {
|
|
122
|
+
this.config.profiler = value;
|
|
123
|
+
});
|
|
124
|
+
this.setIfDefined(options.jobLogger, (value) => {
|
|
125
|
+
this.config.jobLogger = value;
|
|
126
|
+
});
|
|
127
|
+
this.setIfDefined(options.strictArgs, (value) => {
|
|
128
|
+
this.config.strictArgs = value;
|
|
129
|
+
});
|
|
130
|
+
this.setIfDefined(options.logger, (value) => {
|
|
131
|
+
this.config.logger = value;
|
|
132
|
+
});
|
|
133
|
+
this.setIfDefined(options.redisIdleTimeout, (value) => {
|
|
134
|
+
this.config.redisIdleTimeout = value;
|
|
135
|
+
});
|
|
136
|
+
this.setIfDefined(options.leaderElection, (value) => {
|
|
137
|
+
this.config.leaderElection = value;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
static applyHandlerOptions(options) {
|
|
141
|
+
this.setIfDefined(options.errorHandlers, (value) => {
|
|
142
|
+
this.config.errorHandlers.push(...value);
|
|
143
|
+
});
|
|
144
|
+
this.setIfDefined(options.deathHandlers, (value) => {
|
|
145
|
+
this.config.deathHandlers.push(...value);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
static applyLifecycleOptions(events) {
|
|
149
|
+
if (!events) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
for (const [event, handlers] of Object.entries(events)) {
|
|
153
|
+
if (handlers !== undefined) {
|
|
154
|
+
this.config.lifecycleEvents[event].push(...handlers);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
static setIfDefined(value, apply) {
|
|
159
|
+
if (value !== undefined) {
|
|
160
|
+
apply(value);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
static dumpJson(value) {
|
|
164
|
+
return dumpJson(value);
|
|
165
|
+
}
|
|
166
|
+
static loadJson(value) {
|
|
167
|
+
return loadJson(value);
|
|
168
|
+
}
|
|
169
|
+
static async redis(fn) {
|
|
170
|
+
const client = await this.config.getRedisClient();
|
|
171
|
+
return fn(client);
|
|
172
|
+
}
|
|
173
|
+
static registerJob(klass) {
|
|
174
|
+
registerJob(klass);
|
|
175
|
+
}
|
|
176
|
+
static registeredJobClass(name) {
|
|
177
|
+
return registeredJob(name);
|
|
178
|
+
}
|
|
179
|
+
static async run({ config } = {}) {
|
|
180
|
+
if (config) {
|
|
181
|
+
this.config = config;
|
|
182
|
+
}
|
|
183
|
+
this.markServerMode();
|
|
184
|
+
const { Runner } = await import("./runner.js");
|
|
185
|
+
const runner = new Runner(this.config);
|
|
186
|
+
await runner.start();
|
|
187
|
+
return runner;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Config } from "./config.js";
|
|
2
|
+
import type { JobPayload } from "./types.js";
|
|
3
|
+
export type TestMode = "disable" | "fake" | "inline";
|
|
4
|
+
export declare class EmptyQueueError extends Error {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
|
+
export declare class Testing {
|
|
8
|
+
private static globalMode;
|
|
9
|
+
private static localMode;
|
|
10
|
+
static mode(): TestMode;
|
|
11
|
+
static setMode(mode: TestMode, fn?: () => void | Promise<void>): Promise<void> | undefined;
|
|
12
|
+
static disable(fn?: () => void | Promise<void>): Promise<void> | undefined;
|
|
13
|
+
static fake(fn?: () => void | Promise<void>): Promise<void> | undefined;
|
|
14
|
+
static inline(fn?: () => void | Promise<void>): Promise<void> | undefined;
|
|
15
|
+
static enabled(): boolean;
|
|
16
|
+
static disabled(): boolean;
|
|
17
|
+
static enqueue(payload: JobPayload): void;
|
|
18
|
+
static performInline(payload: JobPayload, config: Config): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare class Queues {
|
|
21
|
+
private static jobsByQueue;
|
|
22
|
+
private static jobsByClass;
|
|
23
|
+
static get(queue: string): JobPayload[];
|
|
24
|
+
static jobs(): JobPayload[];
|
|
25
|
+
static jobsForClass(klass: string): JobPayload[];
|
|
26
|
+
static push(queue: string, klass: string, job: JobPayload): void;
|
|
27
|
+
static deleteFor(jid: string, queue: string, klass: string): void;
|
|
28
|
+
static clearFor(queue: string, klass: string): void;
|
|
29
|
+
static clearAll(): void;
|
|
30
|
+
private static ensure;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD,qBAAa,eAAgB,SAAQ,KAAK;;CAIzC;AAGD,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAuB;IAChD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAyB;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EAAE,MAAM,GAAG,IAAI;IAKnD,MAAM,CAAC,QAAQ,IAAI,IAAI;IAKvB,OAAO,CAAC,MAAM,CAAC,MAAM;CAStB"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ensureInterruptHandler } from "./interrupt-handler.js";
|
|
2
|
+
import { nowInMillis } from "./job-util.js";
|
|
3
|
+
import { dumpJson, loadJson } from "./json.js";
|
|
4
|
+
import { resolveJob } from "./registry.js";
|
|
5
|
+
export class EmptyQueueError extends Error {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("performOne called with empty job queue");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
// biome-ignore lint/complexity/noStaticOnlyClass: Testing class provides namespace for test mode management
|
|
11
|
+
export class Testing {
|
|
12
|
+
static globalMode = "disable";
|
|
13
|
+
static localMode = null;
|
|
14
|
+
static mode() {
|
|
15
|
+
return this.localMode ?? this.globalMode;
|
|
16
|
+
}
|
|
17
|
+
static setMode(mode, fn) {
|
|
18
|
+
if (!fn) {
|
|
19
|
+
this.globalMode = mode;
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (this.localMode) {
|
|
23
|
+
throw new Error("Nested testing modes are not supported");
|
|
24
|
+
}
|
|
25
|
+
this.localMode = mode;
|
|
26
|
+
const result = fn();
|
|
27
|
+
if (result && typeof result.then === "function") {
|
|
28
|
+
return result.finally(() => {
|
|
29
|
+
this.localMode = null;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
this.localMode = null;
|
|
33
|
+
}
|
|
34
|
+
static disable(fn) {
|
|
35
|
+
return this.setMode("disable", fn);
|
|
36
|
+
}
|
|
37
|
+
static fake(fn) {
|
|
38
|
+
return this.setMode("fake", fn);
|
|
39
|
+
}
|
|
40
|
+
static inline(fn) {
|
|
41
|
+
return this.setMode("inline", fn);
|
|
42
|
+
}
|
|
43
|
+
static enabled() {
|
|
44
|
+
return this.mode() !== "disable";
|
|
45
|
+
}
|
|
46
|
+
static disabled() {
|
|
47
|
+
return this.mode() === "disable";
|
|
48
|
+
}
|
|
49
|
+
static enqueue(payload) {
|
|
50
|
+
const job = loadJson(dumpJson(payload));
|
|
51
|
+
if (!job.queue) {
|
|
52
|
+
job.queue = "default";
|
|
53
|
+
}
|
|
54
|
+
if (!job.at) {
|
|
55
|
+
job.enqueued_at = nowInMillis();
|
|
56
|
+
}
|
|
57
|
+
Queues.push(job.queue, String(job.class), job);
|
|
58
|
+
}
|
|
59
|
+
static async performInline(payload, config) {
|
|
60
|
+
ensureInterruptHandler(config);
|
|
61
|
+
const job = loadJson(dumpJson(payload));
|
|
62
|
+
const className = String(job.class);
|
|
63
|
+
const klass = resolveJob(className);
|
|
64
|
+
if (!klass) {
|
|
65
|
+
throw new Error(`Unknown job class ${className}`);
|
|
66
|
+
}
|
|
67
|
+
const instance = new klass();
|
|
68
|
+
instance.jid = job.jid;
|
|
69
|
+
instance._context = { stopping: () => false };
|
|
70
|
+
await config.serverMiddleware.invoke(instance, job, job.queue ?? "default", async () => {
|
|
71
|
+
await instance.perform(...(job.args ?? []));
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// biome-ignore lint/complexity/noStaticOnlyClass: Queues class provides namespace for test queue management
|
|
76
|
+
export class Queues {
|
|
77
|
+
static jobsByQueue = new Map();
|
|
78
|
+
static jobsByClass = new Map();
|
|
79
|
+
static get(queue) {
|
|
80
|
+
return this.ensure(this.jobsByQueue, queue);
|
|
81
|
+
}
|
|
82
|
+
static jobs() {
|
|
83
|
+
return Array.from(this.jobsByQueue.values()).flat();
|
|
84
|
+
}
|
|
85
|
+
static jobsForClass(klass) {
|
|
86
|
+
return this.ensure(this.jobsByClass, klass);
|
|
87
|
+
}
|
|
88
|
+
static push(queue, klass, job) {
|
|
89
|
+
this.ensure(this.jobsByQueue, queue).push(job);
|
|
90
|
+
this.ensure(this.jobsByClass, klass).push(job);
|
|
91
|
+
}
|
|
92
|
+
static deleteFor(jid, queue, klass) {
|
|
93
|
+
const queueJobs = this.ensure(this.jobsByQueue, queue);
|
|
94
|
+
const classJobs = this.ensure(this.jobsByClass, klass);
|
|
95
|
+
this.jobsByQueue.set(queue, queueJobs.filter((job) => job.jid !== jid));
|
|
96
|
+
this.jobsByClass.set(klass, classJobs.filter((job) => job.jid !== jid));
|
|
97
|
+
}
|
|
98
|
+
static clearFor(queue, klass) {
|
|
99
|
+
this.jobsByQueue.set(queue, []);
|
|
100
|
+
this.jobsByClass.set(klass, []);
|
|
101
|
+
}
|
|
102
|
+
static clearAll() {
|
|
103
|
+
this.jobsByQueue.clear();
|
|
104
|
+
this.jobsByClass.clear();
|
|
105
|
+
}
|
|
106
|
+
static ensure(map, key) {
|
|
107
|
+
if (!map.has(key)) {
|
|
108
|
+
map.set(key, []);
|
|
109
|
+
}
|
|
110
|
+
return map.get(key);
|
|
111
|
+
}
|
|
112
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type { RedisClientOptions } from "redis";
|
|
2
|
+
import type { Config } from "./config.js";
|
|
3
|
+
import type { Logger } from "./logger.js";
|
|
4
|
+
export type StrictArgsMode = "raise" | "warn" | "none";
|
|
5
|
+
export type LifecycleHandler = () => void | Promise<void>;
|
|
6
|
+
export interface LifecycleEvents {
|
|
7
|
+
startup: LifecycleHandler[];
|
|
8
|
+
quiet: LifecycleHandler[];
|
|
9
|
+
shutdown: LifecycleHandler[];
|
|
10
|
+
exit: LifecycleHandler[];
|
|
11
|
+
heartbeat: LifecycleHandler[];
|
|
12
|
+
beat: LifecycleHandler[];
|
|
13
|
+
leader: LifecycleHandler[];
|
|
14
|
+
follower: LifecycleHandler[];
|
|
15
|
+
}
|
|
16
|
+
export type ErrorHandler = (error: Error, context: Record<string, unknown>, config?: Config) => void | Promise<void>;
|
|
17
|
+
export type DeathHandler = (payload: JobPayload, error: Error) => void | Promise<void>;
|
|
18
|
+
export type SidekiqEventName = keyof LifecycleEvents | "error" | "death";
|
|
19
|
+
export type SidekiqEventHandler<TEvent extends SidekiqEventName> = TEvent extends "error" ? ErrorHandler : TEvent extends "death" ? DeathHandler : LifecycleHandler;
|
|
20
|
+
export interface LeaderElectionConfig {
|
|
21
|
+
/** Leader refresh interval in milliseconds (default: 15000) */
|
|
22
|
+
refreshInterval?: number;
|
|
23
|
+
/** Follower check interval in milliseconds (default: 60000) */
|
|
24
|
+
checkInterval?: number;
|
|
25
|
+
/** Leader key TTL in seconds (default: 20) */
|
|
26
|
+
ttl?: number;
|
|
27
|
+
}
|
|
28
|
+
export interface ConfigOptions {
|
|
29
|
+
redis?: RedisClientOptions;
|
|
30
|
+
concurrency?: number;
|
|
31
|
+
queues?: string[] | [string, number][];
|
|
32
|
+
timeout?: number;
|
|
33
|
+
pollIntervalAverage?: number | null;
|
|
34
|
+
averageScheduledPollInterval?: number;
|
|
35
|
+
heartbeatInterval?: number;
|
|
36
|
+
tag?: string;
|
|
37
|
+
labels?: string[];
|
|
38
|
+
maxRetries?: number;
|
|
39
|
+
deadMaxJobs?: number;
|
|
40
|
+
deadTimeoutInSeconds?: number;
|
|
41
|
+
backtraceCleaner?: (backtrace: string[]) => string[];
|
|
42
|
+
maxIterationRuntime?: number | null;
|
|
43
|
+
skipDefaultJobLogging?: boolean;
|
|
44
|
+
loggedJobAttributes?: string[];
|
|
45
|
+
profiler?: (payload: JobPayload, fn: () => Promise<void>) => Promise<void>;
|
|
46
|
+
jobLogger?: JobLogger;
|
|
47
|
+
strictArgs?: StrictArgsMode;
|
|
48
|
+
errorHandlers?: ErrorHandler[];
|
|
49
|
+
deathHandlers?: DeathHandler[];
|
|
50
|
+
lifecycleEvents?: Partial<LifecycleEvents>;
|
|
51
|
+
logger?: Logger;
|
|
52
|
+
redisIdleTimeout?: number | null;
|
|
53
|
+
/** Leader election configuration */
|
|
54
|
+
leaderElection?: LeaderElectionConfig;
|
|
55
|
+
}
|
|
56
|
+
export type JobRetryOption = boolean | number;
|
|
57
|
+
export interface JobOptions {
|
|
58
|
+
queue?: string;
|
|
59
|
+
retry?: JobRetryOption;
|
|
60
|
+
backtrace?: boolean | number;
|
|
61
|
+
retry_for?: number;
|
|
62
|
+
retry_queue?: string;
|
|
63
|
+
dead?: boolean;
|
|
64
|
+
tags?: string[];
|
|
65
|
+
log_level?: string;
|
|
66
|
+
profile?: boolean | string;
|
|
67
|
+
profiler_options?: Record<string, unknown>;
|
|
68
|
+
}
|
|
69
|
+
export interface JobSetterOptions extends JobOptions {
|
|
70
|
+
wait?: number;
|
|
71
|
+
waitUntil?: number;
|
|
72
|
+
at?: number;
|
|
73
|
+
sync?: boolean;
|
|
74
|
+
}
|
|
75
|
+
export interface BulkOptions {
|
|
76
|
+
batchSize?: number;
|
|
77
|
+
at?: number | number[];
|
|
78
|
+
spreadInterval?: number;
|
|
79
|
+
}
|
|
80
|
+
export interface JobClassLike {
|
|
81
|
+
name?: string;
|
|
82
|
+
getSidekiqOptions?: () => JobOptions;
|
|
83
|
+
}
|
|
84
|
+
export interface JobPayload extends JobOptions {
|
|
85
|
+
class: string | JobClassLike;
|
|
86
|
+
args: unknown[];
|
|
87
|
+
queue?: string;
|
|
88
|
+
at?: number;
|
|
89
|
+
jid?: string;
|
|
90
|
+
created_at?: number;
|
|
91
|
+
enqueued_at?: number;
|
|
92
|
+
wrapped?: string | JobClassLike;
|
|
93
|
+
error_message?: string;
|
|
94
|
+
error_class?: string;
|
|
95
|
+
failed_at?: number;
|
|
96
|
+
retried_at?: number;
|
|
97
|
+
retry_count?: number;
|
|
98
|
+
error_backtrace?: string;
|
|
99
|
+
discarded_at?: number;
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
}
|
|
102
|
+
export interface JobLogger {
|
|
103
|
+
prepare<T>(payload: JobPayload, fn: () => Promise<T> | T): Promise<T> | T;
|
|
104
|
+
call<T>(payload: JobPayload, queue: string, fn: () => Promise<T> | T): Promise<T> | T;
|
|
105
|
+
}
|
|
106
|
+
export interface BulkPayload extends JobOptions {
|
|
107
|
+
class: string | JobClassLike;
|
|
108
|
+
args: unknown[][];
|
|
109
|
+
queue?: string;
|
|
110
|
+
at?: number | number[];
|
|
111
|
+
spread_interval?: number;
|
|
112
|
+
batch_size?: number;
|
|
113
|
+
jid?: string;
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,QAAQ,EAAE,gBAAgB,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,YAAY,GAAG,CACzB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,MAAM,CAAC,EAAE,MAAM,KACZ,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,MAAM,YAAY,GAAG,CACzB,OAAO,EAAE,UA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AAC,CAAC;CACnB;AAED,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;IAC7B,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sidekiq-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript client for Sidekiq job processing",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": ["sidekiq", "redis", "job", "queue", "worker", "typescript"],
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"sidekiq": "dist/cli.js"
|
|
18
|
+
},
|
|
19
|
+
"files": ["dist"],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=24.12.0"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsc",
|
|
25
|
+
"prepublishOnly": "npm run build",
|
|
26
|
+
"check": "npm run lint && npm run typecheck",
|
|
27
|
+
"lint": "ultracite check",
|
|
28
|
+
"test": "vitest",
|
|
29
|
+
"typecheck": "tsc --noEmit"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"redis": "^5.10.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@biomejs/biome": "^2.3.10",
|
|
36
|
+
"@types/node": "^25.0.3",
|
|
37
|
+
"tsx": "^4.19.2",
|
|
38
|
+
"typescript": "^5.7.2",
|
|
39
|
+
"ultracite": "^6.5.0",
|
|
40
|
+
"vitest": "^2.1.8"
|
|
41
|
+
}
|
|
42
|
+
}
|