refactor: tighten backend and logic boundaries

This commit is contained in:
2026-08-15 06:46:52 +00:00
parent 7b02ff155f
commit 35d8824b95
86 changed files with 820 additions and 1872 deletions
+2 -2
View File
@@ -25,12 +25,12 @@ const readJsonFile = async (filePath: string): Promise<unknown> => {
const resolveMapRoot = (options?: MapLoaderOptions): string => options?.mapRoot ?? DEFAULT_MAP_ROOT;
export const resolveMapDefinitionPath = (mapName: string, options?: MapLoaderOptions): string => {
const resolveMapDefinitionPath = (mapName: string, options?: MapLoaderOptions): string => {
const prefix = options?.filePrefix ?? 'map_';
return path.resolve(resolveMapRoot(options), `${prefix}${mapName}.json`);
};
export const loadMapDefinition = async (mapPath: string): Promise<MapDefinition> => {
const loadMapDefinition = async (mapPath: string): Promise<MapDefinition> => {
const raw = await readJsonFile(mapPath);
return MapDefinitionSchema.parse(raw);
};
@@ -29,16 +29,16 @@ const resolveScenarioRoot = (options?: ScenarioLoaderOptions): string => options
export const resolveScenarioDefaultsPath = (options?: ScenarioLoaderOptions): string =>
path.resolve(resolveScenarioRoot(options), options?.defaultsFileName ?? 'default.json');
export const resolveScenarioPath = (options: ScenarioLoaderOptions | undefined, scenarioId: number): string =>
const resolveScenarioPath = (options: ScenarioLoaderOptions | undefined, scenarioId: number): string =>
path.resolve(resolveScenarioRoot(options), `scenario_${scenarioId}.json`);
export const loadScenarioDefaults = async (defaultsPath: string): Promise<ScenarioDefaults> => {
const loadScenarioDefaults = async (defaultsPath: string): Promise<ScenarioDefaults> => {
// 기본 시나리오 파일을 읽고 정규화한다.
const raw = await readJsonFile(defaultsPath);
return parseScenarioDefaults(raw);
};
export const loadScenarioDefinition = async (
const loadScenarioDefinition = async (
scenarioPath: string,
defaults: ScenarioDefaults
): Promise<ScenarioDefinition> => {
@@ -20,12 +20,12 @@ const readJsonFile = async (filePath: string): Promise<unknown> => {
const resolveUnitSetRoot = (options?: UnitSetLoaderOptions): string => options?.unitSetRoot ?? DEFAULT_UNIT_SET_ROOT;
export const resolveUnitSetDefinitionPath = (unitSetName: string, options?: UnitSetLoaderOptions): string => {
const resolveUnitSetDefinitionPath = (unitSetName: string, options?: UnitSetLoaderOptions): string => {
const prefix = options?.filePrefix ?? 'unitset_';
return path.resolve(resolveUnitSetRoot(options), `${prefix}${unitSetName}.json`);
};
export const loadUnitSetDefinition = async (unitSetPath: string): Promise<UnitSetDefinition> => {
const loadUnitSetDefinition = async (unitSetPath: string): Promise<UnitSetDefinition> => {
const raw = await readJsonFile(unitSetPath);
return parseUnitSetDefinition(raw);
};