@k-msg/channel 0.1.1 → 0.1.3

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/index.d.ts CHANGED
@@ -1,837 +1,8 @@
1
- import { z } from 'zod';
2
- import { EventEmitter } from 'events';
3
-
4
- interface Channel {
5
- id: string;
6
- name: string;
7
- provider: string;
8
- type: ChannelType;
9
- status: ChannelStatus;
10
- profileKey: string;
11
- senderNumbers: SenderNumber[];
12
- metadata: ChannelMetadata;
13
- verification: ChannelVerification;
14
- createdAt: Date;
15
- updatedAt: Date;
16
- }
17
- declare enum ChannelType {
18
- KAKAO_ALIMTALK = "KAKAO_ALIMTALK",
19
- KAKAO_FRIENDTALK = "KAKAO_FRIENDTALK",
20
- SMS = "SMS",
21
- LMS = "LMS",
22
- MMS = "MMS"
23
- }
24
- declare enum ChannelStatus {
25
- PENDING = "PENDING",// 등록 대기
26
- VERIFYING = "VERIFYING",// 검증 중
27
- ACTIVE = "ACTIVE",// 활성화
28
- SUSPENDED = "SUSPENDED",// 일시 정지
29
- BLOCKED = "BLOCKED",// 차단됨
30
- DELETED = "DELETED"
31
- }
32
- interface SenderNumber {
33
- id: string;
34
- phoneNumber: string;
35
- status: SenderNumberStatus;
36
- verificationCode?: string;
37
- verifiedAt?: Date;
38
- category: SenderNumberCategory;
39
- metadata: {
40
- businessName?: string;
41
- businessRegistrationNumber?: string;
42
- contactPerson?: string;
43
- contactEmail?: string;
44
- };
45
- createdAt: Date;
46
- updatedAt: Date;
47
- }
48
- declare enum SenderNumberStatus {
49
- PENDING = "PENDING",// 등록 대기
50
- VERIFYING = "VERIFYING",// 인증 중
51
- VERIFIED = "VERIFIED",// 인증 완료
52
- REJECTED = "REJECTED",// 반려됨
53
- BLOCKED = "BLOCKED"
54
- }
55
- declare enum SenderNumberCategory {
56
- BUSINESS = "BUSINESS",// 사업자
57
- PERSONAL = "PERSONAL",// 개인
58
- GOVERNMENT = "GOVERNMENT",// 관공서
59
- NON_PROFIT = "NON_PROFIT"
60
- }
61
- interface ChannelMetadata {
62
- businessInfo?: {
63
- name: string;
64
- registrationNumber: string;
65
- category: string;
66
- contactPerson: string;
67
- contactEmail: string;
68
- contactPhone: string;
69
- };
70
- kakaoInfo?: {
71
- plusFriendId: string;
72
- brandName: string;
73
- logoUrl?: string;
74
- description?: string;
75
- };
76
- limits: {
77
- dailyMessageLimit: number;
78
- monthlyMessageLimit: number;
79
- rateLimit: number;
80
- };
81
- features: {
82
- supportsBulkSending: boolean;
83
- supportsScheduling: boolean;
84
- supportsButtons: boolean;
85
- maxButtonCount: number;
86
- };
87
- }
88
- interface ChannelVerification {
89
- status: VerificationStatus;
90
- documents: VerificationDocument[];
91
- verifiedAt?: Date;
92
- rejectedAt?: Date;
93
- rejectionReason?: string;
94
- verifiedBy?: string;
95
- }
96
- declare enum VerificationStatus {
97
- NOT_REQUIRED = "NOT_REQUIRED",
98
- PENDING = "PENDING",
99
- UNDER_REVIEW = "UNDER_REVIEW",
100
- VERIFIED = "VERIFIED",
101
- REJECTED = "REJECTED"
102
- }
103
- interface VerificationDocument {
104
- id: string;
105
- type: DocumentType;
106
- fileName: string;
107
- fileUrl: string;
108
- uploadedAt: Date;
109
- status: DocumentStatus;
110
- }
111
- declare enum DocumentType {
112
- BUSINESS_REGISTRATION = "BUSINESS_REGISTRATION",
113
- BUSINESS_LICENSE = "BUSINESS_LICENSE",
114
- ID_CARD = "ID_CARD",
115
- AUTHORIZATION_LETTER = "AUTHORIZATION_LETTER",
116
- OTHER = "OTHER"
117
- }
118
- declare enum DocumentStatus {
119
- UPLOADED = "UPLOADED",
120
- VERIFIED = "VERIFIED",
121
- REJECTED = "REJECTED"
122
- }
123
- interface ChannelCreateRequest {
124
- name: string;
125
- type: ChannelType;
126
- provider: string;
127
- profileKey: string;
128
- businessInfo?: {
129
- name: string;
130
- registrationNumber: string;
131
- category: string;
132
- contactPerson: string;
133
- contactEmail: string;
134
- contactPhone: string;
135
- };
136
- kakaoInfo?: {
137
- plusFriendId: string;
138
- brandName: string;
139
- logoUrl?: string;
140
- description?: string;
141
- };
142
- }
143
- interface SenderNumberCreateRequest {
144
- phoneNumber: string;
145
- category: SenderNumberCategory;
146
- businessInfo?: {
147
- businessName: string;
148
- businessRegistrationNumber: string;
149
- contactPerson: string;
150
- contactEmail: string;
151
- };
152
- }
153
- interface ChannelFilters {
154
- provider?: string;
155
- type?: ChannelType;
156
- status?: ChannelStatus;
157
- verified?: boolean;
158
- createdAfter?: Date;
159
- createdBefore?: Date;
160
- }
161
- interface SenderNumberFilters {
162
- channelId?: string;
163
- status?: SenderNumberStatus;
164
- category?: SenderNumberCategory;
165
- verified?: boolean;
166
- }
167
- declare const ChannelCreateRequestSchema: z.ZodObject<{
168
- name: z.ZodString;
169
- type: z.ZodEnum<typeof ChannelType>;
170
- provider: z.ZodString;
171
- profileKey: z.ZodString;
172
- businessInfo: z.ZodOptional<z.ZodObject<{
173
- name: z.ZodString;
174
- registrationNumber: z.ZodString;
175
- category: z.ZodString;
176
- contactPerson: z.ZodString;
177
- contactEmail: z.ZodString;
178
- contactPhone: z.ZodString;
179
- }, z.core.$strip>>;
180
- kakaoInfo: z.ZodOptional<z.ZodObject<{
181
- plusFriendId: z.ZodString;
182
- brandName: z.ZodString;
183
- logoUrl: z.ZodOptional<z.ZodString>;
184
- description: z.ZodOptional<z.ZodString>;
185
- }, z.core.$strip>>;
186
- }, z.core.$strip>;
187
- declare const SenderNumberCreateRequestSchema: z.ZodObject<{
188
- phoneNumber: z.ZodString;
189
- category: z.ZodEnum<typeof SenderNumberCategory>;
190
- businessInfo: z.ZodOptional<z.ZodObject<{
191
- businessName: z.ZodString;
192
- businessRegistrationNumber: z.ZodString;
193
- contactPerson: z.ZodString;
194
- contactEmail: z.ZodString;
195
- }, z.core.$strip>>;
196
- }, z.core.$strip>;
197
- declare const ChannelFiltersSchema: z.ZodObject<{
198
- provider: z.ZodOptional<z.ZodString>;
199
- type: z.ZodOptional<z.ZodEnum<typeof ChannelType>>;
200
- status: z.ZodOptional<z.ZodEnum<typeof ChannelStatus>>;
201
- verified: z.ZodOptional<z.ZodBoolean>;
202
- createdAfter: z.ZodOptional<z.ZodDate>;
203
- createdBefore: z.ZodOptional<z.ZodDate>;
204
- }, z.core.$strip>;
205
- declare const SenderNumberFiltersSchema: z.ZodObject<{
206
- channelId: z.ZodOptional<z.ZodString>;
207
- status: z.ZodOptional<z.ZodEnum<typeof SenderNumberStatus>>;
208
- category: z.ZodOptional<z.ZodEnum<typeof SenderNumberCategory>>;
209
- verified: z.ZodOptional<z.ZodBoolean>;
210
- }, z.core.$strip>;
211
- type ChannelCreateRequestType = z.infer<typeof ChannelCreateRequestSchema>;
212
- type SenderNumberCreateRequestType = z.infer<typeof SenderNumberCreateRequestSchema>;
213
- type ChannelFiltersType = z.infer<typeof ChannelFiltersSchema>;
214
- type SenderNumberFiltersType = z.infer<typeof SenderNumberFiltersSchema>;
215
- interface ChannelConfig {
216
- id: string;
217
- name: string;
218
- type: 'alimtalk' | 'sms' | 'lms' | 'friendtalk';
219
- providerId: string;
220
- active: boolean;
221
- settings: Record<string, any>;
222
- createdAt: Date;
223
- updatedAt: Date;
224
- }
225
- interface ChannelVerificationResult {
226
- success: boolean;
227
- status: string;
228
- verificationCode?: string;
229
- error?: string;
230
- }
231
-
232
- declare class KakaoChannelManager {
233
- private channels;
234
- createChannel(request: ChannelCreateRequest): Promise<Channel>;
235
- private validateKakaoChannelRequest;
236
- private isValidPlusFriendId;
237
- private initiateBusinessVerification;
238
- completeVerification(channelId: string, approved: boolean, rejectionReason?: string): Promise<void>;
239
- getChannel(channelId: string): Promise<Channel | null>;
240
- updateChannel(channelId: string, updates: Partial<Channel>): Promise<Channel>;
241
- deleteChannel(channelId: string): Promise<boolean>;
242
- listChannels(filters?: {
243
- status?: ChannelStatus;
244
- type?: ChannelType;
245
- verified?: boolean;
246
- }): Promise<Channel[]>;
247
- suspendChannel(channelId: string, reason: string): Promise<void>;
248
- reactivateChannel(channelId: string): Promise<void>;
249
- checkChannelHealth(channelId: string): Promise<{
250
- isHealthy: boolean;
251
- issues: string[];
252
- recommendations: string[];
253
- }>;
254
- private generateChannelId;
255
- }
256
-
257
- declare class KakaoSenderNumberManager {
258
- private senderNumbers;
259
- private verificationCodes;
260
- addSenderNumber(channelId: string, request: SenderNumberCreateRequest): Promise<SenderNumber>;
261
- private validatePhoneNumber;
262
- private findSenderNumberByPhone;
263
- private initiateVerification;
264
- private sendVerificationSMS;
265
- verifySenderNumber(senderNumberId: string, code: string): Promise<boolean>;
266
- resendVerificationCode(senderNumberId: string): Promise<void>;
267
- getSenderNumber(senderNumberId: string): Promise<SenderNumber | null>;
268
- listSenderNumbers(filters?: {
269
- channelId?: string;
270
- status?: SenderNumberStatus;
271
- category?: SenderNumberCategory;
272
- verified?: boolean;
273
- }): Promise<SenderNumber[]>;
274
- updateSenderNumber(senderNumberId: string, updates: Partial<SenderNumber>): Promise<SenderNumber>;
275
- deleteSenderNumber(senderNumberId: string): Promise<boolean>;
276
- private isSenderNumberInUse;
277
- blockSenderNumber(senderNumberId: string, reason: string): Promise<void>;
278
- unblockSenderNumber(senderNumberId: string): Promise<void>;
279
- validateSenderNumberForSending(senderNumberId: string): Promise<{
280
- isValid: boolean;
281
- errors: string[];
282
- }>;
283
- private generateSenderNumberId;
284
- private generateVerificationCode;
285
- cleanup(): void;
286
- }
287
-
288
- /**
289
- * Channel CRUD Operations
290
- * 채널 생성, 조회, 수정, 삭제 통합 관리
291
- */
292
-
293
- interface PaginationOptions {
294
- page: number;
295
- limit: number;
296
- sortBy?: string;
297
- sortOrder?: 'asc' | 'desc';
298
- }
299
- interface PaginatedResult<T> {
300
- data: T[];
301
- total: number;
302
- page: number;
303
- limit: number;
304
- totalPages: number;
305
- hasNext: boolean;
306
- hasPrev: boolean;
307
- }
308
- interface ChannelCRUDOptions {
309
- enableAuditLog: boolean;
310
- enableEventEmission: boolean;
311
- defaultPageSize: number;
312
- maxPageSize: number;
313
- enableSoftDelete: boolean;
314
- autoCleanup: boolean;
315
- cleanupInterval: number;
316
- }
317
- interface AuditLogEntry {
318
- id: string;
319
- entityType: 'channel' | 'senderNumber';
320
- entityId: string;
321
- action: 'create' | 'read' | 'update' | 'delete' | 'verify' | 'suspend' | 'activate';
322
- userId?: string;
323
- timestamp: Date;
324
- changes?: {
325
- before: any;
326
- after: any;
327
- };
328
- metadata?: Record<string, any>;
329
- }
330
- declare class ChannelCRUD extends EventEmitter {
331
- private options;
332
- private channels;
333
- private senderNumbers;
334
- private auditLogs;
335
- private cleanupTimer?;
336
- private defaultOptions;
337
- constructor(options?: Partial<ChannelCRUDOptions>);
338
- createChannel(request: ChannelCreateRequest, userId?: string): Promise<Channel>;
339
- getChannel(channelId: string, userId?: string): Promise<Channel | null>;
340
- updateChannel(channelId: string, updates: Partial<Omit<Channel, 'id' | 'createdAt' | 'updatedAt'>>, userId?: string): Promise<Channel>;
341
- deleteChannel(channelId: string, userId?: string): Promise<boolean>;
342
- listChannels(filters?: ChannelFilters, pagination?: PaginationOptions): Promise<PaginatedResult<Channel>>;
343
- createSenderNumber(channelId: string, request: SenderNumberCreateRequest, userId?: string): Promise<SenderNumber>;
344
- getSenderNumber(senderNumberId: string, userId?: string): Promise<SenderNumber | null>;
345
- updateSenderNumber(senderNumberId: string, updates: Partial<Omit<SenderNumber, 'id' | 'phoneNumber' | 'createdAt' | 'updatedAt'>>, userId?: string): Promise<SenderNumber>;
346
- deleteSenderNumber(senderNumberId: string, userId?: string): Promise<boolean>;
347
- listSenderNumbers(filters?: SenderNumberFilters, pagination?: PaginationOptions): Promise<PaginatedResult<SenderNumber>>;
348
- getAuditLogs(entityType?: 'channel' | 'senderNumber', entityId?: string, limit?: number): AuditLogEntry[];
349
- getStatistics(): {
350
- channels: {
351
- total: number;
352
- byStatus: Record<string, number>;
353
- byType: Record<string, number>;
354
- byProvider: Record<string, number>;
355
- };
356
- senderNumbers: {
357
- total: number;
358
- byStatus: Record<string, number>;
359
- byCategory: Record<string, number>;
360
- };
361
- };
362
- cleanup(): {
363
- deletedChannels: number;
364
- expiredAuditLogs: number;
365
- };
366
- destroy(): void;
367
- private addAuditLog;
368
- private getDefaultLimits;
369
- private getDefaultFeatures;
370
- private startAutoCleanup;
371
- private generateChannelId;
372
- private generateSenderNumberId;
373
- private generateAuditLogId;
374
- }
375
-
376
- /**
377
- * Permission Management System
378
- * 채널 및 발신번호 액세스 권한 관리
379
- */
380
-
381
- interface User {
382
- id: string;
383
- email: string;
384
- name: string;
385
- roles: Role[];
386
- isActive: boolean;
387
- createdAt: Date;
388
- updatedAt: Date;
389
- }
390
- interface Role {
391
- id: string;
392
- name: string;
393
- permissions: Permission[];
394
- description?: string;
395
- isSystem: boolean;
396
- createdAt: Date;
397
- updatedAt: Date;
398
- }
399
- interface Permission {
400
- id: string;
401
- resource: ResourceType;
402
- action: ActionType;
403
- scope: PermissionScope;
404
- conditions?: PermissionCondition[];
405
- }
406
- declare enum ResourceType {
407
- CHANNEL = "channel",
408
- SENDER_NUMBER = "senderNumber",
409
- TEMPLATE = "template",
410
- MESSAGE = "message",
411
- USER = "user",
412
- ROLE = "role",
413
- AUDIT_LOG = "auditLog",
414
- ANALYTICS = "analytics"
415
- }
416
- declare enum ActionType {
417
- CREATE = "create",
418
- READ = "read",
419
- UPDATE = "update",
420
- DELETE = "delete",
421
- VERIFY = "verify",
422
- SUSPEND = "suspend",
423
- ACTIVATE = "activate",
424
- SEND = "send",
425
- MANAGE = "manage"
426
- }
427
- declare enum PermissionScope {
428
- GLOBAL = "global",
429
- ORGANIZATION = "organization",
430
- TEAM = "team",
431
- PERSONAL = "personal"
432
- }
433
- interface PermissionCondition {
434
- field: string;
435
- operator: 'equals' | 'not_equals' | 'in' | 'not_in' | 'contains' | 'starts_with';
436
- value: any;
437
- }
438
- interface AccessContext {
439
- userId: string;
440
- organizationId?: string;
441
- teamId?: string;
442
- resourceOwnerId?: string;
443
- metadata?: Record<string, any>;
444
- }
445
- interface PermissionCheck {
446
- userId: string;
447
- resource: ResourceType;
448
- action: ActionType;
449
- resourceId?: string;
450
- context?: AccessContext;
451
- }
452
- interface PermissionResult {
453
- granted: boolean;
454
- reason?: string;
455
- matchedPermissions: Permission[];
456
- deniedReasons: string[];
457
- }
458
- declare class PermissionManager extends EventEmitter {
459
- private users;
460
- private roles;
461
- private userRoleCache;
462
- private permissionCache;
463
- private cacheExpiry;
464
- private readonly CACHE_DURATION;
465
- constructor();
466
- createUser(userData: Omit<User, 'id' | 'createdAt' | 'updatedAt'>): Promise<User>;
467
- getUser(userId: string): Promise<User | null>;
468
- updateUser(userId: string, updates: Partial<User>): Promise<User>;
469
- deleteUser(userId: string): Promise<boolean>;
470
- createRole(roleData: Omit<Role, 'id' | 'createdAt' | 'updatedAt'>): Promise<Role>;
471
- getRole(roleId: string): Promise<Role | null>;
472
- updateRole(roleId: string, updates: Partial<Role>): Promise<Role>;
473
- deleteRole(roleId: string): Promise<boolean>;
474
- assignRoleToUser(userId: string, roleId: string): Promise<void>;
475
- removeRoleFromUser(userId: string, roleId: string): Promise<void>;
476
- checkPermission(check: PermissionCheck): Promise<PermissionResult>;
477
- hasPermission(userId: string, resource: ResourceType, action: ActionType, resourceId?: string, context?: AccessContext): Promise<boolean>;
478
- requirePermission(userId: string, resource: ResourceType, action: ActionType, resourceId?: string, context?: AccessContext): Promise<void>;
479
- getUserPermissions(userId: string): Promise<Permission[]>;
480
- getUserRoles(userId: string): Promise<Role[]>;
481
- listUsers(filters?: {
482
- isActive?: boolean;
483
- roleId?: string;
484
- }): User[];
485
- listRoles(): Role[];
486
- private performPermissionCheck;
487
- private doesPermissionMatch;
488
- private checkConditions;
489
- private evaluateCondition;
490
- private initializeSystemRoles;
491
- private updateUserRoleCache;
492
- private clearUserPermissionCache;
493
- private clearRolePermissionCache;
494
- private getCacheKey;
495
- private getFromCache;
496
- private setCache;
497
- private generateUserId;
498
- private generateRoleId;
499
- }
500
-
501
- /**
502
- * Business Verification System
503
- * 사업자 정보 및 서류 검증 시스템
504
- */
505
-
506
- interface BusinessInfo {
507
- businessName: string;
508
- businessRegistrationNumber: string;
509
- businessType: 'corporation' | 'individual' | 'partnership' | 'other';
510
- industry: string;
511
- establishedDate: Date;
512
- address: {
513
- street: string;
514
- city: string;
515
- state: string;
516
- postalCode: string;
517
- country: string;
518
- };
519
- contactInfo: {
520
- phoneNumber: string;
521
- email: string;
522
- website?: string;
523
- };
524
- representatives: Array<{
525
- name: string;
526
- position: string;
527
- phoneNumber: string;
528
- email: string;
529
- }>;
530
- }
531
- interface VerificationRequest {
532
- id: string;
533
- channelId: string;
534
- businessInfo: BusinessInfo;
535
- documents: VerificationDocument[];
536
- status: VerificationStatus;
537
- submittedAt: Date;
538
- reviewedAt?: Date;
539
- reviewedBy?: string;
540
- reviewNotes?: string;
541
- autoVerificationResults?: AutoVerificationResult[];
542
- }
543
- interface AutoVerificationResult {
544
- checkType: 'business_registry' | 'document_validation' | 'address_verification' | 'phone_verification';
545
- status: 'passed' | 'failed' | 'warning';
546
- score: number;
547
- details: string;
548
- metadata?: Record<string, any>;
549
- }
550
- interface DocumentValidationResult {
551
- isValid: boolean;
552
- confidence: number;
553
- extractedData?: Record<string, any>;
554
- issues: Array<{
555
- type: 'format' | 'content' | 'quality' | 'authenticity';
556
- severity: 'low' | 'medium' | 'high' | 'critical';
557
- message: string;
558
- }>;
559
- }
560
- interface BusinessVerifierOptions {
561
- enableAutoVerification: boolean;
562
- requiredDocuments: DocumentType[];
563
- autoApprovalThreshold: number;
564
- requireManualReview: boolean;
565
- documentRetentionDays: number;
566
- enableExternalAPIs: boolean;
567
- externalAPIConfig?: {
568
- businessRegistryAPI?: string;
569
- addressVerificationAPI?: string;
570
- documentOCRAPI?: string;
571
- };
572
- }
573
- declare class BusinessVerifier extends EventEmitter {
574
- private options;
575
- private verificationRequests;
576
- private documentValidators;
577
- private defaultOptions;
578
- constructor(options?: Partial<BusinessVerifierOptions>);
579
- /**
580
- * Submit business verification request
581
- */
582
- submitVerification(channelId: string, businessInfo: BusinessInfo, documents: VerificationDocument[]): Promise<VerificationRequest>;
583
- /**
584
- * Get verification request by ID
585
- */
586
- getVerificationRequest(requestId: string): VerificationRequest | null;
587
- /**
588
- * Get verification request by channel ID
589
- */
590
- getVerificationByChannelId(channelId: string): VerificationRequest | null;
591
- /**
592
- * Manually approve verification
593
- */
594
- approveVerification(requestId: string, reviewerId: string, notes?: string): Promise<VerificationRequest>;
595
- /**
596
- * Manually reject verification
597
- */
598
- rejectVerification(requestId: string, reviewerId: string, reason: string): Promise<VerificationRequest>;
599
- /**
600
- * Update verification request with additional documents
601
- */
602
- addDocument(requestId: string, document: VerificationDocument): Promise<VerificationRequest>;
603
- /**
604
- * List verification requests with filters
605
- */
606
- listVerificationRequests(filters?: {
607
- status?: VerificationStatus;
608
- channelId?: string;
609
- submittedAfter?: Date;
610
- submittedBefore?: Date;
611
- }): VerificationRequest[];
612
- /**
613
- * Get verification statistics
614
- */
615
- getVerificationStats(): {
616
- total: number;
617
- byStatus: Record<string, number>;
618
- averageProcessingTime: number;
619
- autoApprovalRate: number;
620
- };
621
- private processAutoVerification;
622
- private validateRequiredDocuments;
623
- private verifyBusinessRegistration;
624
- private calculateBusinessRegistrationScore;
625
- private validateDocument;
626
- private verifyAddress;
627
- private verifyPhoneNumber;
628
- private initializeDocumentValidators;
629
- private generateRequestId;
630
- }
631
-
632
- /**
633
- * Phone Number Verification System
634
- * 발신번호 인증 및 검증 시스템
635
- */
636
-
637
- interface PhoneVerificationRequest {
638
- id: string;
639
- senderNumberId: string;
640
- phoneNumber: string;
641
- verificationType: VerificationType;
642
- verificationCode: string;
643
- status: PhoneVerificationStatus;
644
- attempts: VerificationAttempt[];
645
- expiresAt: Date;
646
- createdAt: Date;
647
- completedAt?: Date;
648
- metadata: {
649
- userAgent?: string;
650
- ipAddress?: string;
651
- deviceId?: string;
652
- smsProvider?: string;
653
- callProvider?: string;
654
- };
655
- }
656
- interface VerificationAttempt {
657
- attemptNumber: number;
658
- attemptedAt: Date;
659
- method: VerificationMethod;
660
- status: 'sent' | 'delivered' | 'failed' | 'verified' | 'expired';
661
- failureReason?: string;
662
- responseTime?: number;
663
- }
664
- declare enum VerificationType {
665
- SMS = "sms",
666
- VOICE_CALL = "voice_call",
667
- HYBRID = "hybrid"
668
- }
669
- declare enum VerificationMethod {
670
- SMS = "sms",
671
- VOICE_CALL = "voice_call",
672
- MISSED_CALL = "missed_call"
673
- }
674
- declare enum PhoneVerificationStatus {
675
- PENDING = "pending",
676
- CODE_SENT = "code_sent",
677
- VERIFIED = "verified",
678
- FAILED = "failed",
679
- EXPIRED = "expired",
680
- BLOCKED = "blocked"
681
- }
682
- interface NumberVerifierOptions {
683
- codeLength: number;
684
- codeExpiryMinutes: number;
685
- maxAttempts: number;
686
- maxDailyAttempts: number;
687
- smsTemplate: string;
688
- voiceTemplate: string;
689
- rateLimitMinutes: number;
690
- enableVoiceFallback: boolean;
691
- enableMissedCallVerification: boolean;
692
- blockedNumbers: string[];
693
- allowedCountries: string[];
694
- smsProvider?: SMSProvider;
695
- voiceProvider?: VoiceProvider;
696
- }
697
- interface SMSProvider {
698
- id: string;
699
- name: string;
700
- sendSMS(phoneNumber: string, message: string, options?: any): Promise<SMSResult>;
701
- getDeliveryStatus?(messageId: string): Promise<DeliveryStatus>;
702
- }
703
- interface VoiceProvider {
704
- id: string;
705
- name: string;
706
- makeCall(phoneNumber: string, message: string, options?: any): Promise<VoiceResult>;
707
- makeMissedCall?(phoneNumber: string, options?: any): Promise<MissedCallResult>;
708
- }
709
- interface SMSResult {
710
- messageId: string;
711
- status: 'sent' | 'failed';
712
- cost?: number;
713
- error?: string;
714
- }
715
- interface VoiceResult {
716
- callId: string;
717
- status: 'initiated' | 'answered' | 'failed' | 'busy' | 'no_answer';
718
- duration?: number;
719
- cost?: number;
720
- error?: string;
721
- }
722
- interface MissedCallResult {
723
- callId: string;
724
- status: 'initiated' | 'completed' | 'failed';
725
- missedCallNumber?: string;
726
- error?: string;
727
- }
728
- interface DeliveryStatus {
729
- messageId: string;
730
- status: 'pending' | 'delivered' | 'failed' | 'expired';
731
- deliveredAt?: Date;
732
- failureReason?: string;
733
- }
734
- interface PhoneNumberInfo {
735
- phoneNumber: string;
736
- countryCode: string;
737
- nationalNumber: string;
738
- carrier?: string;
739
- lineType?: 'mobile' | 'landline' | 'voip' | 'unknown';
740
- isValid: boolean;
741
- isPossible: boolean;
742
- region?: string;
743
- }
744
- declare class NumberVerifier extends EventEmitter {
745
- private options;
746
- private verificationRequests;
747
- private phoneNumberCache;
748
- private rateLimitTracker;
749
- private dailyAttemptTracker;
750
- private blockedNumbers;
751
- private defaultOptions;
752
- constructor(options?: Partial<NumberVerifierOptions>);
753
- /**
754
- * Start phone number verification process
755
- */
756
- startVerification(senderNumberId: string, phoneNumber: string, verificationType?: VerificationType, metadata?: PhoneVerificationRequest['metadata']): Promise<PhoneVerificationRequest>;
757
- /**
758
- * Verify the provided code
759
- */
760
- verifyCode(requestId: string, providedCode: string): Promise<{
761
- success: boolean;
762
- status: PhoneVerificationStatus;
763
- message: string;
764
- }>;
765
- /**
766
- * Resend verification code
767
- */
768
- resendCode(requestId: string, method?: VerificationMethod): Promise<PhoneVerificationRequest>;
769
- /**
770
- * Get verification request status
771
- */
772
- getVerificationStatus(requestId: string): PhoneVerificationRequest | null;
773
- /**
774
- * Cancel verification request
775
- */
776
- cancelVerification(requestId: string): Promise<boolean>;
777
- /**
778
- * Block a phone number from verification
779
- */
780
- blockPhoneNumber(phoneNumber: string, reason?: string): void;
781
- /**
782
- * Unblock a phone number
783
- */
784
- unblockPhoneNumber(phoneNumber: string): void;
785
- /**
786
- * Get verification statistics
787
- */
788
- getVerificationStats(): {
789
- total: number;
790
- byStatus: Record<string, number>;
791
- byMethod: Record<string, number>;
792
- successRate: number;
793
- averageCompletionTime: number;
794
- };
795
- /**
796
- * Clean up expired verification requests
797
- */
798
- cleanup(): number;
799
- private sendVerificationCode;
800
- private sendVerificationByMethod;
801
- private sendSMS;
802
- private sendVoiceCall;
803
- private sendMissedCall;
804
- private getPhoneNumberInfo;
805
- private parseKoreanPhoneNumber;
806
- private isNumberBlocked;
807
- private isRateLimited;
808
- private isDailyLimitExceeded;
809
- private updateRateLimit;
810
- private updateDailyAttempts;
811
- private validateCode;
812
- private generateVerificationCode;
813
- private generateRequestId;
814
- }
815
-
816
- interface ServiceSenderNumber {
817
- phoneNumber: string;
818
- name?: string;
819
- verifiedAt?: Date;
820
- status: SenderNumberStatus;
821
- channelId: string;
822
- }
823
- declare class ChannelService {
824
- private channels;
825
- private senderNumbers;
826
- createChannel(channel: Omit<ChannelConfig, 'id' | 'createdAt' | 'updatedAt'>): Promise<ChannelConfig>;
827
- getChannel(channelId: string): Promise<ChannelConfig | null>;
828
- listChannels(providerId?: string): Promise<ChannelConfig[]>;
829
- updateChannel(channelId: string, updates: Partial<ChannelConfig>): Promise<ChannelConfig>;
830
- deleteChannel(channelId: string): Promise<void>;
831
- addSenderNumber(channelId: string, phoneNumber: string, name?: string): Promise<ServiceSenderNumber>;
832
- verifySenderNumber(phoneNumber: string): Promise<ChannelVerificationResult>;
833
- getSenderNumbers(channelId?: string): Promise<ServiceSenderNumber[]>;
834
- private generateChannelId;
835
- }
836
-
837
- export { type AccessContext, ActionType, type AuditLogEntry, type AutoVerificationResult, type BusinessInfo, BusinessVerifier, type BusinessVerifierOptions, type Channel, ChannelCRUD, type ChannelCRUDOptions, type ChannelConfig, type ChannelCreateRequest, ChannelCreateRequestSchema, type ChannelCreateRequestType, type ChannelFilters, ChannelFiltersSchema, type ChannelFiltersType, type ChannelMetadata, ChannelService, ChannelStatus, ChannelType, type ChannelVerification, type ChannelVerificationResult, DocumentStatus, DocumentType, type DocumentValidationResult, KakaoChannelManager, KakaoSenderNumberManager, NumberVerifier, type NumberVerifierOptions, type PaginatedResult, type PaginationOptions, type Permission, type PermissionCheck, PermissionManager, type PermissionResult, PermissionScope, type PhoneNumberInfo, type PhoneVerificationRequest, PhoneVerificationStatus, ResourceType, type Role, type SMSProvider, type SenderNumber, SenderNumberCategory, type SenderNumberCreateRequest, SenderNumberCreateRequestSchema, type SenderNumberCreateRequestType, type SenderNumberFilters, SenderNumberFiltersSchema, type SenderNumberFiltersType, SenderNumberStatus, type User, type VerificationAttempt, type VerificationDocument, VerificationMethod, type VerificationRequest, VerificationStatus, VerificationType, type VoiceProvider };
1
+ export { KakaoChannelManager } from "./kakao/channel";
2
+ export { KakaoSenderNumberManager } from "./kakao/sender-number";
3
+ export { type AuditLogEntry, ChannelCRUD, type ChannelCRUDOptions, type PaginatedResult, type PaginationOptions, } from "./management/crud";
4
+ export { type AccessContext, ActionType, type Permission, type PermissionCheck, PermissionManager, type PermissionResult, PermissionScope, ResourceType, type Role, type User, } from "./management/permissions";
5
+ export { ChannelService } from "./services/channel.service";
6
+ export * from "./types/channel.types";
7
+ export { type AutoVerificationResult, type BusinessInfo, BusinessVerifier, type BusinessVerifierOptions, type DocumentValidationResult, type VerificationRequest, } from "./verification/business.verify";
8
+ export { NumberVerifier, type NumberVerifierOptions, type PhoneNumberInfo, type PhoneVerificationRequest, type PhoneVerificationStatus, type SMSProvider, type VerificationAttempt, VerificationMethod, VerificationType, type VoiceProvider, } from "./verification/number.verify";