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
+1 -15
View File
@@ -1,9 +1,6 @@
import type { WarTriggerModule, WarTriggerModuleExport } from './types.js';
import type { WarTriggerRegistry } from '@sammo-ts/logic/war/triggers.js';
export const WAR_TRIGGER_KEYS = ['che_필살', 'che_의술'] as const;
export type WarTriggerKey = (typeof WAR_TRIGGER_KEYS)[number];
export type WarTriggerKey = 'che_필살' | 'che_의술';
export type WarTriggerImporter = () => Promise<WarTriggerModuleExport>;
@@ -12,9 +9,6 @@ const defaultImporters: Record<WarTriggerKey, WarTriggerImporter> = {
che_의술: async () => import('./che_의술.js'),
};
export const isWarTriggerKey = (value: string): value is WarTriggerKey =>
WAR_TRIGGER_KEYS.includes(value as WarTriggerKey);
export class WarTriggerLoader {
private readonly cache = new Map<WarTriggerKey, Promise<WarTriggerModule>>();
@@ -60,12 +54,4 @@ export const loadWarTriggerModules = async (
return modules;
};
export const createWarTriggerRegistry = (modules: WarTriggerModule[]): WarTriggerRegistry => {
const registry: WarTriggerRegistry = {};
for (const module of modules) {
registry[module.key] = (unit) => module.createTriggerList(unit);
}
return registry;
};
export type { WarTriggerModule, WarTriggerModuleExport } from './types.js';