@opra/nestjs 1.0.0-alpha.32 → 1.0.0-alpha.34
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 +3 -3
- package/cjs/opra-http-core.module.js +4 -4
- package/cjs/opra-nestjs-adapter.js +2 -2
- package/cjs/services/opra-middleware.js +2 -2
- package/esm/augmentation/nestjs.augmentation.js +1 -1
- package/esm/opra-http-core.module.js +2 -2
- package/esm/opra-nestjs-adapter.js +1 -1
- package/esm/package.json +3 -0
- package/esm/services/opra-middleware.js +1 -1
- package/package.json +27 -40
- package/cjs/interfaces/opra-module-options.interface.js +0 -17
- package/esm/interfaces/opra-module-options.interface.js +0 -17
- package/types/interfaces/opra-module-options.interface.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const oldCatchMethod =
|
|
5
|
-
|
|
3
|
+
const external_exception_filter_js_1 = require("@nestjs/core/exceptions/external-exception-filter.js");
|
|
4
|
+
const oldCatchMethod = external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch;
|
|
5
|
+
external_exception_filter_js_1.ExternalExceptionFilter.prototype.catch = function (exception, host) {
|
|
6
6
|
const opraContext = host.getArgByIndex(3);
|
|
7
7
|
// Prevents error logging for all Opra controllers
|
|
8
8
|
if (opraContext && opraContext.request && opraContext.response)
|
|
@@ -7,9 +7,9 @@ const common_1 = require("@nestjs/common");
|
|
|
7
7
|
const core_1 = require("@nestjs/core");
|
|
8
8
|
const common_2 = require("@opra/common");
|
|
9
9
|
const ts_gems_1 = require("ts-gems");
|
|
10
|
-
const
|
|
10
|
+
const constants_js_1 = require("./constants.js");
|
|
11
11
|
const opra_nestjs_adapter_js_1 = require("./opra-nestjs-adapter.js");
|
|
12
|
-
const
|
|
12
|
+
const opra_exception_filter_js_1 = require("./services/opra-exception-filter.js");
|
|
13
13
|
const opra_middleware_js_1 = require("./services/opra-middleware.js");
|
|
14
14
|
let OpraHttpCoreModule = OpraHttpCoreModule_1 = class OpraHttpCoreModule {
|
|
15
15
|
constructor(opraAdapter) {
|
|
@@ -27,7 +27,7 @@ let OpraHttpCoreModule = OpraHttpCoreModule_1 = class OpraHttpCoreModule {
|
|
|
27
27
|
const providers = [
|
|
28
28
|
...(init?.providers || []),
|
|
29
29
|
{
|
|
30
|
-
provide:
|
|
30
|
+
provide: constants_js_1.OPRA_HTTP_MODULE_OPTIONS,
|
|
31
31
|
useValue: { ...options },
|
|
32
32
|
},
|
|
33
33
|
{
|
|
@@ -53,7 +53,7 @@ let OpraHttpCoreModule = OpraHttpCoreModule_1 = class OpraHttpCoreModule {
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
provide: core_1.APP_FILTER,
|
|
56
|
-
useClass:
|
|
56
|
+
useClass: opra_exception_filter_js_1.OpraExceptionFilter,
|
|
57
57
|
},
|
|
58
58
|
];
|
|
59
59
|
if (token !== opra_nestjs_adapter_js_1.OpraNestAdapter) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OpraNestAdapter = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
|
-
const
|
|
6
|
+
const constants_js_1 = require("@nestjs/common/constants.js");
|
|
7
7
|
const common_2 = require("@opra/common");
|
|
8
8
|
const core_1 = require("@opra/core");
|
|
9
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -172,7 +172,7 @@ class OpraNestAdapter extends core_1.HttpAdapter {
|
|
|
172
172
|
Reflect.defineMetadata(key, metadata, target);
|
|
173
173
|
continue;
|
|
174
174
|
}
|
|
175
|
-
if (key ===
|
|
175
|
+
if (key === constants_js_1.GUARDS_METADATA || key === constants_js_1.INTERCEPTORS_METADATA || key === constants_js_1.EXCEPTION_FILTERS_METADATA) {
|
|
176
176
|
const m1 = Reflect.getMetadata(key, target) || [];
|
|
177
177
|
const metadata = [...m1];
|
|
178
178
|
const m2 = Reflect.getOwnMetadata(key, parent) || [];
|
|
@@ -4,7 +4,7 @@ exports.OpraMiddleware = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const common_1 = require("@nestjs/common");
|
|
6
6
|
const core_1 = require("@opra/core");
|
|
7
|
-
const
|
|
7
|
+
const constants_js_1 = require("../constants.js");
|
|
8
8
|
const opra_nestjs_adapter_js_1 = require("../opra-nestjs-adapter.js");
|
|
9
9
|
let OpraMiddleware = class OpraMiddleware {
|
|
10
10
|
constructor(opraAdapter, options) {
|
|
@@ -31,6 +31,6 @@ let OpraMiddleware = class OpraMiddleware {
|
|
|
31
31
|
exports.OpraMiddleware = OpraMiddleware;
|
|
32
32
|
exports.OpraMiddleware = OpraMiddleware = tslib_1.__decorate([
|
|
33
33
|
(0, common_1.Injectable)(),
|
|
34
|
-
tslib_1.__param(1, (0, common_1.Inject)(
|
|
34
|
+
tslib_1.__param(1, (0, common_1.Inject)(constants_js_1.OPRA_HTTP_MODULE_OPTIONS)),
|
|
35
35
|
tslib_1.__metadata("design:paramtypes", [opra_nestjs_adapter_js_1.OpraNestAdapter, Object])
|
|
36
36
|
], OpraMiddleware);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalExceptionFilter } from '@nestjs/core/exceptions/external-exception-filter';
|
|
1
|
+
import { ExternalExceptionFilter } from '@nestjs/core/exceptions/external-exception-filter.js';
|
|
2
2
|
const oldCatchMethod = ExternalExceptionFilter.prototype.catch;
|
|
3
3
|
ExternalExceptionFilter.prototype.catch = function (exception, host) {
|
|
4
4
|
const opraContext = host.getArgByIndex(3);
|
|
@@ -4,9 +4,9 @@ import { Global, Module, RequestMethod, } from '@nestjs/common';
|
|
|
4
4
|
import { APP_FILTER, ModuleRef } from '@nestjs/core';
|
|
5
5
|
import { ApiDocumentFactory, isConstructor } from '@opra/common';
|
|
6
6
|
import { asMutable } from 'ts-gems';
|
|
7
|
-
import { OPRA_HTTP_MODULE_OPTIONS } from './constants';
|
|
7
|
+
import { OPRA_HTTP_MODULE_OPTIONS } from './constants.js';
|
|
8
8
|
import { OpraNestAdapter } from './opra-nestjs-adapter.js';
|
|
9
|
-
import { OpraExceptionFilter } from './services/opra-exception-filter';
|
|
9
|
+
import { OpraExceptionFilter } from './services/opra-exception-filter.js';
|
|
10
10
|
import { OpraMiddleware } from './services/opra-middleware.js';
|
|
11
11
|
let OpraHttpCoreModule = OpraHttpCoreModule_1 = class OpraHttpCoreModule {
|
|
12
12
|
constructor(opraAdapter) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { Controller, Delete, Get, Head, Next, Options, Patch, Post, Put, Req, Res, Search } from '@nestjs/common';
|
|
3
|
-
import { EXCEPTION_FILTERS_METADATA, GUARDS_METADATA, INTERCEPTORS_METADATA } from '@nestjs/common/constants';
|
|
3
|
+
import { EXCEPTION_FILTERS_METADATA, GUARDS_METADATA, INTERCEPTORS_METADATA } from '@nestjs/common/constants.js';
|
|
4
4
|
import { ApiDocument, HTTP_CONTROLLER_METADATA, HttpApi, isConstructor, NotFoundError, } from '@opra/common';
|
|
5
5
|
import { HttpAdapter } from '@opra/core';
|
|
6
6
|
import nodePath from 'path';
|
package/esm/package.json
ADDED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { Inject, Injectable } from '@nestjs/common';
|
|
3
3
|
import { HttpContext, HttpIncoming, HttpOutgoing } from '@opra/core';
|
|
4
|
-
import { OPRA_HTTP_MODULE_OPTIONS } from '../constants';
|
|
4
|
+
import { OPRA_HTTP_MODULE_OPTIONS } from '../constants.js';
|
|
5
5
|
import { OpraNestAdapter } from '../opra-nestjs-adapter.js';
|
|
6
6
|
let OpraMiddleware = class OpraMiddleware {
|
|
7
7
|
constructor(opraAdapter, options) {
|
package/package.json
CHANGED
|
@@ -1,58 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/nestjs",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.34",
|
|
4
4
|
"description": "Opra NestJS module",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/panates/opra.git",
|
|
10
|
-
"directory": "packages/nestjs"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"compile": "tsc",
|
|
14
|
-
"prebuild": "npm run lint && npm run clean",
|
|
15
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
16
|
-
"build:cjs": "tsc -b tsconfig-build-cjs.json",
|
|
17
|
-
"build:esm": "tsc -b tsconfig-build-esm.json",
|
|
18
|
-
"postbuild": "cp README.md package.json ../../LICENSE ../../build/nestjs && cp ../../package.cjs.json ../../build/nestjs/cjs/package.json",
|
|
19
|
-
"lint": "eslint . --max-warnings=0",
|
|
20
|
-
"format": "prettier . --write --log-level=warn",
|
|
21
|
-
"test": "jest --passWithNoTests",
|
|
22
|
-
"cover": "jest --passWithNoTests --collect-coverage",
|
|
23
|
-
"clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
|
|
24
|
-
"clean:src": "ts-cleanup -s src --all",
|
|
25
|
-
"clean:test": "ts-cleanup -s test --all",
|
|
26
|
-
"clean:dist": "rimraf ../../build/client",
|
|
27
|
-
"clean:cover": "rimraf ../../coverage/client"
|
|
28
|
-
},
|
|
29
7
|
"dependencies": {
|
|
30
|
-
"@opra/common": "^1.0.0-alpha.
|
|
31
|
-
"@opra/core": "^1.0.0-alpha.
|
|
32
|
-
"fast-tokenizer": "^1.
|
|
8
|
+
"@opra/common": "^1.0.0-alpha.34",
|
|
9
|
+
"@opra/core": "^1.0.0-alpha.34",
|
|
10
|
+
"fast-tokenizer": "^1.6.1",
|
|
33
11
|
"lodash.head": "^4.0.1",
|
|
34
12
|
"putil-promisify": "^1.10.1",
|
|
35
13
|
"reflect-metadata": "^0.2.2",
|
|
36
14
|
"tslib": "^2.6.3"
|
|
37
15
|
},
|
|
38
16
|
"peerDependencies": {
|
|
39
|
-
"@nestjs/common": "^10.
|
|
40
|
-
"@nestjs/core": "^10.
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@nestjs/platform-express": "^10.3.10",
|
|
44
|
-
"@nestjs/testing": "^10.3.10",
|
|
45
|
-
"@types/lodash.head": "^4.0.9",
|
|
46
|
-
"express": "^4.19.2",
|
|
47
|
-
"filedirname": "^3.4.0",
|
|
48
|
-
"rxjs": "^7.8.1",
|
|
49
|
-
"supertest": "^7.0.0",
|
|
50
|
-
"ts-gems": "^3.4.0"
|
|
17
|
+
"@nestjs/common": "^10.4.1",
|
|
18
|
+
"@nestjs/core": "^10.4.1"
|
|
51
19
|
},
|
|
52
20
|
"type": "module",
|
|
53
|
-
"
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./types/index.d.ts",
|
|
25
|
+
"default": "./esm/index.js"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./types/index.d.ts",
|
|
29
|
+
"default": "./cjs/index.js"
|
|
30
|
+
},
|
|
31
|
+
"default": "./esm/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
54
35
|
"main": "./cjs/index.js",
|
|
36
|
+
"module": "./esm/index.js",
|
|
55
37
|
"types": "./types/index.d.ts",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/panates/opra.git",
|
|
41
|
+
"directory": "packages/nestjs"
|
|
42
|
+
},
|
|
56
43
|
"engines": {
|
|
57
44
|
"node": ">=16.0",
|
|
58
45
|
"npm": ">=7.0.0"
|
|
@@ -69,4 +56,4 @@
|
|
|
69
56
|
"opra",
|
|
70
57
|
"nestjs"
|
|
71
58
|
]
|
|
72
|
-
}
|
|
59
|
+
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { ApiDocumentFactory } from '@opra/common';
|
|
3
|
-
// import { ExpressAdapter, HttpAdapter } from '@opra/core';
|
|
4
|
-
// export interface OpraModuleOptions extends HttpAdapter.Options {
|
|
5
|
-
// id?: any;
|
|
6
|
-
// document?: Partial<ApiDocumentFactory.InitArguments>;
|
|
7
|
-
//
|
|
8
|
-
// /**
|
|
9
|
-
// * @default true
|
|
10
|
-
// */
|
|
11
|
-
// useGlobalPrefix?: boolean;
|
|
12
|
-
// }
|
|
13
|
-
// export interface ExpressModuleOptions extends OpraModuleOptions, HttpAdapter.Options {}
|
|
14
|
-
// type OpraModuleOptionsWithoutId = Omit<OpraModuleOptions, 'id'>;
|
|
15
|
-
// export interface OpraModuleOptionsFactory {
|
|
16
|
-
// createOptions(): Promise<OpraModuleOptionsWithoutId> | OpraModuleOptionsWithoutId;
|
|
17
|
-
// }
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { ApiDocumentFactory } from '@opra/common';
|
|
3
|
-
// import { ExpressAdapter, HttpAdapter } from '@opra/core';
|
|
4
|
-
// export interface OpraModuleOptions extends HttpAdapter.Options {
|
|
5
|
-
// id?: any;
|
|
6
|
-
// document?: Partial<ApiDocumentFactory.InitArguments>;
|
|
7
|
-
//
|
|
8
|
-
// /**
|
|
9
|
-
// * @default true
|
|
10
|
-
// */
|
|
11
|
-
// useGlobalPrefix?: boolean;
|
|
12
|
-
// }
|
|
13
|
-
// export interface ExpressModuleOptions extends OpraModuleOptions, HttpAdapter.Options {}
|
|
14
|
-
// type OpraModuleOptionsWithoutId = Omit<OpraModuleOptions, 'id'>;
|
|
15
|
-
// export interface OpraModuleOptionsFactory {
|
|
16
|
-
// createOptions(): Promise<OpraModuleOptionsWithoutId> | OpraModuleOptionsWithoutId;
|
|
17
|
-
// }
|
|
File without changes
|