Skip to main content

Module undo

Module undo 

Source
Expand description

Compensating event generation for bn undo.

Events are immutable and append-only. undo does not delete or modify events — it emits compensating events that reverse the observable effect:

Original eventCompensating event
item.createitem.delete
item.updateitem.update with prior field value
item.moveitem.move back to prior state
item.assign(assign)item.assign(unassign)
item.assign(unassign)item.assign(assign)
item.linkitem.unlink
item.unlinkitem.link
item.deleteitem.create (reconstruct from history)

Events that cannot be undone (grow-only by design):

  • item.comment — G-Set: comments are permanent
  • item.compact — compaction is not reversible without original events
  • item.snapshot — same as compact
  • item.redact — intentionally permanent

Enums§

UndoError
Reason a compensating event cannot be generated.

Functions§

compensating_event
Generate a compensating event that reverses the effect of original.