Skip to content

Policies and Privacy

This sample trail is immutable. Comparison and filtering work, while restore actions are unavailable.

Production audit logs often need more than raw before/after values. Use ignoredColumns, sanitizeValue, getMetadata, canRestore, and immutable to align the client behavior with your business rules.

const auditHistory: AuditHistoryConfig = {
getCurrentUser: () => currentUser,
rowIdProp: 'id',
ignoredColumns: ['internalNotes'],
sanitizeValue(value, context) {
if (context.column === 'amount') {
return '[redacted]';
}
return value;
},
getMetadata() {
return {
workspaceId: currentWorkspace.id,
requestId: crypto.randomUUID(),
};
},
canRestore({ type }) {
return currentUser.role === 'admin' && type !== 'transaction';
},
};

Use action-type policy when entire classes of audit records should be included or ignored:

const auditHistory: AuditHistoryConfig = {
ignoredActionTypes: ['undo', 'redo'],
trackedActionTypes: ['cell-change', 'bulk-paste', 'approval-submitted'],
shouldTrackRecord({ type, changes, metadata }) {
if (type === 'server-validation' && metadata?.severity === 'debug') {
return false;
}
return changes.length > 0 || type === 'approval-submitted';
},
};

For compliance-style screens where the client must not mutate local audit records, set immutable: true. This disables clear, replaceRecords, and restore actions in the plugin. Server-side immutability should still be enforced by your backend.

const auditHistory: AuditHistoryConfig = {
storage: 'custom',
storageAdapter,
immutable: true,
};

See storage and providers for backend persistence and review and restore for recovery behavior.