@k-msg/core 0.7.2 → 0.8.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/dist/index.js +19 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -19
- package/dist/index.mjs.map +1 -1
- package/dist/provider.d.ts +40 -6
- package/dist/types/index.d.ts +1 -0
- package/dist/types/kakao-channel.d.ts +28 -0
- package/package.json +1 -1
package/dist/provider.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KMsgError } from "./errors";
|
|
2
2
|
import type { Result } from "./result";
|
|
3
|
-
import type { DeliveryStatusQuery, DeliveryStatusResult, MessageType, SendOptions, SendResult } from "./types/index";
|
|
3
|
+
import type { DeliveryStatusQuery, DeliveryStatusResult, KakaoChannel, KakaoChannelCategories, MessageType, SendOptions, SendResult } from "./types/index";
|
|
4
4
|
export interface Template {
|
|
5
5
|
id: string;
|
|
6
6
|
code: string;
|
|
@@ -13,16 +13,50 @@ export interface Template {
|
|
|
13
13
|
createdAt: Date;
|
|
14
14
|
updatedAt: Date;
|
|
15
15
|
}
|
|
16
|
+
export type TemplateCreateInput = {
|
|
17
|
+
name: string;
|
|
18
|
+
content: string;
|
|
19
|
+
category?: string;
|
|
20
|
+
buttons?: unknown[];
|
|
21
|
+
variables?: string[];
|
|
22
|
+
};
|
|
23
|
+
export type TemplateUpdateInput = Partial<TemplateCreateInput>;
|
|
24
|
+
export type TemplateContext = {
|
|
25
|
+
/**
|
|
26
|
+
* Provider-specific Kakao channel key (e.g. Aligo senderKey).
|
|
27
|
+
*/
|
|
28
|
+
kakaoChannelSenderKey?: string;
|
|
29
|
+
};
|
|
16
30
|
export interface TemplateProvider {
|
|
17
|
-
createTemplate(
|
|
18
|
-
updateTemplate(code: string,
|
|
19
|
-
deleteTemplate(code: string): Promise<Result<void, KMsgError>>;
|
|
20
|
-
getTemplate(code: string): Promise<Result<Template, KMsgError>>;
|
|
31
|
+
createTemplate(input: TemplateCreateInput, ctx?: TemplateContext): Promise<Result<Template, KMsgError>>;
|
|
32
|
+
updateTemplate(code: string, patch: TemplateUpdateInput, ctx?: TemplateContext): Promise<Result<Template, KMsgError>>;
|
|
33
|
+
deleteTemplate(code: string, ctx?: TemplateContext): Promise<Result<void, KMsgError>>;
|
|
34
|
+
getTemplate(code: string, ctx?: TemplateContext): Promise<Result<Template, KMsgError>>;
|
|
21
35
|
listTemplates(params?: {
|
|
22
36
|
status?: string;
|
|
23
37
|
page?: number;
|
|
24
38
|
limit?: number;
|
|
25
|
-
}): Promise<Result<Template[], KMsgError>>;
|
|
39
|
+
}, ctx?: TemplateContext): Promise<Result<Template[], KMsgError>>;
|
|
40
|
+
}
|
|
41
|
+
export interface TemplateInspectionProvider {
|
|
42
|
+
requestTemplateInspection(code: string, ctx?: TemplateContext): Promise<Result<void, KMsgError>>;
|
|
43
|
+
}
|
|
44
|
+
export interface KakaoChannelProvider {
|
|
45
|
+
listKakaoChannels(params?: {
|
|
46
|
+
plusId?: string;
|
|
47
|
+
senderKey?: string;
|
|
48
|
+
}): Promise<Result<KakaoChannel[], KMsgError>>;
|
|
49
|
+
listKakaoChannelCategories?(): Promise<Result<KakaoChannelCategories, KMsgError>>;
|
|
50
|
+
requestKakaoChannelAuth?(params: {
|
|
51
|
+
plusId: string;
|
|
52
|
+
phoneNumber: string;
|
|
53
|
+
}): Promise<Result<void, KMsgError>>;
|
|
54
|
+
addKakaoChannel?(params: {
|
|
55
|
+
plusId: string;
|
|
56
|
+
authNum: string;
|
|
57
|
+
phoneNumber: string;
|
|
58
|
+
categoryCode: string;
|
|
59
|
+
}): Promise<Result<KakaoChannel, KMsgError>>;
|
|
26
60
|
}
|
|
27
61
|
export interface ProviderHealthStatus {
|
|
28
62
|
healthy: boolean;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface KakaoChannel {
|
|
2
|
+
providerId: string;
|
|
3
|
+
/**
|
|
4
|
+
* Provider-specific Kakao channel key.
|
|
5
|
+
* - Aligo: senderKey
|
|
6
|
+
* - Solapi: pfId (profileId)
|
|
7
|
+
*/
|
|
8
|
+
senderKey: string;
|
|
9
|
+
/**
|
|
10
|
+
* Kakao channel id including "@", when available (e.g. "@mybrand").
|
|
11
|
+
*/
|
|
12
|
+
plusId?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
status?: string;
|
|
15
|
+
createdAt?: Date;
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
raw?: unknown;
|
|
18
|
+
}
|
|
19
|
+
export interface KakaoCategoryEntry {
|
|
20
|
+
code: string;
|
|
21
|
+
name: string;
|
|
22
|
+
parentCode?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface KakaoChannelCategories {
|
|
25
|
+
first: KakaoCategoryEntry[];
|
|
26
|
+
second: KakaoCategoryEntry[];
|
|
27
|
+
third: KakaoCategoryEntry[];
|
|
28
|
+
}
|