plutin 1.5.0 → 1.5.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.
package/dist/index.cjs CHANGED
@@ -442,6 +442,7 @@ var require_cli_options = __commonJS({
442
442
  // src/index.ts
443
443
  var src_exports = {};
444
444
  __export(src_exports, {
445
+ AggregateObjectRoot: () => AggregateObjectRoot,
445
446
  AggregateRoot: () => AggregateRoot,
446
447
  BaseController: () => BaseController,
447
448
  Controller: () => Controller,
@@ -457,6 +458,7 @@ __export(src_exports, {
457
458
  NotificationFactory: () => NotificationFactory,
458
459
  SentryNotifier: () => SentryNotifier,
459
460
  UniqueEntityId: () => UniqueEntityId,
461
+ UniqueObjectUniqueId: () => UniqueObjectUniqueId,
460
462
  ValueObject: () => ValueObject,
461
463
  WatchedList: () => WatchedList,
462
464
  baseEnvSchema: () => baseEnvSchema,
@@ -787,31 +789,31 @@ function Controller({ method, path, middlewares = [] }) {
787
789
  }
788
790
  __name(Controller, "Controller");
789
791
 
790
- // src/core/entities/unique-entity-id.ts
791
- var import_node_crypto = require("crypto");
792
- var UniqueEntityId = class {
792
+ // src/core/entities/unique-object-id.ts
793
+ var import_bson = require("bson");
794
+ var UniqueObjectUniqueId = class {
793
795
  static {
794
- __name(this, "UniqueEntityId");
796
+ __name(this, "UniqueObjectUniqueId");
795
797
  }
796
798
  value;
797
799
  constructor(value) {
798
- this.value = value ?? (0, import_node_crypto.randomUUID)();
800
+ this.value = new import_bson.ObjectId(value);
799
801
  }
800
802
  toString() {
801
- return this.value;
803
+ return this.value.toString();
802
804
  }
803
805
  toValue() {
804
- return this.value;
806
+ return this.value.toString();
805
807
  }
806
808
  equals(id) {
807
809
  return id.toValue() === this.toValue();
808
810
  }
809
811
  };
810
812
 
811
- // src/core/entities/entity.ts
812
- var Entity = class {
813
+ // src/core/entities/entity-object.ts
814
+ var EntityObject = class {
813
815
  static {
814
- __name(this, "Entity");
816
+ __name(this, "EntityObject");
815
817
  }
816
818
  _id;
817
819
  props;
@@ -834,7 +836,7 @@ var Entity = class {
834
836
  this.props.updatedAt = /* @__PURE__ */ new Date();
835
837
  }
836
838
  constructor(props, id) {
837
- this._id = id ?? new UniqueEntityId(id);
839
+ this._id = id ?? new UniqueObjectUniqueId(id);
838
840
  this.props = props;
839
841
  }
840
842
  equals(entity) {
@@ -848,38 +850,38 @@ var Entity = class {
848
850
  }
849
851
  };
850
852
 
851
- // src/core/entities/aggregate-root.ts
852
- var AggregateRoot = class extends Entity {
853
+ // src/core/entities/aggregate-object-root.ts
854
+ var AggregateObjectRoot = class extends EntityObject {
853
855
  static {
854
- __name(this, "AggregateRoot");
856
+ __name(this, "AggregateObjectRoot");
855
857
  }
856
858
  };
857
859
 
858
- // src/core/entities/object-id.ts
859
- var import_bson = require("bson");
860
- var ObjectUniqueId = class {
860
+ // src/core/entities/unique-entity-id.ts
861
+ var import_node_crypto = require("crypto");
862
+ var UniqueEntityId = class {
861
863
  static {
862
- __name(this, "ObjectUniqueId");
864
+ __name(this, "UniqueEntityId");
863
865
  }
864
866
  value;
865
867
  constructor(value) {
866
- this.value = new import_bson.ObjectId(value);
868
+ this.value = value ?? (0, import_node_crypto.randomUUID)();
867
869
  }
868
870
  toString() {
869
- return this.value.toString();
871
+ return this.value;
870
872
  }
871
873
  toValue() {
872
- return this.value.toString();
874
+ return this.value;
873
875
  }
874
876
  equals(id) {
875
877
  return id.toValue() === this.toValue();
876
878
  }
877
879
  };
878
880
 
879
- // src/core/entities/entity-object.ts
880
- var EntityObject = class {
881
+ // src/core/entities/entity.ts
882
+ var Entity = class {
881
883
  static {
882
- __name(this, "EntityObject");
884
+ __name(this, "Entity");
883
885
  }
884
886
  _id;
885
887
  props;
@@ -889,8 +891,20 @@ var EntityObject = class {
889
891
  set id(id) {
890
892
  this._id = id;
891
893
  }
894
+ get createdAt() {
895
+ return this.props.createdAt;
896
+ }
897
+ set createdAt(date) {
898
+ this.props.createdAt = date;
899
+ }
900
+ get updatedAt() {
901
+ return this.props.updatedAt;
902
+ }
903
+ touch() {
904
+ this.props.updatedAt = /* @__PURE__ */ new Date();
905
+ }
892
906
  constructor(props, id) {
893
- this._id = id ?? new ObjectUniqueId(id);
907
+ this._id = id ?? new UniqueEntityId(id);
894
908
  this.props = props;
895
909
  }
896
910
  equals(entity) {
@@ -904,6 +918,13 @@ var EntityObject = class {
904
918
  }
905
919
  };
906
920
 
921
+ // src/core/entities/aggregate-root.ts
922
+ var AggregateRoot = class extends Entity {
923
+ static {
924
+ __name(this, "AggregateRoot");
925
+ }
926
+ };
927
+
907
928
  // src/core/entities/value-object.ts
908
929
  var ValueObject = class {
909
930
  static {
@@ -1511,6 +1532,7 @@ var baseEnvSchema = import_zod.z.object({
1511
1532
  });
1512
1533
  // Annotate the CommonJS export names for ESM import in node:
1513
1534
  0 && (module.exports = {
1535
+ AggregateObjectRoot,
1514
1536
  AggregateRoot,
1515
1537
  BaseController,
1516
1538
  Controller,
@@ -1526,6 +1548,7 @@ var baseEnvSchema = import_zod.z.object({
1526
1548
  NotificationFactory,
1527
1549
  SentryNotifier,
1528
1550
  UniqueEntityId,
1551
+ UniqueObjectUniqueId,
1529
1552
  ValueObject,
1530
1553
  WatchedList,
1531
1554
  baseEnvSchema,