@teamlearners/clawops 0.38.0 → 0.39.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.
Files changed (34) hide show
  1. package/README.md +36 -0
  2. package/dist/agent/index.cjs +77 -77
  3. package/dist/agent/index.js +4 -4
  4. package/dist/agent/livekit/index.cjs +9 -9
  5. package/dist/agent/livekit/index.js +2 -2
  6. package/dist/{chunk-VYGIWHRU.js → chunk-54GBFYZT.js} +2 -2
  7. package/dist/chunk-54GBFYZT.js.map +1 -0
  8. package/dist/chunk-FI2WH67N.cjs +8 -0
  9. package/dist/{chunk-NXCYAYFT.cjs.map → chunk-FI2WH67N.cjs.map} +1 -1
  10. package/dist/chunk-NDFDYCFM.js +6 -0
  11. package/dist/{chunk-J7UIB4EA.js.map → chunk-NDFDYCFM.js.map} +1 -1
  12. package/dist/{chunk-IYSPOOKH.cjs → chunk-OBGKLTIN.cjs} +2 -2
  13. package/dist/chunk-OBGKLTIN.cjs.map +1 -0
  14. package/dist/{chunk-ASQU6NA2.cjs → chunk-UOUNMCXE.cjs} +4 -4
  15. package/dist/{chunk-ASQU6NA2.cjs.map → chunk-UOUNMCXE.cjs.map} +1 -1
  16. package/dist/{chunk-EO25KTL4.js → chunk-W4XFMJFU.js} +3 -3
  17. package/dist/{chunk-EO25KTL4.js.map → chunk-W4XFMJFU.js.map} +1 -1
  18. package/dist/{client-ZOgpzAPe.d.cts → client-B_GblPxW.d.cts} +157 -10
  19. package/dist/{client-ZOgpzAPe.d.ts → client-B_GblPxW.d.ts} +157 -10
  20. package/dist/index.cjs +98 -40
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +70 -13
  25. package/dist/index.js.map +1 -1
  26. package/dist/solapi/index.cjs +7 -7
  27. package/dist/solapi/index.d.cts +2 -2
  28. package/dist/solapi/index.d.ts +2 -2
  29. package/dist/solapi/index.js +2 -2
  30. package/package.json +1 -1
  31. package/dist/chunk-IYSPOOKH.cjs.map +0 -1
  32. package/dist/chunk-J7UIB4EA.js +0 -6
  33. package/dist/chunk-NXCYAYFT.cjs +0 -8
  34. package/dist/chunk-VYGIWHRU.js.map +0 -1
@@ -1042,6 +1042,81 @@ declare const KakaoTemplateSchema: z.ZodObject<{
1042
1042
  updatedAt: z.ZodString;
1043
1043
  }, z.ZodTypeAny, "passthrough">>;
1044
1044
  type KakaoTemplate = z.infer<typeof KakaoTemplateSchema>;
1045
+ /**
1046
+ * 브랜드 메시지 말풍선 유형. **이 값이 단가를 정한다** — 텍스트형이 가장 싸고
1047
+ * 와이드리스트·캐러셀·커머스가 가장 비싸다.
1048
+ *
1049
+ * `MessageType` 과 같은 이유로 열어 둔 유니온이다.
1050
+ */
1051
+ type BrandBubbleType = 'TEXT' | 'IMAGE' | 'WIDE' | 'WIDE_ITEM_LIST' | 'CAROUSEL_FEED' | 'COMMERCE' | 'CAROUSEL_COMMERCE' | (string & {});
1052
+ /**
1053
+ * 브랜드 메시지 템플릿.
1054
+ *
1055
+ * ⭐ **알림톡과 달리 검수가 없다** — `status`·`dormant`·`sendable` 이 없는 이유이고,
1056
+ * 목록에 있으면 곧 발송할 수 있다.
1057
+ */
1058
+ declare const KakaoBrandTemplateSchema: z.ZodObject<{
1059
+ /** ClawOps 템플릿 리소스 ID. 발송의 `brand.templateId` 에 이 값을 쓴다. */
1060
+ id: z.ZodString;
1061
+ /** ClawOps 채널 리소스 ID. 발송의 `brand.channelId` 와 같은 값이다. */
1062
+ channelId: z.ZodString;
1063
+ name: z.ZodString;
1064
+ chatBubbleType: z.ZodType<BrandBubbleType>;
1065
+ /**
1066
+ * 말풍선 본문.
1067
+ *
1068
+ * ⚠️ **유형에 따라 `null` 이다.** 본문이 담기는 자리가 유형마다 달라 `TEXT`·`IMAGE`·
1069
+ * `WIDE` 에만 채워진다 — 나머지는 헤더·카드·상품명이 그 자리를 대신한다.
1070
+ */
1071
+ content: z.ZodNullable<z.ZodString>;
1072
+ /** 와이드리스트형의 머리말. 다른 유형에서는 `null`. */
1073
+ header: z.ZodNullable<z.ZodString>;
1074
+ /** 발송 시 `brand.variables` 에 모두 채워야 하는 변수 이름. */
1075
+ variables: z.ZodArray<z.ZodString, "many">;
1076
+ createdAt: z.ZodString;
1077
+ updatedAt: z.ZodString;
1078
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1079
+ /** ClawOps 템플릿 리소스 ID. 발송의 `brand.templateId` 에 이 값을 쓴다. */
1080
+ id: z.ZodString;
1081
+ /** ClawOps 채널 리소스 ID. 발송의 `brand.channelId` 와 같은 값이다. */
1082
+ channelId: z.ZodString;
1083
+ name: z.ZodString;
1084
+ chatBubbleType: z.ZodType<BrandBubbleType>;
1085
+ /**
1086
+ * 말풍선 본문.
1087
+ *
1088
+ * ⚠️ **유형에 따라 `null` 이다.** 본문이 담기는 자리가 유형마다 달라 `TEXT`·`IMAGE`·
1089
+ * `WIDE` 에만 채워진다 — 나머지는 헤더·카드·상품명이 그 자리를 대신한다.
1090
+ */
1091
+ content: z.ZodNullable<z.ZodString>;
1092
+ /** 와이드리스트형의 머리말. 다른 유형에서는 `null`. */
1093
+ header: z.ZodNullable<z.ZodString>;
1094
+ /** 발송 시 `brand.variables` 에 모두 채워야 하는 변수 이름. */
1095
+ variables: z.ZodArray<z.ZodString, "many">;
1096
+ createdAt: z.ZodString;
1097
+ updatedAt: z.ZodString;
1098
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1099
+ /** ClawOps 템플릿 리소스 ID. 발송의 `brand.templateId` 에 이 값을 쓴다. */
1100
+ id: z.ZodString;
1101
+ /** ClawOps 채널 리소스 ID. 발송의 `brand.channelId` 와 같은 값이다. */
1102
+ channelId: z.ZodString;
1103
+ name: z.ZodString;
1104
+ chatBubbleType: z.ZodType<BrandBubbleType>;
1105
+ /**
1106
+ * 말풍선 본문.
1107
+ *
1108
+ * ⚠️ **유형에 따라 `null` 이다.** 본문이 담기는 자리가 유형마다 달라 `TEXT`·`IMAGE`·
1109
+ * `WIDE` 에만 채워진다 — 나머지는 헤더·카드·상품명이 그 자리를 대신한다.
1110
+ */
1111
+ content: z.ZodNullable<z.ZodString>;
1112
+ /** 와이드리스트형의 머리말. 다른 유형에서는 `null`. */
1113
+ header: z.ZodNullable<z.ZodString>;
1114
+ /** 발송 시 `brand.variables` 에 모두 채워야 하는 변수 이름. */
1115
+ variables: z.ZodArray<z.ZodString, "many">;
1116
+ createdAt: z.ZodString;
1117
+ updatedAt: z.ZodString;
1118
+ }, z.ZodTypeAny, "passthrough">>;
1119
+ type KakaoBrandTemplate = z.infer<typeof KakaoBrandTemplateSchema>;
1045
1120
  /** 채널 업종 카테고리. **열린 집합이므로 코드에 하드코딩하지 말 것** — 이 응답이 정본이다. */
1046
1121
  declare const KakaoChannelCategorySchema: z.ZodObject<{
1047
1122
  /** 채널 연결의 `categoryCode` 에 그대로 보내는 값. */
@@ -1213,6 +1288,13 @@ interface KakaoTemplateListParams {
1213
1288
  page?: number;
1214
1289
  pageSize?: number;
1215
1290
  }
1291
+ /** 브랜드 메시지 템플릿 목록. 알림톡과 같은 축(채널 필수)이다. */
1292
+ interface KakaoBrandTemplateListParams {
1293
+ /** ClawOps 채널 리소스 ID. **필수다** — 없으면 `400` 이다. */
1294
+ channelId: string;
1295
+ page?: number;
1296
+ pageSize?: number;
1297
+ }
1216
1298
 
1217
1299
  type RequestOptions$1 = {
1218
1300
  extraHeaders?: Record<string, string>;
@@ -1288,14 +1370,28 @@ declare class KakaoTemplates extends APIResource {
1288
1370
  */
1289
1371
  list(params: KakaoTemplateListParams, options?: RequestOptions$1): Promise<Page<KakaoTemplate>>;
1290
1372
  }
1373
+ declare class KakaoBrandTemplates extends APIResource {
1374
+ /**
1375
+ * 한 채널의 브랜드 메시지 템플릿 목록.
1376
+ *
1377
+ * 응답의 `data[].id` 를 발송의 `brand.templateId` 로, `data[].channelId` 를
1378
+ * `brand.channelId` 로 쓴다. `variables` 의 모든 항목을 `brand.variables` 에 채워야 한다.
1379
+ *
1380
+ * ⭐ **알림톡과 달리 검수가 없어** `sendable` 같은 칸이 없다 — 목록에 있으면 곧 보낼 수 있다.
1381
+ */
1382
+ list(params: KakaoBrandTemplateListParams, options?: RequestOptions$1): Promise<Page<KakaoBrandTemplate>>;
1383
+ }
1291
1384
  /**
1292
- * 카카오 알림톡 관련 리소스.
1385
+ * 카카오 알림톡·브랜드 메시지 관련 리소스.
1293
1386
  *
1294
- * 발송 자체는 `client.messages.create({ kakao: … })` 여기서 얻은 채널·템플릿 ID 를 그대로 쓴다.
1387
+ * 발송 자체는 `client.messages.create({ kakao: … })` 또는 `({ brand: })`
1388
+ * 여기서 얻은 채널·템플릿 ID 를 그대로 쓴다.
1295
1389
  */
1296
1390
  declare class Kakao extends APIResource {
1297
1391
  get channels(): KakaoChannels;
1298
1392
  get templates(): KakaoTemplates;
1393
+ /** 브랜드 메시지 템플릿. 알림톡 템플릿(`templates`)과 **다른 표**다. */
1394
+ get brandTemplates(): KakaoBrandTemplates;
1299
1395
  /**
1300
1396
  * 채널 연결 시 지정할 업종 카테고리 목록.
1301
1397
  *
@@ -1426,6 +1522,7 @@ interface TextMessageCreateParams extends MessageCreateBaseParams {
1426
1522
  /** MMS 첨부 (최대 3개). jpg·jpeg·png·bmp, 장당 300KB 이하. */
1427
1523
  mediaUrl?: string[];
1428
1524
  kakao?: never;
1525
+ brand?: never;
1429
1526
  fallback?: never;
1430
1527
  }
1431
1528
  /** 알림톡 템플릿 지정. 구조(본문·버튼·아이템·강조)는 검수된 템플릿이 정하고, 요청은 값만 채운다. */
@@ -1464,6 +1561,7 @@ interface KakaoFallbackParams {
1464
1561
  */
1465
1562
  interface KakaoMessageCreateParams extends MessageCreateBaseParams {
1466
1563
  kakao: KakaoSendParams;
1564
+ brand?: never;
1467
1565
  fallback?: KakaoFallbackParams;
1468
1566
  /** `kakao` 를 실으면 알림톡이다. 명시할 필요가 없고, 명시한다면 `'ata'` 뿐이다. */
1469
1567
  type?: 'ata';
@@ -1471,12 +1569,49 @@ interface KakaoMessageCreateParams extends MessageCreateBaseParams {
1471
1569
  subject?: never;
1472
1570
  mediaUrl?: never;
1473
1571
  }
1572
+ /** 브랜드 메시지 템플릿 지정. 구조(본문·버튼·이미지)는 등록한 템플릿이 정한다. */
1573
+ interface BrandSendParams {
1574
+ /** `kakao.channels.list()` 의 `data[].id` (ClawOps 리소스 ID). */
1575
+ channelId: string;
1576
+ /**
1577
+ * `kakao.brandTemplates.list()` 의 `data[].id` (ClawOps 리소스 ID).
1578
+ */
1579
+ templateId: string;
1580
+ /**
1581
+ * 템플릿 변수. 키는 `고객명` 과 `#{고객명}` 을 모두 받는다.
1582
+ *
1583
+ * 채워야 할 이름은 `kakao.brandTemplates.list()` 응답의 `variables` 가 알려준다.
1584
+ */
1585
+ variables?: Record<string, string>;
1586
+ }
1587
+ /**
1588
+ * 카카오 브랜드 메시지 발송 파라미터.
1589
+ *
1590
+ * 채널을 **추가한 친구**에게 나가는 광고성 메시지다. 알림톡과 갈리는 점 둘:
1591
+ *
1592
+ * - **야간에 못 보낸다.** 20:50~08:00(KST)은 `422 kakao_brand_night_blocked` 다.
1593
+ * - **대체발송이 없다.** `fallback` 을 실으면 `400 kakao_fallback_not_allowed` 라서
1594
+ * 타입에서도 막는다.
1595
+ *
1596
+ * `(광고)` 표기와 수신거부 안내는 카카오가 붙이므로 본문에 넣지 않는다.
1597
+ */
1598
+ interface BrandMessageCreateParams extends MessageCreateBaseParams {
1599
+ brand: BrandSendParams;
1600
+ /** `brand` 를 실으면 브랜드 메시지다. 명시할 필요가 없고, 명시한다면 `'bms'` 뿐이다. */
1601
+ type?: 'bms';
1602
+ body?: never;
1603
+ subject?: never;
1604
+ mediaUrl?: never;
1605
+ kakao?: never;
1606
+ fallback?: never;
1607
+ }
1474
1608
  /**
1475
- * 발송 파라미터. 문자와 알림톡은 **서로 배타적**이다 — 서버 규칙이 그렇고, 섞으면 컴파일 에러다.
1609
+ * 발송 파라미터. 문자·알림톡·브랜드 메시지는 **서로 배타적**이다 — 서버 규칙이 그렇고,
1610
+ * 섞으면 컴파일 에러다.
1476
1611
  */
1477
- type MessageCreateParams = TextMessageCreateParams | KakaoMessageCreateParams;
1612
+ type MessageCreateParams = TextMessageCreateParams | KakaoMessageCreateParams | BrandMessageCreateParams;
1478
1613
  interface MessageListParams {
1479
- type?: TextMessageType | 'ata';
1614
+ type?: TextMessageType | 'ata' | 'bms';
1480
1615
  status?: 'queued' | 'sent' | 'failed' | 'received';
1481
1616
  /** 발신 또는 수신 번호. 하이픈 유무를 모두 매칭한다. */
1482
1617
  number?: string;
@@ -1486,10 +1621,10 @@ interface MessageListParams {
1486
1621
 
1487
1622
  declare class Messages extends APIResource {
1488
1623
  /**
1489
- * 문자(SMS/LMS/MMS) 또는 카카오 알림톡을 발송합니다.
1624
+ * 문자(SMS/LMS/MMS) 또는 카카오 알림톡·브랜드 메시지를 발송합니다.
1490
1625
  *
1491
- * 둘은 배타적입니다 — `kakao` 를 실으면 알림톡이고, 이때 `body`·`subject`·`mediaUrl`
1492
- * 실을 수 없습니다(본문은 검수된 템플릿이 정합니다).
1626
+ * 셋은 배타적입니다 — `kakao` 를 실으면 알림톡, `brand` 를 실으면 브랜드 메시지이고,
1627
+ * 이때 `body`·`subject`·`mediaUrl` 은 실을 수 없습니다(본문은 템플릿이 정합니다).
1493
1628
  *
1494
1629
  * ```ts
1495
1630
  * // 문자
@@ -1502,6 +1637,14 @@ declare class Messages extends APIResource {
1502
1637
  * kakao: { channelId, templateId, variables: { 고객명: '홍길동' } },
1503
1638
  * fallback: { body: '주문이 접수되었습니다.' },
1504
1639
  * });
1640
+ *
1641
+ * // 브랜드 메시지 — 채널을 추가한 친구에게 나가는 광고성 메시지
1642
+ * // ⚠️ 야간 제한과 대체발송 없음 — 제약은 `BrandMessageCreateParams` 참고.
1643
+ * await client.messages.create({
1644
+ * to: '010…',
1645
+ * from: '070…',
1646
+ * brand: { channelId, templateId, variables: { 고객명: '홍길동' } },
1647
+ * });
1505
1648
  * ```
1506
1649
  */
1507
1650
  create(params: MessageCreateParams, options?: {
@@ -1912,7 +2055,11 @@ declare class AccountContext {
1912
2055
  * 그렇게 보내므로 SDK 가 임의로 정규화하지 않는다. 열린 유니온이라 목록에 없는 코드도
1913
2056
  * 그대로 실린다(자동완성만 돕는다).
1914
2057
  */
1915
- type ClawOpsErrorCode = 'invalid_phone' | 'invalid_type' | 'invalid_input' | 'from_not_registered' | 'body_too_long' | 'sms_no_subject' | 'sms_no_media' | 'lms_no_media' | 'too_many_media' | 'invalid_media_ext' | 'media_download_failed' | 'type_not_supported' | 'messaging_blocked' | 'recipient_blocked' | 'quota_exceeded' | 'override_quota_exceeded' | 'no_active_subscription' | 'kakao_required' | 'kakao_type_conflict' | 'kakao_body_not_allowed' | 'kakao_subject_not_allowed' | 'kakao_media_not_allowed' | 'kakao_channel_not_found' | 'kakao_template_not_found' | 'kakao_template_not_approved' | 'kakao_template_dormant' | 'kakao_variable_missing' | 'kakao_variable_unknown' | 'kakao_send_failed' | 'kakao_unavailable' | 'invalid_fallback_type' | 'KAKAO_TOKEN_INVALID' | 'KAKAO_CHANNEL_ALREADY_LINKED' | 'KAKAO_CHANNEL_REJECTED' | 'KAKAO_RATE_LIMITED' | 'KAKAO_PROVIDER_UNAVAILABLE' | 'VALIDATION' | 'NOT_FOUND' | (string & {});
2058
+ type ClawOpsErrorCode = 'invalid_phone' | 'invalid_type' | 'invalid_input' | 'from_not_registered' | 'body_too_long' | 'sms_no_subject' | 'sms_no_media' | 'lms_no_media' | 'too_many_media' | 'invalid_media_ext' | 'media_download_failed' | 'type_not_supported' | 'messaging_blocked' | 'recipient_blocked' | 'quota_exceeded' | 'override_quota_exceeded' | 'no_active_subscription' | 'kakao_required' | 'kakao_type_conflict' | 'kakao_body_not_allowed' | 'kakao_subject_not_allowed' | 'kakao_media_not_allowed' | 'kakao_channel_not_found' | 'kakao_template_not_found' | 'kakao_template_not_approved' | 'kakao_template_dormant' | 'kakao_variable_missing' | 'kakao_variable_unknown' | 'kakao_send_failed' | 'kakao_unavailable' | 'invalid_fallback_type' | 'kakao_brand_required' | 'kakao_brand_template_not_found'
2059
+ /** 광고성이라 20:50~08:00(KST)에는 접수되지 않는다. 하루 11시간 동안 나오므로 재시도 스케줄링이 이 분기에 달린다. */
2060
+ | 'kakao_brand_night_blocked'
2061
+ /** 브랜드는 대체발송이 없다 — `fallback` 을 실으면 이 코드다. */
2062
+ | 'kakao_fallback_not_allowed' | 'KAKAO_TOKEN_INVALID' | 'KAKAO_CHANNEL_ALREADY_LINKED' | 'KAKAO_CHANNEL_REJECTED' | 'KAKAO_RATE_LIMITED' | 'KAKAO_PROVIDER_UNAVAILABLE' | 'VALIDATION' | 'NOT_FOUND' | (string & {});
1916
2063
  declare class ClawOpsError extends Error {
1917
2064
  constructor(message: string);
1918
2065
  }
@@ -2116,4 +2263,4 @@ declare class ClawOps extends APIClient {
2116
2263
  accounts(accountId: string): AccountContext;
2117
2264
  }
2118
2265
 
2119
- export { type MessageListParams as $, APIClient as A, BadRequestError as B, type Call as C, ClawOps as D, ClawOpsError as E, type ClawOpsErrorCode as F, type ClawOpsOptions as G, ConflictError as H, InternalServerError as I, type KakaoChannel as J, Kakao as K, type KakaoChannelCategory as L, type KakaoChannelCategoryList as M, type KakaoChannelConnectParams as N, type KakaoChannelListParams as O, type KakaoChannelStatus as P, KakaoChannels as Q, type KakaoFallbackParams as R, type KakaoMessageCreateParams as S, type KakaoSendParams as T, type KakaoTemplate as U, type KakaoTemplateListParams as V, KakaoTemplates as W, type KakaoTokenRequest as X, type KakaoTokenRequestParams as Y, type Message as Z, type MessageCreateParams as _, type APIClientOptions as a, Messages as a0, NotFoundError as a1, type NumberCreateParams as a2, type NumberListItem as a3, type NumberUpdateParams as a4, type NumberUpdateResponse as a5, Numbers as a6, Page as a7, PermissionDeniedError as a8, type PhoneNumber as a9, RateLimitError as aa, type RecordingDownload as ab, Recordings as ac, type RoutingType as ad, ServiceUnavailableError as ae, type SipCredential as af, SipCredentials as ag, type SipEndpoint as ah, SipEndpoints as ai, SolapiBridgeError as aj, type TextMessageCreateParams as ak, UnprocessableEntityError as al, type WebhookLog as am, WebhookLogs as an, WebhookVerificationError as ao, Webhooks as ap, APIConnectionError as b, APIError as c, APIResponseValidationError as d, APIStatusError as e, APITimeoutError as f, AccountContext as g, AgentConnectionError as h, AgentError as i, type AssignmentLink as j, type AssignmentLinkAssignment as k, type AssignmentLinkCreateResponse as l, type AssignmentLinkStatus as m, AssignmentLinks as n, AuthenticationError as o, type BlockedChannel as p, type BlockedRecipient as q, type BlockedRecipientSource as r, type BlockedRecipientStatus as s, BlockedRecipients as t, type CallContextParam as u, type CallControlResponse as v, type CallCreateParams as w, type CallListParams as x, type CallUpdateParams as y, Calls as z };
2266
+ export { type KakaoTemplateListParams as $, APIClient as A, BadRequestError as B, type Call as C, type CallListParams as D, type CallUpdateParams as E, Calls as F, ClawOps as G, ClawOpsError as H, type ClawOpsErrorCode as I, type ClawOpsOptions as J, ConflictError as K, InternalServerError as L, Kakao as M, type KakaoBrandTemplate as N, type KakaoBrandTemplateListParams as O, KakaoBrandTemplates as P, type KakaoChannel as Q, type KakaoChannelCategory as R, type KakaoChannelCategoryList as S, type KakaoChannelConnectParams as T, type KakaoChannelListParams as U, type KakaoChannelStatus as V, KakaoChannels as W, type KakaoFallbackParams as X, type KakaoMessageCreateParams as Y, type KakaoSendParams as Z, type KakaoTemplate as _, type APIClientOptions as a, KakaoTemplates as a0, type KakaoTokenRequest as a1, type KakaoTokenRequestParams as a2, type Message as a3, type MessageCreateParams as a4, type MessageListParams as a5, Messages as a6, NotFoundError as a7, type NumberCreateParams as a8, type NumberListItem as a9, type NumberUpdateParams as aa, type NumberUpdateResponse as ab, Numbers as ac, Page as ad, PermissionDeniedError as ae, type PhoneNumber as af, RateLimitError as ag, type RecordingDownload as ah, Recordings as ai, type RoutingType as aj, ServiceUnavailableError as ak, type SipCredential as al, SipCredentials as am, type SipEndpoint as an, SipEndpoints as ao, SolapiBridgeError as ap, type TextMessageCreateParams as aq, UnprocessableEntityError as ar, type WebhookLog as as, WebhookLogs as at, WebhookVerificationError as au, Webhooks as av, APIConnectionError as b, APIError as c, APIResponseValidationError as d, APIStatusError as e, APITimeoutError as f, AccountContext as g, AgentConnectionError as h, AgentError as i, type AssignmentLink as j, type AssignmentLinkAssignment as k, type AssignmentLinkCreateResponse as l, type AssignmentLinkStatus as m, AssignmentLinks as n, AuthenticationError as o, type BlockedChannel as p, type BlockedRecipient as q, type BlockedRecipientSource as r, type BlockedRecipientStatus as s, BlockedRecipients as t, type BrandBubbleType as u, type BrandMessageCreateParams as v, type BrandSendParams as w, type CallContextParam as x, type CallControlResponse as y, type CallCreateParams as z };
package/dist/index.cjs CHANGED
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var chunkLLPMUDNE_cjs = require('./chunk-LLPMUDNE.cjs');
6
- var chunkIYSPOOKH_cjs = require('./chunk-IYSPOOKH.cjs');
7
- var chunkNXCYAYFT_cjs = require('./chunk-NXCYAYFT.cjs');
6
+ var chunkOBGKLTIN_cjs = require('./chunk-OBGKLTIN.cjs');
7
+ var chunkFI2WH67N_cjs = require('./chunk-FI2WH67N.cjs');
8
8
  var zod = require('zod');
9
9
  var crypto = require('crypto');
10
10
 
@@ -15,11 +15,11 @@ function validateBaseUrl(url) {
15
15
  try {
16
16
  parsed = new URL(url);
17
17
  } catch {
18
- throw new chunkIYSPOOKH_cjs.ClawOpsError(`Invalid base_url: ${url}`);
18
+ throw new chunkOBGKLTIN_cjs.ClawOpsError(`Invalid base_url: ${url}`);
19
19
  }
20
20
  if (parsed.protocol === "https:") return url;
21
21
  if (parsed.protocol === "http:" && LOCALHOST_HOSTS.has(parsed.hostname)) return url;
22
- throw new chunkIYSPOOKH_cjs.ClawOpsError(
22
+ throw new chunkOBGKLTIN_cjs.ClawOpsError(
23
23
  `base_url\uC740 HTTPS\uB97C \uC0AC\uC6A9\uD574\uC57C \uD569\uB2C8\uB2E4 (\uBC1B\uC740 \uAC12: '${url}'). \uB85C\uCEEC \uAC1C\uBC1C \uC2DC\uC5D0\uB294 http://localhost\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.`
24
24
  );
25
25
  }
@@ -43,7 +43,7 @@ var APIClient = class {
43
43
  Authorization: `Bearer ${this._apiKey}`,
44
44
  "Content-Type": "application/json",
45
45
  Accept: "application/json",
46
- "User-Agent": `claw-ops-node/${chunkNXCYAYFT_cjs.VERSION}`,
46
+ "User-Agent": `claw-ops-node/${chunkFI2WH67N_cjs.VERSION}`,
47
47
  ...this._defaultHeaders
48
48
  };
49
49
  if (extra) Object.assign(headers, extra);
@@ -79,14 +79,14 @@ var APIClient = class {
79
79
  await this._sleep(this._retryDelay(this._maxRetries - retriesLeft));
80
80
  continue;
81
81
  }
82
- throw new chunkIYSPOOKH_cjs.APITimeoutError({ method: method2, url });
82
+ throw new chunkOBGKLTIN_cjs.APITimeoutError({ method: method2, url });
83
83
  }
84
84
  if (retriesLeft > 0) {
85
85
  retriesLeft--;
86
86
  await this._sleep(this._retryDelay(this._maxRetries - retriesLeft));
87
87
  continue;
88
88
  }
89
- throw new chunkIYSPOOKH_cjs.APIConnectionError({ method: method2, url });
89
+ throw new chunkOBGKLTIN_cjs.APIConnectionError({ method: method2, url });
90
90
  } finally {
91
91
  clearTimeout(timeoutId);
92
92
  }
@@ -102,7 +102,7 @@ var APIClient = class {
102
102
  } catch {
103
103
  body = null;
104
104
  }
105
- throw chunkIYSPOOKH_cjs.makeStatusError(response.status, body, response.headers, { method: method2, url });
105
+ throw chunkOBGKLTIN_cjs.makeStatusError(response.status, body, response.headers, { method: method2, url });
106
106
  }
107
107
  }
108
108
  async _request(method2, path, options = {}) {
@@ -113,11 +113,11 @@ var APIClient = class {
113
113
  try {
114
114
  json = await response.json();
115
115
  } catch {
116
- throw new chunkIYSPOOKH_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
116
+ throw new chunkOBGKLTIN_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
117
117
  }
118
118
  const parsed = options.castTo.safeParse(json);
119
119
  if (!parsed.success) {
120
- throw new chunkIYSPOOKH_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
120
+ throw new chunkOBGKLTIN_cjs.APIResponseValidationError({ status: response.status }, { method: method2, url });
121
121
  }
122
122
  return parsed.data;
123
123
  }
@@ -691,6 +691,27 @@ var KakaoTemplateSchema = zod.z.object({
691
691
  createdAt: zod.z.string(),
692
692
  updatedAt: zod.z.string()
693
693
  }).passthrough();
694
+ var KakaoBrandTemplateSchema = zod.z.object({
695
+ /** ClawOps 템플릿 리소스 ID. 발송의 `brand.templateId` 에 이 값을 쓴다. */
696
+ id: zod.z.string(),
697
+ /** ClawOps 채널 리소스 ID. 발송의 `brand.channelId` 와 같은 값이다. */
698
+ channelId: zod.z.string(),
699
+ name: zod.z.string(),
700
+ chatBubbleType: zod.z.string(),
701
+ /**
702
+ * 말풍선 본문.
703
+ *
704
+ * ⚠️ **유형에 따라 `null` 이다.** 본문이 담기는 자리가 유형마다 달라 `TEXT`·`IMAGE`·
705
+ * `WIDE` 에만 채워진다 — 나머지는 헤더·카드·상품명이 그 자리를 대신한다.
706
+ */
707
+ content: zod.z.string().nullable(),
708
+ /** 와이드리스트형의 머리말. 다른 유형에서는 `null`. */
709
+ header: zod.z.string().nullable(),
710
+ /** 발송 시 `brand.variables` 에 모두 채워야 하는 변수 이름. */
711
+ variables: zod.z.array(zod.z.string()),
712
+ createdAt: zod.z.string(),
713
+ updatedAt: zod.z.string()
714
+ }).passthrough();
694
715
  var KakaoChannelCategorySchema = zod.z.object({
695
716
  /** 채널 연결의 `categoryCode` 에 그대로 보내는 값. */
696
717
  code: zod.z.string(),
@@ -836,6 +857,32 @@ var KakaoTemplates = class extends APIResource {
836
857
  return page;
837
858
  }
838
859
  };
860
+ var KakaoBrandTemplates = class extends APIResource {
861
+ /**
862
+ * 한 채널의 브랜드 메시지 템플릿 목록.
863
+ *
864
+ * 응답의 `data[].id` 를 발송의 `brand.templateId` 로, `data[].channelId` 를
865
+ * `brand.channelId` 로 쓴다. `variables` 의 모든 항목을 `brand.variables` 에 채워야 한다.
866
+ *
867
+ * ⭐ **알림톡과 달리 검수가 없어** `sendable` 같은 칸이 없다 — 목록에 있으면 곧 보낼 수 있다.
868
+ */
869
+ async list(params, options = {}) {
870
+ const query = stripNotGiven({
871
+ channelId: params.channelId,
872
+ page: params.page,
873
+ pageSize: params.pageSize
874
+ });
875
+ const path = `${this._basePath}/kakao/brand-templates`;
876
+ const raw = await this._client._get(path, {
877
+ castTo: PageSchema(KakaoBrandTemplateSchema),
878
+ query: Object.keys(query).length ? query : void 0,
879
+ ...options
880
+ });
881
+ const page = new Page(raw.data, raw.meta);
882
+ page._setClient(this._client, path, KakaoBrandTemplateSchema, query);
883
+ return page;
884
+ }
885
+ };
839
886
  var Kakao = class extends APIResource {
840
887
  get channels() {
841
888
  return new KakaoChannels(this._client, this._accountId);
@@ -843,6 +890,10 @@ var Kakao = class extends APIResource {
843
890
  get templates() {
844
891
  return new KakaoTemplates(this._client, this._accountId);
845
892
  }
893
+ /** 브랜드 메시지 템플릿. 알림톡 템플릿(`templates`)과 **다른 표**다. */
894
+ get brandTemplates() {
895
+ return new KakaoBrandTemplates(this._client, this._accountId);
896
+ }
846
897
  /**
847
898
  * 채널 연결 시 지정할 업종 카테고리 목록.
848
899
  *
@@ -885,12 +936,13 @@ var MessageSchema = zod.z.object({
885
936
  }).passthrough();
886
937
 
887
938
  // src/resources/messages.ts
939
+ var templateBlock = (p) => p && stripNotGiven({ ChannelId: p.channelId, TemplateId: p.templateId, Variables: p.variables });
888
940
  var Messages = class extends APIResource {
889
941
  /**
890
- * 문자(SMS/LMS/MMS) 또는 카카오 알림톡을 발송합니다.
942
+ * 문자(SMS/LMS/MMS) 또는 카카오 알림톡·브랜드 메시지를 발송합니다.
891
943
  *
892
- * 둘은 배타적입니다 — `kakao` 를 실으면 알림톡이고, 이때 `body`·`subject`·`mediaUrl`
893
- * 실을 수 없습니다(본문은 검수된 템플릿이 정합니다).
944
+ * 셋은 배타적입니다 — `kakao` 를 실으면 알림톡, `brand` 를 실으면 브랜드 메시지이고,
945
+ * 이때 `body`·`subject`·`mediaUrl` 은 실을 수 없습니다(본문은 템플릿이 정합니다).
894
946
  *
895
947
  * ```ts
896
948
  * // 문자
@@ -903,6 +955,14 @@ var Messages = class extends APIResource {
903
955
  * kakao: { channelId, templateId, variables: { 고객명: '홍길동' } },
904
956
  * fallback: { body: '주문이 접수되었습니다.' },
905
957
  * });
958
+ *
959
+ * // 브랜드 메시지 — 채널을 추가한 친구에게 나가는 광고성 메시지
960
+ * // ⚠️ 야간 제한과 대체발송 없음 — 제약은 `BrandMessageCreateParams` 참고.
961
+ * await client.messages.create({
962
+ * to: '010…',
963
+ * from: '070…',
964
+ * brand: { channelId, templateId, variables: { 고객명: '홍길동' } },
965
+ * });
906
966
  * ```
907
967
  */
908
968
  async create(params, options = {}) {
@@ -915,11 +975,8 @@ var Messages = class extends APIResource {
915
975
  MediaUrl: params.mediaUrl,
916
976
  IdempotencyKey: params.idempotencyKey,
917
977
  // 중첩 객체는 손으로 조립한다 — stripNotGiven 은 한 겹만 훑는다.
918
- Kakao: params.kakao && stripNotGiven({
919
- ChannelId: params.kakao.channelId,
920
- TemplateId: params.kakao.templateId,
921
- Variables: params.kakao.variables
922
- }),
978
+ Kakao: templateBlock(params.kakao),
979
+ Brand: templateBlock(params.brand),
923
980
  Fallback: params.fallback && stripNotGiven({
924
981
  Type: params.fallback.type,
925
982
  Subject: params.fallback.subject,
@@ -1238,7 +1295,7 @@ var AccountContext = class {
1238
1295
  return new Kakao(this._client, this._accountId);
1239
1296
  }
1240
1297
  };
1241
- var WebhookVerificationError = class extends chunkIYSPOOKH_cjs.ClawOpsError {
1298
+ var WebhookVerificationError = class extends chunkOBGKLTIN_cjs.ClawOpsError {
1242
1299
  constructor(message = "Webhook \uC11C\uBA85\uC774 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.") {
1243
1300
  super(message);
1244
1301
  this.name = "WebhookVerificationError";
@@ -1268,11 +1325,11 @@ var ClawOps = class extends APIClient {
1268
1325
  constructor(options = {}) {
1269
1326
  let apiKey = options.apiKey ?? process.env.CLAWOPS_API_KEY;
1270
1327
  if (!apiKey) {
1271
- throw new chunkIYSPOOKH_cjs.ClawOpsError("apiKey\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_API_KEY \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
1328
+ throw new chunkOBGKLTIN_cjs.ClawOpsError("apiKey\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_API_KEY \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
1272
1329
  }
1273
1330
  let accountId = options.accountId ?? process.env.CLAWOPS_ACCOUNT_ID;
1274
1331
  if (!accountId) {
1275
- throw new chunkIYSPOOKH_cjs.ClawOpsError("accountId\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_ACCOUNT_ID \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
1332
+ throw new chunkOBGKLTIN_cjs.ClawOpsError("accountId\uB97C \uC9C0\uC815\uD558\uAC70\uB098 CLAWOPS_ACCOUNT_ID \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694.");
1276
1333
  }
1277
1334
  const baseURL = options.baseURL ?? process.env.CLAWOPS_BASE_URL ?? chunkLLPMUDNE_cjs.DEFAULT_BASE_URL;
1278
1335
  super({
@@ -1329,79 +1386,79 @@ var client_default_default = ClawOps;
1329
1386
 
1330
1387
  Object.defineProperty(exports, "APIConnectionError", {
1331
1388
  enumerable: true,
1332
- get: function () { return chunkIYSPOOKH_cjs.APIConnectionError; }
1389
+ get: function () { return chunkOBGKLTIN_cjs.APIConnectionError; }
1333
1390
  });
1334
1391
  Object.defineProperty(exports, "APIError", {
1335
1392
  enumerable: true,
1336
- get: function () { return chunkIYSPOOKH_cjs.APIError; }
1393
+ get: function () { return chunkOBGKLTIN_cjs.APIError; }
1337
1394
  });
1338
1395
  Object.defineProperty(exports, "APIResponseValidationError", {
1339
1396
  enumerable: true,
1340
- get: function () { return chunkIYSPOOKH_cjs.APIResponseValidationError; }
1397
+ get: function () { return chunkOBGKLTIN_cjs.APIResponseValidationError; }
1341
1398
  });
1342
1399
  Object.defineProperty(exports, "APIStatusError", {
1343
1400
  enumerable: true,
1344
- get: function () { return chunkIYSPOOKH_cjs.APIStatusError; }
1401
+ get: function () { return chunkOBGKLTIN_cjs.APIStatusError; }
1345
1402
  });
1346
1403
  Object.defineProperty(exports, "APITimeoutError", {
1347
1404
  enumerable: true,
1348
- get: function () { return chunkIYSPOOKH_cjs.APITimeoutError; }
1405
+ get: function () { return chunkOBGKLTIN_cjs.APITimeoutError; }
1349
1406
  });
1350
1407
  Object.defineProperty(exports, "AgentConnectionError", {
1351
1408
  enumerable: true,
1352
- get: function () { return chunkIYSPOOKH_cjs.AgentConnectionError; }
1409
+ get: function () { return chunkOBGKLTIN_cjs.AgentConnectionError; }
1353
1410
  });
1354
1411
  Object.defineProperty(exports, "AgentError", {
1355
1412
  enumerable: true,
1356
- get: function () { return chunkIYSPOOKH_cjs.AgentError; }
1413
+ get: function () { return chunkOBGKLTIN_cjs.AgentError; }
1357
1414
  });
1358
1415
  Object.defineProperty(exports, "AuthenticationError", {
1359
1416
  enumerable: true,
1360
- get: function () { return chunkIYSPOOKH_cjs.AuthenticationError; }
1417
+ get: function () { return chunkOBGKLTIN_cjs.AuthenticationError; }
1361
1418
  });
1362
1419
  Object.defineProperty(exports, "BadRequestError", {
1363
1420
  enumerable: true,
1364
- get: function () { return chunkIYSPOOKH_cjs.BadRequestError; }
1421
+ get: function () { return chunkOBGKLTIN_cjs.BadRequestError; }
1365
1422
  });
1366
1423
  Object.defineProperty(exports, "ClawOpsError", {
1367
1424
  enumerable: true,
1368
- get: function () { return chunkIYSPOOKH_cjs.ClawOpsError; }
1425
+ get: function () { return chunkOBGKLTIN_cjs.ClawOpsError; }
1369
1426
  });
1370
1427
  Object.defineProperty(exports, "ConflictError", {
1371
1428
  enumerable: true,
1372
- get: function () { return chunkIYSPOOKH_cjs.ConflictError; }
1429
+ get: function () { return chunkOBGKLTIN_cjs.ConflictError; }
1373
1430
  });
1374
1431
  Object.defineProperty(exports, "InternalServerError", {
1375
1432
  enumerable: true,
1376
- get: function () { return chunkIYSPOOKH_cjs.InternalServerError; }
1433
+ get: function () { return chunkOBGKLTIN_cjs.InternalServerError; }
1377
1434
  });
1378
1435
  Object.defineProperty(exports, "NotFoundError", {
1379
1436
  enumerable: true,
1380
- get: function () { return chunkIYSPOOKH_cjs.NotFoundError; }
1437
+ get: function () { return chunkOBGKLTIN_cjs.NotFoundError; }
1381
1438
  });
1382
1439
  Object.defineProperty(exports, "PermissionDeniedError", {
1383
1440
  enumerable: true,
1384
- get: function () { return chunkIYSPOOKH_cjs.PermissionDeniedError; }
1441
+ get: function () { return chunkOBGKLTIN_cjs.PermissionDeniedError; }
1385
1442
  });
1386
1443
  Object.defineProperty(exports, "RateLimitError", {
1387
1444
  enumerable: true,
1388
- get: function () { return chunkIYSPOOKH_cjs.RateLimitError; }
1445
+ get: function () { return chunkOBGKLTIN_cjs.RateLimitError; }
1389
1446
  });
1390
1447
  Object.defineProperty(exports, "ServiceUnavailableError", {
1391
1448
  enumerable: true,
1392
- get: function () { return chunkIYSPOOKH_cjs.ServiceUnavailableError; }
1449
+ get: function () { return chunkOBGKLTIN_cjs.ServiceUnavailableError; }
1393
1450
  });
1394
1451
  Object.defineProperty(exports, "SolapiBridgeError", {
1395
1452
  enumerable: true,
1396
- get: function () { return chunkIYSPOOKH_cjs.SolapiBridgeError; }
1453
+ get: function () { return chunkOBGKLTIN_cjs.SolapiBridgeError; }
1397
1454
  });
1398
1455
  Object.defineProperty(exports, "UnprocessableEntityError", {
1399
1456
  enumerable: true,
1400
- get: function () { return chunkIYSPOOKH_cjs.UnprocessableEntityError; }
1457
+ get: function () { return chunkOBGKLTIN_cjs.UnprocessableEntityError; }
1401
1458
  });
1402
1459
  Object.defineProperty(exports, "VERSION", {
1403
1460
  enumerable: true,
1404
- get: function () { return chunkNXCYAYFT_cjs.VERSION; }
1461
+ get: function () { return chunkFI2WH67N_cjs.VERSION; }
1405
1462
  });
1406
1463
  exports.APIClient = APIClient;
1407
1464
  exports.AccountContext = AccountContext;
@@ -1410,6 +1467,7 @@ exports.BlockedRecipients = BlockedRecipients;
1410
1467
  exports.Calls = Calls;
1411
1468
  exports.ClawOps = ClawOps;
1412
1469
  exports.Kakao = Kakao;
1470
+ exports.KakaoBrandTemplates = KakaoBrandTemplates;
1413
1471
  exports.KakaoChannels = KakaoChannels;
1414
1472
  exports.KakaoTemplates = KakaoTemplates;
1415
1473
  exports.Messages = Messages;