aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 5.49 kB
JavaScript
var _a,_b,_c,_d;Object.defineProperty(exports,"__esModule",{value:!0}),exports.JsonNull=exports.Tokenization=exports.Token=exports.TokenComparison=void 0,exports.isResolvableObject=isResolvableObject,exports.withResolved=withResolved;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("./errors");return errors_1=()=>tmp,tmp},lazy_1=()=>{var tmp=require("./lazy");return lazy_1=()=>tmp,tmp},encoding_1=()=>{var tmp=require("./private/encoding");return encoding_1=()=>tmp,tmp},intrinsic_1=()=>{var tmp=require("./private/intrinsic");return intrinsic_1=()=>tmp,tmp},resolve_1=()=>{var tmp=require("./private/resolve");return resolve_1=()=>tmp,tmp},token_map_1=()=>{var tmp=require("./private/token-map");return token_map_1=()=>tmp,tmp};class TokenComparison{constructor(){}}exports.TokenComparison=TokenComparison,_a=JSII_RTTI_SYMBOL_1,TokenComparison[_a]={fqn:"aws-cdk-lib.TokenComparison",version:"2.202.0"},TokenComparison.SAME=new TokenComparison,TokenComparison.DIFFERENT=new TokenComparison,TokenComparison.ONE_UNRESOLVED=new TokenComparison,TokenComparison.BOTH_UNRESOLVED=new TokenComparison;class Token{static isUnresolved(obj){return(0,encoding_1().unresolved)(obj)}static asString(value,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_EncodingOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.asString),error}return typeof value=="string"?value:token_map_1().TokenMap.instance().registerString(Token.asAny(value),options.displayHint)}static asNumber(value){return typeof value=="number"?value:token_map_1().TokenMap.instance().registerNumber(Token.asAny(value))}static asList(value,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_EncodingOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.asList),error}return Array.isArray(value)&&value.every(x=>typeof x=="string")?value:token_map_1().TokenMap.instance().registerList(Token.asAny(value),options.displayHint)}static asAny(value){return value=Tokenization.reverse(value)??value,isResolvableObject(value)?value:new(intrinsic_1()).Intrinsic(value)}static compareStrings(possibleToken1,possibleToken2){const firstIsUnresolved=Token.isUnresolved(possibleToken1),secondIsUnresolved=Token.isUnresolved(possibleToken2);return firstIsUnresolved&&secondIsUnresolved?TokenComparison.BOTH_UNRESOLVED:firstIsUnresolved||secondIsUnresolved?TokenComparison.ONE_UNRESOLVED:possibleToken1===possibleToken2?TokenComparison.SAME:TokenComparison.DIFFERENT}constructor(){}}exports.Token=Token,_b=JSII_RTTI_SYMBOL_1,Token[_b]={fqn:"aws-cdk-lib.Token",version:"2.202.0"};class Tokenization{static reverseString(s){return token_map_1().TokenMap.instance().splitString(s)}static reverseCompleteString(s){const fragments=Tokenization.reverseString(s);if(fragments.length!==1)throw new(errors_1()).UnscopedValidationError(`Tokenzation.reverseCompleteString: argument must not be a concatenation, got '${s}'`);return fragments.firstToken}static reverseNumber(n){return token_map_1().TokenMap.instance().lookupNumberToken(n)}static reverseList(l){return token_map_1().TokenMap.instance().lookupList(l)}static reverse(x,options={}){try{jsiiDeprecationWarnings().aws_cdk_lib_ReverseOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.reverse),error}if(Tokenization.isResolvable(x))return x;if(typeof x=="string"){if(options.failConcat===!1){const fragments=Tokenization.reverseString(x);return fragments.length===1?fragments.firstToken:void 0}return Tokenization.reverseCompleteString(x)}if(Array.isArray(x))return Tokenization.reverseList(x);if(typeof x=="number")return Tokenization.reverseNumber(x)}static resolve(obj,options){try{jsiiDeprecationWarnings().aws_cdk_lib_ResolveOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.resolve),error}return(0,resolve_1().resolve)(obj,{scope:options.scope,resolver:options.resolver,preparing:options.preparing??!1,removeEmpty:options.removeEmpty})}static isResolvable(obj){return isResolvableObject(obj)}static stringifyNumber(x){return Token.isUnresolved(x)?lazy_1().Lazy.uncachedString({produce:context=>{const resolved=context.resolve(x);return typeof resolved!="number"?resolved:`${resolved}`}}):typeof x!="number"?x:`${x}`}constructor(){}}exports.Tokenization=Tokenization,_c=JSII_RTTI_SYMBOL_1,Tokenization[_c]={fqn:"aws-cdk-lib.Tokenization",version:"2.202.0"};class JsonNull{constructor(){this.creationStack=[]}resolve(_ctx){try{jsiiDeprecationWarnings().aws_cdk_lib_IResolveContext(_ctx)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.resolve),error}return null}toJSON(){return null}toString(){return"null"}}exports.JsonNull=JsonNull,_d=JSII_RTTI_SYMBOL_1,JsonNull[_d]={fqn:"aws-cdk-lib.JsonNull",version:"2.202.0"},JsonNull.INSTANCE=new JsonNull;function isResolvableObject(x){return typeof x=="object"&&x!==null&&typeof x.resolve=="function"}function withResolved(...args){if(args.length<2)return;const argArray=args.slice(0,args.length-1);argArray.some(Token.isUnresolved)||args[args.length-1].apply(arguments,argArray)}
;