@ekwo-ai/xaf

中文文档
0.25.2发布于 2026/11/13MITTypeScriptES Module零依赖构建来源已验证近 30 天下载 3209

Reads an XML Audit File Financial (XAF, versions 3.2 and 4.0) — the accounts, the parties, the opening balance and every transaction of a year — into plain objects in TypeScript: amounts as decimal strings, the file's own totals checked, and what does not

原始使用文档
文档目录3 节
  1. What is read
  2. What it returns
  3. Sources

@ekwo-ai/xaf

Reads an XML Audit File Financial — the XML Auditfile Financieel, XAF, the file an accounting package hands over when an auditor or a tax authority asks for the books of a year — into plain objects, in TypeScript, with no dependencies. Versions 3.2 and 4.0 are read, each recognised by the namespace of its schema.

import { readXaf } from '@ekwo-ai/xaf';

const books = readXaf(bytes); // a string, or the bytes of the file

books.version;     // '4.0'
books.currency;    // 'EUR', from header/curCode
books.entries;     // [{ journal: 'VK', number: '2025001', date: '2025-01-15', lines: […] }, …]
books.opening;     // the obLine of the opening balance
books.openingDate; // opBalDate (3.2), or the first day of the year (4.0)
books.violations;  // a transaction that does not balance, totals the lines disagree with

What is read

Part of the booksWhere it sits in the file
currencyheader/curCode
accountscompany/generalLedger/ledgerAccount: accID, accDesc, accTp (B, P, M, kept as written)
partiescompany/customersSuppliers/customerSupplier: custSupID, custSupName, eMail, taxRegIdent, commerceNr, the country of its first address
opening balancecompany/openingBalance/obLine: accID, amnt, amntTp; its date opBalDate in 3.2, header/startDate in 4.0, which has none
entriescompany/transactions/journal (jrnID, desc) /transaction (nr, desc, trDt)
linestrLine: accID, desc, amnt and amntTp (D or C), custSupID, docRef (the first one is the entry's reference), currency/curCode and curAmnt, and in 3.2 matchKeyID
  • An amount is an xsd:decimal; its side is amntTp. A negative amount is the other side.
  • The file states its own totals — linesCount, totalDebit, totalCredit — for the opening balance and for the transactions, and each is held against what the lines add up to. A file that disagrees with itself, or a transaction that does not balance, comes back as written, with a violation.
  • The encoding is the one the XML declaration names — UTF-8 or ISO-8859-1 — and UTF-8 when it names none, as XML provides. A caller who names another is refused rather than obeyed.
  • The XML is read by a strict reader of its own: no DOCTYPE, no entity beyond the five XML predefines, bounds on size, depth and element count.

What is not read: the sub-ledgers of version 3.2 (subledgers, obSubledgers), which restate by party what the lines already say; the VAT codes and the tax amounts of a line; the periods; the history of changes.

What it returns

The shape declared in src/types.ts, which is, field for field, the shape every reader of an accounting export in this repository declares for itself, plus the version of the file and the openingDate of its opening balance. Amounts are decimal strings, never negative. What is not an audit file is thrown as a BooksFileError with a code.

It knows no chart of accounts: in Ekwo OS the correspondence is made by ekwo import xaf <file>.

Sources

The format was read on 24 September 2026 from the schemas the Dutch tax administration publishes on its developer portal — XmlAuditfileFinancieel3.2.xsd and XmlAuditfileFinancieel4.0.xsd, kept under test/xsd/ with where each came from — and from the pages of that portal: Auditfile Financieel (XAF) v 3.2.1, XMLAuditfile Financieel (XAF) v 4.0.3, Achtergrond informatie XAF4.0.

It was written against the audit file Exact Online exports, as its help centre describes it on the same day: Auditfiles in xml-formaat (XAF) exporteren — Import/Export > Export > Audit file; entries not yet processed are not in the file. ekwo import exact-online <file> is the same as ekwo import xaf.

The fixtures under test/fixtures/, one per version, are written by hand, hold no real data, and are validated against the schema of their version by test/schema.test.ts.

MIT.

版本与发布记录

@ekwo-ai/xaf 共发布 25 个版本,首次发布于 2026/09/28;过去 12 个月发布了 25 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.25.2latest2026/11/13今天
0.25.02026/11/076 天前
0.24.12026/11/059 天前
0.24.02026/10/2816 天前
0.23.02026/10/2816 天前
0.22.02026/10/2816 天前

关于 @ekwo-ai/xaf 的常见问题

@ekwo-ai/xaf 是什么?

Reads an XML Audit File Financial (XAF, versions 3.2 and 4.0) — the accounts, the parties, the opening balance and every transaction of a year — into plain objects in TypeScript: amounts as decimal strings, the file's own totals checked, and what does not

如何安装 @ekwo-ai/xaf?

在项目目录运行 npm install @ekwo-ai/xaf,或使用 pnpm add / yarn add / bun add。

@ekwo-ai/xaf 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ekwo-ai/xaf 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ekwo-ai/xaf 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ekwo-ai/xaf 可以商用吗?

@ekwo-ai/xaf 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ekwo-ai/xaf 的下载量有多少?

根据 npm 官方下载统计,@ekwo-ai/xaf 在 2026/10/13 – 2026/11/11 这 30 天内被下载 3,209 次,日均约 107 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ekwo-ai/xaf 还在维护吗?

最新版本 0.25.2 发布于 2026/11/13(今天);至今共发布 25 个版本,其中过去 12 个月发布了 25 个;首次发布于 2026/09/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。