@iamnnort/nestjs-serializer 2.2.8 → 2.2.9
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -63,7 +63,7 @@ declare const SerializerInterceptor: (config: {
|
|
|
63
63
|
serializerService: SerializerService;
|
|
64
64
|
intercept(ctx: ExecutionContext, next: CallHandler<Promise<any>>): rxjs.Observable<Promise<any>>;
|
|
65
65
|
getScopes(ctx: ExecutionContext): string[];
|
|
66
|
-
|
|
66
|
+
withExtendedScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
67
67
|
withSecretScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
68
68
|
};
|
|
69
69
|
};
|
|
@@ -72,7 +72,7 @@ declare const SerializerIdInterceptor_base: {
|
|
|
72
72
|
serializerService: SerializerService;
|
|
73
73
|
intercept(ctx: ExecutionContext, next: CallHandler<Promise<any>>): rxjs.Observable<Promise<any>>;
|
|
74
74
|
getScopes(ctx: ExecutionContext): string[];
|
|
75
|
-
|
|
75
|
+
withExtendedScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
76
76
|
withSecretScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
77
77
|
};
|
|
78
78
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ declare const SerializerInterceptor: (config: {
|
|
|
63
63
|
serializerService: SerializerService;
|
|
64
64
|
intercept(ctx: ExecutionContext, next: CallHandler<Promise<any>>): rxjs.Observable<Promise<any>>;
|
|
65
65
|
getScopes(ctx: ExecutionContext): string[];
|
|
66
|
-
|
|
66
|
+
withExtendedScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
67
67
|
withSecretScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
68
68
|
};
|
|
69
69
|
};
|
|
@@ -72,7 +72,7 @@ declare const SerializerIdInterceptor_base: {
|
|
|
72
72
|
serializerService: SerializerService;
|
|
73
73
|
intercept(ctx: ExecutionContext, next: CallHandler<Promise<any>>): rxjs.Observable<Promise<any>>;
|
|
74
74
|
getScopes(ctx: ExecutionContext): string[];
|
|
75
|
-
|
|
75
|
+
withExtendedScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
76
76
|
withSecretScopes(ctx: ExecutionContext, scopes: string[]): string[];
|
|
77
77
|
};
|
|
78
78
|
};
|
package/dist/index.js
CHANGED
|
@@ -9228,7 +9228,7 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
|
|
|
9228
9228
|
}
|
|
9229
9229
|
intercept(ctx, next) {
|
|
9230
9230
|
const request = ctx.switchToHttp().getRequest();
|
|
9231
|
-
request.scopes = this.
|
|
9231
|
+
request.scopes = this.getScopes(ctx);
|
|
9232
9232
|
return next.handle().pipe((0, import_operators.map)(async (responsePromise) => {
|
|
9233
9233
|
const response = await responsePromise;
|
|
9234
9234
|
if (!request.scopes && !config.fields) {
|
|
@@ -9246,18 +9246,18 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
|
|
|
9246
9246
|
if (request.query.limited === "true") {
|
|
9247
9247
|
return config.limitedScopes || this.serializerService.config.globalLimitedScopes || scopes;
|
|
9248
9248
|
}
|
|
9249
|
-
if (request.query.
|
|
9250
|
-
return
|
|
9249
|
+
if (request.query.scopes && config.allowedScopes) {
|
|
9250
|
+
return _lodash.intersection.call(void 0, request.query.scopes, config.allowedScopes);
|
|
9251
9251
|
}
|
|
9252
|
-
return scopes;
|
|
9252
|
+
return this.withSecretScopes(ctx, this.withExtendedScopes(ctx, scopes));
|
|
9253
9253
|
}
|
|
9254
|
-
|
|
9254
|
+
withExtendedScopes(ctx, scopes) {
|
|
9255
9255
|
const request = ctx.switchToHttp().getRequest();
|
|
9256
|
-
if (request.query.
|
|
9257
|
-
const
|
|
9256
|
+
if (request.query.extended === "true") {
|
|
9257
|
+
const extendedScopes = config.extendedScopes || [];
|
|
9258
9258
|
return _lodash.uniq.call(void 0, [
|
|
9259
9259
|
...scopes,
|
|
9260
|
-
...
|
|
9260
|
+
...extendedScopes
|
|
9261
9261
|
]);
|
|
9262
9262
|
}
|
|
9263
9263
|
return scopes;
|