@noti-bot/sdk 0.13.0 → 0.14.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
@@ -169,8 +169,23 @@ try {
169
169
  - 각 메서드의 두 번째 인자에 `{ signal }`을 넣어 취소할 수 있습니다.
170
170
  - `fetch`와 `timeoutMs`(기본 10초)를 생성자에서 주입할 수 있습니다.
171
171
 
172
+ ## API 버전
173
+
174
+ SDK는 모든 요청에 `NotiBot-Version` 헤더를 보냅니다. 값은 이 SDK가 만들어진 API 버전(`API_VERSION`, 지금은 `2026-12-01`)입니다.
175
+ 허브가 호환이 깨지는 변경을 새 날짜 버전으로 내도, SDK를 올리기 전에는 지금 받는 응답 모양이 그대로 유지됩니다.
176
+
177
+ ```ts
178
+ import { API_VERSION } from '@noti-bot/sdk';
179
+ console.log(API_VERSION); // "2026-12-01"
180
+ ```
181
+
182
+ - 경로의 `/v1`은 바뀌지 않습니다. 새 필드와 새 오류 코드는 버전을 올리지 않고 더해집니다.
183
+ - webhook 요청에도 같은 헤더가 붙습니다. 본문과 서명은 그대로입니다.
184
+ - 허브가 모르는 버전이면 `400 unsupported_api_version`(`NotiBotApiError`, `retryable: false`)입니다. 이 SDK보다 오래된 허브에 붙였을 때만 납니다.
185
+
172
186
  ## 변경 이력
173
187
 
188
+ - **0.14.0** — 모든 요청에 `NotiBot-Version` 헤더를 보냅니다. `API_VERSION` export. 오류 코드 `unsupported_api_version`.
174
189
  - **0.13.0** — `setTyping({ room | roomId | roomSlug, durationSeconds? })`: 봇의 "입력 중" 표시(`POST /v1/typing`, `/v1/rooms/{slug}/typing`).
175
190
  - **0.9.0** — `getMessage(requestId)`: 보낸 메시지의 전달 결과(`GET /v1/messages/{requestId}`).
176
191
  - **0.8.0** — 워크스페이스 API 키(`nb_live_`/`nb_test_`). `kb_` 키는 더 이상 동작하지 않음. 콘솔에서 새로 발급해 교체하세요. `room_not_bound` 대신 `404 room_not_found`.
package/dist/errors.d.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
  export declare const NOTIBOT_ERROR_BRAND: unique symbol;
21
21
  /** 허브가 돌려주는 오류 코드. 서버 라우트(`src/outbound/routes.ts`)가 정본이다. */
22
- export declare const NOTIBOT_ERROR_CODES: readonly ["validation_error", "invalid_room_slug", "unauthorized", "plan_message_limit", "insufficient_scope", "room_not_found", "message_not_found", "room_inactive", "idempotency_conflict", "rate_limited", "kill_switch", "queue_full", "typing_unsupported", "request_failed"];
22
+ export declare const NOTIBOT_ERROR_CODES: readonly ["validation_error", "unsupported_api_version", "invalid_room_slug", "unauthorized", "plan_message_limit", "insufficient_scope", "room_not_found", "message_not_found", "room_inactive", "idempotency_conflict", "rate_limited", "kill_switch", "queue_full", "typing_unsupported", "request_failed"];
23
23
  export type NotiBotErrorCode = (typeof NOTIBOT_ERROR_CODES)[number];
24
24
  /**
25
25
  * 알려진 코드는 자동완성으로 뜨되, 허브가 새 코드를 추가해도 타입이 깨지지 않는다.
package/dist/errors.js CHANGED
@@ -21,6 +21,7 @@ export const NOTIBOT_ERROR_BRAND = Symbol.for("@noti-bot/sdk.error");
21
21
  /** 허브가 돌려주는 오류 코드. 서버 라우트(`src/outbound/routes.ts`)가 정본이다. */
22
22
  export const NOTIBOT_ERROR_CODES = [
23
23
  "validation_error",
24
+ "unsupported_api_version",
24
25
  "invalid_room_slug",
25
26
  "unauthorized",
26
27
  "plan_message_limit",
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  export type { NotiBotErrorCode, NotiBotErrorCodeLike, NotiBotErrorJSON } from "./errors.js";
2
2
  export { isNotiBotError, NOTIBOT_ERROR_BRAND, NOTIBOT_ERROR_CODES, NotiBotApiError, NotiBotError, NotiBotProtocolError, NotiBotTimeoutError, NotiBotTransportError, } from "./errors.js";
3
+ /**
4
+ * The API version this SDK was built for. It is sent as `NotiBot-Version` on every request,
5
+ * so responses keep the shape this SDK knows until you upgrade the SDK.
6
+ */
7
+ export declare const API_VERSION = "2026-12-01";
3
8
  /**
4
9
  * Tag a member in `sendMessage` text: `` `${mention(ev.senderId)} 확인했어요` ``.
5
10
  * The bridge swaps it for `@표시이름` and sends a real Kakao mention (notification to that person).
package/dist/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  export { isNotiBotError, NOTIBOT_ERROR_BRAND, NOTIBOT_ERROR_CODES, NotiBotApiError, NotiBotError, NotiBotProtocolError, NotiBotTimeoutError, NotiBotTransportError, } from "./errors.js";
2
2
  import { NotiBotApiError, NotiBotProtocolError, NotiBotTimeoutError, NotiBotTransportError, } from "./errors.js";
3
+ /**
4
+ * The API version this SDK was built for. It is sent as `NotiBot-Version` on every request,
5
+ * so responses keep the shape this SDK knows until you upgrade the SDK.
6
+ */
7
+ export const API_VERSION = "2026-12-01";
3
8
  /**
4
9
  * Tag a member in `sendMessage` text: `` `${mention(ev.senderId)} 확인했어요` ``.
5
10
  * The bridge swaps it for `@표시이름` and sends a real Kakao mention (notification to that person).
@@ -217,6 +222,7 @@ export class NotiBot {
217
222
  headers: {
218
223
  Authorization: `Bearer ${this.apiKey}`,
219
224
  Accept: "application/json",
225
+ "NotiBot-Version": API_VERSION,
220
226
  // multipart: fetch sets the Content-Type with its boundary
221
227
  ...(body === undefined || body instanceof FormData
222
228
  ? {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noti-bot/sdk",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Typed server-side client for the NotiBot API",
5
5
  "license": "MIT",
6
6
  "author": "Jeongmin Lee",