@eui/tools 6.4.2 → 6.4.4

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.
@@ -1 +1 @@
1
- 6.4.2
1
+ 6.4.4
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## 6.4.4 (2023-02-23)
2
+
3
+ ##### Chores
4
+
5
+ * **other:**
6
+ * send msteams channel email to gitlab vars for XLR processing - EUI-7146 [EUI-7146](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7146) ([665f70bb](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/665f70bb7fea498c15577810deb129bb2ba2a287))
7
+
8
+ * * *
9
+ * * *
10
+ ## 6.4.3 (2023-02-23)
11
+
12
+ ##### Chores
13
+
14
+ * **other:**
15
+ * limit the number of commit output for MS Teams message - EUI-7146 [EUI-7146](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7146) ([616070b3](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/616070b3daaaae67fc5753c490290c14f9790738))
16
+ * adapted teams notification message for exception and commits outpuy - EUI-7146 [EUI-7146](https://webgate.ec.europa.eu/CITnet/jira/browse/EUI-7146) ([58f0f958](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/58f0f9587af636311c43d9a979ea3d4acb5c5511))
17
+
18
+ * * *
19
+ * * *
1
20
  ## 6.4.2 (2023-02-22)
2
21
 
3
22
  ##### Chores
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eui/tools",
3
- "version": "6.4.2",
3
+ "version": "6.4.4",
4
4
  "tag": "latest",
5
5
  "license": "EUPL-1.1",
6
6
  "description": "eUI common tools and scripts",
package/sandbox.js CHANGED
@@ -1181,9 +1181,33 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
1181
1181
  // })
1182
1182
 
1183
1183
 
1184
- const teamsUtils = require('./scripts/utils/notification/teams-utils');
1184
+ // const teamsUtils = require('./scripts/utils/notification/teams-utils');
1185
+
1186
+ // Promise.resolve()
1187
+ // .then(() => {
1188
+ // console.log(teamsUtils.getChannelHook('pipeline-ui-edui'));
1189
+ // })
1190
+
1191
+ // Promise.resolve()
1192
+ // .then(() => {
1193
+
1194
+ // var startTime = moment('03-01-2021 01:01:01', 'DD-MM-YYYY hh:mm:ss');
1195
+ // var endTime = moment('03-01-2021 01:04:53', 'DD-MM-YYYY hh:mm:ss');
1196
+
1197
+ // var secondsDiff = endTime.diff(startTime, 's');
1198
+
1199
+ // const getMinSec = (s) => { return(s-(s%=60))/60+'m'+(9<s?':':':0')+s+'s'; }
1200
+ // const minSec = getMinSec(secondsDiff);
1201
+ // console.log(minSec);
1202
+ // })
1185
1203
 
1186
1204
  Promise.resolve()
1187
1205
  .then(() => {
1188
- console.log(teamsUtils.getChannelHook('pipeline-ui-edui'));
1206
+ const options = configUtils.global.getConfigOptions();
1207
+ console.log(options);
1208
+
1209
+ const pkg = configUtils.packages.getPackage('mapar-administration-ui');
1210
+ const config = notificationUtils.config.getPackageConfig(pkg);
1211
+
1212
+ console.log(config);
1189
1213
  })
@@ -4,6 +4,7 @@
4
4
  "composite": {
5
5
  "@eui/deps-base": "^15.0.0",
6
6
  "@module.scope@/@module.name@": "^1.0.0",
7
+ "@cc/shared": "^4.0.0",
7
8
  "@csdr/core": "^4.0.0",
8
9
  "@csdr/integration": "^3.0.0"
9
10
  },
@@ -229,13 +229,11 @@ module.exports.getConfigOptions = () => {
229
229
  SLACK_CHANNEL_FRONTEND: null,
230
230
  SLACK_CHANNEL_BACKEND: null,
231
231
  SLACK_CHANNEL_PROJECT: null,
232
- MAIL_ADDRESS_FRONTEND: null,
233
- MAIL_ADDRESS_BACKEND: null,
234
- MAIL_ADDRESS_PROJECT: null,
235
232
  MSTEAMS_HOST: null,
236
233
  MSTEAMS_FRONTEND_CHANNEL: null,
237
234
  MSTEAMS_BACKEND_CHANNEL: null,
238
235
  MSTEAMS_PROJECT_CHANNEL: null,
236
+ MSTEAMS_CHANNELS_EMAILS: null,
239
237
  API_HOST: null,
240
238
  AUDIT_DEPENDENCIES_GATES: null,
241
239
  }
@@ -327,22 +325,6 @@ module.exports.getConfigOptions = () => {
327
325
  }
328
326
  }
329
327
 
330
- const mail = notification.mail;
331
-
332
- if (mail) {
333
- if (mail.channels) {
334
- if (mail.channels.frontend) {
335
- configOptions.MAIL_ADDRESS_FRONTEND = this.getNotificationMailAddress(mail.channels.frontend);
336
- }
337
- if (mail.channels.backend) {
338
- configOptions.MAIL_ADDRESS_BACKEND = this.getNotificationMailAddress(mail.channels.backend);
339
- }
340
- if (mail.channels.project) {
341
- configOptions.MAIL_ADDRESS_PROJECT = this.getNotificationMailAddress(mail.channels.project);
342
- }
343
- }
344
- }
345
-
346
328
  const msteams = notification.msteams;
347
329
 
348
330
  if (msteams) {
@@ -361,6 +343,10 @@ module.exports.getConfigOptions = () => {
361
343
  configOptions.MSTEAMS_PROJECT_CHANNEL = msteams.channels.project;
362
344
  }
363
345
  }
346
+
347
+ if (msteams.channelsEmails) {
348
+ configOptions.MSTEAMS_CHANNELS_EMAILS = msteams.channelsEmails;
349
+ }
364
350
  }
365
351
  }
366
352
 
@@ -395,42 +381,6 @@ module.exports.getConfigOptions = () => {
395
381
  }
396
382
 
397
383
 
398
- module.exports.getNotificationMailChannel = (channelName) => {
399
- const config = this.getConfig();
400
- var channelPrefix;
401
-
402
- if (config && config.notification && config.notification.mail && config.notification.mail.channelsMap) {
403
- channelPrefix = config.notification.mail.channelsMap[channelName];
404
- if (!channelPrefix) {
405
- channelPrefix = config.notification.mail.channelsMap[config.notification.mail.defaultChannel];
406
- }
407
- }
408
-
409
- return channelPrefix;
410
- }
411
-
412
- module.exports.getNotificationMailAddress = (channelName) => {
413
- const config = this.getConfig();
414
-
415
- const getChannel = (channelName) => {
416
- let channelPrefix;
417
-
418
- if (config && config.notification && config.notification.mail && config.notification.mail.channelsMap) {
419
- channelPrefix = config.notification.mail.channelsMap[channelName];
420
- if (!channelPrefix) {
421
- channelPrefix = config.notification.mail.channelsMap[config.notification.mail.defaultChannel];
422
- }
423
- }
424
-
425
- return channelPrefix;
426
- }
427
-
428
- const channelPrefix = getChannel(channelName);
429
-
430
- return channelPrefix + config.notification.mail.addressSuffix;
431
- }
432
-
433
-
434
384
  module.exports.getLocalEuiVersion = () => {
435
385
  let euiVersionsLocal = [
436
386
  ...innerPackages.getLocalPackagesEuiVersion(),
package/scripts/index.js CHANGED
@@ -31,7 +31,6 @@ module.exports.cleanUtils = require('./utils/clean/clean-utils');
31
31
  // utils - notification
32
32
  module.exports.notificationCommon = require('./utils/notification/common');
33
33
  module.exports.notificationConfig = require('./utils/notification/config');
34
- module.exports.notificationMailUtils = require('./utils/notification/mail-utils');
35
34
  module.exports.notificationMessageStack = require('./utils/notification/message-stack');
36
35
  module.exports.notificationUtils = require('./utils/notification/notification-utils');
37
36
  module.exports.notificationPackage = require('./utils/notification/package');
@@ -12,6 +12,7 @@ module.exports.getMessage = (options) => {
12
12
  mainText: null,
13
13
  detailTitle: null,
14
14
  detailText: null,
15
+ detailTextArray: [],
15
16
  text: options.text || null,
16
17
  status: null,
17
18
  statusColor: null
@@ -41,55 +42,57 @@ module.exports.getMessage = (options) => {
41
42
  switch (options.exception) {
42
43
  case 'NO_VALID_COMMIT_FOUND':
43
44
  message.detailTitle = 'NO VALID COMMIT FOUND!';
44
- message.detailText = 'No valid commit found since last release tag\n' + '...Check trace file for details';
45
+ message.detailTextArray.push('No valid commit found since last release tag');
45
46
  break;
46
47
 
47
48
  case 'NO_ISSUE_FOUND':
48
49
  message.detailTitle = 'NO ISSUE FOUND!';
49
- message.detailText = 'No issue found on commits since last release tag\n' + '...Check trace file for details\n';
50
+ message.detailTextArray.push('No issue found on commits since last release tag');
51
+ message.detailTextArray.push('Commit details:');
50
52
  if (options.metadata.commits && options.metadata.commits.length !== 0) {
51
- message.detailText += options.metadata.commits.map((commit) => {
53
+ const commits = options.metadata.commits.map((commit) => {
52
54
  return metadataUtils.commit.formatCommit(commit);
53
- }).join('\n');
55
+ });
56
+ message.detailTextArray = [...message.detailTextArray, ...commits];
54
57
  }
55
58
  break;
56
59
 
57
60
  case 'GLOBAL_PIPELINE_DISABLED':
58
61
  message.detailTitle = 'PIPELINE GLOBALLY DISABLED!';
59
- message.detailText = 'Due to maintenance, all pipeline jobs have been temporary disabled - retry later';
62
+ message.detailTextArray.push('Due to maintenance, all pipeline jobs have been temporary disabled - retry later');
60
63
  break;
61
64
 
62
65
  case 'PACKAGE_LOCKED':
63
66
  message.detailTitle = 'CONCURRENT BUILD DETECTED FOR PACKAGE - ABORTING!';
64
- message.detailText = 'Another build has been detected for the current package being build\n Retry again this build after 15m, lock will be auto-cleared';
67
+ message.detailTextArray.push('Another build has been detected for the current package being build\n Retry again this build after 15m, lock will be auto-cleared');
65
68
  break;
66
69
 
67
70
  case 'MULTIPLE_LOCAL_EUI_VERSIONS_FOUND':
68
71
  message.detailTitle = 'MULTIPLE eUI VERSIONS FOUND IN LOCAL PROJECT - ABORTING!';
69
- message.detailText = 'Uncompatible version of eUI found installed in the local CSDR project, please adjust and keep same compatible versions of eUI packages and projects';
72
+ message.detailTextArray.push('Uncompatible version of eUI found installed in the local CSDR project, please adjust and keep same compatible versions of eUI packages and projects');
70
73
  break;
71
74
 
72
75
  case 'BRANCH_NOT_PROVIDED':
73
76
  message.detailTitle = 'RELEASE BRANCH missing - ABORTING!';
74
- message.detailText = 'Package release needs to have a branch to build from as parameter from Bamboo';
77
+ message.detailTextArray.push('Package release needs to have a branch to build from as parameter from Bamboo');
75
78
  break;
76
79
 
77
80
  case 'REMOTE_ENVTARGET_NOT_MASTER_BRANCH':
78
81
  message.detailTitle = 'REMOTE envTarget type branchis different from master - ABORTING!';
79
- message.detailText = 'For envTarget remote delivery or "à la carte", only the master branch is allowed for build, contact support if any question';
82
+ message.detailTextArray.push('For envTarget remote delivery or "à la carte", only the master branch is allowed for build, contact support if any question');
80
83
  break;
81
84
 
82
85
  case 'AUDIT_DEPENDENCIES_GATES_FAILED':
83
- message.detailTitle = 'Audit dependencies gates for current eUI version contains blocking vulnerabilities - ABORTING!';
84
- message.detailText = 'Check logs for more info or contact eUI support for detailed checks';
86
+ message.detailTitle = 'AUDIT DEPENDENCIES GATES FAILED';
87
+ message.detailTextArray.push('Audit dependencies gates for current eUI version contains blocking vulnerabilities - ABORTING!');
85
88
  break;
86
89
 
87
90
  default:
88
91
  message.detailTitle = 'GENERAL ERROR!';
89
- message.detailText = options.exception;
92
+ message.detailTextArray.push(options.exception);
90
93
  };
91
94
 
92
-
95
+ message.detailText = message.detailTextArray.join('\n');
93
96
 
94
97
  } else {
95
98
 
@@ -106,12 +109,16 @@ module.exports.getMessage = (options) => {
106
109
 
107
110
  if (options.metadata && options.metadata.commits && options.metadata.commits.length !== 0) {
108
111
  message.detailTitle = 'Commit history since last release tag';
109
- message.detailText = options.metadata.commits.map((commit) => {
112
+ const formattedCommits = options.metadata.commits.map((commit) => {
110
113
  return metadataUtils.commit.formatCommit(commit);
111
- }).join('\n ');
114
+ });
115
+ message.detailText = formattedCommits.join('\n ');
116
+ message.detailTextArray = formattedCommits;
112
117
 
113
118
  if (options.metadata.issues && options.metadata.issues.length !== 0) {
114
- message.detailText += '\nExtracted issues : ' + options.metadata.issues;
119
+ const extractedIssuesText = 'Extracted issues : ' + options.metadata.issues;
120
+ message.detailText += '\n' + extractedIssuesText;
121
+ message.detailTextArray.push(extractedIssuesText);
115
122
  }
116
123
  }
117
124
  }
@@ -12,15 +12,14 @@ module.exports.getPackageConfig = (pkg) => {
12
12
  // Fetching global config - default if not overriden in package own config
13
13
  const globalConfig = configUtils.global.getConfigOptions();
14
14
 
15
- var slackChannel, mailAdress, msTeamsChannel, msTeamsHook;
15
+ let slackChannel, msTeamsChannel;
16
+
16
17
 
17
18
  if (pkg.backend) {
18
19
  slackChannel = globalConfig.SLACK_CHANNEL_BACKEND;
19
- mailAdress = globalConfig.MAIL_ADDRESS_BACKEND;
20
20
  msTeamsChannel = globalConfig.MSTEAMS_BACKEND_CHANNEL;
21
21
  } else {
22
22
  slackChannel = globalConfig.SLACK_CHANNEL_FRONTEND;
23
- mailAdress = globalConfig.MAIL_ADDRESS_FRONTEND;
24
23
  msTeamsChannel = globalConfig.MSTEAMS_FRONTEND_CHANNEL;
25
24
  }
26
25
 
@@ -32,15 +31,11 @@ module.exports.getPackageConfig = (pkg) => {
32
31
  SLACK_HOOK: globalConfig.SLACK_HOOK,
33
32
  SLACK_CHANNEL: slackChannel
34
33
  }
35
- } else if (globalConfig.NOTIFICATION_CLIENT === 'MAIL') {
36
- return {
37
- CLIENT: globalConfig.NOTIFICATION_CLIENT,
38
- MAIL_ADDRESS: mailAdress
39
- }
40
34
  } else if (globalConfig.NOTIFICATION_CLIENT === 'SLACK') {
41
35
  return {
42
36
  CLIENT: globalConfig.NOTIFICATION_CLIENT,
43
37
  MSTEAMS_CHANNEL: msTeamsChannel,
38
+ MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[msTeamsChannel]
44
39
  }
45
40
  }
46
41
 
@@ -61,15 +56,11 @@ module.exports.getPackageConfig = (pkg) => {
61
56
  SLACK_HOOK: globalConfig.SLACK_HOOK,
62
57
  SLACK_CHANNEL: pkg.notification.channel
63
58
  }
64
- } else if (pkg.notification.client === 'MAIL') {
65
- return {
66
- CLIENT: pkg.notification.client,
67
- MAIL_ADDRESS: configUtils.global.getNotificationMailAddress(pkg.notification.channel)
68
- }
69
59
  } else if (pkg.notification.client === 'MSTEAMS') {
70
60
  return {
71
61
  CLIENT: pkg.notification.client,
72
62
  MSTEAMS_CHANNEL: pkg.notification.channel,
63
+ MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[pkg.notification.channel]
73
64
  }
74
65
  }
75
66
  }
@@ -88,15 +79,11 @@ module.exports.getProjectConfig = (project) => {
88
79
  SLACK_HOOK: globalConfig.SLACK_HOOK,
89
80
  SLACK_CHANNEL: globalConfig.SLACK_CHANNEL_PROJECT
90
81
  }
91
- } else if (globalConfig.NOTIFICATION_CLIENT === 'MAIL') {
92
- return {
93
- CLIENT: globalConfig.NOTIFICATION_CLIENT,
94
- MAIL_ADDRESS: globalConfig.MAIL_ADDRESS_PROJECT
95
- }
96
82
  } else if (globalConfig.NOTIFICATION_CLIENT === 'MSTEAMS') {
97
83
  return {
98
84
  CLIENT: globalConfig.NOTIFICATION_CLIENT,
99
85
  MSTEAMS_CHANNEL: globalConfig.MSTEAMS_PROJECT_CHANNEL,
86
+ MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[globalConfig.MSTEAMS_PROJECT_CHANNEL]
100
87
  }
101
88
  }
102
89
 
@@ -117,15 +104,11 @@ module.exports.getProjectConfig = (project) => {
117
104
  SLACK_HOOK: globalConfig.SLACK_HOOK,
118
105
  SLACK_CHANNEL: project.notification.channel
119
106
  }
120
- } else if (project.notification.client === 'MAIL') {
121
- return {
122
- CLIENT: project.notification.client,
123
- MAIL_ADDRESS: configUtils.global.getNotificationMailAddress(project.notification.channel)
124
- }
125
107
  } else if (project.notification.client === 'MSTEAMS') {
126
108
  return {
127
109
  CLIENT: globalConfig.NOTIFICATION_CLIENT,
128
110
  MSTEAMS_CHANNEL: project.notification.channel,
111
+ MSTEAMS_CHANNEL_EMAIL: globalConfig.MSTEAMS_CHANNELS_EMAILS[project.notification.channel]
129
112
  }
130
113
  }
131
114
  }
@@ -133,14 +116,14 @@ module.exports.getProjectConfig = (project) => {
133
116
  }
134
117
 
135
118
 
136
- module.exports.storeConfig = (rootPath, slackHook, slackChannel, mailAddress, msTeamsChannel) => {
119
+ module.exports.storeConfig = (rootPath, slackHook, slackChannel, msTeamsChannel, msTeamsChannelEmail) => {
137
120
  return Promise.resolve()
138
121
  .then(() => {
139
122
  var content = '';
140
123
  content += `export SLACK_HOOK=${slackHook}\n`;
141
124
  content += `export SLACK_CHANNEL=${slackChannel}\n`;
142
- content += `export MAIL_ADDRESS=${mailAddress}\n`;
143
125
  content += `export MSTEAMS_CHANNEL=${msTeamsChannel}\n`;
126
+ content += `export MSTEAMS_CHANNEL_EMAIL=${msTeamsChannelEmail}\n`;
144
127
  return pipelineUtils.setVariables(rootPath, content);
145
128
  })
146
129
 
@@ -153,8 +136,11 @@ module.exports.storePackageConfig = (pkg) => {
153
136
  return Promise.resolve()
154
137
  .then(() => {
155
138
  const config = this.getPackageConfig(pkg);
139
+
156
140
  return this.storeConfig(
157
- process.cwd(), config.SLACK_HOOK, config.SLACK_CHANNEL, config.MAIL_ADDRESS, config.MSTEAMS_CHANNEL
141
+ process.cwd(),
142
+ config.SLACK_HOOK, config.SLACK_CHANNEL,
143
+ config.MSTEAMS_CHANNEL, config.MSTEAMS_CHANNEL_EMAIL
158
144
  );
159
145
  })
160
146
 
@@ -167,8 +153,11 @@ module.exports.storeProjectConfig = (project) => {
167
153
  return Promise.resolve()
168
154
  .then(() => {
169
155
  const config = this.getProjectConfig(project);
156
+
170
157
  return this.storeConfig(
171
- project.paths.rootPath, config.SLACK_HOOK, config.SLACK_CHANNEL, config.MAIL_ADDRESS, config.MSTEAMS_CHANNEL
158
+ project.paths.rootPath,
159
+ config.SLACK_HOOK, config.SLACK_CHANNEL,
160
+ config.MSTEAMS_CHANNEL, config.MSTEAMS_CHANNEL_EMAIL
172
161
  );
173
162
  })
174
163
 
@@ -22,6 +22,7 @@ const messageContent = {
22
22
  startTimestamp: null,
23
23
  endTimestamp: null,
24
24
  duration: null,
25
+ durationSeconds: null,
25
26
  durationMinSec: null
26
27
  };
27
28
 
@@ -33,7 +34,9 @@ module.exports.endStack = () => {
33
34
  messageContent.endTimestamp = moment();
34
35
  messageContent.duration = messageContent.endTimestamp - messageContent.startTimestamp;
35
36
  const start = messageContent.startTimestamp, end = messageContent.endTimestamp;
36
- messageContent.durationMinSec = `${end.diff(start, 'm')}m:${end.diff(start, 's')}s`;
37
+ messageContent.durationSeconds = end.diff(start, 's');
38
+ const getMinSec = (s) => { return(s-(s%=60))/60+'m'+(9<s?':':':0')+s+'s'; }
39
+ messageContent.durationMinSec = getMinSec(messageContent.durationSeconds);
37
40
  }
38
41
 
39
42
  module.exports.pushMessage = (message) => {
@@ -50,9 +53,6 @@ const sendMessage = (config) => {
50
53
  .then(() => {
51
54
  if (config.CLIENT === 'MSTEAMS') {
52
55
  return innerTeamsUtils.sendMessage(config, messageContent);
53
-
54
- } else if (config.CLIENT === 'MAIL') {
55
- // TODO IF MAIL NOTIF IS NEEDED...
56
56
  }
57
57
  })
58
58
  .catch((e) => {
@@ -54,11 +54,19 @@ const createPayload = (messageContent) => {
54
54
  const version = finalMessage.version;
55
55
 
56
56
  // set commit history
57
- const commitHistory = "```" + finalMessage.detailText;
57
+ let commitHistory = [], exceptionDetails = [];
58
+ if (status === statuses.success) {
59
+ commitHistory = finalMessage.detailTextArray;
60
+ } else {
61
+ exceptionDetails = finalMessage.detailTextArray;
62
+ }
58
63
 
59
64
  // set summary
60
65
  const itemName = messageContent.buffer[0].scope;
61
- const summary = `${status.emoji} :: ${status.text} - ${itemName} - ${version}`;
66
+ let summary = `${status.emoji} :: ${status.text} - ${itemName}`;
67
+ if (version) {
68
+ summary += ` - ${version}`;
69
+ }
62
70
 
63
71
  // set release sections
64
72
  const publications = messageContent.buffer.filter(m => m.text !== null && m.text.indexOf(':rocket:') > -1);
@@ -71,11 +79,29 @@ const createPayload = (messageContent) => {
71
79
  }
72
80
  });
73
81
 
74
- sections.push({
75
- "startGroup": true,
76
- "activityTitle": "Commit history since last release tag",
77
- "activityText": commitHistory
78
- });
82
+ if (commitHistory.length > 0) {
83
+ sections.push({
84
+ "startGroup": true,
85
+ "activityTitle": "Commit history since last release tag"
86
+ });
87
+ commitHistory.slice(0, 5).forEach((commit) => {
88
+ sections.push({
89
+ "activityText": commit
90
+ });
91
+ });
92
+ }
93
+
94
+ if (exceptionDetails.length > 0) {
95
+ sections.push({
96
+ "startGroup": true,
97
+ "activityTitle": finalMessage.detailTitle
98
+ });
99
+ exceptionDetails.forEach((exd) => {
100
+ sections.push({
101
+ "activityText": exd
102
+ });
103
+ });
104
+ }
79
105
 
80
106
  sections.push({
81
107
  "startGroup": true,
@@ -78,8 +78,8 @@ function getArgs() {
78
78
  const newItem = {};
79
79
  newItem[subItemSplit[0].trim()] = subItemSplit[1].trim();
80
80
  array.push(newItem);
81
- args[item.split(':')[0]] = array;
82
81
  })
82
+ args[item.split(':')[0]] = array;
83
83
 
84
84
  // otherwise normal key/value pairs - example format : test1:test1,test2:test2
85
85
  } else {
@@ -1,59 +0,0 @@
1
- 'use strict';
2
-
3
-
4
- // LOCALS
5
- const tools = require('../tools');
6
-
7
- let { dryRun, debug} = tools.getArgs();
8
-
9
-
10
- const sendCore = (subject, body, recipient) => {
11
- const sendmail = require('sendmail')(); // if used in the future and needed this deps is required : "sendmail": "1.6.1"
12
-
13
- tools.logInfo(`Sending mail to : ${recipient}`);
14
- tools.logInfo('Message subject / body :');
15
- console.log(subject);
16
- console.log(body);
17
-
18
- if (dryRun) {
19
- console.log('----------------------------------------------');
20
- console.log('----------------------------------------------');
21
- console.log(subject);
22
- console.log('----------------------------------------------');
23
- console.log(body);
24
- console.log('----------------------------------------------');
25
- console.log(recipient);
26
- console.log('----------------------------------------------');
27
- console.log('----------------------------------------------');
28
-
29
- } else {
30
-
31
- return new Promise((resolve, reject) => {
32
- sendmail({
33
- from: 'automated-notifications@nomail.ec.europa.eu',
34
- to: recipient,
35
- subject: subject,
36
- html: body
37
- }, function (err, reply) {
38
- if (err) {
39
- console.log(err && err.stack);
40
- reject(err);
41
- } else {
42
- console.dir(reply);
43
- resolve();
44
- }
45
- })
46
- })
47
-
48
- }
49
- }
50
-
51
- module.exports.sendMessage = (subject, message, recipient) => {
52
- return Promise.resolve()
53
- .then(() => {
54
- return sendCore(subject, message, recipient);
55
- })
56
- .catch(e => {
57
- throw e;
58
- })
59
- }