@celljs/cqrs 0.0.0-stage → 4.4.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/README.md +193 -2
- package/esm/node/aggregate/aggregate-root.d.ts +24 -0
- package/esm/node/aggregate/aggregate-root.js +69 -0
- package/esm/node/aggregate/aggregate-root.js.map +1 -0
- package/esm/node/aggregate/event-publisher.d.ts +16 -0
- package/esm/node/aggregate/event-publisher.js +42 -0
- package/esm/node/aggregate/event-publisher.js.map +1 -0
- package/esm/node/aggregate/index.d.ts +2 -0
- package/esm/node/aggregate/index.js +3 -0
- package/esm/node/aggregate/index.js.map +1 -0
- package/esm/node/command/command-bus.d.ts +11 -0
- package/esm/node/command/command-bus.js +36 -0
- package/esm/node/command/command-bus.js.map +1 -0
- package/esm/node/command/command-protocol.d.ts +30 -0
- package/esm/node/command/command-protocol.js +17 -0
- package/esm/node/command/command-protocol.js.map +1 -0
- package/esm/node/command/index.d.ts +2 -0
- package/esm/node/command/index.js +3 -0
- package/esm/node/command/index.js.map +1 -0
- package/esm/node/error/cqrs-error.d.ts +18 -0
- package/esm/node/error/cqrs-error.js +19 -0
- package/esm/node/error/cqrs-error.js.map +1 -0
- package/esm/node/error/index.d.ts +1 -0
- package/esm/node/error/index.js +2 -0
- package/esm/node/error/index.js.map +1 -0
- package/esm/node/event/event-bus.d.ts +17 -0
- package/esm/node/event/event-bus.js +81 -0
- package/esm/node/event/event-bus.js.map +1 -0
- package/esm/node/event/event-protocol.d.ts +42 -0
- package/esm/node/event/event-protocol.js +17 -0
- package/esm/node/event/event-protocol.js.map +1 -0
- package/esm/node/event/index.d.ts +3 -0
- package/esm/node/event/index.js +4 -0
- package/esm/node/event/index.js.map +1 -0
- package/esm/node/event/unhandled-exception-bus.d.ts +8 -0
- package/esm/node/event/unhandled-exception-bus.js +35 -0
- package/esm/node/event/unhandled-exception-bus.js.map +1 -0
- package/esm/node/index.d.ts +6 -0
- package/esm/node/index.js +7 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/module.d.ts +3 -0
- package/esm/node/module.js +4 -0
- package/esm/node/module.js.map +1 -0
- package/esm/node/query/index.d.ts +2 -0
- package/esm/node/query/index.js +3 -0
- package/esm/node/query/index.js.map +1 -0
- package/esm/node/query/query-bus.d.ts +11 -0
- package/esm/node/query/query-bus.js +36 -0
- package/esm/node/query/query-bus.js.map +1 -0
- package/esm/node/query/query-protocol.d.ts +31 -0
- package/esm/node/query/query-protocol.js +18 -0
- package/esm/node/query/query-protocol.js.map +1 -0
- package/esm/node/utils/cqrs-util.d.ts +25 -0
- package/esm/node/utils/cqrs-util.js +85 -0
- package/esm/node/utils/cqrs-util.js.map +1 -0
- package/esm/node/utils/index.d.ts +1 -0
- package/esm/node/utils/index.js +2 -0
- package/esm/node/utils/index.js.map +1 -0
- package/esm/package.json +3 -0
- package/lib/node/aggregate/aggregate-root.d.ts +25 -0
- package/lib/node/aggregate/aggregate-root.d.ts.map +1 -0
- package/lib/node/aggregate/aggregate-root.js +73 -0
- package/lib/node/aggregate/aggregate-root.js.map +1 -0
- package/lib/node/aggregate/event-publisher.d.ts +17 -0
- package/lib/node/aggregate/event-publisher.d.ts.map +1 -0
- package/lib/node/aggregate/event-publisher.js +45 -0
- package/lib/node/aggregate/event-publisher.js.map +1 -0
- package/lib/node/aggregate/index.d.ts +3 -0
- package/lib/node/aggregate/index.d.ts.map +1 -0
- package/lib/node/aggregate/index.js +19 -0
- package/lib/node/aggregate/index.js.map +1 -0
- package/lib/node/command/command-bus.d.ts +12 -0
- package/lib/node/command/command-bus.d.ts.map +1 -0
- package/lib/node/command/command-bus.js +39 -0
- package/lib/node/command/command-bus.js.map +1 -0
- package/lib/node/command/command-protocol.d.ts +31 -0
- package/lib/node/command/command-protocol.d.ts.map +1 -0
- package/lib/node/command/command-protocol.js +22 -0
- package/lib/node/command/command-protocol.js.map +1 -0
- package/lib/node/command/index.d.ts +3 -0
- package/lib/node/command/index.d.ts.map +1 -0
- package/lib/node/command/index.js +19 -0
- package/lib/node/command/index.js.map +1 -0
- package/lib/node/cqrs.spec.d.ts +76 -0
- package/lib/node/cqrs.spec.d.ts.map +1 -0
- package/lib/node/cqrs.spec.js +319 -0
- package/lib/node/cqrs.spec.js.map +1 -0
- package/lib/node/error/cqrs-error.d.ts +19 -0
- package/lib/node/error/cqrs-error.d.ts.map +1 -0
- package/lib/node/error/cqrs-error.js +23 -0
- package/lib/node/error/cqrs-error.js.map +1 -0
- package/lib/node/error/index.d.ts +2 -0
- package/lib/node/error/index.d.ts.map +1 -0
- package/lib/node/error/index.js +18 -0
- package/lib/node/error/index.js.map +1 -0
- package/lib/node/event/event-bus.d.ts +18 -0
- package/lib/node/event/event-bus.d.ts.map +1 -0
- package/lib/node/event/event-bus.js +84 -0
- package/lib/node/event/event-bus.js.map +1 -0
- package/lib/node/event/event-protocol.d.ts +43 -0
- package/lib/node/event/event-protocol.d.ts.map +1 -0
- package/lib/node/event/event-protocol.js +22 -0
- package/lib/node/event/event-protocol.js.map +1 -0
- package/lib/node/event/index.d.ts +4 -0
- package/lib/node/event/index.d.ts.map +1 -0
- package/lib/node/event/index.js +20 -0
- package/lib/node/event/index.js.map +1 -0
- package/lib/node/event/unhandled-exception-bus.d.ts +9 -0
- package/lib/node/event/unhandled-exception-bus.d.ts.map +1 -0
- package/lib/node/event/unhandled-exception-bus.js +38 -0
- package/lib/node/event/unhandled-exception-bus.js.map +1 -0
- package/lib/node/index.d.ts +7 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +23 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/module.d.ts +4 -0
- package/lib/node/module.d.ts.map +1 -0
- package/lib/node/module.js +6 -0
- package/lib/node/module.js.map +1 -0
- package/lib/node/query/index.d.ts +3 -0
- package/lib/node/query/index.d.ts.map +1 -0
- package/lib/node/query/index.js +19 -0
- package/lib/node/query/index.js.map +1 -0
- package/lib/node/query/query-bus.d.ts +12 -0
- package/lib/node/query/query-bus.d.ts.map +1 -0
- package/lib/node/query/query-bus.js +39 -0
- package/lib/node/query/query-bus.js.map +1 -0
- package/lib/node/query/query-protocol.d.ts +32 -0
- package/lib/node/query/query-protocol.d.ts.map +1 -0
- package/lib/node/query/query-protocol.js +23 -0
- package/lib/node/query/query-protocol.js.map +1 -0
- package/lib/node/utils/cqrs-util.d.ts +26 -0
- package/lib/node/utils/cqrs-util.d.ts.map +1 -0
- package/lib/node/utils/cqrs-util.js +88 -0
- package/lib/node/utils/cqrs-util.js.map +1 -0
- package/lib/node/utils/index.d.ts +2 -0
- package/lib/node/utils/index.d.ts.map +1 -0
- package/lib/node/utils/index.js +18 -0
- package/lib/node/utils/index.js.map +1 -0
- package/package.json +88 -4
- package/src/node/aggregate/aggregate-root.ts +78 -0
- package/src/node/aggregate/event-publisher.ts +43 -0
- package/src/node/aggregate/index.ts +2 -0
- package/src/node/command/command-bus.ts +28 -0
- package/src/node/command/command-protocol.ts +39 -0
- package/src/node/command/index.ts +2 -0
- package/src/node/cqrs.spec.ts +316 -0
- package/src/node/error/cqrs-error.ts +23 -0
- package/src/node/error/index.ts +1 -0
- package/src/node/event/event-bus.ts +70 -0
- package/src/node/event/event-protocol.ts +60 -0
- package/src/node/event/index.ts +3 -0
- package/src/node/event/unhandled-exception-bus.ts +21 -0
- package/src/node/index.ts +6 -0
- package/src/node/module.ts +4 -0
- package/src/node/query/index.ts +2 -0
- package/src/node/query/query-bus.ts +28 -0
- package/src/node/query/query-protocol.ts +40 -0
- package/src/node/utils/cqrs-util.ts +90 -0
- package/src/node/utils/index.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../../../src/node/event/event-bus.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,Q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E,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACxE,CAAC;IACL,CAAC;CACJ,CAAA;AA1DsB;IADlB,iBAAiB,CAAC,aAAa,CAAC;;qDAC0B;AAGxC;IADlB,iBAAiB,CAAC,IAAI,CAAC;;kDACwB;AAG7B;IADlB,SAAS,CAAC,UAAU,CAAC;;gDACoB;AAGvB;IADlB,SAAS,CAAC,qBAAqB,CAAC;;2DAC+B;AAZvD,YAAY;IADxB,SAAS,CAAC,QAAQ,CAAC;GACP,YAAY,CA6DxB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ComponentOption, Event, MaybePromise, Newable } from '@celljs/core';
|
|
2
|
+
export declare const EventBus: unique symbol;
|
|
3
|
+
export declare const UnhandledExceptionBus: unique symbol;
|
|
4
|
+
export declare const EVENT_HANDLER: unique symbol;
|
|
5
|
+
export declare const SAGA: unique symbol;
|
|
6
|
+
/** Reacts to events that happened; an event class can have any number of handlers. */
|
|
7
|
+
export interface EventHandler<E extends object = any> {
|
|
8
|
+
handle(event: E): MaybePromise<void>;
|
|
9
|
+
}
|
|
10
|
+
/** Makes the class a component that handles the events of the given classes. */
|
|
11
|
+
export declare function EventHandler(events: Newable<object> | Newable<object>[], option?: ComponentOption): ClassDecorator;
|
|
12
|
+
/**
|
|
13
|
+
* Turns an event into the commands that follow from it: the event bus runs what `handle` returns
|
|
14
|
+
* (a command, an array of commands or nothing) with the command bus, in order.
|
|
15
|
+
*/
|
|
16
|
+
export interface Saga<E extends object = any> {
|
|
17
|
+
handle(event: E): MaybePromise<object | object[] | undefined | void>;
|
|
18
|
+
}
|
|
19
|
+
/** Makes the class a component that turns the events of the given classes into commands. */
|
|
20
|
+
export declare function Saga(events: Newable<object> | Newable<object>[], option?: ComponentOption): ClassDecorator;
|
|
21
|
+
/** Hands events to their handlers and sagas. */
|
|
22
|
+
export interface EventBus {
|
|
23
|
+
/**
|
|
24
|
+
* Runs the handlers and sagas of the event concurrently and resolves when they are all done.
|
|
25
|
+
* What they throw does not reject it: it goes to the `UnhandledExceptionBus`.
|
|
26
|
+
* Rejects with a `CqrsError` when the event is not an instance of a class.
|
|
27
|
+
*/
|
|
28
|
+
publish(event: object): Promise<void>;
|
|
29
|
+
/** Publishes the events one after the other. */
|
|
30
|
+
publishAll(events: object[]): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/** What an event handler or a saga (`handler`) threw while handling `event`. */
|
|
33
|
+
export interface UnhandledException {
|
|
34
|
+
error: unknown;
|
|
35
|
+
event: object;
|
|
36
|
+
handler: object;
|
|
37
|
+
}
|
|
38
|
+
/** Where the errors of event handlers and sagas go; they are logged too. */
|
|
39
|
+
export interface UnhandledExceptionBus {
|
|
40
|
+
readonly onException: Event<UnhandledException>;
|
|
41
|
+
publish(exception: UnhandledException): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CqrsUtil, METADATA_KEY } from '../utils/index.js';
|
|
2
|
+
export const EventBus = Symbol('EventBus');
|
|
3
|
+
export const UnhandledExceptionBus = Symbol('UnhandledExceptionBus');
|
|
4
|
+
export const EVENT_HANDLER = Symbol('EventHandler');
|
|
5
|
+
export const SAGA = Symbol('Saga');
|
|
6
|
+
/** Makes the class a component that handles the events of the given classes. */
|
|
7
|
+
export function EventHandler(events, option) {
|
|
8
|
+
return target => CqrsUtil.applyHandlerDecorator(target, EVENT_HANDLER, METADATA_KEY.eventHandler, toArray(events), option);
|
|
9
|
+
}
|
|
10
|
+
/** Makes the class a component that turns the events of the given classes into commands. */
|
|
11
|
+
export function Saga(events, option) {
|
|
12
|
+
return target => CqrsUtil.applyHandlerDecorator(target, SAGA, METADATA_KEY.saga, toArray(events), option);
|
|
13
|
+
}
|
|
14
|
+
function toArray(value) {
|
|
15
|
+
return Array.isArray(value) ? value : [value];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=event-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-protocol.js","sourceRoot":"","sources":["../../../src/node/event/event-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAOnC,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAAC,MAA2C,EAAE,MAAwB;IAC9F,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAC/H,CAAC;AAWD,4FAA4F;AAC5F,MAAM,UAAU,IAAI,CAAC,MAA2C,EAAE,MAAwB;IACtF,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;AAC9G,CAAC;AA2BD,SAAS,OAAO,CAAI,KAAc;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/event/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Emitter, Logger } from '@celljs/core';
|
|
2
|
+
import { type UnhandledException, UnhandledExceptionBus } from './event-protocol.js';
|
|
3
|
+
export declare class UnhandledExceptionBusImpl implements UnhandledExceptionBus {
|
|
4
|
+
protected readonly logger: Logger;
|
|
5
|
+
protected readonly onExceptionEmitter: Emitter<UnhandledException>;
|
|
6
|
+
get onException(): import("@celljs/core").Event<UnhandledException>;
|
|
7
|
+
publish(exception: UnhandledException): void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Autowired, Component, Emitter, getTargetClass, Logger } from '@celljs/core';
|
|
11
|
+
import { UnhandledExceptionBus } from './event-protocol.js';
|
|
12
|
+
let UnhandledExceptionBusImpl = class UnhandledExceptionBusImpl {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.onExceptionEmitter = new Emitter();
|
|
15
|
+
}
|
|
16
|
+
get onException() {
|
|
17
|
+
return this.onExceptionEmitter.event;
|
|
18
|
+
}
|
|
19
|
+
publish(exception) {
|
|
20
|
+
var _a;
|
|
21
|
+
const { error, event, handler } = exception;
|
|
22
|
+
const reason = error instanceof Error ? ((_a = error.stack) !== null && _a !== void 0 ? _a : error.message) : String(error);
|
|
23
|
+
this.logger.error(`${getTargetClass(handler).name} failed on the event ${event.constructor.name}: ${reason}`);
|
|
24
|
+
this.onExceptionEmitter.fire(exception);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
__decorate([
|
|
28
|
+
Autowired(Logger),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], UnhandledExceptionBusImpl.prototype, "logger", void 0);
|
|
31
|
+
UnhandledExceptionBusImpl = __decorate([
|
|
32
|
+
Component(UnhandledExceptionBus)
|
|
33
|
+
], UnhandledExceptionBusImpl);
|
|
34
|
+
export { UnhandledExceptionBusImpl };
|
|
35
|
+
//# sourceMappingURL=unhandled-exception-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unhandled-exception-bus.js","sourceRoot":"","sources":["../../../src/node/event/unhandled-exception-bus.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAA2B,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAG3E,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAA/B;QAIgB,uBAAkB,GAAG,IAAI,OAAO,EAAsB,CAAC;IAY9E,CAAC;IAVG,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,SAA6B;;QACjC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,CAAC;QAC5C,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAC,KAAK,CAAC,KAAK,mCAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,IAAI,wBAAwB,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QAC9G,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC5C,CAAC;CACJ,CAAA;AAdsB;IADlB,SAAS,CAAC,MAAM,CAAC;;yDACgB;AAFzB,yBAAyB;IADrC,SAAS,CAAC,qBAAqB,CAAC;GACpB,yBAAyB,CAgBrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,SAAS,CAAC;AAEjB,eAAe,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/query/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Provider } from '@celljs/core';
|
|
2
|
+
import { type MessageType } from '../utils/index.js';
|
|
3
|
+
import { QueryBus, type QueryHandler, type QueryMessage } from './query-protocol.js';
|
|
4
|
+
export declare class QueryBusImpl implements QueryBus {
|
|
5
|
+
/** A provider: the handlers are created when the first query runs, so they can inject the buses. */
|
|
6
|
+
protected readonly handlerProvider: Provider<QueryHandler>;
|
|
7
|
+
protected handlers?: Map<MessageType, QueryHandler>;
|
|
8
|
+
execute<R>(query: QueryMessage<R>): Promise<R>;
|
|
9
|
+
execute<R = any>(query: object): Promise<R>;
|
|
10
|
+
protected getHandler(query: object): QueryHandler;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { AutowiredProvider, Component } from '@celljs/core';
|
|
11
|
+
import { CqrsUtil, METADATA_KEY } from '../utils/index.js';
|
|
12
|
+
import { QUERY_HANDLER, QueryBus } from './query-protocol.js';
|
|
13
|
+
let QueryBusImpl = class QueryBusImpl {
|
|
14
|
+
async execute(query) {
|
|
15
|
+
return this.getHandler(query).execute(query);
|
|
16
|
+
}
|
|
17
|
+
getHandler(query) {
|
|
18
|
+
var _a;
|
|
19
|
+
const type = CqrsUtil.typeOf(query, 'query');
|
|
20
|
+
(_a = this.handlers) !== null && _a !== void 0 ? _a : (this.handlers = CqrsUtil.single(this.handlerProvider.get(), METADATA_KEY.queryHandler, 'query'));
|
|
21
|
+
const handler = this.handlers.get(type);
|
|
22
|
+
if (!handler) {
|
|
23
|
+
throw CqrsUtil.noHandler(type, 'query');
|
|
24
|
+
}
|
|
25
|
+
return handler;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
__decorate([
|
|
29
|
+
AutowiredProvider(QUERY_HANDLER),
|
|
30
|
+
__metadata("design:type", Object)
|
|
31
|
+
], QueryBusImpl.prototype, "handlerProvider", void 0);
|
|
32
|
+
QueryBusImpl = __decorate([
|
|
33
|
+
Component(QueryBus)
|
|
34
|
+
], QueryBusImpl);
|
|
35
|
+
export { QueryBusImpl };
|
|
36
|
+
//# sourceMappingURL=query-bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-bus.js","sourceRoot":"","sources":["../../../src/node/query/query-bus.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAiB,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAoB,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAwC,MAAM,kBAAkB,CAAC;AAG1F,IAAM,YAAY,GAAlB,MAAM,YAAY;IASrB,KAAK,CAAC,OAAO,CAAC,KAAa;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAES,UAAU,CAAC,KAAa;;QAC9B,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC7C,MAAA,IAAI,CAAC,QAAQ,oCAAb,IAAI,CAAC,QAAQ,GAAK,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,EAAC;QAClG,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ,CAAA;AAnBsB;IADlB,iBAAiB,CAAC,aAAa,CAAC;;qDAC0B;AAHlD,YAAY;IADxB,SAAS,CAAC,QAAQ,CAAC;GACP,YAAY,CAsBxB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentOption, MaybePromise, Newable } from '@celljs/core';
|
|
2
|
+
export declare const QueryBus: unique symbol;
|
|
3
|
+
export declare const QUERY_HANDLER: unique symbol;
|
|
4
|
+
/**
|
|
5
|
+
* Optional base class of a query that gives `QueryBus.execute` its result type:
|
|
6
|
+
* `class GetUser extends QueryMessage<User> { ... }` makes `execute(new GetUser(...))` a `Promise<User>`.
|
|
7
|
+
* (Not named `Query`: `@celljs/mvc` has a `@Query` parameter decorator.)
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class QueryMessage<R = any> {
|
|
10
|
+
/** Carries the result type only; never set. */
|
|
11
|
+
readonly __result: R;
|
|
12
|
+
}
|
|
13
|
+
export type QueryResult<Q> = Q extends QueryMessage<infer R> ? R : any;
|
|
14
|
+
/** Reads the state of the application without changing it; the one handler of a query class is selected by the class of the query. */
|
|
15
|
+
export interface QueryHandler<Q extends object = any, R = QueryResult<Q>> {
|
|
16
|
+
execute(query: Q): MaybePromise<R>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Makes the class a component that answers the queries of the given class.
|
|
20
|
+
* Each query class has exactly one handler.
|
|
21
|
+
*/
|
|
22
|
+
export declare function QueryHandler(query: Newable<object>, option?: ComponentOption): ClassDecorator;
|
|
23
|
+
/** Answers a query with its handler. */
|
|
24
|
+
export interface QueryBus {
|
|
25
|
+
/**
|
|
26
|
+
* Runs the handler of the query and resolves to what it returns.
|
|
27
|
+
* Rejects with what the handler throws, or a `CqrsError` when no handler handles the query.
|
|
28
|
+
*/
|
|
29
|
+
execute<R>(query: QueryMessage<R>): Promise<R>;
|
|
30
|
+
execute<R = any>(query: object): Promise<R>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CqrsUtil, METADATA_KEY } from '../utils/index.js';
|
|
2
|
+
export const QueryBus = Symbol('QueryBus');
|
|
3
|
+
export const QUERY_HANDLER = Symbol('QueryHandler');
|
|
4
|
+
/**
|
|
5
|
+
* Optional base class of a query that gives `QueryBus.execute` its result type:
|
|
6
|
+
* `class GetUser extends QueryMessage<User> { ... }` makes `execute(new GetUser(...))` a `Promise<User>`.
|
|
7
|
+
* (Not named `Query`: `@celljs/mvc` has a `@Query` parameter decorator.)
|
|
8
|
+
*/
|
|
9
|
+
export class QueryMessage {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Makes the class a component that answers the queries of the given class.
|
|
13
|
+
* Each query class has exactly one handler.
|
|
14
|
+
*/
|
|
15
|
+
export function QueryHandler(query, option) {
|
|
16
|
+
return target => CqrsUtil.applyHandlerDecorator(target, QUERY_HANDLER, METADATA_KEY.queryHandler, [query], option);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=query-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-protocol.js","sourceRoot":"","sources":["../../../src/node/query/query-protocol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAEpD;;;;GAIG;AACH,MAAM,OAAgB,YAAY;CAGjC;AASD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAsB,EAAE,MAAwB;IACzE,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AACvH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ComponentId, type ComponentOption } from '@celljs/core';
|
|
2
|
+
import { CqrsError } from '../error/index.js';
|
|
3
|
+
export type MessageKind = 'command' | 'query' | 'event';
|
|
4
|
+
/** The class of a command, query or event. */
|
|
5
|
+
export type MessageType = new (...args: any[]) => object;
|
|
6
|
+
export declare const METADATA_KEY: {
|
|
7
|
+
commandHandler: string;
|
|
8
|
+
queryHandler: string;
|
|
9
|
+
eventHandler: string;
|
|
10
|
+
saga: string;
|
|
11
|
+
};
|
|
12
|
+
export declare namespace CqrsUtil {
|
|
13
|
+
/**
|
|
14
|
+
* Registers the class as a component that is also bound to `id` and records the message classes it handles,
|
|
15
|
+
* for the bus that collects the components of `id`.
|
|
16
|
+
*/
|
|
17
|
+
function applyHandlerDecorator(target: any, id: ComponentId, metadataKey: string, types: MessageType[], option?: ComponentOption): void;
|
|
18
|
+
/** The class of a command, query or event: what selects its handlers. */
|
|
19
|
+
function typeOf(message: unknown, kind: MessageKind): MessageType;
|
|
20
|
+
/** The handlers by the message class they handle, in the order the container gives them. */
|
|
21
|
+
function index<H extends object>(handlers: H[], metadataKey: string): Map<MessageType, H[]>;
|
|
22
|
+
/** The one handler of each message class; commands and queries have exactly one. */
|
|
23
|
+
function single<H extends object>(handlers: H[], metadataKey: string, kind: MessageKind): Map<MessageType, H>;
|
|
24
|
+
function noHandler(type: MessageType, kind: MessageKind): CqrsError;
|
|
25
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Component, getTargetClass, parseComponentOption } from '@celljs/core';
|
|
2
|
+
import { CqrsError } from '../error/index.js';
|
|
3
|
+
export const METADATA_KEY = {
|
|
4
|
+
commandHandler: 'cell:cqrs:command-handler',
|
|
5
|
+
queryHandler: 'cell:cqrs:query-handler',
|
|
6
|
+
eventHandler: 'cell:cqrs:event-handler',
|
|
7
|
+
saga: 'cell:cqrs:saga',
|
|
8
|
+
};
|
|
9
|
+
const DECORATOR = { command: '@CommandHandler', query: '@QueryHandler', event: '@EventHandler' };
|
|
10
|
+
export var CqrsUtil;
|
|
11
|
+
(function (CqrsUtil) {
|
|
12
|
+
/**
|
|
13
|
+
* Registers the class as a component that is also bound to `id` and records the message classes it handles,
|
|
14
|
+
* for the bus that collects the components of `id`.
|
|
15
|
+
*/
|
|
16
|
+
function applyHandlerDecorator(target, id, metadataKey, types, option) {
|
|
17
|
+
const parsed = parseComponentOption(target, option);
|
|
18
|
+
parsed.id.push(id);
|
|
19
|
+
Reflect.defineMetadata(metadataKey, types, target);
|
|
20
|
+
Component(parsed)(target);
|
|
21
|
+
}
|
|
22
|
+
CqrsUtil.applyHandlerDecorator = applyHandlerDecorator;
|
|
23
|
+
/** The class of a command, query or event: what selects its handlers. */
|
|
24
|
+
function typeOf(message, kind) {
|
|
25
|
+
const type = message !== null && typeof message === 'object' ? message.constructor : undefined;
|
|
26
|
+
if (typeof type !== 'function' || type === Object) {
|
|
27
|
+
throw new CqrsError({
|
|
28
|
+
code: 'CELL_CQRS_NOT_AN_INSTANCE',
|
|
29
|
+
message: `${kind === 'event' ? 'An' : 'A'} ${kind} must be an instance of a class, got ${describe(message)}.`,
|
|
30
|
+
hint: `Declare a class for the ${kind}, dispatch new MyClass(...) and decorate its handler with ${DECORATOR[kind]}(MyClass).`,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return type;
|
|
34
|
+
}
|
|
35
|
+
CqrsUtil.typeOf = typeOf;
|
|
36
|
+
/** The handlers by the message class they handle, in the order the container gives them. */
|
|
37
|
+
function index(handlers, metadataKey) {
|
|
38
|
+
const result = new Map();
|
|
39
|
+
for (const handler of handlers) {
|
|
40
|
+
const types = Reflect.getOwnMetadata(metadataKey, getTargetClass(handler)) || [];
|
|
41
|
+
for (const type of types) {
|
|
42
|
+
const list = result.get(type);
|
|
43
|
+
if (list) {
|
|
44
|
+
list.push(handler);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
result.set(type, [handler]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
CqrsUtil.index = index;
|
|
54
|
+
/** The one handler of each message class; commands and queries have exactly one. */
|
|
55
|
+
function single(handlers, metadataKey, kind) {
|
|
56
|
+
const result = new Map();
|
|
57
|
+
for (const [type, list] of index(handlers, metadataKey)) {
|
|
58
|
+
if (list.length > 1) {
|
|
59
|
+
throw new CqrsError({
|
|
60
|
+
code: 'CELL_CQRS_DUPLICATE_HANDLER',
|
|
61
|
+
message: `The ${kind} ${type.name} has ${list.length} handlers: ${list.map(h => getTargetClass(h).name).join(', ')}.`,
|
|
62
|
+
hint: `Keep one ${DECORATOR[kind]}(${type.name}) class; to react to something in several places, publish an event.`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
result.set(type, list[0]);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
CqrsUtil.single = single;
|
|
70
|
+
function noHandler(type, kind) {
|
|
71
|
+
return new CqrsError({
|
|
72
|
+
code: 'CELL_CQRS_NO_HANDLER',
|
|
73
|
+
message: `No handler for the ${kind} ${type.name}.`,
|
|
74
|
+
hint: `Decorate a class with ${DECORATOR[kind]}(${type.name}) in a file that the DI module of your application imports.`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
CqrsUtil.noHandler = noHandler;
|
|
78
|
+
function describe(value) {
|
|
79
|
+
if (value === null || value === undefined) {
|
|
80
|
+
return String(value);
|
|
81
|
+
}
|
|
82
|
+
return typeof value === 'object' ? 'a plain object' : `a ${typeof value}`;
|
|
83
|
+
}
|
|
84
|
+
})(CqrsUtil || (CqrsUtil = {}));
|
|
85
|
+
//# sourceMappingURL=cqrs-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cqrs-util.js","sourceRoot":"","sources":["../../../src/node/utils/cqrs-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,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ceRoot":"","sources":["../../../src/node/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
package/esm/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CqrsError } from '../error';
|
|
2
|
+
/**
|
|
3
|
+
* An entity whose changes are events: `apply(event)` records the event and calls the method `on<EventClassName>`
|
|
4
|
+
* of the aggregate, if there is one, to change its state; `commit()` publishes the recorded events.
|
|
5
|
+
* Before `commit()`, connect the aggregate to the event bus with `EventPublisher.mergeObjectContext`
|
|
6
|
+
* (or create it from a class given by `EventPublisher.mergeClassContext`).
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class AggregateRoot<E extends object = object> {
|
|
9
|
+
/** Records the event, unless it is replayed from history, and applies it to the state with `on<EventClassName>`. */
|
|
10
|
+
apply(event: E, fromHistory?: boolean): void;
|
|
11
|
+
/** Publishes the recorded events, in order, and forgets them. */
|
|
12
|
+
commit(): Promise<void>;
|
|
13
|
+
/** Forgets the recorded events without publishing them. */
|
|
14
|
+
uncommit(): void;
|
|
15
|
+
getUncommittedEvents(): E[];
|
|
16
|
+
/** Rebuilds the state from past events; they are not recorded again. */
|
|
17
|
+
loadFromHistory(history: E[]): void;
|
|
18
|
+
/** Replaced by `EventPublisher`, which publishes with the `EventBus`. */
|
|
19
|
+
publish(event: E): Promise<void>;
|
|
20
|
+
/** Replaced by `EventPublisher`, which publishes with the `EventBus`. */
|
|
21
|
+
publishAll(events: E[]): Promise<void>;
|
|
22
|
+
protected getEventHandler(event: E): ((event: E) => void) | undefined;
|
|
23
|
+
protected notMerged(events: E[]): CqrsError;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=aggregate-root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-root.d.ts","sourceRoot":"","sources":["../../../src/node/aggregate/aggregate-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAarC;;;;;GAKG;AACH,8BAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACzD,oHAAoH;IACpH,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,WAAW,UAAQ,GAAG,IAAI,CAKzC;IAED,iEAAiE;IAC3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAQ5B;IAED,2DAA2D;IAC3D,QAAQ,IAAI,IAAI,CAEf;IAED,oBAAoB,IAAI,CAAC,EAAE,CAE1B;IAED,wEAAwE;IACxE,eAAe,CAAC,OAAO,EAAE,CAAC,EAAE,GAAG,IAAI,CAIlC;IAED,yEAAyE;IACzE,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/B;IAED,yEAAyE;IACzE,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAErC;IAED,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,GAAG,SAAS,CAGpE;IAED,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,CAM1C;CACJ"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateRoot = void 0;
|
|
4
|
+
const error_1 = require("../error");
|
|
5
|
+
const uncommitted = new WeakMap();
|
|
6
|
+
function eventsOf(aggregate) {
|
|
7
|
+
let events = uncommitted.get(aggregate);
|
|
8
|
+
if (!events) {
|
|
9
|
+
events = [];
|
|
10
|
+
uncommitted.set(aggregate, events);
|
|
11
|
+
}
|
|
12
|
+
return events;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* An entity whose changes are events: `apply(event)` records the event and calls the method `on<EventClassName>`
|
|
16
|
+
* of the aggregate, if there is one, to change its state; `commit()` publishes the recorded events.
|
|
17
|
+
* Before `commit()`, connect the aggregate to the event bus with `EventPublisher.mergeObjectContext`
|
|
18
|
+
* (or create it from a class given by `EventPublisher.mergeClassContext`).
|
|
19
|
+
*/
|
|
20
|
+
class AggregateRoot {
|
|
21
|
+
/** Records the event, unless it is replayed from history, and applies it to the state with `on<EventClassName>`. */
|
|
22
|
+
apply(event, fromHistory = false) {
|
|
23
|
+
var _a;
|
|
24
|
+
if (!fromHistory) {
|
|
25
|
+
eventsOf(this).push(event);
|
|
26
|
+
}
|
|
27
|
+
(_a = this.getEventHandler(event)) === null || _a === void 0 ? void 0 : _a.call(this, event);
|
|
28
|
+
}
|
|
29
|
+
/** Publishes the recorded events, in order, and forgets them. */
|
|
30
|
+
async commit() {
|
|
31
|
+
const events = eventsOf(this);
|
|
32
|
+
if (events.length === 0) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const committing = events.slice();
|
|
36
|
+
await this.publishAll(committing);
|
|
37
|
+
events.splice(0, committing.length);
|
|
38
|
+
}
|
|
39
|
+
/** Forgets the recorded events without publishing them. */
|
|
40
|
+
uncommit() {
|
|
41
|
+
eventsOf(this).length = 0;
|
|
42
|
+
}
|
|
43
|
+
getUncommittedEvents() {
|
|
44
|
+
return eventsOf(this).slice();
|
|
45
|
+
}
|
|
46
|
+
/** Rebuilds the state from past events; they are not recorded again. */
|
|
47
|
+
loadFromHistory(history) {
|
|
48
|
+
for (const event of history) {
|
|
49
|
+
this.apply(event, true);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Replaced by `EventPublisher`, which publishes with the `EventBus`. */
|
|
53
|
+
publish(event) {
|
|
54
|
+
return this.publishAll([event]);
|
|
55
|
+
}
|
|
56
|
+
/** Replaced by `EventPublisher`, which publishes with the `EventBus`. */
|
|
57
|
+
publishAll(events) {
|
|
58
|
+
return Promise.reject(this.notMerged(events));
|
|
59
|
+
}
|
|
60
|
+
getEventHandler(event) {
|
|
61
|
+
const handler = this[`on${event.constructor.name}`];
|
|
62
|
+
return typeof handler === 'function' ? handler : undefined;
|
|
63
|
+
}
|
|
64
|
+
notMerged(events) {
|
|
65
|
+
return new error_1.CqrsError({
|
|
66
|
+
code: 'CELL_CQRS_AGGREGATE_NOT_MERGED',
|
|
67
|
+
message: `${this.constructor.name} cannot publish ${events.map(e => e.constructor.name).join(', ')}: it is not connected to the event bus.`,
|
|
68
|
+
hint: 'Inject EventPublisher and pass the aggregate to eventPublisher.mergeObjectContext(aggregate) before commit().',
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.AggregateRoot = AggregateRoot;
|
|
73
|
+
//# sourceMappingURL=aggregate-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregate-root.js","sourceRoot":"","sources":["../../../src/node/aggregate/aggregate-root.ts"],"names":[],"mappings":";;;AAAA,oCAAqC;AAErC,MAAM,WAAW,GAAG,IAAI,OAAO,EAAgC,CAAC;AAEhE,SAAS,QAAQ,CAAC,SAA6B;IAC3C,IAAI,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,MAAM,GAAG,EAAE,CAAC;QACZ,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH;IACI,oHAAoH;IACpH,KAAK,CAAC,KAAQ,EAAE,WAAW,GAAG,KAAK;;QAC/B,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QACD,MAAA,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,0CAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;IAED,iEAAiE;IACjE,KAAK,CAAC,MAAM;QACR,MAAM,MA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O,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,mBAAmB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,yCAAyC;YAC3I,IAAI,EAAE,+GAA+G;SACxH,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EventBus } from '../event/event-protocol';
|
|
2
|
+
import type { AggregateRoot } from './aggregate-root';
|
|
3
|
+
export declare const EventPublisher: unique symbol;
|
|
4
|
+
export type AggregateClass<T extends AggregateRoot<any>> = new (...args: any[]) => T;
|
|
5
|
+
/** Connects aggregates to the `EventBus`, so that their `commit()` publishes their events. */
|
|
6
|
+
export interface EventPublisher {
|
|
7
|
+
/** Connects the aggregate and returns it. */
|
|
8
|
+
mergeObjectContext<T extends AggregateRoot<any>>(aggregate: T): T;
|
|
9
|
+
/** A subclass of the aggregate class whose instances are connected. */
|
|
10
|
+
mergeClassContext<T extends AggregateClass<AggregateRoot<any>>>(type: T): T;
|
|
11
|
+
}
|
|
12
|
+
export declare class EventPublisherImpl implements EventPublisher {
|
|
13
|
+
protected readonly eventBus: EventBus;
|
|
14
|
+
mergeObjectContext<T extends AggregateRoot<any>>(aggregate: T): T;
|
|
15
|
+
mergeClassContext<T extends AggregateClass<AggregateRoot<any>>>(type: T): T;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=event-publisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-publisher.d.ts","sourceRoot":"","sources":["../../../src/node/aggregate/event-publisher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,cAAc,eAA2B,CAAC;AAEvD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAErF,8FAA8F;AAC9F,MAAM,WAAW,cAAc;IAC3B,6CAA6C;IAC7C,kBAAkB,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC;IAClE,uEAAuE;IACvE,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;CAC/E;AAED,qBACa,kBAAmB,YAAW,cAAc;IAErD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAEtC,kBAAkB,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAKhE;IAED,iBAAiB,CAAC,CAAC,SAAS,cAAc,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAa1E;CACJ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EventPublisherImpl = exports.EventPublisher = void 0;
|
|
13
|
+
const core_1 = require("@celljs/core");
|
|
14
|
+
const event_protocol_1 = require("../event/event-protocol");
|
|
15
|
+
exports.EventPublisher = Symbol('EventPublisher');
|
|
16
|
+
let EventPublisherImpl = class EventPublisherImpl {
|
|
17
|
+
mergeObjectContext(aggregate) {
|
|
18
|
+
const eventBus = this.eventBus;
|
|
19
|
+
aggregate.publish = event => eventBus.publish(event);
|
|
20
|
+
aggregate.publishAll = events => eventBus.publishAll(events);
|
|
21
|
+
return aggregate;
|
|
22
|
+
}
|
|
23
|
+
mergeClassContext(type) {
|
|
24
|
+
const eventBus = this.eventBus;
|
|
25
|
+
const merged = class extends type {
|
|
26
|
+
publish(event) {
|
|
27
|
+
return eventBus.publish(event);
|
|
28
|
+
}
|
|
29
|
+
publishAll(events) {
|
|
30
|
+
return eventBus.publishAll(events);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
Object.defineProperty(merged, 'name', { value: type.name });
|
|
34
|
+
return merged;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
exports.EventPublisherImpl = EventPublisherImpl;
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, core_1.Autowired)(event_protocol_1.EventBus),
|
|
40
|
+
__metadata("design:type", Object)
|
|
41
|
+
], EventPublisherImpl.prototype, "eventBus", void 0);
|
|
42
|
+
exports.EventPublisherImpl = EventPublisherImpl = __decorate([
|
|
43
|
+
(0, core_1.Component)(exports.EventPublisher)
|
|
44
|
+
], EventPublisherImpl);
|
|
45
|
+
//# sourceMappingURL=event-publisher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-publisher.js","sourceRoot":"","sources":["../../../src/node/aggregate/event-publisher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAoD;AACpD,4DAAmD;AAGtC,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAahD,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAI3B,kBAAkB,CAA+B,SAAY;QACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACrD,SAAS,CAAC,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC7D,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,iBAAiB,CAA+C,IAAO;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,MAAM,MAAM,GAAG,KAAM,SAAQ,IAAI;YACpB,OAAO,CAAC,KAAa;gBAC1B,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACnC,CAAC;YAEQ,UAAU,CAAC,MAAgB;gBAChC,OAAO,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YACvC,CAAC;SACJ,CAAC;QACF,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5D,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAA;;AAvBsB;IADlB,IAAA,gBAAS,EAAC,yBAAQ,CAAC;;oDACkB;6BAF7B,kBAAkB;IAD9B,IAAA,gBAAS,EAAC,QAAA,cAAc,CAAC;GACb,kBAAkB,CAyB9B"}
|