@k-msg/core
v0.1.1
Published
Core types and interfaces for K-Message platform
Maintainers
Readme
@k-msg/core
Core library for the K-Message platform. Provides foundational functionality including type definitions, error handling, retry logic, and platform interfaces.
Installation
npm install @k-msg/core
# or
bun add @k-msg/coreFeatures
- 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
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
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
