@rolandsall24/nest-mediator 0.5.1 → 0.5.2
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
CHANGED
|
@@ -758,7 +758,6 @@ Module registration with configuration options.
|
|
|
758
758
|
| `enableExceptionHandling` | boolean | false | Enable centralized exception logging |
|
|
759
759
|
| `enablePerformanceTracking` | boolean | false | Enable slow request warnings |
|
|
760
760
|
| `performanceThresholdMs` | number | 500 | Threshold for slow request warnings |
|
|
761
|
-
| `behaviors` | Type[] | [] | Additional custom behaviors to register |
|
|
762
761
|
|
|
763
762
|
## Pipeline Behaviors
|
|
764
763
|
|
|
@@ -839,28 +838,12 @@ export class MyCustomBehavior<TRequest, TResponse>
|
|
|
839
838
|
|
|
840
839
|
### Registering Custom Behaviors
|
|
841
840
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
```typescript
|
|
845
|
-
@Module({
|
|
846
|
-
imports: [
|
|
847
|
-
NestMediatorModule.forRoot({
|
|
848
|
-
behaviors: [MyCustomBehavior],
|
|
849
|
-
}),
|
|
850
|
-
],
|
|
851
|
-
providers: [
|
|
852
|
-
MyCustomBehavior, // Also add to providers for DI
|
|
853
|
-
],
|
|
854
|
-
})
|
|
855
|
-
export class AppModule {}
|
|
856
|
-
```
|
|
857
|
-
|
|
858
|
-
Or use the `@PipelineBehavior` decorator and add to providers - it will be auto-discovered:
|
|
841
|
+
Custom behaviors with the `@PipelineBehavior` decorator are auto-discovered. Just add them to your module's providers:
|
|
859
842
|
|
|
860
843
|
```typescript
|
|
861
844
|
@Module({
|
|
862
845
|
imports: [NestMediatorModule.forRoot()],
|
|
863
|
-
providers: [MyCustomBehavior], // Auto-discovered via decorator
|
|
846
|
+
providers: [MyCustomBehavior], // Auto-discovered via @PipelineBehavior decorator
|
|
864
847
|
})
|
|
865
848
|
export class AppModule {}
|
|
866
849
|
```
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { DynamicModule,
|
|
1
|
+
import { DynamicModule, OnModuleInit } from '@nestjs/common';
|
|
2
2
|
import { Reflector, DiscoveryService } from '@nestjs/core';
|
|
3
3
|
import { MediatorBus } from './services/index.js';
|
|
4
|
-
import { IPipelineBehavior } from './interfaces/index.js';
|
|
5
4
|
/**
|
|
6
5
|
* Configuration options for NestMediatorModule
|
|
7
6
|
*/
|
|
@@ -37,12 +36,6 @@ export interface NestMediatorModuleOptions {
|
|
|
37
36
|
* Default: 500
|
|
38
37
|
*/
|
|
39
38
|
performanceThresholdMs?: number;
|
|
40
|
-
/**
|
|
41
|
-
* Custom pipeline behaviors to register.
|
|
42
|
-
* These will be registered in addition to any behaviors
|
|
43
|
-
* discovered via @PipelineBehavior decorator.
|
|
44
|
-
*/
|
|
45
|
-
behaviors?: Type<IPipelineBehavior<any, any>>[];
|
|
46
39
|
}
|
|
47
40
|
/**
|
|
48
41
|
* Token for module options injection
|
|
@@ -74,11 +67,6 @@ export declare class NestMediatorModule implements OnModuleInit {
|
|
|
74
67
|
* enablePerformanceTracking: true,
|
|
75
68
|
* performanceThresholdMs: 1000,
|
|
76
69
|
* })
|
|
77
|
-
*
|
|
78
|
-
* // With custom behaviors
|
|
79
|
-
* NestMediatorModule.forRoot({
|
|
80
|
-
* behaviors: [MyCustomBehavior],
|
|
81
|
-
* })
|
|
82
70
|
* ```
|
|
83
71
|
*/
|
|
84
72
|
static forRoot(options?: NestMediatorModuleOptions): DynamicModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nest-mediator.module.d.ts","sourceRoot":"","sources":["../../src/lib/nest-mediator.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"nest-mediator.module.d.ts","sourceRoot":"","sources":["../../src/lib/nest-mediator.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAmB,MAAM,cAAc,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAqBlD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,qBACa,kBAAmB,YAAW,YAAY;IAEnD,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAFhB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB;IAGrD,YAAY;IAoEZ;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,yBAA8B,GAAG,aAAa;CAoCvE"}
|
|
@@ -78,11 +78,6 @@ let NestMediatorModule = NestMediatorModule_1 = class NestMediatorModule {
|
|
|
78
78
|
* enablePerformanceTracking: true,
|
|
79
79
|
* performanceThresholdMs: 1000,
|
|
80
80
|
* })
|
|
81
|
-
*
|
|
82
|
-
* // With custom behaviors
|
|
83
|
-
* NestMediatorModule.forRoot({
|
|
84
|
-
* behaviors: [MyCustomBehavior],
|
|
85
|
-
* })
|
|
86
81
|
* ```
|
|
87
82
|
*/
|
|
88
83
|
static forRoot(options = {}) {
|
|
@@ -100,8 +95,6 @@ let NestMediatorModule = NestMediatorModule_1 = class NestMediatorModule {
|
|
|
100
95
|
if (options.enableValidation) {
|
|
101
96
|
builtInProviders.push(index_js_3.ValidationBehavior);
|
|
102
97
|
}
|
|
103
|
-
// Add custom behaviors
|
|
104
|
-
const customBehaviors = options.behaviors ?? [];
|
|
105
98
|
return {
|
|
106
99
|
module: NestMediatorModule_1,
|
|
107
100
|
imports: [core_1.DiscoveryModule],
|
|
@@ -109,7 +102,6 @@ let NestMediatorModule = NestMediatorModule_1 = class NestMediatorModule {
|
|
|
109
102
|
index_js_1.MediatorBus,
|
|
110
103
|
core_1.Reflector,
|
|
111
104
|
...builtInProviders,
|
|
112
|
-
...customBehaviors,
|
|
113
105
|
{
|
|
114
106
|
provide: exports.NEST_MEDIATOR_OPTIONS,
|
|
115
107
|
useValue: options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nest-mediator.module.js","sourceRoot":"","sources":["../../src/lib/nest-mediator.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA2E;AAC3E,uCAA4E;AAC5E,kDAAkD;AAClD,oDAI+B;AAS/B,mDAK8B;
|
|
1
|
+
{"version":3,"file":"nest-mediator.module.js","sourceRoot":"","sources":["../../src/lib/nest-mediator.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA2E;AAC3E,uCAA4E;AAC5E,kDAAkD;AAClD,oDAI+B;AAS/B,mDAK8B;AA2C9B;;GAEG;AACU,QAAA,qBAAqB,GAAG,uBAAuB,CAAC;AAGtD,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAC7B,YACmB,WAAwB,EACxB,SAAoB,EACpB,gBAAkC;QAFlC,gBAAW,GAAX,WAAW,CAAa;QACxB,cAAS,GAAT,SAAS,CAAW;QACpB,qBAAgB,GAAhB,gBAAgB,CAAkB;IAClD,CAAC;IAEJ,YAAY;QACV,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QAEvD,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,QAAQ,IA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2
2
|
"name": "@rolandsall24/nest-mediator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "A lightweight CQRS (Command Query Responsibility Segregation) mediator pattern implementation for NestJS applications",
|
|
5
5
|
"author": "Roland Salloum",
|
|
6
6
|
"license": "MIT",
|