ddd-node 24.1.1 → 24.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.
- package/dist/{model → base}/decorators/model.d.ts +1 -1
- package/dist/base/decorators/mutable.d.ts +2 -0
- package/dist/{model → base}/decorators/prop.d.ts +1 -1
- package/dist/base/decorators/static.d.ts +3 -0
- package/dist/{model → base}/index.d.ts +1 -1
- package/dist/{model → base}/index.js +1 -1
- package/dist/{model → base}/meta/model-domain.d.ts +1 -1
- package/dist/{model → base}/meta/model-id.d.ts +1 -1
- package/dist/{model → base}/meta/model-name.d.ts +1 -1
- package/dist/{model → base}/meta/model-props-map.d.ts +1 -1
- package/dist/{model → base}/meta/model-props-map.js +2 -2
- package/dist/{model → base}/meta/model-props-validator.d.ts +1 -1
- package/dist/{model → base}/meta/model-static-values.d.ts +1 -1
- package/dist/{model → base}/meta/model-version.d.ts +1 -1
- package/dist/{model/core → base/model}/model.d.ts +3 -1
- package/dist/{model → base}/model-registry.d.ts +1 -1
- package/dist/core/aggregate/aggregate-base/aggregate-event-dispatcher.interface.d.ts +4 -0
- package/dist/core/aggregate/aggregate-base/aggregate.d.ts +3 -3
- package/dist/core/aggregate/aggregate-base/index.d.ts +1 -0
- package/dist/core/aggregate/aggregate-base/index.js +1 -0
- package/dist/core/aggregate/event-sourced-aggregate/event-sourced-aggregate-model-descriptor.d.ts +1 -1
- package/dist/core/aggregate/event-sourced-aggregate/event-sourced-aggregate.d.ts +3 -3
- package/dist/core/aggregate/event-sourced-aggregate/snapshot.d.ts +1 -1
- package/dist/core/aggregate/index.d.ts +0 -1
- package/dist/core/aggregate/index.js +0 -1
- package/dist/core/aggregate/state-aggregate/state-aggregate.d.ts +3 -4
- package/dist/core/entity/entity.builder.d.ts +1 -1
- package/dist/core/entity/entity.builder.js +2 -2
- package/dist/core/entity/entity.d.ts +1 -1
- package/dist/core/entity/entity.js +2 -2
- package/dist/core/enum/enum-builder.d.ts +1 -1
- package/dist/core/enum/enum-builder.js +2 -2
- package/dist/core/enum/enum.d.ts +2 -1
- package/dist/core/enum/enum.js +7 -4
- package/dist/core/identifiable-model/identifiable-model.builder.d.ts +1 -1
- package/dist/core/identifiable-model/identifiable-model.builder.js +2 -2
- package/dist/core/identifiable-model/identifiable-model.d.ts +1 -1
- package/dist/core/identifiable-model/identifiable-model.js +2 -2
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -1
- package/dist/core/message/command/command-model-descriptor.d.ts +1 -1
- package/dist/core/message/command/command.d.ts +1 -1
- package/dist/core/message/event/event-model-descriptor.d.ts +1 -1
- package/dist/core/message/event/event.d.ts +1 -1
- package/dist/core/message/message-base/message.d.ts +1 -1
- package/dist/core/message/message-base/message.js +2 -2
- package/dist/core/value-object/value-object.builder.d.ts +1 -1
- package/dist/core/value-object/value-object.builder.js +2 -2
- package/dist/core/value-object/value-object.d.ts +3 -1
- package/dist/core/value-object/value-object.js +26 -5
- package/dist/decorators/enum.js +2 -2
- package/dist/event-pubsub/decorators/event-subscriber.d.ts +5 -0
- package/dist/event-pubsub/decorators/event-subscriber.js +11 -0
- package/dist/event-pubsub/decorators/index.d.ts +1 -0
- package/dist/event-pubsub/decorators/index.js +17 -0
- package/dist/{core/event-pubsub → event-pubsub}/event-publisher.d.ts +2 -5
- package/dist/{core/event-pubsub → event-pubsub}/event-subscriber-registry.d.ts +2 -9
- package/dist/{core/event-pubsub → event-pubsub}/event-subscriber-registry.js +1 -1
- package/dist/event-pubsub/event-subscriber.d.ts +13 -0
- package/dist/{core/event-pubsub → event-pubsub}/event-subscriber.js +10 -2
- package/dist/{core/event-pubsub → event-pubsub}/index.d.ts +2 -0
- package/dist/{core/event-pubsub → event-pubsub}/index.js +2 -0
- package/dist/event-pubsub/interfaces/event-publisher.interface.d.ts +4 -0
- package/dist/event-pubsub/interfaces/event-publisher.interface.js +2 -0
- package/dist/event-pubsub/interfaces/event-subscriber-registry.interface.d.ts +9 -0
- package/dist/event-pubsub/interfaces/event-subscriber-registry.interface.js +2 -0
- package/dist/event-pubsub/interfaces/event-subscriber.interface.d.ts +6 -0
- package/dist/event-pubsub/interfaces/event-subscriber.interface.js +2 -0
- package/dist/event-pubsub/interfaces/index.d.ts +3 -0
- package/dist/event-pubsub/interfaces/index.js +19 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/dist/core/aggregate/event-dispatcher.interface.d.ts +0 -4
- package/dist/core/event-pubsub/event-subscriber.d.ts +0 -13
- package/dist/model/decorators/mutable.d.ts +0 -2
- package/dist/model/decorators/static.d.ts +0 -3
- /package/dist/{model → base}/decorators/index.d.ts +0 -0
- /package/dist/{model → base}/decorators/index.js +0 -0
- /package/dist/{model → base}/decorators/model.js +0 -0
- /package/dist/{model → base}/decorators/mutable.js +0 -0
- /package/dist/{model → base}/decorators/prop.js +0 -0
- /package/dist/{model → base}/decorators/static.js +0 -0
- /package/dist/{model → base}/domain.d.ts +0 -0
- /package/dist/{model → base}/domain.js +0 -0
- /package/dist/{model → base}/meta/index.d.ts +0 -0
- /package/dist/{model → base}/meta/index.js +0 -0
- /package/dist/{model → base}/meta/model-domain.js +0 -0
- /package/dist/{model → base}/meta/model-id.js +0 -0
- /package/dist/{model → base}/meta/model-mutable.d.ts +0 -0
- /package/dist/{model → base}/meta/model-mutable.js +0 -0
- /package/dist/{model → base}/meta/model-name.js +0 -0
- /package/dist/{model → base}/meta/model-props-validator.js +0 -0
- /package/dist/{model → base}/meta/model-static-values.js +0 -0
- /package/dist/{model → base}/meta/model-version.js +0 -0
- /package/dist/{model/core → base/model}/errors.d.ts +0 -0
- /package/dist/{model/core → base/model}/errors.js +0 -0
- /package/dist/{model/core → base/model}/index.d.ts +0 -0
- /package/dist/{model/core → base/model}/index.js +0 -0
- /package/dist/{model/core → base/model}/model-descriptor.d.ts +0 -0
- /package/dist/{model/core → base/model}/model-descriptor.js +0 -0
- /package/dist/{model/core → base/model}/model.builder.d.ts +0 -0
- /package/dist/{model/core → base/model}/model.builder.js +0 -0
- /package/dist/{model/core → base/model}/model.js +0 -0
- /package/dist/{model → base}/model-registry.js +0 -0
- /package/dist/core/aggregate/{event-dispatcher.interface.js → aggregate-base/aggregate-event-dispatcher.interface.js} +0 -0
- /package/dist/{core/event-pubsub → event-pubsub}/event-publisher.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { AnyModel, PropsOf } from "../
|
|
1
|
+
import { AnyModel, PropsOf } from "../model";
|
|
2
2
|
export declare const Prop: <T extends AnyModel>(propTargetKey?: keyof PropsOf<T> | undefined) => (target: T, key: PropertyKey) => void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ModelClass } from "../model";
|
|
2
|
+
import { StaticValueBuilder } from "../meta";
|
|
3
|
+
export declare const Static: <T extends ModelClass<import("../model").AnyModel>, I extends InstanceType<T> = InstanceType<T>>(builder: StaticValueBuilder<I>) => (target: T, key: PropertyKey) => void;
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./meta"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./model"), exports);
|
|
19
19
|
__exportStar(require("./decorators"), exports);
|
|
20
20
|
__exportStar(require("./domain"), exports);
|
|
21
21
|
__exportStar(require("./model-registry"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyModel, ModelClass } from "../
|
|
1
|
+
import { AnyModel, ModelClass } from "../model";
|
|
2
2
|
export declare const ModelDomainMetaKey: unique symbol;
|
|
3
3
|
export declare const defineModelDomain: <T extends AnyModel>(target: ModelClass<T>, domainName: string) => void;
|
|
4
4
|
export declare const getModelDomain: <T extends AnyModel>(target: ModelClass<T>) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyModel, PropsOf } from "../
|
|
1
|
+
import { AnyModel, PropsOf } from "../model";
|
|
2
2
|
export declare class PropsMap<T extends AnyModel = AnyModel> extends Map<PropertyKey, keyof PropsOf<T>> {
|
|
3
3
|
}
|
|
4
4
|
export declare const getOwnPropsMap: <T extends AnyModel = AnyModel>(target: object) => PropsMap<T>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPropsMap = exports.defineProp = exports.getOwnPropsMap = exports.PropsMap = void 0;
|
|
4
|
-
const
|
|
4
|
+
const model_1 = require("../model");
|
|
5
5
|
const OwnPropsMapMetaKey = Symbol.for("OWN_PROPS_MAP");
|
|
6
6
|
class PropsMap extends Map {
|
|
7
7
|
}
|
|
@@ -27,7 +27,7 @@ const getPropsMap = (target) => {
|
|
|
27
27
|
const result = new PropsMap();
|
|
28
28
|
const ownPropsMapList = [];
|
|
29
29
|
do {
|
|
30
|
-
if (
|
|
30
|
+
if (model_1.ModelBase.isModel(_target)) {
|
|
31
31
|
const ownPropsMap = (0, exports.getOwnPropsMap)(_target);
|
|
32
32
|
ownPropsMapList.unshift(ownPropsMap);
|
|
33
33
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyModel, PropsOf } from "../
|
|
1
|
+
import { AnyModel, PropsOf } from "../model";
|
|
2
2
|
export type PropsValidator<T extends AnyModel = AnyModel> = (props: PropsOf<T>) => void;
|
|
3
3
|
export declare const definePropsValidator: <T extends AnyModel>(target: object, validator: PropsValidator<T>) => void;
|
|
4
4
|
export declare const getOwnPropsValidator: <T extends AnyModel>(target: object) => PropsValidator<T> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Class } from "type-fest";
|
|
1
|
+
import { AbstractClass, Class } from "type-fest";
|
|
2
2
|
import { ModelId, ModelName, ModelVersion, PropsMap, PropsValidator, StaticValuesMap } from "../meta";
|
|
3
3
|
import { ClassStatic } from "../../types";
|
|
4
4
|
import { ModelDescriptor } from "./model-descriptor";
|
|
@@ -36,3 +36,5 @@ export type AnyModel = ModelBase<Props>;
|
|
|
36
36
|
export type PropsOf<T extends AnyModel> = T extends ModelBase<infer P extends Props> ? P : never;
|
|
37
37
|
export interface ModelClass<T extends AnyModel = AnyModel> extends Class<T>, ClassStatic<typeof ModelBase<PropsOf<T>>> {
|
|
38
38
|
}
|
|
39
|
+
export interface AbstractModelClass<T extends AnyModel = AnyModel> extends AbstractClass<T>, ClassStatic<typeof ModelBase<PropsOf<T>>> {
|
|
40
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyModel, ModelClass } from "./
|
|
1
|
+
import { AnyModel, ModelClass } from "./model";
|
|
2
2
|
import { ModelId, ModelName, ModelVersion } from "./meta";
|
|
3
3
|
export declare class ModelVersionMap<T extends AnyModel = AnyModel> extends Map<ModelVersion, ModelClass<T>> {
|
|
4
4
|
readonly modelName: ModelName;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Props, PropsOf } from "../../../
|
|
1
|
+
import { Props, PropsOf } from "../../../base";
|
|
2
2
|
import { EntityBase, EntityMetadata } from "../../entity";
|
|
3
3
|
import { AnyEvent, EventClassWithTypedConstructor, EventSource } from "../../message";
|
|
4
|
-
import {
|
|
4
|
+
import { IAggregateEventDispatcher } from "./aggregate-event-dispatcher.interface";
|
|
5
5
|
export interface AggregateMetadata extends EntityMetadata {
|
|
6
6
|
version: number;
|
|
7
7
|
}
|
|
@@ -12,6 +12,6 @@ export declare abstract class AggregateBase<P extends Props> extends EntityBase<
|
|
|
12
12
|
metadata(): AggregateMetadata;
|
|
13
13
|
protected createEventSource(): EventSource;
|
|
14
14
|
protected newEvent<E extends AnyEvent>(eventClass: EventClassWithTypedConstructor<E>, props: PropsOf<E>): E;
|
|
15
|
-
abstract dispatchEvents(dispatcher:
|
|
15
|
+
abstract dispatchEvents(dispatcher: IAggregateEventDispatcher): void;
|
|
16
16
|
}
|
|
17
17
|
export type AnyAggregate = AggregateBase<Props>;
|
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./aggregate"), exports);
|
|
18
18
|
__exportStar(require("./aggregate.builder"), exports);
|
|
19
|
+
__exportStar(require("./aggregate-event-dispatcher.interface"), exports);
|
package/dist/core/aggregate/event-sourced-aggregate/event-sourced-aggregate-model-descriptor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyEventSourcedAggregate } from ".";
|
|
2
2
|
import { CommandHandlerMap, EventApplierMap } from "../../../meta";
|
|
3
|
-
import { ModelDescriptor } from "../../../
|
|
3
|
+
import { ModelDescriptor } from "../../../base";
|
|
4
4
|
export interface EventSourcedAggregateModelDescriptor<T extends AnyEventSourcedAggregate> extends ModelDescriptor<T> {
|
|
5
5
|
ownEventApplierMap: EventApplierMap;
|
|
6
6
|
eventApplierMap: EventApplierMap;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
-
import { Props, PropsOf } from "../../../
|
|
2
|
+
import { Props, PropsOf } from "../../../base";
|
|
3
3
|
import { ClassStatic } from "../../../types";
|
|
4
4
|
import { AnyCommand, AnyEvent, EventClassWithTypedConstructor } from "../../message";
|
|
5
5
|
import { AggregateBase, AggregateMetadata } from "../aggregate-base";
|
|
6
|
-
import {
|
|
6
|
+
import { IAggregateEventDispatcher } from "../aggregate-base";
|
|
7
7
|
import { EventSourcedAggregateModelDescriptor } from "./event-sourced-aggregate-model-descriptor";
|
|
8
8
|
import { Snapshot, SnapshotMetadata } from "./snapshot";
|
|
9
9
|
export interface EventSourceAggregateMetadata extends AggregateMetadata {
|
|
@@ -36,7 +36,7 @@ export declare class EventSourcedAggregateBase<P extends Props> extends Aggregat
|
|
|
36
36
|
snapMetadata(): SnapshotMetadata;
|
|
37
37
|
snap(): Snapshot<this>;
|
|
38
38
|
protected archiveEvents(): void;
|
|
39
|
-
dispatchEvents(dispatcher:
|
|
39
|
+
dispatchEvents(dispatcher: IAggregateEventDispatcher): void;
|
|
40
40
|
}
|
|
41
41
|
export type AnyEventSourcedAggregate = EventSourcedAggregateBase<Props>;
|
|
42
42
|
export interface EventSourcedAggregateClass<T extends AnyEventSourcedAggregate = AnyEventSourcedAggregate, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof EventSourcedAggregateBase<PropsOf<T>>> {
|
|
@@ -14,7 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./event-dispatcher.interface"), exports);
|
|
18
17
|
__exportStar(require("./aggregate-base"), exports);
|
|
19
18
|
__exportStar(require("./state-aggregate"), exports);
|
|
20
19
|
__exportStar(require("./event-sourced-aggregate"), exports);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
-
import { Props, PropsOf } from "../../../
|
|
2
|
+
import { Props, PropsOf } from "../../../base";
|
|
3
3
|
import { ClassStatic } from "../../../types";
|
|
4
4
|
import { AnyEvent, EventClassWithTypedConstructor } from "../../message";
|
|
5
|
-
import { AggregateBase, AggregateMetadata } from "../aggregate-base";
|
|
6
|
-
import { IEventDispatcher } from "../event-dispatcher.interface";
|
|
5
|
+
import { AggregateBase, AggregateMetadata, IAggregateEventDispatcher } from "../aggregate-base";
|
|
7
6
|
export interface StateAggregateMetadata extends AggregateMetadata {
|
|
8
7
|
}
|
|
9
8
|
export declare class StateAggregateBase<P extends Props> extends AggregateBase<P> {
|
|
@@ -15,7 +14,7 @@ export declare class StateAggregateBase<P extends Props> extends AggregateBase<P
|
|
|
15
14
|
protected recordEvent<E extends AnyEvent>(event: E): void;
|
|
16
15
|
protected recordEvent<E extends AnyEvent>(eventClass: EventClassWithTypedConstructor<E>, props: PropsOf<E>): void;
|
|
17
16
|
clearEvents(): void;
|
|
18
|
-
dispatchEvents(dispatcher:
|
|
17
|
+
dispatchEvents(dispatcher: IAggregateEventDispatcher): void;
|
|
19
18
|
}
|
|
20
19
|
export type AnyStateAggregate = StateAggregateBase<Props>;
|
|
21
20
|
export interface StateAggregateClass<T extends AnyStateAggregate = AnyStateAggregate, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof StateAggregateBase<PropsOf<T>>> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IdentifiableModelBuilder } from "
|
|
1
|
+
import { IdentifiableModelBuilder } from "../identifiable-model";
|
|
2
2
|
import { AnyEntity, EntityClassWithTypedConstructor } from "./entity";
|
|
3
3
|
export declare abstract class EntityBuilderBase<T extends AnyEntity> extends IdentifiableModelBuilder<T> {
|
|
4
4
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityBuilder = exports.EntityBuilderBase = void 0;
|
|
4
|
-
const
|
|
5
|
-
class EntityBuilderBase extends
|
|
4
|
+
const identifiable_model_1 = require("../identifiable-model");
|
|
5
|
+
class EntityBuilderBase extends identifiable_model_1.IdentifiableModelBuilder {
|
|
6
6
|
}
|
|
7
7
|
exports.EntityBuilderBase = EntityBuilderBase;
|
|
8
8
|
class EntityBuilder extends EntityBuilderBase {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
-
import { Props, PropsOf } from "../../
|
|
2
|
+
import { Props, PropsOf } from "../../base";
|
|
3
3
|
import { ClassStatic } from "../../types";
|
|
4
4
|
import { IdentifiableModel, IdentifiableModelMetadata } from "../identifiable-model";
|
|
5
5
|
export interface EntityMetadata extends IdentifiableModelMetadata {
|
|
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EntityBase = void 0;
|
|
13
|
-
const
|
|
13
|
+
const base_1 = require("../../base");
|
|
14
14
|
const identifiable_model_1 = require("../identifiable-model");
|
|
15
15
|
let EntityBase = class EntityBase extends identifiable_model_1.IdentifiableModel {
|
|
16
16
|
constructor(metadata, props) {
|
|
@@ -21,6 +21,6 @@ let EntityBase = class EntityBase extends identifiable_model_1.IdentifiableModel
|
|
|
21
21
|
};
|
|
22
22
|
exports.EntityBase = EntityBase;
|
|
23
23
|
exports.EntityBase = EntityBase = __decorate([
|
|
24
|
-
(0,
|
|
24
|
+
(0, base_1.Mutable)(true),
|
|
25
25
|
__metadata("design:paramtypes", [Object, Object])
|
|
26
26
|
], EntityBase);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EnumBuilder = void 0;
|
|
4
|
-
const
|
|
5
|
-
class EnumBuilder extends
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
class EnumBuilder extends base_1.ModelBuilder {
|
|
6
6
|
constructor(enumClass) {
|
|
7
7
|
super();
|
|
8
8
|
this.enumClass = enumClass;
|
package/dist/core/enum/enum.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
-
import { ModelBase } from "../../
|
|
2
|
+
import { ModelBase } from "../../base";
|
|
3
3
|
import { ClassStatic } from "../../types";
|
|
4
4
|
export type EnumValue = string | number;
|
|
5
5
|
export interface EnumProps {
|
|
@@ -9,6 +9,7 @@ export declare class EnumBase extends ModelBase<EnumProps> {
|
|
|
9
9
|
static values(): EnumBase[];
|
|
10
10
|
constructor(value: EnumValue);
|
|
11
11
|
value: EnumValue;
|
|
12
|
+
valueOf(): EnumValue;
|
|
12
13
|
}
|
|
13
14
|
export type AnyEnum = EnumBase;
|
|
14
15
|
export interface EnumClass<T extends AnyEnum = AnyEnum, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof EnumBase> {
|
package/dist/core/enum/enum.js
CHANGED
|
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EnumBase = void 0;
|
|
13
|
-
const
|
|
14
|
-
let EnumBase = class EnumBase extends
|
|
13
|
+
const base_1 = require("../../base");
|
|
14
|
+
let EnumBase = class EnumBase extends base_1.ModelBase {
|
|
15
15
|
static values() {
|
|
16
16
|
return Array.from(this.ownStaticValues().values()).map((staticValue) => staticValue.value);
|
|
17
17
|
}
|
|
@@ -19,13 +19,16 @@ let EnumBase = class EnumBase extends model_1.ModelBase {
|
|
|
19
19
|
super();
|
|
20
20
|
this.initializeProps({ value });
|
|
21
21
|
}
|
|
22
|
+
valueOf() {
|
|
23
|
+
return this.value;
|
|
24
|
+
}
|
|
22
25
|
};
|
|
23
26
|
exports.EnumBase = EnumBase;
|
|
24
27
|
__decorate([
|
|
25
|
-
(0,
|
|
28
|
+
(0, base_1.Prop)(),
|
|
26
29
|
__metadata("design:type", Object)
|
|
27
30
|
], EnumBase.prototype, "value", void 0);
|
|
28
31
|
exports.EnumBase = EnumBase = __decorate([
|
|
29
|
-
(0,
|
|
32
|
+
(0, base_1.Mutable)(false),
|
|
30
33
|
__metadata("design:paramtypes", [Object])
|
|
31
34
|
], EnumBase);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelBuilder } from "../../
|
|
1
|
+
import { ModelBuilder } from "../../base";
|
|
2
2
|
import { AnyIdentifiableModel } from "./identifiable-model";
|
|
3
3
|
import { Id } from "./id";
|
|
4
4
|
export declare abstract class IdentifiableModelBuilder<T extends AnyIdentifiableModel> extends ModelBuilder<T> {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdentifiableModelBuilder = void 0;
|
|
4
4
|
const uuid_1 = require("uuid");
|
|
5
|
-
const
|
|
6
|
-
class IdentifiableModelBuilder extends
|
|
5
|
+
const base_1 = require("../../base");
|
|
6
|
+
class IdentifiableModelBuilder extends base_1.ModelBuilder {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
9
|
this.id = this.newId();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdentifiableModel = void 0;
|
|
4
|
-
const
|
|
5
|
-
class IdentifiableModel extends
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
class IdentifiableModel extends base_1.ModelBase {
|
|
6
6
|
constructor(metadata) {
|
|
7
7
|
super();
|
|
8
8
|
this._id = metadata.id;
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyCommand } from "./command";
|
|
2
2
|
import { CommandType } from "../../../meta";
|
|
3
|
-
import { ModelDescriptor } from "../../../
|
|
3
|
+
import { ModelDescriptor } from "../../../base";
|
|
4
4
|
export interface CommandModelDescriptor<T extends AnyCommand> extends ModelDescriptor<T> {
|
|
5
5
|
commandType: CommandType;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
2
|
import { CommandType } from "../../../meta";
|
|
3
|
-
import { Props, PropsOf } from "../../../
|
|
3
|
+
import { Props, PropsOf } from "../../../base";
|
|
4
4
|
import { ClassStatic } from "../../../types";
|
|
5
5
|
import { MessageBase, MessageMetadata } from "../message-base";
|
|
6
6
|
import { CommandModelDescriptor } from "./command-model-descriptor";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnyEvent } from ".";
|
|
2
2
|
import { EventType } from "../../../meta";
|
|
3
|
-
import { ModelDescriptor } from "../../../
|
|
3
|
+
import { ModelDescriptor } from "../../../base";
|
|
4
4
|
export interface EventModelDescriptor<T extends AnyEvent> extends ModelDescriptor<T> {
|
|
5
5
|
eventType: EventType;
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
2
|
import { EventType } from "../../../meta";
|
|
3
|
-
import { Props, PropsOf } from "../../../
|
|
3
|
+
import { Props, PropsOf } from "../../../base";
|
|
4
4
|
import { ClassStatic } from "../../../types";
|
|
5
5
|
import { Id } from "../../identifiable-model";
|
|
6
6
|
import { MessageBase, MessageMetadata } from "../message-base";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
-
import { Props, PropsOf } from "../../../
|
|
2
|
+
import { Props, PropsOf } from "../../../base";
|
|
3
3
|
import { ClassStatic } from "../../../types";
|
|
4
4
|
import { IdentifiableModel, IdentifiableModelMetadata } from "../../identifiable-model";
|
|
5
5
|
export interface MessageContext {
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.MessageBase = void 0;
|
|
16
16
|
const lodash_1 = __importDefault(require("lodash"));
|
|
17
|
-
const
|
|
17
|
+
const base_1 = require("../../../base");
|
|
18
18
|
const identifiable_model_1 = require("../../identifiable-model");
|
|
19
19
|
let MessageBase = class MessageBase extends identifiable_model_1.IdentifiableModel {
|
|
20
20
|
constructor(metadata, props) {
|
|
@@ -45,6 +45,6 @@ let MessageBase = class MessageBase extends identifiable_model_1.IdentifiableMod
|
|
|
45
45
|
};
|
|
46
46
|
exports.MessageBase = MessageBase;
|
|
47
47
|
exports.MessageBase = MessageBase = __decorate([
|
|
48
|
-
(0,
|
|
48
|
+
(0, base_1.Mutable)(false),
|
|
49
49
|
__metadata("design:paramtypes", [Object, Object])
|
|
50
50
|
], MessageBase);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelBuilder } from "../../
|
|
1
|
+
import { ModelBuilder } from "../../base";
|
|
2
2
|
import { AnyValueObject, ValueObjectClassWithTypedConstructor } from "./value-object";
|
|
3
3
|
export declare class ValueObjectBuilder<T extends AnyValueObject> extends ModelBuilder<T> {
|
|
4
4
|
private valueObjectClass;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ValueObjectBuilder = void 0;
|
|
4
|
-
const
|
|
5
|
-
class ValueObjectBuilder extends
|
|
4
|
+
const base_1 = require("../../base");
|
|
5
|
+
class ValueObjectBuilder extends base_1.ModelBuilder {
|
|
6
6
|
constructor(valueObjectClass) {
|
|
7
7
|
super();
|
|
8
8
|
this.valueObjectClass = valueObjectClass;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Class } from "type-fest";
|
|
2
|
-
import { ModelBase, Props, PropsOf } from "../../
|
|
2
|
+
import { ModelBase, Props, PropsOf } from "../../base";
|
|
3
3
|
import { ClassStatic } from "../../types";
|
|
4
4
|
export declare class ValueObjectBase<P extends Props> extends ModelBase<P> {
|
|
5
5
|
constructor(props: P);
|
|
6
6
|
props(): P;
|
|
7
7
|
equals<V extends AnyValueObject>(vo: V): boolean;
|
|
8
8
|
with(props: Partial<P>): typeof this;
|
|
9
|
+
getEqualityValue(): string;
|
|
10
|
+
getEqualityObject(): any;
|
|
9
11
|
}
|
|
10
12
|
export type AnyValueObject = ValueObjectBase<Props>;
|
|
11
13
|
export interface ValueObjectClass<T extends AnyValueObject = AnyValueObject> extends Class<T>, ClassStatic<typeof ValueObjectBase<PropsOf<T>>> {
|
|
@@ -11,11 +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 ValueObjectBase_1;
|
|
14
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
16
|
exports.ValueObjectBase = void 0;
|
|
16
17
|
const lodash_1 = __importDefault(require("lodash"));
|
|
17
|
-
const
|
|
18
|
-
let ValueObjectBase = class ValueObjectBase extends
|
|
18
|
+
const base_1 = require("../../base");
|
|
19
|
+
let ValueObjectBase = ValueObjectBase_1 = class ValueObjectBase extends base_1.ModelBase {
|
|
19
20
|
constructor(props) {
|
|
20
21
|
super();
|
|
21
22
|
this.initializeProps(props);
|
|
@@ -25,16 +26,36 @@ let ValueObjectBase = class ValueObjectBase extends model_1.ModelBase {
|
|
|
25
26
|
}
|
|
26
27
|
equals(vo) {
|
|
27
28
|
const equalsType = vo instanceof this.constructor;
|
|
28
|
-
const equalsValue =
|
|
29
|
+
const equalsValue = this.getEqualityValue() === vo.getEqualityValue();
|
|
29
30
|
return equalsType && equalsValue;
|
|
30
31
|
}
|
|
31
32
|
with(props) {
|
|
32
33
|
const newProps = lodash_1.default.merge(this.props(), props);
|
|
33
34
|
return new this.constructor(newProps);
|
|
34
35
|
}
|
|
36
|
+
getEqualityValue() {
|
|
37
|
+
return JSON.stringify(this.getEqualityObject());
|
|
38
|
+
}
|
|
39
|
+
getEqualityObject() {
|
|
40
|
+
const result = {};
|
|
41
|
+
const props = this.props();
|
|
42
|
+
const valueOf = (v) => v instanceof ValueObjectBase_1 ? v.getEqualityObject() : v;
|
|
43
|
+
for (let [key, value] of Object.entries(props)) {
|
|
44
|
+
if (Array.isArray(value)) {
|
|
45
|
+
result[key] = value.map((v) => valueOf(v));
|
|
46
|
+
result[key].sort((a, b) => {
|
|
47
|
+
const stringValueOf = (v) => JSON.stringify(v);
|
|
48
|
+
return stringValueOf(a).localeCompare(stringValueOf(b));
|
|
49
|
+
});
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
result[key] = valueOf(value);
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
35
56
|
};
|
|
36
57
|
exports.ValueObjectBase = ValueObjectBase;
|
|
37
|
-
exports.ValueObjectBase = ValueObjectBase = __decorate([
|
|
38
|
-
(0,
|
|
58
|
+
exports.ValueObjectBase = ValueObjectBase = ValueObjectBase_1 = __decorate([
|
|
59
|
+
(0, base_1.Mutable)(false),
|
|
39
60
|
__metadata("design:paramtypes", [Object])
|
|
40
61
|
], ValueObjectBase);
|
package/dist/decorators/enum.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Enum = void 0;
|
|
4
|
-
const
|
|
4
|
+
const base_1 = require("../base");
|
|
5
5
|
const Enum = (value) => {
|
|
6
6
|
return (target, key) => {
|
|
7
|
-
(0,
|
|
7
|
+
(0, base_1.Static)(() => new target(value ?? key))(target, key);
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
exports.Enum = Enum;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Class } from "type-fest";
|
|
2
|
+
import { EventClass } from "../../core";
|
|
3
|
+
import { IEventSubscriber } from "../interfaces";
|
|
4
|
+
export declare const SubscribedEventsMetaKey: unique symbol;
|
|
5
|
+
export declare const SubscribeToEvents: <T extends EventClass<import("../../core").AnyEvent, any[]>>(subscribedEvents: T | T[]) => (target: Class<IEventSubscriber<InstanceType<T>>>) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscribeToEvents = exports.SubscribedEventsMetaKey = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
exports.SubscribedEventsMetaKey = Symbol.for("SUBSCRIBED_EVENTS");
|
|
6
|
+
const SubscribeToEvents = (subscribedEvents) => {
|
|
7
|
+
return (target) => {
|
|
8
|
+
Reflect.defineMetadata(exports.SubscribedEventsMetaKey, (0, utils_1.toArray)(subscribedEvents), target);
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
exports.SubscribeToEvents = SubscribeToEvents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./event-subscriber";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./event-subscriber"), exports);
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { AnyEvent } from "../
|
|
2
|
-
import { IEventSubscriberRegistry } from "./
|
|
3
|
-
export interface IEventPublisher {
|
|
4
|
-
publish<T extends AnyEvent = AnyEvent>(event: T): Promise<void>;
|
|
5
|
-
}
|
|
1
|
+
import { AnyEvent } from "../core";
|
|
2
|
+
import { IEventPublisher, IEventSubscriberRegistry } from "./interfaces";
|
|
6
3
|
export declare class EventPublisher implements IEventPublisher {
|
|
7
4
|
private subscriberRegistry;
|
|
8
5
|
constructor(subscriberRegistry: IEventSubscriberRegistry);
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { AnyEvent, EventClass } from "../
|
|
2
|
-
import { IEventSubscriber } from "./
|
|
3
|
-
export type Unsubscriber = () => void;
|
|
4
|
-
export interface IEventSubscriberRegistry {
|
|
5
|
-
registerSubscriber(subscriber: IEventSubscriber): Unsubscriber;
|
|
6
|
-
deregisterSubscriber(subscriber: IEventSubscriber): void;
|
|
7
|
-
getSubscribersForEvent<T extends AnyEvent = AnyEvent>(eventType: EventClass<T>): IEventSubscriber<T>[];
|
|
8
|
-
getSubscribers(): IEventSubscriber[];
|
|
9
|
-
}
|
|
1
|
+
import { AnyEvent, EventClass } from "../core";
|
|
2
|
+
import { IEventSubscriber, IEventSubscriberRegistry } from "./interfaces";
|
|
10
3
|
export declare class EventSubscriberRegistry implements IEventSubscriberRegistry {
|
|
11
4
|
private static _instance;
|
|
12
5
|
static instance(): EventSubscriberRegistry;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EventSubscriberRegistry = void 0;
|
|
4
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
5
|
class EventSubscriberRegistry {
|
|
6
6
|
static instance() {
|
|
7
7
|
if (!this._instance)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AnyEvent, EventClass } from "../core";
|
|
2
|
+
import { EventSubscriberHandler, IEventSubscriber } from "./interfaces";
|
|
3
|
+
export declare abstract class EventSubscriber<T extends AnyEvent = AnyEvent> implements IEventSubscriber<T> {
|
|
4
|
+
subscribeToEvents(): EventClass<T, any[]> | EventClass<T, any[]>[];
|
|
5
|
+
abstract handleEvent(event: T): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare class DynamicEventSubscriber<T extends AnyEvent = AnyEvent> implements IEventSubscriber<T> {
|
|
8
|
+
private readonly subscribedEvents;
|
|
9
|
+
private readonly eventHandler;
|
|
10
|
+
constructor(subscribedEvents: EventClass<T> | EventClass<T>[], eventHandler: EventSubscriberHandler<T>);
|
|
11
|
+
subscribeToEvents(): EventClass<T, any[]> | EventClass<T, any[]>[];
|
|
12
|
+
handleEvent(event: T): Promise<void>;
|
|
13
|
+
}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventSubscriber = void 0;
|
|
3
|
+
exports.DynamicEventSubscriber = exports.EventSubscriber = void 0;
|
|
4
|
+
const decorators_1 = require("./decorators");
|
|
4
5
|
class EventSubscriber {
|
|
6
|
+
subscribeToEvents() {
|
|
7
|
+
const subscribedEvents = Reflect.getOwnMetadata(decorators_1.SubscribedEventsMetaKey, this.constructor) ?? [];
|
|
8
|
+
return subscribedEvents;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.EventSubscriber = EventSubscriber;
|
|
12
|
+
class DynamicEventSubscriber {
|
|
5
13
|
constructor(subscribedEvents, eventHandler) {
|
|
6
14
|
this.subscribedEvents = subscribedEvents;
|
|
7
15
|
this.eventHandler = eventHandler;
|
|
@@ -13,4 +21,4 @@ class EventSubscriber {
|
|
|
13
21
|
return this.eventHandler(event);
|
|
14
22
|
}
|
|
15
23
|
}
|
|
16
|
-
exports.
|
|
24
|
+
exports.DynamicEventSubscriber = DynamicEventSubscriber;
|
|
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./interfaces"), exports);
|
|
18
|
+
__exportStar(require("./decorators"), exports);
|
|
17
19
|
__exportStar(require("./event-subscriber"), exports);
|
|
18
20
|
__exportStar(require("./event-publisher"), exports);
|
|
19
21
|
__exportStar(require("./event-subscriber-registry"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnyEvent, EventClass } from "../../core";
|
|
2
|
+
import { IEventSubscriber } from "./event-subscriber.interface";
|
|
3
|
+
export type Unsubscriber = () => void;
|
|
4
|
+
export interface IEventSubscriberRegistry {
|
|
5
|
+
registerSubscriber(subscriber: IEventSubscriber): Unsubscriber;
|
|
6
|
+
deregisterSubscriber(subscriber: IEventSubscriber): void;
|
|
7
|
+
getSubscribersForEvent<T extends AnyEvent = AnyEvent>(eventType: EventClass<T>): IEventSubscriber<T>[];
|
|
8
|
+
getSubscribers(): IEventSubscriber[];
|
|
9
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AnyEvent, EventClass } from "../../core";
|
|
2
|
+
export interface IEventSubscriber<T extends AnyEvent = AnyEvent> {
|
|
3
|
+
subscribeToEvents(): EventClass<T> | EventClass<T>[];
|
|
4
|
+
handleEvent(event: T): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export type EventSubscriberHandler<T extends AnyEvent = AnyEvent> = IEventSubscriber<T>["handleEvent"];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./event-publisher.interface"), exports);
|
|
18
|
+
__exportStar(require("./event-subscriber.interface"), exports);
|
|
19
|
+
__exportStar(require("./event-subscriber-registry.interface"), exports);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
/// <reference types="src
|
|
2
|
-
export * from "./
|
|
1
|
+
/// <reference types="src/#declarations" />
|
|
2
|
+
export * from "./base";
|
|
3
3
|
export * from "./meta";
|
|
4
4
|
export * from "./types";
|
|
5
5
|
export * from "./utils";
|
|
6
6
|
export * from "./core";
|
|
7
|
+
export * from "./event-pubsub";
|
|
7
8
|
export * from "./decorators";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/// <reference path="
|
|
2
|
+
/// <reference path="./#declarations/index.d.ts" />
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -15,9 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./base"), exports);
|
|
19
19
|
__exportStar(require("./meta"), exports);
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
21
21
|
__exportStar(require("./utils"), exports);
|
|
22
22
|
__exportStar(require("./core"), exports);
|
|
23
|
+
__exportStar(require("./event-pubsub"), exports);
|
|
23
24
|
__exportStar(require("./decorators"), exports);
|
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ddd-node","version":"24.
|
|
1
|
+
{"name":"ddd-node","version":"24.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","reflect-metadata":"^0.1.13","tsc-alias":"^1.8.8","type-fest":"^4.20.1","uuid":"^9.0.1"}}
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AnyEvent, EventClass } from "../message";
|
|
2
|
-
export interface IEventSubscriber<T extends AnyEvent = AnyEvent> {
|
|
3
|
-
subscribeToEvents(): EventClass<T> | EventClass<T>[];
|
|
4
|
-
handleEvent(event: T): Promise<void>;
|
|
5
|
-
}
|
|
6
|
-
export type EventSubscriberHandler<T extends AnyEvent = AnyEvent> = IEventSubscriber<T>["handleEvent"];
|
|
7
|
-
export declare class EventSubscriber<T extends AnyEvent = AnyEvent> implements IEventSubscriber<T> {
|
|
8
|
-
private readonly subscribedEvents;
|
|
9
|
-
private readonly eventHandler;
|
|
10
|
-
constructor(subscribedEvents: EventClass<T> | EventClass<T>[], eventHandler: EventSubscriberHandler<T>);
|
|
11
|
-
subscribeToEvents(): EventClass<T, any[]> | EventClass<T, any[]>[];
|
|
12
|
-
handleEvent(event: T): Promise<void>;
|
|
13
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ModelClass } from "../core";
|
|
2
|
-
import { StaticValueBuilder } from "../meta";
|
|
3
|
-
export declare const Static: <T extends ModelClass<import("../core").AnyModel>, I extends InstanceType<T> = InstanceType<T>>(builder: StaticValueBuilder<I>) => (target: T, key: PropertyKey) => void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|