Files split by agents before rate limit: - dsr/api.ts (669 → barrel + helpers) - einwilligungen/context.tsx (669 → barrel + hooks/reducer) - export.ts (753 → barrel + domain exporters) - incidents/api.ts (845 → barrel + api-helpers) - tom-generator/context.tsx (720 → barrel + hooks/reducer) - vendor-compliance/context.tsx (1010 → 234 provider + hooks/reducer) - api-docs/endpoints.ts — partially split (3 domain files created) - academy/api.ts — partially split (helpers extracted) - whistleblower/api.ts — partially split (helpers extracted) next build passes. api-client.ts (885) deferred to next session. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
/**
|
|
* SDK Export Utilities — Barrel re-exports
|
|
* Preserves the original public API so existing imports work unchanged.
|
|
*/
|
|
|
|
import { SDKState } from './types'
|
|
export { exportToPDF } from './export-pdf'
|
|
export type { ExportOptions } from './export-pdf'
|
|
export { exportToZIP } from './export-zip'
|
|
|
|
// =============================================================================
|
|
// EXPORT HELPER
|
|
// =============================================================================
|
|
|
|
export async function downloadExport(
|
|
state: SDKState,
|
|
format: 'json' | 'pdf' | 'zip',
|
|
options: import('./export-pdf').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': {
|
|
const { exportToPDF } = await import('./export-pdf')
|
|
blob = await exportToPDF(state, options)
|
|
filename = `ai-compliance-sdk-${timestamp}.pdf`
|
|
break
|
|
}
|
|
|
|
case 'zip': {
|
|
const { exportToZIP } = await import('./export-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)
|
|
}
|