feat(fp): WP-05 — parse-don't-validate closure + MDX

Close the three remaining unvalidated `as <DomainType>` casts at the wire
boundary (intake-policy, big-register aantekening type, brief passage scope),
each replaced by a Result-returning parser with a rejection-case spec, plus
the Foundations/Parse, don't validate curriculum page.
This commit is contained in:
2026-07-03 21:02:15 +02:00
parent 5d6a78d4ec
commit 34d34512b3
11 changed files with 2323 additions and 1994 deletions

View File

@@ -21,7 +21,6 @@ import {
LetterBlock,
LetterSection,
LibraryPassage,
PassageScope,
} from '@brief/domain/brief';
import { PlaceholderDef } from '@brief/domain/placeholders';
import { Mark, Paragraph, RichTextBlock, RichTextNode } from '@shared/kernel/rich-text';
@@ -228,8 +227,9 @@ export function parseStatus(dto: BriefStatusDto | undefined): Result<string, Bri
}
function parsePassage(dto: LibraryPassageDto): Result<string, LibraryPassage> {
if (typeof dto.passageId !== 'string' || (dto.scope !== 'global' && dto.scope !== 'beroep'))
return err('passage: bad shape');
if (typeof dto.passageId !== 'string') return err('passage: bad shape');
if (dto.scope !== 'global' && dto.scope !== 'beroep')
return err(`passage: unknown scope ${dto.scope}`);
if (
typeof dto.sectionKey !== 'string' ||
typeof dto.label !== 'string' ||
@@ -240,7 +240,7 @@ function parsePassage(dto: LibraryPassageDto): Result<string, LibraryPassage> {
if (!content.ok) return content;
return ok({
passageId: dto.passageId,
scope: dto.scope as PassageScope,
scope: dto.scope,
sectionKey: dto.sectionKey,
label: dto.label,
content: content.value,