@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.
@@ -35,4 +35,4 @@ RUN --mount=type=secret,id=npmrc,target=.npmrc npm ci --omit=dev
35
35
  RUN npm install --omit=dev
36
36
 
37
37
  ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
38
- CMD ["node", "./index.js"]
38
+ CMD ["node", "./src/index.js"]
@@ -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
- core_1.ux.action.start(`Saving credentials for account: ${testAccount}`, undefined, { stdout: true });
107
- await (0, configuration_1.writeTestAccount)(configuration, environment, customConfigPath, credentials, testAccount);
108
- core_1.ux.action.stop();
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
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.60.11",
2
+ "version": "0.60.12",
3
3
  "commands": {
4
4
  "activity": {
5
5
  "id": "activity",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integration-cli",
3
- "version": "0.60.11",
3
+ "version": "0.60.12",
4
4
  "description": "Integration CLI",
5
5
  "bin": {
6
6
  "integration-cli": "./bin/run"