@schorts/shared-kernel 1.1.1 → 1.1.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.
Files changed (45) hide show
  1. package/CHANGELOG +9 -1
  2. package/__tests__/dao/dao.test.ts +17 -0
  3. package/dist/auth/auth-provider.d.ts +2 -1
  4. package/dist/auth/auth-provider.d.ts.map +1 -1
  5. package/dist/dao/dao.d.ts +15 -0
  6. package/dist/dao/dao.d.ts.map +1 -0
  7. package/dist/dao/dao.js +3 -0
  8. package/dist/dao/dao.js.map +1 -0
  9. package/dist/dao/index.d.ts +2 -0
  10. package/dist/dao/index.d.ts.map +1 -0
  11. package/dist/dao/index.js +3 -0
  12. package/dist/dao/index.js.map +1 -0
  13. package/dist/entities/entity-registry.d.ts +14 -0
  14. package/dist/entities/entity-registry.d.ts.map +1 -0
  15. package/dist/entities/entity-registry.js +22 -0
  16. package/dist/entities/entity-registry.js.map +1 -0
  17. package/dist/entities/entity.d.ts +4 -3
  18. package/dist/entities/entity.d.ts.map +1 -1
  19. package/dist/entities/entity.js +3 -0
  20. package/dist/entities/entity.js.map +1 -1
  21. package/dist/entities/exceptions/entity-not-registered.d.ts +3 -0
  22. package/dist/entities/exceptions/entity-not-registered.d.ts.map +1 -0
  23. package/dist/entities/exceptions/entity-not-registered.js +7 -0
  24. package/dist/entities/exceptions/entity-not-registered.js.map +1 -0
  25. package/dist/entities/exceptions/index.d.ts +2 -0
  26. package/dist/entities/exceptions/index.d.ts.map +1 -0
  27. package/dist/entities/exceptions/index.js +6 -0
  28. package/dist/entities/exceptions/index.js.map +1 -0
  29. package/dist/entities/index.d.ts +3 -0
  30. package/dist/entities/index.d.ts.map +1 -1
  31. package/dist/entities/index.js +7 -1
  32. package/dist/entities/index.js.map +1 -1
  33. package/dist/entities/register-entity.decorator.d.ts +9 -0
  34. package/dist/entities/register-entity.decorator.d.ts.map +1 -0
  35. package/dist/entities/register-entity.decorator.js +11 -0
  36. package/dist/entities/register-entity.decorator.js.map +1 -0
  37. package/dist/unit-of-work/index.d.ts +2 -0
  38. package/dist/unit-of-work/index.d.ts.map +1 -0
  39. package/dist/unit-of-work/index.js +3 -0
  40. package/dist/unit-of-work/index.js.map +1 -0
  41. package/dist/unit-of-work/unit-of-work.d.ts +6 -0
  42. package/dist/unit-of-work/unit-of-work.d.ts.map +1 -0
  43. package/dist/unit-of-work/unit-of-work.js +3 -0
  44. package/dist/unit-of-work/unit-of-work.js.map +1 -0
  45. package/package.json +1 -1
package/CHANGELOG CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.1.2] - 2025-09-30
9
+
10
+ ### Changed
11
+
12
+ - Now the `DAO` actions like `create`, `update` and `delete` can receive a `UnitOfWork`.
13
+
8
14
  ## [1.1.1] - 2025-09-30
9
15
 
10
16
  ### Added
@@ -44,7 +50,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
44
50
 
45
51
  - Removed indirect dependencies from the `package.json`.
46
52
 
47
- [1.0.5]: https://github.com/schorts99/shared-kernel/compare/v1.0.5...v1.1.0
53
+ [1.1.2]: https://github.com/schorts99/shared-kernel/compare/v1.1.1...v1.1.2
54
+ [1.1.1]: https://github.com/schorts99/shared-kernel/compare/v1.1.0...v1.1.1
55
+ [1.1.0]: https://github.com/schorts99/shared-kernel/compare/v1.0.5...v1.1.0
48
56
  [1.0.5]: https://github.com/schorts99/shared-kernel/compare/v1.0.4...v0.0.5
49
57
  [1.0.4]: https://github.com/schorts99/shared-kernel/compare/v1.0.3...v0.0.4
50
58
  [1.0.3]: https://github.com/schorts99/shared-kernel/releases/tag/v1.0.3
@@ -4,6 +4,7 @@ import { DAO } from "../../src/dao";
4
4
  import { Entity } from "../../src/entities";
5
5
  import { Criteria } from "../../src/criteria";
6
6
  import { UUIDValue } from "../../src/value-objects";
7
+ import { UnitOfWork } from "../../src/unit-of-work";
7
8
 
8
9
  type Model = {
9
10
  id: string;
@@ -15,6 +16,10 @@ class IDValue extends UUIDValue {
15
16
  }
16
17
 
17
18
  class ModelEntity extends Entity<IDValue, Model> {
19
+ constructor(id: IDValue) {
20
+ super(id);
21
+ }
22
+
18
23
  toPrimitives(): Model {
19
24
  throw new Error("Method not implemented.");
20
25
  }
@@ -82,6 +87,10 @@ describe("DAO", () => {
82
87
  expectTypeOf<DAO<Model, ModelEntity>>().toHaveProperty("create");
83
88
  });
84
89
 
90
+ it('should receive the entity and can receive a UnitOfWork', () => {
91
+ expectTypeOf<DAO<Model, ModelEntity>['create']>().parameters.toEqualTypeOf<[ModelEntity, UnitOfWork?]>();
92
+ });
93
+
85
94
  it('should return a promise with the created entity', () => {
86
95
  expectTypeOf<DAO<Model, ModelEntity>['create']>().returns.toEqualTypeOf<Promise<ModelEntity>>();
87
96
  });
@@ -92,6 +101,10 @@ describe("DAO", () => {
92
101
  expectTypeOf<DAO<Model, ModelEntity>>().toHaveProperty("update");
93
102
  });
94
103
 
104
+ it('should receive the entity and can receive a UnitOfWork', () => {
105
+ expectTypeOf<DAO<Model, ModelEntity>['update']>().parameters.toEqualTypeOf<[ModelEntity, UnitOfWork?]>();
106
+ });
107
+
95
108
  it('should return a promise with the updated entity', () => {
96
109
  expectTypeOf<DAO<Model, ModelEntity>['update']>().returns.toEqualTypeOf<Promise<ModelEntity>>();
97
110
  });
@@ -102,6 +115,10 @@ describe("DAO", () => {
102
115
  expectTypeOf<DAO<Model, ModelEntity>>().toHaveProperty("delete");
103
116
  });
104
117
 
118
+ it('should receive the entity and can receive a UnitOfWork', () => {
119
+ expectTypeOf<DAO<Model, ModelEntity>['delete']>().parameters.toEqualTypeOf<[ModelEntity, UnitOfWork?]>();
120
+ });
121
+
105
122
  it('should return a promise with the deleted entity', () => {
106
123
  expectTypeOf<DAO<Model, ModelEntity>['delete']>().returns.toEqualTypeOf<Promise<ModelEntity>>();
107
124
  });
@@ -1,6 +1,7 @@
1
1
  import { Entity } from "../entities";
2
2
  import { BaseModel } from "../models";
3
- export interface AuthProvider<UserEntity extends Entity<BaseModel>> {
3
+ import { ValueObject } from "../value-objects";
4
+ export interface AuthProvider<UserEntity extends Entity<ValueObject, BaseModel>> {
4
5
  authenticate(...args: any[]): Promise<void>;
5
6
  logout(): Promise<void>;
6
7
  isAuthenticated(): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"auth-provider.d.ts","sourceRoot":"","sources":["../../src/auth/auth-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,WAAW,YAAY,CAAC,UAAU,SAAS,MAAM,CAAC,SAAS,CAAC;IAChE,YAAY,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,WAAW,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC1C,YAAY,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACvE"}
1
+ {"version":3,"file":"auth-provider.d.ts","sourceRoot":"","sources":["../../src/auth/auth-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,WAAW,YAAY,CAAC,UAAU,SAAS,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC;IAC7E,YAAY,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,WAAW,IAAI,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IAC1C,YAAY,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CACvE"}
@@ -0,0 +1,15 @@
1
+ import { BaseModel } from "../models";
2
+ import { Entity as BaseEntity } from "../entities";
3
+ import { Criteria } from "../criteria";
4
+ import { UnitOfWork } from "../unit-of-work";
5
+ import { ValueObject } from "../value-objects";
6
+ export interface DAO<Model extends BaseModel, Entity extends BaseEntity<ValueObject, Model>> {
7
+ getAll(): Promise<Entity[]>;
8
+ findByID(id: Entity["id"]["value"]): Promise<Entity | null>;
9
+ findOneBy(criteria: Criteria): Promise<Entity | null>;
10
+ search(criteria: Criteria): Promise<Entity[]>;
11
+ create(entity: Entity, uow?: UnitOfWork): Promise<Entity>;
12
+ update(entity: Entity, uow?: UnitOfWork): Promise<Entity>;
13
+ delete(entity: Entity, uow?: UnitOfWork): Promise<Entity>;
14
+ }
15
+ //# sourceMappingURL=dao.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dao.d.ts","sourceRoot":"","sources":["../../src/dao/dao.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,WAAW,GAAG,CAAC,KAAK,SAAS,SAAS,EAAE,MAAM,SAAS,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC;IACzF,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5D,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3D"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=dao.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dao.js","sourceRoot":"","sources":["../../src/dao/dao.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export type { DAO } from "./dao";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dao/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dao/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { BaseModel } from "../models";
2
+ import { Entity } from "./entity";
3
+ import { ValueObject } from "../value-objects";
4
+ type EntityConstructor<Model extends BaseModel = BaseModel> = {
5
+ fromPrimitives(model: Model): Entity<ValueObject, Model>;
6
+ };
7
+ export declare class EntityRegistry {
8
+ private static registry;
9
+ static register<Model extends BaseModel>(type: string, entity: EntityConstructor<Model>): void;
10
+ static resolve<Model extends BaseModel>(type: string): EntityConstructor<Model> | null;
11
+ static create<Model extends BaseModel>(type: string, model: Model): Entity<ValueObject, Model>;
12
+ }
13
+ export {};
14
+ //# sourceMappingURL=entity-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-registry.d.ts","sourceRoot":"","sources":["../../src/entities/entity-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,KAAK,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,IAAI;IAC5D,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CAC1D,CAAC;AAEF,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAwC;IAE/D,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,CAAC,KAAK,CAAC,GAAG,IAAI;IAI9F,MAAM,CAAC,OAAO,CAAC,KAAK,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,GAAG,IAAI;IAItF,MAAM,CAAC,MAAM,CAAC,KAAK,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC;CAS/F"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityRegistry = void 0;
4
+ const exceptions_1 = require("./exceptions");
5
+ class EntityRegistry {
6
+ static registry = new Map();
7
+ static register(type, entity) {
8
+ this.registry.set(type, entity);
9
+ }
10
+ static resolve(type) {
11
+ return (this.registry.get(type) || null);
12
+ }
13
+ static create(type, model) {
14
+ const entity = this.resolve(type);
15
+ if (!entity) {
16
+ throw new exceptions_1.EntityNotRegistered(`Entity type "${type}" not registered`);
17
+ }
18
+ return entity.fromPrimitives(model);
19
+ }
20
+ }
21
+ exports.EntityRegistry = EntityRegistry;
22
+ //# sourceMappingURL=entity-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-registry.js","sourceRoot":"","sources":["../../src/entities/entity-registry.ts"],"names":[],"mappings":";;;AAEA,6CAAmD;AAOnD,MAAa,cAAc;IACjB,MAAM,CAAC,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;IAE/D,MAAM,CAAC,QAAQ,CAA0B,IAAY,EAAE,MAAgC;QACrF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,OAAO,CAA0B,IAAY;QAClD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAoC,CAAC;IAC9E,CAAC;IAED,MAAM,CAAC,MAAM,CAA0B,IAAY,EAAE,KAAY;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAQ,IAAI,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,gCAAmB,CAAC,gBAAgB,IAAI,kBAAkB,CAAC,CAAC;QACxE,CAAC;QAED,OAAO,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;;AAnBH,wCAoBC"}
@@ -1,12 +1,13 @@
1
1
  import { ValueObject } from "../value-objects";
2
2
  import { BaseModel } from "../models";
3
3
  import { DomainEvent } from "../domain-events";
4
- export declare abstract class Entity<Model extends BaseModel> {
5
- readonly id: ValueObject;
4
+ export declare abstract class Entity<IDValue extends ValueObject, Model extends BaseModel> {
5
+ readonly id: IDValue;
6
6
  private domainEvents;
7
- constructor(id: ValueObject);
7
+ constructor(id: IDValue);
8
8
  pullDomainEvents(): Array<DomainEvent>;
9
9
  recordDomainEvent(domainEvent: DomainEvent): void;
10
10
  abstract toPrimitives(): Model;
11
+ static fromPrimitives<Model extends BaseModel>(_model: Model): void;
11
12
  }
12
13
  //# sourceMappingURL=entity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/entities/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,8BAAsB,MAAM,CAAC,KAAK,SAAS,SAAS;IAGtC,QAAQ,CAAC,EAAE,EAAE,WAAW;IAFpC,OAAO,CAAC,YAAY,CAA0B;gBAEzB,EAAE,EAAE,WAAW;IAEpC,gBAAgB,IAAI,KAAK,CAAC,WAAW,CAAC;IAOtC,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAIjD,QAAQ,CAAC,YAAY,IAAI,KAAK;CAC/B"}
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../src/entities/entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,8BAAsB,MAAM,CAAC,OAAO,SAAS,WAAW,EAAE,KAAK,SAAS,SAAS;IAGnE,QAAQ,CAAC,EAAE,EAAE,OAAO;IAFhC,OAAO,CAAC,YAAY,CAA0B;gBAEzB,EAAE,EAAE,OAAO;IAEhC,gBAAgB,IAAI,KAAK,CAAC,WAAW,CAAC;IAOtC,iBAAiB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAIjD,QAAQ,CAAC,YAAY,IAAI,KAAK;IAC9B,MAAM,CAAC,cAAc,CAAC,KAAK,SAAS,SAAS,EAAE,MAAM,EAAE,KAAK;CAG7D"}
@@ -15,6 +15,9 @@ class Entity {
15
15
  recordDomainEvent(domainEvent) {
16
16
  this.domainEvents.push(domainEvent);
17
17
  }
18
+ static fromPrimitives(_model) {
19
+ throw new Error("Method not implemented.");
20
+ }
18
21
  }
19
22
  exports.Entity = Entity;
20
23
  //# sourceMappingURL=entity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/entities/entity.ts"],"names":[],"mappings":";;;AAIA,MAAsB,MAAM;IAGL;IAFb,YAAY,GAAuB,EAAE,CAAC;IAE9C,YAAqB,EAAe;QAAf,OAAE,GAAF,EAAE,CAAa;IAAG,CAAC;IAExC,gBAAgB;QACd,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,iBAAiB,CAAC,WAAwB;QACxC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;CAGF;AAjBD,wBAiBC"}
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/entities/entity.ts"],"names":[],"mappings":";;;AAIA,MAAsB,MAAM;IAGL;IAFb,YAAY,GAAuB,EAAE,CAAC;IAE9C,YAAqB,EAAW;QAAX,OAAE,GAAF,EAAE,CAAS;IAAG,CAAC;IAEpC,gBAAgB;QACd,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,iBAAiB,CAAC,WAAwB;QACxC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAGD,MAAM,CAAC,cAAc,CAA0B,MAAa;QAC1D,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;CACF;AApBD,wBAoBC"}
@@ -0,0 +1,3 @@
1
+ export declare class EntityNotRegistered extends Error {
2
+ }
3
+ //# sourceMappingURL=entity-not-registered.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-not-registered.d.ts","sourceRoot":"","sources":["../../../src/entities/exceptions/entity-not-registered.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;CAAG"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityNotRegistered = void 0;
4
+ class EntityNotRegistered extends Error {
5
+ }
6
+ exports.EntityNotRegistered = EntityNotRegistered;
7
+ //# sourceMappingURL=entity-not-registered.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-not-registered.js","sourceRoot":"","sources":["../../../src/entities/exceptions/entity-not-registered.ts"],"names":[],"mappings":";;;AAAA,MAAa,mBAAoB,SAAQ,KAAK;CAAG;AAAjD,kDAAiD"}
@@ -0,0 +1,2 @@
1
+ export { EntityNotRegistered } from "./entity-not-registered";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/entities/exceptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntityNotRegistered = void 0;
4
+ var entity_not_registered_1 = require("./entity-not-registered");
5
+ Object.defineProperty(exports, "EntityNotRegistered", { enumerable: true, get: function () { return entity_not_registered_1.EntityNotRegistered; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/entities/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAArD,4HAAA,mBAAmB,OAAA"}
@@ -1,2 +1,5 @@
1
1
  export { Entity } from "./entity";
2
+ export { EntityRegistry } from "./entity-registry";
3
+ export { EntityNotRegistered } from "./exceptions";
4
+ export { RegisterEntity } from "./register-entity.decorator";
2
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Entity = void 0;
3
+ exports.RegisterEntity = exports.EntityNotRegistered = exports.EntityRegistry = exports.Entity = void 0;
4
4
  var entity_1 = require("./entity");
5
5
  Object.defineProperty(exports, "Entity", { enumerable: true, get: function () { return entity_1.Entity; } });
6
+ var entity_registry_1 = require("./entity-registry");
7
+ Object.defineProperty(exports, "EntityRegistry", { enumerable: true, get: function () { return entity_registry_1.EntityRegistry; } });
8
+ var exceptions_1 = require("./exceptions");
9
+ Object.defineProperty(exports, "EntityNotRegistered", { enumerable: true, get: function () { return exceptions_1.EntityNotRegistered; } });
10
+ var register_entity_decorator_1 = require("./register-entity.decorator");
11
+ Object.defineProperty(exports, "RegisterEntity", { enumerable: true, get: function () { return register_entity_decorator_1.RegisterEntity; } });
6
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";;;AAAA,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,2CAAmD;AAA1C,iHAAA,mBAAmB,OAAA;AAC5B,yEAA6D;AAApD,2HAAA,cAAc,OAAA"}
@@ -0,0 +1,9 @@
1
+ import { BaseModel } from "../models";
2
+ import { Entity as BaseEntity } from "./entity";
3
+ import { ValueObject } from "../value-objects";
4
+ type EntityConstructor<Model extends BaseModel = BaseModel> = {
5
+ fromPrimitives(model: Model): BaseEntity<ValueObject, Model>;
6
+ };
7
+ export declare function RegisterEntity<Model extends BaseModel = BaseModel>(type: string): <Entity extends EntityConstructor<Model>>(entity: Entity) => Entity;
8
+ export {};
9
+ //# sourceMappingURL=register-entity.decorator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-entity.decorator.d.ts","sourceRoot":"","sources":["../../src/entities/register-entity.decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,KAAK,iBAAiB,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,IAAI;IAC5D,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;CAC9D,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,SAAS,SAAS,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,IAC7D,MAAM,SAAS,iBAAiB,CAAC,KAAK,CAAC,EAAE,QAAQ,MAAM,KAAG,MAAM,CAKlF"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RegisterEntity = RegisterEntity;
4
+ const entity_registry_1 = require("./entity-registry");
5
+ function RegisterEntity(type) {
6
+ return function (entity) {
7
+ entity_registry_1.EntityRegistry.register(type, entity);
8
+ return entity;
9
+ };
10
+ }
11
+ //# sourceMappingURL=register-entity.decorator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-entity.decorator.js","sourceRoot":"","sources":["../../src/entities/register-entity.decorator.ts"],"names":[],"mappings":";;AASA,wCAMC;AAfD,uDAAmD;AASnD,SAAgB,cAAc,CAAsC,IAAY;IAC9E,OAAO,UAAmD,MAAc;QACtE,gCAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEtC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type { UnitOfWork } from "./unit-of-work";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unit-of-work/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/unit-of-work/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export interface UnitOfWork {
2
+ begin(): Promise<void>;
3
+ commit(): Promise<void>;
4
+ rollback(): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=unit-of-work.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit-of-work.d.ts","sourceRoot":"","sources":["../../src/unit-of-work/unit-of-work.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=unit-of-work.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unit-of-work.js","sourceRoot":"","sources":["../../src/unit-of-work/unit-of-work.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schorts/shared-kernel",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "A modular, type-safe foundation for building expressive, maintainable applications. This package provides core abstractions for domain modeling, HTTP integration, authentication, state management, and more — designed to be framework-agnostic and highly extensible.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",