fix(gateway): 일시정지와 서버 중지 상태 계약 분리

This commit is contained in:
2026-08-15 17:12:13 +00:00
parent dc27766dd6
commit 4f841ad82f
16 changed files with 320 additions and 41 deletions
@@ -0,0 +1,70 @@
export const GATEWAY_PROFILE_STATUSES = [
'RESERVED',
'PREOPEN',
'RUNNING',
'PAUSED',
'COMPLETED',
'STOPPED',
'DISABLED',
] as const;
export type GatewayProfileStatus = (typeof GATEWAY_PROFILE_STATUSES)[number];
export type GatewayProfileCapabilities = {
/** Frontend/API/daemon processes are expected to remain online. */
runtimeExpected: boolean;
/** A player may enter the game and read or edit data such as reserved turns. */
userAccessible: boolean;
/** The turn daemon may advance logical game time. */
turnsRunning: boolean;
/** An operator may move this state directly back to RUNNING. */
operatorResumable: boolean;
};
const CAPABILITIES: Record<GatewayProfileStatus, GatewayProfileCapabilities> = {
RESERVED: {
runtimeExpected: false,
userAccessible: false,
turnsRunning: false,
operatorResumable: false,
},
PREOPEN: {
runtimeExpected: true,
userAccessible: true,
turnsRunning: false,
operatorResumable: false,
},
RUNNING: {
runtimeExpected: true,
userAccessible: true,
turnsRunning: true,
operatorResumable: false,
},
PAUSED: {
runtimeExpected: true,
userAccessible: true,
turnsRunning: false,
operatorResumable: true,
},
COMPLETED: {
runtimeExpected: true,
userAccessible: true,
turnsRunning: false,
operatorResumable: false,
},
STOPPED: {
runtimeExpected: false,
userAccessible: false,
turnsRunning: false,
operatorResumable: true,
},
DISABLED: {
runtimeExpected: false,
userAccessible: false,
turnsRunning: false,
operatorResumable: false,
},
};
export const gatewayProfileCapabilities = (status: GatewayProfileStatus): GatewayProfileCapabilities =>
CAPABILITIES[status];
+1
View File
@@ -22,3 +22,4 @@ export * from './ranking/types.js';
export * from './ranking/legacyColor.js';
export * from './auth/accountIconProjection.js';
export * from './logging/formatLegacyLogHtml.js';
export * from './gateway/profileStatus.js';