Creates a Transaction. Accepts a Client which provides the connection and traversal source for all transaction requests.
Returns true if transaction is open.
Returns the server-generated transaction ID, or undefined if not yet begun.
Spawns a GraphTraversalSource that is bound to a remote transaction.
begin() is idempotent: calling it while a transaction is already open does not send a second begin to the server and does not throw - it reuses the existing transaction ID and returns a source bound to the same transaction. A transaction is single-use, so calling begin() after it has been closed (commit/rollback/failed begin) throws.
Closes the transaction. Default behavior is rollback: partial work is discarded rather than accidentally persisted.
Commits the transaction.
Rolls back the transaction.
Submits a gremlin-lang string within this transaction. The transactionId is automatically attached. Has the same signature as Client.submit().
Optionalparameters: anyOptionalrequestOptions: any
Controls an explicit remote transaction. A thin wrapper around a Client that adds transaction lifecycle (begin/commit/rollback/close) and attaches a transactionId to every request.
Created via Client.transact() or g.tx(). The traversal source (g alias) is inherited from the Client and cannot be changed.
Transactions are short-lived and single-use. After commit or rollback, the transaction ID is invalid and the object cannot be reused.
Each traversal on the transaction-bound source must be awaited before submitting the next, to ensure the server receives requests in order.
This class is NOT thread-safe. Do not share a Transaction across concurrent async contexts without external synchronization.