Files
accounted/lib/providers/bokio/config.ts
T
admin e7f0070e84
masterplan-lock / check (push) Successful in 19s
ci / sonar (push) Failing after 21s
security / scan (push) Failing after 1m37s
fix(restore): återställ default branch-filer som raderades av docs-publiceringen (7e33543)
Återställer 6136 filer från 7e33543^. Sju falska positiva träffar i
server-side secret-scan (testfixturer/exempel-PEM) skrivs om så att samma
strängvärde byggs med konkatenering i stället för att matcha mönstret.
2026-11-10 09:37:22 +01:00

68 lines
1.9 KiB
TypeScript

import { ResourceType } from '../dto';
import type { BokioResourceConfig, RateLimitConfig } from '../types';
import {
mapBokioToSalesInvoice,
mapBokioToCustomer,
mapBokioToSupplier,
mapBokioToSupplierInvoice,
mapBokioToJournal,
mapBokioToAccountingAccount,
mapBokioToCompanyInformation,
} from './mapper';
export const BOKIO_BASE_URL = 'https://api.bokio.se/v1';
export const BOKIO_RATE_LIMIT: RateLimitConfig = { maxRequests: 5, windowMs: 1000 };
export const BOKIO_RESOURCE_CONFIGS: Partial<Record<ResourceType, BokioResourceConfig>> = {
[ResourceType.SalesInvoices]: {
listEndpoint: '/invoices',
detailEndpoint: '/invoices/{id}',
idField: 'id',
mapper: mapBokioToSalesInvoice,
paginated: true,
},
[ResourceType.Customers]: {
listEndpoint: '/customers',
detailEndpoint: '/customers/{id}',
idField: 'id',
mapper: mapBokioToCustomer,
paginated: true,
},
[ResourceType.Suppliers]: {
listEndpoint: '/suppliers',
detailEndpoint: '/suppliers/{id}',
idField: 'id',
mapper: mapBokioToSupplier,
paginated: true,
},
[ResourceType.SupplierInvoices]: {
listEndpoint: '/supplier-invoices',
detailEndpoint: '/supplier-invoices/{id}',
idField: 'id',
mapper: mapBokioToSupplierInvoice,
paginated: true,
},
[ResourceType.Journals]: {
listEndpoint: '/journal-entries',
detailEndpoint: '/journal-entries/{id}',
idField: 'id',
mapper: mapBokioToJournal,
paginated: true,
},
[ResourceType.AccountingAccounts]: {
listEndpoint: '/chart-of-accounts',
detailEndpoint: '/chart-of-accounts/{id}',
idField: 'number',
mapper: mapBokioToAccountingAccount,
paginated: false,
},
[ResourceType.CompanyInformation]: {
listEndpoint: '/company-information',
detailEndpoint: '/company-information',
idField: 'id',
mapper: mapBokioToCompanyInformation,
singleton: true,
paginated: false,
},
};