@forklaunch/implementation-worker-bullmq 0.3.2 → 0.3.3

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.
@@ -0,0 +1,10 @@
1
+ import { QueueOptions } from 'bullmq';
2
+
3
+ type BullMqWorkerOptions = {
4
+ queueOptions: QueueOptions;
5
+ backoffType: 'exponential' | 'fixed';
6
+ retries: number;
7
+ interval: number;
8
+ };
9
+
10
+ export type { BullMqWorkerOptions };
@@ -0,0 +1,10 @@
1
+ import { QueueOptions } from 'bullmq';
2
+
3
+ type BullMqWorkerOptions = {
4
+ queueOptions: QueueOptions;
5
+ backoffType: 'exponential' | 'fixed';
6
+ retries: number;
7
+ interval: number;
8
+ };
9
+
10
+ export type { BullMqWorkerOptions };
@@ -1,18 +1,22 @@
1
- "use strict";
1
+ 'use strict';
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
7
+ if ((from && typeof from === 'object') || typeof from === 'function') {
8
8
  for (let key of __getOwnPropNames(from))
9
9
  if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ __defProp(to, key, {
11
+ get: () => from[key],
12
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
13
+ });
11
14
  }
12
15
  return to;
13
16
  };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
17
+ var __toCommonJS = (mod) =>
18
+ __copyProps(__defProp({}, '__esModule', { value: true }), mod);
15
19
 
16
- // types/index.ts
20
+ // domain/types/index.ts
17
21
  var types_exports = {};
18
22
  module.exports = __toCommonJS(types_exports);
@@ -5,7 +5,7 @@ import {
5
5
  WorkerProcessFunction
6
6
  } from '@forklaunch/interfaces-worker/types';
7
7
  import { Job, Queue, Worker } from 'bullmq';
8
- import { BullMqWorkerOptions } from '../types/bullMqWorker.types';
8
+ import { BullMqWorkerOptions } from '../domain/types/bullMqWorker.types';
9
9
 
10
10
  export class BullMqWorkerConsumer<
11
11
  EventEntity extends WorkerEventEntity,
@@ -1,7 +1,7 @@
1
1
  import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
2
2
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
3
3
  import { Queue } from 'bullmq';
4
- import { BullMqWorkerOptions } from '../types/bullMqWorker.types';
4
+ import { BullMqWorkerOptions } from '../domain/types/bullMqWorker.types';
5
5
 
6
6
  export class BullMqWorkerProducer<
7
7
  EventEntity extends WorkerEventEntity,
@@ -1,15 +1,19 @@
1
1
  import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
2
2
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
3
- import { BullMqWorkerOptions } from '../types/index.mjs';
3
+ import { BullMqWorkerOptions } from '../domain/types/index.mjs';
4
4
  import 'bullmq';
5
5
 
6
- declare class BullMqWorkerProducer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerProducer<EventEntity> {
7
- private readonly queueName;
8
- private readonly options;
9
- private queue;
10
- constructor(queueName: string, options: Options);
11
- enqueueJob(event: EventEntity): Promise<void>;
12
- enqueueBatchJobs(events: EventEntity[]): Promise<void>;
6
+ declare class BullMqWorkerProducer<
7
+ EventEntity extends WorkerEventEntity,
8
+ Options extends BullMqWorkerOptions
9
+ > implements WorkerProducer<EventEntity>
10
+ {
11
+ private readonly queueName;
12
+ private readonly options;
13
+ private queue;
14
+ constructor(queueName: string, options: Options);
15
+ enqueueJob(event: EventEntity): Promise<void>;
16
+ enqueueBatchJobs(events: EventEntity[]): Promise<void>;
13
17
  }
14
18
 
15
19
  export { BullMqWorkerProducer };
@@ -1,15 +1,19 @@
1
1
  import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
2
2
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
3
- import { BullMqWorkerOptions } from '../types/index.js';
3
+ import { BullMqWorkerOptions } from '../domain/types/index.js';
4
4
  import 'bullmq';
5
5
 
6
- declare class BullMqWorkerProducer<EventEntity extends WorkerEventEntity, Options extends BullMqWorkerOptions> implements WorkerProducer<EventEntity> {
7
- private readonly queueName;
8
- private readonly options;
9
- private queue;
10
- constructor(queueName: string, options: Options);
11
- enqueueJob(event: EventEntity): Promise<void>;
12
- enqueueBatchJobs(events: EventEntity[]): Promise<void>;
6
+ declare class BullMqWorkerProducer<
7
+ EventEntity extends WorkerEventEntity,
8
+ Options extends BullMqWorkerOptions
9
+ > implements WorkerProducer<EventEntity>
10
+ {
11
+ private readonly queueName;
12
+ private readonly options;
13
+ private queue;
14
+ constructor(queueName: string, options: Options);
15
+ enqueueJob(event: EventEntity): Promise<void>;
16
+ enqueueBatchJobs(events: EventEntity[]): Promise<void>;
13
17
  }
14
18
 
15
19
  export { BullMqWorkerProducer };
@@ -1,4 +1,4 @@
1
- "use strict";
1
+ 'use strict';
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -8,14 +8,18 @@ var __export = (target, all) => {
8
8
  __defProp(target, name, { get: all[name], enumerable: true });
9
9
  };
10
10
  var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
11
+ if ((from && typeof from === 'object') || typeof from === 'function') {
12
12
  for (let key of __getOwnPropNames(from))
13
13
  if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
15
18
  }
16
19
  return to;
17
20
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __toCommonJS = (mod) =>
22
+ __copyProps(__defProp({}, '__esModule', { value: true }), mod);
19
23
 
20
24
  // producers/index.ts
21
25
  var producers_exports = {};
@@ -25,7 +29,7 @@ __export(producers_exports, {
25
29
  module.exports = __toCommonJS(producers_exports);
26
30
 
27
31
  // producers/bullMqWorker.producer.ts
28
- var import_bullmq = require("bullmq");
32
+ var import_bullmq = require('bullmq');
29
33
  var BullMqWorkerProducer = class {
30
34
  constructor(queueName, options) {
31
35
  this.queueName = queueName;
@@ -61,6 +65,7 @@ var BullMqWorkerProducer = class {
61
65
  }
62
66
  };
63
67
  // Annotate the CommonJS export names for ESM import in node:
64
- 0 && (module.exports = {
65
- BullMqWorkerProducer
66
- });
68
+ 0 &&
69
+ (module.exports = {
70
+ BullMqWorkerProducer
71
+ });
@@ -1,5 +1,5 @@
1
1
  // producers/bullMqWorker.producer.ts
2
- import { Queue } from "bullmq";
2
+ import { Queue } from 'bullmq';
3
3
  var BullMqWorkerProducer = class {
4
4
  constructor(queueName, options) {
5
5
  this.queueName = queueName;
@@ -34,6 +34,4 @@ var BullMqWorkerProducer = class {
34
34
  );
35
35
  }
36
36
  };
37
- export {
38
- BullMqWorkerProducer
39
- };
37
+ export { BullMqWorkerProducer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-bullmq",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "BullMQ implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -26,16 +26,16 @@
26
26
  "default": "./lib/producers/index.js"
27
27
  },
28
28
  "./schemas": {
29
- "types": "./lib/schemas/index.d.ts",
30
- "import": "./lib/schemas/index.mjs",
31
- "require": "./lib/schemas/index.js",
32
- "default": "./lib/schemas/index.js"
29
+ "types": "./lib/domain/schemas/index.d.ts",
30
+ "import": "./lib/domain/schemas/index.mjs",
31
+ "require": "./lib/domain/schemas/index.js",
32
+ "default": "./lib/domain/schemas/index.js"
33
33
  },
34
34
  "./types": {
35
- "types": "./lib/types/index.d.ts",
36
- "import": "./lib/types/index.mjs",
37
- "require": "./lib/types/index.js",
38
- "default": "./lib/types/index.js"
35
+ "types": "./lib/domain/types/index.d.ts",
36
+ "import": "./lib/domain/types/index.mjs",
37
+ "require": "./lib/domain/types/index.js",
38
+ "default": "./lib/domain/types/index.js"
39
39
  }
40
40
  },
41
41
  "files": [
@@ -58,7 +58,7 @@
58
58
  "typescript-eslint": "^8.34.1"
59
59
  },
60
60
  "scripts": {
61
- "build": "tsc --noEmit && tsup producers/index.ts consumers/index.ts schemas/index.ts 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",
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",
62
62
  "clean": "rm -rf lib pnpm.lock.yaml node_modules",
63
63
  "docs": "typedoc --out docs *",
64
64
  "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
@@ -1,21 +0,0 @@
1
- import * as _forklaunch_internal from '@forklaunch/internal';
2
- import * as zod from 'zod';
3
- import * as bullmq from 'bullmq';
4
- import * as _sinclair_typebox from '@sinclair/typebox';
5
- import * as _forklaunch_validator from '@forklaunch/validator';
6
-
7
- declare const BullMqWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
8
- validator: SchemaValidator;
9
- }) => _forklaunch_internal.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
10
- queueOptions: _sinclair_typebox.TTransform<_sinclair_typebox.TAny, bullmq.QueueOptions>;
11
- backoffType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"exponential">, _sinclair_typebox.TLiteral<"fixed">]>;
12
- retries: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
13
- interval: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
14
- }, (options: Record<string, unknown>) => {
15
- queueOptions: zod.ZodType<bullmq.QueueOptions, zod.ZodTypeDef, bullmq.QueueOptions>;
16
- backoffType: zod.ZodUnion<[zod.ZodLiteral<"exponential">, zod.ZodLiteral<"fixed">]>;
17
- retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
18
- interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
19
- }>;
20
-
21
- export { BullMqWorkerSchemas };
@@ -1,21 +0,0 @@
1
- import * as _forklaunch_internal from '@forklaunch/internal';
2
- import * as zod from 'zod';
3
- import * as bullmq from 'bullmq';
4
- import * as _sinclair_typebox from '@sinclair/typebox';
5
- import * as _forklaunch_validator from '@forklaunch/validator';
6
-
7
- declare const BullMqWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
8
- validator: SchemaValidator;
9
- }) => _forklaunch_internal.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
10
- queueOptions: _sinclair_typebox.TTransform<_sinclair_typebox.TAny, bullmq.QueueOptions>;
11
- backoffType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"exponential">, _sinclair_typebox.TLiteral<"fixed">]>;
12
- retries: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
13
- interval: _sinclair_typebox.TTransform<_sinclair_typebox.TUnion<[_sinclair_typebox.TNumber, _sinclair_typebox.TString, _sinclair_typebox.TBoolean, _sinclair_typebox.TNull, _sinclair_typebox.TBigInt, _sinclair_typebox.TDate]>, number>;
14
- }, (options: Record<string, unknown>) => {
15
- queueOptions: zod.ZodType<bullmq.QueueOptions, zod.ZodTypeDef, bullmq.QueueOptions>;
16
- backoffType: zod.ZodUnion<[zod.ZodLiteral<"exponential">, zod.ZodLiteral<"fixed">]>;
17
- retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
18
- interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
19
- }>;
20
-
21
- export { BullMqWorkerSchemas };
@@ -1,10 +0,0 @@
1
- import { QueueOptions } from 'bullmq';
2
-
3
- type BullMqWorkerOptions = {
4
- queueOptions: QueueOptions;
5
- backoffType: 'exponential' | 'fixed';
6
- retries: number;
7
- interval: number;
8
- };
9
-
10
- export type { BullMqWorkerOptions };
@@ -1,10 +0,0 @@
1
- import { QueueOptions } from 'bullmq';
2
-
3
- type BullMqWorkerOptions = {
4
- queueOptions: QueueOptions;
5
- backoffType: 'exponential' | 'fixed';
6
- retries: number;
7
- interval: number;
8
- };
9
-
10
- export type { BullMqWorkerOptions };
File without changes
File without changes