aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 4.15 kB
JavaScript
"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.StackOutputReference=exports.ShellStep=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var file_set_1=()=>{var tmp=require("./file-set");return file_set_1=()=>tmp,tmp},step_1=()=>{var tmp=require("./step");return step_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},javascript_1=()=>{var tmp=require("../private/javascript");return javascript_1=()=>tmp,tmp};class ShellStep extends step_1().Step{constructor(id,props){super(id),this.inputs=[],this.outputs=[],this._additionalOutputs={};try{jsiiDeprecationWarnings().aws_cdk_lib_pipelines_ShellStepProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ShellStep),error}if(this.commands=props.commands,this.installCommands=props.installCommands??[],this.env=props.env??{},this.envFromCfnOutputs=(0,javascript_1().mapValues)(props.envFromCfnOutputs??{},x=>StackOutputReference.fromCfnOutput(x)),this.discoverReferencedOutputs({env:this.env}),props.input){const fileSet=props.input.primaryOutput;if(!fileSet)throw new(core_1()).UnscopedValidationError(`'${id}': primary input should be a step that has produced a file set, got ${props.input}`);this.addDependencyFileSet(fileSet),this.inputs.push({directory:".",fileSet})}for(const[directory,step]of Object.entries(props.additionalInputs??{})){if(directory===".")throw new(core_1()).UnscopedValidationError(`'${id}': input for directory '.' should be passed via 'input' property`);const fileSet=step.primaryOutput;if(!fileSet)throw new(core_1()).UnscopedValidationError(`'${id}': additionalInput for directory '${directory}' should be a step that has produced a file set, got ${step}`);this.addDependencyFileSet(fileSet),this.inputs.push({directory,fileSet})}if(props.primaryOutputDirectory){this._primaryOutputDirectory=props.primaryOutputDirectory;const fileSet=new(file_set_1()).FileSet("Output",this);this.configurePrimaryOutput(fileSet),this.outputs.push({directory:props.primaryOutputDirectory,fileSet})}}primaryOutputDirectory(directory){if(this._primaryOutputDirectory!==void 0){if(this._primaryOutputDirectory!==directory)throw new(core_1()).UnscopedValidationError(`${this}: primaryOutputDirectory is '${this._primaryOutputDirectory}', cannot be changed to '${directory}'`);return this.primaryOutput}this._primaryOutputDirectory=directory;const fileSet=new(file_set_1()).FileSet("Output",this);return this.configurePrimaryOutput(fileSet),this.outputs.push({directory,fileSet}),fileSet}addOutputDirectory(directory){let fileSet=this._additionalOutputs[directory];return fileSet||(fileSet=new(file_set_1()).FileSet(directory,this),this._additionalOutputs[directory]=fileSet,this.outputs.push({directory,fileSet})),fileSet}get consumedStackOutputs(){return Object.values(this.envFromCfnOutputs)}}exports.ShellStep=ShellStep,_a=JSII_RTTI_SYMBOL_1,ShellStep[_a]={fqn:"aws-cdk-lib.pipelines.ShellStep",version:"2.185.0"};class StackOutputReference{static fromCfnOutput(output){try{jsiiDeprecationWarnings().aws_cdk_lib_CfnOutput(output)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromCfnOutput),error}const stack=core_1().Stack.of(output);return new StackOutputReference(stack.node.path,stack.artifactId,stack.resolve(output.logicalId))}constructor(stackDescription,stackArtifactId,outputName){this.stackDescription=stackDescription,this.stackArtifactId=stackArtifactId,this.outputName=outputName}isProducedBy(stack){try{jsiiDeprecationWarnings().aws_cdk_lib_pipelines_StackDeployment(stack)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.isProducedBy),error}return stack.stackArtifactId===this.stackArtifactId}}exports.StackOutputReference=StackOutputReference,_b=JSII_RTTI_SYMBOL_1,StackOutputReference[_b]={fqn:"aws-cdk-lib.pipelines.StackOutputReference",version:"2.185.0"};