pg-boss 12.4.0 → 12.5.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/dist/attorney.d.ts +19 -0
- package/dist/attorney.d.ts.map +1 -0
- package/dist/attorney.js +170 -0
- package/dist/boss.d.ts +16 -0
- package/dist/boss.d.ts.map +1 -0
- package/dist/boss.js +135 -0
- package/dist/contractor.d.ts +22 -0
- package/dist/contractor.d.ts.map +1 -0
- package/dist/contractor.js +81 -0
- package/dist/db.d.ts +16 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +46 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +239 -0
- package/dist/manager.d.ts +89 -0
- package/dist/manager.d.ts.map +1 -0
- package/dist/manager.js +547 -0
- package/dist/migrationStore.d.ts +7 -0
- package/dist/migrationStore.d.ts.map +1 -0
- package/dist/migrationStore.js +126 -0
- package/dist/plans.d.ts +78 -0
- package/dist/plans.d.ts.map +1 -0
- package/dist/plans.js +885 -0
- package/dist/spy.d.ts +23 -0
- package/dist/spy.d.ts.map +1 -0
- package/dist/spy.js +73 -0
- package/dist/timekeeper.d.ts +34 -0
- package/dist/timekeeper.d.ts.map +1 -0
- package/dist/timekeeper.js +158 -0
- package/dist/tools.d.ts +18 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +45 -0
- package/dist/types.d.ts +230 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/worker.d.ts +41 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +107 -0
- package/package.json +8 -11
- package/dist/index.d.mts +0 -285
- package/dist/index.mjs +0 -2468
package/dist/worker.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { delay } from "./tools.js";
|
|
2
|
+
const WORKER_STATES = {
|
|
3
|
+
created: 'created',
|
|
4
|
+
active: 'active',
|
|
5
|
+
stopping: 'stopping',
|
|
6
|
+
stopped: 'stopped'
|
|
7
|
+
};
|
|
8
|
+
class Worker {
|
|
9
|
+
id;
|
|
10
|
+
name;
|
|
11
|
+
options;
|
|
12
|
+
fetch;
|
|
13
|
+
onFetch;
|
|
14
|
+
onError;
|
|
15
|
+
interval;
|
|
16
|
+
jobs = [];
|
|
17
|
+
createdOn = Date.now();
|
|
18
|
+
state = WORKER_STATES.created;
|
|
19
|
+
lastFetchedOn = null;
|
|
20
|
+
lastJobStartedOn = null;
|
|
21
|
+
lastJobEndedOn = null;
|
|
22
|
+
lastJobDuration = null;
|
|
23
|
+
lastError = null;
|
|
24
|
+
lastErrorOn = null;
|
|
25
|
+
stopping = false;
|
|
26
|
+
stopped = false;
|
|
27
|
+
loopDelayPromise = null;
|
|
28
|
+
beenNotified = false;
|
|
29
|
+
runPromise = null;
|
|
30
|
+
constructor({ id, name, options, interval, fetch, onFetch, onError }) {
|
|
31
|
+
this.id = id;
|
|
32
|
+
this.name = name;
|
|
33
|
+
this.options = options;
|
|
34
|
+
this.fetch = fetch;
|
|
35
|
+
this.onFetch = onFetch;
|
|
36
|
+
this.onError = onError;
|
|
37
|
+
this.interval = interval;
|
|
38
|
+
}
|
|
39
|
+
start() {
|
|
40
|
+
this.runPromise = this.run();
|
|
41
|
+
}
|
|
42
|
+
async run() {
|
|
43
|
+
this.state = WORKER_STATES.active;
|
|
44
|
+
while (!this.stopping) {
|
|
45
|
+
const started = Date.now();
|
|
46
|
+
try {
|
|
47
|
+
this.beenNotified = false;
|
|
48
|
+
const jobs = await this.fetch();
|
|
49
|
+
this.lastFetchedOn = Date.now();
|
|
50
|
+
if (jobs) {
|
|
51
|
+
this.jobs = jobs;
|
|
52
|
+
this.lastJobStartedOn = this.lastFetchedOn;
|
|
53
|
+
await this.onFetch(jobs);
|
|
54
|
+
this.lastJobEndedOn = Date.now();
|
|
55
|
+
this.jobs = [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.lastErrorOn = Date.now();
|
|
60
|
+
this.lastError = err;
|
|
61
|
+
err.message = `${err.message} (Queue: ${this.name}, Worker: ${this.id})`;
|
|
62
|
+
this.onError(err);
|
|
63
|
+
}
|
|
64
|
+
const duration = Date.now() - started;
|
|
65
|
+
this.lastJobDuration = duration;
|
|
66
|
+
if (!this.stopping && !this.beenNotified && (this.interval - duration) > 100) {
|
|
67
|
+
this.loopDelayPromise = delay(this.interval - duration);
|
|
68
|
+
await this.loopDelayPromise;
|
|
69
|
+
this.loopDelayPromise = null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
this.stopping = false;
|
|
73
|
+
this.stopped = true;
|
|
74
|
+
this.state = WORKER_STATES.stopped;
|
|
75
|
+
}
|
|
76
|
+
notify() {
|
|
77
|
+
this.beenNotified = true;
|
|
78
|
+
if (this.loopDelayPromise) {
|
|
79
|
+
this.loopDelayPromise.abort();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async stop() {
|
|
83
|
+
this.stopping = true;
|
|
84
|
+
this.state = WORKER_STATES.stopping;
|
|
85
|
+
if (this.loopDelayPromise) {
|
|
86
|
+
this.loopDelayPromise.abort();
|
|
87
|
+
}
|
|
88
|
+
await this.runPromise;
|
|
89
|
+
}
|
|
90
|
+
toWipData() {
|
|
91
|
+
return {
|
|
92
|
+
id: this.id,
|
|
93
|
+
name: this.name,
|
|
94
|
+
options: this.options,
|
|
95
|
+
state: this.state,
|
|
96
|
+
count: this.jobs.length,
|
|
97
|
+
createdOn: this.createdOn,
|
|
98
|
+
lastFetchedOn: this.lastFetchedOn,
|
|
99
|
+
lastJobStartedOn: this.lastJobStartedOn,
|
|
100
|
+
lastJobEndedOn: this.lastJobEndedOn,
|
|
101
|
+
lastError: this.lastError,
|
|
102
|
+
lastErrorOn: this.lastErrorOn,
|
|
103
|
+
lastJobDuration: this.lastJobDuration
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export default Worker;
|
package/package.json
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-boss",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.5.0",
|
|
4
4
|
"description": "Queueing jobs in Postgres from Node.js like a boss",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
-
"
|
|
8
|
-
"types": "./dist/index.d.mts",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
9
8
|
"engines": {
|
|
10
9
|
"node": ">=22.12.0"
|
|
11
10
|
},
|
|
12
|
-
"exports": {
|
|
13
|
-
".": "./dist/index.mjs",
|
|
14
|
-
"./package.json": "./package.json"
|
|
15
|
-
},
|
|
16
11
|
"dependencies": {
|
|
17
12
|
"cron-parser": "^5.4.0",
|
|
18
13
|
"pg": "^8.16.3",
|
|
@@ -20,7 +15,9 @@
|
|
|
20
15
|
},
|
|
21
16
|
"devDependencies": {
|
|
22
17
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
18
|
+
"@tsconfig/node-ts": "^23.6.2",
|
|
23
19
|
"@tsconfig/node22": "^22.0.5",
|
|
20
|
+
"@types/luxon": "^3.7.1",
|
|
24
21
|
"@types/mocha": "^10.0.10",
|
|
25
22
|
"@types/node": "^22.19.1",
|
|
26
23
|
"@types/pg": "^8.15.6",
|
|
@@ -29,14 +26,14 @@
|
|
|
29
26
|
"mocha": "^11.7.5",
|
|
30
27
|
"neostandard": "^0.12.2",
|
|
31
28
|
"nyc": "^17.1.0",
|
|
32
|
-
"source-map-support": "^0.5.21",
|
|
33
|
-
"tsdown": "^0.16.6",
|
|
34
29
|
"tsx": "^4.20.6",
|
|
35
30
|
"typescript": "^5.9.3"
|
|
36
31
|
},
|
|
37
32
|
"scripts": {
|
|
38
|
-
"build": "
|
|
33
|
+
"build": "npm run clean && tsc --project tsconfig.build.json",
|
|
34
|
+
"clean": "node -e \"fs.rmSync('dist',{recursive:true,force:true})\"",
|
|
39
35
|
"prepublishOnly": "npm test && npm run build",
|
|
36
|
+
"postpublish": "npm run clean",
|
|
40
37
|
"test": "eslint . && mocha test/**/*.ts",
|
|
41
38
|
"cover": "nyc npm test",
|
|
42
39
|
"tsc": "tsc --noEmit",
|
package/dist/index.d.mts
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import EventEmitter from "node:events";
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type JobStates = {
|
|
5
|
-
created: 'created';
|
|
6
|
-
retry: 'retry';
|
|
7
|
-
active: 'active';
|
|
8
|
-
completed: 'completed';
|
|
9
|
-
cancelled: 'cancelled';
|
|
10
|
-
failed: 'failed';
|
|
11
|
-
};
|
|
12
|
-
type Events = {
|
|
13
|
-
error: 'error';
|
|
14
|
-
warning: 'warning';
|
|
15
|
-
wip: 'wip';
|
|
16
|
-
stopped: 'stopped';
|
|
17
|
-
};
|
|
18
|
-
interface IDatabase {
|
|
19
|
-
executeSql(text: string, values?: unknown[]): Promise<{
|
|
20
|
-
rows: any[];
|
|
21
|
-
}>;
|
|
22
|
-
}
|
|
23
|
-
interface DatabaseOptions {
|
|
24
|
-
application_name?: string;
|
|
25
|
-
database?: string;
|
|
26
|
-
user?: string;
|
|
27
|
-
password?: string | (() => string) | (() => Promise<string>);
|
|
28
|
-
host?: string;
|
|
29
|
-
port?: number;
|
|
30
|
-
schema?: string;
|
|
31
|
-
ssl?: any;
|
|
32
|
-
connectionString?: string;
|
|
33
|
-
max?: number;
|
|
34
|
-
db?: IDatabase;
|
|
35
|
-
connectionTimeoutMillis?: number;
|
|
36
|
-
}
|
|
37
|
-
interface SchedulingOptions {
|
|
38
|
-
schedule?: boolean;
|
|
39
|
-
clockMonitorIntervalSeconds?: number;
|
|
40
|
-
cronWorkerIntervalSeconds?: number;
|
|
41
|
-
cronMonitorIntervalSeconds?: number;
|
|
42
|
-
}
|
|
43
|
-
interface MaintenanceOptions {
|
|
44
|
-
supervise?: boolean;
|
|
45
|
-
migrate?: boolean;
|
|
46
|
-
createSchema?: boolean;
|
|
47
|
-
warningSlowQuerySeconds?: number;
|
|
48
|
-
warningQueueSize?: number;
|
|
49
|
-
superviseIntervalSeconds?: number;
|
|
50
|
-
maintenanceIntervalSeconds?: number;
|
|
51
|
-
queueCacheIntervalSeconds?: number;
|
|
52
|
-
monitorIntervalSeconds?: number;
|
|
53
|
-
}
|
|
54
|
-
interface ConstructorOptions extends DatabaseOptions, SchedulingOptions, MaintenanceOptions {}
|
|
55
|
-
interface QueueOptions {
|
|
56
|
-
expireInSeconds?: number;
|
|
57
|
-
retentionSeconds?: number;
|
|
58
|
-
deleteAfterSeconds?: number;
|
|
59
|
-
retryLimit?: number;
|
|
60
|
-
retryDelay?: number;
|
|
61
|
-
retryBackoff?: boolean;
|
|
62
|
-
retryDelayMax?: number;
|
|
63
|
-
}
|
|
64
|
-
interface JobOptions {
|
|
65
|
-
id?: string;
|
|
66
|
-
priority?: number;
|
|
67
|
-
startAfter?: number | string | Date;
|
|
68
|
-
singletonKey?: string;
|
|
69
|
-
singletonSeconds?: number;
|
|
70
|
-
singletonNextSlot?: boolean;
|
|
71
|
-
keepUntil?: number | string | Date;
|
|
72
|
-
}
|
|
73
|
-
interface ConnectionOptions {
|
|
74
|
-
db?: IDatabase;
|
|
75
|
-
}
|
|
76
|
-
type InsertOptions = ConnectionOptions;
|
|
77
|
-
type SendOptions = JobOptions & QueueOptions & ConnectionOptions;
|
|
78
|
-
type QueuePolicy = 'standard' | 'short' | 'singleton' | 'stately' | 'exclusive';
|
|
79
|
-
interface Queue extends QueueOptions {
|
|
80
|
-
name: string;
|
|
81
|
-
policy?: QueuePolicy;
|
|
82
|
-
partition?: boolean;
|
|
83
|
-
deadLetter?: string;
|
|
84
|
-
warningQueueSize?: number;
|
|
85
|
-
}
|
|
86
|
-
interface QueueResult extends Queue {
|
|
87
|
-
deferredCount: number;
|
|
88
|
-
queuedCount: number;
|
|
89
|
-
activeCount: number;
|
|
90
|
-
totalCount: number;
|
|
91
|
-
table: string;
|
|
92
|
-
createdOn: Date;
|
|
93
|
-
updatedOn: Date;
|
|
94
|
-
singletonsActive: string[] | null;
|
|
95
|
-
}
|
|
96
|
-
type ScheduleOptions = SendOptions & {
|
|
97
|
-
tz?: string;
|
|
98
|
-
key?: string;
|
|
99
|
-
};
|
|
100
|
-
interface JobPollingOptions {
|
|
101
|
-
pollingIntervalSeconds?: number;
|
|
102
|
-
}
|
|
103
|
-
interface JobFetchOptions {
|
|
104
|
-
includeMetadata?: boolean;
|
|
105
|
-
priority?: boolean;
|
|
106
|
-
batchSize?: number;
|
|
107
|
-
ignoreStartAfter?: boolean;
|
|
108
|
-
}
|
|
109
|
-
type WorkOptions = JobFetchOptions & JobPollingOptions;
|
|
110
|
-
type FetchOptions = JobFetchOptions & ConnectionOptions;
|
|
111
|
-
interface WorkHandler<ReqData, ResData = any> {
|
|
112
|
-
(job: Job<ReqData>[]): Promise<ResData>;
|
|
113
|
-
}
|
|
114
|
-
interface WorkWithMetadataHandler<ReqData, ResData = any> {
|
|
115
|
-
(job: JobWithMetadata<ReqData>[]): Promise<ResData>;
|
|
116
|
-
}
|
|
117
|
-
interface Request {
|
|
118
|
-
name: string;
|
|
119
|
-
data?: object;
|
|
120
|
-
options?: SendOptions;
|
|
121
|
-
}
|
|
122
|
-
interface Schedule {
|
|
123
|
-
name: string;
|
|
124
|
-
key: string;
|
|
125
|
-
cron: string;
|
|
126
|
-
timezone: string;
|
|
127
|
-
data?: object;
|
|
128
|
-
options?: SendOptions;
|
|
129
|
-
}
|
|
130
|
-
interface Job<T = object> {
|
|
131
|
-
id: string;
|
|
132
|
-
name: string;
|
|
133
|
-
data: T;
|
|
134
|
-
expireInSeconds: number;
|
|
135
|
-
signal: AbortSignal;
|
|
136
|
-
}
|
|
137
|
-
interface JobWithMetadata<T = object> extends Job<T> {
|
|
138
|
-
priority: number;
|
|
139
|
-
state: 'created' | 'retry' | 'active' | 'completed' | 'cancelled' | 'failed';
|
|
140
|
-
retryLimit: number;
|
|
141
|
-
retryCount: number;
|
|
142
|
-
retryDelay: number;
|
|
143
|
-
retryBackoff: boolean;
|
|
144
|
-
retryDelayMax?: number;
|
|
145
|
-
startAfter: Date;
|
|
146
|
-
startedOn: Date;
|
|
147
|
-
singletonKey: string | null;
|
|
148
|
-
singletonOn: Date | null;
|
|
149
|
-
expireInSeconds: number;
|
|
150
|
-
deleteAfterSeconds: number;
|
|
151
|
-
createdOn: Date;
|
|
152
|
-
completedOn: Date | null;
|
|
153
|
-
keepUntil: Date;
|
|
154
|
-
policy: QueuePolicy;
|
|
155
|
-
deadLetter: string;
|
|
156
|
-
output: object;
|
|
157
|
-
}
|
|
158
|
-
interface JobInsert<T = object> {
|
|
159
|
-
id?: string;
|
|
160
|
-
data?: T;
|
|
161
|
-
priority?: number;
|
|
162
|
-
retryLimit?: number;
|
|
163
|
-
retryDelay?: number;
|
|
164
|
-
retryBackoff?: boolean;
|
|
165
|
-
retryDelayMax?: number;
|
|
166
|
-
startAfter?: number | string | Date;
|
|
167
|
-
singletonKey?: string;
|
|
168
|
-
singletonSeconds?: number;
|
|
169
|
-
expireInSeconds?: number;
|
|
170
|
-
deleteAfterSeconds?: number;
|
|
171
|
-
retentionSeconds?: number;
|
|
172
|
-
}
|
|
173
|
-
type WorkerState = 'created' | 'active' | 'stopping' | 'stopped';
|
|
174
|
-
interface WipData {
|
|
175
|
-
id: string;
|
|
176
|
-
name: string;
|
|
177
|
-
options: WorkOptions;
|
|
178
|
-
state: WorkerState;
|
|
179
|
-
count: number;
|
|
180
|
-
createdOn: number;
|
|
181
|
-
lastFetchedOn: number | null;
|
|
182
|
-
lastJobStartedOn: number | null;
|
|
183
|
-
lastJobEndedOn: number | null;
|
|
184
|
-
lastJobDuration: number | null;
|
|
185
|
-
lastError: object | null;
|
|
186
|
-
lastErrorOn: number | null;
|
|
187
|
-
}
|
|
188
|
-
interface StopOptions {
|
|
189
|
-
close?: boolean;
|
|
190
|
-
graceful?: boolean;
|
|
191
|
-
timeout?: number;
|
|
192
|
-
}
|
|
193
|
-
interface OffWorkOptions {
|
|
194
|
-
id?: string;
|
|
195
|
-
wait?: boolean;
|
|
196
|
-
}
|
|
197
|
-
type UpdateQueueOptions = Omit<Queue, 'name' | 'partition' | 'policy'>;
|
|
198
|
-
interface Warning {
|
|
199
|
-
message: string;
|
|
200
|
-
data: object;
|
|
201
|
-
}
|
|
202
|
-
interface CommandResponse {}
|
|
203
|
-
type PgBossEventMap = {
|
|
204
|
-
error: [error: Error];
|
|
205
|
-
warning: [warning: Warning];
|
|
206
|
-
wip: [data: WipData[]];
|
|
207
|
-
stopped: [];
|
|
208
|
-
};
|
|
209
|
-
//#endregion
|
|
210
|
-
//#region src/plans.d.ts
|
|
211
|
-
declare const JOB_STATES: Readonly<{
|
|
212
|
-
created: "created";
|
|
213
|
-
retry: "retry";
|
|
214
|
-
active: "active";
|
|
215
|
-
completed: "completed";
|
|
216
|
-
cancelled: "cancelled";
|
|
217
|
-
failed: "failed";
|
|
218
|
-
}>;
|
|
219
|
-
declare const QUEUE_POLICIES: Readonly<{
|
|
220
|
-
standard: "standard";
|
|
221
|
-
short: "short";
|
|
222
|
-
singleton: "singleton";
|
|
223
|
-
stately: "stately";
|
|
224
|
-
exclusive: "exclusive";
|
|
225
|
-
}>;
|
|
226
|
-
//#endregion
|
|
227
|
-
//#region src/index.d.ts
|
|
228
|
-
declare const events: Events;
|
|
229
|
-
declare function getConstructionPlans(schema?: string): string;
|
|
230
|
-
declare function getMigrationPlans(schema?: string, version?: number): string;
|
|
231
|
-
declare function getRollbackPlans(schema?: string, version?: number): string;
|
|
232
|
-
declare class PgBoss extends EventEmitter<PgBossEventMap> {
|
|
233
|
-
#private;
|
|
234
|
-
constructor(connectionString: string);
|
|
235
|
-
constructor(options: ConstructorOptions);
|
|
236
|
-
start(): Promise<this>;
|
|
237
|
-
stop(options?: StopOptions): Promise<void>;
|
|
238
|
-
send(request: Request): Promise<string | null>;
|
|
239
|
-
send(name: string, data?: object | null, options?: SendOptions): Promise<string | null>;
|
|
240
|
-
sendAfter(name: string, data: object, options: SendOptions, date: Date): Promise<string | null>;
|
|
241
|
-
sendAfter(name: string, data: object, options: SendOptions, dateString: string): Promise<string | null>;
|
|
242
|
-
sendAfter(name: string, data: object, options: SendOptions, seconds: number): Promise<string | null>;
|
|
243
|
-
sendThrottled(name: string, data: object, options: SendOptions, seconds: number, key?: string): Promise<string | null>;
|
|
244
|
-
sendDebounced(name: string, data: object, options: SendOptions, seconds: number, key?: string): Promise<string | null>;
|
|
245
|
-
insert(name: string, jobs: JobInsert[], options?: InsertOptions): Promise<string[] | null>;
|
|
246
|
-
fetch<T>(name: string, options: FetchOptions & {
|
|
247
|
-
includeMetadata: true;
|
|
248
|
-
}): Promise<JobWithMetadata<T>[]>;
|
|
249
|
-
fetch<T>(name: string, options?: FetchOptions): Promise<Job<T>[]>;
|
|
250
|
-
work<ReqData, ResData = any>(name: string, handler: WorkHandler<ReqData, ResData>): Promise<string>;
|
|
251
|
-
work<ReqData, ResData = any>(name: string, options: WorkOptions & {
|
|
252
|
-
includeMetadata: true;
|
|
253
|
-
}, handler: WorkWithMetadataHandler<ReqData, ResData>): Promise<string>;
|
|
254
|
-
work<ReqData, ResData = any>(name: string, options: WorkOptions, handler: WorkHandler<ReqData, ResData>): Promise<string>;
|
|
255
|
-
offWork(name: string, options?: OffWorkOptions): Promise<void>;
|
|
256
|
-
notifyWorker(workerId: string): void;
|
|
257
|
-
subscribe(event: string, name: string): Promise<void>;
|
|
258
|
-
unsubscribe(event: string, name: string): Promise<void>;
|
|
259
|
-
publish(event: string, data?: object, options?: SendOptions): Promise<void>;
|
|
260
|
-
cancel(name: string, id: string | string[], options?: ConnectionOptions): Promise<CommandResponse>;
|
|
261
|
-
resume(name: string, id: string | string[], options?: ConnectionOptions): Promise<CommandResponse>;
|
|
262
|
-
retry(name: string, id: string | string[], options?: ConnectionOptions): Promise<CommandResponse>;
|
|
263
|
-
deleteJob(name: string, id: string | string[], options?: ConnectionOptions): Promise<CommandResponse>;
|
|
264
|
-
deleteQueuedJobs(name: string): Promise<void>;
|
|
265
|
-
deleteStoredJobs(name: string): Promise<void>;
|
|
266
|
-
deleteAllJobs(name: string): Promise<void>;
|
|
267
|
-
complete(name: string, id: string | string[], data?: object, options?: ConnectionOptions): Promise<CommandResponse>;
|
|
268
|
-
fail(name: string, id: string | string[], data?: object, options?: ConnectionOptions): Promise<CommandResponse>;
|
|
269
|
-
getJobById<T>(name: string, id: string, options?: ConnectionOptions): Promise<JobWithMetadata<T> | null>;
|
|
270
|
-
createQueue(name: string, options?: Omit<Queue, 'name'>): Promise<void>;
|
|
271
|
-
updateQueue(name: string, options?: UpdateQueueOptions): Promise<void>;
|
|
272
|
-
deleteQueue(name: string): Promise<void>;
|
|
273
|
-
getQueues(names?: string[]): Promise<QueueResult[]>;
|
|
274
|
-
getQueue(name: string): Promise<QueueResult | null>;
|
|
275
|
-
getQueueStats(name: string): Promise<QueueResult>;
|
|
276
|
-
supervise(name?: string): Promise<void>;
|
|
277
|
-
isInstalled(): Promise<boolean>;
|
|
278
|
-
schemaVersion(): Promise<number | null>;
|
|
279
|
-
schedule(name: string, cron: string, data?: object, options?: ScheduleOptions): Promise<void>;
|
|
280
|
-
unschedule(name: string, key?: string): Promise<void>;
|
|
281
|
-
getSchedules(name?: string, key?: string): Promise<Schedule[]>;
|
|
282
|
-
getDb(): IDatabase;
|
|
283
|
-
}
|
|
284
|
-
//#endregion
|
|
285
|
-
export { type ConnectionOptions, type ConstructorOptions, type IDatabase as Db, type Events, type FetchOptions, type Job, type JobFetchOptions, type JobInsert, type JobPollingOptions, type JobStates, type JobWithMetadata, type MaintenanceOptions, type OffWorkOptions, PgBoss, type Queue, type QueuePolicy, type QueueResult, type Request, type Schedule, type ScheduleOptions, type SchedulingOptions, type SendOptions, type StopOptions, type WipData, type WorkHandler, type WorkOptions, type WorkWithMetadataHandler, events, getConstructionPlans, getMigrationPlans, getRollbackPlans, QUEUE_POLICIES as policies, JOB_STATES as states };
|