feat: implement game API with TRPC and Redis transport
- Added GameApiConfig interface and configuration resolver from environment variables. - Created GameApiContext for managing database and transport dependencies. - Implemented InMemoryTurnDaemonTransport for testing purposes. - Developed RedisTurnDaemonTransport for command and status handling via Redis streams. - Defined TurnDaemonStreamKeys for namespacing Redis streams by profile. - Established TRPC router with endpoints for health check, world state retrieval, and turn daemon commands (run, pause, resume, status). - Integrated Fastify server with TRPC and Redis transport. - Added unit tests for router functionality and stream key generation. - Configured Vitest for testing environment.
This commit is contained in:
@@ -7,10 +7,19 @@
|
||||
"build": "tsdown -c ../../tsdown.config.ts -F @sammo-ts/game-api",
|
||||
"dev": "tsdown -c ../../tsdown.config.ts -F @sammo-ts/game-api --watch",
|
||||
"lint": "node -e \"console.log('lint not configured')\"",
|
||||
"test": "node -e \"console.log('test not configured')\"",
|
||||
"test": "vitest run --config vitest.config.ts",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsdown": "^0.18.3"
|
||||
"tsdown": "^0.18.3",
|
||||
"vite-tsconfig-paths": "^6.0.0",
|
||||
"vitest": "^4.0.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fastify/cors": "^10.0.1",
|
||||
"@sammo-ts/infra": "workspace:*",
|
||||
"@trpc/server": "^11.4.4",
|
||||
"fastify": "^5.3.3",
|
||||
"zod": "^4.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user