@@ -24,11 +24,20 @@ export class NodesPool {
2424 * Initialize nodes
2525 */
2626 private async initializeNodes ( ) {
27- const disabled_nodes = process . env . DISABLED_NODES ? process . env . DISABLED_NODES . split ( ',' ) : [ ]
2827 const packagePath = getNodeModulesPackagePath ( 'flowise-components' )
2928 const nodesPath = path . join ( packagePath , 'dist' , 'nodes' )
30- const nodeFiles = await this . getFiles ( nodesPath )
31- return Promise . all (
29+ const nodes = await this . loadNodesFromDir ( nodesPath )
30+ Object . assign ( this . componentNodes , nodes )
31+ }
32+
33+ /**
34+ * Load and filter nodes from a directory.
35+ */
36+ async loadNodesFromDir ( dir : string ) : Promise < IComponentNodes > {
37+ const disabled_nodes = process . env . DISABLED_NODES ? process . env . DISABLED_NODES . split ( ',' ) : [ ]
38+ const nodes : IComponentNodes = { }
39+ const nodeFiles = await this . getFiles ( dir )
40+ await Promise . all (
3241 nodeFiles . map ( async ( file ) => {
3342 if ( file . endsWith ( '.js' ) ) {
3443 try {
@@ -69,7 +78,7 @@ export class NodesPool {
6978 const isDisabled = disabled_nodes . includes ( newNodeInstance . name )
7079
7180 if ( conditionOne && conditionTwo && ! isDisabled ) {
72- this . componentNodes [ newNodeInstance . name ] = newNodeInstance
81+ nodes [ newNodeInstance . name ] = newNodeInstance
7382 }
7483 }
7584 } catch ( err ) {
@@ -78,6 +87,7 @@ export class NodesPool {
7887 }
7988 } )
8089 )
90+ return nodes
8191 }
8292
8393 /**
0 commit comments