Skip to content

Commit b71ba7d

Browse files
committed
CCM-13038: update contracts
1 parent ad336c3 commit b71ba7d

File tree

7 files changed

+290
-52
lines changed

7 files changed

+290
-52
lines changed

.github/workflows/stage-2-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
- name: "Repo setup"
6161
env:
6262
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6364
run: |
6465
npm ci
6566
- name: "Generate dependencies"

pact-contracts/.gitignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

pact-contracts/jest.config.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "@nhsdigital/notify-supplier-api-consumer-contracts",
3+
"version": "1.2.0",
4+
"description": "NHS Notify Supplier API Pact contracts",
5+
"license": "MIT",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+ssh://[email protected]/NHSDigital/nhs-notify-supplier-api.git"
9+
},
10+
"exports": {
11+
"./pacts/*.json": {
12+
"default": "./pacts/*.json"
13+
}
14+
},
15+
"publishConfig": {
16+
"access": "public",
17+
"registry": "https://npm.pkg.github.com"
18+
},
19+
"scripts": {
20+
"lint": "echo Linting not required",
21+
"test:unit": "echo Unit tests not required",
22+
"test:unit:coverage": "echo Unit tests not required",
23+
"typecheck": "echo Typecheck not required"
24+
}
25+
}
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
{
2+
"consumer": {
3+
"name": "supplier-api"
4+
},
5+
"messages": [
6+
{
7+
"contents": {
8+
"data": {
9+
"campaignId": "flu-campaign-2025",
10+
"clientId": "987e6543-21c0-4d5b-8f9a-abcdef123456",
11+
"createdAt": "2025-07-29T08:45:00.000Z",
12+
"domainId": "1y3q9987e6543-21c0-4d5b-8f9a-abcdef123456_34hEIElNxpdXPrNv6OBbU0bqNwG_34hEP2Xc3rGunPUAPe0Mst9IIoA",
13+
"letterVariantId": "1y3q9v2zzzz",
14+
"pageCount": 1,
15+
"requestId": "34hEIFCIw5DUTCRDMGv70CEzGgF",
16+
"requestItemId": "34hEIElNxpdXPrNv6OBbU0bqNwG",
17+
"requestItemPlanId": "34hEP2Xc3rGunPUAPe0Mst9IIoA",
18+
"sha256Hash": "3a7bd3e2360a3d80c4d4e8b1e3e5e6e7e8e9e0e1e2e3e4e5e6e7e8e9e0e1e2e3",
19+
"status": "PREPARED",
20+
"templateId": "template-005",
21+
"url": "s3://comms-123456789012-eu-west-2-pdf-pipeline/rendered/client/35b9VJ4ejJZXk0Z9HtQI9khryiz_35b9VgjHJYKoseXAHWT9i44qSbz.pdf"
22+
},
23+
"datacontenttype": "application/json",
24+
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/letter-rendering/letter-request.prepared.2.0.0.schema.json",
25+
"dataschemaversion": "2.0.0",
26+
"id": "12f1f09c-a555-4d9b-8405-0b33490bc929",
27+
"plane": "data",
28+
"recordedtime": "2025-08-28T08:45:00.000Z",
29+
"severitynumber": 2,
30+
"severitytext": "INFO",
31+
"source": "/data-plane/letter-rendering/prod/render-pdf",
32+
"specversion": "1.0",
33+
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5",
34+
"time": "2025-07-29T08:50:57.350Z",
35+
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
36+
"type": "uk.nhs.notify.letter-rendering.letter-request.prepared.v2"
37+
},
38+
"description": "LetterRequestPrepared",
39+
"matchingRules": {
40+
"body": {
41+
"$.data.campaignId": {
42+
"combine": "AND",
43+
"matchers": [
44+
{
45+
"match": "type"
46+
}
47+
]
48+
},
49+
"$.data.clientId": {
50+
"combine": "AND",
51+
"matchers": [
52+
{
53+
"match": "type"
54+
}
55+
]
56+
},
57+
"$.data.createdAt": {
58+
"combine": "AND",
59+
"matchers": [
60+
{
61+
"format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
62+
"match": "datetime"
63+
}
64+
]
65+
},
66+
"$.data.domainId": {
67+
"combine": "AND",
68+
"matchers": [
69+
{
70+
"match": "type"
71+
}
72+
]
73+
},
74+
"$.data.letterVariantId": {
75+
"combine": "AND",
76+
"matchers": [
77+
{
78+
"match": "type"
79+
}
80+
]
81+
},
82+
"$.data.pageCount": {
83+
"combine": "AND",
84+
"matchers": [
85+
{
86+
"match": "number"
87+
}
88+
]
89+
},
90+
"$.data.requestId": {
91+
"combine": "AND",
92+
"matchers": [
93+
{
94+
"match": "type"
95+
}
96+
]
97+
},
98+
"$.data.requestItemId": {
99+
"combine": "AND",
100+
"matchers": [
101+
{
102+
"match": "type"
103+
}
104+
]
105+
},
106+
"$.data.requestItemPlanId": {
107+
"combine": "AND",
108+
"matchers": [
109+
{
110+
"match": "type"
111+
}
112+
]
113+
},
114+
"$.data.sha256Hash": {
115+
"combine": "AND",
116+
"matchers": [
117+
{
118+
"match": "type"
119+
}
120+
]
121+
},
122+
"$.data.templateId": {
123+
"combine": "AND",
124+
"matchers": [
125+
{
126+
"match": "type"
127+
}
128+
]
129+
},
130+
"$.data.url": {
131+
"combine": "AND",
132+
"matchers": [
133+
{
134+
"match": "regex",
135+
"regex": "^s3:\\/\\/.+"
136+
}
137+
]
138+
},
139+
"$.dataschemaversion": {
140+
"combine": "AND",
141+
"matchers": [
142+
{
143+
"match": "regex",
144+
"regex": "\\d+\\.\\d+\\.\\d+"
145+
}
146+
]
147+
},
148+
"$.id": {
149+
"combine": "AND",
150+
"matchers": [
151+
{
152+
"match": "regex",
153+
"regex": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
154+
}
155+
]
156+
},
157+
"$.recordedtime": {
158+
"combine": "AND",
159+
"matchers": [
160+
{
161+
"format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
162+
"match": "datetime"
163+
}
164+
]
165+
},
166+
"$.severitynumber": {
167+
"combine": "AND",
168+
"matchers": [
169+
{
170+
"match": "number"
171+
}
172+
]
173+
},
174+
"$.source": {
175+
"combine": "AND",
176+
"matchers": [
177+
{
178+
"match": "type"
179+
}
180+
]
181+
},
182+
"$.specversion": {
183+
"combine": "AND",
184+
"matchers": [
185+
{
186+
"match": "regex",
187+
"regex": "\\d+\\.\\d+"
188+
}
189+
]
190+
},
191+
"$.subject": {
192+
"combine": "AND",
193+
"matchers": [
194+
{
195+
"match": "regex",
196+
"regex": "^client\\/[\\d_a-z-]+\\/letter-request\\/[^/]+(?:\\/.*)?$"
197+
}
198+
]
199+
},
200+
"$.time": {
201+
"combine": "AND",
202+
"matchers": [
203+
{
204+
"format": "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
205+
"match": "datetime"
206+
}
207+
]
208+
},
209+
"$.traceparent": {
210+
"combine": "AND",
211+
"matchers": [
212+
{
213+
"match": "type"
214+
}
215+
]
216+
}
217+
}
218+
},
219+
"metadata": {
220+
"contentType": "application/json"
221+
}
222+
}
223+
],
224+
"metadata": {
225+
"pact-js": {
226+
"version": "16.0.2"
227+
},
228+
"pactRust": {
229+
"ffi": "0.4.28",
230+
"models": "1.3.5"
231+
},
232+
"pactSpecification": {
233+
"version": "3.0.0"
234+
}
235+
},
236+
"provider": {
237+
"name": "letter-request-prepared"
238+
}
239+
}

pact-contracts/tsconfig.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

scripts/publish-pact-contracts.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
published_version=$(npm view @nhsdigital/notify-supplier-api-consumer-contracts --json 2>/dev/null | jq -r '.["dist-tags"].latest')
6+
7+
# Fail if there are uncommitted changes as this indicates unexpected changes to the contracts
8+
git diff --quiet tests/pact-tests
9+
10+
local_version=$(cat pact-contracts/package.json | jq -r '.version')
11+
12+
branch=$(git branch --show-current)
13+
14+
if [[ ! $branch == "feature/CCM-13038_pact-tests" ]]; then
15+
echo "Not publishing package because this is not the main branch"
16+
exit 0
17+
fi
18+
19+
if [[ $local_version == $published_version ]]; then
20+
echo "Local version is the same as the latest published version - skipping publish"
21+
exit 0
22+
fi
23+
24+
echo "Local version is different to the latest published version - publishing new version"
25+
npm publish ./pact-contracts

0 commit comments

Comments
 (0)