@accounty/core
v2.0.3
Published
<img src="https://cdn.jsdelivr.net/npm/@accounty/core/banner.png" alt="Accounty — Many providers. One interface." />
Readme
@accounty/core
Shared accounting models, provider interfaces, rate limiters, and utilities for Accounty integrations. To connect an accounting service, install its provider package.
Installation
yarn add @accounty/coreUsage
import { FetchInvoicesState, utils } from '@accounty/core'
import type { FetchInvoicesOptions, SalesInvoice } from '@accounty/core'
const options: FetchInvoicesOptions = { state: FetchInvoicesState.Open }
const cents = utils.toCentAmount('12.34') // 1234
function outstandingAmount(invoice: SalesInvoice): number {
return invoice.centAmountOpen
}Shared API
- Types:
Company,CompanyContact,Address,SalesInvoice,SalesInvoiceWithCompany,FetchResponse, and fetch options. FetchInvoicesState:All,Open, andOverdue; support varies by provider.RevokedException: detected revoked credentials.utils: amount, country, email, language, phone, and array helpers.AccountyRateLimiter,AccountyHeaderRateLimiter, and the default abstractAccountyProviderCoreexport support custom integrations.
Fetch methods return { data, version? }; versions are provider-specific.
Invoice amounts are integer cents, dates are Date objects, and remoteData
preserves provider records. Company details may be absent when no match is found.
setCredentials() stores credentials; use testCredentials() to validate them.
