pg-boss 7.0.1 → 7.0.2

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.
Files changed (2) hide show
  1. package/package.json +2 -1
  2. package/types.d.ts +13 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-boss",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "Queueing jobs in Node.js using PostgreSQL like a boss",
5
5
  "main": "./src/index.js",
6
6
  "engines": {
@@ -15,6 +15,7 @@
15
15
  "uuid": "^8.3.2"
16
16
  },
17
17
  "devDependencies": {
18
+ "@types/node": "^17.0.2",
18
19
  "coveralls": "^3.1.0",
19
20
  "luxon": "^2.0.1",
20
21
  "mocha": "^9.0.1",
package/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { EventEmitter } from 'events'
2
+
1
3
  declare namespace PgBoss {
2
4
  interface Db {
3
5
  executeSql(text: string, values: any[]): Promise<{ rows: any[]; rowCount: number }>;
@@ -239,7 +241,7 @@ declare namespace PgBoss {
239
241
 
240
242
  }
241
243
 
242
- declare class PgBoss {
244
+ declare class PgBoss extends EventEmitter {
243
245
  constructor(connectionString: string);
244
246
  constructor(options: PgBoss.ConstructorOptions);
245
247
 
@@ -254,20 +256,20 @@ declare class PgBoss {
254
256
  static getRollbackPlans(schema: string): string;
255
257
  static getRollbackPlans(): string;
256
258
 
257
- on(event: "error", handler: (error: Error) => void): void;
258
- off(event: "error", handler: (error: Error) => void): void;
259
+ on(event: "error", handler: (error: Error) => void): this;
260
+ off(event: "error", handler: (error: Error) => void): this;
259
261
 
260
- on(event: "maintenance", handler: () => void): void;
261
- off(event: "maintenance", handler: () => void): void;
262
+ on(event: "maintenance", handler: () => void): this;
263
+ off(event: "maintenance", handler: () => void): this;
262
264
 
263
- on(event: "monitor-states", handler: (monitorStates: PgBoss.MonitorStates) => void): void;
264
- off(event: "monitor-states", handler: (monitorStates: PgBoss.MonitorStates) => void): void;
265
+ on(event: "monitor-states", handler: (monitorStates: PgBoss.MonitorStates) => void): this;
266
+ off(event: "monitor-states", handler: (monitorStates: PgBoss.MonitorStates) => void): this;
265
267
 
266
- on(event: "wip", handler: (data: PgBoss.Worker[]) => void): void;
267
- off(event: "wip", handler: (data: PgBoss.Worker[]) => void): void;
268
+ on(event: "wip", handler: (data: PgBoss.Worker[]) => void): this;
269
+ off(event: "wip", handler: (data: PgBoss.Worker[]) => void): this;
268
270
 
269
- on(event: "stopped", handler: () => void): void;
270
- off(event: "stopped", handler: () => void): void;
271
+ on(event: "stopped", handler: () => void): this;
272
+ off(event: "stopped", handler: () => void): this;
271
273
 
272
274
  start(): Promise<PgBoss>;
273
275
  stop(options?: PgBoss.StopOptions): Promise<void>;