@bitblit/ratchet-epsilon-deployment 4.0.229-alpha → 4.0.232-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.mjs +1 -1
  2. package/package.json +6 -6
package/lib/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{Stack as e,Duration as t,Size as o,Lazy as a}from"aws-cdk-lib";import{DockerImageCode as i,DockerImageFunction as s,FunctionUrlAuthType as r,HttpMethod as n}from"aws-cdk-lib/aws-lambda";import{PolicyStatement as c,Effect as m,Role as l,ServicePrincipal as d,ManagedPolicy as u,PolicyDocument as p}from"aws-cdk-lib/aws-iam";import{Topic as f}from"aws-cdk-lib/aws-sns";import{Queue as L}from"aws-cdk-lib/aws-sqs";import{LambdaSubscription as w}from"aws-cdk-lib/aws-sns-subscriptions";import{Rule as b,Schedule as A}from"aws-cdk-lib/aws-events";import{LambdaFunction as h}from"aws-cdk-lib/aws-events-targets";import{DockerImageAsset as S}from"aws-cdk-lib/aws-ecr-assets";import{StringRatchet as g,ErrorRatchet as E}from"@bitblit/ratchet-common";import{FargateComputeEnvironment as N,JobQueue as _,EcsFargateContainerDefinition as O,EcsJobDefinition as I}from"@aws-cdk/aws-batch-alpha";import{Vpc as T,SecurityGroup as C}from"aws-cdk-lib/aws-ec2";import{ContainerImage as P}from"aws-cdk-lib/aws-ecs";import{Bucket as k,BucketEncryption as y}from"aws-cdk-lib/aws-s3";import R from"path";import{OriginAccessIdentity as v,OriginProtocolPolicy as D,CloudFrontAllowedMethods as B,CloudFrontAllowedCachedMethods as W,HttpVersion as H,PriceClass as G,ViewerProtocolPolicy as F,CloudFrontWebDistribution as M}from"aws-cdk-lib/aws-cloudfront";import{RecordSet as U,RecordType as x,HostedZone as V}from"aws-cdk-lib/aws-route53";import{CloudFrontTarget as z}from"aws-cdk-lib/aws-route53-targets";import{BucketDeployment as j,Source as J}from"aws-cdk-lib/aws-s3-deployment";class Q{constructor(){}static buildInformation(){return{version:"229",hash:"67a18925c1017214a7cc68cadc46883143585fa5",branch:"alpha-2023-09-25-3",tag:"alpha-2023-09-25-3",timeBuiltISO:"2023-09-25T13:09:38-0700",notes:"No notes"}}}var q,K;!function(e){e.WebLambda="WebLambda",e.BackgroundLambda="BackgroundLambda",e.AwsBatchHandler="AwsBatchHandler"}(q||(q={}));class Y{constructor(){}static toEnvironmentVariables(e){const t={};return e.forEach((e=>{Object.keys(e).forEach((o=>{t[o]=g.safeString(e[o])}))})),t}static createDefaultPolicyStatementList(e,t,o,a){return(e.additionalPolicyStatements||[]).concat([new c({effect:m.ALLOW,actions:["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"],resources:["arn:aws:logs:*:*:*"]}),new c({effect:m.ALLOW,actions:["ses:SendEmail","ses:SendRawEmail"],resources:["arn:aws:ses:*"]}),new c({effect:m.ALLOW,actions:["sqs:*"],resources:[t.queueArn]}),new c({effect:m.ALLOW,actions:["sns:*"],resources:[o.topicArn,a.topicArn]}),new c({effect:m.ALLOW,actions:["batch:*"],resources:["*"]})])}static ALLOW_ECS=new c({effect:m.ALLOW,actions:["ecs:*"],resources:["*"]});static ALLOW_ECR=new c({effect:m.ALLOW,actions:["ecr:BatchCheckLayerAvailability","ecr:BatchGetImage","ecr:GetDownloadUrlForLayer","ecr:GetAuthorizationToken"],resources:["*"]});static ALLOW_RESTRICTED_LOGS=new c({effect:m.ALLOW,actions:["logs:CreateLogStream","logs:PutLogEvents","logs:DescribeLogStreams","logs:CreateLogGroup"],resources:["*"]});static ALLOW_FARGATE_SECRET_READING=[new c({effect:m.ALLOW,actions:["ssm:GetParameters"],resources:["*"]}),new c({effect:m.ALLOW,actions:["secretsmanager:GetSecretValue"],resources:["*"]}),new c({effect:m.ALLOW,actions:["kms:Decrypt"],resources:["*"]})];static ECS_POLICY_STATEMENTS=[Y.ALLOW_ECS,Y.ALLOW_ECR,Y.ALLOW_RESTRICTED_LOGS].concat(Y.ALLOW_FARGATE_SECRET_READING)}class $ extends e{webHandler;backgroundHandler;apiDomain;constructor(c,m,E){super(c,m,E);const k=E?.disabledFeatures||[],y=new S(this,m+"DockerImage",{directory:E.dockerFileFolder,file:E.dockerFileName}),R=i.fromImageAsset(E.dockerFileFolder,{file:E.dockerFileName}),v=new f(this,m+"WorkNotificationTopic"),D=new L(this,m+"WorkQueue",{fifo:!0,retentionPeriod:t.hours(8),visibilityTimeout:t.minutes(5),contentBasedDeduplication:!0,...E}),B=new f(this,m+"InterApiTopic"),W={EPSILON_AWS_REGION:g.safeString(e.of(this).region),EPSILON_AWS_AVAILABILITY_ZONES:g.safeString(JSON.stringify(e.of(this).availabilityZones)),EPSILON_BACKGROUND_SQS_QUEUE_URL:g.safeString(D.queueUrl),EPSILON_BACKGROUND_SNS_TOPIC_ARN:g.safeString(v.topicArn),EPSILON_INTER_API_EVENT_TOPIC_ARN:g.safeString(B.topicArn),EPSILON_LIB_BUILD_HASH:g.safeString(Q.buildInformation().hash),EPSILON_LIB_BUILD_TIME:g.safeString(Q.buildInformation().timeBuiltISO),EPSILON_LIB_BUILD_BRANCH_OR_TAG:g.safeString(Q.buildInformation().branch||Q.buildInformation().tag),EPSILON_LIB_BUILD_VERSION:g.safeString(Q.buildInformation().version)},H=Object.assign({},E.extraEnvironmentalVars||{},W);if(!k.includes(q.AwsBatchHandler)){const e=new l(this,m+"BatchExecutionRole",{assumedBy:new d("ecs-tasks.amazonaws.com"),managedPolicies:[u.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole")],inlinePolicies:{root:new p({statements:Y.ECS_POLICY_STATEMENTS})}}),a=new l(this,m+"BatchJobRole",{assumedBy:new d("ecs-tasks.amazonaws.com"),managedPolicies:[u.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole")],inlinePolicies:{root:new p({statements:Y.createDefaultPolicyStatementList(E,D,v,B)})}}),i={vpc:T.fromLookup(this,"Vpc",{vpcId:E.vpcId}),computeEnvironmentName:m+"ComputeEnv",enabled:!0,maxvCpus:16,replaceComputeEnvironment:!1,securityGroups:E.lambdaSecurityGroupIds.map(((e,t)=>C.fromSecurityGroupId(this,`SecurityGroup${t}`,`sg-${e}`))),serviceRole:l.fromRoleArn(this,`${m}ServiceRole`,"arn:aws:iam::"+E.env.account+":role/AWSBatchServiceRole"),spot:!1,terminateOnUpdate:!1,updateTimeout:t.hours(4),updateToLatestImageVersion:!0},s=new N(this,m+"ComputeEnv",i),r=new _(this,m+"BatchJobQueue",{computeEnvironments:[{order:1,computeEnvironment:s}],enabled:!0,jobQueueName:m+"BatchJobQueue",priority:10,schedulingPolicy:void 0}),n=Y.toEnvironmentVariables([H,E.extraEnvironmentalVars||{},{EPSILON_RUNNING_IN_AWS_BATCH:!0}]),c={cpu:4,image:P.fromRegistry(y.imageUri),memory:o.mebibytes(8192),assignPublicIp:!0,command:["Ref::taskName","Ref::taskData","Ref::traceId","Ref::traceDepth"],environment:n,executionRole:e,jobRole:a,readonlyRootFilesystem:!1,volumes:[]},f=new O(this,`${m}FargateContainerDefinition`,c),L=new I(this,m+"JobDefinition",{jobDefinitionName:m+"JobDefinition",retryAttempts:3,retryStrategies:void 0,schedulingPriority:void 0,timeout:void 0,container:f});H.EPSILON_AWS_BATCH_JOB_DEFINITION_ARN=L.jobDefinitionArn,H.EPSILON_AWS_BATCH_JOB_QUEUE_ARN=r.jobQueueArn}const G=new l(this,"customRole",{roleName:m+"LambdaCustomRole",assumedBy:new d("lambda.amazonaws.com"),managedPolicies:[u.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole")],inlinePolicies:{root:new p({statements:Y.createDefaultPolicyStatementList(E,D,v,B)})}});if(!k.includes(q.WebLambda)){if(this.webHandler=new s(this,m+"Web",{retryAttempts:2,memorySize:E.webMemorySizeMb||128,ephemeralStorageSize:o.mebibytes(512),timeout:t.seconds(E.webTimeoutSeconds||20),code:R,role:G,environment:H}),E?.webLambdaPingMinutes&&E.webLambdaPingMinutes>0){new b(this,m+"WebKeepaliveRule",{schedule:A.rate(t.minutes(Math.ceil(E.webLambdaPingMinutes)))}).addTarget(new h(this.webHandler))}const e=this.webHandler.addFunctionUrl({authType:r.NONE,cors:{allowedOrigins:["*"],allowedHeaders:["Content-Type","X-Amz-Date","Authorization","X-Api-Key"],allowedMethods:[n.ALL],allowCredentials:!0}});this.apiDomain=a.uncachedString({produce:t=>({"Fn::Select":[2,{"Fn::Split":["/",t.resolve(e.url)]}]})})}if(!k.includes(q.BackgroundLambda)){this.backgroundHandler=new s(this,m+"Background",{retryAttempts:2,memorySize:E.backgroundMemorySizeMb||3e3,ephemeralStorageSize:o.mebibytes(512),timeout:t.seconds(E.backgroundTimeoutSeconds||900),code:R,role:G,environment:H}),v.addSubscription(new w(this.backgroundHandler)),B.addSubscription(new w(this.backgroundHandler));new b(this,m+"CronRule",{schedule:A.rate(t.minutes(1))}).addTarget(new h(this.backgroundHandler))}}}!function(e){e.Update="Update",e.DoNotUpdate="DoNotUpdate"}(K||(K={}));class X extends e{constructor(e,o,a){super(e,o,a);const i=new v(this,o+"OriginAccessId"),s=new k(this,o+"DeployBucket",{bucketName:a.targetBucketName,versioned:!1,publicReadAccess:!1,encryption:y.S3_MANAGED}),r=(a.simpleAdditionalMappings||[]).map((e=>{const o=k.fromBucketAttributes(this,e.bucketName+"ImportedBucket",{bucketName:e.bucketName});return{bucket:o,sourceConfig:{s3OriginSource:{s3BucketSource:o,originAccessIdentity:i},behaviors:[{pathPattern:e.pathPattern,isDefaultBehavior:!1,compress:!0,defaultTtl:t.seconds(1),minTtl:t.seconds(1),maxTtl:t.seconds(1),forwardedValues:{queryString:!1}}]}}})),n={s3OriginSource:{s3BucketSource:s,originAccessIdentity:i},behaviors:[{isDefaultBehavior:!0,compress:!0,defaultTtl:t.seconds(1),minTtl:t.seconds(1),maxTtl:t.seconds(1),forwardedValues:{queryString:!1}}]},c=(a.apiMappings||[]).map((e=>({customOriginSource:{domainName:e.apiDomainName,originProtocolPolicy:D.HTTPS_ONLY},behaviors:[{compress:!0,forwardedValues:{queryString:!0,cookies:{forward:"whitelist",whitelistedNames:["idToken"]},headers:["Accept","Referer","Authorization","Content-Type"]},pathPattern:e.pathPattern,defaultTtl:t.seconds(0),maxTtl:t.seconds(0),minTtl:t.seconds(0),allowedMethods:B.ALL,cachedMethods:W.GET_HEAD}]}))),m={httpVersion:H.HTTP2,defaultRootObject:"index.html",originConfigs:[n,...c,...r.map((e=>e.sourceConfig))],errorConfigurations:[{errorCode:404,errorCachingMinTtl:300,responseCode:200,responsePagePath:"/index.html"},{errorCode:403,errorCachingMinTtl:300,responseCode:200,responsePagePath:"/index.html"}],priceClass:G.PRICE_CLASS_ALL,viewerProtocolPolicy:F.REDIRECT_TO_HTTPS,viewerCertificate:{aliases:a.cloudFrontDomainNames,props:{acmCertificateArn:a.cloudFrontHttpsCertificateArn,sslSupportMethod:"sni-only"}}},l=new M(this,o+"CloudfrontDistro",m);if(a?.route53Handling===K.Update&&a?.cloudFrontDomainNames?.length)for(let e=0;e<a.cloudFrontDomainNames.length;e++)new U(this,o+"DomainName-"+a.cloudFrontDomainNames[e],{recordType:x.A,recordName:a.cloudFrontDomainNames[e],target:{aliasTarget:new z(l)},zone:V.fromLookup(this,o,{domainName:X.extractApexDomain(a.cloudFrontDomainNames[e])})});new j(this,o+"SiteDeploy",{sources:a.pathsToAssets.map((e=>J.asset(R.resolve(e)))),destinationBucket:s,distribution:l,distributionPaths:["/*"]})}static extractApexDomain(e){const t=g.trimToEmpty(e).split(".");return t.length<2&&E.throwFormattedErr("Not a valid domain name : %s",e),t[t.length-2]+"."+t[t.length-1]}}export{$ as EpsilonApiStack,q as EpsilonApiStackFeature,Y as EpsilonStackUtil,X as EpsilonWebsiteStack,K as EpsilonWebsiteStackPropsRoute53Handling,Q as RatchetEpsilonDeploymentInfo};
1
+ import{Stack as e,Duration as t,Size as o,Lazy as a}from"aws-cdk-lib";import{DockerImageCode as i,DockerImageFunction as s,FunctionUrlAuthType as r,HttpMethod as n}from"aws-cdk-lib/aws-lambda";import{PolicyStatement as c,Effect as m,Role as l,ServicePrincipal as d,ManagedPolicy as u,PolicyDocument as p}from"aws-cdk-lib/aws-iam";import{Topic as f}from"aws-cdk-lib/aws-sns";import{Queue as L}from"aws-cdk-lib/aws-sqs";import{LambdaSubscription as w}from"aws-cdk-lib/aws-sns-subscriptions";import{Rule as b,Schedule as A}from"aws-cdk-lib/aws-events";import{LambdaFunction as h}from"aws-cdk-lib/aws-events-targets";import{DockerImageAsset as S}from"aws-cdk-lib/aws-ecr-assets";import{StringRatchet as g,ErrorRatchet as E}from"@bitblit/ratchet-common";import{FargateComputeEnvironment as N,JobQueue as _,EcsFargateContainerDefinition as O,EcsJobDefinition as I}from"@aws-cdk/aws-batch-alpha";import{Vpc as T,SecurityGroup as C}from"aws-cdk-lib/aws-ec2";import{ContainerImage as P}from"aws-cdk-lib/aws-ecs";import{Bucket as k,BucketEncryption as y}from"aws-cdk-lib/aws-s3";import R from"path";import{OriginAccessIdentity as v,OriginProtocolPolicy as D,CloudFrontAllowedMethods as B,CloudFrontAllowedCachedMethods as W,HttpVersion as H,PriceClass as G,ViewerProtocolPolicy as F,CloudFrontWebDistribution as M}from"aws-cdk-lib/aws-cloudfront";import{RecordSet as U,RecordType as x,HostedZone as V}from"aws-cdk-lib/aws-route53";import{CloudFrontTarget as z}from"aws-cdk-lib/aws-route53-targets";import{BucketDeployment as j,Source as J}from"aws-cdk-lib/aws-s3-deployment";class Q{constructor(){}static buildInformation(){return{version:"232",hash:"bcce209de9712e649cb0c1ea207f3297337b39e3",branch:"alpha-2023-09-25-6",tag:"alpha-2023-09-25-6",timeBuiltISO:"2023-09-25T20:00:31-0700",notes:"No notes"}}}var q,K;!function(e){e.WebLambda="WebLambda",e.BackgroundLambda="BackgroundLambda",e.AwsBatchHandler="AwsBatchHandler"}(q||(q={}));class Y{constructor(){}static toEnvironmentVariables(e){const t={};return e.forEach((e=>{Object.keys(e).forEach((o=>{t[o]=g.safeString(e[o])}))})),t}static createDefaultPolicyStatementList(e,t,o,a){return(e.additionalPolicyStatements||[]).concat([new c({effect:m.ALLOW,actions:["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"],resources:["arn:aws:logs:*:*:*"]}),new c({effect:m.ALLOW,actions:["ses:SendEmail","ses:SendRawEmail"],resources:["arn:aws:ses:*"]}),new c({effect:m.ALLOW,actions:["sqs:*"],resources:[t.queueArn]}),new c({effect:m.ALLOW,actions:["sns:*"],resources:[o.topicArn,a.topicArn]}),new c({effect:m.ALLOW,actions:["batch:*"],resources:["*"]})])}static ALLOW_ECS=new c({effect:m.ALLOW,actions:["ecs:*"],resources:["*"]});static ALLOW_ECR=new c({effect:m.ALLOW,actions:["ecr:BatchCheckLayerAvailability","ecr:BatchGetImage","ecr:GetDownloadUrlForLayer","ecr:GetAuthorizationToken"],resources:["*"]});static ALLOW_RESTRICTED_LOGS=new c({effect:m.ALLOW,actions:["logs:CreateLogStream","logs:PutLogEvents","logs:DescribeLogStreams","logs:CreateLogGroup"],resources:["*"]});static ALLOW_FARGATE_SECRET_READING=[new c({effect:m.ALLOW,actions:["ssm:GetParameters"],resources:["*"]}),new c({effect:m.ALLOW,actions:["secretsmanager:GetSecretValue"],resources:["*"]}),new c({effect:m.ALLOW,actions:["kms:Decrypt"],resources:["*"]})];static ECS_POLICY_STATEMENTS=[Y.ALLOW_ECS,Y.ALLOW_ECR,Y.ALLOW_RESTRICTED_LOGS].concat(Y.ALLOW_FARGATE_SECRET_READING)}class $ extends e{webHandler;backgroundHandler;apiDomain;constructor(c,m,E){super(c,m,E);const k=E?.disabledFeatures||[],y=new S(this,m+"DockerImage",{directory:E.dockerFileFolder,file:E.dockerFileName}),R=i.fromImageAsset(E.dockerFileFolder,{file:E.dockerFileName}),v=new f(this,m+"WorkNotificationTopic"),D=new L(this,m+"WorkQueue",{fifo:!0,retentionPeriod:t.hours(8),visibilityTimeout:t.minutes(5),contentBasedDeduplication:!0,...E}),B=new f(this,m+"InterApiTopic"),W={EPSILON_AWS_REGION:g.safeString(e.of(this).region),EPSILON_AWS_AVAILABILITY_ZONES:g.safeString(JSON.stringify(e.of(this).availabilityZones)),EPSILON_BACKGROUND_SQS_QUEUE_URL:g.safeString(D.queueUrl),EPSILON_BACKGROUND_SNS_TOPIC_ARN:g.safeString(v.topicArn),EPSILON_INTER_API_EVENT_TOPIC_ARN:g.safeString(B.topicArn),EPSILON_LIB_BUILD_HASH:g.safeString(Q.buildInformation().hash),EPSILON_LIB_BUILD_TIME:g.safeString(Q.buildInformation().timeBuiltISO),EPSILON_LIB_BUILD_BRANCH_OR_TAG:g.safeString(Q.buildInformation().branch||Q.buildInformation().tag),EPSILON_LIB_BUILD_VERSION:g.safeString(Q.buildInformation().version)},H=Object.assign({},E.extraEnvironmentalVars||{},W);if(!k.includes(q.AwsBatchHandler)){const e=new l(this,m+"BatchExecutionRole",{assumedBy:new d("ecs-tasks.amazonaws.com"),managedPolicies:[u.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole")],inlinePolicies:{root:new p({statements:Y.ECS_POLICY_STATEMENTS})}}),a=new l(this,m+"BatchJobRole",{assumedBy:new d("ecs-tasks.amazonaws.com"),managedPolicies:[u.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole")],inlinePolicies:{root:new p({statements:Y.createDefaultPolicyStatementList(E,D,v,B)})}}),i={vpc:T.fromLookup(this,"Vpc",{vpcId:E.vpcId}),computeEnvironmentName:m+"ComputeEnv",enabled:!0,maxvCpus:16,replaceComputeEnvironment:!1,securityGroups:E.lambdaSecurityGroupIds.map(((e,t)=>C.fromSecurityGroupId(this,`SecurityGroup${t}`,`sg-${e}`))),serviceRole:l.fromRoleArn(this,`${m}ServiceRole`,"arn:aws:iam::"+E.env.account+":role/AWSBatchServiceRole"),spot:!1,terminateOnUpdate:!1,updateTimeout:t.hours(4),updateToLatestImageVersion:!0},s=new N(this,m+"ComputeEnv",i),r=new _(this,m+"BatchJobQueue",{computeEnvironments:[{order:1,computeEnvironment:s}],enabled:!0,jobQueueName:m+"BatchJobQueue",priority:10,schedulingPolicy:void 0}),n=Y.toEnvironmentVariables([H,E.extraEnvironmentalVars||{},{EPSILON_RUNNING_IN_AWS_BATCH:!0}]),c={cpu:4,image:P.fromRegistry(y.imageUri),memory:o.mebibytes(8192),assignPublicIp:!0,command:["Ref::taskName","Ref::taskData","Ref::traceId","Ref::traceDepth"],environment:n,executionRole:e,jobRole:a,readonlyRootFilesystem:!1,volumes:[]},f=new O(this,`${m}FargateContainerDefinition`,c),L=new I(this,m+"JobDefinition",{jobDefinitionName:m+"JobDefinition",retryAttempts:3,retryStrategies:void 0,schedulingPriority:void 0,timeout:void 0,container:f});H.EPSILON_AWS_BATCH_JOB_DEFINITION_ARN=L.jobDefinitionArn,H.EPSILON_AWS_BATCH_JOB_QUEUE_ARN=r.jobQueueArn}const G=new l(this,"customRole",{roleName:m+"LambdaCustomRole",assumedBy:new d("lambda.amazonaws.com"),managedPolicies:[u.fromAwsManagedPolicyName("service-role/AWSLambdaVPCAccessExecutionRole")],inlinePolicies:{root:new p({statements:Y.createDefaultPolicyStatementList(E,D,v,B)})}});if(!k.includes(q.WebLambda)){if(this.webHandler=new s(this,m+"Web",{retryAttempts:2,memorySize:E.webMemorySizeMb||128,ephemeralStorageSize:o.mebibytes(512),timeout:t.seconds(E.webTimeoutSeconds||20),code:R,role:G,environment:H}),E?.webLambdaPingMinutes&&E.webLambdaPingMinutes>0){new b(this,m+"WebKeepaliveRule",{schedule:A.rate(t.minutes(Math.ceil(E.webLambdaPingMinutes)))}).addTarget(new h(this.webHandler))}const e=this.webHandler.addFunctionUrl({authType:r.NONE,cors:{allowedOrigins:["*"],allowedHeaders:["Content-Type","X-Amz-Date","Authorization","X-Api-Key"],allowedMethods:[n.ALL],allowCredentials:!0}});this.apiDomain=a.uncachedString({produce:t=>({"Fn::Select":[2,{"Fn::Split":["/",t.resolve(e.url)]}]})})}if(!k.includes(q.BackgroundLambda)){this.backgroundHandler=new s(this,m+"Background",{retryAttempts:2,memorySize:E.backgroundMemorySizeMb||3e3,ephemeralStorageSize:o.mebibytes(512),timeout:t.seconds(E.backgroundTimeoutSeconds||900),code:R,role:G,environment:H}),v.addSubscription(new w(this.backgroundHandler)),B.addSubscription(new w(this.backgroundHandler));new b(this,m+"CronRule",{schedule:A.rate(t.minutes(1))}).addTarget(new h(this.backgroundHandler))}}}!function(e){e.Update="Update",e.DoNotUpdate="DoNotUpdate"}(K||(K={}));class X extends e{constructor(e,o,a){super(e,o,a);const i=new v(this,o+"OriginAccessId"),s=new k(this,o+"DeployBucket",{bucketName:a.targetBucketName,versioned:!1,publicReadAccess:!1,encryption:y.S3_MANAGED}),r=(a.simpleAdditionalMappings||[]).map((e=>{const o=k.fromBucketAttributes(this,e.bucketName+"ImportedBucket",{bucketName:e.bucketName});return{bucket:o,sourceConfig:{s3OriginSource:{s3BucketSource:o,originAccessIdentity:i},behaviors:[{pathPattern:e.pathPattern,isDefaultBehavior:!1,compress:!0,defaultTtl:t.seconds(1),minTtl:t.seconds(1),maxTtl:t.seconds(1),forwardedValues:{queryString:!1}}]}}})),n={s3OriginSource:{s3BucketSource:s,originAccessIdentity:i},behaviors:[{isDefaultBehavior:!0,compress:!0,defaultTtl:t.seconds(1),minTtl:t.seconds(1),maxTtl:t.seconds(1),forwardedValues:{queryString:!1}}]},c=(a.apiMappings||[]).map((e=>({customOriginSource:{domainName:e.apiDomainName,originProtocolPolicy:D.HTTPS_ONLY},behaviors:[{compress:!0,forwardedValues:{queryString:!0,cookies:{forward:"whitelist",whitelistedNames:["idToken"]},headers:["Accept","Referer","Authorization","Content-Type"]},pathPattern:e.pathPattern,defaultTtl:t.seconds(0),maxTtl:t.seconds(0),minTtl:t.seconds(0),allowedMethods:B.ALL,cachedMethods:W.GET_HEAD}]}))),m={httpVersion:H.HTTP2,defaultRootObject:"index.html",originConfigs:[n,...c,...r.map((e=>e.sourceConfig))],errorConfigurations:[{errorCode:404,errorCachingMinTtl:300,responseCode:200,responsePagePath:"/index.html"},{errorCode:403,errorCachingMinTtl:300,responseCode:200,responsePagePath:"/index.html"}],priceClass:G.PRICE_CLASS_ALL,viewerProtocolPolicy:F.REDIRECT_TO_HTTPS,viewerCertificate:{aliases:a.cloudFrontDomainNames,props:{acmCertificateArn:a.cloudFrontHttpsCertificateArn,sslSupportMethod:"sni-only"}}},l=new M(this,o+"CloudfrontDistro",m);if(a?.route53Handling===K.Update&&a?.cloudFrontDomainNames?.length)for(let e=0;e<a.cloudFrontDomainNames.length;e++)new U(this,o+"DomainName-"+a.cloudFrontDomainNames[e],{recordType:x.A,recordName:a.cloudFrontDomainNames[e],target:{aliasTarget:new z(l)},zone:V.fromLookup(this,o,{domainName:X.extractApexDomain(a.cloudFrontDomainNames[e])})});new j(this,o+"SiteDeploy",{sources:a.pathsToAssets.map((e=>J.asset(R.resolve(e)))),destinationBucket:s,distribution:l,distributionPaths:["/*"]})}static extractApexDomain(e){const t=g.trimToEmpty(e).split(".");return t.length<2&&E.throwFormattedErr("Not a valid domain name : %s",e),t[t.length-2]+"."+t[t.length-1]}}export{$ as EpsilonApiStack,q as EpsilonApiStackFeature,Y as EpsilonStackUtil,X as EpsilonWebsiteStack,K as EpsilonWebsiteStackPropsRoute53Handling,Q as RatchetEpsilonDeploymentInfo};
2
2
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitblit/ratchet-epsilon-deployment",
3
- "version": "4.0.229-alpha",
3
+ "version": "4.0.232-alpha",
4
4
  "description": "Epsilon CDK extensions to simplify deployment",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -52,15 +52,15 @@
52
52
  "license": "Apache-2.0",
53
53
  "dependencies": {
54
54
  "@aws-cdk/aws-batch-alpha": "2.95.1-alpha.0",
55
- "@bitblit/ratchet-aws": "4.0.229-alpha",
56
- "@bitblit/ratchet-common": "4.0.229-alpha",
57
- "@bitblit/ratchet-epsilon-common": "4.0.229-alpha",
55
+ "@bitblit/ratchet-aws": "4.0.232-alpha",
56
+ "@bitblit/ratchet-common": "4.0.232-alpha",
57
+ "@bitblit/ratchet-epsilon-common": "4.0.232-alpha",
58
58
  "aws-cdk-lib": "2.97.0",
59
59
  "constructs": "10.2.70"
60
60
  },
61
61
  "peerDependencies": {
62
- "@aws-cdk/aws-batch-alpha": "^2.94.0-alpha.0",
63
- "@bitblit/ratchet-common": "4.0.229-alpha",
62
+ "@aws-cdk/aws-batch-alpha": "^2.95.1-alpha.0",
63
+ "@bitblit/ratchet-common": "4.0.232-alpha",
64
64
  "aws-cdk-lib": "^2.94.0",
65
65
  "constructs": "^10.2.70"
66
66
  }