fix(sdk): enforce runtime dependency boundary
This commit is contained in:
@@ -5,9 +5,8 @@ import type {
|
||||
GameServerMessage,
|
||||
PlatformToGameEvent,
|
||||
} from '../contracts/index.ts';
|
||||
import { Route } from '../../core/constants.ts';
|
||||
|
||||
const RESERVED_ROUTES = new Set<string>(Object.values(Route));
|
||||
const RESERVED_GAME_ENTRY_ROUTES = new Set(['platform', 'agent', 'room']);
|
||||
const GAME_SESSION_OPEN_FAULT_BRAND = Symbol.for(
|
||||
'youle.framework.sdk.GameSessionOpenFault',
|
||||
);
|
||||
@@ -104,7 +103,7 @@ export function assertGameEntry(entry: GameEntry): void {
|
||||
/** The single GameEntry route admission check shared by runtime adapters. */
|
||||
export function assertGameRoute(route: unknown): asserts route is string {
|
||||
assertNonEmptyText(route, 'route');
|
||||
if (RESERVED_ROUTES.has(route)) {
|
||||
if (RESERVED_GAME_ENTRY_ROUTES.has(route)) {
|
||||
throw new Error(`GameEntry reserved route: ${route}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user