@contrail/cli 3.6.0-alpha-8-alpha.de819d3 → 3.6.0-alpha-8-alpha.fb40acc

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.
package/README.md CHANGED
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
17
17
  $ contrail COMMAND
18
18
  running command...
19
19
  $ contrail (--version)
20
- @contrail/cli/3.6.0-alpha-8-alpha.de819d3 linux-x64 node-v24.21.0
20
+ @contrail/cli/3.6.0-alpha-8-alpha.fb40acc linux-x64 node-v24.21.0
21
21
  $ contrail --help [COMMAND]
22
22
  USAGE
23
23
  $ contrail COMMAND
@@ -161,7 +161,7 @@ async function refreshCurrentUserOrg() {
161
161
  const currentUser = await (0, sdk_1.getCurrentUser)().catch((e) => {
162
162
  console.error('error getting current user', e.message);
163
163
  if (isExpiredTokenError(e)) {
164
- console.log('try frefreshing');
164
+ console.error('access token expired; attempting refresh');
165
165
  return;
166
166
  }
167
167
  throw e;
@@ -176,7 +176,8 @@ async function refreshCurrentUserOrg() {
176
176
  apiGateway: config.apiGateway,
177
177
  orgSlug: config.orgSlug,
178
178
  };
179
- console.log('fetched new access token from refresh token', newVibeAccessToken);
179
+ (0, sdk_1.setConfig)(sdk_1.Auth.config);
180
+ console.error('fetched new access token from refresh token');
180
181
  }
181
182
  catch (e) {
182
183
  throw Error(`Could not get refresh token: ${e}`);
@@ -215,9 +216,11 @@ async function requestRefreshedAccessToken(vibeRefreshToken, apiGateway) {
215
216
  },
216
217
  body: JSON.stringify({ refreshToken: vibeRefreshToken }),
217
218
  });
218
- return await response.json().then((data) => {
219
- return data.accessToken;
220
- });
219
+ const data = await response.json();
220
+ if (!response.ok || !data.accessToken) {
221
+ throw new Error(`jwt_refresh returned ${response.status} with no access token`);
222
+ }
223
+ return data.accessToken;
221
224
  }
222
225
  function getVersionFromPackageJson() {
223
226
  // Get the path to the package.json file
@@ -35,7 +35,7 @@ class GetAPIKeyApp extends basecommand_1.BaseCommand {
35
35
  },
36
36
  ];
37
37
  const answers = await inquirer_1.default.prompt(questions);
38
- logger_1.default.info(`App API key: (app:${answers.appApiKey})`);
38
+ this.log(`App API key: (app:${answers.appApiKey})`);
39
39
  }
40
40
  else {
41
41
  const appFound = installedApps.find((x) => x.app.identifier === this.flags.appIdentifier);
@@ -43,7 +43,7 @@ class GetAPIKeyApp extends basecommand_1.BaseCommand {
43
43
  logger_1.default.info('You do not have such an app installed');
44
44
  return;
45
45
  }
46
- logger_1.default.info(`App API key: (app:${appFound.apiKey.apiKey})`);
46
+ this.log(`App API key: (app:${appFound.apiKey.apiKey})`);
47
47
  }
48
48
  }
49
49
  }
@@ -224,8 +224,9 @@ async function find(entityName, options = {}) {
224
224
  queryOptions.customParams = { propertySlugs: propertySlugs.join(',') };
225
225
  }
226
226
  const payload = id ? { id, ...queryOptions } : { criteria, ...queryOptions };
227
- // a suffix names a specific sub-route, so it always goes through the plain client
228
- if ((0, batchFetch_1.canBatchFetchEntity)(entityName) && !suffix) {
227
+ // a suffix names a specific sub-route and an id names one entity; both always go
228
+ // through the plain client (batch-fetch only understands criteria)
229
+ if ((0, batchFetch_1.canBatchFetchEntity)(entityName) && !suffix && !id) {
229
230
  return (0, batchFetch_1.batchFetch)(entityName, payload);
230
231
  }
231
232
  else {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.de819d3",
2
+ "version": "3.6.0-alpha-8-alpha.fb40acc",
3
3
  "commands": {
4
4
  "app:create": {
5
5
  "id": "app:create",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/cli",
3
- "version": "3.6.0-alpha-8-alpha.de819d3",
3
+ "version": "3.6.0-alpha-8-alpha.fb40acc",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",