@@ -11,14 +11,15 @@ import {
11
11
import { NodeDriverServiceProvider } from "@mongosh/service-provider-node-driver" ;
12
12
import { ErrorCodes , MongoDBError } from "./errors.js" ;
13
13
import { ObjectId } from "bson" ;
14
- import { SessionExportsManager } from "./sessionExportsManager.js" ;
14
+ import { SessionExportsManager , SessionExportsManagerConfig } from "./sessionExportsManager.js" ;
15
15
import { config } from "./config.js" ;
16
16
17
17
export interface SessionOptions {
18
18
apiBaseUrl : string ;
19
19
apiClientId ?: string ;
20
20
apiClientSecret ?: string ;
21
21
connectionManager ?: ConnectionManager ;
22
+ exportsManagerConfig ?: SessionExportsManagerConfig ;
22
23
}
23
24
24
25
export type SessionEvents = {
@@ -30,15 +31,15 @@ export type SessionEvents = {
30
31
31
32
export class Session extends EventEmitter < SessionEvents > {
32
33
readonly sessionId = new ObjectId ( ) . toString ( ) ;
33
- readonly exportsManager = new SessionExportsManager ( this , config ) ;
34
+ readonly exportsManager : SessionExportsManager ;
34
35
connectionManager : ConnectionManager ;
35
36
apiClient : ApiClient ;
36
37
agentRunner ?: {
37
38
name : string ;
38
39
version : string ;
39
40
} ;
40
41
41
- constructor ( { apiBaseUrl, apiClientId, apiClientSecret, connectionManager } : SessionOptions ) {
42
+ constructor ( { apiBaseUrl, apiClientId, apiClientSecret, connectionManager, exportsManagerConfig } : SessionOptions ) {
42
43
super ( ) ;
43
44
44
45
const credentials : ApiClientCredentials | undefined =
@@ -50,6 +51,7 @@ export class Session extends EventEmitter<SessionEvents> {
50
51
: undefined ;
51
52
52
53
this . apiClient = new ApiClient ( { baseUrl : apiBaseUrl , credentials } ) ;
54
+ this . exportsManager = new SessionExportsManager ( this . sessionId , exportsManagerConfig ?? config ) ;
53
55
54
56
this . connectionManager = connectionManager ?? new ConnectionManager ( ) ;
55
57
this . connectionManager . on ( "connection-succeeded" , ( ) => this . emit ( "connect" ) ) ;
0 commit comments