## Server Testing Utils - Add TestServer, TestClient, MockRoom for unit testing - Export testing utilities from @esengine/server/testing ## Transaction Storage (BREAKING) - Simplify RedisStorage/MongoStorage to factory pattern only - Remove DI client injection option - Add lazy connection and Symbol.asyncDispose support - Add 161 unit tests with full coverage ## Pathfinding Tests - Add 150 unit tests covering all components - BinaryHeap, Heuristics, AStarPathfinder, GridMap, NavMesh, PathSmoother ## Docs - Update storage.md for new factory pattern API
1.4 KiB
1.4 KiB
@esengine/transaction
| @esengine/transaction |
|---|
| major |
Breaking Changes
Storage API Simplification
RedisStorage and MongoStorage now use factory pattern only for connection management. The direct client injection option has been removed.
Before (removed):
// Direct client injection - NO LONGER SUPPORTED
const storage = new RedisStorage({ client: redisClient });
const storage = new MongoStorage({ client: mongoClient, database: 'game' });
After (factory pattern only):
// RedisStorage
const storage = new RedisStorage({
factory: () => new Redis('redis://localhost:6379'),
prefix: 'tx:',
transactionTTL: 86400,
});
// MongoStorage
const storage = new MongoStorage({
factory: async () => {
const client = new MongoClient('mongodb://localhost:27017');
await client.connect();
return client;
},
database: 'game',
});
New Features
- Lazy Connection: Connection is established on first operation, not at construction time
- Automatic Cleanup: Support
await usingsyntax (TypeScript 5.2+) for automatic resource cleanup - Explicit Close: Call
storage.close()when done, or useawait usingfor automatic disposal
Migration Guide
- Replace
clientoption withfactoryfunction - Add
storage.close()call when done, or useawait using - For MongoStorage, ensure factory returns a connected client