@teamlearners/clawops 0.39.0 → 0.40.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 +60 -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-W4XFMJFU.js → chunk-AYSW63CJ.js} +3 -3
  7. package/dist/{chunk-W4XFMJFU.js.map → chunk-AYSW63CJ.js.map} +1 -1
  8. package/dist/chunk-IEFCBBKV.cjs +8 -0
  9. package/dist/{chunk-FI2WH67N.cjs.map → chunk-IEFCBBKV.cjs.map} +1 -1
  10. package/dist/{chunk-OBGKLTIN.cjs → chunk-MXEZQRIL.cjs} +2 -2
  11. package/dist/chunk-MXEZQRIL.cjs.map +1 -0
  12. package/dist/{chunk-UOUNMCXE.cjs → chunk-PO5ACGWL.cjs} +4 -4
  13. package/dist/{chunk-UOUNMCXE.cjs.map → chunk-PO5ACGWL.cjs.map} +1 -1
  14. package/dist/chunk-R6UEIVYE.js +6 -0
  15. package/dist/{chunk-NDFDYCFM.js.map → chunk-R6UEIVYE.js.map} +1 -1
  16. package/dist/{chunk-54GBFYZT.js → chunk-SXXOAPMG.js} +2 -2
  17. package/dist/chunk-SXXOAPMG.js.map +1 -0
  18. package/dist/{client-B_GblPxW.d.cts → client-DOMZ2phc.d.cts} +148 -7
  19. package/dist/{client-B_GblPxW.d.ts → client-DOMZ2phc.d.ts} +148 -7
  20. package/dist/index.cjs +121 -36
  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 +93 -9
  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-54GBFYZT.js.map +0 -1
  32. package/dist/chunk-FI2WH67N.cjs +0 -8
  33. package/dist/chunk-NDFDYCFM.js +0 -6
  34. package/dist/chunk-OBGKLTIN.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APIClient, a as APIClientOptions, b as APIConnectionError, c as APIError, d as APIResponseValidationError, e as APIStatusError, f as APITimeoutError, g as AccountContext, h as AgentConnectionError, i as AgentError, j as AssignmentLink, k as AssignmentLinkAssignment, l as AssignmentLinkCreateResponse, m as AssignmentLinkStatus, n as AssignmentLinks, o as AuthenticationError, B as BadRequestError, p as BlockedChannel, q as BlockedRecipient, r as BlockedRecipientSource, s as BlockedRecipientStatus, t as BlockedRecipients, u as BrandBubbleType, v as BrandMessageCreateParams, w as BrandSendParams, C as Call, x as CallContextParam, y as CallControlResponse, z as CallCreateParams, D as CallListParams, E as CallUpdateParams, F as Calls, G as ClawOps, H as ClawOpsError, I as ClawOpsErrorCode, J as ClawOpsOptions, K as ConflictError, L as InternalServerError, M as Kakao, N as KakaoBrandTemplate, O as KakaoBrandTemplateListParams, P as KakaoBrandTemplates, Q as KakaoChannel, R as KakaoChannelCategory, S as KakaoChannelCategoryList, T as KakaoChannelConnectParams, U as KakaoChannelListParams, V as KakaoChannelStatus, W as KakaoChannels, X as KakaoFallbackParams, Y as KakaoMessageCreateParams, Z as KakaoSendParams, _ as KakaoTemplate, $ as KakaoTemplateListParams, a0 as KakaoTemplates, a1 as KakaoTokenRequest, a2 as KakaoTokenRequestParams, a3 as Message, a4 as MessageCreateParams, a5 as MessageListParams, a6 as Messages, a7 as NotFoundError, a8 as NumberCreateParams, a9 as NumberListItem, aa as NumberUpdateParams, ab as NumberUpdateResponse, ac as Numbers, ad as Page, ae as PermissionDeniedError, af as PhoneNumber, ag as RateLimitError, ah as RecordingDownload, ai as Recordings, aj as RoutingType, ak as ServiceUnavailableError, al as SipCredential, am as SipCredentials, an as SipEndpoint, ao as SipEndpoints, ap as SolapiBridgeError, aq as TextMessageCreateParams, ar as UnprocessableEntityError, as as WebhookLog, at as WebhookLogs, au as WebhookVerificationError, av as Webhooks, G as default } from './client-B_GblPxW.cjs';
1
+ export { A as APIClient, a as APIClientOptions, b as APIConnectionError, c as APIError, d as APIResponseValidationError, e as APIStatusError, f as APITimeoutError, g as AccountContext, h as AgentConnectionError, i as AgentError, j as AssignmentLink, k as AssignmentLinkAssignment, l as AssignmentLinkCreateResponse, m as AssignmentLinkStatus, n as AssignmentLinks, o as AuthenticationError, B as BadRequestError, p as BlockedChannel, q as BlockedRecipient, r as BlockedRecipientSource, s as BlockedRecipientStatus, t as BlockedRecipients, u as BrandBubbleType, v as BrandFreeSendParams, w as BrandMessageCreateParams, x as BrandSendParams, y as BrandTemplateSendParams, C as Call, z as CallContextParam, D as CallControlResponse, E as CallCreateParams, F as CallListParams, G as CallUpdateParams, H as Calls, I as ClawOps, J as ClawOpsError, K as ClawOpsErrorCode, L as ClawOpsOptions, M as ConflictError, N as InternalServerError, O as Kakao, P as KakaoBrandImage, Q as KakaoBrandImages, R as KakaoBrandTemplate, S as KakaoBrandTemplateListParams, T as KakaoBrandTemplates, U as KakaoChannel, V as KakaoChannelCategory, W as KakaoChannelCategoryList, X as KakaoChannelConnectParams, Y as KakaoChannelListParams, Z as KakaoChannelStatus, _ as KakaoChannels, $ as KakaoFallbackParams, a0 as KakaoMessageCreateParams, a1 as KakaoSendParams, a2 as KakaoTemplate, a3 as KakaoTemplateListParams, a4 as KakaoTemplates, a5 as KakaoTokenRequest, a6 as KakaoTokenRequestParams, a7 as Message, a8 as MessageCreateParams, a9 as MessageListParams, aa as Messages, ab as NotFoundError, ac as NumberCreateParams, ad as NumberListItem, ae as NumberUpdateParams, af as NumberUpdateResponse, ag as Numbers, ah as Page, ai as PermissionDeniedError, aj as PhoneNumber, ak as RateLimitError, al as RecordingDownload, am as Recordings, an as RoutingType, ao as ServiceUnavailableError, ap as SipCredential, aq as SipCredentials, ar as SipEndpoint, as as SipEndpoints, at as SolapiBridgeError, au as TextMessageCreateParams, av as UnprocessableEntityError, aw as WebhookLog, ax as WebhookLogs, ay as WebhookVerificationError, az as Webhooks, I as default } from './client-DOMZ2phc.cjs';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const VERSION: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as APIClient, a as APIClientOptions, b as APIConnectionError, c as APIError, d as APIResponseValidationError, e as APIStatusError, f as APITimeoutError, g as AccountContext, h as AgentConnectionError, i as AgentError, j as AssignmentLink, k as AssignmentLinkAssignment, l as AssignmentLinkCreateResponse, m as AssignmentLinkStatus, n as AssignmentLinks, o as AuthenticationError, B as BadRequestError, p as BlockedChannel, q as BlockedRecipient, r as BlockedRecipientSource, s as BlockedRecipientStatus, t as BlockedRecipients, u as BrandBubbleType, v as BrandMessageCreateParams, w as BrandSendParams, C as Call, x as CallContextParam, y as CallControlResponse, z as CallCreateParams, D as CallListParams, E as CallUpdateParams, F as Calls, G as ClawOps, H as ClawOpsError, I as ClawOpsErrorCode, J as ClawOpsOptions, K as ConflictError, L as InternalServerError, M as Kakao, N as KakaoBrandTemplate, O as KakaoBrandTemplateListParams, P as KakaoBrandTemplates, Q as KakaoChannel, R as KakaoChannelCategory, S as KakaoChannelCategoryList, T as KakaoChannelConnectParams, U as KakaoChannelListParams, V as KakaoChannelStatus, W as KakaoChannels, X as KakaoFallbackParams, Y as KakaoMessageCreateParams, Z as KakaoSendParams, _ as KakaoTemplate, $ as KakaoTemplateListParams, a0 as KakaoTemplates, a1 as KakaoTokenRequest, a2 as KakaoTokenRequestParams, a3 as Message, a4 as MessageCreateParams, a5 as MessageListParams, a6 as Messages, a7 as NotFoundError, a8 as NumberCreateParams, a9 as NumberListItem, aa as NumberUpdateParams, ab as NumberUpdateResponse, ac as Numbers, ad as Page, ae as PermissionDeniedError, af as PhoneNumber, ag as RateLimitError, ah as RecordingDownload, ai as Recordings, aj as RoutingType, ak as ServiceUnavailableError, al as SipCredential, am as SipCredentials, an as SipEndpoint, ao as SipEndpoints, ap as SolapiBridgeError, aq as TextMessageCreateParams, ar as UnprocessableEntityError, as as WebhookLog, at as WebhookLogs, au as WebhookVerificationError, av as Webhooks, G as default } from './client-B_GblPxW.js';
1
+ export { A as APIClient, a as APIClientOptions, b as APIConnectionError, c as APIError, d as APIResponseValidationError, e as APIStatusError, f as APITimeoutError, g as AccountContext, h as AgentConnectionError, i as AgentError, j as AssignmentLink, k as AssignmentLinkAssignment, l as AssignmentLinkCreateResponse, m as AssignmentLinkStatus, n as AssignmentLinks, o as AuthenticationError, B as BadRequestError, p as BlockedChannel, q as BlockedRecipient, r as BlockedRecipientSource, s as BlockedRecipientStatus, t as BlockedRecipients, u as BrandBubbleType, v as BrandFreeSendParams, w as BrandMessageCreateParams, x as BrandSendParams, y as BrandTemplateSendParams, C as Call, z as CallContextParam, D as CallControlResponse, E as CallCreateParams, F as CallListParams, G as CallUpdateParams, H as Calls, I as ClawOps, J as ClawOpsError, K as ClawOpsErrorCode, L as ClawOpsOptions, M as ConflictError, N as InternalServerError, O as Kakao, P as KakaoBrandImage, Q as KakaoBrandImages, R as KakaoBrandTemplate, S as KakaoBrandTemplateListParams, T as KakaoBrandTemplates, U as KakaoChannel, V as KakaoChannelCategory, W as KakaoChannelCategoryList, X as KakaoChannelConnectParams, Y as KakaoChannelListParams, Z as KakaoChannelStatus, _ as KakaoChannels, $ as KakaoFallbackParams, a0 as KakaoMessageCreateParams, a1 as KakaoSendParams, a2 as KakaoTemplate, a3 as KakaoTemplateListParams, a4 as KakaoTemplates, a5 as KakaoTokenRequest, a6 as KakaoTokenRequestParams, a7 as Message, a8 as MessageCreateParams, a9 as MessageListParams, aa as Messages, ab as NotFoundError, ac as NumberCreateParams, ad as NumberListItem, ae as NumberUpdateParams, af as NumberUpdateResponse, ag as Numbers, ah as Page, ai as PermissionDeniedError, aj as PhoneNumber, ak as RateLimitError, al as RecordingDownload, am as Recordings, an as RoutingType, ao as ServiceUnavailableError, ap as SipCredential, aq as SipCredentials, ar as SipEndpoint, as as SipEndpoints, at as SolapiBridgeError, au as TextMessageCreateParams, av as UnprocessableEntityError, aw as WebhookLog, ax as WebhookLogs, ay as WebhookVerificationError, az as Webhooks, I as default } from './client-DOMZ2phc.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const VERSION: string;
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, INITIAL_RETRY_DELAY, MAX_RETRY_DELAY } from './chunk-35XJNMFU.js';
2
- import { APITimeoutError, APIConnectionError, makeStatusError, APIResponseValidationError, ClawOpsError } from './chunk-54GBFYZT.js';
3
- export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, SolapiBridgeError, UnprocessableEntityError } from './chunk-54GBFYZT.js';
4
- import { VERSION } from './chunk-NDFDYCFM.js';
5
- export { VERSION } from './chunk-NDFDYCFM.js';
2
+ import { APITimeoutError, APIConnectionError, makeStatusError, APIResponseValidationError, ClawOpsError } from './chunk-SXXOAPMG.js';
3
+ export { APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AgentConnectionError, AgentError, AuthenticationError, BadRequestError, ClawOpsError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, ServiceUnavailableError, SolapiBridgeError, UnprocessableEntityError } from './chunk-SXXOAPMG.js';
4
+ import { VERSION } from './chunk-R6UEIVYE.js';
5
+ export { VERSION } from './chunk-R6UEIVYE.js';
6
6
  import { z } from 'zod';
7
7
  import { timingSafeEqual, createHmac } from 'crypto';
8
8
 
@@ -21,6 +21,11 @@ function validateBaseUrl(url) {
21
21
  `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.`
22
22
  );
23
23
  }
24
+ function serializeBody(body) {
25
+ if (body instanceof FormData) return { payload: body, contentType: null };
26
+ if (!body) return { payload: void 0, contentType: "application/json" };
27
+ return { payload: JSON.stringify(body), contentType: "application/json" };
28
+ }
24
29
  var APIClient = class {
25
30
  _apiKey;
26
31
  _baseURL;
@@ -49,6 +54,9 @@ var APIClient = class {
49
54
  }
50
55
  async _send(method2, path, options = {}) {
51
56
  const headers = this._buildHeaders(options.extraHeaders);
57
+ const { payload, contentType } = serializeBody(options.body);
58
+ if (contentType === null) delete headers["Content-Type"];
59
+ else headers["Content-Type"] = contentType;
52
60
  const params = new URLSearchParams();
53
61
  const queryObj = { ...options.query, ...options.extraQuery };
54
62
  for (const [k, v] of Object.entries(queryObj)) {
@@ -66,7 +74,7 @@ var APIClient = class {
66
74
  response = await this._fetch(url, {
67
75
  method: method2,
68
76
  headers,
69
- body: options.body ? JSON.stringify(options.body) : void 0,
77
+ body: payload,
70
78
  signal: controller.signal
71
79
  });
72
80
  } catch (err) {
@@ -710,6 +718,16 @@ var KakaoBrandTemplateSchema = z.object({
710
718
  createdAt: z.string(),
711
719
  updatedAt: z.string()
712
720
  }).passthrough();
721
+ var KakaoBrandImageSchema = z.object({
722
+ id: z.string(),
723
+ /** 업로드할 때 지정한 말풍선 유형. 규격이 유형마다 달라 다른 유형엔 재사용할 수 없다. */
724
+ bubbleType: z.string(),
725
+ /** `'main'` | `'sub'`. 서브는 와이드리스트형에만 있다(메인 2:1, 서브 1:1). */
726
+ slot: z.string(),
727
+ /** 업로드한 원본 파일 이름. */
728
+ name: z.string().nullable(),
729
+ createdAt: z.string()
730
+ }).passthrough();
713
731
  var KakaoChannelCategorySchema = z.object({
714
732
  /** 채널 연결의 `categoryCode` 에 그대로 보내는 값. */
715
733
  code: z.string(),
@@ -881,6 +899,63 @@ var KakaoBrandTemplates = class extends APIResource {
881
899
  return page;
882
900
  }
883
901
  };
902
+ var KakaoBrandImages = class extends APIResource {
903
+ get _path() {
904
+ return `${this._basePath}/kakao/brand-images`;
905
+ }
906
+ /**
907
+ * 이미지를 올리고 발송에 쓸 `id` 를 받는다.
908
+ *
909
+ * ```ts
910
+ * const image = await client.kakao.brandImages.upload({
911
+ * file: readFileSync('banner.png'),
912
+ * filename: 'banner.png',
913
+ * bubbleType: 'WIDE',
914
+ * });
915
+ * await client.messages.create({
916
+ * to: '01012345678',
917
+ * from: '07012345678',
918
+ * brand: {
919
+ * channelId,
920
+ * free: { chatBubbleType: 'WIDE', content: '신메뉴가 나왔어요.', imageId: image.id },
921
+ * },
922
+ * });
923
+ * ```
924
+ *
925
+ * ⚠️ `TEXT` 는 이미지 자리가 없어 `400` 이다. 자동완성에 뜨지만 쓸 수 없다.
926
+ *
927
+ * ⚠️ **상한은 5MB 다.** 넘으면 `400`, 10MB 를 넘으면 업로드 검증기가 먼저 끊어 `413` 이고
928
+ * **`code` 가 없다** — 즉 "너무 크다" 가 두 모양으로 온다.
929
+ *
930
+ * @param params.filename 원본 파일 이름. 목록에서 사람이 알아볼 유일한 단서다.
931
+ * @param params.slot 와이드리스트형에서 작은 항목에 쓸 이미지면 `'sub'`. 기본은 `'main'`.
932
+ */
933
+ async upload(params, options = {}) {
934
+ const form = new FormData();
935
+ const blob = params.file instanceof Blob ? params.file : new Blob([params.file]);
936
+ form.append("image", blob, params.filename);
937
+ form.append("bubbleType", params.bubbleType);
938
+ if (params.slot) form.append("slot", params.slot);
939
+ return this._client._post(this._path, {
940
+ body: form,
941
+ castTo: z.object({ id: z.string() }).passthrough(),
942
+ ...options
943
+ });
944
+ }
945
+ /** 올려 둔 이미지 목록. **`id` 를 잃었을 때 되찾는 경로다.** */
946
+ async list(params = {}, options = {}) {
947
+ const query = stripNotGiven({ page: params.page, pageSize: params.pageSize });
948
+ const path = this._path;
949
+ const raw = await this._client._get(path, {
950
+ castTo: PageSchema(KakaoBrandImageSchema),
951
+ query: Object.keys(query).length ? query : void 0,
952
+ ...options
953
+ });
954
+ const page = new Page(raw.data, raw.meta);
955
+ page._setClient(this._client, path, KakaoBrandImageSchema, query);
956
+ return page;
957
+ }
958
+ };
884
959
  var Kakao = class extends APIResource {
885
960
  get channels() {
886
961
  return new KakaoChannels(this._client, this._accountId);
@@ -892,6 +967,10 @@ var Kakao = class extends APIResource {
892
967
  get brandTemplates() {
893
968
  return new KakaoBrandTemplates(this._client, this._accountId);
894
969
  }
970
+ /** 자유형 말풍선에 실을 이미지. 템플릿형은 이미지가 템플릿에 들어 있어 필요 없다. */
971
+ get brandImages() {
972
+ return new KakaoBrandImages(this._client, this._accountId);
973
+ }
895
974
  /**
896
975
  * 채널 연결 시 지정할 업종 카테고리 목록.
897
976
  *
@@ -934,7 +1013,12 @@ var MessageSchema = z.object({
934
1013
  }).passthrough();
935
1014
 
936
1015
  // src/resources/messages.ts
937
- var templateBlock = (p) => p && stripNotGiven({ ChannelId: p.channelId, TemplateId: p.templateId, Variables: p.variables });
1016
+ var sendBlock = (p) => p && stripNotGiven({
1017
+ ChannelId: p.channelId,
1018
+ TemplateId: p.templateId,
1019
+ Variables: p.variables,
1020
+ Free: p.free
1021
+ });
938
1022
  var Messages = class extends APIResource {
939
1023
  /**
940
1024
  * 문자(SMS/LMS/MMS) 또는 카카오 알림톡·브랜드 메시지를 발송합니다.
@@ -973,8 +1057,8 @@ var Messages = class extends APIResource {
973
1057
  MediaUrl: params.mediaUrl,
974
1058
  IdempotencyKey: params.idempotencyKey,
975
1059
  // 중첩 객체는 손으로 조립한다 — stripNotGiven 은 한 겹만 훑는다.
976
- Kakao: templateBlock(params.kakao),
977
- Brand: templateBlock(params.brand),
1060
+ Kakao: sendBlock(params.kakao),
1061
+ Brand: sendBlock(params.brand),
978
1062
  Fallback: params.fallback && stripNotGiven({
979
1063
  Type: params.fallback.type,
980
1064
  Subject: params.fallback.subject,
@@ -1382,6 +1466,6 @@ var ClawOps = class extends APIClient {
1382
1466
  // src/client-default.ts
1383
1467
  var client_default_default = ClawOps;
1384
1468
 
1385
- export { APIClient, AccountContext, AssignmentLinks, BlockedRecipients, Calls, ClawOps, Kakao, KakaoBrandTemplates, KakaoChannels, KakaoTemplates, Messages, Numbers, Page, Recordings, SipCredentials, SipEndpoints, WebhookLogs, WebhookVerificationError, Webhooks, client_default_default as default };
1469
+ export { APIClient, AccountContext, AssignmentLinks, BlockedRecipients, Calls, ClawOps, Kakao, KakaoBrandImages, KakaoBrandTemplates, KakaoChannels, KakaoTemplates, Messages, Numbers, Page, Recordings, SipCredentials, SipEndpoints, WebhookLogs, WebhookVerificationError, Webhooks, client_default_default as default };
1386
1470
  //# sourceMappingURL=index.js.map
1387
1471
  //# sourceMappingURL=index.js.map