// Static message
const mapping = UndoMapping.make({
operation: DeleteThread,
inverse: RestoreThread,
deriveContext: (input, output) => ({
thread: output.thread,
anchor: output.anchor,
}),
message: ['thread deleted label', { ns: '@dxos/plugin-thread' }],
});
// Dynamic message based on input/output
const mapping = UndoMapping.make({
operation: RemoveObjects,
inverse: RestoreObjects,
deriveContext: (_input, output) => output,
message: (input, _output) =>
input.objects.length === 1
? ['object deleted label', { ns: getTypename(input.objects[0]) }]
: ['objects deleted label', { ns: '@dxos/plugin-space' }],
});
Creates a type-safe undo mapping.