Fix: Remove broken getKlausurApiUrl and clean up empty lines
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 42s
CI / test-go-edu-search (push) Successful in 34s
CI / test-python-klausur (push) Failing after 2m51s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 29s
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-school (push) Successful in 42s
CI / test-go-edu-search (push) Successful in 34s
CI / test-python-klausur (push) Failing after 2m51s
CI / test-python-agent-core (push) Successful in 21s
CI / test-nodejs-website (push) Successful in 29s
sed replacement left orphaned hostname references in story page and empty lines in getApiBase functions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
46
admin-lehrer/lib/sdk/types/ai-act-obligations.ts
Normal file
46
admin-lehrer/lib/sdk/types/ai-act-obligations.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* AI Act & Obligations types
|
||||
*
|
||||
* EU AI Act classification results, obligations tracking,
|
||||
* and general regulatory obligation management.
|
||||
*/
|
||||
|
||||
import type { AIActRiskCategory } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// AI ACT
|
||||
// =============================================================================
|
||||
|
||||
export interface AIActObligation {
|
||||
id: string
|
||||
article: string
|
||||
title: string
|
||||
description: string
|
||||
deadline: Date | null
|
||||
status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED'
|
||||
}
|
||||
|
||||
export interface AIActResult {
|
||||
riskCategory: AIActRiskCategory
|
||||
systemType: string
|
||||
obligations: AIActObligation[]
|
||||
assessmentDate: Date
|
||||
assessedBy: string
|
||||
justification: string
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// GENERAL OBLIGATIONS
|
||||
// =============================================================================
|
||||
|
||||
export interface Obligation {
|
||||
id: string
|
||||
regulation: string
|
||||
article: string
|
||||
title: string
|
||||
description: string
|
||||
deadline: Date | null
|
||||
penalty: string | null
|
||||
status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED'
|
||||
responsible: string | null
|
||||
}
|
||||
39
admin-lehrer/lib/sdk/types/assessment.ts
Normal file
39
admin-lehrer/lib/sdk/types/assessment.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* Use Case Assessment types
|
||||
*
|
||||
* Structures for documenting and assessing AI use cases,
|
||||
* including step tracking and assessment results.
|
||||
*/
|
||||
|
||||
import type { RiskSeverity } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// USE CASE ASSESSMENT
|
||||
// =============================================================================
|
||||
|
||||
export interface UseCaseStep {
|
||||
id: string
|
||||
name: string
|
||||
completed: boolean
|
||||
data: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AssessmentResult {
|
||||
riskLevel: RiskSeverity
|
||||
applicableRegulations: string[]
|
||||
recommendedControls: string[]
|
||||
dsfaRequired: boolean
|
||||
aiActClassification: string
|
||||
}
|
||||
|
||||
export interface UseCaseAssessment {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
category: string
|
||||
stepsCompleted: number
|
||||
steps: UseCaseStep[]
|
||||
assessmentResult: AssessmentResult | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
55
admin-lehrer/lib/sdk/types/checkpoint.ts
Normal file
55
admin-lehrer/lib/sdk/types/checkpoint.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* Checkpoint System types
|
||||
*
|
||||
* Validation rules, checkpoint definitions, and checkpoint status
|
||||
* for the SDK's progress-gate system.
|
||||
*/
|
||||
|
||||
import type { CheckpointType, ReviewerType, ValidationSeverity } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// VALIDATION
|
||||
// =============================================================================
|
||||
|
||||
export interface ValidationRule {
|
||||
id: string
|
||||
field: string
|
||||
condition: 'NOT_EMPTY' | 'MIN_COUNT' | 'MIN_VALUE' | 'CUSTOM' | 'REGEX'
|
||||
value?: number | string
|
||||
message: string
|
||||
severity: ValidationSeverity
|
||||
}
|
||||
|
||||
export interface ValidationError {
|
||||
ruleId: string
|
||||
field: string
|
||||
message: string
|
||||
severity: ValidationSeverity
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// CHECKPOINT
|
||||
// =============================================================================
|
||||
|
||||
export interface Checkpoint {
|
||||
id: string
|
||||
step: string
|
||||
name: string
|
||||
type: CheckpointType
|
||||
validation: ValidationRule[]
|
||||
blocksProgress: boolean
|
||||
requiresReview: ReviewerType
|
||||
autoValidate: boolean
|
||||
}
|
||||
|
||||
export interface CheckpointStatus {
|
||||
checkpointId: string
|
||||
passed: boolean
|
||||
validatedAt: Date | null
|
||||
validatedBy: string | null
|
||||
errors: ValidationError[]
|
||||
warnings: ValidationError[]
|
||||
overrideReason?: string
|
||||
overriddenBy?: string
|
||||
overriddenAt?: Date
|
||||
}
|
||||
238
admin-lehrer/lib/sdk/types/company-profile.ts
Normal file
238
admin-lehrer/lib/sdk/types/company-profile.ts
Normal file
@@ -0,0 +1,238 @@
|
||||
/**
|
||||
* Company Profile types
|
||||
*
|
||||
* Business context collected before use cases: company info,
|
||||
* business model, offerings, target markets, legal form.
|
||||
*/
|
||||
|
||||
import type { SDKPackageId } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// COMPANY PROFILE ENUMS
|
||||
// =============================================================================
|
||||
|
||||
export type BusinessModel = 'B2B' | 'B2C' | 'B2B_B2C'
|
||||
|
||||
export type OfferingType =
|
||||
| 'app_mobile' // Mobile App
|
||||
| 'app_web' // Web Application
|
||||
| 'website' // Website/Landing Pages
|
||||
| 'webshop' // E-Commerce
|
||||
| 'hardware' // Hardware sales
|
||||
| 'software_saas' // SaaS/Software products
|
||||
| 'software_onpremise' // On-Premise Software
|
||||
| 'services_consulting' // Consulting/Professional Services
|
||||
| 'services_agency' // Agency Services
|
||||
| 'internal_only' // Internal applications only
|
||||
|
||||
export type TargetMarket =
|
||||
| 'germany_only' // Only Germany
|
||||
| 'dach' // Germany, Austria, Switzerland
|
||||
| 'eu' // European Union
|
||||
| 'ewr' // European Economic Area (EU + Iceland, Liechtenstein, Norway)
|
||||
| 'eu_uk' // EU + United Kingdom
|
||||
| 'worldwide' // Global operations
|
||||
|
||||
export type CompanySize = 'micro' | 'small' | 'medium' | 'large' | 'enterprise'
|
||||
|
||||
export type LegalForm =
|
||||
| 'einzelunternehmen' // Sole proprietorship
|
||||
| 'gbr' // GbR
|
||||
| 'ohg' // OHG
|
||||
| 'kg' // KG
|
||||
| 'gmbh' // GmbH
|
||||
| 'ug' // UG (haftungsbeschraenkt)
|
||||
| 'ag' // AG
|
||||
| 'gmbh_co_kg' // GmbH & Co. KG
|
||||
| 'ev' // e.V. (Verein)
|
||||
| 'stiftung' // Foundation
|
||||
| 'other' // Other
|
||||
|
||||
// =============================================================================
|
||||
// COMPANY PROFILE INTERFACE
|
||||
// =============================================================================
|
||||
|
||||
export interface CompanyProfile {
|
||||
// Basic Info
|
||||
companyName: string
|
||||
legalForm: LegalForm
|
||||
industry: string // Free text or NACE code
|
||||
foundedYear: number | null
|
||||
|
||||
// Business Model
|
||||
businessModel: BusinessModel
|
||||
offerings: OfferingType[]
|
||||
|
||||
// Size & Scope
|
||||
companySize: CompanySize
|
||||
employeeCount: string // Range: "1-9", "10-49", "50-249", "250-999", "1000+"
|
||||
annualRevenue: string // Range: "< 2 Mio", "2-10 Mio", "10-50 Mio", "> 50 Mio"
|
||||
|
||||
// Locations
|
||||
headquartersCountry: string // ISO country code, e.g., "DE"
|
||||
headquartersCity: string
|
||||
hasInternationalLocations: boolean
|
||||
internationalCountries: string[] // ISO country codes
|
||||
|
||||
// Target Markets & Legal Scope
|
||||
targetMarkets: TargetMarket[]
|
||||
primaryJurisdiction: string // Which law primarily applies: "DE", "AT", "CH", etc.
|
||||
|
||||
// Data Processing Role
|
||||
isDataController: boolean // Verantwortlicher (Art. 4 Nr. 7 DSGVO)
|
||||
isDataProcessor: boolean // Auftragsverarbeiter (Art. 4 Nr. 8 DSGVO)
|
||||
|
||||
// AI Usage
|
||||
usesAI: boolean
|
||||
aiUseCases: string[] // Brief descriptions
|
||||
|
||||
// Contact Persons
|
||||
dpoName: string | null // Data Protection Officer
|
||||
dpoEmail: string | null
|
||||
legalContactName: string | null
|
||||
legalContactEmail: string | null
|
||||
|
||||
// Completion Status
|
||||
isComplete: boolean
|
||||
completedAt: Date | null
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// COVERAGE ASSESSMENT
|
||||
// =============================================================================
|
||||
|
||||
export interface SDKCoverageAssessment {
|
||||
isFullyCovered: boolean
|
||||
coveredRegulations: string[]
|
||||
partiallyCoveredRegulations: string[]
|
||||
notCoveredRegulations: string[]
|
||||
requiresLegalCounsel: boolean
|
||||
reasons: string[]
|
||||
recommendations: string[]
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DISPLAY LABELS
|
||||
// =============================================================================
|
||||
|
||||
export const COMPANY_SIZE_LABELS: Record<CompanySize, string> = {
|
||||
micro: 'Kleinstunternehmen (< 10 MA)',
|
||||
small: 'Kleinunternehmen (10-49 MA)',
|
||||
medium: 'Mittelstand (50-249 MA)',
|
||||
large: 'Gro\u00dfunternehmen (250-999 MA)',
|
||||
enterprise: 'Konzern (1000+ MA)',
|
||||
}
|
||||
|
||||
export const BUSINESS_MODEL_LABELS: Record<BusinessModel, string> = {
|
||||
B2B: 'B2B (Gesch\u00e4ftskunden)',
|
||||
B2C: 'B2C (Privatkunden)',
|
||||
B2B_B2C: 'B2B und B2C',
|
||||
}
|
||||
|
||||
export const OFFERING_TYPE_LABELS: Record<OfferingType, { label: string; description: string }> = {
|
||||
app_mobile: { label: 'Mobile App', description: 'iOS/Android Anwendungen' },
|
||||
app_web: { label: 'Web-Anwendung', description: 'Browser-basierte Software' },
|
||||
website: { label: 'Website', description: 'Informationsseiten, Landing Pages' },
|
||||
webshop: { label: 'Online-Shop', description: 'E-Commerce, Produktverkauf' },
|
||||
hardware: { label: 'Hardware-Verkauf', description: 'Physische Produkte' },
|
||||
software_saas: { label: 'SaaS/Cloud', description: 'Software as a Service' },
|
||||
software_onpremise: { label: 'On-Premise Software', description: 'Lokale Installation' },
|
||||
services_consulting: { label: 'Beratung', description: 'Consulting, Professional Services' },
|
||||
services_agency: { label: 'Agentur', description: 'Marketing, Design, Entwicklung' },
|
||||
internal_only: { label: 'Nur intern', description: 'Interne Unternehmensanwendungen' },
|
||||
}
|
||||
|
||||
export const TARGET_MARKET_LABELS: Record<TargetMarket, { label: string; description: string; regulations: string[] }> = {
|
||||
germany_only: {
|
||||
label: 'Nur Deutschland',
|
||||
description: 'Verkauf nur in Deutschland',
|
||||
regulations: ['DSGVO', 'BDSG', 'TTDSG', 'AI Act'],
|
||||
},
|
||||
dach: {
|
||||
label: 'DACH-Region',
|
||||
description: 'Deutschland, \u00d6sterreich, Schweiz',
|
||||
regulations: ['DSGVO', 'BDSG', 'DSG (AT)', 'DSG (CH)', 'AI Act'],
|
||||
},
|
||||
eu: {
|
||||
label: 'Europ\u00e4ische Union',
|
||||
description: 'Alle EU-Mitgliedsstaaten',
|
||||
regulations: ['DSGVO', 'AI Act', 'NIS2', 'DMA/DSA'],
|
||||
},
|
||||
ewr: {
|
||||
label: 'EWR',
|
||||
description: 'EU + Island, Liechtenstein, Norwegen',
|
||||
regulations: ['DSGVO', 'AI Act', 'NIS2', 'EWR-Sonderregelungen'],
|
||||
},
|
||||
eu_uk: {
|
||||
label: 'EU + Gro\u00dfbritannien',
|
||||
description: 'EU plus Vereinigtes K\u00f6nigreich',
|
||||
regulations: ['DSGVO', 'UK GDPR', 'AI Act', 'UK AI Framework'],
|
||||
},
|
||||
worldwide: {
|
||||
label: 'Weltweit',
|
||||
description: 'Globaler Verkauf/Betrieb',
|
||||
regulations: ['DSGVO', 'CCPA', 'LGPD', 'POPIA', 'und weitere...'],
|
||||
},
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SDK PACKAGE DEFINITION
|
||||
// =============================================================================
|
||||
|
||||
export interface SDKPackage {
|
||||
id: SDKPackageId
|
||||
order: number
|
||||
name: string
|
||||
nameShort: string
|
||||
description: string
|
||||
icon: string
|
||||
result: string
|
||||
}
|
||||
|
||||
export const SDK_PACKAGES: SDKPackage[] = [
|
||||
{
|
||||
id: 'vorbereitung',
|
||||
order: 1,
|
||||
name: 'Vorbereitung',
|
||||
nameShort: 'Vorbereitung',
|
||||
description: 'Grundlagen erfassen, Ausgangssituation verstehen',
|
||||
icon: '\ud83c\udfaf',
|
||||
result: 'Klares Verst\u00e4ndnis, welche Regulierungen greifen',
|
||||
},
|
||||
{
|
||||
id: 'analyse',
|
||||
order: 2,
|
||||
name: 'Analyse',
|
||||
nameShort: 'Analyse',
|
||||
description: 'Risiken erkennen, Anforderungen ableiten',
|
||||
icon: '\ud83d\udd0d',
|
||||
result: 'Vollst\u00e4ndige Risikobewertung, Audit-Ready',
|
||||
},
|
||||
{
|
||||
id: 'dokumentation',
|
||||
order: 3,
|
||||
name: 'Dokumentation',
|
||||
nameShort: 'Doku',
|
||||
description: 'Rechtliche Pflichtnachweise erstellen',
|
||||
icon: '\ud83d\udccb',
|
||||
result: 'DSFA, TOMs, VVT, L\u00f6schkonzept',
|
||||
},
|
||||
{
|
||||
id: 'rechtliche-texte',
|
||||
order: 4,
|
||||
name: 'Rechtliche Texte',
|
||||
nameShort: 'Legal',
|
||||
description: 'Kundenf\u00e4hige Dokumente generieren',
|
||||
icon: '\ud83d\udcdd',
|
||||
result: 'AGB, DSI, Nutzungsbedingungen, Cookie-Banner (Code)',
|
||||
},
|
||||
{
|
||||
id: 'betrieb',
|
||||
order: 5,
|
||||
name: 'Betrieb',
|
||||
nameShort: 'Betrieb',
|
||||
description: 'Laufender Compliance-Betrieb',
|
||||
icon: '\u2699\ufe0f',
|
||||
result: 'DSR-Portal, Eskalationsprozesse, Vendor-Management',
|
||||
},
|
||||
]
|
||||
85
admin-lehrer/lib/sdk/types/compliance.ts
Normal file
85
admin-lehrer/lib/sdk/types/compliance.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Compliance types
|
||||
*
|
||||
* Service modules, requirements, controls, evidence,
|
||||
* and audit checklist items for compliance tracking.
|
||||
*/
|
||||
|
||||
import type {
|
||||
RiskSeverity,
|
||||
RequirementStatus,
|
||||
ControlType,
|
||||
ImplementationStatus,
|
||||
EvidenceType,
|
||||
} from './core'
|
||||
|
||||
// =============================================================================
|
||||
// SERVICE MODULES
|
||||
// =============================================================================
|
||||
|
||||
export interface ServiceModule {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
regulations: string[]
|
||||
criticality: RiskSeverity
|
||||
processesPersonalData: boolean
|
||||
hasAIComponents: boolean
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// REQUIREMENTS & CONTROLS
|
||||
// =============================================================================
|
||||
|
||||
export interface Requirement {
|
||||
id: string
|
||||
regulation: string
|
||||
article: string
|
||||
title: string
|
||||
description: string
|
||||
criticality: RiskSeverity
|
||||
applicableModules: string[]
|
||||
status: RequirementStatus
|
||||
controls: string[]
|
||||
}
|
||||
|
||||
export interface Control {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
type: ControlType
|
||||
category: string
|
||||
implementationStatus: ImplementationStatus
|
||||
effectiveness: RiskSeverity
|
||||
evidence: string[]
|
||||
owner: string | null
|
||||
dueDate: Date | null
|
||||
}
|
||||
|
||||
export interface Evidence {
|
||||
id: string
|
||||
controlId: string
|
||||
type: EvidenceType
|
||||
name: string
|
||||
description: string
|
||||
fileUrl: string | null
|
||||
validFrom: Date
|
||||
validUntil: Date | null
|
||||
uploadedBy: string
|
||||
uploadedAt: Date
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// CHECKLIST
|
||||
// =============================================================================
|
||||
|
||||
export interface ChecklistItem {
|
||||
id: string
|
||||
requirementId: string
|
||||
title: string
|
||||
description: string
|
||||
status: 'PENDING' | 'PASSED' | 'FAILED' | 'NOT_APPLICABLE'
|
||||
notes: string
|
||||
verifiedBy: string | null
|
||||
verifiedAt: Date | null
|
||||
}
|
||||
88
admin-lehrer/lib/sdk/types/core.ts
Normal file
88
admin-lehrer/lib/sdk/types/core.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* Core SDK enums and base types
|
||||
*
|
||||
* Shared enums used across multiple domains: subscription tiers,
|
||||
* phases, severity levels, status codes, and style enums.
|
||||
*/
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Subscription & Phase
|
||||
// =============================================================================
|
||||
|
||||
export type SubscriptionTier = 'FREE' | 'STARTER' | 'PROFESSIONAL' | 'ENTERPRISE'
|
||||
|
||||
export type SDKPhase = 1 | 2
|
||||
|
||||
export type SDKPackageId = 'vorbereitung' | 'analyse' | 'dokumentation' | 'rechtliche-texte' | 'betrieb'
|
||||
|
||||
export type CustomerType = 'new' | 'existing'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Checkpoint & Validation
|
||||
// =============================================================================
|
||||
|
||||
export type CheckpointType = 'REQUIRED' | 'RECOMMENDED' | 'OPTIONAL'
|
||||
|
||||
export type ReviewerType = 'NONE' | 'TEAM_LEAD' | 'DSB' | 'LEGAL'
|
||||
|
||||
export type ValidationSeverity = 'ERROR' | 'WARNING' | 'INFO'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Risk
|
||||
// =============================================================================
|
||||
|
||||
export type RiskSeverity = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL'
|
||||
|
||||
export type RiskLikelihood = 1 | 2 | 3 | 4 | 5
|
||||
|
||||
export type RiskImpact = 1 | 2 | 3 | 4 | 5
|
||||
|
||||
export type RiskStatus = 'IDENTIFIED' | 'ASSESSED' | 'MITIGATED' | 'ACCEPTED' | 'CLOSED'
|
||||
|
||||
export type MitigationType = 'AVOID' | 'TRANSFER' | 'MITIGATE' | 'ACCEPT'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Implementation & Compliance
|
||||
// =============================================================================
|
||||
|
||||
export type ImplementationStatus = 'NOT_IMPLEMENTED' | 'PARTIAL' | 'IMPLEMENTED'
|
||||
|
||||
export type RequirementStatus = 'NOT_STARTED' | 'IN_PROGRESS' | 'IMPLEMENTED' | 'VERIFIED'
|
||||
|
||||
export type ControlType = 'TECHNICAL' | 'ORGANIZATIONAL' | 'PHYSICAL'
|
||||
|
||||
export type EvidenceType = 'DOCUMENT' | 'SCREENSHOT' | 'LOG' | 'CERTIFICATE' | 'AUDIT_REPORT'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — AI Act & DSFA
|
||||
// =============================================================================
|
||||
|
||||
export type AIActRiskCategory = 'MINIMAL' | 'LIMITED' | 'HIGH' | 'UNACCEPTABLE'
|
||||
|
||||
export type DSFAStatus = 'DRAFT' | 'IN_REVIEW' | 'APPROVED' | 'REJECTED'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Screening & Security
|
||||
// =============================================================================
|
||||
|
||||
export type ScreeningStatus = 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED'
|
||||
|
||||
export type SecurityIssueSeverity = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW'
|
||||
|
||||
export type SecurityIssueStatus = 'OPEN' | 'IN_PROGRESS' | 'RESOLVED' | 'ACCEPTED'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Cookie Banner
|
||||
// =============================================================================
|
||||
|
||||
export type CookieBannerStyle = 'BANNER' | 'MODAL' | 'FLOATING'
|
||||
|
||||
export type CookieBannerPosition = 'TOP' | 'BOTTOM' | 'CENTER'
|
||||
|
||||
export type CookieBannerTheme = 'LIGHT' | 'DARK' | 'CUSTOM'
|
||||
|
||||
// =============================================================================
|
||||
// ENUMS — Command Bar
|
||||
// =============================================================================
|
||||
|
||||
export type CommandType = 'ACTION' | 'NAVIGATION' | 'SEARCH' | 'GENERATE' | 'HELP'
|
||||
339
admin-lehrer/lib/sdk/types/document-generator.ts
Normal file
339
admin-lehrer/lib/sdk/types/document-generator.ts
Normal file
@@ -0,0 +1,339 @@
|
||||
/**
|
||||
* Document Generator types (Legal Templates RAG)
|
||||
*
|
||||
* License types, template search, document generation,
|
||||
* and template ingestion for the legal document generator.
|
||||
*/
|
||||
|
||||
import type { CompanyProfile } from './company-profile'
|
||||
|
||||
// =============================================================================
|
||||
// LICENSE & TEMPLATE ENUMS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* License types for legal templates with compliance metadata
|
||||
*/
|
||||
export type LicenseType =
|
||||
| 'public_domain' // SS5 UrhG German official works
|
||||
| 'cc0' // CC0 1.0 Universal
|
||||
| 'unlicense' // Unlicense (public domain)
|
||||
| 'mit' // MIT License
|
||||
| 'cc_by_4' // CC BY 4.0 International
|
||||
| 'reuse_notice' // EU reuse notice (source required)
|
||||
|
||||
/**
|
||||
* Template types available for document generation
|
||||
*/
|
||||
export type TemplateType =
|
||||
| 'privacy_policy'
|
||||
| 'terms_of_service'
|
||||
| 'agb'
|
||||
| 'cookie_banner'
|
||||
| 'cookie_policy'
|
||||
| 'impressum'
|
||||
| 'widerruf'
|
||||
| 'dpa'
|
||||
| 'sla'
|
||||
| 'nda'
|
||||
| 'cloud_service_agreement'
|
||||
| 'data_usage_clause'
|
||||
| 'acceptable_use'
|
||||
| 'community_guidelines'
|
||||
| 'copyright_policy'
|
||||
| 'clause'
|
||||
|
||||
/**
|
||||
* Jurisdiction codes for legal documents
|
||||
*/
|
||||
export type Jurisdiction = 'DE' | 'AT' | 'CH' | 'EU' | 'US' | 'INTL'
|
||||
|
||||
// =============================================================================
|
||||
// SEARCH & RESULTS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* A single legal template search result from RAG
|
||||
*/
|
||||
export interface LegalTemplateResult {
|
||||
id: string
|
||||
score: number
|
||||
text: string
|
||||
documentTitle: string | null
|
||||
templateType: TemplateType | null
|
||||
clauseCategory: string | null
|
||||
language: 'de' | 'en'
|
||||
jurisdiction: Jurisdiction | null
|
||||
|
||||
// License information
|
||||
licenseId: LicenseType | null
|
||||
licenseName: string | null
|
||||
licenseUrl: string | null
|
||||
attributionRequired: boolean
|
||||
attributionText: string | null
|
||||
|
||||
// Source information
|
||||
sourceName: string | null
|
||||
sourceUrl: string | null
|
||||
sourceRepo: string | null
|
||||
placeholders: string[]
|
||||
|
||||
// Document characteristics
|
||||
isCompleteDocument: boolean
|
||||
isModular: boolean
|
||||
requiresCustomization: boolean
|
||||
|
||||
// Usage rights
|
||||
outputAllowed: boolean
|
||||
modificationAllowed: boolean
|
||||
distortionProhibited: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Search request for legal templates
|
||||
*/
|
||||
export interface TemplateSearchRequest {
|
||||
query: string
|
||||
templateType?: TemplateType
|
||||
licenseTypes?: LicenseType[]
|
||||
language?: 'de' | 'en'
|
||||
jurisdiction?: Jurisdiction
|
||||
attributionRequired?: boolean
|
||||
limit?: number
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DOCUMENT GENERATION
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Reference to a template used in document generation (for attribution)
|
||||
*/
|
||||
export interface TemplateReference {
|
||||
templateId: string
|
||||
sourceName: string
|
||||
sourceUrl: string
|
||||
licenseId: LicenseType
|
||||
licenseName: string
|
||||
attributionRequired: boolean
|
||||
attributionText: string | null
|
||||
usedAt: string // ISO timestamp
|
||||
}
|
||||
|
||||
/**
|
||||
* A customization applied to a generated document
|
||||
*/
|
||||
export interface DocumentCustomization {
|
||||
type: 'add_section' | 'modify_section' | 'remove_section' | 'replace_placeholder'
|
||||
section: string | null
|
||||
originalText: string | null
|
||||
newText: string | null
|
||||
reason: string | null
|
||||
appliedAt: string
|
||||
}
|
||||
|
||||
/**
|
||||
* A generated document with attribution tracking
|
||||
*/
|
||||
export interface GeneratedDocument {
|
||||
id: string
|
||||
documentType: TemplateType
|
||||
title: string
|
||||
content: string
|
||||
language: 'de' | 'en'
|
||||
jurisdiction: Jurisdiction
|
||||
|
||||
// Templates and sources used
|
||||
usedTemplates: TemplateReference[]
|
||||
|
||||
// Generated attribution footer
|
||||
attributionFooter: string
|
||||
|
||||
// Customization
|
||||
placeholderValues: Record<string, string>
|
||||
customizations: DocumentCustomization[]
|
||||
|
||||
// Metadata
|
||||
generatedAt: string
|
||||
generatedBy: string
|
||||
version: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Document generation request
|
||||
*/
|
||||
export interface DocumentGenerationRequest {
|
||||
documentType: TemplateType
|
||||
language: 'de' | 'en'
|
||||
jurisdiction: Jurisdiction
|
||||
templateIds: string[] // Selected template IDs to use
|
||||
placeholderValues: Record<string, string>
|
||||
companyProfile?: Partial<CompanyProfile> // For auto-filling placeholders
|
||||
additionalContext?: string
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DOCUMENT GENERATOR STATE
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* State for the document generator feature
|
||||
*/
|
||||
export interface DocumentGeneratorState {
|
||||
// Search state
|
||||
searchQuery: string
|
||||
searchResults: LegalTemplateResult[]
|
||||
selectedTemplates: string[] // Template IDs
|
||||
|
||||
// Current document being generated
|
||||
currentDocumentType: TemplateType | null
|
||||
currentLanguage: 'de' | 'en'
|
||||
currentJurisdiction: Jurisdiction
|
||||
|
||||
// Editor state
|
||||
editorContent: string
|
||||
editorMode: 'preview' | 'edit'
|
||||
unsavedChanges: boolean
|
||||
|
||||
// Placeholder values
|
||||
placeholderValues: Record<string, string>
|
||||
|
||||
// Generated documents history
|
||||
generatedDocuments: GeneratedDocument[]
|
||||
|
||||
// UI state
|
||||
isGenerating: boolean
|
||||
isSearching: boolean
|
||||
lastError: string | null
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// TEMPLATE SOURCES & INGESTION
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Source configuration for legal templates
|
||||
*/
|
||||
export interface TemplateSource {
|
||||
name: string
|
||||
description: string
|
||||
licenseType: LicenseType
|
||||
licenseName: string
|
||||
templateTypes: TemplateType[]
|
||||
languages: ('de' | 'en')[]
|
||||
jurisdiction: Jurisdiction
|
||||
repoUrl: string | null
|
||||
webUrl: string | null
|
||||
priority: number
|
||||
enabled: boolean
|
||||
attributionRequired: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Result of ingesting a single source
|
||||
*/
|
||||
export interface SourceIngestionResult {
|
||||
status: 'pending' | 'running' | 'completed' | 'failed'
|
||||
documentsFound: number
|
||||
chunksIndexed: number
|
||||
errors: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of template ingestion
|
||||
*/
|
||||
export interface TemplateIngestionStatus {
|
||||
running: boolean
|
||||
lastRun: string | null
|
||||
currentSource: string | null
|
||||
results: Record<string, SourceIngestionResult>
|
||||
}
|
||||
|
||||
/**
|
||||
* Statistics for the legal templates collection
|
||||
*/
|
||||
export interface TemplateCollectionStats {
|
||||
collection: string
|
||||
vectorsCount: number
|
||||
pointsCount: number
|
||||
status: string
|
||||
templateTypes: Record<TemplateType, number>
|
||||
languages: Record<string, number>
|
||||
licenses: Record<LicenseType, number>
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DISPLAY LABELS & DEFAULTS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Default placeholder values commonly used in legal documents
|
||||
*/
|
||||
export const DEFAULT_PLACEHOLDERS: Record<string, string> = {
|
||||
'[COMPANY_NAME]': '',
|
||||
'[FIRMENNAME]': '',
|
||||
'[ADDRESS]': '',
|
||||
'[ADRESSE]': '',
|
||||
'[EMAIL]': '',
|
||||
'[PHONE]': '',
|
||||
'[TELEFON]': '',
|
||||
'[WEBSITE]': '',
|
||||
'[LEGAL_REPRESENTATIVE]': '',
|
||||
'[GESCHAEFTSFUEHRER]': '',
|
||||
'[REGISTER_COURT]': '',
|
||||
'[REGISTERGERICHT]': '',
|
||||
'[REGISTER_NUMBER]': '',
|
||||
'[REGISTERNUMMER]': '',
|
||||
'[VAT_ID]': '',
|
||||
'[UST_ID]': '',
|
||||
'[DPO_NAME]': '',
|
||||
'[DSB_NAME]': '',
|
||||
'[DPO_EMAIL]': '',
|
||||
'[DSB_EMAIL]': '',
|
||||
}
|
||||
|
||||
/**
|
||||
* Template type labels for display
|
||||
*/
|
||||
export const TEMPLATE_TYPE_LABELS: Record<TemplateType, string> = {
|
||||
privacy_policy: 'Datenschutzerkl\u00e4rung',
|
||||
terms_of_service: 'Nutzungsbedingungen',
|
||||
agb: 'Allgemeine Gesch\u00e4ftsbedingungen',
|
||||
cookie_banner: 'Cookie-Banner',
|
||||
cookie_policy: 'Cookie-Richtlinie',
|
||||
impressum: 'Impressum',
|
||||
widerruf: 'Widerrufsbelehrung',
|
||||
dpa: 'Auftragsverarbeitungsvertrag',
|
||||
sla: 'Service Level Agreement',
|
||||
nda: 'Geheimhaltungsvereinbarung',
|
||||
cloud_service_agreement: 'Cloud-Dienstleistungsvertrag',
|
||||
data_usage_clause: 'Datennutzungsklausel',
|
||||
acceptable_use: 'Acceptable Use Policy',
|
||||
community_guidelines: 'Community-Richtlinien',
|
||||
copyright_policy: 'Urheberrechtsrichtlinie',
|
||||
clause: 'Vertragsklausel',
|
||||
}
|
||||
|
||||
/**
|
||||
* License type labels for display
|
||||
*/
|
||||
export const LICENSE_TYPE_LABELS: Record<LicenseType, string> = {
|
||||
public_domain: 'Public Domain (\u00a75 UrhG)',
|
||||
cc0: 'CC0 1.0 Universal',
|
||||
unlicense: 'Unlicense',
|
||||
mit: 'MIT License',
|
||||
cc_by_4: 'CC BY 4.0 International',
|
||||
reuse_notice: 'EU Reuse Notice',
|
||||
}
|
||||
|
||||
/**
|
||||
* Jurisdiction labels for display
|
||||
*/
|
||||
export const JURISDICTION_LABELS: Record<Jurisdiction, string> = {
|
||||
DE: 'Deutschland',
|
||||
AT: '\u00d6sterreich',
|
||||
CH: 'Schweiz',
|
||||
EU: 'Europ\u00e4ische Union',
|
||||
US: 'United States',
|
||||
INTL: 'International',
|
||||
}
|
||||
239
admin-lehrer/lib/sdk/types/documentation.ts
Normal file
239
admin-lehrer/lib/sdk/types/documentation.ts
Normal file
@@ -0,0 +1,239 @@
|
||||
/**
|
||||
* Documentation & Legal types
|
||||
*
|
||||
* TOMs, retention policies, VVT processing activities,
|
||||
* legal documents, cookie banner, consent/DSR,
|
||||
* imported documents, gap analysis, and escalation workflows.
|
||||
*/
|
||||
|
||||
import type {
|
||||
RiskSeverity,
|
||||
ImplementationStatus,
|
||||
CookieBannerStyle,
|
||||
CookieBannerPosition,
|
||||
CookieBannerTheme,
|
||||
SDKPackageId,
|
||||
} from './core'
|
||||
|
||||
// =============================================================================
|
||||
// TOMs & RETENTION
|
||||
// =============================================================================
|
||||
|
||||
export interface TOM {
|
||||
id: string
|
||||
category: string
|
||||
name: string
|
||||
description: string
|
||||
type: 'TECHNICAL' | 'ORGANIZATIONAL'
|
||||
implementationStatus: ImplementationStatus
|
||||
priority: RiskSeverity
|
||||
responsiblePerson: string | null
|
||||
implementationDate: Date | null
|
||||
reviewDate: Date | null
|
||||
evidence: string[]
|
||||
}
|
||||
|
||||
export interface RetentionPolicy {
|
||||
id: string
|
||||
dataCategory: string
|
||||
description: string
|
||||
legalBasis: string
|
||||
retentionPeriod: string
|
||||
deletionMethod: string
|
||||
exceptions: string[]
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// VVT (Processing Register)
|
||||
// =============================================================================
|
||||
|
||||
export interface ProcessingActivity {
|
||||
id: string
|
||||
name: string
|
||||
purpose: string
|
||||
legalBasis: string
|
||||
dataCategories: string[]
|
||||
dataSubjects: string[]
|
||||
recipients: string[]
|
||||
thirdCountryTransfers: boolean
|
||||
retentionPeriod: string
|
||||
technicalMeasures: string[]
|
||||
organizationalMeasures: string[]
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// LEGAL DOCUMENTS
|
||||
// =============================================================================
|
||||
|
||||
export interface LegalDocument {
|
||||
id: string
|
||||
type: 'AGB' | 'PRIVACY_POLICY' | 'TERMS_OF_USE' | 'IMPRINT' | 'COOKIE_POLICY'
|
||||
title: string
|
||||
content: string
|
||||
version: string
|
||||
status: 'DRAFT' | 'PUBLISHED' | 'ARCHIVED'
|
||||
publishedAt: Date | null
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// COOKIE BANNER
|
||||
// =============================================================================
|
||||
|
||||
export interface Cookie {
|
||||
id: string
|
||||
name: string
|
||||
provider: string
|
||||
purpose: string
|
||||
expiry: string
|
||||
type: 'NECESSARY' | 'FUNCTIONAL' | 'ANALYTICS' | 'MARKETING'
|
||||
}
|
||||
|
||||
export interface CookieCategory {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
required: boolean
|
||||
cookies: Cookie[]
|
||||
}
|
||||
|
||||
export interface CookieBannerTexts {
|
||||
title: string
|
||||
description: string
|
||||
acceptAll: string
|
||||
rejectAll: string
|
||||
settings: string
|
||||
save: string
|
||||
}
|
||||
|
||||
export interface CookieBannerGeneratedCode {
|
||||
html: string
|
||||
css: string
|
||||
js: string
|
||||
}
|
||||
|
||||
export interface CookieBannerConfig {
|
||||
id: string
|
||||
style: CookieBannerStyle
|
||||
position: CookieBannerPosition
|
||||
theme: CookieBannerTheme
|
||||
texts: CookieBannerTexts
|
||||
categories: CookieCategory[]
|
||||
generatedCode: CookieBannerGeneratedCode | null
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// CONSENT & DSR
|
||||
// =============================================================================
|
||||
|
||||
export interface ConsentRecord {
|
||||
id: string
|
||||
userId: string
|
||||
documentId: string
|
||||
documentVersion: string
|
||||
consentType: string
|
||||
granted: boolean
|
||||
grantedAt: Date
|
||||
revokedAt: Date | null
|
||||
ipAddress: string | null
|
||||
userAgent: string | null
|
||||
}
|
||||
|
||||
export interface DSRRequest {
|
||||
id: string
|
||||
type: 'ACCESS' | 'RECTIFICATION' | 'ERASURE' | 'PORTABILITY' | 'RESTRICTION' | 'OBJECTION'
|
||||
status: 'RECEIVED' | 'VERIFIED' | 'PROCESSING' | 'COMPLETED' | 'REJECTED'
|
||||
requesterEmail: string
|
||||
requesterName: string
|
||||
requestedAt: Date
|
||||
dueDate: Date
|
||||
completedAt: Date | null
|
||||
notes: string
|
||||
}
|
||||
|
||||
export interface DSRConfig {
|
||||
id: string
|
||||
enabled: boolean
|
||||
portalUrl: string
|
||||
emailTemplates: Record<string, string>
|
||||
automatedResponses: boolean
|
||||
verificationRequired: boolean
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// IMPORTED DOCUMENTS (fuer Bestandskunden)
|
||||
// =============================================================================
|
||||
|
||||
export type ImportedDocumentType =
|
||||
| 'DSFA'
|
||||
| 'TOM'
|
||||
| 'VVT'
|
||||
| 'AGB'
|
||||
| 'PRIVACY_POLICY'
|
||||
| 'COOKIE_POLICY'
|
||||
| 'RISK_ASSESSMENT'
|
||||
| 'AUDIT_REPORT'
|
||||
| 'OTHER'
|
||||
|
||||
export interface ImportedDocument {
|
||||
id: string
|
||||
name: string
|
||||
type: ImportedDocumentType
|
||||
fileUrl: string
|
||||
uploadedAt: Date
|
||||
analyzedAt: Date | null
|
||||
analysisResult: DocumentAnalysisResult | null
|
||||
}
|
||||
|
||||
export interface DocumentAnalysisResult {
|
||||
detectedType: ImportedDocumentType
|
||||
confidence: number
|
||||
extractedEntities: string[]
|
||||
gaps: GapItem[]
|
||||
recommendations: string[]
|
||||
}
|
||||
|
||||
export interface GapItem {
|
||||
id: string
|
||||
category: string
|
||||
description: string
|
||||
severity: RiskSeverity
|
||||
regulation: string
|
||||
requiredAction: string
|
||||
relatedStepId: string | null
|
||||
}
|
||||
|
||||
export interface GapAnalysis {
|
||||
id: string
|
||||
createdAt: Date
|
||||
totalGaps: number
|
||||
criticalGaps: number
|
||||
highGaps: number
|
||||
mediumGaps: number
|
||||
lowGaps: number
|
||||
gaps: GapItem[]
|
||||
recommendedPackages: SDKPackageId[]
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// ESCALATIONS
|
||||
// =============================================================================
|
||||
|
||||
export interface EscalationWorkflow {
|
||||
id: string
|
||||
name: string
|
||||
description: string
|
||||
triggerConditions: string[]
|
||||
steps: EscalationStep[]
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface EscalationStep {
|
||||
id: string
|
||||
order: number
|
||||
action: string
|
||||
assignee: string
|
||||
timeLimit: string // ISO 8601 Duration
|
||||
escalateOnTimeout: boolean
|
||||
}
|
||||
263
admin-lehrer/lib/sdk/types/dsfa-rag.ts
Normal file
263
admin-lehrer/lib/sdk/types/dsfa-rag.ts
Normal file
@@ -0,0 +1,263 @@
|
||||
/**
|
||||
* DSFA RAG types (Source Attribution & Corpus Management)
|
||||
*
|
||||
* Types for the DSFA (Data Protection Impact Assessment) RAG pipeline:
|
||||
* source documents, chunks, search results, corpus statistics,
|
||||
* and ingestion management.
|
||||
*/
|
||||
|
||||
// =============================================================================
|
||||
// DSFA ENUMS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* License codes for DSFA source documents
|
||||
*/
|
||||
export type DSFALicenseCode =
|
||||
| 'DL-DE-BY-2.0' // Datenlizenz Deutschland -- Namensnennung
|
||||
| 'DL-DE-ZERO-2.0' // Datenlizenz Deutschland -- Zero
|
||||
| 'CC-BY-4.0' // Creative Commons Attribution 4.0
|
||||
| 'EDPB-LICENSE' // EDPB Document License
|
||||
| 'PUBLIC_DOMAIN' // Public Domain
|
||||
| 'PROPRIETARY' // Internal/Proprietary
|
||||
|
||||
/**
|
||||
* Document types in the DSFA corpus
|
||||
*/
|
||||
export type DSFADocumentType = 'guideline' | 'checklist' | 'regulation' | 'template'
|
||||
|
||||
/**
|
||||
* Category for DSFA chunks (for filtering)
|
||||
*/
|
||||
export type DSFACategory =
|
||||
| 'threshold_analysis'
|
||||
| 'risk_assessment'
|
||||
| 'mitigation'
|
||||
| 'consultation'
|
||||
| 'documentation'
|
||||
| 'process'
|
||||
| 'criteria'
|
||||
|
||||
// =============================================================================
|
||||
// DSFA SOURCE & DOCUMENTS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* DSFA source registry entry
|
||||
*/
|
||||
export interface DSFASource {
|
||||
id: string
|
||||
sourceCode: string
|
||||
name: string
|
||||
fullName?: string
|
||||
organization?: string
|
||||
sourceUrl?: string
|
||||
eurLexCelex?: string
|
||||
licenseCode: DSFALicenseCode
|
||||
licenseName: string
|
||||
licenseUrl?: string
|
||||
attributionRequired: boolean
|
||||
attributionText: string
|
||||
documentType?: DSFADocumentType
|
||||
language: string
|
||||
}
|
||||
|
||||
/**
|
||||
* DSFA document entry
|
||||
*/
|
||||
export interface DSFADocument {
|
||||
id: string
|
||||
sourceId: string
|
||||
title: string
|
||||
description?: string
|
||||
fileName?: string
|
||||
fileType?: string
|
||||
fileSizeBytes?: number
|
||||
minioBucket: string
|
||||
minioPath?: string
|
||||
originalUrl?: string
|
||||
ocrProcessed: boolean
|
||||
textExtracted: boolean
|
||||
chunksGenerated: number
|
||||
lastIndexedAt?: string
|
||||
metadata: Record<string, unknown>
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DSFA CHUNKS & SEARCH
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* DSFA chunk with full attribution
|
||||
*/
|
||||
export interface DSFAChunk {
|
||||
chunkId: string
|
||||
content: string
|
||||
sectionTitle?: string
|
||||
pageNumber?: number
|
||||
category?: DSFACategory
|
||||
documentId: string
|
||||
documentTitle?: string
|
||||
sourceId: string
|
||||
sourceCode: string
|
||||
sourceName: string
|
||||
attributionText: string
|
||||
licenseCode: DSFALicenseCode
|
||||
licenseName: string
|
||||
licenseUrl?: string
|
||||
attributionRequired: boolean
|
||||
sourceUrl?: string
|
||||
documentType?: DSFADocumentType
|
||||
}
|
||||
|
||||
/**
|
||||
* DSFA search result with score and attribution
|
||||
*/
|
||||
export interface DSFASearchResult {
|
||||
chunkId: string
|
||||
content: string
|
||||
score: number
|
||||
sourceCode: string
|
||||
sourceName: string
|
||||
attributionText: string
|
||||
licenseCode: DSFALicenseCode
|
||||
licenseName: string
|
||||
licenseUrl?: string
|
||||
attributionRequired: boolean
|
||||
sourceUrl?: string
|
||||
documentType?: DSFADocumentType
|
||||
category?: DSFACategory
|
||||
sectionTitle?: string
|
||||
pageNumber?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* DSFA search response with aggregated attribution
|
||||
*/
|
||||
export interface DSFASearchResponse {
|
||||
query: string
|
||||
results: DSFASearchResult[]
|
||||
totalResults: number
|
||||
licensesUsed: string[]
|
||||
attributionNotice: string
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DSFA STATISTICS & INGESTION
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Source statistics for dashboard
|
||||
*/
|
||||
export interface DSFASourceStats {
|
||||
sourceId: string
|
||||
sourceCode: string
|
||||
name: string
|
||||
organization?: string
|
||||
licenseCode: DSFALicenseCode
|
||||
documentType?: DSFADocumentType
|
||||
documentCount: number
|
||||
chunkCount: number
|
||||
lastIndexedAt?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Corpus statistics for dashboard
|
||||
*/
|
||||
export interface DSFACorpusStats {
|
||||
sources: DSFASourceStats[]
|
||||
totalSources: number
|
||||
totalDocuments: number
|
||||
totalChunks: number
|
||||
qdrantCollection: string
|
||||
qdrantPointsCount: number
|
||||
qdrantStatus: string
|
||||
}
|
||||
|
||||
/**
|
||||
* License information
|
||||
*/
|
||||
export interface DSFALicenseInfo {
|
||||
code: DSFALicenseCode
|
||||
name: string
|
||||
url?: string
|
||||
attributionRequired: boolean
|
||||
modificationAllowed: boolean
|
||||
commercialUse: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* Ingestion request for DSFA documents
|
||||
*/
|
||||
export interface DSFAIngestRequest {
|
||||
documentUrl?: string
|
||||
documentText?: string
|
||||
title?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Ingestion response
|
||||
*/
|
||||
export interface DSFAIngestResponse {
|
||||
sourceCode: string
|
||||
documentId?: string
|
||||
chunksCreated: number
|
||||
message: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Props for SourceAttribution component
|
||||
*/
|
||||
export interface SourceAttributionProps {
|
||||
sources: Array<{
|
||||
sourceCode: string
|
||||
sourceName: string
|
||||
attributionText: string
|
||||
licenseCode: DSFALicenseCode
|
||||
sourceUrl?: string
|
||||
score?: number
|
||||
}>
|
||||
compact?: boolean
|
||||
showScores?: boolean
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// DISPLAY LABELS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* License code display labels
|
||||
*/
|
||||
export const DSFA_LICENSE_LABELS: Record<DSFALicenseCode, string> = {
|
||||
'DL-DE-BY-2.0': 'Datenlizenz DE \u2013 Namensnennung 2.0',
|
||||
'DL-DE-ZERO-2.0': 'Datenlizenz DE \u2013 Zero 2.0',
|
||||
'CC-BY-4.0': 'CC BY 4.0 International',
|
||||
'EDPB-LICENSE': 'EDPB Document License',
|
||||
'PUBLIC_DOMAIN': 'Public Domain',
|
||||
'PROPRIETARY': 'Proprietary',
|
||||
}
|
||||
|
||||
/**
|
||||
* Document type display labels
|
||||
*/
|
||||
export const DSFA_DOCUMENT_TYPE_LABELS: Record<DSFADocumentType, string> = {
|
||||
guideline: 'Leitlinie',
|
||||
checklist: 'Pr\u00fcfliste',
|
||||
regulation: 'Verordnung',
|
||||
template: 'Vorlage',
|
||||
}
|
||||
|
||||
/**
|
||||
* Category display labels
|
||||
*/
|
||||
export const DSFA_CATEGORY_LABELS: Record<DSFACategory, string> = {
|
||||
threshold_analysis: 'Schwellwertanalyse',
|
||||
risk_assessment: 'Risikobewertung',
|
||||
mitigation: 'Risikominderung',
|
||||
consultation: 'Beh\u00f6rdenkonsultation',
|
||||
documentation: 'Dokumentation',
|
||||
process: 'Prozessschritte',
|
||||
criteria: 'Kriterien',
|
||||
}
|
||||
39
admin-lehrer/lib/sdk/types/dsfa.ts
Normal file
39
admin-lehrer/lib/sdk/types/dsfa.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* DSFA (Datenschutz-Folgenabschaetzung) types
|
||||
*
|
||||
* Data Protection Impact Assessment sections,
|
||||
* approval workflow, and document structure.
|
||||
*/
|
||||
|
||||
import type { DSFAStatus } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// DSFA
|
||||
// =============================================================================
|
||||
|
||||
export interface DSFASection {
|
||||
id: string
|
||||
title: string
|
||||
content: string
|
||||
status: 'DRAFT' | 'COMPLETED'
|
||||
order: number
|
||||
}
|
||||
|
||||
export interface DSFAApproval {
|
||||
id: string
|
||||
approver: string
|
||||
role: string
|
||||
status: 'PENDING' | 'APPROVED' | 'REJECTED'
|
||||
comment: string | null
|
||||
approvedAt: Date | null
|
||||
}
|
||||
|
||||
export interface DSFA {
|
||||
id: string
|
||||
status: DSFAStatus
|
||||
version: number
|
||||
sections: DSFASection[]
|
||||
approvals: DSFAApproval[]
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
}
|
||||
187
admin-lehrer/lib/sdk/types/helpers.ts
Normal file
187
admin-lehrer/lib/sdk/types/helpers.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
/**
|
||||
* SDK Helper Functions
|
||||
*
|
||||
* Navigation helpers, risk calculation, completion tracking,
|
||||
* and package management utilities.
|
||||
*/
|
||||
|
||||
import type { SDKPhase, SDKPackageId, RiskLikelihood, RiskImpact, RiskSeverity, CustomerType } from './core'
|
||||
import type { SDKStep, SDK_STEPS } from './sdk-flow'
|
||||
import type { SDKPackage, SDK_PACKAGES } from './company-profile'
|
||||
import type { Risk } from './risk'
|
||||
import type { SDKState } from './state'
|
||||
|
||||
// Re-import values (not just types) for runtime use
|
||||
// We need the actual arrays, not just the types
|
||||
import { SDK_STEPS as STEPS } from './sdk-flow'
|
||||
import { SDK_PACKAGES as PACKAGES } from './company-profile'
|
||||
|
||||
// =============================================================================
|
||||
// STEP NAVIGATION
|
||||
// =============================================================================
|
||||
|
||||
export function getStepById(stepId: string): SDKStep | undefined {
|
||||
return STEPS.find(s => s.id === stepId)
|
||||
}
|
||||
|
||||
export function getStepByUrl(url: string): SDKStep | undefined {
|
||||
return STEPS.find(s => s.url === url)
|
||||
}
|
||||
|
||||
export function getStepsForPhase(phase: SDKPhase): SDKStep[] {
|
||||
return STEPS.filter(s => s.phase === phase).sort((a, b) => a.order - b.order)
|
||||
}
|
||||
|
||||
export function getNextStep(currentStepId: string): SDKStep | undefined {
|
||||
const currentStep = getStepById(currentStepId)
|
||||
if (!currentStep) return undefined
|
||||
|
||||
const stepsInPhase = getStepsForPhase(currentStep.phase)
|
||||
const currentIndex = stepsInPhase.findIndex(s => s.id === currentStepId)
|
||||
|
||||
if (currentIndex < stepsInPhase.length - 1) {
|
||||
return stepsInPhase[currentIndex + 1]
|
||||
}
|
||||
|
||||
// Move to next phase
|
||||
if (currentStep.phase === 1) {
|
||||
return getStepsForPhase(2)[0]
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function getPreviousStep(currentStepId: string): SDKStep | undefined {
|
||||
const currentStep = getStepById(currentStepId)
|
||||
if (!currentStep) return undefined
|
||||
|
||||
const stepsInPhase = getStepsForPhase(currentStep.phase)
|
||||
const currentIndex = stepsInPhase.findIndex(s => s.id === currentStepId)
|
||||
|
||||
if (currentIndex > 0) {
|
||||
return stepsInPhase[currentIndex - 1]
|
||||
}
|
||||
|
||||
// Move to previous phase
|
||||
if (currentStep.phase === 2) {
|
||||
const phase1Steps = getStepsForPhase(1)
|
||||
return phase1Steps[phase1Steps.length - 1]
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// RISK CALCULATION
|
||||
// =============================================================================
|
||||
|
||||
export function calculateRiskScore(likelihood: RiskLikelihood, impact: RiskImpact): number {
|
||||
return likelihood * impact
|
||||
}
|
||||
|
||||
export function getRiskSeverityFromScore(score: number): RiskSeverity {
|
||||
if (score >= 20) return 'CRITICAL'
|
||||
if (score >= 12) return 'HIGH'
|
||||
if (score >= 6) return 'MEDIUM'
|
||||
return 'LOW'
|
||||
}
|
||||
|
||||
export function calculateResidualRisk(risk: Risk): number {
|
||||
const inherentScore = calculateRiskScore(risk.likelihood, risk.impact)
|
||||
const totalEffectiveness = risk.mitigation
|
||||
.filter(m => m.status === 'COMPLETED')
|
||||
.reduce((sum, m) => sum + m.effectiveness, 0)
|
||||
|
||||
const effectivenessMultiplier = Math.min(totalEffectiveness, 100) / 100
|
||||
return Math.max(1, Math.round(inherentScore * (1 - effectivenessMultiplier)))
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// COMPLETION TRACKING
|
||||
// =============================================================================
|
||||
|
||||
export function getCompletionPercentage(state: SDKState): number {
|
||||
const totalSteps = STEPS.length
|
||||
const completedSteps = state.completedSteps.length
|
||||
return Math.round((completedSteps / totalSteps) * 100)
|
||||
}
|
||||
|
||||
export function getPhaseCompletionPercentage(state: SDKState, phase: SDKPhase): number {
|
||||
const phaseSteps = getStepsForPhase(phase)
|
||||
const completedPhaseSteps = phaseSteps.filter(s => state.completedSteps.includes(s.id))
|
||||
return Math.round((completedPhaseSteps.length / phaseSteps.length) * 100)
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// PACKAGE HELPERS
|
||||
// =============================================================================
|
||||
|
||||
export function getPackageById(packageId: SDKPackageId): SDKPackage | undefined {
|
||||
return PACKAGES.find(p => p.id === packageId)
|
||||
}
|
||||
|
||||
export function getStepsForPackage(packageId: SDKPackageId): SDKStep[] {
|
||||
return STEPS.filter(s => s.package === packageId).sort((a, b) => a.order - b.order)
|
||||
}
|
||||
|
||||
export function getPackageCompletionPercentage(state: SDKState, packageId: SDKPackageId): number {
|
||||
const packageSteps = getStepsForPackage(packageId)
|
||||
if (packageSteps.length === 0) return 0
|
||||
const completedPackageSteps = packageSteps.filter(s => state.completedSteps.includes(s.id))
|
||||
return Math.round((completedPackageSteps.length / packageSteps.length) * 100)
|
||||
}
|
||||
|
||||
export function getCurrentPackage(currentStepId: string): SDKPackage | undefined {
|
||||
const step = getStepById(currentStepId)
|
||||
if (!step) return undefined
|
||||
return getPackageById(step.package)
|
||||
}
|
||||
|
||||
export function getNextPackageStep(currentStepId: string): SDKStep | undefined {
|
||||
const currentStep = getStepById(currentStepId)
|
||||
if (!currentStep) return undefined
|
||||
|
||||
const packageSteps = getStepsForPackage(currentStep.package)
|
||||
const currentIndex = packageSteps.findIndex(s => s.id === currentStepId)
|
||||
|
||||
// Next step in same package
|
||||
if (currentIndex < packageSteps.length - 1) {
|
||||
return packageSteps[currentIndex + 1]
|
||||
}
|
||||
|
||||
// Move to next package
|
||||
const currentPackage = getPackageById(currentStep.package)
|
||||
if (!currentPackage) return undefined
|
||||
|
||||
const nextPackage = PACKAGES.find(p => p.order === currentPackage.order + 1)
|
||||
if (!nextPackage) return undefined
|
||||
|
||||
const nextPackageSteps = getStepsForPackage(nextPackage.id)
|
||||
return nextPackageSteps[0]
|
||||
}
|
||||
|
||||
export function isPackageUnlocked(state: SDKState, packageId: SDKPackageId): boolean {
|
||||
if (state.preferences?.allowParallelWork) return true
|
||||
|
||||
const currentPackage = getPackageById(packageId)
|
||||
if (!currentPackage) return false
|
||||
|
||||
// First package is always unlocked
|
||||
if (currentPackage.order === 1) return true
|
||||
|
||||
// Previous package must be completed
|
||||
const prevPackage = PACKAGES.find(p => p.order === currentPackage.order - 1)
|
||||
if (!prevPackage) return true
|
||||
|
||||
return getPackageCompletionPercentage(state, prevPackage.id) === 100
|
||||
}
|
||||
|
||||
export function getVisibleStepsForCustomerType(customerType: CustomerType): SDKStep[] {
|
||||
return STEPS.filter(step => {
|
||||
// Import step is only for existing customers
|
||||
if (step.id === 'import') {
|
||||
return customerType === 'existing'
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
22
admin-lehrer/lib/sdk/types/index.ts
Normal file
22
admin-lehrer/lib/sdk/types/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* SDK Types — Barrel Export
|
||||
*
|
||||
* Re-exports all domain-specific type modules so consumers
|
||||
* can import from `@/lib/sdk/types` or `./types` as before.
|
||||
*/
|
||||
|
||||
export * from './core'
|
||||
export * from './company-profile'
|
||||
export * from './sdk-flow'
|
||||
export * from './checkpoint'
|
||||
export * from './assessment'
|
||||
export * from './screening-security'
|
||||
export * from './compliance'
|
||||
export * from './risk'
|
||||
export * from './ai-act-obligations'
|
||||
export * from './dsfa'
|
||||
export * from './documentation'
|
||||
export * from './state'
|
||||
export * from './helpers'
|
||||
export * from './document-generator'
|
||||
export * from './dsfa-rag'
|
||||
42
admin-lehrer/lib/sdk/types/risk.ts
Normal file
42
admin-lehrer/lib/sdk/types/risk.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Risk Management types
|
||||
*
|
||||
* Risk assessment, mitigation tracking, and residual risk
|
||||
* calculation structures.
|
||||
*/
|
||||
|
||||
import type { RiskLikelihood, RiskImpact, RiskSeverity, RiskStatus, MitigationType } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// RISK MITIGATION
|
||||
// =============================================================================
|
||||
|
||||
export interface RiskMitigation {
|
||||
id: string
|
||||
description: string
|
||||
type: MitigationType
|
||||
status: 'PLANNED' | 'IN_PROGRESS' | 'COMPLETED'
|
||||
effectiveness: number // 0-100
|
||||
controlId: string | null
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// RISK
|
||||
// =============================================================================
|
||||
|
||||
export interface Risk {
|
||||
id: string
|
||||
title: string
|
||||
description: string
|
||||
category: string
|
||||
likelihood: RiskLikelihood
|
||||
impact: RiskImpact
|
||||
severity: RiskSeverity
|
||||
inherentRiskScore: number
|
||||
residualRiskScore: number
|
||||
status: RiskStatus
|
||||
mitigation: RiskMitigation[]
|
||||
owner: string | null
|
||||
relatedControls: string[]
|
||||
relatedRequirements: string[]
|
||||
}
|
||||
99
admin-lehrer/lib/sdk/types/screening-security.ts
Normal file
99
admin-lehrer/lib/sdk/types/screening-security.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Screening & Security types
|
||||
*
|
||||
* SBOM analysis, vulnerability scanning, security issues,
|
||||
* and backlog tracking for the screening pipeline.
|
||||
*/
|
||||
|
||||
import type { ScreeningStatus, SecurityIssueSeverity, SecurityIssueStatus } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// SBOM
|
||||
// =============================================================================
|
||||
|
||||
export interface Vulnerability {
|
||||
id: string
|
||||
cve: string
|
||||
severity: SecurityIssueSeverity
|
||||
title: string
|
||||
description: string
|
||||
cvss: number | null
|
||||
fixedIn: string | null
|
||||
}
|
||||
|
||||
export interface SBOMComponent {
|
||||
name: string
|
||||
version: string
|
||||
type: 'library' | 'framework' | 'application' | 'container'
|
||||
purl: string
|
||||
licenses: string[]
|
||||
vulnerabilities: Vulnerability[]
|
||||
}
|
||||
|
||||
export interface SBOMDependency {
|
||||
from: string
|
||||
to: string
|
||||
}
|
||||
|
||||
export interface SBOM {
|
||||
format: 'CycloneDX' | 'SPDX'
|
||||
version: string
|
||||
components: SBOMComponent[]
|
||||
dependencies: SBOMDependency[]
|
||||
generatedAt: Date
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SECURITY SCAN
|
||||
// =============================================================================
|
||||
|
||||
export interface SecurityScanResult {
|
||||
totalIssues: number
|
||||
critical: number
|
||||
high: number
|
||||
medium: number
|
||||
low: number
|
||||
issues: SecurityIssue[]
|
||||
}
|
||||
|
||||
export interface SecurityIssue {
|
||||
id: string
|
||||
severity: SecurityIssueSeverity
|
||||
title: string
|
||||
description: string
|
||||
cve: string | null
|
||||
cvss: number | null
|
||||
affectedComponent: string
|
||||
remediation: string
|
||||
status: SecurityIssueStatus
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SCREENING RESULT
|
||||
// =============================================================================
|
||||
|
||||
export interface ScreeningResult {
|
||||
id: string
|
||||
status: ScreeningStatus
|
||||
startedAt: Date
|
||||
completedAt: Date | null
|
||||
sbom: SBOM | null
|
||||
securityScan: SecurityScanResult | null
|
||||
error: string | null
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// BACKLOG
|
||||
// =============================================================================
|
||||
|
||||
export interface BacklogItem {
|
||||
id: string
|
||||
title: string
|
||||
description: string
|
||||
severity: SecurityIssueSeverity
|
||||
securityIssueId: string
|
||||
status: 'OPEN' | 'IN_PROGRESS' | 'DONE'
|
||||
assignee: string | null
|
||||
dueDate: Date | null
|
||||
createdAt: Date
|
||||
}
|
||||
429
admin-lehrer/lib/sdk/types/sdk-flow.ts
Normal file
429
admin-lehrer/lib/sdk/types/sdk-flow.ts
Normal file
@@ -0,0 +1,429 @@
|
||||
/**
|
||||
* SDK Flow & Navigation
|
||||
*
|
||||
* Step definitions, step ordering, and the SDK_STEPS constant
|
||||
* that drives the entire compliance workflow.
|
||||
*/
|
||||
|
||||
import type { SDKPhase, SDKPackageId } from './core'
|
||||
|
||||
// =============================================================================
|
||||
// SDK STEP
|
||||
// =============================================================================
|
||||
|
||||
export interface SDKStep {
|
||||
id: string
|
||||
phase: SDKPhase
|
||||
package: SDKPackageId
|
||||
order: number
|
||||
name: string
|
||||
nameShort: string
|
||||
description: string
|
||||
url: string
|
||||
checkpointId: string
|
||||
prerequisiteSteps: string[]
|
||||
isOptional: boolean
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SDK_STEPS — All steps in order
|
||||
// =============================================================================
|
||||
|
||||
export const SDK_STEPS: SDKStep[] = [
|
||||
// =============================================================================
|
||||
// PAKET 1: VORBEREITUNG (Foundation)
|
||||
// =============================================================================
|
||||
{
|
||||
id: 'company-profile',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 1,
|
||||
name: 'Unternehmensprofil',
|
||||
nameShort: 'Profil',
|
||||
description: 'Gesch\u00e4ftsmodell, Gr\u00f6\u00dfe und Zielm\u00e4rkte erfassen',
|
||||
url: '/sdk/company-profile',
|
||||
checkpointId: 'CP-PROF',
|
||||
prerequisiteSteps: [],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'compliance-scope',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 2,
|
||||
name: 'Compliance Scope',
|
||||
nameShort: 'Scope',
|
||||
description: 'Umfang und Tiefe Ihrer Compliance-Dokumentation bestimmen',
|
||||
url: '/sdk/compliance-scope',
|
||||
checkpointId: 'CP-SCOPE',
|
||||
prerequisiteSteps: ['company-profile'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'use-case-assessment',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 3,
|
||||
name: 'Anwendungsfall-Erfassung',
|
||||
nameShort: 'Anwendung',
|
||||
description: 'AI-Anwendungsf\u00e4lle strukturiert dokumentieren',
|
||||
url: '/sdk/advisory-board',
|
||||
checkpointId: 'CP-UC',
|
||||
prerequisiteSteps: ['company-profile'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'import',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 4,
|
||||
name: 'Dokument-Import',
|
||||
nameShort: 'Import',
|
||||
description: 'Bestehende Dokumente hochladen (Bestandskunden)',
|
||||
url: '/sdk/import',
|
||||
checkpointId: 'CP-IMP',
|
||||
prerequisiteSteps: ['use-case-assessment'],
|
||||
isOptional: true, // Nur fuer Bestandskunden
|
||||
},
|
||||
{
|
||||
id: 'screening',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 5,
|
||||
name: 'System Screening',
|
||||
nameShort: 'Screening',
|
||||
description: 'SBOM + Security Check',
|
||||
url: '/sdk/screening',
|
||||
checkpointId: 'CP-SCAN',
|
||||
prerequisiteSteps: ['use-case-assessment'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'modules',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 6,
|
||||
name: 'Compliance Modules',
|
||||
nameShort: 'Module',
|
||||
description: 'Abgleich welche Regulierungen gelten',
|
||||
url: '/sdk/modules',
|
||||
checkpointId: 'CP-MOD',
|
||||
prerequisiteSteps: ['screening'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'source-policy',
|
||||
phase: 1,
|
||||
package: 'vorbereitung',
|
||||
order: 7,
|
||||
name: 'Source Policy',
|
||||
nameShort: 'Quellen',
|
||||
description: 'Datenquellen-Governance & Whitelist',
|
||||
url: '/sdk/source-policy',
|
||||
checkpointId: 'CP-SPOL',
|
||||
prerequisiteSteps: ['modules'],
|
||||
isOptional: false,
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// PAKET 2: ANALYSE (Assessment)
|
||||
// =============================================================================
|
||||
{
|
||||
id: 'requirements',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 1,
|
||||
name: 'Requirements',
|
||||
nameShort: 'Anforderungen',
|
||||
description: 'Pr\u00fcfaspekte aus Regulierungen ableiten',
|
||||
url: '/sdk/requirements',
|
||||
checkpointId: 'CP-REQ',
|
||||
prerequisiteSteps: ['source-policy'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'controls',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 2,
|
||||
name: 'Controls',
|
||||
nameShort: 'Controls',
|
||||
description: 'Erforderliche Ma\u00dfnahmen ermitteln',
|
||||
url: '/sdk/controls',
|
||||
checkpointId: 'CP-CTRL',
|
||||
prerequisiteSteps: ['requirements'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'evidence',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 3,
|
||||
name: 'Evidence',
|
||||
nameShort: 'Nachweise',
|
||||
description: 'Nachweise dokumentieren',
|
||||
url: '/sdk/evidence',
|
||||
checkpointId: 'CP-EVI',
|
||||
prerequisiteSteps: ['controls'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'risks',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 4,
|
||||
name: 'Risk Matrix',
|
||||
nameShort: 'Risiken',
|
||||
description: 'Risikobewertung & Residual Risk',
|
||||
url: '/sdk/risks',
|
||||
checkpointId: 'CP-RISK',
|
||||
prerequisiteSteps: ['evidence'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'ai-act',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 5,
|
||||
name: 'AI Act Klassifizierung',
|
||||
nameShort: 'AI Act',
|
||||
description: 'Risikostufe nach EU AI Act',
|
||||
url: '/sdk/ai-act',
|
||||
checkpointId: 'CP-AI',
|
||||
prerequisiteSteps: ['risks'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'audit-checklist',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 6,
|
||||
name: 'Audit Checklist',
|
||||
nameShort: 'Checklist',
|
||||
description: 'Pr\u00fcfliste generieren',
|
||||
url: '/sdk/audit-checklist',
|
||||
checkpointId: 'CP-CHK',
|
||||
prerequisiteSteps: ['ai-act'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'audit-report',
|
||||
phase: 1,
|
||||
package: 'analyse',
|
||||
order: 7,
|
||||
name: 'Audit Report',
|
||||
nameShort: 'Report',
|
||||
description: 'Audit-Sitzungen & PDF-Report',
|
||||
url: '/sdk/audit-report',
|
||||
checkpointId: 'CP-AREP',
|
||||
prerequisiteSteps: ['audit-checklist'],
|
||||
isOptional: false,
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// PAKET 3: DOKUMENTATION (Compliance Docs)
|
||||
// =============================================================================
|
||||
{
|
||||
id: 'obligations',
|
||||
phase: 2,
|
||||
package: 'dokumentation',
|
||||
order: 1,
|
||||
name: 'Pflichten\u00fcbersicht',
|
||||
nameShort: 'Pflichten',
|
||||
description: 'NIS2, DSGVO, AI Act Pflichten',
|
||||
url: '/sdk/obligations',
|
||||
checkpointId: 'CP-OBL',
|
||||
prerequisiteSteps: ['audit-report'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'dsfa',
|
||||
phase: 2,
|
||||
package: 'dokumentation',
|
||||
order: 2,
|
||||
name: 'DSFA',
|
||||
nameShort: 'DSFA',
|
||||
description: 'Datenschutz-Folgenabsch\u00e4tzung',
|
||||
url: '/sdk/dsfa',
|
||||
checkpointId: 'CP-DSFA',
|
||||
prerequisiteSteps: ['obligations'],
|
||||
isOptional: true, // Only if dsfa_recommended
|
||||
},
|
||||
{
|
||||
id: 'tom',
|
||||
phase: 2,
|
||||
package: 'dokumentation',
|
||||
order: 3,
|
||||
name: 'TOMs',
|
||||
nameShort: 'TOMs',
|
||||
description: 'Technische & Org. Ma\u00dfnahmen',
|
||||
url: '/sdk/tom',
|
||||
checkpointId: 'CP-TOM',
|
||||
prerequisiteSteps: ['dsfa'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'loeschfristen',
|
||||
phase: 2,
|
||||
package: 'dokumentation',
|
||||
order: 4,
|
||||
name: 'L\u00f6schfristen',
|
||||
nameShort: 'L\u00f6schfristen',
|
||||
description: 'Aufbewahrungsrichtlinien',
|
||||
url: '/sdk/loeschfristen',
|
||||
checkpointId: 'CP-RET',
|
||||
prerequisiteSteps: ['tom'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'vvt',
|
||||
phase: 2,
|
||||
package: 'dokumentation',
|
||||
order: 5,
|
||||
name: 'Verarbeitungsverzeichnis',
|
||||
nameShort: 'VVT',
|
||||
description: 'Art. 30 DSGVO Dokumentation',
|
||||
url: '/sdk/vvt',
|
||||
checkpointId: 'CP-VVT',
|
||||
prerequisiteSteps: ['loeschfristen'],
|
||||
isOptional: false,
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// PAKET 4: RECHTLICHE TEXTE (Legal Outputs)
|
||||
// =============================================================================
|
||||
{
|
||||
id: 'einwilligungen',
|
||||
phase: 2,
|
||||
package: 'rechtliche-texte',
|
||||
order: 1,
|
||||
name: 'Einwilligungen',
|
||||
nameShort: 'Einwilligungen',
|
||||
description: 'Datenpunktkatalog & DSI-Generator',
|
||||
url: '/sdk/einwilligungen',
|
||||
checkpointId: 'CP-CONS',
|
||||
prerequisiteSteps: ['vvt'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'consent',
|
||||
phase: 2,
|
||||
package: 'rechtliche-texte',
|
||||
order: 2,
|
||||
name: 'Rechtliche Vorlagen',
|
||||
nameShort: 'Vorlagen',
|
||||
description: 'AGB, Datenschutz, Nutzungsbedingungen',
|
||||
url: '/sdk/consent',
|
||||
checkpointId: 'CP-DOC',
|
||||
prerequisiteSteps: ['einwilligungen'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'cookie-banner',
|
||||
phase: 2,
|
||||
package: 'rechtliche-texte',
|
||||
order: 3,
|
||||
name: 'Cookie Banner',
|
||||
nameShort: 'Cookies',
|
||||
description: 'Cookie-Consent Generator',
|
||||
url: '/sdk/cookie-banner',
|
||||
checkpointId: 'CP-COOK',
|
||||
prerequisiteSteps: ['consent'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'document-generator',
|
||||
phase: 2,
|
||||
package: 'rechtliche-texte',
|
||||
order: 4,
|
||||
name: 'Dokumentengenerator',
|
||||
nameShort: 'Generator',
|
||||
description: 'Rechtliche Dokumente aus Vorlagen erstellen',
|
||||
url: '/sdk/document-generator',
|
||||
checkpointId: 'CP-DOCGEN',
|
||||
prerequisiteSteps: ['cookie-banner'],
|
||||
isOptional: true,
|
||||
},
|
||||
{
|
||||
id: 'workflow',
|
||||
phase: 2,
|
||||
package: 'rechtliche-texte',
|
||||
order: 5,
|
||||
name: 'Document Workflow',
|
||||
nameShort: 'Workflow',
|
||||
description: 'Versionierung & Freigabe-Workflow',
|
||||
url: '/sdk/workflow',
|
||||
checkpointId: 'CP-WRKF',
|
||||
prerequisiteSteps: ['document-generator'],
|
||||
isOptional: false,
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// PAKET 5: BETRIEB (Operations)
|
||||
// =============================================================================
|
||||
{
|
||||
id: 'dsr',
|
||||
phase: 2,
|
||||
package: 'betrieb',
|
||||
order: 1,
|
||||
name: 'DSR Portal',
|
||||
nameShort: 'DSR',
|
||||
description: 'Betroffenenrechte-Portal',
|
||||
url: '/sdk/dsr',
|
||||
checkpointId: 'CP-DSR',
|
||||
prerequisiteSteps: ['workflow'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'escalations',
|
||||
phase: 2,
|
||||
package: 'betrieb',
|
||||
order: 2,
|
||||
name: 'Escalations',
|
||||
nameShort: 'Eskalationen',
|
||||
description: 'Management-Workflows',
|
||||
url: '/sdk/escalations',
|
||||
checkpointId: 'CP-ESC',
|
||||
prerequisiteSteps: ['dsr'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'vendor-compliance',
|
||||
phase: 2,
|
||||
package: 'betrieb',
|
||||
order: 3,
|
||||
name: 'Vendor Compliance',
|
||||
nameShort: 'Vendor',
|
||||
description: 'Dienstleister-Management',
|
||||
url: '/sdk/vendor-compliance',
|
||||
checkpointId: 'CP-VEND',
|
||||
prerequisiteSteps: ['escalations'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'consent-management',
|
||||
phase: 2,
|
||||
package: 'betrieb',
|
||||
order: 4,
|
||||
name: 'Consent Verwaltung',
|
||||
nameShort: 'Consent Mgmt',
|
||||
description: 'Dokument-Lifecycle & DSGVO-Prozesse',
|
||||
url: '/sdk/consent-management',
|
||||
checkpointId: 'CP-CMGMT',
|
||||
prerequisiteSteps: ['vendor-compliance'],
|
||||
isOptional: false,
|
||||
},
|
||||
{
|
||||
id: 'notfallplan',
|
||||
phase: 2,
|
||||
package: 'betrieb',
|
||||
order: 5,
|
||||
name: 'Notfallplan & Breach Response',
|
||||
nameShort: 'Notfallplan',
|
||||
description: 'Datenpannen-Management nach Art. 33/34 DSGVO',
|
||||
url: '/sdk/notfallplan',
|
||||
checkpointId: 'CP-NOTF',
|
||||
prerequisiteSteps: ['consent-management'],
|
||||
isOptional: false,
|
||||
},
|
||||
]
|
||||
197
admin-lehrer/lib/sdk/types/state.ts
Normal file
197
admin-lehrer/lib/sdk/types/state.ts
Normal file
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* SDK State & Actions
|
||||
*
|
||||
* Central SDK state interface, action discriminated union,
|
||||
* user preferences, and command bar types.
|
||||
*/
|
||||
|
||||
import type {
|
||||
SubscriptionTier,
|
||||
SDKPhase,
|
||||
CustomerType,
|
||||
CommandType,
|
||||
} from './core'
|
||||
import type { CompanyProfile } from './company-profile'
|
||||
import type { CheckpointStatus } from './checkpoint'
|
||||
import type { UseCaseAssessment } from './assessment'
|
||||
import type { ScreeningResult, SecurityIssue, BacklogItem, SBOM } from './screening-security'
|
||||
import type { ServiceModule, Requirement, Control, Evidence, ChecklistItem } from './compliance'
|
||||
import type { Risk } from './risk'
|
||||
import type { AIActResult, Obligation } from './ai-act-obligations'
|
||||
import type { DSFA } from './dsfa'
|
||||
import type {
|
||||
TOM,
|
||||
RetentionPolicy,
|
||||
ProcessingActivity,
|
||||
LegalDocument,
|
||||
CookieBannerConfig,
|
||||
ConsentRecord,
|
||||
DSRConfig,
|
||||
ImportedDocument,
|
||||
GapAnalysis,
|
||||
EscalationWorkflow,
|
||||
} from './documentation'
|
||||
|
||||
// =============================================================================
|
||||
// COMMAND BAR
|
||||
// =============================================================================
|
||||
|
||||
export interface CommandSuggestion {
|
||||
id: string
|
||||
type: CommandType
|
||||
label: string
|
||||
description: string
|
||||
shortcut?: string
|
||||
icon?: string
|
||||
action: () => void | Promise<void>
|
||||
relevanceScore: number
|
||||
}
|
||||
|
||||
export interface CommandHistory {
|
||||
id: string
|
||||
query: string
|
||||
type: CommandType
|
||||
timestamp: Date
|
||||
success: boolean
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// USER PREFERENCES
|
||||
// =============================================================================
|
||||
|
||||
export interface UserPreferences {
|
||||
language: 'de' | 'en'
|
||||
theme: 'light' | 'dark' | 'system'
|
||||
compactMode: boolean
|
||||
showHints: boolean
|
||||
autoSave: boolean
|
||||
autoValidate: boolean
|
||||
allowParallelWork: boolean // Erlaubt Navigation zu allen Schritten ohne Voraussetzungen
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SDK STATE
|
||||
// =============================================================================
|
||||
|
||||
export interface SDKState {
|
||||
// Metadata
|
||||
version: string
|
||||
lastModified: Date
|
||||
|
||||
// Tenant & User
|
||||
tenantId: string
|
||||
userId: string
|
||||
subscription: SubscriptionTier
|
||||
|
||||
// Customer Type (new vs existing)
|
||||
customerType: CustomerType | null
|
||||
|
||||
// Company Profile (collected before use cases)
|
||||
companyProfile: CompanyProfile | null
|
||||
|
||||
// Compliance Scope (determines depth level L1-L4)
|
||||
complianceScope: import('../compliance-scope-types').ComplianceScopeState | null
|
||||
|
||||
// Progress
|
||||
currentPhase: SDKPhase
|
||||
currentStep: string
|
||||
completedSteps: string[]
|
||||
checkpoints: Record<string, CheckpointStatus>
|
||||
|
||||
// Imported Documents (for existing customers)
|
||||
importedDocuments: ImportedDocument[]
|
||||
gapAnalysis: GapAnalysis | null
|
||||
|
||||
// Phase 1 Data
|
||||
useCases: UseCaseAssessment[]
|
||||
activeUseCase: string | null
|
||||
screening: ScreeningResult | null
|
||||
modules: ServiceModule[]
|
||||
requirements: Requirement[]
|
||||
controls: Control[]
|
||||
evidence: Evidence[]
|
||||
checklist: ChecklistItem[]
|
||||
risks: Risk[]
|
||||
|
||||
// Phase 2 Data
|
||||
aiActClassification: AIActResult | null
|
||||
obligations: Obligation[]
|
||||
dsfa: DSFA | null
|
||||
toms: TOM[]
|
||||
retentionPolicies: RetentionPolicy[]
|
||||
vvt: ProcessingActivity[]
|
||||
documents: LegalDocument[]
|
||||
cookieBanner: CookieBannerConfig | null
|
||||
consents: ConsentRecord[]
|
||||
dsrConfig: DSRConfig | null
|
||||
escalationWorkflows: EscalationWorkflow[]
|
||||
|
||||
// Security
|
||||
sbom: SBOM | null
|
||||
securityIssues: SecurityIssue[]
|
||||
securityBacklog: BacklogItem[]
|
||||
|
||||
// UI State
|
||||
commandBarHistory: CommandHistory[]
|
||||
recentSearches: string[]
|
||||
preferences: UserPreferences
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// SDK ACTIONS
|
||||
// =============================================================================
|
||||
|
||||
export type SDKAction =
|
||||
| { type: 'SET_STATE'; payload: Partial<SDKState> }
|
||||
| { type: 'SET_CURRENT_STEP'; payload: string }
|
||||
| { type: 'COMPLETE_STEP'; payload: string }
|
||||
| { type: 'SET_CHECKPOINT_STATUS'; payload: { id: string; status: CheckpointStatus } }
|
||||
| { type: 'SET_CUSTOMER_TYPE'; payload: CustomerType }
|
||||
| { type: 'SET_COMPANY_PROFILE'; payload: CompanyProfile }
|
||||
| { type: 'UPDATE_COMPANY_PROFILE'; payload: Partial<CompanyProfile> }
|
||||
| { type: 'SET_COMPLIANCE_SCOPE'; payload: import('../compliance-scope-types').ComplianceScopeState }
|
||||
| { type: 'UPDATE_COMPLIANCE_SCOPE'; payload: Partial<import('../compliance-scope-types').ComplianceScopeState> }
|
||||
| { type: 'ADD_IMPORTED_DOCUMENT'; payload: ImportedDocument }
|
||||
| { type: 'UPDATE_IMPORTED_DOCUMENT'; payload: { id: string; data: Partial<ImportedDocument> } }
|
||||
| { type: 'DELETE_IMPORTED_DOCUMENT'; payload: string }
|
||||
| { type: 'SET_GAP_ANALYSIS'; payload: GapAnalysis }
|
||||
| { type: 'ADD_USE_CASE'; payload: UseCaseAssessment }
|
||||
| { type: 'UPDATE_USE_CASE'; payload: { id: string; data: Partial<UseCaseAssessment> } }
|
||||
| { type: 'DELETE_USE_CASE'; payload: string }
|
||||
| { type: 'SET_ACTIVE_USE_CASE'; payload: string | null }
|
||||
| { type: 'SET_SCREENING'; payload: ScreeningResult }
|
||||
| { type: 'ADD_MODULE'; payload: ServiceModule }
|
||||
| { type: 'UPDATE_MODULE'; payload: { id: string; data: Partial<ServiceModule> } }
|
||||
| { type: 'ADD_REQUIREMENT'; payload: Requirement }
|
||||
| { type: 'UPDATE_REQUIREMENT'; payload: { id: string; data: Partial<Requirement> } }
|
||||
| { type: 'ADD_CONTROL'; payload: Control }
|
||||
| { type: 'UPDATE_CONTROL'; payload: { id: string; data: Partial<Control> } }
|
||||
| { type: 'ADD_EVIDENCE'; payload: Evidence }
|
||||
| { type: 'UPDATE_EVIDENCE'; payload: { id: string; data: Partial<Evidence> } }
|
||||
| { type: 'DELETE_EVIDENCE'; payload: string }
|
||||
| { type: 'ADD_RISK'; payload: Risk }
|
||||
| { type: 'UPDATE_RISK'; payload: { id: string; data: Partial<Risk> } }
|
||||
| { type: 'DELETE_RISK'; payload: string }
|
||||
| { type: 'SET_AI_ACT_RESULT'; payload: AIActResult }
|
||||
| { type: 'ADD_OBLIGATION'; payload: Obligation }
|
||||
| { type: 'UPDATE_OBLIGATION'; payload: { id: string; data: Partial<Obligation> } }
|
||||
| { type: 'SET_DSFA'; payload: DSFA }
|
||||
| { type: 'ADD_TOM'; payload: TOM }
|
||||
| { type: 'UPDATE_TOM'; payload: { id: string; data: Partial<TOM> } }
|
||||
| { type: 'ADD_RETENTION_POLICY'; payload: RetentionPolicy }
|
||||
| { type: 'UPDATE_RETENTION_POLICY'; payload: { id: string; data: Partial<RetentionPolicy> } }
|
||||
| { type: 'ADD_PROCESSING_ACTIVITY'; payload: ProcessingActivity }
|
||||
| { type: 'UPDATE_PROCESSING_ACTIVITY'; payload: { id: string; data: Partial<ProcessingActivity> } }
|
||||
| { type: 'ADD_DOCUMENT'; payload: LegalDocument }
|
||||
| { type: 'UPDATE_DOCUMENT'; payload: { id: string; data: Partial<LegalDocument> } }
|
||||
| { type: 'SET_COOKIE_BANNER'; payload: CookieBannerConfig }
|
||||
| { type: 'SET_DSR_CONFIG'; payload: DSRConfig }
|
||||
| { type: 'ADD_ESCALATION_WORKFLOW'; payload: EscalationWorkflow }
|
||||
| { type: 'UPDATE_ESCALATION_WORKFLOW'; payload: { id: string; data: Partial<EscalationWorkflow> } }
|
||||
| { type: 'ADD_SECURITY_ISSUE'; payload: SecurityIssue }
|
||||
| { type: 'UPDATE_SECURITY_ISSUE'; payload: { id: string; data: Partial<SecurityIssue> } }
|
||||
| { type: 'ADD_BACKLOG_ITEM'; payload: BacklogItem }
|
||||
| { type: 'UPDATE_BACKLOG_ITEM'; payload: { id: string; data: Partial<BacklogItem> } }
|
||||
| { type: 'ADD_COMMAND_HISTORY'; payload: CommandHistory }
|
||||
| { type: 'SET_PREFERENCES'; payload: Partial<UserPreferences> }
|
||||
| { type: 'RESET_STATE' }
|
||||
Reference in New Issue
Block a user