@k-msg/core 0.1.1 → 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.
@@ -0,0 +1,62 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = "DEBUG",
3
+ INFO = "INFO",
4
+ WARN = "WARN",
5
+ ERROR = "ERROR"
6
+ }
7
+ export interface LogContext {
8
+ component?: string;
9
+ operation?: string;
10
+ userId?: string;
11
+ sessionId?: string;
12
+ requestId?: string;
13
+ traceId?: string;
14
+ [key: string]: any;
15
+ }
16
+ export interface LogEntry {
17
+ level: LogLevel;
18
+ message: string;
19
+ timestamp: Date;
20
+ context: LogContext;
21
+ error?: Error;
22
+ duration?: number;
23
+ }
24
+ export interface LoggerConfig {
25
+ level: LogLevel;
26
+ enableConsole: boolean;
27
+ enableFile?: boolean;
28
+ filePath?: string;
29
+ maxFileSize?: number;
30
+ maxFiles?: number;
31
+ enableJson?: boolean;
32
+ enableColors?: boolean;
33
+ }
34
+ export declare class Logger {
35
+ private config;
36
+ private context;
37
+ constructor(context?: LogContext, config?: Partial<LoggerConfig>);
38
+ private shouldLog;
39
+ private formatMessage;
40
+ private colorizeLevel;
41
+ private writeLog;
42
+ debug(message: string, context?: LogContext): void;
43
+ info(message: string, context?: LogContext): void;
44
+ warn(message: string, context?: LogContext, error?: Error): void;
45
+ error(message: string, context?: LogContext, error?: Error): void;
46
+ child(context: LogContext): Logger;
47
+ time(label: string): () => void;
48
+ measure<T>(operation: string, fn: () => Promise<T>, context?: LogContext): Promise<T>;
49
+ }
50
+ export declare function createLogger(context?: LogContext, config?: Partial<LoggerConfig>): Logger;
51
+ export declare function getLogger(): Logger;
52
+ export declare function setGlobalLogger(logger: Logger): void;
53
+ export declare const logger: {
54
+ debug: (message: string, context?: LogContext) => void;
55
+ info: (message: string, context?: LogContext) => void;
56
+ warn: (message: string, context?: LogContext, error?: Error) => void;
57
+ error: (message: string, context?: LogContext, error?: Error) => void;
58
+ child: (context: LogContext) => Logger;
59
+ time: (label: string) => () => void;
60
+ measure: <T>(operation: string, fn: () => Promise<T>, context?: LogContext) => Promise<T>;
61
+ };
62
+ export declare function loggerMiddleware(config?: Partial<LoggerConfig>): (c: any, next: any) => Promise<void>;
@@ -0,0 +1,63 @@
1
+ import type { BaseProvider, Config, KMsg, MessageSendOptions, MessageSendResult, PlatformHealthStatus, PlatformInfo } from "./types/index";
2
+ /**
3
+ * Core AlimTalk Platform implementation
4
+ */
5
+ export declare class AlimTalkPlatform implements KMsg {
6
+ private static readonly channelTemplateFallbacks;
7
+ private static readonly directTemplateCodes;
8
+ private providers;
9
+ private config;
10
+ private defaultProvider?;
11
+ constructor(config: Config);
12
+ getInfo(): PlatformInfo;
13
+ registerProvider(provider: BaseProvider): void;
14
+ getProvider(providerId: string): BaseProvider | null;
15
+ listProviders(): string[];
16
+ getDefaultProvider(): BaseProvider | null;
17
+ private isLegacySendOptions;
18
+ private getProviderOrThrow;
19
+ private resolveProviderForSend;
20
+ private normalizeUnifiedRecipients;
21
+ private resolveTemplateCode;
22
+ private toErrorMessage;
23
+ private extractErrorMessage;
24
+ private hasResultFailureShape;
25
+ private hasResultSuccessShape;
26
+ private isFailedDeliveryStatus;
27
+ private normalizeSendResult;
28
+ private hasTextContent;
29
+ private validateUnifiedSendOptions;
30
+ private toProviderChannel;
31
+ private sendLegacyMessages;
32
+ private sendUnifiedMessages;
33
+ healthCheck(): Promise<PlatformHealthStatus>;
34
+ get messages(): {
35
+ send: (options: MessageSendOptions) => Promise<MessageSendResult>;
36
+ getStatus: (messageId: string) => Promise<string>;
37
+ };
38
+ /**
39
+ * @deprecated Template operations are not yet migrated to the new provider interface.
40
+ * Use the provider's adapter directly for template management.
41
+ */
42
+ templates(providerId?: string): Promise<{
43
+ /** @deprecated Not yet implemented */
44
+ list: (_page?: number, _size?: number, _filters?: any) => Promise<never>;
45
+ /** @deprecated Not yet implemented */
46
+ create: (_name: string, _content: string, _category?: string, _variables?: any[], _buttons?: any[]) => Promise<never>;
47
+ /** @deprecated Not yet implemented */
48
+ modify: (_templateCode: string, _name: string, _content: string, _buttons?: any[]) => Promise<never>;
49
+ /** @deprecated Not yet implemented */
50
+ delete: (_templateCode: string) => Promise<never>;
51
+ }>;
52
+ /**
53
+ * @deprecated History operations are not yet migrated to the new provider interface.
54
+ * Use the provider's adapter directly for history queries.
55
+ */
56
+ history(providerId?: string): Promise<{
57
+ /** @deprecated Not yet implemented */
58
+ list: (_page?: number, _size?: number, _filters?: any) => Promise<never>;
59
+ /** @deprecated Not yet implemented */
60
+ cancelReservation: (_messageId: string) => Promise<never>;
61
+ }>;
62
+ providerHealth(providerId: string): Promise<import(".").ProviderHealthStatus>;
63
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Provider Registry System
3
+ * 프로바이더 등록, 관리, 팩토리 시스템
4
+ */
5
+ import { type AdapterFactory, type BaseProvider, type ProviderConfig, type ProviderFactoryConfig, type ProviderMetadata, type StandardRequest, type StandardResult } from "./types/index";
6
+ /**
7
+ * 프로바이더 레지스트리
8
+ * 모든 등록된 프로바이더와 어댑터 팩토리를 관리
9
+ */
10
+ export declare class ProviderRegistry {
11
+ private factories;
12
+ private providers;
13
+ private metadata;
14
+ private debug;
15
+ /**
16
+ * 어댑터 팩토리 등록
17
+ */
18
+ registerFactory(factory: AdapterFactory): void;
19
+ /**
20
+ * 프로바이더 인스턴스 생성
21
+ */
22
+ createProvider(providerId: string, config: ProviderConfig): BaseProvider<StandardRequest, StandardResult>;
23
+ /**
24
+ * 등록된 프로바이더 인스턴스 반환
25
+ */
26
+ getProvider(providerId: string): BaseProvider<StandardRequest, StandardResult> | null;
27
+ /**
28
+ * 사용 가능한 프로바이더 목록
29
+ */
30
+ getAvailableProviders(): string[];
31
+ /**
32
+ * 프로바이더 메타데이터 조회
33
+ */
34
+ getProviderMetadata(providerId: string): ProviderMetadata | null;
35
+ /**
36
+ * 모든 프로바이더 메타데이터 조회
37
+ */
38
+ getAllMetadata(): ProviderMetadata[];
39
+ /**
40
+ * 특정 기능을 지원하는 프로바이더 검색
41
+ */
42
+ findProvidersByFeature(feature: string): ProviderMetadata[];
43
+ /**
44
+ * 프로바이더 등록 해제
45
+ */
46
+ unregisterProvider(providerId: string): boolean;
47
+ /**
48
+ * 모든 프로바이더 등록 해제
49
+ */
50
+ clear(): void;
51
+ /**
52
+ * 레지스트리 상태 조회
53
+ */
54
+ getStatus(): {
55
+ registeredFactories: number;
56
+ activeProviders: number;
57
+ availableProviders: string[];
58
+ metadata: ProviderMetadata[];
59
+ };
60
+ /**
61
+ * 프로바이더 헬스체크 실행
62
+ */
63
+ healthCheck(): Promise<Record<string, any>>;
64
+ /**
65
+ * 디버그 모드 설정
66
+ */
67
+ setDebug(enabled: boolean): void;
68
+ }
69
+ /**
70
+ * 글로벌 프로바이더 레지스트리 인스턴스
71
+ */
72
+ export declare const globalProviderRegistry: ProviderRegistry;
73
+ /**
74
+ * 설정 기반 프로바이더 팩토리
75
+ */
76
+ export declare class ConfigBasedProviderFactory {
77
+ private registry;
78
+ private config;
79
+ constructor(registry: ProviderRegistry, config: ProviderFactoryConfig);
80
+ /**
81
+ * 설정에서 프로바이더 생성
82
+ */
83
+ createFromConfig(providerId: string): BaseProvider<StandardRequest, StandardResult>;
84
+ /**
85
+ * 모든 설정된 프로바이더 생성
86
+ */
87
+ createAllFromConfig(): Record<string, BaseProvider<StandardRequest, StandardResult>>;
88
+ }
89
+ /**
90
+ * 플러그인 기반 프로바이더 로더
91
+ */
92
+ export declare class ProviderPluginLoader {
93
+ private registry;
94
+ constructor(registry: ProviderRegistry);
95
+ /**
96
+ * 플러그인 모듈 동적 로딩
97
+ */
98
+ loadPlugin(pluginPath: string): Promise<void>;
99
+ /**
100
+ * 여러 플러그인 배치 로딩
101
+ */
102
+ loadPlugins(pluginPaths: string[]): Promise<void>;
103
+ /**
104
+ * 팩토리 인터페이스 검증
105
+ */
106
+ private isValidFactory;
107
+ }
108
+ /**
109
+ * 프로바이더 헬스 모니터
110
+ * HealthChecker를 활용하여 프로바이더들의 헬스 상태를 모니터링
111
+ */
112
+ export declare class ProviderHealthMonitor {
113
+ private registry;
114
+ private interval;
115
+ private checker;
116
+ private intervalId?;
117
+ private registeredServices;
118
+ constructor(registry: ProviderRegistry, interval?: number);
119
+ /**
120
+ * 헬스 모니터링 시작
121
+ */
122
+ start(): void;
123
+ /**
124
+ * 헬스 모니터링 중지
125
+ */
126
+ stop(): void;
127
+ /**
128
+ * 레지스트리의 프로바이더를 HealthChecker에 동기화
129
+ */
130
+ private syncProviders;
131
+ /**
132
+ * 현재 헬스 상태 조회
133
+ */
134
+ checkNow(): Promise<import("./health").HealthStatus>;
135
+ }
@@ -0,0 +1,36 @@
1
+ import type { KMsgError } from "./errors";
2
+ import type { Result } from "./result";
3
+ import type { SendOptions, SendResult } from "./types/index";
4
+ export interface Template {
5
+ id: string;
6
+ code: string;
7
+ name: string;
8
+ content: string;
9
+ category?: string;
10
+ status: "APPROVED" | "REJECTED" | "PENDING" | "INSPECTION";
11
+ buttons?: any[];
12
+ variables?: string[];
13
+ createdAt: Date;
14
+ updatedAt: Date;
15
+ }
16
+ export interface TemplateProvider {
17
+ createTemplate(template: Omit<Template, "id" | "status" | "createdAt" | "updatedAt">): Promise<Result<Template, KMsgError>>;
18
+ updateTemplate(code: string, template: Partial<Omit<Template, "id" | "code" | "status" | "createdAt" | "updatedAt">>): Promise<Result<Template, KMsgError>>;
19
+ deleteTemplate(code: string): Promise<Result<void, KMsgError>>;
20
+ getTemplate(code: string): Promise<Result<Template, KMsgError>>;
21
+ listTemplates(params?: {
22
+ status?: string;
23
+ page?: number;
24
+ limit?: number;
25
+ }): Promise<Result<Template[], KMsgError>>;
26
+ }
27
+ /**
28
+ * @deprecated Use `BaseProvider` from `@k-msg/core` instead.
29
+ * Legacy provider interface that uses the Result<T, E> pattern for send().
30
+ * New providers should implement `BaseProvider` which uses adapter-based patterns.
31
+ */
32
+ export interface Provider {
33
+ readonly id: string;
34
+ readonly name: string;
35
+ send(params: SendOptions): Promise<Result<SendResult, KMsgError>>;
36
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Bulk operation handler with error recovery
3
+ */
4
+ import { type RetryOptions } from "./retry-handler";
5
+ export interface BulkOperationOptions {
6
+ concurrency: number;
7
+ retryOptions: RetryOptions;
8
+ failFast: boolean;
9
+ onProgress?: (completed: number, total: number, failed: number) => void;
10
+ }
11
+ export declare class BulkOperationHandler {
12
+ static execute<T, R>(items: T[], operation: (item: T) => Promise<R>, options?: Partial<BulkOperationOptions>): Promise<{
13
+ successful: {
14
+ item: T;
15
+ result: R;
16
+ }[];
17
+ failed: {
18
+ item: T;
19
+ error: Error;
20
+ }[];
21
+ summary: {
22
+ total: number;
23
+ successful: number;
24
+ failed: number;
25
+ duration: number;
26
+ };
27
+ }>;
28
+ private static createBatches;
29
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Circuit breaker pattern implementation
3
+ */
4
+ export interface CircuitBreakerOptions {
5
+ failureThreshold: number;
6
+ timeout: number;
7
+ resetTimeout: number;
8
+ onOpen?: () => void;
9
+ onHalfOpen?: () => void;
10
+ onClose?: () => void;
11
+ }
12
+ export declare class CircuitBreaker {
13
+ private options;
14
+ private state;
15
+ private failureCount;
16
+ private lastFailureTime;
17
+ private nextAttemptTime;
18
+ constructor(options: CircuitBreakerOptions);
19
+ execute<T>(operation: () => Promise<T>): Promise<T>;
20
+ private recordFailure;
21
+ getState(): string;
22
+ getFailureCount(): number;
23
+ reset(): void;
24
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Error recovery utilities - combines multiple recovery patterns
3
+ */
4
+ import { type CircuitBreakerOptions } from "./circuit-breaker";
5
+ import { type RetryOptions } from "./retry-handler";
6
+ export declare const ErrorRecovery: {
7
+ /**
8
+ * Create a resilient function that combines multiple recovery patterns
9
+ */
10
+ createResilientFunction<T extends any[], R>(func: (...args: T) => Promise<R>, options?: {
11
+ retryOptions?: Partial<RetryOptions>;
12
+ circuitBreaker?: CircuitBreakerOptions;
13
+ rateLimiter?: {
14
+ maxRequests: number;
15
+ windowMs: number;
16
+ };
17
+ timeout?: number;
18
+ fallback?: (...args: T) => Promise<R>;
19
+ }): (...args: T) => Promise<R>;
20
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Graceful degradation handler
3
+ */
4
+ import { type RetryOptions } from "./retry-handler";
5
+ export declare class GracefulDegradation {
6
+ private fallbackStrategies;
7
+ registerFallback<T>(operationName: string, fallbackFunction: () => Promise<T>): void;
8
+ executeWithFallback<T>(operationName: string, primaryOperation: () => Promise<T>, options?: {
9
+ timeout?: number;
10
+ retryOptions?: Partial<RetryOptions>;
11
+ }): Promise<T>;
12
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Health check monitor with automatic recovery
3
+ * Note: This is the resilience-layer health monitor.
4
+ * For the main health check system, see ../health.ts
5
+ */
6
+ export declare class HealthMonitor {
7
+ private services;
8
+ private healthStatus;
9
+ private lastCheck;
10
+ private checkInterval;
11
+ private intervalId?;
12
+ constructor(services: Map<string, () => Promise<boolean>>, checkIntervalMs?: number);
13
+ start(): void;
14
+ stop(): void;
15
+ private checkAllServices;
16
+ getServiceHealth(serviceName: string): boolean | undefined;
17
+ getAllHealth(): Record<string, boolean>;
18
+ isServiceHealthy(serviceName: string): boolean;
19
+ getLastCheckTime(serviceName: string): number | undefined;
20
+ }
@@ -0,0 +1,7 @@
1
+ export { BulkOperationHandler, type BulkOperationOptions, } from "./bulk-operation";
2
+ export { CircuitBreaker, type CircuitBreakerOptions } from "./circuit-breaker";
3
+ export { ErrorRecovery } from "./error-recovery";
4
+ export { GracefulDegradation } from "./graceful-degradation";
5
+ export { HealthMonitor } from "./health-monitor";
6
+ export { RateLimiter } from "./rate-limiter";
7
+ export { RetryHandler, type RetryOptions } from "./retry-handler";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Rate limiter for API calls
3
+ */
4
+ export declare class RateLimiter {
5
+ private maxRequests;
6
+ private windowMs;
7
+ private requests;
8
+ constructor(maxRequests: number, windowMs: number);
9
+ acquire(): Promise<void>;
10
+ canMakeRequest(): boolean;
11
+ getRemainingRequests(): number;
12
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Retry options and handler for K-Message Platform
3
+ */
4
+ export interface RetryOptions {
5
+ maxAttempts?: number;
6
+ initialDelay?: number;
7
+ maxDelay?: number;
8
+ backoffMultiplier?: number;
9
+ jitter?: boolean;
10
+ retryCondition?: (error: Error, attempt: number) => boolean;
11
+ onRetry?: (error: Error, attempt: number) => void;
12
+ }
13
+ /**
14
+ * Exponential backoff retry mechanism
15
+ */
16
+ export declare class RetryHandler {
17
+ private static defaultOptions;
18
+ static execute<T>(operation: () => Promise<T>, options?: Partial<RetryOptions>): Promise<T>;
19
+ static createRetryableFunction<T extends any[], R>(func: (...args: T) => Promise<R>, options?: Partial<RetryOptions>): (...args: T) => Promise<R>;
20
+ }
@@ -0,0 +1,61 @@
1
+ export type Ok<T> = {
2
+ readonly isSuccess: true;
3
+ readonly isFailure: false;
4
+ readonly value: T;
5
+ };
6
+ export type Fail<E> = {
7
+ readonly isSuccess: false;
8
+ readonly isFailure: true;
9
+ readonly error: E;
10
+ };
11
+ export type Result<T, E = Error> = Ok<T> | Fail<E>;
12
+ export declare const ok: <T>(value: T) => Ok<T>;
13
+ export declare const fail: <E>(error: E) => Fail<E>;
14
+ /**
15
+ * Result utility functions for chaining and transformation
16
+ */
17
+ export declare const Result: {
18
+ /**
19
+ * Transform the success value of a Result
20
+ */
21
+ map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
22
+ /**
23
+ * Chain Result-returning operations
24
+ */
25
+ flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
26
+ /**
27
+ * Transform the error of a Result
28
+ */
29
+ mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
30
+ /**
31
+ * Extract the value or throw the error
32
+ */
33
+ unwrap<T, E>(result: Result<T, E>): T;
34
+ /**
35
+ * Extract the value or return a default
36
+ */
37
+ unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
38
+ /**
39
+ * Extract the value or compute a default from the error
40
+ */
41
+ unwrapOrElse<T, E>(result: Result<T, E>, fn: (error: E) => T): T;
42
+ /**
43
+ * Pattern match on a Result
44
+ */
45
+ match<T, E, U>(result: Result<T, E>, handlers: {
46
+ ok: (value: T) => U;
47
+ fail: (error: E) => U;
48
+ }): U;
49
+ /**
50
+ * Convert a Promise to a Result
51
+ */
52
+ fromPromise<T, E = Error>(promise: Promise<T>): Promise<Result<T, E>>;
53
+ /**
54
+ * Check if a Result is Ok
55
+ */
56
+ isOk<T, E>(result: Result<T, E>): result is Ok<T>;
57
+ /**
58
+ * Check if a Result is Fail
59
+ */
60
+ isFail<T, E>(result: Result<T, E>): result is Fail<E>;
61
+ };
@@ -0,0 +1,12 @@
1
+ import { KMsgError, KMsgErrorCode, type Provider, type Result, type SendOptions, type SendResult } from "./index";
2
+ export declare class MockProvider implements Provider {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ constructor(id?: string, name?: string);
6
+ send(params: SendOptions): Promise<Result<SendResult, KMsgError>>;
7
+ }
8
+ export declare const TestAssertions: {
9
+ assertKMsgError: (error: any, expectedCode: KMsgErrorCode) => void;
10
+ assertSuccess: <T, E>(result: Result<T, E>) => T;
11
+ assertFailure: <T, E>(result: Result<T, E>) => E;
12
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./message";
2
+ export * from "./platform";
3
+ export * from "./provider";
4
+ export * from "./standard";
@@ -0,0 +1,34 @@
1
+ export type MessageType = "ALIMTALK" | "FRIENDTALK" | "SMS" | "LMS" | "MMS";
2
+ export interface BaseOptions {
3
+ to: string;
4
+ from: string;
5
+ messageId?: string;
6
+ }
7
+ export interface AlimTalkOptions extends BaseOptions {
8
+ type: "ALIMTALK";
9
+ templateId: string;
10
+ variables: Record<string, string>;
11
+ }
12
+ export interface Button {
13
+ name: string;
14
+ type: string;
15
+ urlPc?: string;
16
+ urlMobile?: string;
17
+ }
18
+ export interface FriendTalkOptions extends BaseOptions {
19
+ type: "FRIENDTALK";
20
+ text: string;
21
+ imageUrl?: string;
22
+ buttons?: Button[];
23
+ }
24
+ export interface SmsOptions extends BaseOptions {
25
+ type: "SMS" | "LMS" | "MMS";
26
+ text: string;
27
+ subject?: string;
28
+ }
29
+ export type SendOptions = AlimTalkOptions | FriendTalkOptions | SmsOptions;
30
+ export interface SendResult {
31
+ messageId: string;
32
+ status: "PENDING" | "SENT" | "FAILED";
33
+ provider: string;
34
+ }
@@ -0,0 +1,88 @@
1
+ import type { Button, MessageType } from "./message";
2
+ export interface PlatformHealthStatus {
3
+ healthy: boolean;
4
+ providers: Record<string, boolean>;
5
+ issues: string[];
6
+ }
7
+ export interface PlatformInfo {
8
+ version: string;
9
+ providers: string[];
10
+ features: string[];
11
+ }
12
+ export interface LegacyMessageSendOptions {
13
+ templateId: string;
14
+ recipients: {
15
+ phoneNumber: string;
16
+ variables?: Record<string, any>;
17
+ }[];
18
+ variables: Record<string, any>;
19
+ }
20
+ export interface UnifiedMessageRecipient {
21
+ phoneNumber: string;
22
+ variables?: Record<string, any>;
23
+ }
24
+ export interface UnifiedMessageSendOptions {
25
+ channel: MessageType;
26
+ recipients: Array<string | UnifiedMessageRecipient>;
27
+ providerId?: string;
28
+ templateCode?: string;
29
+ variables?: Record<string, any>;
30
+ text?: string;
31
+ subject?: string;
32
+ imageUrl?: string;
33
+ buttons?: Button[];
34
+ options?: {
35
+ scheduledAt?: Date;
36
+ senderNumber?: string;
37
+ subject?: string;
38
+ [key: string]: any;
39
+ };
40
+ }
41
+ export type MessageSendOptions = LegacyMessageSendOptions | UnifiedMessageSendOptions;
42
+ export interface MessageSendResult {
43
+ results: Array<{
44
+ messageId?: string;
45
+ status: string;
46
+ phoneNumber: string;
47
+ error?: {
48
+ message: string;
49
+ };
50
+ }>;
51
+ summary: {
52
+ total: number;
53
+ sent: number;
54
+ failed: number;
55
+ };
56
+ }
57
+ export interface KMsg {
58
+ getInfo(): PlatformInfo;
59
+ registerProvider(provider: any): void;
60
+ getProvider(providerId: string): any | null;
61
+ listProviders(): string[];
62
+ healthCheck(): Promise<PlatformHealthStatus>;
63
+ messages: {
64
+ send(options: MessageSendOptions): Promise<MessageSendResult>;
65
+ getStatus(messageId: string): Promise<string>;
66
+ };
67
+ }
68
+ export interface Config {
69
+ defaultProvider?: string;
70
+ providers: string[];
71
+ features: {
72
+ enableBulkSending?: boolean;
73
+ enableScheduling?: boolean;
74
+ enableAnalytics?: boolean;
75
+ };
76
+ messageDefaults?: {
77
+ providerId?: string;
78
+ senderNumber?: string;
79
+ subject?: string;
80
+ templateCodes?: Partial<Record<MessageType, string>>;
81
+ channels?: Partial<Record<MessageType, {
82
+ providerId?: string;
83
+ senderNumber?: string;
84
+ subject?: string;
85
+ templateCode?: string;
86
+ }>>;
87
+ };
88
+ }