@k-msg/provider 0.1.0 → 0.1.2
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/README.md +3 -1
- package/dist/abstract/provider.base.d.ts +108 -0
- package/dist/adapters/aligo.adapter.d.ts +50 -0
- package/dist/adapters/iwinv.adapter.d.ts +111 -0
- package/dist/aligo/provider.d.ts +18 -0
- package/dist/config/provider-config-v2.d.ts +122 -0
- package/dist/contracts/provider.contract.d.ts +355 -0
- package/dist/contracts/sms.contract.d.ts +135 -0
- package/dist/index.d.ts +29 -1424
- package/dist/index.js +21 -2003
- package/dist/index.js.map +98 -1
- package/dist/index.mjs +25 -0
- package/dist/index.mjs.map +98 -0
- package/dist/interfaces/index.d.ts +14 -0
- package/dist/interfaces/plugin.d.ts +122 -0
- package/dist/interfaces/services.d.ts +222 -0
- package/dist/iwinv/contracts/account.contract.d.ts +11 -0
- package/dist/iwinv/contracts/analytics.contract.d.ts +16 -0
- package/dist/iwinv/contracts/channel.contract.d.ts +15 -0
- package/dist/iwinv/contracts/messaging.contract.d.ts +14 -0
- package/dist/iwinv/contracts/sms.contract.d.ts +33 -0
- package/dist/iwinv/contracts/template.contract.d.ts +18 -0
- package/dist/iwinv/index.d.ts +5 -0
- package/dist/iwinv/provider-multi.d.ts +116 -0
- package/dist/iwinv/provider-sms.d.ts +55 -0
- package/dist/iwinv/provider.d.ts +42 -0
- package/dist/iwinv/types/iwinv.d.ts +153 -0
- package/dist/middleware/index.d.ts +27 -0
- package/dist/mock/index.d.ts +1 -0
- package/dist/providers/mock/index.d.ts +1 -0
- package/dist/providers/mock/mock.provider.d.ts +22 -0
- package/dist/registry/index.d.ts +1 -0
- package/dist/registry/plugin-registry.d.ts +15 -0
- package/dist/services/provider.manager.d.ts +24 -0
- package/dist/services/provider.service.d.ts +49 -0
- package/dist/test-helpers.d.ts +110 -0
- package/dist/types/aligo.d.ts +69 -0
- package/dist/types/base.d.ts +172 -0
- package/dist/types/typed-templates.d.ts +199 -0
- package/dist/types/unified-config.d.ts +197 -0
- package/dist/types/unified-errors.d.ts +225 -0
- package/dist/utils/base-plugin.d.ts +35 -0
- package/dist/utils/index.d.ts +12 -0
- package/package.json +25 -14
- package/dist/index.cjs +0 -2061
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1425
package/dist/index.d.cts
DELETED
|
@@ -1,1425 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { BaseProvider as BaseProvider$1 } from '@k-msg/core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 공통 프로바이더 인터페이스와 타입 정의
|
|
6
|
-
* 모든 K-Message 프로바이더가 구현해야 하는 기본 인터페이스
|
|
7
|
-
* 알림톡, 친구톡, SMS, LMS 등 다양한 메시징 채널 지원
|
|
8
|
-
*/
|
|
9
|
-
declare enum MessageChannel {
|
|
10
|
-
ALIMTALK = "alimtalk",// 카카오 알림톡
|
|
11
|
-
FRIENDTALK = "friendtalk",// 카카오 친구톡
|
|
12
|
-
SMS = "sms",// 단문 메시지
|
|
13
|
-
LMS = "lms",// 장문 메시지
|
|
14
|
-
MMS = "mms",// 멀티미디어 메시지
|
|
15
|
-
PUSH = "push",// 푸시 알림
|
|
16
|
-
EMAIL = "email"
|
|
17
|
-
}
|
|
18
|
-
declare enum MessageType {
|
|
19
|
-
TEXT = "text",// 텍스트만
|
|
20
|
-
RICH = "rich",// 리치 메시지 (버튼, 이미지 등)
|
|
21
|
-
TEMPLATE = "template",// 템플릿 기반
|
|
22
|
-
CUSTOM = "custom"
|
|
23
|
-
}
|
|
24
|
-
interface SendOptions {
|
|
25
|
-
channel?: MessageChannel;
|
|
26
|
-
messageType?: MessageType;
|
|
27
|
-
reserve?: boolean;
|
|
28
|
-
sendDate?: Date | string;
|
|
29
|
-
timezone?: string;
|
|
30
|
-
senderKey?: string;
|
|
31
|
-
senderNumber?: string;
|
|
32
|
-
senderName?: string;
|
|
33
|
-
enableFallback?: boolean;
|
|
34
|
-
fallbackChannel?: MessageChannel;
|
|
35
|
-
fallbackContent?: string;
|
|
36
|
-
fallbackTitle?: string;
|
|
37
|
-
title?: string;
|
|
38
|
-
subject?: string;
|
|
39
|
-
priority?: 'high' | 'normal' | 'low';
|
|
40
|
-
trackingId?: string;
|
|
41
|
-
campaignId?: string;
|
|
42
|
-
tags?: string[];
|
|
43
|
-
attachments?: MediaAttachment[];
|
|
44
|
-
metadata?: Record<string, any>;
|
|
45
|
-
}
|
|
46
|
-
interface MediaAttachment {
|
|
47
|
-
type: 'image' | 'video' | 'audio' | 'document';
|
|
48
|
-
url: string;
|
|
49
|
-
filename?: string;
|
|
50
|
-
size?: number;
|
|
51
|
-
mimeType?: string;
|
|
52
|
-
}
|
|
53
|
-
interface TemplateFilters$1 {
|
|
54
|
-
templateCode?: string;
|
|
55
|
-
templateName?: string;
|
|
56
|
-
templateStatus?: string;
|
|
57
|
-
[key: string]: any;
|
|
58
|
-
}
|
|
59
|
-
interface HistoryFilters {
|
|
60
|
-
reserve?: 'Y' | 'N' | boolean;
|
|
61
|
-
startDate?: string | Date;
|
|
62
|
-
endDate?: string | Date;
|
|
63
|
-
messageId?: number | string;
|
|
64
|
-
phone?: string;
|
|
65
|
-
[key: string]: any;
|
|
66
|
-
}
|
|
67
|
-
interface HealthCheckResult {
|
|
68
|
-
healthy: boolean;
|
|
69
|
-
issues: string[];
|
|
70
|
-
data?: {
|
|
71
|
-
balance?: number;
|
|
72
|
-
status: string;
|
|
73
|
-
code?: number;
|
|
74
|
-
message?: string;
|
|
75
|
-
} | null;
|
|
76
|
-
}
|
|
77
|
-
interface SendResult {
|
|
78
|
-
success: boolean;
|
|
79
|
-
messageId: string | null;
|
|
80
|
-
status: string;
|
|
81
|
-
error: string | null;
|
|
82
|
-
}
|
|
83
|
-
interface TemplateResult {
|
|
84
|
-
success: boolean;
|
|
85
|
-
templateCode: string | null;
|
|
86
|
-
status: string;
|
|
87
|
-
error: string | null;
|
|
88
|
-
}
|
|
89
|
-
interface BaseProvider<TConfig = any> {
|
|
90
|
-
readonly id: string;
|
|
91
|
-
readonly name: string;
|
|
92
|
-
readonly supportedChannels: MessageChannel[];
|
|
93
|
-
readonly supportedTypes: MessageType[];
|
|
94
|
-
healthCheck(): Promise<HealthCheckResult>;
|
|
95
|
-
sendMessage?(recipient: string, // 수신자 (전화번호 또는 이메일)
|
|
96
|
-
content: MessageContent, options?: SendOptions): Promise<SendResult>;
|
|
97
|
-
sendTemplateMessage?(templateCode: string, phoneNumber: string, variables: Record<string, any>, options?: SendOptions): Promise<SendResult>;
|
|
98
|
-
createTemplate?(template: TemplateCreateRequest$1): Promise<TemplateResult>;
|
|
99
|
-
getTemplates?(pageNum?: number, pageSize?: number, filters?: TemplateFilters$1): Promise<any>;
|
|
100
|
-
modifyTemplate?(templateCode: string, template: TemplateUpdateRequest$1): Promise<TemplateResult>;
|
|
101
|
-
deleteTemplate?(templateCode: string): Promise<any>;
|
|
102
|
-
getHistory?(pageNum?: number, pageSize?: number, filters?: HistoryFilters): Promise<any>;
|
|
103
|
-
cancelReservation?(messageId: number | string): Promise<any>;
|
|
104
|
-
getSenderNumbers?(): Promise<SenderNumber$1[]>;
|
|
105
|
-
verifySenderNumber?(phoneNumber: string): Promise<SenderVerificationResult>;
|
|
106
|
-
getChannelInfo?(channel: MessageChannel): Promise<ChannelInfo>;
|
|
107
|
-
}
|
|
108
|
-
interface MessageContent {
|
|
109
|
-
channel?: MessageChannel;
|
|
110
|
-
type?: MessageType;
|
|
111
|
-
text: string;
|
|
112
|
-
title?: string;
|
|
113
|
-
templateId?: string;
|
|
114
|
-
variables?: Record<string, any>;
|
|
115
|
-
buttons?: MessageButton[];
|
|
116
|
-
attachments?: MediaAttachment[];
|
|
117
|
-
}
|
|
118
|
-
interface MessageButton {
|
|
119
|
-
type: 'web' | 'app' | 'phone' | 'delivery';
|
|
120
|
-
text: string;
|
|
121
|
-
url?: string;
|
|
122
|
-
scheme?: string;
|
|
123
|
-
phoneNumber?: string;
|
|
124
|
-
}
|
|
125
|
-
interface TemplateCreateRequest$1 {
|
|
126
|
-
name: string;
|
|
127
|
-
content: string;
|
|
128
|
-
channel: MessageChannel;
|
|
129
|
-
category?: string;
|
|
130
|
-
buttons?: MessageButton[];
|
|
131
|
-
variables?: string[];
|
|
132
|
-
description?: string;
|
|
133
|
-
}
|
|
134
|
-
interface TemplateUpdateRequest$1 {
|
|
135
|
-
name?: string;
|
|
136
|
-
content?: string;
|
|
137
|
-
buttons?: MessageButton[];
|
|
138
|
-
description?: string;
|
|
139
|
-
}
|
|
140
|
-
interface SenderNumber$1 {
|
|
141
|
-
phoneNumber: string;
|
|
142
|
-
name?: string;
|
|
143
|
-
verified: boolean;
|
|
144
|
-
verifiedAt?: Date;
|
|
145
|
-
status: 'active' | 'pending' | 'rejected' | 'blocked';
|
|
146
|
-
}
|
|
147
|
-
interface SenderVerificationResult {
|
|
148
|
-
success: boolean;
|
|
149
|
-
phoneNumber: string;
|
|
150
|
-
status: string;
|
|
151
|
-
verificationCode?: string;
|
|
152
|
-
error?: string;
|
|
153
|
-
}
|
|
154
|
-
interface ChannelInfo {
|
|
155
|
-
channel: MessageChannel;
|
|
156
|
-
available: boolean;
|
|
157
|
-
limits: {
|
|
158
|
-
maxLength?: number;
|
|
159
|
-
maxAttachments?: number;
|
|
160
|
-
maxAttachmentSize?: number;
|
|
161
|
-
};
|
|
162
|
-
features: {
|
|
163
|
-
supportsButtons: boolean;
|
|
164
|
-
supportsAttachments: boolean;
|
|
165
|
-
supportsTemplates: boolean;
|
|
166
|
-
supportsScheduling: boolean;
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
interface BaseProviderConfig {
|
|
170
|
-
apiKey: string;
|
|
171
|
-
baseUrl?: string;
|
|
172
|
-
debug?: boolean;
|
|
173
|
-
timeout?: number;
|
|
174
|
-
retries?: number;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
interface MessagingService {
|
|
178
|
-
sendMessage(params: SendMessageParams): Promise<SendMessageResult>;
|
|
179
|
-
sendBulk(params: BulkMessageParams): Promise<BulkMessageResult>;
|
|
180
|
-
getDeliveryStatus?(messageId: string): Promise<DeliveryStatus>;
|
|
181
|
-
}
|
|
182
|
-
interface SchedulingService {
|
|
183
|
-
schedule(params: ScheduleMessageParams): Promise<ScheduleResult$1>;
|
|
184
|
-
cancelSchedule(params: CancelScheduleParams): Promise<void>;
|
|
185
|
-
modifySchedule?(params: ModifyScheduleParams): Promise<ScheduleResult$1>;
|
|
186
|
-
}
|
|
187
|
-
interface TemplatingService {
|
|
188
|
-
createTemplate(params: TemplateParams): Promise<Template$1>;
|
|
189
|
-
updateTemplate(templateId: string, params: TemplateParams): Promise<Template$1>;
|
|
190
|
-
deleteTemplate(templateId: string): Promise<void>;
|
|
191
|
-
getTemplate(templateId: string): Promise<Template$1>;
|
|
192
|
-
listTemplates(params?: ListTemplatesParams): Promise<TemplateList>;
|
|
193
|
-
validateTemplate(params: TemplateParams): Promise<ValidationResult>;
|
|
194
|
-
}
|
|
195
|
-
interface AnalyticsService {
|
|
196
|
-
getStats(params: AnalyticsParams): Promise<AnalyticsData>;
|
|
197
|
-
getDeliveryReport(messageId: string): Promise<DeliveryReport$1>;
|
|
198
|
-
}
|
|
199
|
-
interface WebhookService {
|
|
200
|
-
registerWebhook(params: WebhookParams): Promise<WebhookRegistration>;
|
|
201
|
-
updateWebhook(webhookId: string, params: WebhookParams): Promise<WebhookRegistration>;
|
|
202
|
-
deleteWebhook(webhookId: string): Promise<void>;
|
|
203
|
-
listWebhooks(): Promise<WebhookRegistration[]>;
|
|
204
|
-
}
|
|
205
|
-
interface BalanceService {
|
|
206
|
-
getBalance(): Promise<BalanceInfo>;
|
|
207
|
-
getRate?(): Promise<RateInfo>;
|
|
208
|
-
}
|
|
209
|
-
interface HistoryService {
|
|
210
|
-
getHistory(params: HistoryParams): Promise<HistoryList>;
|
|
211
|
-
getMessageDetail(messageId: string): Promise<MessageDetail>;
|
|
212
|
-
}
|
|
213
|
-
interface SendMessageParams {
|
|
214
|
-
to: string;
|
|
215
|
-
templateId?: string;
|
|
216
|
-
message?: string;
|
|
217
|
-
variables?: Record<string, string>;
|
|
218
|
-
resend?: ResendConfig;
|
|
219
|
-
}
|
|
220
|
-
interface BulkMessageParams {
|
|
221
|
-
templateId: string;
|
|
222
|
-
messages: Array<{
|
|
223
|
-
to: string;
|
|
224
|
-
variables?: Record<string, string>;
|
|
225
|
-
}>;
|
|
226
|
-
resend?: ResendConfig;
|
|
227
|
-
}
|
|
228
|
-
interface ResendConfig {
|
|
229
|
-
from: string;
|
|
230
|
-
content?: string;
|
|
231
|
-
title?: string;
|
|
232
|
-
}
|
|
233
|
-
interface SendMessageResult {
|
|
234
|
-
messageId: string;
|
|
235
|
-
status: 'SUCCESS' | 'FAILED' | 'PENDING';
|
|
236
|
-
statusCode?: string;
|
|
237
|
-
remainingBalance?: number;
|
|
238
|
-
creditsUsed?: number;
|
|
239
|
-
}
|
|
240
|
-
interface BulkMessageResult {
|
|
241
|
-
messageIds: string[];
|
|
242
|
-
successCount: number;
|
|
243
|
-
failureCount: number;
|
|
244
|
-
results: Array<{
|
|
245
|
-
status: 'SUCCESS' | 'FAILED';
|
|
246
|
-
statusCode?: string;
|
|
247
|
-
messageId?: string;
|
|
248
|
-
}>;
|
|
249
|
-
remainingBalance?: number;
|
|
250
|
-
creditsUsed?: number;
|
|
251
|
-
}
|
|
252
|
-
interface ScheduleMessageParams {
|
|
253
|
-
templateId: string;
|
|
254
|
-
messages: Array<{
|
|
255
|
-
to: string;
|
|
256
|
-
variables?: Record<string, string>;
|
|
257
|
-
}>;
|
|
258
|
-
scheduledAt: Date;
|
|
259
|
-
resend?: ResendConfig;
|
|
260
|
-
}
|
|
261
|
-
interface ScheduleResult$1 {
|
|
262
|
-
scheduleId: string;
|
|
263
|
-
scheduledAt: Date;
|
|
264
|
-
messageCount: number;
|
|
265
|
-
}
|
|
266
|
-
interface CancelScheduleParams {
|
|
267
|
-
scheduleId: string;
|
|
268
|
-
}
|
|
269
|
-
interface ModifyScheduleParams {
|
|
270
|
-
scheduleId: string;
|
|
271
|
-
scheduledAt?: Date;
|
|
272
|
-
messages?: Array<{
|
|
273
|
-
to: string;
|
|
274
|
-
variables?: Record<string, string>;
|
|
275
|
-
}>;
|
|
276
|
-
}
|
|
277
|
-
interface TemplateParams {
|
|
278
|
-
name: string;
|
|
279
|
-
content: string;
|
|
280
|
-
variables?: string[];
|
|
281
|
-
buttons?: TemplateButton[];
|
|
282
|
-
}
|
|
283
|
-
interface TemplateButton {
|
|
284
|
-
type: string;
|
|
285
|
-
name: string;
|
|
286
|
-
linkMobile?: string;
|
|
287
|
-
linkPc?: string;
|
|
288
|
-
linkIos?: string;
|
|
289
|
-
linkAndroid?: string;
|
|
290
|
-
}
|
|
291
|
-
interface Template$1 {
|
|
292
|
-
id: string;
|
|
293
|
-
name: string;
|
|
294
|
-
content: string;
|
|
295
|
-
status: 'ACTIVE' | 'PENDING' | 'REJECTED';
|
|
296
|
-
variables: string[];
|
|
297
|
-
buttons?: TemplateButton[];
|
|
298
|
-
createdAt: Date;
|
|
299
|
-
updatedAt: Date;
|
|
300
|
-
}
|
|
301
|
-
interface ListTemplatesParams {
|
|
302
|
-
page?: number;
|
|
303
|
-
pageSize?: number;
|
|
304
|
-
templateCode?: string;
|
|
305
|
-
templateName?: string;
|
|
306
|
-
status?: string;
|
|
307
|
-
}
|
|
308
|
-
interface TemplateList {
|
|
309
|
-
items: Template$1[];
|
|
310
|
-
totalCount: number;
|
|
311
|
-
currentPage: number;
|
|
312
|
-
totalPages: number;
|
|
313
|
-
}
|
|
314
|
-
interface ValidationResult {
|
|
315
|
-
valid: boolean;
|
|
316
|
-
errors?: string[];
|
|
317
|
-
}
|
|
318
|
-
interface DeliveryStatus {
|
|
319
|
-
messageId: string;
|
|
320
|
-
status: 'PENDING' | 'SENT' | 'DELIVERED' | 'FAILED' | 'EXPIRED';
|
|
321
|
-
sentAt?: Date;
|
|
322
|
-
deliveredAt?: Date;
|
|
323
|
-
failureReason?: string;
|
|
324
|
-
}
|
|
325
|
-
interface AnalyticsParams {
|
|
326
|
-
startDate: Date;
|
|
327
|
-
endDate: Date;
|
|
328
|
-
templateIds?: string[];
|
|
329
|
-
metrics?: string[];
|
|
330
|
-
}
|
|
331
|
-
interface AnalyticsData {
|
|
332
|
-
sent: number;
|
|
333
|
-
delivered: number;
|
|
334
|
-
failed: number;
|
|
335
|
-
deliveryRate: number;
|
|
336
|
-
templateStats?: Record<string, any>;
|
|
337
|
-
}
|
|
338
|
-
interface DeliveryReport$1 {
|
|
339
|
-
messageId: string;
|
|
340
|
-
templateId?: string;
|
|
341
|
-
recipient: string;
|
|
342
|
-
status: string;
|
|
343
|
-
sentAt: Date;
|
|
344
|
-
deliveredAt?: Date;
|
|
345
|
-
events: Array<{
|
|
346
|
-
timestamp: Date;
|
|
347
|
-
event: string;
|
|
348
|
-
description?: string;
|
|
349
|
-
}>;
|
|
350
|
-
}
|
|
351
|
-
interface WebhookParams {
|
|
352
|
-
url: string;
|
|
353
|
-
events: string[];
|
|
354
|
-
secretKey?: string;
|
|
355
|
-
}
|
|
356
|
-
interface WebhookRegistration {
|
|
357
|
-
id: string;
|
|
358
|
-
url: string;
|
|
359
|
-
events: string[];
|
|
360
|
-
isActive: boolean;
|
|
361
|
-
createdAt: Date;
|
|
362
|
-
}
|
|
363
|
-
interface BalanceInfo {
|
|
364
|
-
amount: number;
|
|
365
|
-
currency: string;
|
|
366
|
-
lastUpdated: Date;
|
|
367
|
-
}
|
|
368
|
-
interface RateInfo {
|
|
369
|
-
messageRate: number;
|
|
370
|
-
currency: string;
|
|
371
|
-
unit: string;
|
|
372
|
-
}
|
|
373
|
-
interface HistoryParams {
|
|
374
|
-
startDate?: Date;
|
|
375
|
-
endDate?: Date;
|
|
376
|
-
phoneNumber?: string;
|
|
377
|
-
templateId?: string;
|
|
378
|
-
status?: string;
|
|
379
|
-
page?: number;
|
|
380
|
-
pageSize?: number;
|
|
381
|
-
}
|
|
382
|
-
interface HistoryList {
|
|
383
|
-
items: MessageDetail[];
|
|
384
|
-
totalCount: number;
|
|
385
|
-
currentPage: number;
|
|
386
|
-
totalPages: number;
|
|
387
|
-
}
|
|
388
|
-
interface MessageDetail {
|
|
389
|
-
messageId: string;
|
|
390
|
-
phoneNumber: string;
|
|
391
|
-
templateId?: string;
|
|
392
|
-
content: string;
|
|
393
|
-
status: string;
|
|
394
|
-
sentAt: Date;
|
|
395
|
-
deliveredAt?: Date;
|
|
396
|
-
failureReason?: string;
|
|
397
|
-
creditsUsed: number;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
interface ProviderPlugin {
|
|
401
|
-
readonly metadata: ProviderMetadata;
|
|
402
|
-
readonly capabilities: ProviderCapabilities$1;
|
|
403
|
-
initialize(context: PluginContext): Promise<void>;
|
|
404
|
-
destroy(): Promise<void>;
|
|
405
|
-
middleware?: ProviderMiddleware[];
|
|
406
|
-
getImplementation(): ProviderImplementation;
|
|
407
|
-
}
|
|
408
|
-
interface ProviderMetadata {
|
|
409
|
-
name: string;
|
|
410
|
-
version: string;
|
|
411
|
-
author: string;
|
|
412
|
-
description: string;
|
|
413
|
-
homepage?: string;
|
|
414
|
-
repository?: string;
|
|
415
|
-
}
|
|
416
|
-
interface ProviderCapabilities$1 {
|
|
417
|
-
messaging: {
|
|
418
|
-
single: boolean;
|
|
419
|
-
bulk: boolean;
|
|
420
|
-
maxBulkSize?: number;
|
|
421
|
-
maxMessageLength?: number;
|
|
422
|
-
variableSupport?: boolean;
|
|
423
|
-
maxVariables?: number;
|
|
424
|
-
};
|
|
425
|
-
scheduling?: {
|
|
426
|
-
supported: boolean;
|
|
427
|
-
maxAdvanceDays?: number;
|
|
428
|
-
minAdvanceMinutes?: number;
|
|
429
|
-
modifiable?: boolean;
|
|
430
|
-
cancellable?: boolean;
|
|
431
|
-
};
|
|
432
|
-
templating?: {
|
|
433
|
-
supported: boolean;
|
|
434
|
-
crud: boolean;
|
|
435
|
-
validation: boolean;
|
|
436
|
-
buttonTypes?: string[];
|
|
437
|
-
maxButtons?: number;
|
|
438
|
-
reviewRequired?: boolean;
|
|
439
|
-
reviewTime?: string;
|
|
440
|
-
};
|
|
441
|
-
resending?: {
|
|
442
|
-
supported: boolean;
|
|
443
|
-
fallbackTypes?: string[];
|
|
444
|
-
customContent?: boolean;
|
|
445
|
-
};
|
|
446
|
-
webhooks?: {
|
|
447
|
-
delivery: boolean;
|
|
448
|
-
status: boolean;
|
|
449
|
-
};
|
|
450
|
-
rateLimit?: {
|
|
451
|
-
messagesPerSecond?: number;
|
|
452
|
-
messagesPerMinute?: number;
|
|
453
|
-
messagesPerHour?: number;
|
|
454
|
-
messagesPerDay?: number;
|
|
455
|
-
};
|
|
456
|
-
}
|
|
457
|
-
interface PluginContext {
|
|
458
|
-
config: ProviderConfig;
|
|
459
|
-
logger: Logger;
|
|
460
|
-
metrics: MetricsCollector;
|
|
461
|
-
storage: PluginStorage;
|
|
462
|
-
eventBus: EventEmitter;
|
|
463
|
-
}
|
|
464
|
-
interface ProviderConfig {
|
|
465
|
-
apiUrl: string;
|
|
466
|
-
apiKey?: string;
|
|
467
|
-
secretKey?: string;
|
|
468
|
-
userId?: string;
|
|
469
|
-
senderKey?: string;
|
|
470
|
-
plusFriendId?: string;
|
|
471
|
-
headers?: Record<string, string>;
|
|
472
|
-
customFields?: Record<string, any>;
|
|
473
|
-
timeout?: number;
|
|
474
|
-
retryConfig?: RetryConfig;
|
|
475
|
-
logLevel?: string;
|
|
476
|
-
}
|
|
477
|
-
interface RetryConfig {
|
|
478
|
-
maxRetries: number;
|
|
479
|
-
retryDelay: number;
|
|
480
|
-
retryableErrors?: string[];
|
|
481
|
-
retryableStatusCodes?: number[];
|
|
482
|
-
}
|
|
483
|
-
interface Logger {
|
|
484
|
-
info(message: string, ...args: any[]): void;
|
|
485
|
-
error(message: string, error?: any): void;
|
|
486
|
-
debug(message: string, ...args: any[]): void;
|
|
487
|
-
warn(message: string, ...args: any[]): void;
|
|
488
|
-
}
|
|
489
|
-
interface MetricsCollector {
|
|
490
|
-
increment(metric: string, labels?: Record<string, string>): void;
|
|
491
|
-
histogram(metric: string, value: number, labels?: Record<string, string>): void;
|
|
492
|
-
gauge(metric: string, value: number, labels?: Record<string, string>): void;
|
|
493
|
-
}
|
|
494
|
-
interface PluginStorage {
|
|
495
|
-
get(key: string): Promise<any>;
|
|
496
|
-
set(key: string, value: any, ttl?: number): Promise<void>;
|
|
497
|
-
delete(key: string): Promise<void>;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
interface ProviderImplementation {
|
|
501
|
-
messaging: MessagingService;
|
|
502
|
-
scheduling?: SchedulingService;
|
|
503
|
-
templating?: TemplatingService;
|
|
504
|
-
analytics?: AnalyticsService;
|
|
505
|
-
webhooks?: WebhookService;
|
|
506
|
-
balance?: BalanceService;
|
|
507
|
-
history?: HistoryService;
|
|
508
|
-
}
|
|
509
|
-
interface ProviderMiddleware {
|
|
510
|
-
name: string;
|
|
511
|
-
pre?: (context: MiddlewareContext) => Promise<void>;
|
|
512
|
-
post?: (context: MiddlewareContext) => Promise<void>;
|
|
513
|
-
error?: (error: Error, context: MiddlewareContext) => Promise<void>;
|
|
514
|
-
}
|
|
515
|
-
interface MiddlewareContext {
|
|
516
|
-
request: any;
|
|
517
|
-
response?: any;
|
|
518
|
-
metadata: Record<string, any>;
|
|
519
|
-
startTime: number;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
interface NotificationRequest {
|
|
523
|
-
phoneNumber: string;
|
|
524
|
-
message: string;
|
|
525
|
-
templateCode?: string;
|
|
526
|
-
variables?: Record<string, string>;
|
|
527
|
-
}
|
|
528
|
-
interface NotificationResponse {
|
|
529
|
-
success: boolean;
|
|
530
|
-
messageId?: string;
|
|
531
|
-
error?: string;
|
|
532
|
-
code?: string;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
declare class PluginRegistry {
|
|
536
|
-
private plugins;
|
|
537
|
-
private instances;
|
|
538
|
-
register(plugin: ProviderPlugin): void;
|
|
539
|
-
create(pluginId: string, config: ProviderConfig, options?: {
|
|
540
|
-
logger?: Logger;
|
|
541
|
-
metrics?: MetricsCollector;
|
|
542
|
-
storage?: PluginStorage;
|
|
543
|
-
}): Promise<ProviderPlugin>;
|
|
544
|
-
loadAndCreate(pluginId: string, config: ProviderConfig, options?: any): Promise<ProviderPlugin>;
|
|
545
|
-
getSupportedTypes(): string[];
|
|
546
|
-
validateProviderConfig(type: string, config: ProviderConfig): boolean;
|
|
547
|
-
destroyAll(): Promise<void>;
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
declare function createRetryMiddleware(options: {
|
|
551
|
-
maxRetries: number;
|
|
552
|
-
retryDelay: number;
|
|
553
|
-
retryableErrors?: string[];
|
|
554
|
-
retryableStatusCodes?: number[];
|
|
555
|
-
}): ProviderMiddleware;
|
|
556
|
-
declare function createRateLimitMiddleware(options: {
|
|
557
|
-
messagesPerSecond?: number;
|
|
558
|
-
messagesPerMinute?: number;
|
|
559
|
-
messagesPerHour?: number;
|
|
560
|
-
messagesPerDay?: number;
|
|
561
|
-
strategy?: 'sliding-window' | 'fixed-window';
|
|
562
|
-
}): ProviderMiddleware;
|
|
563
|
-
declare function createLoggingMiddleware(options: {
|
|
564
|
-
logger: any;
|
|
565
|
-
logLevel?: string;
|
|
566
|
-
}): ProviderMiddleware;
|
|
567
|
-
declare function createMetricsMiddleware(options: {
|
|
568
|
-
collector: any;
|
|
569
|
-
labels?: Record<string, string>;
|
|
570
|
-
}): ProviderMiddleware;
|
|
571
|
-
declare function createCircuitBreakerMiddleware(options: {
|
|
572
|
-
threshold: number;
|
|
573
|
-
timeout: number;
|
|
574
|
-
resetTimeout: number;
|
|
575
|
-
}): ProviderMiddleware;
|
|
576
|
-
|
|
577
|
-
declare abstract class BasePlugin implements ProviderPlugin {
|
|
578
|
-
abstract readonly metadata: ProviderMetadata;
|
|
579
|
-
abstract readonly capabilities: ProviderCapabilities$1;
|
|
580
|
-
protected context: PluginContext;
|
|
581
|
-
middleware: ProviderMiddleware[];
|
|
582
|
-
initialize(context: PluginContext): Promise<void>;
|
|
583
|
-
destroy(): Promise<void>;
|
|
584
|
-
abstract getImplementation(): ProviderImplementation;
|
|
585
|
-
protected executeMiddleware(phase: 'pre' | 'post' | 'error', context: any, error?: Error): Promise<void>;
|
|
586
|
-
protected createMiddlewareContext(request: any, metadata?: Record<string, any>): {
|
|
587
|
-
request: any;
|
|
588
|
-
response: any;
|
|
589
|
-
metadata: {
|
|
590
|
-
pluginName: string;
|
|
591
|
-
pluginVersion: string;
|
|
592
|
-
};
|
|
593
|
-
startTime: number;
|
|
594
|
-
};
|
|
595
|
-
protected validateConfig(config: any, required: string[]): void;
|
|
596
|
-
protected makeRequest(url: string, options: RequestInit, metadata?: Record<string, any>): Promise<Response>;
|
|
597
|
-
/**
|
|
598
|
-
* Make HTTP request and parse JSON response
|
|
599
|
-
* Subclasses should use their specific response adapters to transform the result
|
|
600
|
-
*/
|
|
601
|
-
protected makeJSONRequest<T = any>(url: string, options: RequestInit, metadata?: Record<string, any>): Promise<T>;
|
|
602
|
-
/**
|
|
603
|
-
* Helper method for logging provider-specific operations
|
|
604
|
-
*/
|
|
605
|
-
protected logOperation(operation: string, data?: any): void;
|
|
606
|
-
/**
|
|
607
|
-
* Helper method for logging provider-specific errors
|
|
608
|
-
*/
|
|
609
|
-
protected logError(operation: string, error: any, data?: any): void;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
declare function normalizePhoneNumber(phone: string): string;
|
|
613
|
-
declare function validatePhoneNumber(phone: string): boolean;
|
|
614
|
-
declare function formatDateTime(date: Date): string;
|
|
615
|
-
declare function parseTemplate(template: string, variables: Record<string, string>): string;
|
|
616
|
-
declare function extractVariables(template: string): string[];
|
|
617
|
-
declare function delay(ms: number): Promise<void>;
|
|
618
|
-
declare function retry<T>(fn: () => Promise<T>, options: {
|
|
619
|
-
maxRetries: number;
|
|
620
|
-
delay: number;
|
|
621
|
-
backoff?: 'linear' | 'exponential';
|
|
622
|
-
}): Promise<T>;
|
|
623
|
-
|
|
624
|
-
interface Channel {
|
|
625
|
-
id: string;
|
|
626
|
-
name: string;
|
|
627
|
-
profileKey: string;
|
|
628
|
-
status: 'active' | 'inactive' | 'pending' | 'blocked';
|
|
629
|
-
createdAt: Date;
|
|
630
|
-
updatedAt: Date;
|
|
631
|
-
}
|
|
632
|
-
interface SenderNumber {
|
|
633
|
-
id: string;
|
|
634
|
-
channelId: string;
|
|
635
|
-
phoneNumber: string;
|
|
636
|
-
isVerified: boolean;
|
|
637
|
-
verifiedAt?: Date;
|
|
638
|
-
createdAt: Date;
|
|
639
|
-
}
|
|
640
|
-
interface AlimTalkProvider {
|
|
641
|
-
readonly id: string;
|
|
642
|
-
readonly name: string;
|
|
643
|
-
readonly capabilities: ProviderCapabilities;
|
|
644
|
-
templates: TemplateContract;
|
|
645
|
-
channels: ChannelContract;
|
|
646
|
-
messaging: MessagingContract;
|
|
647
|
-
analytics: AnalyticsContract;
|
|
648
|
-
account: AccountContract;
|
|
649
|
-
}
|
|
650
|
-
interface ProviderCapabilities {
|
|
651
|
-
templates: {
|
|
652
|
-
maxLength: number;
|
|
653
|
-
maxVariables: number;
|
|
654
|
-
maxButtons: number;
|
|
655
|
-
supportedButtonTypes: string[];
|
|
656
|
-
requiresApproval: boolean;
|
|
657
|
-
approvalTime: string;
|
|
658
|
-
};
|
|
659
|
-
messaging: {
|
|
660
|
-
maxRecipientsPerRequest: number;
|
|
661
|
-
maxRequestsPerSecond: number;
|
|
662
|
-
supportsBulk: boolean;
|
|
663
|
-
supportsScheduling: boolean;
|
|
664
|
-
maxScheduleDays: number;
|
|
665
|
-
supportsFallback: boolean;
|
|
666
|
-
};
|
|
667
|
-
channels: {
|
|
668
|
-
requiresBusinessVerification: boolean;
|
|
669
|
-
maxSenderNumbers: number;
|
|
670
|
-
supportsMultipleChannels: boolean;
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
|
-
interface TemplateContract {
|
|
674
|
-
create(template: TemplateCreateRequest): Promise<TemplateCreateResult>;
|
|
675
|
-
update(templateId: string, template: TemplateUpdateRequest): Promise<TemplateUpdateResult>;
|
|
676
|
-
delete(templateId: string): Promise<void>;
|
|
677
|
-
get(templateId: string): Promise<ProviderTemplate>;
|
|
678
|
-
list(filters?: TemplateFilters): Promise<ProviderTemplate[]>;
|
|
679
|
-
sync(): Promise<SyncResult>;
|
|
680
|
-
}
|
|
681
|
-
interface TemplateCreateRequest {
|
|
682
|
-
name: string;
|
|
683
|
-
content: string;
|
|
684
|
-
variables: TemplateVariableDefinition[];
|
|
685
|
-
buttons?: TemplateButtonDefinition[];
|
|
686
|
-
category: string;
|
|
687
|
-
}
|
|
688
|
-
interface TemplateUpdateRequest {
|
|
689
|
-
name?: string;
|
|
690
|
-
content?: string;
|
|
691
|
-
variables?: TemplateVariableDefinition[];
|
|
692
|
-
buttons?: TemplateButtonDefinition[];
|
|
693
|
-
}
|
|
694
|
-
interface TemplateCreateResult {
|
|
695
|
-
templateId: string;
|
|
696
|
-
providerTemplateCode: string;
|
|
697
|
-
status: TemplateStatus;
|
|
698
|
-
message?: string;
|
|
699
|
-
}
|
|
700
|
-
interface TemplateUpdateResult {
|
|
701
|
-
templateId: string;
|
|
702
|
-
status: TemplateStatus;
|
|
703
|
-
message?: string;
|
|
704
|
-
}
|
|
705
|
-
interface ProviderTemplate {
|
|
706
|
-
id: string;
|
|
707
|
-
code: string;
|
|
708
|
-
name: string;
|
|
709
|
-
content: string;
|
|
710
|
-
status: TemplateStatus;
|
|
711
|
-
createdAt: Date;
|
|
712
|
-
updatedAt: Date;
|
|
713
|
-
approvedAt?: Date;
|
|
714
|
-
rejectedAt?: Date;
|
|
715
|
-
rejectionReason?: string;
|
|
716
|
-
}
|
|
717
|
-
declare enum TemplateStatus {
|
|
718
|
-
DRAFT = "DRAFT",
|
|
719
|
-
PENDING = "PENDING",
|
|
720
|
-
APPROVED = "APPROVED",
|
|
721
|
-
REJECTED = "REJECTED",
|
|
722
|
-
DISABLED = "DISABLED"
|
|
723
|
-
}
|
|
724
|
-
interface TemplateVariableDefinition {
|
|
725
|
-
name: string;
|
|
726
|
-
type: string;
|
|
727
|
-
required: boolean;
|
|
728
|
-
maxLength?: number;
|
|
729
|
-
format?: string;
|
|
730
|
-
}
|
|
731
|
-
interface TemplateButtonDefinition {
|
|
732
|
-
type: string;
|
|
733
|
-
name: string;
|
|
734
|
-
linkMobile?: string;
|
|
735
|
-
linkPc?: string;
|
|
736
|
-
linkIos?: string;
|
|
737
|
-
linkAndroid?: string;
|
|
738
|
-
schemeIos?: string;
|
|
739
|
-
schemeAndroid?: string;
|
|
740
|
-
}
|
|
741
|
-
interface TemplateFilters {
|
|
742
|
-
status?: TemplateStatus;
|
|
743
|
-
category?: string;
|
|
744
|
-
createdAfter?: Date;
|
|
745
|
-
createdBefore?: Date;
|
|
746
|
-
}
|
|
747
|
-
interface SyncResult {
|
|
748
|
-
synced: number;
|
|
749
|
-
created: number;
|
|
750
|
-
updated: number;
|
|
751
|
-
deleted: number;
|
|
752
|
-
errors: SyncError[];
|
|
753
|
-
}
|
|
754
|
-
interface SyncError {
|
|
755
|
-
templateId: string;
|
|
756
|
-
error: string;
|
|
757
|
-
}
|
|
758
|
-
interface ChannelContract {
|
|
759
|
-
register(channel: ChannelRequest): Promise<Channel>;
|
|
760
|
-
list(): Promise<Channel[]>;
|
|
761
|
-
addSenderNumber(channelId: string, number: string): Promise<SenderNumber>;
|
|
762
|
-
verifySenderNumber(number: string, verificationCode: string): Promise<boolean>;
|
|
763
|
-
}
|
|
764
|
-
interface ChannelRequest {
|
|
765
|
-
name: string;
|
|
766
|
-
profileKey: string;
|
|
767
|
-
businessInfo?: BusinessInfo;
|
|
768
|
-
}
|
|
769
|
-
interface BusinessInfo {
|
|
770
|
-
name: string;
|
|
771
|
-
registrationNumber: string;
|
|
772
|
-
category: string;
|
|
773
|
-
contactPerson: string;
|
|
774
|
-
contactEmail: string;
|
|
775
|
-
contactPhone: string;
|
|
776
|
-
}
|
|
777
|
-
interface MessagingContract {
|
|
778
|
-
send(message: ProviderMessageRequest): Promise<ProviderMessageResult>;
|
|
779
|
-
sendBulk(messages: ProviderMessageRequest[]): Promise<ProviderBulkResult>;
|
|
780
|
-
schedule(message: ProviderMessageRequest, scheduledAt: Date): Promise<ScheduleResult>;
|
|
781
|
-
cancel(messageId: string): Promise<void>;
|
|
782
|
-
getStatus(messageId: string): Promise<MessageStatus>;
|
|
783
|
-
}
|
|
784
|
-
interface ProviderMessageRequest {
|
|
785
|
-
templateCode: string;
|
|
786
|
-
phoneNumber: string;
|
|
787
|
-
variables: Record<string, unknown>;
|
|
788
|
-
senderNumber?: string;
|
|
789
|
-
options?: MessageOptions;
|
|
790
|
-
}
|
|
791
|
-
interface MessageOptions {
|
|
792
|
-
priority?: 'high' | 'normal' | 'low';
|
|
793
|
-
ttl?: number;
|
|
794
|
-
tracking?: boolean;
|
|
795
|
-
webhookUrl?: string;
|
|
796
|
-
scheduledAt?: Date;
|
|
797
|
-
}
|
|
798
|
-
interface ProviderMessageResult {
|
|
799
|
-
messageId: string;
|
|
800
|
-
status: MessageStatus;
|
|
801
|
-
sentAt?: Date;
|
|
802
|
-
error?: ProviderError;
|
|
803
|
-
}
|
|
804
|
-
interface ProviderBulkResult {
|
|
805
|
-
requestId: string;
|
|
806
|
-
results: ProviderMessageResult[];
|
|
807
|
-
summary: {
|
|
808
|
-
total: number;
|
|
809
|
-
sent: number;
|
|
810
|
-
failed: number;
|
|
811
|
-
};
|
|
812
|
-
}
|
|
813
|
-
interface ScheduleResult {
|
|
814
|
-
scheduleId: string;
|
|
815
|
-
messageId: string;
|
|
816
|
-
scheduledAt: Date;
|
|
817
|
-
status: 'scheduled' | 'cancelled';
|
|
818
|
-
}
|
|
819
|
-
declare enum MessageStatus {
|
|
820
|
-
QUEUED = "QUEUED",
|
|
821
|
-
SENDING = "SENDING",
|
|
822
|
-
SENT = "SENT",
|
|
823
|
-
DELIVERED = "DELIVERED",
|
|
824
|
-
FAILED = "FAILED",
|
|
825
|
-
CANCELLED = "CANCELLED"
|
|
826
|
-
}
|
|
827
|
-
interface ProviderError {
|
|
828
|
-
code: string;
|
|
829
|
-
message: string;
|
|
830
|
-
details?: Record<string, unknown>;
|
|
831
|
-
}
|
|
832
|
-
interface AnalyticsContract {
|
|
833
|
-
getUsage(period: DateRange): Promise<UsageStats>;
|
|
834
|
-
getTemplateStats(templateId: string, period: DateRange): Promise<TemplateStats>;
|
|
835
|
-
getDeliveryReport(messageId: string): Promise<DeliveryReport>;
|
|
836
|
-
}
|
|
837
|
-
interface DateRange {
|
|
838
|
-
from: Date;
|
|
839
|
-
to: Date;
|
|
840
|
-
}
|
|
841
|
-
interface UsageStats {
|
|
842
|
-
period: DateRange;
|
|
843
|
-
totalMessages: number;
|
|
844
|
-
sentMessages: number;
|
|
845
|
-
deliveredMessages: number;
|
|
846
|
-
failedMessages: number;
|
|
847
|
-
deliveryRate: number;
|
|
848
|
-
failureRate: number;
|
|
849
|
-
breakdown: {
|
|
850
|
-
byTemplate: Record<string, number>;
|
|
851
|
-
byDay: Record<string, number>;
|
|
852
|
-
byHour: Record<string, number>;
|
|
853
|
-
};
|
|
854
|
-
}
|
|
855
|
-
interface TemplateStats {
|
|
856
|
-
templateId: string;
|
|
857
|
-
period: DateRange;
|
|
858
|
-
totalSent: number;
|
|
859
|
-
delivered: number;
|
|
860
|
-
failed: number;
|
|
861
|
-
clickRate?: number;
|
|
862
|
-
deliveryRate: number;
|
|
863
|
-
averageDeliveryTime: number;
|
|
864
|
-
}
|
|
865
|
-
interface DeliveryReport {
|
|
866
|
-
messageId: string;
|
|
867
|
-
phoneNumber: string;
|
|
868
|
-
templateCode: string;
|
|
869
|
-
status: MessageStatus;
|
|
870
|
-
sentAt?: Date;
|
|
871
|
-
deliveredAt?: Date;
|
|
872
|
-
failedAt?: Date;
|
|
873
|
-
clickedAt?: Date;
|
|
874
|
-
error?: ProviderError;
|
|
875
|
-
attempts: DeliveryAttempt[];
|
|
876
|
-
}
|
|
877
|
-
interface DeliveryAttempt {
|
|
878
|
-
attemptNumber: number;
|
|
879
|
-
attemptedAt: Date;
|
|
880
|
-
status: MessageStatus;
|
|
881
|
-
error?: ProviderError;
|
|
882
|
-
}
|
|
883
|
-
interface AccountContract {
|
|
884
|
-
getBalance(): Promise<Balance>;
|
|
885
|
-
getProfile(): Promise<AccountProfile>;
|
|
886
|
-
}
|
|
887
|
-
interface Balance {
|
|
888
|
-
current: number;
|
|
889
|
-
currency: string;
|
|
890
|
-
lastUpdated: Date;
|
|
891
|
-
threshold?: number;
|
|
892
|
-
}
|
|
893
|
-
interface AccountProfile {
|
|
894
|
-
accountId: string;
|
|
895
|
-
name: string;
|
|
896
|
-
email: string;
|
|
897
|
-
phone: string;
|
|
898
|
-
status: 'active' | 'suspended' | 'blocked';
|
|
899
|
-
tier: 'basic' | 'standard' | 'premium' | 'enterprise';
|
|
900
|
-
features: string[];
|
|
901
|
-
limits: {
|
|
902
|
-
dailyMessageLimit: number;
|
|
903
|
-
monthlyMessageLimit: number;
|
|
904
|
-
rateLimit: number;
|
|
905
|
-
};
|
|
906
|
-
}
|
|
907
|
-
interface ProviderConfiguration {
|
|
908
|
-
required: ConfigurationField[];
|
|
909
|
-
optional: ConfigurationField[];
|
|
910
|
-
}
|
|
911
|
-
interface ConfigurationField {
|
|
912
|
-
key: string;
|
|
913
|
-
name: string;
|
|
914
|
-
type: 'string' | 'number' | 'boolean' | 'password' | 'url';
|
|
915
|
-
description: string;
|
|
916
|
-
required: boolean;
|
|
917
|
-
default?: unknown;
|
|
918
|
-
validation?: {
|
|
919
|
-
pattern?: string;
|
|
920
|
-
min?: number;
|
|
921
|
-
max?: number;
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
declare abstract class BaseAlimTalkProvider implements AlimTalkProvider {
|
|
926
|
-
abstract readonly id: string;
|
|
927
|
-
abstract readonly name: string;
|
|
928
|
-
abstract readonly capabilities: ProviderCapabilities;
|
|
929
|
-
protected config: Record<string, unknown>;
|
|
930
|
-
protected isConfigured: boolean;
|
|
931
|
-
abstract templates: TemplateContract;
|
|
932
|
-
abstract channels: ChannelContract;
|
|
933
|
-
abstract messaging: MessagingContract;
|
|
934
|
-
abstract analytics: AnalyticsContract;
|
|
935
|
-
abstract account: AccountContract;
|
|
936
|
-
constructor(config?: Record<string, unknown>);
|
|
937
|
-
/**
|
|
938
|
-
* Configure the provider with necessary credentials and settings
|
|
939
|
-
*/
|
|
940
|
-
configure(config: Record<string, unknown>): void;
|
|
941
|
-
/**
|
|
942
|
-
* Get the configuration schema for this provider
|
|
943
|
-
*/
|
|
944
|
-
abstract getConfigurationSchema(): ProviderConfiguration;
|
|
945
|
-
/**
|
|
946
|
-
* Validate the provided configuration
|
|
947
|
-
*/
|
|
948
|
-
protected validateConfiguration(config: Record<string, unknown>): void;
|
|
949
|
-
private validateFieldValue;
|
|
950
|
-
/**
|
|
951
|
-
* Called after configuration is set
|
|
952
|
-
*/
|
|
953
|
-
protected onConfigured(): void;
|
|
954
|
-
/**
|
|
955
|
-
* Check if the provider is properly configured
|
|
956
|
-
*/
|
|
957
|
-
isReady(): boolean;
|
|
958
|
-
/**
|
|
959
|
-
* Get configuration value
|
|
960
|
-
*/
|
|
961
|
-
protected getConfig<T = unknown>(key: string): T;
|
|
962
|
-
/**
|
|
963
|
-
* Check if a configuration key exists
|
|
964
|
-
*/
|
|
965
|
-
protected hasConfig(key: string): boolean;
|
|
966
|
-
/**
|
|
967
|
-
* Perform health check on the provider
|
|
968
|
-
*/
|
|
969
|
-
healthCheck(): Promise<{
|
|
970
|
-
healthy: boolean;
|
|
971
|
-
issues: string[];
|
|
972
|
-
latency?: number;
|
|
973
|
-
}>;
|
|
974
|
-
/**
|
|
975
|
-
* Test basic connectivity to the provider
|
|
976
|
-
*/
|
|
977
|
-
protected abstract testConnectivity(): Promise<void>;
|
|
978
|
-
/**
|
|
979
|
-
* Test authentication with the provider
|
|
980
|
-
*/
|
|
981
|
-
protected abstract testAuthentication(): Promise<void>;
|
|
982
|
-
/**
|
|
983
|
-
* Get provider information
|
|
984
|
-
*/
|
|
985
|
-
getInfo(): {
|
|
986
|
-
id: string;
|
|
987
|
-
name: string;
|
|
988
|
-
version: string;
|
|
989
|
-
capabilities: ProviderCapabilities;
|
|
990
|
-
configured: boolean;
|
|
991
|
-
};
|
|
992
|
-
/**
|
|
993
|
-
* Get provider version
|
|
994
|
-
*/
|
|
995
|
-
protected abstract getVersion(): string;
|
|
996
|
-
/**
|
|
997
|
-
* Cleanup resources when provider is destroyed
|
|
998
|
-
*/
|
|
999
|
-
destroy(): void;
|
|
1000
|
-
/**
|
|
1001
|
-
* Called when provider is being destroyed
|
|
1002
|
-
*/
|
|
1003
|
-
protected onDestroy(): void;
|
|
1004
|
-
/**
|
|
1005
|
-
* Create standardized error
|
|
1006
|
-
*/
|
|
1007
|
-
protected createError(code: string, message: string, details?: Record<string, unknown>): Error;
|
|
1008
|
-
/**
|
|
1009
|
-
* Log provider activity
|
|
1010
|
-
*/
|
|
1011
|
-
protected log(level: 'info' | 'warn' | 'error', message: string, data?: unknown): void;
|
|
1012
|
-
/**
|
|
1013
|
-
* Handle rate limiting
|
|
1014
|
-
*/
|
|
1015
|
-
protected handleRateLimit(operation: string): Promise<void>;
|
|
1016
|
-
/**
|
|
1017
|
-
* Retry mechanism for failed operations
|
|
1018
|
-
*/
|
|
1019
|
-
protected withRetry<T>(operation: () => Promise<T>, options?: {
|
|
1020
|
-
maxRetries?: number;
|
|
1021
|
-
initialDelay?: number;
|
|
1022
|
-
maxDelay?: number;
|
|
1023
|
-
backoffFactor?: number;
|
|
1024
|
-
}): Promise<T>;
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
/**
|
|
1028
|
-
* Base request adapter for transforming platform requests to provider-specific format
|
|
1029
|
-
*/
|
|
1030
|
-
declare abstract class BaseRequestAdapter {
|
|
1031
|
-
/**
|
|
1032
|
-
* Transform a generic message request to provider-specific format
|
|
1033
|
-
*/
|
|
1034
|
-
abstract transformMessageRequest(request: ProviderMessageRequest): unknown;
|
|
1035
|
-
/**
|
|
1036
|
-
* Transform a generic template request to provider-specific format
|
|
1037
|
-
*/
|
|
1038
|
-
abstract transformTemplateRequest(request: TemplateCreateRequest): unknown;
|
|
1039
|
-
/**
|
|
1040
|
-
* Common transformation utilities
|
|
1041
|
-
*/
|
|
1042
|
-
protected formatPhoneNumber(phoneNumber: string, countryCode?: string): string;
|
|
1043
|
-
protected formatVariables(variables: Record<string, unknown>): Record<string, string>;
|
|
1044
|
-
protected validateRequiredFields(data: unknown, requiredFields: string[]): void;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Request adapter for IWINV provider
|
|
1048
|
-
*/
|
|
1049
|
-
declare class IWINVRequestAdapter extends BaseRequestAdapter {
|
|
1050
|
-
transformMessageRequest(request: ProviderMessageRequest): unknown;
|
|
1051
|
-
transformTemplateRequest(request: TemplateCreateRequest): unknown;
|
|
1052
|
-
private getProfileKey;
|
|
1053
|
-
private mapCategory;
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* Request adapter for Aligo provider
|
|
1057
|
-
*/
|
|
1058
|
-
declare class AligoRequestAdapter extends BaseRequestAdapter {
|
|
1059
|
-
transformMessageRequest(request: ProviderMessageRequest): unknown;
|
|
1060
|
-
transformTemplateRequest(request: TemplateCreateRequest): unknown;
|
|
1061
|
-
private getApiKey;
|
|
1062
|
-
private getUserId;
|
|
1063
|
-
private getSenderKey;
|
|
1064
|
-
private buildMessage;
|
|
1065
|
-
private formatDateTime;
|
|
1066
|
-
private extractEmphasis;
|
|
1067
|
-
private buildTemplateExtra;
|
|
1068
|
-
private isPromotional;
|
|
1069
|
-
}
|
|
1070
|
-
/**
|
|
1071
|
-
* Request adapter for Kakao provider (direct API)
|
|
1072
|
-
*/
|
|
1073
|
-
declare class KakaoRequestAdapter extends BaseRequestAdapter {
|
|
1074
|
-
transformMessageRequest(request: ProviderMessageRequest): unknown;
|
|
1075
|
-
transformTemplateRequest(request: TemplateCreateRequest): unknown;
|
|
1076
|
-
private buildTemplateText;
|
|
1077
|
-
private buildTemplateLink;
|
|
1078
|
-
private mapCategoryCode;
|
|
1079
|
-
private extractEmphasisType;
|
|
1080
|
-
private buildTemplateButtons;
|
|
1081
|
-
}
|
|
1082
|
-
declare class RequestAdapterFactory {
|
|
1083
|
-
private static adapters;
|
|
1084
|
-
static create(providerId: string): BaseRequestAdapter;
|
|
1085
|
-
static register(providerId: string, adapterClass: new () => BaseRequestAdapter): void;
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Base response adapter for transforming provider responses to platform format
|
|
1090
|
-
*/
|
|
1091
|
-
declare abstract class BaseResponseAdapter {
|
|
1092
|
-
/**
|
|
1093
|
-
* Transform provider message response to standard format
|
|
1094
|
-
*/
|
|
1095
|
-
abstract transformMessageResponse(providerResponse: unknown): ProviderMessageResult;
|
|
1096
|
-
/**
|
|
1097
|
-
* Transform provider template response to standard format
|
|
1098
|
-
*/
|
|
1099
|
-
abstract transformTemplateResponse(providerResponse: unknown): TemplateCreateResult;
|
|
1100
|
-
/**
|
|
1101
|
-
* Common error transformation
|
|
1102
|
-
*/
|
|
1103
|
-
protected transformError(providerError: unknown): ProviderError;
|
|
1104
|
-
protected abstract extractErrorCode(providerError: unknown): string;
|
|
1105
|
-
protected abstract extractErrorMessage(providerError: unknown): string;
|
|
1106
|
-
protected abstract extractErrorDetails(providerError: unknown): Record<string, unknown>;
|
|
1107
|
-
/**
|
|
1108
|
-
* Common status mapping utilities
|
|
1109
|
-
*/
|
|
1110
|
-
protected mapMessageStatus(providerStatus: string): MessageStatus;
|
|
1111
|
-
protected mapTemplateStatus(providerStatus: string): TemplateStatus;
|
|
1112
|
-
protected parseDate(dateString: string): Date | undefined;
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Response adapter for IWINV provider
|
|
1116
|
-
*/
|
|
1117
|
-
declare class IWINVResponseAdapter extends BaseResponseAdapter {
|
|
1118
|
-
transformMessageResponse(providerResponse: unknown): ProviderMessageResult;
|
|
1119
|
-
transformTemplateResponse(providerResponse: unknown): TemplateCreateResult;
|
|
1120
|
-
private mapIWINVMessageStatus;
|
|
1121
|
-
private mapIWINVTemplateStatus;
|
|
1122
|
-
protected extractErrorCode(providerError: unknown): string;
|
|
1123
|
-
protected extractErrorMessage(providerError: unknown): string;
|
|
1124
|
-
protected extractErrorDetails(providerError: unknown): Record<string, unknown>;
|
|
1125
|
-
}
|
|
1126
|
-
/**
|
|
1127
|
-
* Response adapter for Aligo provider
|
|
1128
|
-
*/
|
|
1129
|
-
declare class AligoResponseAdapter extends BaseResponseAdapter {
|
|
1130
|
-
transformMessageResponse(providerResponse: unknown): ProviderMessageResult;
|
|
1131
|
-
transformTemplateResponse(providerResponse: unknown): TemplateCreateResult;
|
|
1132
|
-
private mapAligoMessageStatus;
|
|
1133
|
-
private mapAligoTemplateStatus;
|
|
1134
|
-
protected extractErrorCode(providerError: unknown): string;
|
|
1135
|
-
protected extractErrorMessage(providerError: unknown): string;
|
|
1136
|
-
protected extractErrorDetails(providerError: unknown): Record<string, unknown>;
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Response adapter for Kakao provider (direct API)
|
|
1140
|
-
*/
|
|
1141
|
-
declare class KakaoResponseAdapter extends BaseResponseAdapter {
|
|
1142
|
-
transformMessageResponse(providerResponse: unknown): ProviderMessageResult;
|
|
1143
|
-
transformTemplateResponse(providerResponse: unknown): TemplateCreateResult;
|
|
1144
|
-
private mapKakaoMessageStatus;
|
|
1145
|
-
private mapKakaoTemplateStatus;
|
|
1146
|
-
protected extractErrorCode(providerError: unknown): string;
|
|
1147
|
-
protected extractErrorMessage(providerError: unknown): string;
|
|
1148
|
-
protected extractErrorDetails(providerError: unknown): Record<string, unknown>;
|
|
1149
|
-
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Response adapter for NHN provider
|
|
1152
|
-
*/
|
|
1153
|
-
declare class NHNResponseAdapter extends BaseResponseAdapter {
|
|
1154
|
-
transformMessageResponse(providerResponse: unknown): ProviderMessageResult;
|
|
1155
|
-
transformTemplateResponse(providerResponse: unknown): TemplateCreateResult;
|
|
1156
|
-
private mapNHNMessageStatus;
|
|
1157
|
-
private mapNHNTemplateStatus;
|
|
1158
|
-
protected extractErrorCode(providerError: unknown): string;
|
|
1159
|
-
protected extractErrorMessage(providerError: unknown): string;
|
|
1160
|
-
protected extractErrorDetails(providerError: unknown): Record<string, unknown>;
|
|
1161
|
-
}
|
|
1162
|
-
/**
|
|
1163
|
-
* Factory for creating response adapters
|
|
1164
|
-
*/
|
|
1165
|
-
declare class ResponseAdapterFactory {
|
|
1166
|
-
private static adapters;
|
|
1167
|
-
static create(providerId: string): BaseResponseAdapter;
|
|
1168
|
-
static register(providerId: string, adapterClass: new () => BaseResponseAdapter): void;
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
declare class ProviderManager {
|
|
1172
|
-
private providers;
|
|
1173
|
-
private defaultProvider?;
|
|
1174
|
-
registerProvider(provider: BaseProvider$1): void;
|
|
1175
|
-
unregisterProvider(providerId: string): void;
|
|
1176
|
-
getProvider(providerId?: string): BaseProvider$1 | null;
|
|
1177
|
-
listProviders(): BaseProvider$1[];
|
|
1178
|
-
setDefaultProvider(providerId: string): void;
|
|
1179
|
-
healthCheckAll(): Promise<Record<string, boolean>>;
|
|
1180
|
-
getProvidersForChannel(channel: string): BaseProvider$1[];
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
/**
|
|
1184
|
-
* IWINV API TypeScript 타입 정의
|
|
1185
|
-
* IWINV 알림톡 REST API 규격서 기반
|
|
1186
|
-
*/
|
|
1187
|
-
interface IWINVBaseResponse {
|
|
1188
|
-
code: number;
|
|
1189
|
-
message: string;
|
|
1190
|
-
}
|
|
1191
|
-
interface SendMessageRequest {
|
|
1192
|
-
templateCode: string;
|
|
1193
|
-
reserve?: 'Y' | 'N';
|
|
1194
|
-
sendDate?: string;
|
|
1195
|
-
reSend?: 'Y' | 'N';
|
|
1196
|
-
resendCallback?: string;
|
|
1197
|
-
resendType?: 'Y' | 'N';
|
|
1198
|
-
resendTitle?: string;
|
|
1199
|
-
resendContent?: string;
|
|
1200
|
-
list: SendRecipient[];
|
|
1201
|
-
}
|
|
1202
|
-
interface SendRecipient {
|
|
1203
|
-
phone: string;
|
|
1204
|
-
templateParam?: string[];
|
|
1205
|
-
}
|
|
1206
|
-
interface SendMessageResponse extends IWINVBaseResponse {
|
|
1207
|
-
success: number;
|
|
1208
|
-
fail: number;
|
|
1209
|
-
}
|
|
1210
|
-
interface CreateTemplateRequest {
|
|
1211
|
-
templateName: string;
|
|
1212
|
-
templateContent: string;
|
|
1213
|
-
buttons?: CreateTemplateButton[];
|
|
1214
|
-
}
|
|
1215
|
-
interface CreateTemplateButton {
|
|
1216
|
-
type: 'WL' | 'AL' | 'DB' | 'BK' | 'MD';
|
|
1217
|
-
name: string;
|
|
1218
|
-
linkMo?: string;
|
|
1219
|
-
linkPc?: string;
|
|
1220
|
-
linkIos?: string;
|
|
1221
|
-
linkAnd?: string;
|
|
1222
|
-
}
|
|
1223
|
-
interface Template {
|
|
1224
|
-
templateCode: string;
|
|
1225
|
-
templateName: string;
|
|
1226
|
-
templateContent: string;
|
|
1227
|
-
status: 'Y' | 'I' | 'R';
|
|
1228
|
-
templateStatusMsg?: string;
|
|
1229
|
-
templateStatusComments?: string;
|
|
1230
|
-
createDate: string;
|
|
1231
|
-
buttons: any[];
|
|
1232
|
-
}
|
|
1233
|
-
interface TemplateListRequest {
|
|
1234
|
-
pageNum?: string;
|
|
1235
|
-
pageSize?: string;
|
|
1236
|
-
templateCode?: string;
|
|
1237
|
-
templateName?: string;
|
|
1238
|
-
templateStatus?: 'Y' | 'I' | 'R';
|
|
1239
|
-
}
|
|
1240
|
-
interface TemplateListResponse extends IWINVBaseResponse {
|
|
1241
|
-
totalCount: number;
|
|
1242
|
-
list: Template[];
|
|
1243
|
-
}
|
|
1244
|
-
interface ModifyTemplateRequest {
|
|
1245
|
-
templateCode: string;
|
|
1246
|
-
templateName: string;
|
|
1247
|
-
templateContent: string;
|
|
1248
|
-
buttons?: CreateTemplateButton[];
|
|
1249
|
-
}
|
|
1250
|
-
interface DeleteTemplateRequest {
|
|
1251
|
-
templateCode: string;
|
|
1252
|
-
}
|
|
1253
|
-
type CreateTemplateResponse = IWINVBaseResponse;
|
|
1254
|
-
type ModifyTemplateResponse = IWINVBaseResponse;
|
|
1255
|
-
type DeleteTemplateResponse = IWINVBaseResponse;
|
|
1256
|
-
interface HistoryRequest {
|
|
1257
|
-
pageNum?: number;
|
|
1258
|
-
pageSize?: number;
|
|
1259
|
-
reserve?: 'Y' | 'N';
|
|
1260
|
-
startDate?: string;
|
|
1261
|
-
endDate?: string;
|
|
1262
|
-
seqNo?: number;
|
|
1263
|
-
phone?: string;
|
|
1264
|
-
}
|
|
1265
|
-
interface MessageHistory {
|
|
1266
|
-
seqNo: number;
|
|
1267
|
-
phone: string;
|
|
1268
|
-
callback: string;
|
|
1269
|
-
templateCode: string;
|
|
1270
|
-
sendMessage: string;
|
|
1271
|
-
reserve: 'Y' | 'N';
|
|
1272
|
-
requestDate: string;
|
|
1273
|
-
sendDate: string;
|
|
1274
|
-
receiveDate: string;
|
|
1275
|
-
statusCode: string;
|
|
1276
|
-
statusCodeName: string;
|
|
1277
|
-
resendStatus: string | null;
|
|
1278
|
-
resendStatusName: string | null;
|
|
1279
|
-
buttons: {
|
|
1280
|
-
link1: string | null;
|
|
1281
|
-
link2: string | null;
|
|
1282
|
-
link3: string | null;
|
|
1283
|
-
link4: string | null;
|
|
1284
|
-
link5: string | null;
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
interface HistoryResponse extends IWINVBaseResponse {
|
|
1288
|
-
totalCount: number;
|
|
1289
|
-
list: MessageHistory[];
|
|
1290
|
-
}
|
|
1291
|
-
interface CancelReservationRequest {
|
|
1292
|
-
seqNo: number;
|
|
1293
|
-
}
|
|
1294
|
-
type CancelReservationResponse = IWINVBaseResponse;
|
|
1295
|
-
interface BalanceResponse extends IWINVBaseResponse {
|
|
1296
|
-
charge: number;
|
|
1297
|
-
}
|
|
1298
|
-
interface IWINVConfig {
|
|
1299
|
-
apiKey: string;
|
|
1300
|
-
baseUrl?: string;
|
|
1301
|
-
debug?: boolean;
|
|
1302
|
-
[key: string]: unknown;
|
|
1303
|
-
}
|
|
1304
|
-
declare const IWINV_STATUS_CODES: {
|
|
1305
|
-
readonly SUCCESS: 200;
|
|
1306
|
-
readonly AUTH_FAILED: 201;
|
|
1307
|
-
readonly BAD_REQUEST: 400;
|
|
1308
|
-
readonly UNAUTHORIZED: 401;
|
|
1309
|
-
readonly FORBIDDEN: 403;
|
|
1310
|
-
readonly NOT_FOUND: 404;
|
|
1311
|
-
readonly TOO_MANY_REQUESTS: 429;
|
|
1312
|
-
readonly INTERNAL_SERVER_ERROR: 500;
|
|
1313
|
-
};
|
|
1314
|
-
|
|
1315
|
-
/**
|
|
1316
|
-
* IWINV Messaging Contract Implementation
|
|
1317
|
-
*/
|
|
1318
|
-
|
|
1319
|
-
declare class IWINVMessagingContract implements MessagingContract {
|
|
1320
|
-
private config;
|
|
1321
|
-
constructor(config: IWINVConfig);
|
|
1322
|
-
send(message: ProviderMessageRequest): Promise<ProviderMessageResult>;
|
|
1323
|
-
sendBulk(messages: ProviderMessageRequest[]): Promise<ProviderBulkResult>;
|
|
1324
|
-
schedule(message: ProviderMessageRequest, scheduledAt: Date): Promise<ScheduleResult>;
|
|
1325
|
-
cancel(messageId: string): Promise<void>;
|
|
1326
|
-
getStatus(messageId: string): Promise<MessageStatus>;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
/**
|
|
1330
|
-
* IWINV Template Contract Implementation
|
|
1331
|
-
*/
|
|
1332
|
-
|
|
1333
|
-
declare class IWINVTemplateContract implements TemplateContract {
|
|
1334
|
-
private config;
|
|
1335
|
-
constructor(config: IWINVConfig);
|
|
1336
|
-
create(template: TemplateCreateRequest): Promise<TemplateCreateResult>;
|
|
1337
|
-
update(templateId: string, template: TemplateUpdateRequest): Promise<TemplateUpdateResult>;
|
|
1338
|
-
delete(templateId: string): Promise<void>;
|
|
1339
|
-
get(templateId: string): Promise<ProviderTemplate>;
|
|
1340
|
-
list(filters?: TemplateFilters): Promise<ProviderTemplate[]>;
|
|
1341
|
-
sync(): Promise<SyncResult>;
|
|
1342
|
-
private mapIWINVStatus;
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
/**
|
|
1346
|
-
* IWINV Channel Contract Implementation
|
|
1347
|
-
*/
|
|
1348
|
-
|
|
1349
|
-
declare class IWINVChannelContract implements ChannelContract {
|
|
1350
|
-
private config;
|
|
1351
|
-
constructor(config: IWINVConfig);
|
|
1352
|
-
register(channel: ChannelRequest): Promise<Channel>;
|
|
1353
|
-
list(): Promise<Channel[]>;
|
|
1354
|
-
addSenderNumber(channelId: string, number: string): Promise<SenderNumber>;
|
|
1355
|
-
verifySenderNumber(number: string, verificationCode: string): Promise<boolean>;
|
|
1356
|
-
}
|
|
1357
|
-
|
|
1358
|
-
/**
|
|
1359
|
-
* IWINV Analytics Contract Implementation
|
|
1360
|
-
*/
|
|
1361
|
-
|
|
1362
|
-
declare class IWINVAnalyticsContract implements AnalyticsContract {
|
|
1363
|
-
private config;
|
|
1364
|
-
constructor(config: IWINVConfig);
|
|
1365
|
-
getUsage(period: DateRange): Promise<UsageStats>;
|
|
1366
|
-
getTemplateStats(templateId: string, period: DateRange): Promise<TemplateStats>;
|
|
1367
|
-
getDeliveryReport(messageId: string): Promise<DeliveryReport>;
|
|
1368
|
-
private groupByTemplate;
|
|
1369
|
-
private groupByDay;
|
|
1370
|
-
private groupByHour;
|
|
1371
|
-
private mapStatus;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
/**
|
|
1375
|
-
* IWINV Account Contract Implementation
|
|
1376
|
-
*/
|
|
1377
|
-
|
|
1378
|
-
declare class IWINVAccountContract implements AccountContract {
|
|
1379
|
-
private config;
|
|
1380
|
-
constructor(config: IWINVConfig);
|
|
1381
|
-
getBalance(): Promise<Balance>;
|
|
1382
|
-
getProfile(): Promise<AccountProfile>;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
declare class IWINVProvider extends BaseAlimTalkProvider {
|
|
1386
|
-
readonly id = "iwinv";
|
|
1387
|
-
readonly name = "IWINV AlimTalk Provider";
|
|
1388
|
-
readonly capabilities: ProviderCapabilities;
|
|
1389
|
-
templates: IWINVTemplateContract;
|
|
1390
|
-
channels: IWINVChannelContract;
|
|
1391
|
-
messaging: IWINVMessagingContract;
|
|
1392
|
-
analytics: IWINVAnalyticsContract;
|
|
1393
|
-
account: IWINVAccountContract;
|
|
1394
|
-
constructor(config?: IWINVConfig);
|
|
1395
|
-
getConfigurationSchema(): ProviderConfiguration;
|
|
1396
|
-
protected testConnectivity(): Promise<void>;
|
|
1397
|
-
protected testAuthentication(): Promise<void>;
|
|
1398
|
-
protected getVersion(): string;
|
|
1399
|
-
/**
|
|
1400
|
-
* Get IWINV-specific configuration
|
|
1401
|
-
*/
|
|
1402
|
-
private getIWINVConfig;
|
|
1403
|
-
/**
|
|
1404
|
-
* IWINV-specific methods for backward compatibility
|
|
1405
|
-
*/
|
|
1406
|
-
/**
|
|
1407
|
-
* Send AlimTalk message (legacy method)
|
|
1408
|
-
*/
|
|
1409
|
-
sendMessage(options: {
|
|
1410
|
-
templateCode: string;
|
|
1411
|
-
phoneNumber: string;
|
|
1412
|
-
variables: Record<string, any>;
|
|
1413
|
-
senderNumber?: string;
|
|
1414
|
-
}): Promise<ProviderMessageResult>;
|
|
1415
|
-
/**
|
|
1416
|
-
* Get account balance (legacy method)
|
|
1417
|
-
*/
|
|
1418
|
-
getBalance(): Promise<Balance>;
|
|
1419
|
-
/**
|
|
1420
|
-
* List templates (legacy method)
|
|
1421
|
-
*/
|
|
1422
|
-
listTemplates(filters?: any): Promise<ProviderTemplate[]>;
|
|
1423
|
-
}
|
|
1424
|
-
|
|
1425
|
-
export { type AccountContract, AligoRequestAdapter, AligoResponseAdapter, type AnalyticsContract, type BalanceResponse, BaseAlimTalkProvider, BasePlugin, type BaseProvider, type BaseProviderConfig, BaseRequestAdapter, BaseResponseAdapter, type CancelReservationRequest, type CancelReservationResponse, type ChannelContract, type ChannelInfo, type ConfigurationField, type CreateTemplateButton, type CreateTemplateRequest, type CreateTemplateResponse, type DeleteTemplateRequest, type DeleteTemplateResponse, type HealthCheckResult, type HistoryFilters, type HistoryRequest, type HistoryResponse, type IWINVBaseResponse, type IWINVConfig, IWINVProvider, IWINVRequestAdapter, IWINVResponseAdapter, IWINV_STATUS_CODES, KakaoRequestAdapter, KakaoResponseAdapter, type Logger, type MediaAttachment, type MessageButton, MessageChannel, type MessageContent, type MessageHistory, MessageType, type MessagingContract, type MetricsCollector, type MiddlewareContext, type ModifyTemplateRequest, type ModifyTemplateResponse, NHNResponseAdapter, type NotificationRequest, type NotificationResponse, type PluginContext, PluginRegistry, type PluginStorage, type ProviderCapabilities, type ProviderConfig, type ProviderConfiguration, type ProviderImplementation, ProviderManager, type ProviderMetadata, type ProviderMiddleware, type ProviderPlugin, RequestAdapterFactory, ResponseAdapterFactory, type RetryConfig, type ScheduleResult, type SendMessageRequest, type SendMessageResponse, type SendOptions, type SendRecipient, type SendResult, type SenderNumber$1 as SenderNumber, type SenderVerificationResult, type Template, type TemplateContract, type TemplateCreateRequest$1 as TemplateCreateRequest, type TemplateFilters$1 as TemplateFilters, type TemplateListRequest, type TemplateListResponse, type TemplateResult, type TemplateUpdateRequest$1 as TemplateUpdateRequest, createCircuitBreakerMiddleware, createLoggingMiddleware, createMetricsMiddleware, createRateLimitMiddleware, createRetryMiddleware, delay, extractVariables, formatDateTime, normalizePhoneNumber, parseTemplate, retry, validatePhoneNumber };
|