feat(app): application on the canonical sheet — report v3 store with v2 draft migration, bundled SheetProvider (SHEET_BUNDLE), annotation layer rendered from the document, zone interaction service, pickers and cards on the sheet index, PDF v3 export with v2 archive import; legacy registry, matchers, editors and assets removed

This commit is contained in:
bchanot committed 2026-10-10 11:36:14 +02:00
1 parent 0a17e390cf
commit ce2ec26112
114 files changed
+3560 -14637

No files matched your search

+20 -21
View File
@@ -1,33 +1,30 @@
import { describe, it, expect } from 'vitest'
import { describe, it, expect, beforeAll } from 'vitest'
import { PDFDocument } from 'pdf-lib'
import { attachReportJson, extractReportJson } from '@/pdf/attachment'
import type { Report } from '@/domain/schema/report'
import type { SheetIndex } from '@/services/sheetIndex'
import { loadTestSheet, minimalReport } from '../helpers/sheet'
const report: Report = {
version: 2,
id: 'r1',
createdAt: '2026-05-18T10:00:00Z',
date: '2026-05-18',
practitioner: { name: 'Dr. Dupont' },
animal: { speciesId: 'equine', name: 'Mistral' },
owner: { name: 'Jean Martin' },
observations: [],
conclusion: 'tout va bien',
recommendations: 'continuer',
}
let sheet: SheetIndex
beforeAll(async () => {
sheet = await loadTestSheet()
})
describe('PDF attachment roundtrip', () => {
it('attaches and extracts the report JSON', async () => {
it('attaches and extracts the v3 report JSON', async () => {
const doc = await PDFDocument.create()
doc.addPage()
await attachReportJson(doc, report)
await attachReportJson(
doc,
minimalReport(sheet, { conclusion: 'tout va bien' }),
)
const bytes = await doc.save()
const reopened = await PDFDocument.load(bytes)
const out = await extractReportJson(reopened)
expect(out.conclusion).toBe('tout va bien')
expect(out.animal.name).toBe('Mistral')
expect(out.version).toBe(2)
const out = await extractReportJson(reopened, sheet.sheet.migrationMap)
expect(out.report.conclusion).toBe('tout va bien')
expect(out.report.animal.name).toBe('Mistral')
expect(out.report.version).toBe(3)
expect(out.migrated).toBe(false)
})
it('throws on PDFs without the attachment', async () => {
@@ -35,6 +32,8 @@ describe('PDF attachment roundtrip', () => {
doc.addPage()
const bytes = await doc.save()
const reopened = await PDFDocument.load(bytes)
await expect(extractReportJson(reopened)).rejects.toThrow()
await expect(
extractReportJson(reopened, sheet.sheet.migrationMap),
).rejects.toThrow()
})
})