notifications-node-client 7.0.0 → 7.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 7.0.1 - 2023-07-13
2
+
3
+ * Fix a bug with default behaviour for `confirmEmailBeforeDownload`, which coalesced false to null.
4
+
1
5
  ## 7.0.0 - 2023-01-12
2
6
 
3
7
  * Remove support for node versions below v14.17.3.
package/DOCUMENTATION.md CHANGED
@@ -291,15 +291,13 @@ To send a file by email, add a placeholder to the template then upload a file. T
291
291
 
292
292
  The links are unique and unguessable. GOV.UK Notify cannot access or decrypt your file.
293
293
 
294
- Your file will be available to download for a default period of 78 weeks (18 months). From 29 March 2023 we will reduce this to 26 weeks (6 months) for all new files. Files sent before 29 March will not be affected.
294
+ Your file will be available to download for a default period of 26 weeks (6 months).
295
295
 
296
296
  To help protect your files you can also:
297
297
 
298
298
  * ask recipients to confirm their email address before downloading
299
299
  * choose the length of time that a file is available to download
300
300
 
301
- To turn these features on or off, you will need version 5.2.0 of the Node.js client library or a more recent version.
302
-
303
301
  #### Add contact details to the file download page
304
302
 
305
303
  1. [Sign in to GOV.UK Notify](https://www.notifications.service.gov.uk/sign-in).
@@ -363,38 +361,13 @@ fs.readFile('path/to/document.csv', function (err, csvFile) {
363
361
 
364
362
  #### Ask recipients to confirm their email address before they can download the file
365
363
 
366
- This new security feature is optional. You should use it if you send files that are sensitive - for example, because they contain personal information about your users.
367
-
368
364
  When a recipient clicks the link in the email you’ve sent them, they have to enter their email address. Only someone who knows the recipient’s email address can download the file.
369
365
 
370
- From 29 March 2023, we will turn this feature on by default for every file you send. Files sent before 29 March will not be affected.
371
-
372
- ##### Turn on email address check
373
-
374
- To use this feature before 29 March 2023 you will need version 5.2.0 of the Node.js client library, or a more recent version.
375
-
376
- To make the recipient confirm their email address before downloading the file, set the `confirmEmailBeforeDownload` option to `true`.
377
-
378
- You will not need to do this after 29 March.
379
-
380
- ```javascript
381
- var fs = require('fs')
382
-
383
- fs.readFile('path/to/document.pdf', function (err, pdfFile) {
384
- console.log(err)
385
- notifyClient.sendEmail(templateId, emailAddress, {
386
- personalisation: {
387
- first_name: 'Amala',
388
- application_date: '2018-01-01',
389
- link_to_file: notifyClient.prepareUpload(pdfFile, { confirmEmailBeforeDownload: true })
390
- }
391
- }).then(response => console.log(response)).catch(err => console.error(err))
392
- })
393
- ```
366
+ This security feature is turned on by default.
394
367
 
395
368
  ##### Turn off email address check (not recommended)
396
369
 
397
- If you do not want to use this feature after 29 March 2023, you can turn it off on a file-by-file basis.
370
+ If you do not want to use this feature, you can turn it off on a file-by-file basis.
398
371
 
399
372
  To do this you will need version 5.2.0 of the Node.js client library, or a more recent version.
400
373
 
@@ -429,7 +402,9 @@ You can choose any value between 1 week and 78 weeks.
429
402
 
430
403
  To use this feature will need version 5.2.0 of the Node.js client library, or a more recent version.
431
404
 
432
- If you do not choose a value, the file will be available for the default period of 78 weeks (18 months).
405
+ If you do not choose a value, the file will be available for the default period of 26 weeks (6 months).
406
+
407
+ Files sent before 12 April 2023 had a longer default period of 78 weeks (18 months).
433
408
 
434
409
  ```javascript
435
410
  var fs = require('fs')
@@ -368,7 +368,7 @@ Object.assign(NotifyClient.prototype, {
368
368
  data.is_csv = options.isCsv;
369
369
  }
370
370
 
371
- data.confirm_email_before_download = options.confirmEmailBeforeDownload || null;
371
+ data.confirm_email_before_download = options.confirmEmailBeforeDownload !== undefined ? options.confirmEmailBeforeDownload : null;
372
372
  data.retention_period = options.retentionPeriod || null
373
373
  }
374
374
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notifications-node-client",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "homepage": "https://docs.notifications.service.gov.uk/node.html",
5
5
  "repository": {
6
6
  "type": "git",
@@ -228,6 +228,13 @@ describe('notification api', () => {
228
228
  ).contains({is_csv: false, confirm_email_before_download: null, retention_period: null})
229
229
  });
230
230
 
231
+ it('should allow send a file email confirmation to be disabled', () => {
232
+ let file = Buffer.alloc(2*1024*1024)
233
+ expect(
234
+ notifyClient.prepareUpload(file, {confirmEmailBeforeDownload: false})
235
+ ).contains({is_csv: false, confirm_email_before_download: false, retention_period: null})
236
+ });
237
+
231
238
  it('should allow send a file email confirmation to be set', () => {
232
239
  let file = Buffer.alloc(2*1024*1024)
233
240
  expect(