notifications-node-client 5.1.0 → 5.1.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 +4 -0
- package/CONTRIBUTING.md +35 -29
- package/DOCUMENTATION.md +56 -45
- package/Makefile +12 -66
- package/package.json +2 -2
- package/scripts/run_with_docker.sh +21 -0
- package/{script → scripts}/test_send.js +0 -0
- package/.npmignore +0 -6
- package/script/generate_docker_env.sh +0 -28
package/CHANGELOG.md
CHANGED
package/CONTRIBUTING.md
CHANGED
|
@@ -2,52 +2,58 @@
|
|
|
2
2
|
|
|
3
3
|
Pull requests welcome.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Setting Up
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
### Docker container
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This app uses dependencies that are difficult to install locally. In order to make local development easy, we run app commands through a Docker container. Run the following to set this up:
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
```shell
|
|
12
|
+
make bootstrap-with-docker
|
|
13
|
+
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
### `environment.sh`
|
|
16
|
+
|
|
17
|
+
In the root directory of the repo, run:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
notify-pass credentials/client-integration-tests > environment.sh
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Unless you're part of the GOV.UK Notify team, you won't be able to run this command or the Integration Tests. However, the file still needs to exist - run `touch environment.sh` instead.
|
|
24
|
+
|
|
25
|
+
## Tests
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
There are unit and integration tests that can be run to test functionality of the client.
|
|
16
28
|
|
|
17
|
-
|
|
29
|
+
### Unit tests
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
To run the unit tests:
|
|
20
32
|
|
|
21
33
|
```
|
|
22
|
-
|
|
23
|
-
export API_KEY="example_API_test_key"
|
|
24
|
-
export FUNCTIONAL_TEST_NUMBER="valid mobile number"
|
|
25
|
-
export FUNCTIONAL_TEST_EMAIL="valid email address"
|
|
26
|
-
export EMAIL_TEMPLATE_ID="valid email_template_id"
|
|
27
|
-
export SMS_TEMPLATE_ID="valid sms_template_id"
|
|
28
|
-
export LETTER_TEMPLATE_ID="valid letter_template_id"
|
|
29
|
-
export EMAIL_REPLY_TO_ID="valid email reply to id"
|
|
30
|
-
export SMS_SENDER_ID="valid sms_sender_id - to test sending to a receiving number, so needs to be a valid number"
|
|
31
|
-
export API_SENDING_KEY="API_team_key for sending a SMS to a receiving number"
|
|
32
|
-
export INBOUND_SMS_QUERY_KEY="API_test_key to get received text messages - leave blank for local development as cannot test locally"
|
|
34
|
+
make test-with-docker
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
### Integration Tests
|
|
35
38
|
|
|
36
39
|
To run the integration tests:
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
```
|
|
42
|
+
make integration-test-with-docker
|
|
43
|
+
```
|
|
41
44
|
|
|
42
|
-
##
|
|
45
|
+
## Working on the client locally
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
```
|
|
48
|
+
npm install --save notifications-node-client
|
|
49
|
+
```
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
## Testing JavaScript examples in Markdown
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
We automatically test that the JavaScript in the documentation examples matches [our linting standards](https://gds-way.cloudapps.digital/manuals/programming-languages/nodejs/#source-formatting-and-linting). This also catches some issues that could stop an example from running when copied.
|
|
50
54
|
|
|
51
|
-
You can
|
|
55
|
+
You can fix issues automatically by running:
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
```
|
|
58
|
+
npm run test:markdown:standard -- --fix
|
|
59
|
+
```
|
package/DOCUMENTATION.md
CHANGED
|
@@ -289,6 +289,8 @@ If the request is not successful, the promise fails with an `err`.
|
|
|
289
289
|
|
|
290
290
|
To send a file by email, add a placeholder to the template then upload a file. The placeholder will contain a secure link to download the file.
|
|
291
291
|
|
|
292
|
+
The file will be available for the recipient to download for 18 months.
|
|
293
|
+
|
|
292
294
|
The links are unique and unguessable. GOV.UK Notify cannot access or decrypt your file.
|
|
293
295
|
|
|
294
296
|
#### Add contact details to the file download page
|
|
@@ -309,7 +311,7 @@ The links are unique and unguessable. GOV.UK Notify cannot access or decrypt you
|
|
|
309
311
|
|
|
310
312
|
#### Upload your file
|
|
311
313
|
|
|
312
|
-
You can upload PDF, CSV, .odt, .txt, .rtf and MS Word Document files. Your file must be smaller than 2MB. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) if you need to send other file types.
|
|
314
|
+
You can upload PDF, CSV, .odt, .txt, .rtf, .xlsx and MS Word Document files. Your file must be smaller than 2MB. [Contact the GOV.UK Notify team](https://www.notifications.service.gov.uk/support/ask-question-give-feedback) if you need to send other file types.
|
|
313
315
|
|
|
314
316
|
Pass the file object as a value into the `personalisation` argument. For example:
|
|
315
317
|
|
|
@@ -382,7 +384,7 @@ If the request is not successful, the promise fails with an `err`.
|
|
|
382
384
|
|:---|:---|:---|
|
|
383
385
|
|`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "Can't send to this recipient using a team-only API key"`<br>`}]`|Use the correct type of [API key](#api-keys)|
|
|
384
386
|
|`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "Can't send to this recipient when service is in trial mode - see https://www.notifications.service.gov.uk/trial-mode"`<br>`}]`|Your service cannot send this notification in [trial mode](https://www.notifications.service.gov.uk/features/using-notify#trial-mode)|
|
|
385
|
-
|`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "Unsupported file type '(FILE TYPE)'. Supported types are: '(ALLOWED TYPES)'"`<br>`}]`|Wrong file type. You can only upload .pdf, .csv, .txt, .doc, .docx, .rtf or .odt files|
|
|
387
|
+
|`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "Unsupported file type '(FILE TYPE)'. Supported types are: '(ALLOWED TYPES)'"`<br>`}]`|Wrong file type. You can only upload .pdf, .csv, .txt, .doc, .docx, .xlsx, .rtf or .odt files|
|
|
386
388
|
|`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "File did not pass the virus scan"`<br>`}]`|The file contains a virus|
|
|
387
389
|
|`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "Send files by email has not been set up - add contact details for your service at https://www.notifications.service.gov.uk/services/(SERVICE ID)/service-settings/send-files-by-email"`<br>`}]`|See how to [add contact details to the file download page](#add-contact-details-to-the-file-download-page)|
|
|
388
390
|
|`403`|`[{`<br>`"error": "AuthError",`<br>`"message": "Error: Your system clock must be accurate to within 30 seconds"`<br>`}]`|Check your system clock|
|
|
@@ -592,48 +594,11 @@ If the request is not successful, the promise fails with an `err`.
|
|
|
592
594
|
|
|
593
595
|
## Get message status
|
|
594
596
|
|
|
595
|
-
Message status depends on the type of message you have sent.
|
|
596
|
-
|
|
597
|
-
You can only get the status of messages that are 7 days old or newer.
|
|
598
|
-
|
|
599
|
-
### Status - email
|
|
600
|
-
|
|
601
|
-
|Status|Information|
|
|
602
|
-
|:---|:---|
|
|
603
|
-
|Created|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.|
|
|
604
|
-
|Sending|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.|
|
|
605
|
-
|Delivered|The message was successfully delivered.|
|
|
606
|
-
|Failed|This covers all failure statuses:<br>- `permanent-failure` - "The provider could not deliver the message because the email address was wrong. You should remove these email addresses from your database."<br>- `temporary-failure` - "The provider could not deliver the message. This can happen when the recipient’s inbox is full. You can try to send the message again."<br>- `technical-failure` - "Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again."|
|
|
607
|
-
|
|
608
|
-
### Status - text message
|
|
609
|
-
|
|
610
|
-
|Status|Information|
|
|
611
|
-
|:---|:---|
|
|
612
|
-
|Created|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.|
|
|
613
|
-
|Sending|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.|
|
|
614
|
-
|Pending|GOV.UK Notify is waiting for more delivery information.<br>GOV.UK Notify received a callback from the provider but the recipient’s device has not yet responded. Another callback from the provider determines the final status of the notification.|
|
|
615
|
-
|Sent / Sent internationally|The message was sent to an international number. The mobile networks in some countries do not provide any more delivery information. The GOV.UK Notify client API returns this status as `sent`. The GOV.UK Notify client app returns this status as `Sent to an international number`.|
|
|
616
|
-
|Delivered|The message was successfully delivered.|
|
|
617
|
-
|Failed|This covers all failure statuses:<br>- `permanent-failure` - "The provider could not deliver the message. This can happen if the phone number was wrong or if the network operator rejects the message. If you’re sure that these phone numbers are correct, you should [contact GOV.UK Notify support](https://www.notifications.service.gov.uk/support). If not, you should remove them from your database. You’ll still be charged for text messages that cannot be delivered."<br>- `temporary-failure` - "The provider could not deliver the message. This can happen when the recipient’s phone is off, has no signal, or their text message inbox is full. You can try to send the message again. You’ll still be charged for text messages to phones that are not accepting messages."<br>- `technical-failure` - "Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again. You will not be charged for text messages that are affected by a technical failure."|
|
|
618
|
-
|
|
619
|
-
### Status - letter
|
|
620
|
-
|
|
621
|
-
|Status|information|
|
|
622
|
-
|:---|:---|
|
|
623
|
-
|Failed|The only failure status that applies to letters is `technical-failure`. GOV.UK Notify had an unexpected error while sending to our printing provider.|
|
|
624
|
-
|Accepted|GOV.UK Notify has sent the letter to the provider to be printed.|
|
|
625
|
-
|Received|The provider has printed and dispatched the letter.|
|
|
626
|
-
|
|
627
|
-
### Status - precompiled letter
|
|
628
|
-
|
|
629
|
-
|Status|information|
|
|
630
|
-
|:---|:---|
|
|
631
|
-
|Pending virus check|GOV.UK Notify has not completed a virus scan of the precompiled letter file.|
|
|
632
|
-
|Virus scan failed|GOV.UK Notify found a potential virus in the precompiled letter file.|
|
|
633
|
-
|Validation failed|Content in the precompiled letter file is outside the printable area. [See the GOV.UK Notify letter specification](https://www.notifications.service.gov.uk/using-notify/guidance/letter-specification) for more information. |
|
|
634
597
|
|
|
635
598
|
### Get the status of one message
|
|
636
599
|
|
|
600
|
+
You can only get the status of messages sent within the retention period. The default retention period is 7 days.
|
|
601
|
+
|
|
637
602
|
#### Method
|
|
638
603
|
|
|
639
604
|
```javascript
|
|
@@ -734,10 +699,10 @@ You can pass in empty arguments or `null` to ignore these filters.
|
|
|
734
699
|
|
|
735
700
|
You can filter by each:
|
|
736
701
|
|
|
737
|
-
* [email status](#status-
|
|
738
|
-
* [text message status](#
|
|
739
|
-
* [letter status](#status-
|
|
740
|
-
* [precompiled letter status](#
|
|
702
|
+
* [email status](#email-status-descriptions)
|
|
703
|
+
* [text message status](#text-message-status-descriptions)
|
|
704
|
+
* [letter status](#letter-status-descriptions)
|
|
705
|
+
* [precompiled letter status](#precompiled-letter-status-descriptions)
|
|
741
706
|
|
|
742
707
|
You can leave out this argument to ignore this filter.
|
|
743
708
|
|
|
@@ -818,6 +783,52 @@ If the request is not successful, the promise fails with an `err`.
|
|
|
818
783
|
|`403`|`[{`<br>`"error": "AuthError",`<br>`"message": "Error: Your system clock must be accurate to within 30 seconds"`<br>`}]`|Check your system clock|
|
|
819
784
|
|`403`|`[{`<br>`"error": "AuthError",`<br>`"message": "Invalid token: API key not found"`<br>`}]`|Use the correct API key. Refer to [API keys](#api-keys) for more information|
|
|
820
785
|
|
|
786
|
+
### Email status descriptions
|
|
787
|
+
|
|
788
|
+
|Status|Description|
|
|
789
|
+
|:---|:---|
|
|
790
|
+
|#`created`|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.|
|
|
791
|
+
|#`sending`|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.|
|
|
792
|
+
|#`delivered`|The message was successfully delivered.|
|
|
793
|
+
|#`permanent-failure`|The provider could not deliver the message because the email address was wrong. You should remove these email addresses from your database.|
|
|
794
|
+
|#`temporary-failure`|The provider could not deliver the message. This can happen when the recipient’s inbox is full or their anti-spam filter rejects your email. [Check your content does not look like spam](https://www.gov.uk/service-manual/design/sending-emails-and-text-messages#protect-your-users-from-spam-and-phishing) before you try to send the message again.|
|
|
795
|
+
|#`technical-failure`|Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again.|
|
|
796
|
+
|
|
797
|
+
### Text message status descriptions
|
|
798
|
+
|
|
799
|
+
|Status|Description|
|
|
800
|
+
|:---|:---|
|
|
801
|
+
|#`created`|GOV.UK Notify has placed the message in a queue, ready to be sent to the provider. It should only remain in this state for a few seconds.|
|
|
802
|
+
|#`sending`|GOV.UK Notify has sent the message to the provider. The provider will try to deliver the message to the recipient for up to 72 hours. GOV.UK Notify is waiting for delivery information.|
|
|
803
|
+
|#`pending`|GOV.UK Notify is waiting for more delivery information.<br>GOV.UK Notify received a callback from the provider but the recipient’s device has not yet responded. Another callback from the provider determines the final status of the text message.|
|
|
804
|
+
|#`sent`|The message was sent to an international number. The mobile networks in some countries do not provide any more delivery information. The GOV.UK Notify website displays this status as 'Sent to an international number'.|
|
|
805
|
+
|#`delivered`|The message was successfully delivered.|
|
|
806
|
+
|#`permanent-failure`|The provider could not deliver the message. This can happen if the phone number was wrong or if the network operator rejects the message. If you’re sure that these phone numbers are correct, you should [contact GOV.UK Notify support](https://www.notifications.service.gov.uk/support). If not, you should remove them from your database. You’ll still be charged for text messages that cannot be delivered.
|
|
807
|
+
|#`temporary-failure`|The provider could not deliver the message. This can happen when the recipient’s phone is off, has no signal, or their text message inbox is full. You can try to send the message again. You’ll still be charged for text messages to phones that are not accepting messages.|
|
|
808
|
+
|#`technical-failure`|Your message was not sent because there was a problem between Notify and the provider.<br>You’ll have to try sending your messages again. You will not be charged for text messages that are affected by a technical failure.|
|
|
809
|
+
|
|
810
|
+
### Letter status descriptions
|
|
811
|
+
|
|
812
|
+
|Status|Description|
|
|
813
|
+
|:---|:---|
|
|
814
|
+
|#`accepted`|GOV.UK Notify has sent the letter to the provider to be printed.|
|
|
815
|
+
|#`received`|The provider has printed and dispatched the letter.|
|
|
816
|
+
|#`cancelled`|Sending cancelled. The letter will not be printed or dispatched.|
|
|
817
|
+
|#`technical-failure`|GOV.UK Notify had an unexpected error while sending the letter to our printing provider.|
|
|
818
|
+
|#`permanent-failure`|The provider cannot print the letter. Your letter will not be dispatched.|
|
|
819
|
+
|
|
820
|
+
### Precompiled letter status descriptions
|
|
821
|
+
|
|
822
|
+
|Status|Description|
|
|
823
|
+
|:---|:---|
|
|
824
|
+
|#`accepted`|GOV.UK Notify has sent the letter to the provider to be printed.|
|
|
825
|
+
|#`received`|The provider has printed and dispatched the letter.|
|
|
826
|
+
|#`cancelled`|Sending cancelled. The letter will not be printed or dispatched.|
|
|
827
|
+
|#`pending-virus-check`|GOV.UK Notify has not completed a virus scan of the precompiled letter file.|
|
|
828
|
+
|#`virus-scan-failed`|GOV.UK Notify found a potential virus in the precompiled letter file.|
|
|
829
|
+
|#`validation-failed`|Content in the precompiled letter file is outside the printable area. See the [GOV.UK Notify letter specification](https://www.notifications.service.gov.uk/using-notify/guidance/letter-specification) for more information.|
|
|
830
|
+
|#`technical-failure`|GOV.UK Notify had an unexpected error while sending the letter to our printing provider.|
|
|
831
|
+
|#`permanent-failure`|The provider cannot print the letter. Your letter will not be dispatched.|
|
|
821
832
|
|
|
822
833
|
### Get a PDF for a letter notification
|
|
823
834
|
|
package/Makefile
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
.DEFAULT_GOAL := help
|
|
2
2
|
SHELL := /bin/bash
|
|
3
3
|
|
|
4
|
-
DOCKER_BUILDER_IMAGE_NAME = govuk/notify-nodejs-client-runner
|
|
5
|
-
|
|
6
|
-
BUILD_TAG ?= notifications-nodejs-client-manual
|
|
7
|
-
|
|
8
|
-
DOCKER_CONTAINER_PREFIX = ${USER}-${BUILD_TAG}
|
|
9
|
-
|
|
10
4
|
.PHONY: help
|
|
11
5
|
help:
|
|
12
6
|
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
13
7
|
|
|
14
|
-
.PHONY:
|
|
15
|
-
|
|
16
|
-
npm
|
|
8
|
+
.PHONY: bootstrap
|
|
9
|
+
bootstrap: ## Install build dependencies
|
|
10
|
+
npm ci
|
|
17
11
|
|
|
18
12
|
.PHONY: build
|
|
19
|
-
build:
|
|
13
|
+
build: bootstrap ## Build project (dummy task for CI)
|
|
20
14
|
|
|
21
15
|
.PHONY: test
|
|
22
16
|
test: ## Run tests
|
|
@@ -26,70 +20,22 @@ test: ## Run tests
|
|
|
26
20
|
integration-test: ## Run integration tests
|
|
27
21
|
npm test --integration
|
|
28
22
|
|
|
29
|
-
.PHONY:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.PHONY: markdown-standard-test-fix
|
|
34
|
-
markdown-standard-test-fix: ## Fix errors found from linting
|
|
35
|
-
npm run test:markdown:standard -- --fix
|
|
36
|
-
|
|
37
|
-
.PHONY: generate-env-file
|
|
38
|
-
generate-env-file: ## Generate the environment file for running the tests inside a Docker container
|
|
39
|
-
script/generate_docker_env.sh
|
|
40
|
-
|
|
41
|
-
.PHONY: prepare-docker-runner-image
|
|
42
|
-
prepare-docker-runner-image: ## Prepare the Docker builder image
|
|
43
|
-
make -C docker build
|
|
44
|
-
|
|
45
|
-
.PHONY: build-with-docker
|
|
46
|
-
build-with-docker: prepare-docker-runner-image ## Build inside a Docker container
|
|
47
|
-
docker run -i --rm \
|
|
48
|
-
--name "${DOCKER_CONTAINER_PREFIX}-build" \
|
|
49
|
-
-v "`pwd`:/var/project" \
|
|
50
|
-
-e http_proxy="${HTTP_PROXY}" \
|
|
51
|
-
-e HTTP_PROXY="${HTTP_PROXY}" \
|
|
52
|
-
-e https_proxy="${HTTPS_PROXY}" \
|
|
53
|
-
-e HTTPS_PROXY="${HTTPS_PROXY}" \
|
|
54
|
-
-e NO_PROXY="${NO_PROXY}" \
|
|
55
|
-
${DOCKER_BUILDER_IMAGE_NAME} \
|
|
56
|
-
make build
|
|
23
|
+
.PHONY: bootstrap-with-docker
|
|
24
|
+
bootstrap-with-docker: ## Prepare the Docker builder image
|
|
25
|
+
docker build -t notifications-node-client .
|
|
26
|
+
./scripts/run_with_docker.sh make bootstrap
|
|
57
27
|
|
|
58
28
|
.PHONY: test-with-docker
|
|
59
|
-
test-with-docker:
|
|
60
|
-
|
|
61
|
-
--name "${DOCKER_CONTAINER_PREFIX}-test" \
|
|
62
|
-
-v "`pwd`:/var/project" \
|
|
63
|
-
-e http_proxy="${HTTP_PROXY}" \
|
|
64
|
-
-e HTTP_PROXY="${HTTP_PROXY}" \
|
|
65
|
-
-e https_proxy="${HTTPS_PROXY}" \
|
|
66
|
-
-e HTTPS_PROXY="${HTTPS_PROXY}" \
|
|
67
|
-
-e NO_PROXY="${NO_PROXY}" \
|
|
68
|
-
--env-file docker.env \
|
|
69
|
-
${DOCKER_BUILDER_IMAGE_NAME} \
|
|
70
|
-
make test
|
|
29
|
+
test-with-docker: ## Run tests inside a Docker container
|
|
30
|
+
./scripts/run_with_docker.sh make test
|
|
71
31
|
|
|
72
32
|
.PHONY: integration-test-with-docker
|
|
73
|
-
integration-test-with-docker:
|
|
74
|
-
|
|
75
|
-
--name "${DOCKER_CONTAINER_PREFIX}-integration-test" \
|
|
76
|
-
-v "`pwd`:/var/project" \
|
|
77
|
-
-e http_proxy="${HTTP_PROXY}" \
|
|
78
|
-
-e HTTP_PROXY="${HTTP_PROXY}" \
|
|
79
|
-
-e https_proxy="${HTTPS_PROXY}" \
|
|
80
|
-
-e HTTPS_PROXY="${HTTPS_PROXY}" \
|
|
81
|
-
-e NO_PROXY="${NO_PROXY}" \
|
|
82
|
-
--env-file docker.env \
|
|
83
|
-
${DOCKER_BUILDER_IMAGE_NAME} \
|
|
84
|
-
make integration-test
|
|
33
|
+
integration-test-with-docker: ## Run integration tests inside a Docker container
|
|
34
|
+
./scripts/run_with_docker.sh make integration-test
|
|
85
35
|
|
|
86
36
|
.PHONY: get-client-version
|
|
87
37
|
get-client-version: ## Retrieve client version number from source code
|
|
88
38
|
@node -p "require('./package.json').version"
|
|
89
39
|
|
|
90
|
-
.PHONY: clean-docker-containers
|
|
91
|
-
clean-docker-containers: ## Clean up any remaining docker containers
|
|
92
|
-
docker rm -f $(shell docker ps -q -f "name=${DOCKER_CONTAINER_PREFIX}") 2> /dev/null || true
|
|
93
|
-
|
|
94
40
|
clean:
|
|
95
41
|
rm -rf .cache venv
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notifications-node-client",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.1",
|
|
4
4
|
"homepage": "https://docs.notifications.service.gov.uk/node.html",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"jsonwebtoken": "^8.2.1",
|
|
20
|
-
"axios": "^0.
|
|
20
|
+
"axios": "^0.25.0",
|
|
21
21
|
"underscore": "^1.9.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
DOCKER_IMAGE_NAME=notifications-node-client
|
|
2
|
+
|
|
3
|
+
source environment.sh
|
|
4
|
+
|
|
5
|
+
docker run \
|
|
6
|
+
--rm \
|
|
7
|
+
-v "`pwd`:/var/project" \
|
|
8
|
+
-e NOTIFY_API_URL=${NOTIFY_API_URL} \
|
|
9
|
+
-e API_KEY=${API_KEY} \
|
|
10
|
+
-e FUNCTIONAL_TEST_NUMBER=${FUNCTIONAL_TEST_NUMBER} \
|
|
11
|
+
-e FUNCTIONAL_TEST_EMAIL=${FUNCTIONAL_TEST_EMAIL} \
|
|
12
|
+
-e EMAIL_TEMPLATE_ID=${EMAIL_TEMPLATE_ID} \
|
|
13
|
+
-e SMS_TEMPLATE_ID=${SMS_TEMPLATE_ID} \
|
|
14
|
+
-e LETTER_TEMPLATE_ID=${LETTER_TEMPLATE_ID} \
|
|
15
|
+
-e EMAIL_REPLY_TO_ID=${EMAIL_REPLY_TO_ID} \
|
|
16
|
+
-e SMS_SENDER_ID=${SMS_SENDER_ID} \
|
|
17
|
+
-e API_SENDING_KEY=${API_SENDING_KEY} \
|
|
18
|
+
-e INBOUND_SMS_QUERY_KEY=${INBOUND_SMS_QUERY_KEY} \
|
|
19
|
+
-it \
|
|
20
|
+
${DOCKER_IMAGE_NAME} \
|
|
21
|
+
${@}
|
|
File without changes
|
package/.npmignore
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
set -eo pipefail
|
|
4
|
-
|
|
5
|
-
function exit_with_msg {
|
|
6
|
-
echo $1
|
|
7
|
-
exit $2
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
echo -n "" > docker.env
|
|
11
|
-
|
|
12
|
-
env_vars=(
|
|
13
|
-
NOTIFY_API_URL
|
|
14
|
-
API_KEY
|
|
15
|
-
FUNCTIONAL_TEST_EMAIL
|
|
16
|
-
FUNCTIONAL_TEST_NUMBER
|
|
17
|
-
EMAIL_TEMPLATE_ID
|
|
18
|
-
LETTER_TEMPLATE_ID
|
|
19
|
-
SMS_TEMPLATE_ID
|
|
20
|
-
EMAIL_REPLY_TO_ID
|
|
21
|
-
SMS_SENDER_ID
|
|
22
|
-
API_SENDING_KEY
|
|
23
|
-
INBOUND_SMS_QUERY_KEY
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
for env_var in "${env_vars[@]}"; do
|
|
27
|
-
echo "${env_var}=${!env_var}" >> docker.env
|
|
28
|
-
done
|