Exclude internal properties from node definition

pull/5144/head
GogoVega 2025-06-02 14:26:41 +02:00
parent 0f653ed7b2
commit 26e58a53b7
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B
1 changed files with 50 additions and 1 deletions

View File

@ -44,6 +44,51 @@ RED.nodes = (function() {
var dirty = false;
const internalProperties = [
"changed",
"dirty",
"id",
"inputLabels",
"moved",
"outputLabels",
"selected",
"type",
"users",
"valid",
"validationErrors",
"wires",
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
"_",
"_config",
"_def",
"_orig"
];
function setDirty(d) {
dirty = d;
if (!d) {
@ -231,7 +276,6 @@ RED.nodes = (function() {
def.type = nt;
nodeDefinitions[nt] = def;
if (def.defaults) {
for (var d in def.defaults) {
if (def.defaults.hasOwnProperty(d)) {
@ -242,6 +286,11 @@ RED.nodes = (function() {
console.warn(err);
}
}
if (internalProperties.includes(d)) {
console.warn(`registerType: ${nt}: the property "${d}" is internal and cannot be used.`);
delete def.defaults[d];
}
}
}
}