Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
e5cfae1
script
Namitha-Prabhu Nov 3, 2025
0d7458d
CCM-12180: acceptance stage internal invoke
masl2 Nov 3, 2025
4999505
CCM-12180: correct infraRepo name param
masl2 Nov 7, 2025
c021822
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
masl2 Nov 7, 2025
104851e
CCM-12180: add override project and role
masl2 Nov 7, 2025
d6c1239
CCM-12180: override project
masl2 Nov 10, 2025
a424ceb
CCM-12180: remove callerId param
masl2 Nov 10, 2025
29fdc70
fix tests
Namitha-Prabhu Nov 12, 2025
038076e
remove generate-output
Namitha-Prabhu Nov 12, 2025
223d427
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Nov 12, 2025
d18d495
tests
Namitha-Prabhu Nov 19, 2025
d161b85
merge
Namitha-Prabhu Nov 19, 2025
787face
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Nov 22, 2025
b154794
merge
Namitha-Prabhu Nov 22, 2025
1d53900
Add upsert lambda
francisco-videira-nhs Dec 1, 2025
4334697
Fix names
francisco-videira-nhs Dec 2, 2025
132326d
Fix unit test
francisco-videira-nhs Dec 2, 2025
036c319
Fix unit test dates
francisco-videira-nhs Dec 2, 2025
d6602c3
Fix lambda handler name export
francisco-videira-nhs Dec 2, 2025
10326e9
merge
Namitha-Prabhu Dec 3, 2025
d78a8c7
merge
Namitha-Prabhu Dec 3, 2025
92d4d26
Add event-schemas-letter-rendering
francisco-videira-nhs Dec 4, 2025
b040535
Add GitHub NPM registry configuration to .npmrc
m-houston Dec 5, 2025
ffb8d5c
Add version check and Node.js setup to CI workflow
m-houston Dec 5, 2025
c307fc9
TO REVERT AFTER TEST: conditional check for event schema version update
m-houston Dec 5, 2025
46c8402
Refactor event schema version checks in CI workflow
m-houston Dec 5, 2025
f1444fd
Add GitHub NPM registry URL to Node.js setup in workflows
m-houston Dec 5, 2025
59d8846
Log npm response
m-houston Dec 5, 2025
d7a665c
Add NODE_AUTH_TOKEN to GitHub Actions environment for NPM access
m-houston Dec 5, 2025
5741a86
Revert "Add GitHub NPM registry URL to Node.js setup in workflows"
m-houston Dec 5, 2025
c427d03
Move NODE_AUTH_TOKEN to npm view step in CI workflow
m-houston Dec 5, 2025
8981a44
Reapply "Add GitHub NPM registry URL to Node.js setup in workflows"
m-houston Dec 5, 2025
fbf2e9d
Add NODE_AUTH_TOKEN to NPM install steps in workflows
m-houston Dec 5, 2025
113bbe5
Re-enable conditional check on published package check
m-houston Dec 5, 2025
032e48f
Add NODE_AUTH_TOKEN input for GitHub package registry access in workf…
m-houston Dec 5, 2025
f24f37a
Add packages:read to permissions
m-houston Dec 5, 2025
333f352
Merge branch 'main' into feature/fix-github-npm-registry-access
m-houston Dec 5, 2025
0d41d64
Merge remote-tracking branch 'origin/main' into feature/CCM-12997
francisco-videira-nhs Dec 5, 2025
6400400
delete old test
francisco-videira-nhs Dec 5, 2025
dcead20
tests
Namitha-Prabhu Dec 5, 2025
6a7efa3
Merge remote-tracking branch 'origin/feature/fix-github-npm-registry-…
francisco-videira-nhs Dec 5, 2025
116c323
fix unit tests
Namitha-Prabhu Dec 5, 2025
1d35f02
fix unit tests
Namitha-Prabhu Dec 5, 2025
4001e32
fix trivy scan step
francisco-videira-nhs Dec 5, 2025
ffdf716
fix unit tests
Namitha-Prabhu Dec 5, 2025
7e8533f
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
masl2 Dec 8, 2025
c5d9b9e
dependencies
masl2 Dec 8, 2025
20c5fd0
fix jest configurations
masl2 Dec 8, 2025
66eb971
Fix gh pkg registry test stage
francisco-videira-nhs Dec 8, 2025
b8b45ac
Merge remote-tracking branch 'origin/main' into feature/CCM-12997
francisco-videira-nhs Dec 8, 2025
1fbbb52
event package version
masl2 Dec 8, 2025
64d0fe2
fix local npmrc
francisco-videira-nhs Dec 8, 2025
7c57d35
lint fixes
Namitha-Prabhu Dec 8, 2025
fb0ebd9
lint fixes
Namitha-Prabhu Dec 8, 2025
9aaab4c
Merge branch 'feature/CCM-12180-TestsOnPipeline' of https://github.co…
Namitha-Prabhu Dec 8, 2025
52bf92b
remove duplicate variable defs
masl2 Dec 8, 2025
c8c3fd8
Merge branch 'feature/CCM-12180-TestsOnPipeline' of https://github.co…
Namitha-Prabhu Dec 8, 2025
4750470
remove test archive
Namitha-Prabhu Dec 9, 2025
d3aba34
suppress test data false positive
masl2 Dec 9, 2025
1adba99
imports
Namitha-Prabhu Dec 10, 2025
df1261c
checks for supplier data
Namitha-Prabhu Dec 10, 2025
7f06b68
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 10, 2025
49fd69b
tests
Namitha-Prabhu Dec 10, 2025
d0c63e1
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
masl2 Dec 11, 2025
5685221
merge
Namitha-Prabhu Dec 11, 2025
7f920cc
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 11, 2025
7636dda
Merge branch 'feature/CCM-12180-TestsOnPipeline' of https://github.co…
Namitha-Prabhu Dec 11, 2025
3e38147
version
Namitha-Prabhu Dec 11, 2025
0843041
lock file
Namitha-Prabhu Dec 11, 2025
93f72a7
lock file
Namitha-Prabhu Dec 11, 2025
f531aaf
fix
Namitha-Prabhu Dec 11, 2025
ecb88e8
fix
Namitha-Prabhu Dec 11, 2025
6bed21e
fix
Namitha-Prabhu Dec 11, 2025
5f30fa4
update test to reflect version
masl2 Dec 12, 2025
85233bf
package lock
masl2 Dec 12, 2025
ca58f3b
Fix unit test timestamps, add source
francisco-videira-nhs Dec 12, 2025
7b36de2
replace js-yaml with yaml
masl2 Dec 12, 2025
48b242b
downgrade yargs due to y18n dep
masl2 Dec 12, 2025
4513c92
missing deps
masl2 Dec 12, 2025
65481fd
Merge remote-tracking branch 'origin/main' into feature/CCM-12997
francisco-videira-nhs Dec 12, 2025
8a74c03
Add notification parsing logic
francisco-videira-nhs Dec 12, 2025
cb29729
fix tf var
francisco-videira-nhs Dec 12, 2025
2715285
Fix ddb permissions
francisco-videira-nhs Dec 12, 2025
5e1c732
update versions
Namitha-Prabhu Dec 15, 2025
3b5a35b
update versions
Namitha-Prabhu Dec 15, 2025
b1a5d66
fetch env variable
Namitha-Prabhu Dec 15, 2025
415d07a
fetch env variable
Namitha-Prabhu Dec 15, 2025
d9a5a14
PR number
Namitha-Prabhu Dec 15, 2025
a5ef09e
PR number
Namitha-Prabhu Dec 15, 2025
d6e80aa
Add latest version event schema letter rendering
francisco-videira-nhs Dec 15, 2025
595d4b6
Add trying v1 parse if v2 fails
francisco-videira-nhs Dec 15, 2025
d470154
add flag for execute endpoint
masl2 Dec 15, 2025
78ece30
Add subject
francisco-videira-nhs Dec 16, 2025
52513c2
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 18, 2025
a8fa07e
Split upsert operations
francisco-videira-nhs Dec 18, 2025
6040c12
Merge remote-tracking branch 'origin/main' into feature/CCM-12997
francisco-videira-nhs Dec 18, 2025
b1e1195
Letter variant map to vars
francisco-videira-nhs Dec 18, 2025
fdd73fc
Revert supplierStatusSk
francisco-videira-nhs Dec 18, 2025
05a6b2b
Merge remote-tracking branch 'origin/main' into feature/CCM-12997
francisco-videira-nhs Dec 18, 2025
10ec08f
Fix dependencies
francisco-videira-nhs Dec 18, 2025
9158018
merge
Namitha-Prabhu Dec 19, 2025
b7b91d2
Merge branch 'main' into feature/CCM-12180-TestsOnPipeline
Namitha-Prabhu Dec 19, 2025
b9d364e
trivy job setup of node for nhs packages
masl2 Dec 19, 2025
52b3af0
lock
masl2 Dec 19, 2025
f62a004
lock
masl2 Dec 19, 2025
7196cba
verbose log level
masl2 Dec 19, 2025
832f20e
try node setup and token env
masl2 Dec 19, 2025
1947273
node setup
masl2 Dec 22, 2025
6f6cd33
acceptance deps
masl2 Dec 22, 2025
4e060b6
acceptance deps
masl2 Dec 22, 2025
7efebb6
another go
masl2 Dec 22, 2025
c232df7
another go
masl2 Dec 22, 2025
547f6b1
Merge branch 'main' into feature/CCM-12997
masl2 Dec 24, 2025
e42d26c
CCM-13697: Letters Key and Source Data Item (#323)
masl2 Dec 24, 2025
448702b
missing close brace
masl2 Dec 24, 2025
c68acc2
merge feature/CCM-12997 into my branch
Vlasis-Perdikidis Dec 24, 2025
6e13097
minor refactor upsert unit tests
francisco-videira-nhs Dec 30, 2025
1eecf9b
remove dup line
francisco-videira-nhs Dec 30, 2025
6e86b9d
Merge remote-tracking branch 'origin/main' into feature/CCM-12180-Tes…
francisco-videira-nhs Dec 30, 2025
4693211
fix workspace for supplier test data
francisco-videira-nhs Dec 31, 2025
25d2d8f
merge latest from feature/CCM-12180-TestsOnPipeline into my branch
Vlasis-Perdikidis Jan 2, 2026
018febb
merge latest from feature/CCM-12997
Vlasis-Perdikidis Jan 2, 2026
ccea30d
Merge branch 'main' into feature/CCM-13610-letterRequestEventPerforma…
Vlasis-Perdikidis Jan 5, 2026
d8db90f
add logs to upsert lambda
Vlasis-Perdikidis Jan 5, 2026
82f6be3
trigger another build
Vlasis-Perdikidis Jan 5, 2026
6a5bd82
add fingerprints to gitleaksignore
Vlasis-Perdikidis Jan 5, 2026
f6c2d06
add more logging in upsert lambda
Vlasis-Perdikidis Jan 6, 2026
2162ff5
merge with main
Vlasis-Perdikidis Jan 9, 2026
777eb40
working prepared letter performance test
Vlasis-Perdikidis Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
},
"mounts": [
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached"
"source=${localEnv:HOME}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
"source=${localEnv:HOME}/.npmrc,target=/home/vscode/.npmrc,type=bind,consistency=cached"
],
"name": "Devcontainer",
"postCreateCommand": "scripts/devcontainer/postcreatecommand.sh"
Expand Down
51 changes: 51 additions & 0 deletions .github/actions/acceptance-tests/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Acceptance tests
description: "Run acceptance tests for this repo"

inputs:
testType:
description: Type of test to run
required: true

targetEnvironment:
description: Name of the environment under test
required: true

targetAccountGroup:
description: Name of the account group under test
default: nhs-notify-template-management-dev
required: true

targetComponent:
description: Name of the component under test
required: true

runs:
using: "composite"

steps:
- name: Fetch terraform output
uses: actions/download-artifact@v5
with:
name: terraform-output-${{ inputs.targetComponent }}

- name: Get Node version
id: nodejs_version
shell: bash
run: |
echo "nodejs_version=$(grep "^nodejs\s" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT

- name: "Repo setup"
uses: ./.github/actions/node-install
with:
node-version: ${{ steps.nodejs_version.outputs.nodejs_version }}
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }}

- name: "Set PR NUMBER"
shell: bash
run: |
echo "PR_NUMBER=${{ inputs.targetEnvironment }}" >> $GITHUB_ENV

- name: Run test - ${{ inputs.testType }}
shell: bash
run: |
make test-${{ inputs.testType }}
4 changes: 2 additions & 2 deletions .github/workflows/stage-1-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
needs: detect-terraform-changes
if: needs.detect-terraform-changes.outputs.terraform_changed == 'true'
permissions:
contents: write
contents: write
steps:
- name: "Checkout code"
uses: actions/checkout@v5
Expand Down Expand Up @@ -317,7 +317,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: 'https://npm.pkg.github.com'
registry-url: "https://npm.pkg.github.com"

- name: check if local version differs from latest published version
id: check-version
Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ env:

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
contents: read # This is required for actions/checkout
packages: read # This is required for downloading from GitHub Package Registry

jobs:
Expand All @@ -49,6 +49,11 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: "https://npm.pkg.github.com"
- name: "Cache node_modules"
uses: actions/cache@v4
with:
Expand All @@ -73,6 +78,11 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: "https://npm.pkg.github.com"
- name: "Cache node_modules"
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -142,6 +152,11 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: "https://npm.pkg.github.com"
- name: "Cache node_modules"
uses: actions/cache@v4
with:
Expand All @@ -168,6 +183,11 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v5
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.nodejs_version }}
registry-url: "https://npm.pkg.github.com"
- name: "Cache node_modules"
uses: actions/cache@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ version.json
# Please, add your custom content below!
.idea
.env
.envrc

# dependencies
node_modules
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"autoOpenWorkspace.enableAutoOpenIfSingleWorkspace": true,
"cSpell.words": [
"envrc"
],
"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ config:: _install-dependencies version # Configure development environment (main
test-component:
(cd tests && npm install && npm run test:component)

test-performance:
(cd tests && npm install && npm run test:performance)

version:
rm -f .version
make version-create-effective-file dir=.
Expand Down
1 change: 1 addition & 0 deletions infrastructure/terraform/components/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ No requirements.
| <a name="input_group"></a> [group](#input\_group) | The group variables are being inherited from (often synonmous with account short-name) | `string` | n/a | yes |
| <a name="input_kms_deletion_window"></a> [kms\_deletion\_window](#input\_kms\_deletion\_window) | When a kms key is deleted, how long should it wait in the pending deletion state? | `string` | `"30"` | no |
| <a name="input_letter_table_ttl_hours"></a> [letter\_table\_ttl\_hours](#input\_letter\_table\_ttl\_hours) | Number of hours to set as TTL on letters table | `number` | `24` | no |
| <a name="input_letter_variant_map"></a> [letter\_variant\_map](#input\_letter\_variant\_map) | n/a | `map(object({ supplierId = string, specId = string }))` | <pre>{<br/> "lv1": {<br/> "specId": "spec1",<br/> "supplierId": "supplier1"<br/> },<br/> "lv2": {<br/> "specId": "spec2",<br/> "supplierId": "supplier1"<br/> },<br/> "lv3": {<br/> "specId": "spec3",<br/> "supplierId": "supplier2"<br/> }<br/>}</pre> | no |
| <a name="input_log_level"></a> [log\_level](#input\_log\_level) | The log level to be used in lambda functions within the component. Any log with a lower severity than the configured value will not be logged: https://docs.python.org/3/library/logging.html#levels | `string` | `"INFO"` | no |
| <a name="input_log_retention_in_days"></a> [log\_retention\_in\_days](#input\_log\_retention\_in\_days) | The retention period in days for the Cloudwatch Logs events to be retained, default of 0 is indefinite | `number` | `0` | no |
| <a name="input_manually_configure_mtls_truststore"></a> [manually\_configure\_mtls\_truststore](#input\_manually\_configure\_mtls\_truststore) | Manually manage the truststore used for API Gateway mTLS (e.g. for prod environment) | `bool` | `false` | no |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ resource "aws_dynamodb_table" "letters" {
name = "${local.csi}-letters"
billing_mode = "PAY_PER_REQUEST"

hash_key = "supplierId"
range_key = "id"
hash_key = "id"
range_key = "supplierId"

ttl {
attribute_name = "ttl"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module "upsert_letter" {
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.29/terraform-lambda.zip"

function_name = "upsert-letter"
function_name = "upsert_letter"
description = "Update or Insert the letter data in the letters table"

aws_account_id = var.aws_account_id
Expand All @@ -22,7 +22,7 @@ module "upsert_letter" {
function_code_base_path = local.aws_lambda_functions_dir_path
function_code_dir = "upsert-letter/dist"
function_include_common = true
handler_function_name = "handler"
handler_function_name = "upsertLetterHandler"
runtime = "nodejs22.x"
memory = 128
timeout = 29
Expand All @@ -34,7 +34,9 @@ module "upsert_letter" {
log_destination_arn = local.destination_arn
log_subscription_role_arn = local.acct.log_subscription_role_arn

lambda_env_vars = merge(local.common_lambda_env_vars, {})
lambda_env_vars = merge(local.common_lambda_env_vars, {
VARIANT_MAP = jsonencode(var.letter_variant_map)
})
}

data "aws_iam_policy_document" "upsert_letter_lambda" {
Expand All @@ -57,7 +59,10 @@ data "aws_iam_policy_document" "upsert_letter_lambda" {
effect = "Allow"

actions = [
"dynamodb:PutItem"
"dynamodb:PutItem",
"dynamodb:GetItem",
"dynamodb:Query",
"dynamodb:UpdateItem"
]

resources = [
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/terraform/components/api/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ROOT_DIR/scripts/set-github-token.sh

echo "Completed."

npm ci
npm ci --loglevel verbose

npm run generate-dependencies --workspaces --if-present

Expand Down
9 changes: 9 additions & 0 deletions infrastructure/terraform/components/api/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ variable "disable_gateway_execute_endpoint" {
default = true
}

variable "letter_variant_map" {
type = map(object({ supplierId = string, specId = string }))
default = {
"lv1" = { supplierId = "supplier1", specId = "spec1" },
"lv2" = { supplierId = "supplier1", specId = "spec2" },
"lv3" = { supplierId = "supplier2", specId = "spec3" }
}
}

variable "core_account_id" {
type = string
description = "AWS Account ID for Core"
Expand Down
4 changes: 2 additions & 2 deletions internal/datastore/src/__test__/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ const createLetterTableCommand = new CreateTableCommand({
TableName: "letters",
BillingMode: "PAY_PER_REQUEST",
KeySchema: [
{ AttributeName: "supplierId", KeyType: "HASH" }, // Partition key
{ AttributeName: "id", KeyType: "RANGE" }, // Sort key
{ AttributeName: "id", KeyType: "HASH" }, // Partition key (letter ID)
{ AttributeName: "supplierId", KeyType: "RANGE" }, // Sort key
],
GlobalSecondaryIndexes: [
{
Expand Down
4 changes: 4 additions & 0 deletions internal/datastore/src/__test__/heathcheck.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ describe("DBHealthcheck", () => {
await deleteTables(db);
});

afterAll(async () => {
await db.container.stop();
});

it("passes when the database is available", async () => {
const dbHealthCheck = new DBHealthcheck(db.docClient, db.config);
await expect(dbHealthCheck.check()).resolves.not.toThrow();
Expand Down
Loading
Loading