@iamnnort/nestjs-serializer 1.1.6 → 1.1.8

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/index.mjs CHANGED
@@ -9062,6 +9062,9 @@ var SerializerService = class {
9062
9062
  this.globalEntityNames = config.globalEntityNames || [];
9063
9063
  }
9064
9064
  async transform(response, config) {
9065
+ if (!response) {
9066
+ return response;
9067
+ }
9065
9068
  if (!config.scopes && !config.fields) {
9066
9069
  return response;
9067
9070
  }
@@ -9179,7 +9182,6 @@ SerializerService = _ts_decorate([
9179
9182
  ], SerializerService);
9180
9183
 
9181
9184
  // src/interceptor.ts
9182
- import { pick as pick2 } from "lodash";
9183
9185
  function _ts_decorate2(decorators, target, key, desc) {
9184
9186
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9185
9187
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -9204,16 +9206,13 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
9204
9206
  const scopes = this.getScopes(ctx);
9205
9207
  return next.handle().pipe((0, import_operators.map)(async (responsePromise) => {
9206
9208
  const response = await responsePromise;
9207
- if (config.fields) {
9208
- return pick2(response, config.fields);
9209
+ if (!scopes && !config.fields) {
9210
+ return response;
9209
9211
  }
9210
- if (scopes) {
9211
- return this.serializerService.transform(response, {
9212
- scopes,
9213
- fields: config.fields
9214
- });
9215
- }
9216
- return response;
9212
+ return this.serializerService.transform(response, {
9213
+ scopes,
9214
+ fields: config.fields
9215
+ });
9217
9216
  }));
9218
9217
  }
9219
9218
  getScopes(ctx) {