fix(editor): Fix credential 'supportedNodes' matching

This commit is contained in:
Csaba Tuncsik 2025-01-08 12:06:22 +01:00
parent ecabe34705
commit 4a24021363
No known key found for this signature in database

View file

@ -31,23 +31,21 @@ export function groupNodeTypesByNameAndType(
): NodeTypesByTypeNameAndVersion { ): NodeTypesByTypeNameAndVersion {
const groupedNodeTypes = nodeTypes.reduce<NodeTypesByTypeNameAndVersion>((groups, nodeType) => { const groupedNodeTypes = nodeTypes.reduce<NodeTypesByTypeNameAndVersion>((groups, nodeType) => {
const newNodeVersions = getNodeVersions(nodeType); const newNodeVersions = getNodeVersions(nodeType);
const nodeName = nodeType.name.split('.').pop() as string;
if (newNodeVersions.length === 0) { if (newNodeVersions.length === 0) {
const singleVersion = { [DEFAULT_NODETYPE_VERSION]: nodeType }; const singleVersion = { [DEFAULT_NODETYPE_VERSION]: nodeType };
groups[nodeType.name] = singleVersion; groups[nodeName] = singleVersion;
return groups; return groups;
} }
for (const version of newNodeVersions) { for (const version of newNodeVersions) {
// Node exists with the same name // Node exists with the same name
if (groups[nodeType.name]) { if (groups[nodeName]) {
groups[nodeType.name][version] = Object.assign( groups[nodeName][version] = Object.assign(groups[nodeName][version] ?? {}, nodeType);
groups[nodeType.name][version] ?? {},
nodeType,
);
} else { } else {
groups[nodeType.name] = Object.assign(groups[nodeType.name] ?? {}, { groups[nodeName] = Object.assign(groups[nodeName] ?? {}, {
[version]: nodeType, [version]: nodeType,
}); });
} }