@contentstack/cli-cm-export-to-csv 1.6.0 → 1.6.1

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export-to-csv",
3
3
  "description": "Export entities to csv",
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "author": "Abhinav Gupta @abhinav-from-contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "~1.2.15",
9
- "@contentstack/cli-utilities": "~1.5.5",
8
+ "@contentstack/cli-command": "~1.2.16",
9
+ "@contentstack/cli-utilities": "~1.5.7",
10
10
  "chalk": "^4.1.0",
11
11
  "fast-csv": "^4.3.6",
12
12
  "inquirer": "8.2.4",
@@ -6,6 +6,7 @@ const {
6
6
  isAuthenticated,
7
7
  cliux,
8
8
  doesBranchExist,
9
+ isManagementTokenValid
9
10
  } = require('@contentstack/cli-utilities');
10
11
  const util = require('../../util');
11
12
  const config = require('../../util/config');
@@ -332,6 +333,10 @@ class ExportToCsvCommand extends Command {
332
333
  let apiClient, stackDetails;
333
334
  const listOfTokens = configHandler.get('tokens');
334
335
  if (managementTokenAlias && listOfTokens[managementTokenAlias]) {
336
+ const checkManagementTokenValidity = await isManagementTokenValid((listOfTokens[managementTokenAlias].apiKey) ,listOfTokens[managementTokenAlias].token);
337
+ if(!checkManagementTokenValidity?.valid) {
338
+ throw checkManagementTokenValidity.hasOwnProperty('valid')?(`error: Management token or stack API key is invalid. ${checkManagementTokenValidity?.message||""}`):checkManagementTokenValidity?.message||"";
339
+ }
335
340
  apiClient = await managementSDKClient({
336
341
  host: this.cmaHost,
337
342
  management_token: listOfTokens[managementTokenAlias].token,