MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / transformToCredentialEntity

Function transformToCredentialEntity

packages/server/src/utils/index.ts:1745–1764  ·  view source on GitHub ↗
(body: ICredentialReqBody)

Source from the content-addressed store, hash-verified

1743 * @returns {Credential}
1744 */
1745export const transformToCredentialEntity = async (body: ICredentialReqBody): Promise<Credential> => {
1746 const credentialBody: ICommonObject = {
1747 name: body.name,
1748 credentialName: body.credentialName
1749 }
1750
1751 if (body.plainDataObj) {
1752 const encryptedData = await encryptCredentialData(body.plainDataObj)
1753 credentialBody.encryptedData = encryptedData
1754 }
1755
1756 const newCredential = new Credential()
1757 Object.assign(newCredential, credentialBody)
1758
1759 if (body.workspaceId) {
1760 newCredential.workspaceId = body.workspaceId
1761 }
1762
1763 return newCredential
1764}
1765
1766/**
1767 * Redact values that are of password type to avoid sending back to client

Callers 2

createCredentialFunction · 0.90
updateCredentialFunction · 0.90

Calls 1

encryptCredentialDataFunction · 0.85

Tested by

no test coverage detected