@webiny/project-aws 6.6.0-alpha.1 → 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/abstractions/pulumiTypes.d.ts +15 -0
- package/abstractions/pulumiTypes.js +0 -0
- package/api.js +1 -3
- package/api.js.map +1 -1
- 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.js +6 -12
- 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 +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +1 -1
- 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 +2 -2
- 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/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 +12 -1
- 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 +2 -1
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
- package/pulumi/apps/api/ApiOutput.d.ts +6 -6
- package/pulumi/apps/api/createApiPulumiApp.js +9 -7
- package/pulumi/apps/api/createApiPulumiApp.js.map +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/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/configureS3BucketMalwareProtection.js +12 -2
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -1
- package/pulumi/apps/core/createCorePulumiApp.js +16 -7
- 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/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 +53 -22
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/project-aws",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -17,37 +17,37 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@pulumi/aws": "^7.
|
|
21
|
-
"@pulumi/pulumi": "^3.
|
|
22
|
-
"@pulumi/random": "4.21.
|
|
23
|
-
"@webiny/aws-layers": "6.6.0-alpha.
|
|
24
|
-
"@webiny/aws-sdk": "6.6.0-alpha.
|
|
25
|
-
"@webiny/cli-core": "6.6.0-alpha.
|
|
26
|
-
"@webiny/di": "
|
|
27
|
-
"@webiny/global-config": "6.6.0-alpha.
|
|
28
|
-
"@webiny/project": "6.6.0-alpha.
|
|
29
|
-
"@webiny/
|
|
30
|
-
"@webiny/pulumi
|
|
31
|
-
"@webiny/
|
|
32
|
-
"
|
|
33
|
-
"
|
|
20
|
+
"@pulumi/aws": "^7.52.1",
|
|
21
|
+
"@pulumi/pulumi": "^3.273.0",
|
|
22
|
+
"@pulumi/random": "4.21.4",
|
|
23
|
+
"@webiny/aws-layers": "6.6.0-alpha.10",
|
|
24
|
+
"@webiny/aws-sdk": "6.6.0-alpha.10",
|
|
25
|
+
"@webiny/cli-core": "6.6.0-alpha.10",
|
|
26
|
+
"@webiny/di": "2.0.0",
|
|
27
|
+
"@webiny/global-config": "6.6.0-alpha.10",
|
|
28
|
+
"@webiny/project": "6.6.0-alpha.10",
|
|
29
|
+
"@webiny/project-extensions-aws": "6.6.0-alpha.10",
|
|
30
|
+
"@webiny/pulumi": "6.6.0-alpha.10",
|
|
31
|
+
"@webiny/pulumi-sdk": "6.6.0-alpha.10",
|
|
32
|
+
"@webiny/utils": "6.6.0-alpha.10",
|
|
33
|
+
"chalk": "6.0.1",
|
|
34
34
|
"exit-hook": "5.1.0",
|
|
35
35
|
"find-up": "8.0.0",
|
|
36
36
|
"invariant": "2.2.4",
|
|
37
37
|
"lodash": "4.18.1",
|
|
38
|
-
"mime": "4.1.
|
|
39
|
-
"p-retry": "8.0.
|
|
40
|
-
"react": "
|
|
38
|
+
"mime": "4.1.2",
|
|
39
|
+
"p-retry": "8.0.1",
|
|
40
|
+
"react": "19.3.1",
|
|
41
41
|
"replace-in-path": "1.1.0",
|
|
42
42
|
"ts-morph": "28.0.0",
|
|
43
|
-
"zod": "4.
|
|
43
|
+
"zod": "4.6.7"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/lodash": "4.17.
|
|
46
|
+
"@types/lodash": "4.17.27",
|
|
47
47
|
"@types/ncp": "2.0.8",
|
|
48
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
48
|
+
"@webiny/build-tools": "6.6.0-alpha.10",
|
|
49
49
|
"typescript": "7.0.2",
|
|
50
|
-
"vitest": "
|
|
50
|
+
"vitest": "5.0.5"
|
|
51
51
|
},
|
|
52
52
|
"adio": {
|
|
53
53
|
"ignoreDirs": [
|
package/project.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const Project: {
|
|
|
16
16
|
FeatureFlags: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
|
|
17
17
|
features: import("zod").ZodObject<{
|
|
18
18
|
multiTenancy: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
19
|
+
languages: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
19
20
|
advancedPublishingWorkflow: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
20
21
|
advancedAccessControlLayer: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodObject<{
|
|
21
22
|
teams: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
@@ -37,6 +38,7 @@ export declare const Project: {
|
|
|
37
38
|
imageEnrichment: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
38
39
|
}, import("zod/v4/core").$strip>>;
|
|
39
40
|
lexicalGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
41
|
+
adminAssistant: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
40
42
|
cms: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
41
43
|
entryGeneration: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
42
44
|
entryComparison: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
@@ -44,7 +46,16 @@ export declare const Project: {
|
|
|
44
46
|
}, import("zod/v4/core").$strip>>;
|
|
45
47
|
}, import("zod/v4/core").$strip>]>>;
|
|
46
48
|
abTesting: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
47
|
-
|
|
49
|
+
collaboration: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodBoolean, import("zod").ZodObject<{
|
|
50
|
+
comments: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
51
|
+
activityLog: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
52
|
+
}, import("zod/v4/core").$strip>]>>;
|
|
53
|
+
webhooks: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
48
54
|
}, import("zod/v4/core").$strip>;
|
|
49
55
|
}, import("zod/v4/core").$strip>>;
|
|
56
|
+
BugReporter: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
|
|
57
|
+
token: import("zod").ZodOptional<import("zod").ZodString>;
|
|
58
|
+
repository: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
+
labels: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
|
+
}, import("zod/v4/core").$strip>>;
|
|
50
61
|
};
|
package/project.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { FeatureFlags, ProjectId, Telemetry } from "@webiny/project/extensions/index.js";
|
|
1
|
+
import { BugReporter, FeatureFlags, ProjectId, Telemetry } from "@webiny/project/extensions/index.js";
|
|
2
2
|
import { AutoInstall } from "./extensions/index.js";
|
|
3
3
|
const Project = {
|
|
4
4
|
Id: ProjectId,
|
|
5
5
|
Telemetry: Telemetry,
|
|
6
6
|
AutoInstall: AutoInstall,
|
|
7
|
-
FeatureFlags: FeatureFlags
|
|
7
|
+
FeatureFlags: FeatureFlags,
|
|
8
|
+
BugReporter: BugReporter
|
|
8
9
|
};
|
|
9
10
|
export { Project };
|
|
10
11
|
|
package/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sources":["../src/project.ts"],"sourcesContent":["import { ProjectId
|
|
1
|
+
{"version":3,"file":"project.js","sources":["../src/project.ts"],"sourcesContent":["import { ProjectId } from \"@webiny/project/extensions/index.js\";\nimport { Telemetry } from \"@webiny/project/extensions/index.js\";\nimport { FeatureFlags } from \"@webiny/project/extensions/index.js\";\nimport { BugReporter } from \"@webiny/project/extensions/index.js\";\nimport { AutoInstall } from \"./extensions/index.js\";\n\nexport const Project = {\n Id: ProjectId,\n Telemetry,\n AutoInstall,\n FeatureFlags,\n BugReporter\n};\n"],"names":["Project","ProjectId","Telemetry","AutoInstall","FeatureFlags","BugReporter"],"mappings":";;AAMO,MAAMA,UAAU;IACnB,IAAIC;IACJC,WAASA;IACTC,aAAWA;IACXC,cAAYA;IACZC,aAAWA;AACf"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createReactPulumiApp } from "../index.js";
|
|
2
2
|
import { getAwsProjectSdk } from "../../getAwsProjectSdk.js";
|
|
3
|
-
import { AdminPulumi, SetAdminCustomDomains } from "
|
|
3
|
+
import { AdminPulumi, SetAdminCustomDomains } from "@webiny/project-extensions-aws/abstractions/features/pulumi/index.js";
|
|
4
4
|
import { adminPulumi } from "../../features/AdminPulumi/index.js";
|
|
5
5
|
import { DefaultSetAdminCustomDomains } from "../../features/DefaultSetAdminCustomDomains.js";
|
|
6
|
-
import { AdminCustomDomains } from "
|
|
6
|
+
import { AdminCustomDomains } from "@webiny/project-extensions-aws/extensions/AdminCustomDomains.js";
|
|
7
7
|
import { withServiceManifest } from "../../index.js";
|
|
8
|
+
import { getDistributionUrl } from "../../utils/index.js";
|
|
8
9
|
const createAdminPulumiApp = async ()=>{
|
|
9
10
|
const sdk = await getAwsProjectSdk();
|
|
10
11
|
const projectConfig = await sdk.getProjectConfig();
|
|
@@ -14,11 +15,12 @@ const createAdminPulumiApp = async ()=>{
|
|
|
14
15
|
domains: ()=>{
|
|
15
16
|
const [adminDomains] = projectConfig.extensionsByType(AdminCustomDomains);
|
|
16
17
|
if (adminDomains) {
|
|
17
|
-
const { domains, sslMethod, certificateArn } = adminDomains.params;
|
|
18
|
+
const { domains, sslMethod, certificateArn, minimumProtocolVersion } = adminDomains.params;
|
|
18
19
|
return {
|
|
19
20
|
domains,
|
|
20
21
|
sslSupportMethod: sslMethod,
|
|
21
|
-
acmCertificateArn: certificateArn
|
|
22
|
+
acmCertificateArn: certificateArn,
|
|
23
|
+
minimumProtocolVersion
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
},
|
|
@@ -34,6 +36,7 @@ const createAdminPulumiApp = async ()=>{
|
|
|
34
36
|
app.addServiceManifest({
|
|
35
37
|
name: "admin",
|
|
36
38
|
manifest: {
|
|
39
|
+
url: getDistributionUrl(baseApp.resources.cloudfront),
|
|
37
40
|
cloudfront: {
|
|
38
41
|
distributionId: baseApp.resources.cloudfront.output.id,
|
|
39
42
|
domain: baseApp.resources.cloudfront.output.domainName.apply((v)=>`https://${v}`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/admin/createAdminPulumiApp.js","sources":["../../../../src/pulumi/apps/admin/createAdminPulumiApp.ts"],"sourcesContent":["import { createReactPulumiApp } from \"~/pulumi/apps/index.js\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"pulumi/apps/admin/createAdminPulumiApp.js","sources":["../../../../src/pulumi/apps/admin/createAdminPulumiApp.ts"],"sourcesContent":["import { createReactPulumiApp } from \"~/pulumi/apps/index.js\";\nimport { getAwsProjectSdk } from \"~/pulumi/getAwsProjectSdk.js\";\nimport {\n AdminPulumi,\n SetAdminCustomDomains\n} from \"@webiny/project-extensions-aws/abstractions/features/pulumi/index.js\";\nimport { adminPulumi } from \"~/pulumi/features/AdminPulumi/index.js\";\nimport { DefaultSetAdminCustomDomains } from \"~/pulumi/features/DefaultSetAdminCustomDomains.js\";\nimport { AdminCustomDomains as adminCustomDomainsExt } from \"@webiny/project-extensions-aws/extensions/AdminCustomDomains.js\";\nimport { withServiceManifest } from \"~/pulumi/index.js\";\nimport { getDistributionUrl } from \"~/pulumi/utils/index.js\";\n\nexport type AdminPulumiApp = ReturnType<typeof createReactPulumiApp>;\n\nexport const createAdminPulumiApp = async () => {\n const sdk = await getAwsProjectSdk();\n const projectConfig = await sdk.getProjectConfig();\n const baseApp = createReactPulumiApp({\n name: \"admin\",\n folder: \"apps/admin\",\n domains: () => {\n const [adminDomains] = projectConfig.extensionsByType(adminCustomDomainsExt);\n\n if (adminDomains) {\n const { domains, sslMethod, certificateArn, minimumProtocolVersion } =\n adminDomains.params;\n return {\n domains,\n sslSupportMethod: sslMethod,\n acmCertificateArn: certificateArn,\n minimumProtocolVersion\n };\n }\n\n return undefined;\n },\n pulumi: async app => {\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(adminPulumi);\n\n // Make the `SetAdminCustomDomains` service injectable into user-defined `AdminPulumi`\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 SetAdminCustomDomains,\n new DefaultSetAdminCustomDomains(app as AdminPulumiApp)\n );\n\n const pulumiHandlers = sdk.getContainer().resolve(AdminPulumi);\n\n app.addHandler(() => {\n return pulumiHandlers.execute(app as AdminPulumiApp);\n });\n }\n });\n\n const app = withServiceManifest(baseApp);\n\n app.addHandler(() => {\n app.addServiceManifest({\n name: \"admin\",\n manifest: {\n // Read by the API through `PublicUrls.getAdminUrl()`.\n url: getDistributionUrl(baseApp.resources.cloudfront),\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\n return app;\n};\n"],"names":["createAdminPulumiApp","sdk","getAwsProjectSdk","projectConfig","baseApp","createReactPulumiApp","adminDomains","adminCustomDomainsExt","domains","sslMethod","certificateArn","minimumProtocolVersion","app","adminPulumi","SetAdminCustomDomains","DefaultSetAdminCustomDomains","pulumiHandlers","AdminPulumi","withServiceManifest","getDistributionUrl","v"],"mappings":";;;;;;;;AAcO,MAAMA,uBAAuB;IAChC,MAAMC,MAAM,MAAMC;IAClB,MAAMC,gBAAgB,MAAMF,IAAI,gBAAgB;IAChD,MAAMG,UAAUC,qBAAqB;QACjC,MAAM;QACN,QAAQ;QACR,SAAS;YACL,MAAM,CAACC,aAAa,GAAGH,cAAc,gBAAgB,CAACI;YAEtD,IAAID,cAAc;gBACd,MAAM,EAAEE,OAAO,EAAEC,SAAS,EAAEC,cAAc,EAAEC,sBAAsB,EAAE,GAChEL,aAAa,MAAM;gBACvB,OAAO;oBACHE;oBACA,kBAAkBC;oBAClB,mBAAmBC;oBACnBC;gBACJ;YACJ;QAGJ;QACA,QAAQ,OAAMC;YAGVX,IAAI,YAAY,GAAG,iBAAiB,CAACY;YAOrCZ,IAAI,YAAY,GAAG,gBAAgB,CAC/Ba,uBACA,IAAIC,6BAA6BH;YAGrC,MAAMI,iBAAiBf,IAAI,YAAY,GAAG,OAAO,CAACgB;YAElDL,IAAI,UAAU,CAAC,IACJI,eAAe,OAAO,CAACJ;QAEtC;IACJ;IAEA,MAAMA,MAAMM,oBAAoBd;IAEhCQ,IAAI,UAAU,CAAC;QACXA,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBAEN,KAAKO,mBAAmBf,QAAQ,SAAS,CAAC,UAAU;gBACpD,YAAY;oBACR,gBAAgBA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;oBACtD,QAAQA,QAAQ,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CACxDgB,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAE3B;YACJ;QACJ;IACJ;IAEA,OAAOR;AACX"}
|
|
@@ -21,7 +21,8 @@ const ApiCloudfront = createAppModule({
|
|
|
21
21
|
"Accept",
|
|
22
22
|
"Accept-Language",
|
|
23
23
|
"X-Tenant",
|
|
24
|
-
"X-Webiny-Sdk"
|
|
24
|
+
"X-Webiny-Sdk",
|
|
25
|
+
"X-Webiny-Debug"
|
|
25
26
|
];
|
|
26
27
|
const streamOac = app.addResource(__rspack_external__pulumi_aws_9e2bee2d.cloudfront.OriginAccessControl, {
|
|
27
28
|
name: "api-stream-oac",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pulumi/apps/api/ApiCloudfront.js","sources":["../../../../src/pulumi/apps/api/ApiCloudfront.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nimport { ApiGateway } from \"./ApiGateway.js\";\nimport { ApiGraphqlStream } from \"./ApiGraphqlStream.js\";\n\nexport type ApiCloudfront = PulumiAppModule<typeof ApiCloudfront>;\n\nconst STREAM_ORIGIN_ID = \"graphql-stream-function-url\";\n\n// AWS's `Managed-CachingDisabled` cache policy. Managed policy IDs are global constants — the same\n// value in every account and region — so this is hardcoded rather than resolved via\n// `aws.cloudfront.getCachePolicyOutput({ name: \"Managed-CachingDisabled\" })` the way\n// `createCloudFrontDefaultCacheBehaviorPolicies` does. The lookup would need\n// `cloudfront:ListCachePolicies` on the deploy role, and that is not worth adding to every\n// project's default deployment path just to avoid a constant AWS itself documents.\nconst MANAGED_CACHING_DISABLED_POLICY_ID = \"4135ea2d-6df8-44a3-9df3-4b5a84be39ad\";\n\nexport const ApiCloudfront = createAppModule({\n name: \"ApiCloudfront\",\n config(app: PulumiApp) {\n const gateway = app.getModule(ApiGateway);\n const graphqlStream = app.getModule(ApiGraphqlStream);\n\n const cookies = {\n forward: \"whitelist\",\n whitelistedNames: [\"wby-id-token\"]\n };\n\n const forwardHeaders = [\n \"Origin\",\n \"Authorization\",\n \"Accept\",\n \"Accept-Language\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\"\n ];\n\n // Lets CloudFront sign requests to the Lambda Function URL with SigV4, so the URL itself can\n // stay on AWS_IAM authorization instead of being reachable from the internet.\n const streamOac = app.addResource(aws.cloudfront.OriginAccessControl, {\n name: \"api-stream-oac\",\n config: {\n description: \"Signs CloudFront requests to the streaming Lambda Function URL\",\n originAccessControlOriginType: \"lambda\",\n signingBehavior: \"always\",\n signingProtocol: \"sigv4\"\n }\n });\n\n // The streaming behavior uses a cache policy + origin request policy instead of the legacy\n // `forwardedValues` the other behaviors use, because legacy forwarded values are deprecated\n // and this policy also has to forward the two CORS preflight headers (see below).\n //\n // It is NOT what fixed the `AccessDeniedException` that made Lambda reject every signed\n // CloudFront request — that was a missing `lambda:InvokeFunction` permission (see the two\n // permissions at the bottom of this file). Recorded because the wrong cause was assumed first.\n //\n // Do NOT replace this with a managed origin request policy. `Managed-AllViewer` forwards\n // `Host`, which breaks OAC signing against a Function URL origin.\n // `Managed-AllViewerExceptHostHeader` (used for the blue/green router in this same package)\n // fixes `Host` but still forwards `Authorization`, which OAC signing owns here — see below.\n const streamOriginRequestPolicy = app.addResource(aws.cloudfront.OriginRequestPolicy, {\n name: \"api-stream-origin-request-policy\",\n config: {\n comment: \"Headers/cookies forwarded to the streaming Lambda Function URL origin\",\n headersConfig: {\n headerBehavior: \"whitelist\",\n headers: {\n items: [\n \"Origin\",\n \"Accept\",\n \"Accept-Language\",\n // Required for CORS preflight: without these the origin can't build a\n // correct 204, so the browser blocks the real request.\n \"Access-Control-Request-Method\",\n \"Access-Control-Request-Headers\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\",\n // `Authorization` is deliberately ABSENT — OAC signing owns that header.\n // Clients send their token in `X-Webiny-Authorization` instead.\n \"X-Webiny-Authorization\"\n ]\n }\n },\n cookiesConfig: {\n cookieBehavior: \"whitelist\",\n cookies: { items: [\"wby-id-token\"] }\n },\n queryStringsConfig: { queryStringBehavior: \"all\" }\n }\n });\n\n const distribution = app.addResource(aws.cloudfront.Distribution, {\n name: \"api-cloudfront\",\n config: {\n httpVersion: \"http2and3\",\n waitForDeployment: false,\n isIpv6Enabled: true,\n enabled: true,\n defaultCacheBehavior: {\n compress: true,\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\", \"PUT\", \"POST\", \"PATCH\", \"DELETE\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies,\n headers: forwardHeaders,\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 86400,\n targetOriginId: gateway.api.output.name,\n viewerProtocolPolicy: \"allow-all\"\n },\n orderedCacheBehaviors: [\n {\n // Streaming routes (SSE). Must come before the other behaviors so `/stream/*`\n // never falls through to the API Gateway origin, which cannot stream.\n //\n // `compress: false` is load-bearing: CloudFront compression buffers small\n // chunks, which defeats incremental delivery even though the origin streams.\n compress: false,\n allowedMethods: [\n \"GET\",\n \"HEAD\",\n \"OPTIONS\",\n \"PUT\",\n \"POST\",\n \"PATCH\",\n \"DELETE\"\n ],\n cachedMethods: [\"GET\", \"HEAD\"],\n // Nothing on a streaming route is cacheable. TTLs must NOT be set\n // alongside a cache policy.\n cachePolicyId: MANAGED_CACHING_DISABLED_POLICY_ID,\n originRequestPolicyId: streamOriginRequestPolicy.output.id,\n pathPattern: \"/stream/*\",\n // Stricter than the other behaviors' `allow-all` on purpose: a streaming route\n // carries an auth token in a header, so plain HTTP is never acceptable here.\n viewerProtocolPolicy: \"https-only\",\n targetOriginId: STREAM_ORIGIN_ID\n },\n {\n compress: true,\n allowedMethods: [\n \"GET\",\n \"HEAD\",\n \"OPTIONS\",\n \"PUT\",\n \"POST\",\n \"PATCH\",\n \"DELETE\"\n ],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: forwardHeaders,\n queryString: true\n },\n pathPattern: \"/cms*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n },\n {\n compress: true,\n allowedMethods: [\n \"GET\",\n \"HEAD\",\n \"OPTIONS\",\n \"PUT\",\n \"POST\",\n \"PATCH\",\n \"DELETE\"\n ],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: forwardHeaders,\n queryString: true\n },\n pathPattern: \"/wb/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n },\n {\n allowedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n cachedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: forwardHeaders,\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 2592000,\n pathPattern: \"/files/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n },\n {\n allowedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n cachedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n forwardedValues: {\n cookies: cookies,\n headers: forwardHeaders,\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 2592000,\n pathPattern: \"/private/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n }\n ],\n origins: [\n {\n domainName: gateway.stage.output.invokeUrl.apply(\n (url: string) => new URL(url).hostname\n ),\n originPath: gateway.stage.output.invokeUrl.apply(\n (url: string) => new URL(url).pathname\n ),\n originId: gateway.api.output.name,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"]\n }\n },\n {\n // Lambda Function URL origin for streaming routes. A Function URL is a plain\n // HTTPS endpoint, hence customOriginConfig; the OAC is what makes CloudFront\n // sign the request so the URL can require AWS_IAM.\n domainName: graphqlStream.functionUrlDomain,\n originId: STREAM_ORIGIN_ID,\n originAccessControlId: streamOac.output.id,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"],\n // NOT a cap on how long a response may stream. It is an IDLE timeout,\n // applied twice: to time-to-first-byte, and to the gap between any two\n // subsequent packets. A stream that keeps emitting can run as long as the\n // Lambda lives (300s here); only silence longer than this kills it.\n //\n // Raised from the 30s default because that is shorter than a slow model's\n // time to first token: CloudFront would abandon the stream while the Lambda\n // kept working. 60s is the ceiling without an AWS quota increase — a route\n // whose quiet gaps could exceed it must emit SSE heartbeat comments\n // (`: ping\\n\\n`), which clients ignore by spec, resetting the timer.\n originReadTimeout: 60\n }\n }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n },\n opts: {\n // We are ignoring changes to the \"staging\" property. This is because of the following.\n // With the 5.41.0 release of Webiny, we also upgraded Pulumi to v6. This introduced a change\n // with how Cloudfront distributions are deployed, where Pulumi now also controls the new\n // `staging` property.\n // If not set, Pulumi will default it to `false`. Which is fine, but, the problem is\n // that, because this property did not exist before, it will always be considered as a change\n // upon deployment.\n // We might think this is fine, but, the problem is that a change in this property causes\n // a full replacement of the Cloudfront distribution, which is not acceptable. Especially\n // if a custom domain has already been associated with the distribution. This then would\n // require the user to disassociate the domain, wait for the distribution to be replaced,\n // and then re-associate the domain. This is not a good experience.\n ignoreChanges: [\"staging\"]\n }\n });\n\n // Allows THIS distribution — and nothing else — to invoke the streaming Function URL. Created\n // after the distribution because it needs its ARN; the Function URL is useless until it exists.\n //\n // BOTH statements are required. The OAC-for-Lambda docs list `lambda:InvokeFunctionUrl` AND\n // `lambda:InvokeFunction`; with only the former, Lambda's authorizer rejects every signed\n // request from CloudFront with `AccessDeniedException` and the function is never invoked.\n app.addResource(aws.lambda.Permission, {\n name: \"graphql-stream-url-cloudfront-invoke\",\n config: {\n action: \"lambda:InvokeFunctionUrl\",\n function: graphqlStream.functions.graphqlStream.output.name,\n principal: \"cloudfront.amazonaws.com\",\n sourceArn: distribution.output.arn,\n functionUrlAuthType: \"AWS_IAM\",\n statementId: \"allow-cloudfront-invoke-function-url\"\n }\n });\n\n app.addResource(aws.lambda.Permission, {\n name: \"graphql-stream-cloudfront-invoke-function\",\n config: {\n action: \"lambda:InvokeFunction\",\n function: graphqlStream.functions.graphqlStream.output.name,\n principal: \"cloudfront.amazonaws.com\",\n sourceArn: distribution.output.arn,\n statementId: \"allow-cloudfront-invoke-function\"\n }\n });\n\n return distribution;\n }\n});\n"],"names":["STREAM_ORIGIN_ID","MANAGED_CACHING_DISABLED_POLICY_ID","ApiCloudfront","createAppModule","app","gateway","ApiGateway","graphqlStream","ApiGraphqlStream","cookies","forwardHeaders","streamOac","aws","streamOriginRequestPolicy","distribution","url","URL"],"mappings":";;;;AASA,MAAMA,mBAAmB;AAQzB,MAAMC,qCAAqC;AAEpC,MAAMC,gBAAgBC,gBAAgB;IACzC,MAAM;IACN,QAAOC,GAAc;QACjB,MAAMC,UAAUD,IAAI,SAAS,CAACE;QAC9B,MAAMC,gBAAgBH,IAAI,SAAS,CAACI;QAEpC,MAAMC,UAAU;YACZ,SAAS;YACT,kBAAkB;gBAAC;aAAe;QACtC;QAEA,MAAMC,iBAAiB;YACnB;YACA;YACA;YACA;YACA;YACA;SACH;QAID,MAAMC,YAAYP,IAAI,WAAW,CAACQ,uCAAAA,UAAAA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udfront.js","sources":["../../../../src/pulumi/apps/api/ApiCloudfront.ts"],"sourcesContent":["import * as aws from \"@pulumi/aws\";\nimport type { PulumiApp, PulumiAppModule } from \"@webiny/pulumi\";\nimport { createAppModule } from \"@webiny/pulumi\";\n\nimport { ApiGateway } from \"./ApiGateway.js\";\nimport { ApiGraphqlStream } from \"./ApiGraphqlStream.js\";\n\nexport type ApiCloudfront = PulumiAppModule<typeof ApiCloudfront>;\n\nconst STREAM_ORIGIN_ID = \"graphql-stream-function-url\";\n\n// AWS's `Managed-CachingDisabled` cache policy. Managed policy IDs are global constants — the same\n// value in every account and region — so this is hardcoded rather than resolved via\n// `aws.cloudfront.getCachePolicyOutput({ name: \"Managed-CachingDisabled\" })` the way\n// `createCloudFrontDefaultCacheBehaviorPolicies` does. The lookup would need\n// `cloudfront:ListCachePolicies` on the deploy role, and that is not worth adding to every\n// project's default deployment path just to avoid a constant AWS itself documents.\nconst MANAGED_CACHING_DISABLED_POLICY_ID = \"4135ea2d-6df8-44a3-9df3-4b5a84be39ad\";\n\nexport const ApiCloudfront = createAppModule({\n name: \"ApiCloudfront\",\n config(app: PulumiApp) {\n const gateway = app.getModule(ApiGateway);\n const graphqlStream = app.getModule(ApiGraphqlStream);\n\n const cookies = {\n forward: \"whitelist\",\n whitelistedNames: [\"wby-id-token\"]\n };\n\n const forwardHeaders = [\n \"Origin\",\n \"Authorization\",\n \"Accept\",\n \"Accept-Language\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\",\n // Narrows the debugger's capture. Without it here the edge drops the header silently.\n \"X-Webiny-Debug\"\n ];\n\n // Lets CloudFront sign requests to the Lambda Function URL with SigV4, so the URL itself can\n // stay on AWS_IAM authorization instead of being reachable from the internet.\n const streamOac = app.addResource(aws.cloudfront.OriginAccessControl, {\n name: \"api-stream-oac\",\n config: {\n description: \"Signs CloudFront requests to the streaming Lambda Function URL\",\n originAccessControlOriginType: \"lambda\",\n signingBehavior: \"always\",\n signingProtocol: \"sigv4\"\n }\n });\n\n // The streaming behavior uses a cache policy + origin request policy instead of the legacy\n // `forwardedValues` the other behaviors use, because legacy forwarded values are deprecated\n // and this policy also has to forward the two CORS preflight headers (see below).\n //\n // It is NOT what fixed the `AccessDeniedException` that made Lambda reject every signed\n // CloudFront request — that was a missing `lambda:InvokeFunction` permission (see the two\n // permissions at the bottom of this file). Recorded because the wrong cause was assumed first.\n //\n // Do NOT replace this with a managed origin request policy. `Managed-AllViewer` forwards\n // `Host`, which breaks OAC signing against a Function URL origin.\n // `Managed-AllViewerExceptHostHeader` (used for the blue/green router in this same package)\n // fixes `Host` but still forwards `Authorization`, which OAC signing owns here — see below.\n const streamOriginRequestPolicy = app.addResource(aws.cloudfront.OriginRequestPolicy, {\n name: \"api-stream-origin-request-policy\",\n config: {\n comment: \"Headers/cookies forwarded to the streaming Lambda Function URL origin\",\n headersConfig: {\n headerBehavior: \"whitelist\",\n headers: {\n items: [\n \"Origin\",\n \"Accept\",\n \"Accept-Language\",\n // Required for CORS preflight: without these the origin can't build a\n // correct 204, so the browser blocks the real request.\n \"Access-Control-Request-Method\",\n \"Access-Control-Request-Headers\",\n \"X-Tenant\",\n \"X-Webiny-Sdk\",\n // `Authorization` is deliberately ABSENT — OAC signing owns that header.\n // Clients send their token in `X-Webiny-Authorization` instead.\n \"X-Webiny-Authorization\"\n ]\n }\n },\n cookiesConfig: {\n cookieBehavior: \"whitelist\",\n cookies: { items: [\"wby-id-token\"] }\n },\n queryStringsConfig: { queryStringBehavior: \"all\" }\n }\n });\n\n const distribution = app.addResource(aws.cloudfront.Distribution, {\n name: \"api-cloudfront\",\n config: {\n httpVersion: \"http2and3\",\n waitForDeployment: false,\n isIpv6Enabled: true,\n enabled: true,\n defaultCacheBehavior: {\n compress: true,\n allowedMethods: [\"GET\", \"HEAD\", \"OPTIONS\", \"PUT\", \"POST\", \"PATCH\", \"DELETE\"],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies,\n headers: forwardHeaders,\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 86400,\n targetOriginId: gateway.api.output.name,\n viewerProtocolPolicy: \"allow-all\"\n },\n orderedCacheBehaviors: [\n {\n // Streaming routes (SSE). Must come before the other behaviors so `/stream/*`\n // never falls through to the API Gateway origin, which cannot stream.\n //\n // `compress: false` is load-bearing: CloudFront compression buffers small\n // chunks, which defeats incremental delivery even though the origin streams.\n compress: false,\n allowedMethods: [\n \"GET\",\n \"HEAD\",\n \"OPTIONS\",\n \"PUT\",\n \"POST\",\n \"PATCH\",\n \"DELETE\"\n ],\n cachedMethods: [\"GET\", \"HEAD\"],\n // Nothing on a streaming route is cacheable. TTLs must NOT be set\n // alongside a cache policy.\n cachePolicyId: MANAGED_CACHING_DISABLED_POLICY_ID,\n originRequestPolicyId: streamOriginRequestPolicy.output.id,\n pathPattern: \"/stream/*\",\n // Stricter than the other behaviors' `allow-all` on purpose: a streaming route\n // carries an auth token in a header, so plain HTTP is never acceptable here.\n viewerProtocolPolicy: \"https-only\",\n targetOriginId: STREAM_ORIGIN_ID\n },\n {\n compress: true,\n allowedMethods: [\n \"GET\",\n \"HEAD\",\n \"OPTIONS\",\n \"PUT\",\n \"POST\",\n \"PATCH\",\n \"DELETE\"\n ],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: forwardHeaders,\n queryString: true\n },\n pathPattern: \"/cms*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n },\n {\n compress: true,\n allowedMethods: [\n \"GET\",\n \"HEAD\",\n \"OPTIONS\",\n \"PUT\",\n \"POST\",\n \"PATCH\",\n \"DELETE\"\n ],\n cachedMethods: [\"GET\", \"HEAD\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: forwardHeaders,\n queryString: true\n },\n pathPattern: \"/wb/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n },\n {\n allowedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n cachedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n forwardedValues: {\n cookies: {\n forward: \"none\"\n },\n headers: forwardHeaders,\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 2592000,\n pathPattern: \"/files/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n },\n {\n allowedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n cachedMethods: [\"HEAD\", \"GET\", \"OPTIONS\"],\n forwardedValues: {\n cookies: cookies,\n headers: forwardHeaders,\n queryString: true\n },\n // MinTTL <= DefaultTTL <= MaxTTL\n minTtl: 0,\n defaultTtl: 0,\n maxTtl: 2592000,\n pathPattern: \"/private/*\",\n viewerProtocolPolicy: \"allow-all\",\n targetOriginId: gateway.api.output.name\n }\n ],\n origins: [\n {\n domainName: gateway.stage.output.invokeUrl.apply(\n (url: string) => new URL(url).hostname\n ),\n originPath: gateway.stage.output.invokeUrl.apply(\n (url: string) => new URL(url).pathname\n ),\n originId: gateway.api.output.name,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"]\n }\n },\n {\n // Lambda Function URL origin for streaming routes. A Function URL is a plain\n // HTTPS endpoint, hence customOriginConfig; the OAC is what makes CloudFront\n // sign the request so the URL can require AWS_IAM.\n domainName: graphqlStream.functionUrlDomain,\n originId: STREAM_ORIGIN_ID,\n originAccessControlId: streamOac.output.id,\n customOriginConfig: {\n httpPort: 80,\n httpsPort: 443,\n originProtocolPolicy: \"https-only\",\n originSslProtocols: [\"TLSv1.2\"],\n // NOT a cap on how long a response may stream. It is an IDLE timeout,\n // applied twice: to time-to-first-byte, and to the gap between any two\n // subsequent packets. A stream that keeps emitting can run as long as the\n // Lambda lives (300s here); only silence longer than this kills it.\n //\n // Raised from the 30s default because that is shorter than a slow model's\n // time to first token: CloudFront would abandon the stream while the Lambda\n // kept working. 60s is the ceiling without an AWS quota increase — a route\n // whose quiet gaps could exceed it must emit SSE heartbeat comments\n // (`: ping\\n\\n`), which clients ignore by spec, resetting the timer.\n originReadTimeout: 60\n }\n }\n ],\n restrictions: {\n geoRestriction: {\n restrictionType: \"none\"\n }\n },\n viewerCertificate: {\n cloudfrontDefaultCertificate: true\n }\n },\n opts: {\n // We are ignoring changes to the \"staging\" property. This is because of the following.\n // With the 5.41.0 release of Webiny, we also upgraded Pulumi to v6. This introduced a change\n // with how Cloudfront distributions are deployed, where Pulumi now also controls the new\n // `staging` property.\n // If not set, Pulumi will default it to `false`. Which is fine, but, the problem is\n // that, because this property did not exist before, it will always be considered as a change\n // upon deployment.\n // We might think this is fine, but, the problem is that a change in this property causes\n // a full replacement of the Cloudfront distribution, which is not acceptable. Especially\n // if a custom domain has already been associated with the distribution. This then would\n // require the user to disassociate the domain, wait for the distribution to be replaced,\n // and then re-associate the domain. This is not a good experience.\n ignoreChanges: [\"staging\"]\n }\n });\n\n // Allows THIS distribution — and nothing else — to invoke the streaming Function URL. Created\n // after the distribution because it needs its ARN; the Function URL is useless until it exists.\n //\n // BOTH statements are required. The OAC-for-Lambda docs list `lambda:InvokeFunctionUrl` AND\n // `lambda:InvokeFunction`; with only the former, Lambda's authorizer rejects every signed\n // request from CloudFront with `AccessDeniedException` and the function is never invoked.\n app.addResource(aws.lambda.Permission, {\n name: \"graphql-stream-url-cloudfront-invoke\",\n config: {\n action: \"lambda:InvokeFunctionUrl\",\n function: graphqlStream.functions.graphqlStream.output.name,\n principal: \"cloudfront.amazonaws.com\",\n sourceArn: distribution.output.arn,\n functionUrlAuthType: \"AWS_IAM\",\n statementId: \"allow-cloudfront-invoke-function-url\"\n }\n });\n\n app.addResource(aws.lambda.Permission, {\n name: \"graphql-stream-cloudfront-invoke-function\",\n config: {\n action: \"lambda:InvokeFunction\",\n function: graphqlStream.functions.graphqlStream.output.name,\n principal: \"cloudfront.amazonaws.com\",\n sourceArn: distribution.output.arn,\n statementId: \"allow-cloudfront-invoke-function\"\n }\n });\n\n return distribution;\n }\n});\n"],"names":["STREAM_ORIGIN_ID","MANAGED_CACHING_DISABLED_POLICY_ID","ApiCloudfront","createAppModule","app","gateway","ApiGateway","graphqlStream","ApiGraphqlStream","cookies","forwardHeaders","streamOac","aws","streamOriginRequestPolicy","distribution","url","URL"],"mappings":";;;;AASA,MAAMA,mBAAmB;AAQzB,MAAMC,qCAAqC;AAEpC,MAAMC,gBAAgBC,gBAAgB;IACzC,MAAM;IACN,QAAOC,GAAc;QACjB,MAAMC,UAAUD,IAAI,SAAS,CAACE;QAC9B,MAAMC,gBAAgBH,IAAI,SAAS,CAACI;QAEpC,MAAMC,UAAU;YACZ,SAAS;YACT,kBAAkB;gBAAC;aAAe;QACtC;QAEA,MAAMC,iBAAiB;YACnB;YACA;YACA;YACA;YACA;YACA;YAEA;SACH;QAID,MAAMC,YAAYP,IAAI,WAAW,CAACQ,uCAAAA,UAAAA,CAAAA,mBAAkC,EAAE;YAClE,MAAM;YACN,QAAQ;gBACJ,aAAa;gBACb,+BAA+B;gBAC/B,iBAAiB;gBACjB,iBAAiB;YACrB;QACJ;QAcA,MAAMC,4BAA4BT,IAAI,WAAW,CAACQ,uCAAAA,UAAAA,CAAAA,mBAAkC,EAAE;YAClF,MAAM;YACN,QAAQ;gBACJ,SAAS;gBACT,eAAe;oBACX,gBAAgB;oBAChB,SAAS;wBACL,OAAO;4BACH;4BACA;4BACA;4BAGA;4BACA;4BACA;4BACA;4BAGA;yBACH;oBACL;gBACJ;gBACA,eAAe;oBACX,gBAAgB;oBAChB,SAAS;wBAAE,OAAO;4BAAC;yBAAe;oBAAC;gBACvC;gBACA,oBAAoB;oBAAE,qBAAqB;gBAAM;YACrD;QACJ;QAEA,MAAME,eAAeV,IAAI,WAAW,CAACQ,uCAAAA,UAAAA,CAAAA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Z,iBAAiB;oBACrB;gBACJ;gBACA,mBAAmB;oBACf,8BAA8B;gBAClC;YACJ;YACA,MAAM;gBAaF,eAAe;oBAAC;iBAAU;YAC9B;QACJ;QAQAP,IAAI,WAAW,CAACQ,uCAAAA,MAAAA,CAAAA,UAAqB,EAAE;YACnC,MAAM;YACN,QAAQ;gBACJ,QAAQ;gBACR,UAAUL,cAAc,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI;gBAC3D,WAAW;gBACX,WAAWO,aAAa,MAAM,CAAC,GAAG;gBAClC,qBAAqB;gBACrB,aAAa;YACjB;QACJ;QAEAV,IAAI,WAAW,CAACQ,uCAAAA,MAAAA,CAAAA,UAAqB,EAAE;YACnC,MAAM;YACN,QAAQ;gBACJ,QAAQ;gBACR,UAAUL,cAAc,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI;gBAC3D,WAAW;gBACX,WAAWO,aAAa,MAAM,CAAC,GAAG;gBAClC,aAAa;YACjB;QACJ;QAEA,OAAOA;IACX;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>;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { createPulumiApp, isResourceOfType } from "@webiny/pulumi";
|
|
2
2
|
import { ApiBackgroundTask, ApiCloudfront, ApiFileManager, ApiGateway, ApiGraphql, ApiGraphqlStream, ApiWebsocket, CoreOutput, VpcConfig } from "../index.js";
|
|
3
|
-
import { addDomainsUrlsOutputs, withCommonLambdaEnvVariables, withServiceManifest } from "../../utils/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 = ()=>{
|
|
@@ -73,9 +74,8 @@ 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
80
|
const graphqlEnv = {
|
|
81
81
|
COGNITO_REGION: getEnvVariableAwsRegion(),
|
|
@@ -157,11 +157,12 @@ const createApiPulumiApp = ()=>{
|
|
|
157
157
|
const scheduler = app.addModule(ApiScheduler);
|
|
158
158
|
const [apiCustomDomains] = projectConfig.extensionsByType(ApiCustomDomains);
|
|
159
159
|
if (apiCustomDomains) {
|
|
160
|
-
const { domains, sslMethod, certificateArn } = apiCustomDomains.params;
|
|
160
|
+
const { domains, sslMethod, certificateArn, minimumProtocolVersion } = apiCustomDomains.params;
|
|
161
161
|
applyCustomDomain(cloudfront, {
|
|
162
162
|
domains,
|
|
163
163
|
sslSupportMethod: sslMethod,
|
|
164
|
-
acmCertificateArn: certificateArn
|
|
164
|
+
acmCertificateArn: certificateArn,
|
|
165
|
+
minimumProtocolVersion
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
app.addOutputs({
|
|
@@ -217,6 +218,7 @@ const createApiPulumiApp = ()=>{
|
|
|
217
218
|
app.addServiceManifest({
|
|
218
219
|
name: "api",
|
|
219
220
|
manifest: {
|
|
221
|
+
url: getDistributionUrl(baseApp.resources.cloudfront),
|
|
220
222
|
bgTaskSfn: baseApp.resources.backgroundTask.stepFunction.output.arn,
|
|
221
223
|
cloudfront: {
|
|
222
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 ApiGraphqlStream,\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.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 const vpcEnabled =\n vpcExtensionsConfig === true ||\n typeof vpcExtensionsConfig === \"object\" ||\n isProduction;\n\n app.addModule(VpcConfig, { enabled: vpcEnabled });\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 } = 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 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 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","graphqlEnv","getEnvVariableAwsRegion","graphql","ApiGraphql","graphqlStream","ApiGraphqlStream","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":";;;;;;;;;;;;;;;;AAmCO,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,UAA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C,2BAA2BU,UAAU,UAAU,CAAC,MAAM,CAAC,GAAG;YAC9D;YAGA,IAAIxC,oBACAT,IAAI,UAAU,CAAC;gBACX,yBAAyB6B,KAAK,2BAA2B;YAC7D;YAGJ7B,IAAI,UAAU,CAAC;gBACX0D,sBAAsB;oBAClB1D;oBACA,wBAAwB6C;oBACxB,KAAK;wBACD,oBAAoB;wBACpB,iBAAiB;wBACjB,YAAY;wBACZ,SAAS;oBACb;gBACJ;YACJ;YAWA,MAAMc,qBAAqB;YAE3B,OAAO;gBACHlB;gBACAN;gBACAE;gBACAM;gBACAJ;gBACAM;gBACAE;gBACAE;YACJ;QACJ;IACJ;IAEA,MAAMjD,MAAM4D,oBAAoBC,6BAA6B/D;IAE7DE,IAAI,UAAU,CAAC;QACXA,IAAI,kBAAkB,CAAC;YACnB,MAAM;YACN,UAAU;gBACN,WAAWF,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,CACxDgE,CAAAA,IAAK,CAAC,QAAQ,EAAEA,GAAG;gBAE3B;YACJ;QACJ;QAEA9D,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"}
|
|
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;oBAG5C,IAAID,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;oBAGrD,IAAIA,OAAO,QAAQ,EACfC,QAAQ,GAAG,CAAC,mBAAmB,GAAGD,OAAO,QAAQ;gBAEzD;YACJ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;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"}
|
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;
|