@zudojs/transactions 1.2.2 → 1.3.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.
Files changed (72) hide show
  1. package/README.md +11 -2
  2. package/dist/adapter/adapter.core.d.ts +0 -1
  3. package/dist/adapter/adapter.core.js +0 -1
  4. package/dist/adapter/index.d.ts +0 -1
  5. package/dist/adapter/index.js +0 -1
  6. package/dist/context/context.core.d.ts +15 -1
  7. package/dist/context/context.core.js +18 -1
  8. package/dist/context/context.handle.d.ts +2 -2
  9. package/dist/context/context.handle.js +4 -4
  10. package/dist/context/index.d.ts +1 -2
  11. package/dist/context/index.js +1 -2
  12. package/dist/hooks/hooks.core.d.ts +0 -1
  13. package/dist/hooks/hooks.core.js +0 -1
  14. package/dist/hooks/index.d.ts +0 -1
  15. package/dist/hooks/index.js +0 -1
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.js +0 -1
  18. package/dist/manager/index.d.ts +0 -1
  19. package/dist/manager/index.js +0 -1
  20. package/dist/manager/manager.capabilities.d.ts +0 -1
  21. package/dist/manager/manager.capabilities.js +0 -1
  22. package/dist/manager/manager.commit.d.ts +0 -1
  23. package/dist/manager/manager.commit.js +8 -4
  24. package/dist/manager/manager.core.d.ts +9 -44
  25. package/dist/manager/manager.core.js +23 -9
  26. package/dist/manager/manager.events.d.ts +0 -1
  27. package/dist/manager/manager.events.js +0 -1
  28. package/dist/manager/manager.propagation.d.ts +7 -1
  29. package/dist/manager/manager.propagation.js +3 -4
  30. package/dist/manager/manager.retry.d.ts +0 -1
  31. package/dist/manager/manager.retry.js +0 -1
  32. package/dist/registry/index.d.ts +0 -1
  33. package/dist/registry/index.js +0 -1
  34. package/dist/registry/registry.core.d.ts +0 -1
  35. package/dist/registry/registry.core.js +0 -1
  36. package/dist/transaction/index.d.ts +0 -1
  37. package/dist/transaction/index.js +0 -1
  38. package/dist/transaction/transaction.core.d.ts +4 -2
  39. package/dist/transaction/transaction.core.js +13 -8
  40. package/dist/transaction/transaction.internal.d.ts +16 -1
  41. package/dist/transaction/transaction.internal.js +2 -1
  42. package/dist/transaction/transaction.participant.d.ts +0 -1
  43. package/dist/transaction/transaction.participant.js +1 -1
  44. package/dist/transaction/transaction.savepoint.d.ts +0 -1
  45. package/dist/transaction/transaction.savepoint.js +0 -1
  46. package/dist/transaction/transactionStateMachine.d.ts +0 -1
  47. package/dist/transaction/transactionStateMachine.js +0 -1
  48. package/dist/transactionErrors/index.d.ts +0 -1
  49. package/dist/transactionErrors/index.js +0 -1
  50. package/dist/transactionErrors/transactionError.base.d.ts +0 -1
  51. package/dist/transactionErrors/transactionError.base.js +0 -1
  52. package/dist/transactionErrors/transactionError.types.d.ts +0 -1
  53. package/dist/transactionErrors/transactionError.types.js +0 -1
  54. package/dist/transactionTypes/index.d.ts +1 -1
  55. package/dist/transactionTypes/index.js +1 -1
  56. package/dist/transactionTypes/transaction.interface.d.ts +0 -1
  57. package/dist/transactionTypes/transaction.interface.js +0 -1
  58. package/dist/transactionTypes/transactionAdapter.d.ts +0 -1
  59. package/dist/transactionTypes/transactionAdapter.js +0 -1
  60. package/dist/transactionTypes/transactionHooks.d.ts +0 -1
  61. package/dist/transactionTypes/transactionHooks.js +0 -1
  62. package/dist/transactionTypes/transactionManager.d.ts +52 -0
  63. package/dist/transactionTypes/transactionManager.js +10 -0
  64. package/dist/transactionTypes/transactionState.d.ts +0 -1
  65. package/dist/transactionTypes/transactionState.js +0 -1
  66. package/dist/utils/index.d.ts +0 -1
  67. package/dist/utils/index.js +0 -1
  68. package/dist/utils/utils.helper.d.ts +0 -1
  69. package/dist/utils/utils.helper.js +0 -1
  70. package/dist/utils/utils.signal.d.ts +0 -1
  71. package/dist/utils/utils.signal.js +0 -1
  72. package/package.json +2 -2
package/README.md CHANGED
@@ -17,9 +17,9 @@ npm install @zudojs/transactions
17
17
  ## Quick Start
18
18
 
19
19
  ```typescript
20
- import { createTransactionManager } from "@zudojs/transactions";
20
+ import { createTransactionManager, type TransactionManager } from "@zudojs/transactions";
21
21
 
22
- const manager = createTransactionManager({ adapter: databaseAdapter });
22
+ const manager: TransactionManager = createTransactionManager({ adapter: databaseAdapter });
23
23
 
24
24
  // `run` opens a transaction, commits on success, rolls back on a throw.
25
25
  const orderId = await manager.run(async (transaction) => {
@@ -166,6 +166,15 @@ the transaction.
166
166
  `manager.commit()` / `manager.rollback()` releases its timer and registry entry.
167
167
  - Failures thrown by `afterCommit` callbacks never undo the commit; they are
168
168
  reported to `hooks.onError` as an `AggregateError`.
169
+ - A finished transaction is never joined. `afterCommit`/`afterRollback`
170
+ callbacks and hooks run in the scope that enclosed the transaction (the
171
+ outer transaction of a `requires_new`, otherwise none), and
172
+ `manager.getCurrent()`, `getCurrentHandle()`, `currentTransactionHandle()`
173
+ and `begin()` all read the scope through `currentTransaction()`, which
174
+ ignores a committed, rolled-back or failed transaction still held by the
175
+ context. Work started from an after-commit callback, or by a timer armed
176
+ inside the callback that fires after the commit, therefore starts a new
177
+ root transaction instead of a participant on a closed one.
169
178
  - `retry` replays only attempts that opened their own transaction. An attempt
170
179
  that joined an enclosing transaction has marked it rollback-only and is not
171
180
  replayed.
@@ -16,4 +16,3 @@ export declare function createInMemoryAdapter(): TransactionAdapter;
16
16
  * Create an adapter with custom capabilities.
17
17
  */
18
18
  export declare function createAdapter(implementation: TransactionAdapter, capabilities: TransactionAdapterCapabilities): TransactionAdapter;
19
- //# sourceMappingURL=adapter.core.d.ts.map
@@ -80,4 +80,3 @@ export function createAdapter(implementation, capabilities) {
80
80
  capabilities: Object.freeze(capabilities),
81
81
  };
82
82
  }
83
- //# sourceMappingURL=adapter.core.js.map
@@ -4,4 +4,3 @@
4
4
  * @module adapter
5
5
  */
6
6
  export { createInMemoryAdapter, createAdapter } from "./adapter.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * @module adapter
5
5
  */
6
6
  export { createInMemoryAdapter, createAdapter } from "./adapter.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * @module context/context
5
5
  */
6
+ import type { Transaction } from "../transactionTypes/transaction.interface.js";
6
7
  import type { TransactionContext } from "../transactionTypes/transactionAdapter.js";
7
8
  /**
8
9
  * Create a transaction context backed by AsyncLocalStorage.
@@ -16,4 +17,17 @@ export declare function getDefaultContext(): TransactionContext;
16
17
  * Reset the default context (useful for testing).
17
18
  */
18
19
  export declare function resetDefaultContext(): void;
19
- //# sourceMappingURL=context.core.d.ts.map
20
+ /**
21
+ * The transaction in scope for the current async execution: the context's
22
+ * stored transaction unless it has already committed, rolled back or
23
+ * failed.
24
+ *
25
+ * A store outlives the transaction it holds. Work started while the store
26
+ * is active (`afterCommit` callbacks, timers armed inside the callback,
27
+ * jobs queued from it) inherits it, and `context.get()` then hands back a
28
+ * finished transaction that a new `run()` would join as a participant and
29
+ * fail on. The manager consults this instead, so such work starts afresh.
30
+ *
31
+ * @param context - The context to read; defaults to the default context.
32
+ */
33
+ export declare function currentTransaction(context?: TransactionContext): Transaction | undefined;
@@ -4,6 +4,7 @@
4
4
  * @module context/context
5
5
  */
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
+ import { isTerminal } from "../transaction/transactionStateMachine.js";
7
8
  /**
8
9
  * Create a transaction context backed by AsyncLocalStorage.
9
10
  */
@@ -38,4 +39,20 @@ export function getDefaultContext() {
38
39
  export function resetDefaultContext() {
39
40
  defaultContext = undefined;
40
41
  }
41
- //# sourceMappingURL=context.core.js.map
42
+ /**
43
+ * The transaction in scope for the current async execution: the context's
44
+ * stored transaction unless it has already committed, rolled back or
45
+ * failed.
46
+ *
47
+ * A store outlives the transaction it holds. Work started while the store
48
+ * is active (`afterCommit` callbacks, timers armed inside the callback,
49
+ * jobs queued from it) inherits it, and `context.get()` then hands back a
50
+ * finished transaction that a new `run()` would join as a participant and
51
+ * fail on. The manager consults this instead, so such work starts afresh.
52
+ *
53
+ * @param context - The context to read; defaults to the default context.
54
+ */
55
+ export function currentTransaction(context = getDefaultContext()) {
56
+ const transaction = context.get();
57
+ return transaction && !isTerminal(transaction.state) ? transaction : undefined;
58
+ }
@@ -28,9 +28,9 @@ export declare function getTransactionHandle<THandle = unknown>(transaction: Tra
28
28
  *
29
29
  * Uses the default context unless one is supplied; pass the same context
30
30
  * the manager was created with when it was given a custom one (or call the
31
- * manager's `getCurrentHandle()`).
31
+ * manager's `getCurrentHandle()`). A finished transaction still held by
32
+ * the store yields `undefined`; see `currentTransaction`.
32
33
  *
33
34
  * @typeParam THandle - The handle type your adapter's `begin()` returns.
34
35
  */
35
36
  export declare function currentTransactionHandle<THandle = unknown>(context?: TransactionContext): THandle | undefined;
36
- //# sourceMappingURL=context.handle.d.ts.map
@@ -4,7 +4,7 @@
4
4
  * @module context/context.handle
5
5
  */
6
6
  import { connectionHandle } from "../transaction/transaction.internal.js";
7
- import { getDefaultContext } from "./context.core.js";
7
+ import { currentTransaction, getDefaultContext } from "./context.core.js";
8
8
  /**
9
9
  * The adapter handle a transaction runs on: whatever the adapter's
10
10
  * `begin()` returned (for example a database client or connection bound to
@@ -30,12 +30,12 @@ export function getTransactionHandle(transaction) {
30
30
  *
31
31
  * Uses the default context unless one is supplied; pass the same context
32
32
  * the manager was created with when it was given a custom one (or call the
33
- * manager's `getCurrentHandle()`).
33
+ * manager's `getCurrentHandle()`). A finished transaction still held by
34
+ * the store yields `undefined`; see `currentTransaction`.
34
35
  *
35
36
  * @typeParam THandle - The handle type your adapter's `begin()` returns.
36
37
  */
37
38
  export function currentTransactionHandle(context = getDefaultContext()) {
38
- const transaction = context.get();
39
+ const transaction = currentTransaction(context);
39
40
  return transaction ? getTransactionHandle(transaction) : undefined;
40
41
  }
41
- //# sourceMappingURL=context.handle.js.map
@@ -3,6 +3,5 @@
3
3
  *
4
4
  * @module context
5
5
  */
6
- export { createTransactionContext, getDefaultContext, resetDefaultContext, } from "./context.core.js";
6
+ export { createTransactionContext, currentTransaction, getDefaultContext, resetDefaultContext, } from "./context.core.js";
7
7
  export { getTransactionHandle, currentTransactionHandle, } from "./context.handle.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -3,6 +3,5 @@
3
3
  *
4
4
  * @module context
5
5
  */
6
- export { createTransactionContext, getDefaultContext, resetDefaultContext, } from "./context.core.js";
6
+ export { createTransactionContext, currentTransaction, getDefaultContext, resetDefaultContext, } from "./context.core.js";
7
7
  export { getTransactionHandle, currentTransactionHandle, } from "./context.handle.js";
8
- //# sourceMappingURL=index.js.map
@@ -8,4 +8,3 @@ import type { TransactionHooks } from "../transactionTypes/transactionHooks.js";
8
8
  * Merge multiple hook sets into one. Later hooks run after earlier ones.
9
9
  */
10
10
  export declare function mergeHooks(...hookSets: readonly TransactionHooks[]): TransactionHooks;
11
- //# sourceMappingURL=hooks.core.d.ts.map
@@ -75,4 +75,3 @@ export function mergeHooks(...hookSets) {
75
75
  }
76
76
  return merged;
77
77
  }
78
- //# sourceMappingURL=hooks.core.js.map
@@ -4,4 +4,3 @@
4
4
  * @module hooks
5
5
  */
6
6
  export { mergeHooks } from "./hooks.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * @module hooks
5
5
  */
6
6
  export { mergeHooks } from "./hooks.core.js";
7
- //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -17,4 +17,3 @@ export * from "./hooks/index.js";
17
17
  export * from "./registry/index.js";
18
18
  export * from "./utils/index.js";
19
19
  export { createTransactionManager, createEmitter, type TransactionEmitter, type TransactionManagerOptions, } from "./manager/index.js";
20
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -17,4 +17,3 @@ export * from "./hooks/index.js";
17
17
  export * from "./registry/index.js";
18
18
  export * from "./utils/index.js";
19
19
  export { createTransactionManager, createEmitter, } from "./manager/index.js";
20
- //# sourceMappingURL=index.js.map
@@ -11,4 +11,3 @@ export { assertAdapterSupports } from "./manager.capabilities.js";
11
11
  export { withRetry } from "./manager.retry.js";
12
12
  export { createEmitter } from "./manager.events.js";
13
13
  export type { TransactionEmitter } from "./manager.events.js";
14
- //# sourceMappingURL=index.d.ts.map
@@ -9,4 +9,3 @@ export { resolvePropagation, suspendsTransaction, } from "./manager.propagation.
9
9
  export { assertAdapterSupports } from "./manager.capabilities.js";
10
10
  export { withRetry } from "./manager.retry.js";
11
11
  export { createEmitter } from "./manager.events.js";
12
- //# sourceMappingURL=index.js.map
@@ -23,4 +23,3 @@ import type { TransactionAdapter } from "../transactionTypes/transactionAdapter.
23
23
  * @throws {TransactionCapabilityError} when another capability is missing.
24
24
  */
25
25
  export declare function assertAdapterSupports(adapter: TransactionAdapter, options: TransactionOptions | undefined): void;
26
- //# sourceMappingURL=manager.capabilities.d.ts.map
@@ -38,4 +38,3 @@ export function assertAdapterSupports(adapter, options) {
38
38
  throw new TransactionCapabilityError("transaction timeouts");
39
39
  }
40
40
  }
41
- //# sourceMappingURL=manager.capabilities.js.map
@@ -39,4 +39,3 @@ export declare function commitTransaction(transaction: Transaction, adapter: Tra
39
39
  * @throws {TransactionRollbackError} when the adapter refuses the rollback.
40
40
  */
41
41
  export declare function rollbackTransaction(transaction: Transaction, adapter: TransactionAdapter, reason?: unknown, hooks?: TransactionHooks, emit?: TransactionEmitter): Promise<void>;
42
- //# sourceMappingURL=manager.commit.d.ts.map
@@ -126,7 +126,10 @@ export async function commitTransaction(transaction, adapter, hooks, emit = noop
126
126
  });
127
127
  }
128
128
  if (hooks?.afterCommit && transaction.kind !== "savepoint") {
129
- await hooks.afterCommit({ transaction });
129
+ // Detached: the transaction is finished, so work the hook starts must
130
+ // not inherit its context (see TransactionInternals._detach).
131
+ const afterCommit = hooks.afterCommit;
132
+ await internals(transaction)._detach(() => afterCommit({ transaction }));
130
133
  }
131
134
  }
132
135
  /**
@@ -171,7 +174,8 @@ export async function rollbackTransaction(transaction, adapter, reason, hooks, e
171
174
  });
172
175
  }
173
176
  emit(TRANSACTION_EVENTS.ROLLED_BACK, transaction, reason);
174
- if (hooks?.afterRollback)
175
- await hooks.afterRollback({ transaction });
177
+ if (hooks?.afterRollback) {
178
+ const afterRollback = hooks.afterRollback;
179
+ await internals(transaction)._detach(() => afterRollback({ transaction }));
180
+ }
176
181
  }
177
- //# sourceMappingURL=manager.commit.js.map
@@ -3,9 +3,9 @@
3
3
  *
4
4
  * @module manager/manager
5
5
  */
6
- import type { Transaction, TransactionOptions } from "../transactionTypes/transaction.interface.js";
7
6
  import type { TransactionAdapter, TransactionContext } from "../transactionTypes/transactionAdapter.js";
8
7
  import type { TransactionEventHandler, TransactionHooks, TransactionRegistry } from "../transactionTypes/transactionHooks.js";
8
+ import type { TransactionManager } from "../transactionTypes/transactionManager.js";
9
9
  /** Options for creating a transaction manager. */
10
10
  export interface TransactionManagerOptions {
11
11
  readonly adapter: TransactionAdapter;
@@ -23,47 +23,12 @@ export interface TransactionManagerOptions {
23
23
  }
24
24
  /**
25
25
  * Create a transaction manager.
26
+ *
27
+ * The manager reads the transaction in scope through `currentTransaction`,
28
+ * so a transaction that has finished but whose context is still active
29
+ * (inside an `afterCommit` callback, or in a timer armed during the
30
+ * transaction) is never joined; a new `run()` there opens a fresh
31
+ * transaction. After-commit and after-rollback callbacks and hooks run in
32
+ * the scope that enclosed the transaction, not inside its context.
26
33
  */
27
- export declare function createTransactionManager(options: TransactionManagerOptions): {
28
- /**
29
- * Begin a transaction, applying the requested propagation mode.
30
- *
31
- * With the default `required` propagation inside an existing transaction
32
- * this returns a participant: a handle that observes the enclosing
33
- * transaction but never commits it.
34
- */
35
- begin(opts?: TransactionOptions): Promise<Transaction>;
36
- /**
37
- * Run a callback inside a transaction, committing or rolling back around it.
38
- *
39
- * Only a transaction this call opened is completed here: joining an
40
- * enclosing transaction must not commit it, and a failure inside a
41
- * participant marks the enclosing transaction rollback-only instead.
42
- *
43
- * When the transaction times out, `transaction.signal` aborts and this
44
- * stops waiting for the callback: the transaction is rolled back and
45
- * the call rejects with `TransactionTimeoutError`. An error raised
46
- * after a successful commit (for example by an `afterCommit` hook) is
47
- * rethrown without attempting a rollback.
48
- */
49
- run<T>(callback: (transaction: Transaction) => Promise<T>, opts?: TransactionOptions): Promise<T>;
50
- /**
51
- * Commit a transaction. Participants and committed transactions are no-ops.
52
- *
53
- * Completing a transaction opened with `begin()` also releases its
54
- * timeout timer and registry entry; both used to be released only by
55
- * `run()`, so hand-managed transactions stayed in the registry forever.
56
- */
57
- commit(transaction: Transaction): Promise<void>;
58
- /** Roll back a transaction, or mark the joined transaction rollback-only. */
59
- rollback(transaction: Transaction, reason?: unknown): Promise<void>;
60
- /** The transaction in scope for the current async execution, if any. */
61
- getCurrent(): Transaction | undefined;
62
- /**
63
- * The adapter handle (what `adapter.begin()` returned) of the
64
- * transaction in scope for the current async execution, or `undefined`
65
- * outside a transaction. See `getTransactionHandle`.
66
- */
67
- getCurrentHandle<THandle = unknown>(): THandle | undefined;
68
- };
69
- //# sourceMappingURL=manager.core.d.ts.map
34
+ export declare function createTransactionManager(options: TransactionManagerOptions): TransactionManager;
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * @module manager/manager
5
5
  */
6
- import { getDefaultContext } from "../context/context.core.js";
7
- import { internals } from "../transaction/transaction.internal.js";
6
+ import { currentTransaction, getDefaultContext, } from "../context/context.core.js";
7
+ import { internals, } from "../transaction/transaction.internal.js";
8
8
  import { isTerminal } from "../transaction/transactionStateMachine.js";
9
9
  import { TransactionRollbackError } from "../transactionErrors/transactionError.types.js";
10
10
  import { getTransactionHandle } from "../context/context.handle.js";
@@ -19,6 +19,13 @@ function isFinished(transaction) {
19
19
  }
20
20
  /**
21
21
  * Create a transaction manager.
22
+ *
23
+ * The manager reads the transaction in scope through `currentTransaction`,
24
+ * so a transaction that has finished but whose context is still active
25
+ * (inside an `afterCommit` callback, or in a timer armed during the
26
+ * transaction) is never joined; a new `run()` there opens a fresh
27
+ * transaction. After-commit and after-rollback callbacks and hooks run in
28
+ * the scope that enclosed the transaction, not inside its context.
22
29
  */
23
30
  export function createTransactionManager(options) {
24
31
  const { adapter, hooks, registry } = options;
@@ -70,15 +77,20 @@ export function createTransactionManager(options) {
70
77
  */
71
78
  async begin(opts) {
72
79
  const propagation = opts?.propagation ?? "required";
73
- const current = suspendsTransaction(propagation)
74
- ? undefined
75
- : context.get();
80
+ const enclosing = currentTransaction(context);
81
+ const current = suspendsTransaction(propagation) ? undefined : enclosing;
82
+ // Post-completion work returns to whatever enclosed this transaction:
83
+ // the outer transaction of a `requires_new`, or no transaction at all.
84
+ const detach = enclosing
85
+ ? (work) => context.run(enclosing, work)
86
+ : (work) => context.exit(work);
76
87
  const transaction = await resolvePropagation(propagation, {
77
88
  current,
78
89
  opts,
79
90
  adapter,
80
91
  hooks,
81
92
  emit,
93
+ detach,
82
94
  });
83
95
  if (owns(transaction)) {
84
96
  registry?.register(transaction);
@@ -172,9 +184,12 @@ export function createTransactionManager(options) {
172
184
  release(transaction);
173
185
  }
174
186
  },
175
- /** The transaction in scope for the current async execution, if any. */
187
+ /**
188
+ * The transaction in scope for the current async execution, if any. A
189
+ * finished transaction still held by the context is not in scope.
190
+ */
176
191
  getCurrent() {
177
- return context.get();
192
+ return currentTransaction(context);
178
193
  },
179
194
  /**
180
195
  * The adapter handle (what `adapter.begin()` returned) of the
@@ -182,9 +197,8 @@ export function createTransactionManager(options) {
182
197
  * outside a transaction. See `getTransactionHandle`.
183
198
  */
184
199
  getCurrentHandle() {
185
- const current = context.get();
200
+ const current = currentTransaction(context);
186
201
  return current ? getTransactionHandle(current) : undefined;
187
202
  },
188
203
  };
189
204
  }
190
- //# sourceMappingURL=manager.core.js.map
@@ -28,4 +28,3 @@ export declare const noopEmitter: TransactionEmitter;
28
28
  */
29
29
  export declare function createEmitter(handler: TransactionEventHandler | undefined): TransactionEmitter;
30
30
  export { TRANSACTION_EVENTS };
31
- //# sourceMappingURL=manager.events.d.ts.map
@@ -42,4 +42,3 @@ export function createEmitter(handler) {
42
42
  };
43
43
  }
44
44
  export { TRANSACTION_EVENTS };
45
- //# sourceMappingURL=manager.events.js.map
@@ -11,6 +11,7 @@ import type { Transaction, TransactionOptions } from "../transactionTypes/transa
11
11
  import type { TransactionAdapter } from "../transactionTypes/transactionAdapter.js";
12
12
  import type { TransactionHooks } from "../transactionTypes/transactionHooks.js";
13
13
  import type { TransactionPropagation } from "../transactionTypes/transactionState.js";
14
+ import { type TransactionDetach } from "../transaction/transaction.internal.js";
14
15
  import type { TransactionEmitter } from "./manager.events.js";
15
16
  /** Everything a propagation branch may need. */
16
17
  export interface PropagationContext {
@@ -20,6 +21,12 @@ export interface PropagationContext {
20
21
  readonly hooks: TransactionHooks | undefined;
21
22
  /** Lifecycle event emitter. Defaults to discarding events. */
22
23
  readonly emit?: TransactionEmitter;
24
+ /**
25
+ * Runs after-commit / after-rollback work in the scope that enclosed the
26
+ * new transaction, so it does not inherit the finished transaction's
27
+ * context. Defaults to running the work in place.
28
+ */
29
+ readonly detach?: TransactionDetach;
23
30
  }
24
31
  /**
25
32
  * Open a root transaction against the adapter and make it active.
@@ -40,4 +47,3 @@ export declare function beginRoot(context: PropagationContext, parentId?: string
40
47
  export declare function resolvePropagation(propagation: TransactionPropagation, context: PropagationContext): Promise<Transaction>;
41
48
  /** Whether a propagation mode runs its body outside any transaction. */
42
49
  export declare function suspendsTransaction(propagation: TransactionPropagation): boolean;
43
- //# sourceMappingURL=manager.propagation.d.ts.map
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { createTransaction } from "../transaction/transaction.core.js";
11
11
  import { createNonTransactional, createParticipant, } from "../transaction/transaction.participant.js";
12
- import { connectionHandle, internals, } from "../transaction/transaction.internal.js";
12
+ import { connectionHandle, internals, runInPlace, } from "../transaction/transaction.internal.js";
13
13
  import { SavepointError, TransactionCapabilityError, TransactionPropagationError, } from "../transactionErrors/transactionError.types.js";
14
14
  import { assertAdapterSupports } from "./manager.capabilities.js";
15
15
  import { noopEmitter, TRANSACTION_EVENTS } from "./manager.events.js";
@@ -24,7 +24,7 @@ export async function beginRoot(context, parentId) {
24
24
  const { adapter, hooks, opts } = context;
25
25
  const emit = context.emit ?? noopEmitter;
26
26
  assertAdapterSupports(adapter, opts);
27
- const transaction = createTransaction(opts, parentId, "root");
27
+ const transaction = createTransaction(opts, parentId, "root", undefined, context.detach ?? runInPlace);
28
28
  if (hooks?.beforeBegin)
29
29
  await hooks.beforeBegin({ transaction });
30
30
  try {
@@ -56,7 +56,7 @@ async function beginSavepoint(parent, context) {
56
56
  // rule violation, and TransactionCapabilityError names what is missing.
57
57
  throw new TransactionCapabilityError("savepoints, required by nested transactions");
58
58
  }
59
- const child = createTransaction(opts, parent.id, "savepoint", parent);
59
+ const child = createTransaction(opts, parent.id, "savepoint", parent, context.detach ?? runInPlace);
60
60
  if (hooks?.beforeBegin)
61
61
  await hooks.beforeBegin({ transaction: child });
62
62
  const savepoint = `sp_${child.id}`;
@@ -119,4 +119,3 @@ export async function resolvePropagation(propagation, context) {
119
119
  export function suspendsTransaction(propagation) {
120
120
  return propagation === "not_supported" || propagation === "requires_new";
121
121
  }
122
- //# sourceMappingURL=manager.propagation.js.map
@@ -17,4 +17,3 @@ import type { TransactionRetryOptions } from "../transactionTypes/transaction.in
17
17
  * @throws The last error when every attempt fails.
18
18
  */
19
19
  export declare function withRetry<T>(options: TransactionRetryOptions | undefined, operation: (attempt: number) => Promise<T>): Promise<T>;
20
- //# sourceMappingURL=manager.retry.d.ts.map
@@ -43,4 +43,3 @@ export async function withRetry(options, operation) {
43
43
  }
44
44
  throw lastError;
45
45
  }
46
- //# sourceMappingURL=manager.retry.js.map
@@ -4,4 +4,3 @@
4
4
  * @module registry
5
5
  */
6
6
  export { createTransactionRegistry } from "./registry.core.js";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * @module registry
5
5
  */
6
6
  export { createTransactionRegistry } from "./registry.core.js";
7
- //# sourceMappingURL=index.js.map
@@ -8,4 +8,3 @@ import type { TransactionRegistry } from "../transactionTypes/transactionHooks.j
8
8
  * Create an in-memory transaction registry.
9
9
  */
10
10
  export declare function createTransactionRegistry(): TransactionRegistry;
11
- //# sourceMappingURL=registry.core.d.ts.map
@@ -23,4 +23,3 @@ export function createTransactionRegistry() {
23
23
  },
24
24
  };
25
25
  }
26
- //# sourceMappingURL=registry.core.js.map
@@ -6,4 +6,3 @@ export { createNonTransactional, createParticipant, } from "./transaction.partic
6
6
  export { canTransition, createTransitionFunction, isTerminal, } from "./transactionStateMachine.js";
7
7
  export { asSavepointHandle } from "./transaction.internal.js";
8
8
  export type { SavepointHandle } from "./transaction.internal.js";
9
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@ export { createTransaction } from "./transaction.core.js";
5
5
  export { createNonTransactional, createParticipant, } from "./transaction.participant.js";
6
6
  export { canTransition, createTransitionFunction, isTerminal, } from "./transactionStateMachine.js";
7
7
  export { asSavepointHandle } from "./transaction.internal.js";
8
- //# sourceMappingURL=index.js.map
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import type { Transaction, TransactionOptions } from "../transactionTypes/transaction.interface.js";
5
5
  import type { TransactionKind } from "../transactionTypes/transactionState.js";
6
+ import { type TransactionDetach } from "./transaction.internal.js";
6
7
  /**
7
8
  * Create a new Transaction instance.
8
9
  *
@@ -11,6 +12,7 @@ import type { TransactionKind } from "../transactionTypes/transactionState.js";
11
12
  * @param kind - How this handle relates to the adapter transaction.
12
13
  * @param parent - The enclosing transaction of a savepoint. Its callbacks
13
14
  * are deferred to `parent` on release instead of running.
15
+ * @param detach - Runs after-commit / after-rollback work in the scope
16
+ * that enclosed the transaction. Defaults to running it in place.
14
17
  */
15
- export declare function createTransaction(options?: TransactionOptions, parentId?: string, kind?: TransactionKind, parent?: Transaction): Transaction;
16
- //# sourceMappingURL=transaction.core.d.ts.map
18
+ export declare function createTransaction(options?: TransactionOptions, parentId?: string, kind?: TransactionKind, parent?: Transaction, detach?: TransactionDetach): Transaction;
@@ -4,7 +4,7 @@
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { TransactionRollbackError, TransactionRollbackOnlyError, TransactionStateError, TransactionTimeoutError, } from "../transactionErrors/transactionError.types.js";
6
6
  import { canTransition, createTransitionFunction, } from "./transactionStateMachine.js";
7
- import { attachInternals } from "./transaction.internal.js";
7
+ import { attachInternals, runInPlace, } from "./transaction.internal.js";
8
8
  import { deferCallbacksToParent } from "./transaction.savepoint.js";
9
9
  /**
10
10
  * Generate a unique transaction ID.
@@ -12,12 +12,15 @@ import { deferCallbacksToParent } from "./transaction.savepoint.js";
12
12
  function generateTransactionId() {
13
13
  return `txn_${randomBytes(16).toString("hex")}`;
14
14
  }
15
- /** Runs callbacks in order, collecting failures rather than aborting. */
16
- async function runCallbacks(callbacks) {
15
+ /**
16
+ * Runs callbacks in order, collecting failures rather than aborting. Each
17
+ * runs detached from the finished transaction's context.
18
+ */
19
+ async function runCallbacks(callbacks, detach) {
17
20
  const errors = [];
18
21
  for (const callback of callbacks.splice(0)) {
19
22
  try {
20
- await callback();
23
+ await detach(callback);
21
24
  }
22
25
  catch (error) {
23
26
  errors.push(error);
@@ -33,8 +36,10 @@ async function runCallbacks(callbacks) {
33
36
  * @param kind - How this handle relates to the adapter transaction.
34
37
  * @param parent - The enclosing transaction of a savepoint. Its callbacks
35
38
  * are deferred to `parent` on release instead of running.
39
+ * @param detach - Runs after-commit / after-rollback work in the scope
40
+ * that enclosed the transaction. Defaults to running it in place.
36
41
  */
37
- export function createTransaction(options = {}, parentId, kind = "root", parent) {
42
+ export function createTransaction(options = {}, parentId, kind = "root", parent, detach = runInPlace) {
38
43
  let state = "pending";
39
44
  let rollbackOnly = false;
40
45
  let rollbackOnlyReason;
@@ -106,7 +111,7 @@ export function createTransaction(options = {}, parentId, kind = "root", parent)
106
111
  afterRollbackCallbacks.length = 0;
107
112
  // The commit stands whatever the callbacks do; their failures are
108
113
  // kept for the manager to report instead of being dropped.
109
- callbackErrors = await runCallbacks(afterCommitCallbacks);
114
+ callbackErrors = await runCallbacks(afterCommitCallbacks, detach);
110
115
  },
111
116
  async rollback(reason) {
112
117
  if (state === "rolled_back" || state === "failed")
@@ -120,7 +125,7 @@ export function createTransaction(options = {}, parentId, kind = "root", parent)
120
125
  transition("rolling_back");
121
126
  transition("rolled_back");
122
127
  afterCommitCallbacks.length = 0;
123
- const errors = await runCallbacks(afterRollbackCallbacks);
128
+ const errors = await runCallbacks(afterRollbackCallbacks, detach);
124
129
  if (errors.length > 0) {
125
130
  throw new TransactionRollbackError(id, {
126
131
  cause: new AggregateError(errors, "after-rollback callback failures"),
@@ -154,6 +159,6 @@ export function createTransaction(options = {}, parentId, kind = "root", parent)
154
159
  },
155
160
  _getRollbackOnlyReason: () => rollbackOnlyReason,
156
161
  _drainCallbackErrors: () => callbackErrors.splice(0),
162
+ _detach: detach,
157
163
  });
158
164
  }
159
- //# sourceMappingURL=transaction.core.js.map
@@ -39,7 +39,23 @@ export interface TransactionInternals {
39
39
  * trace. The manager drains them and reports them to `hooks.onError`.
40
40
  */
41
41
  _drainCallbackErrors(): unknown[];
42
+ /**
43
+ * Run work in the scope that enclosed this transaction, rather than in
44
+ * the transaction's own context.
45
+ *
46
+ * After-commit and after-rollback callbacks and hooks run once the
47
+ * transaction has finished, yet they used to run with its context still
48
+ * active, so anything they started (a timer, a queued job) inherited a
49
+ * finished transaction and joined it. The manager supplies this from the
50
+ * context the transaction was begun in; a transaction created without a
51
+ * manager runs the work in place.
52
+ */
53
+ _detach<T>(work: () => Promise<T>): Promise<T>;
42
54
  }
55
+ /** Runs post-completion work in the scope enclosing a transaction. */
56
+ export type TransactionDetach = <T>(work: () => Promise<T>) => Promise<T>;
57
+ /** The detach used when no manager supplied one: run the work in place. */
58
+ export declare const runInPlace: TransactionDetach;
43
59
  /**
44
60
  * Access the manager-only surface of a transaction.
45
61
  *
@@ -82,4 +98,3 @@ export declare function connectionHandle(transaction: Transaction): unknown;
82
98
  * @returns The savepoint handle, or undefined when it is a plain handle.
83
99
  */
84
100
  export declare function asSavepointHandle(handle: unknown): SavepointHandle | undefined;
85
- //# sourceMappingURL=transaction.internal.d.ts.map
@@ -17,6 +17,8 @@
17
17
  * steal the adapter handle.
18
18
  */
19
19
  export const TRANSACTION_INTERNALS = Symbol("zudojs.transaction.internals");
20
+ /** The detach used when no manager supplied one: run the work in place. */
21
+ export const runInPlace = (work) => work();
20
22
  /**
21
23
  * Access the manager-only surface of a transaction.
22
24
  *
@@ -79,4 +81,3 @@ export function asSavepointHandle(handle) {
79
81
  }
80
82
  return undefined;
81
83
  }
82
- //# sourceMappingURL=transaction.internal.js.map
@@ -28,4 +28,3 @@ export declare function createParticipant(parent: Transaction): Transaction;
28
28
  * @returns A transaction handle bound to no adapter transaction.
29
29
  */
30
30
  export declare function createNonTransactional(options?: TransactionOptions): Transaction;
31
- //# sourceMappingURL=transaction.participant.d.ts.map
@@ -81,6 +81,7 @@ export function createParticipant(parent) {
81
81
  _markTimedOut: refuse,
82
82
  _getRollbackOnlyReason: () => internals(parent)._getRollbackOnlyReason(),
83
83
  _drainCallbackErrors: () => [],
84
+ _detach: (work) => internals(parent)._detach(work),
84
85
  });
85
86
  return Object.freeze(participant);
86
87
  }
@@ -99,4 +100,3 @@ export function createNonTransactional(options = {}) {
99
100
  internals(txn)._transition("active");
100
101
  return txn;
101
102
  }
102
- //# sourceMappingURL=transaction.participant.js.map
@@ -21,4 +21,3 @@ import type { Transaction } from "../transactionTypes/transaction.interface.js";
21
21
  * @param afterRollback - The savepoint's pending after-rollback callbacks.
22
22
  */
23
23
  export declare function deferCallbacksToParent(parent: Transaction, afterCommit: Array<() => Promise<void>>, afterRollback: Array<() => Promise<void>>): void;
24
- //# sourceMappingURL=transaction.savepoint.d.ts.map
@@ -26,4 +26,3 @@ export function deferCallbacksToParent(parent, afterCommit, afterRollback) {
26
26
  parent.afterRollback(callback);
27
27
  }
28
28
  }
29
- //# sourceMappingURL=transaction.savepoint.js.map
@@ -16,4 +16,3 @@ export declare function createTransitionFunction(getState: () => TransactionStat
16
16
  export declare function canTransition(from: TransactionState, to: TransactionState): boolean;
17
17
  /** Whether a state admits no further transitions. */
18
18
  export declare function isTerminal(state: TransactionState): boolean;
19
- //# sourceMappingURL=transactionStateMachine.d.ts.map
@@ -38,4 +38,3 @@ export function canTransition(from, to) {
38
38
  export function isTerminal(state) {
39
39
  return (VALID_TRANSITIONS[state]?.length ?? 0) === 0;
40
40
  }
41
- //# sourceMappingURL=transactionStateMachine.js.map
@@ -3,4 +3,3 @@
3
3
  */
4
4
  export { TransactionError, type TransactionErrorOptions, } from "./transactionError.base.js";
5
5
  export { TransactionStateError, TransactionTimeoutError, TransactionCommitError, TransactionRollbackError, TransactionRollbackOnlyError, TransactionAdapterError, TransactionPropagationError, TransactionIsolationError, SavepointError, TransactionRequiredError, TransactionUnexpectedError, TransactionCapabilityError, } from "./transactionError.types.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -3,4 +3,3 @@
3
3
  */
4
4
  export { TransactionError, } from "./transactionError.base.js";
5
5
  export { TransactionStateError, TransactionTimeoutError, TransactionCommitError, TransactionRollbackError, TransactionRollbackOnlyError, TransactionAdapterError, TransactionPropagationError, TransactionIsolationError, SavepointError, TransactionRequiredError, TransactionUnexpectedError, TransactionCapabilityError, } from "./transactionError.types.js";
6
- //# sourceMappingURL=index.js.map
@@ -6,4 +6,3 @@
6
6
  * it from. Name, constructor, `code` defaults and category are unchanged.
7
7
  */
8
8
  export { TransactionError, type TransactionErrorOptions } from "@zudojs/errors";
9
- //# sourceMappingURL=transactionError.base.d.ts.map
@@ -6,4 +6,3 @@
6
6
  * it from. Name, constructor, `code` defaults and category are unchanged.
7
7
  */
8
8
  export { TransactionError } from "@zudojs/errors";
9
- //# sourceMappingURL=transactionError.base.js.map
@@ -6,4 +6,3 @@
6
6
  * across both import paths.
7
7
  */
8
8
  export { TransactionStateError, TransactionTimeoutError, TransactionCommitError, TransactionRollbackError, TransactionRollbackOnlyError, TransactionAdapterError, TransactionPropagationError, TransactionIsolationError, SavepointError, TransactionRequiredError, TransactionUnexpectedError, TransactionCapabilityError, } from "@zudojs/errors";
9
- //# sourceMappingURL=transactionError.types.d.ts.map
@@ -6,4 +6,3 @@
6
6
  * across both import paths.
7
7
  */
8
8
  export { TransactionStateError, TransactionTimeoutError, TransactionCommitError, TransactionRollbackError, TransactionRollbackOnlyError, TransactionAdapterError, TransactionPropagationError, TransactionIsolationError, SavepointError, TransactionRequiredError, TransactionUnexpectedError, TransactionCapabilityError, } from "@zudojs/errors";
9
- //# sourceMappingURL=transactionError.types.js.map
@@ -6,5 +6,5 @@
6
6
  export { type TransactionState, type TransactionKind, type TransactionPropagation, type TransactionIsolationLevel, } from "./transactionState.js";
7
7
  export { type Transaction, type TransactionOptions, type TransactionRetryOptions, type TransactionRetryPredicate, } from "./transaction.interface.js";
8
8
  export { type TransactionHandle, type TransactionAdapterCapabilities, type TransactionAdapter, type TransactionContext, } from "./transactionAdapter.js";
9
+ export { type TransactionManager } from "./transactionManager.js";
9
10
  export { type TransactionHookContext, type TransactionErrorContext, type TransactionHooks, type TransactionRegistry, TRANSACTION_EVENTS, type TransactionEvent, type TransactionEventHandler, } from "./transactionHooks.js";
10
- //# sourceMappingURL=index.d.ts.map
@@ -6,5 +6,5 @@
6
6
  export {} from "./transactionState.js";
7
7
  export {} from "./transaction.interface.js";
8
8
  export {} from "./transactionAdapter.js";
9
+ export {} from "./transactionManager.js";
9
10
  export { TRANSACTION_EVENTS, } from "./transactionHooks.js";
10
- //# sourceMappingURL=index.js.map
@@ -91,4 +91,3 @@ export interface Transaction {
91
91
  /** Register a callback to run after rollback. */
92
92
  afterRollback(callback: () => Promise<void>): void;
93
93
  }
94
- //# sourceMappingURL=transaction.interface.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * @module transactionTypes/transaction
5
5
  */
6
6
  export {};
7
- //# sourceMappingURL=transaction.interface.js.map
@@ -51,4 +51,3 @@ export interface TransactionContext {
51
51
  */
52
52
  exit<T>(callback: () => Promise<T>): Promise<T>;
53
53
  }
54
- //# sourceMappingURL=transactionAdapter.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * @module transactionTypes/transactionAdapter
5
5
  */
6
6
  export {};
7
- //# sourceMappingURL=transactionAdapter.js.map
@@ -53,4 +53,3 @@ export interface TransactionEvent {
53
53
  }
54
54
  /** Handler for transaction events. */
55
55
  export type TransactionEventHandler = (event: TransactionEvent) => void;
56
- //# sourceMappingURL=transactionHooks.d.ts.map
@@ -14,4 +14,3 @@ export const TRANSACTION_EVENTS = {
14
14
  FAILED: "transaction.failed",
15
15
  TIMED_OUT: "transaction.timed_out",
16
16
  };
17
- //# sourceMappingURL=transactionHooks.js.map
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The transaction manager contract.
3
+ *
4
+ * `createTransactionManager` returned an anonymous object type, so a
5
+ * consumer that wanted to hold, inject or mock a manager had to write
6
+ * `ReturnType<typeof createTransactionManager>`. This is that type, named.
7
+ *
8
+ * @module transactionTypes/transactionManager
9
+ */
10
+ import type { Transaction, TransactionOptions } from "./transaction.interface.js";
11
+ /**
12
+ * Coordinates begin, commit, rollback and context propagation for
13
+ * transactions opened against one adapter.
14
+ */
15
+ export interface TransactionManager {
16
+ /**
17
+ * Begin a transaction, applying the requested propagation mode.
18
+ *
19
+ * With the default `required` propagation inside an existing transaction
20
+ * this returns a participant: a handle that observes the enclosing
21
+ * transaction but never commits it. A transaction opened here must be
22
+ * completed with `commit()` or `rollback()`.
23
+ */
24
+ begin(options?: TransactionOptions): Promise<Transaction>;
25
+ /**
26
+ * Run a callback inside a transaction, committing or rolling back around
27
+ * it. Only a transaction this call opened is completed here; a failure
28
+ * inside a participant marks the enclosing transaction rollback-only.
29
+ */
30
+ run<T>(callback: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
31
+ /**
32
+ * Commit a transaction. Participants and committed transactions are
33
+ * no-ops; a rollback-only transaction is rolled back and the call
34
+ * rejects.
35
+ */
36
+ commit(transaction: Transaction): Promise<void>;
37
+ /** Roll back a transaction, or mark the joined transaction rollback-only. */
38
+ rollback(transaction: Transaction, reason?: unknown): Promise<void>;
39
+ /**
40
+ * The transaction in scope for the current async execution, if any. A
41
+ * transaction that has already committed, rolled back or failed is not
42
+ * in scope, even when its context is still the active store (for example
43
+ * inside an `afterCommit` callback).
44
+ */
45
+ getCurrent(): Transaction | undefined;
46
+ /**
47
+ * The adapter handle (what `adapter.begin()` returned) of the transaction
48
+ * in scope for the current async execution, or `undefined` outside a
49
+ * transaction. See `getTransactionHandle`.
50
+ */
51
+ getCurrentHandle<THandle = unknown>(): THandle | undefined;
52
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The transaction manager contract.
3
+ *
4
+ * `createTransactionManager` returned an anonymous object type, so a
5
+ * consumer that wanted to hold, inject or mock a manager had to write
6
+ * `ReturnType<typeof createTransactionManager>`. This is that type, named.
7
+ *
8
+ * @module transactionTypes/transactionManager
9
+ */
10
+ export {};
@@ -18,4 +18,3 @@ export type TransactionPropagation = "required" | "requires_new" | "supports" |
18
18
  export type TransactionKind = "root" | "participant" | "savepoint" | "none";
19
19
  /** Database isolation levels. */
20
20
  export type TransactionIsolationLevel = "read_uncommitted" | "read_committed" | "repeatable_read" | "serializable";
21
- //# sourceMappingURL=transactionState.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * @module transactionTypes/transactionState
5
5
  */
6
6
  export {};
7
- //# sourceMappingURL=transactionState.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { isTerminalState, isModifiable, summarizeTransaction, } from "./utils.helper.js";
7
7
  export { raceSignal } from "./utils.signal.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { isTerminalState, isModifiable, summarizeTransaction, } from "./utils.helper.js";
7
7
  export { raceSignal } from "./utils.signal.js";
8
- //# sourceMappingURL=index.js.map
@@ -22,4 +22,3 @@ export declare function isModifiable(transaction: Transaction): boolean;
22
22
  * Get a human-readable summary of a transaction.
23
23
  */
24
24
  export declare function summarizeTransaction(transaction: Transaction): string;
25
- //# sourceMappingURL=utils.helper.d.ts.map
@@ -36,4 +36,3 @@ export function summarizeTransaction(transaction) {
36
36
  .filter(Boolean)
37
37
  .join(", ");
38
38
  }
39
- //# sourceMappingURL=utils.helper.js.map
@@ -12,4 +12,3 @@
12
12
  * rejection. Cooperative code should watch the same signal and stop.
13
13
  */
14
14
  export declare function raceSignal<T>(work: Promise<T>, signal: AbortSignal): Promise<T>;
15
- //# sourceMappingURL=utils.signal.d.ts.map
@@ -31,4 +31,3 @@ export function raceSignal(work, signal) {
31
31
  });
32
32
  });
33
33
  }
34
- //# sourceMappingURL=utils.signal.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zudojs/transactions",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Transaction lifecycle and coordination with state machine, AsyncLocalStorage context propagation, savepoints, hooks, and adapter abstraction.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -25,7 +25,7 @@
25
25
  "!dist/.tsbuildinfo"
26
26
  ],
27
27
  "dependencies": {
28
- "@zudojs/errors": "1.3.2"
28
+ "@zudojs/errors": "1.4.0"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=24.0.0"