import { $Fetch } from 'ofetch'; import { HistoryTab } from '../../common/constants/history.constant'; import { DealHistoryItem, DealsSummaryResponse, HistoryDealsQuery, HistoryListResponse, HistoryOrdersQuery, HistoryPositionsQuery, OrderHistoryItem, OrdersSummaryResponse, PositionHistoryItem, PositionSummaryResponse, AccountStatesQuery, AccountStatesResponse } from './history.type'; export interface IHistoryServiceOptions { /** The CMS `$Fetch` instance (one of `sdk.apis`). */ api: $Fetch; /** Lazy flag — when true, the service returns fake data. */ mock: () => boolean; } export interface IHistoryService { listDeals(q: HistoryDealsQuery): Promise>; listPositions(q: HistoryPositionsQuery): Promise>; listOrders(q: HistoryOrdersQuery): Promise>; dealsSummary(q: HistoryDealsQuery): Promise; positionsSummary(q: HistoryPositionsQuery): Promise; ordersSummary(q: HistoryOrdersQuery): Promise; exportCsv(tab: HistoryTab, q: HistoryDealsQuery | HistoryPositionsQuery | HistoryOrdersQuery): Promise; /** Latest MT5 account-state snapshot from ClickHouse (ADO #10515). */ accountStates(q: AccountStatesQuery): Promise; } /** * History service (read-only) — ClickHouse-direct deal/position/order reads * (`eaera_cms/history/routes.py`, doc §5.6). * * Authz is email-bound: the route resolves `Mt5Account.data.email` against * the JWT subject's `users.email`. Callers MAY additionally scope by * account via the optional `login` query param (`Mt5Account.data.login`). * Wire-level support lands with BE task #8531 (API ≥ v2.1); until then * the upstream CMS ignores the param and callers should still post-filter * on `login` client-side. * * Required params on every call: `fromTime`, `toTime` (ISO-8601 range). The * service throws on missing range — the backend would 400 anyway, and we * want a deterministic client error. * * While `mock()` returns true, every method resolves against the local fake * dataset (`./mock.ts`) and never touches `api`. */ export declare function createHistoryService(opts: IHistoryServiceOptions): IHistoryService; //# sourceMappingURL=index.d.ts.map