aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 4.57 kB
JavaScript
;var __runInitializers=exports&&exports.__runInitializers||function(thisArg,initializers,value){for(var useValue=arguments.length>2,i=0;i<initializers.length;i++)value=useValue?initializers[i].call(thisArg,value):initializers[i].call(thisArg);return useValue?value:void 0},__esDecorate=exports&&exports.__esDecorate||function(ctor,descriptorIn,decorators,contextIn,initializers,extraInitializers){function accept(f){if(f!==void 0&&typeof f!="function")throw new TypeError("Function expected");return f}for(var kind=contextIn.kind,key=kind==="getter"?"get":kind==="setter"?"set":"value",target=!descriptorIn&&ctor?contextIn.static?ctor:ctor.prototype:null,descriptor=descriptorIn||(target?Object.getOwnPropertyDescriptor(target,contextIn.name):{}),_,done=!1,i=decorators.length-1;i>=0;i--){var context={};for(var p in contextIn)context[p]=p==="access"?{}:contextIn[p];for(var p in contextIn.access)context.access[p]=contextIn.access[p];context.addInitializer=function(f){if(done)throw new TypeError("Cannot add initializers after decoration has completed");extraInitializers.push(accept(f||null))};var result=(0,decorators[i])(kind==="accessor"?{get:descriptor.get,set:descriptor.set}:descriptor[key],context);if(kind==="accessor"){if(result===void 0)continue;if(result===null||typeof result!="object")throw new TypeError("Object expected");(_=accept(result.get))&&(descriptor.get=_),(_=accept(result.set))&&(descriptor.set=_),(_=accept(result.init))&&initializers.unshift(_)}else(_=accept(result))&&(kind==="field"?initializers.unshift(_):descriptor[key]=_)}target&&Object.defineProperty(target,contextIn.name,descriptor),done=!0};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MixinApplicator=void 0;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},mixin_metadata_1=()=>{var tmp=require("./private/mixin-metadata");return mixin_metadata_1=()=>tmp,tmp},selectors_1=()=>{var tmp=require("./selectors");return selectors_1=()=>tmp,tmp},helpers_internal_1=()=>{var tmp=require("../helpers-internal");return helpers_internal_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../private/literal-string");return literal_string_1=()=>tmp,tmp};let MixinApplicator=(()=>{let _instanceExtraInitializers=[],_get_selectedConstructs_decorators;return class MixinApplicator2{static{const _metadata=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;_get_selectedConstructs_decorators=[helpers_internal_1().memoizedGetter],__esDecorate(this,null,_get_selectedConstructs_decorators,{kind:"getter",name:"selectedConstructs",static:!1,private:!1,access:{has:obj=>"selectedConstructs"in obj,get:obj=>obj.selectedConstructs},metadata:_metadata},null,_instanceExtraInitializers),_metadata&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:_metadata})}static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.MixinApplicator",version:"2.247.0"};scope=__runInitializers(this,_instanceExtraInitializers);selector;applications=[];expectAll=!1;expectAny=!1;get selectedConstructs(){return this.selector.select(this.scope)}get report(){return this.applications}constructor(scope,selector=selectors_1().ConstructSelector.all()){try{jsiiDeprecationWarnings().aws_cdk_lib_IConstructSelector(selector)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,MixinApplicator2),error}this.scope=scope,this.selector=selector}apply(...mixins){const applications=[],allConstructs=Array.from(this.selectedConstructs);for(const mixin of mixins)for(const construct of allConstructs)if(mixin.supports(construct))(0,mixin_metadata_1().applyMixin)(construct,mixin),applications.push({construct,mixin});else if(this.expectAll)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`Mixin`,`Mixin ${mixin.constructor.name} could not be applied to ${construct.constructor.name} but was required to.`,this.scope);if(this.expectAny&&applications.length<=0)throw new(errors_1()).ValidationError((0,literal_string_1().lit)`LeastOneMixinApplicationRequired`,"At least one mixin application was required, but none of the provided mixins could be applied to any selected construct.",this.scope);return this.applications.push(...applications),this}requireAll(){return this.expectAll=!0,this}requireAny(){return this.expectAny=!0,this}}})();exports.MixinApplicator=MixinApplicator;