Extraction Export Library #
@bonsai/extraction-export is an independent TypeScript library that converts extracted document data (invoices, credit notes, bank statements, direct expenses) into 27+ accounting software formats. It was extracted from apps/webapp/src/shared/lib/export into libs/typescript/extraction-export/ to enable reuse across services and enforce a clean dependency boundary.
Architecture #
Directory Layout #
libs/typescript/extraction-export/
├── build.ts # Bun bundler configuration
├── package.json # Scripts, exports, dependencies
├── tsconfig.json # TypeScript config (noEmit for dev)
├── tsconfig.build.json # TypeScript config (declaration-only for build)
├── scripts/
│ └── generate-metadata.ts # Codegen: ts-morph → export-format-metadata.tsx
└── src/
├── index.ts # Server entry point (full exports)
├── client.ts # Client entry point (no Node.js deps)
├── format-converters.tsx # Base types: FormatConverter, ExportFormat, enriched types
├── ap-bill-format-converters.tsx # AP Bill converters (22 formats)
├── ar-invoice-format-converters.tsx # AR Invoice converters (15 formats)
├── credit-note-format-converters.tsx # Credit Note converters (3 formats)
├── bank-statement-format-converters.tsx # Bank Statement converters (8 formats)
├── direct-expense-format-converters.tsx # Direct Expense converters (3 formats)
├── export-format-metadata.tsx # Auto-generated (gitignored) — client-safe metadata
├── export-utils.ts # Export orchestration: enrichment, validation, archiving
├── direct-expense-types.ts # Enriched direct expense types
├── credit-note-types.ts # Enriched credit note types
├── logger.ts # Pluggable logger (configureLogger)
├── icons/ # React SVG icons for accounting software logos
├── types/ # API types (Invoice, BankStatement, etc.)
└── utils/ # Shared utilities (round, StrictSubset)
Key Modules #
| Module | Purpose |
|---|---|
format-converters.tsx |
Base interfaces (FormatConverter, ExportFormat), enriched types, ExportFormatType union, formatDate utility |
ap-bill-format-converters.tsx |
All AP Bill converter classes (QBO, Xero, AutoCount, MYOB, Sage, etc.) |
ar-invoice-format-converters.tsx |
All AR Invoice converter classes |
credit-note-format-converters.tsx |
All Credit Note converter classes (Xero, Zoho Books, Odoo) |
bank-statement-format-converters.tsx |
All Bank Statement converter classes |
direct-expense-format-converters.tsx |
All Direct Expense converter classes (Zoho, MYOB, SQL Accounting) |
export-utils.ts |
High-level functions: enrichInvoicesWithAccountingData, exportInvoices, createMultiFileExport, validation |
export-format-metadata.tsx |
Auto-generated — lightweight metadata (id, name, icon, disabled) for client-side UI format selectors |
logger.ts |
Pluggable logger — webapp bridges its Sentry/Datadog logger via configureLogger() |
generate-metadata.ts |
Metadata codegen source of truth for export format UI metadata and EXPORT_FORMAT_ACCOUNTING_KEYS mappings |
entity.rs |
Defines AccountingTarget, which is the software-level target key used by non-integrated export template selection |
csv-accounting-targets.yaml |
Source of truth for accounting target defaults and extraction-type config |
accounting-target-select.tsx |
Webapp target selector UI, including the manual icon mapping for accounting targets |
config/i18n/en/webapp.json |
English source for accounting target labels under accountingSoftware |
Dual Entry Points #
The library provides two entry points to separate server-side and client-side concerns:
@bonsai/extraction-export (server)
#
Full library with all converter classes, export utilities, and Node.js dependencies (archiver, xlsx). Use this in API routes and server-side code.
import {
exportInvoices,
getApBillConverter,
configureLogger,
} from '@bonsai/extraction-export';
@bonsai/extraction-export/client (client-safe)
#
Types, metadata getters, icons, and lightweight values only. No archiver or xlsx — safe for browser bundles.
import {
getApBillExportFormatMetadata,
configureAssetBaseUrl,
type ApBillExportFormatType,
} from '@bonsai/extraction-export/client';
The client entry point exports:
- All types (type-only re-exports from converter modules)
- Export format metadata getters (from the auto-generated
export-format-metadata.tsx) - Icons and
configureAssetBaseUrl - Logger, utility functions, and enums
How Webapp Consumes the Library #
The webapp configures the library at import time through two config files:
export-config.ts— Sets the R2 CDN base URL for format icons:configureAssetBaseUrl('https://assets.gotofu.com')export-config.server.ts— Bridges the webapp’s structured logger:configureLogger(logger as Logger)
Server-side API routes (/api/export-invoices, /api/export-bank-statements, /api/export-credit-notes, etc.) and the job renderer (/api/internal/export-render) import from @bonsai/extraction-export. Client-side UI components import from @bonsai/extraction-export/client.
Export Status Pipeline #
Export routes do not own extraction status or SSE. They call bonsapi’s status endpoint through shared/lib/extraction-export-status.server.ts:
beginExtractionExportbefore generating the file — moves every selected extraction toEXPORTING.settleExtractionExportonce the response is built —EXPORTEDfor the extractions that made it into the file, and for any that did not,READYwitherror_phase = EXPORT.failExtractionExportin afinallyguard — the route clears its status context after settling, so this only fires on a path that never settled.
bonsapi owns all SSE emission from those transitions; the route never writes to Redis. last_exported_at persists across re-exports, so the recovery action for a failed export is simply re-export.
Export Jobs (bonsapi) #
POST /api/v1/exports starts an asynchronous export that bonsapi owns, so the webapp and the MCP share one implementation, one status writer and one audit trail, with no Next.js request timeout in the way (ENG-9278). GET /api/v1/exports/{export_id} reports it.
- Create. An
Idempotency-Keyheader returns the job the same user already created on the same entity under that key, before anything else is checked. Otherwise the request is validated, the extraction ids are checked as forPOST /api/v1/exports/bundle, and the renderer checks the formats and options (/api/internal/export-render/validate, 10-second timeout): an unknown or disabled format (the message lists the type’s valid formats) or a missing fiscal year start month answers 400 with no job, and an unreachable renderer answers 502. The job is then stored inexport_jobasPENDING. Without the renderer and download configuration the request answers 503. An organization runs at most 3 jobs at once; a fourth answers 429. The check and the insert run under the organization’s row lock, so concurrent requests cannot exceed it, and a job not updated for 10 minutes stops counting. Each bonsapi pod also renders at most 4 jobs at once, whatever their organization; a job waiting for a slot keeps proving it is alive, so the sweep leaves it alone. Anextraction_export_requestedaudit event mirrors the webapp’s “Export Documents (Combined)” log. - Run. The job runs on the actix worker that created it. With
mark_exported: trueit claims the extractions instarted_extraction_idsunder the organization’s row lock, leaving out any anotherRUNNINGjob has claimed, then moves them toEXPORTING; one that refuses is reported, left out and dropped from the record. The move requires a change: an extraction alreadyEXPORTINGis refused when planned and again by theUPDATEunder its row lock, so of two concurrent exports only one holds it and only that one settles it. A transition only fails as a whole before it writes, so a retry never finds this job’s own move. A run that stops on an error fails the job and releases what it moved. - Produce. It builds the bundle in process, posts it to the renderer, and uploads the zip to
exports/files/{organization_id}/{entity_id}/{job_id}.zip. This phase is cut off after 8 minutes. - Settle. The job proves it is still
RUNNINGfirst, so the sweep cannot fail it mid-settle. Withmark_exported, of the recorded extractions stillEXPORTING, those in the file becomeEXPORTEDand the rest go back toREADYwitherror_phase = EXPORT. Both go through the status transition service, so SSE and auto-done behave as for the webapp route. The job endsDONEwith an archive orFAILEDwithout one, and anextraction_export_finishedaudit event records the outcome. - Download. While the job is
DONEand within 24 hours of finishing, eachGETreturns a fresh link toGET /api/v1/exports/{export_id}/download, HMAC-signed withEXPORT_DOWNLOAD_SIGNING_KEYand valid untilexpires_at. bonsapi sets the lifetime when the job is created: 60 minutes when the verified token is the tofu MCP’s, since an agent’s reply may be read much later, and 15 minutes otherwise. A link never outlives the archive. bonsapi streams the archive from storage itself, so the link needs no session, works the same locally, and its lifetime does not depend on AWS credentials.
mark_exported is false by default. The webapp route drives EXPORTING/EXPORTED itself, and a job with mark_exported: true must never act on the same extraction as that route.
Webapp. Behind the export_via_backend_job canary flag (ENG-9280), useExtractionExport sends combined (multi-type) exports to the job instead of /api/export-combined (features/review/hooks/extraction-export-job.ts); the job’s files match that route byte for byte. Single-type exports stay on the per-type routes, which finish files differently (a BOM on single CSVs, CRLF for Sage bank statements, and a few format-specific values), until the renderer matches them. The hook creates the job with mark_exported: true, retrying network errors, 5xx and 429 under one Idempotency-Key so a retry cannot start a second job, polls GET /api/v1/exports/{export_id} every 1.5 seconds with the same retries, then downloads download_url, asking for a fresh link before each of up to 3 attempts. bonsapi ends every job within ten minutes of its last update; the client only gives up after 30 minutes of an unreachable bonsapi. Once the job exists, bonsapi settles the statuses, so the hook throws ExportJobStartedError and the export dialog keeps its optimistic EXPORTING and reconciles from the server instead of rolling back, and shows the error. The job is kept in localStorage until it settles: ExportJobResumer, mounted in the app shell, delivers the file of a job a previous page load left running, including one whose download failed, for as long as bonsapi keeps the archive (24 hours). A Web Lock per job keeps two tabs from following, and downloading, the same job. A 404 while following, which is also what another organization’s token gets (bonsapi’s entity lookup is organization-scoped), pauses instead: it is logged, shows no error, and keeps the job until its organization is active again or the 24-hour limit. Credit notes, expense claims (the job has no group for them) and exports with a MYOB date format (the job has no such option) stay on the routes whatever the flag says. Once the flag has been at 100% for a release cycle, a separate PR deletes the routes, extraction-export-status.server.ts and the export path’s assertOrgAccess, and moves the golden tests to the library renderer.
Recovery and retention. A running job bumps updated_at between phases. A sweep at boot and every minute fails any PENDING or RUNNING job not written for 10 minutes, which covers a bonsapi restart mid-job, and returns its recorded extractions still EXPORTING to READY. The same sweep deletes archives 24 hours after their job finished.
Rendering. Rendering stays in TypeScript. bonsapi posts { bundle, formats, options, context } to the stateless render endpoint POST {EXPORT_RENDER_URL}/api/internal/export-render with Authorization: Bearer {EXPORT_RENDER_API_KEY}. The endpoint answers { archive (base64 zip or null), exported_extraction_ids, errors }, or a 400 { error } for a request it refuses. Its /validate sibling runs the same format and option checks without a bundle, for create time. A stateless HTTP renderer was chosen over the MCP’s in-process path: the job must not depend on the MCP, and a new RabbitMQ worker was ruled out. The endpoint is hosted by the webapp for now, because the library is already built and deployed there. Moving it to a dedicated service changes only EXPORT_RENDER_URL. exportBundleFromApi and resolveExportRequest in export-bundle-api.ts turn the bundle JSON into the renderExportBundle input.
Configuration.
| Where | Variable | Purpose |
|---|---|---|
| bonsapi | EXPORT_RENDER_URL |
Base URL of the renderer, reached inside the cluster |
| bonsapi, webapp | EXPORT_RENDER_API_KEY |
Shared bearer key; the route refuses every call while it is unset |
| bonsapi | EXPORT_DOWNLOAD_SIGNING_KEY |
Signs download links; served at BONSAPI_EXTERNAL_HOST |
| bonsapi | BONSAPI_EXTERNAL_HOST |
Host the download links point at; already passed to the bonsapi deployment |
| S3 bucket | Lifecycle rule on prefix exports/files/ (tools/app-infra) |
Backstop for an archive the sweep failed to delete or never recorded |
Without any of these variables, bonsapi starts but POST /api/v1/exports answers 503.
MCP. tofu-external-mcp’s export_extractions tool is a thin client of the job (ENG-9279), served in every environment since ENG-9324. It creates the job with mark_exported: false and an Idempotency-Key hashed from the entity, the sorted ids, the formats, the options and the current 10-minute window, so a repeated call reuses its job, polls for up to 45 seconds (bonsapi requests included, and stopping if the client cancels), and returns export_id, status, download_url, expires_at and errors. A job still running then is returned as export_id and status, and calling the tool again with that export_id gets the result. A repeat of the same request inside the window returns that job’s file, even if an extraction was edited since.
Build System #
Build Pipeline #
The build runs two stages:
pnpm build
# Which executes: pnpm codegen && bun run build.ts
-
Codegen (
pnpm codegen): Runsscripts/generate-metadata.tswhich uses ts-morph to parse the 5 converter files, extract lightweight metadata (id, name, icon, disabled) from each converter class, and writessrc/export-format-metadata.tsx. This file is gitignored and regenerated on every build. -
Bundle (
bun run build.ts):- Cleans
dist/ - Builds ESM bundles with Bun for both entry points (
index.ts,client.ts) - Externalizes
react,archiver,date-fns,xlsx - Generates source maps
- Runs
tsc --project tsconfig.build.jsonto emit.d.tsdeclaration files - Runs
tsc-aliasto resolve@/path aliases in declarations
- Cleans
Postinstall #
"postinstall": "[ -d dist ] || pnpm build"
Builds the library on pnpm install if dist/ doesn’t exist. This ensures the library is available to consumers without an explicit build step in CI and local development.
Codegen Details #
scripts/generate-metadata.ts uses ts-morph to:
- Parse the 5 converter source files (
ap-bill-format-converters.tsx, etc.) - Walk class hierarchies to find
format,name,icon, anddisabledproperties - Generate a single
export-format-metadata.tsxwith typed metadata arrays and getter functions - Format the output with Biome
Each section is configured with a SectionConfig specifying the source file, type name, and output variable name. Bank statement formats are sorted alphabetically; others preserve source order.
To verify codegen is up to date:
pnpm codegen:check
# Runs codegen, then git diff --exit-code to detect uncommitted changes
Format Converter Types #
The library supports 5 document types, each with its own set of accounting software converters:
AP Bill (Accounts Payable) #
22 formats including: QBO, QBO Desktop, Xero, AutoCount, AutoCount Cloud, Bukku, FAST, FAST Voucher, Winton, MYOB, Sage, Odoo, Freee, Yayoi, SAP, Zoho Bill, QNE (Past Bills & Purchase Invoices), PEAK, ThaiTax, SQL Accounting, AccountingAI
AR Invoice (Accounts Receivable) #
Formats include: QBO, QBO Desktop, Xero, AutoCount, Bukku, FAST, Winton, MYOB, Sage, Odoo, freee, QNE (Past Invoices & Sales Invoices), Zoho Sales Invoice, PEAK, SQL Accounting, InSoft Accounting, AccountingAI, NetSuite
Credit Note #
3 formats: Xero (xero-credit-notes), Zoho Books (zoho-credit-note), Odoo (odoo-credit-notes).
One template per provider covers both directions — purchase (ACCPAYCREDIT) and sales (ACCRECCREDIT). The column set is identical; only the contact column and, where the provider distinguishes them, a document-type column change. Providers file the two directions under separate import screens (Xero: Sales overview vs. the bills-and-credit-notes import; Zoho Books: Credit Notes vs. Vendor Credits), so a mixed selection produces one file the user imports twice.
Amounts are written positive, per ENG-7285 locked decision 7 — every importer targeted here is told the document is a credit note (by its own import screen, by a document-type column, or by the menu it is imported through), so none of them needs the sign to carry that meaning. A converter-level test asserts no template emits a negative cell.
Before adding a template that negates on export, check the importer actually wants that. SQL Account looked like such a case and is not: its FAQ says plainly “No you can’t import the document amount with Negative Value”, and its *-1 All Data tool exists to turn a user’s negative spreadsheet into positives before import. The PRD Qty & Gross AMT column need * -1 rule that suggests otherwise belongs to SQL Account’s customer-specific Yeos import format, whose columns do not exist in our template at all.
Odoo needs no credit-note columns of its own. Odoo’s importer has no move_type column — the field is set by the menu the user imports through (Customers → Credit Notes, Vendors → Refunds). odoo-credit-notes is therefore column-identical to odoo, and a test pins that equality so the two cannot drift.
There is deliberately no QuickBooks Online credit-note template. Intuit does not support credit-memo CSV import in QBO at all — the only route is a third-party importer from the app store (SaasAnt Transactions, Dancing Numbers). A template built for those would be shaped against an importer whose column spec we have not verified, which is a guess wearing a QuickBooks logo. If a customer needs this, get their importer’s published template first and build to that.
Bank Statement #
8 formats including: QBO, Xero, AutoCount, Bukku, Odoo, Zoho, PEAK, AccountingAI
Direct Expense #
3 formats: Zoho Expense, MYOB Direct Expense, SQL Accounting
Converter Interface #
Each converter implements a consistent interface:
interface FormatConverter {
format: ExportFormatType; // e.g. 'qbo', 'xero'
headers: string[]; // CSV/XLSX column headers
convertInvoice: (invoice: EnrichedInvoice) => (string | number | Date | null)[][];
getFileExtension: () => string; // 'csv' or 'xlsx'
getContentType: () => string; // MIME type
getExportWithMetadata?: ( // Optional: custom export with metadata rows
invoices: EnrichedInvoice[],
metadata?: ExportMetadata
) => string | Buffer;
}
Bank statement, direct expense and credit note converters follow the same pattern with type-appropriate methods (convertBankStatement, convertDirectExpense, convertCreditNote).
Credit Note Model #
Credit notes have their own enriched types in credit-note-types.ts rather than reusing EnrichedInvoice (ENG-7551), following the direct-expense-types.ts precedent. The shapes differ in ways an adapter would have to paper over: lines live under data.lines (not data.line_items), there is no due date, direction lives on credit_note.type rather than on the data row, and credit notes carry original_invoice_* / reason_* fields with no invoice counterpart. Adapting would also let every invoice converter silently accept a credit note, which ENG-7285 decision 8 (“fail loud”) rules out.
Mise Tasks #
All tasks are defined in libs/typescript/.tasks.toml:
| Task | Command | Description |
|---|---|---|
mise ts-lib-build |
pnpm build |
Run codegen + Bun bundler + tsc declarations |
mise ts-lib-codegen |
pnpm codegen |
Generate export-format-metadata.tsx |
mise ts-lib-check |
Runs lint + format + typecheck in parallel | All quality checks |
mise ts-lib-lint-check |
pnpm lint (oxlint) |
Lint source files |
mise ts-lib-format-check |
pnpm format (biome) |
Check formatting |
mise ts-lib-format-fix |
pnpm format:fix |
Auto-fix formatting |
mise ts-lib-type-check |
pnpm typecheck (tsc –noEmit) |
Type checking |
CI/CD #
The library is built in CI through two mechanisms:
ci.yml: Thepostinstallscript handles it —pnpm installtriggers[ -d dist ] || pnpm build, building the library ifdist/is absent.deploy.yaml: Explicitly sets up mise and runsmise ts-lib-buildto ensure a fresh build before deployment.
Development Workflow #
Local Development #
# Build the library (codegen + bundle + declarations)
mise ts-lib-build
# Run all quality checks
mise ts-lib-check
# Fix formatting issues
mise ts-lib-format-fix
# Regenerate metadata after modifying converters
mise ts-lib-codegen
# Type-check only
mise ts-lib-type-check
After Modifying Converters #
When you add or change a converter class, you must regenerate metadata:
mise ts-lib-codegen # Regenerates export-format-metadata.tsx
mise ts-lib-build # Full rebuild including codegen
The postinstall hook rebuilds automatically when dist/ is missing, but during development you should run explicit builds after changes.
Golden-File Tests #
Export output is pinned byte for byte at two levels:
- Converters (
libs/typescript/extraction-export/tests/golden.test.ts, bun,mise run ts-extraction-export-test): every format’screateMultiFileExportoutput, recorded per file (name, size, bytes) intests/__golden__/<variant>/<type>/<format>.golden. - Routes (
apps/webapp/src/app/api/export-*/__tests__/golden*.test.ts, Jest): the same fixtures posted through each export route, recording status, download headers and body. A zip is recorded entry by entry (name, order, bytes) plus a sha256 of the whole archive, so the Money Forward and Yayoi normalisation, the Shift_JIS encoding, the BOM rules and the zip container are covered. The archive hash moves with the Node zlib version.
Variants cover every combination of the inputs a route takes: the accounting source (base with no integration, quickbooks, xero) and each option (reverse-charge, fiscal-january against a base of April, myob-dmy, myob-ymd). A variant keeps its own file only where its output differs from its parent (the same variant without its last option, or the previous source), so most combinations reuse a parent’s file. A file that repeats its parent fails the run. row-split cases cross the 1,000-row file limit, must answer with a zip, and record a sha256 per entry.
Fixtures are synthetic, never customer data, and live in libs/typescript/extraction-export/tests/fixtures/. The webapp imports them, and the golden file store, from @bonsai/extraction-export/testing. The clock is pinned to 2026-03-01T09:30:45Z and the zone to UTC: by bun for the library, and by apps/webapp/jest.export-golden-environment.cjs (named in each route test’s @jest-environment docblock) for the routes, so other webapp tests keep their own zone.
The webapp tests read the library’s dist/, so rebuild it first. To accept an intended output change, regenerate and review the diff of the golden files:
mise run ts-extraction-export-build
UPDATE_EXPORT_GOLDEN=1 mise run ts-extraction-export-test
UPDATE_EXPORT_GOLDEN=1 pnpm webapp test -- golden
A golden file no case produces fails the run; regenerating removes it.
Adding a New CSV Export Template #
Adding a new export template is not a single-file change. There are two cases:
1. New template that reuses an existing accounting target #
You usually need to update all of these:
libs/typescript/extraction-export/src/format-converters/format-converters.tsx- add the new format id to
ExportFormatType
- add the new format id to
- The relevant extraction-type converter file:
ap-bill-format-converters.tsxar-invoice-format-converters.tsxbank-statement-format-converters.tsxdirect-expense-format-converters.tsxcredit-note-format-converters.tsx- add the format id to the extraction-type subset union
- add the converter class
- register the converter in the converter map
libs/typescript/extraction-export/scripts/generate-metadata.ts- add the new format id to
EXPORT_FORMAT_ACCOUNTING_KEYS - point it at the existing accounting target key
- add the new format id to
2. New template that also needs a new accounting target #
If the template cannot reuse an existing accounting target, you must also add the target itself:
libs/rust/bonsai-model/src/entity.rs- add a new
AccountingTargetenum member - update
as_str() - update
FromStr
- add a new
config/csv-accounting-targets.yaml- add the target defaults and extraction-type config
config/i18n/en/webapp.json- add a label under
accountingSoftware
- add a label under
apps/webapp/src/shared/components/accounting-target-select/accounting-target-select.tsx- add the icon mapping for the new target
After that, regenerate the downstream artifacts that depend on the new target:
mise codegen
Notes #
src/export-format-metadata.tsxis generated. Do not edit it manually.- If a new target is added, the API/client enums and accounting target config are generated from the Rust enum + YAML config, not maintained by hand in generated files.
- The target label and icon are separate from the export template metadata. Reusing an existing target means you usually do not need to touch
entity.rs,csv-accounting-targets.yaml, or the accounting-target selector UI.
Key Conventions #
File Formats #
- CSV (
text/csv): Most formats export as CSV. Headers are the first row, followed by one row per line item. - Excel (
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet): Some formats (FAST, FAST Voucher, SAP, QNE, SQL Accounting, MYOB Direct Expense) export as.xlsxusing SheetJS (xlsx) throughsrc/libs/xlsx.ts. These usegetExportWithMetadatafor custom sheet layouts.
Date Formatting #
Each accounting software expects dates in specific formats. The formatDate(dateMs, format) utility wraps date-fns/format. Common patterns:
dd/MM/yyyy— Default, Xero, AutoCountMM/dd/yyyy— QBOyyyy-MM-dd— Zoho, Odoo, Sage, SAP, PEAK
Tax Calculations #
- Converters respect
InvoiceDataLineAmountType(INCLUSIVE vs EXCLUSIVE) to determine how tax is calculated - Tax amounts are extracted from enriched line items (
accounting_tax_rate) - Rounding uses the
round()utility fromutils/number.ts
Enriched Data #
Before export, invoices and bank statements are enriched with accounting data (contacts, accounts, tax rates, tags, items, locations) via enrichInvoicesWithAccountingData and enrichBankStatementsWithAccountingData in export-utils.ts. The enriched types (EnrichedInvoice, EnrichedInvoiceLineItem, etc.) extend the base API types with optional accounting fields.
Credit notes and direct expenses are enriched inline in their routes rather than through a shared helper, because each fetches a different set of accounting resources. The credit-note route resolves them in one batch from POST /internal/api/v1/credit-notes/search, which takes the selected extraction_ids and returns each credit note with its latest data snapshot and lines.
Validation #
Export utilities include validation functions (validateInvoiceForExport, validateBankStatementForExport, validateDirectExpenseForExport) that check for required fields before export.
Related Documentation #
- Webapp Documentation — Frontend that consumes this library
- API Documentation — Backend API providing the data
- Development Workflow — Branching strategy and PR process