Build a document editor that creates, updates, and deletes documents without silently overwriting a newer revision.
Requirements
Return {documents, error}. Error is null or one of exists, missing, conflict, invalid.
create requires a new nonempty id and a nonblank title; body is a string. Create a document with version 1.
update and delete require an existing id and an exact expectedVersion. Reject stale versions with conflict.
update replaces title and body and increases version by 1. delete removes only that document. Preserve list order, return unchanged documents on errors, and never mutate input.