Attach a mandatory data retention period to any model.
Records older than the policy window are purged (deleted or anonymized)
when DataRetentionPolicy.purge() is called.
Covers ~80 compliance frameworks including:
GDPR (storage limitation), SOX (7yr), MiFID II (5yr), SEC 17a-4,
FINRA, HIPAA, PIPEDA, LGPD, APPI, PDPA variants, and more.
Usage:
// Set a 7-year retention on financial records:
DataRetentionPolicy.set(FinancialRecord, {
maxAge: { years: 7 },
field: 'createdAt',
onExpiry: 'delete',
});
// Purge expired records (call from a scheduled job):
const { deleted } = await DataRetentionPolicy.purge(FinancialRecord, prorm);
// Or purge all registered models:
const report = await DataRetentionPolicy.purgeAll(prorm);
DataRetentionPolicy
Attach a mandatory data retention period to any model. Records older than the policy window are purged (deleted or anonymized) when DataRetentionPolicy.purge() is called.
Covers ~80 compliance frameworks including: GDPR (storage limitation), SOX (7yr), MiFID II (5yr), SEC 17a-4, FINRA, HIPAA, PIPEDA, LGPD, APPI, PDPA variants, and more.
Usage: // Set a 7-year retention on financial records: DataRetentionPolicy.set(FinancialRecord, { maxAge: { years: 7 }, field: 'createdAt', onExpiry: 'delete', });
// Purge expired records (call from a scheduled job): const { deleted } = await DataRetentionPolicy.purge(FinancialRecord, prorm);
// Or purge all registered models: const report = await DataRetentionPolicy.purgeAll(prorm);