UNPKG

@k-msg/core

Version:

Core types and interfaces for K-Message platform

60 lines (45 loc) 1.26 kB
# @k-msg/core Core library for the K-Message platform. Provides foundational functionality including type definitions, error handling, retry logic, and platform interfaces. ## Installation ```bash npm install @k-msg/core # or bun add @k-msg/core ``` ## Features - **AlimTalkPlatform**: Core messaging platform interface - **Error Handling**: Comprehensive error types and handling logic - **Retry Mechanism**: Automatic retry for network failures - **Health Checks**: System health monitoring and diagnostics ## Basic Usage ```typescript import { AlimTalkPlatform } from '@k-msg/core'; const platform = new AlimTalkPlatform({ providers: ['iwinv'], defaultProvider: 'iwinv', features: { enableBulkSending: true, enableScheduling: true, enableAnalytics: true } }); // Get platform information const info = platform.getInfo(); console.log(info); // Perform health check const health = await platform.healthCheck(); console.log(health); ``` ## Error Handling ```typescript import { KMessageError, Result } from '@k-msg/core'; // Using Result pattern const result = await Result.fromPromise(someAsyncOperation()); if (result.isSuccess) { console.log(result.data); } else { console.error(result.error); } ``` ## License MIT