connectbase-client 3.14.0 → 3.14.2

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/CHANGELOG.md CHANGED
@@ -3,6 +3,62 @@
3
3
  본 SDK 의 모든 주요 변경사항을 [Keep a Changelog](https://keepachangelog.com/ko/1.1.0/) 형식으로 기록합니다.
4
4
  버전은 [Semantic Versioning](https://semver.org/lang/ko/) 을 따릅니다.
5
5
 
6
+ ## [3.14.2] - 2026-05-14
7
+
8
+ ### Fixed — `cb.game.createClient()` appId 누락 시 silent 연결 깨짐
9
+
10
+ NJB 측 `createRoom` → `SCRIPT_NOT_FOUND` 오탐 보고 (019e2210) 로 발견. `appId` 가
11
+ `new ConnectBase({ appId })` 에 설정되지 않은 상태에서 `cb.game.createClient()` 를 쓰면
12
+ `GameRoom.buildConnectionUrl` 이 `wss://.../v1/game//ws` (빈 path 세그먼트) 를 만들어
13
+ game-server 의 `conn.appID` 가 빈 문자열로 들어갔다. 그 결과 `createRoom` 의 스크립트
14
+ 검증이 `GetMeta("", name)` → `nats: invalid key` 로 실패해 실제로 존재하는 active
15
+ 스크립트가 `SCRIPT_NOT_FOUND` 로 오탐. HTTP 스크립트 메서드 (`uploadScript(appId, ...)`)
16
+ 는 appId 가 명시적 인자라 영향 없었고, WS 클라이언트만 전역 appId 에 의존해 깨졌음.
17
+
18
+ - `GameRoom.connect()` — `appId` 가 비어 있으면 빈 URL 로 붙는 대신 명확한 에러로 즉시
19
+ reject (`appId is required to connect ...`). `buildConnectionUrl` 에도 hard invariant
20
+ 가드 추가 — `/v1/game//ws` 는 더 이상 생성되지 않는다.
21
+ - `GameAPI.createClient({ appId })` — per-call `appId` 지정을 지원. 이전엔 `this.appId`
22
+ (전역) 가 `config.appId` 를 무조건 덮어써서 호출별 지정이 불가능했다. 이제
23
+ `config.appId ?? this.appId` 로 per-call 우선.
24
+
25
+ > game-server 측에도 defense-in-depth 보정 동반 — `public_key` / `token` 으로 인증된
26
+ > WS 연결은 auth 가 resolve 한 appID 를 authoritative 로 사용 (URL path 의 빈 `:appID`
27
+ > 무시). 유효한 publicKey 를 보내는 클라이언트는 SDK 업그레이드 없이도 자동 교정된다.
28
+
29
+ ### Added — 회귀 가드 테스트
30
+
31
+ - `test/game-connect-appid.test.ts` — appId 누락 시 `connect()` reject + WS 미생성,
32
+ `createClient({ appId })` per-call override, `/v1/game//ws` 절대 미생성 단언.
33
+
34
+ ## [3.14.1] - 2026-05-14
35
+
36
+ ### Fixed — `cb.game.*` primitive 호스트 라우팅 회귀 (v3.0.0 이후 잠복)
37
+
38
+ NJB 측 deleteScript / deactivateScript 404 보고 (2026-05-14) 로 발견. v3.0.0 BREAKING 에서
39
+ matchqueue / leaderboard / scripts primitive 메서드 16개가 `this.http.*` (기본 baseUrl
40
+ = core-server, `api.connectbase.world`) 를 거치도록 잘못 wired 되어 game-server
41
+ (`game.connectbase.world`) 로 라우팅되지 않고 404 회귀. NJB 는 v3.9.0 부터 `uploadScript`
42
+ 회귀를 raw fetch 로 우회 중이었음 (apps/game/scripts/upload-lua.mjs 참고).
43
+
44
+ 수정: `GameAPI` 내부 `gameFetch` private helper 도입. `${this.gameServerUrl}${path}` 기준
45
+ fetch + 표준 `getHeaders()` (X-Public-Key / Bearer) + 서버 응답 `{ error }` → `ApiError.code`
46
+ surface + 204/non-JSON 응답을 `undefined` 로 처리. 영향받은 메서드:
47
+
48
+ - **scripts (8)**: `uploadScript` / `listScripts` / `getScript` / `listScriptVersions` /
49
+ `activateScript` / `rollbackScript` / `deactivateScript` / `deleteScript`
50
+ - **matchqueue (3)**: `enqueueMatch` / `listMatchqueue` / `cancelMatch`
51
+ - **leaderboard (6)**: `submitScore` / `getTopScores` / `getMemberRank` /
52
+ `getRankAround` / `resetLeaderboard` / `removeFromLeaderboard`
53
+
54
+ 기존에 raw fetch 로 우회 중이던 통합 코드는 SDK 본 메서드로 회귀해도 무방 (4xx/5xx 시
55
+ `ApiError` 로 throw 되며 status/code 분기는 동일하게 작동).
56
+
57
+ ### Added — 회귀 가드 테스트
58
+
59
+ - `test/game-host-routing.test.ts` — 17개 메서드 전체가 `game.*` 호스트로 라우팅되는지
60
+ fetch mock 으로 단언. 동일 회귀 재발 방지.
61
+
6
62
  ## [3.14.0] - 2026-05-14
7
63
 
8
64
  ### Added — `GameError` 클래스 + `createRoom` 응답 메타