@@ -11,14 +11,15 @@ import {
1111import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver" ;
1212import { ErrorCodes , MongoDBError } from "./errors.js" ;
1313import { ObjectId } from "bson" ;
14- import { SessionExportsManager } from "./sessionExportsManager.js" ;
14+ import { SessionExportsManager , SessionExportsManagerConfig } from "./sessionExportsManager.js" ;
1515import { config } from "./config.js" ;
1616
1717export interface SessionOptions {
1818 apiBaseUrl : string ;
1919 apiClientId ?: string ;
2020 apiClientSecret ?: string ;
2121 connectionManager ?: ConnectionManager ;
22+ exportsManagerConfig ?: SessionExportsManagerConfig ;
2223}
2324
2425export type SessionEvents = {
@@ -30,15 +31,15 @@ export type SessionEvents = {
3031
3132export class Session extends EventEmitter < SessionEvents > {
3233 readonly sessionId = new ObjectId ( ) . toString ( ) ;
33- readonly exportsManager = new SessionExportsManager ( this , config ) ;
34+ readonly exportsManager : SessionExportsManager ;
3435 connectionManager : ConnectionManager ;
3536 apiClient : ApiClient ;
3637 agentRunner ?: {
3738 name : string ;
3839 version : string ;
3940 } ;
4041
41- constructor ( { apiBaseUrl, apiClientId, apiClientSecret, connectionManager } : SessionOptions ) {
42+ constructor ( { apiBaseUrl, apiClientId, apiClientSecret, connectionManager, exportsManagerConfig } : SessionOptions ) {
4243 super ( ) ;
4344
4445 const credentials : ApiClientCredentials | undefined =
@@ -50,6 +51,7 @@ export class Session extends EventEmitter<SessionEvents> {
5051 : undefined ;
5152
5253 this . apiClient = new ApiClient ( { baseUrl : apiBaseUrl , credentials } ) ;
54+ this . exportsManager = new SessionExportsManager ( this . sessionId , exportsManagerConfig ?? config ) ;
5355
5456 this . connectionManager = connectionManager ?? new ConnectionManager ( ) ;
5557 this . connectionManager . on ( "connection-succeeded" , ( ) => this . emit ( "connect" ) ) ;
0 commit comments