Skip to content

Commit d6a7c30

Browse files
authored
Merge branch 'main' into feature/CCM-11586_enable-gw-mtls
2 parents a23d453 + a3ea2e2 commit d6a7c30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+14849
-3073
lines changed

.github/actions/build-proxies/action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ runs:
5454
working-directory: .
5555
shell: bash
5656
run: |
57-
make build-json-oas-spec APIM_ENV=dev
57+
if [ -z $PR_NUMBER ]
58+
then
59+
make build-json-oas-spec APIM_ENV=dev
60+
else
61+
make build-json-oas-spec APIM_ENV=dev-pr
62+
fi
5863
5964
- name: Set target
6065
shell: bash

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ terraform 1.10.1
88
terraform-docs 0.19.0
99
trivy 0.61.0
1010
vale 3.6.0
11+
poetry 2.1.4
1112

1213
# ==============================================================================
1314
# The section below is reserved for Docker image versions.

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,17 @@ set-access: guard-APIM_ENV
5353
envsubst '$${ACCESS}' \
5454
< specification/api/components/x-nhsd-apim/access-template.yml > specification/api/components/x-nhsd-apim/access.yml
5555

56+
set-security: guard-APIM_ENV
57+
@ SECURITY=security-$$APIM_ENV.yml \
58+
envsubst '$${SECURITY}' \
59+
< specification/api/components/security/security-template.yml > specification/api/components/security/security.yml
60+
5661
construct-spec: guard-APIM_ENV
5762
$(MAKE) set-target APIM_ENV=$$APIM_ENV
5863
$(MAKE) set-access APIM_ENV=$$APIM_ENV
64+
$(MAKE) set-security APIM_ENV=$$APIM_ENV
65+
66+
5967

6068
build-json-oas-spec: guard-APIM_ENV
6169
$(MAKE) construct-spec APIM_ENV=$$APIM_ENV
@@ -75,6 +83,7 @@ bundle-oas:
7583
generate-sandbox:
7684
$(MAKE) build-json-oas-spec APIM_ENV=sandbox
7785
jq --slurpfile status sandbox/HealthcheckEndpoint.json '.paths += $$status[0]' build/notify-supplier.json > tmp.json && mv tmp.json build/notify-supplier.json
86+
jq '.security = []' build/notify-supplier.json > tmp.json && mv tmp.json build/notify-supplier.json
7887
npm run generate-sandbox
7988

8089
serve-swagger:

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import unicorn from 'eslint-plugin-unicorn';
1212
import { defineConfig, globalIgnores } from 'eslint/config';
1313
import js from '@eslint/js';
1414
import html from 'eslint-plugin-html';
15-
import tseslint from 'typescript-eslint';
15+
import tseslint from '@typescript-eslint/parser';
1616
import sortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
1717
import {
1818
configs as airbnbConfigs,

infrastructure/terraform/components/api/module_lambda_get_letters.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ module "get_letters" {
3636
log_subscription_role_arn = local.acct.log_subscription_role_arn
3737

3838
lambda_env_vars = {
39-
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name
39+
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
40+
LETTER_TTL_HOURS = 24
4041
}
4142
}
4243

@@ -61,13 +62,9 @@ data "aws_iam_policy_document" "get_letters_lambda" {
6162

6263
actions = [
6364
"dynamodb:BatchGetItem",
64-
"dynamodb:BatchWriteItem",
65-
"dynamodb:DeleteItem",
6665
"dynamodb:GetItem",
67-
"dynamodb:PutItem",
6866
"dynamodb:Query",
6967
"dynamodb:Scan",
70-
"dynamodb:UpdateItem",
7168
]
7269

7370
resources = [

infrastructure/terraform/components/api/module_lambda_patch_letters.tf

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module "patch_letters" {
99
environment = var.environment
1010
project = var.project
1111
region = var.region
12-
1312
group = var.group
1413

1514
log_retention_in_days = var.log_retention_in_days
@@ -37,6 +36,8 @@ module "patch_letters" {
3736
log_subscription_role_arn = local.acct.log_subscription_role_arn
3837

3938
lambda_env_vars = {
39+
LETTERS_TABLE_NAME = aws_dynamodb_table.letters.name,
40+
LETTER_TTL_HOURS = 24
4041
}
4142
}
4243

@@ -54,4 +55,23 @@ data "aws_iam_policy_document" "patch_letters_lambda" {
5455
module.kms.key_arn, ## Requires shared kms module
5556
]
5657
}
58+
59+
statement {
60+
sid = "AllowDynamoDBAccess"
61+
effect = "Allow"
62+
63+
actions = [
64+
"dynamodb:BatchGetItem",
65+
"dynamodb:BatchWriteItem",
66+
"dynamodb:GetItem",
67+
"dynamodb:PutItem",
68+
"dynamodb:Query",
69+
"dynamodb:Scan",
70+
"dynamodb:UpdateItem",
71+
]
72+
73+
resources = [
74+
aws_dynamodb_table.letters.arn,
75+
]
76+
}
5777
}

internal/datastore/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist

internal/datastore/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
coverage
2+
node_modules
3+
dist
4+
.reports

internal/datastore/jest.config.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import type { Config } from 'jest';
2+
3+
export const baseJestConfig: Config = {
4+
preset: 'ts-jest',
5+
6+
// Automatically clear mock calls, instances, contexts and results before every test
7+
clearMocks: true,
8+
9+
// Indicates whether the coverage information should be collected while executing the test
10+
collectCoverage: true,
11+
12+
// The directory where Jest should output its coverage files
13+
coverageDirectory: './.reports/unit/coverage',
14+
15+
// Indicates which provider should be used to instrument code for coverage
16+
coverageProvider: 'babel',
17+
18+
coverageThreshold: {
19+
global: {
20+
branches: 100,
21+
functions: 100,
22+
lines: 100,
23+
statements: -10,
24+
},
25+
},
26+
27+
coveragePathIgnorePatterns: ['/__tests__/'],
28+
transform: { '^.+\\.ts$': 'ts-jest' },
29+
testPathIgnorePatterns: ['.build'],
30+
testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'],
31+
32+
// Use this configuration option to add custom reporters to Jest
33+
reporters: [
34+
'default',
35+
[
36+
'jest-html-reporter',
37+
{
38+
pageTitle: 'Test Report',
39+
outputPath: './.reports/unit/test-report.html',
40+
includeFailureMsg: true,
41+
},
42+
],
43+
],
44+
45+
// The test environment that will be used for testing
46+
testEnvironment: 'jsdom',
47+
};
48+
49+
const utilsJestConfig = {
50+
...baseJestConfig,
51+
52+
testEnvironment: 'node',
53+
54+
coveragePathIgnorePatterns: [
55+
...(baseJestConfig.coveragePathIgnorePatterns ?? []),
56+
'zod-validators.ts',
57+
],
58+
};
59+
60+
export default utilsJestConfig;

0 commit comments

Comments
 (0)