27 lines
946 B
JavaScript
27 lines
946 B
JavaScript
/**
|
|
* @file ledgerHistoryAutomat.js
|
|
* @description Double-buffered chunk list automat (`ledgerHistoryAutomat`) for
|
|
* append-only ledger transactions and stock journal with multi-filter caching and LRU eviction.
|
|
*
|
|
* Upstream Triggers:
|
|
* - `authAutomat`: Subscribes to auth state changes — resets on `'anon'` or when
|
|
* `selectedCompanyId` changes.
|
|
* - Consumer UI: Calls `getItems()`, `requireChunk(start, end)`, `filter(search)`,
|
|
* `addSeekMonth()`, `addSeekYear()`, `resetNegativeSeek()`.
|
|
*/
|
|
|
|
import { createChunkListAutomat } from './createChunkListAutomat';
|
|
import { ledger } from '../api';
|
|
|
|
export const ledgerHistoryAutomat = createChunkListAutomat({
|
|
name: 'ledgerHistory',
|
|
chunkSize: 50,
|
|
maxLruChunks: 50,
|
|
fetchPage: (params) => ledger.getHistory(params),
|
|
});
|
|
|
|
// Alias for consistency with other grid/chunk automats
|
|
export const ledgerHistoryGridAutomat = ledgerHistoryAutomat;
|
|
|
|
export default ledgerHistoryAutomat;
|