@@ -2,7 +2,7 @@ import { promises as fs } from 'fs';
22import type { TcpNetConnectOpts } from 'net' ;
33import type { ConnectionOptions as TLSConnectionOptions , TLSSocketOptions } from 'tls' ;
44
5- import { type ServerCommandOptions , type TimeoutContext , TopologyType } from '.' ;
5+ import { TopologyType } from '.' ;
66import { type BSONSerializeOptions , type Document , resolveBSONOptions } from './bson' ;
77import { ChangeStream , type ChangeStreamDocument , type ChangeStreamOptions } from './change_stream' ;
88import type { AutoEncrypter , AutoEncryptionOptions } from './client-side-encryption/auto_encrypter' ;
@@ -22,7 +22,6 @@ import {
2222 makeClientMetadata
2323} from './cmap/handshake/client_metadata' ;
2424import type { CompressorName } from './cmap/wire_protocol/compression' ;
25- import { MongoDBResponse } from './cmap/wire_protocol/responses' ;
2625import { parseOptions , resolveSRVRecord } from './connection_string' ;
2726import { MONGO_CLIENT_EVENTS } from './constants' ;
2827import { type AbstractCursor } from './cursor/abstract_cursor' ;
@@ -44,8 +43,8 @@ import {
4443 type ClientBulkWriteResult
4544} from './operations/client_bulk_write/common' ;
4645import { ClientBulkWriteExecutor } from './operations/client_bulk_write/executor' ;
46+ import { EndSessionsOperation } from './operations/end_sessions' ;
4747import { executeOperation } from './operations/execute_operation' ;
48- import { AbstractOperation } from './operations/operation' ;
4948import type { ReadConcern , ReadConcernLevel , ReadConcernLike } from './read_concern' ;
5049import { ReadPreference , type ReadPreferenceMode } from './read_preference' ;
5150import { type AsyncDisposable , configureResourceManagement } from './resource_management' ;
@@ -63,7 +62,7 @@ import {
6362 type HostAddress ,
6463 hostMatchesWildcards ,
6564 isHostMatch ,
66- MongoDBNamespace ,
65+ type MongoDBNamespace ,
6766 noop ,
6867 ns ,
6968 resolveOptions ,
@@ -827,26 +826,7 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> implements
827826 const endSessions = Array . from ( client . s . sessionPool . sessions , ( { id } ) => id ) ;
828827 if ( endSessions . length !== 0 ) {
829828 try {
830- class EndSessionsOperation extends AbstractOperation < void > {
831- override ns = MongoDBNamespace . fromString ( 'admin.$cmd' ) ;
832- override SERVER_COMMAND_RESPONSE_TYPE = MongoDBResponse ;
833- override buildCommand ( _connection : Connection , _session ?: ClientSession ) : Document {
834- return {
835- endSessions
836- } ;
837- }
838- override buildOptions ( timeoutContext : TimeoutContext ) : ServerCommandOptions {
839- return {
840- timeoutContext,
841- readPreference : ReadPreference . primaryPreferred ,
842- noResponse : true
843- } ;
844- }
845- override get commandName ( ) : string {
846- return 'endSessions' ;
847- }
848- }
849- await executeOperation ( client , new EndSessionsOperation ( ) ) ;
829+ await executeOperation ( client , new EndSessionsOperation ( endSessions ) ) ;
850830 } catch ( error ) {
851831 squashError ( error ) ;
852832 }
0 commit comments