@esengine/transaction 2.0.7 → 2.1.1

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.
Files changed (41) hide show
  1. package/dist/core/TransactionContext.d.ts +79 -0
  2. package/dist/core/TransactionContext.d.ts.map +1 -0
  3. package/dist/core/TransactionManager.d.ts +104 -0
  4. package/dist/core/TransactionManager.d.ts.map +1 -0
  5. package/dist/core/index.d.ts +8 -0
  6. package/dist/core/index.d.ts.map +1 -0
  7. package/dist/core/types.d.ts +393 -0
  8. package/dist/core/types.d.ts.map +1 -0
  9. package/dist/distributed/SagaOrchestrator.d.ts +173 -0
  10. package/dist/distributed/SagaOrchestrator.d.ts.map +1 -0
  11. package/dist/distributed/index.d.ts +6 -0
  12. package/dist/distributed/index.d.ts.map +1 -0
  13. package/dist/index.d.ts +56 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +1621 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/integration/RoomTransactionMixin.d.ts +108 -0
  18. package/dist/integration/RoomTransactionMixin.d.ts.map +1 -0
  19. package/dist/integration/index.d.ts +6 -0
  20. package/dist/integration/index.d.ts.map +1 -0
  21. package/dist/operations/BaseOperation.d.ts +43 -0
  22. package/dist/operations/BaseOperation.d.ts.map +1 -0
  23. package/dist/operations/CurrencyOperation.d.ts +122 -0
  24. package/dist/operations/CurrencyOperation.d.ts.map +1 -0
  25. package/dist/operations/InventoryOperation.d.ts +152 -0
  26. package/dist/operations/InventoryOperation.d.ts.map +1 -0
  27. package/dist/operations/TradeOperation.d.ts +155 -0
  28. package/dist/operations/TradeOperation.d.ts.map +1 -0
  29. package/dist/operations/index.d.ts +9 -0
  30. package/dist/operations/index.d.ts.map +1 -0
  31. package/dist/storage/MemoryStorage.d.ts +63 -0
  32. package/dist/storage/MemoryStorage.d.ts.map +1 -0
  33. package/dist/storage/MongoStorage.d.ts +118 -0
  34. package/dist/storage/MongoStorage.d.ts.map +1 -0
  35. package/dist/storage/RedisStorage.d.ts +125 -0
  36. package/dist/storage/RedisStorage.d.ts.map +1 -0
  37. package/dist/storage/index.d.ts +8 -0
  38. package/dist/storage/index.d.ts.map +1 -0
  39. package/dist/tokens.d.ts +17 -0
  40. package/dist/tokens.d.ts.map +1 -0
  41. package/package.json +2 -2
@@ -0,0 +1,152 @@
1
+ /**
2
+ * @zh 背包操作
3
+ * @en Inventory operation
4
+ */
5
+ import type { ITransactionContext, OperationResult } from '../core/types.js';
6
+ import { BaseOperation } from './BaseOperation.js';
7
+ /**
8
+ * @zh 背包操作类型
9
+ * @en Inventory operation type
10
+ */
11
+ export type InventoryOperationType = 'add' | 'remove' | 'update';
12
+ /**
13
+ * @zh 物品数据
14
+ * @en Item data
15
+ */
16
+ export interface ItemData {
17
+ /**
18
+ * @zh 物品 ID
19
+ * @en Item ID
20
+ */
21
+ itemId: string;
22
+ /**
23
+ * @zh 数量
24
+ * @en Quantity
25
+ */
26
+ quantity: number;
27
+ /**
28
+ * @zh 物品属性
29
+ * @en Item properties
30
+ */
31
+ properties?: Record<string, unknown>;
32
+ }
33
+ /**
34
+ * @zh 背包操作数据
35
+ * @en Inventory operation data
36
+ */
37
+ export interface InventoryOperationData {
38
+ /**
39
+ * @zh 操作类型
40
+ * @en Operation type
41
+ */
42
+ type: InventoryOperationType;
43
+ /**
44
+ * @zh 玩家 ID
45
+ * @en Player ID
46
+ */
47
+ playerId: string;
48
+ /**
49
+ * @zh 物品 ID
50
+ * @en Item ID
51
+ */
52
+ itemId: string;
53
+ /**
54
+ * @zh 数量
55
+ * @en Quantity
56
+ */
57
+ quantity: number;
58
+ /**
59
+ * @zh 物品属性(用于更新)
60
+ * @en Item properties (for update)
61
+ */
62
+ properties?: Record<string, unknown>;
63
+ /**
64
+ * @zh 原因/来源
65
+ * @en Reason/source
66
+ */
67
+ reason?: string;
68
+ }
69
+ /**
70
+ * @zh 背包操作结果
71
+ * @en Inventory operation result
72
+ */
73
+ export interface InventoryOperationResult {
74
+ /**
75
+ * @zh 操作前的物品数据
76
+ * @en Item data before operation
77
+ */
78
+ beforeItem?: ItemData;
79
+ /**
80
+ * @zh 操作后的物品数据
81
+ * @en Item data after operation
82
+ */
83
+ afterItem?: ItemData;
84
+ }
85
+ /**
86
+ * @zh 背包数据提供者接口
87
+ * @en Inventory data provider interface
88
+ */
89
+ export interface IInventoryProvider {
90
+ /**
91
+ * @zh 获取物品
92
+ * @en Get item
93
+ */
94
+ getItem(playerId: string, itemId: string): Promise<ItemData | null>;
95
+ /**
96
+ * @zh 设置物品
97
+ * @en Set item
98
+ */
99
+ setItem(playerId: string, itemId: string, item: ItemData | null): Promise<void>;
100
+ /**
101
+ * @zh 检查背包容量
102
+ * @en Check inventory capacity
103
+ */
104
+ hasCapacity?(playerId: string, count: number): Promise<boolean>;
105
+ }
106
+ /**
107
+ * @zh 背包操作
108
+ * @en Inventory operation
109
+ *
110
+ * @zh 用于处理物品的添加、移除和更新
111
+ * @en Used for handling item addition, removal, and update
112
+ *
113
+ * @example
114
+ * ```typescript
115
+ * // 添加物品
116
+ * tx.addOperation(new InventoryOperation({
117
+ * type: 'add',
118
+ * playerId: 'player1',
119
+ * itemId: 'sword_001',
120
+ * quantity: 1,
121
+ * }))
122
+ *
123
+ * // 移除物品
124
+ * tx.addOperation(new InventoryOperation({
125
+ * type: 'remove',
126
+ * playerId: 'player1',
127
+ * itemId: 'potion_hp',
128
+ * quantity: 5,
129
+ * }))
130
+ * ```
131
+ */
132
+ export declare class InventoryOperation extends BaseOperation<InventoryOperationData, InventoryOperationResult> {
133
+ readonly name = "inventory";
134
+ private _provider;
135
+ private _beforeItem;
136
+ /**
137
+ * @zh 设置背包数据提供者
138
+ * @en Set inventory data provider
139
+ */
140
+ setProvider(provider: IInventoryProvider): this;
141
+ validate(ctx: ITransactionContext): Promise<boolean>;
142
+ execute(ctx: ITransactionContext): Promise<OperationResult<InventoryOperationResult>>;
143
+ compensate(ctx: ITransactionContext): Promise<void>;
144
+ private _getItem;
145
+ private _setItem;
146
+ }
147
+ /**
148
+ * @zh 创建背包操作
149
+ * @en Create inventory operation
150
+ */
151
+ export declare function createInventoryOperation(data: InventoryOperationData): InventoryOperation;
152
+ //# sourceMappingURL=InventoryOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryOperation.d.ts","sourceRoot":"","sources":["../../src/operations/InventoryOperation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEhE;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC;;;OAGG;IACH,IAAI,EAAE,sBAAsB,CAAA;IAE5B;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAEpC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACrC;;;OAGG;IACH,UAAU,CAAC,EAAE,QAAQ,CAAA;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAA;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAEnE;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/E;;;OAGG;IACH,WAAW,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAClE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,sBAAsB,EAAE,wBAAwB,CAAC;IACnG,QAAQ,CAAC,IAAI,eAAe;IAE5B,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,WAAW,CAAyB;IAE5C;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI;IAKzC,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAmBpD,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC;IAkErF,UAAU,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;YAI3C,QAAQ;YAcR,QAAQ;CAgBzB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,CAEzF"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * @zh 交易操作
3
+ * @en Trade operation
4
+ */
5
+ import type { ITransactionContext, OperationResult } from '../core/types.js';
6
+ import { BaseOperation } from './BaseOperation.js';
7
+ import { type ICurrencyProvider } from './CurrencyOperation.js';
8
+ import { type IInventoryProvider } from './InventoryOperation.js';
9
+ /**
10
+ * @zh 交易物品
11
+ * @en Trade item
12
+ */
13
+ export interface TradeItem {
14
+ /**
15
+ * @zh 物品 ID
16
+ * @en Item ID
17
+ */
18
+ itemId: string;
19
+ /**
20
+ * @zh 数量
21
+ * @en Quantity
22
+ */
23
+ quantity: number;
24
+ }
25
+ /**
26
+ * @zh 交易货币
27
+ * @en Trade currency
28
+ */
29
+ export interface TradeCurrency {
30
+ /**
31
+ * @zh 货币类型
32
+ * @en Currency type
33
+ */
34
+ currency: string;
35
+ /**
36
+ * @zh 数量
37
+ * @en Amount
38
+ */
39
+ amount: number;
40
+ }
41
+ /**
42
+ * @zh 交易方数据
43
+ * @en Trade party data
44
+ */
45
+ export interface TradeParty {
46
+ /**
47
+ * @zh 玩家 ID
48
+ * @en Player ID
49
+ */
50
+ playerId: string;
51
+ /**
52
+ * @zh 给出的物品
53
+ * @en Items to give
54
+ */
55
+ items?: TradeItem[];
56
+ /**
57
+ * @zh 给出的货币
58
+ * @en Currencies to give
59
+ */
60
+ currencies?: TradeCurrency[];
61
+ }
62
+ /**
63
+ * @zh 交易操作数据
64
+ * @en Trade operation data
65
+ */
66
+ export interface TradeOperationData {
67
+ /**
68
+ * @zh 交易 ID
69
+ * @en Trade ID
70
+ */
71
+ tradeId: string;
72
+ /**
73
+ * @zh 交易发起方
74
+ * @en Trade initiator
75
+ */
76
+ partyA: TradeParty;
77
+ /**
78
+ * @zh 交易接收方
79
+ * @en Trade receiver
80
+ */
81
+ partyB: TradeParty;
82
+ /**
83
+ * @zh 原因/备注
84
+ * @en Reason/note
85
+ */
86
+ reason?: string;
87
+ }
88
+ /**
89
+ * @zh 交易操作结果
90
+ * @en Trade operation result
91
+ */
92
+ export interface TradeOperationResult {
93
+ /**
94
+ * @zh 交易 ID
95
+ * @en Trade ID
96
+ */
97
+ tradeId: string;
98
+ /**
99
+ * @zh 交易是否成功
100
+ * @en Whether trade succeeded
101
+ */
102
+ completed: boolean;
103
+ }
104
+ /**
105
+ * @zh 交易数据提供者
106
+ * @en Trade data provider
107
+ */
108
+ export interface ITradeProvider {
109
+ currencyProvider?: ICurrencyProvider;
110
+ inventoryProvider?: IInventoryProvider;
111
+ }
112
+ /**
113
+ * @zh 交易操作
114
+ * @en Trade operation
115
+ *
116
+ * @zh 用于处理玩家之间的物品和货币交换
117
+ * @en Used for handling item and currency exchange between players
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * tx.addOperation(new TradeOperation({
122
+ * tradeId: 'trade_001',
123
+ * partyA: {
124
+ * playerId: 'player1',
125
+ * items: [{ itemId: 'sword', quantity: 1 }],
126
+ * },
127
+ * partyB: {
128
+ * playerId: 'player2',
129
+ * currencies: [{ currency: 'gold', amount: 1000 }],
130
+ * },
131
+ * }))
132
+ * ```
133
+ */
134
+ export declare class TradeOperation extends BaseOperation<TradeOperationData, TradeOperationResult> {
135
+ readonly name = "trade";
136
+ private _provider;
137
+ private _subOperations;
138
+ private _executedCount;
139
+ /**
140
+ * @zh 设置交易数据提供者
141
+ * @en Set trade data provider
142
+ */
143
+ setProvider(provider: ITradeProvider): this;
144
+ validate(ctx: ITransactionContext): Promise<boolean>;
145
+ execute(ctx: ITransactionContext): Promise<OperationResult<TradeOperationResult>>;
146
+ compensate(ctx: ITransactionContext): Promise<void>;
147
+ private _buildSubOperations;
148
+ private _compensateExecuted;
149
+ }
150
+ /**
151
+ * @zh 创建交易操作
152
+ * @en Create trade operation
153
+ */
154
+ export declare function createTradeOperation(data: TradeOperationData): TradeOperation;
155
+ //# sourceMappingURL=TradeOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TradeOperation.d.ts","sourceRoot":"","sources":["../../src/operations/TradeOperation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAiD,KAAK,iBAAiB,EAAE,MAAM,wBA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,cAAc,CAAK;IAE3B;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAKrC,QAAQ,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAapD,OAAO,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;IAyBjF,UAAU,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD,OAAO,CAAC,mBAAmB;YA8Gb,mBAAmB;CAKpC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,CAE7E"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @zh 操作模块导出
3
+ * @en Operations module exports
4
+ */
5
+ export { BaseOperation } from './BaseOperation.js';
6
+ export { CurrencyOperation, createCurrencyOperation, type CurrencyOperationType, type CurrencyOperationData, type CurrencyOperationResult, type ICurrencyProvider } from './CurrencyOperation.js';
7
+ export { InventoryOperation, createInventoryOperation, type InventoryOperationType, type InventoryOperationData, type InventoryOperationResult, type IInventoryProvider, type ItemData } from './InventoryOperation.js';
8
+ export { TradeOperation, createTradeOperation, type TradeOperationData, type TradeOperationResult, type TradeItem, type TradeCurrency, type TradeParty, type ITradeProvider } from './TradeOperation.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACzB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACH,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,QAAQ,EAChB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACH,cAAc,EACd,oBAAoB,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACtB,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @zh 内存存储实现
3
+ * @en Memory storage implementation
4
+ *
5
+ * @zh 用于开发和测试环境,不支持分布式
6
+ * @en For development and testing, does not support distributed scenarios
7
+ */
8
+ import type { ITransactionStorage, TransactionLog, TransactionState, OperationLog } from '../core/types.js';
9
+ /**
10
+ * @zh 内存存储配置
11
+ * @en Memory storage configuration
12
+ */
13
+ export interface MemoryStorageConfig {
14
+ /**
15
+ * @zh 最大事务日志数量
16
+ * @en Maximum transaction log count
17
+ */
18
+ maxTransactions?: number;
19
+ }
20
+ /**
21
+ * @zh 内存存储
22
+ * @en Memory storage
23
+ *
24
+ * @zh 适用于单机开发和测试,数据仅保存在内存中
25
+ * @en Suitable for single-machine development and testing, data is stored in memory only
26
+ */
27
+ export declare class MemoryStorage implements ITransactionStorage {
28
+ private _transactions;
29
+ private _data;
30
+ private _locks;
31
+ private _maxTransactions;
32
+ constructor(config?: MemoryStorageConfig);
33
+ acquireLock(key: string, ttl: number): Promise<string | null>;
34
+ releaseLock(key: string, token: string): Promise<boolean>;
35
+ saveTransaction(tx: TransactionLog): Promise<void>;
36
+ getTransaction(id: string): Promise<TransactionLog | null>;
37
+ updateTransactionState(id: string, state: TransactionState): Promise<void>;
38
+ updateOperationState(transactionId: string, operationIndex: number, state: OperationLog['state'], error?: string): Promise<void>;
39
+ getPendingTransactions(serverId?: string): Promise<TransactionLog[]>;
40
+ deleteTransaction(id: string): Promise<void>;
41
+ get<T>(key: string): Promise<T | null>;
42
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
43
+ delete(key: string): Promise<boolean>;
44
+ /**
45
+ * @zh 清空所有数据(测试用)
46
+ * @en Clear all data (for testing)
47
+ */
48
+ clear(): void;
49
+ /**
50
+ * @zh 获取事务数量
51
+ * @en Get transaction count
52
+ */
53
+ get transactionCount(): number;
54
+ private _cleanExpiredLocks;
55
+ private _cleanExpiredData;
56
+ private _cleanOldTransactions;
57
+ }
58
+ /**
59
+ * @zh 创建内存存储
60
+ * @en Create memory storage
61
+ */
62
+ export declare function createMemoryStorage(config?: MemoryStorageConfig): MemoryStorage;
63
+ //# sourceMappingURL=MemoryStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MemoryStorage.d.ts","sourceRoot":"","sources":["../../src/storage/MemoryStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACR,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACf,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED;;;;;;GAMG;AACH,qBAAa,aAAc,YAAW,mBAAmB;IACrD,OAAO,CAAC,aAAa,CAA0C;IAC/D,OAAO,CAAC,KAAK,CAAiE;IAC9E,OAAO,CAAC,MAAM,CAA+D;IAC7E,OAAO,CAAC,gBAAgB,CAAS;gBAErB,MAAM,GAAE,mBAAwB;IAQtC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAiB7D,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAczD,eAAe,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlD,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAK1D,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1E,oBAAoB,CACtB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,EAC5B,KAAK,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAgBV,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAcpE,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IActC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ3C;;;OAGG;IACH,KAAK,IAAI,IAAI;IAMb;;;OAGG;IACH,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED,OAAO,CAAC,kBAAkB;IAS1B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,qBAAqB;CAYhC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,GAAE,mBAAwB,GAAG,aAAa,CAEnF"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * @zh MongoDB 存储实现
3
+ * @en MongoDB storage implementation
4
+ *
5
+ * @zh 基于共享连接的事务存储,使用 @esengine/database-drivers 提供的连接
6
+ * @en Transaction storage based on shared connection from @esengine/database-drivers
7
+ */
8
+ import type { IMongoConnection } from '@esengine/database-drivers';
9
+ import type { ITransactionStorage, TransactionLog, TransactionState, OperationLog } from '../core/types.js';
10
+ /**
11
+ * @zh MongoDB 存储配置
12
+ * @en MongoDB storage configuration
13
+ */
14
+ export interface MongoStorageConfig {
15
+ /**
16
+ * @zh MongoDB 连接(来自 @esengine/database-drivers)
17
+ * @en MongoDB connection (from @esengine/database-drivers)
18
+ */
19
+ connection: IMongoConnection;
20
+ /**
21
+ * @zh 事务日志集合名称
22
+ * @en Transaction log collection name
23
+ */
24
+ transactionCollection?: string;
25
+ /**
26
+ * @zh 数据集合名称
27
+ * @en Data collection name
28
+ */
29
+ dataCollection?: string;
30
+ /**
31
+ * @zh 锁集合名称
32
+ * @en Lock collection name
33
+ */
34
+ lockCollection?: string;
35
+ }
36
+ /**
37
+ * @zh MongoDB 存储
38
+ * @en MongoDB storage
39
+ *
40
+ * @zh 基于 MongoDB 的事务存储,使用 @esengine/database-drivers 的共享连接
41
+ * @en MongoDB-based transaction storage using shared connection from @esengine/database-drivers
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * import { createMongoConnection } from '@esengine/database-drivers'
46
+ * import { MongoStorage } from '@esengine/transaction'
47
+ *
48
+ * const mongo = createMongoConnection({
49
+ * uri: 'mongodb://localhost:27017',
50
+ * database: 'game'
51
+ * })
52
+ * await mongo.connect()
53
+ *
54
+ * const storage = new MongoStorage({ connection: mongo })
55
+ * ```
56
+ */
57
+ export declare class MongoStorage implements ITransactionStorage {
58
+ private readonly _connection;
59
+ private readonly _transactionCollection;
60
+ private readonly _dataCollection;
61
+ private readonly _lockCollection;
62
+ private _closed;
63
+ constructor(config: MongoStorageConfig);
64
+ /**
65
+ * @zh 获取集合
66
+ * @en Get collection
67
+ */
68
+ private _getCollection;
69
+ /**
70
+ * @zh 关闭存储
71
+ * @en Close storage
72
+ *
73
+ * @zh 不会关闭共享连接,只标记存储为已关闭
74
+ * @en Does not close shared connection, only marks storage as closed
75
+ */
76
+ close(): Promise<void>;
77
+ /**
78
+ * @zh 支持 await using 语法
79
+ * @en Support await using syntax
80
+ */
81
+ [Symbol.asyncDispose](): Promise<void>;
82
+ /**
83
+ * @zh 确保索引存在
84
+ * @en Ensure indexes exist
85
+ */
86
+ ensureIndexes(): Promise<void>;
87
+ acquireLock(key: string, ttl: number): Promise<string | null>;
88
+ releaseLock(key: string, token: string): Promise<boolean>;
89
+ saveTransaction(tx: TransactionLog): Promise<void>;
90
+ getTransaction(id: string): Promise<TransactionLog | null>;
91
+ updateTransactionState(id: string, state: TransactionState): Promise<void>;
92
+ updateOperationState(transactionId: string, operationIndex: number, state: OperationLog['state'], error?: string): Promise<void>;
93
+ getPendingTransactions(serverId?: string): Promise<TransactionLog[]>;
94
+ deleteTransaction(id: string): Promise<void>;
95
+ get<T>(key: string): Promise<T | null>;
96
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
97
+ delete(key: string): Promise<boolean>;
98
+ }
99
+ /**
100
+ * @zh 创建 MongoDB 存储
101
+ * @en Create MongoDB storage
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * import { createMongoConnection } from '@esengine/database-drivers'
106
+ * import { createMongoStorage } from '@esengine/transaction'
107
+ *
108
+ * const mongo = createMongoConnection({
109
+ * uri: 'mongodb://localhost:27017',
110
+ * database: 'game'
111
+ * })
112
+ * await mongo.connect()
113
+ *
114
+ * const storage = createMongoStorage(mongo)
115
+ * ```
116
+ */
117
+ export declare function createMongoStorage(connection: IMongoConnection, options?: Omit<MongoStorageConfig, 'connection'>): MongoStorage;
118
+ //# sourceMappingURL=MongoStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MongoStorage.d.ts","sourceRoot":"","sources":["../../src/storage/MongoStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EACR,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACf,MAAM,kBAAkB,CAAC;AAM1B;;;GAGG;AACH,MAA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Aa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,EAC5B,KAAK,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAwBV,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAepE,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IActC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB1D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAK9C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,gBAAgB,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GACjD,YAAY,CAEd"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @zh Redis 存储实现
3
+ * @en Redis storage implementation
4
+ *
5
+ * @zh 支持分布式锁和快速缓存
6
+ * @en Supports distributed locking and fast caching
7
+ */
8
+ import type { ITransactionStorage, TransactionLog, TransactionState, OperationLog } from '../core/types.js';
9
+ /**
10
+ * @zh Redis 客户端接口(兼容 ioredis)
11
+ * @en Redis client interface (compatible with ioredis)
12
+ */
13
+ export interface RedisClient {
14
+ get(key: string): Promise<string | null>;
15
+ set(key: string, value: string, ...args: string[]): Promise<string | null>;
16
+ del(...keys: string[]): Promise<number>;
17
+ eval(script: string, numkeys: number, ...args: (string | number)[]): Promise<unknown>;
18
+ hget(key: string, field: string): Promise<string | null>;
19
+ hset(key: string, ...args: (string | number)[]): Promise<number>;
20
+ hdel(key: string, ...fields: string[]): Promise<number>;
21
+ hgetall(key: string): Promise<Record<string, string>>;
22
+ keys(pattern: string): Promise<string[]>;
23
+ expire(key: string, seconds: number): Promise<number>;
24
+ quit(): Promise<string>;
25
+ }
26
+ /**
27
+ * @zh Redis 连接工厂
28
+ * @en Redis connection factory
29
+ */
30
+ export type RedisClientFactory = () => RedisClient | Promise<RedisClient>;
31
+ /**
32
+ * @zh Redis 存储配置
33
+ * @en Redis storage configuration
34
+ */
35
+ export interface RedisStorageConfig {
36
+ /**
37
+ * @zh Redis 客户端工厂(惰性连接)
38
+ * @en Redis client factory (lazy connection)
39
+ *
40
+ * @example
41
+ * ```typescript
42
+ * import Redis from 'ioredis'
43
+ * const storage = new RedisStorage({
44
+ * factory: () => new Redis('redis://localhost:6379')
45
+ * })
46
+ * ```
47
+ */
48
+ factory: RedisClientFactory;
49
+ /**
50
+ * @zh 键前缀
51
+ * @en Key prefix
52
+ */
53
+ prefix?: string;
54
+ /**
55
+ * @zh 事务日志过期时间(秒)
56
+ * @en Transaction log expiration time in seconds
57
+ */
58
+ transactionTTL?: number;
59
+ }
60
+ /**
61
+ * @zh Redis 存储
62
+ * @en Redis storage
63
+ *
64
+ * @zh 基于 Redis 的分布式事务存储,支持分布式锁和惰性连接
65
+ * @en Redis-based distributed transaction storage with distributed locking and lazy connection
66
+ *
67
+ * @example
68
+ * ```typescript
69
+ * import Redis from 'ioredis'
70
+ *
71
+ * // 创建存储(惰性连接,首次操作时才连接)
72
+ * const storage = new RedisStorage({
73
+ * factory: () => new Redis('redis://localhost:6379')
74
+ * })
75
+ *
76
+ * // 使用后手动关闭
77
+ * await storage.close()
78
+ *
79
+ * // 或使用 await using 自动关闭 (TypeScript 5.2+)
80
+ * await using storage = new RedisStorage({
81
+ * factory: () => new Redis('redis://localhost:6379')
82
+ * })
83
+ * // 作用域结束时自动关闭
84
+ * ```
85
+ */
86
+ export declare class RedisStorage implements ITransactionStorage {
87
+ private _client;
88
+ private _factory;
89
+ private _prefix;
90
+ private _transactionTTL;
91
+ private _closed;
92
+ constructor(config: RedisStorageConfig);
93
+ /**
94
+ * @zh 获取 Redis 客户端(惰性连接)
95
+ * @en Get Redis client (lazy connection)
96
+ */
97
+ private _getClient;
98
+ /**
99
+ * @zh 关闭存储连接
100
+ * @en Close storage connection
101
+ */
102
+ close(): Promise<void>;
103
+ /**
104
+ * @zh 支持 await using 语法
105
+ * @en Support await using syntax
106
+ */
107
+ [Symbol.asyncDispose](): Promise<void>;
108
+ acquireLock(key: string, ttl: number): Promise<string | null>;
109
+ releaseLock(key: string, token: string): Promise<boolean>;
110
+ saveTransaction(tx: TransactionLog): Promise<void>;
111
+ getTransaction(id: string): Promise<TransactionLog | null>;
112
+ updateTransactionState(id: string, state: TransactionState): Promise<void>;
113
+ updateOperationState(transactionId: string, operationIndex: number, state: OperationLog['state'], error?: string): Promise<void>;
114
+ getPendingTransactions(serverId?: string): Promise<TransactionLog[]>;
115
+ deleteTransaction(id: string): Promise<void>;
116
+ get<T>(key: string): Promise<T | null>;
117
+ set<T>(key: string, value: T, ttl?: number): Promise<void>;
118
+ delete(key: string): Promise<boolean>;
119
+ }
120
+ /**
121
+ * @zh 创建 Redis 存储
122
+ * @en Create Redis storage
123
+ */
124
+ export declare function createRedisStorage(config: RedisStorageConfig): RedisStorage;
125
+ //# sourceMappingURL=RedisStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RedisStorage.d.ts","sourceRoot":"","sources":["../../src/storage/RedisStorage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACR,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,YAAY,EACf,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACxC,GAAG,CAAC,GAAG,EAAE,MA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EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB5C,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAQtC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1D,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAM9C;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAE3E"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @zh 存储模块导出
3
+ * @en Storage module exports
4
+ */
5
+ export { MemoryStorage, createMemoryStorage, type MemoryStorageConfig } from './MemoryStorage.js';
6
+ export { RedisStorage, createRedisStorage, type RedisStorageConfig, type RedisClient } from './RedisStorage.js';
7
+ export { MongoStorage, createMongoStorage, type MongoStorageConfig } from './MongoStorage.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/storage/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAClG,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}