@unito/integration-cli 0.62.5 → 0.62.7
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.
|
@@ -492,17 +492,32 @@
|
|
|
492
492
|
}
|
|
493
493
|
},
|
|
494
494
|
"node_modules/@eslint/plugin-kit": {
|
|
495
|
-
"version": "0.2.
|
|
496
|
-
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.
|
|
497
|
-
"integrity": "sha512-
|
|
495
|
+
"version": "0.2.5",
|
|
496
|
+
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.5.tgz",
|
|
497
|
+
"integrity": "sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==",
|
|
498
498
|
"dev": true,
|
|
499
|
+
"license": "Apache-2.0",
|
|
499
500
|
"dependencies": {
|
|
501
|
+
"@eslint/core": "^0.10.0",
|
|
500
502
|
"levn": "^0.4.1"
|
|
501
503
|
},
|
|
502
504
|
"engines": {
|
|
503
505
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
504
506
|
}
|
|
505
507
|
},
|
|
508
|
+
"node_modules/@eslint/plugin-kit/node_modules/@eslint/core": {
|
|
509
|
+
"version": "0.10.0",
|
|
510
|
+
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.10.0.tgz",
|
|
511
|
+
"integrity": "sha512-gFHJ+xBOo4G3WRlR1e/3G8A6/KZAH6zcE/hkLRCZTi/B9avAG365QhFA8uOGzTMqgTghpn7/fSnscW++dpMSAw==",
|
|
512
|
+
"dev": true,
|
|
513
|
+
"license": "Apache-2.0",
|
|
514
|
+
"dependencies": {
|
|
515
|
+
"@types/json-schema": "^7.0.15"
|
|
516
|
+
},
|
|
517
|
+
"engines": {
|
|
518
|
+
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
|
519
|
+
}
|
|
520
|
+
},
|
|
506
521
|
"node_modules/@humanfs/core": {
|
|
507
522
|
"version": "0.19.0",
|
|
508
523
|
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.0.tgz",
|
|
@@ -1264,10 +1279,11 @@
|
|
|
1264
1279
|
}
|
|
1265
1280
|
},
|
|
1266
1281
|
"node_modules/cross-spawn": {
|
|
1267
|
-
"version": "7.0.
|
|
1268
|
-
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.
|
|
1269
|
-
"integrity": "sha512-
|
|
1282
|
+
"version": "7.0.6",
|
|
1283
|
+
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
|
1284
|
+
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
|
1270
1285
|
"dev": true,
|
|
1286
|
+
"license": "MIT",
|
|
1271
1287
|
"dependencies": {
|
|
1272
1288
|
"path-key": "^3.1.0",
|
|
1273
1289
|
"shebang-command": "^2.0.0",
|
|
@@ -77,47 +77,50 @@ class Oauth2 extends core_1.Command {
|
|
|
77
77
|
const testAccount = flags['test-account'];
|
|
78
78
|
const testAccountCredentials = configuration.testAccounts?.[testAccount];
|
|
79
79
|
const testAccountsToRefresh = new Set([testAccount]);
|
|
80
|
+
// Figure out if we want to refresh other test account at the same time (like if they currently have the same values)
|
|
81
|
+
for (const [account, accountCredentials] of Object.entries(configuration.testAccounts ?? {})) {
|
|
82
|
+
if (!testAccountsToRefresh.has(account) &&
|
|
83
|
+
accountCredentials?.accessToken === testAccountCredentials?.accessToken &&
|
|
84
|
+
accountCredentials?.refreshToken === testAccountCredentials?.refreshToken) {
|
|
85
|
+
testAccountsToRefresh.add(account);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
let decryptionResult;
|
|
89
|
+
if (testAccountCredentials) {
|
|
90
|
+
decryptionResult = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, testAccountCredentials);
|
|
91
|
+
}
|
|
80
92
|
let credentials;
|
|
81
93
|
if (!testAccountCredentials?.accessToken || flags.reauth) {
|
|
82
|
-
core_1.ux.log(`Starting
|
|
94
|
+
core_1.ux.log(`Starting OAuth2 flow for test account: ${testAccount}`);
|
|
83
95
|
credentials = await Oauth2Resource.performOAuth2Flow(oauth2, environment, testAccountCredentials);
|
|
84
|
-
core_1.ux.log(`
|
|
96
|
+
core_1.ux.log(`OAuth2 flow... Done`);
|
|
85
97
|
}
|
|
86
98
|
else {
|
|
87
99
|
if (!testAccountCredentials?.refreshToken) {
|
|
88
100
|
core_1.ux.log(chalk_1.default.redBright('No refresh token found, nothing to do.'));
|
|
89
101
|
return;
|
|
90
102
|
}
|
|
91
|
-
|
|
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
|
-
}
|
|
99
|
-
const decryptionResult = await (0, decryption_1.decryptEntries)(configuration.name, environment, this.config.configDir, testAccountCredentials);
|
|
100
|
-
const refreshToken = decryptionResult.successful.refreshToken;
|
|
103
|
+
const refreshToken = decryptionResult?.successful.refreshToken;
|
|
101
104
|
core_1.ux.action.start(`Refreshing test account ${testAccount}`, undefined, { stdout: true });
|
|
102
105
|
credentials = await Oauth2Resource.updateToken(oauth2, refreshToken);
|
|
103
|
-
// If provider response doesn't contain a new refresh token, use the one
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
// If provider response doesn't contain a new refresh token, use the existing one
|
|
107
|
+
credentials.refreshToken = credentials.refreshToken ?? refreshToken;
|
|
108
|
+
core_1.ux.action.stop();
|
|
109
|
+
}
|
|
110
|
+
if (decryptionResult) {
|
|
107
111
|
if (decryptionResult.successful.accessToken) {
|
|
108
112
|
credentials.accessToken = (await IntegrationsPlatform.encryptData(configuration.name, credentials.accessToken, false)).encryptedData;
|
|
109
113
|
}
|
|
110
|
-
if (decryptionResult.successful.refreshToken) {
|
|
114
|
+
if (decryptionResult.successful.refreshToken && credentials.refreshToken) {
|
|
111
115
|
credentials.refreshToken = (await IntegrationsPlatform.encryptData(configuration.name, credentials.refreshToken, false)).encryptedData;
|
|
112
116
|
}
|
|
113
|
-
core_1.ux.action.stop();
|
|
114
117
|
}
|
|
118
|
+
// Save credentials for all test accounts needing refresh
|
|
115
119
|
for (const account of testAccountsToRefresh) {
|
|
116
120
|
core_1.ux.action.start(`Saving credentials for account: ${account}`, undefined, { stdout: true });
|
|
117
121
|
await (0, configuration_1.writeTestAccount)(configuration, environment, customConfigPath, credentials, account);
|
|
118
122
|
core_1.ux.action.stop();
|
|
119
123
|
}
|
|
120
|
-
return;
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
exports.default = Oauth2;
|
|
@@ -165,15 +165,16 @@ class Publish extends baseCommand_1.BaseCommand {
|
|
|
165
165
|
}
|
|
166
166
|
if (integration) {
|
|
167
167
|
core_1.ux.action.start('Integration found. Updating', undefined, { stdout: true });
|
|
168
|
+
const configurationPayload = {
|
|
169
|
+
...integrationConfiguration,
|
|
170
|
+
};
|
|
168
171
|
if (integration.archivedAt) {
|
|
169
172
|
core_1.ux.action.start(`Integration previously archived on ${integration.archivedAt}. Un-archiving`, undefined, {
|
|
170
173
|
stdout: true,
|
|
171
174
|
});
|
|
175
|
+
configurationPayload.archived = false;
|
|
172
176
|
}
|
|
173
|
-
updated = await IntegrationsPlatform.updateIntegration(integration.id,
|
|
174
|
-
...integrationConfiguration,
|
|
175
|
-
archived: false,
|
|
176
|
-
});
|
|
177
|
+
updated = await IntegrationsPlatform.updateIntegration(integration.id, configurationPayload);
|
|
177
178
|
}
|
|
178
179
|
else {
|
|
179
180
|
core_1.ux.action.start('Integration not found. Creating', undefined, { stdout: true });
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unito/integration-cli",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.7",
|
|
4
4
|
"description": "Integration CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"integration-cli": "./bin/run"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"better-ajv-errors": "1.x",
|
|
45
45
|
"chalk": "4.x",
|
|
46
46
|
"cors": "2.x",
|
|
47
|
-
"express": "5.0.
|
|
47
|
+
"express": "5.0.1",
|
|
48
48
|
"gradient-string": "2.x",
|
|
49
49
|
"inquirer": "8.x",
|
|
50
50
|
"json-colorizer": "2.x",
|