feat: add flow export/import frontend + backend tests

Frontend:
- ExportFlowModal with JSON/XML format selection + download
- ImportFlowModal with drag-drop file picker + preview step
- rfflowParser for client-side JSON/XML .rfflow parsing
- Export buttons on editor toolbar and library action menus
- Import button on library page next to Create New
- Provenance display for imported flows in editor
- flowTransfer API client + types

Backend:
- Fix regex->pattern deprecation in export endpoint
- 12 integration tests covering export, import, round-trip,
  access control, tag/category creation, version validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chihlasm
2026-03-06 00:18:10 -05:00
parent ee9895de5d
commit 39677a3841
15 changed files with 1099 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
import apiClient from './client'
import type { RFFlowFile, FlowImportResponse } from '@/types'
export const flowTransferApi = {
async exportFlow(treeId: string, format: 'json' | 'xml' = 'json'): Promise<Blob> {
const response = await apiClient.get(`/trees/${treeId}/export`, {
params: { format },
responseType: 'blob',
})
return response.data
},
async importFlow(data: RFFlowFile, nameOverride?: string): Promise<FlowImportResponse> {
const params = nameOverride ? { name_override: nameOverride } : undefined
const response = await apiClient.post('/trees/import', data, { params })
return response.data
},
}