@iamnnort/nestjs-serializer 2.1.0 → 2.1.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.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
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,10 +9151,13 @@ 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
|
}
|
|
9154
|
-
transformedEntity[rootFieldName] =
|
|
9160
|
+
transformedEntity[rootFieldName] = null;
|
|
9155
9161
|
});
|
|
9156
9162
|
if (isPlainObject(entity.relatedScope)) {
|
|
9157
9163
|
const transformedRelatedScope = {};
|