@forklaunch/implementation-worker-kafka 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.
- package/lib/consumers/index.d.mts +29 -16
- package/lib/consumers/index.d.ts +29 -16
- package/lib/consumers/index.js +14 -11
- package/lib/consumers/index.mjs +3 -7
- package/lib/domain/schemas/index.d.mts +68 -0
- package/lib/domain/schemas/index.d.ts +68 -0
- package/lib/{schemas → domain/schemas}/index.js +865 -494
- package/lib/{schemas → domain/schemas}/index.mjs +841 -501
- package/lib/domain/types/index.d.mts +10 -0
- package/lib/domain/types/index.d.ts +10 -0
- package/lib/{types → domain/types}/index.js +9 -5
- package/lib/eject/consumers/kafkaWorker.consumer.ts +1 -1
- package/lib/eject/producers/kafkaWorker.producer.ts +1 -1
- package/lib/producers/index.d.mts +11 -8
- package/lib/producers/index.d.ts +11 -8
- package/lib/producers/index.js +13 -8
- package/lib/producers/index.mjs +2 -4
- package/package.json +10 -10
- package/lib/schemas/index.d.mts +0 -24
- package/lib/schemas/index.d.ts +0 -24
- package/lib/types/index.d.mts +0 -10
- package/lib/types/index.d.ts +0 -10
- /package/lib/{types → domain/types}/index.mjs +0 -0
- /package/lib/eject/{types → domain/types}/index.ts +0 -0
- /package/lib/eject/{types → domain/types}/kafkaWorker.types.ts +0 -0
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
|
|
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 ===
|
|
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, {
|
|
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) =>
|
|
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 { Consumer, Kafka, Producer } from 'kafkajs';
|
|
8
|
-
import { KafkaWorkerOptions } from '../types/kafkaWorker.types';
|
|
8
|
+
import { KafkaWorkerOptions } from '../domain/types/kafkaWorker.types';
|
|
9
9
|
|
|
10
10
|
export class KafkaWorkerConsumer<
|
|
11
11
|
EventEntity extends WorkerEventEntity,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
2
2
|
import { Kafka } from 'kafkajs';
|
|
3
|
-
import { KafkaWorkerOptions } from '../types/kafkaWorker.types';
|
|
3
|
+
import { KafkaWorkerOptions } from '../domain/types/kafkaWorker.types';
|
|
4
4
|
export class KafkaWorkerProducer<
|
|
5
5
|
EventEntity extends WorkerEventEntity,
|
|
6
6
|
Options extends KafkaWorkerOptions
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
2
|
-
import { KafkaWorkerOptions } from '../types/index.mjs';
|
|
2
|
+
import { KafkaWorkerOptions } from '../domain/types/index.mjs';
|
|
3
3
|
|
|
4
|
-
declare class KafkaWorkerProducer<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
declare class KafkaWorkerProducer<
|
|
5
|
+
EventEntity extends WorkerEventEntity,
|
|
6
|
+
Options extends KafkaWorkerOptions
|
|
7
|
+
> {
|
|
8
|
+
private readonly queueName;
|
|
9
|
+
private readonly options;
|
|
10
|
+
private producer;
|
|
11
|
+
constructor(queueName: string, options: Options);
|
|
12
|
+
enqueueJob(event: EventEntity): Promise<void>;
|
|
13
|
+
enqueueBatchJobs(events: EventEntity[]): Promise<void>;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export { KafkaWorkerProducer };
|
package/lib/producers/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
|
|
2
|
-
import { KafkaWorkerOptions } from '../types/index.js';
|
|
2
|
+
import { KafkaWorkerOptions } from '../domain/types/index.js';
|
|
3
3
|
|
|
4
|
-
declare class KafkaWorkerProducer<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
declare class KafkaWorkerProducer<
|
|
5
|
+
EventEntity extends WorkerEventEntity,
|
|
6
|
+
Options extends KafkaWorkerOptions
|
|
7
|
+
> {
|
|
8
|
+
private readonly queueName;
|
|
9
|
+
private readonly options;
|
|
10
|
+
private producer;
|
|
11
|
+
constructor(queueName: string, options: Options);
|
|
12
|
+
enqueueJob(event: EventEntity): Promise<void>;
|
|
13
|
+
enqueueBatchJobs(events: EventEntity[]): Promise<void>;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
export { KafkaWorkerProducer };
|
package/lib/producers/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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 ===
|
|
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, {
|
|
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) =>
|
|
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/kafkaWorker.producer.ts
|
|
28
|
-
var import_kafkajs = require(
|
|
32
|
+
var import_kafkajs = require('kafkajs');
|
|
29
33
|
var KafkaWorkerProducer = class {
|
|
30
34
|
constructor(queueName, options) {
|
|
31
35
|
this.queueName = queueName;
|
|
@@ -52,6 +56,7 @@ var KafkaWorkerProducer = class {
|
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 &&
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
0 &&
|
|
60
|
+
(module.exports = {
|
|
61
|
+
KafkaWorkerProducer
|
|
62
|
+
});
|
package/lib/producers/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// producers/kafkaWorker.producer.ts
|
|
2
|
-
import { Kafka } from
|
|
2
|
+
import { Kafka } from 'kafkajs';
|
|
3
3
|
var KafkaWorkerProducer = class {
|
|
4
4
|
constructor(queueName, options) {
|
|
5
5
|
this.queueName = queueName;
|
|
@@ -25,6 +25,4 @@ var KafkaWorkerProducer = class {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
|
-
export {
|
|
29
|
-
KafkaWorkerProducer
|
|
30
|
-
};
|
|
28
|
+
export { KafkaWorkerProducer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-worker-kafka",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Kafka 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",
|
package/lib/schemas/index.d.mts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as _forklaunch_internal from '@forklaunch/internal';
|
|
2
|
-
import * as zod from 'zod';
|
|
3
|
-
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
-
import * as _forklaunch_validator from '@forklaunch/validator';
|
|
5
|
-
|
|
6
|
-
declare const KafkaWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
|
|
7
|
-
validator: SchemaValidator;
|
|
8
|
-
}) => _forklaunch_internal.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
|
|
9
|
-
brokers: _sinclair_typebox.TArray<_sinclair_typebox.TString>;
|
|
10
|
-
clientId: _sinclair_typebox.TString;
|
|
11
|
-
groupId: _sinclair_typebox.TString;
|
|
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
|
-
peekCount: _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>;
|
|
15
|
-
}, (options: Record<string, unknown>) => {
|
|
16
|
-
brokers: zod.ZodArray<zod.ZodString, "many">;
|
|
17
|
-
clientId: zod.ZodString;
|
|
18
|
-
groupId: zod.ZodString;
|
|
19
|
-
retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
20
|
-
interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
21
|
-
peekCount: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
22
|
-
}>;
|
|
23
|
-
|
|
24
|
-
export { KafkaWorkerSchemas };
|
package/lib/schemas/index.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as _forklaunch_internal from '@forklaunch/internal';
|
|
2
|
-
import * as zod from 'zod';
|
|
3
|
-
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
-
import * as _forklaunch_validator from '@forklaunch/validator';
|
|
5
|
-
|
|
6
|
-
declare const KafkaWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
|
|
7
|
-
validator: SchemaValidator;
|
|
8
|
-
}) => _forklaunch_internal.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
|
|
9
|
-
brokers: _sinclair_typebox.TArray<_sinclair_typebox.TString>;
|
|
10
|
-
clientId: _sinclair_typebox.TString;
|
|
11
|
-
groupId: _sinclair_typebox.TString;
|
|
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
|
-
peekCount: _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>;
|
|
15
|
-
}, (options: Record<string, unknown>) => {
|
|
16
|
-
brokers: zod.ZodArray<zod.ZodString, "many">;
|
|
17
|
-
clientId: zod.ZodString;
|
|
18
|
-
groupId: zod.ZodString;
|
|
19
|
-
retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
20
|
-
interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
21
|
-
peekCount: zod.ZodEffects<zod.ZodNumber, number, unknown>;
|
|
22
|
-
}>;
|
|
23
|
-
|
|
24
|
-
export { KafkaWorkerSchemas };
|
package/lib/types/index.d.mts
DELETED
package/lib/types/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|