@webiny/pulumi-aws 0.0.0-ee-vpcs.549378cf03

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +328 -0
  3. package/apps/admin/createAdminPulumiApp.d.ts +24 -0
  4. package/apps/admin/createAdminPulumiApp.js +21 -0
  5. package/apps/admin/createAdminPulumiApp.js.map +1 -0
  6. package/apps/admin/index.d.ts +1 -0
  7. package/apps/admin/index.js +18 -0
  8. package/apps/admin/index.js.map +1 -0
  9. package/apps/api/ApiApwScheduler.d.ts +20 -0
  10. package/apps/api/ApiApwScheduler.js +246 -0
  11. package/apps/api/ApiApwScheduler.js.map +1 -0
  12. package/apps/api/ApiCloudfront.d.ts +3 -0
  13. package/apps/api/ApiCloudfront.js +101 -0
  14. package/apps/api/ApiCloudfront.js.map +1 -0
  15. package/apps/api/ApiFileManager.d.ts +10 -0
  16. package/apps/api/ApiFileManager.js +166 -0
  17. package/apps/api/ApiFileManager.js.map +1 -0
  18. package/apps/api/ApiGateway.d.ts +18 -0
  19. package/apps/api/ApiGateway.js +88 -0
  20. package/apps/api/ApiGateway.js.map +1 -0
  21. package/apps/api/ApiGraphql.d.ts +26 -0
  22. package/apps/api/ApiGraphql.js +167 -0
  23. package/apps/api/ApiGraphql.js.map +1 -0
  24. package/apps/api/ApiHeadlessCMS.d.ts +13 -0
  25. package/apps/api/ApiHeadlessCMS.js +94 -0
  26. package/apps/api/ApiHeadlessCMS.js.map +1 -0
  27. package/apps/api/ApiOutput.d.ts +15 -0
  28. package/apps/api/ApiOutput.js +43 -0
  29. package/apps/api/ApiOutput.js.map +1 -0
  30. package/apps/api/ApiPageBuilder.d.ts +24 -0
  31. package/apps/api/ApiPageBuilder.js +248 -0
  32. package/apps/api/ApiPageBuilder.js.map +1 -0
  33. package/apps/api/createApiPulumiApp.d.ts +71 -0
  34. package/apps/api/createApiPulumiApp.js +188 -0
  35. package/apps/api/createApiPulumiApp.js.map +1 -0
  36. package/apps/api/index.d.ts +9 -0
  37. package/apps/api/index.js +122 -0
  38. package/apps/api/index.js.map +1 -0
  39. package/apps/awsUtils.d.ts +3 -0
  40. package/apps/awsUtils.js +23 -0
  41. package/apps/awsUtils.js.map +1 -0
  42. package/apps/common/CoreOutput.d.ts +21 -0
  43. package/apps/common/CoreOutput.js +50 -0
  44. package/apps/common/CoreOutput.js.map +1 -0
  45. package/apps/common/VpcConfig.d.ts +8 -0
  46. package/apps/common/VpcConfig.js +37 -0
  47. package/apps/common/VpcConfig.js.map +1 -0
  48. package/apps/common/index.d.ts +2 -0
  49. package/apps/common/index.js +31 -0
  50. package/apps/common/index.js.map +1 -0
  51. package/apps/core/CoreCognito.d.ts +10 -0
  52. package/apps/core/CoreCognito.js +100 -0
  53. package/apps/core/CoreCognito.js.map +1 -0
  54. package/apps/core/CoreDynamo.d.ts +5 -0
  55. package/apps/core/CoreDynamo.js +51 -0
  56. package/apps/core/CoreDynamo.js.map +1 -0
  57. package/apps/core/CoreElasticSearch.d.ts +16 -0
  58. package/apps/core/CoreElasticSearch.js +286 -0
  59. package/apps/core/CoreElasticSearch.js.map +1 -0
  60. package/apps/core/CoreEventBus.d.ts +1 -0
  61. package/apps/core/CoreEventBus.js +25 -0
  62. package/apps/core/CoreEventBus.js.map +1 -0
  63. package/apps/core/CoreFileManager.d.ts +8 -0
  64. package/apps/core/CoreFileManager.js +55 -0
  65. package/apps/core/CoreFileManager.js.map +1 -0
  66. package/apps/core/CoreVpc.d.ts +13 -0
  67. package/apps/core/CoreVpc.js +148 -0
  68. package/apps/core/CoreVpc.js.map +1 -0
  69. package/apps/core/createCorePulumiApp.d.ts +64 -0
  70. package/apps/core/createCorePulumiApp.js +104 -0
  71. package/apps/core/createCorePulumiApp.js.map +1 -0
  72. package/apps/core/index.d.ts +6 -0
  73. package/apps/core/index.js +83 -0
  74. package/apps/core/index.js.map +1 -0
  75. package/apps/createAppBucket.d.ts +13 -0
  76. package/apps/createAppBucket.js +106 -0
  77. package/apps/createAppBucket.js.map +1 -0
  78. package/apps/customDomain.d.ts +9 -0
  79. package/apps/customDomain.js +14 -0
  80. package/apps/customDomain.js.map +1 -0
  81. package/apps/index.d.ts +7 -0
  82. package/apps/index.js +100 -0
  83. package/apps/index.js.map +1 -0
  84. package/apps/lambdaUtils.d.ts +10 -0
  85. package/apps/lambdaUtils.js +82 -0
  86. package/apps/lambdaUtils.js.map +1 -0
  87. package/apps/react/createReactPulumiApp.d.ts +33 -0
  88. package/apps/react/createReactPulumiApp.js +144 -0
  89. package/apps/react/createReactPulumiApp.js.map +1 -0
  90. package/apps/react/index.d.ts +1 -0
  91. package/apps/react/index.js +18 -0
  92. package/apps/react/index.js.map +1 -0
  93. package/apps/tenantRouter.d.ts +3 -0
  94. package/apps/tenantRouter.js +115 -0
  95. package/apps/tenantRouter.js.map +1 -0
  96. package/apps/website/WebsitePrerendering.d.ts +39 -0
  97. package/apps/website/WebsitePrerendering.js +300 -0
  98. package/apps/website/WebsitePrerendering.js.map +1 -0
  99. package/apps/website/createWebsitePulumiApp.d.ts +74 -0
  100. package/apps/website/createWebsitePulumiApp.js +246 -0
  101. package/apps/website/createWebsitePulumiApp.js.map +1 -0
  102. package/apps/website/deliveryViewerRequest.d.ts +2 -0
  103. package/apps/website/deliveryViewerRequest.js +32 -0
  104. package/apps/website/deliveryViewerRequest.js.map +1 -0
  105. package/apps/website/index.d.ts +1 -0
  106. package/apps/website/index.js +18 -0
  107. package/apps/website/index.js.map +1 -0
  108. package/components/tenantRouter/WebsiteTenantRouter.d.ts +11 -0
  109. package/components/tenantRouter/WebsiteTenantRouter.js +98 -0
  110. package/components/tenantRouter/WebsiteTenantRouter.js.map +1 -0
  111. package/components/tenantRouter/functions/origin/request.d.ts +1 -0
  112. package/components/tenantRouter/functions/origin/request.js +129 -0
  113. package/components/tenantRouter/functions/origin/request.js.map +1 -0
  114. package/enterprise/createAdminPulumiApp.d.ts +1 -0
  115. package/enterprise/createAdminPulumiApp.js +25 -0
  116. package/enterprise/createAdminPulumiApp.js.map +1 -0
  117. package/enterprise/createApiPulumiApp.d.ts +61 -0
  118. package/enterprise/createApiPulumiApp.js +68 -0
  119. package/enterprise/createApiPulumiApp.js.map +1 -0
  120. package/enterprise/createCorePulumiApp.d.ts +42 -0
  121. package/enterprise/createCorePulumiApp.js +137 -0
  122. package/enterprise/createCorePulumiApp.js.map +1 -0
  123. package/enterprise/createWebsitePulumiApp.d.ts +56 -0
  124. package/enterprise/createWebsitePulumiApp.js +68 -0
  125. package/enterprise/createWebsitePulumiApp.js.map +1 -0
  126. package/enterprise/index.d.ts +4 -0
  127. package/enterprise/index.js +57 -0
  128. package/enterprise/index.js.map +1 -0
  129. package/index.d.ts +3 -0
  130. package/index.js +44 -0
  131. package/index.js.map +1 -0
  132. package/package.json +53 -0
  133. package/utils/crawlDirectory.d.ts +1 -0
  134. package/utils/crawlDirectory.js +33 -0
  135. package/utils/crawlDirectory.js.map +1 -0
  136. package/utils/getPresignedPost.d.ts +11 -0
  137. package/utils/getPresignedPost.js +46 -0
  138. package/utils/getPresignedPost.js.map +1 -0
  139. package/utils/index.d.ts +3 -0
  140. package/utils/index.js +51 -0
  141. package/utils/index.js.map +1 -0
  142. package/utils/lambdaEnvVariables.d.ts +20 -0
  143. package/utils/lambdaEnvVariables.js +78 -0
  144. package/utils/lambdaEnvVariables.js.map +1 -0
  145. package/utils/storageMigrate.d.ts +0 -0
  146. package/utils/storageMigrate.js +292 -0
  147. package/utils/storageMigrate.js.map +1 -0
  148. package/utils/tagResources.d.ts +5 -0
  149. package/utils/tagResources.js +43 -0
  150. package/utils/tagResources.js.map +1 -0
  151. package/utils/uploadFolderToS3.d.ts +26 -0
  152. package/utils/uploadFolderToS3.js +188 -0
  153. package/utils/uploadFolderToS3.js.map +1 -0
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.createCorePulumiApp = createCorePulumiApp;
11
+
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
+
14
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
15
+
16
+ var _createCorePulumiApp = require("../apps/core/createCorePulumiApp");
17
+
18
+ var _pulumi = require("@webiny/pulumi");
19
+
20
+ function createCorePulumiApp(projectAppParams = {}) {
21
+ const {
22
+ vpc,
23
+ elasticSearch,
24
+ pulumi
25
+ } = projectAppParams;
26
+ const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
27
+ return (0, _createCorePulumiApp.createCorePulumiApp)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, projectAppParams), {}, {
28
+ // If using existing VPC, we ensure `vpc` param is set to `false`.
29
+ vpc: usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc),
30
+
31
+ pulumi(...args) {
32
+ // Not using advanced VPC params? Then immediately exit.
33
+ if (!usingAdvancedVpcParams) {
34
+ return pulumi === null || pulumi === void 0 ? void 0 : pulumi(...args);
35
+ }
36
+
37
+ const [{
38
+ resources,
39
+ addResource,
40
+ onResource
41
+ }] = args;
42
+ const {
43
+ useExistingVpc,
44
+ useVpcEndpoints
45
+ } = vpc; // 1. We first deal with "existing VPC" setup.
46
+
47
+ if (useExistingVpc) {
48
+ if ("useVpcEndpoints" in vpc) {
49
+ throw new Error("Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.");
50
+ }
51
+
52
+ if (elasticSearch) {
53
+ if (!useExistingVpc.elasticSearchDomainVpcConfig) {
54
+ throw new Error("Cannot specify `useExistingVpc` parameter because the `elasticSearchDomainVpcConfig` parameter wasn't provided.");
55
+ }
56
+
57
+ onResource(resource => {
58
+ if ((0, _pulumi.isResourceOfType)(resource, aws.elasticsearch.Domain)) {
59
+ resource.config.vpcOptions(useExistingVpc.elasticSearchDomainVpcConfig);
60
+ }
61
+
62
+ if ((0, _pulumi.isResourceOfType)(resource, aws.lambda.Function)) {
63
+ resource.config.vpcConfig(useExistingVpc.lambdaFunctionsVpcConfig);
64
+ }
65
+
66
+ if ((0, _pulumi.isResourceOfType)(resource, aws.iam.Role)) {
67
+ if (resource.meta.isLambdaFunctionRole) {
68
+ new aws.iam.RolePolicyAttachment(`${resource.name}-vpc-access-execution-role`, {
69
+ role: resource.output.name,
70
+ policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole
71
+ });
72
+ }
73
+ }
74
+ });
75
+ }
76
+
77
+ return pulumi === null || pulumi === void 0 ? void 0 : pulumi(...args);
78
+ }
79
+
80
+ if (useVpcEndpoints) {
81
+ // 2. Now we deal with "non-existing VPC" setup.
82
+ onResource(resource => {
83
+ if ((0, _pulumi.isResourceOfType)(resource, aws.ec2.Vpc)) {
84
+ resource.config.enableDnsSupport(true);
85
+ resource.config.enableDnsHostnames(true);
86
+ }
87
+ });
88
+ const {
89
+ vpc,
90
+ subnets,
91
+ routeTables
92
+ } = resources.vpc;
93
+ addResource(aws.ec2.VpcEndpoint, {
94
+ name: "vpc-s3-vpc-endpoint",
95
+ config: {
96
+ vpcId: vpc.output.id,
97
+ serviceName: "com.amazonaws.eu-central-1.s3",
98
+ routeTableIds: [routeTables.privateSubnets.output.id]
99
+ }
100
+ });
101
+ addResource(aws.ec2.VpcEndpoint, {
102
+ name: "vpc-dynamodb-vpc-endpoint",
103
+ config: {
104
+ vpcId: vpc.output.id,
105
+ serviceName: "com.amazonaws.eu-central-1.dynamodb",
106
+ routeTableIds: [routeTables.privateSubnets.output.id]
107
+ }
108
+ });
109
+ addResource(aws.ec2.VpcEndpoint, {
110
+ name: "vpc-sqs-vpc-endpoint",
111
+ config: {
112
+ vpcId: vpc.output.id,
113
+ serviceName: "com.amazonaws.eu-central-1.sqs",
114
+ vpcEndpointType: "Interface",
115
+ privateDnsEnabled: true,
116
+ securityGroupIds: [vpc.output.defaultSecurityGroupId],
117
+ subnetIds: subnets.private.map(subNet => subNet.output.id)
118
+ }
119
+ });
120
+ addResource(aws.ec2.VpcEndpoint, {
121
+ name: "vpc-events-vpc-endpoint",
122
+ config: {
123
+ vpcId: vpc.output.id,
124
+ serviceName: "com.amazonaws.eu-central-1.events",
125
+ vpcEndpointType: "Interface",
126
+ privateDnsEnabled: true,
127
+ securityGroupIds: [vpc.output.defaultSecurityGroupId],
128
+ subnetIds: subnets.private.map(subNet => subNet.output.id)
129
+ }
130
+ });
131
+ }
132
+
133
+ return pulumi === null || pulumi === void 0 ? void 0 : pulumi(...args);
134
+ }
135
+
136
+ }));
137
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCorePulumiApp","projectAppParams","vpc","elasticSearch","pulumi","usingAdvancedVpcParams","baseCreateCorePulumiApp","useExistingVpc","Boolean","args","resources","addResource","onResource","useVpcEndpoints","Error","elasticSearchDomainVpcConfig","resource","isResourceOfType","aws","elasticsearch","Domain","config","vpcOptions","lambda","Function","vpcConfig","lambdaFunctionsVpcConfig","iam","Role","meta","isLambdaFunctionRole","RolePolicyAttachment","name","role","output","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole","ec2","Vpc","enableDnsSupport","enableDnsHostnames","subnets","routeTables","VpcEndpoint","vpcId","id","serviceName","routeTableIds","privateSubnets","vpcEndpointType","privateDnsEnabled","securityGroupIds","defaultSecurityGroupId","subnetIds","private","map","subNet"],"sources":["createCorePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport {\n createCorePulumiApp as baseCreateCorePulumiApp,\n CreateCorePulumiAppParams as BaseCreateCorePulumiAppParams\n} from \"~/apps/core/createCorePulumiApp\";\nimport { isResourceOfType } from \"@webiny/pulumi\";\n\nexport type CorePulumiApp = ReturnType<typeof createCorePulumiApp>;\n\nexport type CorePulumiAppAdvancedVpcParams = Partial<{\n useVpcEndpoints: boolean;\n useExistingVpc: {\n elasticSearchDomainVpcConfig?: aws.types.input.elasticsearch.DomainVpcOptions;\n lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;\n };\n}>;\n\nexport interface CreateCorePulumiAppParams extends Omit<BaseCreateCorePulumiAppParams, \"vpc\"> {\n vpc?: boolean | CorePulumiAppAdvancedVpcParams;\n}\n\nexport function createCorePulumiApp(projectAppParams: CreateCorePulumiAppParams = {}) {\n const { vpc, elasticSearch, pulumi } = projectAppParams;\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n\n return baseCreateCorePulumiApp({\n ...projectAppParams,\n // If using existing VPC, we ensure `vpc` param is set to `false`.\n vpc: usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc),\n pulumi(...args) {\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return pulumi?.(...args);\n }\n\n const [{ resources, addResource, onResource }] = args;\n const { useExistingVpc, useVpcEndpoints } = vpc;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (\"useVpcEndpoints\" in vpc) {\n throw new Error(\n \"Cannot specify `useVpcEndpoints` parameter when using an existing VPC. The VPC endpoints configurations should be already defined within the existing VPC.\"\n );\n }\n\n if (elasticSearch) {\n if (!useExistingVpc.elasticSearchDomainVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `elasticSearchDomainVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.elasticsearch.Domain)) {\n resource.config.vpcOptions(\n useExistingVpc!.elasticSearchDomainVpcConfig\n );\n }\n\n if (isResourceOfType(resource, aws.lambda.Function)) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n new aws.iam.RolePolicyAttachment(\n `${resource.name}-vpc-access-execution-role`,\n {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n );\n }\n }\n });\n }\n\n return pulumi?.(...args);\n }\n\n if (useVpcEndpoints) {\n // 2. Now we deal with \"non-existing VPC\" setup.\n onResource(resource => {\n if (isResourceOfType(resource, aws.ec2.Vpc)) {\n resource.config.enableDnsSupport(true);\n resource.config.enableDnsHostnames(true);\n }\n });\n\n const { vpc, subnets, routeTables } = resources.vpc!;\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-s3-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.s3\",\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-dynamodb-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.dynamodb\",\n routeTableIds: [routeTables.privateSubnets.output.id]\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-sqs-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.sqs\",\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n\n addResource(aws.ec2.VpcEndpoint, {\n name: \"vpc-events-vpc-endpoint\",\n config: {\n vpcId: vpc.output.id,\n serviceName: \"com.amazonaws.eu-central-1.events\",\n vpcEndpointType: \"Interface\",\n privateDnsEnabled: true,\n securityGroupIds: [vpc.output.defaultSecurityGroupId],\n subnetIds: subnets.private.map(subNet => subNet.output.id)\n }\n });\n }\n\n return pulumi?.(...args);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAgBO,SAASA,mBAAT,CAA6BC,gBAA2C,GAAG,EAA3E,EAA+E;EAClF,MAAM;IAAEC,GAAF;IAAOC,aAAP;IA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@pulumi/aws";
2
+ import { CreateWebsitePulumiAppParams as BaseCreateWebsitePulumiAppParams } from "../apps/website/createWebsitePulumiApp";
3
+ export declare type WebsitePulumiApp = ReturnType<typeof createWebsitePulumiApp>;
4
+ export declare type WebsitePulumiAppAdvancedVpcParams = Partial<{
5
+ useExistingVpc: {
6
+ lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;
7
+ };
8
+ }>;
9
+ export interface CreateWebsitePulumiAppParams extends Omit<BaseCreateWebsitePulumiAppParams, "vpc"> {
10
+ vpc?: boolean | WebsitePulumiAppAdvancedVpcParams;
11
+ }
12
+ export declare function createWebsitePulumiApp(projectAppParams?: CreateWebsitePulumiAppParams): import("@webiny/pulumi").PulumiApp<{
13
+ prerendering: {
14
+ subscriber: {
15
+ policy: import("@pulumi/pulumi").Output<import("@pulumi/aws/iam/policy").Policy>;
16
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
17
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
18
+ eventRule: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventRule").EventRule>;
19
+ eventPermission: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/permission").Permission>;
20
+ eventTarget: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventTarget").EventTarget>;
21
+ };
22
+ renderer: {
23
+ policy: import("@pulumi/pulumi").Output<import("@pulumi/aws/iam/policy").Policy>;
24
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
25
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
26
+ eventSourceMapping: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/eventSourceMapping").EventSourceMapping>;
27
+ };
28
+ flush: {
29
+ policy: import("@pulumi/pulumi").Output<import("@pulumi/aws/iam/policy").Policy>;
30
+ role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/role").Role>;
31
+ lambda: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/function").Function>;
32
+ eventRule: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventRule").EventRule>;
33
+ eventPermission: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/permission").Permission>;
34
+ eventTarget: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudwatch/eventTarget").EventTarget>;
35
+ };
36
+ settings: {
37
+ tableItem: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/tableItem").TableItem>;
38
+ };
39
+ };
40
+ app: {
41
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution").Distribution>;
42
+ bucket: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
43
+ originIdentity: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/originAccessIdentity").OriginAccessIdentity>;
44
+ origin: aws.types.input.cloudfront.DistributionOrigin;
45
+ bucketPublicAccessBlock: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPublicAccessBlock").BucketPublicAccessBlock>;
46
+ bucketPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPolicy").BucketPolicy>;
47
+ };
48
+ delivery: {
49
+ cloudfront: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/distribution").Distribution>;
50
+ bucket: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucket").Bucket>;
51
+ originIdentity: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/cloudfront/originAccessIdentity").OriginAccessIdentity>;
52
+ origin: aws.types.input.cloudfront.DistributionOrigin;
53
+ bucketPublicAccessBlock: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPublicAccessBlock").BucketPublicAccessBlock>;
54
+ bucketPolicy: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/s3/bucketPolicy").BucketPolicy>;
55
+ };
56
+ }> & import("../utils/lambdaEnvVariables").WithCommonLambdaEnvVariables;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.createWebsitePulumiApp = createWebsitePulumiApp;
11
+
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
13
+
14
+ var aws = _interopRequireWildcard(require("@pulumi/aws"));
15
+
16
+ var _createWebsitePulumiApp = require("../apps/website/createWebsitePulumiApp");
17
+
18
+ var _pulumi = require("@webiny/pulumi");
19
+
20
+ function createWebsitePulumiApp(projectAppParams = {}) {
21
+ const {
22
+ vpc,
23
+ pulumi
24
+ } = projectAppParams;
25
+ const usingAdvancedVpcParams = vpc && typeof vpc !== "boolean";
26
+ return (0, _createWebsitePulumiApp.createWebsitePulumiApp)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, projectAppParams), {}, {
27
+ // If using existing VPC, we ensure `vpc` param is set to `false`.
28
+ vpc: usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc),
29
+
30
+ pulumi(...args) {
31
+ // Not using advanced VPC params? Then immediately exit.
32
+ if (!usingAdvancedVpcParams) {
33
+ return pulumi === null || pulumi === void 0 ? void 0 : pulumi(...args);
34
+ }
35
+
36
+ const [{
37
+ onResource
38
+ }] = args;
39
+ const {
40
+ useExistingVpc
41
+ } = vpc; // 1. We first deal with "existing VPC" setup.
42
+
43
+ if (useExistingVpc) {
44
+ if (!useExistingVpc.lambdaFunctionsVpcConfig) {
45
+ throw new Error("Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.");
46
+ }
47
+
48
+ onResource(resource => {
49
+ if ((0, _pulumi.isResourceOfType)(resource, aws.lambda.Function)) {
50
+ resource.config.vpcConfig(useExistingVpc.lambdaFunctionsVpcConfig);
51
+ }
52
+
53
+ if ((0, _pulumi.isResourceOfType)(resource, aws.iam.Role)) {
54
+ if (resource.meta.isLambdaFunctionRole) {
55
+ new aws.iam.RolePolicyAttachment(`${resource.name}-vpc-access-execution-role`, {
56
+ role: resource.output.name,
57
+ policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole
58
+ });
59
+ }
60
+ }
61
+ });
62
+ }
63
+
64
+ return pulumi === null || pulumi === void 0 ? void 0 : pulumi(...args);
65
+ }
66
+
67
+ }));
68
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createWebsitePulumiApp","projectAppParams","vpc","pulumi","usingAdvancedVpcParams","baseCreateWebsitePulumiApp","useExistingVpc","Boolean","args","onResource","lambdaFunctionsVpcConfig","Error","resource","isResourceOfType","aws","lambda","Function","config","vpcConfig","iam","Role","meta","isLambdaFunctionRole","RolePolicyAttachment","name","role","output","policyArn","ManagedPolicy","AWSLambdaVPCAccessExecutionRole"],"sources":["createWebsitePulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport {\n createWebsitePulumiApp as baseCreateWebsitePulumiApp,\n CreateWebsitePulumiAppParams as BaseCreateWebsitePulumiAppParams\n} from \"~/apps/website/createWebsitePulumiApp\";\nimport { isResourceOfType } from \"@webiny/pulumi\";\n\nexport type WebsitePulumiApp = ReturnType<typeof createWebsitePulumiApp>;\n\nexport type WebsitePulumiAppAdvancedVpcParams = Partial<{\n useExistingVpc: {\n lambdaFunctionsVpcConfig: aws.types.input.lambda.FunctionVpcConfig;\n };\n}>;\n\nexport interface CreateWebsitePulumiAppParams\n extends Omit<BaseCreateWebsitePulumiAppParams, \"vpc\"> {\n vpc?: boolean | WebsitePulumiAppAdvancedVpcParams;\n}\n\nexport function createWebsitePulumiApp(projectAppParams: CreateWebsitePulumiAppParams = {}) {\n const { vpc, pulumi } = projectAppParams;\n const usingAdvancedVpcParams = vpc && typeof vpc !== \"boolean\";\n\n return baseCreateWebsitePulumiApp({\n ...projectAppParams,\n // If using existing VPC, we ensure `vpc` param is set to `false`.\n vpc: usingAdvancedVpcParams && vpc.useExistingVpc ? false : Boolean(vpc),\n pulumi(...args) {\n // Not using advanced VPC params? Then immediately exit.\n if (!usingAdvancedVpcParams) {\n return pulumi?.(...args);\n }\n\n const [{ onResource }] = args;\n const { useExistingVpc } = vpc;\n\n // 1. We first deal with \"existing VPC\" setup.\n if (useExistingVpc) {\n if (!useExistingVpc.lambdaFunctionsVpcConfig) {\n throw new Error(\n \"Cannot specify `useExistingVpc` parameter because the `lambdaFunctionsVpcConfig` parameter wasn't provided.\"\n );\n }\n\n onResource(resource => {\n if (isResourceOfType(resource, aws.lambda.Function)) {\n resource.config.vpcConfig(useExistingVpc!.lambdaFunctionsVpcConfig);\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n new aws.iam.RolePolicyAttachment(\n `${resource.name}-vpc-access-execution-role`,\n {\n role: resource.output.name,\n policyArn: aws.iam.ManagedPolicy.AWSLambdaVPCAccessExecutionRole\n }\n );\n }\n }\n });\n }\n\n return pulumi?.(...args);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AAIA;;AAeO,SAASA,sBAAT,CAAgCC,gBAA8C,GAAG,EAAjF,EAAqF;EACxF,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAkBF,gBAAxB;EACA,MAAMG,sBAAsB,GAAGF,GAAG,IAAI,OAAOA,GAAP,KAAe,SAArD;EAEA,OAAO,IAAAG,8CAAA,8DACAJ,gBADA;IAEH;IACAC,GAAG,EAAEE,sBAAsB,IAAIF,GAAG,CAAC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PulumiApp";
3
+ export * from "./createAdminPulumiApp";
4
+ export * from "./createWebsitePulumiApp";
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _createCorePulumiApp = require("./createCorePulumiApp");
8
+
9
+ Object.keys(_createCorePulumiApp).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _createCorePulumiApp[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _createCorePulumiApp[key];
16
+ }
17
+ });
18
+ });
19
+
20
+ var _createApiPulumiApp = require("./createApiPulumiApp");
21
+
22
+ Object.keys(_createApiPulumiApp).forEach(function (key) {
23
+ if (key === "default" || key === "__esModule") return;
24
+ if (key in exports && exports[key] === _createApiPulumiApp[key]) return;
25
+ Object.defineProperty(exports, key, {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _createApiPulumiApp[key];
29
+ }
30
+ });
31
+ });
32
+
33
+ var _createAdminPulumiApp = require("./createAdminPulumiApp");
34
+
35
+ Object.keys(_createAdminPulumiApp).forEach(function (key) {
36
+ if (key === "default" || key === "__esModule") return;
37
+ if (key in exports && exports[key] === _createAdminPulumiApp[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _createAdminPulumiApp[key];
42
+ }
43
+ });
44
+ });
45
+
46
+ var _createWebsitePulumiApp = require("./createWebsitePulumiApp");
47
+
48
+ Object.keys(_createWebsitePulumiApp).forEach(function (key) {
49
+ if (key === "default" || key === "__esModule") return;
50
+ if (key in exports && exports[key] === _createWebsitePulumiApp[key]) return;
51
+ Object.defineProperty(exports, key, {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _createWebsitePulumiApp[key];
55
+ }
56
+ });
57
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createCorePulumiApp\";\nexport * from \"./createApiPulumiApp\";\nexport * from \"./createAdminPulumiApp\";\nexport * from \"./createWebsitePulumiApp\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { WebsiteTenantRouter } from "./components/tenantRouter/WebsiteTenantRouter";
2
+ export * from "./apps";
3
+ export * from "./utils";
package/index.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ WebsiteTenantRouter: true
8
+ };
9
+ Object.defineProperty(exports, "WebsiteTenantRouter", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _WebsiteTenantRouter.WebsiteTenantRouter;
13
+ }
14
+ });
15
+
16
+ var _WebsiteTenantRouter = require("./components/tenantRouter/WebsiteTenantRouter");
17
+
18
+ var _apps = require("./apps");
19
+
20
+ Object.keys(_apps).forEach(function (key) {
21
+ if (key === "default" || key === "__esModule") return;
22
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
23
+ if (key in exports && exports[key] === _apps[key]) return;
24
+ Object.defineProperty(exports, key, {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _apps[key];
28
+ }
29
+ });
30
+ });
31
+
32
+ var _utils = require("./utils");
33
+
34
+ Object.keys(_utils).forEach(function (key) {
35
+ if (key === "default" || key === "__esModule") return;
36
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
37
+ if (key in exports && exports[key] === _utils[key]) return;
38
+ Object.defineProperty(exports, key, {
39
+ enumerable: true,
40
+ get: function () {
41
+ return _utils[key];
42
+ }
43
+ });
44
+ });
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { WebsiteTenantRouter } from \"./components/tenantRouter/WebsiteTenantRouter\";\nexport * from \"./apps\";\nexport * from \"./utils\";\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@webiny/pulumi-aws",
3
+ "version": "0.0.0-ee-vpcs.549378cf03",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/webiny/webiny-js.git"
7
+ },
8
+ "description": "A set of Pulumi apps that deploy Webiny CMS into Amazon Web Services (AWS).",
9
+ "author": "Webiny Ltd",
10
+ "license": "MIT",
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "directory": "dist"
14
+ },
15
+ "dependencies": {
16
+ "@pulumi/aws": "^5.8.0",
17
+ "@pulumi/pulumi": "^3.34.0",
18
+ "@webiny/cli-plugin-deploy-pulumi": "0.0.0-ee-vpcs.549378cf03",
19
+ "@webiny/pulumi": "0.0.0-ee-vpcs.549378cf03",
20
+ "form-data": "4.0.0",
21
+ "node-fetch": "2.6.7"
22
+ },
23
+ "devDependencies": {
24
+ "@babel/cli": "^7.19.3",
25
+ "@babel/core": "^7.19.3",
26
+ "@babel/preset-env": "^7.19.4",
27
+ "@babel/preset-typescript": "^7.18.6",
28
+ "@babel/runtime": "^7.19.0",
29
+ "@webiny/api-page-builder": "^0.0.0-ee-vpcs.549378cf03",
30
+ "@webiny/aws-layers": "^0.0.0-ee-vpcs.549378cf03",
31
+ "@webiny/cli": "^0.0.0-ee-vpcs.549378cf03",
32
+ "@webiny/project-utils": "^0.0.0-ee-vpcs.549378cf03",
33
+ "chalk": "^4.1.0",
34
+ "lodash": "^4.5.0",
35
+ "mime": "2.5.2",
36
+ "rimraf": "^3.0.2",
37
+ "ttypescript": "^1.5.12",
38
+ "typescript": "4.7.4"
39
+ },
40
+ "scripts": {
41
+ "build": "yarn webiny run build",
42
+ "watch": "yarn webiny run watch"
43
+ },
44
+ "adio": {
45
+ "ignore": {
46
+ "dependencies": [
47
+ "@pulumi/pulumi",
48
+ "@pulumi/aws"
49
+ ]
50
+ }
51
+ },
52
+ "gitHead": "549378cf03fcd27845fc3fa23d1dc6b32896f630"
53
+ }
@@ -0,0 +1 @@
1
+ export declare const crawlDirectory: (dir: string, callback: (filePath: string) => void) => void;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.crawlDirectory = void 0;
9
+
10
+ var fs = _interopRequireWildcard(require("fs"));
11
+
12
+ const crawlDirectory = (dir, callback) => {
13
+ if (!fs.existsSync(dir)) {
14
+ return;
15
+ }
16
+
17
+ const files = fs.readdirSync(dir);
18
+
19
+ for (const file of files) {
20
+ const filePath = `${dir}/${file}`;
21
+ const stat = fs.statSync(filePath);
22
+
23
+ if (stat.isDirectory()) {
24
+ crawlDirectory(filePath, callback);
25
+ }
26
+
27
+ if (stat.isFile()) {
28
+ callback(filePath);
29
+ }
30
+ }
31
+ };
32
+
33
+ exports.crawlDirectory = crawlDirectory;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["crawlDirectory","dir","callback","fs","existsSync","files","readdirSync","file","filePath","stat","statSync","isDirectory","isFile"],"sources":["crawlDirectory.ts"],"sourcesContent":["import * as fs from \"fs\";\n\nexport const crawlDirectory = (dir: string, callback: (filePath: string) => void) => {\n if (!fs.existsSync(dir)) {\n return;\n }\n\n const files = fs.readdirSync(dir);\n for (const file of files) {\n const filePath = `${dir}/${file}`;\n const stat = fs.statSync(filePath);\n if (stat.isDirectory()) {\n crawlDirectory(filePath, callback);\n }\n if (stat.isFile()) {\n callback(filePath);\n }\n }\n};\n"],"mappings":";;;;;;;;;AAAA;;AAEO,MAAMA,cAAc,GAAG,CAACC,GAAD,EAAcC,QAAd,KAAuD;EACjF,IAAI,CAACC,EAAE,CAACC,UAAH,CAAcH,GAAd,CAAL,EAAyB;IACrB;EACH;;EAED,MAAMI,KAAK,GAAGF,EAAE,CAACG,WAAH,CAAeL,GAAf,CAAd;;EACA,KAAK,MAAMM,IAAX,IAAmBF,KAAnB,EAA0B;IACtB,MAAMG,QAAQ,GAAI,GAAEP,GAAI,IAAGM,IAAK,EAAhC;IACA,MAAME,IAAI,GAAGN,EAAE,CAACO,QAAH,CAAYF,QAAZ,CAAb;;IACA,IAAIC,IAAI,CAACE,WAAL,EAAJ,EAAwB;MACpBX,cAAc,CAACQ,QAAD,EAAWN,QAAX,CAAd;IACH;;IACD,IAAIO,IAAI,CAACG,MAAL,EAAJ,EAAmB;MACfV,QAAQ,CAACM,QAAD,CAAR;IACH;EACJ;AACJ,CAhBM"}
@@ -0,0 +1,11 @@
1
+ import S3Client from "aws-sdk/clients/s3";
2
+ interface GetPresignedPostParams {
3
+ bucket: string;
4
+ key: string;
5
+ acl: string;
6
+ checksum: string;
7
+ contentType: string | null;
8
+ cacheControl: string | undefined;
9
+ }
10
+ export declare const getPresignedPost: ({ bucket, key, acl, checksum, cacheControl, contentType }: GetPresignedPostParams) => Promise<S3Client.PresignedPost>;
11
+ export {};
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.getPresignedPost = void 0;
9
+
10
+ var _s = _interopRequireDefault(require("aws-sdk/clients/s3"));
11
+
12
+ const getPresignedPost = async ({
13
+ bucket,
14
+ key,
15
+ acl,
16
+ checksum,
17
+ cacheControl,
18
+ contentType
19
+ }) => {
20
+ const fields = {
21
+ key,
22
+ "X-Amz-Meta-Checksum": checksum,
23
+ acl
24
+ };
25
+
26
+ if (contentType) {
27
+ fields["Content-Type"] = contentType;
28
+ }
29
+
30
+ if (cacheControl) {
31
+ fields["Cache-Control"] = cacheControl;
32
+ }
33
+
34
+ const s3Params = {
35
+ Expires: 20,
36
+ Bucket: bucket,
37
+ Conditions: [["content-length-range", 0, 26214400], {
38
+ acl
39
+ }],
40
+ Fields: fields
41
+ };
42
+ const s3 = new _s.default();
43
+ return s3.createPresignedPost(s3Params);
44
+ };
45
+
46
+ exports.getPresignedPost = getPresignedPost;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getPresignedPost","bucket","key","acl","checksum","cacheControl","contentType","fields","s3Params","Expires","Bucket","Conditions","Fields","s3","S3Client","createPresignedPost"],"sources":["getPresignedPost.ts"],"sourcesContent":["import S3Client from \"aws-sdk/clients/s3\";\n\ninterface GetPresignedPostParams {\n bucket: string;\n key: string;\n acl: string;\n checksum: string;\n contentType: string | null;\n cacheControl: string | undefined;\n}\n\nexport const getPresignedPost = async ({\n bucket,\n key,\n acl,\n checksum,\n cacheControl,\n contentType\n}: GetPresignedPostParams) => {\n const fields: Record<string, string> = { key, \"X-Amz-Meta-Checksum\": checksum, acl };\n\n if (contentType) {\n fields[\"Content-Type\"] = contentType;\n }\n\n if (cacheControl) {\n fields[\"Cache-Control\"] = cacheControl;\n }\n\n const s3Params = {\n Expires: 20,\n Bucket: bucket,\n Conditions: [[\"content-length-range\", 0, 26214400], { acl }],\n Fields: fields\n };\n\n const s3 = new S3Client();\n\n return s3.createPresignedPost(s3Params);\n};\n"],"mappings":";;;;;;;;;AAAA;;AAWO,MAAMA,gBAAgB,GAAG,OAAO;EACnCC,MADmC;EAEnCC,GAFmC;EAGnCC,GAHmC;EAInCC,QAJmC;EAKnCC,YALmC;EAMnCC;AANmC,CAAP,KAOF;EAC1B,MAAMC,MAA8B,GAAG;IAAEL,GAAF;IAAO,uBAAuBE,QAA9B;IAAwCD;EAAxC,CAAvC;;EAEA,IAAIG,WAAJ,EAAiB;IACbC,MAAM,CAAC,cAAD,CAAN,GAAyBD,WAAzB;EACH;;EAED,IAAID,YAAJ,EAAkB;IACdE,MAAM,CAAC,eAAD,CAAN,GAA0BF,YAA1B;EACH;;EAED,MAAMG,QAAQ,GAAG;IACbC,OAAO,EAAE,EADI;IAEbC,MAAM,EAAET,MAFK;IAGbU,UAAU,EAAE,CAAC,CAAC,sBAAD,EAAyB,CAAzB,EAA4B,QAA5B,CAAD,EAAwC;MAAER;IAAF,CAAxC,CAHC;IAIbS,MAAM,EAAEL;EAJK,CAAjB;EAOA,MAAMM,EAAE,GAAG,IAAIC,UAAJ,EAAX;EAEA,OAAOD,EAAE,CAACE,mBAAH,CAAuBP,QAAvB,CAAP;AACH,CA5BM"}
@@ -0,0 +1,3 @@
1
+ export * from "./tagResources";
2
+ export * from "./uploadFolderToS3";
3
+ export { withCommonLambdaEnvVariables, getCommonLambdaEnvVariables } from "./lambdaEnvVariables";
package/utils/index.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ withCommonLambdaEnvVariables: true,
8
+ getCommonLambdaEnvVariables: true
9
+ };
10
+ Object.defineProperty(exports, "getCommonLambdaEnvVariables", {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _lambdaEnvVariables.getCommonLambdaEnvVariables;
14
+ }
15
+ });
16
+ Object.defineProperty(exports, "withCommonLambdaEnvVariables", {
17
+ enumerable: true,
18
+ get: function () {
19
+ return _lambdaEnvVariables.withCommonLambdaEnvVariables;
20
+ }
21
+ });
22
+
23
+ var _tagResources = require("./tagResources");
24
+
25
+ Object.keys(_tagResources).forEach(function (key) {
26
+ if (key === "default" || key === "__esModule") return;
27
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
28
+ if (key in exports && exports[key] === _tagResources[key]) return;
29
+ Object.defineProperty(exports, key, {
30
+ enumerable: true,
31
+ get: function () {
32
+ return _tagResources[key];
33
+ }
34
+ });
35
+ });
36
+
37
+ var _uploadFolderToS = require("./uploadFolderToS3");
38
+
39
+ Object.keys(_uploadFolderToS).forEach(function (key) {
40
+ if (key === "default" || key === "__esModule") return;
41
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
+ if (key in exports && exports[key] === _uploadFolderToS[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _uploadFolderToS[key];
47
+ }
48
+ });
49
+ });
50
+
51
+ var _lambdaEnvVariables = require("./lambdaEnvVariables");
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./tagResources\";\nexport * from \"./uploadFolderToS3\";\nexport { withCommonLambdaEnvVariables, getCommonLambdaEnvVariables } from \"./lambdaEnvVariables\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA"}