Skip to content

feat(NODE-6865): deprecate transaction getters #4567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export class ClientSession
/** @internal */
owner?: symbol | AbstractCursor;
defaultTransactionOptions: TransactionOptions;
/** @deprecated - Will be made internal in the next major release */
transaction: Transaction;
/**
* @internal
Expand Down
11 changes: 10 additions & 1 deletion src/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ export interface TransactionOptions extends Omit<CommandOperationOptions, 'timeo

/**
* @public
* @deprecated - Will be made internal in a future major release.
* A class maintaining state related to a server transaction. Internal Only
*/
export class Transaction {
/** @internal */
state: TxnState;
/** @deprecated - Will be made internal in a future major release. */
options: TransactionOptions;
/** @internal */
_pinnedServer?: Server;
Expand Down Expand Up @@ -122,26 +124,33 @@ export class Transaction {
return this._pinnedServer;
}

/** @deprecated - Will be made internal in a future major release. */
get recoveryToken(): Document | undefined {
return this._recoveryToken;
}

/** @deprecated - Will be made internal in a future major release. */
get isPinned(): boolean {
return !!this.server;
}

/** @returns Whether the transaction has started */
/**
* @deprecated - Will be made internal in a future major release.
* @returns Whether the transaction has started
*/
get isStarting(): boolean {
return this.state === TxnState.STARTING_TRANSACTION;
}

/**
* @deprecated - Will be made internal in a future major release.
* @returns Whether this session is presently in a transaction
*/
get isActive(): boolean {
return ACTIVE_STATES.has(this.state);
}

/** @deprecated - Will be made internal in a future major release. */
get isCommitted(): boolean {
return COMMITTED_STATES.has(this.state);
}
Expand Down