forked from Talenttrust/Talenttrust-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
212 lines (202 loc) · 6.7 KB
/
Copy pathtypes.ts
File metadata and controls
212 lines (202 loc) · 6.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/**
* Data Retention Control Types and Interfaces
*
* Provides type definitions for configurable data retention and archival
* policies to support compliance and data governance requirements.
*
* @module retention/types
*/
/**
* Supported data retention periods
* @enum {string}
*/
export enum RetentionPeriod {
THIRTY_DAYS = '30d',
NINETY_DAYS = '90d',
SIX_MONTHS = '6m',
ONE_YEAR = '1y',
TWO_YEARS = '2y',
INDEFINITE = 'indefinite',
}
/**
* Data classification levels for compliance
* @enum {string}
*/
export enum DataClassification {
PUBLIC = 'public',
INTERNAL = 'internal',
CONFIDENTIAL = 'confidential',
RESTRICTED = 'restricted',
}
/**
* Archival storage types
* @enum {string}
*/
export enum ArchivalStorageType {
LOCAL = 'local',
CLOUD = 'cloud',
COLD_STORAGE = 'cold_storage',
ENCRYPTED_ARCHIVE = 'encrypted_archive',
}
/**
* Retention action types for audit logging
* @enum {string}
*/
export enum RetentionAction {
CREATE = 'create',
UPDATE = 'update',
ARCHIVE = 'archive',
DELETE = 'delete',
RESTORE = 'restore',
POLICY_APPLIED = 'policy_applied',
RETENTION_EXPIRED = 'retention_expired',
}
/**
* Data entity types that can be retained
* @enum {string}
*/
export enum DataEntityType {
CONTRACT = 'contract',
USER_PROFILE = 'user_profile',
TRANSACTION = 'transaction',
AUDIT_LOG = 'audit_log',
DOCUMENT = 'document',
MESSAGE = 'message',
}
/**
* Configuration for a data retention policy
*
* @interface RetentionPolicy
* @property {string} id - Unique policy identifier
* @property {string} name - Human-readable policy name
* @property {string} description - Policy description for compliance documentation
* @property {DataEntityType} entityType - Type of data this policy applies to
* @property {RetentionPeriod} period - How long data should be retained
* @property {DataClassification} classification - Data classification level
* @property {ArchivalStorageType} archivalType - Where to archive expired data
* @property {boolean} encryptArchive - Whether to encrypt archived data
* @property {boolean} allowPermanentRetention - Allow override for indefinite retention
* @property {boolean} isActive - Whether this policy is currently enforced
* @property {Date} createdAt - Policy creation timestamp
* @property {Date} updatedAt - Last policy update timestamp
*/
export interface RetentionPolicy {
id: string;
name: string;
description: string;
entityType: DataEntityType;
period: RetentionPeriod;
classification: DataClassification;
archivalType: ArchivalStorageType;
encryptArchive: boolean;
allowPermanentRetention: boolean;
isActive: boolean;
createdAt: Date;
updatedAt: Date;
}
/**
* Data entity with retention metadata
*
* @interface RetainedData
* @property {string} id - Unique data identifier
* @property {DataEntityType} entityType - Type of data entity
* @property {unknown} data - The actual data payload
* @property {DataClassification} classification - Data sensitivity level
* @property {Date} createdAt - When data was created
* @property {Date} expiresAt - When data retention expires
* @property {Date} [archivedAt] - When data was archived (if applicable)
* @property {string} [archivedLocation] - Where archived data is stored
* @property {boolean} isArchived - Whether data is archived
* @property {string} [retentionPolicyId] - Associated policy identifier
* @property {string} [metadata] - Additional metadata for tracking
*/
export interface RetainedData {
id: string;
entityType: DataEntityType;
data: unknown;
classification: DataClassification;
createdAt: Date;
expiresAt: Date;
archivedAt?: Date;
archivedLocation?: string;
isArchived: boolean;
retentionPolicyId?: string;
metadata?: Record<string, unknown>;
}
/**
* Audit log entry for retention and archival actions
*
* @interface ComplianceAuditLog
* @property {string} id - Unique audit log identifier
* @property {string} entityId - ID of the retained data entity
* @property {DataEntityType} entityType - Type of entity being audited
* @property {RetentionAction} action - Action performed
* @property {string} actor - User or system that performed the action
* @property {Date} timestamp - When action occurred
* @property {Record<string, unknown>} details - Action-specific details
* @property {string} compliance - Applicable compliance standard (e.g., GDPR, CCPA)
* @property {string} [notes] - Additional notes for compliance review
*/
export interface ComplianceAuditLog {
id: string;
entityId: string;
entityType: DataEntityType;
action: RetentionAction;
actor: string;
timestamp: Date;
details: Record<string, unknown>;
compliance: string;
notes?: string;
proof?: string; // Cryptographic proof of the action (e.g., deletion proof)
}
/**
* Retention status and metadata
*
* @interface RetentionStatus
* @property {string} dataId - ID of the retained data
* @property {Date} createdAt - When data was created
* @property {Date} expiresAt - When retention expires
* @property {number} daysUntilExpiry - Days remaining before expiration
* @property {boolean} isArchived - Archival status
* @property {string} [archivedLocation] - Archive location if applicable
* @property {boolean} needsAction - Whether manual action is required
* @property {string} [actionRequired] - Description of required action
*/
export interface RetentionStatus {
dataId: string;
createdAt: Date;
expiresAt: Date;
daysUntilExpiry: number;
isArchived: boolean;
archivedLocation?: string;
needsAction: boolean;
actionRequired?: string;
}
/**
* Retention system configuration
*
* @interface RetentionConfig
* @property {boolean} enabled - Enable retention controls
* @property {string} storageBasePath - Base path for storage operations
* @property {string} archiveBasePath - Base path for archived data
* @property {number} checksIntervalMs - Interval for running retention checks (milliseconds)
* @property {number} batchSize - Number of records to process per batch
* @property {boolean} automaticArchival - Automatically archive expired data
* @property {boolean} automaticDeletion - Automatically delete archived data
* @property {number} postArchivalRetentionDays - Days to keep data after archival before deletion
* @property {string} complianceStandard - Primary compliance standard (e.g., GDPR)
* @property {boolean} encryptionEnabled - Enable encryption for sensitive data
*/
export interface RetentionConfig {
enabled: boolean;
storageBasePath: string;
archiveBasePath: string;
checksIntervalMs: number;
batchSize: number;
automaticArchival: boolean;
automaticDeletion: boolean;
postArchivalRetentionDays: number;
complianceStandard: string;
encryptionEnabled: boolean;
exportFormat?: 'json' | 'csv';
}