# Usage

Python 3.11+ standard library:
```python
import json
from pathlib import Path
from implementations.python.posting_engine import validate_journal,initial_state,post_journal
f=json.loads(Path("datasets/journal-cases.json").read_text())
decision=validate_journal(f["command_template"],f["accounts"],f["context_template"])
outcome=post_journal(initial_state(f["accounts"]),f["command_template"],f["context_template"])
assert decision["totals"]["debit_minor"]=="100000"
assert outcome["code"]=="POSTED"
assert outcome["journal"]["sequence"]=="1"
```

TypeScript 5.7+/Node 22+:
```typescript
import {readFileSync} from 'node:fs';
import {validateJournal,initialState,postJournal} from './implementations/typescript/posting-engine.js';
const f=JSON.parse(readFileSync('datasets/journal-cases.json','utf8'));
const decision=validateJournal(f.command_template,f.accounts,f.context_template);
const result=postJournal(initialState(f.accounts),f.command_template,f.context_template);
console.log(decision.totals,result.code,result.journal.sequence);
```

Run from this folder: `python tests/test_posting.py` then `python tests/run_parity.py`. Parity finds this repository's installed compiler and performs no network install. A standalone copy needs TypeScript and Node type declarations: compile `tsconfig.json` and run `node tests/.tmp-compiled/tests/posting.test.js datasets/journal-cases.json`. Runtime modules have no third-party or sibling imports.

All monetary JSON outputs are strings. Never parse through Number before BigInt. A snapshot is not a database acknowledgement.
