notifications-node-client 5.1.0 → 5.1.2

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,11 @@
1
+ ## 5.1.2 - 2022-09-23
2
+
3
+ Remove underscore.js dependency
4
+
5
+ ## 5.1.1 - 2022-01-18
6
+
7
+ Upgrade axios version from ^0.21.1 to ^0.25.0
8
+
1
9
  ## 5.1.0 - 2020-12-30
2
10
 
3
11
  ### Changed
package/CONTRIBUTING.md CHANGED
@@ -2,52 +2,58 @@
2
2
 
3
3
  Pull requests welcome.
4
4
 
5
- ## Working on the client locally
5
+ ## Setting Up
6
6
 
7
- `npm install --save notifications-node-client`
7
+ ### Docker container
8
8
 
9
- ## Tests
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
- There are unit and integration tests that can be run to test functionality of the client.
11
+ ```shell
12
+ make bootstrap-with-docker
13
+ ```
12
14
 
13
- To run the unit tests:
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
- `make test`
27
+ There are unit and integration tests that can be run to test functionality of the client.
16
28
 
17
- ## Integration Tests
29
+ ### Unit tests
18
30
 
19
- Before running the integration tests, please ensure that the environment variables are set up.
31
+ To run the unit tests:
20
32
 
21
33
  ```
22
- export NOTIFY_API_URL="https://example.notify-api.url"
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
- `make integration-test`
39
-
40
- The integration tests are used to test the contract of the response to all the api calls, ensuring the latest version of notifications-api do not break the contract of the notifications-node-client.
41
+ ```
42
+ make integration-test-with-docker
43
+ ```
41
44
 
42
- ## Testing JavaScript examples in Markdown
45
+ ## Working on the client locally
43
46
 
44
- We automatically test that the JavaScript in the documentation examples matched [our linting standards](https://gds-way.cloudapps.digital/manuals/programming-languages/nodejs/#source-formatting-and-linting),
45
- this also catches some issues that could stop an example from running when copied.
47
+ ```
48
+ npm install --save notifications-node-client
49
+ ```
46
50
 
47
- To test the JavaScript for syntax and linting errors run:
51
+ ## Testing JavaScript examples in Markdown
48
52
 
49
- `make markdown-standard-test`
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 then fix some issues automatically by running:
55
+ You can fix issues automatically by running:
52
56
 
53
- `make markdown-standard-test-fix`
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,9 +384,10 @@ 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)|
390
+ |`400`|`[{`<br>`"error": "BadRequestError",`<br>`"message": "Can only send a file by email"`<br>`}]`|Make sure you are using an email template|
388
391
  |`403`|`[{`<br>`"error": "AuthError",`<br>`"message": "Error: Your system clock must be accurate to within 30 seconds"`<br>`}]`|Check your system clock|
389
392
  |`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|
390
393
  |`429`|`[{`<br>`"error": "RateLimitError",`<br>`"message": "Exceeded rate limit for key type TEAM/TEST/LIVE of 3000 requests per 60 seconds"`<br>`}]`|Refer to [API rate limits](#rate-limits) for more information|
@@ -592,48 +595,11 @@ If the request is not successful, the promise fails with an `err`.
592
595
 
593
596
  ## Get message status
594
597
 
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
598
 
635
599
  ### Get the status of one message
636
600
 
601
+ You can only get the status of messages sent within the retention period. The default retention period is 7 days.
602
+
637
603
  #### Method
638
604
 
639
605
  ```javascript
@@ -734,10 +700,10 @@ You can pass in empty arguments or `null` to ignore these filters.
734
700
 
735
701
  You can filter by each:
736
702
 
737
- * [email status](#status-email)
738
- * [text message status](#status-text-message)
739
- * [letter status](#status-letter)
740
- * [precompiled letter status](#status-precompiled-letter)
703
+ * [email status](#email-status-descriptions)
704
+ * [text message status](#text-message-status-descriptions)
705
+ * [letter status](#letter-status-descriptions)
706
+ * [precompiled letter status](#precompiled-letter-status-descriptions)
741
707
 
742
708
  You can leave out this argument to ignore this filter.
743
709
 
@@ -818,6 +784,52 @@ If the request is not successful, the promise fails with an `err`.
818
784
  |`403`|`[{`<br>`"error": "AuthError",`<br>`"message": "Error: Your system clock must be accurate to within 30 seconds"`<br>`}]`|Check your system clock|
819
785
  |`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
786
 
787
+ ### Email status descriptions
788
+
789
+ |Status|Description|
790
+ |:---|:---|
791
+ |#`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.|
792
+ |#`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.|
793
+ |#`delivered`|The message was successfully delivered.|
794
+ |#`permanent-failure`|The provider could not deliver the message because the email address was wrong. You should remove these email addresses from your database.|
795
+ |#`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.|
796
+ |#`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.|
797
+
798
+ ### Text message status descriptions
799
+
800
+ |Status|Description|
801
+ |:---|:---|
802
+ |#`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.|
803
+ |#`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.|
804
+ |#`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.|
805
+ |#`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'.|
806
+ |#`delivered`|The message was successfully delivered.|
807
+ |#`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.
808
+ |#`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.|
809
+ |#`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.|
810
+
811
+ ### Letter status descriptions
812
+
813
+ |Status|Description|
814
+ |:---|:---|
815
+ |#`accepted`|GOV.UK Notify has sent the letter to the provider to be printed.|
816
+ |#`received`|The provider has printed and dispatched the letter.|
817
+ |#`cancelled`|Sending cancelled. The letter will not be printed or dispatched.|
818
+ |#`technical-failure`|GOV.UK Notify had an unexpected error while sending the letter to our printing provider.|
819
+ |#`permanent-failure`|The provider cannot print the letter. Your letter will not be dispatched.|
820
+
821
+ ### Precompiled letter status descriptions
822
+
823
+ |Status|Description|
824
+ |:---|:---|
825
+ |#`accepted`|GOV.UK Notify has sent the letter to the provider to be printed.|
826
+ |#`received`|The provider has printed and dispatched the letter.|
827
+ |#`cancelled`|Sending cancelled. The letter will not be printed or dispatched.|
828
+ |#`pending-virus-check`|GOV.UK Notify has not completed a virus scan of the precompiled letter file.|
829
+ |#`virus-scan-failed`|GOV.UK Notify found a potential virus in the precompiled letter file.|
830
+ |#`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.|
831
+ |#`technical-failure`|GOV.UK Notify had an unexpected error while sending the letter to our printing provider.|
832
+ |#`permanent-failure`|The provider cannot print the letter. Your letter will not be dispatched.|
821
833
 
822
834
  ### Get a PDF for a letter notification
823
835
 
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: dependencies
15
- dependencies: ## Install build dependencies
16
- npm install
8
+ .PHONY: bootstrap
9
+ bootstrap: ## Install build dependencies
10
+ npm ci
17
11
 
18
12
  .PHONY: build
19
- build: dependencies ## Build project
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: markdown-standard-test
30
- markdown-standard-test: ## Run linting on JavaScript examples in markdown using StandardJS
31
- npm run test:markdown:standard
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: prepare-docker-runner-image generate-env-file ## Run tests inside a Docker container
60
- docker run -i --rm \
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: prepare-docker-runner-image generate-env-file ## Run integration tests inside a Docker container
74
- docker run -i --rm \
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
@@ -1,5 +1,4 @@
1
1
  var restClient = require('axios').default,
2
- _ = require('underscore'),
3
2
  createGovukNotifyToken = require('../client/authentication.js'),
4
3
  notifyProductionAPI = 'https://api.notifications.service.gov.uk',
5
4
  version = require('../package.json').version;
@@ -56,7 +55,7 @@ function createToken(requestMethod, requestPath, apiKeyId, serviceId) {
56
55
  return createGovukNotifyToken(requestMethod, requestPath, apiKeyId, serviceId);
57
56
  }
58
57
 
59
- _.extend(ApiClient.prototype, {
58
+ Object.assign(ApiClient.prototype, {
60
59
 
61
60
  /**
62
61
  *
@@ -73,7 +72,7 @@ _.extend(ApiClient.prototype, {
73
72
  'User-Agent': 'NOTIFY-API-NODE-CLIENT/' + version
74
73
  }
75
74
  };
76
- _.extend(options, additionalOptions)
75
+ Object.assign(options, additionalOptions)
77
76
  if(this.proxy !== null) options.proxy = this.proxy;
78
77
 
79
78
  return restClient(options);
@@ -1,5 +1,4 @@
1
- var ApiClient = require('./api_client'),
2
- _ = require('underscore');
1
+ var ApiClient = require('./api_client');
3
2
 
4
3
  /**
5
4
  *
@@ -119,7 +118,7 @@ function _check_and_encode_file(file, size_limit) {
119
118
  return file.toString('base64')
120
119
  }
121
120
 
122
- _.extend(NotifyClient.prototype, {
121
+ Object.assign(NotifyClient.prototype, {
123
122
  /**
124
123
  * Usage:
125
124
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notifications-node-client",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "homepage": "https://docs.notifications.service.gov.uk/node.html",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,8 +17,7 @@
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
19
  "jsonwebtoken": "^8.2.1",
20
- "axios": "^0.21.1",
21
- "underscore": "^1.9.0"
20
+ "axios": "^0.25.0"
22
21
  },
23
22
  "devDependencies": {
24
23
  "chai": "4.1.2",
@@ -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,6 +0,0 @@
1
- node_modules
2
- .idea/
3
- environment.sh
4
- package-lock.json
5
- .eslintrc.js
6
- docker.env
@@ -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