Files
breakpilot-compliance/admin-compliance/lib/sdk/loeschfristen-baseline-catalog/helpers.ts
Sharang Parnerkar 91063f09b8 refactor(admin): split lib document generators and data catalogs into domain barrels
obligations-document, tom-document, loeschfristen-document, compliance-scope-triggers,
sdk-flow/flow-data, processing-activities, loeschfristen-baseline-catalog,
catalog-registry, dsfa mitigation-library + risk-catalog, vvt-baseline-catalog,
vendor contract-review checklists + findings, demo-data, tom-compliance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 00:07:03 +02:00

70 lines
2.3 KiB
TypeScript

/**
* Loeschfristen Baseline-Katalog — Helper Functions
*/
import type { LoeschfristPolicy } from '../loeschfristen-types'
import { createEmptyPolicy } from '../loeschfristen-types'
import type { BaselineTemplate } from './types'
import { FINANCE_LEGAL_TEMPLATES } from './finance-legal'
import { HR_TEMPLATES } from './hr'
import { IT_SECURITY_TEMPLATES } from './it-security'
import { MARKETING_CRM_TEMPLATES } from './marketing-crm'
export const BASELINE_TEMPLATES: BaselineTemplate[] = [
...HR_TEMPLATES,
...FINANCE_LEGAL_TEMPLATES,
...IT_SECURITY_TEMPLATES,
...MARKETING_CRM_TEMPLATES,
]
/**
* Erstellt eine vollstaendige LoeschfristPolicy aus einem BaselineTemplate.
*/
export function templateToPolicy(template: BaselineTemplate): LoeschfristPolicy {
const base = createEmptyPolicy()
return {
...base,
dataObjectName: template.dataObjectName,
description: template.description,
affectedGroups: [...template.affectedGroups],
dataCategories: [...template.dataCategories],
primaryPurpose: template.primaryPurpose,
deletionTrigger: template.deletionTrigger,
retentionDriver: template.retentionDriver,
retentionDriverDetail: template.retentionDriverDetail,
retentionDuration: template.retentionDuration,
retentionUnit: template.retentionUnit,
retentionDescription: template.retentionDescription,
startEvent: template.startEvent,
deletionMethod: template.deletionMethod,
deletionMethodDetail: template.deletionMethodDetail,
responsibleRole: template.responsibleRole,
reviewInterval: template.reviewInterval,
tags: [...template.tags],
}
}
/**
* Gibt alle Templates zurueck, die einen bestimmten Tag enthalten.
*/
export function getTemplatesByTag(tag: string): BaselineTemplate[] {
return BASELINE_TEMPLATES.filter(t => t.tags.includes(tag))
}
/**
* Findet ein Template anhand seiner templateId.
*/
export function getTemplateById(templateId: string): BaselineTemplate | undefined {
return BASELINE_TEMPLATES.find(t => t.templateId === templateId)
}
/**
* Gibt alle im Katalog verwendeten Tags als sortierte Liste zurueck.
*/
export function getAllTemplateTags(): string[] {
const tags = new Set<string>()
BASELINE_TEMPLATES.forEach(t => t.tags.forEach(tag => tags.add(tag)))
return Array.from(tags).sort()
}