@opra/nestjs 1.19.3 → 1.19.5
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/cjs/augmentation/nestjs.augmentation.js +2 -2
- package/cjs/index.js +1 -0
- package/cjs/mq-controller.factory.js +12 -0
- package/cjs/rpc-controller.factory.js +3 -2
- package/esm/augmentation/nestjs.augmentation.js +2 -2
- package/esm/index.js +1 -0
- package/esm/mq-controller.factory.js +8 -0
- package/esm/rpc-controller.factory.js +3 -2
- package/package.json +4 -4
- package/types/index.d.cts +1 -0
- package/types/index.d.ts +1 -0
- package/types/mq-controller.factory.d.ts +4 -0
- package/types/rpc-controller.factory.d.ts +1 -0
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const common_1 = require("@nestjs/common");
|
|
4
4
|
const external_exception_filter_js_1 = require("@nestjs/core/exceptions/external-exception-filter.js");
|
|
5
5
|
const common_2 = require("@opra/common");
|
|
6
|
-
const {
|
|
6
|
+
const { MQControllerDecoratorFactory } = common_2.classes;
|
|
7
7
|
const oldCatchMethod = external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch;
|
|
8
8
|
external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch = function (exception, host) {
|
|
9
9
|
const opraContext = host.getArgByIndex(3);
|
|
@@ -12,7 +12,7 @@ external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch = functio
|
|
|
12
12
|
throw exception;
|
|
13
13
|
oldCatchMethod(exception, host);
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
MQControllerDecoratorFactory.augment((decorator, decoratorChain) => {
|
|
16
16
|
decoratorChain.push((_, target) => {
|
|
17
17
|
(0, common_1.Controller)()(target);
|
|
18
18
|
});
|
package/cjs/index.js
CHANGED
|
@@ -5,6 +5,7 @@ require("reflect-metadata");
|
|
|
5
5
|
require("./augmentation/nestjs.augmentation.js");
|
|
6
6
|
tslib_1.__exportStar(require("./constants.js"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./decorators/public.decorator.js"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./mq-controller.factory.js"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./opra-nest-utils.js"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./rpc-controller.factory.js"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./rpc-params.factory.js"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MQControllerFactory = void 0;
|
|
4
|
+
const common_1 = require("@opra/common");
|
|
5
|
+
const rpc_controller_factory_js_1 = require("./rpc-controller.factory.js");
|
|
6
|
+
class MQControllerFactory extends rpc_controller_factory_js_1.RpcControllerFactory {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this._metadataKey = common_1.MQ_CONTROLLER_METADATA;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.MQControllerFactory = MQControllerFactory;
|
|
@@ -16,6 +16,7 @@ let RpcControllerFactory = class RpcControllerFactory {
|
|
|
16
16
|
constructor(modulesContainer, externalContextCreator) {
|
|
17
17
|
this.modulesContainer = modulesContainer;
|
|
18
18
|
this.externalContextCreator = externalContextCreator;
|
|
19
|
+
this._metadataKey = common_2.RPC_CONTROLLER_METADATA;
|
|
19
20
|
this.paramsFactory = new rpc_params_factory_js_1.RpcParamsFactory();
|
|
20
21
|
this.injector = new injector_js_1.Injector();
|
|
21
22
|
}
|
|
@@ -24,7 +25,7 @@ let RpcControllerFactory = class RpcControllerFactory {
|
|
|
24
25
|
for (const { module, wrapper } of this.exploreControllers()) {
|
|
25
26
|
const instance = wrapper.instance;
|
|
26
27
|
const sourceClass = instance.constructor;
|
|
27
|
-
const metadata = Reflect.getMetadata(
|
|
28
|
+
const metadata = Reflect.getMetadata(this._metadataKey, sourceClass);
|
|
28
29
|
const isRequestScoped = !wrapper.isDependencyTreeStatic();
|
|
29
30
|
/** Create a new controller class */
|
|
30
31
|
const newClass = {
|
|
@@ -97,7 +98,7 @@ let RpcControllerFactory = class RpcControllerFactory {
|
|
|
97
98
|
if (wrapper.instance &&
|
|
98
99
|
typeof wrapper.instance === 'object' &&
|
|
99
100
|
wrapper.instance.constructor &&
|
|
100
|
-
Reflect.getMetadata(
|
|
101
|
+
Reflect.getMetadata(this._metadataKey, wrapper.instance.constructor) &&
|
|
101
102
|
!controllers.has(wrapper)) {
|
|
102
103
|
controllers.add({ module, wrapper });
|
|
103
104
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Controller } from '@nestjs/common';
|
|
2
2
|
import { ExternalExceptionFilter } from '@nestjs/core/exceptions/external-exception-filter.js';
|
|
3
3
|
import { classes } from '@opra/common';
|
|
4
|
-
const {
|
|
4
|
+
const { MQControllerDecoratorFactory } = classes;
|
|
5
5
|
const oldCatchMethod = ExternalExceptionFilter.prototype.catch;
|
|
6
6
|
ExternalExceptionFilter.prototype.catch = function (exception, host) {
|
|
7
7
|
const opraContext = host.getArgByIndex(3);
|
|
@@ -10,7 +10,7 @@ ExternalExceptionFilter.prototype.catch = function (exception, host) {
|
|
|
10
10
|
throw exception;
|
|
11
11
|
oldCatchMethod(exception, host);
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
MQControllerDecoratorFactory.augment((decorator, decoratorChain) => {
|
|
14
14
|
decoratorChain.push((_, target) => {
|
|
15
15
|
Controller()(target);
|
|
16
16
|
});
|
package/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import './augmentation/nestjs.augmentation.js';
|
|
3
3
|
export * from './constants.js';
|
|
4
4
|
export * from './decorators/public.decorator.js';
|
|
5
|
+
export * from './mq-controller.factory.js';
|
|
5
6
|
export * from './opra-nest-utils.js';
|
|
6
7
|
export * from './rpc-controller.factory.js';
|
|
7
8
|
export * from './rpc-params.factory.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MQ_CONTROLLER_METADATA } from '@opra/common';
|
|
2
|
+
import { RpcControllerFactory } from './rpc-controller.factory.js';
|
|
3
|
+
export class MQControllerFactory extends RpcControllerFactory {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this._metadataKey = MQ_CONTROLLER_METADATA;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -13,6 +13,7 @@ let RpcControllerFactory = class RpcControllerFactory {
|
|
|
13
13
|
constructor(modulesContainer, externalContextCreator) {
|
|
14
14
|
this.modulesContainer = modulesContainer;
|
|
15
15
|
this.externalContextCreator = externalContextCreator;
|
|
16
|
+
this._metadataKey = RPC_CONTROLLER_METADATA;
|
|
16
17
|
this.paramsFactory = new RpcParamsFactory();
|
|
17
18
|
this.injector = new Injector();
|
|
18
19
|
}
|
|
@@ -21,7 +22,7 @@ let RpcControllerFactory = class RpcControllerFactory {
|
|
|
21
22
|
for (const { module, wrapper } of this.exploreControllers()) {
|
|
22
23
|
const instance = wrapper.instance;
|
|
23
24
|
const sourceClass = instance.constructor;
|
|
24
|
-
const metadata = Reflect.getMetadata(
|
|
25
|
+
const metadata = Reflect.getMetadata(this._metadataKey, sourceClass);
|
|
25
26
|
const isRequestScoped = !wrapper.isDependencyTreeStatic();
|
|
26
27
|
/** Create a new controller class */
|
|
27
28
|
const newClass = {
|
|
@@ -94,7 +95,7 @@ let RpcControllerFactory = class RpcControllerFactory {
|
|
|
94
95
|
if (wrapper.instance &&
|
|
95
96
|
typeof wrapper.instance === 'object' &&
|
|
96
97
|
wrapper.instance.constructor &&
|
|
97
|
-
Reflect.getMetadata(
|
|
98
|
+
Reflect.getMetadata(this._metadataKey, wrapper.instance.constructor) &&
|
|
98
99
|
!controllers.has(wrapper)) {
|
|
99
100
|
controllers.add({ module, wrapper });
|
|
100
101
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/nestjs",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.5",
|
|
4
4
|
"description": "Opra NestJS module",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@jsopen/objects": "^2.0.
|
|
8
|
+
"@jsopen/objects": "^2.0.2",
|
|
9
9
|
"reflect-metadata": "^0.2.2",
|
|
10
10
|
"tslib": "^2.8.1"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@opra/common": "^1.19.
|
|
14
|
-
"@opra/core": "^1.19.
|
|
13
|
+
"@opra/common": "^1.19.5",
|
|
14
|
+
"@opra/core": "^1.19.5",
|
|
15
15
|
"@nestjs/common": "^10.0.0 || ^11.0.0",
|
|
16
16
|
"@nestjs/core": "^10.0.0 || ^11.0.0",
|
|
17
17
|
"@nestjs/microservices": "^10.0.0 || ^11.0.0"
|
package/types/index.d.cts
CHANGED
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import './augmentation/nestjs.augmentation.js';
|
|
3
3
|
export * from './constants.js';
|
|
4
4
|
export * from './decorators/public.decorator.js';
|
|
5
|
+
export * from './mq-controller.factory.js';
|
|
5
6
|
export * from './opra-nest-utils.js';
|
|
6
7
|
export * from './rpc-controller.factory.js';
|
|
7
8
|
export * from './rpc-params.factory.js';
|
package/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import './augmentation/nestjs.augmentation.js';
|
|
3
3
|
export * from './constants.js';
|
|
4
4
|
export * from './decorators/public.decorator.js';
|
|
5
|
+
export * from './mq-controller.factory.js';
|
|
5
6
|
export * from './opra-nest-utils.js';
|
|
6
7
|
export * from './rpc-controller.factory.js';
|
|
7
8
|
export * from './rpc-params.factory.js';
|
|
@@ -6,6 +6,7 @@ import type { Module } from '@nestjs/core/injector/module.js';
|
|
|
6
6
|
export declare class RpcControllerFactory {
|
|
7
7
|
private readonly modulesContainer;
|
|
8
8
|
private readonly externalContextCreator;
|
|
9
|
+
protected _metadataKey: symbol;
|
|
9
10
|
private _coreModuleRef?;
|
|
10
11
|
private readonly paramsFactory;
|
|
11
12
|
private readonly injector;
|