@forklaunch/implementation-worker-database 0.3.1 → 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.
@@ -1,6 +1,6 @@
1
1
  type DatabaseWorkerOptions = {
2
- retries: number;
3
- interval: number;
2
+ retries: number;
3
+ interval: number;
4
4
  };
5
5
 
6
6
  export type { DatabaseWorkerOptions };
@@ -1,6 +1,6 @@
1
1
  type DatabaseWorkerOptions = {
2
- retries: number;
3
- interval: number;
2
+ retries: number;
3
+ interval: number;
4
4
  };
5
5
 
6
6
  export type { DatabaseWorkerOptions };
@@ -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 { BaseEntity, EntityManager, EntityName } from '@mikro-orm/core';
8
- import { DatabaseWorkerOptions } from '../types/databaseWorker.types';
8
+ import { DatabaseWorkerOptions } from '../domain/types/databaseWorker.types';
9
9
 
10
10
  export class DatabaseWorkerConsumer<
11
11
  EventEntity extends WorkerEventEntity & BaseEntity,
@@ -1,6 +1,6 @@
1
1
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
2
2
  import { BaseEntity, EntityManager } from '@mikro-orm/core';
3
- import { DatabaseWorkerOptions } from '../types/databaseWorker.types';
3
+ import { DatabaseWorkerOptions } from '../domain/types/databaseWorker.types';
4
4
 
5
5
  export class DatabaseWorkerProducer<
6
6
  EventEntity extends WorkerEventEntity & BaseEntity,
@@ -1,13 +1,16 @@
1
1
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
2
2
  import { BaseEntity, EntityManager } from '@mikro-orm/core';
3
- import { DatabaseWorkerOptions } from '../types/index.mjs';
3
+ import { DatabaseWorkerOptions } from '../domain/types/index.mjs';
4
4
 
5
- declare class DatabaseWorkerProducer<EventEntity extends WorkerEventEntity & BaseEntity, Options extends DatabaseWorkerOptions> {
6
- private readonly em;
7
- private readonly options;
8
- constructor(em: EntityManager, options: Options);
9
- enqueueJob(event: EventEntity): Promise<void>;
10
- enqueueBatchJobs(events: EventEntity[]): Promise<void>;
5
+ declare class DatabaseWorkerProducer<
6
+ EventEntity extends WorkerEventEntity & BaseEntity,
7
+ Options extends DatabaseWorkerOptions
8
+ > {
9
+ private readonly em;
10
+ private readonly options;
11
+ constructor(em: EntityManager, options: Options);
12
+ enqueueJob(event: EventEntity): Promise<void>;
13
+ enqueueBatchJobs(events: EventEntity[]): Promise<void>;
11
14
  }
12
15
 
13
16
  export { DatabaseWorkerProducer };
@@ -1,13 +1,16 @@
1
1
  import { WorkerEventEntity } from '@forklaunch/interfaces-worker/types';
2
2
  import { BaseEntity, EntityManager } from '@mikro-orm/core';
3
- import { DatabaseWorkerOptions } from '../types/index.js';
3
+ import { DatabaseWorkerOptions } from '../domain/types/index.js';
4
4
 
5
- declare class DatabaseWorkerProducer<EventEntity extends WorkerEventEntity & BaseEntity, Options extends DatabaseWorkerOptions> {
6
- private readonly em;
7
- private readonly options;
8
- constructor(em: EntityManager, options: Options);
9
- enqueueJob(event: EventEntity): Promise<void>;
10
- enqueueBatchJobs(events: EventEntity[]): Promise<void>;
5
+ declare class DatabaseWorkerProducer<
6
+ EventEntity extends WorkerEventEntity & BaseEntity,
7
+ Options extends DatabaseWorkerOptions
8
+ > {
9
+ private readonly em;
10
+ private readonly options;
11
+ constructor(em: EntityManager, options: Options);
12
+ enqueueJob(event: EventEntity): Promise<void>;
13
+ enqueueBatchJobs(events: EventEntity[]): Promise<void>;
11
14
  }
12
15
 
13
16
  export { DatabaseWorkerProducer };
@@ -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 = {};
@@ -38,6 +42,7 @@ var DatabaseWorkerProducer = class {
38
42
  }
39
43
  };
40
44
  // Annotate the CommonJS export names for ESM import in node:
41
- 0 && (module.exports = {
42
- DatabaseWorkerProducer
43
- });
45
+ 0 &&
46
+ (module.exports = {
47
+ DatabaseWorkerProducer
48
+ });
@@ -11,6 +11,4 @@ var DatabaseWorkerProducer = class {
11
11
  await this.em.persistAndFlush(events);
12
12
  }
13
13
  };
14
- export {
15
- DatabaseWorkerProducer
16
- };
14
+ export { DatabaseWorkerProducer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forklaunch/implementation-worker-database",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Database implementation for forklaunch workers",
5
5
  "homepage": "https://github.com/forklaunch/forklaunch-js#readme",
6
6
  "bugs": {
@@ -26,38 +26,39 @@
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": [
42
42
  "lib/**"
43
43
  ],
44
44
  "dependencies": {
45
- "@forklaunch/core": "^0.9.15",
45
+ "@forklaunch/core": "^0.9.21",
46
+ "@forklaunch/internal": "^0.0.7",
46
47
  "@mikro-orm/core": "^6.4.16",
47
- "@sinclair/typebox": "^0.34.33",
48
- "zod": "^3.25.63",
49
- "@forklaunch/interfaces-worker": "0.2.1"
48
+ "@sinclair/typebox": "^0.34.35",
49
+ "zod": "^3.25.67",
50
+ "@forklaunch/interfaces-worker": "0.2.2"
50
51
  },
51
52
  "devDependencies": {
52
- "@typescript/native-preview": "7.0.0-dev.20250611.1",
53
+ "@typescript/native-preview": "7.0.0-dev.20250619.1",
53
54
  "depcheck": "^1.4.7",
54
- "eslint": "^9.28.0",
55
+ "eslint": "^9.29.0",
55
56
  "prettier": "^3.5.3",
56
57
  "typedoc": "^0.28.5",
57
- "typescript-eslint": "^8.34.0"
58
+ "typescript-eslint": "^8.34.1"
58
59
  },
59
60
  "scripts": {
60
- "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",
61
62
  "clean": "rm -rf lib pnpm.lock.yaml node_modules",
62
63
  "docs": "typedoc --out docs *",
63
64
  "format": "prettier --ignore-path=.prettierignore --config .prettierrc '**/*.{ts,tsx,json}' --write",
@@ -1,16 +0,0 @@
1
- import * as _forklaunch_core_mappers from '@forklaunch/core/mappers';
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 DatabaseWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
7
- validator: SchemaValidator;
8
- }) => _forklaunch_core_mappers.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
9
- 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>;
10
- 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>;
11
- }, (options: Record<string, unknown>) => {
12
- retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
13
- interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
14
- }>;
15
-
16
- export { DatabaseWorkerSchemas };
@@ -1,16 +0,0 @@
1
- import * as _forklaunch_core_mappers from '@forklaunch/core/mappers';
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 DatabaseWorkerSchemas: <SchemaValidator extends _forklaunch_validator.AnySchemaValidator>(options: Record<string, unknown> & {
7
- validator: SchemaValidator;
8
- }) => _forklaunch_core_mappers.SchemasByValidator<SchemaValidator, (options: Record<string, unknown>) => {
9
- 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>;
10
- 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>;
11
- }, (options: Record<string, unknown>) => {
12
- retries: zod.ZodEffects<zod.ZodNumber, number, unknown>;
13
- interval: zod.ZodEffects<zod.ZodNumber, number, unknown>;
14
- }>;
15
-
16
- export { DatabaseWorkerSchemas };
File without changes
File without changes