@@ -26,7 +26,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2626 return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
2727} ;
2828Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
29- exports . getConfigCredentials = exports . getCachedTokenSessions = exports . serialiseTokensList = exports . combineOptsWithSettings = exports . applyGlobalConfigHooks = exports . getEnvSettings = exports . getConfigSettings = exports . getConfig = exports . setProfile = exports . updateConfig = exports . dumpConfigProfile = exports . listConfigProfiles = exports . hasValidConfig = exports . profile = exports . BDCONF = void 0 ;
29+ exports . profile = exports . BDCONF = void 0 ;
30+ exports . hasValidConfig = hasValidConfig ;
31+ exports . listConfigProfiles = listConfigProfiles ;
32+ exports . dumpConfigProfile = dumpConfigProfile ;
33+ exports . updateConfig = updateConfig ;
34+ exports . setProfile = setProfile ;
35+ exports . getConfig = getConfig ;
36+ exports . getConfigSettings = getConfigSettings ;
37+ exports . getEnvSettings = getEnvSettings ;
38+ exports . applyGlobalConfigHooks = applyGlobalConfigHooks ;
39+ exports . combineOptsWithSettings = combineOptsWithSettings ;
40+ exports . serialiseTokensList = serialiseTokensList ;
41+ exports . getCachedTokenSessions = getCachedTokenSessions ;
42+ exports . getConfigCredentials = getConfigCredentials ;
3043const fs = __importStar ( require ( "fs/promises" ) ) ;
3144const yaml = __importStar ( require ( "js-yaml" ) ) ;
3245const os = __importStar ( require ( "os" ) ) ;
@@ -53,7 +66,6 @@ async function hasValidConfig(logger) {
5366 return false ;
5467 }
5568}
56- exports . hasValidConfig = hasValidConfig ;
5769async function listConfigProfiles ( logger ) {
5870 try {
5971 const config = yaml . load ( await fs . readFile ( configFile , "utf8" ) ) ;
@@ -66,7 +78,6 @@ async function listConfigProfiles(logger) {
6678 throw err ;
6779 }
6880}
69- exports . listConfigProfiles = listConfigProfiles ;
7081async function dumpConfigProfile ( profile , logger ) {
7182 logger ?. debug ( { profile } ) ;
7283 const config = yaml . load ( await fs . readFile ( configFile , "utf8" ) ) ;
@@ -75,7 +86,6 @@ async function dumpConfigProfile(profile, logger) {
7586 return ;
7687 return dump ;
7788}
78- exports . dumpConfigProfile = dumpConfigProfile ;
7989async function updateConfig ( updates , logger ) {
8090 let config = { } ;
8191 try {
@@ -100,12 +110,10 @@ async function updateConfig(updates, logger) {
100110 mode : 0o600 ,
101111 } ) ;
102112}
103- exports . updateConfig = updateConfig ;
104113function setProfile ( profileName , logger ) {
105114 exports . profile = profileName ;
106115 logger ?. debug ( { profile : exports . profile } ) ;
107116}
108- exports . setProfile = setProfile ;
109117async function getConfig ( logger ) {
110118 try {
111119 const configFileData = await fs . readFile ( configFile , "utf8" ) ;
@@ -122,14 +130,12 @@ async function getConfig(logger) {
122130 }
123131 return ;
124132}
125- exports . getConfig = getConfig ;
126133async function getConfigSettings ( logger ) {
127134 const conf = await getConfig ( logger ) ;
128135 const settings = conf ?. settings ?? { } ;
129136 logger ?. debug ( { settings } ) ;
130137 return settings ;
131138}
132- exports . getConfigSettings = getConfigSettings ;
133139function camalize ( str ) {
134140 return str . toLowerCase ( ) . replace ( / [ ^ a - z A - Z 0 - 9 ] + ( .) / g, ( _m , chr ) => chr . toUpperCase ( ) ) ;
135141}
@@ -141,7 +147,6 @@ function getEnvSettings(logger) {
141147 logger ?. debug ( { bdEnvs } ) ;
142148 return bdEnvs ;
143149}
144- exports . getEnvSettings = getEnvSettings ;
145150function applyGlobalConfigHooks ( opts , logger ) {
146151 // global opts handling due to the Commander short comings
147152 if ( opts [ "profile" ] )
@@ -153,7 +158,6 @@ function applyGlobalConfigHooks(opts, logger) {
153158 if ( opts [ "disableSpinner" ] )
154159 ( 0 , spinner_util_js_1 . disableSpinner ) ( ) ;
155160}
156- exports . applyGlobalConfigHooks = applyGlobalConfigHooks ;
157161async function combineOptsWithSettings ( opts , logger ) {
158162 const envSettings = getEnvSettings ( logger ) ;
159163 // we get e.g. BD_PROFILE, so we can get settings
@@ -164,11 +168,9 @@ async function combineOptsWithSettings(opts, logger) {
164168 logger ?. debug ( { options : { ...options , password : options [ "password" ] ? "**" : undefined } } ) ;
165169 return options ;
166170}
167- exports . combineOptsWithSettings = combineOptsWithSettings ;
168171function serialiseTokensList ( sharedTokens ) {
169172 return sharedTokens . map ( entry => `${ entry . shareId } :${ entry . bdStsToken } ` ) ;
170173}
171- exports . serialiseTokensList = serialiseTokensList ;
172174async function getCachedTokenSessions ( logger , showExpired = false ) {
173175 const conf = await getConfig ( ) ;
174176 const decodedList = ( conf ?. credentials ?. sharedTokens ?? [ ] )
@@ -196,7 +198,6 @@ async function getCachedTokenSessions(logger, showExpired = false) {
196198 . filter ( e => ! ! e ) ;
197199 return decodedList ?? [ ] ;
198200}
199- exports . getCachedTokenSessions = getCachedTokenSessions ;
200201async function getConfigCredentials ( logger ) {
201202 if ( currentCreds )
202203 return currentCreds ; // cached in mem, so you can call this method multiple times
@@ -214,4 +215,3 @@ async function getConfigCredentials(logger) {
214215 logger ?. debug ( { ...currentCreds , password : currentCreds ?. password ? "**" : undefined } ) ;
215216 return currentCreds ;
216217}
217- exports . getConfigCredentials = getConfigCredentials ;
0 commit comments