File tree Expand file tree Collapse file tree
packages/cdkConstructs/src/constructs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import {stateMachineRequestTemplate} from "./templates/stateMachineRequest.js"
66import { stateMachine200ResponseTemplate , stateMachineErrorResponseTemplate } from "./templates/stateMachineResponses.js"
77import { ExpressStateMachine } from "../StateMachine.js"
88
9+ /** Parameters used to create an API endpoint backed by a Step Functions Express workflow. */
910export interface StateMachineEndpointProps {
1011 /** Parent API resource under which the state machine endpoint is added. */
1112 parentResource : IResource
@@ -21,6 +22,7 @@ export interface StateMachineEndpointProps {
2122
2223/** Adds an API Gateway resource/method that starts an Express Step Functions execution. */
2324export class StateMachineEndpoint extends Construct {
25+ /** API resource created by this construct. */
2426 resource : IResource
2527
2628 /** Wires request and response mapping templates for JSON and FHIR payload flows. */
Original file line number Diff line number Diff line change 11/* eslint-disable max-len */
2+ /**
3+ * @returns API Gateway request mapping template for StartExecution payloads.
4+ */
25export const stateMachineRequestTemplate = ( stateMachineArn : string ) => {
36 return `## Velocity Template used for API Gateway request mapping template
47## "@@" is used here as a placeholder for '"' to avoid using escape characters.
Original file line number Diff line number Diff line change 11/* eslint-disable max-len */
2+ /** VTL response template that unwraps successful workflow output and forwards status and headers. */
23export const stateMachine200ResponseTemplate = `#set($payload = $util.parseJson($input.path('$.output')))
34#set($context.responseOverride.status = $payload.Payload.statusCode)
45#set($allHeaders = $payload.Payload.headers)
@@ -56,5 +57,8 @@ const getOperationOutcome = (status: string) => {
5657 } )
5758}
5859
60+ /**
61+ * @returns VTL response template that maps workflow failures to FHIR OperationOutcome payloads.
62+ */
5963export const stateMachineErrorResponseTemplate = ( status : string ) => `#set($context.responseOverride.header["Content-Type"] ="application/fhir+json")
6064${ getOperationOutcome ( status ) } `
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ import {Construct} from "constructs"
2222import { CfnDeliveryStream } from "aws-cdk-lib/aws-kinesisfirehose"
2323import { ACCOUNT_RESOURCES , LAMBDA_RESOURCES } from "../constants"
2424
25+ /**
26+ * Configuration for provisioning an Express Step Functions state machine
27+ * with logging and optional Splunk forwarding.
28+ */
2529export interface StateMachineProps {
2630 /** Stack name, used as prefix for resource naming and DNS records. */
2731 readonly stackName : string
@@ -60,8 +64,12 @@ export interface StateMachineProps {
6064 readonly addSplunkSubscriptionFilter ?: boolean
6165}
6266
67+ /** Creates an Express Step Functions workflow with CloudWatch logging and invoke permissions. */
6368export class ExpressStateMachine extends Construct {
69+ /** Managed policy that grants permission to start this workflow. */
6470 public readonly executionPolicy : ManagedPolicy
71+
72+ /** Created Step Functions state machine resource. */
6573 public readonly stateMachine : StateMachine
6674
6775 /**
You can’t perform that action at this time.
0 commit comments