@lenne.tech/nest-server 11.1.3 → 11.1.4
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/dist/core/common/decorators/rest-service-options.decorator.d.ts +1 -2
- package/dist/core/common/decorators/rest-service-options.decorator.js +6 -2
- package/dist/core/common/decorators/rest-service-options.decorator.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core/common/decorators/rest-service-options.decorator.ts +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nest-server",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.4",
|
|
4
4
|
"description": "Modern, fast, powerful Node.js web framework in TypeScript based on Nest with a GraphQL API and a connection to MongoDB (or other databases).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -9,12 +9,17 @@ import { ServiceOptions } from '../interfaces/service-options.interface';
|
|
|
9
9
|
* Includes following properties of ServiceOptions:
|
|
10
10
|
* - currentUser
|
|
11
11
|
* - language
|
|
12
|
+
*
|
|
13
|
+
* param data is set to null, because it is not used in this decorator
|
|
12
14
|
*/
|
|
13
|
-
export const RESTServiceOptions = createParamDecorator((ctx: ExecutionContext): ServiceOptions => {
|
|
14
|
-
|
|
15
|
+
export const RESTServiceOptions = createParamDecorator((data: unknown, ctx: ExecutionContext): ServiceOptions => {
|
|
16
|
+
if (ctx?.getType() !== 'http') {
|
|
17
|
+
console.warn('[RESTServiceOptions] Not an HTTP context:', ctx?.getType());
|
|
18
|
+
return { currentUser: null };
|
|
19
|
+
}
|
|
15
20
|
|
|
21
|
+
const request = ctx.switchToHttp()?.getRequest();
|
|
16
22
|
const language = request?.headers?.['accept-language'];
|
|
17
|
-
|
|
18
23
|
return {
|
|
19
24
|
currentUser: currentUserDec(null, ctx),
|
|
20
25
|
language,
|