UNPKG

@accounter/server

Version:
44 lines (43 loc) 2.57 kB
import DataLoader from 'dataloader'; import type { PoolClient } from 'pg'; import { TenantAwareDBClient } from '../../app-providers/tenant-db-client.js'; import type { IGetAllFinancialEntitiesResult, IInsertFinancialEntitiesParams, IUpdateFinancialEntityParams } from '../types.js'; import { BusinessesOperationProvider } from './businesses-operation.provider.js'; import { BusinessesProvider } from './businesses.provider.js'; import { TaxCategoriesProvider } from './tax-categories.provider.js'; export declare class FinancialEntitiesProvider { private db; private businessesProvider; private businessesOperationProvider; private taxCategoriesProvider; constructor(db: TenantAwareDBClient, businessesProvider: BusinessesProvider, businessesOperationProvider: BusinessesOperationProvider, taxCategoriesProvider: TaxCategoriesProvider); private batchFinancialEntitiesByIds; getFinancialEntityByIdLoader: DataLoader<string, import("../types.js").IGetFinancialEntitiesByIdsResult | undefined, string>; private allFinancialEntitiesCache; getAllFinancialEntities(): Promise<IGetAllFinancialEntitiesResult[]>; /** Returns a map of sort_code → entity ids, built once per request from the cached entity list. */ private entityBySortCodeMapCache; getEntityBySortCodeMap(): Promise<Map<number, string[]>>; updateFinancialEntity(params: IUpdateFinancialEntityParams): Promise<import("../types.js").IUpdateFinancialEntityResult[]>; insertFinancialEntity(params: IInsertFinancialEntitiesParams['financialEntities'][number], client?: PoolClient): Promise<import("../types.js").IInsertFinancialEntitiesResult[]>; private batchInsertFinancialEntities; insertFinancialEntitiesLoader: DataLoader<{ type: string | null | void; ownerId: string | null | void; name: string | null | void; sortCode: number | null | void; irsCode: number | null | void; isActive: boolean | null | void; }, import("../types.js").IInsertFinancialEntitiesResult | null, { type: string | null | void; ownerId: string | null | void; name: string | null | void; sortCode: number | null | void; irsCode: number | null | void; isActive: boolean | null | void; }>; deleteFinancialEntityById(financialEntityId: string): Promise<void>; replaceFinancialEntity(targetEntityId: string, entityIdToReplace: string, deleteEntity?: boolean): Promise<void>; invalidateFinancialEntityById(financialEntityId: string): void; clearCache(): void; }