Skip to content

API reference / Common / UDocCommand

Type Alias: UDocCommand ​

ts
type UDocCommand = 
  | {
  image: ImageCommand;
}
  | {
  portable: PortableCommand;
}
  | {
  presentation: PresentationCommand;
}
  | {
  spreadsheet: SpreadsheetCommand;
}
  | {
  wordprocessing: WordprocessingCommand;
};

Top-level edit intent for a loaded document — a format-agnostic enum over the per-doc-type commands. A command is issued by the UI or the host and routed to the matching editor + engine by UDocSession::execute.

Every doc type has a variant so the routing is exhaustive. The placeholder doc types wrap an empty command enum (no edits defined yet), so those variants can't be constructed — they're unconstructable today and become live the moment that doc type gains its first command.

Serialize/Deserialize make it the host-facing wire form: externally tagged by doc type, wrapping the per-type command, itself externally tagged — e.g. {"portable":{"insertPage":{"index":1}}}. A host hands this JSON to UDocSession::execute; the same shape logs and replays.