Skip to content
2 changes: 1 addition & 1 deletion internal/events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@
"typecheck": "tsc --noEmit"
},
"types": "dist/index.d.ts",
"version": "1.0.3"
"version": "1.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/render-pdf",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"specificationId": "1y3q9v1zzzz",
"status": "ACCEPTED"
"status": "ACCEPTED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.ACCEPTED.1.0.0.schema.json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.accepted.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
Expand All @@ -22,5 +23,5 @@
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.ACCEPTED.v1"
"type": "uk.nhs.notify.supplier-api.letter.accepted.v1"
}
27 changes: 27 additions & 0 deletions internal/events/schemas/examples/letter.cancelled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"data": {
"domainId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"groupId": "client_template",
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"specificationId": "1y3q9v1zzzz",
"status": "CANCELLED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.cancelled.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
"severitytext": "INFO",
"source": "/data-plane/supplier-api/prod/update-status",
"specversion": "1.0",
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.cancelled.v1"
}
27 changes: 27 additions & 0 deletions internal/events/schemas/examples/letter.dispatched.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"data": {
"domainId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"groupId": "client_template",
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"specificationId": "1y3q9v1zzzz",
"status": "DISPATCHED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.dispatched.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
"severitytext": "INFO",
"source": "/data-plane/supplier-api/prod/update-status",
"specversion": "1.0",
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.dispatched.v1"
}
29 changes: 29 additions & 0 deletions internal/events/schemas/examples/letter.failed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"data": {
"domainId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"groupId": "client_template",
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"reasonCode": "X07",
"reasonText": "Unprintable",
"specificationId": "1y3q9v1zzzz",
"status": "FAILED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.failed.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
"severitytext": "INFO",
"source": "/data-plane/supplier-api/prod/update-status",
"specversion": "1.0",
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.failed.v1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/render-pdf",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"reasonCode": "RNIB",
"reasonText": "RNIB",
"specificationId": "1y3q9v1zzzz",
"status": "FORWARDED"
"status": "FORWARDED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.FORWARDED.1.0.0.schema.json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.forwarded.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
Expand All @@ -24,5 +25,5 @@
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.FORWARDED.v1"
"type": "uk.nhs.notify.supplier-api.letter.forwarded.v1"
}
29 changes: 29 additions & 0 deletions internal/events/schemas/examples/letter.rejected.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"data": {
"domainId": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"groupId": "client_template",
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"reasonCode": "Z07",
"reasonText": "Invalid",
"specificationId": "1y3q9v1zzzz",
"status": "REJECTED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.rejected.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
"severitytext": "INFO",
"source": "/data-plane/supplier-api/prod/update-status",
"specversion": "1.0",
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.rejected.v1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@
"origin": {
"domain": "letter-rendering",
"event": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"source": "/data-plane/letter-rendering/prod/render-pdf",
"source": "/data-plane/letter-rendering/prod/letter-renderer",
"subject": "client/00f3b388-bbe9-41c9-9e76-052d37ee8988/letter-request/0o5Fs0EELR0fUjHjbCnEtdUwQe4_0o5Fs0EELR0fUjHjbCnEtdUwQe5"
},
"reasonCode": "R07",
"reasonText": "No such address",
"specificationId": "1y3q9v1zzzz",
"status": "RETURNED"
"status": "RETURNED",
"supplierId": "supplier_12345"
},
"datacontenttype": "application/json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.RETURNED.1.0.0.schema.json",
"dataschema": "https://notify.nhs.uk/cloudevents/schemas/supplier-api/letter.returned.1.0.0.schema.json",
"id": "23f1f09c-a555-4d9b-8405-0b33490bc920",
"recordedtime": "2025-08-28T08:45:00.000Z",
"severitynumber": 2,
Expand All @@ -24,5 +25,5 @@
"subject": "letter-origin/letter-rendering/letter/f47ac10b-58cc-4372-a567-0e02b2c3d479",
"time": "2025-08-28T08:45:00.000Z",
"traceparent": "00-0af7651916cd43dd8448eb211c80319c-b7ad6b7169203331-01",
"type": "uk.nhs.notify.supplier-api.letter.RETURNED.v1"
"type": "uk.nhs.notify.supplier-api.letter.returned.v1"
}
42 changes: 27 additions & 15 deletions internal/events/schemas/supplier-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ components:
This indicates that a letter has been accepted for processing by a supplier.
contentType: application/json
payload:
$ref: './events/letter.ACCEPTED.schema.json'
$ref: './events/letter.accepted.schema.json'
examples:
- payload:
$ref: './examples/letter.ACCEPTED.json'
$ref: './examples/letter.accepted.json'

letter-cancelled:
name: letter-cancelled
Expand All @@ -63,7 +63,10 @@ components:
This indicates that a letter has been cancelled and will not be printed or dispatched.
contentType: application/json
payload:
$ref: './events/letter.CANCELLED.schema.json'
$ref: './events/letter.cancelled.schema.json'
examples:
- payload:
$ref: './examples/letter.cancelled.json'

letter-delivered:
name: letter-delivered
Expand All @@ -74,7 +77,7 @@ components:
This indicates that a letter has been delivered to the recipient.
contentType: application/json
payload:
$ref: './events/letter.DELIVERED.schema.json'
$ref: './events/letter.delivered.schema.json'

letter-dispatched:
name: letter-dispatched
Expand All @@ -85,7 +88,10 @@ components:
This indicates that a letter has been dispatched from the supplier to a down-stream access (DSA) provider.
contentType: application/json
payload:
$ref: './events/letter.DISPATCHED.schema.json'
$ref: './events/letter.dispatched.schema.json'
examples:
- payload:
$ref: './examples/letter.dispatched.json'

letter-enclosed:
name: letter-enclosed
Expand All @@ -96,7 +102,7 @@ components:
This indicates that a letter has been printed and packaged in an envelope.
contentType: application/json
payload:
$ref: './events/letter.ENCLOSED.schema.json'
$ref: './events/letter.enclosed.schema.json'

letter-failed:
name: letter-failed
Expand All @@ -107,7 +113,10 @@ components:
This indicates that a letter has failed to be processed by a supplier.
contentType: application/json
payload:
$ref: './events/letter.FAILED.schema.json'
$ref: './events/letter.failed.schema.json'
examples:
- payload:
$ref: './examples/letter.failed.json'

letter-forwarded:
name: letter-forwarded
Expand All @@ -118,10 +127,10 @@ components:
This indicates that a letter has been forwarded to another supplier for processing.
contentType: application/json
payload:
$ref: './events/letter.FORWARDED.schema.json'
$ref: './events/letter.forwarded.schema.json'
examples:
- payload:
$ref: './examples/letter.FORWARDED.json'
$ref: './examples/letter.forwarded.json'

letter-pending:
name: letter-pending
Expand All @@ -132,7 +141,7 @@ components:
This indicates that a letter has been queued for processing by a supplier.
contentType: application/json
payload:
$ref: './events/letter.PENDING.schema.json'
$ref: './events/letter.pending.schema.json'

letter-printed:
name: letter-printed
Expand All @@ -143,7 +152,7 @@ components:
This indicates that a letter has been printed by the supplier.
contentType: application/json
payload:
$ref: './events/letter.PRINTED.schema.json'
$ref: './events/letter.printed.schema.json'

letter-rejected:
name: letter-rejected
Expand All @@ -154,7 +163,10 @@ components:
This indicates that a letter has been rejected by the supplier and will not be processed.
contentType: application/json
payload:
$ref: './events/letter.REJECTED.schema.json'
$ref: './events/letter.rejected.schema.json'
examples:
- payload:
$ref: './examples/letter.rejected.json'

letter-returned:
name: letter-returned
Expand All @@ -165,10 +177,10 @@ components:
This indicates that a letter has been returned to the supplier.
contentType: application/json
payload:
$ref: './events/letter.RETURNED.schema.json'
$ref: './events/letter.returned.schema.json'
examples:
- payload:
$ref: './examples/letter.RETURNED.json'
$ref: './examples/letter.returned.json'

letter-any:
name: letter-any
Expand All @@ -188,7 +200,7 @@ components:
This indicates that MI data has been submitted to the NHS Notify Supplier API.
contentType: application/json
payload:
$ref: './events/mi.SUBMITTED.schema.json'
$ref: './events/mi.submitted.schema.json'

schemas:
letter:
Expand Down
4 changes: 2 additions & 2 deletions internal/events/src/cli/generate-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ const miJson = z.toJSONSchema($MISubmittedEvent, {
target: "openapi-3.0",
reused: "ref",
});
const miFile = `schemas/events/mi.SUBMITTED.schema.json`;
const miFile = `schemas/events/mi.submitted.schema.json`;
fs.writeFileSync(miFile, JSON.stringify(miJson, null, 2));
console.info(`Wrote JSON schema for letter.any to ${miFile}`);
console.info(`Wrote JSON schema for mi.submitted to ${miFile}`);
6 changes: 6 additions & 0 deletions internal/events/src/domain/letter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ The identifier will be included as the origin domain in the subject of any corre
"Optional human-readable reason for the status change, if applicable.",
examples: ["Undeliverable", "Recipient moved"],
}),

supplierId: z.string().meta({
Copy link
Contributor

Choose a reason for hiding this comment

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

This is added in Steve's PR #274, along with dataschemaversion and plane fields.

title: "Supplier ID",
description: "Identifier for the supplier handling this letter.",
examples: ["supplier-12345"],
}),
})
.meta({
title: "Letter",
Expand Down
Loading
Loading