ddd-node 26.0.0 → 27.0.0

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 (29) hide show
  1. package/dist/core/aggregate/aggregate-base/aggregate.builder.d.ts +2 -2
  2. package/dist/core/aggregate/aggregate-base/aggregate.builder.js +2 -2
  3. package/dist/core/aggregate/aggregate-base/aggregate.d.ts +3 -3
  4. package/dist/core/aggregate/aggregate-base/aggregate.js +2 -2
  5. package/dist/core/entity/entity.builder.d.ts +2 -2
  6. package/dist/core/entity/entity.builder.js +2 -2
  7. package/dist/core/entity/entity.d.ts +3 -3
  8. package/dist/core/entity/entity.js +2 -2
  9. package/dist/core/index.d.ts +1 -1
  10. package/dist/core/index.js +1 -1
  11. package/dist/core/message/event/event.d.ts +1 -1
  12. package/dist/core/message/message-base/message.builder.d.ts +2 -2
  13. package/dist/core/message/message-base/message.builder.js +2 -2
  14. package/dist/core/message/message-base/message.d.ts +3 -3
  15. package/dist/core/message/message-base/message.js +2 -2
  16. package/dist/core/model-with-id/index.d.ts +3 -0
  17. package/dist/core/{identifiable-model → model-with-id}/index.js +2 -2
  18. package/dist/core/model-with-id/model-with-id.builder.d.ts +9 -0
  19. package/dist/core/{identifiable-model/identifiable-model.builder.js → model-with-id/model-with-id.builder.js} +3 -3
  20. package/dist/core/model-with-id/model-with-id.d.ts +13 -0
  21. package/dist/core/{identifiable-model/identifiable-model.js → model-with-id/model-with-id.js} +3 -3
  22. package/dist/core/repository/repository.d.ts +1 -1
  23. package/dist/package.json +1 -1
  24. package/package.json +1 -1
  25. package/dist/core/identifiable-model/identifiable-model.builder.d.ts +0 -9
  26. package/dist/core/identifiable-model/identifiable-model.d.ts +0 -13
  27. package/dist/core/identifiable-model/index.d.ts +0 -3
  28. /package/dist/core/{identifiable-model → model-with-id}/id.d.ts +0 -0
  29. /package/dist/core/{identifiable-model → model-with-id}/id.js +0 -0
@@ -1,6 +1,6 @@
1
- import { IdentifiableModelBuilder } from "../../identifiable-model";
1
+ import { ModelWithIdBuilder } from "../../model-with-id";
2
2
  import { AnyAggregate } from "./aggregate";
3
- export declare abstract class AggregateBuilderBase<T extends AnyAggregate> extends IdentifiableModelBuilder<T> {
3
+ export declare abstract class AggregateBuilderBase<T extends AnyAggregate> extends ModelWithIdBuilder<T> {
4
4
  protected version: number;
5
5
  withVersion(version: number): this;
6
6
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AggregateBuilderBase = void 0;
4
- const identifiable_model_1 = require("../../identifiable-model");
5
- class AggregateBuilderBase extends identifiable_model_1.IdentifiableModelBuilder {
4
+ const model_with_id_1 = require("../../model-with-id");
5
+ class AggregateBuilderBase extends model_with_id_1.ModelWithIdBuilder {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  this.version = 0;
@@ -1,11 +1,11 @@
1
1
  import { Props, PropsOf } from "../../../base";
2
- import { IdentifiableModel, IdentifiableModelMetadata } from "../../identifiable-model";
2
+ import { ModelWithId, ModelWithIdMetadata } from "../../model-with-id";
3
3
  import { AnyEvent, EventClassWithTypedConstructor, EventSource } from "../../message";
4
4
  import { IAggregateEventDispatcher } from "./aggregate-event-dispatcher.interface";
5
- export interface AggregateMetadata extends IdentifiableModelMetadata {
5
+ export interface AggregateMetadata extends ModelWithIdMetadata {
6
6
  version: number;
7
7
  }
8
- export declare abstract class AggregateBase<P extends Props> extends IdentifiableModel<P> {
8
+ export declare abstract class AggregateBase<P extends Props> extends ModelWithId<P> {
9
9
  protected readonly _version: number;
10
10
  constructor(metadata: AggregateMetadata, props?: P);
11
11
  abstract version(): number;
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AggregateBase = void 0;
13
13
  const base_1 = require("../../../base");
14
- const identifiable_model_1 = require("../../identifiable-model");
15
- let AggregateBase = class AggregateBase extends identifiable_model_1.IdentifiableModel {
14
+ const model_with_id_1 = require("../../model-with-id");
15
+ let AggregateBase = class AggregateBase extends model_with_id_1.ModelWithId {
16
16
  constructor(metadata, props) {
17
17
  super(metadata);
18
18
  if (props)
@@ -1,6 +1,6 @@
1
- import { IdentifiableModelBuilder } from "../identifiable-model";
1
+ import { ModelWithIdBuilder } from "../model-with-id";
2
2
  import { AnyEntity, EntityClassWithTypedConstructor } from "./entity";
3
- export declare class EntityBuilder<T extends AnyEntity> extends IdentifiableModelBuilder<T> {
3
+ export declare class EntityBuilder<T extends AnyEntity> extends ModelWithIdBuilder<T> {
4
4
  private entityClass;
5
5
  constructor(entityClass: EntityClassWithTypedConstructor<T>);
6
6
  build(): T;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EntityBuilder = void 0;
4
- const identifiable_model_1 = require("../identifiable-model");
5
- class EntityBuilder extends identifiable_model_1.IdentifiableModelBuilder {
4
+ const model_with_id_1 = require("../model-with-id");
5
+ class EntityBuilder extends model_with_id_1.ModelWithIdBuilder {
6
6
  constructor(entityClass) {
7
7
  super();
8
8
  this.entityClass = entityClass;
@@ -1,11 +1,11 @@
1
1
  import { Class } from "type-fest";
2
2
  import { Props, PropsOf } from "../../base";
3
3
  import { ClassStatic } from "../../types";
4
- import { IdentifiableModel, IdentifiableModelMetadata } from "../identifiable-model";
4
+ import { ModelWithId, ModelWithIdMetadata } from "../model-with-id";
5
5
  import { EntityBuilder } from ".";
6
- export interface EntityMetadata extends IdentifiableModelMetadata {
6
+ export interface EntityMetadata extends ModelWithIdMetadata {
7
7
  }
8
- export declare class EntityBase<P extends Props> extends IdentifiableModel<P> {
8
+ export declare class EntityBase<P extends Props> extends ModelWithId<P> {
9
9
  static builder<T extends AnyEntity>(this: EntityClass<T>): EntityBuilder<T>;
10
10
  constructor(metadata: EntityMetadata, props: P);
11
11
  }
@@ -11,9 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.EntityBase = void 0;
13
13
  const base_1 = require("../../base");
14
- const identifiable_model_1 = require("../identifiable-model");
14
+ const model_with_id_1 = require("../model-with-id");
15
15
  const _1 = require(".");
16
- let EntityBase = class EntityBase extends identifiable_model_1.IdentifiableModel {
16
+ let EntityBase = class EntityBase extends model_with_id_1.ModelWithId {
17
17
  static builder() {
18
18
  return new _1.EntityBuilder(this);
19
19
  }
@@ -1,6 +1,6 @@
1
1
  export * from "./value-object";
2
2
  export * from "./enum";
3
- export * from "./identifiable-model";
3
+ export * from "./model-with-id";
4
4
  export * from "./entity";
5
5
  export * from "./aggregate";
6
6
  export * from "./message";
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./value-object"), exports);
18
18
  __exportStar(require("./enum"), exports);
19
- __exportStar(require("./identifiable-model"), exports);
19
+ __exportStar(require("./model-with-id"), exports);
20
20
  __exportStar(require("./entity"), exports);
21
21
  __exportStar(require("./aggregate"), exports);
22
22
  __exportStar(require("./message"), exports);
@@ -2,7 +2,7 @@ import { Class } from "type-fest";
2
2
  import { EventType } from "../../../meta";
3
3
  import { Props, PropsOf } from "../../../base";
4
4
  import { ClassStatic } from "../../../types";
5
- import { Id } from "../../identifiable-model";
5
+ import { Id } from "../../model-with-id";
6
6
  import { MessageBase, MessageMetadata } from "../message-base";
7
7
  import { EventModelDescriptor } from "./event-model-descriptor";
8
8
  import { EventBuilder } from ".";
@@ -1,6 +1,6 @@
1
- import { IdentifiableModelBuilder } from "../../identifiable-model";
1
+ import { ModelWithIdBuilder } from "../../model-with-id";
2
2
  import { AnyMessage, CorrelationIds, MessageClassWithTypedConstructor } from "./message";
3
- export declare abstract class MessageBuilderBase<T extends AnyMessage> extends IdentifiableModelBuilder<T> {
3
+ export declare abstract class MessageBuilderBase<T extends AnyMessage> extends ModelWithIdBuilder<T> {
4
4
  protected timestamp: number;
5
5
  protected causationId?: string;
6
6
  protected correlationIds: CorrelationIds;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessageBuilder = exports.MessageBuilderBase = void 0;
4
- const identifiable_model_1 = require("../../identifiable-model");
5
- class MessageBuilderBase extends identifiable_model_1.IdentifiableModelBuilder {
4
+ const model_with_id_1 = require("../../model-with-id");
5
+ class MessageBuilderBase extends model_with_id_1.ModelWithIdBuilder {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
  this.timestamp = Date.now();
@@ -1,16 +1,16 @@
1
1
  import { Class } from "type-fest";
2
2
  import { Props, PropsOf } from "../../../base";
3
3
  import { ClassStatic } from "../../../types";
4
- import { IdentifiableModel, IdentifiableModelMetadata } from "../../identifiable-model";
4
+ import { ModelWithId, ModelWithIdMetadata } from "../../model-with-id";
5
5
  export interface CorrelationIds {
6
6
  [type: string]: string | undefined;
7
7
  }
8
- export interface MessageMetadata extends IdentifiableModelMetadata {
8
+ export interface MessageMetadata extends ModelWithIdMetadata {
9
9
  timestamp: number;
10
10
  causationId?: string;
11
11
  correlationIds: CorrelationIds;
12
12
  }
13
- export declare class MessageBase<P extends Props> extends IdentifiableModel<P> {
13
+ export declare class MessageBase<P extends Props> extends ModelWithId<P> {
14
14
  private readonly _timestamp;
15
15
  private _causationId?;
16
16
  private _correlationIds;
@@ -11,8 +11,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MessageBase = void 0;
13
13
  const base_1 = require("../../../base");
14
- const identifiable_model_1 = require("../../identifiable-model");
15
- let MessageBase = class MessageBase extends identifiable_model_1.IdentifiableModel {
14
+ const model_with_id_1 = require("../../model-with-id");
15
+ let MessageBase = class MessageBase extends model_with_id_1.ModelWithId {
16
16
  constructor(metadata, props) {
17
17
  super(metadata);
18
18
  this._timestamp = metadata.timestamp;
@@ -0,0 +1,3 @@
1
+ export * from "./id";
2
+ export * from "./model-with-id";
3
+ export * from "./model-with-id.builder";
@@ -15,5 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./id"), exports);
18
- __exportStar(require("./identifiable-model"), exports);
19
- __exportStar(require("./identifiable-model.builder"), exports);
18
+ __exportStar(require("./model-with-id"), exports);
19
+ __exportStar(require("./model-with-id.builder"), exports);
@@ -0,0 +1,9 @@
1
+ import { ModelBuilder } from "../../base";
2
+ import { AnyModelWithId } from "./model-with-id";
3
+ import { Id } from "./id";
4
+ export declare abstract class ModelWithIdBuilder<T extends AnyModelWithId> extends ModelBuilder<T> {
5
+ protected id: Id;
6
+ newId(): string;
7
+ withId(id: Id): this;
8
+ withNewId(): this;
9
+ }
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdentifiableModelBuilder = void 0;
3
+ exports.ModelWithIdBuilder = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const base_1 = require("../../base");
6
- class IdentifiableModelBuilder extends base_1.ModelBuilder {
6
+ class ModelWithIdBuilder extends base_1.ModelBuilder {
7
7
  constructor() {
8
8
  super(...arguments);
9
9
  this.id = this.newId();
@@ -19,4 +19,4 @@ class IdentifiableModelBuilder extends base_1.ModelBuilder {
19
19
  return this.withId(this.newId());
20
20
  }
21
21
  }
22
- exports.IdentifiableModelBuilder = IdentifiableModelBuilder;
22
+ exports.ModelWithIdBuilder = ModelWithIdBuilder;
@@ -0,0 +1,13 @@
1
+ import { Id } from "./id";
2
+ import { ModelBase, Props } from "../../base";
3
+ export interface ModelWithIdMetadata {
4
+ id: Id;
5
+ }
6
+ export declare class ModelWithId<P extends Props> extends ModelBase<P> {
7
+ protected readonly _id: Id;
8
+ constructor(metadata: ModelWithIdMetadata);
9
+ metadata(): ModelWithIdMetadata;
10
+ id(): string;
11
+ hasId(id: Id): boolean;
12
+ }
13
+ export type AnyModelWithId = ModelWithId<Props>;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IdentifiableModel = void 0;
3
+ exports.ModelWithId = void 0;
4
4
  const base_1 = require("../../base");
5
- class IdentifiableModel extends base_1.ModelBase {
5
+ class ModelWithId extends base_1.ModelBase {
6
6
  constructor(metadata) {
7
7
  super();
8
8
  this._id = metadata.id;
@@ -20,4 +20,4 @@ class IdentifiableModel extends base_1.ModelBase {
20
20
  return this._id === id;
21
21
  }
22
22
  }
23
- exports.IdentifiableModel = IdentifiableModel;
23
+ exports.ModelWithId = ModelWithId;
@@ -1,4 +1,4 @@
1
- import { Id } from "../identifiable-model";
1
+ import { Id } from "../model-with-id";
2
2
  import { AnyAggregate } from "../aggregate";
3
3
  export interface IRepository<T extends AnyAggregate> {
4
4
  id(id: Id): Promise<T | null>;
package/dist/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"ddd-node","version":"26.0.0","description":"Domain Driven Design base for NodeJs","type":"commonjs","main":"index.js","types":"index.d.ts","files":["dist"],"repository":{"type":"git","url":"https://github.com/nqd881/ddd-node"},"keywords":["ddd","ddd-node","ddd-base","ddd-ts","ddd-js"],"author":"Quoc Dai","license":"ISC","devDependencies":{"@types/chai":"^4.3.16","@types/lodash":"^4.14.200","@types/mocha":"^10.0.6","@types/uuid":"^9.0.6","chai":"^5.1.1","chai-deep-match":"^1.2.1","ddd-node":"file:dist","mocha":"^10.4.0","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"^5.2.2"},"dependencies":{"lodash":"^4.17.21","reflect-metadata":"^0.1.13","tsc-alias":"^1.8.8","type-fest":"^4.20.1","uuid":"^9.0.1"}}
1
+ {"name":"ddd-node","version":"27.0.0","description":"Domain Driven Design base for NodeJs","type":"commonjs","main":"index.js","types":"index.d.ts","files":["dist"],"repository":{"type":"git","url":"https://github.com/nqd881/ddd-node"},"keywords":["ddd","ddd-node","ddd-base","ddd-ts","ddd-js"],"author":"Quoc Dai","license":"ISC","devDependencies":{"@types/chai":"^4.3.16","@types/lodash":"^4.14.200","@types/mocha":"^10.0.6","@types/uuid":"^9.0.6","chai":"^5.1.1","chai-deep-match":"^1.2.1","ddd-node":"file:dist","mocha":"^10.4.0","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typescript":"^5.2.2"},"dependencies":{"lodash":"^4.17.21","reflect-metadata":"^0.1.13","tsc-alias":"^1.8.8","type-fest":"^4.20.1","uuid":"^9.0.1"}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ddd-node",
3
- "version": "26.0.0",
3
+ "version": "27.0.0",
4
4
  "description": "Domain Driven Design base for NodeJs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,9 +0,0 @@
1
- import { ModelBuilder } from "../../base";
2
- import { AnyIdentifiableModel } from "./identifiable-model";
3
- import { Id } from "./id";
4
- export declare abstract class IdentifiableModelBuilder<T extends AnyIdentifiableModel> extends ModelBuilder<T> {
5
- protected id: Id;
6
- newId(): string;
7
- withId(id: Id): this;
8
- withNewId(): this;
9
- }
@@ -1,13 +0,0 @@
1
- import { Id } from "./id";
2
- import { ModelBase, Props } from "../../base";
3
- export interface IdentifiableModelMetadata {
4
- id: Id;
5
- }
6
- export declare class IdentifiableModel<P extends Props> extends ModelBase<P> {
7
- protected readonly _id: Id;
8
- constructor(metadata: IdentifiableModelMetadata);
9
- metadata(): IdentifiableModelMetadata;
10
- id(): string;
11
- hasId(id: Id): boolean;
12
- }
13
- export type AnyIdentifiableModel = IdentifiableModel<Props>;
@@ -1,3 +0,0 @@
1
- export * from "./id";
2
- export * from "./identifiable-model";
3
- export * from "./identifiable-model.builder";