UNPKG

the-game-domain

Version:

Complete domain layer for 'The Game' card game with rich business entities, automatic persistence, action tracking, and advanced game mechanics. Features Game, Player, Card, Deck, Pile entities with repository pattern, turn management, victory/defeat dete

31 lines 760 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InMemoryGameRepository = void 0; class InMemoryGameRepository { constructor() { this._games = new Map(); } async save(game) { this._games.set(game.id, game); } async findById(id) { return this._games.get(id) || null; } async findAll() { return Array.from(this._games.values()); } async delete(id) { this._games.delete(id); } clear() { this._games.clear(); } get size() { return this._games.size; } has(id) { return this._games.has(id); } } exports.InMemoryGameRepository = InMemoryGameRepository; //# sourceMappingURL=InMemoryGameRepository.js.map