@unito/integration-cli 0.60.11 → 0.60.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -76,6 +76,7 @@ class Oauth2 extends core_1.Command {
|
|
|
76
76
|
oauth2 = decryptedEntries.successful;
|
|
77
77
|
const testAccount = flags['test-account'];
|
|
78
78
|
const testAccountCredentials = configuration.testAccounts?.[testAccount];
|
|
79
|
+
const testAccountsToRefresh = new Set([testAccount]);
|
|
79
80
|
let credentials;
|
|
80
81
|
if (!testAccountCredentials?.accessToken || flags.reauth) {
|
|
81
82
|
core_1.ux.log(`Starting Oauth2 flow for test account: ${testAccount}`);
|
|
@@ -87,6 +88,14 @@ class Oauth2 extends core_1.Command {
|
|
|
87
88
|
core_1.ux.log(chalk_1.default.redBright('No refresh token found, nothing to do.'));
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
91
|
+
// Figure out if we want to refresh other test account at the same time (like if they currently have the same values)
|
|
92
|
+
for (const [account, accountCredentials] of Object.entries(configuration.testAccounts ?? {})) {
|
|
93
|
+
if (!testAccountsToRefresh.has(account) &&
|
|
94
|
+
accountCredentials?.accessToken === testAccountCredentials.accessToken &&
|
|
95
|
+
accountCredentials?.refreshToken === testAccountCredentials.refreshToken) {
|
|
96
|
+
testAccountsToRefresh.add(account);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
90
99
|
const decryptionResult = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, testAccountCredentials);
|
|
91
100
|
const refreshToken = decryptionResult.successful.refreshToken;
|
|
92
101
|
core_1.ux.action.start(`Refreshing test account ${testAccount}`, undefined, { stdout: true });
|
|
@@ -103,9 +112,11 @@ class Oauth2 extends core_1.Command {
|
|
|
103
112
|
}
|
|
104
113
|
core_1.ux.action.stop();
|
|
105
114
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
for (const account of testAccountsToRefresh) {
|
|
116
|
+
core_1.ux.action.start(`Saving credentials for account: ${account}`, undefined, { stdout: true });
|
|
117
|
+
await (0, configuration_1.writeTestAccount)(configuration, environment, customConfigPath, credentials, account);
|
|
118
|
+
core_1.ux.action.stop();
|
|
119
|
+
}
|
|
109
120
|
return;
|
|
110
121
|
}
|
|
111
122
|
}
|
package/oclif.manifest.json
CHANGED