(env: Env)
| 50 | |
| 51 | /** Configured retention, clamped to something sane; falls back to the default. */ |
| 52 | export function retentionDays(env: Env): number { |
| 53 | const raw = Number(env.RETENTION_DAYS); |
| 54 | return Number.isInteger(raw) && raw >= 1 && raw <= 3650 ? raw : DEFAULT_RETENTION_DAYS; |
| 55 | } |
| 56 | |
| 57 | /** Oldest day kept: everything strictly before this is purged. */ |
| 58 | export function retentionCutoff(atMs: number, keepDays: number): string { |
no outgoing calls
no test coverage detected