refactor(domain): own digest and prefixed identifier shapes in one module (#547)

This commit is contained in:
morluto
2026-10-05 17:29:20 +08:00
committed by GitHub
parent 828395d510
commit ea58834940
56 changed files with 314 additions and 162 deletions
@@ -1,9 +1,10 @@
import { z } from "zod";
import { evidenceBundleSchema } from "./evidenceBundle.js";
import { digestSchema } from "./../domain/digests.js";
import { prefixedDigestSchema } from "./../domain/digests.js";
const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
const evidenceIdSchema = z.string().regex(/^ev_[a-f0-9]{64}$/u);
const evidenceIdSchema = prefixedDigestSchema("ev");
const stableIdSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._:/-]*$/u);
const textSchema = z.string().trim().min(1);
@@ -235,7 +236,7 @@ const countBySchema = <Schema extends z.ZodType>(
export const reconstructionObligationLedgerSchema = z.strictObject({
schema: z.literal("ReconstructionObligationLedger"),
ledger_id: z.string().regex(/^rol_[a-f0-9]{64}$/u),
ledger_id: prefixedDigestSchema("rol"),
closure_digest: digestSchema,
status: z.enum(["ready", "open", "failed", "unknown"]),
coverage: z.strictObject({