@k-msg/channel 0.19.1 → 0.21.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Canonical docs: [k-msg.and.guide](https://k-msg.and.guide)
4
4
 
5
- Channel and sender number management for the K-Message platform.
5
+ Runtime-first Kakao channel orchestration for `k-msg`.
6
6
 
7
7
  ## Installation
8
8
 
@@ -12,72 +12,65 @@ npm install @k-msg/channel @k-msg/core
12
12
  bun add @k-msg/channel @k-msg/core
13
13
  ```
14
14
 
15
- ## Features
15
+ ## Runtime API (`@k-msg/channel`)
16
16
 
17
- - **Channel Management**: Complete channel lifecycle management
18
- - **Sender Number Registration**: Automated sender number registration and verification
19
- - **Business Verification**: Business information verification for AlimTalk channels
20
- - **Permission Management**: Role-based access control for channels
21
- - **Status Monitoring**: Real-time channel status monitoring
17
+ Root exports are runtime-focused:
22
18
 
23
- ## Runtime Compatibility
19
+ - `KakaoChannelCapabilityService`
20
+ - `KakaoChannelBindingResolver`
21
+ - `KakaoChannelLifecycleService`
22
+ - runtime types (`KakaoChannelCapabilityMode`, `KakaoChannelBinding`, `ResolvedKakaoChannelBinding`, `KakaoChannelListItem`, ...)
24
23
 
25
- - Works in Edge runtimes without `nodejs_compat` (no runtime dependency on Node built-ins).
24
+ ### Capability modes
26
25
 
27
- ## Basic Usage
26
+ - `api`: provider exposes channel onboarding APIs (`list/auth/add/categories`)
27
+ - `manual`: provider requires manual onboarding (no channel onboarding API calls)
28
+ - `none`: provider does not support channel onboarding APIs
28
29
 
29
- ```typescript
30
- import { ChannelService } from '@k-msg/channel';
30
+ ### Example: resolve config binding
31
31
 
32
- const channelService = new ChannelService();
32
+ ```ts
33
+ import { KakaoChannelBindingResolver } from "@k-msg/channel";
33
34
 
34
- // Create a new AlimTalk channel
35
- const channel = await channelService.createChannel({
36
- name: 'My Business Channel',
37
- provider: 'iwinv',
38
- businessInfo: {
39
- name: 'My Company Ltd.',
40
- registrationNumber: '123-45-67890',
41
- category: 'E-COMMERCE',
42
- contactEmail: 'contact@mycompany.com',
43
- contactPhone: '02-1234-5678'
44
- }
45
- });
35
+ const resolver = new KakaoChannelBindingResolver(config);
46
36
 
47
- // Register sender number
48
- const senderNumber = await channelService.addSenderNumber(channel.id, {
49
- phoneNumber: '15881234',
50
- purpose: 'MARKETING'
37
+ const resolved = resolver.resolve({
38
+ providerId: "solapi-main",
39
+ channelAlias: "main",
40
+ senderKey: undefined,
41
+ plusId: undefined,
51
42
  });
43
+
44
+ // precedence: explicit > alias > defaults > provider config
45
+ console.log(resolved.senderKey, resolved.plusId);
52
46
  ```
53
47
 
54
- ## Channel Verification
48
+ ### Example: provider lifecycle calls
55
49
 
56
- ```typescript
57
- // Verify business information
58
- const verification = await channelService.verifyBusiness(channel.id, {
59
- documents: [
60
- { type: 'BUSINESS_LICENSE', url: 'https://docs.example.com/license.pdf' },
61
- { type: 'REPRESENTATIVE_ID', url: 'https://docs.example.com/id.pdf' }
62
- ]
63
- });
50
+ ```ts
51
+ import { KakaoChannelLifecycleService } from "@k-msg/channel";
52
+
53
+ const service = new KakaoChannelLifecycleService(provider);
64
54
 
65
- // Check verification status
66
- const status = await channelService.getVerificationStatus(channel.id);
67
- console.log('Verification status:', status);
55
+ const channels = await service.list();
56
+ if (channels.isSuccess) {
57
+ console.log(channels.value); // KakaoChannelListItem[] with source="api"
58
+ }
68
59
  ```
69
60
 
70
- ## Sender Number Management
61
+ ## Toolkit API (`@k-msg/channel/toolkit`)
71
62
 
72
- ```typescript
73
- // List all sender numbers for a channel
74
- const senderNumbers = await channelService.getSenderNumbers(channel.id);
63
+ In-memory channel/sender helpers are now toolkit-only exports:
75
64
 
76
- // Verify sender number with SMS
77
- await channelService.verifySenderNumber(senderNumber.id, '123456');
65
+ - `KakaoChannelManager`
66
+ - `KakaoSenderNumberManager`
67
+ - `ChannelCRUD`
68
+ - `PermissionManager`
69
+ - `ChannelService`
70
+ - verification helpers and legacy channel types
78
71
 
79
- // Check sender number status
80
- const numberStatus = await channelService.getSenderNumberStatus(senderNumber.id);
72
+ ```ts
73
+ import { KakaoChannelManager } from "@k-msg/channel/toolkit";
81
74
  ```
82
75
 
83
76
  ## License
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
- export { KakaoChannelManager } from "./kakao/channel";
2
- export { KakaoSenderNumberManager } from "./kakao/sender-number";
3
- export { type AuditLogEntry, ChannelCRUD, type ChannelCRUDOptions, type PaginatedResult, type PaginationOptions, } from "./management/crud";
4
- export { type AccessContext, ActionType, type Permission, type PermissionCheck, PermissionManager, type PermissionResult, PermissionScope, ResourceType, type Role, type User, } from "./management/permissions";
5
- export { ChannelService } from "./services/channel.service";
6
- export * from "./types/channel.types";
7
- export { type AutoVerificationResult, type BusinessInfo, BusinessVerifier, type BusinessVerifierOptions, type DocumentValidationResult, type VerificationRequest, } from "./verification/business.verify";
8
- export { NumberVerifier, type NumberVerifierOptions, type PhoneNumberInfo, type PhoneVerificationRequest, type PhoneVerificationStatus, type SMSProvider, type VerificationAttempt, VerificationMethod, VerificationType, type VoiceProvider, } from "./verification/number.verify";
1
+ /**
2
+ * Runtime channel APIs
3
+ */
4
+ export { KakaoChannelBindingResolver } from "./runtime/kakao-channel-binding-resolver";
5
+ export { KakaoChannelCapabilityService } from "./runtime/kakao-channel-capability.service";
6
+ export { KakaoChannelLifecycleService } from "./runtime/kakao-channel-lifecycle.service";
7
+ export type { KakaoChannelAddParams, KakaoChannelAliasEntry, KakaoChannelApiAdapter, KakaoChannelApiOperation, KakaoChannelAuthParams, KakaoChannelBinding, KakaoChannelBindingSource, KakaoChannelCapability, KakaoChannelCapabilityMode, KakaoChannelListItem, KakaoChannelListParams, KakaoChannelResolveInput, KakaoChannelResolverConfig, KakaoChannelRuntimeProvider, KakaoProviderConfigEntry, ResolvedKakaoChannelBinding, } from "./runtime/types";