connectbase-client 6.19.0 → 6.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/dist/index.mjs CHANGED
@@ -284,7 +284,9 @@ function aiErrorToApiError(err) {
284
284
  bad_gateway: 502,
285
285
  service_unavailable: 503,
286
286
  rate_limit_exceeded: 429,
287
- quota_exceeded: 429,
287
+ // 서버는 플랜 할당량 소진을 402 로 준다 (errclass.go ErrPlatformQuotaExceeded, ai_controller
288
+ // enforceChatQuota). 예전 표는 429 라 비스트리밍 응답과 mid-stream 응답의 statusCode 가 달랐다.
289
+ quota_exceeded: 402,
288
290
  invalid_request: 400,
289
291
  config_error: 400,
290
292
  unauthorized: 401
@@ -362,6 +364,10 @@ var AIAPI = class {
362
364
  onReasoning: (delta) => {
363
365
  reasoning += delta;
364
366
  },
367
+ onImage: (image) => {
368
+ if (!aggregated.images) aggregated.images = [];
369
+ aggregated.images.push(image);
370
+ },
365
371
  onSources: (sources) => {
366
372
  aggregated.sources = sources;
367
373
  },
@@ -546,6 +552,11 @@ var AIAPI = class {
546
552
  }
547
553
  if (event.reasoning) callbacks.onReasoning?.(event.reasoning);
548
554
  if (event.content) callbacks.onToken?.(event.content);
555
+ for (const image of event.images ?? []) {
556
+ if (image && typeof image.url === "string" && image.url) {
557
+ callbacks.onImage?.(image);
558
+ }
559
+ }
549
560
  if (event.done) {
550
561
  callbacks.onDone?.();
551
562
  return;
@@ -10185,6 +10196,10 @@ var QueueAPI = class {
10185
10196
  }
10186
10197
  /**
10187
10198
  * 배치 메시지 발행 (최대 100개) — 엔드유저 동작. 퍼블릭 키만으로 동작합니다.
10199
+ *
10200
+ * 각 메시지는 `publish()` 와 같은 규칙을 따릅니다: `delay_seconds`(생략 시 큐 기본 지연), `ttl_seconds`,
10201
+ * FIFO 큐의 `deduplication_id` 자동 생성. 실패한 메시지는 배치 전체를 실패시키지 않고 `failed` 수와
10202
+ * `errors`(위치, 사유)로 알려 줍니다.
10188
10203
  */
10189
10204
  async publishBatch(queueID, data) {
10190
10205
  return this.http.post(`/v1/public/queues/${queueID}/messages/batch`, data);
@@ -10197,6 +10212,12 @@ var QueueAPI = class {
10197
10212
  *
10198
10213
  * auto_ack=false(기본값): 명시적 Ack 필요. 응답의 ack_token을 ack() 호출 시 전달.
10199
10214
  * auto_ack=true: 즉시 자동 Ack (at-most-once, 유실 가능)
10215
+ *
10216
+ * - 여러 워커(프로세스)가 같은 큐를 동시에 consume 해도 됩니다. 한 메시지는 한 워커에게만 갑니다.
10217
+ * - `visibility_timeout` 안에 ack 하지 않으면 다시 전달됩니다. 생략하면 큐 설정값(기본 30초)입니다.
10218
+ * - 큐의 `max_retries` 를 넘겨 전달된 메시지는 DLQ 로 옮겨집니다(DLQ 가 켜져 있을 때).
10219
+ * - 지연 메시지(`delay_seconds`)는 그 시각이 되어야 받습니다.
10220
+ * - function 트리거가 걸린 큐는 메시지가 트리거로 가므로 consume 할 수 없습니다(409).
10200
10221
  */
10201
10222
  async consume(queueID, options) {
10202
10223
  const params = new URLSearchParams();
@@ -10224,7 +10245,11 @@ var QueueAPI = class {
10224
10245
  *
10225
10246
  * **워커 동작 — Secret Key 필수.** 퍼블릭 키만이면 401 `SECRET_KEY_REQUIRED`.
10226
10247
  *
10227
- * ackToken: auto_ack=false 소비 시 반환된 ack_token. 생략 시 message_ids로만 확인.
10248
+ * ackToken: auto_ack=false 소비 시 반환된 ack_token. 생략해도 message_ids 로 실제로 확인되지만,
10249
+ * 넘기면 그 소비가 잡고 있던 자리를 바로 풀어 다음 consume() 이 기다리지 않습니다.
10250
+ *
10251
+ * 응답의 `acked` 는 실제로 확인한 메시지, `not_found` 는 큐에 이미 없던 메시지(auto_ack=true 로 받았거나
10252
+ * 이미 ack 됨, 만료)입니다.
10228
10253
  */
10229
10254
  async ack(queueID, messageIds, ackToken) {
10230
10255
  const data = {
@@ -10234,9 +10259,29 @@ var QueueAPI = class {
10234
10259
  return this.http.post(`/v1/public/queues/${queueID}/messages/ack`, data);
10235
10260
  }
10236
10261
  /**
10237
- * 메시지 재시도 요청 (Nack)
10262
+ * 메시지 재시도 요청 (Nack) — "이 메시지를 다시 전달하라"
10238
10263
  *
10239
10264
  * **워커 동작 — Secret Key 필수.** 퍼블릭 키만이면 401 `SECRET_KEY_REQUIRED`.
10265
+ *
10266
+ * - `options` 를 통째로 생략하면 같은 메시지를 곧바로 다시 전달합니다(`requeue: 'redeliver'`, 같은 `message_id`,
10267
+ * `delivery_count` 증가, 큐의 `max_retries` 를 넘기면 DLQ).
10268
+ * - `payload` 나 `delay_seconds` 를 주면 새 메시지로 다시 넣고 원본은 끝냅니다(`requeue: 'republish'`, 새
10269
+ * `message_id`, `headers["Nack-Count"]` 증가). 지연은 서버가 예약해 두므로 기다리는 동안 다른 메시지를 막지 않습니다.
10270
+ * - 어느 쪽이든 따로 `ack()` 하지 않으며, 원본이 visibility timeout 뒤 한 번 더 오지 않습니다.
10271
+ * - `auto_ack: true` 로 받은 메시지는 이미 큐에 없으므로 `payload` 를 줘야 합니다(없으면 404).
10272
+ *
10273
+ * @example
10274
+ * ```typescript
10275
+ * const { messages, ack_token } = await worker.queue.consume('queue-id')
10276
+ * for (const msg of messages) {
10277
+ * try {
10278
+ * await processMessage(msg.body)
10279
+ * await worker.queue.ack('queue-id', [msg.message_id], ack_token)
10280
+ * } catch {
10281
+ * await worker.queue.nack('queue-id', msg.message_id, { delay_seconds: 30, ack_token })
10282
+ * }
10283
+ * }
10284
+ * ```
10240
10285
  */
10241
10286
  async nack(queueID, messageId, options) {
10242
10287
  return this.http.post(
@@ -12953,7 +12998,10 @@ var SubscriptionAPI = class {
12953
12998
  * 빌링키 발급 시작
12954
12999
  * 토스 카드 등록 위젯에 필요한 정보를 반환합니다.
12955
13000
  *
12956
- * @returns 토스 클라이언트 키, 고객 키 등
13001
+ * 빌링키는 아직 만들어지지 않는다. 카드 등록이 끝나면 `confirmBillingKey` 가 빌링키를 만들고 그 `id` 를 돌려준다.
13002
+ *
13003
+ * @param request - 선택. `customer_key` 를 직접 정할 때만 넣는다 (생략하면 서버가 만든다)
13004
+ * @returns 토스 클라이언트 키, 고객 키, 성공/실패 URL
12957
13005
  *
12958
13006
  * @example
12959
13007
  * ```typescript
@@ -12968,11 +13016,13 @@ var SubscriptionAPI = class {
12968
13016
  * })
12969
13017
  * ```
12970
13018
  */
12971
- async issueBillingKey() {
13019
+ async issueBillingKey(request) {
12972
13020
  const prefix = this.getPublicPrefix();
13021
+ const body = {};
13022
+ if (request?.customer_key) body.customer_key = request.customer_key;
12973
13023
  return this.http.post(
12974
13024
  `${prefix}/subscriptions/billing-keys`,
12975
- {}
13025
+ body
12976
13026
  );
12977
13027
  }
12978
13028
  /**
@@ -13715,8 +13765,8 @@ var SupportAPI = class {
13715
13765
  }
13716
13766
  };
13717
13767
  function detectSdkVersion() {
13718
- if ("6.19.0") {
13719
- return "6.19.0";
13768
+ if ("6.21.0") {
13769
+ return "6.21.0";
13720
13770
  }
13721
13771
  return "unknown";
13722
13772
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectbase-client",
3
- "version": "6.19.0",
3
+ "version": "6.21.0",
4
4
  "description": "Connect Base JavaScript/TypeScript SDK for browser and Node.js",
5
5
  "repository": {
6
6
  "type": "git",