@ekwo-ai/vd

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

The Estonian form VD — uhendusesisese kaibe aruanne — in TypeScript: the XML the e-MTA loads, from plain statement rows. Zero dependencies.

原始使用文档
文档目录7 节
  1. One line per acquirer, not one per nature
  2. The specification this was written from
  3. Amounts
  4. What it refuses and what it reports
  5. The file name
  6. Two things about loading it
  7. What is out of scope, on purpose

@ekwo-ai/vd

The Estonian form VD — ühendusesisese käibe aruanne, the report of European Union turnover — in TypeScript, with no dependencies.

Give it the rows of a recapitulative statement and it gives you the XML the e-MTA loads, a name for it, and the list of what could not be put in it.

import { generateVd } from '@ekwo-ai/vd';

const { file, filename, violations } = generateVd(rows, {
  registryCode: '19999999',
  year: 2026,
  month: 2,
});

StatementRow is the row shape of the ec_sales_list(company, from, to) function of Ekwo OS, declared here so that nothing is imported from it. Any book-keeping system that can produce those columns can use this package; it reads no database and knows no accounting.

One line per acquirer, not one per nature

This is the thing to know before anything else. Form VD prints one row per customer with three amount columns beside it, so an acquirer who was supplied goods and services appears once, with two amounts. The instructions say it in as many words: not a single VAT identification number shall recur in the column, and the loader rejects a duplicate by row number.

Every other recapitulative statement in Europe does the opposite — the Belgian listing prints the same number three times with three operation codes. So this package merges the rows it is given, and a package for another format must not.

ColumnWhat it holdsElement
1Country code of the acquirerriik, an attribute of kmkrKood
2VAT number, without the country prefixthe text of kmkrKood
3Taxable value of the goodskaup
4Value of triangular transactionskolmnurktehing
5Taxable value of the servicesteenusteMyyk

A row carries at least one of the three amounts, which this package enforces by leaving out an acquirer whose every amount rounds to nothing, and saying so.

The specification this was written from

WhatWhere
The technical section that carries them allhttps://www.emta.ee/ariklient/e-teenused-koolitused/e-teenuste-kasutamine/teenuste-tehniline-info#vd-aruanne
The schema, served with an .xml extensionhttps://www.emta.ee/sites/default/files/documents/2021-06/vorm_vd_xsd_2011.xml
Description of the XML filehttps://www.emta.ee/sites/default/files/documents/2021-06/vorm_vd_xml_kirjeldus_2011%281%29.rtf
A complete examplehttps://www.emta.ee/sites/default/files/documents/2023-04/vorm_vd_xml_2011.xml
The error messages the loader giveshttps://www.emta.ee/sites/default/files/documents/2023-01/vd_vdp_veateated_12012023.xlsx
The regulation behind the form, consolidatedhttps://www.riigiteataja.ee/akt/107012021006

The output of this package was checked against that schema with xmllint before it was committed. The schema is not shipped here — it belongs to the administration and it moves — so the test suite proves the shape of the document and not its validity.

Two things worth knowing about those documents:

  • The specification is only on the Estonian page. The English technical page carries no VD section at all; its VAT page points at the KMD instead.
  • elementFormDefault is unqualified, so only the root carries the namespace prefix and its children are bare. The published example shows it, and this package writes it that way.

Amounts

Whole euros, rounded away from zero at the half, with no decimals and no separator — the form says täiseurodes under each column, the schema types the three as xs:integer, and the loader refuses 1.5 by name. Negative values are allowed: a cancelled invoice or a credit note is reported on form VD for the period of the credit note, with a minus sign.

What it refuses and what it reports

An exception, because it would make the whole file meaningless: a month outside 1 to 12, or a registry code longer than the eleven characters the schema holds.

A violation, because one line is wrong and the rest of the file is not: whatever the producer flagged, unknown_nature, wrong_currency, no_vat_number, country_code_length, vat_number_is_the_declarer, vat_number_shape — the schema allows twelve characters of letters, digits, + and * — and nil_amounts.

The loader also validates the structure of each number against the Member State it claims, which this package does not: the table of per-country shapes is published with the form and belongs to whoever wants that check, not to a file writer that would then hold a list of Member States.

The file name

The administration imposes none. The technical description prescribes no convention: the e-MTA checks the header of the file — declarer code, year, month — against the report it is being loaded into, and nothing else. vdFileName is a name of ours, and a caller is free to pick another.

Two things about loading it

  • A load replaces everything already in the report, whether it was loaded before or typed in, and only works on a report that has not been confirmed.
  • There is no nil report. Where there was no European Union supply, form VD is not filed at all.

What is out of scope, on purpose

  • Form VDP, the corrections. It exists, it is described, and it has no file format: the e-MTA offers loading from a file for VD and only manual entry for VDP. Nothing here can be written against a specification that does not exist.
  • Call-off stock, column 6 of the form. It is a separate schema with its own namespace, VD_NV_toimingud, and it reports movements of stock rather than supplies.
  • Filing. This package writes bytes; the e-MTA screen is what turns them into a report, and confirming it is irreversible.

MIT.

版本与发布记录

@ekwo-ai/vd 共发布 31 个版本,首次发布于 2026/09/19;过去 12 个月发布了 31 个版本。最新版本附带 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/2817 天前

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

@ekwo-ai/vd 是什么?

The Estonian form VD — uhendusesisese kaibe aruanne — in TypeScript: the XML the e-MTA loads, from plain statement rows. Zero dependencies.

如何安装 @ekwo-ai/vd?

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

@ekwo-ai/vd 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

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

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

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