From e295aa5e6ef7a9657f7d55cf6acbf69586af8207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillaume=20=C3=89g=C3=A9e?= <46320048+guiyom-e@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:38:24 -0700 Subject: [PATCH] typing: add loadSsoSessionsFrom and expose private util methods to IniLoader (#4456) * typing: add loadSsoSessionsFrom method to IniLoader * typing: expose getDefaultFilePath and getHomeDir methods --- lib/shared-ini/ini-loader.d.ts | 25 ++++++++++++++++++++++++- lib/shared-ini/ini-loader.js | 6 ------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/lib/shared-ini/ini-loader.d.ts b/lib/shared-ini/ini-loader.d.ts index f1b8d1037e..05aef41160 100644 --- a/lib/shared-ini/ini-loader.d.ts +++ b/lib/shared-ini/ini-loader.d.ts @@ -24,7 +24,30 @@ export class IniLoader{ * Load configurations from config/credentials files and cache them * for later use. If no file is specified it will try to load default * files. - * @returns {object} object of all profile information in the file + * @returns {Record} object of all profile information in the file */ loadFrom(options: LoadFileOptions): IniFileContent; + + /** + * Load sso sessions from config/credentials files and cache them + * for later use. If no file is specified it will try to load default + * files. + * @returns {Record} object of all sso sessions information in the file + */ + loadSsoSessionsFrom(options: LoadFileOptions): IniFileContent; + + /** + * Get default file path for config/credentials files. + * + * @param isConfig whether the file is a config file or a credentials file + * @returns {string} default file path + */ + getDefaultFilePath(isConfig: boolean): string; + + /** + * Get Home directory of the current user. + * + * @returns {string} home directory path + * */ + getHomeDir(): string; } \ No newline at end of file diff --git a/lib/shared-ini/ini-loader.js b/lib/shared-ini/ini-loader.js index 1785085c7f..5cbf49a1ab 100644 --- a/lib/shared-ini/ini-loader.js +++ b/lib/shared-ini/ini-loader.js @@ -103,9 +103,6 @@ AWS.IniLoader = AWS.util.inherit({ return this.resolvedSsoSessions[filename]; }, - /** - * @api private - */ getDefaultFilePath: function getDefaultFilePath(isConfig) { return path.join( this.getHomeDir(), @@ -114,9 +111,6 @@ AWS.IniLoader = AWS.util.inherit({ ); }, - /** - * @api private - */ getHomeDir: function getHomeDir() { var env = process.env; var home = env.HOME ||