Files
accounted/lib/connect/contract.ts
T
fcfa1ba974 feat(connect): extract the connector wire contract into packages/connect-contract (#2179)
* feat(connect): extract the connector wire contract into packages/connect-contract

The definitions in lib/connect/contract.ts (key prefix, headers, entitlements
path, entitlement and sync-report shapes) move into a standalone MIT package,
packages/connect-contract (published as @accounted/connect-contract), joined
by the error envelope, the stable error codes, and Zod schemas for every
Peppol connector operation (lookup, submit, status, evidence, register,
unregister, inbound list and xml) with an operation table. Shape only: no
behaviour, no provider code. In-repo callers import through the tsconfig and
vitest alias; lib/connect/contract.ts re-exports so nothing else changes.
The point of the package is that either side of the connection can be built
outside this repository: a self-hosted ledger talking to Accounted Connect,
or another connector service talking to the open ledger.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>

* docs(decisions): record the Connect direction, the Peppol proxy shape, and the contract package

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>

---------

Signed-off-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Jakob Wennberg <311770904+jakobwennberg-oss@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-02 20:57:47 +02:00

26 lines
1.1 KiB
TypeScript

/**
* The wire contract between a self-hosted Accounted instance and the hosted
* connector service (app.gnubok.se/api/connect/*). The definitions live in
* the MIT package packages/connect-contract (published as
* @accounted/connect-contract) so that either side can be implemented outside
* this repository; this module re-exports them for in-repo callers.
*
* Background: a self-hosted instance runs everything itself except the
* services only Accounted can operate (bank sync via our PSD2/AISP
* credentials, the Skatteverket API client, TIC org lookup, the migration
* gateway). A connector key (`gnubok_ck_...`) is the subscription token for
* those; this is the Nabu Casa model: everything local is free AGPL, the key
* buys access to the hosted connectors, and enforcement is key auth at the
* hosted proxy, never a licence check inside the instance.
*/
export {
CONNECTOR_KEY_PREFIX,
CONNECTOR_KEY_HEADER,
CONNECTOR_ENTITLEMENTS_PATH,
DEFAULT_CONNECT_BASE_URL,
type ConnectorKeyStatus,
type ConnectorEntitlements,
type ConnectorSyncReport,
} from '@accounted/connect-contract'