connectbase-client 6.26.1 → 6.27.1

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,39 @@
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
+ ## [Unreleased]
7
+
8
+ ## [6.27.1] - 2026-12-03
9
+
10
+ ### Added
11
+
12
+ - `GameUsageResponse` 에 플레이어 지표: `days[].active_players`(그날 활동한 서로 다른 플레이어), `days[].peak_concurrent`(그날 최고 동시 접속),
13
+ `players`(`active_players` 기간 고유 수, `concurrent_now` 지금 동시 접속, `approximate`). 게임 서버 집계를 읽지 못하면 `players` 는 null.
14
+
15
+ ## [6.27.0] - 2026-12-03
16
+
17
+ ### Added — 앱 안의 게임 단위 (platform-issue 01a237c8)
18
+
19
+ - `cb.game.forGame(gameId, { token, playerId?, playerIdMode?, expiresAt?, onTokenExpiring? })`: 게임 토큰을 고정한 게임 범위 클라이언트(`GameScope`).
20
+ `leaderboard.submit/top/rank/around/removeMe`, `matchqueue.enqueue/list/cancel`, `entities.list/get`(읽기만),
21
+ `kv.list/get/set/delete`(per-player KV, `expectedRevision`), `createClient`. 리더보드 member 와 매치큐 ticket id 는
22
+ `playerId` 로 자동으로 채운다. Authorization 은 늘 게임 토큰이고 SDK 로그인 토큰으로 바꿔 끼우지 않는다.
23
+ `playerId` 는 발급 응답의 `player_id`(게임의 `player_id_mode` 를 따름: `anonymous` 면 `gp_...`, `member` 면 회원 id)를 그대로 넘긴다.
24
+ 생략하면 토큰의 익명 id 를 읽되, `playerIdMode: 'member'` 면 읽지 않고 요청 전에 오류를 낸다.
25
+ - `cb.game.hub.mount(iframe, { gameId, origin, getToken })`: 허브(부모 창)가 iframe 게임에 게임 토큰을 postMessage 로 넘긴다.
26
+ 정확한 targetOrigin 으로만 보내고, 게임의 origin 과 창(source)을 확인한다. 만료 2분 전에 새 토큰을 보낸다.
27
+ - `cb.game.fromHost({ allowedParentOrigins, gameId?, timeoutMs? })`: iframe 안 게임이 허브에서 토큰을 받는다. 토큰은 메모리에만 둔다.
28
+ - `cb.game.issueToken({ accessToken, gameId, ttlSeconds? })`: 게임 토큰 발급(시크릿 키 또는 `ctx.cbAdmin` + `game:manage`).
29
+ 응답에 `player_id_mode` 가 있다.
30
+ - `cb.games.list/get/create/update/disable/enable/resolvePlayers/activateScript`, `cb.games.creatorTokens.list/issue/revoke`:
31
+ 게임 단위 관리(시크릿 키 또는 함수 `ctx.cbAdmin` 전용, 공개 키 단독 인스턴스는 요청 전에 막는다).
32
+ - CLI `deploy` 가 `CONNECTBASE_CREATOR_TOKEN=cb_gct_...`(게임 제작자 토큰)을 받는다. Authorization 으로만 보내고 늘 QA 로 배포한다.
33
+ - 결제 게임 차원: `cb.payment.prepare/createCheckoutSession` 의 `game_id`(서버 호출 전용), `cb.payment.list` 의
34
+ `gameKey` 필터와 항목의 `game_key`, 새 `cb.payment.summary(appId, { groupBy: 'game_key', from, to })`(통화별 합계).
35
+ - `GameRoom.setAccessToken(token)`: 다음 연결, 재연결부터 쓸 토큰을 바꾼다(게임 토큰 갱신).
36
+ - `cb.game.config` 응답 타입에 격리 칸(`subtenant_isolation`, `game_credential_mode`, `entity_game_namespace`,
37
+ `unregistered_game_policy`, `kv_enabled`)을 선택 칸으로 더했다.
38
+
6
39
  ## [6.26.0] - 2026-12-03
7
40
 
8
41
  ### Added
package/dist/cli.js CHANGED
@@ -2071,7 +2071,7 @@ function handleTunnelError(msg, appId, localPort) {
2071
2071
  }
2072
2072
 
2073
2073
  // src/cli.ts
2074
- var VERSION = "6.26.1" ? "6.26.1" : getPackageVersion();
2074
+ var VERSION = "6.27.1" ? "6.27.1" : getPackageVersion();
2075
2075
  var DEFAULT_BASE_URL = "https://api.connectbase.world";
2076
2076
  var colors = {
2077
2077
  reset: "\x1B[0m",
@@ -2267,6 +2267,10 @@ function storageAdminHeaders(config) {
2267
2267
  const headers = {
2268
2268
  "X-Public-Key": config.publicKey
2269
2269
  };
2270
+ if (config.creatorToken) {
2271
+ headers.Authorization = `Bearer ${config.creatorToken}`;
2272
+ return headers;
2273
+ }
2270
2274
  if (config.secretKey) {
2271
2275
  headers["X-User-Secret-Key"] = config.secretKey;
2272
2276
  headers.Authorization = `Bearer ${config.secretKey}`;
@@ -2303,6 +2307,7 @@ function loadConfig() {
2303
2307
  const config = {
2304
2308
  publicKey: process.env.CONNECTBASE_PUBLIC_KEY,
2305
2309
  secretKey: process.env.CONNECTBASE_SECRET_KEY,
2310
+ creatorToken: process.env.CONNECTBASE_CREATOR_TOKEN,
2306
2311
  storageId: process.env.CONNECTBASE_STORAGE_ID,
2307
2312
  baseUrl: envBaseUrl || DEFAULT_BASE_URL,
2308
2313
  baseUrlFromRepo: false
@@ -2760,8 +2765,14 @@ async function deploy(directory, config, isDev = false, deployOpts = {}) {
2760
2765
  `${colors.green}\u2713${colors.reset} ${files.length}\uAC1C \uD30C\uC77C \uBC1C\uACAC (${sizeKB} KB)${skipped.length > 0 ? ` ${colors.yellow}\u2014 ${skipped.length}\uAC1C \uC81C\uC678${colors.reset}` : ""}`
2761
2766
  );
2762
2767
  reportSkippedFiles(skipped);
2763
- const target = isDev ? "qa" : void 0;
2764
- const envLabel = isDev ? "QA" : "Prod";
2768
+ const qaOnly = isDev || !!config.creatorToken;
2769
+ const target = qaOnly ? "qa" : void 0;
2770
+ const envLabel = qaOnly ? "QA" : "Prod";
2771
+ if (config.creatorToken) {
2772
+ log(
2773
+ `${colors.dim}\uC81C\uC791\uC790 \uD1A0\uD070(CONNECTBASE_CREATOR_TOKEN)\uC73C\uB85C QA \uC5D0\uB9CC \uBC30\uD3EC\uD569\uB2C8\uB2E4. production \uBC18\uC601\uC740 \uC571 \uC18C\uC720\uC790\uAC00 \uC2B9\uACA9\uD569\uB2C8\uB2E4.${colors.reset}`
2774
+ );
2775
+ }
2765
2776
  if (isDev) {
2766
2777
  warn(
2767
2778
  `${colors.yellow}--dev \uB294 deprecated${colors.reset} \uC785\uB2C8\uB2E4 \u2014 QA \uCC44\uB110\uB85C \uBC30\uD3EC\uD569\uB2C8\uB2E4(production \uBBF8\uBC18\uC601). \uC774\uD6C4 ${colors.cyan}npx connectbase-client promote${colors.reset} \uB85C production \uC5D0 \uBC18\uC601\uD558\uC138\uC694. promote_mode=manual \uC774\uBA74 \uC77C\uBC18 ${colors.cyan}deploy${colors.reset} \uB3C4 \uB3D9\uC77C\uD558\uAC8C QA \uB85C \uBC30\uD3EC\uB429\uB2C8\uB2E4.`
@@ -5847,6 +5858,7 @@ ${colors.yellow}\uD658\uACBD\uBCC0\uC218:${colors.reset}
5847
5858
  CONNECTBASE_PUBLIC_KEY Public Key (cb_pk_*)
5848
5859
  CONNECTBASE_SECRET_KEY Secret Key (cb_sk_*) \u2014 \uBC30\uD3EC/\uC2B9\uACA9/\uD130\uB110\uC5D0 \uD544\uC218
5849
5860
  CONNECTBASE_PUBLIC_KEY (deprecated) \uB808\uAC70\uC2DC \u2014 publicKey \uB610\uB294 secretKey \uB85C \uC0AC\uC6A9
5861
+ CONNECTBASE_CREATOR_TOKEN \uAC8C\uC784 \uC81C\uC791\uC790 \uD1A0\uD070 (cb_gct_*) \u2014 \uADF8 \uAC8C\uC784 \uC2A4\uD1A0\uB9AC\uC9C0 QA \uBC30\uD3EC\uB9CC
5850
5862
  CONNECTBASE_STORAGE_ID \uC2A4\uD1A0\uB9AC\uC9C0 ID
5851
5863
  CONNECTBASE_BASE_URL \uC11C\uBC84 URL (.connectbaserc \uBCF4\uB2E4 \uC6B0\uC120)
5852
5864