@nestjs/cqrs 10.0.3 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { OnApplicationBootstrap } from '@nestjs/common';
1
+ import { DynamicModule, OnApplicationBootstrap } from '@nestjs/common';
2
2
  import { CommandBus } from './command-bus';
3
3
  import { EventBus } from './event-bus';
4
4
  import { IEvent } from './interfaces';
@@ -9,6 +9,11 @@ export declare class CqrsModule<EventBase extends IEvent = IEvent> implements On
9
9
  private readonly eventBus;
10
10
  private readonly commandBus;
11
11
  private readonly queryBus;
12
+ /**
13
+ * Registers the CQRS Module globally.
14
+ * @returns DynamicModule
15
+ */
16
+ static forRoot(): DynamicModule;
12
17
  constructor(explorerService: ExplorerService<EventBase>, eventBus: EventBus<EventBase>, commandBus: CommandBus, queryBus: QueryBus);
13
18
  onApplicationBootstrap(): void;
14
19
  }
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var CqrsModule_1;
11
12
  Object.defineProperty(exports, "__esModule", { value: true });
12
13
  exports.CqrsModule = void 0;
13
14
  const common_1 = require("@nestjs/common");
@@ -17,13 +18,23 @@ const event_publisher_1 = require("./event-publisher");
17
18
  const query_bus_1 = require("./query-bus");
18
19
  const explorer_service_1 = require("./services/explorer.service");
19
20
  const unhandled_exception_bus_1 = require("./unhandled-exception-bus");
20
- let CqrsModule = class CqrsModule {
21
+ let CqrsModule = CqrsModule_1 = class CqrsModule {
21
22
  constructor(explorerService, eventBus, commandBus, queryBus) {
22
23
  this.explorerService = explorerService;
23
24
  this.eventBus = eventBus;
24
25
  this.commandBus = commandBus;
25
26
  this.queryBus = queryBus;
26
27
  }
28
+ /**
29
+ * Registers the CQRS Module globally.
30
+ * @returns DynamicModule
31
+ */
32
+ static forRoot() {
33
+ return {
34
+ module: CqrsModule_1,
35
+ global: true,
36
+ };
37
+ }
27
38
  onApplicationBootstrap() {
28
39
  const { events, queries, sagas, commands } = this.explorerService.explore();
29
40
  this.eventBus.register(events);
@@ -32,7 +43,7 @@ let CqrsModule = class CqrsModule {
32
43
  this.eventBus.registerSagas(sagas);
33
44
  }
34
45
  };
35
- CqrsModule = __decorate([
46
+ CqrsModule = CqrsModule_1 = __decorate([
36
47
  (0, common_1.Module)({
37
48
  providers: [
38
49
  command_bus_1.CommandBus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cqrs",
3
- "version": "10.0.3",
3
+ "version": "10.1.0",
4
4
  "description": "A lightweight CQRS module for Nest framework (node.js)",
5
5
  "license": "MIT",
6
6
  "url": "https://github.com/nestjs/cqrs#readme",
@@ -23,17 +23,17 @@
23
23
  "devDependencies": {
24
24
  "@commitlint/cli": "17.6.7",
25
25
  "@commitlint/config-angular": "17.6.7",
26
- "@nestjs/common": "10.1.1",
27
- "@nestjs/core": "10.1.1",
28
- "@types/node": "18.17.0",
26
+ "@nestjs/common": "10.1.3",
27
+ "@nestjs/core": "10.1.3",
28
+ "@types/node": "18.17.1",
29
29
  "@types/jest": "29.5.3",
30
- "@typescript-eslint/eslint-plugin": "6.2.0",
31
- "@typescript-eslint/parser": "6.2.0",
32
- "eslint": "8.45.0",
33
- "eslint-config-prettier": "8.8.0",
34
- "eslint-plugin-import": "2.27.5",
30
+ "@typescript-eslint/eslint-plugin": "6.2.1",
31
+ "@typescript-eslint/parser": "6.2.1",
32
+ "eslint": "8.46.0",
33
+ "eslint-config-prettier": "8.9.0",
34
+ "eslint-plugin-import": "2.28.0",
35
35
  "husky": "8.0.3",
36
- "jest": "29.6.1",
36
+ "jest": "29.6.2",
37
37
  "lint-staged": "13.2.3",
38
38
  "prettier": "3.0.0",
39
39
  "reflect-metadata": "0.1.13",