Maps Logistiki virtual accounts, journals, and postings to Beancount directives and back.
Beancount is the accounting oracle, not the domain model. Beancount-specific
structs never escape this module (and the Logistiki.Ledger.Beancount
backend). The public API only sees Logistiki.Projections.* structs.
Account code mapping
Logistiki virtual account codes are colon-separated and human-readable
(LIABILITIES:CLIENT_DEPOSITS:USD:ACME:OPERATING). The mapper produces
deterministic Beancount account names by mapping the account type to a
Beancount root (Assets, Liabilities, Equity, Income, Expenses) and
CamelCasing the remaining segments.
Summary
Functions
Converts a Beancount balances result into a map of account -> balance.
Converts a Beancount query row into a plain map of column -> value.
True when the account type has a debit normal balance.
Returns the beancount root for a Logistiki account type.
Returns the signed Beancount amount for a Logistiki posting.
Maps a %VirtualAccount{} to a deterministic Beancount account name.
Maps a Logistiki journal + postings + accounts to a Beancount transaction directive.
Maps a list of accounts to Beancount open directives.
Maps a Logistiki posting to a Beancount posting (signed amount).
Functions
Converts a Beancount balances result into a map of account -> balance.
Converts a Beancount query row into a plain map of column -> value.
True when the account type has a debit normal balance.
Returns the beancount root for a Logistiki account type.
Returns the signed Beancount amount for a Logistiki posting.
Beancount encodes direction as sign: debits are positive, credits are negative, regardless of account type. Account balances then read naturally (assets positive, liabilities/income negative) and match Logistiki's net = debit - credit projection.
Maps a %VirtualAccount{} to a deterministic Beancount account name.
Maps a Logistiki journal + postings + accounts to a Beancount transaction directive.
Maps a list of accounts to Beancount open directives.
Maps a Logistiki posting to a Beancount posting (signed amount).