@cheetah.js/orm 0.1.122 → 0.1.125
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.
|
@@ -138,9 +138,10 @@ class BaseEntity {
|
|
|
138
138
|
serializeWithEntity(entity) {
|
|
139
139
|
const data = {};
|
|
140
140
|
const allProperties = new Set(Object.keys(entity.properties));
|
|
141
|
+
const allRelations = new Set((entity.relations || []).map((relation) => relation.propertyKey));
|
|
141
142
|
const hidePropertiesSet = new Set(entity.hideProperties);
|
|
142
143
|
for (const key in this) {
|
|
143
|
-
if (this.shouldSkipProperty(key, allProperties, hidePropertiesSet)) {
|
|
144
|
+
if (this.shouldSkipProperty(key, allProperties, allRelations, hidePropertiesSet)) {
|
|
144
145
|
continue;
|
|
145
146
|
}
|
|
146
147
|
data[key] = this[key];
|
|
@@ -159,11 +160,11 @@ class BaseEntity {
|
|
|
159
160
|
}
|
|
160
161
|
return data;
|
|
161
162
|
}
|
|
162
|
-
shouldSkipProperty(key, allProperties, hideProperties) {
|
|
163
|
+
shouldSkipProperty(key, allProperties, allRelations, hideProperties) {
|
|
163
164
|
if (this.isInternalProperty(key)) {
|
|
164
165
|
return true;
|
|
165
166
|
}
|
|
166
|
-
if (!allProperties.has(key)) {
|
|
167
|
+
if (!allProperties.has(key) && !allRelations.has(key)) {
|
|
167
168
|
return true;
|
|
168
169
|
}
|
|
169
170
|
return hideProperties.has(key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cheetah.js/orm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.125",
|
|
4
4
|
"description": "A simple ORM for Cheetah.js",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"bun",
|
|
56
56
|
"value-object"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "b93f774dc0f732549b22d724616e683819683b80"
|
|
59
59
|
}
|