Skip to content

Commit f4d848e

Browse files
committed
adding update builder
1 parent 0d29744 commit f4d848e

Some content is hidden

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

46 files changed

+4222
-99
lines changed

infrastructure/terraform/components/app/module_backend_api.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module "backend_api" {
44
source = "../../modules/backend-api"
55

6+
component = "${var.component}-api"
7+
base_component = var.component
68
project = var.project
79
environment = var.environment
810
aws_account_id = var.aws_account_id

infrastructure/terraform/components/sandbox/module_backend_api.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module "backend_api" {
22
source = "../../modules/backend-api"
33

4+
component = "${var.component}-api"
5+
base_component = var.component
46
project = var.project
57
environment = var.environment
68
aws_account_id = var.aws_account_id

infrastructure/terraform/modules/backend-api/locals.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
locals {
2-
csi = "${var.csi}-${var.component}"
2+
csi = "${var.project}-${var.environment}-${var.component}"
33

44
lambdas_source_code_dir = abspath("${path.module}/../../../../lambdas")
55

@@ -26,9 +26,13 @@ locals {
2626

2727
dynamodb_kms_key_arn = var.dynamodb_kms_key_arn == "" ? aws_kms_key.dynamo[0].arn : var.dynamodb_kms_key_arn
2828

29-
mock_letter_supplier_name = "WTMMOCK"
29+
mock_letter_supplier_name = "WTMMOCK"
30+
3031
use_sftp_letter_supplier_mock = lookup(var.letter_suppliers, local.mock_letter_supplier_name, null) != null
32+
3133
default_letter_supplier = [
3234
for k, v in var.letter_suppliers : merge(v, { name = k }) if v.default_supplier
3335
][0]
36+
37+
sftp_environment = "${var.group}-${var.environment}-${var.base_component}"
3438
}

infrastructure/terraform/modules/backend-api/module_lambda_send_letter_proof.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ module "lambda_send_letter_proof" {
1414
environment_variables = {
1515
CSI = local.csi
1616
INTERNAL_BUCKET_NAME = module.s3bucket_internal.id
17-
DEFAULT_LETTER_SUPPLIER = local.default_letter_supplier
17+
DEFAULT_LETTER_SUPPLIER = local.default_letter_supplier.name
18+
SFTP_ENVIRONMENT = local.sftp_environment
19+
REGION = var.region
20+
"NODE_OPTIONS" = "--enable-source-maps",
1821
}
1922
}
2023

@@ -51,7 +54,7 @@ data "aws_iam_policy_document" "send_letter_proof" {
5154
"ssm:GetParameter",
5255
]
5356
resources = [
54-
"arn:aws:ssm:${var.region}:${var.aws_account_id}:parameter/${local.csi}/*/sftp-config"
57+
"arn:aws:ssm:${var.region}:${var.aws_account_id}:parameter/${local.csi}/sftp-config/*"
5558
]
5659
}
5760

infrastructure/terraform/modules/backend-api/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ variable "group" {
3535
variable "component" {
3636
type = string
3737
description = "The variable encapsulating the name of this component"
38-
default = "api"
3938
}
4039

41-
##
42-
# Variables specific to this component
43-
##
40+
variable "base_component" {
41+
type = string
42+
description = "The top level component containing this module"
43+
}
4444

4545
variable "csi" {
4646
type = string

infrastructure/terraform/modules/typescript-build-zip/null_resource_typescript_build.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ resource "null_resource" "typescript_build" {
55

66
provisioner "local-exec" {
77
working_dir = var.source_code_dir
8-
command = "rm -rf ${var.output_dir} && npx esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --entry-names=[name] --outdir=${var.output_dir} ${join(" ", var.entrypoints)}"
8+
command = "rm -rf ${var.output_dir} && npx esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --entry-names=[name] --loader:.node=file --outdir=${var.output_dir} ${join(" ", var.entrypoints)}"
99
}
1010
}

lambdas/backend-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@hey-api/openapi-ts": "^0.64.13",
2020
"axios": "^1.8.4",
2121
"axios-retry": "^4.5.0",
22+
"nhs-notify-web-template-management-utils": "^0.0.1",
2223
"zod": "^3.24.2"
2324
},
2425
"devDependencies": {
@@ -28,7 +29,6 @@
2829
"axios-mock-adapter": "^2.1.0",
2930
"esbuild": "^0.24.0",
3031
"jest-mock-extended": "^3.0.7",
31-
"nhs-notify-web-template-management-utils": "^0.0.1",
3232
"typescript": "^5.8.2"
3333
}
3434
}

lambdas/backend-client/src/schemas/union-lists.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@ import {
1111
TemplateType,
1212
VirusScanStatus,
1313
} from '../types/generated';
14-
15-
/**
16-
* Returns an identity function which will fail to compile if 'array'
17-
* doesn't contain all the cases of 'Union'
18-
*
19-
* @example
20-
* const arrayOfFooBarBaz = arrayOfAll<'foo' | 'bar' | 'baz'>();
21-
*
22-
* const a = arrayOfFooBarBaz(['foo', 'bar']); // does not compile
23-
* const b = arrayOfFooBarBaz(['foo', 'bar', 'baz']); // compiles
24-
*/
25-
export function arrayOfAll<Union>() {
26-
return <T extends [Union, ...Union[]]>(
27-
array: T & ([Union] extends [T[number]] ? unknown : 'Invalid')
28-
) => array;
29-
}
14+
import { arrayOfAll } from 'nhs-notify-web-template-management-utils';
3015

3116
export const TEMPLATE_TYPE_LIST = arrayOfAll<TemplateType>()([
3217
'NHS_APP',
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import type { Config } from 'jest';
22
import { baseJestConfig } from 'nhs-notify-web-template-management-utils'; // eslint-disable-line no-restricted-exports
33

4-
const config: Config = { ...baseJestConfig, testEnvironment: 'node' };
4+
const config: Config = {
5+
...baseJestConfig,
6+
testEnvironment: 'node',
7+
coveragePathIgnorePatterns: [
8+
...(baseJestConfig.coveragePathIgnorePatterns ?? []),
9+
'container-*.ts',
10+
],
11+
};
512

613
export default config;

lambdas/sftp-letters/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"@types/aws-lambda": "^8.10.148",
1616
"@types/jest": "^29.5.14",
1717
"@types/ssh2-sftp-client": "^9.0.0",
18-
"aws-sdk-client-mock-jest": "^4.1.0",
1918
"aws-sdk-client-mock": "^4.1.0",
19+
"aws-sdk-client-mock-jest": "^4.1.0",
2020
"esbuild": "^0.24.0",
21-
"jest-mock-extended": "^3.0.7",
2221
"jest": "^29.7.0",
22+
"jest-mock-extended": "^3.0.7",
2323
"nhs-notify-web-template-management-test-helper-utils": "*",
2424
"ts-jest": "^29.3.0",
2525
"ts-node": "^10.9.2",
@@ -28,6 +28,8 @@
2828
"dependencies": {
2929
"@aws-sdk/client-s3": "3.775.0",
3030
"@aws-sdk/client-ssm": "3.775.0",
31+
"csv-stringify": "^6.4.4",
32+
"date-fns": "^4.1.0",
3133
"nhs-notify-web-template-management-utils": "*",
3234
"ssh2-sftp-client": "^9.1.0",
3335
"zod": "^3.24.2"

0 commit comments

Comments
 (0)