From 1cfa64aa0fe138b71fe38dc72ebb65e8a49ff8ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 29 Dec 2025 15:04:07 +0800 Subject: [PATCH] chore: release packages (#385) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/transaction-storage-simplify.md | 48 -------------------- packages/framework/transaction/CHANGELOG.md | 49 +++++++++++++++++++++ packages/framework/transaction/package.json | 2 +- 3 files changed, 50 insertions(+), 49 deletions(-) delete mode 100644 .changeset/transaction-storage-simplify.md diff --git a/.changeset/transaction-storage-simplify.md b/.changeset/transaction-storage-simplify.md deleted file mode 100644 index aad9fee5..00000000 --- a/.changeset/transaction-storage-simplify.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -"@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):** -```typescript -// Direct client injection - NO LONGER SUPPORTED -const storage = new RedisStorage({ client: redisClient }); -const storage = new MongoStorage({ client: mongoClient, database: 'game' }); -``` - -**After (factory pattern only):** -```typescript -// 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 using` syntax (TypeScript 5.2+) for automatic resource cleanup -- **Explicit Close**: Call `storage.close()` when done, or use `await using` for automatic disposal - -### Migration Guide - -1. Replace `client` option with `factory` function -2. Add `storage.close()` call when done, or use `await using` -3. For MongoStorage, ensure factory returns a connected client diff --git a/packages/framework/transaction/CHANGELOG.md b/packages/framework/transaction/CHANGELOG.md index f405f17a..53fa5442 100644 --- a/packages/framework/transaction/CHANGELOG.md +++ b/packages/framework/transaction/CHANGELOG.md @@ -1,5 +1,54 @@ # @esengine/transaction +## 2.0.0 + +### Major Changes + +- [#384](https://github.com/esengine/esengine/pull/384) [`3b97838`](https://github.com/esengine/esengine/commit/3b978384c7d4570f9af9d139e3bfea04c6875543) Thanks [@esengine](https://github.com/esengine)! - ## 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):** + + ```typescript + // Direct client injection - NO LONGER SUPPORTED + const storage = new RedisStorage({ client: redisClient }); + const storage = new MongoStorage({ client: mongoClient, database: 'game' }); + ``` + + **After (factory pattern only):** + + ```typescript + // 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 using` syntax (TypeScript 5.2+) for automatic resource cleanup + - **Explicit Close**: Call `storage.close()` when done, or use `await using` for automatic disposal + + ### Migration Guide + 1. Replace `client` option with `factory` function + 2. Add `storage.close()` call when done, or use `await using` + 3. For MongoStorage, ensure factory returns a connected client + ## 1.1.0 ### Minor Changes diff --git a/packages/framework/transaction/package.json b/packages/framework/transaction/package.json index e3f58c9e..5c722bf6 100644 --- a/packages/framework/transaction/package.json +++ b/packages/framework/transaction/package.json @@ -1,6 +1,6 @@ { "name": "@esengine/transaction", - "version": "1.1.0", + "version": "2.0.0", "description": "Game transaction system with distributed support | 游戏事务系统,支持分布式事务", "type": "module", "main": "./dist/index.js",