@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nest-server",
3
- "version": "11.1.3",
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
- const request = ctx.switchToHttp().getRequest();
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,