@nodescript/core
Advanced tools
Comparing version 7.18.4 to 7.19.0
@@ -21,2 +21,3 @@ import { NodeSpec } from '../types/model.js'; | ||
get nodeUid(): string; | ||
reloadModuleSpec(): Promise<void>; | ||
getModuleSpec(): ModuleSpec; | ||
@@ -68,3 +69,2 @@ isRoot(): boolean; | ||
isAsync(): boolean; | ||
private applyParamAliases; | ||
} | ||
@@ -71,0 +71,0 @@ export interface NodeLink { |
@@ -29,2 +29,3 @@ import { PropSpecSchema } from '../schema/PropSpec.js'; | ||
this.nodeSpec = nodeSpec; | ||
this._moduleSpec = null; | ||
const { ref } = nodeSpec; | ||
@@ -34,5 +35,3 @@ if (ref === '@system/Result') { | ||
} | ||
this._moduleSpec = this.loader.resolveModule(ref); | ||
this._nodeUid = this.graph.scopeId + ':' + localId; | ||
this.applyParamAliases(); | ||
} | ||
@@ -54,3 +53,9 @@ toJSON() { | ||
} | ||
async reloadModuleSpec() { | ||
this._moduleSpec = await this.loader.loadModule(this.ref); | ||
} | ||
getModuleSpec() { | ||
if (!this._moduleSpec) { | ||
this._moduleSpec = this.loader.resolveModule(this.ref); | ||
} | ||
return this._moduleSpec; | ||
@@ -245,25 +250,3 @@ } | ||
} | ||
applyParamAliases() { | ||
for (const [paramKey, paramSpec] of Object.entries(this._moduleSpec.params)) { | ||
// Do not apply alias if prop exists | ||
if (this.nodeSpec.props[paramKey]) { | ||
continue; | ||
} | ||
const aliases = paramSpec.attributes?.aliases; | ||
if (!Array.isArray(aliases)) { | ||
continue; | ||
} | ||
// Assign the prop of the first alias, drop all others | ||
for (const aliasKey of aliases) { | ||
const propSpec = this.nodeSpec.props[aliasKey]; | ||
if (propSpec) { | ||
this.nodeSpec.props[paramKey] = propSpec; | ||
} | ||
} | ||
for (const aliasKey of aliases) { | ||
delete this.nodeSpec.props[aliasKey]; | ||
} | ||
} | ||
} | ||
} | ||
//# sourceMappingURL=NodeView.js.map |
{ | ||
"name": "@nodescript/core", | ||
"version": "7.18.4", | ||
"version": "7.19.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Visual programming language for Browser and Node", |
Sorry, the diff of this file is not supported yet
212509
3692