@iamnnort/nestjs-serializer 2.2.0 → 2.2.2
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
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);
|
|
@@ -9220,7 +9221,9 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
|
|
|
9220
9221
|
this.serializerService = serializerService;
|
|
9221
9222
|
}
|
|
9222
9223
|
intercept(ctx, next) {
|
|
9224
|
+
const request = ctx.switchToHttp().getRequest();
|
|
9223
9225
|
const scopes = this.getScopes(ctx);
|
|
9226
|
+
request.query.scopes = scopes;
|
|
9224
9227
|
return next.handle().pipe((0, import_operators.map)(async (responsePromise) => {
|
|
9225
9228
|
const response = await responsePromise;
|
|
9226
9229
|
if (!scopes && !config.fields) {
|
|
@@ -9243,6 +9246,9 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
|
|
|
9243
9246
|
if (request.query.secret) {
|
|
9244
9247
|
return config.secretScopes || this.serializerService.config.globalSecretScopes || config.scopes;
|
|
9245
9248
|
}
|
|
9249
|
+
if (request.query.scopes && config.allowedScopes) {
|
|
9250
|
+
return _lodash.intersection.call(void 0, request.query.scopes, config.allowedScopes);
|
|
9251
|
+
}
|
|
9246
9252
|
return config.scopes;
|
|
9247
9253
|
}
|
|
9248
9254
|
};
|