@webiny/project-aws 0.0.0-unstable.6844005670 → 0.0.0-unstable.7be00a75a9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_templates/appTemplates/admin/src/index.tsx +0 -3
- package/_templates/appTemplates/admin/webiny.application.ts +1 -1
- package/_templates/appTemplates/api/graphql/package.json +3 -5
- package/_templates/appTemplates/api/graphql/src/extensions.ts +1 -1
- package/_templates/appTemplates/api/graphql/src/index.ts +9 -8
- package/_templates/appTemplates/api/webiny.application.ts +1 -1
- package/_templates/appTemplates/blueGreen/webiny.application.ts +1 -1
- package/_templates/appTemplates/core/webiny.application.ts +1 -1
- package/_templates/appTemplates/syncSystem/webiny.application.ts +1 -1
- package/_templates/extensions/OpenSearch/api/graphql/src/index.ts +22 -17
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/src/index.ts +14 -7
- package/_templates/extensions/OpenSearch/coreDdbToEsHandler/dynamoToElastic/webiny.config.ts +2 -2
- package/abstractions/ApiGqlClient.js +2 -1
- package/abstractions/ApiGqlClient.js.map +1 -1
- package/abstractions/InvokeLambdaFunction.js +2 -1
- package/abstractions/InvokeLambdaFunction.js.map +1 -1
- package/abstractions/features/pulumi/AdminPulumi.d.ts +9 -0
- package/abstractions/features/pulumi/AdminPulumi.js +5 -0
- package/abstractions/features/pulumi/AdminPulumi.js.map +1 -0
- package/abstractions/features/pulumi/ApiPulumi.d.ts +9 -0
- package/abstractions/features/pulumi/ApiPulumi.js +5 -0
- package/abstractions/features/pulumi/ApiPulumi.js.map +1 -0
- package/abstractions/features/pulumi/CorePulumi.d.ts +9 -0
- package/abstractions/features/pulumi/CorePulumi.js +5 -0
- package/abstractions/features/pulumi/CorePulumi.js.map +1 -0
- package/abstractions/features/pulumi/index.d.ts +3 -0
- package/abstractions/features/pulumi/index.js +3 -0
- package/abstractions/index.d.ts +1 -0
- package/abstractions/index.js +1 -2
- package/abstractions/services/AdminStackOutputService.js +2 -1
- package/abstractions/services/AdminStackOutputService.js.map +1 -1
- package/abstractions/services/ApiStackOutputService.d.ts +0 -1
- package/abstractions/services/ApiStackOutputService.js +2 -1
- package/abstractions/services/ApiStackOutputService.js.map +1 -1
- package/abstractions/services/CoreStackOutputService.js +2 -1
- package/abstractions/services/CoreStackOutputService.js.map +1 -1
- package/admin.d.ts +6 -18
- package/admin.js +5 -4
- package/admin.js.map +1 -1
- package/api.d.ts +36 -18
- package/api.js +14 -3
- package/api.js.map +1 -1
- package/apps/createAdminApp.js +11 -12
- package/apps/createAdminApp.js.map +1 -1
- package/apps/createAdminAppConfig.js +12 -18
- package/apps/createAdminAppConfig.js.map +1 -1
- package/apps/createApiApp.d.ts +0 -3
- package/apps/createApiApp.js +17 -22
- package/apps/createApiApp.js.map +1 -1
- package/apps/createBlueGreenApp.js +13 -16
- package/apps/createBlueGreenApp.js.map +1 -1
- package/apps/createCoreApp.d.ts +0 -1
- package/apps/createCoreApp.js +12 -13
- package/apps/createCoreApp.js.map +1 -1
- package/apps/createReactAppConfig.d.ts +0 -7
- package/apps/createReactAppConfig.js +56 -69
- package/apps/createReactAppConfig.js.map +1 -1
- package/apps/createSyncSystemApp.js +8 -7
- package/apps/createSyncSystemApp.js.map +1 -1
- package/apps/index.js +0 -2
- package/cli.d.ts +2 -6
- package/cli.js +3 -2
- package/cli.js.map +1 -1
- package/exports/extensions.js +0 -2
- package/exports/infra/admin.d.ts +1 -0
- package/exports/infra/admin.js +1 -2
- package/exports/infra/api.d.ts +1 -0
- package/exports/infra/api.js +1 -2
- package/exports/infra/core.d.ts +1 -0
- package/exports/infra/core.js +1 -2
- package/exports/{infra/index.d.ts → infra.d.ts} +1 -1
- package/exports/infra.js +1 -0
- package/extensions/ApiLambdaFunction.d.ts +4 -10
- package/extensions/ApiLambdaFunction.js +45 -56
- package/extensions/ApiLambdaFunction.js.map +1 -1
- package/extensions/ApiRoute.d.ts +16 -0
- package/extensions/ApiRoute.js +106 -0
- package/extensions/ApiRoute.js.map +1 -0
- package/extensions/AwsDefaultRegion.d.ts +1 -5
- package/extensions/AwsDefaultRegion.js +17 -16
- package/extensions/AwsDefaultRegion.js.map +1 -1
- package/extensions/Cms/ModelFieldCompression.d.ts +4 -0
- package/extensions/Cms/ModelFieldCompression.js +24 -0
- package/extensions/Cms/ModelFieldCompression.js.map +1 -0
- package/extensions/Encryption.d.ts +10 -0
- package/extensions/Encryption.js +36 -0
- package/extensions/Encryption.js.map +1 -0
- package/extensions/Mailer/Smtp.d.ts +8 -0
- package/extensions/Mailer/Smtp.js +21 -0
- package/extensions/Mailer/Smtp.js.map +1 -0
- package/extensions/Mailer/Smtp.test.d.ts +1 -0
- package/extensions/Mailer/Smtp.test.js +127 -0
- package/extensions/Mailer/Smtp.test.js.map +1 -0
- package/extensions/Mailer/SmtpParamsSchema.d.ts +9 -0
- package/extensions/Mailer/SmtpParamsSchema.js +17 -0
- package/extensions/Mailer/SmtpParamsSchema.js.map +1 -0
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.d.ts +1 -1
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js +25 -30
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js.map +1 -1
- package/extensions/OpenSearch/EnsureOsWasDeployed.js +14 -24
- package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -1
- package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.js +25 -21
- package/extensions/OpenSearch/InjectDdbEsLambdaFnHandler.js.map +1 -1
- package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js +26 -22
- package/extensions/OpenSearch/ReplaceApiLambdaFnHandlers.js.map +1 -1
- package/extensions/OpenSearch.d.ts +4 -11
- package/extensions/OpenSearch.js +30 -28
- package/extensions/OpenSearch.js.map +1 -1
- package/extensions/ProjectAws/AdminStackOutputService.js +0 -2
- package/extensions/ProjectAws/ApiStackOutputService.js +0 -2
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +65 -70
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/AutoInstall.d.ts +3 -27
- package/extensions/ProjectAws/AutoInstall.js +15 -14
- package/extensions/ProjectAws/AutoInstall.js.map +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.d.ts +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js +15 -19
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.d.ts +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js +56 -45
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js.map +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js +57 -55
- package/extensions/ProjectAws/BlueGreenDeployments/SetPrimaryVariantCliCommand.js.map +1 -1
- package/extensions/ProjectAws/BuildAppWorkspace.js +49 -54
- package/extensions/ProjectAws/BuildAppWorkspace.js.map +1 -1
- package/extensions/ProjectAws/CoreStackOutputService.js +0 -2
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.d.ts +10 -0
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +36 -0
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -0
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js +25 -38
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVars.js.map +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js +22 -17
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeBuild.js.map +1 -1
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js +22 -17
- package/extensions/ProjectAws/SetAdminEnvVars/SetAdminEnvVarsBeforeWatch.js.map +1 -1
- package/extensions/ProjectAws/SetDatabaseSetupOutput.d.ts +5 -3
- package/extensions/ProjectAws/SetDatabaseSetupOutput.js +22 -22
- package/extensions/ProjectAws/SetDatabaseSetupOutput.js.map +1 -1
- package/extensions/ProjectAws/UploadAdminAppToS3.d.ts +1 -1
- package/extensions/ProjectAws/UploadAdminAppToS3.js +53 -58
- package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
- package/extensions/ProjectAws/definitions.js +13 -6
- package/extensions/ProjectAws/definitions.js.map +1 -1
- package/extensions/ProjectAws.js +45 -45
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/RegisterRoutesPulumi.d.ts +12 -0
- package/extensions/RegisterRoutesPulumi.js +37 -0
- package/extensions/RegisterRoutesPulumi.js.map +1 -0
- package/extensions/definitions.js +12 -2
- package/extensions/definitions.js.map +1 -1
- package/extensions/index.d.ts +3 -0
- package/extensions/index.js +3 -2
- package/features/ApiGqlClient.js +46 -51
- package/features/ApiGqlClient.js.map +1 -1
- package/features/InvokeLambdaFunction.js +30 -32
- package/features/InvokeLambdaFunction.js.map +1 -1
- package/features/index.js +0 -2
- package/index.js +0 -2
- package/infra.d.ts +110 -348
- package/infra.js +59 -48
- package/infra.js.map +1 -1
- package/package.json +31 -30
- package/project.d.ts +22 -116
- package/project.js +7 -6
- package/project.js.map +1 -1
- package/pulumi/apps/admin/createAdminPulumiApp.js +38 -44
- package/pulumi/apps/admin/createAdminPulumiApp.js.map +1 -1
- package/pulumi/apps/admin/index.js +0 -2
- package/pulumi/apps/api/ApiBackgroundTask.js +153 -137
- package/pulumi/apps/api/ApiBackgroundTask.js.map +1 -1
- package/pulumi/apps/api/ApiCloudfront.js +188 -130
- package/pulumi/apps/api/ApiCloudfront.js.map +1 -1
- package/pulumi/apps/api/ApiFileManager.js +34 -33
- package/pulumi/apps/api/ApiFileManager.js.map +1 -1
- package/pulumi/apps/api/ApiGateway.js +67 -71
- package/pulumi/apps/api/ApiGateway.js.map +1 -1
- package/pulumi/apps/api/ApiGraphql.js +223 -152
- package/pulumi/apps/api/ApiGraphql.js.map +1 -1
- package/pulumi/apps/api/ApiOutput.d.ts +0 -1
- package/pulumi/apps/api/ApiOutput.js +29 -31
- package/pulumi/apps/api/ApiOutput.js.map +1 -1
- package/pulumi/apps/api/ApiScheduler.js +94 -92
- package/pulumi/apps/api/ApiScheduler.js.map +1 -1
- package/pulumi/apps/api/ApiWebsocket.js +141 -133
- package/pulumi/apps/api/ApiWebsocket.js.map +1 -1
- package/pulumi/apps/api/backgroundTask/definition.js +122 -144
- package/pulumi/apps/api/backgroundTask/definition.js.map +1 -1
- package/pulumi/apps/api/backgroundTask/policy.js +37 -23
- package/pulumi/apps/api/backgroundTask/policy.js.map +1 -1
- package/pulumi/apps/api/backgroundTask/role.js +29 -29
- package/pulumi/apps/api/backgroundTask/role.js.map +1 -1
- package/pulumi/apps/api/backgroundTask/types.js +9 -11
- package/pulumi/apps/api/backgroundTask/types.js.map +1 -1
- package/pulumi/apps/api/createApiPulumiApp.d.ts +0 -3
- package/pulumi/apps/api/createApiPulumiApp.js +210 -261
- package/pulumi/apps/api/createApiPulumiApp.js.map +1 -1
- package/pulumi/apps/api/handleGuardDutyEvents.js +54 -51
- package/pulumi/apps/api/handleGuardDutyEvents.js.map +1 -1
- package/pulumi/apps/api/index.d.ts +0 -1
- package/pulumi/apps/api/index.js +0 -3
- package/pulumi/apps/awsUtils.js +21 -24
- package/pulumi/apps/awsUtils.js.map +1 -1
- package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js +37 -40
- package/pulumi/apps/blueGreen/BlueGreenRouterApiGateway.js.map +1 -1
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js +83 -91
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFront.js.map +1 -1
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js +17 -16
- package/pulumi/apps/blueGreen/BlueGreenRouterCloudFrontStore.js.map +1 -1
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js +13 -12
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontDefaultCacheBehaviorPolicies.js.map +1 -1
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.js +9 -14
- package/pulumi/apps/blueGreen/cloudfront/createCloudFrontFunctionDomainMap.js.map +1 -1
- package/pulumi/apps/blueGreen/cloudfront/createOriginId.js +5 -7
- package/pulumi/apps/blueGreen/cloudfront/createOriginId.js.map +1 -1
- package/pulumi/apps/blueGreen/constants.js +15 -3
- package/pulumi/apps/blueGreen/constants.js.map +1 -1
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js +77 -103
- package/pulumi/apps/blueGreen/createBlueGreenPulumiApp.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js +20 -26
- package/pulumi/apps/blueGreen/domains/attachDomainsToOutput.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/convertApplicationDomains.js +17 -20
- package/pulumi/apps/blueGreen/domains/convertApplicationDomains.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js +51 -61
- package/pulumi/apps/blueGreen/domains/getApplicationDomains.js.map +1 -1
- package/pulumi/apps/blueGreen/domains/resolveDomains.js +24 -38
- package/pulumi/apps/blueGreen/domains/resolveDomains.js.map +1 -1
- package/pulumi/apps/blueGreen/functions/buildHandlerFunction.js +7 -14
- package/pulumi/apps/blueGreen/functions/buildHandlerFunction.js.map +1 -1
- package/pulumi/apps/blueGreen/functions/handler.js +1 -56
- package/pulumi/apps/blueGreen/functions/handler.js.map +1 -1
- package/pulumi/apps/blueGreen/types.js +0 -3
- package/pulumi/apps/blueGreen/validation/validateDeployments.js +19 -24
- package/pulumi/apps/blueGreen/validation/validateDeployments.js.map +1 -1
- package/pulumi/apps/common/CoreOutput.d.ts +0 -4
- package/pulumi/apps/common/CoreOutput.js +34 -41
- package/pulumi/apps/common/CoreOutput.js.map +1 -1
- package/pulumi/apps/common/VpcConfig.js +20 -20
- package/pulumi/apps/common/VpcConfig.js.map +1 -1
- package/pulumi/apps/common/index.js +0 -2
- package/pulumi/apps/core/CoreAuditLogsDynamo.js +245 -182
- package/pulumi/apps/core/CoreAuditLogsDynamo.js.map +1 -1
- package/pulumi/apps/core/CoreCognito.js +117 -106
- package/pulumi/apps/core/CoreCognito.js.map +1 -1
- package/pulumi/apps/core/CoreDynamo.js +91 -70
- package/pulumi/apps/core/CoreDynamo.js.map +1 -1
- package/pulumi/apps/core/CoreEventBus.js +10 -9
- package/pulumi/apps/core/CoreEventBus.js.map +1 -1
- package/pulumi/apps/core/CoreFileManager.js +76 -68
- package/pulumi/apps/core/CoreFileManager.js.map +1 -1
- package/pulumi/apps/core/CoreOpenSearch.d.ts +2 -0
- package/pulumi/apps/core/CoreOpenSearch.js +281 -278
- package/pulumi/apps/core/CoreOpenSearch.js.map +1 -1
- package/pulumi/apps/core/CoreVpc.js +155 -156
- package/pulumi/apps/core/CoreVpc.js.map +1 -1
- package/pulumi/apps/core/WatchCommand.js +94 -96
- package/pulumi/apps/core/WatchCommand.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/amazon.js +16 -22
- package/pulumi/apps/core/cognitoIdentityProviders/amazon.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/apple.js +16 -17
- package/pulumi/apps/core/cognitoIdentityProviders/apple.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js +44 -50
- package/pulumi/apps/core/cognitoIdentityProviders/configure.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/facebook.js +16 -17
- package/pulumi/apps/core/cognitoIdentityProviders/facebook.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.js +7 -8
- package/pulumi/apps/core/cognitoIdentityProviders/getIdpConfig.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/google.js +16 -17
- package/pulumi/apps/core/cognitoIdentityProviders/google.js.map +1 -1
- package/pulumi/apps/core/cognitoIdentityProviders/index.js +0 -2
- package/pulumi/apps/core/cognitoIdentityProviders/oidc.js +17 -18
- package/pulumi/apps/core/cognitoIdentityProviders/oidc.js.map +1 -1
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js +251 -188
- package/pulumi/apps/core/configureS3BucketMalwareProtection.js.map +1 -1
- package/pulumi/apps/core/createCorePulumiApp.d.ts +0 -1
- package/pulumi/apps/core/createCorePulumiApp.js +214 -268
- package/pulumi/apps/core/createCorePulumiApp.js.map +1 -1
- package/pulumi/apps/core/index.js +0 -2
- package/pulumi/apps/core/webinyWatchCommand/handler.js +45 -32
- package/pulumi/apps/core/webinyWatchCommand/handler.js.map +1 -1
- package/pulumi/apps/createAppBucket.js +157 -146
- package/pulumi/apps/createAppBucket.js.map +1 -1
- package/pulumi/apps/customDomain.js +7 -6
- package/pulumi/apps/customDomain.js.map +1 -1
- package/pulumi/apps/extensions/getAwsTagsFromExtension.js +8 -7
- package/pulumi/apps/extensions/getAwsTagsFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.d.ts +4 -6
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js +6 -7
- package/pulumi/apps/extensions/getBgDeploymentsConfigFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/getOsConfigFromExtension.d.ts +3 -0
- package/pulumi/apps/extensions/getOsConfigFromExtension.js +17 -29
- package/pulumi/apps/extensions/getOsConfigFromExtension.js.map +1 -1
- package/pulumi/apps/extensions/getVpcConfigFromExtension.js +13 -25
- package/pulumi/apps/extensions/getVpcConfigFromExtension.js.map +1 -1
- package/pulumi/apps/index.js +0 -3
- package/pulumi/apps/lambdaUtils.js +57 -61
- package/pulumi/apps/lambdaUtils.js.map +1 -1
- package/pulumi/apps/react/createReactPulumiApp.js +108 -129
- package/pulumi/apps/react/createReactPulumiApp.js.map +1 -1
- package/pulumi/apps/react/index.js +0 -2
- package/pulumi/apps/syncSystem/SyncSystemDynamo.js +77 -52
- package/pulumi/apps/syncSystem/SyncSystemDynamo.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js +74 -47
- package/pulumi/apps/syncSystem/SyncSystemDynamoDb.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemEventBus.js +77 -71
- package/pulumi/apps/syncSystem/SyncSystemEventBus.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemLambda.js +154 -87
- package/pulumi/apps/syncSystem/SyncSystemLambda.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemOutput.js +14 -13
- package/pulumi/apps/syncSystem/SyncSystemOutput.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js +56 -60
- package/pulumi/apps/syncSystem/SyncSystemResolverLambda.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemSQS.js +25 -49
- package/pulumi/apps/syncSystem/SyncSystemSQS.js.map +1 -1
- package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js +44 -43
- package/pulumi/apps/syncSystem/SyncSystemWorkerLambda.js.map +1 -1
- package/pulumi/apps/syncSystem/addTableItems.js +35 -45
- package/pulumi/apps/syncSystem/addTableItems.js.map +1 -1
- package/pulumi/apps/syncSystem/api/addServiceManifest.js +12 -14
- package/pulumi/apps/syncSystem/api/addServiceManifest.js.map +1 -1
- package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js +49 -55
- package/pulumi/apps/syncSystem/api/attachCognitoPermissions.js.map +1 -1
- package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js +88 -40
- package/pulumi/apps/syncSystem/api/attachDynamoDbPermissions.js.map +1 -1
- package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js +37 -43
- package/pulumi/apps/syncSystem/api/attachEventBusPermissions.js.map +1 -1
- package/pulumi/apps/syncSystem/api/attachS3Permissions.js +51 -47
- package/pulumi/apps/syncSystem/api/attachS3Permissions.js.map +1 -1
- package/pulumi/apps/syncSystem/api/index.js +28 -46
- package/pulumi/apps/syncSystem/api/index.js.map +1 -1
- package/pulumi/apps/syncSystem/constants.js +2 -1
- package/pulumi/apps/syncSystem/constants.js.map +1 -1
- package/pulumi/apps/syncSystem/createSyncResourceName.js +2 -7
- package/pulumi/apps/syncSystem/createSyncResourceName.js.map +1 -1
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js +101 -166
- package/pulumi/apps/syncSystem/createSyncSystemPulumiApp.js.map +1 -1
- package/pulumi/apps/syncSystem/customApp.js +12 -16
- package/pulumi/apps/syncSystem/customApp.js.map +1 -1
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js +5 -6
- package/pulumi/apps/syncSystem/getSyncSystemOutput.js.map +1 -1
- package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js +108 -42
- package/pulumi/apps/syncSystem/lambda/createSyncSystemResolverLambdaPolicy.js.map +1 -1
- package/pulumi/apps/syncSystem/types.js +0 -3
- package/pulumi/constants.js +2 -1
- package/pulumi/constants.js.map +1 -1
- package/pulumi/env/awsRegion.js +3 -2
- package/pulumi/env/awsRegion.js.map +1 -1
- package/pulumi/env/base.js +11 -27
- package/pulumi/env/base.js.map +1 -1
- package/pulumi/env/env.js +3 -2
- package/pulumi/env/env.js.map +1 -1
- package/pulumi/env/projectName.js +3 -2
- package/pulumi/env/projectName.js.map +1 -1
- package/pulumi/env/variant.js +4 -3
- package/pulumi/env/variant.js.map +1 -1
- package/pulumi/extensions/AdminCustomDomains.d.ts +7 -12
- package/pulumi/extensions/AdminCustomDomains.js +15 -11
- package/pulumi/extensions/AdminCustomDomains.js.map +1 -1
- package/pulumi/extensions/AdminPulumi.d.ts +4 -0
- package/pulumi/extensions/AdminPulumi.js +22 -0
- package/pulumi/extensions/AdminPulumi.js.map +1 -0
- package/pulumi/extensions/ApiCustomDomains.d.ts +9 -0
- package/pulumi/extensions/ApiCustomDomains.js +20 -0
- package/pulumi/extensions/ApiCustomDomains.js.map +1 -0
- package/pulumi/extensions/ApiPulumi.d.ts +4 -0
- package/pulumi/extensions/ApiPulumi.js +22 -0
- package/pulumi/extensions/ApiPulumi.js.map +1 -0
- package/pulumi/extensions/AwsTags.d.ts +2 -6
- package/pulumi/extensions/AwsTags.js +11 -10
- package/pulumi/extensions/AwsTags.js.map +1 -1
- package/pulumi/extensions/BlueGreenDeployments.d.ts +15 -115
- package/pulumi/extensions/BlueGreenDeployments.js +29 -25
- package/pulumi/extensions/BlueGreenDeployments.js.map +1 -1
- package/pulumi/extensions/CorePulumi.d.ts +4 -0
- package/pulumi/extensions/CorePulumi.js +22 -0
- package/pulumi/extensions/CorePulumi.js.map +1 -0
- package/pulumi/extensions/OpenSearch.d.ts +5 -12
- package/pulumi/extensions/OpenSearch.js +16 -12
- package/pulumi/extensions/OpenSearch.js.map +1 -1
- package/pulumi/extensions/Vpc.d.ts +9 -65
- package/pulumi/extensions/Vpc.js +21 -20
- package/pulumi/extensions/Vpc.js.map +1 -1
- package/pulumi/extensions/index.d.ts +40 -187
- package/pulumi/extensions/index.js +16 -6
- package/pulumi/extensions/index.js.map +1 -1
- package/pulumi/features/AdminPulumi/AdminPulumi.d.ts +7 -0
- package/pulumi/features/AdminPulumi/AdminPulumi.js +25 -0
- package/pulumi/features/AdminPulumi/AdminPulumi.js.map +1 -0
- package/pulumi/features/AdminPulumi/index.d.ts +1 -0
- package/pulumi/features/AdminPulumi/index.js +1 -0
- package/pulumi/features/ApiPulumi/ApiPulumi.d.ts +7 -0
- package/pulumi/features/ApiPulumi/ApiPulumi.js +25 -0
- package/pulumi/features/ApiPulumi/ApiPulumi.js.map +1 -0
- package/pulumi/features/ApiPulumi/index.d.ts +1 -0
- package/pulumi/features/ApiPulumi/index.js +1 -0
- package/pulumi/features/CorePulumi/CorePulumi.d.ts +7 -0
- package/pulumi/features/CorePulumi/CorePulumi.js +25 -0
- package/pulumi/features/CorePulumi/CorePulumi.js.map +1 -0
- package/pulumi/features/CorePulumi/index.d.ts +1 -0
- package/pulumi/features/CorePulumi/index.js +1 -0
- package/pulumi/features/index.d.ts +3 -0
- package/pulumi/features/index.js +3 -0
- package/pulumi/index.js +0 -2
- package/pulumi/types.d.ts +0 -5
- package/pulumi/types.js +0 -3
- package/pulumi/utils/addDomainsUrlsOutputs.js +20 -37
- package/pulumi/utils/addDomainsUrlsOutputs.js.map +1 -1
- package/pulumi/utils/addServiceManifestTableItem.js +12 -15
- package/pulumi/utils/addServiceManifestTableItem.js.map +1 -1
- package/pulumi/utils/crawlDirectory.js +10 -15
- package/pulumi/utils/crawlDirectory.js.map +1 -1
- package/pulumi/utils/createAssetArchive.js +5 -6
- package/pulumi/utils/createAssetArchive.js.map +1 -1
- package/pulumi/utils/dynamodb.js +26 -27
- package/pulumi/utils/dynamodb.js.map +1 -1
- package/pulumi/utils/getPresignedPost.d.ts +1 -1
- package/pulumi/utils/getPresignedPost.js +27 -30
- package/pulumi/utils/getPresignedPost.js.map +1 -1
- package/pulumi/utils/index.js +1 -3
- package/pulumi/utils/lambdaEnvVariables.js +42 -54
- package/pulumi/utils/lambdaEnvVariables.js.map +1 -1
- package/pulumi/utils/tagResources.js +248 -28
- package/pulumi/utils/tagResources.js.map +1 -1
- package/pulumi/utils/uploadFolderToS3.js +101 -131
- package/pulumi/utils/uploadFolderToS3.js.map +1 -1
- package/pulumi/utils/withServiceManifest.js +28 -37
- package/pulumi/utils/withServiceManifest.js.map +1 -1
- package/services/AdminStackOutputService.d.ts +1 -1
- package/services/AdminStackOutputService.js +14 -11
- package/services/AdminStackOutputService.js.map +1 -1
- package/services/ApiStackOutputService.d.ts +1 -1
- package/services/ApiStackOutputService.js +14 -11
- package/services/ApiStackOutputService.js.map +1 -1
- package/services/CoreStackOutputService.d.ts +1 -1
- package/services/CoreStackOutputService.js +14 -11
- package/services/CoreStackOutputService.js.map +1 -1
- package/utils/getTemplatesFolderPath.js +9 -11
- package/utils/getTemplatesFolderPath.js.map +1 -1
- package/utils/index.js +0 -2
- package/_templates/appTemplates/api/migration/src/index.ts +0 -23
- package/_templates/appTemplates/api/migration/tsconfig.json +0 -6
- package/_templates/appTemplates/api/migration/webiny.config.ts +0 -8
- package/_templates/extensions/OpenSearch/api/migration/src/index.ts +0 -33
- package/abstractions/index.js.map +0 -1
- package/apps/index.js.map +0 -1
- package/exports/extensions.js.map +0 -1
- package/exports/infra/admin.js.map +0 -1
- package/exports/infra/api.js.map +0 -1
- package/exports/infra/core.js.map +0 -1
- package/exports/infra/index.js +0 -3
- package/exports/infra/index.js.map +0 -1
- package/extensions/ProjectAws/AdminStackOutputService.js.map +0 -1
- package/extensions/ProjectAws/ApiStackOutputService.js.map +0 -1
- package/extensions/ProjectAws/CoreStackOutputService.js.map +0 -1
- package/extensions/ProjectAws/ExecuteDataMigrations.d.ts +0 -16
- package/extensions/ProjectAws/ExecuteDataMigrations.js +0 -69
- package/extensions/ProjectAws/ExecuteDataMigrations.js.map +0 -1
- package/extensions/index.js.map +0 -1
- package/features/index.js.map +0 -1
- package/index.js.map +0 -1
- package/pulumi/apps/admin/index.js.map +0 -1
- package/pulumi/apps/api/ApiMigration.d.ts +0 -5
- package/pulumi/apps/api/ApiMigration.js +0 -83
- package/pulumi/apps/api/ApiMigration.js.map +0 -1
- package/pulumi/apps/api/index.js.map +0 -1
- package/pulumi/apps/blueGreen/types.js.map +0 -1
- package/pulumi/apps/common/index.js.map +0 -1
- package/pulumi/apps/core/LogDynamo.d.ts +0 -5
- package/pulumi/apps/core/LogDynamo.js +0 -122
- package/pulumi/apps/core/LogDynamo.js.map +0 -1
- package/pulumi/apps/core/cognitoIdentityProviders/index.js.map +0 -1
- package/pulumi/apps/core/index.js.map +0 -1
- package/pulumi/apps/index.js.map +0 -1
- package/pulumi/apps/react/index.js.map +0 -1
- package/pulumi/apps/syncSystem/types.js.map +0 -1
- package/pulumi/index.js.map +0 -1
- package/pulumi/types.js.map +0 -1
- package/pulumi/utils/index.js.map +0 -1
- package/utils/index.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -6,63 +6,52 @@ import { replaceInPath } from "replace-in-path";
|
|
|
6
6
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
7
7
|
import { zodSrcPath } from "@webiny/project/defineExtension/zodTypes/zodSrcPath.js";
|
|
8
8
|
import { ExtensionSrcResolver } from "@webiny/project/utils/index.js";
|
|
9
|
-
import { ApiPulumi
|
|
10
|
-
import { ApiPulumi } from "
|
|
9
|
+
import { ApiPulumi } from "../abstractions/features/pulumi/index.js";
|
|
10
|
+
import { ApiPulumi as ApiPulumi_js_ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
|
|
11
11
|
import { getTemplatesFolderPath } from "../utils/index.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
12
|
+
const ApiLambdaFunction = defineExtension({
|
|
13
|
+
type: "Api/LambdaFunction",
|
|
14
|
+
tags: {
|
|
15
|
+
runtimeContext: "app-build",
|
|
16
|
+
appName: "api"
|
|
17
|
+
},
|
|
18
|
+
description: "Add a custom Lambda function to the API app.",
|
|
19
|
+
multiple: true,
|
|
20
|
+
paramsSchema: ({ project })=>z.object({
|
|
21
|
+
functionSrc: zodSrcPath({
|
|
22
|
+
project
|
|
23
|
+
}),
|
|
24
|
+
pulumiSrc: zodSrcPath({
|
|
25
|
+
project,
|
|
26
|
+
abstraction: ApiPulumi
|
|
27
|
+
})
|
|
28
|
+
}),
|
|
29
|
+
async build (params, ctx) {
|
|
30
|
+
const absoluteFunctionSrc = ExtensionSrcResolver.resolvePath(params.functionSrc, ctx.project);
|
|
31
|
+
const functionName = path.parse(absoluteFunctionSrc).name;
|
|
32
|
+
const fnWorkspacePath = ctx.project.paths.workspaceFolder.join("apps", "api", functionName).toString();
|
|
33
|
+
if (!fs.existsSync(fnWorkspacePath)) {
|
|
34
|
+
const templatePath = path.join(getTemplatesFolderPath(), "extensions", "ApiLambdaFunction");
|
|
35
|
+
fs.cpSync(templatePath, fnWorkspacePath, {
|
|
36
|
+
recursive: true
|
|
37
|
+
});
|
|
38
|
+
replaceInPath(path.join(fnWorkspacePath, "package.json"), {
|
|
39
|
+
find: "{{functionName}}",
|
|
40
|
+
replaceWith: functionName
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const srcDir = path.join(fnWorkspacePath, "src");
|
|
44
|
+
fs.mkdirSync(srcDir, {
|
|
45
|
+
recursive: true
|
|
46
|
+
});
|
|
47
|
+
fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, "index.ts"));
|
|
48
|
+
},
|
|
49
|
+
render (props) {
|
|
50
|
+
return /*#__PURE__*/ react.createElement(ApiPulumi_js_ApiPulumi, {
|
|
51
|
+
src: props.pulumiSrc
|
|
52
|
+
});
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
// 2. Copy user's handler file → <functionName>/src/index.ts.
|
|
55
|
-
const srcDir = path.join(fnWorkspacePath, "src");
|
|
56
|
-
fs.mkdirSync(srcDir, {
|
|
57
|
-
recursive: true
|
|
58
|
-
});
|
|
59
|
-
fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, "index.ts"));
|
|
60
|
-
},
|
|
61
|
-
render(props) {
|
|
62
|
-
return /*#__PURE__*/React.createElement(ApiPulumi, {
|
|
63
|
-
src: props.pulumiSrc
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
54
|
});
|
|
55
|
+
export { ApiLambdaFunction };
|
|
67
56
|
|
|
68
57
|
//# sourceMappingURL=ApiLambdaFunction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"extensions/ApiLambdaFunction.js","sources":["../../src/extensions/ApiLambdaFunction.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { z } from \"zod\";\nimport { replaceInPath } from \"replace-in-path\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi as ApiPulumiAbstraction } from \"~/abstractions/features/pulumi/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { getTemplatesFolderPath } from \"~/utils/index.js\";\n\nexport const ApiLambdaFunction = defineExtension({\n type: \"Api/LambdaFunction\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add a custom Lambda function to the API app.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n functionSrc: zodSrcPath({ project }),\n pulumiSrc: zodSrcPath({ project, abstraction: ApiPulumiAbstraction })\n });\n },\n async build(params, ctx) {\n const absoluteFunctionSrc = ExtensionSrcResolver.resolvePath(\n params.functionSrc,\n ctx.project\n );\n\n // Derive function name from the handler file name (without extension).\n const functionName = path.parse(absoluteFunctionSrc).name;\n\n const fnWorkspacePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", functionName)\n .toString();\n\n // 1. Scaffold from template if the folder doesn't exist yet.\n if (!fs.existsSync(fnWorkspacePath)) {\n const templatePath = path.join(\n getTemplatesFolderPath(),\n \"extensions\",\n \"ApiLambdaFunction\"\n );\n\n fs.cpSync(templatePath, fnWorkspacePath, { recursive: true });\n\n // Replace the {{functionName}} placeholder in package.json.\n replaceInPath(path.join(fnWorkspacePath, \"package.json\"), {\n find: \"{{functionName}}\",\n replaceWith: functionName\n });\n }\n\n // 2. Copy user's handler file → <functionName>/src/index.ts.\n const srcDir = path.join(fnWorkspacePath, \"src\");\n fs.mkdirSync(srcDir, { recursive: true });\n fs.copyFileSync(absoluteFunctionSrc, path.join(srcDir, \"index.ts\"));\n },\n render(props) {\n return <ApiPulumi src={props.pulumiSrc} />;\n }\n});\n"],"names":["ApiLambdaFunction","defineExtension","project","z","zodSrcPath","ApiPulumiAbstraction","params","ctx","absoluteFunctionSrc","ExtensionSrcResolver","functionName","path","fnWorkspacePath","fs","templatePath","getTemplatesFolderPath","replaceInPath","srcDir","props","ApiPulumi"],"mappings":";;;;;;;;;;;AAYO,MAAMA,oBAAoBC,gBAAgB;IAC7C,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,aAAaC,WAAW;gBAAEF;YAAQ;YAClC,WAAWE,WAAW;gBAAEF;gBAAS,aAAaG;YAAqB;QACvE;IAEJ,MAAM,OAAMC,MAAM,EAAEC,GAAG;QACnB,MAAMC,sBAAsBC,qBAAqB,WAAW,CACxDH,OAAO,WAAW,EAClBC,IAAI,OAAO;QAIf,MAAMG,eAAeC,KAAK,KAAK,CAACH,qBAAqB,IAAI;QAEzD,MAAMI,kBAAkBL,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACpD,IAAI,CAAC,QAAQ,OAAOG,cACpB,QAAQ;QAGb,IAAI,CAACG,GAAG,UAAU,CAACD,kBAAkB;YACjC,MAAME,eAAeH,KAAK,IAAI,CAC1BI,0BACA,cACA;YAGJF,GAAG,MAAM,CAACC,cAAcF,iBAAiB;gBAAE,WAAW;YAAK;YAG3DI,cAAcL,KAAK,IAAI,CAACC,iBAAiB,iBAAiB;gBACtD,MAAM;gBACN,aAAaF;YACjB;QACJ;QAGA,MAAMO,SAASN,KAAK,IAAI,CAACC,iBAAiB;QAC1CC,GAAG,SAAS,CAACI,QAAQ;YAAE,WAAW;QAAK;QACvCJ,GAAG,YAAY,CAACL,qBAAqBG,KAAK,IAAI,CAACM,QAAQ;IAC3D;IACA,QAAOC,KAAK;QACR,OAAO,WAAP,GAAO,oBAACC,wBAASA;YAAC,KAAKD,MAAM,SAAS;;IAC1C;AACJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ApiRoute: import("@webiny/project/extensions").ExtensionComponent<z.ZodObject<{
|
|
3
|
+
path: z.ZodString;
|
|
4
|
+
method: z.ZodEnum<{
|
|
5
|
+
POST: "POST";
|
|
6
|
+
GET: "GET";
|
|
7
|
+
PUT: "PUT";
|
|
8
|
+
HEAD: "HEAD";
|
|
9
|
+
OPTIONS: "OPTIONS";
|
|
10
|
+
PATCH: "PATCH";
|
|
11
|
+
DELETE: "DELETE";
|
|
12
|
+
ANY: "ANY";
|
|
13
|
+
}>;
|
|
14
|
+
src: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
15
|
+
routeName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import crypto_0 from "crypto";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { Node, Project } from "ts-morph";
|
|
6
|
+
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
7
|
+
import { zodSrcPath } from "@webiny/project/defineExtension/zodTypes/zodSrcPath.js";
|
|
8
|
+
import { ExtensionSrcResolver } from "@webiny/project/utils/index.js";
|
|
9
|
+
import { ApiPulumi } from "../pulumi/extensions/ApiPulumi.js";
|
|
10
|
+
import { createPathResolver } from "@webiny/project";
|
|
11
|
+
const p = createPathResolver(import.meta.dirname);
|
|
12
|
+
const HTTP_METHODS = [
|
|
13
|
+
"DELETE",
|
|
14
|
+
"GET",
|
|
15
|
+
"HEAD",
|
|
16
|
+
"PATCH",
|
|
17
|
+
"POST",
|
|
18
|
+
"PUT",
|
|
19
|
+
"OPTIONS",
|
|
20
|
+
"ANY"
|
|
21
|
+
];
|
|
22
|
+
const METHOD_HANDLER = {
|
|
23
|
+
DELETE: "onDelete",
|
|
24
|
+
GET: "onGet",
|
|
25
|
+
HEAD: "onHead",
|
|
26
|
+
PATCH: "onPatch",
|
|
27
|
+
POST: "onPost",
|
|
28
|
+
PUT: "onPut",
|
|
29
|
+
OPTIONS: "onOptions",
|
|
30
|
+
ANY: "onAll"
|
|
31
|
+
};
|
|
32
|
+
const ApiRoute = defineExtension({
|
|
33
|
+
type: "Api/Route",
|
|
34
|
+
tags: {
|
|
35
|
+
runtimeContext: "app-build",
|
|
36
|
+
appName: "api"
|
|
37
|
+
},
|
|
38
|
+
description: "Register a custom REST route on the API Gateway + GraphQL Lambda.",
|
|
39
|
+
multiple: true,
|
|
40
|
+
paramsSchema: ({ project })=>z.object({
|
|
41
|
+
path: z.string().startsWith("/"),
|
|
42
|
+
method: z["enum"](HTTP_METHODS),
|
|
43
|
+
src: zodSrcPath({
|
|
44
|
+
project
|
|
45
|
+
}),
|
|
46
|
+
routeName: z.string().optional()
|
|
47
|
+
}),
|
|
48
|
+
async build (params, ctx) {
|
|
49
|
+
const extensionsTsFilePath = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "extensions.ts").toString();
|
|
50
|
+
const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);
|
|
51
|
+
const hash = crypto_0.createHash("sha256").update(params.src).digest("hex");
|
|
52
|
+
const alias = `ApiRoute_${hash.slice(-10)}`;
|
|
53
|
+
const importPath = path.relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath).replace(/\.tsx?$/, ".js");
|
|
54
|
+
const tsProject = new Project();
|
|
55
|
+
tsProject.addSourceFileAtPath(extensionsTsFilePath);
|
|
56
|
+
const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);
|
|
57
|
+
if (source.getImportDeclaration(importPath)) return;
|
|
58
|
+
let insertIndex = 1;
|
|
59
|
+
const importDeclarations = source.getImportDeclarations();
|
|
60
|
+
if (importDeclarations.length) insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;
|
|
61
|
+
source.insertImportDeclaration(insertIndex, {
|
|
62
|
+
defaultImport: alias,
|
|
63
|
+
moduleSpecifier: importPath
|
|
64
|
+
});
|
|
65
|
+
const ctxPluginPath = "@webiny/api/plugins/ContextPlugin.js";
|
|
66
|
+
if (!source.getImportDeclaration(ctxPluginPath)) {
|
|
67
|
+
const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
|
|
68
|
+
source.insertImportDeclaration(lastIdx, {
|
|
69
|
+
namedImports: [
|
|
70
|
+
"createContextPlugin"
|
|
71
|
+
],
|
|
72
|
+
moduleSpecifier: ctxPluginPath
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const handlerImportPath = "@webiny/handler";
|
|
76
|
+
const existingHandlerImport = source.getImportDeclaration(handlerImportPath);
|
|
77
|
+
const requiredHandlerImports = [
|
|
78
|
+
"createRoute",
|
|
79
|
+
"Route"
|
|
80
|
+
];
|
|
81
|
+
if (existingHandlerImport) {
|
|
82
|
+
const present = existingHandlerImport.getNamedImports().map((i)=>i.getName());
|
|
83
|
+
for (const name of requiredHandlerImports)if (!present.includes(name)) existingHandlerImport.addNamedImport(name);
|
|
84
|
+
} else {
|
|
85
|
+
const lastIdx = source.getImportDeclarations()[source.getImportDeclarations().length - 1].getChildIndex() + 1;
|
|
86
|
+
source.insertImportDeclaration(lastIdx, {
|
|
87
|
+
namedImports: requiredHandlerImports,
|
|
88
|
+
moduleSpecifier: handlerImportPath
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const onMethod = METHOD_HANDLER[params.method];
|
|
92
|
+
const routePath = params.path;
|
|
93
|
+
const pluginsArray = source.getFirstDescendant((node)=>Node.isArrayLiteralExpression(node));
|
|
94
|
+
pluginsArray.addElement(`\ncreateContextPlugin(ctx => {\n\tregisterExtension(ctx.container, ${alias});\n})`);
|
|
95
|
+
pluginsArray.addElement(`\ncreateRoute(({ ${onMethod}, context }) => {\n\t${onMethod}("${routePath}", async (request, reply) => {\n\t\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\n\t\treturn instance.execute(request, reply);\n\t});\n})`);
|
|
96
|
+
await source.save();
|
|
97
|
+
},
|
|
98
|
+
render () {
|
|
99
|
+
return /*#__PURE__*/ react.createElement(ApiPulumi, {
|
|
100
|
+
src: p("RegisterRoutesPulumi.js")
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export { ApiRoute };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=ApiRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/ApiRoute.js","sources":["../../src/extensions/ApiRoute.tsx"],"sourcesContent":["import React from \"react\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { zodSrcPath } from \"@webiny/project/defineExtension/zodTypes/zodSrcPath.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project/utils/index.js\";\nimport { ApiPulumi } from \"~/pulumi/extensions/ApiPulumi.js\";\nimport { createPathResolver } from \"@webiny/project\";\n\nconst p = createPathResolver(import.meta.dirname);\n\nconst HTTP_METHODS = [\"DELETE\", \"GET\", \"HEAD\", \"PATCH\", \"POST\", \"PUT\", \"OPTIONS\", \"ANY\"] as const;\n\nconst METHOD_HANDLER: Record<string, string> = {\n DELETE: \"onDelete\",\n GET: \"onGet\",\n HEAD: \"onHead\",\n PATCH: \"onPatch\",\n POST: \"onPost\",\n PUT: \"onPut\",\n OPTIONS: \"onOptions\",\n ANY: \"onAll\"\n};\n\nexport const ApiRoute = defineExtension({\n type: \"Api/Route\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Register a custom REST route on the API Gateway + GraphQL Lambda.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n path: z.string().startsWith(\"/\"),\n method: z.enum(HTTP_METHODS),\n // TODO: add zodSrcPath abstraction validation once Route abstraction is wired to zodSrcPath.\n src: zodSrcPath({ project }),\n routeName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const absoluteSrcFilePath = ExtensionSrcResolver.resolvePath(params.src, ctx.project);\n\n // Stable alias to avoid naming conflicts across multiple routes.\n const hash = crypto.createHash(\"sha256\").update(params.src).digest(\"hex\");\n const alias = `ApiRoute_${hash.slice(-10)}`;\n\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteSrcFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const tsProject = new Project();\n tsProject.addSourceFileAtPath(extensionsTsFilePath);\n const source = tsProject.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Skip if the route handler is already registered.\n if (source.getImportDeclaration(importPath)) {\n return;\n }\n\n // Insert handler import after the last existing import.\n let insertIndex = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n insertIndex = importDeclarations[importDeclarations.length - 1].getChildIndex() + 1;\n }\n\n source.insertImportDeclaration(insertIndex, {\n defaultImport: alias,\n moduleSpecifier: importPath\n });\n\n // Ensure createContextPlugin import exists.\n const ctxPluginPath = \"@webiny/api/plugins/ContextPlugin.js\";\n if (!source.getImportDeclaration(ctxPluginPath)) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: [\"createContextPlugin\"],\n moduleSpecifier: ctxPluginPath\n });\n }\n\n // Ensure createRoute and Route are imported from @webiny/handler.\n const handlerImportPath = \"@webiny/handler\";\n const existingHandlerImport = source.getImportDeclaration(handlerImportPath);\n const requiredHandlerImports = [\"createRoute\", \"Route\"];\n if (!existingHandlerImport) {\n const lastIdx =\n source\n .getImportDeclarations()\n [source.getImportDeclarations().length - 1].getChildIndex() + 1;\n source.insertImportDeclaration(lastIdx, {\n namedImports: requiredHandlerImports,\n moduleSpecifier: handlerImportPath\n });\n } else {\n const present = existingHandlerImport.getNamedImports().map(i => i.getName());\n for (const name of requiredHandlerImports) {\n if (!present.includes(name)) {\n existingHandlerImport.addNamedImport(name);\n }\n }\n }\n\n const onMethod = METHOD_HANDLER[params.method];\n const routePath = params.path as `/${string}`;\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n // Register factory in DI container.\n pluginsArray.addElement(\n `\\ncreateContextPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${alias});\\n})`\n );\n\n // Register Fastify route with hardcoded path/method.\n // We use resolveAll(Route) + instanceof to find the correct handler when multiple\n // Api.Route extensions are registered.\n pluginsArray.addElement(\n `\\ncreateRoute(({ ${onMethod}, context }) => {\\n` +\n `\\t${onMethod}(\"${routePath}\", async (request, reply) => {\\n` +\n `\\t\\tconst instance = context.container.resolveAll(Route).find(i => i instanceof ${alias})!;\\n` +\n `\\t\\treturn instance.execute(request, reply);\\n` +\n `\\t});\\n` +\n `})`\n );\n\n await source.save();\n },\n render() {\n return <ApiPulumi src={p(\"RegisterRoutesPulumi.js\")} />;\n }\n});\n"],"names":["p","createPathResolver","HTTP_METHODS","METHOD_HANDLER","ApiRoute","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","absoluteSrcFilePath","ExtensionSrcResolver","hash","crypto","alias","importPath","path","tsProject","Project","source","insertIndex","importDeclarations","ctxPluginPath","lastIdx","handlerImportPath","existingHandlerImport","requiredHandlerImports","present","i","name","onMethod","routePath","pluginsArray","node","Node","ApiPulumi"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO;AAEhD,MAAMC,eAAe;IAAC;IAAU;IAAO;IAAQ;IAAS;IAAQ;IAAO;IAAW;CAAM;AAExF,MAAMC,iBAAyC;IAC3C,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,KAAK;IACL,SAAS;IACT,KAAK;AACT;AAEO,MAAMC,WAAWC,gBAAgB;IACpC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,MAAMA,EAAE,MAAM,GAAG,UAAU,CAAC;YAC5B,QAAQA,CAAC,CAADA,OAAM,CAACL;YAEf,KAAKM,WAAW;gBAAEF;YAAQ;YAC1B,WAAWC,EAAE,MAAM,GAAG,QAAQ;QAClC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,uBAAuBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACzD,IAAI,CAAC,QAAQ,OAAO,WAAW,OAAO,iBACtC,QAAQ;QAEb,MAAME,sBAAsBC,qBAAqB,WAAW,CAACJ,OAAO,GAAG,EAAEC,IAAI,OAAO;QAGpF,MAAMI,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACN,OAAO,GAAG,EAAE,MAAM,CAAC;QACnE,MAAMO,QAAQ,CAAC,SAAS,EAAEF,KAAK,KAAK,CAAC,MAAM;QAE3C,MAAMG,aAAaC,KAAAA,QACN,CAACA,KAAK,OAAO,CAACP,uBAAuBC,qBAC7C,OAAO,CAAC,WAAW;QAExB,MAAMO,YAAY,IAAIC;QACtBD,UAAU,mBAAmB,CAACR;QAC9B,MAAMU,SAASF,UAAU,oBAAoB,CAACR;QAG9C,IAAIU,OAAO,oBAAoB,CAACJ,aAC5B;QAIJ,IAAIK,cAAc;QAClB,MAAMC,qBAAqBF,OAAO,qBAAqB;QACvD,IAAIE,mBAAmB,MAAM,EACzBD,cAAcC,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;QAGtFF,OAAO,uBAAuB,CAACC,aAAa;YACxC,eAAeN;YACf,iBAAiBC;QACrB;QAGA,MAAMO,gBAAgB;QACtB,IAAI,CAACH,OAAO,oBAAoB,CAACG,gBAAgB;YAC7C,MAAMC,UACFJ,OACK,qBAAqB,EACtB,CAACA,OAAO,qBAAqB,GAAG,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;YACtEA,OAAO,uBAAuB,CAACI,SAAS;gBACpC,cAAc;oBAAC;iBAAsB;gBACrC,iBAAiBD;YACrB;QACJ;QAGA,MAAME,oBAAoB;QAC1B,MAAMC,wBAAwBN,OAAO,oBAAoB,CAACK;QAC1D,MAAME,yBAAyB;YAAC;YAAe;SAAQ;QACvD,IAAKD,uBASE;YACH,MAAME,UAAUF,sBAAsB,eAAe,GAAG,GAAG,CAACG,CAAAA,IAAKA,EAAE,OAAO;YAC1E,KAAK,MAAMC,QAAQH,uBACf,IAAI,CAACC,QAAQ,QAAQ,CAACE,OAClBJ,sBAAsB,cAAc,CAACI;QAGjD,OAhB4B;YACxB,MAAMN,UACFJ,OACK,qBAAqB,EACtB,CAACA,OAAO,qBAAqB,GAAG,MAAM,GAAG,EAAE,CAAC,aAAa,KAAK;YACtEA,OAAO,uBAAuB,CAACI,SAAS;gBACpC,cAAcG;gBACd,iBAAiBF;YACrB;QACJ;QASA,MAAMM,WAAW7B,cAAc,CAACM,OAAO,MAAM,CAAC;QAC9C,MAAMwB,YAAYxB,OAAO,IAAI;QAE7B,MAAMyB,eAAeb,OAAO,kBAAkB,CAACc,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAIlCD,aAAa,UAAU,CACnB,CAAC,mEAAmE,EAAElB,MAAM,MAAM,CAAC;QAMvFkB,aAAa,UAAU,CACnB,CAAC,iBAAiB,EAAEF,SACf,qBAAE,EAAEA,SAAS,EAAE,EAAEC,UACjB,gHAAgF,EAAEjB,MAElF,4DAAO,CAJqC;QAQrD,MAAMK,OAAO,IAAI;IACrB;IACA;QACI,OAAO,WAAP,GAAO,oBAACgB,WAASA;YAAC,KAAKrC,EAAE;;IAC7B;AACJ"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const AwsDefaultRegion: import("@webiny/project/defineExtension/defineExtension").ExtensionComponent<z.ZodObject<{
|
|
3
3
|
name: z.ZodString;
|
|
4
|
-
},
|
|
5
|
-
name: string;
|
|
6
|
-
}, {
|
|
7
|
-
name: string;
|
|
8
|
-
}>>;
|
|
4
|
+
}, z.core.$strip>>;
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
4
4
|
import { EnvVar } from "@webiny/project/extensions/index.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
const AwsDefaultRegion = defineExtension({
|
|
6
|
+
type: "Aws/DefaultRegion",
|
|
7
|
+
tags: {
|
|
8
|
+
runtimeContext: "project"
|
|
9
|
+
},
|
|
10
|
+
description: "Set the default AWS region for the project.",
|
|
11
|
+
paramsSchema: z.object({
|
|
12
|
+
name: z.string().describe("The AWS region name.")
|
|
13
|
+
}),
|
|
14
|
+
render (props) {
|
|
15
|
+
return /*#__PURE__*/ react.createElement(EnvVar, {
|
|
16
|
+
varName: "AWS_REGION",
|
|
17
|
+
value: props.name
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
20
|
});
|
|
21
|
+
export { AwsDefaultRegion };
|
|
21
22
|
|
|
22
23
|
//# sourceMappingURL=AwsDefaultRegion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"extensions/AwsDefaultRegion.js","sources":["../../src/extensions/AwsDefaultRegion.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { EnvVar } from \"@webiny/project/extensions/index.js\";\n\nexport const AwsDefaultRegion = defineExtension({\n type: \"Aws/DefaultRegion\",\n tags: { runtimeContext: \"project\" },\n description: \"Set the default AWS region for the project.\",\n paramsSchema: z.object({\n name: z.string().describe(\"The AWS region name.\")\n }),\n render(props) {\n return <EnvVar varName=\"AWS_REGION\" value={props.name} />;\n }\n});\n"],"names":["AwsDefaultRegion","defineExtension","z","props","EnvVar"],"mappings":";;;;AAKO,MAAMA,mBAAmBC,gBAAgB;IAC5C,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,MAAMA,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC9B;IACA,QAAOC,KAAK;QACR,OAAO,WAAP,GAAO,oBAACC,QAAMA;YAAC,SAAQ;YAAa,OAAOD,MAAM,IAAI;;IACzD;AACJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
4
|
+
import { BuildParam } from "@webiny/project/extensions/index.js";
|
|
5
|
+
const paramsSchema = z.object({
|
|
6
|
+
enabled: z.boolean().describe("Enable compression of model fields before storing in the database.")
|
|
7
|
+
});
|
|
8
|
+
const ModelFieldCompression = defineExtension({
|
|
9
|
+
type: "Api/Cms/ModelFieldCompression",
|
|
10
|
+
tags: {
|
|
11
|
+
runtimeContext: "project"
|
|
12
|
+
},
|
|
13
|
+
description: "Enable or disable compression of Headless CMS model fields at the database storage level.",
|
|
14
|
+
paramsSchema: paramsSchema,
|
|
15
|
+
render (params) {
|
|
16
|
+
return /*#__PURE__*/ react.createElement(BuildParam, {
|
|
17
|
+
paramName: "ContentModelFieldCompression",
|
|
18
|
+
value: params.enabled
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export { ModelFieldCompression };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=ModelFieldCompression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/Cms/ModelFieldCompression.js","sources":["../../../src/extensions/Cms/ModelFieldCompression.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\n\nconst paramsSchema = z.object({\n enabled: z\n .boolean()\n .describe(\"Enable compression of model fields before storing in the database.\")\n});\n\nexport const ModelFieldCompression = defineExtension({\n type: \"Api/Cms/ModelFieldCompression\",\n tags: { runtimeContext: \"project\" },\n description:\n \"Enable or disable compression of Headless CMS model fields at the database storage level.\",\n paramsSchema,\n render(params) {\n return <BuildParam paramName=\"ContentModelFieldCompression\" value={params.enabled} />;\n }\n});\n"],"names":["paramsSchema","z","ModelFieldCompression","defineExtension","params","BuildParam"],"mappings":";;;;AAKA,MAAMA,eAAeC,EAAE,MAAM,CAAC;IAC1B,SAASA,EAAAA,OACG,GACP,QAAQ,CAAC;AAClB;AAEO,MAAMC,wBAAwBC,gBAAgB;IACjD,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aACI;IACJH,cAAAA;IACA,QAAOI,MAAM;QACT,OAAO,WAAP,GAAO,oBAACC,YAAUA;YAAC,WAAU;YAA+B,OAAOD,OAAO,OAAO;;IACrF;AACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const Encryption: import("@webiny/project/defineExtension/defineExtension").ExtensionComponent<z.ZodObject<{
|
|
3
|
+
passphrase: z.ZodString;
|
|
4
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
5
|
+
algorithm: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
"aes-128-gcm": "aes-128-gcm";
|
|
7
|
+
"aes-192-gcm": "aes-192-gcm";
|
|
8
|
+
"aes-256-gcm": "aes-256-gcm";
|
|
9
|
+
}>>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
4
|
+
import { BuildParam } from "@webiny/project/extensions/index.js";
|
|
5
|
+
const SUPPORTED_ALGORITHMS = [
|
|
6
|
+
"aes-128-gcm",
|
|
7
|
+
"aes-192-gcm",
|
|
8
|
+
"aes-256-gcm"
|
|
9
|
+
];
|
|
10
|
+
const Encryption = defineExtension({
|
|
11
|
+
type: "Infra/Encryption",
|
|
12
|
+
tags: {
|
|
13
|
+
runtimeContext: "project"
|
|
14
|
+
},
|
|
15
|
+
description: "Configure the API's EncryptionService.",
|
|
16
|
+
paramsSchema: z.object({
|
|
17
|
+
passphrase: z.string().min(1).describe("The passphrase used to derive the AES encryption key via scrypt."),
|
|
18
|
+
salt: z.string().min(1).optional().describe("Optional scrypt salt. Ensures two projects using the same passphrase derive different encryption keys."),
|
|
19
|
+
algorithm: z["enum"](SUPPORTED_ALGORITHMS).optional().describe("AES-GCM algorithm. Defaults to aes-256-gcm.")
|
|
20
|
+
}),
|
|
21
|
+
render ({ passphrase, salt, algorithm }) {
|
|
22
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(BuildParam, {
|
|
23
|
+
paramName: "EncryptionPassphrase",
|
|
24
|
+
value: passphrase
|
|
25
|
+
}), salt && /*#__PURE__*/ react.createElement(BuildParam, {
|
|
26
|
+
paramName: "EncryptionSalt",
|
|
27
|
+
value: salt
|
|
28
|
+
}), algorithm && /*#__PURE__*/ react.createElement(BuildParam, {
|
|
29
|
+
paramName: "EncryptionAlgorithm",
|
|
30
|
+
value: algorithm
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export { Encryption };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=Encryption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/Encryption.js","sources":["../../src/extensions/Encryption.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\n\nconst SUPPORTED_ALGORITHMS = [\"aes-128-gcm\", \"aes-192-gcm\", \"aes-256-gcm\"] as const;\n\nexport const Encryption = defineExtension({\n type: \"Infra/Encryption\",\n tags: { runtimeContext: \"project\" },\n description: \"Configure the API's EncryptionService.\",\n paramsSchema: z.object({\n passphrase: z\n .string()\n .min(1)\n .describe(\"The passphrase used to derive the AES encryption key via scrypt.\"),\n salt: z\n .string()\n .min(1)\n .optional()\n .describe(\n \"Optional scrypt salt. Ensures two projects using the same passphrase derive different encryption keys.\"\n ),\n algorithm: z\n .enum(SUPPORTED_ALGORITHMS)\n .optional()\n .describe(\"AES-GCM algorithm. Defaults to aes-256-gcm.\")\n }),\n render({ passphrase, salt, algorithm }) {\n return (\n <>\n <BuildParam paramName=\"EncryptionPassphrase\" value={passphrase} />\n {salt && <BuildParam paramName=\"EncryptionSalt\" value={salt} />}\n {algorithm && <BuildParam paramName=\"EncryptionAlgorithm\" value={algorithm} />}\n </>\n );\n }\n});\n"],"names":["SUPPORTED_ALGORITHMS","Encryption","defineExtension","z","passphrase","salt","algorithm","BuildParam"],"mappings":";;;;AAKA,MAAMA,uBAAuB;IAAC;IAAe;IAAe;CAAc;AAEnE,MAAMC,aAAaC,gBAAgB;IACtC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,YAAYA,EAAAA,MACD,GACN,GAAG,CAAC,GACJ,QAAQ,CAAC;QACd,MAAMA,EAAAA,MACK,GACN,GAAG,CAAC,GACJ,QAAQ,GACR,QAAQ,CACL;QAER,WAAWA,CAAC,CAADA,OACF,CAACH,sBACL,QAAQ,GACR,QAAQ,CAAC;IAClB;IACA,QAAO,EAAEI,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAE;QAClC,OAAO,WAAP,GACI,wDACI,oBAACC,YAAUA;YAAC,WAAU;YAAuB,OAAOH;YACnDC,QAAQ,WAARA,GAAQ,oBAACE,YAAUA;YAAC,WAAU;YAAiB,OAAOF;YACtDC,aAAa,WAAbA,GAAa,oBAACC,YAAUA;YAAC,WAAU;YAAsB,OAAOD;;IAG7E;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const Smtp: import("@webiny/project/defineExtension/defineExtension.js").ExtensionComponent<import("zod").ZodObject<{
|
|
2
|
+
host: import("zod").ZodString;
|
|
3
|
+
port: import("zod").ZodNumber;
|
|
4
|
+
user: import("zod").ZodString;
|
|
5
|
+
password: import("zod").ZodString;
|
|
6
|
+
from: import("zod").ZodString;
|
|
7
|
+
replyTo: import("zod").ZodOptional<import("zod").ZodString>;
|
|
8
|
+
}, import("zod/v4/core").$strip>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
|
+
import { BuildParam } from "@webiny/project/extensions/index.js";
|
|
4
|
+
import { SmtpParamsSchema } from "./SmtpParamsSchema.js";
|
|
5
|
+
const Smtp = defineExtension({
|
|
6
|
+
type: "Api/Mailer/Smtp",
|
|
7
|
+
tags: {
|
|
8
|
+
runtimeContext: "project"
|
|
9
|
+
},
|
|
10
|
+
description: "Configure mailer SMTP transport settings via code. Always pass the password through a build-time env var, e.g. `password={process.env.SMTP_PASSWORD!}` — the value is serialized into the build artifact, so hard-coding it would commit the secret to source control.",
|
|
11
|
+
paramsSchema: SmtpParamsSchema,
|
|
12
|
+
render (params) {
|
|
13
|
+
return /*#__PURE__*/ react.createElement(BuildParam, {
|
|
14
|
+
paramName: "Mailer.SmtpSettings",
|
|
15
|
+
value: params
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export { Smtp };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=Smtp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions/Mailer/Smtp.js","sources":["../../../src/extensions/Mailer/Smtp.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { BuildParam } from \"@webiny/project/extensions/index.js\";\nimport { SmtpParamsSchema } from \"./SmtpParamsSchema.js\";\n\nexport const Smtp = defineExtension({\n type: \"Api/Mailer/Smtp\",\n tags: { runtimeContext: \"project\" },\n description:\n \"Configure mailer SMTP transport settings via code. Always pass the password through a build-time env var, e.g. `password={process.env.SMTP_PASSWORD!}` — the value is serialized into the build artifact, so hard-coding it would commit the secret to source control.\",\n paramsSchema: SmtpParamsSchema,\n render(params) {\n return <BuildParam paramName=\"Mailer.SmtpSettings\" value={params} />;\n }\n});\n"],"names":["Smtp","defineExtension","SmtpParamsSchema","params","BuildParam"],"mappings":";;;;AAKO,MAAMA,OAAOC,gBAAgB;IAChC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aACI;IACJ,cAAcC;IACd,QAAOC,MAAM;QACT,OAAO,WAAP,GAAO,oBAACC,YAAUA;YAAC,WAAU;YAAsB,OAAOD;;IAC9D;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { SmtpParamsSchema } from "./SmtpParamsSchema.js";
|
|
3
|
+
const validParams = {
|
|
4
|
+
host: "smtp.example.com",
|
|
5
|
+
port: 587,
|
|
6
|
+
user: "smtp-user",
|
|
7
|
+
password: "secret",
|
|
8
|
+
from: "Webiny <test@webiny.com>",
|
|
9
|
+
replyTo: "No-reply <no-reply@webiny.com>"
|
|
10
|
+
};
|
|
11
|
+
describe("Smtp paramsSchema", ()=>{
|
|
12
|
+
describe("valid inputs", ()=>{
|
|
13
|
+
it("accepts a complete valid config", async ()=>{
|
|
14
|
+
const result = await SmtpParamsSchema.safeParseAsync(validParams);
|
|
15
|
+
expect(result.success).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it("accepts config without replyTo (it is optional)", async ()=>{
|
|
18
|
+
const { replyTo: _, ...params } = validParams;
|
|
19
|
+
const result = await SmtpParamsSchema.safeParseAsync(params);
|
|
20
|
+
expect(result.success).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
it("accepts bare addr-spec for from and replyTo", async ()=>{
|
|
23
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
24
|
+
...validParams,
|
|
25
|
+
from: "test@webiny.com",
|
|
26
|
+
replyTo: "no-reply@webiny.com"
|
|
27
|
+
});
|
|
28
|
+
expect(result.success).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("react-properties serialization bug", ()=>{
|
|
32
|
+
it("password={} reproduces the 'expected string, received object' error", async ()=>{
|
|
33
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
34
|
+
...validParams,
|
|
35
|
+
password: {}
|
|
36
|
+
});
|
|
37
|
+
expect(result.success).toBe(false);
|
|
38
|
+
const issue = result.error?.issues[0];
|
|
39
|
+
expect(issue?.code).toBe("invalid_type");
|
|
40
|
+
expect(issue?.path).toEqual([
|
|
41
|
+
"password"
|
|
42
|
+
]);
|
|
43
|
+
expect(issue?.message).toBe("Invalid input: expected string, received object");
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("required string fields", ()=>{
|
|
47
|
+
it("rejects missing host", async ()=>{
|
|
48
|
+
const { host: _, ...params } = validParams;
|
|
49
|
+
const result = await SmtpParamsSchema.safeParseAsync(params);
|
|
50
|
+
expect(result.success).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
it("rejects empty host", async ()=>{
|
|
53
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
54
|
+
...validParams,
|
|
55
|
+
host: ""
|
|
56
|
+
});
|
|
57
|
+
expect(result.success).toBe(false);
|
|
58
|
+
});
|
|
59
|
+
it("rejects missing user", async ()=>{
|
|
60
|
+
const { user: _, ...params } = validParams;
|
|
61
|
+
const result = await SmtpParamsSchema.safeParseAsync(params);
|
|
62
|
+
expect(result.success).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
it("rejects empty user", async ()=>{
|
|
65
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
66
|
+
...validParams,
|
|
67
|
+
user: ""
|
|
68
|
+
});
|
|
69
|
+
expect(result.success).toBe(false);
|
|
70
|
+
});
|
|
71
|
+
it("rejects missing password", async ()=>{
|
|
72
|
+
const { password: _, ...params } = validParams;
|
|
73
|
+
const result = await SmtpParamsSchema.safeParseAsync(params);
|
|
74
|
+
expect(result.success).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
it("rejects empty password", async ()=>{
|
|
77
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
78
|
+
...validParams,
|
|
79
|
+
password: ""
|
|
80
|
+
});
|
|
81
|
+
expect(result.success).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
describe("port validation", ()=>{
|
|
85
|
+
it("rejects port 0", async ()=>{
|
|
86
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
87
|
+
...validParams,
|
|
88
|
+
port: 0
|
|
89
|
+
});
|
|
90
|
+
expect(result.success).toBe(false);
|
|
91
|
+
});
|
|
92
|
+
it("rejects negative port", async ()=>{
|
|
93
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
94
|
+
...validParams,
|
|
95
|
+
port: -1
|
|
96
|
+
});
|
|
97
|
+
expect(result.success).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
it("rejects fractional port", async ()=>{
|
|
100
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
101
|
+
...validParams,
|
|
102
|
+
port: 587.5
|
|
103
|
+
});
|
|
104
|
+
expect(result.success).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe("email address validation", ()=>{
|
|
108
|
+
it("rejects invalid from address", async ()=>{
|
|
109
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
110
|
+
...validParams,
|
|
111
|
+
from: "not-an-email"
|
|
112
|
+
});
|
|
113
|
+
expect(result.success).toBe(false);
|
|
114
|
+
expect(result.error?.issues[0].message).toBe("Invalid email address.");
|
|
115
|
+
});
|
|
116
|
+
it("rejects invalid replyTo address", async ()=>{
|
|
117
|
+
const result = await SmtpParamsSchema.safeParseAsync({
|
|
118
|
+
...validParams,
|
|
119
|
+
replyTo: "not-an-email"
|
|
120
|
+
});
|
|
121
|
+
expect(result.success).toBe(false);
|
|
122
|
+
expect(result.error?.issues[0].message).toBe("Invalid email address.");
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
//# sourceMappingURL=Smtp.test.js.map
|