Skip to content

Commit 3922f5f

Browse files
new envelope fields
1 parent 8ce5452 commit 3922f5f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lambdas/mi-updates-transformer/src/mappers/mi-mapper.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@ import { randomUUID, randomBytes } from 'crypto';
55
export function mapMIToCloudEvent(mi: MI): MISubmittedEvent {
66
const now = new Date().toISOString();
77
const eventId = randomUUID();
8+
const dataschemaversion = '1.0.0';
9+
810
return {
911
specversion: '1.0',
1012
id: eventId,
1113
type: `uk.nhs.notify.supplier-api.mi.SUBMITTED.v1`,
12-
dataschema: `https://notify.nhs.uk/cloudevents/schemas/supplier-api/mi.SUBMITTED.1.0.0.schema.json`,
14+
plane: 'data-plane',
15+
dataschema: `https://notify.nhs.uk/cloudevents/schemas/supplier-api/mi.SUBMITTED.${dataschemaversion}.schema.json`,
16+
dataschemaversion,
1317
source: '/data-plane/supplier-api/mi',
1418
subject: 'mi/' + mi.id,
1519

@@ -26,6 +30,7 @@ export function mapMIToCloudEvent(mi: MI): MISubmittedEvent {
2630
stockRemaining: mi.stockRemaining
2731
},
2832
time: now,
33+
datacontenttype: 'application/json',
2934
traceparent: `00-${randomBytes(16).toString('hex')}-${randomBytes(8).toString('hex')}-01`,
3035
recordedtime: now,
3136
severitynumber: 2,

0 commit comments

Comments
 (0)