ddd-node 30.1.2 → 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.
- package/base/decorators/model.d.ts +5 -5
- package/base/decorators/mutable.d.ts +2 -2
- package/base/decorators/prop.d.ts +2 -2
- package/base/decorators/props-validator.d.ts +2 -2
- package/base/decorators/static.d.ts +2 -2
- package/base/domain.d.ts +1 -0
- package/base/domain.js +3 -0
- package/base/meta/model-domain.d.ts +4 -3
- package/base/meta/model-id.d.ts +3 -3
- package/base/meta/model-mutable.d.ts +1 -0
- package/base/meta/model-mutable.js +1 -0
- package/base/meta/model-name.d.ts +3 -3
- package/base/meta/model-props-map.d.ts +5 -5
- package/base/meta/model-props-map.js +1 -1
- package/base/meta/model-props-validator.d.ts +4 -4
- package/base/meta/model-static-values.d.ts +8 -8
- package/base/meta/model-version.d.ts +3 -3
- package/base/model/index.d.ts +0 -1
- package/base/model/index.js +0 -1
- package/base/model/model-descriptor.d.ts +15 -12
- package/base/model/model-descriptor.js +39 -0
- package/base/model/model.d.ts +10 -20
- package/base/model/model.js +23 -52
- package/base/model-registry.d.ts +14 -10
- package/base/model-registry.js +42 -27
- package/core/decorators/enum/index.d.ts +1 -0
- package/core/decorators/enum/index.js +17 -0
- package/core/decorators/enum/is-enum.d.ts +2 -0
- package/{decorators/enum.js → core/decorators/enum/is-enum.js} +4 -4
- package/core/decorators/es-aggregate/handle.d.ts +2 -0
- package/core/decorators/es-aggregate/when.d.ts +2 -0
- package/{decorators → core/decorators}/index.d.ts +1 -1
- package/{decorators → core/decorators}/index.js +1 -1
- package/core/decorators/message/index.d.ts +2 -0
- package/core/decorators/message/index.js +18 -0
- package/core/decorators/message/is-command.d.ts +4 -0
- package/{decorators/message/command.js → core/decorators/message/is-command.js} +4 -4
- package/core/decorators/message/is-event.d.ts +4 -0
- package/{decorators/message/event.js → core/decorators/message/is-event.js} +4 -4
- package/core/index.d.ts +3 -6
- package/core/index.js +3 -6
- package/{meta → core/meta}/command.metadata.js +2 -2
- package/{meta/aggregate-es → core/meta/es-aggregate}/command-handler-map.d.ts +1 -1
- package/{meta/aggregate-es → core/meta/es-aggregate}/event-applier-map.d.ts +1 -1
- package/{meta → core/meta}/event.metadata.js +1 -1
- package/{meta → core/meta}/index.d.ts +1 -1
- package/{meta → core/meta}/index.js +1 -1
- package/core/{aggregate/aggregate-base → model/aggregate}/aggregate.d.ts +7 -6
- package/core/{aggregate/aggregate-base → model/aggregate}/aggregate.js +12 -12
- package/core/model/aggregate/es-aggregate.d.ts +50 -0
- package/core/{aggregate/event-sourced-aggregate/event-sourced-aggregate.js → model/aggregate/es-aggregate.js} +40 -33
- package/core/model/aggregate/index.d.ts +4 -0
- package/core/{aggregate → model/aggregate}/index.js +2 -2
- package/core/{aggregate/state-aggregate → model/aggregate}/state-aggregate.d.ts +10 -9
- package/core/{aggregate/state-aggregate → model/aggregate}/state-aggregate.js +9 -7
- package/core/model/aggregate/types.d.ts +7 -0
- package/core/model/entity/entity.d.ts +18 -0
- package/core/{entity → model/entity}/entity.js +12 -9
- package/core/model/entity/index.d.ts +1 -0
- package/core/{entity → model/entity}/index.js +0 -1
- package/core/{enum → model/enum}/enum.d.ts +7 -10
- package/core/{enum → model/enum}/enum.js +24 -16
- package/core/model/enum/index.d.ts +1 -0
- package/core/{enum → model/enum}/index.js +0 -1
- package/core/model/index.d.ts +6 -0
- package/core/{aggregate/aggregate-base → model}/index.js +5 -2
- package/core/model/message/command.d.ts +20 -0
- package/core/model/message/command.js +27 -0
- package/core/model/message/event.d.ts +32 -0
- package/core/model/message/event.js +31 -0
- package/{decorators → core/model}/message/index.d.ts +2 -1
- package/{decorators → core/model}/message/index.js +2 -1
- package/core/model/message/message.d.ts +37 -0
- package/core/{message/message-base → model/message}/message.js +13 -6
- package/core/{model-with-id → model/model-with-id}/index.d.ts +0 -1
- package/core/{model-with-id → model/model-with-id}/index.js +0 -1
- package/core/{model-with-id → model/model-with-id}/model-with-id.d.ts +2 -2
- package/core/{model-with-id → model/model-with-id}/model-with-id.js +2 -2
- package/core/model/value-object/index.d.ts +1 -0
- package/core/{value-object → model/value-object}/index.js +0 -1
- package/core/model/value-object/value-object.d.ts +18 -0
- package/core/{value-object → model/value-object}/value-object.js +13 -9
- package/core/repository/repository.d.ts +1 -2
- package/event-pubsub/decorators/subscribe-to-events.d.ts +1 -1
- package/event-pubsub/event-dispatcher.d.ts +7 -0
- package/event-pubsub/{event-publisher.js → event-dispatcher.js} +4 -4
- package/event-pubsub/event-subscriber.d.ts +1 -1
- package/event-pubsub/index.d.ts +1 -1
- package/event-pubsub/index.js +1 -1
- package/event-pubsub/interfaces/event-dispatcher.interface.d.ts +4 -0
- package/event-pubsub/interfaces/index.d.ts +1 -1
- package/event-pubsub/interfaces/index.js +1 -1
- package/index.d.ts +1 -3
- package/index.js +1 -3
- package/package.json +1 -1
- package/base/model/model.builder.d.ts +0 -11
- package/base/model/model.builder.js +0 -18
- package/core/aggregate/aggregate-base/aggregate-event-publisher.interface.d.ts +0 -4
- package/core/aggregate/aggregate-base/aggregate.builder.d.ts +0 -6
- package/core/aggregate/aggregate-base/aggregate.builder.js +0 -15
- package/core/aggregate/aggregate-base/index.d.ts +0 -3
- package/core/aggregate/event-sourced-aggregate/event-sourced-aggregate-model-descriptor.d.ts +0 -9
- package/core/aggregate/event-sourced-aggregate/event-sourced-aggregate-model-descriptor.js +0 -2
- package/core/aggregate/event-sourced-aggregate/event-sourced-aggregate.builder.d.ts +0 -13
- package/core/aggregate/event-sourced-aggregate/event-sourced-aggregate.builder.js +0 -33
- package/core/aggregate/event-sourced-aggregate/event-sourced-aggregate.d.ts +0 -49
- package/core/aggregate/event-sourced-aggregate/index.d.ts +0 -2
- package/core/aggregate/event-sourced-aggregate/index.js +0 -18
- package/core/aggregate/event-sourced-aggregate/snapshot.d.ts +0 -8
- package/core/aggregate/event-sourced-aggregate/snapshot.js +0 -2
- package/core/aggregate/index.d.ts +0 -4
- package/core/aggregate/state-aggregate/index.d.ts +0 -2
- package/core/aggregate/state-aggregate/index.js +0 -18
- package/core/aggregate/state-aggregate/state-aggregate.builder.d.ts +0 -7
- package/core/aggregate/state-aggregate/state-aggregate.builder.js +0 -19
- package/core/aggregate/types.d.ts +0 -4
- package/core/entity/entity.builder.d.ts +0 -7
- package/core/entity/entity.builder.js +0 -16
- package/core/entity/entity.d.ts +0 -18
- package/core/entity/index.d.ts +0 -2
- package/core/enum/enum-builder.d.ts +0 -9
- package/core/enum/enum-builder.js +0 -32
- package/core/enum/index.d.ts +0 -2
- package/core/message/command/command-model-descriptor.d.ts +0 -6
- package/core/message/command/command-model-descriptor.js +0 -2
- package/core/message/command/command.builder.d.ts +0 -7
- package/core/message/command/command.builder.js +0 -21
- package/core/message/command/command.d.ts +0 -24
- package/core/message/command/command.js +0 -29
- package/core/message/command/index.d.ts +0 -3
- package/core/message/command/index.js +0 -19
- package/core/message/event/event-model-descriptor.d.ts +0 -6
- package/core/message/event/event-model-descriptor.js +0 -2
- package/core/message/event/event.builder.d.ts +0 -9
- package/core/message/event/event.builder.js +0 -28
- package/core/message/event/event.d.ts +0 -35
- package/core/message/event/event.js +0 -33
- package/core/message/event/index.d.ts +0 -3
- package/core/message/event/index.js +0 -19
- package/core/message/index.d.ts +0 -3
- package/core/message/index.js +0 -19
- package/core/message/message-base/index.d.ts +0 -2
- package/core/message/message-base/index.js +0 -18
- package/core/message/message-base/message.builder.d.ts +0 -16
- package/core/message/message-base/message.builder.js +0 -44
- package/core/message/message-base/message.d.ts +0 -31
- package/core/model-with-id/model-with-id.builder.d.ts +0 -9
- package/core/model-with-id/model-with-id.builder.js +0 -22
- package/core/value-object/index.d.ts +0 -2
- package/core/value-object/value-object.builder.d.ts +0 -7
- package/core/value-object/value-object.builder.js +0 -16
- package/core/value-object/value-object.d.ts +0 -17
- package/decorators/aggregate-es/handle.d.ts +0 -2
- package/decorators/aggregate-es/when.d.ts +0 -2
- package/decorators/enum.d.ts +0 -2
- package/decorators/message/command.d.ts +0 -4
- package/decorators/message/event.d.ts +0 -4
- package/event-pubsub/event-publisher.d.ts +0 -7
- package/event-pubsub/interfaces/event-publisher.interface.d.ts +0 -4
- package/event-pubsub/interfaces/event-publisher.interface.js +0 -2
- /package/{decorators/aggregate-es → core/decorators/es-aggregate}/handle.js +0 -0
- /package/{decorators/aggregate-es → core/decorators/es-aggregate}/index.d.ts +0 -0
- /package/{decorators/aggregate-es → core/decorators/es-aggregate}/index.js +0 -0
- /package/{decorators/aggregate-es → core/decorators/es-aggregate}/when.js +0 -0
- /package/{decorators → core/decorators}/type.d.ts +0 -0
- /package/{decorators → core/decorators}/type.js +0 -0
- /package/{meta → core/meta}/command.metadata.d.ts +0 -0
- /package/{meta/aggregate-es → core/meta/es-aggregate}/command-handler-map.js +0 -0
- /package/{meta/aggregate-es → core/meta/es-aggregate}/event-applier-map.js +0 -0
- /package/{meta/aggregate-es → core/meta/es-aggregate}/index.d.ts +0 -0
- /package/{meta/aggregate-es → core/meta/es-aggregate}/index.js +0 -0
- /package/{meta → core/meta}/event.metadata.d.ts +0 -0
- /package/core/{aggregate → model/aggregate}/types.js +0 -0
- /package/core/{model-with-id → model/model-with-id}/id.d.ts +0 -0
- /package/core/{model-with-id → model/model-with-id}/id.js +0 -0
- /package/{core/aggregate/aggregate-base/aggregate-event-publisher.interface.js → event-pubsub/interfaces/event-dispatcher.interface.js} +0 -0
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageBuilder = exports.MessageBuilderBase = void 0;
|
|
4
|
-
const model_with_id_1 = require("../../model-with-id");
|
|
5
|
-
class MessageBuilderBase extends model_with_id_1.ModelWithIdBuilder {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.timestamp = Date.now();
|
|
9
|
-
this.correlationIds = {};
|
|
10
|
-
}
|
|
11
|
-
withCausationId(causationId) {
|
|
12
|
-
this.causationId = causationId;
|
|
13
|
-
return this;
|
|
14
|
-
}
|
|
15
|
-
withCorrelationIds(correlationIds) {
|
|
16
|
-
this.correlationIds = correlationIds;
|
|
17
|
-
return this;
|
|
18
|
-
}
|
|
19
|
-
withTimestamp(timestamp) {
|
|
20
|
-
this.timestamp = timestamp;
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
withTimestampNow() {
|
|
24
|
-
return this.withTimestamp(Date.now());
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.MessageBuilderBase = MessageBuilderBase;
|
|
28
|
-
class MessageBuilder extends MessageBuilderBase {
|
|
29
|
-
constructor(messageClass) {
|
|
30
|
-
super();
|
|
31
|
-
this.messageClass = messageClass;
|
|
32
|
-
}
|
|
33
|
-
build() {
|
|
34
|
-
if (!this.props)
|
|
35
|
-
throw new Error("The props must be set before build");
|
|
36
|
-
return new this.messageClass({
|
|
37
|
-
id: this.id,
|
|
38
|
-
timestamp: this.timestamp,
|
|
39
|
-
correlationIds: this.correlationIds,
|
|
40
|
-
causationId: this.causationId,
|
|
41
|
-
}, this.props);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.MessageBuilder = MessageBuilder;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Class } from "type-fest";
|
|
2
|
-
import { Props, InferredProps } from "../../../base";
|
|
3
|
-
import { ClassStatic } from "../../../types";
|
|
4
|
-
import { ModelWithId, ModelWithIdMetadata } from "../../model-with-id";
|
|
5
|
-
export interface CorrelationIds {
|
|
6
|
-
[type: string]: string | undefined;
|
|
7
|
-
}
|
|
8
|
-
export interface MessageMetadata extends ModelWithIdMetadata {
|
|
9
|
-
timestamp: number;
|
|
10
|
-
causationId?: string;
|
|
11
|
-
correlationIds: CorrelationIds;
|
|
12
|
-
}
|
|
13
|
-
export declare class MessageBase<P extends Props> extends ModelWithId<P> {
|
|
14
|
-
private readonly _timestamp;
|
|
15
|
-
private _causationId?;
|
|
16
|
-
private _correlationIds;
|
|
17
|
-
constructor(metadata: MessageMetadata, props: P);
|
|
18
|
-
props(): P;
|
|
19
|
-
metadata(): MessageMetadata;
|
|
20
|
-
timestamp(): number;
|
|
21
|
-
correlationIds(): CorrelationIds;
|
|
22
|
-
causationId(): string | undefined;
|
|
23
|
-
setCausationId(causationId: string): void;
|
|
24
|
-
addCorrelationId(type: string, correlationId: string): void;
|
|
25
|
-
setCorrelationIds(correlationIds: CorrelationIds): void;
|
|
26
|
-
}
|
|
27
|
-
export type AnyMessage = MessageBase<Props>;
|
|
28
|
-
export interface MessageClass<T extends AnyMessage = AnyMessage, Arguments extends unknown[] = any[]> extends Class<T, Arguments>, ClassStatic<typeof MessageBase<InferredProps<T>>> {
|
|
29
|
-
}
|
|
30
|
-
export interface MessageClassWithTypedConstructor<T extends AnyMessage = AnyMessage> extends MessageClass<T, ConstructorParameters<typeof MessageBase<InferredProps<T>>>> {
|
|
31
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ModelBuilder } from "../../base";
|
|
2
|
-
import { AnyModelWithId } from "./model-with-id";
|
|
3
|
-
import { Id } from "./id";
|
|
4
|
-
export declare abstract class ModelWithIdBuilder<T extends AnyModelWithId> extends ModelBuilder<T> {
|
|
5
|
-
protected id: Id;
|
|
6
|
-
newId(): string;
|
|
7
|
-
withId(id: Id): this;
|
|
8
|
-
withNewId(): this;
|
|
9
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ModelWithIdBuilder = void 0;
|
|
4
|
-
const uuid_1 = require("uuid");
|
|
5
|
-
const base_1 = require("../../base");
|
|
6
|
-
class ModelWithIdBuilder extends base_1.ModelBuilder {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.id = this.newId();
|
|
10
|
-
}
|
|
11
|
-
newId() {
|
|
12
|
-
return (0, uuid_1.v4)();
|
|
13
|
-
}
|
|
14
|
-
withId(id) {
|
|
15
|
-
this.id = id;
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
withNewId() {
|
|
19
|
-
return this.withId(this.newId());
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.ModelWithIdBuilder = ModelWithIdBuilder;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ModelBuilder } from "../../base";
|
|
2
|
-
import { AnyValueObject, ValueObjectClassWithTypedConstructor } from "./value-object";
|
|
3
|
-
export declare class ValueObjectBuilder<T extends AnyValueObject> extends ModelBuilder<T> {
|
|
4
|
-
private valueObjectClass;
|
|
5
|
-
constructor(valueObjectClass: ValueObjectClassWithTypedConstructor<T>);
|
|
6
|
-
build(): T;
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValueObjectBuilder = void 0;
|
|
4
|
-
const base_1 = require("../../base");
|
|
5
|
-
class ValueObjectBuilder extends base_1.ModelBuilder {
|
|
6
|
-
constructor(valueObjectClass) {
|
|
7
|
-
super();
|
|
8
|
-
this.valueObjectClass = valueObjectClass;
|
|
9
|
-
}
|
|
10
|
-
build() {
|
|
11
|
-
if (!this.props)
|
|
12
|
-
throw new Error("The props must be set before build");
|
|
13
|
-
return new this.valueObjectClass(this.props);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.ValueObjectBuilder = ValueObjectBuilder;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Class } from "type-fest";
|
|
2
|
-
import { ModelBase, Props, InferredProps } from "../../base";
|
|
3
|
-
import { ClassStatic } from "../../types";
|
|
4
|
-
export declare class ValueObjectBase<P extends Props> extends ModelBase<P> {
|
|
5
|
-
constructor(props: P);
|
|
6
|
-
props(): P;
|
|
7
|
-
equals<V extends AnyValueObject>(vo: V): boolean;
|
|
8
|
-
with(props: Partial<P>): typeof this;
|
|
9
|
-
clone(): this;
|
|
10
|
-
getEqualityValue(): string;
|
|
11
|
-
protected getEqualityObject(): any;
|
|
12
|
-
}
|
|
13
|
-
export type AnyValueObject = ValueObjectBase<Props>;
|
|
14
|
-
export interface ValueObjectClass<T extends AnyValueObject = AnyValueObject> extends Class<T>, ClassStatic<typeof ValueObjectBase<InferredProps<T>>> {
|
|
15
|
-
}
|
|
16
|
-
export interface ValueObjectClassWithTypedConstructor<T extends AnyValueObject = AnyValueObject> extends Class<T, ConstructorParameters<typeof ValueObjectBase<InferredProps<T>>>> {
|
|
17
|
-
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { AnyCommand, AnyEventSourcedAggregate, CommandClass, CommandHandler } from "../../core";
|
|
2
|
-
export declare const Handle: <T extends AnyCommand>(commandClass: CommandClass<T, any[]>) => <U extends CommandHandler<T>>(target: AnyEventSourcedAggregate, propertyKey: string, descriptor: TypedPropertyDescriptor<U>) => void;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { AnyEvent, AnyEventSourcedAggregate, EventApplier, EventClass } from "../../core";
|
|
2
|
-
export declare const When: <T extends AnyEvent>(eventClass: EventClass<T, any[]>) => <U extends EventApplier<T>>(target: AnyEventSourcedAggregate, propertyKey: string, descriptor: TypedPropertyDescriptor<U>) => void;
|
package/decorators/enum.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ModelOptions } from "../../base";
|
|
2
|
-
import { AnyCommand, CommandClass } from "../../core";
|
|
3
|
-
import { CommandType } from "../../meta";
|
|
4
|
-
export declare const Command: (commandType: CommandType, modelOptions?: ModelOptions) => <T extends AnyCommand>(target: CommandClass<T, any[]>) => void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ModelOptions } from "../../base";
|
|
2
|
-
import { AnyEvent, EventClass } from "../../core";
|
|
3
|
-
import { EventType } from "../../meta";
|
|
4
|
-
export declare const Event: (eventType: EventType, modelOptions?: ModelOptions) => <T extends AnyEvent>(target: EventClass<T, any[]>) => void;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AnyEvent } from "../core";
|
|
2
|
-
import { IEventPublisher, IEventSubscriberRegistry } from "./interfaces";
|
|
3
|
-
export declare class EventPublisher implements IEventPublisher {
|
|
4
|
-
private subscriberRegistry;
|
|
5
|
-
constructor(subscriberRegistry: IEventSubscriberRegistry);
|
|
6
|
-
publish<T extends AnyEvent = AnyEvent>(event: T): Promise<void>;
|
|
7
|
-
}
|
|
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
|