@iamnnort/nestjs-serializer 2.1.2 → 2.2.1

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.d.mts CHANGED
@@ -27,6 +27,7 @@ type SerializerFieldConfig = {
27
27
  type SerializerConfig = {
28
28
  globalEntityNames?: string[];
29
29
  globalLimitedScopes?: string[];
30
+ globalSecretScopes?: string[];
30
31
  };
31
32
 
32
33
  declare class SerializerService {
@@ -49,6 +50,8 @@ declare const SerializerInterceptor: (config: {
49
50
  scopes?: string[];
50
51
  extendedScopes?: string[];
51
52
  limitedScopes?: string[];
53
+ secretScopes?: string[];
54
+ allowedScopes?: string[];
52
55
  fields?: string[];
53
56
  }) => {
54
57
  new (serializerService: SerializerService): {
package/dist/index.d.ts CHANGED
@@ -27,6 +27,7 @@ type SerializerFieldConfig = {
27
27
  type SerializerConfig = {
28
28
  globalEntityNames?: string[];
29
29
  globalLimitedScopes?: string[];
30
+ globalSecretScopes?: string[];
30
31
  };
31
32
 
32
33
  declare class SerializerService {
@@ -49,6 +50,8 @@ declare const SerializerInterceptor: (config: {
49
50
  scopes?: string[];
50
51
  extendedScopes?: string[];
51
52
  limitedScopes?: string[];
53
+ secretScopes?: string[];
54
+ allowedScopes?: string[];
52
55
  fields?: string[];
53
56
  }) => {
54
57
  new (serializerService: SerializerService): {
package/dist/index.js CHANGED
@@ -9199,6 +9199,7 @@ SerializerService = exports.SerializerService = _ts_decorate([
9199
9199
  ], SerializerService);
9200
9200
 
9201
9201
  // src/interceptor.ts
9202
+
9202
9203
  function _ts_decorate2(decorators, target, key, desc) {
9203
9204
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9204
9205
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -9240,6 +9241,12 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
9240
9241
  if (request.query.limited) {
9241
9242
  return config.limitedScopes || this.serializerService.config.globalLimitedScopes || config.scopes;
9242
9243
  }
9244
+ if (request.query.secret) {
9245
+ return config.secretScopes || this.serializerService.config.globalSecretScopes || config.scopes;
9246
+ }
9247
+ if (request.query.scopes && config.allowedScopes) {
9248
+ return _lodash.intersection.call(void 0, request.query.scopes, config.allowedScopes);
9249
+ }
9243
9250
  return config.scopes;
9244
9251
  }
9245
9252
  };