Phase 1 — Python (klausur-service): 5 monoliths → 36 files - dsfa_corpus_ingestion.py (1,828 LOC → 5 files) - cv_ocr_engines.py (2,102 LOC → 7 files) - cv_layout.py (3,653 LOC → 10 files) - vocab_worksheet_api.py (2,783 LOC → 8 files) - grid_build_core.py (1,958 LOC → 6 files) Phase 2 — Go (edu-search-service, school-service): 8 monoliths → 19 files - staff_crawler.go (1,402 → 4), policy/store.go (1,168 → 3) - policy_handlers.go (700 → 2), repository.go (684 → 2) - search.go (592 → 2), ai_extraction_handlers.go (554 → 2) - seed_data.go (591 → 2), grade_service.go (646 → 2) Phase 3 — TypeScript (admin-lehrer): 45 monoliths → 220+ files - sdk/types.ts (2,108 → 16 domain files) - ai/rag/page.tsx (2,686 → 14 files) - 22 page.tsx files split into _components/ + _hooks/ - 11 component files split into sub-components - 10 SDK data catalogs added to loc-exceptions - Deleted dead backup index_original.ts (4,899 LOC) All original public APIs preserved via re-export facades. Zero new errors: Python imports verified, Go builds clean, TypeScript tsc --noEmit shows only pre-existing errors. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
/**
|
|
* SDK Export Utilities
|
|
* Barrel module — re-exports PDF, ZIP, and helpers
|
|
*/
|
|
|
|
import { SDKState } from './types'
|
|
import { ExportOptions } from './export-types'
|
|
import { exportToPDF } from './export-pdf'
|
|
import { exportToZIP } from './export-zip'
|
|
|
|
// Re-export all public API
|
|
export type { ExportOptions } from './export-types'
|
|
export { exportToPDF } from './export-pdf'
|
|
export { exportToZIP } from './export-zip'
|
|
|
|
// =============================================================================
|
|
// DOWNLOAD HELPER
|
|
// =============================================================================
|
|
|
|
export async function downloadExport(
|
|
state: SDKState,
|
|
format: 'json' | 'pdf' | 'zip',
|
|
options: ExportOptions = {}
|
|
): Promise<void> {
|
|
let blob: Blob
|
|
let filename: string
|
|
|
|
const timestamp = new Date().toISOString().slice(0, 10)
|
|
|
|
switch (format) {
|
|
case 'json':
|
|
blob = new Blob([JSON.stringify(state, null, 2)], { type: 'application/json' })
|
|
filename = `ai-compliance-sdk-${timestamp}.json`
|
|
break
|
|
|
|
case 'pdf':
|
|
blob = await exportToPDF(state, options)
|
|
filename = `ai-compliance-sdk-${timestamp}.pdf`
|
|
break
|
|
|
|
case 'zip':
|
|
blob = await exportToZIP(state, options)
|
|
filename = `ai-compliance-sdk-${timestamp}.zip`
|
|
break
|
|
|
|
default:
|
|
throw new Error(`Unknown export format: ${format}`)
|
|
}
|
|
|
|
// Create download link
|
|
const url = URL.createObjectURL(blob)
|
|
const link = document.createElement('a')
|
|
link.href = url
|
|
link.download = filename
|
|
document.body.appendChild(link)
|
|
link.click()
|
|
document.body.removeChild(link)
|
|
URL.revokeObjectURL(url)
|
|
}
|