DocMigrator: (source: MigrationSource) => Record<string, unknown> | undefined

A per-document-kind migrator. Receives the document's serialized source and returns a flattened update payload (Foundry dot-path keys, e.g. { "system.foo": 1 }) to write, or undefined / an empty object for a no-op.

The payload is a Foundry document.update() argument, so express nested changes as dot paths and write a whole array back rather than an element by index (see the array-field contract in the runtime-contracts reference). A migrator must not mutate source.

Type declaration