T012–T016: Phase 3 application + web shell (use case, ports, React hook, UI, README)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
21
packages/application/src/advance-turn-use-case.ts
Normal file
21
packages/application/src/advance-turn-use-case.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import {
|
||||
advanceTurn,
|
||||
type DomainError,
|
||||
type DomainEvent,
|
||||
isDomainError,
|
||||
} from "@initiative/domain";
|
||||
import type { EncounterStore } from "./ports.js";
|
||||
|
||||
export function advanceTurnUseCase(
|
||||
store: EncounterStore,
|
||||
): DomainEvent[] | DomainError {
|
||||
const encounter = store.get();
|
||||
const result = advanceTurn(encounter);
|
||||
|
||||
if (isDomainError(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
store.save(result.encounter);
|
||||
return result.events;
|
||||
}
|
||||
Reference in New Issue
Block a user