ddd-node 31.0.0 → 32.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.
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
2
|
import { DomainModel, InferredProps, Props, PropsBuilder } from "../../../base";
|
|
3
3
|
import { ClassStatic } from "../../../types";
|
|
4
|
-
export declare class
|
|
5
|
-
constructor(props?: P | PropsBuilder<
|
|
4
|
+
export declare class ValueObject<P extends Props> extends DomainModel<P> {
|
|
5
|
+
constructor(props?: P | PropsBuilder<ValueObject<P>>);
|
|
6
6
|
_constructor(): ValueObjectClass<this>;
|
|
7
7
|
props(): P;
|
|
8
8
|
equals<V extends AnyValueObject>(vo: V): boolean;
|
|
@@ -11,8 +11,8 @@ export declare class ValueObjectBase<P extends Props> extends DomainModel<P> {
|
|
|
11
11
|
getEqualityValue(): string;
|
|
12
12
|
protected getEqualityObject(): any;
|
|
13
13
|
}
|
|
14
|
-
export type AnyValueObject =
|
|
15
|
-
export interface ValueObjectClass<T extends AnyValueObject = AnyValueObject> extends Class<T>, ClassStatic<typeof
|
|
14
|
+
export type AnyValueObject = ValueObject<Props>;
|
|
15
|
+
export interface ValueObjectClass<T extends AnyValueObject = AnyValueObject> extends Class<T>, ClassStatic<typeof ValueObject<InferredProps<T>>> {
|
|
16
16
|
}
|
|
17
|
-
export interface ValueObjectClassWithTypedConstructor<T extends AnyValueObject = AnyValueObject> extends Class<T, ConstructorParameters<typeof
|
|
17
|
+
export interface ValueObjectClassWithTypedConstructor<T extends AnyValueObject = AnyValueObject> extends Class<T, ConstructorParameters<typeof ValueObject<InferredProps<T>>>> {
|
|
18
18
|
}
|
|
@@ -11,12 +11,12 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
|
-
var
|
|
14
|
+
var ValueObject_1;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
16
|
+
exports.ValueObject = void 0;
|
|
17
17
|
const lodash_1 = __importDefault(require("lodash"));
|
|
18
18
|
const base_1 = require("../../../base");
|
|
19
|
-
let
|
|
19
|
+
let ValueObject = ValueObject_1 = class ValueObject extends base_1.DomainModel {
|
|
20
20
|
constructor(props) {
|
|
21
21
|
super();
|
|
22
22
|
if (props)
|
|
@@ -46,7 +46,7 @@ let ValueObjectBase = ValueObjectBase_1 = class ValueObjectBase extends base_1.D
|
|
|
46
46
|
getEqualityObject() {
|
|
47
47
|
const result = {};
|
|
48
48
|
const props = this.props();
|
|
49
|
-
const valueOf = (v) => v instanceof
|
|
49
|
+
const valueOf = (v) => v instanceof ValueObject_1 ? v.getEqualityObject() : v;
|
|
50
50
|
for (let [key, value] of Object.entries(props)) {
|
|
51
51
|
if (Array.isArray(value)) {
|
|
52
52
|
result[key] = value.map((v) => valueOf(v));
|
|
@@ -61,8 +61,8 @@ let ValueObjectBase = ValueObjectBase_1 = class ValueObjectBase extends base_1.D
|
|
|
61
61
|
return result;
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
64
|
+
exports.ValueObject = ValueObject;
|
|
65
|
+
exports.ValueObject = ValueObject = ValueObject_1 = __decorate([
|
|
66
66
|
(0, base_1.Mutable)(false),
|
|
67
67
|
__metadata("design:paramtypes", [Object])
|
|
68
|
-
],
|
|
68
|
+
], ValueObject);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ddd-node","version":"
|
|
1
|
+
{"name":"ddd-node","version":"32.0.0","description":"Domain Driven Design base for NodeJs","type":"commonjs","main":"index.js","types":"index.d.ts","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","tsconfig-paths":"^4.2.0","typescript":"^5.2.2"},"dependencies":{"lodash":"^4.17.21","reflect-metadata":"^0.1.13","ts-node":"^10.9.2","tsc-alias":"^1.8.8","type-fest":"^4.20.1","uuid":"^9.0.1"}}
|