@forklaunch/implementation-worker-database 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.
- package/lib/consumers/index.js +5 -0
- package/lib/consumers/index.mjs +5 -0
- package/lib/domain/schemas/index.js +5 -5
- package/lib/domain/schemas/index.mjs +5 -5
- package/lib/eject/consumers/databaseWorker.consumer.ts +18 -6
- package/lib/eject/producers/databaseWorker.producer.ts +7 -4
- package/lib/producers/index.js +2 -0
- package/lib/producers/index.mjs +2 -0
- package/package.json +10 -10
package/lib/consumers/index.js
CHANGED
|
@@ -26,6 +26,11 @@ module.exports = __toCommonJS(consumers_exports);
|
|
|
26
26
|
|
|
27
27
|
// consumers/databaseWorker.consumer.ts
|
|
28
28
|
var DatabaseWorkerConsumer = class {
|
|
29
|
+
entityName;
|
|
30
|
+
em;
|
|
31
|
+
options;
|
|
32
|
+
processEvents;
|
|
33
|
+
failureHandler;
|
|
29
34
|
constructor(entityName, em, options, processEvents, failureHandler) {
|
|
30
35
|
this.entityName = entityName;
|
|
31
36
|
this.em = em;
|
package/lib/consumers/index.mjs
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// consumers/databaseWorker.consumer.ts
|
|
2
2
|
var DatabaseWorkerConsumer = class {
|
|
3
|
+
entityName;
|
|
4
|
+
em;
|
|
5
|
+
options;
|
|
6
|
+
processEvents;
|
|
7
|
+
failureHandler;
|
|
3
8
|
constructor(entityName, em, options, processEvents, failureHandler) {
|
|
4
9
|
this.entityName = entityName;
|
|
5
10
|
this.em = em;
|
|
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(schemas_exports);
|
|
|
28
28
|
// domain/schemas/databaseWorker.schema.ts
|
|
29
29
|
var import_internal = require("@forklaunch/internal");
|
|
30
30
|
|
|
31
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.
|
|
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.
|
|
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.
|
|
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");
|
|
@@ -582,7 +582,7 @@ var DatabaseWorkerOptionsSchema = {
|
|
|
582
582
|
interval: number
|
|
583
583
|
};
|
|
584
584
|
|
|
585
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.
|
|
585
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
586
586
|
var import_v3 = require("zod/v3");
|
|
587
587
|
|
|
588
588
|
// ../../../node_modules/.pnpm/ts-deepmerge@7.0.3/node_modules/ts-deepmerge/esm/index.js
|
|
@@ -632,7 +632,7 @@ merge.withOptions = (options, ...objects) => {
|
|
|
632
632
|
return result;
|
|
633
633
|
};
|
|
634
634
|
|
|
635
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.
|
|
635
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
636
636
|
var import_v32 = require("zod/v3");
|
|
637
637
|
function extendApi(schema, schemaObject = {}) {
|
|
638
638
|
const This = schema.constructor;
|
|
@@ -19,7 +19,7 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
19
19
|
// domain/schemas/databaseWorker.schema.ts
|
|
20
20
|
import { serviceSchemaResolver } from "@forklaunch/internal";
|
|
21
21
|
|
|
22
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.
|
|
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.
|
|
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.
|
|
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,
|
|
@@ -583,7 +583,7 @@ var DatabaseWorkerOptionsSchema = {
|
|
|
583
583
|
interval: number
|
|
584
584
|
};
|
|
585
585
|
|
|
586
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.
|
|
586
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
587
587
|
import {
|
|
588
588
|
z as z2,
|
|
589
589
|
ZodType
|
|
@@ -636,7 +636,7 @@ merge.withOptions = (options, ...objects) => {
|
|
|
636
636
|
return result;
|
|
637
637
|
};
|
|
638
638
|
|
|
639
|
-
// ../../../node_modules/.pnpm/@forklaunch+validator@0.
|
|
639
|
+
// ../../../node_modules/.pnpm/@forklaunch+validator@0.9.0/node_modules/@forklaunch/validator/lib/src/zod/index.mjs
|
|
640
640
|
import { z } from "zod/v3";
|
|
641
641
|
function extendApi(schema, schemaObject = {}) {
|
|
642
642
|
const This = schema.constructor;
|
|
@@ -12,13 +12,25 @@ export class DatabaseWorkerConsumer<
|
|
|
12
12
|
Options extends DatabaseWorkerOptions
|
|
13
13
|
> implements WorkerConsumer<EventEntity>
|
|
14
14
|
{
|
|
15
|
+
protected readonly entityName: EntityName<EventEntity>;
|
|
16
|
+
protected readonly em: EntityManager;
|
|
17
|
+
protected readonly options: Options;
|
|
18
|
+
protected readonly processEvents: WorkerProcessFunction<EventEntity>;
|
|
19
|
+
protected readonly failureHandler: WorkerFailureHandler<EventEntity>;
|
|
20
|
+
|
|
15
21
|
constructor(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
) {
|
|
22
|
+
entityName: EntityName<EventEntity>,
|
|
23
|
+
em: EntityManager,
|
|
24
|
+
options: Options,
|
|
25
|
+
processEvents: WorkerProcessFunction<EventEntity>,
|
|
26
|
+
failureHandler: WorkerFailureHandler<EventEntity>
|
|
27
|
+
) {
|
|
28
|
+
this.entityName = entityName;
|
|
29
|
+
this.em = em;
|
|
30
|
+
this.options = options;
|
|
31
|
+
this.processEvents = processEvents;
|
|
32
|
+
this.failureHandler = failureHandler;
|
|
33
|
+
}
|
|
22
34
|
|
|
23
35
|
private async retrieveEvents(): Promise<EventEntity[]> {
|
|
24
36
|
return this.em.getRepository(this.entityName).find(
|
|
@@ -6,10 +6,13 @@ export class DatabaseWorkerProducer<
|
|
|
6
6
|
EventEntity extends WorkerEventEntity & BaseEntity,
|
|
7
7
|
Options extends DatabaseWorkerOptions
|
|
8
8
|
> {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
) {
|
|
9
|
+
private readonly em: EntityManager;
|
|
10
|
+
private readonly options: Options;
|
|
11
|
+
|
|
12
|
+
constructor(em: EntityManager, options: Options) {
|
|
13
|
+
this.em = em;
|
|
14
|
+
this.options = options;
|
|
15
|
+
}
|
|
13
16
|
|
|
14
17
|
async enqueueJob(event: EventEntity): Promise<void> {
|
|
15
18
|
await this.em.persistAndFlush(event);
|
package/lib/producers/index.js
CHANGED
package/lib/producers/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/implementation-worker-database",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Database 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.
|
|
46
|
-
"@forklaunch/internal": "^0.
|
|
45
|
+
"@forklaunch/core": "^0.13.0",
|
|
46
|
+
"@forklaunch/internal": "^0.2.0",
|
|
47
47
|
"@mikro-orm/core": "^6.4.16",
|
|
48
|
-
"@sinclair/typebox": "^0.34.
|
|
49
|
-
"zod": "^4.0.
|
|
50
|
-
"@forklaunch/interfaces-worker": "0.4.
|
|
48
|
+
"@sinclair/typebox": "^0.34.40",
|
|
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.
|
|
53
|
+
"@typescript/native-preview": "7.0.0-dev.20250820.1",
|
|
54
54
|
"depcheck": "^1.4.7",
|
|
55
|
-
"eslint": "^9.
|
|
55
|
+
"eslint": "^9.33.0",
|
|
56
56
|
"prettier": "^3.6.2",
|
|
57
|
-
"typedoc": "^0.28.
|
|
58
|
-
"typescript-eslint": "^8.
|
|
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",
|