plutin 1.5.0 → 1.5.1
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 +48 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -20
- package/dist/index.d.ts +23 -20
- package/dist/index.mjs +46 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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-
|
|
791
|
-
var
|
|
792
|
-
var
|
|
792
|
+
// src/core/entities/unique-object-id.ts
|
|
793
|
+
var import_bson = require("bson");
|
|
794
|
+
var UniqueObjectUniqueId = class {
|
|
793
795
|
static {
|
|
794
|
-
__name(this, "
|
|
796
|
+
__name(this, "UniqueObjectUniqueId");
|
|
795
797
|
}
|
|
796
798
|
value;
|
|
797
799
|
constructor(value) {
|
|
798
|
-
this.value =
|
|
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
|
|
813
|
+
// src/core/entities/entity-object.ts
|
|
814
|
+
var EntityObject = class {
|
|
813
815
|
static {
|
|
814
|
-
__name(this, "
|
|
816
|
+
__name(this, "EntityObject");
|
|
815
817
|
}
|
|
816
818
|
_id;
|
|
817
819
|
props;
|
|
@@ -821,20 +823,8 @@ var Entity = class {
|
|
|
821
823
|
set id(id) {
|
|
822
824
|
this._id = id;
|
|
823
825
|
}
|
|
824
|
-
get createdAt() {
|
|
825
|
-
return this.props.createdAt;
|
|
826
|
-
}
|
|
827
|
-
set createdAt(date) {
|
|
828
|
-
this.props.createdAt = date;
|
|
829
|
-
}
|
|
830
|
-
get updatedAt() {
|
|
831
|
-
return this.props.updatedAt;
|
|
832
|
-
}
|
|
833
|
-
touch() {
|
|
834
|
-
this.props.updatedAt = /* @__PURE__ */ new Date();
|
|
835
|
-
}
|
|
836
826
|
constructor(props, id) {
|
|
837
|
-
this._id = id ?? new
|
|
827
|
+
this._id = id ?? new UniqueObjectUniqueId(id);
|
|
838
828
|
this.props = props;
|
|
839
829
|
}
|
|
840
830
|
equals(entity) {
|
|
@@ -848,38 +838,38 @@ var Entity = class {
|
|
|
848
838
|
}
|
|
849
839
|
};
|
|
850
840
|
|
|
851
|
-
// src/core/entities/aggregate-root.ts
|
|
852
|
-
var
|
|
841
|
+
// src/core/entities/aggregate-object-root.ts
|
|
842
|
+
var AggregateObjectRoot = class extends EntityObject {
|
|
853
843
|
static {
|
|
854
|
-
__name(this, "
|
|
844
|
+
__name(this, "AggregateObjectRoot");
|
|
855
845
|
}
|
|
856
846
|
};
|
|
857
847
|
|
|
858
|
-
// src/core/entities/
|
|
859
|
-
var
|
|
860
|
-
var
|
|
848
|
+
// src/core/entities/unique-entity-id.ts
|
|
849
|
+
var import_node_crypto = require("crypto");
|
|
850
|
+
var UniqueEntityId = class {
|
|
861
851
|
static {
|
|
862
|
-
__name(this, "
|
|
852
|
+
__name(this, "UniqueEntityId");
|
|
863
853
|
}
|
|
864
854
|
value;
|
|
865
855
|
constructor(value) {
|
|
866
|
-
this.value =
|
|
856
|
+
this.value = value ?? (0, import_node_crypto.randomUUID)();
|
|
867
857
|
}
|
|
868
858
|
toString() {
|
|
869
|
-
return this.value
|
|
859
|
+
return this.value;
|
|
870
860
|
}
|
|
871
861
|
toValue() {
|
|
872
|
-
return this.value
|
|
862
|
+
return this.value;
|
|
873
863
|
}
|
|
874
864
|
equals(id) {
|
|
875
865
|
return id.toValue() === this.toValue();
|
|
876
866
|
}
|
|
877
867
|
};
|
|
878
868
|
|
|
879
|
-
// src/core/entities/entity
|
|
880
|
-
var
|
|
869
|
+
// src/core/entities/entity.ts
|
|
870
|
+
var Entity = class {
|
|
881
871
|
static {
|
|
882
|
-
__name(this, "
|
|
872
|
+
__name(this, "Entity");
|
|
883
873
|
}
|
|
884
874
|
_id;
|
|
885
875
|
props;
|
|
@@ -889,8 +879,20 @@ var EntityObject = class {
|
|
|
889
879
|
set id(id) {
|
|
890
880
|
this._id = id;
|
|
891
881
|
}
|
|
882
|
+
get createdAt() {
|
|
883
|
+
return this.props.createdAt;
|
|
884
|
+
}
|
|
885
|
+
set createdAt(date) {
|
|
886
|
+
this.props.createdAt = date;
|
|
887
|
+
}
|
|
888
|
+
get updatedAt() {
|
|
889
|
+
return this.props.updatedAt;
|
|
890
|
+
}
|
|
891
|
+
touch() {
|
|
892
|
+
this.props.updatedAt = /* @__PURE__ */ new Date();
|
|
893
|
+
}
|
|
892
894
|
constructor(props, id) {
|
|
893
|
-
this._id = id ?? new
|
|
895
|
+
this._id = id ?? new UniqueEntityId(id);
|
|
894
896
|
this.props = props;
|
|
895
897
|
}
|
|
896
898
|
equals(entity) {
|
|
@@ -904,6 +906,13 @@ var EntityObject = class {
|
|
|
904
906
|
}
|
|
905
907
|
};
|
|
906
908
|
|
|
909
|
+
// src/core/entities/aggregate-root.ts
|
|
910
|
+
var AggregateRoot = class extends Entity {
|
|
911
|
+
static {
|
|
912
|
+
__name(this, "AggregateRoot");
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
|
|
907
916
|
// src/core/entities/value-object.ts
|
|
908
917
|
var ValueObject = class {
|
|
909
918
|
static {
|
|
@@ -1511,6 +1520,7 @@ var baseEnvSchema = import_zod.z.object({
|
|
|
1511
1520
|
});
|
|
1512
1521
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1513
1522
|
0 && (module.exports = {
|
|
1523
|
+
AggregateObjectRoot,
|
|
1514
1524
|
AggregateRoot,
|
|
1515
1525
|
BaseController,
|
|
1516
1526
|
Controller,
|
|
@@ -1526,6 +1536,7 @@ var baseEnvSchema = import_zod.z.object({
|
|
|
1526
1536
|
NotificationFactory,
|
|
1527
1537
|
SentryNotifier,
|
|
1528
1538
|
UniqueEntityId,
|
|
1539
|
+
UniqueObjectUniqueId,
|
|
1529
1540
|
ValueObject,
|
|
1530
1541
|
WatchedList,
|
|
1531
1542
|
baseEnvSchema,
|