@iamnnort/nestjs-serializer 2.1.1 → 2.2.0
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 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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,7 @@ declare const SerializerInterceptor: (config: {
|
|
|
49
50
|
scopes?: string[];
|
|
50
51
|
extendedScopes?: string[];
|
|
51
52
|
limitedScopes?: string[];
|
|
53
|
+
secretScopes?: string[];
|
|
52
54
|
fields?: string[];
|
|
53
55
|
}) => {
|
|
54
56
|
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,7 @@ declare const SerializerInterceptor: (config: {
|
|
|
49
50
|
scopes?: string[];
|
|
50
51
|
extendedScopes?: string[];
|
|
51
52
|
limitedScopes?: string[];
|
|
53
|
+
secretScopes?: string[];
|
|
52
54
|
fields?: string[];
|
|
53
55
|
}) => {
|
|
54
56
|
new (serializerService: SerializerService): {
|
package/dist/index.js
CHANGED
|
@@ -9136,6 +9136,9 @@ var SerializerService = class {
|
|
|
9136
9136
|
}));
|
|
9137
9137
|
const fieldCountMap = serializerFieldConfigs.reduce((fieldCountMap2, fieldConfig) => {
|
|
9138
9138
|
const fieldName = fieldConfig.fieldName || fieldConfig.name;
|
|
9139
|
+
if (!fieldName.includes(".")) {
|
|
9140
|
+
return fieldCountMap2;
|
|
9141
|
+
}
|
|
9139
9142
|
const rootFieldName = fieldName.split(".")[0];
|
|
9140
9143
|
return {
|
|
9141
9144
|
...fieldCountMap2,
|
|
@@ -9148,6 +9151,9 @@ var SerializerService = class {
|
|
|
9148
9151
|
}
|
|
9149
9152
|
const rootFieldCount = fieldCountMap[rootFieldName];
|
|
9150
9153
|
const rootFieldChildrenCount = Object.keys(rootFieldValue).length;
|
|
9154
|
+
if (!rootFieldCount) {
|
|
9155
|
+
return;
|
|
9156
|
+
}
|
|
9151
9157
|
if (rootFieldCount < rootFieldChildrenCount) {
|
|
9152
9158
|
return;
|
|
9153
9159
|
}
|
|
@@ -9234,6 +9240,9 @@ var SerializerInterceptor = /* @__PURE__ */ __name((config) => {
|
|
|
9234
9240
|
if (request.query.limited) {
|
|
9235
9241
|
return config.limitedScopes || this.serializerService.config.globalLimitedScopes || config.scopes;
|
|
9236
9242
|
}
|
|
9243
|
+
if (request.query.secret) {
|
|
9244
|
+
return config.secretScopes || this.serializerService.config.globalSecretScopes || config.scopes;
|
|
9245
|
+
}
|
|
9237
9246
|
return config.scopes;
|
|
9238
9247
|
}
|
|
9239
9248
|
};
|