/** * JournalPoster — the atomic v2 posting path. * * Flow per posting: pure pre-flight validation (stateless core) → one database * transaction containing period-lock re-check, gapless sequence allocation, * hash computation, entry save, and a compare-and-swap on the chain head. * The session's withTransaction() retries transient conflicts; an abort rolls * the sequence $inc back, so numbering stays gapless. * * JournalEntry (schemaVersion 2) is the single source of truth — no * Transaction-pair explosion. Balances are aggregations (skr.balances.ts). */ import * as core from './core/index.js'; import { JournalEntry } from './skr.classes.journalentry.js'; export interface IPostDraftOptions { policy?: core.IAccountPolicy; postedAt?: Date; createdBy?: string; } /** * The exact structure whose canonical form is hashed into the chain. * Built identically by the poster (from the draft) and the verifier (from the * persisted document) — every optional is normalized so both sides match. */ export declare function buildHashPayload(entry: { sequenceNumber: number; skrType: string; fiscalYear: number; date: Date; postedAt: Date; description: string; reference?: string | null; taxScenario?: string | null; currency?: string | null; reversalOf?: string | null; lines: Array<{ accountNumber: string; counterAccount?: string | null; side?: string | null; amountCents?: number | null; buKey?: string | null; buchungstext?: string | null; belegfeld1?: string | null; costCenter1?: string | null; docLink?: string | null; vatAmountCents?: number | null; reverseChargeParagraph?: string | null; }>; }): Record; export declare class JournalPoster { /** * Probe transaction support with a no-op transaction. Fails hard — * filing-grade posting has no non-transactional fallback. */ assertTransactionSupport(): Promise; /** * Validate and atomically post a journal draft. Returns the persisted, * hashed, immutable JournalEntry. */ postDraft(draft: core.IJournalDraft, options?: IPostDraftOptions): Promise; /** * Storno: post a reversal entry for a hashed entry WITHOUT mutating the * original (GoBD). The reversal references the original via belegfeld1 and * reference; reversal state is derived by querying, never stored on the * original. */ postStorno(original: JournalEntry, options?: IPostDraftOptions & { date?: Date; description?: string; }): Promise; }