ddd-node 30.0.0 → 30.1.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/base/domain.d.ts
CHANGED
|
@@ -9,15 +9,13 @@ export declare class Domain {
|
|
|
9
9
|
export declare class DomainMap extends Map<DomainName, Domain> {
|
|
10
10
|
}
|
|
11
11
|
export declare class DomainManager {
|
|
12
|
-
static _instance
|
|
12
|
+
private static _instance;
|
|
13
13
|
static instance(): DomainManager;
|
|
14
14
|
private constructor();
|
|
15
15
|
private _domains;
|
|
16
16
|
isDefaultDomain(domain: Domain): boolean;
|
|
17
17
|
hasDomain(domainName: DomainName): boolean;
|
|
18
|
-
getDomain(): Domain;
|
|
19
|
-
getDomain(domainName: typeof DEFAULT_DOMAIN): Domain;
|
|
20
|
-
getDomain(domainName: DomainName): Domain | undefined;
|
|
18
|
+
getDomain(domainName?: DomainName): Domain;
|
|
21
19
|
addDomain(domain: Domain): void;
|
|
22
20
|
deleteDomain(domainName: DomainName): void;
|
|
23
21
|
}
|
package/base/domain.js
CHANGED
|
@@ -31,10 +31,12 @@ class DomainManager {
|
|
|
31
31
|
return this._domains.has(domainName);
|
|
32
32
|
}
|
|
33
33
|
getDomain(domainName) {
|
|
34
|
-
if (domainName)
|
|
34
|
+
if (domainName) {
|
|
35
|
+
if (!this.hasDomain(domainName))
|
|
36
|
+
this.addDomain(new Domain(domainName));
|
|
35
37
|
return this._domains.get(domainName);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
}
|
|
39
|
+
return this.getDomain(exports.DEFAULT_DOMAIN);
|
|
38
40
|
}
|
|
39
41
|
addDomain(domain) {
|
|
40
42
|
if (this.hasDomain(domain.name))
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModelOptions } from "../../base";
|
|
1
2
|
import { AnyCommand, CommandClass } from "../../core";
|
|
2
3
|
import { CommandType } from "../../meta";
|
|
3
|
-
export declare const Command: (commandType: CommandType) => <T extends AnyCommand>(target: CommandClass<T, any[]>) => void;
|
|
4
|
+
export declare const Command: (commandType: CommandType, modelOptions?: ModelOptions) => <T extends AnyCommand>(target: CommandClass<T, any[]>) => void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Command = void 0;
|
|
4
|
+
const base_1 = require("../../base");
|
|
4
5
|
const meta_1 = require("../../meta");
|
|
5
|
-
const Command = (commandType) => {
|
|
6
|
+
const Command = (commandType, modelOptions) => {
|
|
6
7
|
return (target) => {
|
|
7
8
|
(0, meta_1.defineCommandType)(target, commandType);
|
|
9
|
+
(0, base_1.Model)(modelOptions);
|
|
8
10
|
};
|
|
9
11
|
};
|
|
10
12
|
exports.Command = Command;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModelOptions } from "../../base";
|
|
1
2
|
import { AnyEvent, EventClass } from "../../core";
|
|
2
3
|
import { EventType } from "../../meta";
|
|
3
|
-
export declare const Event: (eventType: EventType) => <T extends AnyEvent>(target: EventClass<T, any[]>) => void;
|
|
4
|
+
export declare const Event: (eventType: EventType, modelOptions?: ModelOptions) => <T extends AnyEvent>(target: EventClass<T, any[]>) => void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Event = void 0;
|
|
4
|
+
const base_1 = require("../../base");
|
|
4
5
|
const meta_1 = require("../../meta");
|
|
5
|
-
const Event = (eventType) => {
|
|
6
|
+
const Event = (eventType, modelOptions) => {
|
|
6
7
|
return (target) => {
|
|
7
8
|
(0, meta_1.defineEventType)(target, eventType);
|
|
9
|
+
(0, base_1.Model)(modelOptions);
|
|
8
10
|
};
|
|
9
11
|
};
|
|
10
12
|
exports.Event = Event;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ddd-node","version":"30.
|
|
1
|
+
{"name":"ddd-node","version":"30.1.1","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"}}
|