@hellacardgames/speed 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ClientState-Dx8UvhMt.d.cts +111 -0
- package/dist/ClientState-Dx8UvhMt.d.cts.map +1 -0
- package/dist/ClientState-Dx8UvhMt.d.mts +111 -0
- package/dist/ClientState-Dx8UvhMt.d.mts.map +1 -0
- package/dist/client/index.cjs +60 -10
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +89 -14
- package/dist/client/index.d.cts.map +1 -1
- package/dist/client/index.d.mts +89 -14
- package/dist/client/index.d.mts.map +1 -1
- package/dist/client/index.mjs +60 -10
- package/dist/client/index.mjs.map +1 -1
- package/dist/manager/index.cjs +2 -2
- package/dist/manager/index.d.cts +140 -2
- package/dist/manager/index.d.cts.map +1 -0
- package/dist/manager/index.d.mts +140 -2
- package/dist/manager/index.d.mts.map +1 -0
- package/dist/manager/index.mjs +2 -2
- package/dist/manager-B7gHPSPL.cjs +823 -0
- package/dist/manager-B7gHPSPL.cjs.map +1 -0
- package/dist/manager-C6kRM9IW.mjs +818 -0
- package/dist/manager-C6kRM9IW.mjs.map +1 -0
- package/dist/server/index.cjs +45 -165
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +149 -3
- package/dist/server/index.d.cts.map +1 -0
- package/dist/server/index.d.mts +149 -3
- package/dist/server/index.d.mts.map +1 -0
- package/dist/server/index.mjs +45 -165
- package/dist/server/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/index-C5bT1Zzd.d.mts +0 -125
- package/dist/index-C5bT1Zzd.d.mts.map +0 -1
- package/dist/index-NySusLtY.d.cts +0 -125
- package/dist/index-NySusLtY.d.cts.map +0 -1
- package/dist/index-uaOvIhKT.d.cts +0 -247
- package/dist/index-uaOvIhKT.d.cts.map +0 -1
- package/dist/index-uaOvIhKT.d.mts +0 -247
- package/dist/index-uaOvIhKT.d.mts.map +0 -1
- package/dist/manager-BAxBCUOk.mjs +0 -790
- package/dist/manager-BAxBCUOk.mjs.map +0 -1
- package/dist/manager-C9oZYA47.cjs +0 -795
- package/dist/manager-C9oZYA47.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager-C6kRM9IW.mjs","names":["emitEvent","getEventsAndClearAcknowledged","doGetEventsAndClearAcknowledged"],"sources":["../src/game/constants.ts","../src/game/actions/createGame.ts","../src/game/lib/emitEvent.ts","../src/game/lib/emitEventToPlayer.ts","../src/game/actions/drawCard.ts","../src/game/actions/getClientStateAndClearEvents.ts","../src/game/actions/getEventsAndClearAcknowledged.ts","../src/game/actions/joinGame.ts","../src/game/actions/leaveGame.ts","../src/game/lib/isCardPlayable.ts","../src/game/lib/hasPlayableCard.ts","../src/game/actions/playCard.ts","../src/game/lib/shuffleCards.ts","../src/game/actions/reportNoPlayableCards.ts","../src/game/actions/sendChat.ts","../src/game/actions/startGame.ts","../src/manager/createManager.ts"],"sourcesContent":["import type { Card } from \"./types/Card.js\";\n\nexport const EXPIRY_EXTENSION_MS = 300000; // 5 minutes\nexport const MIN_PLAYERS = 2;\nexport const MAX_PLAYERS = 2;\nexport const MAX_HAND_SIZE = 5;\nexport const CAN_PLAY_AT_DELAY_MS = 3000;\n\nexport const CARDS: readonly Card[] = [\n { id: crypto.randomUUID(), rank: 2, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 3, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 4, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 5, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 6, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 7, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 8, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 9, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 10, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 11, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 12, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 13, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 14, suite: \"clubs\" },\n { id: crypto.randomUUID(), rank: 2, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 3, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 4, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 5, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 6, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 7, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 8, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 9, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 10, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 11, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 12, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 13, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 14, suite: \"diamonds\" },\n { id: crypto.randomUUID(), rank: 2, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 3, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 4, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 5, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 6, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 7, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 8, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 9, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 10, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 11, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 12, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 13, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 14, suite: \"hearts\" },\n { id: crypto.randomUUID(), rank: 2, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 3, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 4, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 5, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 6, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 7, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 8, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 9, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 10, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 11, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 12, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 13, suite: \"spades\" },\n { id: crypto.randomUUID(), rank: 14, suite: \"spades\" },\n];\n","import { EXPIRY_EXTENSION_MS } from \"../constants.js\";\nimport type { CreatedGame } from \"../types/Game.js\";\nimport type { Player } from \"../types/Player.js\";\n\nexport function createGame(userId: string, username: string) {\n const player: Player = {\n id: crypto.randomUUID(),\n userId,\n username,\n events: [],\n hand: [],\n drawPile: [],\n sidePile: [],\n centerPile: [],\n hasNoPlayableCards: false,\n };\n\n const createdAt = Date.now();\n\n const game: CreatedGame = {\n status: \"created\",\n id: crypto.randomUUID(),\n createdAt,\n expiresAt: createdAt + EXPIRY_EXTENSION_MS,\n chatMessages: [],\n players: [player],\n };\n\n return { game, playerId: player.id } as const;\n}\n","type Game = {\n readonly players: {\n readonly events: { readonly id: string }[];\n }[];\n};\n\ntype OmitId<T> = T extends unknown ? Omit<T, \"id\"> : never;\n\nexport function emitEvent<T extends Game>(\n game: T,\n data: OmitId<T[\"players\"][number][\"events\"][number]>,\n): void {\n const event = { ...data, id: crypto.randomUUID() };\n for (const p of game.players) {\n p.events.push(event);\n }\n}\n","type Player = {\n readonly events: { readonly id: string }[];\n};\n\ntype OmitId<T> = T extends unknown ? Omit<T, \"id\"> : never;\n\nexport function emitEventToPlayer<T extends Player>(\n player: T,\n data: OmitId<T[\"events\"][number]>,\n): void {\n player.events.push({ ...data, id: crypto.randomUUID() });\n}\n","import { emitEvent } from \"../lib/emitEvent.js\";\nimport { emitEventToPlayer } from \"../lib/emitEventToPlayer.js\";\nimport { EXPIRY_EXTENSION_MS, MAX_HAND_SIZE } from \"../constants.js\";\nimport type { StartedGame } from \"../types/Game.js\";\n\nexport function drawCard(game: StartedGame, playerId: string) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n if (Date.now() < game.canPlayAt) {\n return { success: false, error: \"canPlayAtNotReached\" } as const;\n }\n if (player.hand.length >= MAX_HAND_SIZE) {\n return { success: false, error: \"handFull\" } as const;\n }\n if (player.drawPile.length === 0) {\n return { success: false, error: \"drawPileEmpty\" } as const;\n }\n game.expiresAt = Date.now() + EXPIRY_EXTENSION_MS;\n emitEvent(game, { type: \"expirationUpdated\", expiresAt: game.expiresAt });\n const card = player.drawPile.pop()!;\n player.hand.push(card);\n emitEventToPlayer(player, { type: \"drewCard\", card });\n emitEvent(game, { type: \"playerDrewCard\", username: player.username });\n return { success: true, game } as const;\n}\n","import type { ClientState } from \"../types/ClientState.js\";\nimport type { Game } from \"../types/Game.js\";\n\nexport function getClientStateAndClearEvents(game: Game, playerId: string) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n const state: ClientState = {\n status: game.status,\n gameId: game.id,\n playerId,\n username: player.username,\n players: game.players.map((p) => ({\n username: p.username,\n handSize: p.hand.length,\n drawPileSize: p.drawPile.length,\n sidePileSize: p.sidePile.length,\n centerPileTopCard: p.centerPile.length\n ? p.centerPile[p.centerPile.length - 1]!\n : null,\n })),\n expiresAt: game.expiresAt,\n chatMessages: game.chatMessages,\n hand: player.hand,\n canPlayAt: game.status === \"started\" ? game.canPlayAt : null,\n };\n player.events.length = 0;\n return { success: true, state, game } as const;\n}\n","import { getEventsAndClearAcknowledged as doGetEventsAndClearAcknowledged } from \"@hellacardgames/lib\";\nimport type { Game } from \"../types/Game.js\";\n\nexport function getEventsAndClearAcknowledged(\n game: Game,\n playerId: string,\n lastReadId: string | null,\n) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n\n const result = doGetEventsAndClearAcknowledged(game, player.id, lastReadId);\n\n return {\n success: true,\n events: result.events,\n game: result.game,\n } as const;\n}\n","import { emitEvent } from \"../lib/emitEvent.js\";\nimport { MAX_PLAYERS } from \"../constants.js\";\nimport type { CreatedGame } from \"../types/Game.js\";\nimport type { Player } from \"../types/Player.js\";\n\nexport function joinGame(game: CreatedGame, userId: string, username: string) {\n if (game.players.length === MAX_PLAYERS) {\n return { success: false, error: \"maxPlayersReached\" } as const;\n }\n if (game.players.find((p) => p.userId === userId)) {\n return { success: false, error: \"alreadyInGame\" } as const;\n }\n const player: Player = {\n id: crypto.randomUUID(),\n userId,\n username,\n events: [],\n hand: [],\n drawPile: [],\n sidePile: [],\n centerPile: [],\n hasNoPlayableCards: false,\n };\n game.players.push(player);\n emitEvent(game, { type: \"playerJoined\", username });\n return { success: true, game, playerId: player.id } as const;\n}\n","import { emitEvent } from \"../lib/emitEvent.js\";\nimport { EXPIRY_EXTENSION_MS, MIN_PLAYERS } from \"../constants.js\";\nimport type { Game } from \"../types/Game.js\";\n\nexport function leaveGame(game: Game, playerId: string) {\n const playerIndex = game.players.findIndex((p) => p.id === playerId);\n if (playerIndex === -1) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n\n const player = game.players[playerIndex]!;\n emitEvent(game, { type: \"playerLeft\", username: player.username });\n\n game.players.splice(playerIndex, 1);\n\n if (game.status === \"started\" && game.players.length < MIN_PLAYERS) {\n const forfeitedGame: Game = {\n ...game,\n status: \"forfeited\",\n expiresAt: Date.now() + EXPIRY_EXTENSION_MS,\n };\n // this.games.set(game.id, forfeitedGame);\n emitEvent(forfeitedGame, { type: \"gameForfeited\" });\n emitEvent(forfeitedGame, {\n type: \"expirationUpdated\",\n expiresAt: forfeitedGame.expiresAt,\n });\n }\n return { success: true, game } as const;\n}\n","import type { Card } from \"../types/Card.js\";\n\nexport function isCardPlayable(card: Card, targetPile: Card[]) {\n const targetCard = targetPile[targetPile.length - 1]!;\n const diff = Math.abs(card.rank - targetCard.rank) % 11;\n return diff === 1;\n}\n","import { isCardPlayable } from \"./isCardPlayable.js\";\nimport type { Game } from \"../types/Game.js\";\nimport type { Player } from \"../types/Player.js\";\n\nexport function hasPlayableCard(player: Player, game: Game) {\n const otherPlayer = game.players.find((p) => p !== player)!;\n const targetPile1 = player.centerPile;\n const targetPile2 = otherPlayer.centerPile;\n for (const card of player.hand) {\n if (\n isCardPlayable(card, targetPile1) ||\n isCardPlayable(card, targetPile2)\n ) {\n return true;\n }\n }\n return false;\n}\n","import { emitEvent } from \"../lib/emitEvent.js\";\nimport { EXPIRY_EXTENSION_MS } from \"../constants.js\";\nimport { hasPlayableCard } from \"../lib/hasPlayableCard.js\";\nimport { isCardPlayable } from \"../lib/isCardPlayable.js\";\nimport type { CompletedGame, StartedGame } from \"../types/Game.js\";\n\nexport function playCard(\n game: StartedGame,\n playerId: string,\n cardId: string,\n isForOtherPlayerPile: boolean,\n) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n if (Date.now() < game.canPlayAt) {\n return { success: false, error: \"canPlayAtNotReached\" } as const;\n }\n const cardIndex = player.hand.findIndex((c) => c.id === cardId);\n if (cardIndex === -1) {\n return { success: false, error: \"cardNotFound\" } as const;\n }\n const otherPlayer = game.players.find((p) => p !== player)!;\n const targetPile = isForOtherPlayerPile\n ? otherPlayer.centerPile\n : player.centerPile;\n const card = player.hand[cardIndex]!;\n if (!isCardPlayable(card, targetPile)) {\n return { success: false, error: \"cardNotPlayable\" } as const;\n }\n\n game.expiresAt = Date.now() + EXPIRY_EXTENSION_MS;\n emitEvent(game, { type: \"expirationUpdated\", expiresAt: game.expiresAt });\n\n player.hand.splice(cardIndex, 1);\n targetPile.push(card);\n emitEvent(game, {\n type: \"cardPlayed\",\n username: player.username,\n card,\n isForOtherPlayerPile,\n });\n\n if (otherPlayer.hasNoPlayableCards && hasPlayableCard(otherPlayer, game)) {\n otherPlayer.hasNoPlayableCards = false;\n }\n\n if (player.hand.length === 0 && player.drawPile.length === 0) {\n emitEvent(game, { type: \"gameCompleted\" });\n const completedGame: CompletedGame = {\n ...game,\n status: \"completed\",\n };\n return { success: true, game: completedGame } as const;\n }\n\n return { success: true, game } as const;\n}\n","type Card = { readonly id: string };\n\nexport function shuffleCards<T extends Card>(cards: T[]): void {\n for (let i = cards.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [cards[i], cards[j]] = [cards[j]!, cards[i]!];\n }\n}\n","import { emitEvent } from \"../lib/emitEvent.js\";\nimport { shuffleCards } from \"../lib/shuffleCards.js\";\nimport {\n CAN_PLAY_AT_DELAY_MS,\n EXPIRY_EXTENSION_MS,\n MAX_HAND_SIZE,\n} from \"../constants.js\";\nimport { hasPlayableCard } from \"../lib/hasPlayableCard.js\";\nimport type { StartedGame } from \"../types/Game.js\";\n\nexport function reportNoPlayableCards(game: StartedGame, playerId: string) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n if (Date.now() < game.canPlayAt) {\n return { success: false, error: \"canPlayAtNotReached\" } as const;\n }\n if (player.hasNoPlayableCards) {\n return { success: false, error: \"alreadyReported\" } as const;\n }\n if (hasPlayableCard(player, game)) {\n return { success: false, error: \"hasPlayableCard\" } as const;\n }\n if (player.drawPile.length > 0 && player.hand.length < MAX_HAND_SIZE) {\n return { success: false, error: \"canDraw\" } as const;\n }\n\n game.expiresAt = Date.now() + EXPIRY_EXTENSION_MS;\n emitEvent(game, { type: \"expirationUpdated\", expiresAt: game.expiresAt });\n\n player.hasNoPlayableCards = true;\n\n const otherPlayer = game.players.find((p) => p !== player)!;\n if (otherPlayer.hasNoPlayableCards) {\n if (player.sidePile.length === 0 && otherPlayer.sidePile.length === 0) {\n const cards = [...player.centerPile, ...otherPlayer.centerPile];\n shuffleCards(cards);\n player.sidePile.push(...cards.splice(0, 5));\n emitEvent(game, {\n type: \"playerSidePileInitialized\",\n username: player.username,\n numCards: player.sidePile.length,\n });\n player.centerPile.push(...cards.splice(0, 1));\n emitEvent(game, {\n type: \"playerCenterPileInitialized\",\n username: player.username,\n card: player.centerPile[player.centerPile.length - 1]!,\n });\n otherPlayer.centerPile.push(...cards.splice(0, 1));\n emitEvent(game, {\n type: \"playerCenterPileInitialized\",\n username: otherPlayer.username,\n card: otherPlayer.centerPile[otherPlayer.centerPile.length - 1]!,\n });\n otherPlayer.sidePile.push(...cards.splice(0, 5));\n emitEvent(game, {\n type: \"playerSidePileInitialized\",\n username: otherPlayer.username,\n numCards: otherPlayer.sidePile.length,\n });\n } else {\n const playerSidePileCard = player.sidePile.pop()!;\n player.centerPile.push(playerSidePileCard);\n emitEvent(game, {\n type: \"cardDrawnFromSidePileToCenterPile\",\n username: player.username,\n card: playerSidePileCard,\n });\n const otherPlayerSidePileCard = otherPlayer.sidePile.pop()!;\n otherPlayer.centerPile.push(otherPlayerSidePileCard);\n emitEvent(game, {\n type: \"cardDrawnFromSidePileToCenterPile\",\n username: otherPlayer.username,\n card: otherPlayerSidePileCard,\n });\n }\n player.hasNoPlayableCards = false;\n otherPlayer.hasNoPlayableCards = false;\n game.canPlayAt = Date.now() + CAN_PLAY_AT_DELAY_MS;\n emitEvent(game, {\n type: \"canPlayAtUpdated\",\n canPlayAt: game.canPlayAt,\n });\n }\n\n return { success: true, game } as const;\n}\n","import { addItemToCollection, emitEvent } from \"@hellacardgames/lib\";\nimport type { ChatMessage } from \"../types/ChatMessage.js\";\nimport type { Game } from \"../types/Game.js\";\n\nexport function sendChat(game: Game, playerId: string, text: string) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n\n const message: ChatMessage = {\n id: crypto.randomUUID(),\n username: player.username,\n text,\n };\n\n game = {\n ...game,\n chatMessages: addItemToCollection(game.chatMessages, message),\n };\n\n game = emitEvent(game, { type: \"chat\", message });\n\n return { success: true, game } as const;\n}\n","import { emitEvent } from \"../lib/emitEvent.js\";\nimport { emitEventToPlayer } from \"../lib/emitEventToPlayer.js\";\nimport { shuffleCards } from \"../lib/shuffleCards.js\";\nimport {\n CAN_PLAY_AT_DELAY_MS,\n CARDS,\n EXPIRY_EXTENSION_MS,\n MIN_PLAYERS,\n} from \"../constants.js\";\nimport type { CreatedGame, StartedGame } from \"../types/Game.js\";\n\nexport function startGame(game: CreatedGame, playerId: string) {\n const player = game.players.find((p) => p.id === playerId);\n if (!player) {\n return { success: false, error: \"playerNotFound\" } as const;\n }\n if (game.players.indexOf(player) !== 0) {\n return { success: false, error: \"playerNotAdmin\" } as const;\n }\n if (game.players.length < MIN_PLAYERS) {\n return { success: false, error: \"minPlayersNotReached\" } as const;\n }\n const otherPlayer = game.players[1]!;\n const cards = [...CARDS];\n shuffleCards(cards);\n\n player.sidePile.push(...cards.splice(0, 5));\n emitEvent(game, {\n type: \"playerSidePileInitialized\",\n username: player.username,\n numCards: player.sidePile.length,\n });\n\n player.centerPile.push(...cards.splice(0, 1));\n emitEvent(game, {\n type: \"playerCenterPileInitialized\",\n username: player.username,\n card: player.centerPile[player.centerPile.length - 1]!,\n });\n\n otherPlayer.centerPile.push(...cards.splice(0, 1));\n emitEvent(game, {\n type: \"playerCenterPileInitialized\",\n username: otherPlayer.username,\n card: otherPlayer.centerPile[otherPlayer.centerPile.length - 1]!,\n });\n\n otherPlayer.sidePile.push(...cards.splice(0, 5));\n emitEvent(game, {\n type: \"playerSidePileInitialized\",\n username: otherPlayer.username,\n numCards: otherPlayer.sidePile.length,\n });\n\n player.drawPile.push(...cards.splice(0, 15));\n emitEvent(game, {\n type: \"playerDrawPileInitialized\",\n username: player.username,\n numCards: player.drawPile.length,\n });\n\n player.hand.push(...cards.splice(0, 5));\n emitEventToPlayer(player, { type: \"handInitialized\", cards: player.hand });\n emitEvent(game, {\n type: \"playerHandInitialized\",\n username: player.username,\n numCards: player.hand.length,\n });\n\n otherPlayer.drawPile.push(...cards.splice(0, 15));\n emitEvent(game, {\n type: \"playerDrawPileInitialized\",\n username: otherPlayer.username,\n numCards: otherPlayer.drawPile.length,\n });\n\n otherPlayer.hand.push(...cards.splice(0, 5));\n emitEventToPlayer(otherPlayer, {\n type: \"handInitialized\",\n cards: otherPlayer.hand,\n });\n emitEvent(game, {\n type: \"playerHandInitialized\",\n username: otherPlayer.username,\n numCards: otherPlayer.hand.length,\n });\n\n const startedGame: StartedGame = {\n ...game,\n status: \"started\",\n expiresAt: Date.now() + EXPIRY_EXTENSION_MS,\n canPlayAt: Date.now() + CAN_PLAY_AT_DELAY_MS,\n };\n // this.games.set(game.id, startedGame);\n emitEvent(startedGame, { type: \"gameStarted\" });\n emitEvent(startedGame, {\n type: \"expirationUpdated\",\n expiresAt: startedGame.expiresAt,\n });\n emitEvent(startedGame, {\n type: \"canPlayAtUpdated\",\n canPlayAt: startedGame.canPlayAt,\n });\n return { success: true, game: startedGame } as const;\n}\n","import { createManagerFactory } from \"@hellacardgames/lib\";\nimport {\n createGame,\n drawCard,\n getClientStateAndClearEvents,\n getEventsAndClearAcknowledged,\n joinGame,\n leaveGame,\n MAX_PLAYERS,\n playCard,\n reportNoPlayableCards,\n sendChat,\n startGame,\n} from \"../game/index.js\";\n\nexport const createManager = createManagerFactory({\n maxPlayers: MAX_PLAYERS,\n createGame,\n getClientStateAndClearEvents,\n getEventsAndClearAcknowledged,\n joinGame,\n leaveGame,\n sendChat,\n startGame,\n createCustomActions: (games) => ({\n drawCard: (gameId: string, playerId: string) => {\n const game = games.get(gameId);\n if (!game) {\n return { success: false, error: \"gameNotFound\" } as const;\n }\n if (game.status !== \"started\") {\n return { success: false, error: \"invalidStatus\" } as const;\n }\n const result = drawCard(game, playerId);\n if (!result.success) {\n return { success: false, error: result.error } as const;\n }\n games.set(gameId, result.game);\n return { success: true } as const;\n },\n playCard: (\n gameId: string,\n playerId: string,\n cardId: string,\n isForOtherPlayerPile: boolean,\n ) => {\n const game = games.get(gameId);\n if (!game) {\n return { success: false, error: \"gameNotFound\" } as const;\n }\n if (game.status !== \"started\") {\n return { success: false, error: \"invalidStatus\" } as const;\n }\n const result = playCard(game, playerId, cardId, isForOtherPlayerPile);\n if (!result.success) {\n return { success: false, error: result.error } as const;\n }\n games.set(gameId, result.game);\n return { success: true } as const;\n },\n reportNoPlayableCards: (gameId: string, playerId: string) => {\n const game = games.get(gameId);\n if (!game) {\n return { success: false, error: \"gameNotFound\" } as const;\n }\n if (game.status !== \"started\") {\n return { success: false, error: \"invalidStatus\" } as const;\n }\n const result = reportNoPlayableCards(game, playerId);\n if (!result.success) {\n return { success: false, error: result.error } as const;\n }\n games.set(gameId, result.game);\n return { success: true } as const;\n },\n }),\n});\n"],"mappings":";;AAEA,MAAa,sBAAsB;AAInC,MAAa,uBAAuB;AAEpC,MAAa,QAAyB;CACpC;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAG,OAAO;CAAQ;CACnD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAI,OAAO;CAAQ;CACpD;EAAE,IAAI,OAAO,WAAW;EAAG,MAAM;EAAI,OAAO;CAAQ;CACpD;EAAE,IAAI,OAAO,WAAW;EAAG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SAAS;IAAO,OAAO,OAAO;GAAM;GAE/C,MAAM,IAAI,QAAQ,OAAO,IAAI;GAC7B,OAAO,EAAE,SAAS,KAAK;EACzB;EACA,WACE,QACA,UACA,QACA,yBACG;GACH,MAAM,OAAO,MAAM,IAAI,MAAM;GAC7B,IAAI,CAAC,MACH,OAAO;IAAE,SAAS;IAAO,OAAO;GAAe;GAEjD,IAAI,KAAK,WAAW,WAClB,OAAO;IAAE,SAAS;IAAO,OAAO;GAAgB;GAElD,MAAM,SAAS,SAAS,MAAM,UAAU,QAAQ,oBAAoB;GACpE,IAAI,CAAC,OAAO,SACV,OAAO;IAAE,SAAS;IAAO,OAAO,OAAO;GAAM;GAE/C,MAAM,IAAI,QAAQ,OAAO,IAAI;GAC7B,OAAO,EAAE,SAAS,KAAK;EACzB;EACA,wBAAwB,QAAgB,aAAqB;GAC3D,MAAM,OAAO,MAAM,IAAI,MAAM;GAC7B,IAAI,CAAC,MACH,OAAO;IAAE,SAAS;IAAO,OAAO;GAAe;GAEjD,IAAI,KAAK,WAAW,WAClB,OAAO;IAAE,SAAS;IAAO,OAAO;GAAgB;GAElD,MAAM,SAAS,sBAAsB,MAAM,QAAQ;GACnD,IAAI,CAAC,OAAO,SACV,OAAO;IAAE,SAAS;IAAO,OAAO,OAAO;GAAM;GAE/C,MAAM,IAAI,QAAQ,OAAO,IAAI;GAC7B,OAAO,EAAE,SAAS,KAAK;EACzB;CACF;AACF,CAAC"}
|
package/dist/server/index.cjs
CHANGED
|
@@ -1,188 +1,68 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_manager = require("../manager-
|
|
2
|
+
const require_manager = require("../manager-B7gHPSPL.cjs");
|
|
3
|
+
let _hellacardgames_lib = require("@hellacardgames/lib");
|
|
3
4
|
let zod = require("zod");
|
|
4
|
-
//#region src/server/
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
playerId: zod.z.string()
|
|
12
|
-
}).transform(({ gameId, playerId }) => [gameId, playerId]);
|
|
13
|
-
const getEventsAndClearAcknowledgedInputSchema = zod.z.object({
|
|
14
|
-
gameId: zod.z.string(),
|
|
15
|
-
playerId: zod.z.string(),
|
|
16
|
-
lastReadId: zod.z.string().nullable()
|
|
17
|
-
}).transform(({ gameId, playerId, lastReadId }) => [
|
|
18
|
-
gameId,
|
|
19
|
-
playerId,
|
|
20
|
-
lastReadId
|
|
21
|
-
]);
|
|
22
|
-
const joinGameInputSchema = zod.z.object({ gameId: zod.z.string() }).transform(({ gameId }) => [gameId]);
|
|
23
|
-
const leaveGameInputSchema = zod.z.object({
|
|
24
|
-
gameId: zod.z.string(),
|
|
25
|
-
playerId: zod.z.string()
|
|
26
|
-
}).transform(({ gameId, playerId }) => [gameId, playerId]);
|
|
27
|
-
const playCardInputSchema = zod.z.object({
|
|
28
|
-
gameId: zod.z.string(),
|
|
29
|
-
playerId: zod.z.string(),
|
|
30
|
-
cardId: zod.z.string(),
|
|
31
|
-
isForOtherPlayerPile: zod.z.boolean()
|
|
32
|
-
}).transform(({ gameId, playerId, cardId, isForOtherPlayerPile }) => [
|
|
33
|
-
gameId,
|
|
34
|
-
playerId,
|
|
35
|
-
cardId,
|
|
36
|
-
isForOtherPlayerPile
|
|
37
|
-
]);
|
|
38
|
-
const reportNoPlayableCardsInputSchema = zod.z.object({
|
|
39
|
-
gameId: zod.z.string(),
|
|
40
|
-
playerId: zod.z.string()
|
|
41
|
-
}).transform(({ gameId, playerId }) => [gameId, playerId]);
|
|
42
|
-
const sendChatInputSchema = zod.z.object({
|
|
43
|
-
gameId: zod.z.string(),
|
|
44
|
-
playerId: zod.z.string(),
|
|
45
|
-
text: zod.z.string()
|
|
46
|
-
}).transform(({ gameId, playerId, text }) => [
|
|
47
|
-
gameId,
|
|
48
|
-
playerId,
|
|
49
|
-
text
|
|
50
|
-
]);
|
|
51
|
-
const startGameInputSchema = zod.z.object({
|
|
52
|
-
gameId: zod.z.string(),
|
|
53
|
-
playerId: zod.z.string()
|
|
54
|
-
}).transform(({ gameId, playerId }) => [gameId, playerId]);
|
|
55
|
-
var Server = class {
|
|
56
|
-
manager;
|
|
57
|
-
actions = [
|
|
58
|
-
{
|
|
59
|
-
path: "/createGame",
|
|
60
|
-
action: this.createGame.bind(this)
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
path: "/drawCard",
|
|
64
|
-
action: this.drawCard.bind(this)
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
path: "/getClientStateAndClearEvents",
|
|
68
|
-
action: this.getClientStateAndClearEvents.bind(this)
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
path: "/getEventsAndClearAcknowledged",
|
|
72
|
-
action: this.getEventsAndClearAcknowledged.bind(this)
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
path: "/getJoinableGames",
|
|
76
|
-
action: this.getJoinableGames.bind(this)
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
path: "/joinGame",
|
|
80
|
-
action: this.joinGame.bind(this)
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
path: "/leaveGame",
|
|
84
|
-
action: this.leaveGame.bind(this)
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
path: "/playCard",
|
|
88
|
-
action: this.playCard.bind(this)
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
path: "/reportNoPlayableCards",
|
|
92
|
-
action: this.reportNoPlayableCards.bind(this)
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
path: "/sendChat",
|
|
96
|
-
action: this.sendChat.bind(this)
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
path: "/startGame",
|
|
100
|
-
action: this.startGame.bind(this)
|
|
101
|
-
}
|
|
102
|
-
];
|
|
103
|
-
constructor(...args) {
|
|
104
|
-
this.manager = new require_manager.Manager(...args);
|
|
105
|
-
}
|
|
106
|
-
createGame(userId, username) {
|
|
107
|
-
return this.manager.createGame(userId, username);
|
|
108
|
-
}
|
|
109
|
-
drawCard(input) {
|
|
5
|
+
//#region src/server/createServer.ts
|
|
6
|
+
const createServer = (0, _hellacardgames_lib.createServerFactory)(require_manager.createManager, (manager) => {
|
|
7
|
+
const drawCardInputSchema = zod.z.object({
|
|
8
|
+
gameId: zod.z.string(),
|
|
9
|
+
playerId: zod.z.string()
|
|
10
|
+
}).transform(({ gameId, playerId }) => [gameId, playerId]);
|
|
11
|
+
function drawCard(input) {
|
|
110
12
|
const parseResult = drawCardInputSchema.safeParse(input);
|
|
111
13
|
if (!parseResult.success) return {
|
|
112
14
|
success: false,
|
|
113
15
|
error: "invalidInput"
|
|
114
16
|
};
|
|
115
|
-
return
|
|
116
|
-
}
|
|
117
|
-
getClientStateAndClearEvents(input) {
|
|
118
|
-
const parseResult = getClientStateAndClearEventsInputSchema.safeParse(input);
|
|
119
|
-
if (!parseResult.success) return {
|
|
120
|
-
success: false,
|
|
121
|
-
error: "invalidInput"
|
|
122
|
-
};
|
|
123
|
-
return this.manager.getClientStateAndClearEvents(...parseResult.data);
|
|
17
|
+
return manager.drawCard(...parseResult.data);
|
|
124
18
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const parseResult = joinGameInputSchema.safeParse(input);
|
|
138
|
-
if (!parseResult.success) return {
|
|
139
|
-
success: false,
|
|
140
|
-
error: "invalidInput"
|
|
141
|
-
};
|
|
142
|
-
return this.manager.joinGame(...parseResult.data, userId, username);
|
|
143
|
-
}
|
|
144
|
-
leaveGame(input) {
|
|
145
|
-
const parseResult = leaveGameInputSchema.safeParse(input);
|
|
146
|
-
if (!parseResult.success) return {
|
|
147
|
-
success: false,
|
|
148
|
-
error: "invalidInput"
|
|
149
|
-
};
|
|
150
|
-
return this.manager.leaveGame(...parseResult.data);
|
|
151
|
-
}
|
|
152
|
-
playCard(input) {
|
|
19
|
+
const playCardInputSchema = zod.z.object({
|
|
20
|
+
gameId: zod.z.string(),
|
|
21
|
+
playerId: zod.z.string(),
|
|
22
|
+
cardId: zod.z.string(),
|
|
23
|
+
isForOtherPlayerPile: zod.z.boolean()
|
|
24
|
+
}).transform(({ gameId, playerId, cardId, isForOtherPlayerPile }) => [
|
|
25
|
+
gameId,
|
|
26
|
+
playerId,
|
|
27
|
+
cardId,
|
|
28
|
+
isForOtherPlayerPile
|
|
29
|
+
]);
|
|
30
|
+
function playCard(input) {
|
|
153
31
|
const parseResult = playCardInputSchema.safeParse(input);
|
|
154
32
|
if (!parseResult.success) return {
|
|
155
33
|
success: false,
|
|
156
34
|
error: "invalidInput"
|
|
157
35
|
};
|
|
158
|
-
return
|
|
36
|
+
return manager.playCard(...parseResult.data);
|
|
159
37
|
}
|
|
160
|
-
|
|
38
|
+
const reportNoPlayableCardsInputSchema = zod.z.object({
|
|
39
|
+
gameId: zod.z.string(),
|
|
40
|
+
playerId: zod.z.string()
|
|
41
|
+
}).transform(({ gameId, playerId }) => [gameId, playerId]);
|
|
42
|
+
function reportNoPlayableCards(input) {
|
|
161
43
|
const parseResult = reportNoPlayableCardsInputSchema.safeParse(input);
|
|
162
44
|
if (!parseResult.success) return {
|
|
163
45
|
success: false,
|
|
164
46
|
error: "invalidInput"
|
|
165
47
|
};
|
|
166
|
-
return
|
|
167
|
-
}
|
|
168
|
-
sendChat(input) {
|
|
169
|
-
const parseResult = sendChatInputSchema.safeParse(input);
|
|
170
|
-
if (!parseResult.success) return {
|
|
171
|
-
success: false,
|
|
172
|
-
error: "invalidInput"
|
|
173
|
-
};
|
|
174
|
-
return this.manager.sendChat(...parseResult.data);
|
|
48
|
+
return manager.reportNoPlayableCards(...parseResult.data);
|
|
175
49
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
path: "/drawCard",
|
|
53
|
+
action: drawCard
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
path: "/playCard",
|
|
57
|
+
action: playCard
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
path: "/reportNoPlayableCards",
|
|
61
|
+
action: reportNoPlayableCards
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
});
|
|
185
65
|
//#endregion
|
|
186
|
-
exports.
|
|
66
|
+
exports.createServer = createServer;
|
|
187
67
|
|
|
188
68
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["z","Manager"],"sources":["../../src/server/Server.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Manager } from \"../manager/index.js\";\nimport type { ClientState, GameEvent } from \"../manager/index.js\";\n\nexport type CreateGameResult =\n | {\n readonly success: true;\n readonly gameId: string;\n readonly playerId: string;\n }\n | {\n readonly success: false;\n readonly error: \"maxGamesReached\";\n };\n\nexport type DrawCardResult =\n | {\n readonly success: true;\n }\n | {\n readonly success: false;\n readonly error:\n | \"invalidInput\"\n | \"gameNotFound\"\n | \"playerNotFound\"\n | \"invalidStatus\"\n | \"canPlayAtNotReached\"\n | \"handFull\"\n | \"drawPileEmpty\";\n };\n\nexport type GetClientStateAndClearEventsResult =\n | {\n readonly success: true;\n readonly state: ClientState;\n }\n | {\n readonly success: false;\n readonly error: \"invalidInput\" | \"gameNotFound\" | \"playerNotFound\";\n };\n\nexport type GetEventsAndClearAcknowledgedResult =\n | {\n readonly success: true;\n readonly events: readonly GameEvent[];\n }\n | {\n readonly success: false;\n readonly error: \"invalidInput\" | \"gameNotFound\" | \"playerNotFound\";\n };\n\nexport type GetJoinableGamesResult = {\n readonly games: readonly {\n readonly id: string;\n readonly numPlayers: number;\n }[];\n};\n\nexport type JoinGameResult =\n | {\n readonly success: true;\n readonly playerId: string;\n }\n | {\n readonly success: false;\n readonly error:\n | \"invalidInput\"\n | \"gameNotFound\"\n | \"invalidStatus\"\n | \"maxPlayersReached\"\n | \"alreadyInGame\";\n };\n\nexport type LeaveGameResult =\n | {\n readonly success: true;\n }\n | {\n readonly success: false;\n readonly error: \"invalidInput\" | \"gameNotFound\" | \"playerNotFound\";\n };\n\nexport type PlayCardResult =\n | {\n readonly success: true;\n }\n | {\n readonly success: false;\n readonly error:\n | \"invalidInput\"\n | \"gameNotFound\"\n | \"playerNotFound\"\n | \"invalidStatus\"\n | \"canPlayAtNotReached\"\n | \"cardNotFound\"\n | \"cardNotPlayable\";\n };\n\nexport type ReportNoPlayableCardsResult =\n | {\n readonly success: true;\n }\n | {\n readonly success: false;\n readonly error:\n | \"invalidInput\"\n | \"gameNotFound\"\n | \"playerNotFound\"\n | \"invalidStatus\"\n | \"canPlayAtNotReached\"\n | \"alreadyReported\"\n | \"hasPlayableCard\"\n | \"canDraw\";\n };\n\nexport type SendChatResult =\n | {\n readonly success: true;\n }\n | {\n readonly success: false;\n readonly error: \"invalidInput\" | \"gameNotFound\" | \"playerNotFound\";\n };\n\nexport type StartGameResult =\n | {\n readonly success: true;\n }\n | {\n readonly success: false;\n readonly error:\n | \"invalidInput\"\n | \"gameNotFound\"\n | \"invalidStatus\"\n | \"playerNotFound\"\n | \"playerNotAdmin\"\n | \"minPlayersNotReached\";\n };\n\nconst drawCardInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\nconst getClientStateAndClearEventsInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\nconst getEventsAndClearAcknowledgedInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n lastReadId: z.string().nullable(),\n })\n .transform(\n ({ gameId, playerId, lastReadId }) =>\n [gameId, playerId, lastReadId] as const,\n );\n\nconst joinGameInputSchema = z\n .object({\n gameId: z.string(),\n })\n .transform(({ gameId }) => [gameId] as const);\n\nconst leaveGameInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\nconst playCardInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n cardId: z.string(),\n isForOtherPlayerPile: z.boolean(),\n })\n .transform(\n ({ gameId, playerId, cardId, isForOtherPlayerPile }) =>\n [gameId, playerId, cardId, isForOtherPlayerPile] as const,\n );\n\nconst reportNoPlayableCardsInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\nconst sendChatInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n text: z.string(),\n })\n .transform(({ gameId, playerId, text }) => [gameId, playerId, text] as const);\n\nconst startGameInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\nexport class Server {\n private readonly manager: Manager;\n\n readonly actions = [\n { path: \"/createGame\", action: this.createGame.bind(this) },\n { path: \"/drawCard\", action: this.drawCard.bind(this) },\n {\n path: \"/getClientStateAndClearEvents\",\n action: this.getClientStateAndClearEvents.bind(this),\n },\n {\n path: \"/getEventsAndClearAcknowledged\",\n action: this.getEventsAndClearAcknowledged.bind(this),\n },\n { path: \"/getJoinableGames\", action: this.getJoinableGames.bind(this) },\n { path: \"/joinGame\", action: this.joinGame.bind(this) },\n { path: \"/leaveGame\", action: this.leaveGame.bind(this) },\n { path: \"/playCard\", action: this.playCard.bind(this) },\n {\n path: \"/reportNoPlayableCards\",\n action: this.reportNoPlayableCards.bind(this),\n },\n { path: \"/sendChat\", action: this.sendChat.bind(this) },\n { path: \"/startGame\", action: this.startGame.bind(this) },\n ] as const;\n\n constructor(...args: ConstructorParameters<typeof Manager>) {\n this.manager = new Manager(...args);\n }\n\n private createGame(userId: string, username: string): CreateGameResult {\n return this.manager.createGame(userId, username);\n }\n\n private drawCard(input: unknown): DrawCardResult {\n const parseResult = drawCardInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.drawCard(...parseResult.data);\n }\n\n private getClientStateAndClearEvents(\n input: unknown,\n ): GetClientStateAndClearEventsResult {\n const parseResult =\n getClientStateAndClearEventsInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.getClientStateAndClearEvents(...parseResult.data);\n }\n\n private getEventsAndClearAcknowledged(\n input: unknown,\n ): GetEventsAndClearAcknowledgedResult {\n const parseResult =\n getEventsAndClearAcknowledgedInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.getEventsAndClearAcknowledged(...parseResult.data);\n }\n\n private getJoinableGames(): GetJoinableGamesResult {\n return this.manager.getJoinableGames();\n }\n\n private joinGame(\n input: unknown,\n userId: string,\n username: string,\n ): JoinGameResult {\n const parseResult = joinGameInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.joinGame(...parseResult.data, userId, username);\n }\n\n private leaveGame(input: unknown): LeaveGameResult {\n const parseResult = leaveGameInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.leaveGame(...parseResult.data);\n }\n\n private playCard(input: unknown): PlayCardResult {\n const parseResult = playCardInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.playCard(...parseResult.data);\n }\n\n private reportNoPlayableCards(input: unknown): ReportNoPlayableCardsResult {\n const parseResult = reportNoPlayableCardsInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.reportNoPlayableCards(...parseResult.data);\n }\n\n private sendChat(input: unknown): SendChatResult {\n const parseResult = sendChatInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.sendChat(...parseResult.data);\n }\n\n private startGame(input: unknown): StartGameResult {\n const parseResult = startGameInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" };\n }\n return this.manager.startGame(...parseResult.data);\n }\n}\n"],"mappings":";;;;AA2IA,MAAM,sBAAsBA,IAAAA,EACzB,OAAO;CACN,QAAQA,IAAAA,EAAE,OAAO;CACjB,UAAUA,IAAAA,EAAE,OAAO;AACrB,CAAC,CAAC,CACD,WAAW,EAAE,QAAQ,eAAe,CAAC,QAAQ,QAAQ,CAAU;AAElE,MAAM,0CAA0CA,IAAAA,EAC7C,OAAO;CACN,QAAQA,IAAAA,EAAE,OAAO;CACjB,UAAUA,IAAAA,EAAE,OAAO;AACrB,CAAC,CAAC,CACD,WAAW,EAAE,QAAQ,eAAe,CAAC,QAAQ,QAAQ,CAAU;AAElE,MAAM,2CAA2CA,IAAAA,EAC9C,OAAO;CACN,QAAQA,IAAAA,EAAE,OAAO;CACjB,UAAUA,IAAAA,EAAE,OAAO;CACnB,YAAYA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;AAClC,CAAC,CAAC,CACD,WACE,EAAE,QAAQ,UAAU,iBACnB;CAAC;CAAQ;CAAU;AAAU,CACjC;AAEF,MAAM,sBAAsBA,IAAAA,EACzB,OAAO,EACN,QAAQA,IAAAA,EAAE,OAAO,EACnB,CAAC,CAAC,CACD,WAAW,EAAE,aAAa,CAAC,MAAM,CAAU;AAE9C,MAAM,uBAAuBA,IAAAA,EAC1B,OAAO;CACN,QAAQA,IAAAA,EAAE,OAAO;CACjB,UAAUA,IAAAA,EAAE,OAAO;AACrB,CAAC,CAAC,CACD,WAAW,EAAE,QAAQ,eAAe,CAAC,QAAQ,QAAQ,CAAU;AAElE,MAAM,sBAAsBA,IAAAA,EACzB,OAAO;CACN,QAAQA,IAAAA,EAAE,OAAO;CACjB,UAAUA,IA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CAEA,UAAkB,OAAiC;EACjD,MAAM,cAAc,qBAAqB,UAAU,KAAK;EACxD,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,KAAK,QAAQ,UAAU,GAAG,YAAY,IAAI;CACnD;CAEA,SAAiB,OAAgC;EAC/C,MAAM,cAAc,oBAAoB,UAAU,KAAK;EACvD,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,KAAK,QAAQ,SAAS,GAAG,YAAY,IAAI;CAClD;CAEA,sBAA8B,OAA6C;EACzE,MAAM,cAAc,iCAAiC,UAAU,KAAK;EACpE,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,KAAK,QAAQ,sBAAsB,GAAG,YAAY,IAAI;CAC/D;CAEA,SAAiB,OAAgC;EAC/C,MAAM,cAAc,oBAAoB,UAAU,KAAK;EACvD,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,KAAK,QAAQ,SAAS,GAAG,YAAY,IAAI;CAClD;CAEA,UAAkB,OAAiC;EACjD,MAAM,cAAc,qBAAqB,UAAU,KAAK;EACxD,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,KAAK,QAAQ,UAAU,GAAG,YAAY,IAAI;CACnD;AACF"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["createServerFactory","createManager","z"],"sources":["../../src/server/createServer.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { createServerFactory } from \"@hellacardgames/lib\";\nimport { createManager } from \"../manager/index.js\";\n\nexport const createServer = createServerFactory(createManager, (manager) => {\n const drawCardInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\n function drawCard(input: unknown) {\n const parseResult = drawCardInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" } as const;\n }\n return manager.drawCard(...parseResult.data);\n }\n\n const playCardInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n cardId: z.string(),\n isForOtherPlayerPile: z.boolean(),\n })\n .transform(\n ({ gameId, playerId, cardId, isForOtherPlayerPile }) =>\n [gameId, playerId, cardId, isForOtherPlayerPile] as const,\n );\n\n function playCard(input: unknown) {\n const parseResult = playCardInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" } as const;\n }\n return manager.playCard(...parseResult.data);\n }\n\n const reportNoPlayableCardsInputSchema = z\n .object({\n gameId: z.string(),\n playerId: z.string(),\n })\n .transform(({ gameId, playerId }) => [gameId, playerId] as const);\n\n function reportNoPlayableCards(input: unknown) {\n const parseResult = reportNoPlayableCardsInputSchema.safeParse(input);\n if (!parseResult.success) {\n return { success: false, error: \"invalidInput\" } as const;\n }\n return manager.reportNoPlayableCards(...parseResult.data);\n }\n\n return [\n { path: \"/drawCard\", action: drawCard },\n { path: \"/playCard\", action: playCard },\n { path: \"/reportNoPlayableCards\", action: reportNoPlayableCards },\n ];\n});\n"],"mappings":";;;;;AAIA,MAAa,gBAAA,GAAeA,oBAAAA,oBAAAA,CAAoBC,gBAAAA,gBAAgB,YAAY;CAC1E,MAAM,sBAAsBC,IAAAA,EACzB,OAAO;EACN,QAAQA,IAAAA,EAAE,OAAO;EACjB,UAAUA,IAAAA,EAAE,OAAO;CACrB,CAAC,CAAC,CACD,WAAW,EAAE,QAAQ,eAAe,CAAC,QAAQ,QAAQ,CAAU;CAElE,SAAS,SAAS,OAAgB;EAChC,MAAM,cAAc,oBAAoB,UAAU,KAAK;EACvD,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,QAAQ,SAAS,GAAG,YAAY,IAAI;CAC7C;CAEA,MAAM,sBAAsBA,IAAAA,EACzB,OAAO;EACN,QAAQA,IAAAA,EAAE,OAAO;EACjB,UAAUA,IAAAA,EAAE,OAAO;EACnB,QAAQA,IAAAA,EAAE,OAAO;EACjB,sBAAsBA,IAAAA,EAAE,QAAQ;CAClC,CAAC,CAAC,CACD,WACE,EAAE,QAAQ,UAAU,QAAQ,2BAC3B;EAAC;EAAQ;EAAU;EAAQ;CAAoB,CACnD;CAEF,SAAS,SAAS,OAAgB;EAChC,MAAM,cAAc,oBAAoB,UAAU,KAAK;EACvD,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,QAAQ,SAAS,GAAG,YAAY,IAAI;CAC7C;CAEA,MAAM,mCAAmCA,IAAAA,EACtC,OAAO;EACN,QAAQA,IAAAA,EAAE,OAAO;EACjB,UAAUA,IAAAA,EAAE,OAAO;CACrB,CAAC,CAAC,CACD,WAAW,EAAE,QAAQ,eAAe,CAAC,QAAQ,QAAQ,CAAU;CAElE,SAAS,sBAAsB,OAAgB;EAC7C,MAAM,cAAc,iCAAiC,UAAU,KAAK;EACpE,IAAI,CAAC,YAAY,SACf,OAAO;GAAE,SAAS;GAAO,OAAO;EAAe;EAEjD,OAAO,QAAQ,sBAAsB,GAAG,YAAY,IAAI;CAC1D;CAEA,OAAO;EACL;GAAE,MAAM;GAAa,QAAQ;EAAS;EACtC;GAAE,MAAM;GAAa,QAAQ;EAAS;EACtC;GAAE,MAAM;GAA0B,QAAQ;EAAsB;CAClE;AACF,CAAC"}
|
package/dist/server/index.d.cts
CHANGED
|
@@ -1,3 +1,149 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { n as GameEvent, t as ClientState } from "../ClientState-Dx8UvhMt.cjs";
|
|
2
|
+
//#region src/server/createServer.d.ts
|
|
3
|
+
declare const createServer: (logKey: string, maxGames: number, watchdogIntervalMs: number) => {
|
|
4
|
+
readonly actions: readonly [{
|
|
5
|
+
readonly path: "/createGame";
|
|
6
|
+
readonly action: (userId: string, username: string) => {
|
|
7
|
+
readonly success: true;
|
|
8
|
+
readonly gameId: string;
|
|
9
|
+
readonly playerId: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly success: false;
|
|
12
|
+
readonly error: "maxGamesReached";
|
|
13
|
+
};
|
|
14
|
+
}, {
|
|
15
|
+
readonly path: "/getClientStateAndClearEvents";
|
|
16
|
+
readonly action: (input: unknown) => {
|
|
17
|
+
readonly success: false;
|
|
18
|
+
readonly error: "invalidInput";
|
|
19
|
+
} | {
|
|
20
|
+
readonly success: true;
|
|
21
|
+
readonly state: ClientState;
|
|
22
|
+
} | {
|
|
23
|
+
readonly success: false;
|
|
24
|
+
readonly error: "playerNotFound" | "gameNotFound";
|
|
25
|
+
};
|
|
26
|
+
}, {
|
|
27
|
+
readonly path: "/getEventsAndClearAcknowledged";
|
|
28
|
+
readonly action: (input: unknown) => {
|
|
29
|
+
readonly success: false;
|
|
30
|
+
readonly error: "invalidInput";
|
|
31
|
+
} | {
|
|
32
|
+
readonly success: true;
|
|
33
|
+
readonly events: readonly GameEvent[];
|
|
34
|
+
} | {
|
|
35
|
+
readonly success: false;
|
|
36
|
+
readonly error: "playerNotFound" | "gameNotFound";
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
readonly path: "/getJoinableGames";
|
|
40
|
+
readonly action: () => {
|
|
41
|
+
readonly games: readonly {
|
|
42
|
+
readonly id: string;
|
|
43
|
+
readonly numPlayers: number;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
46
|
+
}, {
|
|
47
|
+
readonly path: "/joinGame";
|
|
48
|
+
readonly action: (input: unknown, userId: string, username: string) => {
|
|
49
|
+
readonly success: true;
|
|
50
|
+
readonly playerId: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly success: false;
|
|
53
|
+
readonly error: "invalidInput";
|
|
54
|
+
} | {
|
|
55
|
+
readonly success: false;
|
|
56
|
+
readonly error: "maxPlayersReached" | "alreadyInGame" | "gameNotFound" | "invalidStatus";
|
|
57
|
+
};
|
|
58
|
+
}, {
|
|
59
|
+
readonly path: "/leaveGame";
|
|
60
|
+
readonly action: (input: unknown) => {
|
|
61
|
+
readonly success: true;
|
|
62
|
+
} | {
|
|
63
|
+
readonly success: false;
|
|
64
|
+
readonly error: "invalidInput";
|
|
65
|
+
} | {
|
|
66
|
+
readonly success: false;
|
|
67
|
+
readonly error: "playerNotFound" | "gameNotFound";
|
|
68
|
+
};
|
|
69
|
+
}, {
|
|
70
|
+
readonly path: "/sendChat";
|
|
71
|
+
readonly action: (input: unknown) => {
|
|
72
|
+
readonly success: true;
|
|
73
|
+
} | {
|
|
74
|
+
readonly success: false;
|
|
75
|
+
readonly error: "invalidInput";
|
|
76
|
+
} | {
|
|
77
|
+
readonly success: false;
|
|
78
|
+
readonly error: "playerNotFound" | "gameNotFound";
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
readonly path: "/startGame";
|
|
82
|
+
readonly action: (input: unknown) => {
|
|
83
|
+
readonly success: true;
|
|
84
|
+
} | {
|
|
85
|
+
readonly success: false;
|
|
86
|
+
readonly error: "invalidInput";
|
|
87
|
+
} | {
|
|
88
|
+
readonly success: false;
|
|
89
|
+
readonly error: "playerNotFound" | "playerNotAdmin" | "minPlayersNotReached" | "gameNotFound" | "invalidStatus";
|
|
90
|
+
};
|
|
91
|
+
}, {
|
|
92
|
+
readonly path: "/drawCard";
|
|
93
|
+
readonly action: (input: unknown) => {
|
|
94
|
+
readonly success: false;
|
|
95
|
+
readonly error: "gameNotFound";
|
|
96
|
+
} | {
|
|
97
|
+
readonly success: false;
|
|
98
|
+
readonly error: "invalidStatus";
|
|
99
|
+
} | {
|
|
100
|
+
readonly success: false;
|
|
101
|
+
readonly error: "playerNotFound" | "canPlayAtNotReached" | "handFull" | "drawPileEmpty";
|
|
102
|
+
} | {
|
|
103
|
+
readonly success: true;
|
|
104
|
+
readonly error?: never;
|
|
105
|
+
} | {
|
|
106
|
+
readonly success: false;
|
|
107
|
+
readonly error: "invalidInput";
|
|
108
|
+
};
|
|
109
|
+
}, {
|
|
110
|
+
readonly path: "/playCard";
|
|
111
|
+
readonly action: (input: unknown) => {
|
|
112
|
+
readonly success: false;
|
|
113
|
+
readonly error: "gameNotFound";
|
|
114
|
+
} | {
|
|
115
|
+
readonly success: false;
|
|
116
|
+
readonly error: "invalidStatus";
|
|
117
|
+
} | {
|
|
118
|
+
readonly success: false;
|
|
119
|
+
readonly error: "playerNotFound" | "canPlayAtNotReached" | "cardNotFound" | "cardNotPlayable";
|
|
120
|
+
} | {
|
|
121
|
+
readonly success: true;
|
|
122
|
+
readonly error?: never;
|
|
123
|
+
} | {
|
|
124
|
+
readonly success: false;
|
|
125
|
+
readonly error: "invalidInput";
|
|
126
|
+
};
|
|
127
|
+
}, {
|
|
128
|
+
readonly path: "/reportNoPlayableCards";
|
|
129
|
+
readonly action: (input: unknown) => {
|
|
130
|
+
readonly success: false;
|
|
131
|
+
readonly error: "gameNotFound";
|
|
132
|
+
} | {
|
|
133
|
+
readonly success: false;
|
|
134
|
+
readonly error: "invalidStatus";
|
|
135
|
+
} | {
|
|
136
|
+
readonly success: false;
|
|
137
|
+
readonly error: "playerNotFound" | "canPlayAtNotReached" | "alreadyReported" | "hasPlayableCard" | "canDraw";
|
|
138
|
+
} | {
|
|
139
|
+
readonly success: true;
|
|
140
|
+
readonly error?: never;
|
|
141
|
+
} | {
|
|
142
|
+
readonly success: false;
|
|
143
|
+
readonly error: "invalidInput";
|
|
144
|
+
};
|
|
145
|
+
}];
|
|
146
|
+
};
|
|
147
|
+
//#endregion
|
|
148
|
+
export { createServer };
|
|
149
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/server/createServer.ts"],"mappings":";;cAIa,eAAY,gBAAA,kBAAA;;;;;;;;;;;;;;;;;;sBAAZ;;;;;;;;;;;;gCAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAQc,SAAA;;;;;;;;;;;;;;;;;;aAoBA,SAAA;;;;;;;;;;;;;;;;;;aAea,SAAA"}
|