/** * Journal activity: what each device changed and when, read from this * store's journal inbox (T13369). * * Every transaction a pull stages is an `_sync_inbox` row carrying the * writing replica, the Nexus device that signed its segment, the * transaction's HLC (its write time) and the times this store staged and * applied it. Own transactions come back through the same inbox as echoes, * so the inbox shows every device on the stream, this one included. * * A transaction its replica wrote after a server-confirmed retire is marked * `history` once applied (ยง1.5, T13366): the merge recorded no conflict for it. * * The inbox is the window: applied rows pruned after a verified checkpoint * are no longer listed. Read-only: nothing is written. * * @task T13369 * @module store/sync/activity */ import type { DatabaseSync } from 'node:sqlite'; import type { CloudJournalActivityDevice, CloudJournalActivityItem } from '@cleocode/contracts'; /** Largest page {@link journalActivity} returns. */ export declare const JOURNAL_ACTIVITY_PAGE_MAX = 200; /** Options of {@link journalActivity}. */ export interface JournalActivityOptions { /** Transactions to return (1..200, default 50). */ readonly limit?: number; /** Older page: the `nextBefore` of a previous call. */ readonly before?: string; /** Only transactions signed by this Nexus device id. */ readonly deviceId?: string; /** Only transactions written at or after this instant (ms since the epoch). */ readonly sinceMs?: number; /** Only transactions for this project id. */ readonly project?: string; /** Device names by Nexus device id (from the account's device list). */ readonly deviceNames?: ReadonlyMap; /** Last presence by Nexus device id (from the account's device list). */ readonly deviceLastSeen?: ReadonlyMap; /** This machine's stable device id (default: the persisted one). */ readonly localDeviceId?: string; } /** What {@link journalActivity} returns. */ export interface JournalActivityPage { readonly items: CloudJournalActivityItem[]; readonly devices: CloudJournalActivityDevice[]; readonly nextBefore: string | null; } /** Thrown for a `before` cursor this module did not issue. */ export declare class JournalActivityCursorError extends Error { readonly code = "E_VALIDATION"; constructor(cursor: string); } /** * List the transactions this store's journal received, newest first (by * HLC), with the device that wrote each one and a per-device summary. * * @param db - The store. * @param opts - Paging and filters. * @returns A page of transactions, the per-device summary and the next cursor. * @throws {JournalActivityCursorError} When `before` is not a cursor this module issued. */ export declare function journalActivity(db: DatabaseSync, opts?: JournalActivityOptions): JournalActivityPage; //# sourceMappingURL=activity.d.ts.map