Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
49ab0af
chore: new ssm params to support tests
tstephen-nhs Oct 9, 2025
feecf1c
chore: add pre-shared NHS numbers for testing
tstephen-nhs Oct 9, 2025
363557e
chore: lookup TC008 nhs number
tstephen-nhs Oct 10, 2025
92957ae
chore: centralise lambda config
tstephen-nhs Oct 10, 2025
0e1007d
chore: expand config for all 3 params
tstephen-nhs Oct 16, 2025
cf0b3c3
chore: update TC008 test to use config
tstephen-nhs Oct 16, 2025
91b3fac
Create common functional code package. Rename common tests and suppor…
connoravo-nhs Oct 16, 2025
6c2bde4
Correct compile
connoravo-nhs Oct 17, 2025
bf01326
Add in other test cases
connoravo-nhs Oct 17, 2025
a7fd3de
Resolve tests - All previous passing
connoravo-nhs Oct 17, 2025
ac47001
Fix test setup exclusion
connoravo-nhs Oct 20, 2025
8412ff3
Shorten common name
connoravo-nhs Oct 20, 2025
7ebd0f0
Switch to common/tests and add in TC007 test case
connoravo-nhs Oct 20, 2025
fd6e7de
Use common/tests import
connoravo-nhs Oct 20, 2025
039975e
Move common logic package to common/utilities to distinguish
connoravo-nhs Oct 20, 2025
1464cbd
Fix up common module imports
connoravo-nhs Oct 21, 2025
f2c41ab
Get common utilities tests working
connoravo-nhs Oct 21, 2025
2c8dc60
Rename tests to testing to differentiate
connoravo-nhs Oct 21, 2025
4bc66e9
Env var the parameters, for easier admin via github
connoravo-nhs Oct 21, 2025
61ffa6a
Move to /testing
connoravo-nhs Oct 21, 2025
bd7078d
Clean up
connoravo-nhs Oct 21, 2025
d4d664d
Set default once
connoravo-nhs Oct 21, 2025
506831c
Rename to agreed pfp-common
connoravo-nhs Oct 21, 2025
beab8b2
Fix dep reference
connoravo-nhs Oct 21, 2025
7e99e66
Add required SSM read permissions to associated lambdas
connoravo-nhs Oct 21, 2025
b610fb7
Fix sam template
connoravo-nhs Oct 22, 2025
f5f6824
fix sam list
connoravo-nhs Oct 22, 2025
584311a
Fix list issue
connoravo-nhs Oct 22, 2025
f921ac0
change to sub
connoravo-nhs Oct 22, 2025
b5623f3
change to sub for both
connoravo-nhs Oct 22, 2025
ec8a255
yaml is a nightmare
connoravo-nhs Oct 22, 2025
c332f5b
Modify resource refences to be dynamic
connoravo-nhs Oct 22, 2025
13d92d6
Set stack name on env var for all lambda
connoravo-nhs Oct 22, 2025
e5630b5
fix env var
connoravo-nhs Oct 22, 2025
825c11a
resolve parameter inputs into resources
connoravo-nhs Oct 22, 2025
21613c1
Use pre-existing ssm policy
connoravo-nhs Oct 22, 2025
1d7df4e
Fix parameter ARN reference
connoravo-nhs Oct 22, 2025
d888efe
chore: regen package-lock.json
tstephen-nhs Oct 23, 2025
1b0468a
chore: avoid empty sam parameter
tstephen-nhs Oct 24, 2025
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
5 changes: 4 additions & 1 deletion .github/scripts/release_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ sam deploy \
ToggleGetStatusUpdates="$TOGGLE_GET_STATUS_UPDATES" \
EnableAlerts="$ENABLE_ALERTS" \
StateMachineLogLevel="$STATE_MACHINE_LOG_LEVEL" \
ForwardCsocLogs="$FORWARD_CSOC_LOGS"
ForwardCsocLogs="$FORWARD_CSOC_LOGS" \
TC007NHSNumberValue="$TC007_NHS_NUMBERS" \
TC008NHSNumberValue="$TC008_NHS_NUMBERS" \
TC009NHSNumberValue="$TC009_NHS_NUMBERS"
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
RUN_REGRESSION_TESTS: true
REGRESSION_TEST_PRODUCT: PFP-APIGEE
FORWARD_CSOC_LOGS: false
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
Expand Down Expand Up @@ -103,6 +106,9 @@ jobs:
STATE_MACHINE_LOG_LEVEL: ALL
RUN_REGRESSION_TESTS: false
FORWARD_CSOC_LOGS: false
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
Expand Down Expand Up @@ -136,6 +142,9 @@ jobs:
STATE_MACHINE_LOG_LEVEL: ERROR
RUN_REGRESSION_TESTS: false
FORWARD_CSOC_LOGS: false
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.REF_CLOUD_FORMATION_DEPLOY_ROLE }}
Expand Down Expand Up @@ -170,6 +179,9 @@ jobs:
RUN_REGRESSION_TESTS: true
REGRESSION_TEST_PRODUCT: PFP-APIGEE
FORWARD_CSOC_LOGS: false
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
Expand Down Expand Up @@ -199,6 +211,9 @@ jobs:
RUN_REGRESSION_TESTS: true
REGRESSION_TEST_PRODUCT: PFP-APIGEE
FORWARD_CSOC_LOGS: false
TC007_NHS_NUMBERS: ${{vars.TC007_NHS_NUMBERS}}
TC008_NHS_NUMBERS: ${{vars.TC008_NHS_NUMBERS}}
TC009_NHS_NUMBERS: ${{vars.TC009_NHS_NUMBERS}}
secrets:
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.INT_CLOUD_FORMATION_DEPLOY_ROLE }}
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/sam_release_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ on:
FORWARD_CSOC_LOGS:
required: true
type: boolean
TC007_NHS_NUMBERS:
required: false
type: string
TC008_NHS_NUMBERS:
required: false
type: string
TC009_NHS_NUMBERS:
required: false
type: string
secrets:
CLOUD_FORMATION_DEPLOY_ROLE:
required: true
Expand Down Expand Up @@ -146,6 +155,9 @@ jobs:
ENABLE_ALERTS: ${{ inputs.ENABLE_ALERTS }}
STATE_MACHINE_LOG_LEVEL: ${{ inputs.STATE_MACHINE_LOG_LEVEL }}
FORWARD_CSOC_LOGS: ${{ inputs.FORWARD_CSOC_LOGS }}
TC007_NHS_NUMBERS: ${{ inputs.TC007_NHS_NUMBERS || '9992387920' }}
TC008_NHS_NUMBERS: ${{ inputs.TC008_NHS_NUMBERS || '9992387920' }}
TC009_NHS_NUMBERS: ${{ inputs.TC009_NHS_NUMBERS || '9992387920' }}
run: ./release_code.sh

- name: create_int_release_notes
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ repos:
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-common-utilities
name: Lint common utilities
entry: npm
args: ["run", "--prefix=packages/common/utilities", "lint"]
language: system
files: ^packages\/common\/src
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-common-testing
name: Lint common testing
entry: npm
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ lint-node: compile-node
npm run lint --workspace packages/nhsd-pfp-sandbox
npm run lint --workspace packages/statusLambda
npm run lint --workspace packages/serviceSearchClient
npm run lint --workspace packages/common/utilities
npm run lint --workspace packages/common/testing
npm run lint --workspace packages/distanceSelling

Expand All @@ -147,6 +148,8 @@ test: compile
npm run test --workspace packages/statusLambda
npm run test --workspace packages/serviceSearchClient
npm run test --workspace packages/distanceSelling
npm run test --workspace packages/common/utilities
npm run test --workspace packages/common/testing

clean:
rm -rf packages/capabilityStatement/coverage
Expand All @@ -165,6 +168,7 @@ clean:
rm -rf packages/distanceSelling/lib
rm -rf packages/statusLambda/lib
rm -rf packages/getSecretLayer/lib
rm -rf packages/common/utilities/lib
rm -rf packages/common/testing/lib
rm -rf .aws-sam

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ It is called by an Apigee proxy that is defined at <https://github.com/NHSDigita
- `packages/capabilityStatement/` Returns a static capability statement.
- `packages/serviceSearchClient/` Module for connecting to service search.
- `packages/distanceSelling/` Module for using Service Search client and enriching the data being returned.
- `packages/common/utilities` Module containing commonly referenced functions, data types and configuration data.
- `packages/common/testing` Module that contains some test data used for tests in other modules.
- `postman/` Contains a postman collection for interacting with the API.
- `scripts/` Utilities helpful to developers of this specification.
Expand Down
9 changes: 9 additions & 0 deletions SAMtemplates/functions/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Globals:
Runtime: nodejs20.x
Environment:
Variables:
STACK_NAME: !Ref StackName
NODE_OPTIONS: "--enable-source-maps"
TargetSpineServer: !Ref TargetSpineServer
TargetServiceSearchServer: !Ref TargetServiceSearchServer
Expand Down Expand Up @@ -64,6 +65,9 @@ Parameters:
ToggleGetStatusUpdates:
Type: String

SSMParameterPolicy:
Type: String

Resources:
GetSecretsLayer:
Type: AWS::Serverless::LayerVersion
Expand Down Expand Up @@ -116,6 +120,7 @@ Resources:
AdditionalPolicies: !Join
- ","
- - !ImportValue account-resources:LambdaAccessSecretsPolicy
- !Ref SSMParameterPolicy
LogRetentionInDays: !Ref LogRetentionInDays
CloudWatchKMSKeyId: !ImportValue account-resources:CloudwatchLogsKmsKeyArn
EnableSplunk: !Ref EnableSplunk
Expand Down Expand Up @@ -163,6 +168,10 @@ Resources:
EnableSplunk: !Ref EnableSplunk
SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole
SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream
IncludeAdditionalPolicies: true
AdditionalPolicies: !Join
- ","
- - !Ref SSMParameterPolicy

CapabilityStatement:
Type: AWS::Serverless::Function
Expand Down
30 changes: 30 additions & 0 deletions SAMtemplates/main_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ Parameters:

StateMachineLogLevel:
Type: String
Default: ERROR
AllowedValues:
- ALL
- ERROR
- FATAL
- OFF
Description: Logging level for Step Functions state machine

TC007NHSNumberValue:
Type: String
Default: "123"

TC008NHSNumberValue:
Type: String
Default: "123"

TC009NHSNumberValue:
Type: String
Default: "123"

ForwardCsocLogs:
Type: String
Expand Down Expand Up @@ -123,6 +142,16 @@ Resources:
EnableSplunk: !Ref EnableSplunk
ForwardCsocLogs: !Ref ForwardCsocLogs

Parameters:
Type: AWS::Serverless::Application
Properties:
Location: parameters/main.yaml
Parameters:
StackName: !Ref AWS::StackName
TC007NHSNumberValue: !Ref TC007NHSNumberValue
TC008NHSNumberValue: !Ref TC008NHSNumberValue
TC009NHSNumberValue: !Ref TC009NHSNumberValue

Functions:
Type: AWS::Serverless::Application
Properties:
Expand All @@ -138,6 +167,7 @@ Resources:
VersionNumber: !Ref VersionNumber
CommitId: !Ref CommitId
ToggleGetStatusUpdates: !Ref ToggleGetStatusUpdates
SSMParameterPolicy: !GetAtt Parameters.Outputs.GetPfPParameterPolicy

StateMachines:
Type: AWS::Serverless::Application
Expand Down
82 changes: 82 additions & 0 deletions SAMtemplates/parameters/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
AWSTemplateFormatVersion: '2010-09-09'
Description: >-
SSM Parameter Store entries. Values may differ between prod and non-prod environments

Parameters:
StackName:
Type: String

TC007NHSNumberValue:
Type: String

TC008NHSNumberValue:
Type: String

TC009NHSNumberValue:
Type: String

Resources:
TC007NHSNumberParameter:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub ${StackName}-TC007NHSNumber
Description: "List of NHS numbers that will trigger 'temporarily unavailable' response for testing purposes."
Type: String
Value: !Ref TC007NHSNumberValue

TC008NHSNumberParameter:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub ${StackName}-TC008NHSNumber
Description: "List of NHS numbers that will trigger '500 system error' response for testing purposes."
Type: String
Value: !Ref TC008NHSNumberValue

TC009NHSNumberParameter:
Type: AWS::SSM::Parameter
Properties:
Name: !Sub ${StackName}-TC009NHSNumber
Description: "List of NHS numbers that will trigger 'one or more prescriptions missing' response for testing purposes."
Type: String
Value: !Ref TC009NHSNumberValue

GetPfPParameterPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
Description: "Allows reading SSM parameters"
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- ssm:GetParameter
- ssm:GetParameters
Resource:
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${TC007NHSNumberParameter}
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${TC008NHSNumberParameter}
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${TC009NHSNumberParameter}

Outputs:
TC007NHSNumberParameterName:
Description: "Name of the SSM parameter holding TC007_NHS_Number"
Value: !Ref TC007NHSNumberParameter
Export:
Name: !Sub ${StackName}-TC007NHSNumberParameter

TC008NHSNumberParameterName:
Description: "Name of the SSM parameter holding TC008_NHS_Number"
Value: !Ref TC008NHSNumberParameter
Export:
Name: !Sub ${StackName}-TC008NHSNumberParameter

TC009NHSNumberParameterName:
Description: "Name of the SSM parameter holding TC009_NHS_Number"
Value: !Ref TC009NHSNumberParameter
Export:
Name: !Sub ${StackName}-TC009NHSNumberParameter

GetPfPParameterPolicy:
Description: Access to the parameters used by the notifications integration
Value: !Ref GetPfPParameterPolicy
Export:
Name: !Sub ${StackName}-GetPfPParameterPolicy
6 changes: 5 additions & 1 deletion jest.default.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ const jestConfig: JestConfigWithTsJest = {
preset: "ts-jest/presets/default-esm",
moduleFileExtensions: ["js", "json", "ts", "d.ts"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1"
"^(\\.{1,2}/.*)\\.js$": "$1",
"^@pfp-common/testing$": "<rootDir>/../../packages/common/testing/lib/index.js",
"^@pfp-common/testing/(.*)$": "<rootDir>/../../packages/common/testing/lib/$1.js",
"^@pfp-common/utilities$": "<rootDir>/../../packages/common/utilities/lib/index.js",
"^@pfp-common/utilities/(.*)$": "<rootDir>/../../packages/common/utilities/lib/$1.js"
},
transform: {
"^.+\\.ts?$": [
Expand Down
Loading
Loading