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

Function createCredential

packages/server/src/services/credentials/index.ts:13–31  ·  view source on GitHub ↗
(requestBody: any)

Source from the content-addressed store, hash-verified

11import { getRunningExpressApp } from '../../utils/getRunningExpressApp'
12
13const createCredential = async (requestBody: any) => {
14 try {
15 const appServer = getRunningExpressApp()
16 const newCredential = await transformToCredentialEntity(requestBody)
17
18 if (requestBody.id) {
19 newCredential.id = requestBody.id
20 }
21
22 const credential = await appServer.AppDataSource.getRepository(Credential).create(newCredential)
23 const dbResponse = await appServer.AppDataSource.getRepository(Credential).save(credential)
24 return dbResponse
25 } catch (error) {
26 throw new InternalFlowiseError(
27 StatusCodes.INTERNAL_SERVER_ERROR,
28 `Error: credentialsService.createCredential - ${getErrorMessage(error)}`
29 )
30 }
31}
32
33// Delete all credentials from chatflowid
34const deleteCredentials = async (credentialId: string, workspaceId: string): Promise<any> => {

Callers

nothing calls this directly

Calls 4

getRunningExpressAppFunction · 0.90
getErrorMessageFunction · 0.90
createMethod · 0.45

Tested by

no test coverage detected