prorm API Reference
    Preparing search index...

    Interface RetentionDuration

    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);

    interface RetentionDuration {
        years?: number;
        months?: number;
        days?: number;
        hours?: number;
        ms?: number;
    }
    Index
    years?: number
    months?: number
    days?: number
    hours?: number
    ms?: number

    Direct millisecond override — takes precedence over the above.