ddd-node 17.1.0 → 17.2.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,4 +1,5 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
+
import { ModelId } from "../../meta";
|
|
2
3
|
import { ClassStatic } from "../../types";
|
|
3
4
|
export type PropKey = string | symbol;
|
|
4
5
|
export interface Props {
|
|
@@ -14,7 +15,8 @@ export declare class ModelBase<P extends Props> {
|
|
|
14
15
|
static mutable(): boolean;
|
|
15
16
|
static modelName<T extends AnyModel>(this: ModelClass<T>): string;
|
|
16
17
|
static modelVersion<T extends AnyModel>(this: ModelClass<T>): number;
|
|
17
|
-
static modelId<T extends AnyModel>(this: ModelClass<T>):
|
|
18
|
+
static modelId<T extends AnyModel>(this: ModelClass<T>): ModelId;
|
|
19
|
+
static hasModelId<T extends AnyModel>(this: ModelClass<T>, modelId: ModelId): boolean;
|
|
18
20
|
static ownPropsValidator<T extends AnyModel>(this: ModelClass<T>): import("../../meta").PropsValidator<T> | undefined;
|
|
19
21
|
static propsValidators<T extends AnyModel>(this: ModelClass<T>): import("../../meta").PropsValidator<AnyModel>[];
|
|
20
22
|
static ownStaticValues<T extends AnyModel>(this: ModelClass<T>): Map<PropertyKey, import("../../meta").StaticValue<T>>;
|
|
@@ -27,7 +29,8 @@ export declare class ModelBase<P extends Props> {
|
|
|
27
29
|
isMutable(): boolean;
|
|
28
30
|
modelName(): string;
|
|
29
31
|
modelVersion(): number;
|
|
30
|
-
modelId():
|
|
32
|
+
modelId(): ModelId;
|
|
33
|
+
hasModelId(modelId: ModelId): boolean;
|
|
31
34
|
ownPropsValidator(): import("../../meta").PropsValidator<this> | undefined;
|
|
32
35
|
propsValidators(): import("../../meta").PropsValidator<AnyModel>[];
|
|
33
36
|
ownPropsMap(): import("../../meta").PropsMap<ModelBase<any>>;
|
package/dist/core/model/model.js
CHANGED
|
@@ -23,6 +23,9 @@ class ModelBase {
|
|
|
23
23
|
static modelId() {
|
|
24
24
|
return (0, meta_1.getModelId)(this);
|
|
25
25
|
}
|
|
26
|
+
static hasModelId(modelId) {
|
|
27
|
+
return this.modelId().equals(modelId);
|
|
28
|
+
}
|
|
26
29
|
static ownPropsValidator() {
|
|
27
30
|
return (0, meta_1.getOwnPropsValidator)(this);
|
|
28
31
|
}
|
|
@@ -72,6 +75,9 @@ class ModelBase {
|
|
|
72
75
|
modelId() {
|
|
73
76
|
return this._modelClass.modelId();
|
|
74
77
|
}
|
|
78
|
+
hasModelId(modelId) {
|
|
79
|
+
return this._modelClass.hasModelId(modelId);
|
|
80
|
+
}
|
|
75
81
|
ownPropsValidator() {
|
|
76
82
|
return this._modelClass.ownPropsValidator();
|
|
77
83
|
}
|
|
@@ -142,7 +142,7 @@ const getPropsValidators = (target) => {
|
|
|
142
142
|
return validators();
|
|
143
143
|
};
|
|
144
144
|
exports.getPropsValidators = getPropsValidators;
|
|
145
|
-
//
|
|
145
|
+
// OWN STATIC VALUES
|
|
146
146
|
const OwnStaticValuesMetaKey = Symbol.for("OWN_STATIC_VALUES");
|
|
147
147
|
const getOwnStaticValues = (target) => {
|
|
148
148
|
const ownStaticValues = () => Reflect.getOwnMetadata(OwnStaticValuesMetaKey, target);
|
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ddd-node","version":"17.
|
|
1
|
+
{"name":"ddd-node","version":"17.2.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","nodejs-snowflake":"^2.0.1","reflect-metadata":"^0.1.13","tsc-alias":"^1.8.8","type-fest":"^4.15.0","uuid":"^9.0.1"}}
|