@contentstack/cli-cm-export 1.5.7 → 1.5.9

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
@@ -48,7 +48,7 @@ $ npm install -g @contentstack/cli-cm-export
48
48
  $ csdx COMMAND
49
49
  running command...
50
50
  $ csdx (--version)
51
- @contentstack/cli-cm-export/1.5.7 linux-x64 node-v16.20.0
51
+ @contentstack/cli-cm-export/1.5.9 linux-x64 node-v16.20.0
52
52
  $ csdx --help [COMMAND]
53
53
  USAGE
54
54
  $ csdx COMMAND
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.7",
2
+ "version": "1.5.9",
3
3
  "commands": {
4
4
  "cm:stacks:export": {
5
5
  "id": "cm:stacks:export",
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-export",
3
3
  "description": "Contentstack CLI plugin to export content from stack",
4
- "version": "1.5.7",
4
+ "version": "1.5.9",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-command": "^1.2.7",
9
- "@contentstack/cli-utilities": "^1.4.3",
8
+ "@contentstack/cli-command": "^1.2.9",
9
+ "@contentstack/cli-utilities": "^1.4.5",
10
10
  "@oclif/command": "^1.8.16",
11
11
  "@oclif/config": "^1.18.3",
12
12
  "async": "^3.2.4",
@@ -15,7 +15,7 @@
15
15
  "chalk": "^4.1.2",
16
16
  "is-valid-path": "^0.1.1",
17
17
  "lodash": "^4.17.20",
18
- "mkdirp": "^1.0.4",
18
+ "mkdirp": "^2.1.3",
19
19
  "path": "^0.12.7",
20
20
  "progress-stream": "^2.0.0",
21
21
  "promise-limit": "^2.7.0",
@@ -23,9 +23,9 @@
23
23
  "winston": "^3.7.2"
24
24
  },
25
25
  "devDependencies": {
26
- "@contentstack/cli-auth": "^1.3.7",
27
- "@contentstack/cli-config": "^1.4.5",
28
- "@contentstack/cli-dev-dependencies": "^1.2.2",
26
+ "@contentstack/cli-auth": "^1.3.8",
27
+ "@contentstack/cli-config": "^1.4.6",
28
+ "@contentstack/cli-dev-dependencies": "^1.2.3",
29
29
  "@oclif/plugin-help": "^5.1.19",
30
30
  "@oclif/test": "^1.2.6",
31
31
  "assert": "^2.0.0",
@@ -84,4 +84,4 @@
84
84
  },
85
85
  "main": "./src/commands/cm/stacks/export.js",
86
86
  "repository": "https://github.com/contentstack/cli"
87
- }
87
+ }
package/src/app.js CHANGED
@@ -36,7 +36,7 @@ exports.initial = async (config) => {
36
36
  await allExport(APIClient, stackAPIClient, config, types, branch.uid);
37
37
  }
38
38
  } catch (error) {
39
- addlogs(config, `failed export contents ${branch.uid} ${util.formatError(error)}`, 'error');
39
+ addlogs(config, `failed export contents '${branch.uid}' ${util.formatError(error)}`, 'error');
40
40
  }
41
41
  }
42
42
  } else {
@@ -47,7 +47,7 @@ exports.initial = async (config) => {
47
47
  await allExport(APIClient, stackAPIClient, config, types);
48
48
  }
49
49
  } catch (error) {
50
- addlogs(config, `failed export contents ${util.formatError(error)}`, 'error');
50
+ addlogs(config, `failed export contents. ${util.formatError(error)}`, 'error');
51
51
  }
52
52
  }
53
53
  };
@@ -77,9 +77,8 @@ exports.initial = async (config) => {
77
77
  resolve();
78
78
  })
79
79
  .catch((error) => {
80
- console.log('error', error && error.message);
81
80
  if (error && error.errors && error.errors.api_key) {
82
- addlogs(config, chalk.red('Stack Api key ' + error.errors.api_key[0], 'Please enter valid Key', 'error'));
81
+ addlogs(config, `Stack Api key '${error.errors.api_key[0]}', Please enter valid Key`, 'error');
83
82
  addlogs(config, 'The log for this is stored at ' + config.data + '/export/logs', 'success');
84
83
  } else {
85
84
  addlogs(config, `${util.formatError(error)}`, 'error');
@@ -112,7 +111,7 @@ const singleExport = async (APIClient, stackAPIClient, moduleName, types, config
112
111
  config = _.merge(config, master_locale);
113
112
  }
114
113
  }
115
- addlogs(config, moduleName + ' was exported successfully!', 'success');
114
+ addlogs(config, `Module '${moduleName}' was exported successfully!`, 'success');
116
115
  addlogs(config, 'The log for this is stored at ' + path.join(config.data, 'logs', 'export'), 'success');
117
116
  } else {
118
117
  addlogs(config, 'Please provide valid module name.', 'error');
@@ -120,8 +119,8 @@ const singleExport = async (APIClient, stackAPIClient, moduleName, types, config
120
119
  return true;
121
120
  } catch (error) {
122
121
  addlogs(config, `${util.formatError(error)}`, 'error');
123
- addlogs(config, 'Failed to migrate ' + moduleName, 'error');
124
- addlogs(config, 'The log for this is stored at ' + path.join(config.data, 'logs', 'export'), 'error');
122
+ addlogs(config, `Failed to migrate module '${moduleName}'`, 'error');
123
+ addlogs(config, `The log for this is stored at '${path.join(config.data, 'logs', 'export')}'`, 'error');
125
124
  }
126
125
  };
127
126
 
@@ -149,13 +148,9 @@ const allExport = async (APIClient, stackAPIClient, config, types, branchName) =
149
148
  addlogs(config, util.formatError(error), 'error');
150
149
  addlogs(
151
150
  config,
152
- chalk.red(
153
- 'Failed to migrate stack: ' +
154
- (config.sourceStackName || config.source_stack) +
155
- '. Please check error logs for more info',
156
- ),
151
+ `Failed to migrate stack '${config.sourceStackName || config.source_stack}'. Please check error logs for more info.`,
157
152
  'error',
158
153
  );
159
- addlogs(config, 'The log for this is stored at ' + path.join(config.data, 'logs', 'export'), 'error');
154
+ addlogs(config, `The log for this is stored at '${path.join(config.data, 'logs', 'export')}'`, 'error');
160
155
  }
161
156
  };
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable complexity */
2
2
  const { Command } = require('@contentstack/cli-command');
3
- const { printFlagDeprecation, configHandler, flags, isAuthenticated } = require('@contentstack/cli-utilities');
3
+ const { printFlagDeprecation, configHandler, flags, isAuthenticated, cliux } = require('@contentstack/cli-utilities');
4
4
  const {
5
5
  configWithMToken,
6
6
  parameterWithMToken,
@@ -71,10 +71,10 @@ class ExportCommand extends Command {
71
71
  exportCommandFlags,
72
72
  );
73
73
  } else {
74
- this.log('Please provide a valid command. Run "csdx cm:export --help" command to view the command usage');
74
+ cliux.print(`error: Please provide a valid command. Run "csdx cm:export --help" command to view the command usage`, {color: 'red'});
75
75
  }
76
76
  } else {
77
- this.log(alias + ' management token is not present, please add managment token first');
77
+ cliux.print(`error: ${alias} management token is not present, please add managment token first`, {color: 'red'});
78
78
  }
79
79
  } else if (isAuthenticated()) {
80
80
  if (extConfig) {
@@ -108,10 +108,10 @@ class ExportCommand extends Command {
108
108
  exportCommandFlags,
109
109
  );
110
110
  } else {
111
- this.log('Please provide a valid command. Run "csdx cm:export --help" command to view the command usage');
111
+ cliux.print(`error: Please provide a valid command. Run "csdx cm:export --help" command to view the command usage`, {color: 'red'});
112
112
  }
113
113
  } else {
114
- this.log('Login or provide the alias for management token');
114
+ cliux.print(`error: Login or provide the alias for management token`, {color: 'red'});
115
115
  }
116
116
  }
117
117
  }
@@ -17,6 +17,7 @@ const helper = require('../util/helper');
17
17
  const { addlogs } = require('../util/log');
18
18
 
19
19
  let config = require('../../config/default');
20
+ const { formatError } = require('../util');
20
21
 
21
22
  module.exports = class ExportAssets {
22
23
  config;
@@ -86,7 +87,8 @@ module.exports = class ExportAssets {
86
87
  .catch((error) => {
87
88
  addlogs(
88
89
  self.config,
89
- chalk.red('The following asset failed to download\n' + JSON.stringify(assetJSON)),
90
+ `Asset '${assetJSON.uid}' failed to download.\n ${formatError(error)}`,
91
+ 'error'
90
92
  );
91
93
  addlogs(self.config, error, 'error');
92
94
  });
@@ -98,8 +100,8 @@ module.exports = class ExportAssets {
98
100
  })
99
101
  .catch((err) => {
100
102
  addlogs(
101
- { errorCode: err && err.code, uid: assetJSON.uid },
102
- `Asset download failed - ${assetJSON.uid}`,
103
+ self.config,
104
+ `Asset '${assetJSON.uid}' download failed. ${formatError(err)}`,
103
105
  'error',
104
106
  );
105
107
  return err;
@@ -113,8 +115,8 @@ module.exports = class ExportAssets {
113
115
  // helper.writeFileSync(this.assetContentsFile, self.assetContents)
114
116
  })
115
117
  .catch((error) => {
116
- console.log('Error fetch/download the asset', error && error.message);
117
- addlogs(self.config, 'Asset batch ' + (batch + 1) + ' failed to download', 'error');
118
+ addlogs(self.config, `Asset batch ${batch + 1} failed to download`, 'error');
119
+ addlogs(self.config, formatError(error), 'error');
118
120
  addlogs(self.config, error, 'error');
119
121
  });
120
122
  })
@@ -135,7 +137,7 @@ module.exports = class ExportAssets {
135
137
  return resolve();
136
138
  })
137
139
  .catch((error) => {
138
- addlogs(self.config, error, 'success');
140
+ addlogs(self.config, error, 'error');
139
141
  reject(error);
140
142
  });
141
143
  })
@@ -143,14 +145,15 @@ module.exports = class ExportAssets {
143
145
  helper.writeFileSync(self.assetContentsFile, self.assetContents);
144
146
  addlogs(
145
147
  self.config,
146
- chalk.red('Asset export failed due to the following errors ' + JSON.stringify(error), 'error'),
148
+ `Asset export failed. ${formatError(error)}`,
149
+ 'error'
147
150
  );
148
- addlogs(self.config, error, 'success');
151
+ addlogs(self.config, error, 'error');
149
152
  reject(error);
150
153
  });
151
154
  })
152
155
  .catch((error) => {
153
- addlogs(self.config, error, 'success');
156
+ addlogs(self.config, error, 'error');
154
157
  reject(error);
155
158
  });
156
159
  });
@@ -175,7 +178,7 @@ module.exports = class ExportAssets {
175
178
  return resolve();
176
179
  })
177
180
  .catch((error) => {
178
- addlogs(self.config, chalk.red('Error while exporting asset-folders!'), 'error');
181
+ addlogs(self.config, `Error while exporting asset-folders!\n ${formatError(error)}`, 'error');
179
182
  return reject(error);
180
183
  });
181
184
  })
@@ -319,7 +322,6 @@ module.exports = class ExportAssets {
319
322
  })
320
323
  .catch((error) => {
321
324
  addlogs(self.config, error, 'error');
322
- console.log('Error on fetch', error && error.message);
323
325
 
324
326
  if (error.status === 408) {
325
327
  console.log('retrying', uid);
@@ -354,7 +356,7 @@ module.exports = class ExportAssets {
354
356
  : asset.url,
355
357
  };
356
358
 
357
- await helper.makeDirectory(assetFolderPath);
359
+ mkdirp.sync(assetFolderPath);
358
360
  const assetFileStream = fs.createWriteStream(assetFilePath);
359
361
  self.assetStream.url = encodeURI(self.assetStream.url);
360
362
  self.httpClient
@@ -383,6 +385,7 @@ module.exports = class ExportAssets {
383
385
  return resolve();
384
386
  })
385
387
  .on('error', (error) => {
388
+ addlogs(self.config, `Download ${asset.filename}: ${asset.uid} failed!`, 'error');
386
389
  addlogs(self.config, error, 'error');
387
390
  reject(error);
388
391
  });
@@ -37,7 +37,7 @@ class ContentTypesExport {
37
37
  await this.writeContentTypes(this.contentTypes);
38
38
  addlogs(this.exportConfig, chalk.green('Content type(s) exported successfully'), 'success');
39
39
  } catch (error) {
40
- addlogs(this.exportConfig, chalk.red(`Failed to export content types ${formatError(error)}`), 'error');
40
+ addlogs(this.exportConfig, `Failed to export content types ${formatError(error)}`, 'error');
41
41
  throw new Error('Failed to export content types');
42
42
  }
43
43
  }
@@ -58,7 +58,7 @@ class ContentTypesExport {
58
58
  }
59
59
  return await this.getContentTypes(skip);
60
60
  } else {
61
- console.log('No content types returned for the given query');
61
+ addlogs(this.exportConfig, 'No content types returned for the given query', 'info');
62
62
  }
63
63
  }
64
64
 
@@ -45,7 +45,7 @@ module.exports = class ExportCustomRoles {
45
45
  );
46
46
  self.customRoles = {};
47
47
  customRoles.forEach((role) => {
48
- addlogs(self.config, role.name + ' role was exported successfully', 'success');
48
+ addlogs(self.config, `'${role.name}' role was exported successfully`, 'success');
49
49
  self.customRoles[role.uid] = role;
50
50
  });
51
51
  helper.writeFileSync(path.join(rolesFolderPath, self.rolesConfig.fileName), self.customRoles);
@@ -54,13 +54,12 @@ module.exports = class ExportCustomRoles {
54
54
  if (error.statusCode === 401) {
55
55
  addlogs(
56
56
  self.config,
57
- chalk.red('You are not allowed to export roles, Unless you provide email and password in config'),
57
+ 'You are not allowed to export roles, Unless you provide email and password in config',
58
58
  'error',
59
59
  );
60
60
  return;
61
61
  }
62
- addlogs(self.config, 'Error occurred in exporting roles. ' + error && error.message, 'error');
63
- addlogs(self.config, formatError(error), 'error');
62
+ addlogs(self.config, `Error occurred in exporting roles. ${formatError(error)}`, 'error');
64
63
  throw error;
65
64
  }
66
65
  }
@@ -32,7 +32,7 @@ class EntriesExport {
32
32
  const locales = await fileHelper.readFile(this.localesFilePath);
33
33
  const contentTypes = await fileHelper.readFile(this.schemaFilePath);
34
34
  if (contentTypes.length === 0) {
35
- addlogs(this.exportConfig, 'No content types found to export entries');
35
+ addlogs(this.exportConfig, 'No content types found to export entries', 'info');
36
36
  return;
37
37
  }
38
38
  const entryRequestOptions = this.createRequestObjects(locales, contentTypes);
@@ -52,13 +52,13 @@ class EntriesExport {
52
52
  await fileHelper.writeLargeFile(entriesFilePath, entries);
53
53
  addlogs(
54
54
  this.exportConfig,
55
- `Exported entries of type ${requestOption.content_type} locale ${requestOption.locale}`,
55
+ `Exported entries of type '${requestOption.content_type}' locale '${requestOption.locale}'`,
56
56
  'success',
57
57
  );
58
58
  if (this.exportConfig.versioning) {
59
59
  addlogs(
60
60
  this.exportConfig,
61
- `Started export versioned entries of type ${requestOption.content_type} locale ${requestOption.locale}`,
61
+ `Started export versioned entries of type '${requestOption.content_type}' locale '${requestOption.locale}'`,
62
62
  'info',
63
63
  );
64
64
  for (let entry of entries) {
@@ -85,7 +85,7 @@ class EntriesExport {
85
85
  await executeTask(versionedEntries, write.bind(this), { concurrency: this.writeConcurrency });
86
86
  addlogs(
87
87
  this.exportConfig,
88
- `Exported versioned entries of type ${requestOption.content_type} locale ${requestOption.locale}`,
88
+ `Exported versioned entries of type '${requestOption.content_type}' locale '${requestOption.locale}'`,
89
89
  'success',
90
90
  );
91
91
  }
@@ -94,7 +94,7 @@ class EntriesExport {
94
94
  }
95
95
  addlogs(this.exportConfig, chalk.green('Entries exported successfully'), 'success');
96
96
  } catch (error) {
97
- addlogs(this.exportConfig, chalk.red(`Failed to export entries ${formatError(error)}`), 'error');
97
+ addlogs(this.exportConfig, `Failed to export entries ${formatError(error)}`, 'error');
98
98
  throw new Error('Failed to export entries');
99
99
  }
100
100
  }
@@ -66,7 +66,7 @@ module.exports = class ExportEnvironments {
66
66
  }
67
67
  })
68
68
  .catch((error) => {
69
- addlogs(self.config, `Environments export failed ${formatError(error)}`, 'error');
69
+ addlogs(self.config, `Environments export failed. ${formatError(error)}`, 'error');
70
70
  reject(error);
71
71
  });
72
72
  });
@@ -61,7 +61,7 @@ module.exports = class ExportExtensions {
61
61
  resolve();
62
62
  })
63
63
  .catch((error) => {
64
- addlogs(self.config, `Failed to export extensions ${formatError(error)}`, 'error');
64
+ addlogs(self.config, `Failed to export extensions. ${formatError(error)}`, 'error');
65
65
  reject();
66
66
  });
67
67
  });
@@ -95,7 +95,7 @@ module.exports = class ExportGlobalFields {
95
95
  }
96
96
  return self.getGlobalFields(skip, globalFieldConfig).then(resolve).catch(reject);
97
97
  } catch (error) {
98
- addlogs(globalFieldConfig, chalk.red(`Failed to export global-fields ${formatError(error)}`), 'error');
98
+ addlogs(globalFieldConfig, `Failed to export global-fields. ${formatError(error)}`, 'error');
99
99
  reject(error);
100
100
  }
101
101
  })
@@ -37,7 +37,7 @@ module.exports = class ExportLabels {
37
37
  .then((response) => {
38
38
  if (response.items.length !== 0) {
39
39
  response.items.forEach(function (label) {
40
- addlogs(self.config, label.name + ' labels was exported successfully', 'success');
40
+ addlogs(self.config, `'${label.name}' label was exported successfully`, 'success');
41
41
  self.labels[label.uid] = label;
42
42
  const deleteItems = self.config.modules.labels.invalidKeys;
43
43
  deleteItems.forEach((e) => delete label[e]);
@@ -53,15 +53,13 @@ module.exports = class ExportLabels {
53
53
  if (error.statusCode === 401) {
54
54
  addlogs(
55
55
  self.config,
56
- chalk.red(
57
- 'You are not allowed to export label, Unless you provide email and password in config',
58
- 'error',
59
- ),
56
+ 'You are not allowed to export label, Unless you provide email and password in config',
57
+ 'error'
60
58
  );
61
59
  return resolve();
62
60
  }
63
61
 
64
- addlogs(self.config, formatError(error), 'error');
62
+ addlogs(self.config, `Failed to export labels. ${formatError(error)}`, 'error');
65
63
  reject();
66
64
  });
67
65
  });
@@ -33,7 +33,7 @@ class LocaleExport {
33
33
  await fileHelper.writeFile(path.join(this.localesPath, this.masterLocaleConfig.fileName), this.masterLocale);
34
34
  addlogs(this.exportConfig, 'Completed locale export', 'success');
35
35
  } catch (error) {
36
- addlogs(this.exportConfig, chalk.red(`Failed to export locales ${formatError(error)}`), 'error');
36
+ addlogs(this.exportConfig, `Failed to export locales. ${formatError(error)}`, 'error');
37
37
  throw new Error('Failed to export locales');
38
38
  }
39
39
  }
@@ -107,11 +107,12 @@ module.exports = class ExportMarketplaceApps {
107
107
  }
108
108
 
109
109
  async exportInstalledExtensions() {
110
+ const client = await managementSDKClient({ host: this.developerHubBaseUrl.split("://").pop() })
110
111
  const installedApps = (await this.getAllStackSpecificApps()) || [];
111
112
 
112
113
  if (!_.isEmpty(installedApps)) {
113
114
  for (const [index, app] of _.entries(installedApps)) {
114
- await this.getAppConfigurations(installedApps, [+index, app]);
115
+ await this.getAppConfigurations(client, installedApps, [+index, app]);
115
116
  }
116
117
 
117
118
  await writeFileSync(path.join(this.marketplaceAppPath, this.marketplaceAppConfig.fileName), installedApps);
@@ -149,36 +150,38 @@ module.exports = class ExportMarketplaceApps {
149
150
  return listOfApps;
150
151
  })
151
152
  .catch((error) => {
152
- log(this.config, `Failed to export marketplace-apps ${formatError(error)}`, 'error');
153
+ log(this.config, `Failed to export marketplace-apps. ${formatError(error)}`, 'error');
153
154
  });
154
155
  }
155
156
 
156
- getAppConfigurations(installedApps, [index, app]) {
157
- const appName = app.manifest.name;
157
+ async getAppConfigurations(sdkClient, installedApps, [index, appInstallation]) {
158
+ const appName = appInstallation.manifest.name;
158
159
  log(this.config, `Exporting ${appName} app and it's config.`, 'success');
159
160
 
160
- return this.httpClient
161
- .get(`${this.developerHubBaseUrl}/installations/${app.uid}/installationData`)
162
- .then(async ({ data: result }) => {
163
- const { data, error } = result;
164
-
165
- if (_.has(data, 'server_configuration')) {
166
- if (!this.nodeCrypto && _.has(data, 'server_configuration')) {
167
- await this.createNodeCryptoInstance();
168
- }
169
-
170
- if (!_.isEmpty(data.server_configuration)) {
171
- installedApps[index]['server_configuration'] = this.nodeCrypto.encrypt(data.server_configuration);
172
- log(this.config, `Exported ${appName} app and it's config.`, 'success');
173
- } else {
174
- log(this.config, `Exported ${appName} app`, 'success');
175
- }
176
- } else if (error) {
177
- log(this.config, `Error on exporting ${appName} app and it's config.`, 'error');
161
+ await sdkClient
162
+ .organization(this.config.org_uid)
163
+ .app(appInstallation.manifest.uid)
164
+ .installation(appInstallation.uid)
165
+ .installationData()
166
+ .then(async result => {
167
+ const {data, error} = result;
168
+ if (_.has(data, 'server_configuration')) {
169
+ if (!this.nodeCrypto && _.has(data, 'server_configuration')) {
170
+ await this.createNodeCryptoInstance();
178
171
  }
179
- })
180
- .catch((err) => {
181
- log(this.config, `Failed to export ${appName} app config ${formatError(err)}`, 'error');
182
- });
172
+
173
+ if (!_.isEmpty(data.server_configuration)) {
174
+ installedApps[index]['server_configuration'] = this.nodeCrypto.encrypt(data.server_configuration);
175
+ log(this.config, `Exported ${appName} app and it's config.`, 'success');
176
+ } else {
177
+ log(this.config, `Exported ${appName} app`, 'success');
178
+ }
179
+ } else if (error) {
180
+ log(this.config, `Error on exporting ${appName} app and it's config.`, 'error');
181
+ }
182
+ })
183
+ .catch(err => {
184
+ log(this.config, `Failed to export ${appName} app config ${formatError(err)}`, 'error');
185
+ })
183
186
  }
184
187
  };
@@ -33,7 +33,6 @@ module.exports = class ExportStack {
33
33
  .stack({ api_key: self.config.source_stack })
34
34
  .fetch()
35
35
  .catch((error) => {
36
- console.log(error);
37
36
  });
38
37
 
39
38
  if (tempStackData && tempStackData.org_uid) {
@@ -63,13 +63,13 @@ module.exports = class ExportWebhooks {
63
63
  if (error.statusCode === 401) {
64
64
  addlogs(
65
65
  self.config,
66
- chalk.red('You are not allowed to export webhooks, Unless you provide email and password in config'),
66
+ 'You are not allowed to export webhooks, Unless you provide email and password in config',
67
67
  'error',
68
68
  );
69
69
  return resolve();
70
70
  }
71
- addlogs(self.config, formatError(error), 'error');
72
- reject('Failed export webhooks');
71
+ addlogs(self.config, `Failed to export webhooks. ${formatError(error)}`, 'error');
72
+ reject('Failed to export webhooks');
73
73
  });
74
74
  });
75
75
  }
@@ -59,10 +59,8 @@ module.exports = class ExportWorkFlows {
59
59
  if (error.statusCode === 401) {
60
60
  addlogs(
61
61
  self.config,
62
- chalk.red(
63
- 'You are not allowed to export workflow, Unless you provide email and password in config',
64
- 'error',
65
- ),
62
+ 'You are not allowed to export workflow, Unless you provide email and password in config',
63
+ 'error',
66
64
  );
67
65
  return resolve();
68
66
  }
@@ -86,8 +84,7 @@ module.exports = class ExportWorkFlows {
86
84
  }
87
85
  }
88
86
  } catch (error) {
89
- console.log('Error getting roles', error && error.message);
90
- addlogs(self.config, 'Error fetching roles in export workflows task.', 'error');
87
+ addlogs(self.config, `Error fetching roles in export workflows task. ${formatError(error)}`, 'error');
91
88
  throw new Error({ message: 'Error fetching roles in export workflows task.' });
92
89
  }
93
90
  }
@@ -102,8 +99,7 @@ module.exports = class ExportWorkFlows {
102
99
  deleteItems.forEach((e) => delete workflow[e]);
103
100
  }
104
101
  } catch (error) {
105
- console.log('Error getting workflow data', error && error.message);
106
- addlogs(self.config, 'Error fetching workflow data in export workflows task.', 'error');
102
+ addlogs(self.config, `Error fetching workflow data in export workflows task. ${formatError(error)}`, 'error');
107
103
  throw error;
108
104
  }
109
105
  }
@@ -89,7 +89,10 @@ function init(_logPath) {
89
89
  errorLogger = winston.createLogger({
90
90
  transports: [
91
91
  new winston.transports.File(errorTransport),
92
- new winston.transports.Console({ level: 'error', format: winston.format.simple() }),
92
+ new winston.transports.Console({
93
+ level: 'error',
94
+ format: winston.format.combine(winston.format.colorize({ all: true,colors:{ error: 'red'} }), winston.format.simple()),
95
+ }),
93
96
  ],
94
97
  levels: { error: 0 },
95
98
  });