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

Function insertWorkspaceId

packages/server/src/services/export-import/index.ts:597–612  ·  view source on GitHub ↗
(importedData: any, activeWorkspaceId?: string)

Source from the content-addressed store, hash-verified

595}
596
597function insertWorkspaceId(importedData: any, activeWorkspaceId?: string) {
598 if (!activeWorkspaceId) return importedData
599 importedData.forEach((item: any) => {
600 if (item.type === 'Tool') {
601 // TODO: This is a temporary fix where export data for CustomTemplate type Tool need to be changed in the future.
602 // Also handles backward compatibility for previously exported data where CustomTemplate type Tool does not have flowData field.
603 item.flowData = JSON.stringify({
604 iconSrc: item.iconSrc,
605 schema: item.schema,
606 func: item.func
607 })
608 }
609 item.workspaceId = activeWorkspaceId
610 })
611 return importedData
612}
613
614async function saveBatch(manager: EntityManager, entity: any, items: any[], batchSize = 900) {
615 for (let i = 0; i < items.length; i += batchSize) {

Callers 1

importDataFunction · 0.85

Calls 1

stringifyMethod · 0.80

Tested by

no test coverage detected