UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 1.55 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.validatePatternSupported=validatePatternSupported,exports.integrationResourceArn=integrationResourceArn,exports.isJsonPathOrJsonataExpression=isJsonPathOrJsonataExpression;var aws_stepfunctions_1=()=>{var tmp=require("../../../aws-stepfunctions");return aws_stepfunctions_1=()=>tmp,tmp},jsonata_1=()=>{var tmp=require("../../../aws-stepfunctions/lib/private/jsonata");return jsonata_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp};function validatePatternSupported(integrationPattern,supportedPatterns){if(!supportedPatterns.includes(integrationPattern))throw new(core_1()).UnscopedValidationError(`Unsupported service integration pattern. Supported Patterns: ${supportedPatterns}. Received: ${integrationPattern}`)}const resourceArnSuffix={[aws_stepfunctions_1().IntegrationPattern.REQUEST_RESPONSE]:"",[aws_stepfunctions_1().IntegrationPattern.RUN_JOB]:".sync",[aws_stepfunctions_1().IntegrationPattern.WAIT_FOR_TASK_TOKEN]:".waitForTaskToken"};function integrationResourceArn(service,api,integrationPattern){if(!service||!api)throw new(core_1()).UnscopedValidationError("Both 'service' and 'api' must be provided to build the resource ARN.");return`arn:${core_1().Aws.PARTITION}:states:::${service}:${api}`+(integrationPattern?resourceArnSuffix[integrationPattern]:"")}function isJsonPathOrJsonataExpression(value){return aws_stepfunctions_1().JsonPath.isEncodedJsonPath(value)||(0,jsonata_1().isValidJsonataExpression)(value)}