Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions .github/actions/build-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ runs:
steps:
- name: Checkout
uses: actions/checkout@v6.0.2
- name: Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
- name: Npm cli install
cache: 'pnpm'
- name: pnpm install
working-directory: ./docs
run: npm ci --min-release-age 3
run: pnpm install --frozen-lockfile
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should default to true in CI environments. I can't see GitHub mentioned but probably falls under env.CI with GitLab:
https://pnpm.io/cli/install#--frozen-lockfile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the bash scripts do want it explicitly set as we might run it locally. So we could just stick with it being explicitly set everywhere.

shell: bash
- name: Setup Ruby
uses: ruby/setup-ruby@v1.180.1
Expand Down
12 changes: 9 additions & 3 deletions .github/actions/node-install/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'npm install and setup'
description: 'Setup node, authenticate github package repository and perform clean npm install'
name: 'pnpm install and setup'
description: 'Setup node, authenticate github package repository and perform clean pnpm install'

inputs:
GITHUB_TOKEN:
Expand All @@ -9,16 +9,22 @@ inputs:
runs:
using: 'composite'
steps:
- name: 'Setup pnpm'
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0

- name: 'Use Node.js'
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
registry-url: 'https://npm.pkg.github.com'
scope: '@nhsdigital'
cache: 'pnpm'

- name: 'Install dependencies'
shell: bash
env:
NODE_AUTH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
run: |
npm ci --min-release-age 3
pnpm install --frozen-lockfile
2 changes: 1 addition & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ updates:
cooldown:
default-days: 7

- package-ecosystem: "npm"
- package-ecosystem: "pnpm"
directory: "/"
schedule:
interval: "daily"
Expand Down
36 changes: 28 additions & 8 deletions .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,21 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v6.0.2
- name: "Setup pnpm"
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- name: "Use Node.js"
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'
- name: "Repo setup"
run: |
npm ci --min-release-age 3
pnpm install --frozen-lockfile
- name: "Generate dependencies"
run: |
npm run generate-dependencies --workspaces --if-present
pnpm run generate-dependencies
git diff --exit-code
test-unit:
name: "Unit tests"
Expand All @@ -66,16 +71,21 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v6.0.2
- name: "Setup pnpm"
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- name: "Use Node.js"
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'
- name: "Repo setup"
run: |
npm ci --min-release-age 3
pnpm install --frozen-lockfile
- name: "Generate dependencies"
run: |
npm run generate-dependencies --workspaces --if-present
pnpm run generate-dependencies
- name: "Run unit test suite"
run: |
make test-unit
Expand All @@ -98,16 +108,21 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v6.0.2
- name: "Setup pnpm"
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- name: "Use Node.js"
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'
- name: "Repo setup"
run: |
npm ci --min-release-age 3
pnpm install --frozen-lockfile
- name: "Generate dependencies"
run: |
npm run generate-dependencies --workspaces --if-present
pnpm run generate-dependencies
- name: "Run linting"
run: |
make test-lint
Expand All @@ -118,16 +133,21 @@ jobs:
steps:
- name: "Checkout code"
uses: actions/checkout@v6.0.2
- name: "Setup pnpm"
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.0
- name: "Use Node.js"
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
cache: 'pnpm'
- name: "Repo setup"
run: |
npm ci --min-release-age 3
pnpm install --frozen-lockfile
- name: "Generate dependencies"
run: |
npm run generate-dependencies --workspaces --if-present
pnpm run generate-dependencies
- name: "Run typecheck"
run: |
make test-typecheck
Expand Down
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ act 0.2.64
gitleaks 8.24.0
jq 1.6
nodejs 24.14.1
pnpm 10.33.0
pre-commit 3.6.0
ruby 3.3.6
terraform 1.10.1
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".github": false,
".vscode": false
},
"jest.jestCommandLine": "npm run test:unit --workspaces --",
"jest.jestCommandLine": "pnpm run --recursive test:unit --",
"sonarlint.connectedMode.project": {
"connectionId": "nhsdigital",
"projectKey": "NHSDigital_nhs-notify-client-callbacks"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include scripts/init.mk
# Example CI/CD targets are: dependencies, build, clean, etc.

dependencies: # Install dependencies needed to build and test the project @Pipeline
npm ci
pnpm install --frozen-lockfile

build: # Build the project artefact @Pipeline
(cd docs && make build)
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ h help:
@egrep '^\S|^$$' Makefile

install:
npm install
pnpm install
bundle config set --local path vendor/bundle
bundle install

Expand Down
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "",
"dependencies": {
"nhsuk-frontend": "^8.1.1"
"nhsuk-frontend": "catalog:app"
},
"description": "",
"devDependencies": {},
Expand Down
6 changes: 3 additions & 3 deletions infrastructure/terraform/components/callbacks/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ for _tfvar_file in \
done
echo "deploy_mock_clients resolved to: ${deploy_mock_clients}"

npm ci
pnpm install --frozen-lockfile

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

"${script_dir}/sync-client-config.sh"

Expand All @@ -36,4 +36,4 @@ if [ "${deploy_mock_clients}" == "true" ]; then
fi
fi

npm run lambda-build --workspaces --if-present
pnpm run --recursive --if-present lambda-build
33 changes: 17 additions & 16 deletions lambdas/client-transform-filter-lambda/package.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
{
"dependencies": {
"@aws-sdk/client-s3": "^3.1020.0",
"@aws-sdk/client-ssm": "^3.1020.0",
"@nhs-notify-client-callbacks/logger": "*",
"@nhs-notify-client-callbacks/models": "*",
"aws-embedded-metrics": "^4.2.1",
"cloudevents": "^10.0.0",
"esbuild": "^0.27.4",
"p-map": "^4.0.0",
"zod": "^4.3.6"
"@aws-sdk/client-s3": "catalog:aws",
"@aws-sdk/client-ssm": "catalog:aws",
"@nhs-notify-client-callbacks/logger": "workspace:*",
"@nhs-notify-client-callbacks/models": "workspace:*",
"aws-embedded-metrics": "catalog:app",
"cloudevents": "catalog:app",
"esbuild": "catalog:tools",
"p-map": "catalog:app",
"zod": "catalog:tools"
},
"devDependencies": {
"@tsconfig/node22": "^22.0.5",
"@types/aws-lambda": "^8.10.161",
"@types/jest": "^29.5.14",
"jest": "^29.7.0",
"jest-mock-extended": "^4.0.0",
"typescript": "^5.9.3"
"@tsconfig/node22": "catalog:tools",
"@types/aws-lambda": "catalog:tools",
"@types/jest": "catalog:test",
"eslint": "catalog:lint",
"jest": "catalog:test",
"jest-mock-extended": "catalog:test",
"typescript": "catalog:tools"
},
"engines": {
"node": ">=24.14.1"
},
"name": "nhs-notify-client-transform-filter-lambda",
"private": true,
"scripts": {
"lambda-build": "rm -rf dist && npx esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --loader:.node=file --entry-names=[name] --outdir=dist src/index.ts",
"lambda-build": "rm -rf dist && pnpm exec esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --loader:.node=file --entry-names=[name] --outdir=dist src/index.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test:unit": "jest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@ export class ConfigCache {

get(clientId: string): ClientSubscriptionConfiguration | undefined {
const entry = this.cache.get(clientId);
if (!entry) {
return undefined;
}

if (entry.expiresAt <= Date.now()) {
if (entry && entry.expiresAt <= Date.now()) {
this.cache.delete(clientId);
return undefined;
}

return entry.value;
return this.cache.get(clientId)?.value;
}

set(clientId: string, value: ClientSubscriptionConfiguration): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ export const matchesChannelStatusSubscription = (
// Check if supplier status changed AND client is subscribed to it
const supplierStatusChanged =
data.previousSupplierStatus !== data.supplierStatus;
const clientSubscribedSupplierStatus =
subscription.supplierStatuses.includes(data.supplierStatus);
const clientSubscribedSupplierStatus = (
subscription.supplierStatuses as readonly string[]
).includes(data.supplierStatus);

// Check if channel status changed AND client is subscribed to it
const channelStatusChanged =
data.previousChannelStatus !== data.channelStatus;
const clientSubscribedChannelStatus =
subscription.channelStatuses.includes(data.channelStatus);
const clientSubscribedChannelStatus = (
subscription.channelStatuses as readonly string[]
).includes(data.channelStatus);

const statusMatch =
(supplierStatusChanged && clientSubscribedSupplierStatus) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export const matchesMessageStatusSubscription = (
.some((subscription) => {
const messageStatusChanged =
data.previousMessageStatus !== data.messageStatus;
const clientSubscribedStatus = subscription.messageStatuses.includes(
data.messageStatus,
);
const clientSubscribedStatus = (
subscription.messageStatuses as readonly string[]
).includes(data.messageStatus);

if (!messageStatusChanged || !clientSubscribedStatus) {
logger.debug(
Expand Down
25 changes: 13 additions & 12 deletions lambdas/mock-webhook-lambda/package.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
{
"dependencies": {
"@nhs-notify-client-callbacks/logger": "*",
"@nhs-notify-client-callbacks/models": "*",
"esbuild": "^0.27.4"
"@nhs-notify-client-callbacks/logger": "workspace:*",
"@nhs-notify-client-callbacks/models": "workspace:*",
"esbuild": "catalog:tools"
},
"devDependencies": {
"@tsconfig/node22": "^22.0.5",
"@types/aws-lambda": "^8.10.161",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.10",
"jest": "^29.7.0",
"jest-html-reporter": "^4.4.0",
"ts-jest": "^29.2.5",
"typescript": "^5.9.3"
"@tsconfig/node22": "catalog:tools",
"@types/aws-lambda": "catalog:tools",
"@types/jest": "catalog:test",
"@types/node": "catalog:tools",
"eslint": "catalog:lint",
"jest": "catalog:test",
"jest-html-reporter": "catalog:test",
"ts-jest": "catalog:test",
"typescript": "catalog:tools"
},
"engines": {
"node": ">=24.14.1"
},
"name": "nhs-notify-mock-webhook-lambda",
"private": true,
"scripts": {
"lambda-build": "rm -rf dist && npx esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --entry-names=[name] --outdir=dist src/index.ts",
"lambda-build": "rm -rf dist && pnpm exec esbuild --bundle --minify --sourcemap --target=es2020 --platform=node --entry-names=[name] --outdir=dist src/index.ts",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"test:unit": "jest",
Expand Down
2 changes: 1 addition & 1 deletion lambdas/mock-webhook-lambda/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function buildResponse(
requestContext?: { http?: { method?: string } };
};
const headers = Object.fromEntries(
Object.entries(event.headers).map(([k, v]) => [k.toLowerCase(), v]),
Object.entries(event.headers).map(([k, v]) => [String(k).toLowerCase(), v]),
) as Record<string, string | undefined>;

const path = event.path ?? eventWithFunctionUrlFields.rawPath;
Expand Down
Loading
Loading