@forklaunch/implementation-worker-database 0.5.0 → 0.5.1

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.
@@ -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;
@@ -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;
@@ -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
- protected readonly entityName: EntityName<EventEntity>,
17
- protected readonly em: EntityManager,
18
- protected readonly options: Options,
19
- protected readonly processEvents: WorkerProcessFunction<EventEntity>,
20
- protected readonly failureHandler: WorkerFailureHandler<EventEntity>
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
- constructor(
10
- private readonly em: EntityManager,
11
- private readonly options: Options
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);
@@ -26,6 +26,8 @@ module.exports = __toCommonJS(producers_exports);
26
26
 
27
27
  // producers/databaseWorker.producer.ts
28
28
  var DatabaseWorkerProducer = class {
29
+ em;
30
+ options;
29
31
  constructor(em, options) {
30
32
  this.em = em;
31
33
  this.options = options;
@@ -1,5 +1,7 @@
1
1
  // producers/databaseWorker.producer.ts
2
2
  var DatabaseWorkerProducer = class {
3
+ em;
4
+ options;
3
5
  constructor(em, options) {
4
6
  this.em = em;
5
7
  this.options = options;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-database",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Database implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {