@contrail/cli 3.6.0-alpha-8-alpha.fb40acc → 3.6.0-alpha-8-alpha.2c2e640

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.fb40acc linux-x64 node-v24.21.0
20
+ @contrail/cli/3.6.0-alpha-8-alpha.2c2e640 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.error('access token expired; attempting refresh');
164
+ console.log('try frefreshing');
165
165
  return;
166
166
  }
167
167
  throw e;
@@ -176,8 +176,7 @@ async function refreshCurrentUserOrg() {
176
176
  apiGateway: config.apiGateway,
177
177
  orgSlug: config.orgSlug,
178
178
  };
179
- (0, sdk_1.setConfig)(sdk_1.Auth.config);
180
- console.error('fetched new access token from refresh token');
179
+ console.log('fetched new access token from refresh token', newVibeAccessToken);
181
180
  }
182
181
  catch (e) {
183
182
  throw Error(`Could not get refresh token: ${e}`);
@@ -216,11 +215,9 @@ async function requestRefreshedAccessToken(vibeRefreshToken, apiGateway) {
216
215
  },
217
216
  body: JSON.stringify({ refreshToken: vibeRefreshToken }),
218
217
  });
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;
218
+ return await response.json().then((data) => {
219
+ return data.accessToken;
220
+ });
224
221
  }
225
222
  function getVersionFromPackageJson() {
226
223
  // 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
- this.log(`App API key: (app:${answers.appApiKey})`);
38
+ logger_1.default.info(`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
- this.log(`App API key: (app:${appFound.apiKey.apiKey})`);
46
+ logger_1.default.info(`App API key: (app:${appFound.apiKey.apiKey})`);
47
47
  }
48
48
  }
49
49
  }
@@ -91,8 +91,8 @@ class DeleteEntity extends basecommand_1.BaseCommand {
91
91
  console.error('deleted entities:');
92
92
  }
93
93
  this.log(JSON.stringify(response, null, 2));
94
- if (response.failed.length > 0) {
95
- console.error(`${response.failed.length} of ${ids.length} deletes failed.`);
94
+ if (response.idsErrored.length > 0) {
95
+ console.error(`${response.idsErrored.length} of ${ids.length} deletes failed.`);
96
96
  process.exitCode = 1;
97
97
  }
98
98
  }
@@ -103,26 +103,32 @@ class DeleteEntity extends basecommand_1.BaseCommand {
103
103
  }
104
104
  exports.default = DeleteEntity;
105
105
  async function deleteEntityByIds(entityName, ids, routing = {}) {
106
- const deletedIds = [];
107
- const notFoundIds = [];
108
- const failed = [];
106
+ const idsDeleted = new Set();
107
+ const idsNotFound = new Set();
108
+ const idsErrored = new Set();
109
109
  const limit = (0, p_limit_1.default)(10);
110
110
  const deletePromises = ids.map((id) => limit(() => deleteEntityById(entityName, id, routing).then((entity) => {
111
111
  if (!entity) {
112
- notFoundIds.push(id);
113
- return;
112
+ idsNotFound.add(id);
113
+ return null;
114
114
  }
115
- deletedIds.push(id);
115
+ idsDeleted.add(id);
116
+ return entity;
116
117
  }, (error) => {
117
118
  if (error.message.includes('not found')) {
118
- notFoundIds.push(id);
119
+ idsNotFound.add(id);
119
120
  }
120
121
  else {
121
- failed.push({ id, error: (0, common_1.sdkErrorMessage)(error) });
122
+ idsErrored.add(id);
122
123
  }
124
+ return null;
123
125
  })));
124
126
  await Promise.all(deletePromises);
125
- return { deletedIds, notFoundIds, failed };
127
+ return {
128
+ idsDeleted: Array.from(idsDeleted),
129
+ idsNotFound: Array.from(idsNotFound),
130
+ idsErrored: Array.from(idsErrored),
131
+ };
126
132
  }
127
133
  async function deleteEntityById(entityName, id, routing = {}) {
128
134
  const client = new sdk_1.Entities();
@@ -224,9 +224,8 @@ 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 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) {
227
+ // a suffix names a specific sub-route, so it always goes through the plain client
228
+ if ((0, batchFetch_1.canBatchFetchEntity)(entityName) && !suffix) {
230
229
  return (0, batchFetch_1.batchFetch)(entityName, payload);
231
230
  }
232
231
  else {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.6.0-alpha-8-alpha.fb40acc",
2
+ "version": "3.6.0-alpha-8-alpha.2c2e640",
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.fb40acc",
3
+ "version": "3.6.0-alpha-8-alpha.2c2e640",
4
4
  "description": "VibeIQ's Contrail Platform CLI.",
5
5
  "bin": {
6
6
  "contrail-cli": "./bin/run",