connectbase-client 3.10.0 → 3.12.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/CHANGELOG.md +96 -0
- package/README.md +4 -1
- package/dist/connect-base.umd.js +4 -4
- package/dist/index.d.mts +154 -8
- package/dist/index.d.ts +154 -8
- package/dist/index.js +115 -7
- package/dist/index.mjs +113 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,102 @@
|
|
|
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.12.0] - 2026-05-13
|
|
7
|
+
|
|
8
|
+
### Fixed — `cb.database.batch()` / `cb.database.transaction()` silent success 회귀 (platform-issue 019e1c9c)
|
|
9
|
+
|
|
10
|
+
서버가 `success: false` + 개별 op `error` 로 부분 실패를 표현해도 SDK 가 그냥 Promise 를 resolve 해
|
|
11
|
+
호출자가 "성공" 으로 오해하던 문제 수정. 이제 첫 실패 op 의 error 메시지로 `throw`.
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
try {
|
|
15
|
+
await cb.database.batch([{
|
|
16
|
+
type: 'update',
|
|
17
|
+
table_id: '019d86bf-...',
|
|
18
|
+
doc_id: '019de33a-...',
|
|
19
|
+
operators: { like_count: { type: 'increment', value: 1 } },
|
|
20
|
+
}])
|
|
21
|
+
} catch (e) {
|
|
22
|
+
// 이제 RLS 거부, table_id 오타, 검증 실패 등이 명확히 throw 됨
|
|
23
|
+
console.error(e.message)
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Added — `BatchWriteResult` / `TransactionResult` / `BatchOperationResult` / `TransactionWriteResult` 타입 export
|
|
28
|
+
|
|
29
|
+
batch/transaction 응답이 `{ results: Record<string, unknown>[] }` 에서 정형 타입으로 변경:
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import type { BatchWriteResult, BatchOperationResult } from 'connectbase-client'
|
|
33
|
+
|
|
34
|
+
const r: BatchWriteResult = await cb.database.batch(ops)
|
|
35
|
+
// r.success: boolean
|
|
36
|
+
// r.results[i]: { index, success, doc_id?, error? }
|
|
37
|
+
// r.total_count / success_count / failed_count
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Behavior change — batch/transaction 부분 실패가 더 이상 silent 통과되지 않음
|
|
41
|
+
|
|
42
|
+
이전: `success: false` 응답도 `await cb.database.batch(...)` 가 정상 resolve → 호출자가 매번
|
|
43
|
+
`response.success` 와 `response.results[i].success` 를 직접 확인해야 했음.
|
|
44
|
+
|
|
45
|
+
본 버전부터: `success: false` 면 즉시 `throw new Error(<첫 실패 op error>)`. 부분 실패를
|
|
46
|
+
silent 처리하던 코드가 있다면 try/catch 로 감싸야 한다.
|
|
47
|
+
|
|
48
|
+
### Backend wiring (참고)
|
|
49
|
+
|
|
50
|
+
본 fix 는 data-server 의 다음 변경과 짝을 이룬다 (별도 배포 필요):
|
|
51
|
+
- `transaction_service` 의 3 callsite (executeRead / RunTransaction commit / BatchWrite) 가
|
|
52
|
+
`table_id` (UUID) 를 title 로 잘못 lookup → 항상 "ent: table not found" 회귀를 함께 수정
|
|
53
|
+
(platform-issue 019e1c9c/eba6).
|
|
54
|
+
- batch/transaction 이 RLS 평가를 통째로 건너뛰던 보안 회귀 수정. operators 가 머지된 finalData
|
|
55
|
+
를 newData 로 RLS 에 전달해 `.update` predicate 가 실제 변경 결과 기준으로 평가됨
|
|
56
|
+
(platform-issue 019e1c9c/c155).
|
|
57
|
+
|
|
58
|
+
## [3.11.0] - 2026-05-10
|
|
59
|
+
|
|
60
|
+
### Fixed — `cb.game.createClient().createRoom()` 의 `scriptName` / 기타 wire 필드 매핑 (platform-issue 019e123a)
|
|
61
|
+
|
|
62
|
+
게임 룸 생성 시 SDK 의 camelCase config (`scriptName`, `tickRate`, `maxPlayers`, `roomId`,
|
|
63
|
+
`categoryId`) 가 게임 서버 (Go 핸들러 JSON 태그 = snake_case) 가 기대하는 와이어 형식으로
|
|
64
|
+
매핑되지 않아, **`scriptName` 미전달 → `RoomConfig.ScriptID` 비어 있음 → `onTick` /
|
|
65
|
+
`onPlayerJoin` 등 모든 사용자 Lua hook 이 silent skip** 되던 문제 수정. NJB 앱 보고로 확인.
|
|
66
|
+
|
|
67
|
+
### Added — `GameRoomConfig.scriptName`
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const room = cb.game.createClient({ clientId: 'p1' })
|
|
71
|
+
await room.connect()
|
|
72
|
+
await room.createRoom({
|
|
73
|
+
tickRate: 20,
|
|
74
|
+
maxPlayers: 100,
|
|
75
|
+
scriptName: 'njb-main', // ← 콘솔/REST 로 업로드+활성화한 Lua 스크립트 이름
|
|
76
|
+
})
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
지정 시 룸의 `onRoomCreate` / `onPlayerJoin` / `onTick` / `onAction` / `onLeave` 가 해당
|
|
80
|
+
스크립트로 디스패치된다. 미지정 시 server tick + delta 만 흐르고 사용자 hook 은 호출되지 않음.
|
|
81
|
+
|
|
82
|
+
### Added — `toCreateRoomWire(config)` 헬퍼 export
|
|
83
|
+
|
|
84
|
+
테스트/디버깅 용으로 `import { toCreateRoomWire } from 'connectbase-client'`. SDK 가 내부적으로
|
|
85
|
+
`create_room` WebSocket 메시지 생성 시 사용하는 매핑 함수.
|
|
86
|
+
|
|
87
|
+
### Behavior change — `tickRate` / `maxPlayers` 등이 이제 실제로 적용됨
|
|
88
|
+
|
|
89
|
+
이전 버전은 camelCase 그대로 와이어로 보냈으나 게임 서버가 snake_case 만 인식해 모든 룸이
|
|
90
|
+
**서버 기본값 (tick_rate=64, max_players=100)** 으로 생성됐다. 본 버전부터 SDK 가 명시한 값이
|
|
91
|
+
실제로 반영된다. 이전 동작에 의존한 코드가 있다면 명시 값을 검토할 것.
|
|
92
|
+
|
|
93
|
+
### Backend wiring (참고)
|
|
94
|
+
|
|
95
|
+
본 fix 는 game-server 의 다음 변경과 짝을 이룬다 (별도 배포 필요):
|
|
96
|
+
- `CreateRoomRequest` 에 `script_name` (+ `script` alias) 필드 추가, `handleCreateRoom` 이
|
|
97
|
+
`RoomConfig.ScriptID = appID:scriptName` 으로 매핑
|
|
98
|
+
- 신규 `scripts.Loader` — 게임 서버 부팅 시 활성 스크립트 일괄 로드 + `game.scripts.reload.>`
|
|
99
|
+
NATS 구독으로 Activate/Rollback/Disable 이벤트를 ScriptEngine 에 반영. legacy `HotReloader`
|
|
100
|
+
는 다른 subject/schema 라 미사용 코드였음 (이번에 발견된 누락)
|
|
101
|
+
|
|
6
102
|
## [3.10.0] - 2026-05-10
|
|
7
103
|
|
|
8
104
|
### Fixed — `/v1/auth/re-issue` 일시 실패에 강제 로그아웃 (platform-issue 019e11cf)
|
package/README.md
CHANGED
|
@@ -321,8 +321,11 @@ Create a new game room.
|
|
|
321
321
|
const state = await gameClient.createRoom({
|
|
322
322
|
roomId: 'my-custom-room', // Optional: Custom room ID
|
|
323
323
|
categoryId: 'battle-royale', // Optional: Room category
|
|
324
|
-
maxPlayers: 100, // Optional: Max players (default:
|
|
324
|
+
maxPlayers: 100, // Optional: Max players (default: 100)
|
|
325
325
|
tickRate: 64, // Optional: Server tick rate (default: 64)
|
|
326
|
+
scriptName: 'main', // Optional (3.11.0+): Lua script attached to the room
|
|
327
|
+
// (uploaded+activated via console or POST /v1/game/:appID/scripts).
|
|
328
|
+
// Required for onTick / onPlayerJoin / onAction etc. to fire.
|
|
326
329
|
metadata: { map: 'forest' } // Optional: Custom metadata
|
|
327
330
|
})
|
|
328
331
|
```
|