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

Function insertWorkspaceId

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

Source from the content-addressed store, hash-verified

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