mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-03-07 17:43:27 +01:00
fix: Change "dynamicports" in "nodelibrary.json" output to be simpler
This commit is contained in:
@@ -1167,6 +1167,24 @@ EventDispatcher.instance.on(
|
||||
null
|
||||
);
|
||||
|
||||
function mapNodeType(value) {
|
||||
const dto = { ...value };
|
||||
|
||||
if (value.dynamicports) {
|
||||
dto.dynamicports = value.dynamicports.map((rule) => {
|
||||
if (['conditionalports/basic', 'conditionalports/extended'].includes(rule.name)) {
|
||||
return {
|
||||
condition: rule.condition,
|
||||
inputs: rule.ports.map((port) => port.name)
|
||||
};
|
||||
}
|
||||
return rule;
|
||||
});
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
NodeLibrary.instance.on('libraryUpdated', () => {
|
||||
const library = NodeLibrary.instance.library;
|
||||
|
||||
@@ -1177,7 +1195,7 @@ NodeLibrary.instance.on('libraryUpdated', () => {
|
||||
const compactLibrary = {
|
||||
typecasts: library.typecasts,
|
||||
dynamicports: library.dynamicports,
|
||||
nodetypes: library.nodetypes,
|
||||
nodetypes: library.nodetypes.map(mapNodeType),
|
||||
// NOTE: Let's save the node index for now, most likely this is something we will just ignore.
|
||||
nodeIndex: library.nodeIndex,
|
||||
projectsettings: library.projectsettings
|
||||
|
||||
Reference in New Issue
Block a user