@plyaz/types 1.15.20 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/aws/index.d.ts +5 -0
- package/dist/api/aws/signature.d.ts +42 -0
- package/dist/api/endpoints/cdn/endpoints.d.ts +57 -0
- package/dist/api/endpoints/cdn/index.d.ts +6 -0
- package/dist/api/endpoints/cdn/types.d.ts +151 -0
- package/dist/api/endpoints/index.d.ts +2 -0
- package/dist/api/endpoints/types.d.ts +3 -1
- package/dist/api/endpoints/virustotal/endpoints.d.ts +37 -0
- package/dist/api/endpoints/virustotal/index.d.ts +6 -0
- package/dist/api/endpoints/virustotal/types.d.ts +202 -0
- package/dist/api/index.cjs +1317 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +1317 -1
- package/dist/api/index.js.map +1 -1
- package/dist/core/idempotency.d.ts +48 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/errors/codes.d.ts +296 -0
- package/dist/errors/enums.d.ts +10 -0
- package/dist/errors/index.cjs +1482 -1
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1482 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/validation.d.ts +71 -0
- package/dist/index.cjs +2268 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +2227 -133
- package/dist/index.js.map +1 -1
- package/dist/logger/enums.d.ts +10 -0
- package/dist/notifications/types.d.ts +1 -2
- package/dist/storage/compliance.d.ts +247 -0
- package/dist/storage/enums.d.ts +527 -0
- package/dist/storage/event-handler-mapping.d.ts +69 -0
- package/dist/storage/index.d.ts +13 -0
- package/dist/storage/interfaces.d.ts +2242 -0
- package/dist/storage/plugins.d.ts +996 -0
- package/dist/storage/schemas.d.ts +224 -0
- package/dist/storage/webhooks.d.ts +340 -0
- package/package.json +6 -1
package/dist/logger/enums.d.ts
CHANGED
|
@@ -30,6 +30,16 @@ export declare const LOGGER_SERVICES: {
|
|
|
30
30
|
readonly WEBHOOK_SERVICE: "WebhookService";
|
|
31
31
|
readonly TEMPLATE_ENGINE: "TemplateEngine";
|
|
32
32
|
readonly ATTACHMENT_RESOLVER: "AttachmentResolver";
|
|
33
|
+
readonly STORAGE_SERVICE: "StorageService";
|
|
34
|
+
readonly STORAGE_ADAPTER: "StorageAdapter";
|
|
35
|
+
readonly CLOUDFLARE_R2_ADAPTER: "CloudflareR2Adapter";
|
|
36
|
+
readonly SUPABASE_STORAGE_ADAPTER: "SupabaseStorageAdapter";
|
|
37
|
+
readonly ADAPTER_REGISTRY: "AdapterRegistry";
|
|
38
|
+
readonly MEDIA_PROCESSOR: "MediaProcessor";
|
|
39
|
+
readonly METADATA_EXTRACTOR: "MetadataExtractor";
|
|
40
|
+
readonly VIRUS_SCANNER: "VirusScanner";
|
|
41
|
+
readonly TEMPLATE_RENDERER: "TemplateRenderer";
|
|
42
|
+
readonly COMPLIANCE_MANAGER: "ComplianceManager";
|
|
33
43
|
readonly CONFIG_MANAGER: "ConfigManager";
|
|
34
44
|
readonly CONFIG_VALIDATOR: "ConfigValidator";
|
|
35
45
|
};
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
import type { UnknownRecord, Promisable } from 'type-fest';
|
|
10
10
|
import type { MessageCatalog, PackageErrorLike } from '../errors';
|
|
11
11
|
import type { WEBHOOK_ENCRYPTION_METHOD, WEBHOOK_EVENT_TYPE, SIGNATURE_METHOD } from './enums';
|
|
12
|
-
import type z from 'zod';
|
|
13
12
|
/**
|
|
14
13
|
* Notification channels supported by the system
|
|
15
14
|
*/
|
|
@@ -1664,7 +1663,7 @@ export interface WebhookProcessingResult {
|
|
|
1664
1663
|
* @template TPayload - Provider-specific payload type
|
|
1665
1664
|
* @template TSchema - Zod schema type for validation
|
|
1666
1665
|
*/
|
|
1667
|
-
export interface WebhookAdapter<TPayload = unknown, TSchema
|
|
1666
|
+
export interface WebhookAdapter<TPayload = unknown, TSchema = unknown> {
|
|
1668
1667
|
/** Provider name (sendgrid, infobip, twilio, etc.) */
|
|
1669
1668
|
readonly providerName: string;
|
|
1670
1669
|
/** Channel this webhook handles */
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Compliance Types
|
|
3
|
+
*
|
|
4
|
+
* Comprehensive, adapter-agnostic compliance system for:
|
|
5
|
+
* - GDPR compliance
|
|
6
|
+
* - Legal retention requirements
|
|
7
|
+
* - Regulatory compliance (SOX, HIPAA, etc.)
|
|
8
|
+
* - Data immutability
|
|
9
|
+
* - Soft delete with grace periods
|
|
10
|
+
*
|
|
11
|
+
* @module @plyaz/types/storage/compliance
|
|
12
|
+
*/
|
|
13
|
+
import type { FILE_CATEGORY, STORAGE_JURISDICTION, STORAGE_REGULATORY_FRAMEWORK } from './enums';
|
|
14
|
+
/**
|
|
15
|
+
* Storage retention policy type
|
|
16
|
+
*/
|
|
17
|
+
export type StorageRetentionPolicyType = 'time-based' | 'legal' | 'regulatory' | 'custom';
|
|
18
|
+
/**
|
|
19
|
+
* Storage retention strategy for deletion attempts on files under retention
|
|
20
|
+
*/
|
|
21
|
+
export type StorageRetentionStrategy = 'soft-delete' | 'defer' | 'error';
|
|
22
|
+
/**
|
|
23
|
+
* Storage immutability strategy for deletion attempts on immutable files
|
|
24
|
+
*/
|
|
25
|
+
export type StorageImmutabilityStrategy = 'skip' | 'defer' | 'error';
|
|
26
|
+
/**
|
|
27
|
+
* Storage deletion reason for audit trail
|
|
28
|
+
*/
|
|
29
|
+
export type StorageDeletionReason = 'user_request' | 'account_deletion' | 'gdpr_erasure' | 'admin_action' | 'retention_expired' | 'policy_enforcement' | 'compliance_requirement' | 'data_cleanup' | 'duplicate_removal' | 'test_data_cleanup' | 'other';
|
|
30
|
+
/**
|
|
31
|
+
* Jurisdiction-specific compliance rule
|
|
32
|
+
*
|
|
33
|
+
* Allows overriding retention requirements per jurisdiction
|
|
34
|
+
*/
|
|
35
|
+
export interface StorageJurisdictionRule {
|
|
36
|
+
/** Jurisdiction code (uses enum for type safety) */
|
|
37
|
+
jurisdiction: STORAGE_JURISDICTION;
|
|
38
|
+
/** Override retention period for this jurisdiction */
|
|
39
|
+
retentionYears?: number;
|
|
40
|
+
/** Right to erasure (GDPR Article 17) - user can request deletion */
|
|
41
|
+
rightToErasure?: boolean;
|
|
42
|
+
/** Mandatory retention - cannot be deleted before retention expires */
|
|
43
|
+
mandatoryRetention?: boolean;
|
|
44
|
+
/** Regulatory frameworks applicable in this jurisdiction */
|
|
45
|
+
frameworks?: STORAGE_REGULATORY_FRAMEWORK[];
|
|
46
|
+
/** Description of jurisdiction-specific requirements */
|
|
47
|
+
description?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Jurisdiction conflict resolution strategy
|
|
51
|
+
*/
|
|
52
|
+
export type StorageJurisdictionConflictStrategy = 'most-restrictive' | 'least-restrictive' | 'mandatory-wins' | 'custom';
|
|
53
|
+
/**
|
|
54
|
+
* Storage retention policy definition
|
|
55
|
+
*
|
|
56
|
+
* Adapter-agnostic: Works with any storage adapter (R2, Supabase, custom, etc.)
|
|
57
|
+
*/
|
|
58
|
+
export interface StorageRetentionPolicy {
|
|
59
|
+
/** Policy type */
|
|
60
|
+
type: StorageRetentionPolicyType;
|
|
61
|
+
/** Retention period in years */
|
|
62
|
+
retentionYears: number;
|
|
63
|
+
/** File is immutable (cannot be deleted before retention expires) */
|
|
64
|
+
immutable: boolean;
|
|
65
|
+
/** Use soft delete instead of hard delete */
|
|
66
|
+
softDelete: boolean;
|
|
67
|
+
/** Grace period in days after deletion before permanent removal */
|
|
68
|
+
gracePeriodDays?: number;
|
|
69
|
+
/** Policy name (for audit/logging) */
|
|
70
|
+
name?: string;
|
|
71
|
+
/** Description of the policy */
|
|
72
|
+
description?: string;
|
|
73
|
+
/** Jurisdictions this policy applies to (uses enum for type safety) */
|
|
74
|
+
jurisdictions?: STORAGE_JURISDICTION[];
|
|
75
|
+
/** Regulatory frameworks (uses enum for type safety - no more "penis" strings!) */
|
|
76
|
+
regulatoryFrameworks?: STORAGE_REGULATORY_FRAMEWORK[];
|
|
77
|
+
/** Jurisdiction-specific rules (overrides for specific jurisdictions) */
|
|
78
|
+
jurisdictionRules?: StorageJurisdictionRule[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Storage compliance configuration for storage service
|
|
82
|
+
*
|
|
83
|
+
* Adapter-agnostic: Applied at service level, works with any adapter
|
|
84
|
+
*/
|
|
85
|
+
export interface StorageComplianceConfig {
|
|
86
|
+
/** Default retention policy for all files (required if enabled is true) */
|
|
87
|
+
defaultRetentionPolicy?: StorageRetentionPolicy;
|
|
88
|
+
/** Retention policies by file category */
|
|
89
|
+
retentionPolicies?: Partial<Record<FILE_CATEGORY, StorageRetentionPolicy>>;
|
|
90
|
+
/** Immutable file path patterns (regex) */
|
|
91
|
+
immutablePatterns?: RegExp[];
|
|
92
|
+
/** Enable compliance checks */
|
|
93
|
+
enabled?: boolean;
|
|
94
|
+
/** Strict mode (throw errors on violations vs warnings) */
|
|
95
|
+
strictMode?: boolean;
|
|
96
|
+
/** Jurisdiction conflict resolution strategy */
|
|
97
|
+
jurisdictionConflictStrategy?: StorageJurisdictionConflictStrategy;
|
|
98
|
+
/** Default jurisdictions to apply if not specified */
|
|
99
|
+
defaultJurisdictions?: STORAGE_JURISDICTION[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Storage compliance check result
|
|
103
|
+
*/
|
|
104
|
+
export interface StorageComplianceCheckResult {
|
|
105
|
+
/** Check passed */
|
|
106
|
+
allowed: boolean;
|
|
107
|
+
/** Reason if not allowed */
|
|
108
|
+
reason?: string;
|
|
109
|
+
/** Retention policy applied */
|
|
110
|
+
policy?: StorageRetentionPolicy;
|
|
111
|
+
/** Retention end date (if applicable) */
|
|
112
|
+
retentionUntil?: Date;
|
|
113
|
+
/** Should use soft delete */
|
|
114
|
+
shouldSoftDelete?: boolean;
|
|
115
|
+
/** Should defer deletion */
|
|
116
|
+
shouldDefer?: boolean;
|
|
117
|
+
/** Grace period end date (if applicable) */
|
|
118
|
+
gracePeriodUntil?: Date;
|
|
119
|
+
/** Is immutable */
|
|
120
|
+
isImmutable?: boolean;
|
|
121
|
+
/** Is under retention */
|
|
122
|
+
underRetention?: boolean;
|
|
123
|
+
/** Pattern matched (if immutable by pattern) */
|
|
124
|
+
matchedPattern?: RegExp;
|
|
125
|
+
/** Applicable jurisdictions for this check */
|
|
126
|
+
applicableJurisdictions?: STORAGE_JURISDICTION[];
|
|
127
|
+
/** Applicable regulatory frameworks */
|
|
128
|
+
applicableFrameworks?: STORAGE_REGULATORY_FRAMEWORK[];
|
|
129
|
+
/** Jurisdiction-specific conflicts detected */
|
|
130
|
+
jurisdictionConflicts?: Array<{
|
|
131
|
+
jurisdiction: STORAGE_JURISDICTION;
|
|
132
|
+
requirement: string;
|
|
133
|
+
conflictsWith: string;
|
|
134
|
+
}>;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Storage delete operation compliance options
|
|
138
|
+
*/
|
|
139
|
+
export interface StorageDeleteComplianceOptions {
|
|
140
|
+
/** Force delete even if immutable */
|
|
141
|
+
force?: boolean;
|
|
142
|
+
/** Ignore retention policy */
|
|
143
|
+
ignoreRetention?: boolean;
|
|
144
|
+
/** Deletion reason (for audit) */
|
|
145
|
+
reason?: StorageDeletionReason | string;
|
|
146
|
+
/** Override retention policy for this operation */
|
|
147
|
+
retentionOverride?: Partial<StorageRetentionPolicy>;
|
|
148
|
+
/** Strategy for files under retention */
|
|
149
|
+
retentionStrategy?: StorageRetentionStrategy;
|
|
150
|
+
/** Strategy for immutable files */
|
|
151
|
+
immutableStrategy?: StorageImmutabilityStrategy;
|
|
152
|
+
/** Override applicable jurisdictions for this operation */
|
|
153
|
+
jurisdictionsOverride?: STORAGE_JURISDICTION[];
|
|
154
|
+
/** Override conflict resolution strategy */
|
|
155
|
+
conflictStrategyOverride?: StorageJurisdictionConflictStrategy;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Jurisdiction resolution context
|
|
159
|
+
*
|
|
160
|
+
* Provides context for determining applicable jurisdictions
|
|
161
|
+
*/
|
|
162
|
+
export interface StorageJurisdictionContext {
|
|
163
|
+
/** User's location/jurisdiction */
|
|
164
|
+
userJurisdiction?: STORAGE_JURISDICTION;
|
|
165
|
+
/** Entity's (organization/company) jurisdiction */
|
|
166
|
+
entityJurisdiction?: STORAGE_JURISDICTION;
|
|
167
|
+
/** Data type category */
|
|
168
|
+
dataCategory?: FILE_CATEGORY;
|
|
169
|
+
/** Explicit jurisdictions to apply */
|
|
170
|
+
explicitJurisdictions?: STORAGE_JURISDICTION[];
|
|
171
|
+
/** Storage location jurisdiction */
|
|
172
|
+
storageJurisdiction?: STORAGE_JURISDICTION;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Storage bulk delete result with compliance tracking
|
|
176
|
+
*/
|
|
177
|
+
export interface StorageBulkDeleteResult {
|
|
178
|
+
/** Files successfully deleted */
|
|
179
|
+
deleted: number;
|
|
180
|
+
/** Files soft deleted */
|
|
181
|
+
softDeleted: number;
|
|
182
|
+
/** Files deferred (will be deleted after retention) */
|
|
183
|
+
deferred: number;
|
|
184
|
+
/** Files skipped (immutable or excluded) */
|
|
185
|
+
skipped: number;
|
|
186
|
+
/** Files that failed to delete */
|
|
187
|
+
failed: number;
|
|
188
|
+
/** Deferred file details */
|
|
189
|
+
deferredFiles?: Array<{
|
|
190
|
+
fileId: string;
|
|
191
|
+
filename: string;
|
|
192
|
+
retentionUntil: Date;
|
|
193
|
+
reason: string;
|
|
194
|
+
}>;
|
|
195
|
+
/** Skipped file details */
|
|
196
|
+
skippedFiles?: Array<{
|
|
197
|
+
fileId: string;
|
|
198
|
+
filename: string;
|
|
199
|
+
reason: string;
|
|
200
|
+
}>;
|
|
201
|
+
/** Failed file details */
|
|
202
|
+
failedFiles?: Array<{
|
|
203
|
+
fileId: string;
|
|
204
|
+
filename: string;
|
|
205
|
+
error: string;
|
|
206
|
+
}>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Storage compliance event metadata
|
|
210
|
+
*/
|
|
211
|
+
export interface StorageComplianceEventMetadata {
|
|
212
|
+
/** File ID */
|
|
213
|
+
fileId: string;
|
|
214
|
+
/** Filename */
|
|
215
|
+
filename?: string;
|
|
216
|
+
/** File category */
|
|
217
|
+
category?: FILE_CATEGORY;
|
|
218
|
+
/** Applied policy */
|
|
219
|
+
policy?: StorageRetentionPolicy;
|
|
220
|
+
/** User who attempted the action */
|
|
221
|
+
attemptedBy?: string;
|
|
222
|
+
/** Action that was attempted */
|
|
223
|
+
action: 'delete' | 'modify' | 'move';
|
|
224
|
+
/** Violation reason */
|
|
225
|
+
violationReason?: string;
|
|
226
|
+
/** Timestamp */
|
|
227
|
+
timestamp: Date;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Storage soft delete metadata
|
|
231
|
+
*/
|
|
232
|
+
export interface StorageSoftDeleteMetadata {
|
|
233
|
+
/** When the file was soft deleted */
|
|
234
|
+
deletedAt: Date;
|
|
235
|
+
/** Who deleted the file */
|
|
236
|
+
deletedBy: string;
|
|
237
|
+
/** Deletion reason */
|
|
238
|
+
reason?: StorageDeletionReason | string;
|
|
239
|
+
/** Grace period in days */
|
|
240
|
+
gracePeriodDays?: number;
|
|
241
|
+
/** When the file will be permanently deleted */
|
|
242
|
+
permanentDeletionAt?: Date;
|
|
243
|
+
/** Grace period end date */
|
|
244
|
+
gracePeriodUntil?: Date;
|
|
245
|
+
/** Can be restored */
|
|
246
|
+
canRestore: boolean;
|
|
247
|
+
}
|