@webiny/project-aws 6.6.0-alpha.10 → 6.6.0-alpha.11
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/AwsProjectSdk.d.ts +38 -0
- package/AwsProjectSdk.js +61 -0
- package/AwsProjectSdk.js.map +1 -0
- package/abstractions/features/DestroyApp.d.ts +18 -0
- package/abstractions/features/DestroyApp.js +5 -0
- package/abstractions/features/DestroyApp.js.map +1 -0
- package/abstractions/features/ExportStack.d.ts +18 -0
- package/abstractions/features/ExportStack.js +5 -0
- package/abstractions/features/ExportStack.js.map +1 -0
- package/abstractions/features/GetAppOutput.d.ts +18 -0
- package/abstractions/features/GetAppOutput.js +5 -0
- package/abstractions/features/GetAppOutput.js.map +1 -0
- package/abstractions/features/GetAppStackOutput.d.ts +18 -0
- package/abstractions/features/GetAppStackOutput.js +5 -0
- package/abstractions/features/GetAppStackOutput.js.map +1 -0
- package/abstractions/features/GetPulumiResourceNamePrefix.d.ts +7 -0
- package/abstractions/features/GetPulumiResourceNamePrefix.js +5 -0
- package/abstractions/features/GetPulumiResourceNamePrefix.js.map +1 -0
- package/abstractions/features/RefreshApp.d.ts +18 -0
- package/abstractions/features/RefreshApp.js +5 -0
- package/abstractions/features/RefreshApp.js.map +1 -0
- package/abstractions/features/RunPulumiCommand.d.ts +19 -0
- package/abstractions/features/RunPulumiCommand.js +5 -0
- package/abstractions/features/RunPulumiCommand.js.map +1 -0
- package/abstractions/index.d.ts +21 -0
- package/abstractions/index.js +21 -0
- package/abstractions/pulumiTypes.d.ts +3 -0
- package/abstractions/services/GetPulumiService.d.ts +20 -0
- package/abstractions/services/GetPulumiService.js +5 -0
- package/abstractions/services/GetPulumiService.js.map +1 -0
- package/abstractions/services/GetPulumiVersionService.d.ts +12 -0
- package/abstractions/services/GetPulumiVersionService.js +5 -0
- package/abstractions/services/GetPulumiVersionService.js.map +1 -0
- package/abstractions/services/IsRemotePulumiBackendService.d.ts +7 -0
- package/abstractions/services/IsRemotePulumiBackendService.js +5 -0
- package/abstractions/services/IsRemotePulumiBackendService.js.map +1 -0
- package/abstractions/services/ListAppLambdaFunctionsService.d.ts +23 -0
- package/abstractions/services/ListAppLambdaFunctionsService.js +5 -0
- package/abstractions/services/ListAppLambdaFunctionsService.js.map +1 -0
- package/abstractions/services/ListDeployedEnvironmentsService.d.ts +12 -0
- package/abstractions/services/ListDeployedEnvironmentsService.js +5 -0
- package/abstractions/services/ListDeployedEnvironmentsService.js.map +1 -0
- package/abstractions/services/PulumiExportService.d.ts +13 -0
- package/abstractions/services/PulumiExportService.js +6 -0
- package/abstractions/services/PulumiExportService.js.map +1 -0
- package/abstractions/services/PulumiGetConfigPassphraseService.d.ts +7 -0
- package/abstractions/services/PulumiGetConfigPassphraseService.js +5 -0
- package/abstractions/services/PulumiGetConfigPassphraseService.js.map +1 -0
- package/abstractions/services/PulumiGetSecretsProviderService.d.ts +7 -0
- package/abstractions/services/PulumiGetSecretsProviderService.js +5 -0
- package/abstractions/services/PulumiGetSecretsProviderService.js.map +1 -0
- package/abstractions/services/PulumiGetStackOutputService.d.ts +13 -0
- package/abstractions/services/PulumiGetStackOutputService.js +5 -0
- package/abstractions/services/PulumiGetStackOutputService.js.map +1 -0
- package/abstractions/services/PulumiImportService.d.ts +8 -0
- package/abstractions/services/PulumiImportService.js +5 -0
- package/abstractions/services/PulumiImportService.js.map +1 -0
- package/abstractions/services/PulumiLoginService.d.ts +19 -0
- package/abstractions/services/PulumiLoginService.js +5 -0
- package/abstractions/services/PulumiLoginService.js.map +1 -0
- package/abstractions/services/PulumiSelectStackService.d.ts +10 -0
- package/abstractions/services/PulumiSelectStackService.js +5 -0
- package/abstractions/services/PulumiSelectStackService.js.map +1 -0
- package/abstractions/services/StackOutputCacheService.d.ts +10 -0
- package/abstractions/services/StackOutputCacheService.js +5 -0
- package/abstractions/services/StackOutputCacheService.js.map +1 -0
- package/abstractions/services/WatchedLambdaFunctionsService.d.ts +28 -0
- package/abstractions/services/WatchedLambdaFunctionsService.js +5 -0
- package/abstractions/services/WatchedLambdaFunctionsService.js.map +1 -0
- package/api.d.ts +1 -15
- package/decorators/DeployAppClearWatchedLambdaFunctions.d.ts +20 -0
- package/decorators/DeployAppClearWatchedLambdaFunctions.js +35 -0
- package/decorators/DeployAppClearWatchedLambdaFunctions.js.map +1 -0
- package/decorators/DeployAppRefreshStackOutputCache.d.ts +20 -0
- package/decorators/DeployAppRefreshStackOutputCache.js +34 -0
- package/decorators/DeployAppRefreshStackOutputCache.js.map +1 -0
- package/decorators/DeployAppWithHooks.d.ts +25 -0
- package/decorators/DeployAppWithHooks.js +58 -0
- package/decorators/DeployAppWithHooks.js.map +1 -0
- package/decorators/DeployAppWithWatchedLambdaReplacement.d.ts +20 -0
- package/decorators/DeployAppWithWatchedLambdaReplacement.js +42 -0
- package/decorators/DeployAppWithWatchedLambdaReplacement.js.map +1 -0
- package/decorators/DestroyAppClearStackOutputCache.d.ts +28 -0
- package/decorators/DestroyAppClearStackOutputCache.js +31 -0
- package/decorators/DestroyAppClearStackOutputCache.js.map +1 -0
- package/decorators/GetPulumiServiceWithDownloadInfo.d.ts +13 -0
- package/decorators/GetPulumiServiceWithDownloadInfo.js +28 -0
- package/decorators/GetPulumiServiceWithDownloadInfo.js.map +1 -0
- package/decorators/ProjectInfoWithPulumi.d.ts +34 -0
- package/decorators/ProjectInfoWithPulumi.js +36 -0
- package/decorators/ProjectInfoWithPulumi.js.map +1 -0
- package/extensions/ApiRoute.d.ts +7 -16
- package/extensions/ApiRoute.js +4 -66
- package/extensions/ApiRoute.js.map +1 -1
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.d.ts +3 -2
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js +2 -1
- package/extensions/OpenSearch/EnsureOsServiceRoleBeforeCoreDeploy.js.map +1 -1
- package/extensions/OpenSearch/EnsureOsWasDeployed.d.ts +2 -2
- package/extensions/OpenSearch/EnsureOsWasDeployed.js +1 -2
- package/extensions/OpenSearch/EnsureOsWasDeployed.js.map +1 -1
- package/extensions/OpenSearch.js +2 -2
- package/extensions/OpenSearch.js.map +1 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.d.ts +2 -2
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js +2 -1
- package/extensions/ProjectAws/AutoInstall/AutoInstallAfterApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.d.ts +3 -2
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js +2 -1
- package/extensions/ProjectAws/BlueGreenDeployments/EnsureVariantBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.d.ts +5 -2
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js +3 -1
- package/extensions/ProjectAws/BlueGreenDeployments/PrintDeploymentInfoAfterDeploy.js.map +1 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.d.ts +3 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js +2 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminBuild.js.map +1 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.d.ts +3 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js +2 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeAdminWatch.js.map +1 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.d.ts +3 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js +2 -1
- package/extensions/ProjectAws/EnsureApiDeployedBeforeWatch.js.map +1 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.d.ts +3 -2
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js +2 -1
- package/extensions/ProjectAws/EnsureAwsCredentialsBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.d.ts +4 -2
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js +3 -1
- package/extensions/ProjectAws/EnsureCoreDeployedBeforeApiDeploy.js.map +1 -1
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.d.ts +6 -2
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js +2 -1
- package/extensions/ProjectAws/EnsureTelemetryEnabledForOss.js.map +1 -1
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.d.ts +2 -2
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js +1 -1
- package/extensions/ProjectAws/TelemetryNoLongerNewUser.js.map +1 -1
- package/extensions/ProjectAws/UploadAdminAppToS3.d.ts +4 -2
- package/extensions/ProjectAws/UploadAdminAppToS3.js +2 -2
- package/extensions/ProjectAws/UploadAdminAppToS3.js.map +1 -1
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.d.ts +5 -2
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js +2 -1
- package/extensions/ProjectAws/ValidateEncryptionBeforeDeploy.js.map +1 -1
- package/extensions/ProjectAws/ValidateProductionPulumiState.d.ts +5 -2
- package/extensions/ProjectAws/ValidateProductionPulumiState.js +3 -1
- package/extensions/ProjectAws/ValidateProductionPulumiState.js.map +1 -1
- package/extensions/ProjectAws/definitions.js +5 -1
- package/extensions/ProjectAws/definitions.js.map +1 -1
- package/extensions/ProjectAws.js +2 -1
- package/extensions/ProjectAws.js.map +1 -1
- package/extensions/RegisterRoutesPulumi.js +2 -2
- package/extensions/RegisterRoutesPulumi.js.map +1 -1
- package/extensions/definitions.js +0 -2
- package/extensions/definitions.js.map +1 -1
- package/extensions/registerExtensionImplementations.js +2 -1
- package/extensions/registerExtensionImplementations.js.map +1 -1
- package/extensions/toApiGatewayPath.d.ts +2 -0
- package/extensions/toApiGatewayPath.js +6 -0
- package/extensions/toApiGatewayPath.js.map +1 -0
- package/features/DeployApp/DeployApp.d.ts +22 -0
- package/features/DeployApp/DeployApp.js +91 -0
- package/features/DeployApp/DeployApp.js.map +1 -0
- package/features/DeployApp/index.d.ts +1 -0
- package/features/DeployApp/index.js +1 -0
- package/features/DestroyApp/DestroyApp.d.ts +20 -0
- package/features/DestroyApp/DestroyApp.js +70 -0
- package/features/DestroyApp/DestroyApp.js.map +1 -0
- package/features/DestroyApp/index.d.ts +1 -0
- package/features/DestroyApp/index.js +1 -0
- package/features/ExportStack/ExportStack.d.ts +12 -0
- package/features/ExportStack/ExportStack.js +28 -0
- package/features/ExportStack/ExportStack.js.map +1 -0
- package/features/ExportStack/index.d.ts +1 -0
- package/features/ExportStack/index.js +1 -0
- package/features/GetAppOutput/GetAppOutput.d.ts +16 -0
- package/features/GetAppOutput/GetAppOutput.js +55 -0
- package/features/GetAppOutput/GetAppOutput.js.map +1 -0
- package/features/GetAppOutput/index.d.ts +1 -0
- package/features/GetAppOutput/index.js +1 -0
- package/features/GetAppStackOutput/GetAppStackOutput.d.ts +13 -0
- package/features/GetAppStackOutput/GetAppStackOutput.js +28 -0
- package/features/GetAppStackOutput/GetAppStackOutput.js.map +1 -0
- package/features/GetAppStackOutput/index.d.ts +1 -0
- package/features/GetAppStackOutput/index.js +1 -0
- package/features/GetPulumiResourceNamePrefix/GetPulumiResourceNamePrefix.d.ts +8 -0
- package/features/GetPulumiResourceNamePrefix/GetPulumiResourceNamePrefix.js +26 -0
- package/features/GetPulumiResourceNamePrefix/GetPulumiResourceNamePrefix.js.map +1 -0
- package/features/GetPulumiResourceNamePrefix/index.d.ts +1 -0
- package/features/GetPulumiResourceNamePrefix/index.js +1 -0
- package/features/InvokeLambdaFunction.d.ts +1 -1
- package/features/InvokeLambdaFunction.js +1 -1
- package/features/InvokeLambdaFunction.js.map +1 -1
- package/features/RefreshApp/RefreshApp.d.ts +18 -0
- package/features/RefreshApp/RefreshApp.js +68 -0
- package/features/RefreshApp/RefreshApp.js.map +1 -0
- package/features/RefreshApp/index.d.ts +1 -0
- package/features/RefreshApp/index.js +1 -0
- package/features/RunPulumiCommand/RunPulumiCommand.d.ts +18 -0
- package/features/RunPulumiCommand/RunPulumiCommand.js +65 -0
- package/features/RunPulumiCommand/RunPulumiCommand.js.map +1 -0
- package/features/RunPulumiCommand/index.d.ts +1 -0
- package/features/RunPulumiCommand/index.js +1 -0
- package/features/Watch/AwsWatch.d.ts +9 -1
- package/features/Watch/AwsWatch.js +6 -2
- package/features/Watch/AwsWatch.js.map +1 -1
- package/features/Watch/getIotEndpoint.d.ts +2 -2
- package/features/Watch/getIotEndpoint.js.map +1 -1
- package/features/Watch/initInvocationForwarding.d.ts +9 -0
- package/features/Watch/initInvocationForwarding.js +91 -0
- package/features/Watch/initInvocationForwarding.js.map +1 -0
- package/features/Watch/localInvocationWorker.d.ts +1 -0
- package/features/Watch/localInvocationWorker.js +31 -0
- package/features/Watch/localInvocationWorker.js.map +1 -0
- package/features/Watch/replaceLambdaFunctions.d.ts +7 -3
- package/features/Watch/replaceLambdaFunctions.js.map +1 -1
- package/features/hooks/AdminAfterDeploy/AdminAfterDeploy.d.ts +7 -0
- package/features/hooks/AdminAfterDeploy/AdminAfterDeploy.js +25 -0
- package/features/hooks/AdminAfterDeploy/AdminAfterDeploy.js.map +1 -0
- package/features/hooks/AdminAfterDeploy/index.d.ts +1 -0
- package/features/hooks/AdminAfterDeploy/index.js +1 -0
- package/features/hooks/AdminBeforeDeploy/AdminBeforeDeploy.d.ts +7 -0
- package/features/hooks/AdminBeforeDeploy/AdminBeforeDeploy.js +25 -0
- package/features/hooks/AdminBeforeDeploy/AdminBeforeDeploy.js.map +1 -0
- package/features/hooks/AdminBeforeDeploy/index.d.ts +1 -0
- package/features/hooks/AdminBeforeDeploy/index.js +1 -0
- package/features/hooks/AfterDeploy/AfterDeploy.d.ts +7 -0
- package/features/hooks/AfterDeploy/AfterDeploy.js +25 -0
- package/features/hooks/AfterDeploy/AfterDeploy.js.map +1 -0
- package/features/hooks/AfterDeploy/index.d.ts +1 -0
- package/features/hooks/AfterDeploy/index.js +1 -0
- package/features/hooks/ApiAfterDeploy/ApiAfterDeploy.d.ts +7 -0
- package/features/hooks/ApiAfterDeploy/ApiAfterDeploy.js +25 -0
- package/features/hooks/ApiAfterDeploy/ApiAfterDeploy.js.map +1 -0
- package/features/hooks/ApiAfterDeploy/index.d.ts +1 -0
- package/features/hooks/ApiAfterDeploy/index.js +1 -0
- package/features/hooks/ApiBeforeDeploy/ApiBeforeDeploy.d.ts +7 -0
- package/features/hooks/ApiBeforeDeploy/ApiBeforeDeploy.js +25 -0
- package/features/hooks/ApiBeforeDeploy/ApiBeforeDeploy.js.map +1 -0
- package/features/hooks/ApiBeforeDeploy/index.d.ts +1 -0
- package/features/hooks/ApiBeforeDeploy/index.js +1 -0
- package/features/hooks/BeforeDeploy/BeforeDeploy.d.ts +7 -0
- package/features/hooks/BeforeDeploy/BeforeDeploy.js +25 -0
- package/features/hooks/BeforeDeploy/BeforeDeploy.js.map +1 -0
- package/features/hooks/BeforeDeploy/index.d.ts +1 -0
- package/features/hooks/BeforeDeploy/index.js +1 -0
- package/features/hooks/CoreAfterDeploy/CoreAfterDeploy.d.ts +7 -0
- package/features/hooks/CoreAfterDeploy/CoreAfterDeploy.js +25 -0
- package/features/hooks/CoreAfterDeploy/CoreAfterDeploy.js.map +1 -0
- package/features/hooks/CoreAfterDeploy/index.d.ts +1 -0
- package/features/hooks/CoreAfterDeploy/index.js +1 -0
- package/features/hooks/CoreBeforeDeploy/CoreBeforeDeploy.d.ts +7 -0
- package/features/hooks/CoreBeforeDeploy/CoreBeforeDeploy.js +25 -0
- package/features/hooks/CoreBeforeDeploy/CoreBeforeDeploy.js.map +1 -0
- package/features/hooks/CoreBeforeDeploy/index.d.ts +1 -0
- package/features/hooks/CoreBeforeDeploy/index.js +1 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/infra.js +2 -2
- package/infra.js.map +1 -1
- package/package.json +15 -12
- package/pulumi/apps/blueGreen/types.d.ts +2 -2
- package/pulumi/apps/syncSystem/types.d.ts +2 -2
- package/pulumi/getAwsProjectSdk.d.ts +2 -12
- package/pulumi/getAwsProjectSdk.js +2 -3
- package/pulumi/getAwsProjectSdk.js.map +1 -1
- package/pulumi/getStackOutput.d.ts +4 -5
- package/pulumi/getStackOutput.js.map +1 -1
- package/pulumi/types.d.ts +2 -2
- package/registerAwsProjectFeatures.js +38 -9
- package/registerAwsProjectFeatures.js.map +1 -1
- package/services/AdminStackOutputService.d.ts +1 -1
- package/services/AdminStackOutputService.js +1 -1
- package/services/AdminStackOutputService.js.map +1 -1
- package/services/ApiStackOutputService.d.ts +1 -1
- package/services/ApiStackOutputService.js +1 -1
- package/services/ApiStackOutputService.js.map +1 -1
- package/services/AwsDeployInitHostingSdkService/AwsDeployInitHostingSdkService.d.ts +10 -0
- package/services/AwsDeployInitHostingSdkService/AwsDeployInitHostingSdkService.js +30 -0
- package/services/AwsDeployInitHostingSdkService/AwsDeployInitHostingSdkService.js.map +1 -0
- package/services/AwsPulumiInitHostingSdkService/AwsPulumiInitHostingSdkService.d.ts +9 -0
- package/services/AwsPulumiInitHostingSdkService/AwsPulumiInitHostingSdkService.js +24 -0
- package/services/AwsPulumiInitHostingSdkService/AwsPulumiInitHostingSdkService.js.map +1 -0
- package/services/CoreStackOutputService.d.ts +1 -1
- package/services/CoreStackOutputService.js +1 -1
- package/services/CoreStackOutputService.js.map +1 -1
- package/services/GetPulumiService/GetPulumiService.d.ts +3 -1
- package/services/GetPulumiService/GetPulumiService.js +2 -1
- package/services/GetPulumiService/GetPulumiService.js.map +1 -1
- package/services/GetPulumiVersionService/GetPulumiVersionService.d.ts +5 -0
- package/services/GetPulumiVersionService/GetPulumiVersionService.js +46 -0
- package/services/GetPulumiVersionService/GetPulumiVersionService.js.map +1 -0
- package/services/IsRemotePulumiBackendService/IsRemotePulumiBackendService.d.ts +14 -0
- package/services/IsRemotePulumiBackendService/IsRemotePulumiBackendService.js +15 -0
- package/services/IsRemotePulumiBackendService/IsRemotePulumiBackendService.js.map +1 -0
- package/services/IsRemotePulumiBackendService/index.d.ts +1 -0
- package/services/IsRemotePulumiBackendService/index.js +1 -0
- package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.d.ts +20 -0
- package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.js +63 -0
- package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.js.map +1 -0
- package/services/ListAppLambdaFunctionsService/index.d.ts +1 -0
- package/services/ListAppLambdaFunctionsService/index.js +1 -0
- package/services/ListDeployedEnvironmentsService/ListDeployedEnvironmentsService.d.ts +8 -0
- package/services/ListDeployedEnvironmentsService/ListDeployedEnvironmentsService.js +31 -0
- package/services/ListDeployedEnvironmentsService/ListDeployedEnvironmentsService.js.map +1 -0
- package/services/ListDeployedEnvironmentsService/index.d.ts +1 -0
- package/services/ListDeployedEnvironmentsService/index.js +1 -0
- package/services/PulumiExportService/PulumiExportService.d.ts +16 -0
- package/services/PulumiExportService/PulumiExportService.js +54 -0
- package/services/PulumiExportService/PulumiExportService.js.map +1 -0
- package/services/PulumiExportService/index.d.ts +1 -0
- package/services/PulumiExportService/index.js +1 -0
- package/services/PulumiGetConfigPassphraseService/PulumiGetConfigPassphraseService.d.ts +5 -0
- package/services/PulumiGetConfigPassphraseService/PulumiGetConfigPassphraseService.js +15 -0
- package/services/PulumiGetConfigPassphraseService/PulumiGetConfigPassphraseService.js.map +1 -0
- package/services/PulumiGetConfigPassphraseService/index.d.ts +1 -0
- package/services/PulumiGetConfigPassphraseService/index.js +1 -0
- package/services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.d.ts +5 -0
- package/services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.js +15 -0
- package/services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.js.map +1 -0
- package/services/PulumiGetSecretsProviderService/index.d.ts +1 -0
- package/services/PulumiGetSecretsProviderService/index.js +1 -0
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.d.ts +16 -0
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js +69 -0
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js.map +1 -0
- package/services/PulumiGetStackOutputService/index.d.ts +1 -0
- package/services/PulumiGetStackOutputService/index.js +1 -0
- package/services/PulumiGetStackOutputService/mapStackOutput.d.ts +1 -0
- package/services/PulumiGetStackOutputService/mapStackOutput.js +22 -0
- package/services/PulumiGetStackOutputService/mapStackOutput.js.map +1 -0
- package/services/PulumiImportService/PulumiImportService.d.ts +13 -0
- package/services/PulumiImportService/PulumiImportService.js +64 -0
- package/services/PulumiImportService/PulumiImportService.js.map +1 -0
- package/services/PulumiImportService/index.d.ts +1 -0
- package/services/PulumiImportService/index.js +1 -0
- package/services/PulumiLoginService/PulumiLoginService.d.ts +13 -0
- package/services/PulumiLoginService/PulumiLoginService.js +59 -0
- package/services/PulumiLoginService/PulumiLoginService.js.map +1 -0
- package/services/PulumiLoginService/index.d.ts +1 -0
- package/services/PulumiLoginService/index.js +1 -0
- package/services/PulumiSelectStackService/PulumiSelectStackService.d.ts +20 -0
- package/services/PulumiSelectStackService/PulumiSelectStackService.js +106 -0
- package/services/PulumiSelectStackService/PulumiSelectStackService.js.map +1 -0
- package/services/PulumiSelectStackService/index.d.ts +1 -0
- package/services/PulumiSelectStackService/index.js +1 -0
- package/services/StackOutputCacheService/StackOutputCacheService.d.ts +21 -0
- package/services/StackOutputCacheService/StackOutputCacheService.js +90 -0
- package/services/StackOutputCacheService/StackOutputCacheService.js.map +1 -0
- package/services/StackOutputCacheService/index.d.ts +1 -0
- package/services/StackOutputCacheService/index.js +1 -0
- package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.d.ts +14 -0
- package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js +55 -0
- package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js.map +1 -0
- package/services/WatchedLambdaFunctionsService/index.d.ts +1 -0
- package/services/WatchedLambdaFunctionsService/index.js +1 -0
- package/utils/withPulumiConfigPassphrase.d.ts +1 -0
- package/utils/withPulumiConfigPassphrase.js +7 -0
- package/utils/withPulumiConfigPassphrase.js.map +1 -0
- package/extensions/routePath.d.ts +0 -20
- package/extensions/routePath.js +0 -13
- package/extensions/routePath.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.js","sources":["../../../src/services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { PulumiGetSecretsProviderService } from \"~/abstractions/services/PulumiGetSecretsProviderService.js\";\n\nexport class DefaultPulumiGetSecretsProviderService\n implements PulumiGetSecretsProviderService.Interface\n{\n execute() {\n return process.env.PULUMI_SECRETS_PROVIDER || \"passphrase\";\n }\n}\n\nexport const pulumiGetSecretsProviderService = createImplementation({\n abstraction: PulumiGetSecretsProviderService,\n implementation: DefaultPulumiGetSecretsProviderService,\n dependencies: []\n});\n"],"names":["DefaultPulumiGetSecretsProviderService","process","pulumiGetSecretsProviderService","createImplementation","PulumiGetSecretsProviderService"],"mappings":";;AAGO,MAAMA;IAGT,UAAU;QACN,OAAOC,QAAQ,GAAG,CAAC,uBAAuB,IAAI;IAClD;AACJ;AAEO,MAAMC,kCAAkCC,qBAAqB;IAChE,aAAaC;IACb,gBAAgBJ;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiGetSecretsProviderService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiGetSecretsProviderService.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
2
|
+
import { LoggerService } from "@webiny/project/abstractions/index.js";
|
|
3
|
+
import { PulumiGetStackOutputService } from "../../abstractions/services/PulumiGetStackOutputService.js";
|
|
4
|
+
import { PulumiSelectStackService } from "../../abstractions/services/PulumiSelectStackService.js";
|
|
5
|
+
import { StackOutputCacheService } from "../../abstractions/services/StackOutputCacheService.js";
|
|
6
|
+
import { type IAppModel } from "@webiny/project/abstractions/models/index.js";
|
|
7
|
+
export declare class DefaultPulumiGetStackOutputService implements PulumiGetStackOutputService.Interface {
|
|
8
|
+
private getPulumiService;
|
|
9
|
+
private pulumiSelectStackService;
|
|
10
|
+
private loggerService;
|
|
11
|
+
private stackOutputCacheService;
|
|
12
|
+
constructor(getPulumiService: GetPulumiService.Interface, pulumiSelectStackService: PulumiSelectStackService.Interface, loggerService: LoggerService.Interface, stackOutputCacheService: StackOutputCacheService.Interface);
|
|
13
|
+
execute<TOutput extends Record<string, any> = Record<string, any>>(app: IAppModel, params?: PulumiGetStackOutputService.Params): Promise<TOutput | null>;
|
|
14
|
+
private applyMapping;
|
|
15
|
+
}
|
|
16
|
+
export declare const pulumiGetStackOutputService: import("@webiny/di").Implementation<typeof DefaultPulumiGetStackOutputService>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
3
|
+
import { LoggerService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { PulumiGetStackOutputService } from "../../abstractions/services/PulumiGetStackOutputService.js";
|
|
5
|
+
import { PulumiSelectStackService } from "../../abstractions/services/PulumiSelectStackService.js";
|
|
6
|
+
import { StackOutputCacheService } from "../../abstractions/services/StackOutputCacheService.js";
|
|
7
|
+
import { createEnvConfiguration } from "@webiny/project/utils/env/index.js";
|
|
8
|
+
import { withPulumiConfigPassphrase } from "../../utils/withPulumiConfigPassphrase.js";
|
|
9
|
+
import { mapStackOutput } from "./mapStackOutput.js";
|
|
10
|
+
class DefaultPulumiGetStackOutputService {
|
|
11
|
+
constructor(getPulumiService, pulumiSelectStackService, loggerService, stackOutputCacheService){
|
|
12
|
+
this.getPulumiService = getPulumiService;
|
|
13
|
+
this.pulumiSelectStackService = pulumiSelectStackService;
|
|
14
|
+
this.loggerService = loggerService;
|
|
15
|
+
this.stackOutputCacheService = stackOutputCacheService;
|
|
16
|
+
}
|
|
17
|
+
async execute(app, params) {
|
|
18
|
+
if (!params?.skipCache) {
|
|
19
|
+
const cachedOutput = await this.stackOutputCacheService.read(app);
|
|
20
|
+
if (null !== cachedOutput) return this.applyMapping(cachedOutput, params?.map);
|
|
21
|
+
}
|
|
22
|
+
const pulumi = await this.getPulumiService.execute({
|
|
23
|
+
app
|
|
24
|
+
});
|
|
25
|
+
await this.pulumiSelectStackService.execute(app);
|
|
26
|
+
const stackOutputString = await pulumi.run({
|
|
27
|
+
command: [
|
|
28
|
+
"stack",
|
|
29
|
+
"output"
|
|
30
|
+
],
|
|
31
|
+
args: {
|
|
32
|
+
json: true
|
|
33
|
+
},
|
|
34
|
+
execa: {
|
|
35
|
+
env: createEnvConfiguration({
|
|
36
|
+
configurations: [
|
|
37
|
+
withPulumiConfigPassphrase()
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
try {
|
|
43
|
+
const stackOutputJson = JSON.parse(stackOutputString.stdout);
|
|
44
|
+
if (!stackOutputJson) return null;
|
|
45
|
+
await this.stackOutputCacheService.write(app, stackOutputJson);
|
|
46
|
+
return this.applyMapping(stackOutputJson, params?.map);
|
|
47
|
+
} catch {
|
|
48
|
+
this.loggerService.error("Could not parse stack output as JSON.", stackOutputString.stdout, app, params);
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
applyMapping(data, map) {
|
|
53
|
+
if (!map) return data;
|
|
54
|
+
return mapStackOutput(data, map);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const pulumiGetStackOutputService = createImplementation({
|
|
58
|
+
abstraction: PulumiGetStackOutputService,
|
|
59
|
+
implementation: DefaultPulumiGetStackOutputService,
|
|
60
|
+
dependencies: [
|
|
61
|
+
GetPulumiService,
|
|
62
|
+
PulumiSelectStackService,
|
|
63
|
+
LoggerService,
|
|
64
|
+
StackOutputCacheService
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
export { DefaultPulumiGetStackOutputService, pulumiGetStackOutputService };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=PulumiGetStackOutputService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/PulumiGetStackOutputService/PulumiGetStackOutputService.js","sources":["../../../src/services/PulumiGetStackOutputService/PulumiGetStackOutputService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetPulumiService } from \"~/abstractions/services/GetPulumiService.js\";\nimport { LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { PulumiGetStackOutputService } from \"~/abstractions/services/PulumiGetStackOutputService.js\";\nimport { PulumiSelectStackService } from \"~/abstractions/services/PulumiSelectStackService.js\";\nimport { StackOutputCacheService } from \"~/abstractions/services/StackOutputCacheService.js\";\nimport { type IAppModel } from \"@webiny/project/abstractions/models/index.js\";\nimport { createEnvConfiguration } from \"@webiny/project/utils/env/index.js\";\nimport { withPulumiConfigPassphrase } from \"~/utils/withPulumiConfigPassphrase.js\";\nimport { mapStackOutput } from \"./mapStackOutput.js\";\n\nexport class DefaultPulumiGetStackOutputService implements PulumiGetStackOutputService.Interface {\n constructor(\n private getPulumiService: GetPulumiService.Interface,\n private pulumiSelectStackService: PulumiSelectStackService.Interface,\n private loggerService: LoggerService.Interface,\n private stackOutputCacheService: StackOutputCacheService.Interface\n ) {}\n\n async execute<TOutput extends Record<string, any> = Record<string, any>>(\n app: IAppModel,\n params?: PulumiGetStackOutputService.Params\n ): Promise<TOutput | null> {\n // Try to read from cache if skipCache is not true\n if (!params?.skipCache) {\n const cachedOutput = await this.stackOutputCacheService.read(app);\n if (cachedOutput !== null) {\n return this.applyMapping(cachedOutput, params?.map) as TOutput;\n }\n }\n\n const pulumi = await this.getPulumiService.execute({ app });\n\n await this.pulumiSelectStackService.execute(app);\n\n const stackOutputString = await pulumi.run({\n command: [\"stack\", \"output\"],\n args: {\n json: true\n },\n execa: {\n env: createEnvConfiguration({\n configurations: [withPulumiConfigPassphrase()]\n })\n }\n });\n\n try {\n const stackOutputJson = JSON.parse(stackOutputString.stdout as string);\n if (!stackOutputJson) {\n return null;\n }\n\n await this.stackOutputCacheService.write(app, stackOutputJson);\n\n return this.applyMapping(stackOutputJson, params?.map) as TOutput;\n } catch {\n this.loggerService.error(\n \"Could not parse stack output as JSON.\",\n stackOutputString.stdout,\n app,\n params\n );\n return null;\n }\n }\n\n private applyMapping(\n data: Record<string, any>,\n map?: Record<string, any>\n ): Record<string, any> {\n if (!map) {\n return data;\n }\n // If a mapping is provided, we map the output to the specified structure.\n return mapStackOutput(data, map);\n }\n}\n\nexport const pulumiGetStackOutputService = createImplementation({\n abstraction: PulumiGetStackOutputService,\n implementation: DefaultPulumiGetStackOutputService,\n dependencies: [\n GetPulumiService,\n PulumiSelectStackService,\n LoggerService,\n StackOutputCacheService\n ]\n});\n"],"names":["DefaultPulumiGetStackOutputService","getPulumiService","pulumiSelectStackService","loggerService","stackOutputCacheService","app","params","cachedOutput","pulumi","stackOutputString","createEnvConfiguration","withPulumiConfigPassphrase","stackOutputJson","JSON","data","map","mapStackOutput","pulumiGetStackOutputService","createImplementation","PulumiGetStackOutputService","GetPulumiService","PulumiSelectStackService","LoggerService","StackOutputCacheService"],"mappings":";;;;;;;;;AAWO,MAAMA;IACT,YACYC,gBAA4C,EAC5CC,wBAA4D,EAC5DC,aAAsC,EACtCC,uBAA0D,CACpE;aAJUH,gBAAgB,GAAhBA;aACAC,wBAAwB,GAAxBA;aACAC,aAAa,GAAbA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,QACFC,GAAc,EACdC,MAA2C,EACpB;QAEvB,IAAI,CAACA,QAAQ,WAAW;YACpB,MAAMC,eAAe,MAAM,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAACF;YAC7D,IAAIE,AAAiB,SAAjBA,cACA,OAAO,IAAI,CAAC,YAAY,CAACA,cAAcD,QAAQ;QAEvD;QAEA,MAAME,SAAS,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAEH;QAAI;QAEzD,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAACA;QAE5C,MAAMI,oBAAoB,MAAMD,OAAO,GAAG,CAAC;YACvC,SAAS;gBAAC;gBAAS;aAAS;YAC5B,MAAM;gBACF,MAAM;YACV;YACA,OAAO;gBACH,KAAKE,uBAAuB;oBACxB,gBAAgB;wBAACC;qBAA6B;gBAClD;YACJ;QACJ;QAEA,IAAI;YACA,MAAMC,kBAAkBC,KAAK,KAAK,CAACJ,kBAAkB,MAAM;YAC3D,IAAI,CAACG,iBACD,OAAO;YAGX,MAAM,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAACP,KAAKO;YAE9C,OAAO,IAAI,CAAC,YAAY,CAACA,iBAAiBN,QAAQ;QACtD,EAAE,OAAM;YACJ,IAAI,CAAC,aAAa,CAAC,KAAK,CACpB,yCACAG,kBAAkB,MAAM,EACxBJ,KACAC;YAEJ,OAAO;QACX;IACJ;IAEQ,aACJQ,IAAyB,EACzBC,GAAyB,EACN;QACnB,IAAI,CAACA,KACD,OAAOD;QAGX,OAAOE,eAAeF,MAAMC;IAChC;AACJ;AAEO,MAAME,8BAA8BC,qBAAqB;IAC5D,aAAaC;IACb,gBAAgBnB;IAChB,cAAc;QACVoB;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiGetStackOutputService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiGetStackOutputService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mapStackOutput: <T extends Record<string, any> = Record<string, any>>(output: Record<string, any>, map: Record<string, any>) => T;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import get from "lodash/get.js";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
const { yellow: yellow } = chalk;
|
|
4
|
+
const mapStackOutput = (output, map)=>{
|
|
5
|
+
const values = {};
|
|
6
|
+
const regex = /\${(.*)}/;
|
|
7
|
+
Object.keys(map).forEach((key)=>{
|
|
8
|
+
const valuePattern = map[key];
|
|
9
|
+
const match = regex.exec(valuePattern);
|
|
10
|
+
if (match) {
|
|
11
|
+
const [replace, valuePath] = match;
|
|
12
|
+
const value = get(output, valuePath);
|
|
13
|
+
if (!value) return void console.log(yellow(`Could not map "${valuePath}" to "${key}" - value missing.`));
|
|
14
|
+
if ("object" == typeof value && null !== value) values[key] = valuePattern.replace(replace, JSON.stringify(value));
|
|
15
|
+
else values[key] = valuePattern.replace(replace, value);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return values;
|
|
19
|
+
};
|
|
20
|
+
export { mapStackOutput };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=mapStackOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/PulumiGetStackOutputService/mapStackOutput.js","sources":["../../../src/services/PulumiGetStackOutputService/mapStackOutput.ts"],"sourcesContent":["import get from \"lodash/get.js\";\nimport chalk from \"chalk\";\n\nconst { yellow } = chalk;\n\nexport const mapStackOutput = <T extends Record<string, any> = Record<string, any>>(\n output: Record<string, any>,\n map: Record<string, any>\n): T => {\n const values: T = {} as T;\n const regex = /\\${(.*)}/;\n\n Object.keys(map).forEach(key => {\n const valuePattern = map[key];\n const match = regex.exec(valuePattern);\n if (match) {\n const [replace, valuePath] = match;\n const value = get(output, valuePath);\n if (!value) {\n console.log(yellow(`Could not map \"${valuePath}\" to \"${key}\" - value missing.`));\n return;\n }\n /**\n * It is ok to expect error here.\n */\n if (typeof value === \"object\" && value !== null) {\n // @ts-expect-error\n values[key] = valuePattern.replace(replace, JSON.stringify(value));\n } else {\n // @ts-expect-error\n values[key] = valuePattern.replace(replace, value);\n }\n }\n });\n\n return values;\n};\n"],"names":["yellow","chalk","mapStackOutput","output","map","values","regex","Object","key","valuePattern","match","replace","valuePath","value","get","console","JSON"],"mappings":";;AAGA,MAAM,EAAEA,QAAAA,MAAM,EAAE,GAAGC;AAEZ,MAAMC,iBAAiB,CAC1BC,QACAC;IAEA,MAAMC,SAAY,CAAC;IACnB,MAAMC,QAAQ;IAEdC,OAAO,IAAI,CAACH,KAAK,OAAO,CAACI,CAAAA;QACrB,MAAMC,eAAeL,GAAG,CAACI,IAAI;QAC7B,MAAME,QAAQJ,MAAM,IAAI,CAACG;QACzB,IAAIC,OAAO;YACP,MAAM,CAACC,SAASC,UAAU,GAAGF;YAC7B,MAAMG,QAAQC,IAAIX,QAAQS;YAC1B,IAAI,CAACC,OAAO,YACRE,QAAQ,GAAG,CAACf,OAAO,CAAC,eAAe,EAAEY,UAAU,MAAM,EAAEJ,IAAI,kBAAkB,CAAC;YAMlF,IAAI,AAAiB,YAAjB,OAAOK,SAAsBA,AAAU,SAAVA,OAE7BR,MAAM,CAACG,IAAI,GAAGC,aAAa,OAAO,CAACE,SAASK,KAAK,SAAS,CAACH;iBAG3DR,MAAM,CAACG,IAAI,GAAGC,aAAa,OAAO,CAACE,SAASE;QAEpD;IACJ;IAEA,OAAOR;AACX"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
2
|
+
import { LoggerService } from "@webiny/project/abstractions/index.js";
|
|
3
|
+
import { PulumiImportService } from "../../abstractions/services/PulumiImportService.js";
|
|
4
|
+
import { PulumiSelectStackService } from "../../abstractions/services/PulumiSelectStackService.js";
|
|
5
|
+
import { type IAppModel } from "@webiny/project/abstractions/models/index.js";
|
|
6
|
+
export declare class DefaultPulumiImportService implements PulumiImportService.Interface {
|
|
7
|
+
private getPulumiService;
|
|
8
|
+
private pulumiSelectStackService;
|
|
9
|
+
private loggerService;
|
|
10
|
+
constructor(getPulumiService: GetPulumiService.Interface, pulumiSelectStackService: PulumiSelectStackService.Interface, loggerService: LoggerService.Interface);
|
|
11
|
+
execute(app: IAppModel, state: Record<string, any>): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare const pulumiImportService: import("@webiny/di").Implementation<typeof DefaultPulumiImportService>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import os from "os";
|
|
5
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
6
|
+
import { LoggerService } from "@webiny/project/abstractions/index.js";
|
|
7
|
+
import { PulumiImportService } from "../../abstractions/services/PulumiImportService.js";
|
|
8
|
+
import { PulumiSelectStackService } from "../../abstractions/services/PulumiSelectStackService.js";
|
|
9
|
+
import { createEnvConfiguration } from "@webiny/project/utils/env/index.js";
|
|
10
|
+
import { withPulumiConfigPassphrase } from "../../utils/withPulumiConfigPassphrase.js";
|
|
11
|
+
class DefaultPulumiImportService {
|
|
12
|
+
constructor(getPulumiService, pulumiSelectStackService, loggerService){
|
|
13
|
+
this.getPulumiService = getPulumiService;
|
|
14
|
+
this.pulumiSelectStackService = pulumiSelectStackService;
|
|
15
|
+
this.loggerService = loggerService;
|
|
16
|
+
}
|
|
17
|
+
async execute(app, state) {
|
|
18
|
+
const pulumi = await this.getPulumiService.execute({
|
|
19
|
+
app
|
|
20
|
+
});
|
|
21
|
+
await this.pulumiSelectStackService.execute(app);
|
|
22
|
+
const tempDir = os.tmpdir();
|
|
23
|
+
const tempFilePath = path.join(tempDir, `pulumi-state-${Date.now()}.json`);
|
|
24
|
+
try {
|
|
25
|
+
const stateJson = JSON.stringify(state, null, 2);
|
|
26
|
+
fs.writeFileSync(tempFilePath, stateJson, "utf-8");
|
|
27
|
+
this.loggerService.debug(`Importing Pulumi state from: ${tempFilePath}`);
|
|
28
|
+
const result = await pulumi.run({
|
|
29
|
+
command: [
|
|
30
|
+
"stack",
|
|
31
|
+
"import"
|
|
32
|
+
],
|
|
33
|
+
args: {
|
|
34
|
+
file: tempFilePath
|
|
35
|
+
},
|
|
36
|
+
execa: {
|
|
37
|
+
env: createEnvConfiguration({
|
|
38
|
+
configurations: [
|
|
39
|
+
withPulumiConfigPassphrase()
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.loggerService.debug("Pulumi import output:", result.stdout);
|
|
45
|
+
fs.unlinkSync(tempFilePath);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (fs.existsSync(tempFilePath)) fs.unlinkSync(tempFilePath);
|
|
48
|
+
this.loggerService.error("Failed to import Pulumi stack state.", error, app);
|
|
49
|
+
throw error;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const pulumiImportService = createImplementation({
|
|
54
|
+
abstraction: PulumiImportService,
|
|
55
|
+
implementation: DefaultPulumiImportService,
|
|
56
|
+
dependencies: [
|
|
57
|
+
GetPulumiService,
|
|
58
|
+
PulumiSelectStackService,
|
|
59
|
+
LoggerService
|
|
60
|
+
]
|
|
61
|
+
});
|
|
62
|
+
export { DefaultPulumiImportService, pulumiImportService };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=PulumiImportService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/PulumiImportService/PulumiImportService.js","sources":["../../../src/services/PulumiImportService/PulumiImportService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport fs from \"fs\";\nimport path from \"path\";\nimport os from \"os\";\nimport { GetPulumiService } from \"~/abstractions/services/GetPulumiService.js\";\nimport { LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { PulumiImportService } from \"~/abstractions/services/PulumiImportService.js\";\nimport { PulumiSelectStackService } from \"~/abstractions/services/PulumiSelectStackService.js\";\nimport { type IAppModel } from \"@webiny/project/abstractions/models/index.js\";\nimport { createEnvConfiguration } from \"@webiny/project/utils/env/index.js\";\nimport { withPulumiConfigPassphrase } from \"~/utils/withPulumiConfigPassphrase.js\";\n\nexport class DefaultPulumiImportService implements PulumiImportService.Interface {\n constructor(\n private getPulumiService: GetPulumiService.Interface,\n private pulumiSelectStackService: PulumiSelectStackService.Interface,\n private loggerService: LoggerService.Interface\n ) {}\n\n async execute(app: IAppModel, state: Record<string, any>) {\n const pulumi = await this.getPulumiService.execute({ app });\n\n await this.pulumiSelectStackService.execute(app);\n\n // Write state to temporary file (pulumi stack import requires --file flag)\n const tempDir = os.tmpdir();\n const tempFilePath = path.join(tempDir, `pulumi-state-${Date.now()}.json`);\n\n try {\n const stateJson = JSON.stringify(state, null, 2);\n fs.writeFileSync(tempFilePath, stateJson, \"utf-8\");\n\n this.loggerService.debug(`Importing Pulumi state from: ${tempFilePath}`);\n\n const result = await pulumi.run({\n command: [\"stack\", \"import\"],\n args: {\n file: tempFilePath\n },\n execa: {\n env: createEnvConfiguration({\n configurations: [withPulumiConfigPassphrase()]\n })\n }\n });\n\n this.loggerService.debug(\"Pulumi import output:\", result.stdout);\n\n // Clean up temp file\n fs.unlinkSync(tempFilePath);\n } catch (error) {\n // Clean up temp file even on error\n if (fs.existsSync(tempFilePath)) {\n fs.unlinkSync(tempFilePath);\n }\n this.loggerService.error(\"Failed to import Pulumi stack state.\", error, app);\n throw error;\n }\n }\n}\n\nexport const pulumiImportService = createImplementation({\n abstraction: PulumiImportService,\n implementation: DefaultPulumiImportService,\n dependencies: [GetPulumiService, PulumiSelectStackService, LoggerService]\n});\n"],"names":["DefaultPulumiImportService","getPulumiService","pulumiSelectStackService","loggerService","app","state","pulumi","tempDir","os","tempFilePath","path","Date","stateJson","JSON","fs","result","createEnvConfiguration","withPulumiConfigPassphrase","error","pulumiImportService","createImplementation","PulumiImportService","GetPulumiService","PulumiSelectStackService","LoggerService"],"mappings":";;;;;;;;;;AAYO,MAAMA;IACT,YACYC,gBAA4C,EAC5CC,wBAA4D,EAC5DC,aAAsC,CAChD;aAHUF,gBAAgB,GAAhBA;aACAC,wBAAwB,GAAxBA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,QAAQC,GAAc,EAAEC,KAA0B,EAAE;QACtD,MAAMC,SAAS,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAEF;QAAI;QAEzD,MAAM,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAACA;QAG5C,MAAMG,UAAUC,GAAG,MAAM;QACzB,MAAMC,eAAeC,KAAK,IAAI,CAACH,SAAS,CAAC,aAAa,EAAEI,KAAK,GAAG,GAAG,KAAK,CAAC;QAEzE,IAAI;YACA,MAAMC,YAAYC,KAAK,SAAS,CAACR,OAAO,MAAM;YAC9CS,GAAG,aAAa,CAACL,cAAcG,WAAW;YAE1C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,6BAA6B,EAAEH,cAAc;YAEvE,MAAMM,SAAS,MAAMT,OAAO,GAAG,CAAC;gBAC5B,SAAS;oBAAC;oBAAS;iBAAS;gBAC5B,MAAM;oBACF,MAAMG;gBACV;gBACA,OAAO;oBACH,KAAKO,uBAAuB;wBACxB,gBAAgB;4BAACC;yBAA6B;oBAClD;gBACJ;YACJ;YAEA,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,yBAAyBF,OAAO,MAAM;YAG/DD,GAAG,UAAU,CAACL;QAClB,EAAE,OAAOS,OAAO;YAEZ,IAAIJ,GAAG,UAAU,CAACL,eACdK,GAAG,UAAU,CAACL;YAElB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,wCAAwCS,OAAOd;YACxE,MAAMc;QACV;IACJ;AACJ;AAEO,MAAMC,sBAAsBC,qBAAqB;IACpD,aAAaC;IACb,gBAAgBrB;IAChB,cAAc;QAACsB;QAAkBC;QAA0BC;KAAc;AAC7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiImportService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiImportService.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
2
|
+
import { PulumiLoginService } from "../../abstractions/services/PulumiLoginService.js";
|
|
3
|
+
import { GetProjectService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { type IAppModel } from "@webiny/project/abstractions/models/index.js";
|
|
5
|
+
export declare class DefaultPulumiLoginService implements PulumiLoginService.Interface {
|
|
6
|
+
private getPulumiService;
|
|
7
|
+
private getProjectService;
|
|
8
|
+
constructor(getPulumiService: GetPulumiService.Interface, getProjectService: GetProjectService.Interface);
|
|
9
|
+
execute(app: IAppModel): Promise<{
|
|
10
|
+
login: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export declare const pulumiLoginService: import("@webiny/di").Implementation<typeof DefaultPulumiLoginService>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
3
|
+
import { PulumiLoginService } from "../../abstractions/services/PulumiLoginService.js";
|
|
4
|
+
import { GetProjectService } from "@webiny/project/abstractions/index.js";
|
|
5
|
+
import trimEnd from "lodash/trimEnd.js";
|
|
6
|
+
import fs from "fs";
|
|
7
|
+
import path from "path";
|
|
8
|
+
const SELF_MANAGED_BACKEND = [
|
|
9
|
+
"s3://",
|
|
10
|
+
"azblob://",
|
|
11
|
+
"gs://"
|
|
12
|
+
];
|
|
13
|
+
class DefaultPulumiLoginService {
|
|
14
|
+
constructor(getPulumiService, getProjectService){
|
|
15
|
+
this.getPulumiService = getPulumiService;
|
|
16
|
+
this.getProjectService = getProjectService;
|
|
17
|
+
}
|
|
18
|
+
async execute(app) {
|
|
19
|
+
const pulumi = await this.getPulumiService.execute({
|
|
20
|
+
app
|
|
21
|
+
});
|
|
22
|
+
const projectAppRelativePath = path.join("apps", app.name);
|
|
23
|
+
let loginUrl = process.env.WEBINY_CLI_PULUMI_BACKEND || process.env.WEBINY_PULUMI_BACKEND;
|
|
24
|
+
if (loginUrl) {
|
|
25
|
+
const selfManagedBackend = SELF_MANAGED_BACKEND.find((item)=>loginUrl.startsWith(item));
|
|
26
|
+
if (selfManagedBackend) {
|
|
27
|
+
loginUrl = trimEnd(loginUrl, "/") + "/" + projectAppRelativePath;
|
|
28
|
+
loginUrl = loginUrl.replace(/\\/g, "/");
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
const project = this.getProjectService.execute();
|
|
32
|
+
const stateFilesFolder = project.paths.rootFolder.join(".pulumi", projectAppRelativePath).toString();
|
|
33
|
+
if (!fs.existsSync(stateFilesFolder)) fs.mkdirSync(stateFilesFolder, {
|
|
34
|
+
recursive: true
|
|
35
|
+
});
|
|
36
|
+
loginUrl = `file://${stateFilesFolder}`;
|
|
37
|
+
}
|
|
38
|
+
await pulumi.run({
|
|
39
|
+
command: [
|
|
40
|
+
"login",
|
|
41
|
+
loginUrl
|
|
42
|
+
]
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
login: loginUrl
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const pulumiLoginService = createImplementation({
|
|
50
|
+
abstraction: PulumiLoginService,
|
|
51
|
+
implementation: DefaultPulumiLoginService,
|
|
52
|
+
dependencies: [
|
|
53
|
+
GetPulumiService,
|
|
54
|
+
GetProjectService
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
export { DefaultPulumiLoginService, pulumiLoginService };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=PulumiLoginService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/PulumiLoginService/PulumiLoginService.js","sources":["../../../src/services/PulumiLoginService/PulumiLoginService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetPulumiService } from \"~/abstractions/services/GetPulumiService.js\";\nimport { PulumiLoginService } from \"~/abstractions/services/PulumiLoginService.js\";\nimport { GetProjectService } from \"@webiny/project/abstractions/index.js\";\nimport { type IAppModel } from \"@webiny/project/abstractions/models/index.js\";\nimport trimEnd from \"lodash/trimEnd.js\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nconst SELF_MANAGED_BACKEND = [\"s3://\", \"azblob://\", \"gs://\"];\n\nexport class DefaultPulumiLoginService implements PulumiLoginService.Interface {\n constructor(\n private getPulumiService: GetPulumiService.Interface,\n private getProjectService: GetProjectService.Interface\n ) {}\n\n async execute(app: IAppModel) {\n const pulumi = await this.getPulumiService.execute({ app });\n\n const projectAppRelativePath = path.join(\"apps\", app.name);\n\n // `WEBINY_CLI_PULUMI_BACKEND` is the canonical variable. We still read the legacy\n // `WEBINY_PULUMI_BACKEND` as a fallback, to preserve backwards compatibility.\n let loginUrl = process.env.WEBINY_CLI_PULUMI_BACKEND || process.env.WEBINY_PULUMI_BACKEND;\n\n if (loginUrl) {\n // If the user passed `s3://my-bucket`, we want to store files in `s3://my-bucket/{project-application-path}`\n const selfManagedBackend = SELF_MANAGED_BACKEND.find(item =>\n loginUrl!.startsWith(item)\n );\n if (selfManagedBackend) {\n loginUrl = trimEnd(loginUrl, \"/\") + \"/\" + projectAppRelativePath;\n loginUrl = loginUrl.replace(/\\\\/g, \"/\");\n }\n } else {\n // By default, we use local file system as backend. All files are stored in project root's\n // `.pulumi` folder, e.g. `.pulumi/apps/admin`.\n const project = this.getProjectService.execute();\n const stateFilesFolder = project.paths.rootFolder\n .join(\".pulumi\", projectAppRelativePath)\n .toString();\n\n if (!fs.existsSync(stateFilesFolder)) {\n fs.mkdirSync(stateFilesFolder, { recursive: true });\n }\n\n loginUrl = `file://${stateFilesFolder}`;\n }\n\n await pulumi.run({ command: [\"login\", loginUrl] });\n\n return { login: loginUrl };\n }\n}\n\nexport const pulumiLoginService = createImplementation({\n abstraction: PulumiLoginService,\n implementation: DefaultPulumiLoginService,\n dependencies: [GetPulumiService, GetProjectService]\n});\n"],"names":["SELF_MANAGED_BACKEND","DefaultPulumiLoginService","getPulumiService","getProjectService","app","pulumi","projectAppRelativePath","path","loginUrl","process","selfManagedBackend","item","trimEnd","project","stateFilesFolder","fs","pulumiLoginService","createImplementation","PulumiLoginService","GetPulumiService","GetProjectService"],"mappings":";;;;;;;AASA,MAAMA,uBAAuB;IAAC;IAAS;IAAa;CAAQ;AAErD,MAAMC;IACT,YACYC,gBAA4C,EAC5CC,iBAA8C,CACxD;aAFUD,gBAAgB,GAAhBA;aACAC,iBAAiB,GAAjBA;IACT;IAEH,MAAM,QAAQC,GAAc,EAAE;QAC1B,MAAMC,SAAS,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAED;QAAI;QAEzD,MAAME,yBAAyBC,KAAK,IAAI,CAAC,QAAQH,IAAI,IAAI;QAIzD,IAAII,WAAWC,QAAQ,GAAG,CAAC,yBAAyB,IAAIA,QAAQ,GAAG,CAAC,qBAAqB;QAEzF,IAAID,UAAU;YAEV,MAAME,qBAAqBV,qBAAqB,IAAI,CAACW,CAAAA,OACjDH,SAAU,UAAU,CAACG;YAEzB,IAAID,oBAAoB;gBACpBF,WAAWI,QAAQJ,UAAU,OAAO,MAAMF;gBAC1CE,WAAWA,SAAS,OAAO,CAAC,OAAO;YACvC;QACJ,OAAO;YAGH,MAAMK,UAAU,IAAI,CAAC,iBAAiB,CAAC,OAAO;YAC9C,MAAMC,mBAAmBD,QAAQ,KAAK,CAAC,UAAU,CAC5C,IAAI,CAAC,WAAWP,wBAChB,QAAQ;YAEb,IAAI,CAACS,GAAG,UAAU,CAACD,mBACfC,GAAG,SAAS,CAACD,kBAAkB;gBAAE,WAAW;YAAK;YAGrDN,WAAW,CAAC,OAAO,EAAEM,kBAAkB;QAC3C;QAEA,MAAMT,OAAO,GAAG,CAAC;YAAE,SAAS;gBAAC;gBAASG;aAAS;QAAC;QAEhD,OAAO;YAAE,OAAOA;QAAS;IAC7B;AACJ;AAEO,MAAMQ,qBAAqBC,qBAAqB;IACnD,aAAaC;IACb,gBAAgBjB;IAChB,cAAc;QAACkB;QAAkBC;KAAkB;AACvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiLoginService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiLoginService.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
2
|
+
import { LoggerService } from "@webiny/project/abstractions/index.js";
|
|
3
|
+
import { ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { PulumiGetConfigPassphraseService } from "../../abstractions/services/PulumiGetConfigPassphraseService.js";
|
|
5
|
+
import { PulumiGetSecretsProviderService } from "../../abstractions/services/PulumiGetSecretsProviderService.js";
|
|
6
|
+
import { PulumiLoginService } from "../../abstractions/services/PulumiLoginService.js";
|
|
7
|
+
import { PulumiSelectStackService } from "../../abstractions/services/PulumiSelectStackService.js";
|
|
8
|
+
import { type IAppModel } from "@webiny/project/abstractions/models/index.js";
|
|
9
|
+
export declare class DefaultPulumiSelectStackService implements PulumiSelectStackService.Interface {
|
|
10
|
+
private getPulumiService;
|
|
11
|
+
private pulumiLoginService;
|
|
12
|
+
private pulumiGetSecretsProviderService;
|
|
13
|
+
private pulumiGetConfigPassphraseService;
|
|
14
|
+
private loggerService;
|
|
15
|
+
private projectSdkParamsService;
|
|
16
|
+
constructor(getPulumiService: GetPulumiService.Interface, pulumiLoginService: PulumiLoginService.Interface, pulumiGetSecretsProviderService: PulumiGetSecretsProviderService.Interface, pulumiGetConfigPassphraseService: PulumiGetConfigPassphraseService.Interface, loggerService: LoggerService.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface);
|
|
17
|
+
execute(app: IAppModel): Promise<void>;
|
|
18
|
+
private getAppStackOutput;
|
|
19
|
+
}
|
|
20
|
+
export declare const pulumiSelectStackService: import("@webiny/di").Implementation<typeof DefaultPulumiSelectStackService>;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GetPulumiService } from "../../abstractions/services/GetPulumiService.js";
|
|
3
|
+
import { LoggerService, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { PulumiGetConfigPassphraseService } from "../../abstractions/services/PulumiGetConfigPassphraseService.js";
|
|
5
|
+
import { PulumiGetSecretsProviderService } from "../../abstractions/services/PulumiGetSecretsProviderService.js";
|
|
6
|
+
import { PulumiLoginService } from "../../abstractions/services/PulumiLoginService.js";
|
|
7
|
+
import { PulumiSelectStackService } from "../../abstractions/services/PulumiSelectStackService.js";
|
|
8
|
+
import { createEnvConfiguration } from "@webiny/project/utils/env/index.js";
|
|
9
|
+
import { withPulumiConfigPassphrase } from "../../utils/withPulumiConfigPassphrase.js";
|
|
10
|
+
import { getStackName } from "@webiny/project/utils/index.js";
|
|
11
|
+
const isCoreAppRegionMismatchCheckNeeded = (app)=>"core" !== app.name && "blueGreen" !== app.name;
|
|
12
|
+
class DefaultPulumiSelectStackService {
|
|
13
|
+
constructor(getPulumiService, pulumiLoginService, pulumiGetSecretsProviderService, pulumiGetConfigPassphraseService, loggerService, projectSdkParamsService){
|
|
14
|
+
this.getPulumiService = getPulumiService;
|
|
15
|
+
this.pulumiLoginService = pulumiLoginService;
|
|
16
|
+
this.pulumiGetSecretsProviderService = pulumiGetSecretsProviderService;
|
|
17
|
+
this.pulumiGetConfigPassphraseService = pulumiGetConfigPassphraseService;
|
|
18
|
+
this.loggerService = loggerService;
|
|
19
|
+
this.projectSdkParamsService = projectSdkParamsService;
|
|
20
|
+
}
|
|
21
|
+
async execute(app) {
|
|
22
|
+
const pulumi = await this.getPulumiService.execute({
|
|
23
|
+
app
|
|
24
|
+
});
|
|
25
|
+
await this.pulumiLoginService.execute(app);
|
|
26
|
+
const secretsProvider = this.pulumiGetSecretsProviderService.execute();
|
|
27
|
+
const configPassphrase = this.pulumiGetConfigPassphraseService.execute();
|
|
28
|
+
const sdkParams = this.projectSdkParamsService.get();
|
|
29
|
+
const stackName = getStackName({
|
|
30
|
+
env: sdkParams.env,
|
|
31
|
+
variant: sdkParams.variant
|
|
32
|
+
});
|
|
33
|
+
await pulumi.run({
|
|
34
|
+
command: [
|
|
35
|
+
"stack",
|
|
36
|
+
"select",
|
|
37
|
+
stackName
|
|
38
|
+
],
|
|
39
|
+
args: {
|
|
40
|
+
create: true,
|
|
41
|
+
secretsProvider
|
|
42
|
+
},
|
|
43
|
+
execa: {
|
|
44
|
+
env: createEnvConfiguration({
|
|
45
|
+
configurations: [
|
|
46
|
+
withPulumiConfigPassphrase(configPassphrase)
|
|
47
|
+
]
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
const region = sdkParams.region || process.env.AWS_REGION;
|
|
52
|
+
const mustPerformCoreAppRegionMismatchCheck = isCoreAppRegionMismatchCheckNeeded(app);
|
|
53
|
+
if (mustPerformCoreAppRegionMismatchCheck) {
|
|
54
|
+
const coreStack = await this.getAppStackOutput(app);
|
|
55
|
+
if (coreStack && coreStack.region && coreStack.region !== region) throw new Error(`Core App Region mismatch. Input: "${sdkParams.region || "none"}", process: "${process.env.AWS_REGION || "none"}". In Core stack: "${coreStack.region}". This can happen if you try to deploy a stack to a region different to the Core application region.`);
|
|
56
|
+
}
|
|
57
|
+
const targetStack = await this.getAppStackOutput(app);
|
|
58
|
+
if (!targetStack?.region || targetStack.region === region) return;
|
|
59
|
+
throw new Error(`Region mismatch. Input: "${sdkParams.region || "none"}", process: "${process.env.AWS_REGION || "none"}". In stack: "${targetStack.region}". This can happen if you try to deploy a stack to a region other than it was initially deployed.`);
|
|
60
|
+
}
|
|
61
|
+
async getAppStackOutput(app) {
|
|
62
|
+
const pulumi = await this.getPulumiService.execute({
|
|
63
|
+
app
|
|
64
|
+
});
|
|
65
|
+
const logger = this.loggerService;
|
|
66
|
+
const stackOutputString = await pulumi.run({
|
|
67
|
+
command: [
|
|
68
|
+
"stack",
|
|
69
|
+
"output"
|
|
70
|
+
],
|
|
71
|
+
args: {
|
|
72
|
+
json: true
|
|
73
|
+
},
|
|
74
|
+
execa: {
|
|
75
|
+
env: createEnvConfiguration({
|
|
76
|
+
configurations: [
|
|
77
|
+
withPulumiConfigPassphrase()
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
try {
|
|
83
|
+
const stackOutputJson = JSON.parse(stackOutputString.stdout);
|
|
84
|
+
if (!stackOutputJson) return null;
|
|
85
|
+
return stackOutputJson;
|
|
86
|
+
} catch {
|
|
87
|
+
logger.error("Could not parse stack output as JSON.", stackOutputString.stdout, app);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const pulumiSelectStackService = createImplementation({
|
|
93
|
+
abstraction: PulumiSelectStackService,
|
|
94
|
+
implementation: DefaultPulumiSelectStackService,
|
|
95
|
+
dependencies: [
|
|
96
|
+
GetPulumiService,
|
|
97
|
+
PulumiLoginService,
|
|
98
|
+
PulumiGetSecretsProviderService,
|
|
99
|
+
PulumiGetConfigPassphraseService,
|
|
100
|
+
LoggerService,
|
|
101
|
+
ProjectSdkParamsService
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
export { DefaultPulumiSelectStackService, pulumiSelectStackService };
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=PulumiSelectStackService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services/PulumiSelectStackService/PulumiSelectStackService.js","sources":["../../../src/services/PulumiSelectStackService/PulumiSelectStackService.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GetPulumiService } from \"~/abstractions/services/GetPulumiService.js\";\nimport { LoggerService } from \"@webiny/project/abstractions/index.js\";\nimport { ProjectSdkParamsService } from \"@webiny/project/abstractions/index.js\";\nimport { PulumiGetConfigPassphraseService } from \"~/abstractions/services/PulumiGetConfigPassphraseService.js\";\nimport { PulumiGetSecretsProviderService } from \"~/abstractions/services/PulumiGetSecretsProviderService.js\";\nimport { PulumiLoginService } from \"~/abstractions/services/PulumiLoginService.js\";\nimport { PulumiSelectStackService } from \"~/abstractions/services/PulumiSelectStackService.js\";\nimport { type IAppModel } from \"@webiny/project/abstractions/models/index.js\";\nimport { createEnvConfiguration } from \"@webiny/project/utils/env/index.js\";\nimport { withPulumiConfigPassphrase } from \"~/utils/withPulumiConfigPassphrase.js\";\nimport { getStackName } from \"@webiny/project/utils/index.js\";\n\n// Every app except core and blue-green is checked against the region stored in the core stack.\nconst isCoreAppRegionMismatchCheckNeeded = (app: IAppModel) => {\n return app.name !== \"core\" && app.name !== \"blueGreen\";\n};\n\nexport class DefaultPulumiSelectStackService implements PulumiSelectStackService.Interface {\n constructor(\n private getPulumiService: GetPulumiService.Interface,\n private pulumiLoginService: PulumiLoginService.Interface,\n private pulumiGetSecretsProviderService: PulumiGetSecretsProviderService.Interface,\n private pulumiGetConfigPassphraseService: PulumiGetConfigPassphraseService.Interface,\n private loggerService: LoggerService.Interface,\n private projectSdkParamsService: ProjectSdkParamsService.Interface\n ) {}\n\n async execute(app: IAppModel) {\n const pulumi = await this.getPulumiService.execute({ app });\n\n await this.pulumiLoginService.execute(app);\n\n const secretsProvider = this.pulumiGetSecretsProviderService.execute();\n const configPassphrase = this.pulumiGetConfigPassphraseService.execute();\n\n const sdkParams = this.projectSdkParamsService.get();\n const stackName = getStackName({ env: sdkParams.env, variant: sdkParams.variant });\n\n await pulumi.run({\n command: [\"stack\", \"select\", stackName],\n args: {\n create: true,\n secretsProvider\n },\n execa: {\n env: createEnvConfiguration({\n configurations: [withPulumiConfigPassphrase(configPassphrase)]\n })\n }\n });\n\n /**\n * A region from the input or process CANNOT be different to the region from the stack.\n * Also, if there is no stack, everything is ok.\n */\n const region = sdkParams.region || process.env.AWS_REGION;\n\n const mustPerformCoreAppRegionMismatchCheck = isCoreAppRegionMismatchCheckNeeded(app);\n\n if (mustPerformCoreAppRegionMismatchCheck) {\n const coreStack = await this.getAppStackOutput(app);\n if (coreStack && coreStack.region && coreStack.region !== region) {\n throw new Error(\n `Core App Region mismatch. Input: \"${sdkParams.region || \"none\"}\", process: \"${\n process.env.AWS_REGION || \"none\"\n }\". In Core stack: \"${\n coreStack.region\n }\". This can happen if you try to deploy a stack to a region different to the Core application region.`\n );\n }\n }\n\n const targetStack = await this.getAppStackOutput(app);\n\n if (!targetStack?.region || targetStack.region === region) {\n return;\n }\n\n throw new Error(\n `Region mismatch. Input: \"${sdkParams.region || \"none\"}\", process: \"${\n process.env.AWS_REGION || \"none\"\n }\". In stack: \"${\n targetStack.region\n }\". This can happen if you try to deploy a stack to a region other than it was initially deployed.`\n );\n }\n\n private async getAppStackOutput(app: IAppModel) {\n // We had to reimplement `getAppStackOutput` locally here. We could not use the existing\n // `PulumiGetStackOutputService` because, internally, it also depends on `PulumiSelectStackService`.\n // This would create a circular dependency. But also, this works just fine.\n const pulumi = await this.getPulumiService.execute({ app });\n const logger = this.loggerService;\n\n const stackOutputString = await pulumi.run({\n command: [\"stack\", \"output\"],\n args: {\n json: true\n },\n execa: {\n env: createEnvConfiguration({\n configurations: [withPulumiConfigPassphrase()]\n })\n }\n });\n\n try {\n const stackOutputJson = JSON.parse(stackOutputString.stdout as string);\n if (!stackOutputJson) {\n return null;\n }\n\n return stackOutputJson;\n } catch {\n logger.error(\"Could not parse stack output as JSON.\", stackOutputString.stdout, app);\n return null;\n }\n }\n}\n\nexport const pulumiSelectStackService = createImplementation({\n abstraction: PulumiSelectStackService,\n implementation: DefaultPulumiSelectStackService,\n dependencies: [\n GetPulumiService,\n PulumiLoginService,\n PulumiGetSecretsProviderService,\n PulumiGetConfigPassphraseService,\n LoggerService,\n ProjectSdkParamsService\n ]\n});\n"],"names":["isCoreAppRegionMismatchCheckNeeded","app","DefaultPulumiSelectStackService","getPulumiService","pulumiLoginService","pulumiGetSecretsProviderService","pulumiGetConfigPassphraseService","loggerService","projectSdkParamsService","pulumi","secretsProvider","configPassphrase","sdkParams","stackName","getStackName","createEnvConfiguration","withPulumiConfigPassphrase","region","process","mustPerformCoreAppRegionMismatchCheck","coreStack","Error","targetStack","logger","stackOutputString","stackOutputJson","JSON","pulumiSelectStackService","createImplementation","PulumiSelectStackService","GetPulumiService","PulumiLoginService","PulumiGetSecretsProviderService","PulumiGetConfigPassphraseService","LoggerService","ProjectSdkParamsService"],"mappings":";;;;;;;;;;AAcA,MAAMA,qCAAqC,CAACC,MACjCA,AAAa,WAAbA,IAAI,IAAI,IAAeA,AAAa,gBAAbA,IAAI,IAAI;AAGnC,MAAMC;IACT,YACYC,gBAA4C,EAC5CC,kBAAgD,EAChDC,+BAA0E,EAC1EC,gCAA4E,EAC5EC,aAAsC,EACtCC,uBAA0D,CACpE;aANUL,gBAAgB,GAAhBA;aACAC,kBAAkB,GAAlBA;aACAC,+BAA+B,GAA/BA;aACAC,gCAAgC,GAAhCA;aACAC,aAAa,GAAbA;aACAC,uBAAuB,GAAvBA;IACT;IAEH,MAAM,QAAQP,GAAc,EAAE;QAC1B,MAAMQ,SAAS,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAER;QAAI;QAEzD,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAACA;QAEtC,MAAMS,kBAAkB,IAAI,CAAC,+BAA+B,CAAC,OAAO;QACpE,MAAMC,mBAAmB,IAAI,CAAC,gCAAgC,CAAC,OAAO;QAEtE,MAAMC,YAAY,IAAI,CAAC,uBAAuB,CAAC,GAAG;QAClD,MAAMC,YAAYC,aAAa;YAAE,KAAKF,UAAU,GAAG;YAAE,SAASA,UAAU,OAAO;QAAC;QAEhF,MAAMH,OAAO,GAAG,CAAC;YACb,SAAS;gBAAC;gBAAS;gBAAUI;aAAU;YACvC,MAAM;gBACF,QAAQ;gBACRH;YACJ;YACA,OAAO;gBACH,KAAKK,uBAAuB;oBACxB,gBAAgB;wBAACC,2BAA2BL;qBAAkB;gBAClE;YACJ;QACJ;QAMA,MAAMM,SAASL,UAAU,MAAM,IAAIM,QAAQ,GAAG,CAAC,UAAU;QAEzD,MAAMC,wCAAwCnB,mCAAmCC;QAEjF,IAAIkB,uCAAuC;YACvC,MAAMC,YAAY,MAAM,IAAI,CAAC,iBAAiB,CAACnB;YAC/C,IAAImB,aAAaA,UAAU,MAAM,IAAIA,UAAU,MAAM,KAAKH,QACtD,MAAM,IAAII,MACN,CAAC,kCAAkC,EAAET,UAAU,MAAM,IAAI,OAAO,aAAa,EACzEM,QAAQ,GAAG,CAAC,UAAU,IAAI,OAC7B,mBAAmB,EAChBE,UAAU,MAAM,CACnB,qGAAqG,CAAC;QAGnH;QAEA,MAAME,cAAc,MAAM,IAAI,CAAC,iBAAiB,CAACrB;QAEjD,IAAI,CAACqB,aAAa,UAAUA,YAAY,MAAM,KAAKL,QAC/C;QAGJ,MAAM,IAAII,MACN,CAAC,yBAAyB,EAAET,UAAU,MAAM,IAAI,OAAO,aAAa,EAChEM,QAAQ,GAAG,CAAC,UAAU,IAAI,OAC7B,cAAc,EACXI,YAAY,MAAM,CACrB,iGAAiG,CAAC;IAE3G;IAEA,MAAc,kBAAkBrB,GAAc,EAAE;QAI5C,MAAMQ,SAAS,MAAM,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;YAAER;QAAI;QACzD,MAAMsB,SAAS,IAAI,CAAC,aAAa;QAEjC,MAAMC,oBAAoB,MAAMf,OAAO,GAAG,CAAC;YACvC,SAAS;gBAAC;gBAAS;aAAS;YAC5B,MAAM;gBACF,MAAM;YACV;YACA,OAAO;gBACH,KAAKM,uBAAuB;oBACxB,gBAAgB;wBAACC;qBAA6B;gBAClD;YACJ;QACJ;QAEA,IAAI;YACA,MAAMS,kBAAkBC,KAAK,KAAK,CAACF,kBAAkB,MAAM;YAC3D,IAAI,CAACC,iBACD,OAAO;YAGX,OAAOA;QACX,EAAE,OAAM;YACJF,OAAO,KAAK,CAAC,yCAAyCC,kBAAkB,MAAM,EAAEvB;YAChF,OAAO;QACX;IACJ;AACJ;AAEO,MAAM0B,2BAA2BC,qBAAqB;IACzD,aAAaC;IACb,gBAAgB3B;IAChB,cAAc;QACV4B;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiSelectStackService.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./PulumiSelectStackService.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GetProjectService } from "@webiny/project/abstractions/index.js";
|
|
2
|
+
import { LoggerService } from "@webiny/project/abstractions/index.js";
|
|
3
|
+
import { ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
4
|
+
import { StackOutputCacheService } from "../../abstractions/services/StackOutputCacheService.js";
|
|
5
|
+
import { type IAppModel } from "@webiny/project/abstractions/models/index.js";
|
|
6
|
+
export declare class DefaultStackOutputCacheService implements StackOutputCacheService.Interface {
|
|
7
|
+
private getProjectService;
|
|
8
|
+
private projectSdkParamsService;
|
|
9
|
+
private loggerService;
|
|
10
|
+
private static readonly DEFAULT_ENV;
|
|
11
|
+
private static readonly DEFAULT_REGION;
|
|
12
|
+
private static readonly DEFAULT_VARIANT;
|
|
13
|
+
constructor(getProjectService: GetProjectService.Interface, projectSdkParamsService: ProjectSdkParamsService.Interface, loggerService: LoggerService.Interface);
|
|
14
|
+
read(app: IAppModel): Promise<Record<string, any> | null>;
|
|
15
|
+
write(app: IAppModel, data: Record<string, any>): Promise<void>;
|
|
16
|
+
delete(app: IAppModel): Promise<void>;
|
|
17
|
+
private getCacheKey;
|
|
18
|
+
private getCacheDir;
|
|
19
|
+
private getCachePath;
|
|
20
|
+
}
|
|
21
|
+
export declare const stackOutputCacheService: import("@webiny/di").Implementation<typeof DefaultStackOutputCacheService>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GetProjectService, LoggerService, ProjectSdkParamsService } from "@webiny/project/abstractions/index.js";
|
|
3
|
+
import { StackOutputCacheService } from "../../abstractions/services/StackOutputCacheService.js";
|
|
4
|
+
import promises from "fs/promises";
|
|
5
|
+
class DefaultStackOutputCacheService {
|
|
6
|
+
static{
|
|
7
|
+
this.DEFAULT_ENV = "dev";
|
|
8
|
+
}
|
|
9
|
+
static{
|
|
10
|
+
this.DEFAULT_REGION = "default";
|
|
11
|
+
}
|
|
12
|
+
static{
|
|
13
|
+
this.DEFAULT_VARIANT = "default";
|
|
14
|
+
}
|
|
15
|
+
constructor(getProjectService, projectSdkParamsService, loggerService){
|
|
16
|
+
this.getProjectService = getProjectService;
|
|
17
|
+
this.projectSdkParamsService = projectSdkParamsService;
|
|
18
|
+
this.loggerService = loggerService;
|
|
19
|
+
}
|
|
20
|
+
async read(app) {
|
|
21
|
+
const cachePath = this.getCachePath(app);
|
|
22
|
+
try {
|
|
23
|
+
const content = await promises.readFile(cachePath, "utf-8");
|
|
24
|
+
const data = JSON.parse(content);
|
|
25
|
+
this.loggerService.debug({
|
|
26
|
+
app: app.name,
|
|
27
|
+
cacheKey: this.getCacheKey(app)
|
|
28
|
+
}, "Stack output read from cache");
|
|
29
|
+
return data;
|
|
30
|
+
} catch {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async write(app, data) {
|
|
35
|
+
const cachePath = this.getCachePath(app);
|
|
36
|
+
const cacheDir = this.getCacheDir().toString();
|
|
37
|
+
try {
|
|
38
|
+
await promises.mkdir(cacheDir, {
|
|
39
|
+
recursive: true
|
|
40
|
+
});
|
|
41
|
+
await promises.writeFile(cachePath, JSON.stringify(data, null, 2), "utf-8");
|
|
42
|
+
this.loggerService.debug("Stack output stored to cache", {
|
|
43
|
+
app: app.name,
|
|
44
|
+
cacheKey: this.getCacheKey(app)
|
|
45
|
+
});
|
|
46
|
+
} catch (error) {
|
|
47
|
+
this.loggerService.error("Could not write to cache file.", cachePath, error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async delete(app) {
|
|
51
|
+
const cachePath = this.getCachePath(app);
|
|
52
|
+
try {
|
|
53
|
+
await promises.rm(cachePath, {
|
|
54
|
+
force: true
|
|
55
|
+
});
|
|
56
|
+
this.loggerService.debug("Stack output cache deleted.", {
|
|
57
|
+
app: app.name,
|
|
58
|
+
cacheKey: this.getCacheKey(app)
|
|
59
|
+
});
|
|
60
|
+
} catch (error) {
|
|
61
|
+
this.loggerService.error("Could not delete stack output cache file.", cachePath, error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
getCacheKey(app) {
|
|
65
|
+
const sdkParams = this.projectSdkParamsService.get();
|
|
66
|
+
const env = sdkParams.env || DefaultStackOutputCacheService.DEFAULT_ENV;
|
|
67
|
+
const region = sdkParams.region || DefaultStackOutputCacheService.DEFAULT_REGION;
|
|
68
|
+
const variant = sdkParams.variant || DefaultStackOutputCacheService.DEFAULT_VARIANT;
|
|
69
|
+
return `${app.name}-${env}-${region}-${variant}.json`;
|
|
70
|
+
}
|
|
71
|
+
getCacheDir() {
|
|
72
|
+
const project = this.getProjectService.execute();
|
|
73
|
+
return project.paths.dotWebinyFolder.join("caches", "stack-output");
|
|
74
|
+
}
|
|
75
|
+
getCachePath(app) {
|
|
76
|
+
return this.getCacheDir().join(this.getCacheKey(app)).toString();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const stackOutputCacheService = createImplementation({
|
|
80
|
+
abstraction: StackOutputCacheService,
|
|
81
|
+
implementation: DefaultStackOutputCacheService,
|
|
82
|
+
dependencies: [
|
|
83
|
+
GetProjectService,
|
|
84
|
+
ProjectSdkParamsService,
|
|
85
|
+
LoggerService
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
export { DefaultStackOutputCacheService, stackOutputCacheService };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=StackOutputCacheService.js.map
|