@forklaunch/implementation-worker-bullmq 0.2.2 → 0.3.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/lib/consumers/index.d.mts +19 -0
- package/lib/consumers/index.d.ts +19 -2
- package/lib/consumers/index.js +73 -1
- package/lib/consumers/{bullMqWorker.consumer.js → index.mjs} +11 -11
- package/lib/producers/index.d.mts +15 -0
- package/lib/producers/index.d.ts +15 -2
- package/lib/producers/index.js +66 -1
- package/lib/producers/{bullMqWorker.producer.js → index.mjs} +8 -6
- package/lib/schemas/index.d.mts +390 -0
- package/lib/schemas/index.d.ts +390 -2
- package/lib/schemas/index.js +1613 -1
- package/lib/schemas/index.mjs +1617 -0
- package/lib/types/index.d.mts +9 -0
- package/lib/types/index.d.ts +9 -2
- package/lib/types/index.js +18 -1
- package/lib/types/index.mjs +0 -0
- package/package.json +6 -5
- package/lib/__test__/schemaEquality.test.d.ts +0 -2
- package/lib/__test__/schemaEquality.test.d.ts.map +0 -1
- package/lib/__test__/schemaEquality.test.js +0 -24
- package/lib/consumers/bullMqWorker.consumer.d.ts +0 -29
- package/lib/consumers/bullMqWorker.consumer.d.ts.map +0 -1
- package/lib/consumers/index.d.ts.map +0 -1
- package/lib/jest.config.d.ts +0 -4
- package/lib/jest.config.d.ts.map +0 -1
- package/lib/jest.config.js +0 -19
- package/lib/producers/bullMqWorker.producer.d.ts +0 -16
- package/lib/producers/bullMqWorker.producer.d.ts.map +0 -1
- package/lib/producers/index.d.ts.map +0 -1
- package/lib/schemas/bullMqWorker.schema.d.ts +0 -2117
- package/lib/schemas/bullMqWorker.schema.d.ts.map +0 -1
- package/lib/schemas/bullMqWorker.schema.js +0 -7
- package/lib/schemas/index.d.ts.map +0 -1
- package/lib/schemas/typebox/bullMqWorker.schema.d.ts +0 -1016
- package/lib/schemas/typebox/bullMqWorker.schema.d.ts.map +0 -1
- package/lib/schemas/typebox/bullMqWorker.schema.js +0 -145
- package/lib/schemas/zod/bullMqWorker.schema.d.ts +0 -1066
- package/lib/schemas/zod/bullMqWorker.schema.d.ts.map +0 -1
- package/lib/schemas/zod/bullMqWorker.schema.js +0 -145
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/bullMqWorker.types.d.ts +0 -7
- package/lib/types/bullMqWorker.types.d.ts.map +0 -1
- package/lib/types/bullMqWorker.types.js +0 -1
- package/lib/types/index.d.ts.map +0 -1
- package/lib/vitest.config.d.ts +0 -3
- package/lib/vitest.config.d.ts.map +0 -1
- package/lib/vitest.config.js +0 -7
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { QueueOptions } from 'bullmq';
|
|
2
|
+
|
|
3
|
+
type BullMqWorkerOptions = QueueOptions & {
|
|
4
|
+
backoffType: 'exponential' | 'fixed';
|
|
5
|
+
retries: number;
|
|
6
|
+
interval: number;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type { BullMqWorkerOptions };
|
package/lib/types/index.js
CHANGED
|
@@ -1 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// types/index.ts
|
|
17
|
+
var types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(types_exports);
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-worker-bullmq",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "BullMQ implementation for forklaunch workers",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -38,13 +38,14 @@
|
|
|
38
38
|
"lib/**"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@forklaunch/core": "^0.9.
|
|
41
|
+
"@forklaunch/core": "^0.9.13",
|
|
42
42
|
"@sinclair/typebox": "^0.34.33",
|
|
43
43
|
"bullmq": "^5.53.2",
|
|
44
|
-
"zod": "^3.25.
|
|
45
|
-
"@forklaunch/interfaces-worker": "0.
|
|
44
|
+
"zod": "^3.25.62",
|
|
45
|
+
"@forklaunch/interfaces-worker": "0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
+
"@typescript/native-preview": "7.0.0-dev.20250611.1",
|
|
48
49
|
"depcheck": "^1.4.7",
|
|
49
50
|
"eslint": "^9.28.0",
|
|
50
51
|
"prettier": "^3.5.3",
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
"typescript-eslint": "^8.34.0"
|
|
53
54
|
},
|
|
54
55
|
"scripts": {
|
|
55
|
-
"build": "tsc && if [ -f eject-package.bash ]; then pnpm package:eject; fi",
|
|
56
|
+
"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",
|
|
56
57
|
"clean": "rm -rf lib pnpm.lock.yaml node_modules",
|
|
57
58
|
"docs": "typedoc --out docs *",
|
|
58
59
|
"format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemaEquality.test.d.ts","sourceRoot":"","sources":["../../__test__/schemaEquality.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { isTrue } from '@forklaunch/common';
|
|
2
|
-
import { testSchemaEquality } from '@forklaunch/core/test';
|
|
3
|
-
import { BullMqWorkerOptionsSchema as TypeboxBullMqWorkerOptionsSchema } from '../schemas/typebox/bullMqWorker.schema';
|
|
4
|
-
import { BullMqWorkerOptionsSchema as ZodBullMqWorkerOptionsSchema } from '../schemas/zod/bullMqWorker.schema';
|
|
5
|
-
describe('schema equality', () => {
|
|
6
|
-
it('should be equal for bullmq worker', () => {
|
|
7
|
-
expect(
|
|
8
|
-
isTrue(
|
|
9
|
-
testSchemaEquality(
|
|
10
|
-
ZodBullMqWorkerOptionsSchema,
|
|
11
|
-
TypeboxBullMqWorkerOptionsSchema,
|
|
12
|
-
{
|
|
13
|
-
backoffType: 'fixed',
|
|
14
|
-
retries: 1,
|
|
15
|
-
interval: 1000,
|
|
16
|
-
connection: {
|
|
17
|
-
url: 'redis://localhost:6379'
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
)
|
|
22
|
-
).toBeTruthy();
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { WorkerConsumer } from '@forklaunch/interfaces-worker/interfaces';
|
|
2
|
-
import {
|
|
3
|
-
WorkerEventEntity,
|
|
4
|
-
WorkerFailureHandler,
|
|
5
|
-
WorkerProcessFunction
|
|
6
|
-
} from '@forklaunch/interfaces-worker/types';
|
|
7
|
-
import { BullMqWorkerOptions } from '../types/bullMqWorker.types';
|
|
8
|
-
export declare class BullMqWorkerConsumer<
|
|
9
|
-
EventEntity extends WorkerEventEntity,
|
|
10
|
-
Options extends BullMqWorkerOptions
|
|
11
|
-
> implements WorkerConsumer<EventEntity>
|
|
12
|
-
{
|
|
13
|
-
protected readonly queueName: string;
|
|
14
|
-
protected readonly options: Options;
|
|
15
|
-
protected readonly processEvents: WorkerProcessFunction<EventEntity>;
|
|
16
|
-
protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
|
|
17
|
-
private queue;
|
|
18
|
-
private worker?;
|
|
19
|
-
constructor(
|
|
20
|
-
queueName: string,
|
|
21
|
-
options: Options,
|
|
22
|
-
processEvents: WorkerProcessFunction<EventEntity>,
|
|
23
|
-
failureHandler: WorkerFailureHandler<EventEntity>
|
|
24
|
-
);
|
|
25
|
-
peekEvents(): Promise<EventEntity[]>;
|
|
26
|
-
start(): Promise<void>;
|
|
27
|
-
close(): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=bullMqWorker.consumer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bullMqWorker.consumer.d.ts","sourceRoot":"","sources":["../../consumers/bullMqWorker.consumer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAa,oBAAoB,CAC/B,WAAW,SAAS,iBAAiB,EACrC,OAAO,SAAS,mBAAmB,CACnC,YAAW,cAAc,CAAC,WAAW,CAAC;IAMpC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM;IACpC,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO;IACnC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC,WAAW,CAAC;IACpE,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAPtE,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,MAAM,CAAC,CAAS;gBAGH,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,qBAAqB,CAAC,WAAW,CAAC,EACjD,cAAc,EAAE,oBAAoB,CAAC,WAAW,CAAC;IAOhE,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAKpC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../consumers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|
package/lib/jest.config.d.ts
DELETED
package/lib/jest.config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,QAAA,MAAM,UAAU,EAAE,oBAiBjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/lib/jest.config.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const jestConfig = {
|
|
2
|
-
preset: 'ts-jest/presets/default-esm', // or other ESM presets
|
|
3
|
-
moduleNameMapper: {
|
|
4
|
-
'^(\\.{1,2}/.*)\\.js$': '$1'
|
|
5
|
-
},
|
|
6
|
-
transform: {
|
|
7
|
-
// '^.+\\.[tj]sx?$' to process ts,js,tsx,jsx with `ts-jest`
|
|
8
|
-
// '^.+\\.m?[tj]sx?$' to process ts,js,tsx,jsx,mts,mjs,mtsx,mjsx with `ts-jest`
|
|
9
|
-
'^.+\\.[tj]sx?$': [
|
|
10
|
-
'ts-jest',
|
|
11
|
-
{
|
|
12
|
-
useESM: true
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
'^.+\\.js$': 'babel-jest'
|
|
16
|
-
},
|
|
17
|
-
testPathIgnorePatterns: ['.*dist/', '.*node_modules/']
|
|
18
|
-
};
|
|
19
|
-
export default jestConfig;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { WorkerProducer } from '@forklaunch/interfaces-worker/interfaces';
|
|
2
|
-
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
3
|
-
import { BullMqWorkerOptions } from '../types/bullMqWorker.types';
|
|
4
|
-
export declare class BullMqWorkerProducer<
|
|
5
|
-
EventEntity extends WorkerEventEntity,
|
|
6
|
-
Options extends BullMqWorkerOptions
|
|
7
|
-
> implements WorkerProducer<EventEntity>
|
|
8
|
-
{
|
|
9
|
-
private readonly queueName;
|
|
10
|
-
private readonly options;
|
|
11
|
-
private queue;
|
|
12
|
-
constructor(queueName: string, options: Options);
|
|
13
|
-
enqueueJob(event: EventEntity): Promise<void>;
|
|
14
|
-
enqueueBatchJobs(events: EventEntity[]): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=bullMqWorker.producer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bullMqWorker.producer.d.ts","sourceRoot":"","sources":["../../producers/bullMqWorker.producer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAa,oBAAoB,CAC/B,WAAW,SAAS,iBAAiB,EACrC,OAAO,SAAS,mBAAmB,CACnC,YAAW,cAAc,CAAC,WAAW,CAAC;IAKpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJ1B,OAAO,CAAC,KAAK,CAAC;gBAGK,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO;IAO7B,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7C,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAe7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../producers/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
|