@webiny/project-aws 6.6.0-alpha.0 → 6.6.0-alpha.10
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/_templates/appTemplates/api/graphql/src/index.ts +12 -1
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +9 -1
- package/abstractions/pulumiTypes.d.ts +15 -0
- package/abstractions/pulumiTypes.js +0 -0
- package/api.js +1 -3
- package/api.js.map +1 -1
- package/apps/createApiApp.d.ts +8 -0
- package/exports/infra/admin.d.ts +1 -3
- package/exports/infra/admin.js +0 -3
- package/exports/infra/api.d.ts +1 -3
- package/exports/infra/api.js +0 -3
- package/exports/infra/core.d.ts +1 -2
- package/exports/infra/core.js +0 -2
- package/extensions/ApiLambdaFunction.js +3 -2
- package/extensions/ApiLambdaFunction.js.map +1 -1
- package/extensions/ApiRoute.d.ts +1 -1
- package/extensions/ApiRoute.js +20 -13
- package/extensions/ApiRoute.js.map +1 -1
- package/extensions/OpenSearch/EnsureOsWasDeployed.d.ts +2 -2
- package/extensions/OpenSearch/EnsureOsWasDeployed.js +1 -1
- package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -1
- package/extensions/OpenSearch.d.ts +9 -10
- package/extensions/OpenSearch.js +7 -15
- package/extensions/OpenSearch.js.map +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +2 -2
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +2 -3
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +1 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.d.ts +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.d.ts +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js.map +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.d.ts +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js.map +1 -1
- package/extensions/ProjectAws/SetDatabaseSetupOutput.d.ts +2 -2
- package/extensions/ProjectAws/SetDatabaseSetupOutput.js +1 -1
- package/extensions/ProjectAws/SetDatabaseSetupOutput.js.map +1 -1
- package/extensions/ProjectAws/UploadAdminAppToS3.d.ts +1 -1
- package/extensions/ProjectAws/UploadAdminAppToS3.js +2 -2
- package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
- package/extensions/ProjectAws/definitions.js +1 -1
- package/extensions/ProjectAws/definitions.js.map +1 -1
- package/extensions/ProjectAws.d.ts +1 -0
- package/extensions/ProjectAws.js +1 -0
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/RegisterRoutesPulumi.d.ts +2 -2
- package/extensions/RegisterRoutesPulumi.js +4 -7
- package/extensions/RegisterRoutesPulumi.js.map +1 -1
- package/extensions/definitions.js +1 -3
- package/extensions/definitions.js.map +1 -1
- package/extensions/index.d.ts +2 -3
- package/extensions/index.js +2 -3
- package/extensions/registerExtensionImplementations.js +10 -0
- package/extensions/registerExtensionImplementations.js.map +1 -0
- package/extensions/routePath.d.ts +20 -0
- package/extensions/routePath.js +13 -0
- package/extensions/routePath.js.map +1 -0
- package/features/ApiGqlClient.d.ts +4 -4
- package/features/ApiGqlClient.js +3 -3
- package/features/ApiGqlClient.js.map +1 -1
- package/features/InvokeLambdaFunction.d.ts +2 -2
- package/features/InvokeLambdaFunction.js +2 -2
- package/features/InvokeLambdaFunction.js.map +1 -1
- package/features/Watch/AwsWatch.js +3 -3
- package/features/Watch/AwsWatch.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/infra.d.ts +49 -2
- package/infra.js +16 -4
- package/infra.js.map +1 -1
- package/package.json +22 -22
- package/project.d.ts +27 -11
- package/project.js +3 -2
- package/project.js.map +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +7 -4
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/api/ApiCloudfront.js +105 -2
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
- package/pulumi/apps/api/ApiGraphqlStream.d.ts +29 -0
- package/pulumi/apps/api/ApiGraphqlStream.js +58 -0
- package/pulumi/apps/api/ApiGraphqlStream.js.map +1 -0
- package/pulumi/apps/api/ApiOutput.d.ts +6 -6
- package/pulumi/apps/api/createApiPulumiApp.d.ts +8 -0
- package/pulumi/apps/api/createApiPulumiApp.js +33 -24
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/api/index.d.ts +1 -0
- package/pulumi/apps/api/index.js +1 -0
- package/pulumi/apps/awsUtils.d.ts +1 -1
- package/pulumi/apps/awsUtils.js +1 -1
- package/pulumi/apps/awsUtils.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/resolveDomains.js +1 -1
- package/pulumi/apps/blueGreen/domains/resolveDomains.js.map +1 -1
- package/pulumi/apps/blueGreen/types.d.ts +0 -3
- package/pulumi/apps/common/CoreOutput.d.ts +2 -1
- package/pulumi/apps/common/CoreOutput.js.map +1 -1
- package/pulumi/apps/core/CoreAuditLogsDynamo.d.ts +1 -0
- package/pulumi/apps/core/CoreAuditLogsDynamo.js +3 -0
- package/pulumi/apps/core/CoreAuditLogsDynamo.js.map +1 -1
- package/pulumi/apps/core/CoreCognito.d.ts +1 -0
- package/pulumi/apps/core/CoreCognito.js +4 -1
- package/pulumi/apps/core/CoreCognito.js.map +1 -1
- package/pulumi/apps/core/CoreDynamo.d.ts +1 -0
- package/pulumi/apps/core/CoreDynamo.js +3 -0
- package/pulumi/apps/core/CoreDynamo.js.map +1 -1
- package/pulumi/apps/core/CoreFileManager.d.ts +2 -0
- package/pulumi/apps/core/CoreFileManager.js +11 -1
- package/pulumi/apps/core/CoreFileManager.js.map +1 -1
- package/pulumi/apps/core/CoreOpenSearch.d.ts +1 -0
- package/pulumi/apps/core/CoreOpenSearch.js +3 -0
- package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +9 -1
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js +12 -2
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -1
- package/pulumi/apps/core/createCorePulumiApp.js +34 -9
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/customDomain.d.ts +10 -0
- package/pulumi/apps/customDomain.js +5 -1
- package/pulumi/apps/customDomain.js.map +1 -1
- package/pulumi/apps/extensions/getAwsTagsFromExtension.js +1 -1
- package/pulumi/apps/extensions/getAwsTagsFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.d.ts +2 -2
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js +1 -1
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/getOsConfigFromExtension.js +2 -2
- package/pulumi/apps/extensions/getOsConfigFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/getVpcConfigFromExtension.js +1 -1
- package/pulumi/apps/extensions/getVpcConfigFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/isProductionDefaultEnabled.d.ts +16 -0
- package/pulumi/apps/extensions/isProductionDefaultEnabled.js +9 -0
- package/pulumi/apps/extensions/isProductionDefaultEnabled.js.map +1 -0
- package/pulumi/apps/extensions/isVpcEnabled.d.ts +14 -0
- package/pulumi/apps/extensions/isVpcEnabled.js +8 -0
- package/pulumi/apps/extensions/isVpcEnabled.js.map +1 -0
- package/pulumi/apps/syncSystem/SyncSystemLambda.d.ts +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.js +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
- package/pulumi/extensions/AdminPulumi.js +3 -2
- package/pulumi/extensions/AdminPulumi.js.map +1 -1
- package/pulumi/extensions/ApiPulumi.js +3 -2
- package/pulumi/extensions/ApiPulumi.js.map +1 -1
- package/pulumi/extensions/CorePulumi.js +3 -2
- package/pulumi/extensions/CorePulumi.js.map +1 -1
- package/pulumi/extensions/index.d.ts +42 -11
- package/pulumi/extensions/index.js +12 -9
- package/pulumi/extensions/index.js.map +1 -1
- package/pulumi/features/AdminPulumi/AdminPulumi.d.ts +1 -1
- package/pulumi/features/AdminPulumi/AdminPulumi.js +1 -1
- package/pulumi/features/AdminPulumi/AdminPulumi.js.map +1 -1
- package/pulumi/features/ApiPulumi/ApiPulumi.d.ts +1 -1
- package/pulumi/features/ApiPulumi/ApiPulumi.js +1 -1
- package/pulumi/features/ApiPulumi/ApiPulumi.js.map +1 -1
- package/pulumi/features/CorePulumi/CorePulumi.d.ts +1 -1
- package/pulumi/features/CorePulumi/CorePulumi.js +1 -1
- package/pulumi/features/CorePulumi/CorePulumi.js.map +1 -1
- package/pulumi/features/DefaultSetAdminCustomDomains.d.ts +1 -1
- package/pulumi/features/DefaultSetAdminCustomDomains.js.map +1 -1
- package/pulumi/features/DefaultSetApiCustomDomains.d.ts +1 -1
- package/pulumi/features/DefaultSetApiCustomDomains.js.map +1 -1
- package/pulumi/types.d.ts +2 -1
- package/pulumi/utils/getDistributionUrl.d.ts +9 -0
- package/pulumi/utils/getDistributionUrl.js +8 -0
- package/pulumi/utils/getDistributionUrl.js.map +1 -0
- package/pulumi/utils/index.d.ts +1 -0
- package/pulumi/utils/index.js +1 -0
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
- package/services/AdminStackOutputService.d.ts +2 -2
- package/services/AdminStackOutputService.js +1 -1
- package/services/AdminStackOutputService.js.map +1 -1
- package/services/ApiStackOutputService.d.ts +2 -2
- package/services/ApiStackOutputService.js +1 -1
- package/services/ApiStackOutputService.js.map +1 -1
- package/services/CoreStackOutputService.d.ts +2 -2
- package/services/CoreStackOutputService.js +1 -1
- package/services/CoreStackOutputService.js.map +1 -1
- package/services/GetPulumiService/GetPulumiService.d.ts +1 -2
- package/services/GetPulumiService/GetPulumiService.js +1 -1
- package/services/GetPulumiService/GetPulumiService.js.map +1 -1
- package/abstractions/ApiGqlClient.d.ts +0 -23
- package/abstractions/ApiGqlClient.js +0 -5
- package/abstractions/ApiGqlClient.js.map +0 -1
- package/abstractions/InvokeLambdaFunction.d.ts +0 -18
- package/abstractions/InvokeLambdaFunction.js +0 -5
- package/abstractions/InvokeLambdaFunction.js.map +0 -1
- package/abstractions/features/pulumi/AdminPulumi.d.ts +0 -9
- package/abstractions/features/pulumi/AdminPulumi.js +0 -5
- package/abstractions/features/pulumi/AdminPulumi.js.map +0 -1
- package/abstractions/features/pulumi/ApiPulumi.d.ts +0 -9
- package/abstractions/features/pulumi/ApiPulumi.js +0 -5
- package/abstractions/features/pulumi/ApiPulumi.js.map +0 -1
- package/abstractions/features/pulumi/CorePulumi.d.ts +0 -9
- package/abstractions/features/pulumi/CorePulumi.js +0 -5
- package/abstractions/features/pulumi/CorePulumi.js.map +0 -1
- package/abstractions/features/pulumi/SetAdminCustomDomains.d.ts +0 -9
- package/abstractions/features/pulumi/SetAdminCustomDomains.js +0 -5
- package/abstractions/features/pulumi/SetAdminCustomDomains.js.map +0 -1
- package/abstractions/features/pulumi/SetApiCustomDomains.d.ts +0 -9
- package/abstractions/features/pulumi/SetApiCustomDomains.js +0 -5
- package/abstractions/features/pulumi/SetApiCustomDomains.js.map +0 -1
- package/abstractions/features/pulumi/index.d.ts +0 -5
- package/abstractions/features/pulumi/index.js +0 -5
- package/abstractions/index.d.ts +0 -6
- package/abstractions/index.js +0 -6
- package/abstractions/services/AdminStackOutputService.d.ts +0 -13
- package/abstractions/services/AdminStackOutputService.js +0 -5
- package/abstractions/services/AdminStackOutputService.js.map +0 -1
- package/abstractions/services/ApiStackOutputService.d.ts +0 -29
- package/abstractions/services/ApiStackOutputService.js +0 -5
- package/abstractions/services/ApiStackOutputService.js.map +0 -1
- package/abstractions/services/CoreStackOutputService.d.ts +0 -16
- package/abstractions/services/CoreStackOutputService.js +0 -5
- package/abstractions/services/CoreStackOutputService.js.map +0 -1
- package/exports/extensions.d.ts +0 -5
- package/exports/extensions.js +0 -5
- package/exports/infra.d.ts +0 -1
- package/exports/infra.js +0 -1
- package/extensions/AwsDefaultRegion.d.ts +0 -4
- package/extensions/AwsDefaultRegion.js +0 -23
- package/extensions/AwsDefaultRegion.js.map +0 -1
- package/extensions/BackgroundTasks.d.ts +0 -4
- package/extensions/BackgroundTasks.js +0 -24
- package/extensions/BackgroundTasks.js.map +0 -1
- package/extensions/Cms/ModelFieldCompression.d.ts +0 -4
- package/extensions/Cms/ModelFieldCompression.js +0 -24
- package/extensions/Cms/ModelFieldCompression.js.map +0 -1
- package/extensions/Mailer/Smtp.d.ts +0 -8
- package/extensions/Mailer/Smtp.js +0 -21
- package/extensions/Mailer/Smtp.js.map +0 -1
- package/extensions/Mailer/Smtp.test.js +0 -127
- package/extensions/Mailer/Smtp.test.js.map +0 -1
- package/extensions/Mailer/SmtpParamsSchema.d.ts +0 -9
- package/extensions/Mailer/SmtpParamsSchema.js +0 -17
- package/extensions/Mailer/SmtpParamsSchema.js.map +0 -1
- package/extensions/ProjectAws/AutoInstall.d.ts +0 -9
- package/extensions/ProjectAws/AutoInstall.js +0 -20
- package/extensions/ProjectAws/AutoInstall.js.map +0 -1
- package/pulumi/extensions/AdminCustomDomains.d.ts +0 -9
- package/pulumi/extensions/AdminCustomDomains.js +0 -20
- package/pulumi/extensions/AdminCustomDomains.js.map +0 -1
- package/pulumi/extensions/ApiCustomDomains.d.ts +0 -9
- package/pulumi/extensions/ApiCustomDomains.js +0 -20
- package/pulumi/extensions/ApiCustomDomains.js.map +0 -1
- package/pulumi/extensions/AwsTags.d.ts +0 -4
- package/pulumi/extensions/AwsTags.js +0 -16
- package/pulumi/extensions/AwsTags.js.map +0 -1
- package/pulumi/extensions/BlueGreenDeployments.d.ts +0 -34
- package/pulumi/extensions/BlueGreenDeployments.js +0 -38
- package/pulumi/extensions/BlueGreenDeployments.js.map +0 -1
- package/pulumi/extensions/OpenSearch.d.ts +0 -10
- package/pulumi/extensions/OpenSearch.js +0 -21
- package/pulumi/extensions/OpenSearch.js.map +0 -1
- package/pulumi/extensions/Vpc.d.ts +0 -15
- package/pulumi/extensions/Vpc.js +0 -26
- package/pulumi/extensions/Vpc.js.map +0 -1
- /package/extensions/{Mailer/Smtp.test.d.ts → registerExtensionImplementations.d.ts} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { createAppModule } from "@webiny/pulumi";
|
|
3
|
+
import { getCommonLambdaEnvVariables } from "../lambdaUtils.js";
|
|
4
|
+
import { VpcConfig } from "../index.js";
|
|
5
|
+
import { LAMBDA_RUNTIME } from "../../constants.js";
|
|
6
|
+
import { ApiGraphql } from "./ApiGraphql.js";
|
|
7
|
+
import * as __rspack_external__pulumi_pulumi_f3e773ed from "@pulumi/pulumi";
|
|
8
|
+
import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
|
|
9
|
+
const ApiGraphqlStream = createAppModule({
|
|
10
|
+
name: "ApiGraphqlStream",
|
|
11
|
+
config (app, params) {
|
|
12
|
+
const { role } = app.getModule(ApiGraphql);
|
|
13
|
+
const graphqlStream = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambda.Function, {
|
|
14
|
+
name: "graphql-stream",
|
|
15
|
+
config: {
|
|
16
|
+
description: "Webiny's streaming HTTP routes",
|
|
17
|
+
runtime: LAMBDA_RUNTIME,
|
|
18
|
+
handler: "handler.streamHandler",
|
|
19
|
+
role: role.output.arn,
|
|
20
|
+
timeout: 300,
|
|
21
|
+
memorySize: 1024,
|
|
22
|
+
code: new __rspack_external__pulumi_pulumi_f3e773ed.asset.AssetArchive({
|
|
23
|
+
".": new __rspack_external__pulumi_pulumi_f3e773ed.asset.FileArchive(path.join(app.paths.workspace, "graphql/build"))
|
|
24
|
+
}),
|
|
25
|
+
environment: {
|
|
26
|
+
variables: getCommonLambdaEnvVariables().apply((value)=>({
|
|
27
|
+
...value,
|
|
28
|
+
...params.env,
|
|
29
|
+
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
|
|
30
|
+
}))
|
|
31
|
+
},
|
|
32
|
+
vpcConfig: app.getModule(VpcConfig).functionVpcConfig,
|
|
33
|
+
loggingConfig: {
|
|
34
|
+
logFormat: "JSON"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const functionUrl = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.lambda.FunctionUrl, {
|
|
39
|
+
name: "graphql-stream-url",
|
|
40
|
+
config: {
|
|
41
|
+
functionName: graphqlStream.output.name,
|
|
42
|
+
authorizationType: "AWS_IAM",
|
|
43
|
+
invokeMode: "RESPONSE_STREAM"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
role,
|
|
48
|
+
functions: {
|
|
49
|
+
graphqlStream
|
|
50
|
+
},
|
|
51
|
+
functionUrl,
|
|
52
|
+
functionUrlDomain: functionUrl.output.functionUrl.apply((url)=>new URL(url).hostname)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
export { ApiGraphqlStream };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=ApiGraphqlStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pulumi/apps/api/ApiGraphqlStream.js","sources":["../../../../src/pulumi/apps/api/ApiGraphqlStream.ts"],"sourcesContent":["import path from \"path\";\nimport * as pulumi from \"@pulumi/pulumi\";\nimport * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\nimport { getCommonLambdaEnvVariables } from \"../lambdaUtils.js\";\nimport { VpcConfig } from \"~/pulumi/apps/index.js\";\nimport { LAMBDA_RUNTIME } from \"~/pulumi/constants.js\";\nimport { ApiGraphql } from \"./ApiGraphql.js\";\n\ninterface GraphqlStreamParams {\n env: Record<string, any>;\n}\n\nexport type ApiGraphqlStream = PulumiAppModule<typeof ApiGraphqlStream>;\n\n/**\n * The response-streaming twin of {@link ApiGraphql}.\n *\n * Why a second Lambda function rather than a second route on the existing one: API Gateway buffers the\n * entire Lambda response no matter how it was produced, so it cannot stream at all. Streaming requires\n * a Lambda Function URL with `InvokeMode: RESPONSE_STREAM`, and the response has to be produced by an\n * `awslambda.streamifyResponse` handler — but a Lambda's handler entry point is fixed per function. So:\n * same code bundle, same IAM role, different entry point (`handler.streamHandler`), reached through a\n * Function URL instead of API Gateway.\n *\n * The Function URL is NOT public. It uses `AWS_IAM` authorization and is invoked only by CloudFront,\n * which signs each request using an Origin Access Control (see ApiCloudfront).\n */\nexport const ApiGraphqlStream = createAppModule({\n name: \"ApiGraphqlStream\",\n config(app: PulumiApp, params: GraphqlStreamParams) {\n // Reuse the buffered function's role and policy: identical permissions, and duplicating the\n // policy would mean two places to keep in sync.\n const { role } = app.getModule(ApiGraphql);\n\n const graphqlStream = app.addResource(aws.lambda.Function, {\n name: \"graphql-stream\",\n config: {\n description: \"Webiny's streaming HTTP routes\",\n runtime: LAMBDA_RUNTIME,\n // Second export of the SAME bundle that backs the `graphql` function.\n handler: \"handler.streamHandler\",\n role: role.output.arn,\n // Streaming exists for long-running work (AI token streams). API Gateway's hard 30s\n // cap doesn't apply to a Function URL, so allow well beyond the buffered function's 30s.\n timeout: 300,\n memorySize: 1024,\n code: new pulumi.asset.AssetArchive({\n \".\": new pulumi.asset.FileArchive(\n path.join(app.paths.workspace, \"graphql/build\")\n )\n }),\n environment: {\n variables: getCommonLambdaEnvVariables().apply(value => ({\n ...value,\n ...params.env,\n AWS_NODEJS_CONNECTION_REUSE_ENABLED: \"1\"\n }))\n },\n vpcConfig: app.getModule(VpcConfig).functionVpcConfig,\n loggingConfig: {\n logFormat: \"JSON\"\n }\n }\n });\n\n const functionUrl = app.addResource(aws.lambda.FunctionUrl, {\n name: \"graphql-stream-url\",\n config: {\n functionName: graphqlStream.output.name,\n // Locked to signed CloudFront requests; see the OAC + invoke permission below.\n authorizationType: \"AWS_IAM\",\n // The whole point: without RESPONSE_STREAM the runtime buffers the response and\n // `streamifyResponse` has no effect.\n invokeMode: \"RESPONSE_STREAM\"\n }\n });\n\n return {\n role,\n functions: {\n graphqlStream\n },\n functionUrl,\n /** Origin domain for CloudFront, e.g. `abc123.lambda-url.eu-central-1.on.aws`. */\n functionUrlDomain: functionUrl.output.functionUrl.apply(\n (url: string) => new URL(url).hostname\n )\n };\n }\n});\n"],"names":["ApiGraphqlStream","createAppModule","app","params","role","ApiGraphql","graphqlStream","aws","LAMBDA_RUNTIME","pulumi","path","getCommonLambdaEnvVariables","value","VpcConfig","functionUrl","url","URL"],"mappings":";;;;;;;;AA6BO,MAAMA,mBAAmBC,gBAAgB;IAC5C,MAAM;IACN,QAAOC,GAAc,EAAEC,MAA2B;QAG9C,MAAM,EAAEC,IAAI,EAAE,GAAGF,IAAI,SAAS,CAACG;QAE/B,MAAMC,gBAAgBJ,IAAI,WAAW,CAACK,uCAAAA,MAAAA,CAAAA,QAAmB,EAAE;YACvD,MAAM;YACN,QAAQ;gBACJ,aAAa;gBACb,SAASC;gBAET,SAAS;gBACT,MAAMJ,KAAK,MAAM,CAAC,GAAG;gBAGrB,SAAS;gBACT,YAAY;gBACZ,MAAM,IAAIK,0CAAAA,KAAAA,CAAAA,YAAyB,CAAC;oBAChC,KAAK,IAAIA,0CAAAA,KAAAA,CAAAA,WAAwB,CAC7BC,KAAK,IAAI,CAACR,IAAI,KAAK,CAAC,SAAS,EAAE;gBAEvC;gBACA,aAAa;oBACT,WAAWS,8BAA8B,KAAK,CAACC,CAAAA,QAAU;4BACrD,GAAGA,KAAK;4BACR,GAAGT,OAAO,GAAG;4BACb,qCAAqC;wBACzC;gBACJ;gBACA,WAAWD,IAAI,SAAS,CAACW,WAAW,iBAAiB;gBACrD,eAAe;oBACX,WAAW;gBACf;YACJ;QACJ;QAEA,MAAMC,cAAcZ,IAAI,WAAW,CAACK,uCAAAA,MAAAA,CAAAA,WAAsB,EAAE;YACxD,MAAM;YACN,QAAQ;gBACJ,cAAcD,cAAc,MAAM,CAAC,IAAI;gBAEvC,mBAAmB;gBAGnB,YAAY;YAChB;QACJ;QAEA,OAAO;YACHF;YACA,WAAW;gBACPE;YACJ;YACAQ;YAEA,mBAAmBA,YAAY,MAAM,CAAC,WAAW,CAAC,KAAK,CACnD,CAACC,MAAgB,IAAIC,IAAID,KAAK,QAAQ;QAE9C;IACJ;AACJ"}
|
|
@@ -7,16 +7,16 @@ export declare const ApiOutput: import("@webiny/pulumi").PulumiAppModuleDefiniti
|
|
|
7
7
|
graphqlLambdaRoleName: string;
|
|
8
8
|
cognitoAppClientId: string;
|
|
9
9
|
cognitoUserPoolId: string;
|
|
10
|
-
cognitoUserPoolPasswordPolicy:
|
|
10
|
+
cognitoUserPoolPasswordPolicy: import("@webiny/project-extensions-aws/abstractions").IApiStackOutputPasswordPolicy;
|
|
11
11
|
dynamoDbTable: string;
|
|
12
12
|
region: string;
|
|
13
|
-
websocketApiId: string | number | boolean | string[] | number[] | undefined;
|
|
13
|
+
websocketApiId: string | number | boolean | object | string[] | number[] | undefined;
|
|
14
14
|
websocketApiUrl: string;
|
|
15
|
-
graphqlLambdaName: string | number | boolean | string[] | number[] | undefined;
|
|
16
|
-
backgroundTaskLambdaArn: string | number | boolean | string[] | number[] | undefined;
|
|
17
|
-
backgroundTaskStepFunctionArn: string | number | boolean | string[] | number[] | undefined;
|
|
15
|
+
graphqlLambdaName: string | number | boolean | object | string[] | number[] | undefined;
|
|
16
|
+
backgroundTaskLambdaArn: string | number | boolean | object | string[] | number[] | undefined;
|
|
17
|
+
backgroundTaskStepFunctionArn: string | number | boolean | object | string[] | number[] | undefined;
|
|
18
18
|
fileManagerManageLambdaArn: string;
|
|
19
19
|
fileManagerManageLambdaRole: string;
|
|
20
20
|
fileManagerManageLambdaRoleName: string;
|
|
21
|
-
fileManagerDownloadLambdaArn: string | number | boolean | string[] | number[] | undefined;
|
|
21
|
+
fileManagerDownloadLambdaArn: string | number | boolean | object | string[] | number[] | undefined;
|
|
22
22
|
}>>, void>;
|
|
@@ -15,6 +15,14 @@ export declare const createApiPulumiApp: () => PulumiApp<{
|
|
|
15
15
|
};
|
|
16
16
|
addRoute: (routeParams: import("~/pulumi/apps/index.js").AddRouteParams) => any;
|
|
17
17
|
};
|
|
18
|
+
graphqlStream: {
|
|
19
|
+
role: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/iam/role.js").Role>;
|
|
20
|
+
functions: {
|
|
21
|
+
graphqlStream: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/function.js").Function>;
|
|
22
|
+
};
|
|
23
|
+
functionUrl: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/lambda/functionUrl.js").FunctionUrl>;
|
|
24
|
+
functionUrlDomain: import("@pulumi/pulumi").Output<string>;
|
|
25
|
+
};
|
|
18
26
|
apiGateway: {
|
|
19
27
|
api: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/api.js").Api>;
|
|
20
28
|
stage: import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/apigatewayv2/stage.js").Stage>;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { createPulumiApp, isResourceOfType } from "@webiny/pulumi";
|
|
2
|
-
import { ApiBackgroundTask, ApiCloudfront, ApiFileManager, ApiGateway, ApiGraphql, ApiWebsocket, CoreOutput, VpcConfig } from "../index.js";
|
|
3
|
-
import { addDomainsUrlsOutputs, withCommonLambdaEnvVariables, withServiceManifest } from "../../utils/index.js";
|
|
2
|
+
import { ApiBackgroundTask, ApiCloudfront, ApiFileManager, ApiGateway, ApiGraphql, ApiGraphqlStream, ApiWebsocket, CoreOutput, VpcConfig } from "../index.js";
|
|
3
|
+
import { addDomainsUrlsOutputs, getDistributionUrl, withCommonLambdaEnvVariables, withServiceManifest } from "../../utils/index.js";
|
|
4
4
|
import { getEnvVariableAwsRegion } from "../../env/awsRegion.js";
|
|
5
5
|
import { applyAwsResourceTags, getAwsAccountId } from "../awsUtils.js";
|
|
6
6
|
import { ApiScheduler } from "./ApiScheduler.js";
|
|
7
7
|
import { getAwsProjectSdk } from "../../getAwsProjectSdk.js";
|
|
8
8
|
import { getVpcConfigFromExtension } from "../extensions/getVpcConfigFromExtension.js";
|
|
9
|
+
import { isVpcEnabled } from "../extensions/isVpcEnabled.js";
|
|
9
10
|
import { getOsConfigFromExtension } from "../extensions/getOsConfigFromExtension.js";
|
|
10
11
|
import { handleGuardDutyEvents } from "./handleGuardDutyEvents.js";
|
|
11
|
-
import { ApiPulumi, SetApiCustomDomains } from "
|
|
12
|
+
import { ApiPulumi, SetApiCustomDomains } from "@webiny/project-extensions-aws/abstractions/features/pulumi/index.js";
|
|
12
13
|
import { apiPulumi } from "../../features/ApiPulumi/index.js";
|
|
13
14
|
import { DefaultSetApiCustomDomains } from "../../features/DefaultSetApiCustomDomains.js";
|
|
14
|
-
import { ApiCustomDomains } from "
|
|
15
|
+
import { ApiCustomDomains } from "@webiny/project-extensions-aws/extensions/ApiCustomDomains.js";
|
|
15
16
|
import { applyCustomDomain } from "../customDomain.js";
|
|
16
17
|
import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
|
|
17
18
|
const createApiPulumiApp = ()=>{
|
|
@@ -43,7 +44,7 @@ const createApiPulumiApp = ()=>{
|
|
|
43
44
|
app.addHandler(async ()=>{
|
|
44
45
|
const featureFlags = await sdk.getFeatureFlags();
|
|
45
46
|
const usingAdvancedVpcParams = vpcExtensionsConfig && "boolean" != typeof vpcExtensionsConfig;
|
|
46
|
-
if (featureFlags.
|
|
47
|
+
if (featureFlags.isEnabled("fileManager.threatDetection")) handleGuardDutyEvents(app);
|
|
47
48
|
if (usingAdvancedVpcParams) {
|
|
48
49
|
const { onResource, addResource } = app;
|
|
49
50
|
const { useExistingVpc } = vpcExtensionsConfig;
|
|
@@ -73,26 +74,29 @@ const createApiPulumiApp = ()=>{
|
|
|
73
74
|
app.addHandler(()=>pulumiHandlers.execute(app));
|
|
74
75
|
const isProduction = app.env.isProduction;
|
|
75
76
|
const core = app.addModule(CoreOutput);
|
|
76
|
-
const vpcEnabled = true === vpcExtensionsConfig || "object" == typeof vpcExtensionsConfig || isProduction;
|
|
77
77
|
app.addModule(VpcConfig, {
|
|
78
|
-
enabled:
|
|
78
|
+
enabled: isVpcEnabled(vpcExtensionsConfig, isProduction)
|
|
79
79
|
});
|
|
80
|
+
const graphqlEnv = {
|
|
81
|
+
COGNITO_REGION: getEnvVariableAwsRegion(),
|
|
82
|
+
COGNITO_USER_POOL_ID: core.cognitoUserPoolId,
|
|
83
|
+
DB_TABLE: core.primaryDynamodbTableName,
|
|
84
|
+
DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,
|
|
85
|
+
DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,
|
|
86
|
+
OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,
|
|
87
|
+
OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,
|
|
88
|
+
OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,
|
|
89
|
+
OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME,
|
|
90
|
+
OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD,
|
|
91
|
+
S3_BUCKET: core.fileManagerBucketId,
|
|
92
|
+
EVENT_BUS: core.eventBusArn,
|
|
93
|
+
OKTA_ISSUER: process.env["OKTA_ISSUER"]
|
|
94
|
+
};
|
|
80
95
|
const graphql = app.addModule(ApiGraphql, {
|
|
81
|
-
env:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,
|
|
86
|
-
DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,
|
|
87
|
-
OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,
|
|
88
|
-
OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,
|
|
89
|
-
OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,
|
|
90
|
-
OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME,
|
|
91
|
-
OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD,
|
|
92
|
-
S3_BUCKET: core.fileManagerBucketId,
|
|
93
|
-
EVENT_BUS: core.eventBusArn,
|
|
94
|
-
OKTA_ISSUER: process.env["OKTA_ISSUER"]
|
|
95
|
-
}
|
|
96
|
+
env: graphqlEnv
|
|
97
|
+
});
|
|
98
|
+
const graphqlStream = app.addModule(ApiGraphqlStream, {
|
|
99
|
+
env: graphqlEnv
|
|
96
100
|
});
|
|
97
101
|
const websocket = app.addModule(ApiWebsocket);
|
|
98
102
|
const fileManager = app.addModule(ApiFileManager, {
|
|
@@ -153,11 +157,12 @@ const createApiPulumiApp = ()=>{
|
|
|
153
157
|
const scheduler = app.addModule(ApiScheduler);
|
|
154
158
|
const [apiCustomDomains] = projectConfig.extensionsByType(ApiCustomDomains);
|
|
155
159
|
if (apiCustomDomains) {
|
|
156
|
-
const { domains, sslMethod, certificateArn } = apiCustomDomains.params;
|
|
160
|
+
const { domains, sslMethod, certificateArn, minimumProtocolVersion } = apiCustomDomains.params;
|
|
157
161
|
applyCustomDomain(cloudfront, {
|
|
158
162
|
domains,
|
|
159
163
|
sslSupportMethod: sslMethod,
|
|
160
|
-
acmCertificateArn: certificateArn
|
|
164
|
+
acmCertificateArn: certificateArn,
|
|
165
|
+
minimumProtocolVersion
|
|
161
166
|
});
|
|
162
167
|
}
|
|
163
168
|
app.addOutputs({
|
|
@@ -171,6 +176,8 @@ const createApiPulumiApp = ()=>{
|
|
|
171
176
|
graphqlLambdaName: graphql.functions.graphql.output.name,
|
|
172
177
|
graphqlLambdaRole: graphql.role.output.arn,
|
|
173
178
|
graphqlLambdaRoleName: graphql.role.output.name,
|
|
179
|
+
graphqlStreamLambdaName: graphqlStream.functions.graphqlStream.output.name,
|
|
180
|
+
graphqlStreamFunctionUrl: graphqlStream.functionUrl.output.functionUrl,
|
|
174
181
|
backgroundTaskLambdaArn: backgroundTask.backgroundTask.output.arn,
|
|
175
182
|
backgroundTaskStepFunctionArn: backgroundTask.stepFunction.output.arn,
|
|
176
183
|
fileManagerDownloadLambdaArn: fileManager.functions.download.output.arn,
|
|
@@ -197,6 +204,7 @@ const createApiPulumiApp = ()=>{
|
|
|
197
204
|
return {
|
|
198
205
|
fileManager,
|
|
199
206
|
graphql,
|
|
207
|
+
graphqlStream,
|
|
200
208
|
apiGateway,
|
|
201
209
|
websocket,
|
|
202
210
|
cloudfront,
|
|
@@ -210,6 +218,7 @@ const createApiPulumiApp = ()=>{
|
|
|
210
218
|
app.addServiceManifest({
|
|
211
219
|
name: "api",
|
|
212
220
|
manifest: {
|
|
221
|
+
url: getDistributionUrl(baseApp.resources.cloudfront),
|
|
213
222
|
bgTaskSfn: baseApp.resources.backgroundTask.stepFunction.output.arn,
|
|
214
223
|
cloudfront: {
|
|
215
224
|
distributionId: baseApp.resources.cloudfront.output.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/api/createApiPulumiApp.js","sources":["../../../../src/pulumi/apps/api/createApiPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType, type PulumiApp } from \"@webiny/pulumi\";\nimport {\n ApiBackgroundTask,\n ApiCloudfront,\n ApiFileManager,\n ApiGateway,\n ApiGraphql,\n ApiWebsocket,\n CoreOutput,\n VpcConfig\n} from \"~/pulumi/apps/index.js\";\nimport {\n addDomainsUrlsOutputs,\n withCommonLambdaEnvVariables,\n withServiceManifest\n} from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n// import { attachSyncSystem } from \"../syncSystem/api/index.js\";\nimport { applyAwsResourceTags, getAwsAccountId } from \"~/pulumi/apps/awsUtils.js\";\nimport type { WithServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport { ApiScheduler } from \"~/pulumi/apps/api/ApiScheduler.js\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { handleGuardDutyEvents } from \"./handleGuardDutyEvents.js\";\nimport { ApiPulumi, SetApiCustomDomains } from \"~/abstractions/features/pulumi/index.js\";\nimport { apiPulumi } from \"~/pulumi/features/ApiPulumi/index.js\";\nimport { DefaultSetApiCustomDomains } from \"~/pulumi/features/DefaultSetApiCustomDomains.js\";\nimport { ApiCustomDomains as apiCustomDomainsExt } from \"~/pulumi/extensions/ApiCustomDomains.js\";\nimport { applyCustomDomain } from \"~/pulumi/apps/customDomain.js\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport const createApiPulumiApp = () => {\n const baseApp = createPulumiApp({\n name: \"api\",\n path: \"apps/api\",\n program: async (app: PulumiApp & WithServiceManifest) => {\n const sdk = await getAwsProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const openSearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n let searchEngineParams: typeof openSearchExtensionConfig | null = null;\n\n if (openSearchExtensionConfig) {\n searchEngineParams = openSearchExtensionConfig;\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\n\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const featureFlags = await sdk.getFeatureFlags();\n\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n if (featureFlags.isFileManagerThreatDetectionEnabled()) {\n handleGuardDutyEvents(app as ApiPulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (usingAdvancedVpcParams) {\n const { onResource, addResource } = app;\n const { useExistingVpc } = vpcExtensionsConfig;\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 const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(\n useExistingVpc!.lambdaFunctionsVpcConfig\n );\n }\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy\n .AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n }\n });\n // <-------------------- Enterprise end -------------------->\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(apiPulumi);\n\n // Make the `SetApiCustomDomains` service injectable into user-defined `ApiPulumi`\n // implementations. This allows applying custom domains using dynamically created\n // Pulumi resources (e.g. ACM certificates), from within a single implementation file.\n // We register an instance (bound to the current `app`) so that user implementations\n // only need to pass the custom domain params - not the `app` itself.\n sdk.getContainer().registerInstance(\n SetApiCustomDomains,\n new DefaultSetApiCustomDomains(app as ApiPulumiApp)\n );\n\n const pulumiHandlers = sdk.getContainer().resolve(ApiPulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as ApiPulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n\n // Register core output as a module available to all the other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n const vpcEnabled =\n vpcExtensionsConfig === true ||\n typeof vpcExtensionsConfig === \"object\" ||\n isProduction;\n\n app.addModule(VpcConfig, { enabled: vpcEnabled });\n\n const graphql = app.addModule(ApiGraphql, {\n env: {\n COGNITO_REGION: getEnvVariableAwsRegion(),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,\n DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,\n OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,\n OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,\n OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME,\n OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD,\n\n S3_BUCKET: core.fileManagerBucketId,\n EVENT_BUS: core.eventBusArn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"]\n }\n });\n\n const websocket = app.addModule(ApiWebsocket);\n\n const fileManager = app.addModule(ApiFileManager, {\n env: {\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName\n }\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"private-any\": {\n path: \"/private/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-get\": {\n path: \"/wb/redirects\",\n method: \"GET\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-options\": {\n path: \"/wb/redirects\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-catch-all\": {\n path: \"/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n const backgroundTask = app.addModule(ApiBackgroundTask);\n const scheduler = app.addModule(ApiScheduler);\n\n const [apiCustomDomains] = projectConfig.extensionsByType(apiCustomDomainsExt);\n if (apiCustomDomains) {\n const { domains, sslMethod, certificateArn } = apiCustomDomains.params;\n applyCustomDomain(cloudfront, {\n domains,\n sslSupportMethod: sslMethod,\n acmCertificateArn: certificateArn\n });\n }\n\n app.addOutputs({\n awsAccountId: getAwsAccountId(app),\n region: aws.config.region,\n cognitoUserPoolId: core.cognitoUserPoolId,\n cognitoAppClientId: core.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,\n dynamoDbTable: core.primaryDynamodbTableName,\n auditLogsDynamoDbTable: core.auditLogsDynamodbTableName,\n graphqlLambdaName: graphql.functions.graphql.output.name,\n graphqlLambdaRole: graphql.role.output.arn,\n graphqlLambdaRoleName: graphql.role.output.name,\n backgroundTaskLambdaArn: backgroundTask.backgroundTask.output.arn,\n backgroundTaskStepFunctionArn: backgroundTask.stepFunction.output.arn,\n fileManagerDownloadLambdaArn: fileManager.functions.download.output.arn,\n websocketApiId: websocket.websocketApi.output.id,\n websocketApiUrl: websocket.websocketApiUrl,\n schedulerLambdaInvokeRole: scheduler.invokeRole.output.arn\n });\n\n // Only add `dynamoDbOpensearchTable` output if using search engine (ES/OS).\n if (searchEngineParams) {\n app.addOutputs({\n dynamoDbOpensearchTable: core.opensearchDynamodbTableName\n });\n }\n\n app.addHandler(() => {\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: cloudfront,\n map: {\n distributionDomain: \"cloudfrontApiDomain\",\n distributionUrl: \"cloudfrontApiUrl\",\n usedDomain: \"apiDomain\",\n usedUrl: \"apiUrl\"\n }\n });\n });\n // /**\n // * We need to attach the Sync System if it exists.\n // */\n // await attachSyncSystem({\n // app,\n // core,\n // env: app.params.run.env\n // });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"api\");\n\n return {\n fileManager,\n graphql,\n apiGateway,\n websocket,\n cloudfront,\n backgroundTask,\n scheduler\n };\n }\n });\n\n const app = withServiceManifest(withCommonLambdaEnvVariables(baseApp));\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"api\",\n manifest: {\n bgTaskSfn: baseApp.resources.backgroundTask.stepFunction.output.arn,\n cloudfront: {\n distributionId: baseApp.resources.cloudfront.output.id,\n domain: baseApp.resources.cloudfront.output.domainName.apply(\n v => `https://${v}`\n )\n }\n }\n });\n\n app.addServiceManifest({\n name: \"scheduler\",\n manifest: {\n lambdaArn: baseApp.resources.graphql.functions.graphql.output.arn,\n roleArn: baseApp.resources.scheduler.invokeRole.output.arn\n }\n });\n });\n\n return app;\n};\n"],"names":["createApiPulumiApp","baseApp","createPulumiApp","app","sdk","getAwsProjectSdk","projectConfig","pulumiResourceNamePrefix","vpcExtensionsConfig","getVpcConfigFromExtension","openSearchExtensionConfig","getOsConfigFromExtension","searchEngineParams","params","process","resource","featureFlags","usingAdvancedVpcParams","handleGuardDutyEvents","onResource","addResource","useExistingVpc","Error","isResourceOfType","aws","canUseVpc","apiPulumi","SetApiCustomDomains","DefaultSetApiCustomDomains","pulumiHandlers","ApiPulumi","isProduction","core","CoreOutput","vpcEnabled","VpcConfig","graphql","ApiGraphql","getEnvVariableAwsRegion","websocket","ApiWebsocket","fileManager","ApiFileManager","apiGateway","ApiGateway","cloudfront","ApiCloudfront","backgroundTask","ApiBackgroundTask","scheduler","ApiScheduler","apiCustomDomains","apiCustomDomainsExt","domains","sslMethod","certificateArn","applyCustomDomain","getAwsAccountId","addDomainsUrlsOutputs","applyAwsResourceTags","withServiceManifest","withCommonLambdaEnvVariables","v"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,qBAAqB;IAC9B,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAOC;YACZ,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MA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EA,OAAOE;AACX"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/api/createApiPulumiApp.js","sources":["../../../../src/pulumi/apps/api/createApiPulumiApp.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { createPulumiApp, isResourceOfType, type PulumiApp } from \"@webiny/pulumi\";\nimport {\n ApiBackgroundTask,\n ApiCloudfront,\n ApiFileManager,\n ApiGateway,\n ApiGraphql,\n ApiGraphqlStream,\n ApiWebsocket,\n CoreOutput,\n VpcConfig\n} from \"~/pulumi/apps/index.js\";\nimport {\n addDomainsUrlsOutputs,\n getDistributionUrl,\n withCommonLambdaEnvVariables,\n withServiceManifest\n} from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableAwsRegion } from \"~/pulumi/env/awsRegion.js\";\n// import { attachSyncSystem } from \"../syncSystem/api/index.js\";\nimport { applyAwsResourceTags, getAwsAccountId } from \"~/pulumi/apps/awsUtils.js\";\nimport type { WithServiceManifest } from \"~/pulumi/utils/withServiceManifest.js\";\nimport { ApiScheduler } from \"~/pulumi/apps/api/ApiScheduler.js\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { getVpcConfigFromExtension } from \"~/pulumi/apps/extensions/getVpcConfigFromExtension.js\";\nimport { isVpcEnabled } from \"~/pulumi/apps/extensions/isVpcEnabled.js\";\nimport { getOsConfigFromExtension } from \"~/pulumi/apps/extensions/getOsConfigFromExtension.js\";\nimport { handleGuardDutyEvents } from \"./handleGuardDutyEvents.js\";\nimport {\n ApiPulumi,\n SetApiCustomDomains\n} from \"@webiny/project-extensions-aws/abstractions/features/pulumi/index.js\";\nimport { apiPulumi } from \"~/pulumi/features/ApiPulumi/index.js\";\nimport { DefaultSetApiCustomDomains } from \"~/pulumi/features/DefaultSetApiCustomDomains.js\";\nimport { ApiCustomDomains as apiCustomDomainsExt } from \"@webiny/project-extensions-aws/extensions/ApiCustomDomains.js\";\nimport { applyCustomDomain } from \"~/pulumi/apps/customDomain.js\";\n\nexport type ApiPulumiApp = ReturnType<typeof createApiPulumiApp>;\n\nexport const createApiPulumiApp = () => {\n const baseApp = createPulumiApp({\n name: \"api\",\n path: \"apps/api\",\n program: async (app: PulumiApp & WithServiceManifest) => {\n const sdk = await getAwsProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const pulumiResourceNamePrefix = await sdk.getPulumiResourceNamePrefix();\n const vpcExtensionsConfig = getVpcConfigFromExtension(projectConfig);\n const openSearchExtensionConfig = getOsConfigFromExtension(projectConfig);\n\n let searchEngineParams: typeof openSearchExtensionConfig | null = null;\n\n if (openSearchExtensionConfig) {\n searchEngineParams = openSearchExtensionConfig;\n }\n\n if (searchEngineParams) {\n const params = searchEngineParams;\n if (typeof params === \"object\") {\n if (params.endpoint) {\n process.env.OPENSEARCH_ENDPOINT = params.endpoint;\n }\n\n if (params.domainName) {\n process.env.AWS_OS_DOMAIN_NAME = params.domainName;\n }\n\n if (params.indexPrefix) {\n process.env.OPENSEARCH_INDEX_PREFIX = params.indexPrefix;\n }\n\n if (params.sharedIndexes) {\n process.env.OPENSEARCH_SHARED_INDEXES = \"true\";\n }\n\n if (params.username) {\n process.env.OPENSEARCH_USERNAME = params.username;\n }\n\n if (params.password) {\n process.env.OPENSEARCH_PASSWORD = params.password;\n }\n }\n }\n\n if (pulumiResourceNamePrefix) {\n app.onResource(resource => {\n if (!resource.name.startsWith(pulumiResourceNamePrefix)) {\n resource.name = `${pulumiResourceNamePrefix}${resource.name}`;\n }\n });\n }\n\n // <-------------------- Enterprise start -------------------->\n app.addHandler(async () => {\n const featureFlags = await sdk.getFeatureFlags();\n\n const usingAdvancedVpcParams =\n vpcExtensionsConfig && typeof vpcExtensionsConfig !== \"boolean\";\n\n if (featureFlags.isEnabled(\"fileManager.threatDetection\")) {\n handleGuardDutyEvents(app as ApiPulumiApp);\n }\n\n // Not using advanced VPC params? Then immediately exit.\n if (usingAdvancedVpcParams) {\n const { onResource, addResource } = app;\n const { useExistingVpc } = vpcExtensionsConfig;\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 const canUseVpc = resource.meta.canUseVpc !== false;\n if (canUseVpc) {\n resource.config.vpcConfig(\n useExistingVpc!.lambdaFunctionsVpcConfig\n );\n }\n }\n\n if (isResourceOfType(resource, aws.iam.Role)) {\n if (resource.meta.isLambdaFunctionRole) {\n addResource(aws.iam.RolePolicyAttachment, {\n name: `${resource.name}-vpc-access-execution-role`,\n config: {\n role: resource.output.name,\n policyArn:\n aws.iam.ManagedPolicy\n .AWSLambdaVPCAccessExecutionRole\n }\n });\n }\n }\n });\n }\n }\n });\n // <-------------------- Enterprise end -------------------->\n\n // Overrides must be applied via a handler, registered at the very start of the program.\n // By doing this, we're ensuring user's adjustments are not applied to late.\n sdk.getContainer().registerComposite(apiPulumi);\n\n // Make the `SetApiCustomDomains` service injectable into user-defined `ApiPulumi`\n // implementations. This allows applying custom domains using dynamically created\n // Pulumi resources (e.g. ACM certificates), from within a single implementation file.\n // We register an instance (bound to the current `app`) so that user implementations\n // only need to pass the custom domain params - not the `app` itself.\n sdk.getContainer().registerInstance(\n SetApiCustomDomains,\n new DefaultSetApiCustomDomains(app as ApiPulumiApp)\n );\n\n const pulumiHandlers = sdk.getContainer().resolve(ApiPulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as ApiPulumiApp);\n });\n\n const isProduction = app.env.isProduction;\n\n // Register core output as a module available to all the other modules\n const core = app.addModule(CoreOutput);\n\n // Register VPC config module to be available to other modules.\n app.addModule(VpcConfig, {\n enabled: isVpcEnabled(vpcExtensionsConfig, isProduction)\n });\n\n // Shared by the buffered `graphql` function and its response-streaming twin: both run the\n // same code bundle, so they must see the same environment.\n const graphqlEnv = {\n COGNITO_REGION: getEnvVariableAwsRegion(),\n COGNITO_USER_POOL_ID: core.cognitoUserPoolId,\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName,\n DB_TABLE_OPENSEARCH: core.opensearchDynamodbTableName,\n OPENSEARCH_ENDPOINT: core.opensearchDomainEndpoint,\n\n // Not required. Useful for testing purposes / ephemeral environments.\n // https://www.webiny.com/docs/key-topics/ci-cd/testing/slow-ephemeral-environments\n OPENSEARCH_INDEX_PREFIX: process.env.OPENSEARCH_INDEX_PREFIX,\n OPENSEARCH_SHARED_INDEXES: process.env.OPENSEARCH_SHARED_INDEXES,\n OPENSEARCH_USERNAME: process.env.OPENSEARCH_USERNAME,\n OPENSEARCH_PASSWORD: process.env.OPENSEARCH_PASSWORD,\n\n S3_BUCKET: core.fileManagerBucketId,\n EVENT_BUS: core.eventBusArn,\n // TODO: move to okta plugin\n OKTA_ISSUER: process.env[\"OKTA_ISSUER\"]\n };\n\n const graphql = app.addModule(ApiGraphql, { env: graphqlEnv });\n\n // Second Lambda function off the same bundle, fronted by a Function URL instead of API\n // Gateway, because API Gateway buffers the whole response and cannot stream. Added before\n // ApiCloudfront, which resolves this module to wire the `/stream/*` origin and behavior.\n const graphqlStream = app.addModule(ApiGraphqlStream, { env: graphqlEnv });\n\n const websocket = app.addModule(ApiWebsocket);\n\n const fileManager = app.addModule(ApiFileManager, {\n env: {\n DB_TABLE: core.primaryDynamodbTableName,\n DB_TABLE_AUDIT_LOGS: core.auditLogsDynamodbTableName\n }\n });\n\n const apiGateway = app.addModule(ApiGateway, {\n \"graphql-post\": {\n path: \"/graphql\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"graphql-options\": {\n path: \"/graphql\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-any\": {\n path: \"/files/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"private-any\": {\n path: \"/private/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n },\n \"cms-post\": {\n path: \"/cms/{key+}\",\n method: \"POST\",\n function: graphql.functions.graphql.output.arn\n },\n \"cms-options\": {\n path: \"/cms/{key+}\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-get\": {\n path: \"/wb/redirects\",\n method: \"GET\",\n function: graphql.functions.graphql.output.arn\n },\n \"redirects-options\": {\n path: \"/wb/redirects\",\n method: \"OPTIONS\",\n function: graphql.functions.graphql.output.arn\n },\n \"files-catch-all\": {\n path: \"/{path+}\",\n method: \"ANY\",\n function: fileManager.functions.download.output.arn\n }\n });\n\n const cloudfront = app.addModule(ApiCloudfront);\n const backgroundTask = app.addModule(ApiBackgroundTask);\n const scheduler = app.addModule(ApiScheduler);\n\n const [apiCustomDomains] = projectConfig.extensionsByType(apiCustomDomainsExt);\n if (apiCustomDomains) {\n const { domains, sslMethod, certificateArn, minimumProtocolVersion } =\n apiCustomDomains.params;\n applyCustomDomain(cloudfront, {\n domains,\n sslSupportMethod: sslMethod,\n acmCertificateArn: certificateArn,\n minimumProtocolVersion\n });\n }\n\n app.addOutputs({\n awsAccountId: getAwsAccountId(app),\n region: aws.config.region,\n cognitoUserPoolId: core.cognitoUserPoolId,\n cognitoAppClientId: core.cognitoAppClientId,\n cognitoUserPoolPasswordPolicy: core.cognitoUserPoolPasswordPolicy,\n dynamoDbTable: core.primaryDynamodbTableName,\n auditLogsDynamoDbTable: core.auditLogsDynamodbTableName,\n graphqlLambdaName: graphql.functions.graphql.output.name,\n graphqlLambdaRole: graphql.role.output.arn,\n graphqlLambdaRoleName: graphql.role.output.name,\n graphqlStreamLambdaName: graphqlStream.functions.graphqlStream.output.name,\n graphqlStreamFunctionUrl: graphqlStream.functionUrl.output.functionUrl,\n backgroundTaskLambdaArn: backgroundTask.backgroundTask.output.arn,\n backgroundTaskStepFunctionArn: backgroundTask.stepFunction.output.arn,\n fileManagerDownloadLambdaArn: fileManager.functions.download.output.arn,\n websocketApiId: websocket.websocketApi.output.id,\n websocketApiUrl: websocket.websocketApiUrl,\n schedulerLambdaInvokeRole: scheduler.invokeRole.output.arn\n });\n\n // Only add `dynamoDbOpensearchTable` output if using search engine (ES/OS).\n if (searchEngineParams) {\n app.addOutputs({\n dynamoDbOpensearchTable: core.opensearchDynamodbTableName\n });\n }\n\n app.addHandler(() => {\n addDomainsUrlsOutputs({\n app,\n cloudfrontDistribution: cloudfront,\n map: {\n distributionDomain: \"cloudfrontApiDomain\",\n distributionUrl: \"cloudfrontApiUrl\",\n usedDomain: \"apiDomain\",\n usedUrl: \"apiUrl\"\n }\n });\n });\n // /**\n // * We need to attach the Sync System if it exists.\n // */\n // await attachSyncSystem({\n // app,\n // core,\n // env: app.params.run.env\n // });\n\n // Applies internal and user-defined AWS tags.\n await applyAwsResourceTags(\"api\");\n\n return {\n fileManager,\n graphql,\n graphqlStream,\n apiGateway,\n websocket,\n cloudfront,\n backgroundTask,\n scheduler\n };\n }\n });\n\n const app = withServiceManifest(withCommonLambdaEnvVariables(baseApp));\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"api\",\n manifest: {\n // Read by the API through `PublicUrls.getApiUrl()`.\n url: getDistributionUrl(baseApp.resources.cloudfront),\n bgTaskSfn: baseApp.resources.backgroundTask.stepFunction.output.arn,\n cloudfront: {\n distributionId: baseApp.resources.cloudfront.output.id,\n domain: baseApp.resources.cloudfront.output.domainName.apply(\n v => `https://${v}`\n )\n }\n }\n });\n\n app.addServiceManifest({\n name: \"scheduler\",\n manifest: {\n lambdaArn: baseApp.resources.graphql.functions.graphql.output.arn,\n roleArn: baseApp.resources.scheduler.invokeRole.output.arn\n }\n });\n });\n\n return app;\n};\n"],"names":["createApiPulumiApp","baseApp","createPulumiApp","app","sdk","getAwsProjectSdk","projectConfig","pulumiResourceNamePrefix","vpcExtensionsConfig","getVpcConfigFromExtension","openSearchExtensionConfig","getOsConfigFromExtension","searchEngineParams","params","process","resource","featureFlags","usingAdvancedVpcParams","handleGuardDutyEvents","onResource","addResource","useExistingVpc","Error","isResourceOfType","aws","canUseVpc","apiPulumi","SetApiCustomDomains","DefaultSetApiCustomDomains","pulumiHandlers","ApiPulumi","isProduction","core","CoreOutput","VpcConfig","isVpcEnabled","graphqlEnv","getEnvVariableAwsRegion","graphql","ApiGraphql","graphqlStream","ApiGraphqlStream","websocket","ApiWebsocket","fileManager","ApiFileManager","apiGateway","ApiGateway","cloudfront","ApiCloudfront","backgroundTask","ApiBackgroundTask","scheduler","ApiScheduler","apiCustomDomains","apiCustomDomainsExt","domains","sslMethod","certificateArn","minimumProtocolVersion","applyCustomDomain","getAwsAccountId","addDomainsUrlsOutputs","applyAwsResourceTags","withServiceManifest","withCommonLambdaEnvVariables","getDistributionUrl","v"],"mappings":";;;;;;;;;;;;;;;;;AAwCO,MAAMA,qBAAqB;IAC9B,MAAMC,UAAUC,gBAAgB;QAC5B,MAAM;QACN,MAAM;QACN,SAAS,OAAOC;YACZ,MAAMC,MAAM,MAAMC;YAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;YAEhD,MAAMG,2BAA2B,MAAMH,IAAI,2BAA2B;YACtE,MAAMI,sBAAsBC,0BAA0BH;YACtD,MAAMI,4BAA4BC,yBAAyBL;YAE3D,IAAIM,qBAA8D;YAElE,IAAIF,2BACAE,qBAAqBF;YAGzB,IAAIE,oBAAoB;gBACpB,MAAMC,SAASD;gBACf,IAAI,AAAkB,YAAlB,OAAOC,QAAqB;oBAC5B,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,UAAU,EACjBC,QAAQ,GAAG,CAAC,kBAAkB,GAAGD,OAAO,UAAU;oBAGtD,IAAIA,OAAO,WAAW,EAClBC,QAAQ,GAAG,CAAC,uBAAuB,GAAGD,OAAO,WAAW;oBAG5D,IAAIA,OAAO,aAAa,EACpBC,QAAQ,GAAG,CAAC,yBAAyB,GAAG;oBA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B3D;oBACA,wBAAwB6C;oBACxB,KAAK;wBACD,oBAAoB;wBACpB,iBAAiB;wBACjB,YAAY;wBACZ,SAAS;oBACb;gBACJ;YACJ;YAWA,MAAMe,qBAAqB;YAE3B,OAAO;gBACHnB;gBACAN;gBACAE;gBACAM;gBACAJ;gBACAM;gBACAE;gBACAE;YACJ;QACJ;IACJ;IAEA,MAAMjD,MAAM6D,oBAAoBC,6BAA6BhE;IAE7DE,IAAI,UAAU,CAAC;QACXA,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBAEN,KAAK+D,mBAAmBjE,QAAQ,SAAS,CAAC,UAAU;gBACpD,WAAWA,QAAQ,SAAS,CAAC,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG;gBACnE,YAAY;oBACR,gBAAgBA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBACtD,QAAQA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CACxDkE,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAE3B;YACJ;QACJ;QAEAhE,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,WAAWF,QAAQ,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;gBACjE,SAASA,QAAQ,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG;YAC9D;QACJ;IACJ;IAEA,OAAOE;AACX"}
|
|
@@ -3,6 +3,7 @@ export * from "./ApiCloudfront.js";
|
|
|
3
3
|
export * from "./ApiFileManager.js";
|
|
4
4
|
export * from "./ApiGateway.js";
|
|
5
5
|
export * from "./ApiGraphql.js";
|
|
6
|
+
export * from "./ApiGraphqlStream.js";
|
|
6
7
|
export * from "./createApiPulumiApp.js";
|
|
7
8
|
export * from "./ApiOutput.js";
|
|
8
9
|
export * from "./ApiWebsocket.js";
|
package/pulumi/apps/api/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./ApiCloudfront.js";
|
|
|
3
3
|
export * from "./ApiFileManager.js";
|
|
4
4
|
export * from "./ApiGateway.js";
|
|
5
5
|
export * from "./ApiGraphql.js";
|
|
6
|
+
export * from "./ApiGraphqlStream.js";
|
|
6
7
|
export * from "./createApiPulumiApp.js";
|
|
7
8
|
export * from "./ApiOutput.js";
|
|
8
9
|
export * from "./ApiWebsocket.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PulumiApp } from "@webiny/pulumi";
|
|
2
2
|
import { type AppName } from "@webiny/project";
|
|
3
3
|
export declare function getAwsAccountId(app: PulumiApp): import("@pulumi/pulumi").Output<string>;
|
|
4
|
-
export declare function getAwsRegion(app: PulumiApp): import("@pulumi/pulumi").Output<"af-south-1" | "ap-east-1" | "ap-east-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-southeast-5" | "ap-southeast-7" | "ca-central-1" | "ca-west-1" | "cn-north-1" | "cn-northwest-1" | "eu-central-1" | "eu-central-2" | "eu-isoe-west-1" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "il-central-1" | "me-central-1" | "me-south-1" | "mx-central-1" | "sa-east-1" | "us-east-1" | "us-east-2" | "us-gov-east-1" | "us-gov-west-1" | "us-iso-east-1" | "us-iso-west-1" | "us-isob-east-1" | "us-west-1" | "us-west-2">;
|
|
4
|
+
export declare function getAwsRegion(app: PulumiApp): import("@pulumi/pulumi").Output<"af-south-1" | "ap-east-1" | "ap-east-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ap-south-1" | "ap-south-2" | "ap-southeast-1" | "ap-southeast-2" | "ap-southeast-3" | "ap-southeast-4" | "ap-southeast-5" | "ap-southeast-6" | "ap-southeast-7" | "ca-central-1" | "ca-west-1" | "cn-north-1" | "cn-northwest-1" | "eu-central-1" | "eu-central-2" | "eu-isoe-west-1" | "eu-north-1" | "eu-south-1" | "eu-south-2" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eusc-de-east-1" | "il-central-1" | "me-central-1" | "me-south-1" | "mx-central-1" | "sa-east-1" | "us-east-1" | "us-east-2" | "us-gov-east-1" | "us-gov-west-1" | "us-iso-east-1" | "us-iso-west-1" | "us-isob-east-1" | "us-isob-west-1" | "us-isof-east-1" | "us-isof-south-1" | "us-west-1" | "us-west-2">;
|
|
5
5
|
export declare function applyAwsResourceTags(appName: AppName): Promise<void>;
|
package/pulumi/apps/awsUtils.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getEnvVariableWebinyProjectName } from "../env/projectName.js";
|
|
|
3
3
|
import { getEnvVariableWebinyEnv } from "../env/env.js";
|
|
4
4
|
import { getEnvVariableWebinyVariant } from "../env/variant.js";
|
|
5
5
|
import { getAwsProjectSdk } from "../getAwsProjectSdk.js";
|
|
6
|
-
import { AwsTags } from "
|
|
6
|
+
import { AwsTags } from "@webiny/project-extensions-aws/extensions/AwsTags.js";
|
|
7
7
|
import * as __rspack_external__pulumi_aws_9e2bee2d from "@pulumi/aws";
|
|
8
8
|
function getAwsAccountId(app) {
|
|
9
9
|
return app.addHandler(()=>__rspack_external__pulumi_aws_9e2bee2d.getCallerIdentity({}).then((x)=>x.accountId));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/awsUtils.js","sources":["../../../src/pulumi/apps/awsUtils.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { type PulumiApp } from \"@webiny/pulumi\";\nimport { tagResources } from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableWebinyProjectName } from \"~/pulumi/env/projectName.js\";\nimport { getEnvVariableWebinyEnv } from \"~/pulumi/env/env.js\";\nimport { getEnvVariableWebinyVariant } from \"~/pulumi/env/variant.js\";\nimport { type AppName } from \"@webiny/project\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { AwsTags as awsTagsExt } from \"
|
|
1
|
+
{"version":3,"file":"pulumi/apps/awsUtils.js","sources":["../../../src/pulumi/apps/awsUtils.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport { type PulumiApp } from \"@webiny/pulumi\";\nimport { tagResources } from \"~/pulumi/utils/index.js\";\nimport { getEnvVariableWebinyProjectName } from \"~/pulumi/env/projectName.js\";\nimport { getEnvVariableWebinyEnv } from \"~/pulumi/env/env.js\";\nimport { getEnvVariableWebinyVariant } from \"~/pulumi/env/variant.js\";\nimport { type AppName } from \"@webiny/project\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport { AwsTags as awsTagsExt } from \"@webiny/project-extensions-aws/extensions/AwsTags.js\";\n\nexport function getAwsAccountId(app: PulumiApp) {\n return app.addHandler(() => {\n return aws.getCallerIdentity({}).then(x => x.accountId);\n });\n}\n\nexport function getAwsRegion(app: PulumiApp) {\n return app.addHandler(() => {\n return aws.config.requireRegion();\n });\n}\n\nexport async function applyAwsResourceTags(appName: AppName) {\n const sdk = await getAwsProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n\n const awsTagsFromExtensions: Record<string, string> = {};\n projectConfig.extensionsByType(awsTagsExt).forEach(ext => {\n Object.assign(awsTagsFromExtensions, ext.params.tags);\n });\n\n tagResources({\n ...awsTagsFromExtensions,\n WbyApp: appName,\n WbyProjectName: getEnvVariableWebinyProjectName(),\n WbyEnvironment: getEnvVariableWebinyEnv(),\n WbyEnvironmentVariant: getEnvVariableWebinyVariant()\n });\n}\n"],"names":["getAwsAccountId","app","aws","x","getAwsRegion","applyAwsResourceTags","appName","sdk","getAwsProjectSdk","projectConfig","awsTagsFromExtensions","awsTagsExt","ext","Object","tagResources","getEnvVariableWebinyProjectName","getEnvVariableWebinyEnv","getEnvVariableWebinyVariant"],"mappings":";;;;;;;AAUO,SAASA,gBAAgBC,GAAc;IAC1C,OAAOA,IAAI,UAAU,CAAC,IACXC,uCAAAA,iBAAqB,CAAC,CAAC,GAAG,IAAI,CAACC,CAAAA,IAAKA,EAAE,SAAS;AAE9D;AAEO,SAASC,aAAaH,GAAc;IACvC,OAAOA,IAAI,UAAU,CAAC,IACXC,uCAAAA,MAAAA,CAAAA,aAAwB;AAEvC;AAEO,eAAeG,qBAAqBC,OAAgB;IACvD,MAAMC,MAAM,MAAMC;IAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;IAEhD,MAAMG,wBAAgD,CAAC;IACvDD,cAAc,gBAAgB,CAACE,SAAY,OAAO,CAACC,CAAAA;QAC/CC,OAAO,MAAM,CAACH,uBAAuBE,IAAI,MAAM,CAAC,IAAI;IACxD;IAEAE,aAAa;QACT,GAAGJ,qBAAqB;QACxB,QAAQJ;QACR,gBAAgBS;QAChB,gBAAgBC;QAChB,uBAAuBC;IAC3B;AACJ"}
|
|
@@ -6,7 +6,7 @@ const resolveDomains = (params)=>{
|
|
|
6
6
|
return types.reduce((output, type)=>{
|
|
7
7
|
const value = domains[type];
|
|
8
8
|
if (!value) return output;
|
|
9
|
-
if (0 === value.length) throw new Error(`Missing domains for "${type}" deployment.`);
|
|
9
|
+
else if (0 === value.length) throw new Error(`Missing domains for "${type}" deployment.`);
|
|
10
10
|
for (const domain of deploymentsDomains){
|
|
11
11
|
const target = domain.domains[type];
|
|
12
12
|
if (!target) throw new Error(`Missing "${type}" domain in deployment "${domain.name}".`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/blueGreen/domains/resolveDomains.js","sources":["../../../../../src/pulumi/apps/blueGreen/domains/resolveDomains.ts"],"sourcesContent":["import type {\n IAttachedDomainKey,\n IAttachedDomains,\n IDeploymentsDomains,\n IResolvedDomains\n} from \"../types.js\";\n\nexport interface IResolveDomainsParams {\n attachedDomains: IAttachedDomains;\n deploymentsDomains: IDeploymentsDomains;\n}\n\nexport const resolveDomains = (params: IResolveDomainsParams): IResolvedDomains => {\n const { attachedDomains, deploymentsDomains } = params;\n\n const domains = attachedDomains.domains;\n\n if (!domains) {\n return [];\n }\n const types = Object.keys(domains).filter(key => {\n return !!domains[key as IAttachedDomainKey];\n }) as IAttachedDomainKey[];\n\n return types.reduce<IResolvedDomains>((output, type) => {\n const value = domains[type];\n /**\n * Should not happen because we are filtering out undefined values when creating the `types` array.\n */\n if (!value) {\n return output;\n } else if (value.length === 0) {\n throw new Error(`Missing domains for \"${type}\" deployment.`);\n }\n for (const domain of deploymentsDomains) {\n const target = domain.domains[type];\n if (!target) {\n throw new Error(`Missing \"${type}\" domain in deployment \"${domain.name}\".`);\n }\n\n output.push({\n type,\n env: domain.env,\n variant: domain.variant,\n name: domain.name,\n sources: value,\n target\n });\n }\n\n return output;\n }, []);\n};\n"],"names":["resolveDomains","params","attachedDomains","deploymentsDomains","domains","types","Object","key","output","type","value","Error","domain","target"],"mappings":"AAYO,MAAMA,iBAAiB,CAACC;IAC3B,MAAM,EAAEC,eAAe,EAAEC,kBAAkB,EAAE,GAAGF;IAEhD,MAAMG,UAAUF,gBAAgB,OAAO;IAEvC,IAAI,CAACE,SACD,OAAO,EAAE;IAEb,MAAMC,QAAQC,OAAO,IAAI,CAACF,SAAS,MAAM,CAACG,CAAAA,MAC/B,CAAC,CAACH,OAAO,CAACG,IAA0B;IAG/C,OAAOF,MAAM,MAAM,CAAmB,CAACG,QAAQC;QAC3C,MAAMC,QAAQN,OAAO,CAACK,KAAK;QAI3B,IAAI,CAACC,OACD,OAAOF;
|
|
1
|
+
{"version":3,"file":"pulumi/apps/blueGreen/domains/resolveDomains.js","sources":["../../../../../src/pulumi/apps/blueGreen/domains/resolveDomains.ts"],"sourcesContent":["import type {\n IAttachedDomainKey,\n IAttachedDomains,\n IDeploymentsDomains,\n IResolvedDomains\n} from \"../types.js\";\n\nexport interface IResolveDomainsParams {\n attachedDomains: IAttachedDomains;\n deploymentsDomains: IDeploymentsDomains;\n}\n\nexport const resolveDomains = (params: IResolveDomainsParams): IResolvedDomains => {\n const { attachedDomains, deploymentsDomains } = params;\n\n const domains = attachedDomains.domains;\n\n if (!domains) {\n return [];\n }\n const types = Object.keys(domains).filter(key => {\n return !!domains[key as IAttachedDomainKey];\n }) as IAttachedDomainKey[];\n\n return types.reduce<IResolvedDomains>((output, type) => {\n const value = domains[type];\n /**\n * Should not happen because we are filtering out undefined values when creating the `types` array.\n */\n if (!value) {\n return output;\n } else if (value.length === 0) {\n throw new Error(`Missing domains for \"${type}\" deployment.`);\n }\n for (const domain of deploymentsDomains) {\n const target = domain.domains[type];\n if (!target) {\n throw new Error(`Missing \"${type}\" domain in deployment \"${domain.name}\".`);\n }\n\n output.push({\n type,\n env: domain.env,\n variant: domain.variant,\n name: domain.name,\n sources: value,\n target\n });\n }\n\n return output;\n }, []);\n};\n"],"names":["resolveDomains","params","attachedDomains","deploymentsDomains","domains","types","Object","key","output","type","value","Error","domain","target"],"mappings":"AAYO,MAAMA,iBAAiB,CAACC;IAC3B,MAAM,EAAEC,eAAe,EAAEC,kBAAkB,EAAE,GAAGF;IAEhD,MAAMG,UAAUF,gBAAgB,OAAO;IAEvC,IAAI,CAACE,SACD,OAAO,EAAE;IAEb,MAAMC,QAAQC,OAAO,IAAI,CAACF,SAAS,MAAM,CAACG,CAAAA,MAC/B,CAAC,CAACH,OAAO,CAACG,IAA0B;IAG/C,OAAOF,MAAM,MAAM,CAAmB,CAACG,QAAQC;QAC3C,MAAMC,QAAQN,OAAO,CAACK,KAAK;QAI3B,IAAI,CAACC,OACD,OAAOF;aACJ,IAAIE,AAAiB,MAAjBA,MAAM,MAAM,EACnB,MAAM,IAAIC,MAAM,CAAC,qBAAqB,EAAEF,KAAK,aAAa,CAAC;QAE/D,KAAK,MAAMG,UAAUT,mBAAoB;YACrC,MAAMU,SAASD,OAAO,OAAO,CAACH,KAAK;YACnC,IAAI,CAACI,QACD,MAAM,IAAIF,MAAM,CAAC,SAAS,EAAEF,KAAK,wBAAwB,EAAEG,OAAO,IAAI,CAAC,EAAE,CAAC;YAG9EJ,OAAO,IAAI,CAAC;gBACRC;gBACA,KAAKG,OAAO,GAAG;gBACf,SAASA,OAAO,OAAO;gBACvB,MAAMA,OAAO,IAAI;gBACjB,SAASF;gBACTG;YACJ;QACJ;QAEA,OAAOL;IACX,GAAG,EAAE;AACT"}
|
|
@@ -69,9 +69,6 @@ export type IResolvedDomains = IResolvedDomain[];
|
|
|
69
69
|
export interface IBlueGreenStackOutput extends IStackOutput {
|
|
70
70
|
distributionDomain: string;
|
|
71
71
|
distributionUrl: string;
|
|
72
|
-
/**
|
|
73
|
-
* TODO fix later
|
|
74
|
-
*/
|
|
75
72
|
environments?: IResolvedDomains;
|
|
76
73
|
domains?: string[];
|
|
77
74
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type PulumiAppModule } from "@webiny/pulumi";
|
|
2
|
+
import type { ApiStackOutputService } from "@webiny/project-extensions-aws/abstractions/services/ApiStackOutputService.js";
|
|
2
3
|
export type CoreOutput = PulumiAppModule<typeof CoreOutput>;
|
|
3
4
|
export interface ICoreOutput {
|
|
4
5
|
deploymentId: string;
|
|
@@ -8,7 +9,7 @@ export interface ICoreOutput {
|
|
|
8
9
|
cognitoUserPoolArn: string;
|
|
9
10
|
cognitoAppClientId: string;
|
|
10
11
|
cognitoUserPoolId: string;
|
|
11
|
-
cognitoUserPoolPasswordPolicy:
|
|
12
|
+
cognitoUserPoolPasswordPolicy: ApiStackOutputService.PasswordPolicy;
|
|
12
13
|
fileManagerBucketId: string;
|
|
13
14
|
fileManagerBucketArn: string;
|
|
14
15
|
primaryDynamodbTableArn: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/common/CoreOutput.js","sources":["../../../../src/pulumi/apps/common/CoreOutput.ts"],"sourcesContent":["import { createAppModule, type PulumiAppModule } from \"@webiny/pulumi\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\n\nexport type CoreOutput = PulumiAppModule<typeof CoreOutput>;\n\nexport interface ICoreOutput {\n deploymentId: string;\n region: string;\n dynamoDbTable: string;\n iotAuthorizerName: string;\n cognitoUserPoolArn: string;\n cognitoAppClientId: string;\n cognitoUserPoolId: string;\n cognitoUserPoolPasswordPolicy:
|
|
1
|
+
{"version":3,"file":"pulumi/apps/common/CoreOutput.js","sources":["../../../../src/pulumi/apps/common/CoreOutput.ts"],"sourcesContent":["import { createAppModule, type PulumiAppModule } from \"@webiny/pulumi\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport type { ApiStackOutputService } from \"@webiny/project-extensions-aws/abstractions/services/ApiStackOutputService.js\";\n\nexport type CoreOutput = PulumiAppModule<typeof CoreOutput>;\n\nexport interface ICoreOutput {\n deploymentId: string;\n region: string;\n dynamoDbTable: string;\n iotAuthorizerName: string;\n cognitoUserPoolArn: string;\n cognitoAppClientId: string;\n cognitoUserPoolId: string;\n cognitoUserPoolPasswordPolicy: ApiStackOutputService.PasswordPolicy;\n fileManagerBucketId: string;\n fileManagerBucketArn: string;\n primaryDynamodbTableArn: string;\n primaryDynamodbTableName: string;\n primaryDynamodbTableHashKey: string;\n primaryDynamodbTableRangeKey: string;\n auditLogsDynamodbTableArn: string;\n auditLogsDynamodbTableName: string;\n auditLogsDynamodbTableHashKey: string;\n auditLogsDynamodbTableRangeKey: string;\n eventBusName: string;\n eventBusArn: string;\n vpcPublicSubnetIds: string[] | undefined;\n vpcPrivateSubnetIds: string[] | undefined;\n vpcSecurityGroupIds: string[] | undefined;\n opensearchDomainArn: string | undefined;\n opensearchDomainEndpoint: string | undefined;\n opensearchDynamodbTableHashKey: string;\n opensearchDynamodbTableRangeKey: string;\n opensearchDynamodbTableArn: string | undefined;\n opensearchDynamodbTableName: string | undefined;\n}\n\nexport const CoreOutput = createAppModule({\n name: \"CoreOutput\",\n config(app) {\n return app.addHandler(async () => {\n const sdk = await getAwsProjectSdk();\n\n const output = await sdk.getAppStackOutput(\"core\");\n if (!output) {\n throw new Error(\"Core application is not deployed.\");\n }\n\n return {\n fileManagerBucketId: output[\"fileManagerBucketId\"],\n primaryDynamodbTableArn: output[\"primaryDynamodbTableArn\"],\n primaryDynamodbTableName: output[\"primaryDynamodbTableName\"],\n primaryDynamodbTableHashKey: output[\"primaryDynamodbTableHashKey\"],\n primaryDynamodbTableRangeKey: output[\"primaryDynamodbTableRangeKey\"],\n auditLogsDynamodbTableArn: output[\"auditLogsDynamodbTableArn\"],\n auditLogsDynamodbTableName: output[\"auditLogsDynamodbTableName\"],\n auditLogsDynamodbTableHashKey: output[\"auditLogsDynamodbTableHashKey\"],\n auditLogsDynamodbTableRangeKey: output[\"auditLogsDynamodbTableRangeKey\"],\n cognitoUserPoolId: output[\"cognitoUserPoolId\"],\n cognitoUserPoolArn: output[\"cognitoUserPoolArn\"],\n cognitoUserPoolPasswordPolicy: output[\"cognitoUserPoolPasswordPolicy\"],\n cognitoAppClientId: output[\"cognitoAppClientId\"],\n eventBusName: output[\"eventBusName\"],\n eventBusArn: output[\"eventBusArn\"],\n // These outputs are optional, since VPC is not always enabled.\n vpcPublicSubnetIds: output[\"vpcPublicSubnetIds\"],\n vpcPrivateSubnetIds: output[\"vpcPrivateSubnetIds\"],\n vpcSecurityGroupIds: output[\"vpcSecurityGroupIds\"],\n // These outputs are optional, since Opensearch is not always enabled.\n opensearchDomainArn: output[\"opensearchDomainArn\"],\n opensearchDomainEndpoint: output[\"opensearchDomainEndpoint\"],\n opensearchDynamodbTableArn: output[\"opensearchDynamodbTableArn\"],\n opensearchDynamodbTableName: output[\"opensearchDynamodbTableName\"]\n } as ICoreOutput;\n });\n }\n});\n"],"names":["CoreOutput","createAppModule","app","sdk","getAwsProjectSdk","output","Error"],"mappings":";;AAsCO,MAAMA,aAAaC,gBAAgB;IACtC,MAAM;IACN,QAAOC,GAAG;QACN,OAAOA,IAAI,UAAU,CAAC;YAClB,MAAMC,MAAM,MAAMC;YAElB,MAAMC,SAAS,MAAMF,IAAI,iBAAiB,CAAC;YAC3C,IAAI,CAACE,QACD,MAAM,IAAIC,MAAM;YAGpB,OAAO;gBACH,qBAAqBD,MAAM,CAAC,sBAAsB;gBAClD,yBAAyBA,MAAM,CAAC,0BAA0B;gBAC1D,0BAA0BA,MAAM,CAAC,2BAA2B;gBAC5D,6BAA6BA,MAAM,CAAC,8BAA8B;gBAClE,8BAA8BA,MAAM,CAAC,+BAA+B;gBACpE,2BAA2BA,MAAM,CAAC,4BAA4B;gBAC9D,4BAA4BA,MAAM,CAAC,6BAA6B;gBAChE,+BAA+BA,MAAM,CAAC,gCAAgC;gBACtE,gCAAgCA,MAAM,CAAC,iCAAiC;gBACxE,mBAAmBA,MAAM,CAAC,oBAAoB;gBAC9C,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,+BAA+BA,MAAM,CAAC,gCAAgC;gBACtE,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,cAAcA,MAAM,CAAC,eAAe;gBACpC,aAAaA,MAAM,CAAC,cAAc;gBAElC,oBAAoBA,MAAM,CAAC,qBAAqB;gBAChD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAClD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAElD,qBAAqBA,MAAM,CAAC,sBAAsB;gBAClD,0BAA0BA,MAAM,CAAC,2BAA2B;gBAC5D,4BAA4BA,MAAM,CAAC,6BAA6B;gBAChE,6BAA6BA,MAAM,CAAC,8BAA8B;YACtE;QACJ;IACJ;AACJ"}
|
|
@@ -2,4 +2,5 @@ import type { PulumiAppModule } from "@webiny/pulumi";
|
|
|
2
2
|
export type CoreAuditLogsDynamo = PulumiAppModule<typeof CoreAuditLogsDynamo>;
|
|
3
3
|
export declare const CoreAuditLogsDynamo: import("@webiny/pulumi").PulumiAppModuleDefinition<import("@webiny/pulumi").PulumiAppResource<typeof import("@pulumi/aws/dynamodb/table").Table>, {
|
|
4
4
|
protect: boolean;
|
|
5
|
+
pointInTimeRecovery: boolean;
|
|
5
6
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/core/CoreAuditLogsDynamo.js","sources":["../../../../src/pulumi/apps/core/CoreAuditLogsDynamo.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport type CoreAuditLogsDynamo = PulumiAppModule<typeof CoreAuditLogsDynamo>;\n\nexport const CoreAuditLogsDynamo = createAppModule({\n name: \"AuditLogsDynamoDb\",\n config(app: PulumiApp, params: { protect: boolean }) {\n return app.addResource(aws.dynamodb.Table, {\n name: \"webiny-audit-logs\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" },\n { name: \"GSI_TENANT\", type: \"S\" },\n { name: \"GSI1_PK\", type: \"S\" },\n { name: \"GSI1_SK\", type: \"N\" },\n { name: \"GSI2_PK\", type: \"S\" },\n { name: \"GSI2_SK\", type: \"N\" },\n { name: \"GSI3_PK\", type: \"S\" },\n { name: \"GSI3_SK\", type: \"N\" },\n { name: \"GSI4_PK\", type: \"S\" },\n { name: \"GSI4_SK\", type: \"N\" },\n { name: \"GSI5_PK\", type: \"S\" },\n { name: \"GSI5_SK\", type: \"N\" },\n { name: \"GSI6_PK\", type: \"S\" },\n { name: \"GSI6_SK\", type: \"N\" },\n { name: \"GSI7_PK\", type: \"S\" },\n { name: \"GSI7_SK\", type: \"N\" },\n { name: \"GSI8_PK\", type: \"S\" },\n { name: \"GSI8_SK\", type: \"N\" },\n { name: \"GSI9_PK\", type: \"S\" },\n { name: \"GSI9_SK\", type: \"N\" }\n ],\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\",\n globalSecondaryIndexes: [\n {\n name: \"GSI_TENANT\",\n keySchemas: [\n {\n attributeName: \"GSI_TENANT\",\n keyType: \"HASH\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI1\",\n keySchemas: [\n {\n attributeName: \"GSI1_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI1_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI2\",\n keySchemas: [\n {\n attributeName: \"GSI2_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI2_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI3\",\n keySchemas: [\n {\n attributeName: \"GSI3_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI3_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI4\",\n keySchemas: [\n {\n attributeName: \"GSI4_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI4_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI5\",\n keySchemas: [\n {\n attributeName: \"GSI5_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI5_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI6\",\n keySchemas: [\n {\n attributeName: \"GSI6_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI6_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI7\",\n keySchemas: [\n {\n attributeName: \"GSI7_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI7_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI8\",\n keySchemas: [\n {\n attributeName: \"GSI8_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI8_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI9\",\n keySchemas: [\n {\n attributeName: \"GSI9_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI9_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n }\n },\n opts: {\n protect: params.protect\n }\n });\n }\n});\n"],"names":["CoreAuditLogsDynamo","createAppModule","app","params","aws"],"mappings":";;AAMO,MAAMA,sBAAsBC,gBAAgB;IAC/C,MAAM;IACN,QAAOC,GAAc,EAAEC,MAA4B;QAC/C,OAAOD,IAAI,WAAW,CAACE,uCAAAA,QAAAA,CAAAA,KAAkB,EAAE;YACvC,MAAM;YACN,QAAQ;gBACJ,YAAY;oBACR;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAc,MAAM;oBAAI;oBAChC;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;iBAChC;gBACD,aAAa;gBACb,SAAS;gBACT,UAAU;gBACV,wBAAwB;oBACpB;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;iBACH;gBACD,KAAK;oBACD,eAAe;oBACf,SAAS;gBACb;YACJ;YACA,MAAM;gBACF,SAASD,OAAO,OAAO;YAC3B;QACJ;IACJ;AACJ"}
|
|
1
|
+
{"version":3,"file":"pulumi/apps/core/CoreAuditLogsDynamo.js","sources":["../../../../src/pulumi/apps/core/CoreAuditLogsDynamo.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nexport type CoreAuditLogsDynamo = PulumiAppModule<typeof CoreAuditLogsDynamo>;\n\nexport const CoreAuditLogsDynamo = createAppModule({\n name: \"AuditLogsDynamoDb\",\n config(app: PulumiApp, params: { protect: boolean; pointInTimeRecovery: boolean }) {\n return app.addResource(aws.dynamodb.Table, {\n name: \"webiny-audit-logs\",\n config: {\n attributes: [\n { name: \"PK\", type: \"S\" },\n { name: \"SK\", type: \"S\" },\n { name: \"GSI_TENANT\", type: \"S\" },\n { name: \"GSI1_PK\", type: \"S\" },\n { name: \"GSI1_SK\", type: \"N\" },\n { name: \"GSI2_PK\", type: \"S\" },\n { name: \"GSI2_SK\", type: \"N\" },\n { name: \"GSI3_PK\", type: \"S\" },\n { name: \"GSI3_SK\", type: \"N\" },\n { name: \"GSI4_PK\", type: \"S\" },\n { name: \"GSI4_SK\", type: \"N\" },\n { name: \"GSI5_PK\", type: \"S\" },\n { name: \"GSI5_SK\", type: \"N\" },\n { name: \"GSI6_PK\", type: \"S\" },\n { name: \"GSI6_SK\", type: \"N\" },\n { name: \"GSI7_PK\", type: \"S\" },\n { name: \"GSI7_SK\", type: \"N\" },\n { name: \"GSI8_PK\", type: \"S\" },\n { name: \"GSI8_SK\", type: \"N\" },\n { name: \"GSI9_PK\", type: \"S\" },\n { name: \"GSI9_SK\", type: \"N\" }\n ],\n billingMode: \"PAY_PER_REQUEST\",\n hashKey: \"PK\",\n rangeKey: \"SK\",\n globalSecondaryIndexes: [\n {\n name: \"GSI_TENANT\",\n keySchemas: [\n {\n attributeName: \"GSI_TENANT\",\n keyType: \"HASH\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI1\",\n keySchemas: [\n {\n attributeName: \"GSI1_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI1_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI2\",\n keySchemas: [\n {\n attributeName: \"GSI2_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI2_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI3\",\n keySchemas: [\n {\n attributeName: \"GSI3_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI3_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI4\",\n keySchemas: [\n {\n attributeName: \"GSI4_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI4_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI5\",\n keySchemas: [\n {\n attributeName: \"GSI5_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI5_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI6\",\n keySchemas: [\n {\n attributeName: \"GSI6_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI6_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI7\",\n keySchemas: [\n {\n attributeName: \"GSI7_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI7_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI8\",\n keySchemas: [\n {\n attributeName: \"GSI8_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI8_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n },\n {\n name: \"GSI9\",\n keySchemas: [\n {\n attributeName: \"GSI9_PK\",\n keyType: \"HASH\"\n },\n {\n attributeName: \"GSI9_SK\",\n keyType: \"RANGE\"\n }\n ],\n projectionType: \"KEYS_ONLY\"\n }\n ],\n ttl: {\n attributeName: \"expiresAt\",\n enabled: true\n },\n pointInTimeRecovery: {\n enabled: params.pointInTimeRecovery\n }\n },\n opts: {\n protect: params.protect\n }\n });\n }\n});\n"],"names":["CoreAuditLogsDynamo","createAppModule","app","params","aws"],"mappings":";;AAMO,MAAMA,sBAAsBC,gBAAgB;IAC/C,MAAM;IACN,QAAOC,GAAc,EAAEC,MAA0D;QAC7E,OAAOD,IAAI,WAAW,CAACE,uCAAAA,QAAAA,CAAAA,KAAkB,EAAE;YACvC,MAAM;YACN,QAAQ;gBACJ,YAAY;oBACR;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAM,MAAM;oBAAI;oBACxB;wBAAE,MAAM;wBAAc,MAAM;oBAAI;oBAChC;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oBAC7B;wBAAE,MAAM;wBAAW,MAAM;oBAAI;oB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,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;oBACA;wBACI,MAAM;wBACN,YAAY;4BACR;gCACI,eAAe;gCACf,SAAS;4BACb;4BACA;gCACI,eAAe;gCACf,SAAS;4BACb;yBACH;wBACD,gBAAgB;oBACpB;iBACH;gBACD,KAAK;oBACD,eAAe;oBACf,SAAS;gBACb;gBACA,qBAAqB;oBACjB,SAASD,OAAO,mBAAmB;gBACvC;YACJ;YACA,MAAM;gBACF,SAASA,OAAO,OAAO;YAC3B;QACJ;IACJ;AACJ"}
|
|
@@ -2,6 +2,7 @@ import { type PulumiAppModule } from "@webiny/pulumi";
|
|
|
2
2
|
export interface CoreCognitoParams {
|
|
3
3
|
protect: boolean;
|
|
4
4
|
useEmailAsUsername: boolean;
|
|
5
|
+
mfa?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export type CoreCognito = PulumiAppModule<typeof CoreCognito>;
|
|
7
8
|
export declare const CoreCognito: import("@webiny/pulumi").PulumiAppModuleDefinition<{
|
|
@@ -30,7 +30,10 @@ const CoreCognito = createAppModule({
|
|
|
30
30
|
"preferred_username"
|
|
31
31
|
],
|
|
32
32
|
lambdaConfig: {},
|
|
33
|
-
mfaConfiguration: "OFF",
|
|
33
|
+
mfaConfiguration: params.mfa ? "ON" : "OFF",
|
|
34
|
+
softwareTokenMfaConfiguration: params.mfa ? {
|
|
35
|
+
enabled: true
|
|
36
|
+
} : void 0,
|
|
34
37
|
userPoolAddOns: {
|
|
35
38
|
advancedSecurityMode: "OFF"
|
|
36
39
|
},
|