@@ -90,19 +90,34 @@ const MONGOSH_OPTIONS = {
9090 "greedy-arrays" : true ,
9191 "short-option-groups" : false ,
9292 } ,
93- } as const ;
93+ } as Readonly < Options > ;
9494
9595const MCP_SERVER_OPTIONS = {
9696 string : [ "atlasTemporaryDatabaseUserLifetimeMs" ] ,
97- } as const ;
98-
99- const OPTIONS = {
100- string : [ ...MONGOSH_OPTIONS . string , ...MCP_SERVER_OPTIONS . string ] ,
101- boolean : [ ...MONGOSH_OPTIONS . boolean ] ,
102- array : [ ...MONGOSH_OPTIONS . array ] ,
103- alias : { ...MONGOSH_OPTIONS . alias } ,
104- configuration : { ...MONGOSH_OPTIONS . configuration } ,
105- } as const ;
97+ } as Readonly < Partial < Options > > ;
98+
99+ interface Options {
100+ string : string [ ] ;
101+ boolean : string [ ] ;
102+ array : string [ ] ;
103+ alias : Record < string , string > ;
104+ configuration : Record < string , boolean > ;
105+ }
106+
107+ function mergeOptions ( ...optionSources : Array < Partial < Options > > ) : Readonly < Options > {
108+ return {
109+ string : optionSources . flatMap ( ( opts ) => opts . string ?? [ ] ) ,
110+ boolean : optionSources . flatMap ( ( opts ) => opts . boolean ?? [ ] ) ,
111+ array : optionSources . flatMap ( ( opts ) => opts . array ?? [ ] ) ,
112+ alias : Object . assign ( { } , ...optionSources . map ( ( opts ) => opts . alias ?? { } ) ) as Record < string , string > ,
113+ configuration : Object . assign ( { } , ...optionSources . map ( ( opts ) => opts . configuration ?? { } ) ) as Record <
114+ string ,
115+ boolean
116+ > ,
117+ } ;
118+ }
119+
120+ const OPTIONS = mergeOptions ( MONGOSH_OPTIONS , MCP_SERVER_OPTIONS ) ;
106121
107122const ALL_CONFIG_KEYS = new Set (
108123 ( OPTIONS . string as readonly string [ ] )
0 commit comments