hof 24.5.1 → 24.6.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 2026-10-07 Version 24.5.2 (Stable), @vivekkumar-ho
2
+
3
+ ### Fixes
4
+ - Preserved original Notify errors and their response payloads, and removed duplicate failure logging.
5
+
6
+ ### Chore & Maintenance
7
+ - Replaced Notify email reference generation with Node.js `crypto.randomUUID`.
8
+ - Added Notify coverage for email payloads, UUID references, attachments, and error propagation and logging.
9
+
1
10
  ## 2026-09-14 Version 24.5.1 (Stable), @nzorba @dk4g @dalglishdhandaHO
2
11
 
3
12
  ### Changed
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const NotifyClient = require('notifications-node-client').NotifyClient;
4
- const { v4: uuidv4 } = require('uuid');
4
+ const { randomUUID } = require('node:crypto');
5
5
  const config = require('../../config/hof-defaults');
6
6
  const logger = require('../../lib/logger');
7
7
 
@@ -10,41 +10,42 @@ module.exports = class Notify {
10
10
  const options = opts || {};
11
11
  this.options = options;
12
12
  this.logger = logger(config);
13
- this.notifyClient = new NotifyClient(options.notifyApiKey);
13
+ this.notifyClient = new NotifyClient(options.notifyApiKey);
14
14
  this.notifyTemplate = options.notifyTemplate;
15
15
  }
16
16
 
17
17
  async sendEmail(templateId, recipient, personalisation) {
18
- const reference = uuidv4();
18
+ const reference = randomUUID();
19
19
 
20
20
  try {
21
21
  await this.notifyClient.sendEmail(templateId, recipient, {
22
22
  personalisation: personalisation,
23
- reference });
23
+ reference
24
+ });
24
25
  this.logger.log('info', 'Email sent');
25
26
  } catch (error) {
26
- this.logger.log('error', error.response ? error.response.data : error.message);
27
- throw new Error(error.response ? error.response.data : error.message);
27
+ this.logger.log(
28
+ 'error',
29
+ error.response ? error.response.data : error.message
30
+ );
31
+ // Preserve the original Notify error and its response payload.
32
+ throw error;
28
33
  }
29
34
  }
30
35
 
31
36
  async send(email) {
32
- let personalisation = {
37
+ const personalisation = {
33
38
  'email-subject': email.subject,
34
39
  'email-body': email.body
35
40
  };
36
41
 
37
- if (email.attachment && email.attachment !== undefined) {
38
- personalisation = Object.assign({'email-attachment':
39
- this.notifyClient.prepareUpload(email.attachment)}, personalisation);
42
+ if (email.attachment) {
43
+ personalisation['email-attachment'] = this.notifyClient.prepareUpload(
44
+ email.attachment
45
+ );
40
46
  }
41
47
 
42
- try {
43
- await this.sendEmail(this.notifyTemplate, email.recipient, personalisation);
44
- } catch (error) {
45
- this.logger.log('error', error.response ? error.response.data : error.message);
46
- throw new Error(error.response ? error.response.data : error.message);
47
- }
48
+ await this.sendEmail(this.notifyTemplate, email.recipient, personalisation);
48
49
  }
49
50
  };
50
51
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "24.5.1",
4
+ "version": "24.6.0",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -79,7 +79,7 @@
79
79
  "mixwith": "^0.1.1",
80
80
  "morgan": "^1.11.0",
81
81
  "mustache": "^4.2.0",
82
- "notifications-node-client": "^8.4.0",
82
+ "notifications-node-client": "^8.5.0",
83
83
  "redis": "^3.1.2",
84
84
  "reqres": "^3.0.1",
85
85
  "rimraf": "^3.0.2",
@@ -135,6 +135,7 @@
135
135
  "exit": "true"
136
136
  },
137
137
  "resolutions": {
138
+ "vite": "^7.3.6",
138
139
  "form-data": "^4.0.6",
139
140
  "js-yaml": "^4.2.0",
140
141
  "qs": "^6.14.1",