@nestjs/cqrs 11.0.1 → 11.0.3

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.
Files changed (41) hide show
  1. package/README.md +0 -1
  2. package/dist/command-bus.d.ts +3 -0
  3. package/dist/command-bus.js +3 -0
  4. package/dist/cqrs.module.d.ts +6 -6
  5. package/dist/cqrs.module.js +54 -5
  6. package/dist/decorators/command-handler.decorator.d.ts +2 -0
  7. package/dist/decorators/command-handler.decorator.js +2 -0
  8. package/dist/decorators/events-handler.decorator.d.ts +2 -0
  9. package/dist/decorators/events-handler.decorator.js +3 -1
  10. package/dist/decorators/publishable.decorator.d.ts +2 -0
  11. package/dist/decorators/publishable.decorator.js +2 -0
  12. package/dist/decorators/query-handler.decorator.d.ts +2 -0
  13. package/dist/decorators/query-handler.decorator.js +2 -0
  14. package/dist/decorators/saga.decorator.d.ts +2 -0
  15. package/dist/decorators/saga.decorator.js +2 -0
  16. package/dist/event-bus.d.ts +3 -0
  17. package/dist/event-bus.js +3 -0
  18. package/dist/event-publisher.d.ts +5 -2
  19. package/dist/event-publisher.js +5 -2
  20. package/dist/exceptions/command-not-found.exception.d.ts +3 -0
  21. package/dist/exceptions/command-not-found.exception.js +3 -0
  22. package/dist/exceptions/invalid-command-handler.exception.d.ts +3 -0
  23. package/dist/exceptions/invalid-command-handler.exception.js +3 -0
  24. package/dist/exceptions/invalid-events-handler.exception.d.ts +3 -0
  25. package/dist/exceptions/invalid-events-handler.exception.js +3 -0
  26. package/dist/exceptions/invalid-saga.exception.d.ts +3 -0
  27. package/dist/exceptions/invalid-saga.exception.js +3 -0
  28. package/dist/exceptions/query-not-found.exception.d.ts +3 -0
  29. package/dist/exceptions/query-not-found.exception.js +3 -0
  30. package/dist/exceptions/unsupported-saga-scope.exception.d.ts +3 -0
  31. package/dist/exceptions/unsupported-saga-scope.exception.js +3 -0
  32. package/dist/interfaces/commands/command-bus.interface.d.ts +2 -0
  33. package/dist/interfaces/commands/command-handler.interface.d.ts +2 -0
  34. package/dist/interfaces/commands/command-publisher.interface.d.ts +5 -0
  35. package/dist/interfaces/cqrs-module-options.interface.d.ts +25 -0
  36. package/dist/interfaces/queries/query-bus.interface.d.ts +2 -0
  37. package/dist/interfaces/queries/query-handler.interface.d.ts +2 -0
  38. package/dist/interfaces/queries/query-publisher.interface.d.ts +5 -0
  39. package/dist/query-bus.d.ts +3 -0
  40. package/dist/query-bus.js +3 -0
  41. package/package.json +19 -19
package/README.md CHANGED
@@ -12,7 +12,6 @@
12
12
  <a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
13
13
  <a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
14
14
  <a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
15
- <a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
16
15
  <a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
17
16
  <a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
18
17
  <a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
@@ -7,6 +7,9 @@ import { CqrsModuleOptions, ICommand, ICommandBus, ICommandHandler, ICommandPubl
7
7
  import { AsyncContext } from './scopes/async.context';
8
8
  import { ObservableBus } from './utils/observable-bus';
9
9
  export type CommandHandlerType<T extends ICommand = ICommand> = Type<ICommandHandler<T>>;
10
+ /**
11
+ * @publicApi
12
+ */
10
13
  export declare class CommandBus<CommandBase extends ICommand = ICommand> extends ObservableBus<CommandBase> implements ICommandBus<CommandBase> {
11
14
  private readonly moduleRef;
12
15
  private readonly options?;
@@ -24,6 +24,9 @@ const default_command_pubsub_1 = require("./helpers/default-command-pubsub");
24
24
  const index_1 = require("./index");
25
25
  const async_context_1 = require("./scopes/async.context");
26
26
  const observable_bus_1 = require("./utils/observable-bus");
27
+ /**
28
+ * @publicApi
29
+ */
27
30
  let CommandBus = CommandBus_1 = class CommandBus extends observable_bus_1.ObservableBus {
28
31
  constructor(moduleRef, options) {
29
32
  super();
@@ -1,20 +1,20 @@
1
1
  import { DynamicModule, OnApplicationBootstrap } from '@nestjs/common';
2
2
  import { CommandBus } from './command-bus';
3
3
  import { EventBus } from './event-bus';
4
- import { CqrsModuleOptions, IEvent } from './interfaces';
4
+ import { CqrsModuleAsyncOptions, CqrsModuleOptions, IEvent } from './interfaces';
5
5
  import { QueryBus } from './query-bus';
6
6
  import { ExplorerService } from './services/explorer.service';
7
+ /**
8
+ * @publicApi
9
+ */
7
10
  export declare class CqrsModule<EventBase extends IEvent = IEvent> implements OnApplicationBootstrap {
8
11
  private readonly explorerService;
9
12
  private readonly eventBus;
10
13
  private readonly commandBus;
11
14
  private readonly queryBus;
12
- /**
13
- * Registers CQRS module globally.
14
- * @param options CQRS module options.
15
- * @returns A dynamic module.
16
- */
17
15
  static forRoot(options?: CqrsModuleOptions): DynamicModule;
16
+ static forRootAsync(options: CqrsModuleAsyncOptions): DynamicModule;
17
+ private static createAsyncProviders;
18
18
  constructor(explorerService: ExplorerService<EventBase>, eventBus: EventBus<EventBase>, commandBus: CommandBus, queryBus: QueryBus);
19
19
  onApplicationBootstrap(): void;
20
20
  }
@@ -20,12 +20,10 @@ const query_bus_1 = require("./query-bus");
20
20
  const explorer_service_1 = require("./services/explorer.service");
21
21
  const unhandled_exception_bus_1 = require("./unhandled-exception-bus");
22
22
  const aggregate_root_storage_1 = require("./storages/aggregate-root.storage");
23
+ /**
24
+ * @publicApi
25
+ */
23
26
  let CqrsModule = CqrsModule_1 = class CqrsModule {
24
- /**
25
- * Registers CQRS module globally.
26
- * @param options CQRS module options.
27
- * @returns A dynamic module.
28
- */
29
27
  static forRoot(options) {
30
28
  return {
31
29
  module: CqrsModule_1,
@@ -38,6 +36,57 @@ let CqrsModule = CqrsModule_1 = class CqrsModule {
38
36
  global: true,
39
37
  };
40
38
  }
39
+ static forRootAsync(options) {
40
+ return {
41
+ module: CqrsModule_1,
42
+ global: true,
43
+ imports: options.imports || [],
44
+ providers: [...this.createAsyncProviders(options)],
45
+ exports: [constants_1.CQRS_MODULE_OPTIONS],
46
+ };
47
+ }
48
+ static createAsyncProviders(options) {
49
+ if (options.useValue) {
50
+ return [
51
+ {
52
+ provide: constants_1.CQRS_MODULE_OPTIONS,
53
+ useValue: options.useValue,
54
+ },
55
+ ];
56
+ }
57
+ if (options.useFactory) {
58
+ return [
59
+ {
60
+ provide: constants_1.CQRS_MODULE_OPTIONS,
61
+ useFactory: options.useFactory,
62
+ inject: options.inject || [],
63
+ },
64
+ ];
65
+ }
66
+ if (options.useClass) {
67
+ return [
68
+ {
69
+ provide: options.useClass,
70
+ useClass: options.useClass,
71
+ },
72
+ {
73
+ provide: constants_1.CQRS_MODULE_OPTIONS,
74
+ useFactory: async (optionsFactory) => optionsFactory.createCqrsOptions(),
75
+ inject: [options.useClass],
76
+ },
77
+ ];
78
+ }
79
+ if (options.useExisting) {
80
+ return [
81
+ {
82
+ provide: constants_1.CQRS_MODULE_OPTIONS,
83
+ useFactory: async (optionsFactory) => optionsFactory.createCqrsOptions(),
84
+ inject: [options.useExisting],
85
+ },
86
+ ];
87
+ }
88
+ throw new Error('Invalid CqrsModuleAsyncOptions configuration. Provide useValue, useFactory, useClass, or useExisting.');
89
+ }
41
90
  constructor(explorerService, eventBus, commandBus, queryBus) {
42
91
  this.explorerService = explorerService;
43
92
  this.eventBus = eventBus;
@@ -11,5 +11,7 @@ import { ICommand } from '../index';
11
11
  * @param options injectable options passed on to the "@Injectable" decorator.
12
12
  *
13
13
  * @see https://docs.nestjs.com/recipes/cqrs#commands
14
+ *
15
+ * @publicApi
14
16
  */
15
17
  export declare const CommandHandler: (command: ICommand | (new (...args: any[]) => ICommand), options?: InjectableOptions) => ClassDecorator;
@@ -15,6 +15,8 @@ const constants_1 = require("./constants");
15
15
  * @param options injectable options passed on to the "@Injectable" decorator.
16
16
  *
17
17
  * @see https://docs.nestjs.com/recipes/cqrs#commands
18
+ *
19
+ * @publicApi
18
20
  */
19
21
  const CommandHandler = (command, options) => {
20
22
  return (target) => {
@@ -11,5 +11,7 @@ import { IEvent } from '../index';
11
11
  * @param options injectable options passed on to the "@Injectable" decorator.
12
12
  *
13
13
  * @see https://docs.nestjs.com/recipes/cqrs#events
14
+ *
15
+ * @publicApi
14
16
  */
15
17
  export declare const EventsHandler: (...events: (IEvent | (new (...args: any[]) => IEvent) | InjectableOptions)[]) => ClassDecorator;
@@ -15,11 +15,13 @@ const constants_1 = require("./constants");
15
15
  * @param options injectable options passed on to the "@Injectable" decorator.
16
16
  *
17
17
  * @see https://docs.nestjs.com/recipes/cqrs#events
18
+ *
19
+ * @publicApi
18
20
  */
19
21
  const EventsHandler = (...events) => {
20
22
  return (target) => {
21
23
  const last = events[events.length - 1];
22
- if (typeof last !== 'function' && 'scope' in last) {
24
+ if (last && typeof last !== 'function' && 'scope' in last) {
23
25
  (0, common_1.Injectable)(last)(target);
24
26
  events.pop();
25
27
  }
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Merges event publisher with the decorated class.
3
3
  * Implements the `publish` and `publishAll` methods in a similar way to {@link EventPublisher#mergeClassContext}.
4
+ *
5
+ * @publicApi
4
6
  */
5
7
  export declare function Publishable(): ClassDecorator;
@@ -5,6 +5,8 @@ const aggregate_root_storage_1 = require("../storages/aggregate-root.storage");
5
5
  /**
6
6
  * Merges event publisher with the decorated class.
7
7
  * Implements the `publish` and `publishAll` methods in a similar way to {@link EventPublisher#mergeClassContext}.
8
+ *
9
+ * @publicApi
8
10
  */
9
11
  function Publishable() {
10
12
  return (target) => {
@@ -11,5 +11,7 @@ import { IQuery } from '../interfaces';
11
11
  * @param options injectable options passed on to the "@Injectable" decorator.
12
12
  *
13
13
  * @see https://docs.nestjs.com/recipes/cqrs#queries
14
+ *
15
+ * @publicApi
14
16
  */
15
17
  export declare const QueryHandler: (query: IQuery, options?: InjectableOptions) => ClassDecorator;
@@ -15,6 +15,8 @@ const constants_1 = require("./constants");
15
15
  * @param options injectable options passed on to the "@Injectable" decorator.
16
16
  *
17
17
  * @see https://docs.nestjs.com/recipes/cqrs#queries
18
+ *
19
+ * @publicApi
18
20
  */
19
21
  const QueryHandler = (query, options) => {
20
22
  return (target) => {
@@ -3,5 +3,7 @@ import 'reflect-metadata';
3
3
  * Decorator that marks a class as a Nest saga. Sagas may listen and react to 1..N events.
4
4
  *
5
5
  * @see https://docs.nestjs.com/recipes/cqrs#sagas
6
+ *
7
+ * @publicApi
6
8
  */
7
9
  export declare const Saga: () => PropertyDecorator;
@@ -7,6 +7,8 @@ const constants_1 = require("./constants");
7
7
  * Decorator that marks a class as a Nest saga. Sagas may listen and react to 1..N events.
8
8
  *
9
9
  * @see https://docs.nestjs.com/recipes/cqrs#sagas
10
+ *
11
+ * @publicApi
10
12
  */
11
13
  const Saga = () => {
12
14
  return (target, propertyKey) => {
@@ -8,6 +8,9 @@ import { AsyncContext } from './scopes';
8
8
  import { UnhandledExceptionBus } from './unhandled-exception-bus';
9
9
  import { ObservableBus } from './utils';
10
10
  export type EventHandlerType<EventBase extends IEvent = IEvent> = Type<IEventHandler<EventBase>>;
11
+ /**
12
+ * @publicApi
13
+ */
11
14
  export declare class EventBus<EventBase extends IEvent = IEvent> extends ObservableBus<EventBase> implements IEventBus<EventBase>, OnModuleDestroy {
12
15
  private readonly commandBus;
13
16
  private readonly moduleRef;
package/dist/event-bus.js CHANGED
@@ -27,6 +27,9 @@ const default_pubsub_1 = require("./helpers/default-pubsub");
27
27
  const scopes_1 = require("./scopes");
28
28
  const unhandled_exception_bus_1 = require("./unhandled-exception-bus");
29
29
  const utils_1 = require("./utils");
30
+ /**
31
+ * @publicApi
32
+ */
30
33
  let EventBus = EventBus_1 = class EventBus extends utils_1.ObservableBus {
31
34
  constructor(commandBus, moduleRef, unhandledExceptionBus, options) {
32
35
  super();
@@ -5,19 +5,22 @@ import { AsyncContext } from './scopes';
5
5
  export interface Constructor<T> {
6
6
  new (...args: any[]): T;
7
7
  }
8
+ /**
9
+ * @publicApi
10
+ */
8
11
  export declare class EventPublisher<EventBase extends IEvent = IEvent> {
9
12
  private readonly eventBus;
10
13
  constructor(eventBus: EventBus<EventBase>);
11
14
  /**
12
15
  * Merge the event publisher into the provided class.
13
- * This is required to make `publish` and `publishAll` available on the `AgreggateRoot` class.
16
+ * This is required to make `publish` and `publishAll` available on the `AggregateRoot` class.
14
17
  * @param metatype The class to merge into.
15
18
  * @param asyncContext The async context (if scoped).
16
19
  */
17
20
  mergeClassContext<T extends Constructor<AggregateRoot<EventBase>>>(metatype: T, asyncContext?: AsyncContext): T;
18
21
  /**
19
22
  * Merge the event publisher into the provided object.
20
- * This is required to make `publish` and `publishAll` available on the `AgreggateRoot` class instance.
23
+ * This is required to make `publish` and `publishAll` available on the `AggregateRoot` class instance.
21
24
  * @param object The object to merge into.
22
25
  * @param asyncContext The async context (if scoped).
23
26
  */
@@ -12,13 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.EventPublisher = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const event_bus_1 = require("./event-bus");
15
+ /**
16
+ * @publicApi
17
+ */
15
18
  let EventPublisher = class EventPublisher {
16
19
  constructor(eventBus) {
17
20
  this.eventBus = eventBus;
18
21
  }
19
22
  /**
20
23
  * Merge the event publisher into the provided class.
21
- * This is required to make `publish` and `publishAll` available on the `AgreggateRoot` class.
24
+ * This is required to make `publish` and `publishAll` available on the `AggregateRoot` class.
22
25
  * @param metatype The class to merge into.
23
26
  * @param asyncContext The async context (if scoped).
24
27
  */
@@ -35,7 +38,7 @@ let EventPublisher = class EventPublisher {
35
38
  }
36
39
  /**
37
40
  * Merge the event publisher into the provided object.
38
- * This is required to make `publish` and `publishAll` available on the `AgreggateRoot` class instance.
41
+ * This is required to make `publish` and `publishAll` available on the `AggregateRoot` class instance.
39
42
  * @param object The object to merge into.
40
43
  * @param asyncContext The async context (if scoped).
41
44
  */
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @publicApi
3
+ */
1
4
  export declare class CommandHandlerNotFoundException extends Error {
2
5
  constructor(commandName: string);
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommandHandlerNotFoundException = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
4
7
  class CommandHandlerNotFoundException extends Error {
5
8
  constructor(commandName) {
6
9
  super(`No handler found for the command: "${commandName}".`);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @publicApi
3
+ */
1
4
  export declare class InvalidCommandHandlerException extends Error {
2
5
  constructor();
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidCommandHandlerException = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
4
7
  class InvalidCommandHandlerException extends Error {
5
8
  constructor() {
6
9
  super(`An invalid command handler has been provided. Please ensure that the provided handler is a class annotated with @CommandHandler and contains an 'execute' method.`);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @publicApi
3
+ */
1
4
  export declare class InvalidEventsHandlerException extends Error {
2
5
  constructor();
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidEventsHandlerException = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
4
7
  class InvalidEventsHandlerException extends Error {
5
8
  constructor() {
6
9
  super(`An invalid events handler has been provided. Please ensure that the provided handler is a class annotated with @EventsHandler and contains a 'handle' method.`);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @publicApi
3
+ */
1
4
  export declare class InvalidSagaException extends Error {
2
5
  constructor();
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidSagaException = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
4
7
  class InvalidSagaException extends Error {
5
8
  constructor() {
6
9
  super(`Invalid saga. Each saga should return Observable stream.`);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @publicApi
3
+ */
1
4
  export declare class QueryHandlerNotFoundException extends Error {
2
5
  constructor(queryName: string);
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.QueryHandlerNotFoundException = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
4
7
  class QueryHandlerNotFoundException extends Error {
5
8
  constructor(queryName) {
6
9
  super(`No handler found for the query: "${queryName}"`);
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @publicApi
3
+ */
1
4
  export declare class UnsupportedSagaScopeException extends Error {
2
5
  constructor();
3
6
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.UnsupportedSagaScopeException = void 0;
4
+ /**
5
+ * @publicApi
6
+ */
4
7
  class UnsupportedSagaScopeException extends Error {
5
8
  constructor() {
6
9
  super(`Request-scoped saga hosts are not supported. Instead, you should retrieve async-context-specific instances within the saga itself, using the "ModuleRef" provider.`);
@@ -3,6 +3,8 @@ import { AsyncContext } from '../../scopes/async.context';
3
3
  import { ICommand } from './command.interface';
4
4
  /**
5
5
  * Represents a command bus.
6
+ *
7
+ * @publicApi
6
8
  */
7
9
  export interface ICommandBus<CommandBase extends ICommand = ICommand> {
8
10
  /**
@@ -3,6 +3,8 @@ import { ICommand } from './command.interface';
3
3
  /**
4
4
  * Represents a command handler.
5
5
  * Command handlers are used to execute commands.
6
+ *
7
+ * @publicApi
6
8
  */
7
9
  export type ICommandHandler<TCommand extends ICommand = any, TResult = any> = TCommand extends Command<infer InferredCommandResult> ? {
8
10
  /**
@@ -1,4 +1,9 @@
1
1
  import { ICommand } from './command.interface';
2
+ /**
3
+ * Represents a command publisher.
4
+ *
5
+ * @publicApi
6
+ */
2
7
  export interface ICommandPublisher<CommandBase extends ICommand = ICommand> {
3
8
  publish<T extends CommandBase = CommandBase>(command: T): any;
4
9
  }
@@ -5,6 +5,8 @@ import { IUnhandledExceptionPublisher } from './exceptions/unhandled-exception-p
5
5
  import { IQueryPublisher } from './queries/query-publisher.interface';
6
6
  /**
7
7
  * Options for the CqrsModule.
8
+ *
9
+ * @publicApi
8
10
  */
9
11
  export interface CqrsModuleOptions {
10
12
  /**
@@ -38,3 +40,26 @@ export interface CqrsModuleOptions {
38
40
  */
39
41
  rethrowUnhandled?: boolean;
40
42
  }
43
+ import { Provider, Type } from '@nestjs/common';
44
+ /**
45
+ * Options for the CqrsModuleOptionsFactory.
46
+ *
47
+ * @publicApi
48
+ */
49
+ export interface CqrsModuleOptionsFactory {
50
+ createCqrsOptions(): Promise<CqrsModuleOptions> | CqrsModuleOptions;
51
+ }
52
+ /**
53
+ * Options for the CqrsModuleAsyncOptions.
54
+ *
55
+ * @publicApi
56
+ */
57
+ export interface CqrsModuleAsyncOptions {
58
+ imports?: any[];
59
+ useExisting?: Type<CqrsModuleOptionsFactory>;
60
+ useClass?: Type<CqrsModuleOptionsFactory>;
61
+ useFactory?: (...args: any[]) => Promise<CqrsModuleOptions> | CqrsModuleOptions;
62
+ useValue?: CqrsModuleOptions;
63
+ inject?: any[];
64
+ extraProviders?: Provider[];
65
+ }
@@ -3,6 +3,8 @@ import { AsyncContext } from '../../scopes/async.context';
3
3
  import { IQuery } from './query.interface';
4
4
  /**
5
5
  * Represents a query bus.
6
+ *
7
+ * @publicApi
6
8
  */
7
9
  export interface IQueryBus<QueryBase extends IQuery = IQuery> {
8
10
  /**
@@ -2,6 +2,8 @@ import { Query } from '../../classes';
2
2
  import { IQuery } from './query.interface';
3
3
  /**
4
4
  * Represents a query handler.
5
+ *
6
+ * @publicApi
5
7
  */
6
8
  export type IQueryHandler<T extends IQuery = any, TRes = any> = T extends Query<infer InferredQueryResult> ? {
7
9
  /**
@@ -1,4 +1,9 @@
1
1
  import { IQuery } from './query.interface';
2
+ /**
3
+ * Represents a query publisher.
4
+ *
5
+ * @publicApi
6
+ */
2
7
  export interface IQueryPublisher<QueryBase extends IQuery = IQuery> {
3
8
  publish<T extends QueryBase = QueryBase>(query: T): any;
4
9
  }
@@ -7,6 +7,9 @@ import { CqrsModuleOptions, IQuery, IQueryBus, IQueryHandler, IQueryPublisher, I
7
7
  import { AsyncContext } from './scopes';
8
8
  import { ObservableBus } from './utils/observable-bus';
9
9
  export type QueryHandlerType<QueryBase extends IQuery = IQuery, QueryResultBase extends IQueryResult = IQueryResult> = Type<IQueryHandler<QueryBase, QueryResultBase>>;
10
+ /**
11
+ * @publicApi
12
+ */
10
13
  export declare class QueryBus<QueryBase extends IQuery = IQuery> extends ObservableBus<QueryBase> implements IQueryBus<QueryBase> {
11
14
  private readonly moduleRef;
12
15
  private readonly options?;
package/dist/query-bus.js CHANGED
@@ -24,6 +24,9 @@ const invalid_query_handler_exception_1 = require("./exceptions/invalid-query-ha
24
24
  const default_query_pubsub_1 = require("./helpers/default-query-pubsub");
25
25
  const scopes_1 = require("./scopes");
26
26
  const observable_bus_1 = require("./utils/observable-bus");
27
+ /**
28
+ * @publicApi
29
+ */
27
30
  let QueryBus = QueryBus_1 = class QueryBus extends observable_bus_1.ObservableBus {
28
31
  constructor(moduleRef, options) {
29
32
  super();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestjs/cqrs",
3
- "version": "11.0.1",
3
+ "version": "11.0.3",
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",
@@ -19,29 +19,29 @@
19
19
  "test:e2e": "jest --config ./test/jest-e2e.json --runInBand"
20
20
  },
21
21
  "devDependencies": {
22
- "@commitlint/cli": "19.7.1",
23
- "@commitlint/config-angular": "19.7.1",
24
- "@eslint/eslintrc": "3.2.0",
25
- "@eslint/js": "9.19.0",
26
- "@nestjs/common": "11.0.7",
27
- "@nestjs/core": "11.0.7",
28
- "@nestjs/testing": "11.0.7",
22
+ "@commitlint/cli": "19.8.0",
23
+ "@commitlint/config-angular": "19.8.0",
24
+ "@eslint/eslintrc": "3.3.1",
25
+ "@eslint/js": "9.23.0",
26
+ "@nestjs/common": "11.0.12",
27
+ "@nestjs/core": "11.0.12",
28
+ "@nestjs/testing": "11.0.12",
29
29
  "@types/jest": "29.5.14",
30
- "@types/node": "22.13.0",
31
- "eslint": "9.19.0",
32
- "eslint-config-prettier": "10.0.1",
33
- "eslint-plugin-prettier": "5.2.3",
34
- "globals": "15.14.0",
30
+ "@types/node": "22.13.11",
31
+ "eslint": "9.23.0",
32
+ "eslint-config-prettier": "10.1.1",
33
+ "eslint-plugin-prettier": "5.2.4",
34
+ "globals": "16.0.0",
35
35
  "husky": "9.1.7",
36
36
  "jest": "29.7.0",
37
- "lint-staged": "15.4.3",
38
- "prettier": "3.4.2",
37
+ "lint-staged": "15.5.0",
38
+ "prettier": "3.5.3",
39
39
  "reflect-metadata": "0.2.2",
40
40
  "release-it": "18.1.2",
41
- "rxjs": "7.8.1",
42
- "ts-jest": "29.2.5",
43
- "typescript": "5.7.3",
44
- "typescript-eslint": "8.22.0"
41
+ "rxjs": "7.8.2",
42
+ "ts-jest": "29.2.6",
43
+ "typescript": "5.8.2",
44
+ "typescript-eslint": "8.27.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@nestjs/common": "^10.0.0 || ^11.0.0",