@k-msg/core 0.1.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.
- package/README.md +60 -0
- package/dist/index.cjs +1015 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +565 -0
- package/dist/index.d.ts +565 -0
- package/dist/index.js +968 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @k-msg/core
|
|
2
|
+
|
|
3
|
+
Core library for the K-Message platform. Provides foundational functionality including type definitions, error handling, retry logic, and platform interfaces.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @k-msg/core
|
|
9
|
+
# or
|
|
10
|
+
bun add @k-msg/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **AlimTalkPlatform**: Core messaging platform interface
|
|
16
|
+
- **Error Handling**: Comprehensive error types and handling logic
|
|
17
|
+
- **Retry Mechanism**: Automatic retry for network failures
|
|
18
|
+
- **Health Checks**: System health monitoring and diagnostics
|
|
19
|
+
|
|
20
|
+
## Basic Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { AlimTalkPlatform } from '@k-msg/core';
|
|
24
|
+
|
|
25
|
+
const platform = new AlimTalkPlatform({
|
|
26
|
+
providers: ['iwinv'],
|
|
27
|
+
defaultProvider: 'iwinv',
|
|
28
|
+
features: {
|
|
29
|
+
enableBulkSending: true,
|
|
30
|
+
enableScheduling: true,
|
|
31
|
+
enableAnalytics: true
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Get platform information
|
|
36
|
+
const info = platform.getInfo();
|
|
37
|
+
console.log(info);
|
|
38
|
+
|
|
39
|
+
// Perform health check
|
|
40
|
+
const health = await platform.healthCheck();
|
|
41
|
+
console.log(health);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Error Handling
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { KMessageError, Result } from '@k-msg/core';
|
|
48
|
+
|
|
49
|
+
// Using Result pattern
|
|
50
|
+
const result = await Result.fromPromise(someAsyncOperation());
|
|
51
|
+
if (result.isSuccess) {
|
|
52
|
+
console.log(result.data);
|
|
53
|
+
} else {
|
|
54
|
+
console.error(result.error);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|