@ekwo-ai/transaction-journal

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

Reads a transaction journal saved as CSV — each transaction a run of rows under one date, type and number, closed by its total — with the list of accounts exported beside it, into plain objects in TypeScript: amounts as decimal strings, and what does not

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

@ekwo-ai/transaction-journal

Reads a transaction journal saved as CSV — the report a ledger prints of every transaction it posted, one after the other, each line of a transaction on a row of its own — into plain objects, in TypeScript, with no dependencies. Beside it, the list of accounts, exported the same way.

import { readTransactionJournal } from '@ekwo-ai/transaction-journal';

const books = readTransactionJournal([journal, accountList], { dateOrder: 'mdy' });

books.entries;    // [{ journal: 'Invoice', number: '1001', date: '2025-01-15', lines: […] }, …]
books.accounts;   // [{ code: '1200', name: 'Accounts Receivable (A/R)', type: 'Accounts receivable (A/R)' }, …]
books.violations; // a transaction that does not balance, a line that belongs to none

The files

The journal (required). Such a ledger exports its reports as a spreadsheet, not as CSV: open it and save it as CSV. A report is laid out for a person, and nothing on a line names the transaction it belongs to, so it is read in order:

  • the header is the first row that names a Date, an Account (or an Account #), a Debit and a Credit — the title rows above it are passed over, and so is an empty first column;
  • a row with an account and a date starts a transaction — unless it repeats the date, the Transaction Type and the Num of the transaction just before it, which a layout that prints them on every line does;
  • a row with an account and no date continues the transaction above;
  • a row with no account ends it: the total of a transaction, a blank row, the total of the report, the footer.

Optional columns: Transaction Type (kept as the journal of the entry), Num (its number and reference), Name — or Customer full name, Vendor, Supplier, Employee where the report shows those instead — and Memo/Description.

  • An account is identified by its number, Account #, where the report has the column — tick it among the report's columns before exporting — and otherwise by the name the list of accounts gives a number to, or by its name alone.
  • A date written in digits — 03/04/2026 — is read in the order the caller names (dateOrder: 'dmy' | 'mdy' | 'ymd') and refused without one: the order follows the region of the company, and the file does not say it. A date in ISO or with its month in letters (Jan 15, 2025) needs none.
  • An amount is read as a spreadsheet displays it. In a comma-separated file the decimal mark is a point and a comma only groups thousands, three digits at a time (1,234.50). In a file separated by a semicolon or a tab the decimal mark is the one mark the number carries, and thousands are grouped by a space only. A negative is a minus or brackets. A currency symbol, or anything else, is refused.

The list of accounts (optional): Account (or Full name), Type, and Account # where it has one; the rest is ignored. The type is kept in the list's words.

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. A report says no currency: it prints the company's and does not name it, and no amount in another currency is read. Amounts are decimal strings, never negative. What does not add up comes back in violations; what is not a journal is thrown as a BooksFileError with a code.

It knows no chart of accounts: in Ekwo OS the correspondence is made by ekwo import transaction-journal <files…> --date-order mdy.

Sources

This reader was written against the Journal report of QuickBooks Online, read on 24 September 2026 from its help centre:

ekwo import quickbooks-online <files…> is the same as ekwo import transaction-journal.

What those pages do not state — the exact text of the title and total rows, whether a line repeats the date of its transaction — is why the reader finds the header by its columns, and a transaction by the order of its rows under either layout, rather than by position. The fixtures under test/fixtures/ are written by hand from those pages and hold no real data.

MIT.

版本与发布记录

@ekwo-ai/transaction-journal 共发布 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/transaction-journal 的常见问题

@ekwo-ai/transaction-journal 是什么?

Reads a transaction journal saved as CSV — each transaction a run of rows under one date, type and number, closed by its total — with the list of accounts exported beside it, into plain objects in TypeScript: amounts as decimal strings, and what does not

如何安装 @ekwo-ai/transaction-journal?

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

@ekwo-ai/transaction-journal 支持 TypeScript 吗?

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

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

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

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

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

@ekwo-ai/transaction-journal 可以商用吗?

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

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

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

@ekwo-ai/transaction-journal 还在维护吗?

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