feat(domain): R2.1 Rust contracts of the sheet, report and archive documents
Sheet document v2, report v3 / v2 / identity, migration map, sheet snapshot, branding, PDF labels and archive envelope ported from the Zod schemas with their exact semantics: strict objects where Zod is strict, optional fields absent (never null), nullable fields required, integers as JavaScript numbers, UTF-16 caps, hand-checked patterns, url crate for .url(), lone surrogate escapes read as U+FFFD (L1, owner confirmation pending). Fields in Zod schema order (PDF labels in the engine dictionary order): the curated and legacy sheets, the demo report and the three frozen archive envelopes print byte for byte as their Zod / attachment form. ts-rs types regenerated; plan rev 2 after three plan challenges.
This commit is contained in:
1 parent
3114d67959
commit
ee0700887f
87 files changed
+2657
-148
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { readdirSync, readFileSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
/** The ts-rs output directory and its hand-kept index must list the same types. */
|
||||
describe('types/index.ts', () => {
|
||||
it('re-exports every generated type file', () => {
|
||||
const dir = fileURLToPath(new URL('../types/', import.meta.url))
|
||||
const generated = readdirSync(dir)
|
||||
.filter((f) => f.endsWith('.ts') && f !== 'index.ts')
|
||||
.map((f) => f.slice(0, -3))
|
||||
.sort()
|
||||
const index = readFileSync(`${dir}index.ts`, 'utf8')
|
||||
const exported = [...index.matchAll(/export type \{ (\w+) \}/g)]
|
||||
.map((m) => m[1])
|
||||
.sort()
|
||||
expect(exported).toEqual(generated)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user