* Initialize credentials
()
| 94 | * Initialize credentials |
| 95 | */ |
| 96 | private async initializeCredentials() { |
| 97 | const packagePath = getNodeModulesPackagePath('flowise-components') |
| 98 | const nodesPath = path.join(packagePath, 'dist', 'credentials') |
| 99 | const nodeFiles = await this.getFiles(nodesPath) |
| 100 | return Promise.all( |
| 101 | nodeFiles.map(async (file) => { |
| 102 | if (file.endsWith('.credential.js')) { |
| 103 | const credentialModule = await require(file) |
| 104 | if (credentialModule.credClass) { |
| 105 | const newCredInstance = new credentialModule.credClass() |
| 106 | newCredInstance.icon = this.credentialIconPath[newCredInstance.name] ?? '' |
| 107 | this.componentCredentials[newCredInstance.name] = newCredInstance |
| 108 | } |
| 109 | } |
| 110 | }) |
| 111 | ) |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * Recursive function to get node files |
no test coverage detected