Audit History
Module Extensions
Section titled “Module Extensions”HTMLRevoGridElement (Extended from @revolist/revogrid)
Section titled “HTMLRevoGridElement (Extended from @revolist/revogrid)”interface HTMLRevoGridElement { auditHistory?: AuditHistoryConfig}AdditionalData (Extended from @revolist/revogrid)
Section titled “AdditionalData (Extended from @revolist/revogrid)”interface AdditionalData { /** * @deprecated Use the direct `grid.auditHistory` property instead. */ auditHistory?: AuditHistoryConfig}HTMLRevoGridElementEventMap (Extended from global)
Section titled “HTMLRevoGridElementEventMap (Extended from global)”interface HTMLRevoGridElementEventMap { auditrecord: AuditRecord; auditrecordsloaded: AuditRecord[]; auditerror: AuditHistoryError; beforeauditrestore: AuditRestoreEvent; auditrestore: AuditRestoreEvent}Plugin API
Section titled “Plugin API”createLocalStorageAuditHistoryAdapter
Section titled “createLocalStorageAuditHistoryAdapter”export function createLocalStorageAuditHistoryAdapter(storageKey = DEFAULT_STORAGE_KEY): AuditHistoryStorageAdapter;AuditHistoryPlugin
Section titled “AuditHistoryPlugin”Dependencies
Section titled “Dependencies”- Required
EventManagerPlugin: Requires EventManagerPlugin to receive normalized edit and paste events. - Auto-installed
HistoryPlugin: Auto-installs or reuses HistoryPlugin for undo/redo shortcuts and replay integration.
class AuditHistoryPlugin { getRecords(filter?: AuditHistoryFilter): AuditRecord[];
getCellHistory(rowId: string | number, column: ColumnProp): AuditRecord[];
getRowHistory(rowId: string | number): AuditRecord[];
getRecord(id: string): AuditRecord | undefined;
getTransaction(transactionId: string): AuditRecord[];
getLastChange(rowId: string | number, column?: ColumnProp): AuditChange | undefined;
getStats(filter?: AuditHistoryFilter): AuditHistoryStats;
getRowIdentity(row: DataType | undefined, rowIndex: number, rowType: DimensionRows): string | undefined;
clear(): boolean;
replaceRecords(records: AuditRecord[], options:;
recordEvent(input: AuditRecordEventInput): AuditRecord | undefined;
createSnapshot(label: string, options: AuditSnapshotOptions =;
restoreSnapshot(recordOrId: AuditRecord | string): boolean;
async refreshRecords(options:;
exportRecords(options: AuditHistoryExportOptions =;
canRestoreRecord(context: AuditHistoryRestoreContext): boolean;
restoreCell(change: AuditChange): boolean;
restoreRow(recordOrRowId: AuditRecord | string | number): boolean;
restoreTransaction(transactionId: string): boolean;}AuditUser
Section titled “AuditUser”export type AuditUser = { id: string; name?: string; email?: string;};BuiltInAuditActionType
Section titled “BuiltInAuditActionType”export type BuiltInAuditActionType = | 'cell-change' | 'bulk-paste' | 'row-added' | 'row-deleted' | 'row-restored' | 'undo' | 'redo' | 'restore-cell' | 'restore-row' | 'restore-transaction' | 'api-sync' | 'formula-update' | 'snapshot-created' | 'snapshot-restored';AuditActionType
Section titled “AuditActionType”export type AuditActionType = BuiltInAuditActionType | (string & {});AuditHistorySource
Section titled “AuditHistorySource”export type AuditHistorySource = | 'manual' | 'paste' | 'api' | 'formula' | 'restore' | 'snapshot' | 'system';AuditRecordPresentation
Section titled “AuditRecordPresentation”export type AuditRecordPresentation = { source?: AuditHistorySource; verb?: string; targetLabel?: string; detailLabel?: string; rangeLabel?: string; avatarLabel?: string; avatarIndex?: number; avatarColor?: string; accent?: boolean;};AuditChangePresentation
Section titled “AuditChangePresentation”export type AuditChangePresentation = { cellLabel?: string; columnLabel?: string;};AuditChange
Section titled “AuditChange”export type AuditChange = { id: string; rowId?: string; rowIndex?: number; rowType: DimensionRows; column?: ColumnProp; oldValue?: unknown; newValue?: unknown; oldRow?: DataType; newRow?: DataType; metadata?: Record<string, unknown>; presentation?: AuditChangePresentation;};AuditRecord
Section titled “AuditRecord”export type AuditRecord = { id: string; transactionId: string; type: AuditActionType; changedAt: string; changedBy: AuditUser; changes: AuditChange[]; metadata?: Record<string, unknown>; presentation?: AuditRecordPresentation;};AuditHistoryFilter
Section titled “AuditHistoryFilter”export type AuditHistoryFilter = { rowId?: string | number; column?: ColumnProp; userId?: string; userEmail?: string; actionType?: AuditActionType; transactionId?: string; dateFrom?: string | Date; dateTo?: string | Date;};AuditHistoryStorageAdapter
Section titled “AuditHistoryStorageAdapter”export type AuditHistoryStorageAdapter = { load?: () => AuditRecord[] | Promise<AuditRecord[]>; save?: (records: AuditRecord[]) => void | Promise<void>; append?: (record: AuditRecord, records: AuditRecord[]) => void | Promise<void>; clear?: () => void | Promise<void>;};AuditHistoryError
Section titled “AuditHistoryError”export type AuditHistoryError = { phase: | 'get-current-user' | 'metadata' | 'sanitize' | 'storage-load' | 'storage-save' | 'storage-append' | 'storage-clear' | 'on-record' | 'restore' | 'export' | 'replace-records' | 'record-event' | 'track-record' | 'snapshot'; error: unknown; record?: AuditRecord;};AuditHistoryRestoreContext
Section titled “AuditHistoryRestoreContext”export type AuditHistoryRestoreContext = { type: AuditRestoreType; record?: AuditRecord; change?: AuditChange; transactionId?: string;};AuditHistoryStats
Section titled “AuditHistoryStats”export type AuditHistoryStats = { totalRecords: number; totalChanges: number; firstChangedAt?: string; lastChangedAt?: string; byType: Partial<Record<AuditActionType, number>>; byUser: Record<string, number>;};AuditHistoryExportFormat
Section titled “AuditHistoryExportFormat”export type AuditHistoryExportFormat = 'json' | 'csv';AuditHistoryExportOptions
Section titled “AuditHistoryExportOptions”export type AuditHistoryExportOptions = { format?: AuditHistoryExportFormat; filter?: AuditHistoryFilter; includeMetadata?: boolean;};AuditRecordTrackContext
Section titled “AuditRecordTrackContext”export type AuditRecordTrackContext = { type: AuditActionType; changes: AuditChange[]; source?: AuditHistorySource; metadata?: Record<string, unknown>; record: AuditRecord; event?: unknown;};AuditHistoryConfig
Section titled “AuditHistoryConfig”export type AuditHistoryConfig = { getCurrentUser?: () => AuditUser; getMetadata?: (context: { type: AuditActionType; changes: AuditChange[] }) => Record<string, unknown> | undefined; rowIdProp?: string; getRowId?: ( row: DataType, context: { rowIndex: number; rowType: DimensionRows }, ) => string | number | undefined; sanitizeValue?: ( value: unknown, context: { rowId?: string; rowIndex?: number; rowType: DimensionRows; column?: ColumnProp; direction: 'old' | 'new'; }, ) => unknown; shouldTrackChange?: ( change: Omit<AuditChange, 'id'>, context: { type: AuditActionType }, ) => boolean; shouldTrackRecord?: (context: AuditRecordTrackContext) => boolean; trackedActionTypes?: AuditActionType[]; ignoredActionTypes?: AuditActionType[]; ignoredColumns?: ColumnProp[] | ((context: { column?: ColumnProp; rowType: DimensionRows; rowId?: string }) => boolean); captureSourceUpdates?: boolean; immutable?: boolean; canRestore?: (context: AuditHistoryRestoreContext) => boolean; storage?: 'memory' | 'localStorage' | 'custom'; storageKey?: string; storageAdapter?: AuditHistoryStorageAdapter; storageProviders?: AuditHistoryStorageAdapter[]; mergeStorageProviders?: boolean; records?: AuditRecord[]; maxRecords?: number; disabled?: boolean; onAuditRecord?: (record: AuditRecord) => void | Promise<void>; onAuditError?: (error: AuditHistoryError) => void; onRecordsLoaded?: (records: AuditRecord[]) => void;};AuditEventChangeInput (Extended from index.ts)
Section titled “AuditEventChangeInput (Extended from index.ts)”export type AuditEventChangeInput = Omit<AuditChange, 'id'> & { id?: string };AuditRecordEventInput
Section titled “AuditRecordEventInput”export type AuditRecordEventInput = { type: AuditActionType; changes?: AuditEventChangeInput[]; changedAt?: string; changedBy?: AuditUser; transactionId?: string; metadata?: Record<string, unknown>; presentation?: AuditRecordPresentation; allowEmpty?: boolean;};AuditSnapshotOptions
Section titled “AuditSnapshotOptions”export type AuditSnapshotOptions = { rowType?: DimensionRows; rows?: DataType[]; metadata?: Record<string, unknown>; presentation?: AuditRecordPresentation;};AuditRestoreType
Section titled “AuditRestoreType”export type AuditRestoreType = 'cell' | 'row' | 'transaction' | 'snapshot';AuditRestoreEvent
Section titled “AuditRestoreEvent”export type AuditRestoreEvent = { type: AuditRestoreType; record?: AuditRecord; change?: AuditChange; transactionId?: string;};defineAuditHistoryPanel
Section titled “defineAuditHistoryPanel”Renders the Audit History panel into el for the given RevoGrid element.
The grid must have AuditHistoryPlugin installed.
export function defineAuditHistoryPanel(el: HTMLElement, grid: HTMLRevoGridElement, options: AuditHistoryPanelOptions =;AuditHistoryPanelDateFormatContext
Section titled “AuditHistoryPanelDateFormatContext”export type AuditHistoryPanelDateFormatContext = { mode: 'time' | 'day' | 'filter'; record?: AuditRecord;};AuditHistoryPanelEvents
Section titled “AuditHistoryPanelEvents”export type AuditHistoryPanelEvents = { beforeRecordSelect?: (context: AuditHistoryPanelRecordContext) => boolean | void; beforeCompareOpen?: (context: AuditHistoryPanelRecordContext) => boolean | void; beforeJumpToCell?: (context: AuditHistoryPanelJumpContext) => boolean | void; beforeRestore?: (context: AuditHistoryPanelRestoreContext) => boolean | void; beforeExport?: (context: AuditHistoryPanelExportContext) => boolean | void;};AuditHistoryPanelExportContext
Section titled “AuditHistoryPanelExportContext”export type AuditHistoryPanelExportContext = { format: AuditHistoryExportFormat;};AuditHistoryPanelJumpContext
Section titled “AuditHistoryPanelJumpContext”export type AuditHistoryPanelJumpContext = { record: AuditRecord; change: AuditChange;};AuditHistoryPanelLabels
Section titled “AuditHistoryPanelLabels”export type AuditHistoryPanelLabels = { title: string; liveStatus: string; recordsSummary: (count: number) => string; changesSummary: (count: number) => string; allTab: string; rowTab: string; cellTab: string; tableTab: string; selectedCell: (rowId: string, column: ColumnProp) => string; selectedRow: (rowId: string) => string; export: string; exportCsv: string; exportJson: string; exportCsvTitle: string; exportJsonTitle: string; close: string; openPanel: string; searchPlaceholder: string; searchAriaLabel: string; searchShortcut: string; userPlaceholder: string; userAriaLabel: string; columnAriaLabel: string; actionAriaLabel: string; dateFromAriaLabel: string; dateToAriaLabel: string; allColumns: string; allActions: string; clearFilters: string; addFilter: string; removeFilter: (label: string) => string; noRecords: string; noComparableRecord: string; scopedRecordCount: (visibleChanges: number, totalChanges: number) => string; changedBy: (changedAt: string, user: string) => string; rowTarget: (rowId: string | undefined, column: ColumnProp | undefined) => string; cellValues: (oldValue: string, newValue: string) => string; rowSnapshotAvailable: string; rowRemoved: string; restoreCell: string; restoreRow: string; restoreTransaction: string; restoreSnapshot: string; jumpToCell: string; revertAll: string; moreActions: string; compare: string; compareTitle: string; compareBefore: string; compareAfter: string; closeCompare: string; compareEmpty: string; viewChanges: (count: number) => string; previousPage: string; nextPage: string; pageStatus: (currentPage: number, pageCount: number) => string; dayToday: string; dayYesterday: string; sourceLabels: Record<AuditHistorySource, string>; actions: Partial<Record<AuditActionType, string>>; actionVerbs: Partial<Record<AuditActionType, string>>;};AuditHistoryPanelLabelsOptions (Extended from index.ts)
Section titled “AuditHistoryPanelLabelsOptions (Extended from index.ts)”export type AuditHistoryPanelLabelsOptions = Partial<Omit<AuditHistoryPanelLabels, 'actions' | 'actionVerbs' | 'sourceLabels'>> & { actions?: Partial<Record<AuditActionType, string>>; actionVerbs?: Partial<Record<AuditActionType, string>>; sourceLabels?: Partial<Record<AuditHistorySource, string>>;};AuditHistoryPanelHandle
Section titled “AuditHistoryPanelHandle”export type AuditHistoryPanelHandle = { destroy: () => void; setPlacement: (placement: AuditHistoryPanelPlacement) => void; refresh: () => Promise<void>;};AuditHistoryPanelOptions
Section titled “AuditHistoryPanelOptions”export type AuditHistoryPanelOptions = { pageSize?: number; allowExport?: boolean; allowCompare?: boolean | ((context: AuditHistoryPanelRecordContext) => boolean); allowClose?: boolean; miniOnClose?: boolean; restoreActions?: false | AuditRestoreType[] | ((context: AuditHistoryPanelRestoreContext) => boolean); formatDate?: (value: string, context: AuditHistoryPanelDateFormatContext) => string; events?: AuditHistoryPanelEvents; placement?: AuditHistoryPanelPlacement; tooltips?: false | Partial<Record<AuditHistoryPanelTooltipKey, string | false>>; labels?: AuditHistoryPanelLabelsOptions;};AuditHistoryPanelRecordContext
Section titled “AuditHistoryPanelRecordContext”export type AuditHistoryPanelRecordContext = { record: AuditRecord; changes: AuditChange[];};AuditHistoryPanelRestoreContext
Section titled “AuditHistoryPanelRestoreContext”export type AuditHistoryPanelRestoreContext = { type: AuditRestoreType; record?: AuditRecord; change?: AuditChange; transactionId?: string;};AuditHistoryPanelPlacement
Section titled “AuditHistoryPanelPlacement”export type AuditHistoryPanelPlacement = 'right' | 'left' | 'top' | 'bottom' | 'none';AuditHistoryPanelTooltipKey
Section titled “AuditHistoryPanelTooltipKey”export type AuditHistoryPanelTooltipKey = | 'totalRecords' | 'totalChanges' | 'selectedScope' | 'searchFilter' | 'userFilter' | 'columnFilter' | 'actionFilter' | 'dateFromFilter' | 'dateToFilter' | 'clearFilters';AUDIT_HISTORY_STORAGE_KEY
Section titled “AUDIT_HISTORY_STORAGE_KEY”AUDIT_HISTORY_STORAGE_KEY: string;cloneValue
Section titled “cloneValue”export function cloneValue<T>(value: T): T;cloneChange
Section titled “cloneChange”export function cloneChange(change: AuditChange): AuditChange;cloneRecord
Section titled “cloneRecord”export function cloneRecord(record: AuditRecord): AuditRecord;normalizeRowId
Section titled “normalizeRowId”export function normalizeRowId(rowId: string | number | undefined): string | undefined;toTime
Section titled “toTime”export function toTime(value: string | Date | undefined, fallback: number);shouldIncludeRecord
Section titled “shouldIncludeRecord”export function shouldIncludeRecord(record: AuditRecord, filter?: AuditHistoryFilter);trimRecords
Section titled “trimRecords”export function trimRecords(records: AuditRecord[], maxRecords: number): AuditRecord[];mergeRecords
Section titled “mergeRecords”export function mergeRecords(current: AuditRecord[], next: AuditRecord[]): AuditRecord[];createAuditStats
Section titled “createAuditStats”export function createAuditStats(records: AuditRecord[], filter?: AuditHistoryFilter): AuditHistoryStats;stringifyExportValue
Section titled “stringifyExportValue”export function stringifyExportValue(value: unknown): string;exportAuditRecords
Section titled “exportAuditRecords”export function exportAuditRecords(records: AuditRecord[], options: AuditHistoryExportOptions =;