Various fixes

This commit is contained in:
barsdeveloper
2023-04-16 19:48:14 +02:00
parent c1bbbfef90
commit 6ef2225396
9 changed files with 188 additions and 18 deletions

View File

@@ -1,3 +1,4 @@
import Configuration from "../Configuration.js"
import Utility from "../Utility.js"
import IEntity from "./IEntity.js"
@@ -27,6 +28,20 @@ export default class ObjectReferenceEntity extends IEntity {
/** @type {String} */ this.path
}
sanitize() {
if (this.type && !this.type.startsWith("/")) {
let deprecatedType = this.type + "_Deprecated"
let nodeType = Object.keys(Configuration.nodeType)
.find(type => {
const name = Utility.getNameFromPath(Configuration.nodeType[type])
return name === this.type || name === deprecatedType
})
if (nodeType) {
this.type = Configuration.nodeType[nodeType]
}
}
}
getName() {
return Utility.getNameFromPath(this.path)
}