Merge claude/performance-2026-12-36a376: fewer queries per render, no 'use client' on the /client barrels, budgets, the doctor's performance and growth groups
Conflicts kept both sides: the doctor status (twoFactorConfirm with growth and media), its key test, e2e:built (the 2FA enrolment spec and the performance budgets), the reference index (regenerated). Reference skill copies synced (iapl-performance added, iapl-audit and iapl-reference updated). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { BasePayload, Config } from 'payload'
|
||||
|
||||
/**
|
||||
* How long each plugin log keeps its records, in days (`config.custom.iapl.retention`): written by iapl() for the
|
||||
* consent log, the statistics and — when the project sets one — form submissions. The purge reads it; the doctor's
|
||||
* `growth-retention` rule checks that the oldest record is not older (the purge runs), docs/performance.md.
|
||||
*/
|
||||
export type RetentionMap = Partial<Record<string, number>>
|
||||
|
||||
export function withRetention(config: Config, slug: string, days: number | undefined): Config {
|
||||
if (typeof days !== 'number' || !(days > 0)) {return config}
|
||||
const iapl = (config.custom?.iapl ?? {}) as { retention?: RetentionMap }
|
||||
return { ...config, custom: { ...config.custom, iapl: { ...iapl, retention: { ...iapl.retention, [slug]: days } } } }
|
||||
}
|
||||
|
||||
export function retentionOf(payload: Pick<BasePayload, 'config'>, slug: string): number | undefined {
|
||||
const days = ((payload.config?.custom as { iapl?: { retention?: RetentionMap } } | undefined)?.iapl?.retention ?? {})[slug]
|
||||
return typeof days === 'number' && days > 0 ? days : undefined
|
||||
}
|
||||
|
||||
export const retentionMap = (payload: Pick<BasePayload, 'config'>): RetentionMap =>
|
||||
({ ...((payload.config?.custom as { iapl?: { retention?: RetentionMap } } | undefined)?.iapl?.retention ?? {}) })
|
||||
Reference in New Issue
Block a user