@incloodsolutions/devkit 0.0.4 → 0.0.5
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.
- package/README.md +40 -10
- package/dist/aws-cdk/constructs/api-gateway-v2.cjs.map +1 -0
- package/dist/aws-cdk/{api-gateway-v2.d.cts → constructs/api-gateway-v2.d.cts} +2 -1
- package/dist/aws-cdk/{api-gateway-v2.d.ts → constructs/api-gateway-v2.d.ts} +2 -1
- package/dist/aws-cdk/constructs/api-gateway-v2.js.map +1 -0
- package/dist/aws-cdk/constructs/api-gateway-websocket.cjs.map +1 -0
- package/dist/aws-cdk/{api-gateway-websocket.d.cts → constructs/api-gateway-websocket.d.cts} +2 -1
- package/dist/aws-cdk/{api-gateway-websocket.d.ts → constructs/api-gateway-websocket.d.ts} +2 -1
- package/dist/aws-cdk/constructs/api-gateway-websocket.js.map +1 -0
- package/dist/aws-cdk/constructs/api-gateway.cjs.map +1 -0
- package/dist/aws-cdk/{api-gateway.d.cts → constructs/api-gateway.d.cts} +2 -1
- package/dist/aws-cdk/{api-gateway.d.ts → constructs/api-gateway.d.ts} +2 -1
- package/dist/aws-cdk/constructs/api-gateway.js.map +1 -0
- package/dist/aws-cdk/constructs/cloudfront.cjs.map +1 -0
- package/dist/aws-cdk/{cloudfront.d.cts → constructs/cloudfront.d.cts} +2 -1
- package/dist/aws-cdk/{cloudfront.d.ts → constructs/cloudfront.d.ts} +2 -1
- package/dist/aws-cdk/constructs/cloudfront.js.map +1 -0
- package/dist/aws-cdk/constructs/cloudwatch.cjs.map +1 -0
- package/dist/aws-cdk/{cloudwatch.d.cts → constructs/cloudwatch.d.cts} +2 -1
- package/dist/aws-cdk/{cloudwatch.d.ts → constructs/cloudwatch.d.ts} +2 -1
- package/dist/aws-cdk/constructs/cloudwatch.js.map +1 -0
- package/dist/aws-cdk/constructs/dynamo-db.cjs.map +1 -0
- package/dist/aws-cdk/{dynamo-db.d.cts → constructs/dynamo-db.d.cts} +2 -1
- package/dist/aws-cdk/{dynamo-db.d.ts → constructs/dynamo-db.d.ts} +2 -1
- package/dist/aws-cdk/constructs/dynamo-db.js.map +1 -0
- package/dist/aws-cdk/constructs/event-bridge.cjs.map +1 -0
- package/dist/aws-cdk/{event-bridge.d.cts → constructs/event-bridge.d.cts} +2 -1
- package/dist/aws-cdk/{event-bridge.d.ts → constructs/event-bridge.d.ts} +2 -1
- package/dist/aws-cdk/constructs/event-bridge.js.map +1 -0
- package/dist/aws-cdk/constructs/lambda-authorizer-v2.cjs.map +1 -0
- package/dist/aws-cdk/{lambda-authorizer-v2.d.cts → constructs/lambda-authorizer-v2.d.cts} +2 -1
- package/dist/aws-cdk/{lambda-authorizer-v2.d.ts → constructs/lambda-authorizer-v2.d.ts} +2 -1
- package/dist/aws-cdk/constructs/lambda-authorizer-v2.js.map +1 -0
- package/dist/aws-cdk/constructs/lambda-authorizer.cjs.map +1 -0
- package/dist/aws-cdk/{lambda-authorizer.d.cts → constructs/lambda-authorizer.d.cts} +2 -1
- package/dist/aws-cdk/{lambda-authorizer.d.ts → constructs/lambda-authorizer.d.ts} +2 -1
- package/dist/aws-cdk/constructs/lambda-authorizer.js.map +1 -0
- package/dist/aws-cdk/constructs/lambda-layer.cjs.map +1 -0
- package/dist/aws-cdk/{lambda-layer.d.cts → constructs/lambda-layer.d.cts} +2 -1
- package/dist/aws-cdk/{lambda-layer.d.ts → constructs/lambda-layer.d.ts} +2 -1
- package/dist/aws-cdk/constructs/lambda-layer.js.map +1 -0
- package/dist/aws-cdk/{lambda.cjs → constructs/lambda.cjs} +2 -2
- package/dist/aws-cdk/constructs/lambda.cjs.map +1 -0
- package/dist/aws-cdk/{lambda.d.cts → constructs/lambda.d.cts} +2 -1
- package/dist/aws-cdk/{lambda.d.ts → constructs/lambda.d.ts} +2 -1
- package/dist/aws-cdk/{lambda.js → constructs/lambda.js} +2 -2
- package/dist/aws-cdk/constructs/lambda.js.map +1 -0
- package/dist/aws-cdk/constructs/role-policy.cjs.map +1 -0
- package/dist/aws-cdk/{role-policy.d.cts → constructs/role-policy.d.cts} +2 -1
- package/dist/aws-cdk/{role-policy.d.ts → constructs/role-policy.d.ts} +2 -1
- package/dist/aws-cdk/constructs/role-policy.js.map +1 -0
- package/dist/aws-cdk/constructs/route53.cjs +79 -0
- package/dist/aws-cdk/constructs/route53.cjs.map +1 -0
- package/dist/aws-cdk/constructs/route53.d.cts +95 -0
- package/dist/aws-cdk/constructs/route53.d.ts +95 -0
- package/dist/aws-cdk/constructs/route53.js +77 -0
- package/dist/aws-cdk/constructs/route53.js.map +1 -0
- package/dist/aws-cdk/constructs/s3-deployment.cjs.map +1 -0
- package/dist/aws-cdk/{s3-deployment.d.cts → constructs/s3-deployment.d.cts} +2 -1
- package/dist/aws-cdk/{s3-deployment.d.ts → constructs/s3-deployment.d.ts} +2 -1
- package/dist/aws-cdk/constructs/s3-deployment.js.map +1 -0
- package/dist/aws-cdk/constructs/s3.cjs.map +1 -0
- package/dist/aws-cdk/{s3.d.cts → constructs/s3.d.cts} +2 -1
- package/dist/aws-cdk/{s3.d.ts → constructs/s3.d.ts} +2 -1
- package/dist/aws-cdk/constructs/s3.js.map +1 -0
- package/dist/aws-cdk/constructs/sns.cjs.map +1 -0
- package/dist/aws-cdk/{sns.d.cts → constructs/sns.d.cts} +2 -1
- package/dist/aws-cdk/{sns.d.ts → constructs/sns.d.ts} +2 -1
- package/dist/aws-cdk/constructs/sns.js.map +1 -0
- package/dist/aws-cdk/constructs/sqs.cjs.map +1 -0
- package/dist/aws-cdk/{sqs.d.cts → constructs/sqs.d.cts} +2 -1
- package/dist/aws-cdk/{sqs.d.ts → constructs/sqs.d.ts} +2 -1
- package/dist/aws-cdk/constructs/sqs.js.map +1 -0
- package/dist/aws-cdk/constructs/vpc.cjs.map +1 -0
- package/dist/aws-cdk/{vpc.d.cts → constructs/vpc.d.cts} +2 -1
- package/dist/aws-cdk/{vpc.d.ts → constructs/vpc.d.ts} +2 -1
- package/dist/aws-cdk/constructs/vpc.js.map +1 -0
- package/dist/aws-cdk/stacks/lambda-api.cjs +252 -0
- package/dist/aws-cdk/stacks/lambda-api.cjs.map +1 -0
- package/dist/aws-cdk/stacks/lambda-api.d.cts +16 -0
- package/dist/aws-cdk/stacks/lambda-api.d.ts +16 -0
- package/dist/aws-cdk/stacks/lambda-api.js +250 -0
- package/dist/aws-cdk/stacks/lambda-api.js.map +1 -0
- package/dist/aws-cdk/stacks/lambda-sns.cjs +211 -0
- package/dist/aws-cdk/stacks/lambda-sns.cjs.map +1 -0
- package/dist/aws-cdk/stacks/lambda-sns.d.cts +17 -0
- package/dist/aws-cdk/stacks/lambda-sns.d.ts +17 -0
- package/dist/aws-cdk/stacks/lambda-sns.js +209 -0
- package/dist/aws-cdk/stacks/lambda-sns.js.map +1 -0
- package/dist/aws-cdk/stacks/lambda-sqs.cjs +220 -0
- package/dist/aws-cdk/stacks/lambda-sqs.cjs.map +1 -0
- package/dist/aws-cdk/stacks/lambda-sqs.d.cts +18 -0
- package/dist/aws-cdk/stacks/lambda-sqs.d.ts +18 -0
- package/dist/aws-cdk/stacks/lambda-sqs.js +218 -0
- package/dist/aws-cdk/stacks/lambda-sqs.js.map +1 -0
- package/dist/aws-types.d.cts +14 -1
- package/dist/aws-types.d.ts +14 -1
- package/dist/aws.cjs +199 -2
- package/dist/aws.cjs.map +1 -1
- package/dist/aws.d.cts +25 -19
- package/dist/aws.d.ts +25 -19
- package/dist/aws.js +198 -5
- package/dist/aws.js.map +1 -1
- package/dist/index.cjs +199 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -18
- package/dist/index.d.ts +24 -18
- package/dist/index.js +198 -5
- package/dist/index.js.map +1 -1
- package/package.json +130 -152
- package/dist/aws-cdk/api-gateway-v2.cjs.map +0 -1
- package/dist/aws-cdk/api-gateway-v2.js.map +0 -1
- package/dist/aws-cdk/api-gateway-websocket.cjs.map +0 -1
- package/dist/aws-cdk/api-gateway-websocket.js.map +0 -1
- package/dist/aws-cdk/api-gateway.cjs.map +0 -1
- package/dist/aws-cdk/api-gateway.js.map +0 -1
- package/dist/aws-cdk/cloudfront.cjs.map +0 -1
- package/dist/aws-cdk/cloudfront.js.map +0 -1
- package/dist/aws-cdk/cloudwatch.cjs.map +0 -1
- package/dist/aws-cdk/cloudwatch.js.map +0 -1
- package/dist/aws-cdk/dynamo-db.cjs.map +0 -1
- package/dist/aws-cdk/dynamo-db.js.map +0 -1
- package/dist/aws-cdk/event-bridge.cjs.map +0 -1
- package/dist/aws-cdk/event-bridge.js.map +0 -1
- package/dist/aws-cdk/lambda-authorizer-v2.cjs.map +0 -1
- package/dist/aws-cdk/lambda-authorizer-v2.js.map +0 -1
- package/dist/aws-cdk/lambda-authorizer.cjs.map +0 -1
- package/dist/aws-cdk/lambda-authorizer.js.map +0 -1
- package/dist/aws-cdk/lambda-layer.cjs.map +0 -1
- package/dist/aws-cdk/lambda-layer.js.map +0 -1
- package/dist/aws-cdk/lambda.cjs.map +0 -1
- package/dist/aws-cdk/lambda.js.map +0 -1
- package/dist/aws-cdk/role-policy.cjs.map +0 -1
- package/dist/aws-cdk/role-policy.js.map +0 -1
- package/dist/aws-cdk/s3-deployment.cjs.map +0 -1
- package/dist/aws-cdk/s3-deployment.js.map +0 -1
- package/dist/aws-cdk/s3.cjs.map +0 -1
- package/dist/aws-cdk/s3.js.map +0 -1
- package/dist/aws-cdk/sns.cjs.map +0 -1
- package/dist/aws-cdk/sns.js.map +0 -1
- package/dist/aws-cdk/sqs.cjs.map +0 -1
- package/dist/aws-cdk/sqs.js.map +0 -1
- package/dist/aws-cdk/vpc.cjs.map +0 -1
- package/dist/aws-cdk/vpc.js.map +0 -1
- package/dist/aws-cdk.cjs +0 -905
- package/dist/aws-cdk.cjs.map +0 -1
- package/dist/aws-cdk.d.cts +0 -34
- package/dist/aws-cdk.d.ts +0 -34
- package/dist/aws-cdk.js +0 -887
- package/dist/aws-cdk.js.map +0 -1
- /package/dist/aws-cdk/{api-gateway-v2.cjs → constructs/api-gateway-v2.cjs} +0 -0
- /package/dist/aws-cdk/{api-gateway-v2.js → constructs/api-gateway-v2.js} +0 -0
- /package/dist/aws-cdk/{api-gateway-websocket.cjs → constructs/api-gateway-websocket.cjs} +0 -0
- /package/dist/aws-cdk/{api-gateway-websocket.js → constructs/api-gateway-websocket.js} +0 -0
- /package/dist/aws-cdk/{api-gateway.cjs → constructs/api-gateway.cjs} +0 -0
- /package/dist/aws-cdk/{api-gateway.js → constructs/api-gateway.js} +0 -0
- /package/dist/aws-cdk/{cloudfront.cjs → constructs/cloudfront.cjs} +0 -0
- /package/dist/aws-cdk/{cloudfront.js → constructs/cloudfront.js} +0 -0
- /package/dist/aws-cdk/{cloudwatch.cjs → constructs/cloudwatch.cjs} +0 -0
- /package/dist/aws-cdk/{cloudwatch.js → constructs/cloudwatch.js} +0 -0
- /package/dist/aws-cdk/{dynamo-db.cjs → constructs/dynamo-db.cjs} +0 -0
- /package/dist/aws-cdk/{dynamo-db.js → constructs/dynamo-db.js} +0 -0
- /package/dist/aws-cdk/{event-bridge.cjs → constructs/event-bridge.cjs} +0 -0
- /package/dist/aws-cdk/{event-bridge.js → constructs/event-bridge.js} +0 -0
- /package/dist/aws-cdk/{lambda-authorizer-v2.cjs → constructs/lambda-authorizer-v2.cjs} +0 -0
- /package/dist/aws-cdk/{lambda-authorizer-v2.js → constructs/lambda-authorizer-v2.js} +0 -0
- /package/dist/aws-cdk/{lambda-authorizer.cjs → constructs/lambda-authorizer.cjs} +0 -0
- /package/dist/aws-cdk/{lambda-authorizer.js → constructs/lambda-authorizer.js} +0 -0
- /package/dist/aws-cdk/{lambda-layer.cjs → constructs/lambda-layer.cjs} +0 -0
- /package/dist/aws-cdk/{lambda-layer.js → constructs/lambda-layer.js} +0 -0
- /package/dist/aws-cdk/{role-policy.cjs → constructs/role-policy.cjs} +0 -0
- /package/dist/aws-cdk/{role-policy.js → constructs/role-policy.js} +0 -0
- /package/dist/aws-cdk/{s3-deployment.cjs → constructs/s3-deployment.cjs} +0 -0
- /package/dist/aws-cdk/{s3-deployment.js → constructs/s3-deployment.js} +0 -0
- /package/dist/aws-cdk/{s3.cjs → constructs/s3.cjs} +0 -0
- /package/dist/aws-cdk/{s3.js → constructs/s3.js} +0 -0
- /package/dist/aws-cdk/{sns.cjs → constructs/sns.cjs} +0 -0
- /package/dist/aws-cdk/{sns.js → constructs/sns.js} +0 -0
- /package/dist/aws-cdk/{sqs.cjs → constructs/sqs.cjs} +0 -0
- /package/dist/aws-cdk/{sqs.js → constructs/sqs.js} +0 -0
- /package/dist/aws-cdk/{vpc.cjs → constructs/vpc.cjs} +0 -0
- /package/dist/aws-cdk/{vpc.js → constructs/vpc.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/lambda-layer-construct.ts"],"names":["Construct","LayerVersion","Code","Architecture","Runtime","CfnOutput"],"mappings":";;;;;;;;AAsDO,IAAM,wBAAA,GAAN,cAAuCA,oBAAA,CAAU;AAAA,EAtDxD;AAsDwD,IAAA,MAAA,CAAA,IAAA,EAAA,0BAAA,CAAA;AAAA;AAAA;AAAA,EAE9C,KAAA;AAAA;AAAA,EAGA,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAKf,IAAA,IAAI,KAAA,EAAO,SAAS,oBAAA,EAAsB;AACzC,MAAA,IAAA,CAAK,gBAAgBC,sBAAA,CAAa,mBAAA;AAAA,QACjC,IAAA;AAAA,QACA,GAAG,EAAE,CAAA,IAAA,CAAA;AAAA,QACL,OAAO,OAAA,EAAS;AAAA,OACjB;AAAA,IAKD,CAAA,MAAA,IAAW,KAAA,EAAO,OAAA,EAAS,0BAAA,EAA4B;AACtD,MAAA,IAAA,CAAK,gBAAgBA,sBAAA,CAAa,0BAAA;AAAA,QACjC,IAAA;AAAA,QACA,GAAG,EAAE,CAAA,UAAA,CAAA;AAAA,QACL,OAAO,OAAA,EAAS;AAAA,OACjB;AAAA,IAKD,CAAA,MAAO;AACN,MAAA,IAAA,CAAK,KAAA,GAAQ,IAAIA,sBAAA,CAAa,IAAA,EAAM,EAAA,EAAI;AAAA,QACvC,GAAG,MAAM,OAAA,EAAS,YAAA;AAAA;AAAA;AAAA;AAAA,QAKlB,MACC,KAAA,EAAO,OAAA,EAAS,cAAc,IAAA,IAAQC,cAAA,CAAK,UAAU,cAAc,CAAA;AAAA;AAAA;AAAA;AAAA,QAKpE,WAAA,EACC,KAAA,EAAO,OAAA,EAAS,YAAA,EAAc,WAAA,IAC9B,4EAAA;AAAA;AAAA;AAAA;AAAA,QAKD,uBAAA,EAAyB,CAACC,sBAAA,CAAa,MAAA,EAAQA,uBAAa,MAAM,CAAA;AAAA;AAAA;AAAA;AAAA,QAKlE,kBAAA,EAAoB;AAAA,UACnBC,iBAAA,CAAQ,WAAA;AAAA,UACRA,iBAAA,CAAQ,WAAA;AAAA,UACRA,iBAAA,CAAQ;AAAA;AACT,OACqB,CAAA;AAAA,IACvB;AAMA,IAAA,IAAIC,mBAAA,CAAU,MAAM,gBAAA,EAAkB;AAAA,MACrC,KAAA,EACC,KAAA,CAAM,OAAA,EAAS,oBAAA,IACf,KAAA,CAAM,OAAA,EAAS,0BAAA,GACZ,IAAA,CAAK,aAAA,CAAc,eAAA,GACnB,IAAA,CAAK,KAAA,CAAM;AAAA,KACf,CAAA;AAAA,EACF;AACD","file":"lambda-layer.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport {\n\tArchitecture,\n\tCode,\n\tILayerVersion,\n\tLayerVersion,\n\tLayerVersionProps,\n\tRuntime,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaLayerConstruct\n *\n * Provides configuration for:\n * - Creating a new Lambda Layer\n * - Importing an existing layer by ARN or attributes\n */\ninterface ILambdaLayerConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/**\n\t\t * Configuration for creating a new Lambda layer\n\t\t *\n\t\t * Note:\n\t\t * - `layerVersionName` is required\n\t\t * - `compatibleArchitectures` is managed internally\n\t\t */\n\t\treadonly layerOptions?: Partial<\n\t\t\tOmit<LayerVersionProps, 'layerVersionName' | 'compatibleArchitectures'>\n\t\t> &\n\t\t\tRequired<Pick<LayerVersionProps, 'layerVersionName'>>;\n\n\t\t/** Import an existing layer by ARN */\n\t\treadonly fromExistingLayerArn?: string;\n\n\t\t/** Import an existing layer using attributes */\n\t\treadonly fromExistingLayerAttribute?: {\n\t\t\treadonly layerVersionArn: string;\n\t\t\treadonly compatibleRuntimes?: Runtime[];\n\t\t};\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for Lambda Layer\n *\n * Responsibilities:\n * - Creates a new Lambda layer or imports an existing one\n * - Applies default runtime and architecture compatibility\n * - Exposes the layer ARN as a CloudFormation output\n */\nexport class BaseLambdaLayerConstruct extends Construct {\n\t/** Newly created Lambda Layer (null if importing existing layer) */\n\treadonly layer: LayerVersion;\n\n\t/** Imported Lambda Layer reference (null if creating new layer) */\n\treadonly existingLayer: ILayerVersion;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for layer creation or import\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops?: ILambdaLayerConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Import layer by ARN\n\t\t */\n\t\tif (props?.options?.fromExistingLayerArn) {\n\t\t\tthis.existingLayer = LayerVersion.fromLayerVersionArn(\n\t\t\t\tthis,\n\t\t\t\t`${id}-Arn`,\n\t\t\t\tprops?.options?.fromExistingLayerArn,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Import layer using attributes\n\t\t\t */\n\t\t} else if (props?.options?.fromExistingLayerAttribute) {\n\t\t\tthis.existingLayer = LayerVersion.fromLayerVersionAttributes(\n\t\t\t\tthis,\n\t\t\t\t`${id}-Attribute`,\n\t\t\t\tprops?.options?.fromExistingLayerAttribute,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Create new Lambda layer\n\t\t\t */\n\t\t} else {\n\t\t\tthis.layer = new LayerVersion(this, id, {\n\t\t\t\t...props.options?.layerOptions,\n\n\t\t\t\t/**\n\t\t\t\t * Default layer code asset\n\t\t\t\t */\n\t\t\t\tcode:\n\t\t\t\t\tprops?.options?.layerOptions?.code || Code.fromAsset('./dist-layer'),\n\n\t\t\t\t/**\n\t\t\t\t * Layer description\n\t\t\t\t */\n\t\t\t\tdescription:\n\t\t\t\t\tprops?.options?.layerOptions?.description ||\n\t\t\t\t\t'Lambda Layer written in NodeJS, NestJS, NodeJS-express, serverless-express',\n\n\t\t\t\t/**\n\t\t\t\t * Supported CPU architectures\n\t\t\t\t */\n\t\t\t\tcompatibleArchitectures: [Architecture.ARM_64, Architecture.X86_64],\n\n\t\t\t\t/**\n\t\t\t\t * Supported runtimes\n\t\t\t\t */\n\t\t\t\tcompatibleRuntimes: [\n\t\t\t\t\tRuntime.NODEJS_22_X,\n\t\t\t\t\tRuntime.NODEJS_24_X,\n\t\t\t\t\tRuntime.NODEJS_LATEST,\n\t\t\t\t],\n\t\t\t} as LayerVersionProps);\n\t\t}\n\n\t\t/**\n\t\t * CloudFormation output exposing the layer ARN\n\t\t * Resolves to either created or imported layer\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaLayerArn', {\n\t\t\tvalue:\n\t\t\t\tprops.options?.fromExistingLayerArn ||\n\t\t\t\tprops.options?.fromExistingLayerAttribute\n\t\t\t\t\t? this.existingLayer.layerVersionArn\n\t\t\t\t\t: this.layer.layerVersionArn,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/lambda-layer-construct.ts"],"names":[],"mappings":";;;;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Q,WAAA;AAAA,UACR,OAAA,CAAQ,WAAA;AAAA,UACR,OAAA,CAAQ;AAAA;AACT,OACqB,CAAA;AAAA,IACvB;AAMA,IAAA,IAAI,SAAA,CAAU,MAAM,gBAAA,EAAkB;AAAA,MACrC,KAAA,EACC,KAAA,CAAM,OAAA,EAAS,oBAAA,IACf,KAAA,CAAM,OAAA,EAAS,0BAAA,GACZ,IAAA,CAAK,aAAA,CAAc,eAAA,GACnB,IAAA,CAAK,KAAA,CAAM;AAAA,KACf,CAAA;AAAA,EACF;AACD","file":"lambda-layer.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport {\n\tArchitecture,\n\tCode,\n\tILayerVersion,\n\tLayerVersion,\n\tLayerVersionProps,\n\tRuntime,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaLayerConstruct\n *\n * Provides configuration for:\n * - Creating a new Lambda Layer\n * - Importing an existing layer by ARN or attributes\n */\ninterface ILambdaLayerConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/**\n\t\t * Configuration for creating a new Lambda layer\n\t\t *\n\t\t * Note:\n\t\t * - `layerVersionName` is required\n\t\t * - `compatibleArchitectures` is managed internally\n\t\t */\n\t\treadonly layerOptions?: Partial<\n\t\t\tOmit<LayerVersionProps, 'layerVersionName' | 'compatibleArchitectures'>\n\t\t> &\n\t\t\tRequired<Pick<LayerVersionProps, 'layerVersionName'>>;\n\n\t\t/** Import an existing layer by ARN */\n\t\treadonly fromExistingLayerArn?: string;\n\n\t\t/** Import an existing layer using attributes */\n\t\treadonly fromExistingLayerAttribute?: {\n\t\t\treadonly layerVersionArn: string;\n\t\t\treadonly compatibleRuntimes?: Runtime[];\n\t\t};\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for Lambda Layer\n *\n * Responsibilities:\n * - Creates a new Lambda layer or imports an existing one\n * - Applies default runtime and architecture compatibility\n * - Exposes the layer ARN as a CloudFormation output\n */\nexport class BaseLambdaLayerConstruct extends Construct {\n\t/** Newly created Lambda Layer (null if importing existing layer) */\n\treadonly layer: LayerVersion;\n\n\t/** Imported Lambda Layer reference (null if creating new layer) */\n\treadonly existingLayer: ILayerVersion;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for layer creation or import\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops?: ILambdaLayerConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Import layer by ARN\n\t\t */\n\t\tif (props?.options?.fromExistingLayerArn) {\n\t\t\tthis.existingLayer = LayerVersion.fromLayerVersionArn(\n\t\t\t\tthis,\n\t\t\t\t`${id}-Arn`,\n\t\t\t\tprops?.options?.fromExistingLayerArn,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Import layer using attributes\n\t\t\t */\n\t\t} else if (props?.options?.fromExistingLayerAttribute) {\n\t\t\tthis.existingLayer = LayerVersion.fromLayerVersionAttributes(\n\t\t\t\tthis,\n\t\t\t\t`${id}-Attribute`,\n\t\t\t\tprops?.options?.fromExistingLayerAttribute,\n\t\t\t);\n\n\t\t\t/**\n\t\t\t * Create new Lambda layer\n\t\t\t */\n\t\t} else {\n\t\t\tthis.layer = new LayerVersion(this, id, {\n\t\t\t\t...props.options?.layerOptions,\n\n\t\t\t\t/**\n\t\t\t\t * Default layer code asset\n\t\t\t\t */\n\t\t\t\tcode:\n\t\t\t\t\tprops?.options?.layerOptions?.code || Code.fromAsset('./dist-layer'),\n\n\t\t\t\t/**\n\t\t\t\t * Layer description\n\t\t\t\t */\n\t\t\t\tdescription:\n\t\t\t\t\tprops?.options?.layerOptions?.description ||\n\t\t\t\t\t'Lambda Layer written in NodeJS, NestJS, NodeJS-express, serverless-express',\n\n\t\t\t\t/**\n\t\t\t\t * Supported CPU architectures\n\t\t\t\t */\n\t\t\t\tcompatibleArchitectures: [Architecture.ARM_64, Architecture.X86_64],\n\n\t\t\t\t/**\n\t\t\t\t * Supported runtimes\n\t\t\t\t */\n\t\t\t\tcompatibleRuntimes: [\n\t\t\t\t\tRuntime.NODEJS_22_X,\n\t\t\t\t\tRuntime.NODEJS_24_X,\n\t\t\t\t\tRuntime.NODEJS_LATEST,\n\t\t\t\t],\n\t\t\t} as LayerVersionProps);\n\t\t}\n\n\t\t/**\n\t\t * CloudFormation output exposing the layer ARN\n\t\t * Resolves to either created or imported layer\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaLayerArn', {\n\t\t\tvalue:\n\t\t\t\tprops.options?.fromExistingLayerArn ||\n\t\t\t\tprops.options?.fromExistingLayerAttribute\n\t\t\t\t\t? this.existingLayer.layerVersionArn\n\t\t\t\t\t: this.layer.layerVersionArn,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/lambda-construct.ts"],"names":["Construct","detectDuplicateProperties","Function","Runtime","Duration","AppEnvironmentEnum","Architecture","Code","CfnOutput"],"mappings":";;;;;;;;;AAwCO,IAAM,mBAAA,GAAN,cAAkCA,oBAAA,CAAU;AAAA,EAxCnD;AAwCmD,IAAA,MAAA,CAAA,IAAA,EAAA,qBAAA,CAAA;AAAA;AAAA;AAAA,EAEzC,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAA8B;AACvE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAUf,IAAA,MAAM,WAAA,GAAc;AAAA,MACnB,GAAG,KAAA,CAAM,OAAA,EAAS,aAAA,EAAe,WAAA;AAAA,MACjC,UAAU,KAAA,CAAM,KAAA;AAAA,MAChB,YAAA,EAAc,sBAAA;AAAA,MACd,mCAAA,EAAqC;AAAA,KACtC;AAKA,IAAAC,iCAAA,CAA0B,EAAE,IAAA,EAAM,WAAA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AAA,KACrB,CAAA;AAAA,EACF;AACD","file":"lambda.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, Duration } from 'aws-cdk-lib';\nimport {\n\tArchitecture,\n\tCode,\n\tFunction,\n\tFunctionProps,\n\tRuntime,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport {\n\tdetectDuplicateProperties,\n\tAppEnvironmentEnum,\n} from '@incloodsolutions/toolkit';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaConstruct\n *\n * Provides configuration for creating a Lambda function\n * with optional overrides for runtime, memory, timeout, and environment.\n */\ninterface ILambdaConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Partial Lambda configuration options */\n\t\treadonly lambdaOptions: Partial<FunctionProps>;\n\t}>,\n\t'appName'\n> {}\n\n/**\n * CDK construct for AWS Lambda function\n *\n * Responsibilities:\n * - Creates a Lambda function with sensible defaults\n * - Merges and validates environment variables\n * - Applies stage-based configuration (e.g. timeout)\n * - Exposes the function ARN as a CloudFormation output\n */\nexport class BaseLambdaConstruct extends Construct {\n\t/** The created Lambda function instance */\n\treadonly function: Function;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for Lambda function\n\t */\n\tconstructor(scope: Construct, id: string, props: ILambdaConstructProps) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Environment variables for the Lambda function\n\t\t *\n\t\t * Includes:\n\t\t * - User-defined variables\n\t\t * - NODE_ENV derived from stage\n\t\t * - Node.js runtime optimisations\n\t\t */\n\t\tconst environment = {\n\t\t\t...props.options?.lambdaOptions?.environment,\n\t\t\tNODE_ENV: props.stage,\n\t\t\tNODE_OPTIONS: '--enable-source-maps',\n\t\t\tAWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',\n\t\t};\n\n\t\t/**\n\t\t * Validate environment variables for duplicate keys\n\t\t */\n\t\tdetectDuplicateProperties({ data: environment });\n\n\t\tthis.function = new Function(this, id, {\n\t\t\t...props?.options?.lambdaOptions,\n\n\t\t\t/**\n\t\t\t * Lambda function name\n\t\t\t * Defaults to \"<stackName>-handler\" if not provided\n\t\t\t */\n\t\t\tfunctionName: `${props?.options?.lambdaOptions?.functionName || props?.stackName}-handler`,\n\n\t\t\t/**\n\t\t\t * Function description\n\t\t\t */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.lambdaOptions?.description || 'A lambda function',\n\n\t\t\t/**\n\t\t\t * Entry handler for the Lambda function\n\t\t\t */\n\t\t\thandler: props?.options?.lambdaOptions?.handler || 'lambda.handler',\n\n\t\t\t/**\n\t\t\t * Runtime environment\n\t\t\t */\n\t\t\truntime: props?.options?.lambdaOptions?.runtime || Runtime.NODEJS_24_X,\n\n\t\t\t/**\n\t\t\t * Execution timeout\n\t\t\t * - 30 seconds in production\n\t\t\t * - 15 seconds otherwise\n\t\t\t */\n\t\t\ttimeout:\n\t\t\t\tprops?.options?.lambdaOptions?.timeout ||\n\t\t\t\tDuration.seconds(\n\t\t\t\t\tprops.stage === AppEnvironmentEnum.PRODUCTION ? 30 : 15,\n\t\t\t\t),\n\n\t\t\t/**\n\t\t\t * Memory allocation (in MB)\n\t\t\t */\n\t\t\tmemorySize: props?.options?.lambdaOptions?.memorySize || 1024,\n\n\t\t\t/**\n\t\t\t * CPU architecture\n\t\t\t */\n\t\t\tarchitecture:\n\t\t\t\tprops?.options?.lambdaOptions?.architecture || Architecture.ARM_64,\n\n\t\t\t/**\n\t\t\t * Lambda deployment package source\n\t\t\t */\n\t\t\tcode: props?.options?.lambdaOptions?.code || Code.fromAsset('dist'),\n\n\t\t\t/**\n\t\t\t * Final merged environment variables\n\t\t\t */\n\t\t\tenvironment,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the Lambda function ARN\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaFunctionArn', {\n\t\t\tvalue: this.function.functionArn,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1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AS,aAAA,EAAe,WAC/B,QAAA,CAAS,OAAA;AAAA,QACR,KAAA,CAAM,KAAA,KAAU,kBAAA,CAAmB,UAAA,GAAa,EAAA,GAAK;AAAA,OACtD;AAAA;AAAA;AAAA;AAAA,MAKD,UAAA,EAAY,KAAA,EAAO,OAAA,EAAS,aAAA,EAAe,UAAA,IAAc,IAAA;AAAA;AAAA;AAAA;AAAA,MAKzD,YAAA,EACC,KAAA,EAAO,OAAA,EAAS,aAAA,EAAe,gBAAgB,YAAA,CAAa,MAAA;AAAA;AAAA;AAAA;AAAA,MAK7D,MAAM,KAAA,EAAO,OAAA,EAAS,eAAe,IAAA,IAAQ,IAAA,CAAK,UAAU,MAAM,CAAA;AAAA;AAAA;AAAA;AAAA,MAKlE;AAAA,KACA,CAAA;AAKD,IAAA,IAAI,SAAA,CAAU,MAAM,mBAAA,EAAqB;AAAA,MACxC,KAAA,EAAO,KAAK,QAAA,CAAS;AAAA,KACrB,CAAA;AAAA,EACF;AACD","file":"lambda.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, Duration } from 'aws-cdk-lib';\nimport {\n\tArchitecture,\n\tCode,\n\tFunction,\n\tFunctionProps,\n\tRuntime,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport {\n\tdetectDuplicateProperties,\n\tAppEnvironmentEnum,\n} from '@incloodsolutions/toolkit';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseLambdaConstruct\n *\n * Provides configuration for creating a Lambda function\n * with optional overrides for runtime, memory, timeout, and environment.\n */\ninterface ILambdaConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Partial Lambda configuration options */\n\t\treadonly lambdaOptions: Partial<FunctionProps>;\n\t}>,\n\t'appName'\n> {}\n\n/**\n * CDK construct for AWS Lambda function\n *\n * Responsibilities:\n * - Creates a Lambda function with sensible defaults\n * - Merges and validates environment variables\n * - Applies stage-based configuration (e.g. timeout)\n * - Exposes the function ARN as a CloudFormation output\n */\nexport class BaseLambdaConstruct extends Construct {\n\t/** The created Lambda function instance */\n\treadonly function: Function;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for Lambda function\n\t */\n\tconstructor(scope: Construct, id: string, props: ILambdaConstructProps) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Environment variables for the Lambda function\n\t\t *\n\t\t * Includes:\n\t\t * - User-defined variables\n\t\t * - NODE_ENV derived from stage\n\t\t * - Node.js runtime optimisations\n\t\t */\n\t\tconst environment = {\n\t\t\t...props.options?.lambdaOptions?.environment,\n\t\t\tNODE_ENV: props.stage,\n\t\t\tNODE_OPTIONS: '--enable-source-maps',\n\t\t\tAWS_NODEJS_CONNECTION_REUSE_ENABLED: '1',\n\t\t};\n\n\t\t/**\n\t\t * Validate environment variables for duplicate keys\n\t\t */\n\t\tdetectDuplicateProperties({ data: environment });\n\n\t\tthis.function = new Function(this, id, {\n\t\t\t...props?.options?.lambdaOptions,\n\n\t\t\t/**\n\t\t\t * Lambda function name\n\t\t\t * Defaults to \"<stackName>-handler\" if not provided\n\t\t\t */\n\t\t\tfunctionName: `${props?.options?.lambdaOptions?.functionName || props?.stackName}-handler`,\n\n\t\t\t/**\n\t\t\t * Function description\n\t\t\t */\n\t\t\tdescription:\n\t\t\t\tprops?.options?.lambdaOptions?.description || 'A lambda function',\n\n\t\t\t/**\n\t\t\t * Entry handler for the Lambda function\n\t\t\t */\n\t\t\thandler: props?.options?.lambdaOptions?.handler || 'lambda.handler',\n\n\t\t\t/**\n\t\t\t * Runtime environment\n\t\t\t */\n\t\t\truntime: props?.options?.lambdaOptions?.runtime || Runtime.NODEJS_24_X,\n\n\t\t\t/**\n\t\t\t * Execution timeout\n\t\t\t * - 30 seconds in production\n\t\t\t * - 15 seconds otherwise\n\t\t\t */\n\t\t\ttimeout:\n\t\t\t\tprops?.options?.lambdaOptions?.timeout ||\n\t\t\t\tDuration.seconds(\n\t\t\t\t\tprops.stage === AppEnvironmentEnum.PRODUCTION ? 30 : 15,\n\t\t\t\t),\n\n\t\t\t/**\n\t\t\t * Memory allocation (in MB)\n\t\t\t */\n\t\t\tmemorySize: props?.options?.lambdaOptions?.memorySize || 1024,\n\n\t\t\t/**\n\t\t\t * CPU architecture\n\t\t\t */\n\t\t\tarchitecture:\n\t\t\t\tprops?.options?.lambdaOptions?.architecture || Architecture.ARM_64,\n\n\t\t\t/**\n\t\t\t * Lambda deployment package source\n\t\t\t */\n\t\t\tcode: props?.options?.lambdaOptions?.code || Code.fromAsset('dist'),\n\n\t\t\t/**\n\t\t\t * Final merged environment variables\n\t\t\t */\n\t\t\tenvironment,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the Lambda function ARN\n\t\t */\n\t\tnew CfnOutput(this, 'LambdaFunctionArn', {\n\t\t\tvalue: this.function.functionArn,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/role-policy-construct.ts"],"names":["Construct","Role","ManagedPolicy","PolicyStatement","RemovalPolicy","CfnOutput"],"mappings":";;;;;;;;AA2CO,IAAM,uBAAA,GAAN,cAAsCA,oBAAA,CAAU;AAAA,EA3CvD;AA2CuD,IAAA,MAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAE7C,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAgC;AACzE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAIC,WAAA,CAAK,IAAA,EAAM,EAAA,EAAI;AAAA,MAC9B,GAAG,MAAM,OAAA,EAAS,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,eAAA,EAAiB,MAAM,OAAA,EAAS,WAAA,EAAa,kBAC1C,KAAA,CAAM,OAAA,CAAQ,YAAY,eAAA,GAC1B;AAAA,QACAC,oBAAA,CAAc,wBAAA;AAAA,UACb;AAAA;AACD;AACD,KACF,CAAA;AAKD,IAAA,IAAI,KAAA,EAAO,UAAU,MAAA,EAAQ;AAC5B,MAAA,KAAA,CAAM,QAAA,CAAS,OAAA,CAAQ,CAAC,MAAA,KAAW;AAClC,QAAA,IAAA,CAAK,IAAA,CAAK,WAAA;AAAA;AAAA;AAAA;AAAA,UAIT,IAAIC,uBAAgB,MAAM;AAAA,SAC3B;AAAA,MACD,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,IAAA,CAAK,kBAAA,CAAmBC,uBAAA,CAAc,OAAO,CAAA;AAKlD,IAAA,IAAIC,mBAAA,CAAU,MAAM,eAAA,EAAiB;AAAA,MACpC,KAAA,EAAO,KAAK,IAAA,CAAK;AAAA,KACjB,CAAA;AAAA,EACF;AACD","file":"role-policy.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport {\n\tManagedPolicy,\n\tPolicyStatement,\n\tPolicyStatementProps,\n\tRole,\n\tRoleProps,\n} from 'aws-cdk-lib/aws-iam';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseRolePolicyConstruct\n *\n * Provides configuration for:\n * - IAM role creation\n * - Inline policy statements\n */\ninterface IDynamoDBConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** IAM Role configuration options */\n\t\treadonly roleOptions: RoleProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Additional inline policies to attach to the role\n\t *\n\t * Each entry is converted into a PolicyStatement\n\t */\n\treadonly policies?: PolicyStatementProps[];\n}\n\n/**\n * CDK construct for IAM Role with policies\n *\n * Responsibilities:\n * - Creates an IAM role with configurable options\n * - Applies a default AWS managed policy if none is provided\n * - Attaches optional inline policy statements\n * - Exposes the role ARN as a CloudFormation output\n */\nexport class BaseRolePolicyConstruct extends Construct {\n\t/** The created IAM Role instance */\n\treadonly role: Role;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for role and policies\n\t */\n\tconstructor(scope: Construct, id: string, props: IDynamoDBConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.role = new Role(this, id, {\n\t\t\t...props.options?.roleOptions,\n\n\t\t\t/**\n\t\t\t * Managed policies attached to the role\n\t\t\t * Defaults to AWSLambdaBasicExecutionRole if not provided\n\t\t\t */\n\t\t\tmanagedPolicies: props.options?.roleOptions?.managedPolicies\n\t\t\t\t? props.options.roleOptions.managedPolicies\n\t\t\t\t: [\n\t\t\t\t\t\tManagedPolicy.fromAwsManagedPolicyName(\n\t\t\t\t\t\t\t'service-role/AWSLambdaBasicExecutionRole',\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t});\n\n\t\t/**\n\t\t * Attach inline policy statements to the role\n\t\t */\n\t\tif (props?.policies?.length) {\n\t\t\tprops.policies.forEach((policy) => {\n\t\t\t\tthis.role.addToPolicy(\n\t\t\t\t\t/**\n\t\t\t\t\t * Inline policy statement\n\t\t\t\t\t */\n\t\t\t\t\tnew PolicyStatement(policy),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.role.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the role ARN\n\t\t */\n\t\tnew CfnOutput(this, 'RolePolicyArn', {\n\t\t\tvalue: this.role.roleArn,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/role-policy-construct.ts"],"names":[],"mappings":";;;;;;AA2CO,IAAM,uBAAA,GAAN,cAAsC,SAAA,CAAU;AAAA,EA3CvD;AA2CuD,IAAA,MAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAE7C,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAAgC;AACzE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,IAAA,CAAK,IAAA,EAAM,EAAA,EAAI;AAAA,MAC9B,GAAG,MAAM,OAAA,EAAS,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,eAAA,EAAiB,MAAM,OAAA,EAAS,WAAA,EAAa,kBAC1C,KAAA,CAAM,OAAA,CAAQ,YAAY,eAAA,GAC1B;AAAA,QACA,aAAA,CAAc,wBAAA;AAAA,UACb;AAAA;AACD;AACD,KACF,CAAA;AAKD,IAAA,IAAI,KAAA,EAAO,UAAU,MAAA,EAAQ;AAC5B,MAAA,KAAA,CAAM,QAAA,CAAS,OAAA,CAAQ,CAAC,MAAA,KAAW;AAClC,QAAA,IAAA,CAAK,IAAA,CAAK,WAAA;AAAA;AAAA;AAAA;AAAA,UAIT,IAAI,gBAAgB,MAAM;AAAA,SAC3B;AAAA,MACD,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,IAAA,CAAK,kBAAA,CAAmB,aAAA,CAAc,OAAO,CAAA;AAKlD,IAAA,IAAI,SAAA,CAAU,MAAM,eAAA,EAAiB;AAAA,MACpC,KAAA,EAAO,KAAK,IAAA,CAAK;AAAA,KACjB,CAAA;AAAA,EACF;AACD","file":"role-policy.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport {\n\tManagedPolicy,\n\tPolicyStatement,\n\tPolicyStatementProps,\n\tRole,\n\tRoleProps,\n} from 'aws-cdk-lib/aws-iam';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseRolePolicyConstruct\n *\n * Provides configuration for:\n * - IAM role creation\n * - Inline policy statements\n */\ninterface IDynamoDBConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** IAM Role configuration options */\n\t\treadonly roleOptions: RoleProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Additional inline policies to attach to the role\n\t *\n\t * Each entry is converted into a PolicyStatement\n\t */\n\treadonly policies?: PolicyStatementProps[];\n}\n\n/**\n * CDK construct for IAM Role with policies\n *\n * Responsibilities:\n * - Creates an IAM role with configurable options\n * - Applies a default AWS managed policy if none is provided\n * - Attaches optional inline policy statements\n * - Exposes the role ARN as a CloudFormation output\n */\nexport class BaseRolePolicyConstruct extends Construct {\n\t/** The created IAM Role instance */\n\treadonly role: Role;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for role and policies\n\t */\n\tconstructor(scope: Construct, id: string, props: IDynamoDBConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.role = new Role(this, id, {\n\t\t\t...props.options?.roleOptions,\n\n\t\t\t/**\n\t\t\t * Managed policies attached to the role\n\t\t\t * Defaults to AWSLambdaBasicExecutionRole if not provided\n\t\t\t */\n\t\t\tmanagedPolicies: props.options?.roleOptions?.managedPolicies\n\t\t\t\t? props.options.roleOptions.managedPolicies\n\t\t\t\t: [\n\t\t\t\t\t\tManagedPolicy.fromAwsManagedPolicyName(\n\t\t\t\t\t\t\t'service-role/AWSLambdaBasicExecutionRole',\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t});\n\n\t\t/**\n\t\t * Attach inline policy statements to the role\n\t\t */\n\t\tif (props?.policies?.length) {\n\t\t\tprops.policies.forEach((policy) => {\n\t\t\t\tthis.role.addToPolicy(\n\t\t\t\t\t/**\n\t\t\t\t\t * Inline policy statement\n\t\t\t\t\t */\n\t\t\t\t\tnew PolicyStatement(policy),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.role.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the role ARN\n\t\t */\n\t\tnew CfnOutput(this, 'RolePolicyArn', {\n\t\t\tvalue: this.role.roleArn,\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/s3-construct.ts","../../src/aws/cdk/constructs/cloudfront-construct.ts","../../src/aws/cdk/constructs/s3-deployment-construct.ts"],"names":["Construct","Bucket","RemovalPolicy","CfnOutput","Distribution","ViewerProtocolPolicy","Duration","CustomException","S3BucketOrigin","BucketDeployment"],"mappings":";;;;;;;;;;;;AA4BO,IAAM,eAAA,GAAN,cAA8BA,oBAAA,CAAU;AAAA,EA5B/C;AA4B+C,IAAA,MAAA,CAAA,IAAA,EAAA,iBAAA,CAAA;AAAA;AAAA;AAAA,EAErC,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,MAAA,GAAS,IAAIC,YAAA,CAAO,IAAA,EAAM,EAAA,EAAI;AAAA,MAClC,GAAG,MAAM,OAAA,EAAS,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,aAAA,EACC,KAAA,CAAM,OAAA,EAAS,aAAA,EAAe,iBAAiBC,uBAAA,CAAc;AAAA,KAC9D,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EAAO,KAAK,MAAA,CAAO;AAAA,KACnB,CAAA;AAAA,EACF;AACD,CAAA;AC9BO,IAAM,uBAAA,GAAN,cAAsCH,oBAAAA,CAAU;AAAA,EAhCvD;AAgCuD,IAAA,MAAA,CAAA,IAAA,EAAA,yBAAA,CAAA;AAAA;AAAA;AAAA,EAE7C,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,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A;AAAA,YAKlB,qBAAqB,MAAA,CAAO,OAAA;AAAA,cAC3B,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,mBAAA,IAAuB;AAAC,aAC3D,CAAE,MAAA;AAAA,cACD,CAAC,QAAA,EAAU,CAAC,OAAA,EAAS,eAAe,CAAA,KAAM;AACzC,gBAAA,QAAA,CAAS,OAAO,CAAA,GAAI;AAAA,kBACnB,GAAG,eAAA;AAAA,kBACH,MAAA,EAAQ,gBAAgB,MAAA,IAAU;AAAA,iBACnC;AACA,gBAAA,OAAO,QAAA;AAAA,cACR,CAAA;AAAA,cACA;AAAC,aACF;AAAA;AAAA;AAAA;AAAA,YAKA,eAAA,EAAiB;AAAA,cAChB,GAAG,KAAA,CAAM,OAAA,EAAS,iBAAA,EAAmB,eAAA;AAAA,cACrC,MAAA,EAAQ;AAAA;AACT;AACD;AACD,OACA,CAAA,CAAE,YAAA;AAAA,IACJ;AAUA,IAAA,IAAA,CAAK,gBAAA,GAAmB,IAAIC,gCAAA,CAAiB,IAAA,EAAM,YAAA,EAAc;AAAA,MAChE,GAAG,MAAM,OAAA,EAAS,uBAAA;AAAA;AAAA,MAGlB,YAAA,EACC,KAAA,CAAM,OAAA,EAAS,uBAAA,EAAyB,gBACxC,IAAA,CAAK,YAAA;AAAA;AAAA,MAGN,mBAAmB,KAAA,CAAM,OAAA,EAAS,uBAAA,EAC/B,iBAAA,IAAqB,CAAC,IAAI,CAAA;AAAA;AAAA,MAG7B,iBAAA,EACC,KAAA,CAAM,OAAA,EAAS,uBAAA,EAAyB,qBACxC,IAAA,CAAK;AAAA,KACmB,CAAA;AAAA,EAC3B;AACD","file":"s3-deployment.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Bucket, BucketProps } from 'aws-cdk-lib/aws-s3';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseS3Construct\n *\n * Provides configuration for creating an S3 bucket\n * with optional overrides for bucket properties.\n */\ninterface IS3DeploymentConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for the S3 bucket */\n\t\treadonly bucketOptions?: BucketProps;\n\t}>,\n\t'appName' | 'stackName'\n> {}\n\n/**\n * CDK construct for S3 bucket\n *\n * Responsibilities:\n * - Creates an S3 bucket with configurable options\n * - Applies a default removal policy if not provided\n * - Exposes the bucket ARN as a CloudFormation output\n */\nexport class BaseS3Construct extends Construct {\n\t/** The created S3 bucket instance */\n\treadonly bucket: Bucket;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for S3 bucket\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IS3DeploymentConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.bucket = new Bucket(this, id, {\n\t\t\t...props.options?.bucketOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the bucket\n\t\t\t * Defaults to DESTROY if not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops.options?.bucketOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the S3 bucket ARN\n\t\t */\n\t\tnew CfnOutput(this, 'S3BucketArn', {\n\t\t\tvalue: this.bucket.bucketArn,\n\t\t});\n\t}\n}\n","import { Construct } from 'constructs';\nimport { Duration } from 'aws-cdk-lib';\nimport {\n\tDistribution,\n\tDistributionProps,\n\tViewerProtocolPolicy,\n} from 'aws-cdk-lib/aws-cloudfront';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseCloudfrontConstruct\n *\n * Provides configuration for creating a CloudFront distribution\n * with optional overrides for default behaviour and error handling.\n */\ninterface ICloudfrontConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Partial configuration for the CloudFront distribution */\n\t\treadonly cloudfrontOptions: Partial<DistributionProps>;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for CloudFront distribution\n *\n * Responsibilities:\n * - Creates a CloudFront distribution with configurable options\n * - Enforces HTTPS redirection by default\n * - Adds fallback error responses for SPA routing (400, 403, 404 → index.html)\n */\nexport class BaseCloudfrontConstruct extends Construct {\n\t/** The created CloudFront distribution instance */\n\treadonly distribution: Distribution;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for CloudFront distribution\n\t */\n\tconstructor(scope: Construct, id: string, props: ICloudfrontConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.distribution = new Distribution(this, id, {\n\t\t\t...props.options?.cloudfrontOptions,\n\n\t\t\t/**\n\t\t\t * Default behaviour configuration\n\t\t\t * Enforces HTTPS if not explicitly defined\n\t\t\t */\n\t\t\tdefaultBehavior: {\n\t\t\t\t...props.options?.cloudfrontOptions?.defaultBehavior,\n\t\t\t\tviewerProtocolPolicy:\n\t\t\t\t\tprops.options?.cloudfrontOptions?.defaultBehavior\n\t\t\t\t\t\t?.viewerProtocolPolicy || ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Error response configuration\n\t\t\t *\n\t\t\t * Adds SPA-friendly fallbacks:\n\t\t\t * - 400, 403, 404 responses are redirected to index.html\n\t\t\t */\n\t\t\terrorResponses: [\n\t\t\t\t...(props.options?.cloudfrontOptions?.errorResponses || []),\n\n\t\t\t\t/** Handle 400 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 400,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 403 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 403,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 404 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 404,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t}\n}\n","import { Construct } from 'constructs';\nimport { Bucket, BucketProps } from 'aws-cdk-lib/aws-s3';\nimport { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';\nimport {\n\tBucketDeployment,\n\tBucketDeploymentProps,\n} from 'aws-cdk-lib/aws-s3-deployment';\nimport {\n\tBehaviorOptions,\n\tDistribution,\n\tDistributionProps,\n} from 'aws-cdk-lib/aws-cloudfront';\n\nimport { ObjectType, CustomException } from '@incloodsolutions/toolkit';\n\nimport { BaseS3Construct } from './s3-construct';\nimport { BaseCloudfrontConstruct } from './cloudfront-construct';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseS3DeploymentConstruct\n *\n * Provides configuration for:\n * - Optional S3 bucket creation\n * - Optional CloudFront distribution\n * - S3 bucket deployment\n */\ninterface IS3DeploymentConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for S3 bucket */\n\t\treadonly bucketOptions?: BucketProps;\n\n\t\t/**\n\t\t * Configuration options for CloudFront distribution\n\t\t *\n\t\t * Note:\n\t\t * - `additionalBehaviors` supports dynamic route mappings\n\t\t * - Origins are automatically resolved if not provided\n\t\t */\n\t\treadonly cloudfrontOptions?: Partial<\n\t\t\tOmit<DistributionProps, 'additionalBehaviors'>\n\t\t> & {\n\t\t\treadonly additionalBehaviors?: ObjectType<\n\t\t\t\tPartial<BehaviorOptions>,\n\t\t\t\tstring\n\t\t\t>;\n\t\t};\n\n\t\t/**\n\t\t * Configuration for S3 bucket deployment\n\t\t *\n\t\t * Note:\n\t\t * - `sources` is required\n\t\t * - `destinationBucket` can be auto-resolved\n\t\t */\n\t\treadonly bucketDeploymentOptions: Omit<\n\t\t\tPartial<BucketDeploymentProps>,\n\t\t\t'sources'\n\t\t> &\n\t\t\tPick<BucketDeploymentProps, 'sources'>;\n\t}>,\n\t'appName' | 'stackName'\n> {\n\t/** Whether to create a new S3 bucket */\n\treadonly withS3Bucket?: boolean;\n\n\t/** Whether to create a CloudFront distribution */\n\treadonly withCloudfront?: boolean;\n}\n\n/**\n * CDK construct for S3 deployment with optional CloudFront integration\n *\n * Responsibilities:\n * - Optionally creates an S3 bucket\n * - Optionally creates a CloudFront distribution with S3 origin\n * - Deploys assets to S3 bucket\n * - Configures CloudFront invalidation paths\n *\n * Behaviour:\n * - Automatically links S3 bucket as CloudFront origin when enabled\n * - Resolves destination bucket and distribution if not explicitly provided\n * - Throws when required dependencies are missing\n */\nexport class BaseS3DeploymentConstruct extends Construct {\n\t/** The created or provided S3 bucket */\n\treadonly bucket: Bucket;\n\n\t/** The created CloudFront distribution */\n\treadonly distribution: Distribution;\n\n\t/** S3 bucket deployment instance */\n\treadonly bucketDeployment: BucketDeployment;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for bucket, distribution, and deployment\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IS3DeploymentConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Validate CloudFront origin requirements\n\t\t */\n\t\tif (\n\t\t\t!props.options?.cloudfrontOptions?.defaultBehavior?.origin &&\n\t\t\t!props?.withS3Bucket &&\n\t\t\tprops.withCloudfront\n\t\t) {\n\t\t\tthrow new CustomException(\n\t\t\t\t'Cloudfront distribution S3_Bucket origins must be defined!',\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Validate deployment destination requirements\n\t\t */\n\t\tif (\n\t\t\t!props.options?.bucketDeploymentOptions?.destinationBucket &&\n\t\t\t!props?.withS3Bucket\n\t\t) {\n\t\t\tthrow new CustomException(\n\t\t\t\t'Deployment S3_Bucket destination must be defined!',\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Create S3 bucket if enabled\n\t\t */\n\t\tif (props?.withS3Bucket) {\n\t\t\tthis.bucket = new BaseS3Construct(this, 'bucket', {\n\t\t\t\tenableDebug: props.enableDebug,\n\t\t\t\toptions: { bucketOptions: props.options?.bucketOptions },\n\t\t\t}).bucket;\n\t\t}\n\n\t\t/**\n\t\t * Create CloudFront distribution if enabled\n\t\t */\n\t\tif (props?.withCloudfront) {\n\t\t\t/**\n\t\t\t * Resolve S3 origin for distribution\n\t\t\t */\n\t\t\tconst s3Origin =\n\t\t\t\tprops.options?.cloudfrontOptions?.defaultBehavior?.origin ||\n\t\t\t\tS3BucketOrigin.withOriginAccessControl(this.bucket);\n\n\t\t\tthis.distribution = new BaseCloudfrontConstruct(this, 'distribution', {\n\t\t\t\tenableDebug: props.enableDebug,\n\t\t\t\toptions: {\n\t\t\t\t\tcloudfrontOptions: {\n\t\t\t\t\t\t...props.options?.cloudfrontOptions,\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Map additional behaviors and ensure origin is assigned\n\t\t\t\t\t\t */\n\t\t\t\t\t\tadditionalBehaviors: Object.entries(\n\t\t\t\t\t\t\tprops.options?.cloudfrontOptions?.additionalBehaviors || {},\n\t\t\t\t\t\t).reduce(\n\t\t\t\t\t\t\t(behavior, [pattern, behaviorOptions]) => {\n\t\t\t\t\t\t\t\tbehavior[pattern] = {\n\t\t\t\t\t\t\t\t\t...behaviorOptions,\n\t\t\t\t\t\t\t\t\torigin: behaviorOptions.origin || s3Origin,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\treturn behavior;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{} as typeof props.options.cloudfrontOptions.additionalBehaviors,\n\t\t\t\t\t\t) as ObjectType<BehaviorOptions>,\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Default behavior configuration\n\t\t\t\t\t\t */\n\t\t\t\t\t\tdefaultBehavior: {\n\t\t\t\t\t\t\t...props.options?.cloudfrontOptions?.defaultBehavior,\n\t\t\t\t\t\t\torigin: s3Origin,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}).distribution;\n\t\t}\n\n\t\t/**\n\t\t * Deploy assets to S3 bucket\n\t\t *\n\t\t * Automatically resolves:\n\t\t * - Destination bucket\n\t\t * - CloudFront distribution\n\t\t * - Invalidation paths\n\t\t */\n\t\tthis.bucketDeployment = new BucketDeployment(this, 'deployment', {\n\t\t\t...props.options?.bucketDeploymentOptions,\n\n\t\t\t/** Target distribution for cache invalidation */\n\t\t\tdistribution:\n\t\t\t\tprops.options?.bucketDeploymentOptions?.distribution ||\n\t\t\t\tthis.distribution,\n\n\t\t\t/** Paths to invalidate after deployment */\n\t\t\tdistributionPaths: props.options?.bucketDeploymentOptions\n\t\t\t\t?.distributionPaths || ['/*'],\n\n\t\t\t/** Destination S3 bucket */\n\t\t\tdestinationBucket:\n\t\t\t\tprops.options?.bucketDeploymentOptions?.destinationBucket ||\n\t\t\t\tthis.bucket,\n\t\t} as BucketDeploymentProps);\n\t}\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/s3-construct.ts","../../src/aws/cdk/constructs/cloudfront-construct.ts","../../src/aws/cdk/constructs/s3-deployment-construct.ts"],"names":["Construct"],"mappings":";;;;;;;;;;AA4BO,IAAM,eAAA,GAAN,cAA8B,SAAA,CAAU;AAAA,EA5B/C;AA4B+C,IAAA,MAAA,CAAA,IAAA,EAAA,iBAAA,CAAA;AAAA;AAAA;AAAA,EAErC,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,MAAA,GAAS,IAAI,MAAA,CAAO,IAAA,EAAM,EAAA,EAAI;AAAA,MAClC,G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,EAAyB,gBACxC,IAAA,CAAK,YAAA;AAAA;AAAA,MAGN,mBAAmB,KAAA,CAAM,OAAA,EAAS,uBAAA,EAC/B,iBAAA,IAAqB,CAAC,IAAI,CAAA;AAAA;AAAA,MAG7B,iBAAA,EACC,KAAA,CAAM,OAAA,EAAS,uBAAA,EAAyB,qBACxC,IAAA,CAAK;AAAA,KACmB,CAAA;AAAA,EAC3B;AACD","file":"s3-deployment.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Bucket, BucketProps } from 'aws-cdk-lib/aws-s3';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseS3Construct\n *\n * Provides configuration for creating an S3 bucket\n * with optional overrides for bucket properties.\n */\ninterface IS3DeploymentConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for the S3 bucket */\n\t\treadonly bucketOptions?: BucketProps;\n\t}>,\n\t'appName' | 'stackName'\n> {}\n\n/**\n * CDK construct for S3 bucket\n *\n * Responsibilities:\n * - Creates an S3 bucket with configurable options\n * - Applies a default removal policy if not provided\n * - Exposes the bucket ARN as a CloudFormation output\n */\nexport class BaseS3Construct extends Construct {\n\t/** The created S3 bucket instance */\n\treadonly bucket: Bucket;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for S3 bucket\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IS3DeploymentConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.bucket = new Bucket(this, id, {\n\t\t\t...props.options?.bucketOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the bucket\n\t\t\t * Defaults to DESTROY if not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops.options?.bucketOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the S3 bucket ARN\n\t\t */\n\t\tnew CfnOutput(this, 'S3BucketArn', {\n\t\t\tvalue: this.bucket.bucketArn,\n\t\t});\n\t}\n}\n","import { Construct } from 'constructs';\nimport { Duration } from 'aws-cdk-lib';\nimport {\n\tDistribution,\n\tDistributionProps,\n\tViewerProtocolPolicy,\n} from 'aws-cdk-lib/aws-cloudfront';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseCloudfrontConstruct\n *\n * Provides configuration for creating a CloudFront distribution\n * with optional overrides for default behaviour and error handling.\n */\ninterface ICloudfrontConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Partial configuration for the CloudFront distribution */\n\t\treadonly cloudfrontOptions: Partial<DistributionProps>;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for CloudFront distribution\n *\n * Responsibilities:\n * - Creates a CloudFront distribution with configurable options\n * - Enforces HTTPS redirection by default\n * - Adds fallback error responses for SPA routing (400, 403, 404 → index.html)\n */\nexport class BaseCloudfrontConstruct extends Construct {\n\t/** The created CloudFront distribution instance */\n\treadonly distribution: Distribution;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for CloudFront distribution\n\t */\n\tconstructor(scope: Construct, id: string, props: ICloudfrontConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.distribution = new Distribution(this, id, {\n\t\t\t...props.options?.cloudfrontOptions,\n\n\t\t\t/**\n\t\t\t * Default behaviour configuration\n\t\t\t * Enforces HTTPS if not explicitly defined\n\t\t\t */\n\t\t\tdefaultBehavior: {\n\t\t\t\t...props.options?.cloudfrontOptions?.defaultBehavior,\n\t\t\t\tviewerProtocolPolicy:\n\t\t\t\t\tprops.options?.cloudfrontOptions?.defaultBehavior\n\t\t\t\t\t\t?.viewerProtocolPolicy || ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n\t\t\t},\n\n\t\t\t/**\n\t\t\t * Error response configuration\n\t\t\t *\n\t\t\t * Adds SPA-friendly fallbacks:\n\t\t\t * - 400, 403, 404 responses are redirected to index.html\n\t\t\t */\n\t\t\terrorResponses: [\n\t\t\t\t...(props.options?.cloudfrontOptions?.errorResponses || []),\n\n\t\t\t\t/** Handle 400 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 400,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 403 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 403,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\n\t\t\t\t/** Handle 404 errors */\n\t\t\t\t{\n\t\t\t\t\thttpStatus: 404,\n\t\t\t\t\tresponseHttpStatus: 200,\n\t\t\t\t\tresponsePagePath: '/index.html',\n\t\t\t\t\tttl: Duration.days(1),\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t}\n}\n","import { Construct } from 'constructs';\nimport { Bucket, BucketProps } from 'aws-cdk-lib/aws-s3';\nimport { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';\nimport {\n\tBucketDeployment,\n\tBucketDeploymentProps,\n} from 'aws-cdk-lib/aws-s3-deployment';\nimport {\n\tBehaviorOptions,\n\tDistribution,\n\tDistributionProps,\n} from 'aws-cdk-lib/aws-cloudfront';\n\nimport { ObjectType, CustomException } from '@incloodsolutions/toolkit';\n\nimport { BaseS3Construct } from './s3-construct';\nimport { BaseCloudfrontConstruct } from './cloudfront-construct';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseS3DeploymentConstruct\n *\n * Provides configuration for:\n * - Optional S3 bucket creation\n * - Optional CloudFront distribution\n * - S3 bucket deployment\n */\ninterface IS3DeploymentConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for S3 bucket */\n\t\treadonly bucketOptions?: BucketProps;\n\n\t\t/**\n\t\t * Configuration options for CloudFront distribution\n\t\t *\n\t\t * Note:\n\t\t * - `additionalBehaviors` supports dynamic route mappings\n\t\t * - Origins are automatically resolved if not provided\n\t\t */\n\t\treadonly cloudfrontOptions?: Partial<\n\t\t\tOmit<DistributionProps, 'additionalBehaviors'>\n\t\t> & {\n\t\t\treadonly additionalBehaviors?: ObjectType<\n\t\t\t\tPartial<BehaviorOptions>,\n\t\t\t\tstring\n\t\t\t>;\n\t\t};\n\n\t\t/**\n\t\t * Configuration for S3 bucket deployment\n\t\t *\n\t\t * Note:\n\t\t * - `sources` is required\n\t\t * - `destinationBucket` can be auto-resolved\n\t\t */\n\t\treadonly bucketDeploymentOptions: Omit<\n\t\t\tPartial<BucketDeploymentProps>,\n\t\t\t'sources'\n\t\t> &\n\t\t\tPick<BucketDeploymentProps, 'sources'>;\n\t}>,\n\t'appName' | 'stackName'\n> {\n\t/** Whether to create a new S3 bucket */\n\treadonly withS3Bucket?: boolean;\n\n\t/** Whether to create a CloudFront distribution */\n\treadonly withCloudfront?: boolean;\n}\n\n/**\n * CDK construct for S3 deployment with optional CloudFront integration\n *\n * Responsibilities:\n * - Optionally creates an S3 bucket\n * - Optionally creates a CloudFront distribution with S3 origin\n * - Deploys assets to S3 bucket\n * - Configures CloudFront invalidation paths\n *\n * Behaviour:\n * - Automatically links S3 bucket as CloudFront origin when enabled\n * - Resolves destination bucket and distribution if not explicitly provided\n * - Throws when required dependencies are missing\n */\nexport class BaseS3DeploymentConstruct extends Construct {\n\t/** The created or provided S3 bucket */\n\treadonly bucket: Bucket;\n\n\t/** The created CloudFront distribution */\n\treadonly distribution: Distribution;\n\n\t/** S3 bucket deployment instance */\n\treadonly bucketDeployment: BucketDeployment;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for bucket, distribution, and deployment\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IS3DeploymentConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\t/**\n\t\t * Validate CloudFront origin requirements\n\t\t */\n\t\tif (\n\t\t\t!props.options?.cloudfrontOptions?.defaultBehavior?.origin &&\n\t\t\t!props?.withS3Bucket &&\n\t\t\tprops.withCloudfront\n\t\t) {\n\t\t\tthrow new CustomException(\n\t\t\t\t'Cloudfront distribution S3_Bucket origins must be defined!',\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Validate deployment destination requirements\n\t\t */\n\t\tif (\n\t\t\t!props.options?.bucketDeploymentOptions?.destinationBucket &&\n\t\t\t!props?.withS3Bucket\n\t\t) {\n\t\t\tthrow new CustomException(\n\t\t\t\t'Deployment S3_Bucket destination must be defined!',\n\t\t\t);\n\t\t}\n\n\t\t/**\n\t\t * Create S3 bucket if enabled\n\t\t */\n\t\tif (props?.withS3Bucket) {\n\t\t\tthis.bucket = new BaseS3Construct(this, 'bucket', {\n\t\t\t\tenableDebug: props.enableDebug,\n\t\t\t\toptions: { bucketOptions: props.options?.bucketOptions },\n\t\t\t}).bucket;\n\t\t}\n\n\t\t/**\n\t\t * Create CloudFront distribution if enabled\n\t\t */\n\t\tif (props?.withCloudfront) {\n\t\t\t/**\n\t\t\t * Resolve S3 origin for distribution\n\t\t\t */\n\t\t\tconst s3Origin =\n\t\t\t\tprops.options?.cloudfrontOptions?.defaultBehavior?.origin ||\n\t\t\t\tS3BucketOrigin.withOriginAccessControl(this.bucket);\n\n\t\t\tthis.distribution = new BaseCloudfrontConstruct(this, 'distribution', {\n\t\t\t\tenableDebug: props.enableDebug,\n\t\t\t\toptions: {\n\t\t\t\t\tcloudfrontOptions: {\n\t\t\t\t\t\t...props.options?.cloudfrontOptions,\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Map additional behaviors and ensure origin is assigned\n\t\t\t\t\t\t */\n\t\t\t\t\t\tadditionalBehaviors: Object.entries(\n\t\t\t\t\t\t\tprops.options?.cloudfrontOptions?.additionalBehaviors || {},\n\t\t\t\t\t\t).reduce(\n\t\t\t\t\t\t\t(behavior, [pattern, behaviorOptions]) => {\n\t\t\t\t\t\t\t\tbehavior[pattern] = {\n\t\t\t\t\t\t\t\t\t...behaviorOptions,\n\t\t\t\t\t\t\t\t\torigin: behaviorOptions.origin || s3Origin,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\treturn behavior;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{} as typeof props.options.cloudfrontOptions.additionalBehaviors,\n\t\t\t\t\t\t) as ObjectType<BehaviorOptions>,\n\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Default behavior configuration\n\t\t\t\t\t\t */\n\t\t\t\t\t\tdefaultBehavior: {\n\t\t\t\t\t\t\t...props.options?.cloudfrontOptions?.defaultBehavior,\n\t\t\t\t\t\t\torigin: s3Origin,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}).distribution;\n\t\t}\n\n\t\t/**\n\t\t * Deploy assets to S3 bucket\n\t\t *\n\t\t * Automatically resolves:\n\t\t * - Destination bucket\n\t\t * - CloudFront distribution\n\t\t * - Invalidation paths\n\t\t */\n\t\tthis.bucketDeployment = new BucketDeployment(this, 'deployment', {\n\t\t\t...props.options?.bucketDeploymentOptions,\n\n\t\t\t/** Target distribution for cache invalidation */\n\t\t\tdistribution:\n\t\t\t\tprops.options?.bucketDeploymentOptions?.distribution ||\n\t\t\t\tthis.distribution,\n\n\t\t\t/** Paths to invalidate after deployment */\n\t\t\tdistributionPaths: props.options?.bucketDeploymentOptions\n\t\t\t\t?.distributionPaths || ['/*'],\n\n\t\t\t/** Destination S3 bucket */\n\t\t\tdestinationBucket:\n\t\t\t\tprops.options?.bucketDeploymentOptions?.destinationBucket ||\n\t\t\t\tthis.bucket,\n\t\t} as BucketDeploymentProps);\n\t}\n}\n"]}
|
package/dist/aws-cdk/s3.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/s3-construct.ts"],"names":["Construct","Bucket","RemovalPolicy","CfnOutput"],"mappings":";;;;;;;;AA4BO,IAAM,eAAA,GAAN,cAA8BA,oBAAA,CAAU;AAAA,EA5B/C;AA4B+C,IAAA,MAAA,CAAA,IAAA,EAAA,iBAAA,CAAA;AAAA;AAAA;AAAA,EAErC,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,MAAA,GAAS,IAAIC,YAAA,CAAO,IAAA,EAAM,EAAA,EAAI;AAAA,MAClC,GAAG,MAAM,OAAA,EAAS,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,aAAA,EACC,KAAA,CAAM,OAAA,EAAS,aAAA,EAAe,iBAAiBC,uBAAA,CAAc;AAAA,KAC9D,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EAAO,KAAK,MAAA,CAAO;AAAA,KACnB,CAAA;AAAA,EACF;AACD","file":"s3.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Bucket, BucketProps } from 'aws-cdk-lib/aws-s3';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseS3Construct\n *\n * Provides configuration for creating an S3 bucket\n * with optional overrides for bucket properties.\n */\ninterface IS3DeploymentConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for the S3 bucket */\n\t\treadonly bucketOptions?: BucketProps;\n\t}>,\n\t'appName' | 'stackName'\n> {}\n\n/**\n * CDK construct for S3 bucket\n *\n * Responsibilities:\n * - Creates an S3 bucket with configurable options\n * - Applies a default removal policy if not provided\n * - Exposes the bucket ARN as a CloudFormation output\n */\nexport class BaseS3Construct extends Construct {\n\t/** The created S3 bucket instance */\n\treadonly bucket: Bucket;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for S3 bucket\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IS3DeploymentConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.bucket = new Bucket(this, id, {\n\t\t\t...props.options?.bucketOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the bucket\n\t\t\t * Defaults to DESTROY if not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops.options?.bucketOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the S3 bucket ARN\n\t\t */\n\t\tnew CfnOutput(this, 'S3BucketArn', {\n\t\t\tvalue: this.bucket.bucketArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/s3.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/s3-construct.ts"],"names":[],"mappings":";;;;;;AA4BO,IAAM,eAAA,GAAN,cAA8B,SAAA,CAAU;AAAA,EA5B/C;AA4B+C,IAAA,MAAA,CAAA,IAAA,EAAA,iBAAA,CAAA;AAAA;AAAA;AAAA,EAErC,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CACC,KAAA,EACA,EAAA,EACA,KAAA,EACC;AACD,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,MAAA,GAAS,IAAI,MAAA,CAAO,IAAA,EAAM,EAAA,EAAI;AAAA,MAClC,GAAG,MAAM,OAAA,EAAS,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMlB,aAAA,EACC,KAAA,CAAM,OAAA,EAAS,aAAA,EAAe,iBAAiB,aAAA,CAAc;AAAA,KAC9D,CAAA;AAKD,IAAA,IAAI,SAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EAAO,KAAK,MAAA,CAAO;AAAA,KACnB,CAAA;AAAA,EACF;AACD","file":"s3.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Bucket, BucketProps } from 'aws-cdk-lib/aws-s3';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseS3Construct\n *\n * Provides configuration for creating an S3 bucket\n * with optional overrides for bucket properties.\n */\ninterface IS3DeploymentConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for the S3 bucket */\n\t\treadonly bucketOptions?: BucketProps;\n\t}>,\n\t'appName' | 'stackName'\n> {}\n\n/**\n * CDK construct for S3 bucket\n *\n * Responsibilities:\n * - Creates an S3 bucket with configurable options\n * - Applies a default removal policy if not provided\n * - Exposes the bucket ARN as a CloudFormation output\n */\nexport class BaseS3Construct extends Construct {\n\t/** The created S3 bucket instance */\n\treadonly bucket: Bucket;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for S3 bucket\n\t */\n\tconstructor(\n\t\tscope: Construct,\n\t\tid: string,\n\t\tprops: IS3DeploymentConstructProps,\n\t) {\n\t\tsuper(scope, id);\n\n\t\tthis.bucket = new Bucket(this, id, {\n\t\t\t...props.options?.bucketOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the bucket\n\t\t\t * Defaults to DESTROY if not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops.options?.bucketOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the S3 bucket ARN\n\t\t */\n\t\tnew CfnOutput(this, 'S3BucketArn', {\n\t\t\tvalue: this.bucket.bucketArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/sns.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/sns-construct.ts"],"names":["Construct","Topic","LambdaSubscription","RemovalPolicy","CfnOutput"],"mappings":";;;;;;;;;AAuCO,IAAM,gBAAA,GAAN,cAA+BA,oBAAA,CAAU;AAAA,EAvChD;AAuCgD,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA;AAAA,EAEtC,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAA2B;AACpE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,QAAQ,IAAIC,YAAA,CAAM,MAAM,EAAA,EAAI,KAAA,CAAM,SAAS,YAAY,CAAA;AAK5D,IAAA,IAAI,KAAA,CAAM,OAAA,EAAS,eAAA,EAAiB,MAAA,EAAQ;AAC3C,MAAA,KAAA,CAAM,OAAA,CAAQ,eAAA,CAAgB,OAAA,CAAQ,CAAC,cAAA,KAAmB;AACzD,QAAA,IAAA,CAAK,KAAA,CAAM,eAAA;AAAA;AAAA;AAAA;AAAA,UAIV,IAAIC,uCAAmB,cAAc;AAAA,SACtC;AAAA,MACD,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,KAAA,CAAM,kBAAA,CAAmBC,uBAAA,CAAc,OAAO,CAAA;AAKnD,IAAA,IAAIC,mBAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EAAO,KAAK,KAAA,CAAM;AAAA,KAClB,CAAA;AAAA,EACF;AACD","file":"sns.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Topic, TopicProps } from 'aws-cdk-lib/aws-sns';\nimport { LambdaSubscription } from 'aws-cdk-lib/aws-sns-subscriptions';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseSnsConstruct\n *\n * Provides configuration for:\n * - SNS topic creation\n * - Lambda subscriptions\n */\ninterface ISnsConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** SNS topic configuration options */\n\t\treadonly topicOptions: TopicProps;\n\n\t\t/**\n\t\t * Lambda functions to subscribe to the topic\n\t\t *\n\t\t * Each function will receive messages published to the topic\n\t\t */\n\t\treadonly targetFunctions: Function[];\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for SNS topic with Lambda subscriptions\n *\n * Responsibilities:\n * - Creates an SNS topic with configurable options\n * - Subscribes one or more Lambda functions to the topic\n * - Applies a removal policy\n * - Exposes the topic ARN as a CloudFormation output\n */\nexport class BaseSnsConstruct extends Construct {\n\t/** The created SNS topic instance */\n\treadonly topic: Topic;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for topic and subscriptions\n\t */\n\tconstructor(scope: Construct, id: string, props: ISnsConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.topic = new Topic(this, id, props.options?.topicOptions);\n\n\t\t/**\n\t\t * Attach Lambda subscriptions to the topic\n\t\t */\n\t\tif (props.options?.targetFunctions?.length) {\n\t\t\tprops.options.targetFunctions.forEach((targetFunction) => {\n\t\t\t\tthis.topic.addSubscription(\n\t\t\t\t\t/**\n\t\t\t\t\t * Lambda subscription target\n\t\t\t\t\t */\n\t\t\t\t\tnew LambdaSubscription(targetFunction),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.topic.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the topic ARN\n\t\t */\n\t\tnew CfnOutput(this, 'SnsTopicArn', {\n\t\t\tvalue: this.topic.topicArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/sns.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/sns-construct.ts"],"names":[],"mappings":";;;;;;;AAuCO,IAAM,gBAAA,GAAN,cAA+B,SAAA,CAAU;AAAA,EAvChD;AAuCgD,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA;AAAA,EAEtC,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAA2B;AACpE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,QAAQ,IAAI,KAAA,CAAM,MAAM,EAAA,EAAI,KAAA,CAAM,SAAS,YAAY,CAAA;AAK5D,IAAA,IAAI,KAAA,CAAM,OAAA,EAAS,eAAA,EAAiB,MAAA,EAAQ;AAC3C,MAAA,KAAA,CAAM,OAAA,CAAQ,eAAA,CAAgB,OAAA,CAAQ,CAAC,cAAA,KAAmB;AACzD,QAAA,IAAA,CAAK,KAAA,CAAM,eAAA;AAAA;AAAA;AAAA;AAAA,UAIV,IAAI,mBAAmB,cAAc;AAAA,SACtC;AAAA,MACD,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAA,CAAK,KAAA,CAAM,kBAAA,CAAmB,aAAA,CAAc,OAAO,CAAA;AAKnD,IAAA,IAAI,SAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EAAO,KAAK,KAAA,CAAM;AAAA,KAClB,CAAA;AAAA,EACF;AACD","file":"sns.js","sourcesContent":["import { Construct } from 'constructs';\nimport { Function } from 'aws-cdk-lib/aws-lambda';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Topic, TopicProps } from 'aws-cdk-lib/aws-sns';\nimport { LambdaSubscription } from 'aws-cdk-lib/aws-sns-subscriptions';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseSnsConstruct\n *\n * Provides configuration for:\n * - SNS topic creation\n * - Lambda subscriptions\n */\ninterface ISnsConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** SNS topic configuration options */\n\t\treadonly topicOptions: TopicProps;\n\n\t\t/**\n\t\t * Lambda functions to subscribe to the topic\n\t\t *\n\t\t * Each function will receive messages published to the topic\n\t\t */\n\t\treadonly targetFunctions: Function[];\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for SNS topic with Lambda subscriptions\n *\n * Responsibilities:\n * - Creates an SNS topic with configurable options\n * - Subscribes one or more Lambda functions to the topic\n * - Applies a removal policy\n * - Exposes the topic ARN as a CloudFormation output\n */\nexport class BaseSnsConstruct extends Construct {\n\t/** The created SNS topic instance */\n\treadonly topic: Topic;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for topic and subscriptions\n\t */\n\tconstructor(scope: Construct, id: string, props: ISnsConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.topic = new Topic(this, id, props.options?.topicOptions);\n\n\t\t/**\n\t\t * Attach Lambda subscriptions to the topic\n\t\t */\n\t\tif (props.options?.targetFunctions?.length) {\n\t\t\tprops.options.targetFunctions.forEach((targetFunction) => {\n\t\t\t\tthis.topic.addSubscription(\n\t\t\t\t\t/**\n\t\t\t\t\t * Lambda subscription target\n\t\t\t\t\t */\n\t\t\t\t\tnew LambdaSubscription(targetFunction),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Apply removal policy (useful for non-production environments)\n\t\t */\n\t\tthis.topic.applyRemovalPolicy(RemovalPolicy.DESTROY);\n\n\t\t/**\n\t\t * CloudFormation output exposing the topic ARN\n\t\t */\n\t\tnew CfnOutput(this, 'SnsTopicArn', {\n\t\t\tvalue: this.topic.topicArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/sqs.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/const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CAAM;AAAA,KAClB,CAAA;AAAA,EACF;AACD","file":"sqs.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Queue, QueueProps } from 'aws-cdk-lib/aws-sqs';\nimport {\n\tEventSourceMapping,\n\tEventSourceMappingProps,\n\tFunction,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseSqsConstruct\n *\n * Provides configuration for:\n * - SQS queue creation\n * - Lambda event source mappings\n */\ninterface ISqsConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for the SQS queue */\n\t\treadonly queueOptions?: QueueProps;\n\n\t\t/**\n\t\t * Configuration for Lambda event source mapping\n\t\t *\n\t\t * Note:\n\t\t * `eventSourceArn` and `target` are managed internally\n\t\t */\n\t\treadonly eventSourceMappingOptions?: Omit<\n\t\t\tEventSourceMappingProps,\n\t\t\t'eventSourceArn' | 'target'\n\t\t>;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda functions to be triggered by SQS messages\n\t *\n\t * Each function will be connected via an event source mapping\n\t */\n\treadonly targetFunctions?: Function[];\n}\n\n/**\n * CDK construct for SQS queue with Lambda integration\n *\n * Responsibilities:\n * - Creates an SQS queue with configurable options\n * - Attaches one or more Lambda consumers via event source mappings\n * - Applies default retry behaviour\n * - Exposes the queue ARN as a CloudFormation output\n */\nexport class BaseSqsConstruct extends Construct {\n\t/** The created SQS queue instance */\n\treadonly queue: Queue;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for queue and Lambda consumers\n\t */\n\tconstructor(scope: Construct, id: string, props: ISqsConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.queue = new Queue(this, id, {\n\t\t\t...props?.options?.queueOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the queue\n\t\t\t * Defaults to DESTROY if not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops?.options?.queueOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\t\t});\n\n\t\t/**\n\t\t * Attach Lambda event source mappings for queue consumption\n\t\t */\n\t\tif (props?.targetFunctions?.length) {\n\t\t\tprops.targetFunctions.forEach((targetFunction, index) => {\n\t\t\t\tnew EventSourceMapping(this, `${id}-eventSourceMap${index + 1}`, {\n\t\t\t\t\t...props?.options?.eventSourceMappingOptions,\n\n\t\t\t\t\t/** Target Lambda function */\n\t\t\t\t\ttarget: targetFunction,\n\n\t\t\t\t\t/** Source SQS queue ARN */\n\t\t\t\t\teventSourceArn: this.queue.queueArn,\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Retry attempts for failed batch processing\n\t\t\t\t\t * Defaults to 3 if not explicitly defined\n\t\t\t\t\t */\n\t\t\t\t\tretryAttempts:\n\t\t\t\t\t\tprops?.options?.eventSourceMappingOptions?.retryAttempts || 3,\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * CloudFormation output exposing the SQS queue ARN\n\t\t */\n\t\tnew CfnOutput(this, 'SqsQueueArn', {\n\t\t\tvalue: this.queue.queueArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/sqs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/sqs-construct.ts"],"names":[],"mappings":";;;;;;;AAqDO,IAAM,gBAAA,GAAN,cAA+B,SAAA,CAAU;AAAA,EArDhD;AAqDgD,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA;AAAA,EAEtC,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAA2B;AACpE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,KAAA,CAAM,IAAA,EAAM,EAAA,EAAI;AAAA,MAChC,GAAG,OAAO,OAAA,EAAS,YAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMnB,aAAA,EACC,KAAA,EAAO,OAAA,EAAS,YAAA,EAAc,iBAAiB,aAAA,CAAc;AAAA,KAC9D,CAAA;AAKD,IAAA,IAAI,KAAA,EAAO,iBAAiB,MAAA,EAAQ;AACnC,MAAA,KAAA,CAAM,eAAA,CAAgB,OAAA,CAAQ,CAAC,cAAA,EAAgB,KAAA,KAAU;AACxD,QAAA,IAAI,mBAAmB,IAAA,EAAM,CAAA,EAAG,EAAE,CAAA,eAAA,EAAkB,KAAA,GAAQ,CAAC,CAAA,CAAA,EAAI;AAAA,UAChE,GAAG,OAAO,OAAA,EAAS,yBAAA;AAAA;AAAA,UAGnB,MAAA,EAAQ,cAAA;AAAA;AAAA,UAGR,cAAA,EAAgB,KAAK,KAAA,CAAM,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAM3B,aAAA,EACC,KAAA,EAAO,OAAA,EAAS,yBAAA,EAA2B,aAAA,IAAiB;AAAA,SAC7D,CAAA;AAAA,MACF,CAAC,CAAA;AAAA,IACF;AAKA,IAAA,IAAI,SAAA,CAAU,MAAM,aAAA,EAAe;AAAA,MAClC,KAAA,EAAO,KAAK,KAAA,CAAM;AAAA,KAClB,CAAA;AAAA,EACF;AACD","file":"sqs.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput, RemovalPolicy } from 'aws-cdk-lib';\nimport { Queue, QueueProps } from 'aws-cdk-lib/aws-sqs';\nimport {\n\tEventSourceMapping,\n\tEventSourceMappingProps,\n\tFunction,\n} from 'aws-cdk-lib/aws-lambda';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseSqsConstruct\n *\n * Provides configuration for:\n * - SQS queue creation\n * - Lambda event source mappings\n */\ninterface ISqsConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** Configuration options for the SQS queue */\n\t\treadonly queueOptions?: QueueProps;\n\n\t\t/**\n\t\t * Configuration for Lambda event source mapping\n\t\t *\n\t\t * Note:\n\t\t * `eventSourceArn` and `target` are managed internally\n\t\t */\n\t\treadonly eventSourceMappingOptions?: Omit<\n\t\t\tEventSourceMappingProps,\n\t\t\t'eventSourceArn' | 'target'\n\t\t>;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {\n\t/**\n\t * Lambda functions to be triggered by SQS messages\n\t *\n\t * Each function will be connected via an event source mapping\n\t */\n\treadonly targetFunctions?: Function[];\n}\n\n/**\n * CDK construct for SQS queue with Lambda integration\n *\n * Responsibilities:\n * - Creates an SQS queue with configurable options\n * - Attaches one or more Lambda consumers via event source mappings\n * - Applies default retry behaviour\n * - Exposes the queue ARN as a CloudFormation output\n */\nexport class BaseSqsConstruct extends Construct {\n\t/** The created SQS queue instance */\n\treadonly queue: Queue;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for queue and Lambda consumers\n\t */\n\tconstructor(scope: Construct, id: string, props: ISqsConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.queue = new Queue(this, id, {\n\t\t\t...props?.options?.queueOptions,\n\n\t\t\t/**\n\t\t\t * Removal policy applied to the queue\n\t\t\t * Defaults to DESTROY if not explicitly defined\n\t\t\t */\n\t\t\tremovalPolicy:\n\t\t\t\tprops?.options?.queueOptions?.removalPolicy || RemovalPolicy.DESTROY,\n\t\t});\n\n\t\t/**\n\t\t * Attach Lambda event source mappings for queue consumption\n\t\t */\n\t\tif (props?.targetFunctions?.length) {\n\t\t\tprops.targetFunctions.forEach((targetFunction, index) => {\n\t\t\t\tnew EventSourceMapping(this, `${id}-eventSourceMap${index + 1}`, {\n\t\t\t\t\t...props?.options?.eventSourceMappingOptions,\n\n\t\t\t\t\t/** Target Lambda function */\n\t\t\t\t\ttarget: targetFunction,\n\n\t\t\t\t\t/** Source SQS queue ARN */\n\t\t\t\t\teventSourceArn: this.queue.queueArn,\n\n\t\t\t\t\t/**\n\t\t\t\t\t * Retry attempts for failed batch processing\n\t\t\t\t\t * Defaults to 3 if not explicitly defined\n\t\t\t\t\t */\n\t\t\t\t\tretryAttempts:\n\t\t\t\t\t\tprops?.options?.eventSourceMappingOptions?.retryAttempts || 3,\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * CloudFormation output exposing the SQS queue ARN\n\t\t */\n\t\tnew CfnOutput(this, 'SqsQueueArn', {\n\t\t\tvalue: this.queue.queueArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/vpc.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/vpc-construct.ts"],"names":["Construct","Vpc","CfnOutput"],"mappings":";;;;;;;;AA0BO,IAAM,gBAAA,GAAN,cAA+BA,oBAAA,CAAU;AAAA,EA1BhD;AA0BgD,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA;AAAA,EAEtC,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAA2B;AACpE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,GAAA,GAAM,IAAIC,UAAA,CAAI,IAAA,EAAM,EAAA,EAAI;AAAA,MAC5B,GAAG,MAAM,OAAA,CAAQ;AAAA,KACjB,CAAA;AAKD,IAAA,IAAIC,mBAAA,CAAU,MAAM,QAAA,EAAU;AAAA,MAC7B,KAAA,EAAO,KAAK,GAAA,CAAI;AAAA,KAChB,CAAA;AAAA,EACF;AACD","file":"vpc.cjs","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Vpc, VpcProps } from 'aws-cdk-lib/aws-ec2';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseVpcConstruct\n *\n * Provides configuration for creating a VPC.\n */\ninterface IVpcConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** VPC configuration options */\n\t\treadonly vpcOptions: VpcProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for Virtual Private Cloud (VPC)\n *\n * Responsibilities:\n * - Creates a VPC with configurable options\n * - Exposes the VPC ARN as a CloudFormation output\n */\nexport class BaseVpcConstruct extends Construct {\n\t/** The created VPC instance */\n\treadonly vpc: Vpc;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for VPC\n\t */\n\tconstructor(scope: Construct, id: string, props: IVpcConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.vpc = new Vpc(this, id, {\n\t\t\t...props.options.vpcOptions,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the VPC ARN\n\t\t */\n\t\tnew CfnOutput(this, 'VpcArn', {\n\t\t\tvalue: this.vpc.vpcArn,\n\t\t});\n\t}\n}\n"]}
|
package/dist/aws-cdk/vpc.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/aws/cdk/constructs/vpc-construct.ts"],"names":[],"mappings":";;;;;;AA0BO,IAAM,gBAAA,GAAN,cAA+B,SAAA,CAAU;AAAA,EA1BhD;AA0BgD,IAAA,MAAA,CAAA,IAAA,EAAA,kBAAA,CAAA;AAAA;AAAA;AAAA,EAEtC,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOT,WAAA,CAAY,KAAA,EAAkB,EAAA,EAAY,KAAA,EAA2B;AACpE,IAAA,KAAA,CAAM,OAAO,EAAE,CAAA;AAEf,IAAA,IAAA,CAAK,GAAA,GAAM,IAAI,GAAA,CAAI,IAAA,EAAM,EAAA,EAAI;AAAA,MAC5B,GAAG,MAAM,OAAA,CAAQ;AAAA,KACjB,CAAA;AAKD,IAAA,IAAI,SAAA,CAAU,MAAM,QAAA,EAAU;AAAA,MAC7B,KAAA,EAAO,KAAK,GAAA,CAAI;AAAA,KAChB,CAAA;AAAA,EACF;AACD","file":"vpc.js","sourcesContent":["import { Construct } from 'constructs';\nimport { CfnOutput } from 'aws-cdk-lib';\nimport { Vpc, VpcProps } from 'aws-cdk-lib/aws-ec2';\n\nimport { IBaseCdkConstructProps } from '../../types';\n\n/**\n * Props for BaseVpcConstruct\n *\n * Provides configuration for creating a VPC.\n */\ninterface IVpcConstructProps extends Omit<\n\tIBaseCdkConstructProps<{\n\t\t/** VPC configuration options */\n\t\treadonly vpcOptions: VpcProps;\n\t}>,\n\t'appName' | 'stage' | 'stackName'\n> {}\n\n/**\n * CDK construct for Virtual Private Cloud (VPC)\n *\n * Responsibilities:\n * - Creates a VPC with configurable options\n * - Exposes the VPC ARN as a CloudFormation output\n */\nexport class BaseVpcConstruct extends Construct {\n\t/** The created VPC instance */\n\treadonly vpc: Vpc;\n\n\t/**\n\t * @param scope Parent construct\n\t * @param id Unique construct identifier\n\t * @param props Configuration for VPC\n\t */\n\tconstructor(scope: Construct, id: string, props: IVpcConstructProps) {\n\t\tsuper(scope, id);\n\n\t\tthis.vpc = new Vpc(this, id, {\n\t\t\t...props.options.vpcOptions,\n\t\t});\n\n\t\t/**\n\t\t * CloudFormation output exposing the VPC ARN\n\t\t */\n\t\tnew CfnOutput(this, 'VpcArn', {\n\t\t\tvalue: this.vpc.vpcArn,\n\t\t});\n\t}\n}\n"]}
|