@forklaunch/implementation-worker-bullmq 0.5.0 → 0.5.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.
@@ -4,12 +4,12 @@ import { BullMqWorkerOptions } from '../domain/types/index.mjs';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerConsumer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerConsumer<EventEntity> {
7
+ private queue;
8
+ private worker?;
7
9
  protected readonly queueName: string;
8
10
  protected readonly options: Options;
9
11
  protected readonly processEvents: WorkerProcessFunction<EventEntity>;
10
12
  protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
11
- private queue;
12
- private worker?;
13
13
  constructor(queueName: string, options: Options, processEvents: WorkerProcessFunction<EventEntity>, failureHandler: WorkerFailureHandler<EventEntity>);
14
14
  peekEvents(): Promise<EventEntity[]>;
15
15
  start(): Promise<void>;
@@ -4,12 +4,12 @@ import { BullMqWorkerOptions } from '../domain/types/index.js';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerConsumer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerConsumer<EventEntity> {
7
+ private queue;
8
+ private worker?;
7
9
  protected readonly queueName: string;
8
10
  protected readonly options: Options;
9
11
  protected readonly processEvents: WorkerProcessFunction<EventEntity>;
10
12
  protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
11
- private queue;
12
- private worker?;
13
13
  constructor(queueName: string, options: Options, processEvents: WorkerProcessFunction<EventEntity>, failureHandler: WorkerFailureHandler<EventEntity>);
14
14
  peekEvents(): Promise<EventEntity[]>;
15
15
  start(): Promise<void>;
@@ -27,6 +27,12 @@ module.exports = __toCommonJS(consumers_exports);
27
27
  // consumers/bullMqWorker.consumer.ts
28
28
  var import_bullmq = require("bullmq");
29
29
  var BullMqWorkerConsumer = class {
30
+ queue;
31
+ worker;
32
+ queueName;
33
+ options;
34
+ processEvents;
35
+ failureHandler;
30
36
  constructor(queueName, options, processEvents, failureHandler) {
31
37
  this.queueName = queueName;
32
38
  this.options = options;
@@ -36,8 +42,6 @@ var BullMqWorkerConsumer = class {
36
42
  connection: this.options.queueOptions.connection
37
43
  });
38
44
  }
39
- queue;
40
- worker;
41
45
  async peekEvents() {
42
46
  const jobs = await this.queue.getJobs(["waiting", "active"]);
43
47
  return jobs.map((job) => job.data);
@@ -1,6 +1,12 @@
1
1
  // consumers/bullMqWorker.consumer.ts
2
2
  import { Queue, Worker } from "bullmq";
3
3
  var BullMqWorkerConsumer = class {
4
+ queue;
5
+ worker;
6
+ queueName;
7
+ options;
8
+ processEvents;
9
+ failureHandler;
4
10
  constructor(queueName, options, processEvents, failureHandler) {
5
11
  this.queueName = queueName;
6
12
  this.options = options;
@@ -10,8 +16,6 @@ var BullMqWorkerConsumer = class {
10
16
  connection: this.options.queueOptions.connection
11
17
  });
12
18
  }
13
- queue;
14
- worker;
15
19
  async peekEvents() {
16
20
  const jobs = await this.queue.getJobs(["waiting", "active"]);
17
21
  return jobs.map((job) => job.data);
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(schemas_exports);
28
28
  // domain/schemas/bullMqWorker.schema.ts
29
29
  var import_internal = require("@forklaunch/internal");
30
30
 
31
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
31
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
32
32
  var typebox_exports = {};
33
33
  __export(typebox_exports, {
34
34
  SchemaValidator: () => SchemaValidator,
@@ -68,7 +68,7 @@ __export(typebox_exports, {
68
68
  });
69
69
  __reExport(typebox_exports, require("@sinclair/typebox"));
70
70
 
71
- // ../../../node_modules/.pnpm/@forklaunch+common@0.4.6/node_modules/@forklaunch/common/lib/index.mjs
71
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.5.0/node_modules/@forklaunch/common/lib/index.mjs
72
72
  var InMemoryBlob = class extends Blob {
73
73
  constructor(content) {
74
74
  super([Buffer.from(content)]);
@@ -76,7 +76,7 @@ var InMemoryBlob = class extends Blob {
76
76
  }
77
77
  };
78
78
 
79
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
79
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
80
80
  var import_typebox = require("@sinclair/typebox");
81
81
  var import_compiler = require("@sinclair/typebox/compiler");
82
82
  var import_errors = require("@sinclair/typebox/errors");
@@ -584,7 +584,7 @@ var BullMqWorkerOptionsSchema = {
584
584
  interval: number
585
585
  };
586
586
 
587
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
587
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
588
588
  var import_v3 = require("zod/v3");
589
589
 
590
590
  // ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
@@ -634,7 +634,7 @@ merge.withOptions = (options, ...objects) => {
634
634
  return result;
635
635
  };
636
636
 
637
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
637
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
638
638
  var import_v32 = require("zod/v3");
639
639
  function extendApi(schema, schemaObject = {}) {
640
640
  const This = schema.constructor;
@@ -19,7 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  // domain/schemas/bullMqWorker.schema.ts
20
20
  import { serviceSchemaResolver } from "@forklaunch/internal";
21
21
 
22
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
22
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
23
23
  var typebox_exports = {};
24
24
  __export(typebox_exports, {
25
25
  SchemaValidator: () => SchemaValidator,
@@ -60,7 +60,7 @@ __export(typebox_exports, {
60
60
  __reExport(typebox_exports, typebox_star);
61
61
  import * as typebox_star from "@sinclair/typebox";
62
62
 
63
- // ../../../node_modules/.pnpm/@forklaunch+common@0.4.6/node_modules/@forklaunch/common/lib/index.mjs
63
+ // ../../../node_modules/.pnpm/@forklaunch+common@0.5.0/node_modules/@forklaunch/common/lib/index.mjs
64
64
  var InMemoryBlob = class extends Blob {
65
65
  constructor(content) {
66
66
  super([Buffer.from(content)]);
@@ -68,7 +68,7 @@ var InMemoryBlob = class extends Blob {
68
68
  }
69
69
  };
70
70
 
71
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
71
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/typebox/index.mjs
72
72
  import {
73
73
  FormatRegistry,
74
74
  Kind,
@@ -585,7 +585,7 @@ var BullMqWorkerOptionsSchema = {
585
585
  interval: number
586
586
  };
587
587
 
588
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
588
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
589
589
  import {
590
590
  z as z2,
591
591
  ZodType
@@ -638,7 +638,7 @@ merge.withOptions = (options, ...objects) => {
638
638
  return result;
639
639
  };
640
640
 
641
- // ../../../node_modules/.pnpm/@forklaunch+validator@0.8.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
641
+ // ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
642
642
  import { z } from "zod/v3";
643
643
  function extendApi(schema, schemaObject = {}) {
644
644
  const This = schema.constructor;
@@ -14,13 +14,21 @@ export class BullMqWorkerConsumer<
14
14
  {
15
15
  private queue: Queue;
16
16
  private worker?: Worker;
17
+ protected readonly queueName: string;
18
+ protected readonly options: Options;
19
+ protected readonly processEvents: WorkerProcessFunction<EventEntity>;
20
+ protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
17
21
 
18
22
  constructor(
19
- protected readonly queueName: string,
20
- protected readonly options: Options,
21
- protected readonly processEvents: WorkerProcessFunction<EventEntity>,
22
- protected readonly failureHandler: WorkerFailureHandler<EventEntity>
23
+ queueName: string,
24
+ options: Options,
25
+ processEvents: WorkerProcessFunction<EventEntity>,
26
+ failureHandler: WorkerFailureHandler<EventEntity>
23
27
  ) {
28
+ this.queueName = queueName;
29
+ this.options = options;
30
+ this.processEvents = processEvents;
31
+ this.failureHandler = failureHandler;
24
32
  this.queue = new Queue(this.queueName, {
25
33
  connection: this.options.queueOptions.connection
26
34
  });
@@ -9,11 +9,12 @@ export class BullMqWorkerProducer<
9
9
  > implements WorkerProducer<EventEntity>
10
10
  {
11
11
  private queue;
12
+ private readonly queueName: string;
13
+ private readonly options: Options;
12
14
 
13
- constructor(
14
- private readonly queueName: string,
15
- private readonly options: Options
16
- ) {
15
+ constructor(queueName: string, options: Options) {
16
+ this.queueName = queueName;
17
+ this.options = options;
17
18
  this.queue = new Queue(this.queueName, {
18
19
  connection: this.options.queueOptions.connection
19
20
  });
@@ -4,9 +4,9 @@ import { BullMqWorkerOptions } from '../domain/types/index.mjs';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerProducer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerProducer<EventEntity> {
7
+ private queue;
7
8
  private readonly queueName;
8
9
  private readonly options;
9
- private queue;
10
10
  constructor(queueName: string, options: Options);
11
11
  enqueueJob(event: EventEntity): Promise<void>;
12
12
  enqueueBatchJobs(events: EventEntity[]): Promise<void>;
@@ -4,9 +4,9 @@ import { BullMqWorkerOptions } from '../domain/types/index.js';
4
4
  import 'bullmq';
5
5
 
6
6
  declare class BullMqWorkerProducer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerProducer<EventEntity> {
7
+ private queue;
7
8
  private readonly queueName;
8
9
  private readonly options;
9
- private queue;
10
10
  constructor(queueName: string, options: Options);
11
11
  enqueueJob(event: EventEntity): Promise<void>;
12
12
  enqueueBatchJobs(events: EventEntity[]): Promise<void>;
@@ -27,6 +27,9 @@ module.exports = __toCommonJS(producers_exports);
27
27
  // producers/bullMqWorker.producer.ts
28
28
  var import_bullmq = require("bullmq");
29
29
  var BullMqWorkerProducer = class {
30
+ queue;
31
+ queueName;
32
+ options;
30
33
  constructor(queueName, options) {
31
34
  this.queueName = queueName;
32
35
  this.options = options;
@@ -34,7 +37,6 @@ var BullMqWorkerProducer = class {
34
37
  connection: this.options.queueOptions.connection
35
38
  });
36
39
  }
37
- queue;
38
40
  async enqueueJob(event) {
39
41
  await this.queue.add(event.id, event, {
40
42
  attempts: this.options.retries,
@@ -1,6 +1,9 @@
1
1
  // producers/bullMqWorker.producer.ts
2
2
  import { Queue } from "bullmq";
3
3
  var BullMqWorkerProducer = class {
4
+ queue;
5
+ queueName;
6
+ options;
4
7
  constructor(queueName, options) {
5
8
  this.queueName = queueName;
6
9
  this.options = options;
@@ -8,7 +11,6 @@ var BullMqWorkerProducer = class {
8
11
  connection: this.options.queueOptions.connection
9
12
  });
10
13
  }
11
- queue;
12
14
  async enqueueJob(event) {
13
15
  await this.queue.add(event.id, event, {
14
16
  attempts: this.options.retries,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-bullmq",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "BullMQ implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -42,20 +42,20 @@
42
42
  "lib/**"
43
43
  ],
44
44
  "dependencies": {
45
- "@forklaunch/core": "^0.12.0",
46
- "@forklaunch/internal": "^0.1.9",
47
- "@sinclair/typebox": "^0.34.38",
48
- "bullmq": "^5.56.9",
49
- "zod": "^4.0.14",
50
- "@forklaunch/interfaces-worker": "0.4.0"
45
+ "@forklaunch/core": "^0.13.0",
46
+ "@forklaunch/internal": "^0.2.0",
47
+ "@sinclair/typebox": "^0.34.40",
48
+ "bullmq": "^5.58.0",
49
+ "zod": "^4.0.17",
50
+ "@forklaunch/interfaces-worker": "0.4.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@typescript/native-preview": "7.0.0-dev.20250803.1",
53
+ "@typescript/native-preview": "7.0.0-dev.20250820.1",
54
54
  "depcheck": "^1.4.7",
55
- "eslint": "^9.32.0",
55
+ "eslint": "^9.33.0",
56
56
  "prettier": "^3.6.2",
57
- "typedoc": "^0.28.9",
58
- "typescript-eslint": "^8.38.0"
57
+ "typedoc": "^0.28.10",
58
+ "typescript-eslint": "^8.40.0"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsc --noEmit && tsup producers/index.ts consumers/index.ts domain/schemas/index.ts domain/types/index.ts --format cjs,esm --no-splitting --dts --tsconfig tsconfig.json --out-dir lib --clean && if [ -f eject-package.bash ]; then pnpm package:eject; fi",