@k-msg/core 0.3.0 → 0.5.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.
@@ -1,87 +0,0 @@
1
- import type { Button, MessageType } from "./message";
2
- export interface DeliveryStatus {
3
- status: "pending" | "sent" | "delivered" | "failed" | "cancelled";
4
- timestamp: Date;
5
- details?: Record<string, unknown>;
6
- }
7
- export declare enum StandardStatus {
8
- PENDING = "PENDING",
9
- SENT = "SENT",
10
- DELIVERED = "DELIVERED",
11
- FAILED = "FAILED",
12
- CANCELLED = "CANCELLED"
13
- }
14
- export declare enum StandardErrorCode {
15
- UNKNOWN_ERROR = "UNKNOWN_ERROR",
16
- INVALID_REQUEST = "INVALID_REQUEST",
17
- AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED",
18
- INSUFFICIENT_BALANCE = "INSUFFICIENT_BALANCE",
19
- TEMPLATE_NOT_FOUND = "TEMPLATE_NOT_FOUND",
20
- RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED",
21
- PROVIDER_ERROR = "PROVIDER_ERROR",
22
- NETWORK_ERROR = "NETWORK_ERROR"
23
- }
24
- export interface StandardError {
25
- code: StandardErrorCode;
26
- message: string;
27
- retryable: boolean;
28
- details?: Record<string, unknown>;
29
- }
30
- export interface StandardRequest {
31
- channel?: MessageType;
32
- templateCode: string;
33
- phoneNumber: string;
34
- variables: Record<string, unknown>;
35
- text?: string;
36
- imageUrl?: string;
37
- buttons?: Button[];
38
- options?: {
39
- scheduledAt?: Date;
40
- senderNumber?: string;
41
- subject?: string;
42
- /**
43
- * Provider-specific KakaoTalk options (e.g. SOLAPI kakaoOptions).
44
- */
45
- kakaoOptions?: {
46
- pfId?: string;
47
- templateId?: string;
48
- variables?: Record<string, string>;
49
- disableSms?: boolean;
50
- adFlag?: boolean;
51
- buttons?: unknown[];
52
- imageId?: string;
53
- [key: string]: unknown;
54
- };
55
- /**
56
- * Provider-specific RCS options (e.g. SOLAPI rcsOptions).
57
- */
58
- rcsOptions?: {
59
- brandId?: string;
60
- templateId?: string;
61
- variables?: Record<string, string>;
62
- disableSms?: boolean;
63
- buttons?: unknown[];
64
- additionalBody?: unknown;
65
- [key: string]: unknown;
66
- };
67
- [key: string]: any;
68
- };
69
- }
70
- export interface StandardResult {
71
- messageId: string;
72
- status: StandardStatus;
73
- provider: string;
74
- timestamp: Date;
75
- phoneNumber: string;
76
- error?: StandardError;
77
- metadata?: Record<string, unknown>;
78
- }
79
- export declare enum TemplateCategory {
80
- AUTHENTICATION = "AUTHENTICATION",
81
- NOTIFICATION = "NOTIFICATION",
82
- PROMOTION = "PROMOTION",
83
- INFORMATION = "INFORMATION",
84
- RESERVATION = "RESERVATION",
85
- SHIPPING = "SHIPPING",
86
- PAYMENT = "PAYMENT"
87
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * Universal Provider Implementation
3
- * 어댑터 패턴을 사용한 범용 프로바이더
4
- */
5
- import { type BaseProvider, type BaseProviderAdapter, type ConfigurationSchema, type DeliveryStatus, type ProviderHealthStatus, type StandardRequest, type StandardResult } from "./types/index";
6
- /**
7
- * 어댑터 기반 범용 프로바이더
8
- * 모든 프로바이더가 이 클래스를 사용하여 표준 인터페이스 구현
9
- */
10
- export declare class UniversalProvider implements BaseProvider<StandardRequest, StandardResult> {
11
- readonly id: string;
12
- readonly name: string;
13
- readonly type: "messaging";
14
- readonly version: string;
15
- private adapter;
16
- private config;
17
- private isConfigured;
18
- constructor(adapter: BaseProviderAdapter, metadata: {
19
- id: string;
20
- name: string;
21
- version: string;
22
- });
23
- configure(config: Record<string, unknown>): void;
24
- isReady(): boolean;
25
- healthCheck(): Promise<ProviderHealthStatus>;
26
- destroy(): void;
27
- send<T extends StandardRequest = StandardRequest, R extends StandardResult = StandardResult>(request: T): Promise<R>;
28
- getStatus(requestId: string): Promise<DeliveryStatus>;
29
- cancel(requestId: string): Promise<boolean>;
30
- getCapabilities(): any;
31
- getSupportedFeatures(): string[];
32
- getConfigurationSchema(): ConfigurationSchema;
33
- /**
34
- * HTTP 요청 실행
35
- */
36
- private makeHttpRequest;
37
- /**
38
- * 표준 상태를 DeliveryStatus로 변환
39
- */
40
- private mapStandardStatusToDeliveryStatus;
41
- /**
42
- * 어댑터 인스턴스 반환 (고급 사용자용)
43
- */
44
- getAdapter(): BaseProviderAdapter;
45
- /**
46
- * 프로바이더 메타데이터 반환
47
- */
48
- getMetadata(): {
49
- id: string;
50
- name: string;
51
- version: string;
52
- type: "messaging";
53
- adapter: string;
54
- };
55
- }