Skip to content

Commit 1346790

Browse files
committed
docs: jsdoc, plus String.raw for regex
1 parent 27484f9 commit 1346790

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

packages/cdkConstructs/src/constructs/RestApiGateway/StateMachineEndpoint.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@ import {stateMachine200ResponseTemplate, stateMachineErrorResponseTemplate} from
77
import {ExpressStateMachine} from "../StateMachine.js"
88

99
export interface StateMachineEndpointProps {
10+
/** Parent API resource under which the state machine endpoint is added. */
1011
parentResource: IResource
12+
/** Path segment used to create the child API resource. */
1113
readonly resourceName: string
14+
/** HTTP verb bound to the Step Functions integration. */
1215
readonly method: HttpMethod
16+
/** Invocation role used by API Gateway when starting workflow executions. */
1317
restApiGatewayRole: IRole
18+
/** State machine wrapper construct providing the target workflow ARN and integration target. */
1419
stateMachine: ExpressStateMachine
1520
}
1621

22+
/** Adds an API Gateway resource/method that starts an Express Step Functions execution. */
1723
export class StateMachineEndpoint extends Construct {
1824
resource: IResource
1925

26+
/** Wires request and response mapping templates for JSON and FHIR payload flows. */
2027
public constructor(scope: Construct, id: string, props: StateMachineEndpointProps) {
2128
super(scope, id)
2229

@@ -39,14 +46,14 @@ export class StateMachineEndpoint extends Construct {
3946
},
4047
{
4148
statusCode: "400",
42-
selectionPattern: "^4\\d{2}.*",
49+
selectionPattern: String.raw`^4\d{2}.*`,
4350
responseTemplates: {
4451
"application/json": stateMachineErrorResponseTemplate("400")
4552
}
4653
},
4754
{
4855
statusCode: "500",
49-
selectionPattern: "^5\\d{2}.*",
56+
selectionPattern: String.raw`^5\d{2}.*`,
5057
responseTemplates: {
5158
"application/json": stateMachineErrorResponseTemplate("500")
5259
}

packages/cdkConstructs/src/constructs/StateMachine.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ import {Construct} from "constructs"
2222
import {CfnDeliveryStream} from "aws-cdk-lib/aws-kinesisfirehose"
2323

2424
export interface StateMachineProps {
25+
/** Stack name, used as prefix for resource naming and DNS records. */
2526
readonly stackName: string
27+
/** Friendly state machine name used for both AWS resource and log naming. */
2628
readonly stateMachineName: string
29+
/** Workflow definition chain rendered as the state machine definition body. */
2730
readonly definition: IChainable
31+
/** Extra managed policies merged into the execution role when required. */
2832
readonly additionalPolicies?: Array<IManagedPolicy>
33+
/** Retention period applied to the workflow CloudWatch log group. */
2934
readonly logRetentionInDays: number
3035
/**
3136
* Optional KMS key for encrypting CloudWatch Logs.
@@ -58,6 +63,7 @@ export class ExpressStateMachine extends Construct {
5863
public readonly executionPolicy: ManagedPolicy
5964
public readonly stateMachine: StateMachine
6065

66+
/** Provisions an Express Step Functions workflow with logging, tracing, and invoke permissions. */
6167
public constructor(scope: Construct, id: string, props: StateMachineProps) {
6268
super(scope, id)
6369

packages/cdkConstructs/src/constructs/StateMachine/CatchAllErrorPass.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ const severErrorOperationOutcome = `{% $string(
2626
}
2727
) %}`
2828

29+
/** Produces a fixed 500 FHIR OperationOutcome payload for unhandled workflow failures. */
2930
export class CatchAllErrorPass extends Construct {
31+
/** Pass state returned by this construct for chaining in state machine definitions. */
3032
public readonly state
3133

34+
/** Creates a terminal-style error response payload without exposing internal exception detail. */
3235
public constructor(scope: Construct, id: string) {
3336
super(scope, id)
3437

0 commit comments

Comments
 (0)