Skip to content

Commit 163b50e

Browse files
committed
fix(cdk): migrate statemachine to JSONata
1 parent cdf4477 commit 163b50e

2 files changed

Lines changed: 38 additions & 44 deletions

File tree

packages/cdk/resources/StateMachineDefinitions/Format1UpdatePrescriptionsStatus.ts

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,17 @@ export class Format1UpdatePrescriptionsStatusDefinition extends Construct {
2424
super(scope, id)
2525

2626
const catchAllError = new Pass(this, "CatchAllError", {
27-
result: {
28-
value: {
29-
Payload: {
30-
statusCode: 500,
31-
headers: {
32-
"Content-Type": "application/fhir+json",
33-
"Cache-Control": "no-cache"
34-
},
35-
body: JSON.stringify({
36-
resourceType: "OperationOutcome",
37-
issue: [{severity: "error", code: "processing", diagnostics: "System error"}]
38-
})
39-
}
27+
outputs: {
28+
Payload: {
29+
statusCode: 500,
30+
headers: {
31+
"Content-Type": "application/fhir+json",
32+
"Cache-Control": "no-cache"
33+
},
34+
body: JSON.stringify({
35+
resourceType: "OperationOutcome",
36+
issue: [{severity: "error", code: "processing", diagnostics: "System error"}]
37+
})
4038
}
4139
}
4240
})
@@ -79,24 +77,22 @@ export class Format1UpdatePrescriptionsStatusDefinition extends Construct {
7977
callUpdatePrescriptionStatus.addCatch(catchAllError)
8078

8179
const translate409To202 = new Pass(this, "Translate 409 to 202", {
82-
result: {
83-
value: {
84-
Payload: {
85-
statusCode: 202,
86-
headers: {
87-
"Content-Type": "application/fhir+json",
88-
"Cache-Control": "no-cache"
89-
},
90-
body: JSON.stringify({
91-
resourceType: "OperationOutcome",
92-
issue: [{
93-
severity: "information",
94-
code: "informational",
95-
diagnostics:
96-
"Duplicate update detected. The message was valid but did not result in an update."
97-
}]
98-
})
99-
}
80+
outputs: {
81+
Payload: {
82+
statusCode: 202,
83+
headers: {
84+
"Content-Type": "application/fhir+json",
85+
"Cache-Control": "no-cache"
86+
},
87+
body: JSON.stringify({
88+
resourceType: "OperationOutcome",
89+
issue: [{
90+
severity: "information",
91+
code: "informational",
92+
diagnostics:
93+
"Duplicate update detected. The message was valid but did not result in an update."
94+
}]
95+
})
10096
}
10197
}
10298
})

packages/cdk/resources/StateMachineDefinitions/UpdatePrescriptionStatus.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@ export class UpdatePrescriptionStatusDefinition extends Construct {
2323
super(scope, id)
2424

2525
const catchAllError = new Pass(this, "CatchAllError", {
26-
result: {
27-
value: {
28-
Payload: {
29-
statusCode: 500,
30-
headers: {
31-
"Content-Type": "application/fhir+json",
32-
"Cache-Control": "no-cache"
33-
},
34-
body: JSON.stringify({
35-
resourceType: "OperationOutcome",
36-
issue: [{severity: "error", code: "processing", diagnostics: "System error"}]
37-
})
38-
}
26+
outputs: {
27+
Payload: {
28+
statusCode: 500,
29+
headers: {
30+
"Content-Type": "application/fhir+json",
31+
"Cache-Control": "no-cache"
32+
},
33+
body: JSON.stringify({
34+
resourceType: "OperationOutcome",
35+
issue: [{severity: "error", code: "processing", diagnostics: "System error"}]
36+
})
3937
}
4038
}
4139
})

0 commit comments

Comments
 (0)