feat(8.0): validateBackup() dry-run + includeContent blob round-trip test + clone test

- validateBackup(data) → { valid, errors, warnings }: structural check, supported
  formatVersion, entity-id uniqueness + required fields, relation-endpoint coverage.
  Lets consumers (e.g. a serializer checking a .wbench graph) validate before import()
  without mutating the brain. Exported from the package root.
- Tests: validateBackup cases, remapIds clone (copy-not-move), and the includeContent
  VFS-blob filesystem round-trip (export captures bytes → import writes them).

Completes the #196 export/import surface for the showcase bar (deferred to 8.0.x:
since(prior).export() delta convenience, exportStream/importStream NDJSON).
This commit is contained in:
David Snelling 2026-06-17 11:44:29 -07:00
parent c2b73d4564
commit 7aad80395e
3 changed files with 195 additions and 2 deletions

View file

@ -144,7 +144,7 @@ export { Db } from './db/db.js'
// Portable graph backup/restore — db.export() / brain.export() / brain.import()
// (BackupData v1; identical wire format to the 7.x line).
export { isBackupData } from './db/backup.js'
export { isBackupData, validateBackup } from './db/backup.js'
export type {
BackupData,
BackupEntity,
@ -152,7 +152,8 @@ export type {
ExportSelector,
ExportOptions,
ImportOptions,
ImportResult
ImportResult,
BackupValidation
} from './db/backup.js'
export {
GenerationConflictError,