@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
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Construct } from 'constructs';
|
|
2
|
-
import { Size, RemovalPolicy, CfnOutput, Duration } from 'aws-cdk-lib';
|
|
2
|
+
import { Size, RemovalPolicy, CfnOutput, Duration, Stack } from 'aws-cdk-lib';
|
|
3
3
|
import { RestApi, Cors, LambdaIntegration, TokenAuthorizer } from 'aws-cdk-lib/aws-apigateway';
|
|
4
4
|
import { printLog, CustomException, detectDuplicateProperties, AppEnvironmentEnum } from '@incloodsolutions/toolkit';
|
|
5
5
|
import { HttpLambdaIntegration, WebSocketLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
|
|
6
|
-
import { HttpApi, CorsHttpMethod, WebSocketApi, WebSocketStage } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
6
|
+
import { HttpApi, CorsHttpMethod, WebSocketApi, WebSocketStage, HttpMethod } from 'aws-cdk-lib/aws-apigatewayv2';
|
|
7
7
|
import { Distribution, ViewerProtocolPolicy } from 'aws-cdk-lib/aws-cloudfront';
|
|
8
8
|
import { LogGroup, RetentionDays } from 'aws-cdk-lib/aws-logs';
|
|
9
9
|
import { Table, BillingMode } from 'aws-cdk-lib/aws-dynamodb';
|
|
@@ -12,6 +12,7 @@ import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets';
|
|
|
12
12
|
import { HttpLambdaAuthorizer, HttpLambdaResponseType } from 'aws-cdk-lib/aws-apigatewayv2-authorizers';
|
|
13
13
|
import { Function, Architecture, Runtime, Code, LayerVersion, EventSourceMapping } from 'aws-cdk-lib/aws-lambda';
|
|
14
14
|
import { Role, ManagedPolicy, PolicyStatement } from 'aws-cdk-lib/aws-iam';
|
|
15
|
+
import { HostedZone, ARecord, AaaaRecord, CnameRecord, TxtRecord } from 'aws-cdk-lib/aws-route53';
|
|
15
16
|
import { Bucket } from 'aws-cdk-lib/aws-s3';
|
|
16
17
|
import { S3BucketOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';
|
|
17
18
|
import { BucketDeployment } from 'aws-cdk-lib/aws-s3-deployment';
|
|
@@ -542,9 +543,9 @@ var BaseLambdaConstruct = class extends Construct {
|
|
|
542
543
|
...props?.options?.lambdaOptions,
|
|
543
544
|
/**
|
|
544
545
|
* Lambda function name
|
|
545
|
-
* Defaults to "<stackName
|
|
546
|
+
* Defaults to "<stackName>" if not provided
|
|
546
547
|
*/
|
|
547
|
-
functionName: `${props?.options?.lambdaOptions?.functionName || props?.stackName}
|
|
548
|
+
functionName: `${props?.options?.lambdaOptions?.functionName || props?.stackName}`,
|
|
548
549
|
/**
|
|
549
550
|
* Function description
|
|
550
551
|
*/
|
|
@@ -685,6 +686,72 @@ var BaseRolePolicyConstruct = class extends Construct {
|
|
|
685
686
|
});
|
|
686
687
|
}
|
|
687
688
|
};
|
|
689
|
+
var BaseRoute53Construct = class extends Construct {
|
|
690
|
+
static {
|
|
691
|
+
__name(this, "BaseRoute53Construct");
|
|
692
|
+
}
|
|
693
|
+
/** The hosted zone this construct created, imported, or looked up */
|
|
694
|
+
hostedZone;
|
|
695
|
+
/**
|
|
696
|
+
* @param scope Parent construct
|
|
697
|
+
* @param id Unique construct identifier
|
|
698
|
+
* @param props Configuration for the hosted zone and its records
|
|
699
|
+
*/
|
|
700
|
+
constructor(scope, id, props) {
|
|
701
|
+
super(scope, id);
|
|
702
|
+
const options = props?.options ?? {};
|
|
703
|
+
if (options.hostedZoneOptions) {
|
|
704
|
+
this.hostedZone = new HostedZone(
|
|
705
|
+
this,
|
|
706
|
+
`${id}-HostedZone`,
|
|
707
|
+
options.hostedZoneOptions
|
|
708
|
+
);
|
|
709
|
+
} else if (options.fromExistingHostedZoneAttributes) {
|
|
710
|
+
this.hostedZone = HostedZone.fromHostedZoneAttributes(
|
|
711
|
+
this,
|
|
712
|
+
`${id}-HostedZone`,
|
|
713
|
+
options.fromExistingHostedZoneAttributes
|
|
714
|
+
);
|
|
715
|
+
} else if (options.fromLookupOptions) {
|
|
716
|
+
this.hostedZone = HostedZone.fromLookup(
|
|
717
|
+
this,
|
|
718
|
+
`${id}-HostedZone`,
|
|
719
|
+
options.fromLookupOptions
|
|
720
|
+
);
|
|
721
|
+
} else {
|
|
722
|
+
throw new CustomException(
|
|
723
|
+
"BaseRoute53Construct requires one of hostedZoneOptions, fromExistingHostedZoneAttributes, or fromLookupOptions"
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
options.aRecords?.forEach((record, index) => {
|
|
727
|
+
new ARecord(this, `${id}-ARecord-${index}`, {
|
|
728
|
+
...record,
|
|
729
|
+
zone: this.hostedZone
|
|
730
|
+
});
|
|
731
|
+
});
|
|
732
|
+
options.aaaaRecords?.forEach((record, index) => {
|
|
733
|
+
new AaaaRecord(this, `${id}-AaaaRecord-${index}`, {
|
|
734
|
+
...record,
|
|
735
|
+
zone: this.hostedZone
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
options.cnameRecords?.forEach((record, index) => {
|
|
739
|
+
new CnameRecord(this, `${id}-CnameRecord-${index}`, {
|
|
740
|
+
...record,
|
|
741
|
+
zone: this.hostedZone
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
options.txtRecords?.forEach((record, index) => {
|
|
745
|
+
new TxtRecord(this, `${id}-TxtRecord-${index}`, {
|
|
746
|
+
...record,
|
|
747
|
+
zone: this.hostedZone
|
|
748
|
+
});
|
|
749
|
+
});
|
|
750
|
+
new CfnOutput(this, "Route53HostedZoneId", {
|
|
751
|
+
value: this.hostedZone.hostedZoneId
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
};
|
|
688
755
|
var BaseS3Construct = class extends Construct {
|
|
689
756
|
static {
|
|
690
757
|
__name(this, "BaseS3Construct");
|
|
@@ -881,7 +948,133 @@ var BaseVpcConstruct = class extends Construct {
|
|
|
881
948
|
});
|
|
882
949
|
}
|
|
883
950
|
};
|
|
951
|
+
var BaseLambdaApiStack = class extends Stack {
|
|
952
|
+
static {
|
|
953
|
+
__name(this, "BaseLambdaApiStack");
|
|
954
|
+
}
|
|
955
|
+
constructor(scope, id, props) {
|
|
956
|
+
super(scope, id, props);
|
|
957
|
+
let layers = [];
|
|
958
|
+
if (props?.stackOptions?.layerOptions) {
|
|
959
|
+
if (!props.stackOptions?.layerOptions?.name || !props.stackOptions?.layerOptions?.version) {
|
|
960
|
+
throw new CustomException("Invalid layer options provided! Both layer 'name' and 'version' are required.");
|
|
961
|
+
}
|
|
962
|
+
const { existingLayer } = new BaseLambdaLayerConstruct(
|
|
963
|
+
this,
|
|
964
|
+
"layer",
|
|
965
|
+
{
|
|
966
|
+
options: {
|
|
967
|
+
fromExistingLayerArn: `arn:aws:lambda:${props.env?.region}:${props.env?.account}:layer:${props.stackOptions?.layerOptions?.name}:${props.stackOptions?.layerOptions?.version}`
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
);
|
|
971
|
+
layers.push(existingLayer);
|
|
972
|
+
}
|
|
973
|
+
const { function: lambdaFunction } = new BaseLambdaConstruct(this, "lambda", {
|
|
974
|
+
stage: props.stackOptions?.stage,
|
|
975
|
+
stackName: props.stackName,
|
|
976
|
+
options: {
|
|
977
|
+
lambdaOptions: { layers }
|
|
978
|
+
}
|
|
979
|
+
});
|
|
980
|
+
new BaseApiGatewayV2Construct(this, "apiGateway", {
|
|
981
|
+
handlerFunctions: [lambdaFunction],
|
|
982
|
+
options: {
|
|
983
|
+
gatewayOptions: {
|
|
984
|
+
apiName: props.stackName,
|
|
985
|
+
corsPreflight: {
|
|
986
|
+
allowOrigins: ["*"]
|
|
987
|
+
}
|
|
988
|
+
},
|
|
989
|
+
routeOptions: [
|
|
990
|
+
{
|
|
991
|
+
path: "/{proxy+}",
|
|
992
|
+
methods: [HttpMethod.ANY]
|
|
993
|
+
}
|
|
994
|
+
]
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
var BaseLambdaSqsStack = class extends Stack {
|
|
1000
|
+
static {
|
|
1001
|
+
__name(this, "BaseLambdaSqsStack");
|
|
1002
|
+
}
|
|
1003
|
+
constructor(scope, id, props) {
|
|
1004
|
+
super(scope, id, props);
|
|
1005
|
+
let layers = [];
|
|
1006
|
+
if (props?.stackOptions?.layerOptions) {
|
|
1007
|
+
if (!props.stackOptions?.layerOptions?.name || !props.stackOptions?.layerOptions?.version) {
|
|
1008
|
+
throw new CustomException("Invalid layer options provided");
|
|
1009
|
+
}
|
|
1010
|
+
const { existingLayer } = new BaseLambdaLayerConstruct(
|
|
1011
|
+
this,
|
|
1012
|
+
"layer",
|
|
1013
|
+
{
|
|
1014
|
+
options: {
|
|
1015
|
+
fromExistingLayerArn: `arn:aws:lambda:${props.env?.region}:${props.env?.account}:layer:${props.stackOptions?.layerOptions?.name}:${props.stackOptions?.layerOptions?.version}`
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
);
|
|
1019
|
+
layers.push(existingLayer);
|
|
1020
|
+
}
|
|
1021
|
+
const { function: lambdaFunction } = new BaseLambdaConstruct(this, "lambda", {
|
|
1022
|
+
stage: props.stackOptions?.stage,
|
|
1023
|
+
stackName: props.stackName,
|
|
1024
|
+
options: {
|
|
1025
|
+
lambdaOptions: { layers }
|
|
1026
|
+
}
|
|
1027
|
+
});
|
|
1028
|
+
new BaseSqsConstruct(this, "sqs", {
|
|
1029
|
+
targetFunctions: [lambdaFunction],
|
|
1030
|
+
options: {
|
|
1031
|
+
eventSourceMappingOptions: {},
|
|
1032
|
+
queueOptions: {}
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
};
|
|
1037
|
+
var BaseLambdaSnsStack = class extends Stack {
|
|
1038
|
+
static {
|
|
1039
|
+
__name(this, "BaseLambdaSnsStack");
|
|
1040
|
+
}
|
|
1041
|
+
constructor(scope, id, props) {
|
|
1042
|
+
super(scope, id, props);
|
|
1043
|
+
let layers = [];
|
|
1044
|
+
if (props?.stackOptions?.layerOptions) {
|
|
1045
|
+
if (!props.stackOptions?.layerOptions?.name || !props.stackOptions?.layerOptions?.version) {
|
|
1046
|
+
throw new CustomException("Invalid layer options provided");
|
|
1047
|
+
}
|
|
1048
|
+
const { existingLayer } = new BaseLambdaLayerConstruct(
|
|
1049
|
+
this,
|
|
1050
|
+
"layer",
|
|
1051
|
+
{
|
|
1052
|
+
options: {
|
|
1053
|
+
fromExistingLayerArn: `arn:aws:lambda:${props.env?.region}:${props.env?.account}:layer:${props.stackOptions?.layerOptions?.name}:${props.stackOptions?.layerOptions?.version}`
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
);
|
|
1057
|
+
layers.push(existingLayer);
|
|
1058
|
+
}
|
|
1059
|
+
const { function: lambdaFunction } = new BaseLambdaConstruct(this, "lambda", {
|
|
1060
|
+
stage: props.stackOptions?.stage,
|
|
1061
|
+
stackName: props.stackName,
|
|
1062
|
+
options: {
|
|
1063
|
+
lambdaOptions: { layers }
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
new BaseSnsConstruct(this, "sns", {
|
|
1067
|
+
options: {
|
|
1068
|
+
targetFunctions: [lambdaFunction],
|
|
1069
|
+
topicOptions: {
|
|
1070
|
+
...props?.stackOptions?.topicOptions,
|
|
1071
|
+
topicName: props?.stackOptions?.topicOptions?.topicName || props.stackName
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
884
1077
|
|
|
885
|
-
export { BaseApiGatewayConstruct, BaseApiGatewayV2Construct, BaseApiGatewayWebSocketConstruct, BaseCloudfrontConstruct, BaseCloudwatchLogGroupConstruct, BaseDynamoDBConstruct, BaseEventBridgeConstruct, BaseLambdaAuthoriserConstruct, BaseLambdaAuthoriserV2Construct, BaseLambdaConstruct, BaseLambdaLayerConstruct, BaseRolePolicyConstruct, BaseS3Construct, BaseS3DeploymentConstruct, BaseSnsConstruct, BaseSqsConstruct, BaseVpcConstruct };
|
|
1078
|
+
export { BaseApiGatewayConstruct, BaseApiGatewayV2Construct, BaseApiGatewayWebSocketConstruct, BaseCloudfrontConstruct, BaseCloudwatchLogGroupConstruct, BaseDynamoDBConstruct, BaseEventBridgeConstruct, BaseLambdaApiStack, BaseLambdaAuthoriserConstruct, BaseLambdaAuthoriserV2Construct, BaseLambdaConstruct, BaseLambdaLayerConstruct, BaseLambdaSnsStack, BaseLambdaSqsStack, BaseRolePolicyConstruct, BaseRoute53Construct, BaseS3Construct, BaseS3DeploymentConstruct, BaseSnsConstruct, BaseSqsConstruct, BaseVpcConstruct };
|
|
886
1079
|
//# sourceMappingURL=index.js.map
|
|
887
1080
|
//# sourceMappingURL=index.js.map
|