@hg-ts/repository 0.2.15 → 0.2.16

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 (35) hide show
  1. package/dist/exceptions/aggregate-event.already-exists.exception.d.ts +5 -0
  2. package/dist/exceptions/aggregate-event.already-exists.exception.d.ts.map +1 -0
  3. package/dist/exceptions/aggregate-event.already-exists.exception.js +11 -0
  4. package/dist/exceptions/aggregate-event.already-exists.exception.js.map +1 -0
  5. package/dist/exceptions/aggregate-event.delete-restricted.exception.d.ts +5 -0
  6. package/dist/exceptions/aggregate-event.delete-restricted.exception.d.ts.map +1 -0
  7. package/dist/exceptions/aggregate-event.delete-restricted.exception.js +11 -0
  8. package/dist/exceptions/aggregate-event.delete-restricted.exception.js.map +1 -0
  9. package/dist/exceptions/aggregate-event.not-found.exception.d.ts +5 -0
  10. package/dist/exceptions/aggregate-event.not-found.exception.d.ts.map +1 -0
  11. package/dist/exceptions/aggregate-event.not-found.exception.js +11 -0
  12. package/dist/exceptions/aggregate-event.not-found.exception.js.map +1 -0
  13. package/dist/exceptions/aggregate-event.update-restricted.exception.d.ts +5 -0
  14. package/dist/exceptions/aggregate-event.update-restricted.exception.d.ts.map +1 -0
  15. package/dist/exceptions/aggregate-event.update-restricted.exception.js +11 -0
  16. package/dist/exceptions/aggregate-event.update-restricted.exception.js.map +1 -0
  17. package/dist/exceptions/index.d.ts +4 -0
  18. package/dist/exceptions/index.d.ts.map +1 -1
  19. package/dist/exceptions/index.js +4 -0
  20. package/dist/exceptions/index.js.map +1 -1
  21. package/dist/repositories/base.event.repository.d.ts +17 -0
  22. package/dist/repositories/base.event.repository.d.ts.map +1 -0
  23. package/dist/repositories/base.event.repository.js +28 -0
  24. package/dist/repositories/base.event.repository.js.map +1 -0
  25. package/dist/repositories/base.repository.d.ts +2 -2
  26. package/dist/repositories/base.repository.d.ts.map +1 -1
  27. package/dist/repositories/base.repository.js.map +1 -1
  28. package/dist/repositories/index.d.ts +1 -0
  29. package/dist/repositories/index.d.ts.map +1 -1
  30. package/dist/repositories/index.js +1 -0
  31. package/dist/repositories/index.js.map +1 -1
  32. package/dist/repositories/repository.d.ts +4 -4
  33. package/dist/repositories/repository.d.ts.map +1 -1
  34. package/dist/repositories/repository.js.map +1 -1
  35. package/package.json +11 -13
@@ -0,0 +1,5 @@
1
+ import { AggregateAlreadyExistsException } from './aggregate.already-exists.exception';
2
+ export declare class AggregateEventAlreadyExistsException extends AggregateAlreadyExistsException {
3
+ constructor(id?: string);
4
+ }
5
+ //# sourceMappingURL=aggregate-event.already-exists.exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.already-exists.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.already-exists.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,qBAAa,oCAAqC,SAAQ,+BAA+B;gBACrE,EAAE,CAAC,EAAE,MAAM;CAG9B"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AggregateEventAlreadyExistsException = void 0;
4
+ const aggregate_already_exists_exception_1 = require("./aggregate.already-exists.exception");
5
+ class AggregateEventAlreadyExistsException extends aggregate_already_exists_exception_1.AggregateAlreadyExistsException {
6
+ constructor(id) {
7
+ super('DomainEvent', { id });
8
+ }
9
+ }
10
+ exports.AggregateEventAlreadyExistsException = AggregateEventAlreadyExistsException;
11
+ //# sourceMappingURL=aggregate-event.already-exists.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.already-exists.exception.js","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.already-exists.exception.ts"],"names":[],"mappings":";;;AAAA,6FAAuF;AAEvF,MAAa,oCAAqC,SAAQ,oEAA+B;IACxF,YAAmB,EAAW;QAC7B,KAAK,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;CACD;AAJD,oFAIC"}
@@ -0,0 +1,5 @@
1
+ import { BaseException } from '@hg-ts/exception';
2
+ export declare class AggregateEventDeleteRestrictedException extends BaseException {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=aggregate-event.delete-restricted.exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.delete-restricted.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.delete-restricted.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,uCAAwC,SAAQ,aAAa;;CAIzE"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AggregateEventDeleteRestrictedException = void 0;
4
+ const exception_1 = require("@hg-ts/exception");
5
+ class AggregateEventDeleteRestrictedException extends exception_1.BaseException {
6
+ constructor() {
7
+ super('Domain event cannot be deleted');
8
+ }
9
+ }
10
+ exports.AggregateEventDeleteRestrictedException = AggregateEventDeleteRestrictedException;
11
+ //# sourceMappingURL=aggregate-event.delete-restricted.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.delete-restricted.exception.js","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.delete-restricted.exception.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAEjD,MAAa,uCAAwC,SAAQ,yBAAa;IACzE;QACC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACzC,CAAC;CACD;AAJD,0FAIC"}
@@ -0,0 +1,5 @@
1
+ import { AggregateNotFoundException } from './aggregate.not-found.exception';
2
+ export declare class AggregateEventNotFoundException extends AggregateNotFoundException {
3
+ constructor(id?: string);
4
+ }
5
+ //# sourceMappingURL=aggregate-event.not-found.exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.not-found.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.not-found.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,qBAAa,+BAAgC,SAAQ,0BAA0B;gBAC3D,EAAE,CAAC,EAAE,MAAM;CAG9B"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AggregateEventNotFoundException = void 0;
4
+ const aggregate_not_found_exception_1 = require("./aggregate.not-found.exception");
5
+ class AggregateEventNotFoundException extends aggregate_not_found_exception_1.AggregateNotFoundException {
6
+ constructor(id) {
7
+ super('DomainEvent', { id });
8
+ }
9
+ }
10
+ exports.AggregateEventNotFoundException = AggregateEventNotFoundException;
11
+ //# sourceMappingURL=aggregate-event.not-found.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.not-found.exception.js","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.not-found.exception.ts"],"names":[],"mappings":";;;AAAA,mFAA6E;AAE7E,MAAa,+BAAgC,SAAQ,0DAA0B;IAC9E,YAAmB,EAAW;QAC7B,KAAK,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC9B,CAAC;CACD;AAJD,0EAIC"}
@@ -0,0 +1,5 @@
1
+ import { BaseException } from '@hg-ts/exception';
2
+ export declare class AggregateEventUpdateRestrictedException extends BaseException {
3
+ constructor();
4
+ }
5
+ //# sourceMappingURL=aggregate-event.update-restricted.exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.update-restricted.exception.d.ts","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.update-restricted.exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,qBAAa,uCAAwC,SAAQ,aAAa;;CAIzE"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AggregateEventUpdateRestrictedException = void 0;
4
+ const exception_1 = require("@hg-ts/exception");
5
+ class AggregateEventUpdateRestrictedException extends exception_1.BaseException {
6
+ constructor() {
7
+ super('Domain event updates restricted');
8
+ }
9
+ }
10
+ exports.AggregateEventUpdateRestrictedException = AggregateEventUpdateRestrictedException;
11
+ //# sourceMappingURL=aggregate-event.update-restricted.exception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-event.update-restricted.exception.js","sourceRoot":"","sources":["../../src/exceptions/aggregate-event.update-restricted.exception.ts"],"names":[],"mappings":";;;AAAA,gDAAiD;AAEjD,MAAa,uCAAwC,SAAQ,yBAAa;IACzE;QACC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAC1C,CAAC;CACD;AAJD,0FAIC"}
@@ -1,3 +1,7 @@
1
1
  export * from './aggregate.not-found.exception';
2
2
  export * from './aggregate.already-exists.exception';
3
+ export * from './aggregate-event.not-found.exception';
4
+ export * from './aggregate-event.already-exists.exception';
5
+ export * from './aggregate-event.update-restricted.exception';
6
+ export * from './aggregate-event.delete-restricted.exception';
3
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AAErD,cAAc,uCAAuC,CAAC;AACtD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,+CAA+C,CAAC"}
@@ -3,4 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./aggregate.not-found.exception"), exports);
5
5
  tslib_1.__exportStar(require("./aggregate.already-exists.exception"), exports);
6
+ tslib_1.__exportStar(require("./aggregate-event.not-found.exception"), exports);
7
+ tslib_1.__exportStar(require("./aggregate-event.already-exists.exception"), exports);
8
+ tslib_1.__exportStar(require("./aggregate-event.update-restricted.exception"), exports);
9
+ tslib_1.__exportStar(require("./aggregate-event.delete-restricted.exception"), exports);
6
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,0EAAgD;AAChD,+EAAqD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;AAAA,0EAAgD;AAChD,+EAAqD;AAErD,gFAAsD;AACtD,qFAA2D;AAC3D,wFAA8D;AAC9D,wFAA8D"}
@@ -0,0 +1,17 @@
1
+ import { DomainEvent } from '@hg-ts/domain';
2
+ import { AggregateAlreadyExistsException, AggregateNotFoundException } from '../exceptions';
3
+ import { BaseRepository } from './base.repository';
4
+ import { BaseFindOptions } from './repository';
5
+ export type EventFindOptions = BaseFindOptions<DomainEvent> & {
6
+ entityId: string;
7
+ entityName: string;
8
+ };
9
+ export declare abstract class BaseEventRepository extends BaseRepository<DomainEvent, EventFindOptions> {
10
+ getNextId(): Promise<string>;
11
+ update(_entity: DomainEvent | DomainEvent[]): Promise<void>;
12
+ delete(_entity: DomainEvent | DomainEvent[]): Promise<void>;
13
+ clear(): Promise<void>;
14
+ protected getNotFoundException(id: string): AggregateNotFoundException;
15
+ protected getAlreadyExistsException(id: string): AggregateAlreadyExistsException;
16
+ }
17
+ //# sourceMappingURL=base.event.repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.event.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/base.event.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACN,+BAA+B,EAK/B,0BAA0B,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,gBAAgB,GAAG,eAAe,CAAC,WAAW,CAAC,GAAG;IAC7D,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,8BAAsB,mBACrB,SAAQ,cAAc,CAAC,WAAW,EAAE,gBAAgB,CAAC;IAC/B,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IAI5B,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;cAIzB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,0BAA0B;cAI5D,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,+BAA+B;CAGzF"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseEventRepository = void 0;
4
+ const domain_1 = require("@hg-ts/domain");
5
+ const exceptions_1 = require("../exceptions");
6
+ const base_repository_1 = require("./base.repository");
7
+ class BaseEventRepository extends base_repository_1.BaseRepository {
8
+ async getNextId() {
9
+ return domain_1.DomainEvent.generateId();
10
+ }
11
+ async update(_entity) {
12
+ throw new exceptions_1.AggregateEventUpdateRestrictedException();
13
+ }
14
+ async delete(_entity) {
15
+ throw new exceptions_1.AggregateEventDeleteRestrictedException();
16
+ }
17
+ async clear() {
18
+ throw new exceptions_1.AggregateEventDeleteRestrictedException();
19
+ }
20
+ getNotFoundException(id) {
21
+ throw new exceptions_1.AggregateEventNotFoundException(id);
22
+ }
23
+ getAlreadyExistsException(id) {
24
+ throw new exceptions_1.AggregateEventAlreadyExistsException(id);
25
+ }
26
+ }
27
+ exports.BaseEventRepository = BaseEventRepository;
28
+ //# sourceMappingURL=base.event.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.event.repository.js","sourceRoot":"","sources":["../../src/repositories/base.event.repository.ts"],"names":[],"mappings":";;;AAAA,0CAA4C;AAE5C,8CAOuB;AACvB,uDAAmD;AAQnD,MAAsB,mBACrB,SAAQ,gCAA6C;IACrC,KAAK,CAAC,SAAS;QAC9B,OAAO,oBAAW,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAEe,KAAK,CAAC,MAAM,CAAC,OAAoC;QAChE,MAAM,IAAI,oDAAuC,EAAE,CAAC;IACrD,CAAC;IAEe,KAAK,CAAC,MAAM,CAAC,OAAoC;QAChE,MAAM,IAAI,oDAAuC,EAAE,CAAC;IACrD,CAAC;IAEe,KAAK,CAAC,KAAK;QAC1B,MAAM,IAAI,oDAAuC,EAAE,CAAC;IACrD,CAAC;IAEkB,oBAAoB,CAAC,EAAU;QACjD,MAAM,IAAI,4CAA+B,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IAEkB,yBAAyB,CAAC,EAAU;QACtD,MAAM,IAAI,iDAAoC,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACD;AAzBD,kDAyBC"}
@@ -1,11 +1,11 @@
1
- import type { BaseAggregate } from '@hg-ts/domain';
1
+ import { BaseAggregate, DomainEvent } from '@hg-ts/domain';
2
2
  import { AggregateAlreadyExistsException, AggregateNotFoundException } from '../exceptions';
3
3
  import { AggregateId, BaseFindOptions, Repository } from './repository';
4
4
  type KeyType = number | string | symbol;
5
5
  export type InternalData = {
6
6
  updatedKeys: Set<KeyType>;
7
7
  };
8
- export declare abstract class BaseRepository<Aggregate extends BaseAggregate<any>, FindOptions extends BaseFindOptions<Aggregate> = BaseFindOptions<Aggregate>> extends Repository<Aggregate, FindOptions> {
8
+ export declare abstract class BaseRepository<Aggregate extends (BaseAggregate<any> | DomainEvent), FindOptions extends BaseFindOptions<Aggregate> = BaseFindOptions<Aggregate>> extends Repository<Aggregate, FindOptions> {
9
9
  get(id: AggregateId<Aggregate>): Promise<Nullable<Aggregate>>;
10
10
  getOrFail(id: AggregateId<Aggregate>): Promise<Aggregate>;
11
11
  has(id: AggregateId<Aggregate>): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"base.repository.d.ts","sourceRoot":"","sources":["../../src/repositories/base.repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACN,+BAA+B,EAC/B,0BAA0B,EAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,WAAW,EACX,eAAe,EACf,UAAU,EACV,MAAM,cAAc,CAAC;AAEtB,KAAK,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG;IACvB,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CAC7B,CAAC;AAEF,8BAAsB,cAAc,CAAC,SAAS,SAAS,aAAa,CAAC,GAAG,CAAC,EACrE,WAAW,SAAS,eAAe,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC,CAC9E,SAAQ,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC;IAC7B,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAO7D,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAUzD,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAMjD,IAAI,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;IAMpE,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,EA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,CAAC;IACjB,CAAC;CAOD;AArCD,wCAqCC"}
1
+ {"version":3,"file":"base.repository.js","sourceRoot":"","sources":["../../src/repositories/base.repository.ts"],"names":[],"mappings":";;;AAQA,6CAIsB;AAQtB,MAAsB,cAErB,SAAQ,uBAAkC;IACnC,KAAK,CAAC,GAAG,CAAC,EAA0B;QAE1C,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QAEzC,OAAO,MAAM,IAAI,IAAI,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,SAAS,CAAC,EAA0B;QAChD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAElC,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,KAAK,CAAC,GAAG,CAAC,EAA0B;QAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAElC,OAAO,MAAM,KAAK,IAAI,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,OAA8B;QAC/C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAElD,OAAO,QAAQ,CAAC;IACjB,CAAC;CAOD;AArCD,wCAqCC"}
@@ -1,4 +1,5 @@
1
1
  export * from './base.repository';
2
2
  export * from './repository';
3
3
  export * from './base.memory.repository';
4
+ export * from './base.event.repository';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AAEzC,cAAc,yBAAyB,CAAC"}
@@ -4,4 +4,5 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./base.repository"), exports);
5
5
  tslib_1.__exportStar(require("./repository"), exports);
6
6
  tslib_1.__exportStar(require("./base.memory.repository"), exports);
7
+ tslib_1.__exportStar(require("./base.event.repository"), exports);
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,uDAA6B;AAC7B,mEAAyC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/repositories/index.ts"],"names":[],"mappings":";;;AAAA,4DAAkC;AAClC,uDAA6B;AAC7B,mEAAyC;AAEzC,kEAAwC"}
@@ -1,9 +1,9 @@
1
- import type { BaseAggregate } from '@hg-ts/domain';
2
- export type AggregateId<Aggregate> = Aggregate extends BaseAggregate<infer X> ? X : never;
3
- export type BaseFindOptions<Aggregate extends BaseAggregate<any>> = {
1
+ import { BaseAggregate, DomainEvent, Identifiable } from '@hg-ts/domain';
2
+ export type AggregateId<Aggregate extends BaseAggregate<any> | DomainEvent> = Aggregate extends Identifiable<infer X> ? X : never;
3
+ export type BaseFindOptions<Aggregate extends BaseAggregate<any> | DomainEvent> = {
4
4
  id?: AggregateId<Aggregate> | AggregateId<Aggregate>[];
5
5
  };
6
- export declare abstract class Repository<Aggregate extends BaseAggregate<any>, FindOptions extends BaseFindOptions<Aggregate> = BaseFindOptions<Aggregate>> {
6
+ export declare abstract class Repository<Aggregate extends BaseAggregate<any> | DomainEvent, FindOptions extends BaseFindOptions<Aggregate> = BaseFindOptions<Aggregate>> {
7
7
  abstract getNextId(): Promise<AggregateId<Aggregate>>;
8
8
  abstract get(id: AggregateId<Aggregate>): Promise<Nullable<Aggregate>>;
9
9
  abstract getOrFail(id: AggregateId<Aggregate>): Promise<Aggregate>;
@@ -1 +1 @@
1
- {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/repositories/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,WAAW,CAAC,SAAS,IAAI,SAAS,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE1F,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,aAAa,CAAC,GAAG,CAAC,IAAI;IACnE,EAAE,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;CACvD,CAAC;AAEF,8BAAsB,UAAU,CAAC,SAAS,SAAS,aAAa,CAAC,GAAG,CAAC,EACpE,WAAW,SAAS,eAAe,CAAC,SAAS,CAAC,GAAG,eAAe,CAAC,SAAS,CAAC;aAC3D,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;aAE5C,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;aAE7D,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;aAEzD,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;aAEjD,GAAG,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;aAEnD,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;aAEtD,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,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,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;aAEtD,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;aAEtD,GAAG,CAAC,EAAE,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;aAEjD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CACtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/repositories/repository.ts"],"names":[],"mappings":";;;AAQA,MAAsB,UAAU;CAmB/B;AAnBD,gCAmBC"}
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/repositories/repository.ts"],"names":[],"mappings":";;;AAcA,MAAsB,UAAU;CAmB/B;AAnBD,gCAmBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hg-ts/repository",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": "./dist/index.js"
@@ -17,12 +17,12 @@
17
17
  "test:dev": "yarn build:dev --onSuccess \"yarn test\""
18
18
  },
19
19
  "devDependencies": {
20
- "@hg-ts-config/typescript": "0.2.15",
21
- "@hg-ts/domain": "0.2.15",
22
- "@hg-ts/exception": "0.2.15",
23
- "@hg-ts/linter": "0.2.15",
24
- "@hg-ts/tests": "0.2.15",
25
- "@hg-ts/types": "0.2.15",
20
+ "@hg-ts-config/typescript": "0.2.16",
21
+ "@hg-ts/domain": "0.2.16",
22
+ "@hg-ts/exception": "0.2.16",
23
+ "@hg-ts/linter": "0.2.16",
24
+ "@hg-ts/tests": "0.2.16",
25
+ "@hg-ts/types": "0.2.16",
26
26
  "@types/node": "22.10.6",
27
27
  "@types/uuid": "10.0.0",
28
28
  "eslint": "9.18.0",
@@ -30,15 +30,13 @@
30
30
  "ts-node": "10.9.2",
31
31
  "tsc-watch": "6.3.0",
32
32
  "tslib": "2.8.1",
33
- "typescript": "5.7.3"
33
+ "typescript": "5.7.3",
34
+ "uuid": "11.1.0"
34
35
  },
35
36
  "peerDependencies": {
36
- "@hg-ts/domain": "0.2.15",
37
- "@hg-ts/exception": "0.2.15",
37
+ "@hg-ts/domain": "0.2.16",
38
+ "@hg-ts/exception": "0.2.16",
38
39
  "reflect-metadata": "*",
39
40
  "tslib": "*"
40
- },
41
- "dependencies": {
42
- "uuid": "11.0.5"
43
41
  }
44
42
  }