connectbase-client 3.14.0 → 3.14.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 +28 -0
- package/dist/connect-base.umd.js +4 -4
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +117 -29
- package/dist/index.mjs +117 -29
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -6149,6 +6149,7 @@ declare class GameAPI {
|
|
|
6149
6149
|
downloadReplay(replayId: string): Promise<ArrayBuffer>;
|
|
6150
6150
|
getReplayHighlights(replayId: string): Promise<ReplayHighlight[]>;
|
|
6151
6151
|
private getHeaders;
|
|
6152
|
+
private gameFetch;
|
|
6152
6153
|
/**
|
|
6153
6154
|
* matchqueue 에 ticket 등록.
|
|
6154
6155
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -6149,6 +6149,7 @@ declare class GameAPI {
|
|
|
6149
6149
|
downloadReplay(replayId: string): Promise<ArrayBuffer>;
|
|
6150
6150
|
getReplayHighlights(replayId: string): Promise<ReplayHighlight[]>;
|
|
6151
6151
|
private getHeaders;
|
|
6152
|
+
private gameFetch;
|
|
6152
6153
|
/**
|
|
6153
6154
|
* matchqueue 에 ticket 등록.
|
|
6154
6155
|
*
|
package/dist/index.js
CHANGED
|
@@ -7025,6 +7025,38 @@ var GameAPI = class {
|
|
|
7025
7025
|
}
|
|
7026
7026
|
return headers;
|
|
7027
7027
|
}
|
|
7028
|
+
// game-server (`game.connectbase.world`) 전용 fetch.
|
|
7029
|
+
//
|
|
7030
|
+
// 회귀 가드 (v3.14.1, NJB report 2026-05-14): matchqueue / leaderboard / scripts 16개
|
|
7031
|
+
// 메서드가 v3.0.0 BREAKING 이후 `this.http.*` 를 통해 기본 baseUrl (=core-server,
|
|
7032
|
+
// `api.connectbase.world`) 로 라우팅되면서 404 회귀. 호스트 분리된 game-server 경로는
|
|
7033
|
+
// 반드시 `this.gameServerUrl` 을 사용해야 한다. 회귀 재발 방지 테스트:
|
|
7034
|
+
// test/game-host-routing.test.ts.
|
|
7035
|
+
async gameFetch(method, path, body, errCode = "GAME_REQUEST_FAILED") {
|
|
7036
|
+
const init = { method, headers: { ...this.getHeaders() } };
|
|
7037
|
+
if (body !== void 0) {
|
|
7038
|
+
init.headers["Content-Type"] = "application/json";
|
|
7039
|
+
init.body = JSON.stringify(body);
|
|
7040
|
+
}
|
|
7041
|
+
const response = await fetch(`${this.gameServerUrl}${path}`, init);
|
|
7042
|
+
if (!response.ok) {
|
|
7043
|
+
let serverCode = errCode;
|
|
7044
|
+
let message = `${method} ${path} failed: ${response.statusText}`;
|
|
7045
|
+
try {
|
|
7046
|
+
const data = await response.json();
|
|
7047
|
+
if (data && typeof data.error === "string") {
|
|
7048
|
+
message = data.error;
|
|
7049
|
+
serverCode = data.error;
|
|
7050
|
+
}
|
|
7051
|
+
} catch {
|
|
7052
|
+
}
|
|
7053
|
+
throw new ApiError(response.status, message, serverCode);
|
|
7054
|
+
}
|
|
7055
|
+
if (response.status === 204) return void 0;
|
|
7056
|
+
const contentType = response.headers.get("content-type") || "";
|
|
7057
|
+
if (!contentType.includes("application/json")) return void 0;
|
|
7058
|
+
return response.json();
|
|
7059
|
+
}
|
|
7028
7060
|
// ─────────────────────────────────────────────────────────────────────
|
|
7029
7061
|
// Phase 3 — Matchqueue primitive (mechanism only)
|
|
7030
7062
|
//
|
|
@@ -7045,9 +7077,11 @@ var GameAPI = class {
|
|
|
7045
7077
|
* @constraints appId/queueKey/ticketId 는 [a-zA-Z0-9_-] 만 허용. ttlSec=0 이면 만료 없음.
|
|
7046
7078
|
*/
|
|
7047
7079
|
async enqueueMatch(appId, queueKey, ticketId, attributes, ttlSec) {
|
|
7048
|
-
return this.
|
|
7080
|
+
return this.gameFetch(
|
|
7081
|
+
"POST",
|
|
7049
7082
|
`/v1/game/${appId}/matchqueue/${queueKey}/tickets`,
|
|
7050
|
-
{ ticket_id: ticketId, attributes, ttl_sec: ttlSec ?? 0 }
|
|
7083
|
+
{ ticket_id: ticketId, attributes, ttl_sec: ttlSec ?? 0 },
|
|
7084
|
+
"GAME_ENQUEUE_MATCH_FAILED"
|
|
7051
7085
|
);
|
|
7052
7086
|
}
|
|
7053
7087
|
/**
|
|
@@ -7056,16 +7090,22 @@ var GameAPI = class {
|
|
|
7056
7090
|
* @example const tickets = await cb.game.listMatchqueue(appId, "ranked")
|
|
7057
7091
|
*/
|
|
7058
7092
|
async listMatchqueue(appId, queueKey) {
|
|
7059
|
-
return this.
|
|
7060
|
-
|
|
7093
|
+
return this.gameFetch(
|
|
7094
|
+
"GET",
|
|
7095
|
+
`/v1/game/${appId}/matchqueue/${queueKey}`,
|
|
7096
|
+
void 0,
|
|
7097
|
+
"GAME_LIST_MATCHQUEUE_FAILED"
|
|
7061
7098
|
);
|
|
7062
7099
|
}
|
|
7063
7100
|
/**
|
|
7064
7101
|
* 매칭 큐에서 ticket 제거 (예: 사용자가 매칭 취소).
|
|
7065
7102
|
*/
|
|
7066
7103
|
async cancelMatch(appId, queueKey, ticketId) {
|
|
7067
|
-
await this.
|
|
7068
|
-
|
|
7104
|
+
await this.gameFetch(
|
|
7105
|
+
"DELETE",
|
|
7106
|
+
`/v1/game/${appId}/matchqueue/${queueKey}/tickets/${ticketId}`,
|
|
7107
|
+
void 0,
|
|
7108
|
+
"GAME_CANCEL_MATCH_FAILED"
|
|
7069
7109
|
);
|
|
7070
7110
|
}
|
|
7071
7111
|
// ─────────────────────────────────────────────────────────────────────
|
|
@@ -7081,47 +7121,66 @@ var GameAPI = class {
|
|
|
7081
7121
|
* await cb.game.submitScore(appId, "global_elo", userId, 32, "incr")
|
|
7082
7122
|
*/
|
|
7083
7123
|
async submitScore(appId, leaderboardKey, member, score, mode = "set") {
|
|
7084
|
-
return this.
|
|
7124
|
+
return this.gameFetch(
|
|
7125
|
+
"POST",
|
|
7085
7126
|
`/v1/game/${appId}/leaderboards/${leaderboardKey}/scores`,
|
|
7086
|
-
{ member, score, mode }
|
|
7127
|
+
{ member, score, mode },
|
|
7128
|
+
"GAME_SUBMIT_SCORE_FAILED"
|
|
7087
7129
|
);
|
|
7088
7130
|
}
|
|
7089
7131
|
/**
|
|
7090
7132
|
* 상위 n 명 조회 (기본 10).
|
|
7091
7133
|
*/
|
|
7092
7134
|
async getTopScores(appId, leaderboardKey, n = 10) {
|
|
7093
|
-
return this.
|
|
7094
|
-
|
|
7135
|
+
return this.gameFetch(
|
|
7136
|
+
"GET",
|
|
7137
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/top?n=${n}`,
|
|
7138
|
+
void 0,
|
|
7139
|
+
"GAME_GET_TOP_SCORES_FAILED"
|
|
7095
7140
|
);
|
|
7096
7141
|
}
|
|
7097
7142
|
/**
|
|
7098
7143
|
* 단일 member 의 rank + score.
|
|
7099
7144
|
*/
|
|
7100
7145
|
async getMemberRank(appId, leaderboardKey, member) {
|
|
7101
|
-
return this.
|
|
7102
|
-
|
|
7146
|
+
return this.gameFetch(
|
|
7147
|
+
"GET",
|
|
7148
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/members/${member}`,
|
|
7149
|
+
void 0,
|
|
7150
|
+
"GAME_GET_MEMBER_RANK_FAILED"
|
|
7103
7151
|
);
|
|
7104
7152
|
}
|
|
7105
7153
|
/**
|
|
7106
7154
|
* member 주변 (위 above 명 + 본인 + 아래 below 명) 조회.
|
|
7107
7155
|
*/
|
|
7108
7156
|
async getRankAround(appId, leaderboardKey, member, above = 5, below = 5) {
|
|
7109
|
-
return this.
|
|
7110
|
-
|
|
7157
|
+
return this.gameFetch(
|
|
7158
|
+
"GET",
|
|
7159
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/around/${member}?above=${above}&below=${below}`,
|
|
7160
|
+
void 0,
|
|
7161
|
+
"GAME_GET_RANK_AROUND_FAILED"
|
|
7111
7162
|
);
|
|
7112
7163
|
}
|
|
7113
7164
|
/**
|
|
7114
7165
|
* leaderboard 전체 reset (시즌 종료 시).
|
|
7115
7166
|
*/
|
|
7116
7167
|
async resetLeaderboard(appId, leaderboardKey) {
|
|
7117
|
-
await this.
|
|
7168
|
+
await this.gameFetch(
|
|
7169
|
+
"DELETE",
|
|
7170
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}`,
|
|
7171
|
+
void 0,
|
|
7172
|
+
"GAME_RESET_LEADERBOARD_FAILED"
|
|
7173
|
+
);
|
|
7118
7174
|
}
|
|
7119
7175
|
/**
|
|
7120
7176
|
* 특정 member 만 제거 (계정 삭제 등).
|
|
7121
7177
|
*/
|
|
7122
7178
|
async removeFromLeaderboard(appId, leaderboardKey, member) {
|
|
7123
|
-
await this.
|
|
7124
|
-
|
|
7179
|
+
await this.gameFetch(
|
|
7180
|
+
"DELETE",
|
|
7181
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/members/${member}`,
|
|
7182
|
+
void 0,
|
|
7183
|
+
"GAME_REMOVE_FROM_LEADERBOARD_FAILED"
|
|
7125
7184
|
);
|
|
7126
7185
|
}
|
|
7127
7186
|
// ─────────────────────────────────────────────────────────────────────
|
|
@@ -7136,47 +7195,66 @@ var GameAPI = class {
|
|
|
7136
7195
|
* await cb.game.uploadScript(appId, "ranked_br", fs.readFileSync("./ranked.lua", "utf-8"))
|
|
7137
7196
|
*/
|
|
7138
7197
|
async uploadScript(appId, name, code) {
|
|
7139
|
-
return this.
|
|
7198
|
+
return this.gameFetch(
|
|
7199
|
+
"POST",
|
|
7140
7200
|
`/v1/game/${appId}/scripts`,
|
|
7141
|
-
{ name, code }
|
|
7201
|
+
{ name, code },
|
|
7202
|
+
"GAME_UPLOAD_SCRIPT_FAILED"
|
|
7142
7203
|
);
|
|
7143
7204
|
}
|
|
7144
7205
|
/**
|
|
7145
7206
|
* app 의 모든 스크립트 메타데이터 목록.
|
|
7146
7207
|
*/
|
|
7147
7208
|
async listScripts(appId) {
|
|
7148
|
-
return this.
|
|
7209
|
+
return this.gameFetch(
|
|
7210
|
+
"GET",
|
|
7211
|
+
`/v1/game/${appId}/scripts`,
|
|
7212
|
+
void 0,
|
|
7213
|
+
"GAME_LIST_SCRIPTS_FAILED"
|
|
7214
|
+
);
|
|
7149
7215
|
}
|
|
7150
7216
|
/**
|
|
7151
7217
|
* 단일 스크립트 메타 + active version code.
|
|
7152
7218
|
*/
|
|
7153
7219
|
async getScript(appId, name) {
|
|
7154
|
-
return this.
|
|
7220
|
+
return this.gameFetch(
|
|
7221
|
+
"GET",
|
|
7222
|
+
`/v1/game/${appId}/scripts/${name}`,
|
|
7223
|
+
void 0,
|
|
7224
|
+
"GAME_GET_SCRIPT_FAILED"
|
|
7225
|
+
);
|
|
7155
7226
|
}
|
|
7156
7227
|
/**
|
|
7157
7228
|
* 단일 스크립트의 모든 버전 이력.
|
|
7158
7229
|
*/
|
|
7159
7230
|
async listScriptVersions(appId, name) {
|
|
7160
|
-
return this.
|
|
7161
|
-
|
|
7231
|
+
return this.gameFetch(
|
|
7232
|
+
"GET",
|
|
7233
|
+
`/v1/game/${appId}/scripts/${name}/versions`,
|
|
7234
|
+
void 0,
|
|
7235
|
+
"GAME_LIST_SCRIPT_VERSIONS_FAILED"
|
|
7162
7236
|
);
|
|
7163
7237
|
}
|
|
7164
7238
|
/**
|
|
7165
7239
|
* 특정 버전 활성화 (hot reload 자동). version=0 또는 미지정 → latest 활성화.
|
|
7166
7240
|
*/
|
|
7167
7241
|
async activateScript(appId, name, version) {
|
|
7168
|
-
return this.
|
|
7242
|
+
return this.gameFetch(
|
|
7243
|
+
"POST",
|
|
7169
7244
|
`/v1/game/${appId}/scripts/${name}/activate`,
|
|
7170
|
-
{ version: version ?? 0 }
|
|
7245
|
+
{ version: version ?? 0 },
|
|
7246
|
+
"GAME_ACTIVATE_SCRIPT_FAILED"
|
|
7171
7247
|
);
|
|
7172
7248
|
}
|
|
7173
7249
|
/**
|
|
7174
7250
|
* 직전 active 버전으로 롤백 (hot reload 자동).
|
|
7175
7251
|
*/
|
|
7176
7252
|
async rollbackScript(appId, name) {
|
|
7177
|
-
return this.
|
|
7253
|
+
return this.gameFetch(
|
|
7254
|
+
"POST",
|
|
7178
7255
|
`/v1/game/${appId}/scripts/${name}/rollback`,
|
|
7179
|
-
{}
|
|
7256
|
+
{},
|
|
7257
|
+
"GAME_ROLLBACK_SCRIPT_FAILED"
|
|
7180
7258
|
);
|
|
7181
7259
|
}
|
|
7182
7260
|
/**
|
|
@@ -7188,7 +7266,12 @@ var GameAPI = class {
|
|
|
7188
7266
|
* `POST /scripts/:name/deactivate` 로 endpoint 이동. 메서드명도 의도 명확화 위해 rename.
|
|
7189
7267
|
*/
|
|
7190
7268
|
async deactivateScript(appId, name) {
|
|
7191
|
-
await this.
|
|
7269
|
+
await this.gameFetch(
|
|
7270
|
+
"POST",
|
|
7271
|
+
`/v1/game/${appId}/scripts/${name}/deactivate`,
|
|
7272
|
+
{},
|
|
7273
|
+
"GAME_DEACTIVATE_SCRIPT_FAILED"
|
|
7274
|
+
);
|
|
7192
7275
|
}
|
|
7193
7276
|
/**
|
|
7194
7277
|
* 스크립트 영구 삭제 (hard-delete) — 메타 + 모든 버전 영구 제거. 복구 불가.
|
|
@@ -7200,7 +7283,12 @@ var GameAPI = class {
|
|
|
7200
7283
|
* 변경된 것에 대응.
|
|
7201
7284
|
*/
|
|
7202
7285
|
async deleteScript(appId, name) {
|
|
7203
|
-
await this.
|
|
7286
|
+
await this.gameFetch(
|
|
7287
|
+
"DELETE",
|
|
7288
|
+
`/v1/game/${appId}/scripts/${name}`,
|
|
7289
|
+
void 0,
|
|
7290
|
+
"GAME_DELETE_SCRIPT_FAILED"
|
|
7291
|
+
);
|
|
7204
7292
|
}
|
|
7205
7293
|
};
|
|
7206
7294
|
|
package/dist/index.mjs
CHANGED
|
@@ -6982,6 +6982,38 @@ var GameAPI = class {
|
|
|
6982
6982
|
}
|
|
6983
6983
|
return headers;
|
|
6984
6984
|
}
|
|
6985
|
+
// game-server (`game.connectbase.world`) 전용 fetch.
|
|
6986
|
+
//
|
|
6987
|
+
// 회귀 가드 (v3.14.1, NJB report 2026-05-14): matchqueue / leaderboard / scripts 16개
|
|
6988
|
+
// 메서드가 v3.0.0 BREAKING 이후 `this.http.*` 를 통해 기본 baseUrl (=core-server,
|
|
6989
|
+
// `api.connectbase.world`) 로 라우팅되면서 404 회귀. 호스트 분리된 game-server 경로는
|
|
6990
|
+
// 반드시 `this.gameServerUrl` 을 사용해야 한다. 회귀 재발 방지 테스트:
|
|
6991
|
+
// test/game-host-routing.test.ts.
|
|
6992
|
+
async gameFetch(method, path, body, errCode = "GAME_REQUEST_FAILED") {
|
|
6993
|
+
const init = { method, headers: { ...this.getHeaders() } };
|
|
6994
|
+
if (body !== void 0) {
|
|
6995
|
+
init.headers["Content-Type"] = "application/json";
|
|
6996
|
+
init.body = JSON.stringify(body);
|
|
6997
|
+
}
|
|
6998
|
+
const response = await fetch(`${this.gameServerUrl}${path}`, init);
|
|
6999
|
+
if (!response.ok) {
|
|
7000
|
+
let serverCode = errCode;
|
|
7001
|
+
let message = `${method} ${path} failed: ${response.statusText}`;
|
|
7002
|
+
try {
|
|
7003
|
+
const data = await response.json();
|
|
7004
|
+
if (data && typeof data.error === "string") {
|
|
7005
|
+
message = data.error;
|
|
7006
|
+
serverCode = data.error;
|
|
7007
|
+
}
|
|
7008
|
+
} catch {
|
|
7009
|
+
}
|
|
7010
|
+
throw new ApiError(response.status, message, serverCode);
|
|
7011
|
+
}
|
|
7012
|
+
if (response.status === 204) return void 0;
|
|
7013
|
+
const contentType = response.headers.get("content-type") || "";
|
|
7014
|
+
if (!contentType.includes("application/json")) return void 0;
|
|
7015
|
+
return response.json();
|
|
7016
|
+
}
|
|
6985
7017
|
// ─────────────────────────────────────────────────────────────────────
|
|
6986
7018
|
// Phase 3 — Matchqueue primitive (mechanism only)
|
|
6987
7019
|
//
|
|
@@ -7002,9 +7034,11 @@ var GameAPI = class {
|
|
|
7002
7034
|
* @constraints appId/queueKey/ticketId 는 [a-zA-Z0-9_-] 만 허용. ttlSec=0 이면 만료 없음.
|
|
7003
7035
|
*/
|
|
7004
7036
|
async enqueueMatch(appId, queueKey, ticketId, attributes, ttlSec) {
|
|
7005
|
-
return this.
|
|
7037
|
+
return this.gameFetch(
|
|
7038
|
+
"POST",
|
|
7006
7039
|
`/v1/game/${appId}/matchqueue/${queueKey}/tickets`,
|
|
7007
|
-
{ ticket_id: ticketId, attributes, ttl_sec: ttlSec ?? 0 }
|
|
7040
|
+
{ ticket_id: ticketId, attributes, ttl_sec: ttlSec ?? 0 },
|
|
7041
|
+
"GAME_ENQUEUE_MATCH_FAILED"
|
|
7008
7042
|
);
|
|
7009
7043
|
}
|
|
7010
7044
|
/**
|
|
@@ -7013,16 +7047,22 @@ var GameAPI = class {
|
|
|
7013
7047
|
* @example const tickets = await cb.game.listMatchqueue(appId, "ranked")
|
|
7014
7048
|
*/
|
|
7015
7049
|
async listMatchqueue(appId, queueKey) {
|
|
7016
|
-
return this.
|
|
7017
|
-
|
|
7050
|
+
return this.gameFetch(
|
|
7051
|
+
"GET",
|
|
7052
|
+
`/v1/game/${appId}/matchqueue/${queueKey}`,
|
|
7053
|
+
void 0,
|
|
7054
|
+
"GAME_LIST_MATCHQUEUE_FAILED"
|
|
7018
7055
|
);
|
|
7019
7056
|
}
|
|
7020
7057
|
/**
|
|
7021
7058
|
* 매칭 큐에서 ticket 제거 (예: 사용자가 매칭 취소).
|
|
7022
7059
|
*/
|
|
7023
7060
|
async cancelMatch(appId, queueKey, ticketId) {
|
|
7024
|
-
await this.
|
|
7025
|
-
|
|
7061
|
+
await this.gameFetch(
|
|
7062
|
+
"DELETE",
|
|
7063
|
+
`/v1/game/${appId}/matchqueue/${queueKey}/tickets/${ticketId}`,
|
|
7064
|
+
void 0,
|
|
7065
|
+
"GAME_CANCEL_MATCH_FAILED"
|
|
7026
7066
|
);
|
|
7027
7067
|
}
|
|
7028
7068
|
// ─────────────────────────────────────────────────────────────────────
|
|
@@ -7038,47 +7078,66 @@ var GameAPI = class {
|
|
|
7038
7078
|
* await cb.game.submitScore(appId, "global_elo", userId, 32, "incr")
|
|
7039
7079
|
*/
|
|
7040
7080
|
async submitScore(appId, leaderboardKey, member, score, mode = "set") {
|
|
7041
|
-
return this.
|
|
7081
|
+
return this.gameFetch(
|
|
7082
|
+
"POST",
|
|
7042
7083
|
`/v1/game/${appId}/leaderboards/${leaderboardKey}/scores`,
|
|
7043
|
-
{ member, score, mode }
|
|
7084
|
+
{ member, score, mode },
|
|
7085
|
+
"GAME_SUBMIT_SCORE_FAILED"
|
|
7044
7086
|
);
|
|
7045
7087
|
}
|
|
7046
7088
|
/**
|
|
7047
7089
|
* 상위 n 명 조회 (기본 10).
|
|
7048
7090
|
*/
|
|
7049
7091
|
async getTopScores(appId, leaderboardKey, n = 10) {
|
|
7050
|
-
return this.
|
|
7051
|
-
|
|
7092
|
+
return this.gameFetch(
|
|
7093
|
+
"GET",
|
|
7094
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/top?n=${n}`,
|
|
7095
|
+
void 0,
|
|
7096
|
+
"GAME_GET_TOP_SCORES_FAILED"
|
|
7052
7097
|
);
|
|
7053
7098
|
}
|
|
7054
7099
|
/**
|
|
7055
7100
|
* 단일 member 의 rank + score.
|
|
7056
7101
|
*/
|
|
7057
7102
|
async getMemberRank(appId, leaderboardKey, member) {
|
|
7058
|
-
return this.
|
|
7059
|
-
|
|
7103
|
+
return this.gameFetch(
|
|
7104
|
+
"GET",
|
|
7105
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/members/${member}`,
|
|
7106
|
+
void 0,
|
|
7107
|
+
"GAME_GET_MEMBER_RANK_FAILED"
|
|
7060
7108
|
);
|
|
7061
7109
|
}
|
|
7062
7110
|
/**
|
|
7063
7111
|
* member 주변 (위 above 명 + 본인 + 아래 below 명) 조회.
|
|
7064
7112
|
*/
|
|
7065
7113
|
async getRankAround(appId, leaderboardKey, member, above = 5, below = 5) {
|
|
7066
|
-
return this.
|
|
7067
|
-
|
|
7114
|
+
return this.gameFetch(
|
|
7115
|
+
"GET",
|
|
7116
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/around/${member}?above=${above}&below=${below}`,
|
|
7117
|
+
void 0,
|
|
7118
|
+
"GAME_GET_RANK_AROUND_FAILED"
|
|
7068
7119
|
);
|
|
7069
7120
|
}
|
|
7070
7121
|
/**
|
|
7071
7122
|
* leaderboard 전체 reset (시즌 종료 시).
|
|
7072
7123
|
*/
|
|
7073
7124
|
async resetLeaderboard(appId, leaderboardKey) {
|
|
7074
|
-
await this.
|
|
7125
|
+
await this.gameFetch(
|
|
7126
|
+
"DELETE",
|
|
7127
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}`,
|
|
7128
|
+
void 0,
|
|
7129
|
+
"GAME_RESET_LEADERBOARD_FAILED"
|
|
7130
|
+
);
|
|
7075
7131
|
}
|
|
7076
7132
|
/**
|
|
7077
7133
|
* 특정 member 만 제거 (계정 삭제 등).
|
|
7078
7134
|
*/
|
|
7079
7135
|
async removeFromLeaderboard(appId, leaderboardKey, member) {
|
|
7080
|
-
await this.
|
|
7081
|
-
|
|
7136
|
+
await this.gameFetch(
|
|
7137
|
+
"DELETE",
|
|
7138
|
+
`/v1/game/${appId}/leaderboards/${leaderboardKey}/members/${member}`,
|
|
7139
|
+
void 0,
|
|
7140
|
+
"GAME_REMOVE_FROM_LEADERBOARD_FAILED"
|
|
7082
7141
|
);
|
|
7083
7142
|
}
|
|
7084
7143
|
// ─────────────────────────────────────────────────────────────────────
|
|
@@ -7093,47 +7152,66 @@ var GameAPI = class {
|
|
|
7093
7152
|
* await cb.game.uploadScript(appId, "ranked_br", fs.readFileSync("./ranked.lua", "utf-8"))
|
|
7094
7153
|
*/
|
|
7095
7154
|
async uploadScript(appId, name, code) {
|
|
7096
|
-
return this.
|
|
7155
|
+
return this.gameFetch(
|
|
7156
|
+
"POST",
|
|
7097
7157
|
`/v1/game/${appId}/scripts`,
|
|
7098
|
-
{ name, code }
|
|
7158
|
+
{ name, code },
|
|
7159
|
+
"GAME_UPLOAD_SCRIPT_FAILED"
|
|
7099
7160
|
);
|
|
7100
7161
|
}
|
|
7101
7162
|
/**
|
|
7102
7163
|
* app 의 모든 스크립트 메타데이터 목록.
|
|
7103
7164
|
*/
|
|
7104
7165
|
async listScripts(appId) {
|
|
7105
|
-
return this.
|
|
7166
|
+
return this.gameFetch(
|
|
7167
|
+
"GET",
|
|
7168
|
+
`/v1/game/${appId}/scripts`,
|
|
7169
|
+
void 0,
|
|
7170
|
+
"GAME_LIST_SCRIPTS_FAILED"
|
|
7171
|
+
);
|
|
7106
7172
|
}
|
|
7107
7173
|
/**
|
|
7108
7174
|
* 단일 스크립트 메타 + active version code.
|
|
7109
7175
|
*/
|
|
7110
7176
|
async getScript(appId, name) {
|
|
7111
|
-
return this.
|
|
7177
|
+
return this.gameFetch(
|
|
7178
|
+
"GET",
|
|
7179
|
+
`/v1/game/${appId}/scripts/${name}`,
|
|
7180
|
+
void 0,
|
|
7181
|
+
"GAME_GET_SCRIPT_FAILED"
|
|
7182
|
+
);
|
|
7112
7183
|
}
|
|
7113
7184
|
/**
|
|
7114
7185
|
* 단일 스크립트의 모든 버전 이력.
|
|
7115
7186
|
*/
|
|
7116
7187
|
async listScriptVersions(appId, name) {
|
|
7117
|
-
return this.
|
|
7118
|
-
|
|
7188
|
+
return this.gameFetch(
|
|
7189
|
+
"GET",
|
|
7190
|
+
`/v1/game/${appId}/scripts/${name}/versions`,
|
|
7191
|
+
void 0,
|
|
7192
|
+
"GAME_LIST_SCRIPT_VERSIONS_FAILED"
|
|
7119
7193
|
);
|
|
7120
7194
|
}
|
|
7121
7195
|
/**
|
|
7122
7196
|
* 특정 버전 활성화 (hot reload 자동). version=0 또는 미지정 → latest 활성화.
|
|
7123
7197
|
*/
|
|
7124
7198
|
async activateScript(appId, name, version) {
|
|
7125
|
-
return this.
|
|
7199
|
+
return this.gameFetch(
|
|
7200
|
+
"POST",
|
|
7126
7201
|
`/v1/game/${appId}/scripts/${name}/activate`,
|
|
7127
|
-
{ version: version ?? 0 }
|
|
7202
|
+
{ version: version ?? 0 },
|
|
7203
|
+
"GAME_ACTIVATE_SCRIPT_FAILED"
|
|
7128
7204
|
);
|
|
7129
7205
|
}
|
|
7130
7206
|
/**
|
|
7131
7207
|
* 직전 active 버전으로 롤백 (hot reload 자동).
|
|
7132
7208
|
*/
|
|
7133
7209
|
async rollbackScript(appId, name) {
|
|
7134
|
-
return this.
|
|
7210
|
+
return this.gameFetch(
|
|
7211
|
+
"POST",
|
|
7135
7212
|
`/v1/game/${appId}/scripts/${name}/rollback`,
|
|
7136
|
-
{}
|
|
7213
|
+
{},
|
|
7214
|
+
"GAME_ROLLBACK_SCRIPT_FAILED"
|
|
7137
7215
|
);
|
|
7138
7216
|
}
|
|
7139
7217
|
/**
|
|
@@ -7145,7 +7223,12 @@ var GameAPI = class {
|
|
|
7145
7223
|
* `POST /scripts/:name/deactivate` 로 endpoint 이동. 메서드명도 의도 명확화 위해 rename.
|
|
7146
7224
|
*/
|
|
7147
7225
|
async deactivateScript(appId, name) {
|
|
7148
|
-
await this.
|
|
7226
|
+
await this.gameFetch(
|
|
7227
|
+
"POST",
|
|
7228
|
+
`/v1/game/${appId}/scripts/${name}/deactivate`,
|
|
7229
|
+
{},
|
|
7230
|
+
"GAME_DEACTIVATE_SCRIPT_FAILED"
|
|
7231
|
+
);
|
|
7149
7232
|
}
|
|
7150
7233
|
/**
|
|
7151
7234
|
* 스크립트 영구 삭제 (hard-delete) — 메타 + 모든 버전 영구 제거. 복구 불가.
|
|
@@ -7157,7 +7240,12 @@ var GameAPI = class {
|
|
|
7157
7240
|
* 변경된 것에 대응.
|
|
7158
7241
|
*/
|
|
7159
7242
|
async deleteScript(appId, name) {
|
|
7160
|
-
await this.
|
|
7243
|
+
await this.gameFetch(
|
|
7244
|
+
"DELETE",
|
|
7245
|
+
`/v1/game/${appId}/scripts/${name}`,
|
|
7246
|
+
void 0,
|
|
7247
|
+
"GAME_DELETE_SCRIPT_FAILED"
|
|
7248
|
+
);
|
|
7161
7249
|
}
|
|
7162
7250
|
};
|
|
7163
7251
|
|