@onehat/data 1.20.1 → 1.20.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/package.json +1 -1
- package/src/Entity/Entity.js +10 -10
package/package.json
CHANGED
package/src/Entity/Entity.js
CHANGED
|
@@ -908,7 +908,7 @@ class Entity extends EventEmitter {
|
|
|
908
908
|
if (this.isDestroyed) {
|
|
909
909
|
throw Error('this.getIdProperty is no longer valid. Entity has been destroyed.');
|
|
910
910
|
}
|
|
911
|
-
const idProperty = this.getSchema()
|
|
911
|
+
const idProperty = this.getSchema()?.model?.idProperty || null;
|
|
912
912
|
if (!idProperty) {
|
|
913
913
|
throw new Error('No idProperty found for ' + schema.name);
|
|
914
914
|
}
|
|
@@ -964,7 +964,7 @@ class Entity extends EventEmitter {
|
|
|
964
964
|
}
|
|
965
965
|
const
|
|
966
966
|
schema = this.getSchema(),
|
|
967
|
-
model = schema
|
|
967
|
+
model = schema?.model,
|
|
968
968
|
displayProperty = model && model.displayProperty ? model.displayProperty : null;
|
|
969
969
|
if (!displayProperty) {
|
|
970
970
|
throw new Error('No displayProperty found for ' + schema.name);
|
|
@@ -1066,10 +1066,10 @@ class Entity extends EventEmitter {
|
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
1068
1068
|
const schema = this.getSchema();
|
|
1069
|
-
if (!schema
|
|
1070
|
-
!schema
|
|
1071
|
-
!schema
|
|
1072
|
-
!schema
|
|
1069
|
+
if (!schema?.model.associations.hasOne.includes(repositoryName) &&
|
|
1070
|
+
!schema?.model.associations.hasMany.includes(repositoryName) &&
|
|
1071
|
+
!schema?.model.associations.belongsTo.includes(repositoryName) &&
|
|
1072
|
+
!schema?.model.associations.belongsToMany.includes(repositoryName)
|
|
1073
1073
|
) {
|
|
1074
1074
|
throw Error(repositoryName + ' is not associated with this schema');
|
|
1075
1075
|
}
|
|
@@ -1449,7 +1449,7 @@ class Entity extends EventEmitter {
|
|
|
1449
1449
|
throw Error('this.getParentIdProperty is no longer valid. TreeNode has been destroyed.');
|
|
1450
1450
|
}
|
|
1451
1451
|
|
|
1452
|
-
const parentIdProperty = this.getSchema()
|
|
1452
|
+
const parentIdProperty = this.getSchema()?.model.parentIdProperty;
|
|
1453
1453
|
return this.getProperty(parentIdProperty);
|
|
1454
1454
|
}
|
|
1455
1455
|
|
|
@@ -1509,7 +1509,7 @@ class Entity extends EventEmitter {
|
|
|
1509
1509
|
throw Error('this.getDepthProperty is no longer valid. TreeNode has been destroyed.');
|
|
1510
1510
|
}
|
|
1511
1511
|
|
|
1512
|
-
const depthProperty = this.getSchema()
|
|
1512
|
+
const depthProperty = this.getSchema()?.model.depthProperty;
|
|
1513
1513
|
return this.getProperty(depthProperty);
|
|
1514
1514
|
}
|
|
1515
1515
|
|
|
@@ -1546,7 +1546,7 @@ class Entity extends EventEmitter {
|
|
|
1546
1546
|
throw Error('this.getHasChildrenProperty is no longer valid. TreeNode has been destroyed.');
|
|
1547
1547
|
}
|
|
1548
1548
|
|
|
1549
|
-
const hasChildrenProperty = this.getSchema()
|
|
1549
|
+
const hasChildrenProperty = this.getSchema()?.model.hasChildrenProperty;
|
|
1550
1550
|
return this.getProperty(hasChildrenProperty);
|
|
1551
1551
|
}
|
|
1552
1552
|
|
|
@@ -1840,8 +1840,8 @@ class Entity extends EventEmitter {
|
|
|
1840
1840
|
})
|
|
1841
1841
|
this.properties = null;
|
|
1842
1842
|
|
|
1843
|
-
this.emit('destroy', this._proxy);
|
|
1844
1843
|
this.isDestroyed = true;
|
|
1844
|
+
this.emit('destroy', this._proxy);
|
|
1845
1845
|
|
|
1846
1846
|
// listeners
|
|
1847
1847
|
this.removeAllListeners();
|