diff --git a/packages/core/src/DirectoryLoader.ts b/packages/core/src/DirectoryLoader.ts index 66ba6c832b..adf6888c2b 100644 --- a/packages/core/src/DirectoryLoader.ts +++ b/packages/core/src/DirectoryLoader.ts @@ -1,7 +1,7 @@ import * as path from 'path'; import { readFile } from 'fs/promises'; import glob from 'fast-glob'; -import { jsonParse, LoggerProxy as Logger } from 'n8n-workflow'; +import { jsonParse, getVersionedNodeTypeAll, LoggerProxy as Logger } from 'n8n-workflow'; import type { CodexData, DocumentationLink, @@ -133,7 +133,9 @@ export abstract class DirectoryLoader { version: nodeVersion, }); - this.types.nodes.push(tempNode.description); + getVersionedNodeTypeAll(tempNode).forEach(({ description }) => { + this.types.nodes.push(description); + }); } protected loadCredentialFromFile(credentialName: string, filePath: string): void { diff --git a/packages/workflow/src/NodeHelpers.ts b/packages/workflow/src/NodeHelpers.ts index 59c02e760c..bfef53b0aa 100644 --- a/packages/workflow/src/NodeHelpers.ts +++ b/packages/workflow/src/NodeHelpers.ts @@ -1395,22 +1395,18 @@ export function getVersionedNodeType( object: IVersionedNodeType | INodeType, version?: number, ): INodeType { - if (isNodeTypeVersioned(object)) { - return (object as IVersionedNodeType).getNodeType(version); + if ('nodeVersions' in object) { + return object.getNodeType(version); } - return object as INodeType; + return object; } export function getVersionedNodeTypeAll(object: IVersionedNodeType | INodeType): INodeType[] { - if (isNodeTypeVersioned(object)) { - return Object.values((object as IVersionedNodeType).nodeVersions).map((element) => { + if ('nodeVersions' in object) { + return Object.values(object.nodeVersions).map((element) => { element.description.name = object.description.name; return element; }); } - return [object as INodeType]; -} - -export function isNodeTypeVersioned(object: IVersionedNodeType | INodeType): boolean { - return !!('getNodeType' in object); + return [object]; } diff --git a/packages/workflow/src/index.ts b/packages/workflow/src/index.ts index 9e8b53d552..5e60cfb422 100644 --- a/packages/workflow/src/index.ts +++ b/packages/workflow/src/index.ts @@ -11,6 +11,7 @@ export * from './MessageEventBus'; export * from './Expression'; export * from './ExpressionError'; export * from './NodeErrors'; +export * from './NodeHelpers'; export * from './RoutingNode'; export * from './Workflow'; export * from './WorkflowActivationError';