ApplyCommandDSL extension

A "fluent" shortcut that makes it easier to create and run commands on a cell.

ApplyCommandDSL provides a readable way to assemble a command. Instead of manually building a complex data record, you can use this extension to write code that reads like a sentence: cell.command(update).args([123]).run().

In the framework's biological metaphor, this is the Ergonomic Gateway for triggering a nervous signal. It simplifies the process of creating a high-integrity request without sacrificing the forensic details needed for the ledger.

Why it is used

  • Readability: It turns technical data structures into a "Fluent API," making it much easier for developers to see the intent of a state change.
  • Developer Experience: It provides auto-complete support for adding arguments, named parameters, and "undo" logic in a specific order.
  • Safety: By using the builder, the framework ensures that the resulting ApplyCommand is shaped correctly before it is submitted.

How it works

This extension adds the command method to every Cell. When called, it returns an ApplyCommandRunner, which is a temporary helper object that "remembers" your choices (arguments, compensation, etc.) until you are ready to ApplyCommandRunner.run.

Technical Details

  • Optional Sugar: This extension is "syntax sugar." The core API of the framework still relies on the raw ApplyCommand record. You can always bypass this extension and submit records directly.
  • Zero Overhead: Because it is an extension, it does not add extra memory weight to the Cell instances themselves.

See also:

on

Methods

command(Function function) → ApplyCommandRunner

Available on Cell, provided by the ApplyCommandDSL extension

Begins assembling a command that invokes function on this cell.