MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / findAvailableConfigs

Function findAvailableConfigs

packages/server/src/utils/index.ts:1334–1461  ·  view source on GitHub ↗
(reactFlowNodes: IReactFlowNode[], componentCredentials: IComponentCredentials)

Source from the content-addressed store, hash-verified

1332 * @returns {IOverrideConfig[]}
1333 */
1334export const findAvailableConfigs = (reactFlowNodes: IReactFlowNode[], componentCredentials: IComponentCredentials) => {
1335 const configs: IOverrideConfig[] = []
1336
1337 for (const flowNode of reactFlowNodes) {
1338 for (const inputParam of flowNode.data.inputParams) {
1339 let obj: IOverrideConfig | undefined
1340 if (inputParam.type === 'file') {
1341 obj = {
1342 node: flowNode.data.label,
1343 nodeId: flowNode.data.id,
1344 label: inputParam.label,
1345 name: 'files',
1346 type: inputParam.fileType ?? inputParam.type
1347 }
1348 } else if (inputParam.type === 'options') {
1349 obj = {
1350 node: flowNode.data.label,
1351 nodeId: flowNode.data.id,
1352 label: inputParam.label,
1353 name: inputParam.name,
1354 type: inputParam.options
1355 ? inputParam.options
1356 ?.map((option) => {
1357 return option.name
1358 })
1359 .join(', ')
1360 : 'string'
1361 }
1362 } else if (inputParam.type === 'credential') {
1363 // get component credential inputs
1364 for (const name of inputParam.credentialNames ?? []) {
1365 if (Object.prototype.hasOwnProperty.call(componentCredentials, name)) {
1366 const inputs = componentCredentials[name]?.inputs ?? []
1367 for (const input of inputs) {
1368 obj = {
1369 node: flowNode.data.label,
1370 nodeId: flowNode.data.id,
1371 label: input.label,
1372 name: input.name,
1373 type: input.type === 'password' ? 'string' : input.type
1374 }
1375 configs.push(obj)
1376 }
1377 }
1378 }
1379 continue
1380 } else if (inputParam.type === 'array') {
1381 const arrayItem = inputParam.array
1382 if (Array.isArray(arrayItem)) {
1383 const arrayItemSchema: Record<string, string> = {}
1384 // Build object schema representing the structure of each array item
1385 for (const item of arrayItem) {
1386 let itemType = item.type
1387 if (itemType === 'options') {
1388 const availableOptions = item.options?.map((option) => option.name).join(', ')
1389 itemType = `(${availableOptions})`
1390 } else if (itemType === 'file') {
1391 itemType = item.fileType ?? item.type

Callers 2

getSingleFlowConfigFunction · 0.90
getAllNodeConfigsFunction · 0.90

Calls 4

stringifyMethod · 0.80
_removeCredentialIdFunction · 0.70
parseMethod · 0.65
callMethod · 0.45

Tested by

no test coverage detected