@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.
@@ -1,2 +1 @@
1
- import { ExecutionContext } from '@nestjs/common';
2
- export declare const RESTServiceOptions: (...dataOrPipes: (ExecutionContext | import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>>)[]) => ParameterDecorator;
1
+ export declare const RESTServiceOptions: (...dataOrPipes: unknown[]) => ParameterDecorator;
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RESTServiceOptions = void 0;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const decorator_helper_1 = require("../helpers/decorator.helper");
6
- exports.RESTServiceOptions = (0, common_1.createParamDecorator)((ctx) => {
7
- const request = ctx.switchToHttp().getRequest();
6
+ exports.RESTServiceOptions = (0, common_1.createParamDecorator)((data, ctx) => {
7
+ if (ctx?.getType() !== 'http') {
8
+ console.warn('[RESTServiceOptions] Not an HTTP context:', ctx?.getType());
9
+ return { currentUser: null };
10
+ }
11
+ const request = ctx.switchToHttp()?.getRequest();
8
12
  const language = request?.headers?.['accept-language'];
9
13
  return {
10
14
  currentUser: (0, decorator_helper_1.currentUserDec)(null, ctx),
@@ -1 +1 @@
1
- {"version":3,"file":"rest-service-options.decorator.js","sourceRoot":"","sources":["../../../../src/core/common/decorators/rest-service-options.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAExE,kEAA6D;AAUhD,QAAA,kBAAkB,GAAG,IAAA,6BAAoB,EAAC,CAAC,GAAqB,EAAkB,EAAE;IAC/F,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAEhD,MAAM,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,iBAAiB,CAAC,CAAC;IAEvD,OAAO;QACL,WAAW,EAAE,IAAA,iCAAc,EAAC,IAAI,EAAE,GAAG,CAAC;QACtC,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"rest-service-options.decorator.js","sourceRoot":"","sources":["../../../../src/core/common/decorators/rest-service-options.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAExE,kEAA6D;AAYhD,QAAA,kBAAkB,GAAG,IAAA,6BAAoB,EAAC,CAAC,IAAa,EAAE,GAAqB,EAAkB,EAAE;IAC9G,IAAI,GAAG,EAAE,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1E,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,EAAE,UAAU,EAAE,CAAC;IACjD,MAAM,QAAQ,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACvD,OAAO;QACL,WAAW,EAAE,IAAA,iCAAc,EAAC,IAAI,EAAE,GAAG,CAAC;QACtC,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC,CAAC"}