@webiny/project 6.3.0-beta.4 → 6.4.0-beta.0
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/GracefulError.js +13 -15
- package/GracefulError.js.map +1 -1
- package/ProjectError.js +11 -13
- package/ProjectError.js.map +1 -1
- package/ProjectSdk.js +113 -129
- package/ProjectSdk.js.map +1 -1
- package/abstractions/createAbstraction.js +3 -2
- package/abstractions/createAbstraction.js.map +1 -1
- package/abstractions/features/BuildApp.js +2 -1
- package/abstractions/features/BuildApp.js.map +1 -1
- package/abstractions/features/BuildExtension.js +2 -1
- package/abstractions/features/BuildExtension.js.map +1 -1
- package/abstractions/features/DeployApp.js +2 -1
- package/abstractions/features/DeployApp.js.map +1 -1
- package/abstractions/features/DestroyApp.js +2 -1
- package/abstractions/features/DestroyApp.js.map +1 -1
- package/abstractions/features/ExportStack.js +2 -1
- package/abstractions/features/ExportStack.js.map +1 -1
- package/abstractions/features/GetApp.js +2 -1
- package/abstractions/features/GetApp.js.map +1 -1
- package/abstractions/features/GetAppOutput.js +2 -1
- package/abstractions/features/GetAppOutput.js.map +1 -1
- package/abstractions/features/GetAppStackOutput.js +2 -6
- package/abstractions/features/GetAppStackOutput.js.map +1 -1
- package/abstractions/features/GetFeatureFlags.js +2 -1
- package/abstractions/features/GetFeatureFlags.js.map +1 -1
- package/abstractions/features/GetLogger.js +2 -1
- package/abstractions/features/GetLogger.js.map +1 -1
- package/abstractions/features/GetProductionEnvironments.js +2 -1
- package/abstractions/features/GetProductionEnvironments.js.map +1 -1
- package/abstractions/features/GetProject.js +2 -1
- package/abstractions/features/GetProject.js.map +1 -1
- package/abstractions/features/GetProjectConfig.js +2 -1
- package/abstractions/features/GetProjectConfig.js.map +1 -1
- package/abstractions/features/GetProjectInfo.js +2 -1
- package/abstractions/features/GetProjectInfo.js.map +1 -1
- package/abstractions/features/GetPulumiResourceNamePrefix.js +2 -1
- package/abstractions/features/GetPulumiResourceNamePrefix.js.map +1 -1
- package/abstractions/features/InstallExtension.js +2 -1
- package/abstractions/features/InstallExtension.js.map +1 -1
- package/abstractions/features/IsCi.js +2 -1
- package/abstractions/features/IsCi.js.map +1 -1
- package/abstractions/features/IsTelemetryEnabled.js +2 -1
- package/abstractions/features/IsTelemetryEnabled.js.map +1 -1
- package/abstractions/features/IsWcpEnabled.js +2 -1
- package/abstractions/features/IsWcpEnabled.js.map +1 -1
- package/abstractions/features/IsWebinyJsRepo.js +2 -1
- package/abstractions/features/IsWebinyJsRepo.js.map +1 -1
- package/abstractions/features/RefreshApp.js +2 -1
- package/abstractions/features/RefreshApp.js.map +1 -1
- package/abstractions/features/RunPulumiCommand.js +2 -1
- package/abstractions/features/RunPulumiCommand.js.map +1 -1
- package/abstractions/features/ValidateProjectConfig.js +2 -1
- package/abstractions/features/ValidateProjectConfig.js.map +1 -1
- package/abstractions/features/Watch.js +2 -1
- package/abstractions/features/Watch.js.map +1 -1
- package/abstractions/features/hooks/AdminAfterBuild.js +2 -1
- package/abstractions/features/hooks/AdminAfterBuild.js.map +1 -1
- package/abstractions/features/hooks/AdminAfterDeploy.js +2 -1
- package/abstractions/features/hooks/AdminAfterDeploy.js.map +1 -1
- package/abstractions/features/hooks/AdminBeforeBuild.js +2 -1
- package/abstractions/features/hooks/AdminBeforeBuild.js.map +1 -1
- package/abstractions/features/hooks/AdminBeforeDeploy.js +2 -1
- package/abstractions/features/hooks/AdminBeforeDeploy.js.map +1 -1
- package/abstractions/features/hooks/AdminBeforeWatch.js +2 -1
- package/abstractions/features/hooks/AdminBeforeWatch.js.map +1 -1
- package/abstractions/features/hooks/AfterBuild.js +2 -1
- package/abstractions/features/hooks/AfterBuild.js.map +1 -1
- package/abstractions/features/hooks/AfterDeploy.js +2 -1
- package/abstractions/features/hooks/AfterDeploy.js.map +1 -1
- package/abstractions/features/hooks/ApiAfterBuild.js +2 -1
- package/abstractions/features/hooks/ApiAfterBuild.js.map +1 -1
- package/abstractions/features/hooks/ApiAfterDeploy.js +2 -1
- package/abstractions/features/hooks/ApiAfterDeploy.js.map +1 -1
- package/abstractions/features/hooks/ApiBeforeBuild.js +2 -1
- package/abstractions/features/hooks/ApiBeforeBuild.js.map +1 -1
- package/abstractions/features/hooks/ApiBeforeDeploy.js +2 -1
- package/abstractions/features/hooks/ApiBeforeDeploy.js.map +1 -1
- package/abstractions/features/hooks/ApiBeforeWatch.js +2 -1
- package/abstractions/features/hooks/ApiBeforeWatch.js.map +1 -1
- package/abstractions/features/hooks/BeforeBuild.js +2 -1
- package/abstractions/features/hooks/BeforeBuild.js.map +1 -1
- package/abstractions/features/hooks/BeforeDeploy.js +2 -1
- package/abstractions/features/hooks/BeforeDeploy.js.map +1 -1
- package/abstractions/features/hooks/BeforeWatch.js +2 -1
- package/abstractions/features/hooks/BeforeWatch.js.map +1 -1
- package/abstractions/features/hooks/CoreAfterBuild.js +2 -1
- package/abstractions/features/hooks/CoreAfterBuild.js.map +1 -1
- package/abstractions/features/hooks/CoreAfterDeploy.js +2 -1
- package/abstractions/features/hooks/CoreAfterDeploy.js.map +1 -1
- package/abstractions/features/hooks/CoreBeforeBuild.js +2 -1
- package/abstractions/features/hooks/CoreBeforeBuild.js.map +1 -1
- package/abstractions/features/hooks/CoreBeforeDeploy.js +2 -1
- package/abstractions/features/hooks/CoreBeforeDeploy.js.map +1 -1
- package/abstractions/features/hooks/CoreBeforeWatch.js +2 -1
- package/abstractions/features/hooks/CoreBeforeWatch.js.map +1 -1
- package/abstractions/features/hooks/index.js +0 -2
- package/abstractions/features/index.js +0 -2
- package/abstractions/index.js +0 -2
- package/abstractions/models/IAppModel.js +0 -3
- package/abstractions/models/IAppPackageModel.js +0 -3
- package/abstractions/models/IPathModel.js +0 -3
- package/abstractions/models/IProjectConfigDto.js +0 -3
- package/abstractions/models/IProjectConfigModel.js +0 -3
- package/abstractions/models/IProjectModel.js +0 -3
- package/abstractions/models/IUrlModel.js +0 -3
- package/abstractions/models/IWcpEnvironmentDto.js +0 -3
- package/abstractions/models/IWcpEnvironmentModel.js +0 -3
- package/abstractions/models/IWcpUserDto.js +0 -3
- package/abstractions/models/IWcpUserModel.js +0 -3
- package/abstractions/models/IWcpUserPatDto.js +0 -3
- package/abstractions/models/IWcpUserPatModel.js +0 -3
- package/abstractions/models/PackagesBuilder/IPackagesBuilder.js +0 -3
- package/abstractions/models/PackagesBuilder/IRunnableBuildProcess.js +0 -3
- package/abstractions/models/PackagesBuilder/IRunnableBuildProcesses.js +0 -3
- package/abstractions/models/PackagesBuilder/index.js +0 -3
- package/abstractions/models/index.js +0 -3
- package/abstractions/services/BuildAppWorkspaceService.js +2 -1
- package/abstractions/services/BuildAppWorkspaceService.js.map +1 -1
- package/abstractions/services/BuildProjectWorkspaceService.js +2 -1
- package/abstractions/services/BuildProjectWorkspaceService.js.map +1 -1
- package/abstractions/services/GetAppPackagesService.js +2 -1
- package/abstractions/services/GetAppPackagesService.js.map +1 -1
- package/abstractions/services/GetAppService.js +2 -1
- package/abstractions/services/GetAppService.js.map +1 -1
- package/abstractions/services/GetCwdService.js +2 -1
- package/abstractions/services/GetCwdService.js.map +1 -1
- package/abstractions/services/GetProjectConfigService.js +2 -1
- package/abstractions/services/GetProjectConfigService.js.map +1 -1
- package/abstractions/services/GetProjectIdService.js +2 -1
- package/abstractions/services/GetProjectIdService.js.map +1 -1
- package/abstractions/services/GetProjectService.js +2 -1
- package/abstractions/services/GetProjectService.js.map +1 -1
- package/abstractions/services/GetProjectVersionService.js +2 -1
- package/abstractions/services/GetProjectVersionService.js.map +1 -1
- package/abstractions/services/GetPulumiService.js +2 -1
- package/abstractions/services/GetPulumiService.js.map +1 -1
- package/abstractions/services/InitProjectSdkService.js +2 -1
- package/abstractions/services/InitProjectSdkService.js.map +1 -1
- package/abstractions/services/InstallExtensionService.js +2 -1
- package/abstractions/services/InstallExtensionService.js.map +1 -1
- package/abstractions/services/IsRemotePulumiBackendService.js +2 -1
- package/abstractions/services/IsRemotePulumiBackendService.js.map +1 -1
- package/abstractions/services/ListAppLambdaFunctionsService.js +2 -1
- package/abstractions/services/ListAppLambdaFunctionsService.js.map +1 -1
- package/abstractions/services/ListDeployedEnvironmentsService.js +2 -1
- package/abstractions/services/ListDeployedEnvironmentsService.js.map +1 -1
- package/abstractions/services/ListPackagesInAppWorkspaceService.js +2 -1
- package/abstractions/services/ListPackagesInAppWorkspaceService.js.map +1 -1
- package/abstractions/services/ListPackagesService.js +2 -1
- package/abstractions/services/ListPackagesService.js.map +1 -1
- package/abstractions/services/LoadEnvVarsService.js +2 -1
- package/abstractions/services/LoadEnvVarsService.js.map +1 -1
- package/abstractions/services/LocalStorageService.js +2 -1
- package/abstractions/services/LocalStorageService.js.map +1 -1
- package/abstractions/services/LoggerService.js +2 -1
- package/abstractions/services/LoggerService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/GetIsCiService.js +2 -1
- package/abstractions/services/ProjectInfoService/GetIsCiService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/GetNpmVersionService.js +2 -1
- package/abstractions/services/ProjectInfoService/GetNpmVersionService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/GetNpxVersionService.js +2 -1
- package/abstractions/services/ProjectInfoService/GetNpxVersionService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/GetPulumiVersionService.js +2 -1
- package/abstractions/services/ProjectInfoService/GetPulumiVersionService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/GetYarnVersionService.js +2 -1
- package/abstractions/services/ProjectInfoService/GetYarnVersionService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/ProjectInfoService.js +2 -1
- package/abstractions/services/ProjectInfoService/ProjectInfoService.js.map +1 -1
- package/abstractions/services/ProjectInfoService/index.js +0 -2
- package/abstractions/services/ProjectSdkParamsService.js +2 -1
- package/abstractions/services/ProjectSdkParamsService.js.map +1 -1
- package/abstractions/services/PulumiExportService.js +3 -4
- package/abstractions/services/PulumiExportService.js.map +1 -1
- package/abstractions/services/PulumiGetConfigPassphraseService.js +2 -1
- package/abstractions/services/PulumiGetConfigPassphraseService.js.map +1 -1
- package/abstractions/services/PulumiGetSecretsProviderService.js +2 -1
- package/abstractions/services/PulumiGetSecretsProviderService.js.map +1 -1
- package/abstractions/services/PulumiGetStackOutputService.js +2 -1
- package/abstractions/services/PulumiGetStackOutputService.js.map +1 -1
- package/abstractions/services/PulumiImportService.js +2 -1
- package/abstractions/services/PulumiImportService.js.map +1 -1
- package/abstractions/services/PulumiLoginService.js +2 -1
- package/abstractions/services/PulumiLoginService.js.map +1 -1
- package/abstractions/services/PulumiSelectStackService.js +2 -1
- package/abstractions/services/PulumiSelectStackService.js.map +1 -1
- package/abstractions/services/SetProjectIdService.js +2 -1
- package/abstractions/services/SetProjectIdService.js.map +1 -1
- package/abstractions/services/StdioService.js +2 -1
- package/abstractions/services/StdioService.js.map +1 -1
- package/abstractions/services/UiService.js +2 -1
- package/abstractions/services/UiService.js.map +1 -1
- package/abstractions/services/ValidateProjectConfigService.js +2 -1
- package/abstractions/services/ValidateProjectConfigService.js.map +1 -1
- package/abstractions/services/WatchedLambdaFunctionsService.js +2 -1
- package/abstractions/services/WatchedLambdaFunctionsService.js.map +1 -1
- package/abstractions/services/WcpService.js +2 -1
- package/abstractions/services/WcpService.js.map +1 -1
- package/abstractions/services/index.js +0 -2
- package/abstractions/types.js +0 -3
- package/components/Wcp.js +27 -38
- package/components/Wcp.js.map +1 -1
- package/createProjectSdkContainer.js +103 -112
- package/createProjectSdkContainer.js.map +1 -1
- package/decorators/BuildAppWithHooks.js +54 -44
- package/decorators/BuildAppWithHooks.js.map +1 -1
- package/decorators/DeployAppClearWatchedLambdaFunctions.js +27 -29
- package/decorators/DeployAppClearWatchedLambdaFunctions.js.map +1 -1
- package/decorators/DeployAppRefreshStackOutputCache.js +26 -30
- package/decorators/DeployAppRefreshStackOutputCache.js.map +1 -1
- package/decorators/DeployAppWithHooks.js +51 -41
- package/decorators/DeployAppWithHooks.js.map +1 -1
- package/decorators/DeployAppWithWatchedLambdaReplacement.js +33 -37
- package/decorators/DeployAppWithWatchedLambdaReplacement.js.map +1 -1
- package/decorators/GetFeatureFlagsWithLicense.js +36 -57
- package/decorators/GetFeatureFlagsWithLicense.js.map +1 -1
- package/decorators/GetPulumiServiceWithDownloadInfo.js +21 -19
- package/decorators/GetPulumiServiceWithDownloadInfo.js.map +1 -1
- package/decorators/WatchWithHooks.js +30 -27
- package/decorators/WatchWithHooks.js.map +1 -1
- package/decorators/index.js +0 -2
- package/defineExtension/createExtensionDefinition.js +12 -19
- package/defineExtension/createExtensionDefinition.js.map +1 -1
- package/defineExtension/createExtensionReactComponent.js +40 -46
- package/defineExtension/createExtensionReactComponent.js.map +1 -1
- package/defineExtension/defineExtension.js +8 -9
- package/defineExtension/defineExtension.js.map +1 -1
- package/defineExtension/index.js +0 -2
- package/defineExtension/models/ExtensionDefinitionModel.js +11 -10
- package/defineExtension/models/ExtensionDefinitionModel.js.map +1 -1
- package/defineExtension/models/ExtensionInstanceModel.js +23 -24
- package/defineExtension/models/ExtensionInstanceModel.js.map +1 -1
- package/defineExtension/models/index.js +0 -2
- package/defineExtension/types.js +0 -3
- package/defineExtension/zodTypes/zodSrcPath.js +35 -61
- package/defineExtension/zodTypes/zodSrcPath.js.map +1 -1
- package/exports/infra/admin.js +0 -2
- package/exports/infra/api.js +0 -2
- package/exports/infra/core.js +0 -2
- package/exports/infra.js +0 -2
- package/extensions/AdminBuildParam.js +105 -147
- package/extensions/AdminBuildParam.js.map +1 -1
- package/extensions/AdminExtension.js +64 -90
- package/extensions/AdminExtension.js.map +1 -1
- package/extensions/ApiBuildParam.js +71 -97
- package/extensions/ApiBuildParam.js.map +1 -1
- package/extensions/ApiExtension.js +71 -92
- package/extensions/ApiExtension.js.map +1 -1
- package/extensions/DatabaseSetup.js +14 -9
- package/extensions/DatabaseSetup.js.map +1 -1
- package/extensions/EnvVar.js +12 -16
- package/extensions/EnvVar.js.map +1 -1
- package/extensions/ExtensionDefinitions.js +11 -10
- package/extensions/ExtensionDefinitions.js.map +1 -1
- package/extensions/FeatureFlags.js +47 -48
- package/extensions/FeatureFlags.js.map +1 -1
- package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.js +20 -21
- package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.js.map +1 -1
- package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.js +20 -21
- package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.js.map +1 -1
- package/extensions/Project/EnsureApiDeployedBeforeWatch.js +20 -21
- package/extensions/Project/EnsureApiDeployedBeforeWatch.js.map +1 -1
- package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js +22 -25
- package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js.map +1 -1
- package/extensions/Project/EnsureTelemetryEnabledForOss.js +25 -28
- package/extensions/Project/EnsureTelemetryEnabledForOss.js.map +1 -1
- package/extensions/Project/SetAdminAppEnvVarsBeforeBuild.js +29 -34
- package/extensions/Project/SetAdminAppEnvVarsBeforeBuild.js.map +1 -1
- package/extensions/Project/SetAdminAppEnvVarsBeforeWatch.js +30 -35
- package/extensions/Project/SetAdminAppEnvVarsBeforeWatch.js.map +1 -1
- package/extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.js +12 -9
- package/extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.js.map +1 -1
- package/extensions/Project/ShowConfigChangeInfoBeforeApiWatch.js +12 -9
- package/extensions/Project/ShowConfigChangeInfoBeforeApiWatch.js.map +1 -1
- package/extensions/Project/TelemetryNoLongerNewUser.js +7 -7
- package/extensions/Project/TelemetryNoLongerNewUser.js.map +1 -1
- package/extensions/Project/ValidateEncryptionBeforeDeploy.js +22 -23
- package/extensions/Project/ValidateEncryptionBeforeDeploy.js.map +1 -1
- package/extensions/Project/ValidateProductionPulumiState.js +25 -28
- package/extensions/Project/ValidateProductionPulumiState.js.map +1 -1
- package/extensions/Project/WcpInjectTelemetryClientAfterBuild.js +46 -51
- package/extensions/Project/WcpInjectTelemetryClientAfterBuild.js.map +1 -1
- package/extensions/Project.js +29 -30
- package/extensions/Project.js.map +1 -1
- package/extensions/ProjectDecorator.js +13 -16
- package/extensions/ProjectDecorator.js.map +1 -1
- package/extensions/ProjectId.js +11 -13
- package/extensions/ProjectId.js.map +1 -1
- package/extensions/ProjectImplementation.js +14 -17
- package/extensions/ProjectImplementation.js.map +1 -1
- package/extensions/Telemetry.js +10 -9
- package/extensions/Telemetry.js.map +1 -1
- package/extensions/hooks/AdminAfterBuild.js +16 -19
- package/extensions/hooks/AdminAfterBuild.js.map +1 -1
- package/extensions/hooks/AdminAfterDeploy.js +16 -19
- package/extensions/hooks/AdminAfterDeploy.js.map +1 -1
- package/extensions/hooks/AdminBeforeBuild.js +16 -19
- package/extensions/hooks/AdminBeforeBuild.js.map +1 -1
- package/extensions/hooks/AdminBeforeDeploy.js +16 -19
- package/extensions/hooks/AdminBeforeDeploy.js.map +1 -1
- package/extensions/hooks/AdminBeforeWatch.js +16 -19
- package/extensions/hooks/AdminBeforeWatch.js.map +1 -1
- package/extensions/hooks/AfterBuild.js +15 -18
- package/extensions/hooks/AfterBuild.js.map +1 -1
- package/extensions/hooks/AfterDeploy.js +15 -18
- package/extensions/hooks/AfterDeploy.js.map +1 -1
- package/extensions/hooks/ApiAfterBuild.js +16 -19
- package/extensions/hooks/ApiAfterBuild.js.map +1 -1
- package/extensions/hooks/ApiAfterDeploy.js +16 -19
- package/extensions/hooks/ApiAfterDeploy.js.map +1 -1
- package/extensions/hooks/ApiBeforeBuild.js +16 -19
- package/extensions/hooks/ApiBeforeBuild.js.map +1 -1
- package/extensions/hooks/ApiBeforeDeploy.js +16 -19
- package/extensions/hooks/ApiBeforeDeploy.js.map +1 -1
- package/extensions/hooks/ApiBeforeWatch.js +16 -19
- package/extensions/hooks/ApiBeforeWatch.js.map +1 -1
- package/extensions/hooks/BeforeBuild.js +15 -18
- package/extensions/hooks/BeforeBuild.js.map +1 -1
- package/extensions/hooks/BeforeDeploy.js +15 -18
- package/extensions/hooks/BeforeDeploy.js.map +1 -1
- package/extensions/hooks/BeforeWatch.js +15 -18
- package/extensions/hooks/BeforeWatch.js.map +1 -1
- package/extensions/hooks/CoreAfterBuild.js +16 -19
- package/extensions/hooks/CoreAfterBuild.js.map +1 -1
- package/extensions/hooks/CoreAfterDeploy.js +16 -19
- package/extensions/hooks/CoreAfterDeploy.js.map +1 -1
- package/extensions/hooks/CoreBeforeBuild.js +16 -19
- package/extensions/hooks/CoreBeforeBuild.js.map +1 -1
- package/extensions/hooks/CoreBeforeDeploy.js +16 -19
- package/extensions/hooks/CoreBeforeDeploy.js.map +1 -1
- package/extensions/hooks/CoreBeforeWatch.js +16 -19
- package/extensions/hooks/CoreBeforeWatch.js.map +1 -1
- package/extensions/hooks/index.js +0 -2
- package/extensions/index.js +43 -57
- package/extensions/index.js.map +1 -1
- package/extensions/infra/Ci.js +8 -24
- package/extensions/infra/Ci.js.map +1 -1
- package/extensions/infra/Env.js +35 -92
- package/extensions/infra/Env.js.map +1 -1
- package/extensions/infra/index.js +0 -2
- package/extensions/pulumi/AdminStackOutputValue.js +13 -12
- package/extensions/pulumi/AdminStackOutputValue.js.map +1 -1
- package/extensions/pulumi/ApiStackOutputValue.js +13 -12
- package/extensions/pulumi/ApiStackOutputValue.js.map +1 -1
- package/extensions/pulumi/CoreStackOutputValue.js +13 -12
- package/extensions/pulumi/CoreStackOutputValue.js.map +1 -1
- package/extensions/pulumi/ProductionEnvironments.js +29 -39
- package/extensions/pulumi/ProductionEnvironments.js.map +1 -1
- package/extensions/pulumi/PulumiResourceNamePrefix.js +10 -9
- package/extensions/pulumi/PulumiResourceNamePrefix.js.map +1 -1
- package/extensions/pulumi/index.js +0 -2
- package/features/BuildApp/BuildApp.js +49 -40
- package/features/BuildApp/BuildApp.js.map +1 -1
- package/features/BuildApp/PackagesBuilder/PackagesBuilder.js +34 -39
- package/features/BuildApp/PackagesBuilder/PackagesBuilder.js.map +1 -1
- package/features/BuildApp/PackagesBuilder/RunnableBuildProcess.js +39 -33
- package/features/BuildApp/PackagesBuilder/RunnableBuildProcess.js.map +1 -1
- package/features/BuildApp/PackagesBuilder/RunnableBuildProcesses.js +39 -46
- package/features/BuildApp/PackagesBuilder/RunnableBuildProcesses.js.map +1 -1
- package/features/BuildApp/PackagesBuilder/worker.js +26 -34
- package/features/BuildApp/PackagesBuilder/worker.js.map +1 -1
- package/features/BuildApp/index.js +0 -2
- package/features/DeployApp/DeployApp.js +79 -79
- package/features/DeployApp/DeployApp.js.map +1 -1
- package/features/DeployApp/index.js +0 -2
- package/features/DestroyApp/DestroyApp.js +60 -46
- package/features/DestroyApp/DestroyApp.js.map +1 -1
- package/features/DestroyApp/index.js +0 -2
- package/features/ExportStack/ExportStack.js +21 -16
- package/features/ExportStack/ExportStack.js.map +1 -1
- package/features/ExportStack/index.js +0 -2
- package/features/GetApp/GetApp.js +14 -11
- package/features/GetApp/GetApp.js.map +1 -1
- package/features/GetApp/index.js +0 -2
- package/features/GetAppOutput/GetAppOutput.js +44 -33
- package/features/GetAppOutput/GetAppOutput.js.map +1 -1
- package/features/GetAppOutput/index.js +0 -2
- package/features/GetAppStackOutput/GetAppStackOutput.js +20 -15
- package/features/GetAppStackOutput/GetAppStackOutput.js.map +1 -1
- package/features/GetAppStackOutput/index.js +0 -2
- package/features/GetFeatureFlags/GetFeatureFlags.js +20 -19
- package/features/GetFeatureFlags/GetFeatureFlags.js.map +1 -1
- package/features/GetFeatureFlags/index.js +0 -2
- package/features/GetLogger/GetLogger.js +14 -11
- package/features/GetLogger/GetLogger.js.map +1 -1
- package/features/GetLogger/index.js +0 -2
- package/features/GetProductionEnvironments/GetProductionEnvironments.js +24 -19
- package/features/GetProductionEnvironments/GetProductionEnvironments.js.map +1 -1
- package/features/GetProductionEnvironments/index.js +0 -2
- package/features/GetProject/GetProject.js +14 -11
- package/features/GetProject/GetProject.js.map +1 -1
- package/features/GetProject/index.js +0 -2
- package/features/GetProjectConfig/GetProjectConfig.js +14 -11
- package/features/GetProjectConfig/GetProjectConfig.js.map +1 -1
- package/features/GetProjectConfig/index.js +0 -2
- package/features/GetProjectInfo/GetProjectInfo.js +14 -11
- package/features/GetProjectInfo/GetProjectInfo.js.map +1 -1
- package/features/GetProjectInfo/index.js +0 -2
- package/features/GetPulumiResourceNamePrefix/GetPulumiResourceNamePrefix.js +18 -17
- package/features/GetPulumiResourceNamePrefix/GetPulumiResourceNamePrefix.js.map +1 -1
- package/features/GetPulumiResourceNamePrefix/index.js +0 -2
- package/features/InstallExtension/InstallExtension.js +14 -11
- package/features/InstallExtension/InstallExtension.js.map +1 -1
- package/features/InstallExtension/index.js +0 -2
- package/features/IsCi/IsCi.js +14 -11
- package/features/IsCi/IsCi.js.map +1 -1
- package/features/IsCi/index.js +0 -2
- package/features/IsTelemetryEnabled/IsTelemetryEnabled.js +19 -18
- package/features/IsTelemetryEnabled/IsTelemetryEnabled.js.map +1 -1
- package/features/IsTelemetryEnabled/index.js +0 -2
- package/features/IsWcpEnabled/IsWcpEnabled.js +15 -12
- package/features/IsWcpEnabled/IsWcpEnabled.js.map +1 -1
- package/features/IsWcpEnabled/index.js +0 -2
- package/features/IsWebinyJsRepo/IsWebinyJsRepo.js +17 -14
- package/features/IsWebinyJsRepo/IsWebinyJsRepo.js.map +1 -1
- package/features/IsWebinyJsRepo/index.js +0 -2
- package/features/RefreshApp/RefreshApp.js +57 -46
- package/features/RefreshApp/RefreshApp.js.map +1 -1
- package/features/RefreshApp/index.js +0 -2
- package/features/RunPulumiCommand/RunPulumiCommand.js +54 -43
- package/features/RunPulumiCommand/RunPulumiCommand.js.map +1 -1
- package/features/RunPulumiCommand/index.js +0 -2
- package/features/ValidateProjectConfig/ValidateProjectConfig.js +14 -11
- package/features/ValidateProjectConfig/ValidateProjectConfig.js.map +1 -1
- package/features/ValidateProjectConfig/index.js +0 -2
- package/features/Watch/Watch.js +178 -181
- package/features/Watch/Watch.js.map +1 -1
- package/features/Watch/getIotEndpoint.js +14 -12
- package/features/Watch/getIotEndpoint.js.map +1 -1
- package/features/Watch/index.js +0 -2
- package/features/Watch/initInvocationForwarding.js +76 -95
- package/features/Watch/initInvocationForwarding.js.map +1 -1
- package/features/Watch/localInvocationWorker.js +24 -33
- package/features/Watch/localInvocationWorker.js.map +1 -1
- package/features/Watch/replaceLambdaFunctions.js +61 -84
- package/features/Watch/replaceLambdaFunctions.js.map +1 -1
- package/features/Watch/watchers/BasePackagesWatcher.js +10 -13
- package/features/Watch/watchers/BasePackagesWatcher.js.map +1 -1
- package/features/Watch/watchers/MultiplePackagesWatcher.js +11 -12
- package/features/Watch/watchers/MultiplePackagesWatcher.js.map +1 -1
- package/features/Watch/watchers/PackagesWatcher.js +15 -18
- package/features/Watch/watchers/PackagesWatcher.js.map +1 -1
- package/features/Watch/watchers/RunnableWatchProcess.js +41 -40
- package/features/Watch/watchers/RunnableWatchProcess.js.map +1 -1
- package/features/Watch/watchers/RunnableWatchProcesses.js +35 -34
- package/features/Watch/watchers/RunnableWatchProcesses.js.map +1 -1
- package/features/Watch/watchers/SinglePackageWatcher.js +11 -8
- package/features/Watch/watchers/SinglePackageWatcher.js.map +1 -1
- package/features/Watch/watchers/WebinyConfigWatcher.js +30 -40
- package/features/Watch/watchers/WebinyConfigWatcher.js.map +1 -1
- package/features/Watch/watchers/ZeroPackagesWatcher.js +5 -5
- package/features/Watch/watchers/ZeroPackagesWatcher.js.map +1 -1
- package/features/Watch/watchers/utils/measureDuration.js +7 -8
- package/features/Watch/watchers/utils/measureDuration.js.map +1 -1
- package/features/Watch/watchers/worker.js +12 -21
- package/features/Watch/watchers/worker.js.map +1 -1
- package/features/hooks/AdminAfterBuild/AdminBeforeBuild.js +19 -15
- package/features/hooks/AdminAfterBuild/AdminBeforeBuild.js.map +1 -1
- package/features/hooks/AdminAfterBuild/index.js +0 -2
- package/features/hooks/AdminAfterDeploy/AdminBeforeBuild.js +19 -15
- package/features/hooks/AdminAfterDeploy/AdminBeforeBuild.js.map +1 -1
- package/features/hooks/AdminAfterDeploy/index.js +0 -2
- package/features/hooks/AdminBeforeBuild/AdminBeforeBuild.js +19 -15
- package/features/hooks/AdminBeforeBuild/AdminBeforeBuild.js.map +1 -1
- package/features/hooks/AdminBeforeBuild/index.js +0 -2
- package/features/hooks/AdminBeforeDeploy/AdminBeforeDeploy.js +19 -15
- package/features/hooks/AdminBeforeDeploy/AdminBeforeDeploy.js.map +1 -1
- package/features/hooks/AdminBeforeDeploy/index.js +0 -2
- package/features/hooks/AdminBeforeWatch/AdminBeforeWatch.js +18 -14
- package/features/hooks/AdminBeforeWatch/AdminBeforeWatch.js.map +1 -1
- package/features/hooks/AdminBeforeWatch/index.js +0 -2
- package/features/hooks/AfterBuild/AfterBuild.js +19 -15
- package/features/hooks/AfterBuild/AfterBuild.js.map +1 -1
- package/features/hooks/AfterBuild/index.js +0 -2
- package/features/hooks/AfterDeploy/AfterDeploy.js +19 -15
- package/features/hooks/AfterDeploy/AfterDeploy.js.map +1 -1
- package/features/hooks/AfterDeploy/index.js +0 -2
- package/features/hooks/ApiAfterBuild/ApiBeforeBuild.js +18 -14
- package/features/hooks/ApiAfterBuild/ApiBeforeBuild.js.map +1 -1
- package/features/hooks/ApiAfterBuild/index.js +0 -2
- package/features/hooks/ApiAfterDeploy/ApiBeforeBuild.js +18 -14
- package/features/hooks/ApiAfterDeploy/ApiBeforeBuild.js.map +1 -1
- package/features/hooks/ApiAfterDeploy/index.js +0 -2
- package/features/hooks/ApiBeforeBuild/ApiBeforeBuild.js +18 -14
- package/features/hooks/ApiBeforeBuild/ApiBeforeBuild.js.map +1 -1
- package/features/hooks/ApiBeforeBuild/index.js +0 -2
- package/features/hooks/ApiBeforeDeploy/ApiBeforeDeploy.js +18 -14
- package/features/hooks/ApiBeforeDeploy/ApiBeforeDeploy.js.map +1 -1
- package/features/hooks/ApiBeforeDeploy/index.js +0 -2
- package/features/hooks/ApiBeforeWatch/ApiBeforeWatch.js +18 -14
- package/features/hooks/ApiBeforeWatch/ApiBeforeWatch.js.map +1 -1
- package/features/hooks/ApiBeforeWatch/index.js +0 -2
- package/features/hooks/BeforeBuild/BeforeBuild.js +19 -15
- package/features/hooks/BeforeBuild/BeforeBuild.js.map +1 -1
- package/features/hooks/BeforeBuild/index.js +0 -2
- package/features/hooks/BeforeDeploy/BeforeDeploy.js +19 -15
- package/features/hooks/BeforeDeploy/BeforeDeploy.js.map +1 -1
- package/features/hooks/BeforeDeploy/index.js +0 -2
- package/features/hooks/BeforeWatch/BeforeWatch.js +19 -15
- package/features/hooks/BeforeWatch/BeforeWatch.js.map +1 -1
- package/features/hooks/BeforeWatch/index.js +0 -2
- package/features/hooks/CoreAfterBuild/CoreBeforeBuild.js +18 -14
- package/features/hooks/CoreAfterBuild/CoreBeforeBuild.js.map +1 -1
- package/features/hooks/CoreAfterBuild/index.js +0 -2
- package/features/hooks/CoreAfterDeploy/CoreBeforeBuild.js +18 -14
- package/features/hooks/CoreAfterDeploy/CoreBeforeBuild.js.map +1 -1
- package/features/hooks/CoreAfterDeploy/index.js +0 -2
- package/features/hooks/CoreBeforeBuild/CoreBeforeBuild.js +18 -14
- package/features/hooks/CoreBeforeBuild/CoreBeforeBuild.js.map +1 -1
- package/features/hooks/CoreBeforeBuild/index.js +0 -2
- package/features/hooks/CoreBeforeDeploy/CoreBeforeDeploy.js +18 -14
- package/features/hooks/CoreBeforeDeploy/CoreBeforeDeploy.js.map +1 -1
- package/features/hooks/CoreBeforeDeploy/index.js +0 -2
- package/features/hooks/CoreBeforeWatch/CoreBeforeWatch.js +18 -14
- package/features/hooks/CoreBeforeWatch/CoreBeforeWatch.js.map +1 -1
- package/features/hooks/CoreBeforeWatch/index.js +0 -2
- package/features/hooks/index.js +0 -2
- package/features/index.js +0 -2
- package/index.js +5 -10
- package/index.js.map +1 -1
- package/models/AppModel.js +20 -19
- package/models/AppModel.js.map +1 -1
- package/models/AppPackageModel.js +10 -9
- package/models/AppPackageModel.js.map +1 -1
- package/models/PathModel.js +23 -26
- package/models/PathModel.js.map +1 -1
- package/models/ProjectConfigModel.js +12 -16
- package/models/ProjectConfigModel.js.map +1 -1
- package/models/ProjectModel.js +37 -36
- package/models/ProjectModel.js.map +1 -1
- package/models/UrlModel.js +23 -23
- package/models/UrlModel.js.map +1 -1
- package/models/WcpEnvironmentModel.js +23 -22
- package/models/WcpEnvironmentModel.js.map +1 -1
- package/models/WcpUserModel.js +13 -12
- package/models/WcpUserModel.js.map +1 -1
- package/models/WcpUserPatModel.js +12 -11
- package/models/WcpUserPatModel.js.map +1 -1
- package/models/index.js +0 -2
- package/package.json +14 -14
- package/rslib-runtime.js +14 -0
- package/rslib-runtime.js.map +1 -0
- package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.js +62 -69
- package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.js.map +1 -1
- package/services/BuildAppWorkspaceService/index.js +0 -2
- package/services/BuildProjectWorkspaceService/BuildProjectWorkspaceService.js +21 -17
- package/services/BuildProjectWorkspaceService/BuildProjectWorkspaceService.js.map +1 -1
- package/services/BuildProjectWorkspaceService/index.js +0 -2
- package/services/GetAppPackagesService/GetAppPackagesService.js +24 -23
- package/services/GetAppPackagesService/GetAppPackagesService.js.map +1 -1
- package/services/GetAppPackagesService/index.js +0 -2
- package/services/GetAppService/GetAppService.js +24 -27
- package/services/GetAppService/GetAppService.js.map +1 -1
- package/services/GetAppService/index.js +0 -2
- package/services/GetCwdService/GetCwdService.js +15 -12
- package/services/GetCwdService/GetCwdService.js.map +1 -1
- package/services/GetCwdService/index.js +0 -2
- package/services/GetProjectConfigService/EnvContext.js +29 -38
- package/services/GetProjectConfigService/EnvContext.js.map +1 -1
- package/services/GetProjectConfigService/GetProjectConfigService.js +102 -115
- package/services/GetProjectConfigService/GetProjectConfigService.js.map +1 -1
- package/services/GetProjectConfigService/ProductionEnvironmentsContext.js +13 -18
- package/services/GetProjectConfigService/ProductionEnvironmentsContext.js.map +1 -1
- package/services/GetProjectConfigService/WcpProjectLicenseContext.js +32 -37
- package/services/GetProjectConfigService/WcpProjectLicenseContext.js.map +1 -1
- package/services/GetProjectConfigService/index.js +0 -2
- package/services/GetProjectConfigService/renderConfig.js +32 -38
- package/services/GetProjectConfigService/renderConfig.js.map +1 -1
- package/services/GetProjectConfigService/renderConfigWorker.js +37 -48
- package/services/GetProjectConfigService/renderConfigWorker.js.map +1 -1
- package/services/GetProjectIdService/GetProjectIdService.js +22 -23
- package/services/GetProjectIdService/GetProjectIdService.js.map +1 -1
- package/services/GetProjectIdService/index.js +0 -2
- package/services/GetProjectService/GetProjectService.js +43 -45
- package/services/GetProjectService/GetProjectService.js.map +1 -1
- package/services/GetProjectService/index.js +0 -2
- package/services/GetProjectVersionService/GetProjectVersionService.js +23 -22
- package/services/GetProjectVersionService/GetProjectVersionService.js.map +1 -1
- package/services/GetProjectVersionService/index.js +0 -2
- package/services/GetPulumiService/GetPulumiService.js +36 -41
- package/services/GetPulumiService/GetPulumiService.js.map +1 -1
- package/services/GetPulumiService/index.js +0 -2
- package/services/InitProjectSdkService/InitProjectSdkService.js +36 -46
- package/services/InitProjectSdkService/InitProjectSdkService.js.map +1 -1
- package/services/InitProjectSdkService/applyEnvVars.js +5 -8
- package/services/InitProjectSdkService/applyEnvVars.js.map +1 -1
- package/services/InitProjectSdkService/applyWcpEnvVars.js +91 -136
- package/services/InitProjectSdkService/applyWcpEnvVars.js.map +1 -1
- package/services/InitProjectSdkService/index.js +0 -2
- package/services/InitProjectSdkService/registerDecorators.js +10 -7
- package/services/InitProjectSdkService/registerDecorators.js.map +1 -1
- package/services/InitProjectSdkService/registerHooks.js +30 -7
- package/services/InitProjectSdkService/registerHooks.js.map +1 -1
- package/services/InitProjectSdkService/registerImplementations.js +10 -11
- package/services/InitProjectSdkService/registerImplementations.js.map +1 -1
- package/services/InitProjectSdkService/registerPulumiExtensions.js +12 -9
- package/services/InitProjectSdkService/registerPulumiExtensions.js.map +1 -1
- package/services/InstallExtensionService/InstallExtensionService.js +78 -121
- package/services/InstallExtensionService/InstallExtensionService.js.map +1 -1
- package/services/InstallExtensionService/downloadFolderFromS3.js +46 -65
- package/services/InstallExtensionService/downloadFolderFromS3.js.map +1 -1
- package/services/InstallExtensionService/index.js +0 -2
- package/services/InstallExtensionService/mergePackageJson.js +15 -25
- package/services/InstallExtensionService/mergePackageJson.js.map +1 -1
- package/services/InstallExtensionService/types.js +0 -3
- package/services/InstallExtensionService/updateWebinyConfig.js +60 -137
- package/services/InstallExtensionService/updateWebinyConfig.js.map +1 -1
- package/services/IsRemotePulumiBackendService/IsRemotePulumiBackendService.js +9 -17
- package/services/IsRemotePulumiBackendService/IsRemotePulumiBackendService.js.map +1 -1
- package/services/IsRemotePulumiBackendService/index.js +0 -2
- package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.js +50 -73
- package/services/ListAppLambdaFunctionsService/ListAppLambdaFunctionsService.js.map +1 -1
- package/services/ListAppLambdaFunctionsService/index.js +0 -2
- package/services/ListDeployedEnvironmentsService/ListDeployedEnvironmentsService.js +21 -23
- package/services/ListDeployedEnvironmentsService/ListDeployedEnvironmentsService.js.map +1 -1
- package/services/ListDeployedEnvironmentsService/index.js +0 -2
- package/services/ListPackagesInAppWorkspaceService/ListPackagesInAppWorkspaceService.js +34 -29
- package/services/ListPackagesInAppWorkspaceService/ListPackagesInAppWorkspaceService.js.map +1 -1
- package/services/ListPackagesInAppWorkspaceService/index.js +0 -2
- package/services/ListPackagesService/ListPackagesService.js +81 -114
- package/services/ListPackagesService/ListPackagesService.js.map +1 -1
- package/services/ListPackagesService/index.js +0 -2
- package/services/LoadEnvVarsService/LoadEnvVarsService.js +28 -29
- package/services/LoadEnvVarsService/LoadEnvVarsService.js.map +1 -1
- package/services/LoadEnvVarsService/index.js +0 -2
- package/services/LocalStorageService/LocalStorageService.js +41 -44
- package/services/LocalStorageService/LocalStorageService.js.map +1 -1
- package/services/LocalStorageService/index.js +0 -2
- package/services/LoggerService/LoggerService.js +76 -84
- package/services/LoggerService/LoggerService.js.map +1 -1
- package/services/LoggerService/index.js +0 -2
- package/services/ProjectInfoService/GetIsCiService.js +9 -8
- package/services/ProjectInfoService/GetIsCiService.js.map +1 -1
- package/services/ProjectInfoService/GetNpmVersionService.js +9 -8
- package/services/ProjectInfoService/GetNpmVersionService.js.map +1 -1
- package/services/ProjectInfoService/GetNpxVersionService.js +9 -8
- package/services/ProjectInfoService/GetNpxVersionService.js.map +1 -1
- package/services/ProjectInfoService/GetPulumiVersionService.js +38 -30
- package/services/ProjectInfoService/GetPulumiVersionService.js.map +1 -1
- package/services/ProjectInfoService/GetYarnVersionService.js +9 -8
- package/services/ProjectInfoService/GetYarnVersionService.js.map +1 -1
- package/services/ProjectInfoService/ProjectInfoService.js +56 -51
- package/services/ProjectInfoService/ProjectInfoService.js.map +1 -1
- package/services/ProjectInfoService/index.js +0 -2
- package/services/ProjectSdkParamsService/ProjectSdkParamsService.js +37 -34
- package/services/ProjectSdkParamsService/ProjectSdkParamsService.js.map +1 -1
- package/services/ProjectSdkParamsService/index.js +0 -2
- package/services/PulumiExportService/PulumiExportService.js +42 -35
- package/services/PulumiExportService/PulumiExportService.js.map +1 -1
- package/services/PulumiExportService/index.js +0 -2
- package/services/PulumiGetConfigPassphraseService/PulumiGetConfigPassphraseService.js +9 -8
- package/services/PulumiGetConfigPassphraseService/PulumiGetConfigPassphraseService.js.map +1 -1
- package/services/PulumiGetConfigPassphraseService/index.js +0 -2
- package/services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.js +9 -8
- package/services/PulumiGetSecretsProviderService/PulumiGetSecretsProviderService.js.map +1 -1
- package/services/PulumiGetSecretsProviderService/index.js +0 -2
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js +108 -100
- package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js.map +1 -1
- package/services/PulumiGetStackOutputService/index.js +0 -2
- package/services/PulumiGetStackOutputService/mapStackOutput.js +17 -29
- package/services/PulumiGetStackOutputService/mapStackOutput.js.map +1 -1
- package/services/PulumiImportService/PulumiImportService.js +48 -45
- package/services/PulumiImportService/PulumiImportService.js.map +1 -1
- package/services/PulumiImportService/index.js +0 -2
- package/services/PulumiLoginService/PulumiLoginService.js +43 -40
- package/services/PulumiLoginService/PulumiLoginService.js.map +1 -1
- package/services/PulumiLoginService/index.js +0 -2
- package/services/PulumiSelectStackService/PulumiSelectStackService.js +91 -86
- package/services/PulumiSelectStackService/PulumiSelectStackService.js.map +1 -1
- package/services/PulumiSelectStackService/index.js +0 -2
- package/services/SetProjectIdService/SetProjectIdService.js +43 -57
- package/services/SetProjectIdService/SetProjectIdService.js.map +1 -1
- package/services/SetProjectIdService/index.js +0 -2
- package/services/StdioService/StdioService.js +15 -14
- package/services/StdioService/StdioService.js.map +1 -1
- package/services/StdioService/index.js +0 -2
- package/services/UiService/UiService.js +55 -58
- package/services/UiService/UiService.js.map +1 -1
- package/services/UiService/index.js +0 -2
- package/services/ValidateProjectConfigService/ValidateProjectConfigService.js +18 -19
- package/services/ValidateProjectConfigService/ValidateProjectConfigService.js.map +1 -1
- package/services/ValidateProjectConfigService/index.js +0 -2
- package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js +47 -54
- package/services/WatchedLambdaFunctionsService/WatchedLambdaFunctionsService.js.map +1 -1
- package/services/WatchedLambdaFunctionsService/index.js +0 -2
- package/services/WcpService/CreateUserPat.js +20 -23
- package/services/WcpService/CreateUserPat.js.map +1 -1
- package/services/WcpService/GenerateUserPat.js +15 -18
- package/services/WcpService/GenerateUserPat.js.map +1 -1
- package/services/WcpService/GetPatFromLocalStorage.js +9 -10
- package/services/WcpService/GetPatFromLocalStorage.js.map +1 -1
- package/services/WcpService/GetProjectEnvironment.js +34 -47
- package/services/WcpService/GetProjectEnvironment.js.map +1 -1
- package/services/WcpService/GetProjectLicense.js +28 -38
- package/services/WcpService/GetProjectLicense.js.map +1 -1
- package/services/WcpService/GetUser.js +43 -46
- package/services/WcpService/GetUser.js.map +1 -1
- package/services/WcpService/GetUserPat.js +20 -23
- package/services/WcpService/GetUserPat.js.map +1 -1
- package/services/WcpService/LogoutUser.js +9 -8
- package/services/WcpService/LogoutUser.js.map +1 -1
- package/services/WcpService/StorePatToLocalStorage.js +9 -10
- package/services/WcpService/StorePatToLocalStorage.js.map +1 -1
- package/services/WcpService/UnsetPatFromLocalStorage.js +9 -10
- package/services/WcpService/UnsetPatFromLocalStorage.js.map +1 -1
- package/services/WcpService/WcpGqlClient.js +6 -5
- package/services/WcpService/WcpGqlClient.js.map +1 -1
- package/services/WcpService/WcpService.js +74 -75
- package/services/WcpService/WcpService.js.map +1 -1
- package/services/WcpService/index.js +0 -2
- package/services/index.js +0 -2
- package/utils/ExtensionSrcResolver.js +51 -106
- package/utils/ExtensionSrcResolver.js.map +1 -1
- package/utils/constants.js +8 -7
- package/utils/constants.js.map +1 -1
- package/utils/createPathResolver.js +2 -5
- package/utils/createPathResolver.js.map +1 -1
- package/utils/env/configuration.js +16 -25
- package/utils/env/configuration.js.map +1 -1
- package/utils/env/index.js +0 -2
- package/utils/env/types.js +0 -3
- package/utils/env/withEnv.js +4 -7
- package/utils/env/withEnv.js.map +1 -1
- package/utils/env/withEnvVariant.js +8 -11
- package/utils/env/withEnvVariant.js.map +1 -1
- package/utils/env/withProjectName.js +4 -9
- package/utils/env/withProjectName.js.map +1 -1
- package/utils/env/withPulumiConfigPassphrase.js +4 -8
- package/utils/env/withPulumiConfigPassphrase.js.map +1 -1
- package/utils/env/withRegion.js +10 -17
- package/utils/env/withRegion.js.map +1 -1
- package/utils/getRandomColorForString.js +86 -8
- package/utils/getRandomColorForString.js.map +1 -1
- package/utils/getStackName.js +11 -18
- package/utils/getStackName.js.map +1 -1
- package/utils/getTemplatesFolderPath.js +6 -8
- package/utils/getTemplatesFolderPath.js.map +1 -1
- package/utils/index.js +0 -2
- package/utils/isValidRegionName.js +8 -13
- package/utils/isValidRegionName.js.map +1 -1
- package/utils/isValidVariantName.js +11 -10
- package/utils/isValidVariantName.js.map +1 -1
- package/utils/measureDuration.js +7 -8
- package/utils/measureDuration.js.map +1 -1
- package/utils/projectSdkContext.js +23 -39
- package/utils/projectSdkContext.js.map +1 -1
- package/utils/regions.js +75 -63
- package/utils/regions.js.map +1 -1
- package/utils/registerExtension.js +6 -15
- package/utils/registerExtension.js.map +1 -1
- package/utils/requireConfig.js +7 -12
- package/utils/requireConfig.js.map +1 -1
- package/utils/toImportSpecifier.js +3 -9
- package/utils/toImportSpecifier.js.map +1 -1
- package/abstractions/features/hooks/index.js.map +0 -1
- package/abstractions/features/index.js.map +0 -1
- package/abstractions/index.js.map +0 -1
- package/abstractions/models/IAppModel.js.map +0 -1
- package/abstractions/models/IAppPackageModel.js.map +0 -1
- package/abstractions/models/IPathModel.js.map +0 -1
- package/abstractions/models/IProjectConfigDto.js.map +0 -1
- package/abstractions/models/IProjectConfigModel.js.map +0 -1
- package/abstractions/models/IProjectModel.js.map +0 -1
- package/abstractions/models/IUrlModel.js.map +0 -1
- package/abstractions/models/IWcpEnvironmentDto.js.map +0 -1
- package/abstractions/models/IWcpEnvironmentModel.js.map +0 -1
- package/abstractions/models/IWcpUserDto.js.map +0 -1
- package/abstractions/models/IWcpUserModel.js.map +0 -1
- package/abstractions/models/IWcpUserPatDto.js.map +0 -1
- package/abstractions/models/IWcpUserPatModel.js.map +0 -1
- package/abstractions/models/PackagesBuilder/IPackagesBuilder.js.map +0 -1
- package/abstractions/models/PackagesBuilder/IRunnableBuildProcess.js.map +0 -1
- package/abstractions/models/PackagesBuilder/IRunnableBuildProcesses.js.map +0 -1
- package/abstractions/models/PackagesBuilder/index.js.map +0 -1
- package/abstractions/models/index.js.map +0 -1
- package/abstractions/services/ProjectInfoService/index.js.map +0 -1
- package/abstractions/services/index.js.map +0 -1
- package/abstractions/types.js.map +0 -1
- package/decorators/index.js.map +0 -1
- package/defineExtension/index.js.map +0 -1
- package/defineExtension/models/index.js.map +0 -1
- package/defineExtension/types.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.js.map +0 -1
- package/extensions/hooks/index.js.map +0 -1
- package/extensions/infra/index.js.map +0 -1
- package/extensions/pulumi/index.js.map +0 -1
- package/features/BuildApp/index.js.map +0 -1
- package/features/DeployApp/index.js.map +0 -1
- package/features/DestroyApp/index.js.map +0 -1
- package/features/ExportStack/index.js.map +0 -1
- package/features/GetApp/index.js.map +0 -1
- package/features/GetAppOutput/index.js.map +0 -1
- package/features/GetAppStackOutput/index.js.map +0 -1
- package/features/GetFeatureFlags/index.js.map +0 -1
- package/features/GetLogger/index.js.map +0 -1
- package/features/GetProductionEnvironments/index.js.map +0 -1
- package/features/GetProject/index.js.map +0 -1
- package/features/GetProjectConfig/index.js.map +0 -1
- package/features/GetProjectInfo/index.js.map +0 -1
- package/features/GetPulumiResourceNamePrefix/index.js.map +0 -1
- package/features/InstallExtension/index.js.map +0 -1
- package/features/IsCi/index.js.map +0 -1
- package/features/IsTelemetryEnabled/index.js.map +0 -1
- package/features/IsWcpEnabled/index.js.map +0 -1
- package/features/IsWebinyJsRepo/index.js.map +0 -1
- package/features/RefreshApp/index.js.map +0 -1
- package/features/RunPulumiCommand/index.js.map +0 -1
- package/features/ValidateProjectConfig/index.js.map +0 -1
- package/features/Watch/index.js.map +0 -1
- package/features/hooks/AdminAfterBuild/index.js.map +0 -1
- package/features/hooks/AdminAfterDeploy/index.js.map +0 -1
- package/features/hooks/AdminBeforeBuild/index.js.map +0 -1
- package/features/hooks/AdminBeforeDeploy/index.js.map +0 -1
- package/features/hooks/AdminBeforeWatch/index.js.map +0 -1
- package/features/hooks/AfterBuild/index.js.map +0 -1
- package/features/hooks/AfterDeploy/index.js.map +0 -1
- package/features/hooks/ApiAfterBuild/index.js.map +0 -1
- package/features/hooks/ApiAfterDeploy/index.js.map +0 -1
- package/features/hooks/ApiBeforeBuild/index.js.map +0 -1
- package/features/hooks/ApiBeforeDeploy/index.js.map +0 -1
- package/features/hooks/ApiBeforeWatch/index.js.map +0 -1
- package/features/hooks/BeforeBuild/index.js.map +0 -1
- package/features/hooks/BeforeDeploy/index.js.map +0 -1
- package/features/hooks/BeforeWatch/index.js.map +0 -1
- package/features/hooks/CoreAfterBuild/index.js.map +0 -1
- package/features/hooks/CoreAfterDeploy/index.js.map +0 -1
- package/features/hooks/CoreBeforeBuild/index.js.map +0 -1
- package/features/hooks/CoreBeforeDeploy/index.js.map +0 -1
- package/features/hooks/CoreBeforeWatch/index.js.map +0 -1
- package/features/hooks/index.js.map +0 -1
- package/features/index.js.map +0 -1
- package/models/index.js.map +0 -1
- package/services/BuildAppWorkspaceService/index.js.map +0 -1
- package/services/BuildProjectWorkspaceService/index.js.map +0 -1
- package/services/GetAppPackagesService/index.js.map +0 -1
- package/services/GetAppService/index.js.map +0 -1
- package/services/GetCwdService/index.js.map +0 -1
- package/services/GetProjectConfigService/index.js.map +0 -1
- package/services/GetProjectIdService/index.js.map +0 -1
- package/services/GetProjectService/index.js.map +0 -1
- package/services/GetProjectVersionService/index.js.map +0 -1
- package/services/GetPulumiService/index.js.map +0 -1
- package/services/InitProjectSdkService/index.js.map +0 -1
- package/services/InstallExtensionService/index.js.map +0 -1
- package/services/InstallExtensionService/types.js.map +0 -1
- package/services/IsRemotePulumiBackendService/index.js.map +0 -1
- package/services/ListAppLambdaFunctionsService/index.js.map +0 -1
- package/services/ListDeployedEnvironmentsService/index.js.map +0 -1
- package/services/ListPackagesInAppWorkspaceService/index.js.map +0 -1
- package/services/ListPackagesService/index.js.map +0 -1
- package/services/LoadEnvVarsService/index.js.map +0 -1
- package/services/LocalStorageService/index.js.map +0 -1
- package/services/LoggerService/index.js.map +0 -1
- package/services/ProjectInfoService/index.js.map +0 -1
- package/services/ProjectSdkParamsService/index.js.map +0 -1
- package/services/PulumiExportService/index.js.map +0 -1
- package/services/PulumiGetConfigPassphraseService/index.js.map +0 -1
- package/services/PulumiGetSecretsProviderService/index.js.map +0 -1
- package/services/PulumiGetStackOutputService/index.js.map +0 -1
- package/services/PulumiImportService/index.js.map +0 -1
- package/services/PulumiLoginService/index.js.map +0 -1
- package/services/PulumiSelectStackService/index.js.map +0 -1
- package/services/SetProjectIdService/index.js.map +0 -1
- package/services/StdioService/index.js.map +0 -1
- package/services/UiService/index.js.map +0 -1
- package/services/ValidateProjectConfigService/index.js.map +0 -1
- package/services/WatchedLambdaFunctionsService/index.js.map +0 -1
- package/services/WcpService/index.js.map +0 -1
- package/services/index.js.map +0 -1
- package/utils/env/index.js.map +0 -1
- package/utils/env/types.js.map +0 -1
- package/utils/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","defineExtension","crypto","path","fs","Node","Project","generateBuildParamsFeature","buildParamsDir","ctx","featureFilePath","join","files","readdirSync","filter","f","startsWith","endsWith","imports","map","file","className","parse","name","registrations","featureContent","writeFileSync","updateExtensionsTsx","extensionsTsxFilePath","project","paths","workspaceFolder","toString","addSourceFileAtPath","source","getSourceFileOrThrow","buildParamsFeatureImport","existingFeatureImport","getImportDeclaration","index","importDeclarations","getImportDeclarations","length","last","getChildIndex","insertImportDeclaration","namedImports","moduleSpecifier","buildParamsFeatureImportPath","existingBuildParamsImport","getNamedImports","hasBuildParamsFeature","some","ni","getName","addNamedImport","registerFeatureImportPath","existingRegisterFeatureImport","hasRegisterFeature","extensionsIdentifier","getFirstDescendant","node","isIdentifier","getText","Error","extensionsArrowFn","getNextSibling","isArrowFunction","extensionsArrowFnFragment","isJsxFragment","currentContent","getFullText","replace","trim","includes","newContent","replaceWithText","save","AdminBuildParam","type","tags","runtimeContext","appName","description","multiple","paramsSchema","object","paramName","string","value","union","record","any","array","number","boolean","build","params","valueStr","JSON","stringify","hash","createHash","update","digest","slice","fileName","filePath","existsSync","mkdirSync","recursive","fileContent"],"sources":["AdminBuildParam.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport crypto from \"crypto\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { Node, Project } from \"ts-morph\";\n\nasync function generateBuildParamsFeature(buildParamsDir: string, ctx: any) {\n const featureFilePath = path.join(buildParamsDir, \"feature.ts\");\n\n // Get all BuildParam_*.ts files.\n const files = fs\n .readdirSync(buildParamsDir)\n .filter(f => f.startsWith(\"BuildParam_\") && f.endsWith(\".ts\") && f !== \"feature.ts\");\n\n // Generate imports and registrations.\n const imports = files\n .map(file => {\n const className = path.parse(file).name;\n return `import ${className} from \"./${className}.js\";`;\n })\n .join(\"\\n\");\n\n const registrations = files\n .map(file => {\n const className = path.parse(file).name;\n return ` container.register(${className});`;\n })\n .join(\"\\n\");\n\n const featureContent = `import { createFeature } from \"@webiny/feature/admin\";\nimport { Container } from \"@webiny/di\";\n${imports}\n\nexport const BuildParamsInternalFeature = createFeature({\n name: \"BuildParamsInternal\",\n register(container: Container) {\n${registrations}\n }\n});\n`;\n\n fs.writeFileSync(featureFilePath, featureContent, \"utf8\");\n\n // Now we need to update Extensions.tsx to use RegisterFeature with this feature.\n await updateExtensionsTsx(ctx);\n}\n\nasync function updateExtensionsTsx(ctx: any) {\n const extensionsTsxFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"Extensions.tsx\")\n .toString();\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsxFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsxFilePath);\n\n // Check if we already have the imports.\n const buildParamsFeatureImport = \"./buildParams/feature.js\";\n const existingFeatureImport = source.getImportDeclaration(buildParamsFeatureImport);\n\n if (!existingFeatureImport) {\n let index = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Add import for BuildParamsInternalFeature.\n source.insertImportDeclaration(index, {\n namedImports: [\"BuildParamsInternalFeature\"],\n moduleSpecifier: buildParamsFeatureImport\n });\n\n // Add import for BuildParamsFeature.\n const buildParamsFeatureImportPath = \"@webiny/app-admin\";\n const existingBuildParamsImport = source.getImportDeclaration(buildParamsFeatureImportPath);\n\n if (!existingBuildParamsImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"BuildParamsFeature\"],\n moduleSpecifier: buildParamsFeatureImportPath\n });\n } else {\n // Add to existing import if BuildParamsFeature not already there.\n const namedImports = existingBuildParamsImport.getNamedImports();\n const hasBuildParamsFeature = namedImports.some(\n ni => ni.getName() === \"BuildParamsFeature\"\n );\n if (!hasBuildParamsFeature) {\n existingBuildParamsImport.addNamedImport(\"BuildParamsFeature\");\n }\n }\n\n // Add import for RegisterFeature if not present.\n const registerFeatureImportPath = \"@webiny/app-admin\";\n const existingRegisterFeatureImport =\n source.getImportDeclaration(registerFeatureImportPath);\n\n if (existingRegisterFeatureImport) {\n const namedImports = existingRegisterFeatureImport.getNamedImports();\n const hasRegisterFeature = namedImports.some(ni => ni.getName() === \"RegisterFeature\");\n if (!hasRegisterFeature) {\n existingRegisterFeatureImport.addNamedImport(\"RegisterFeature\");\n }\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [\"RegisterFeature\"],\n moduleSpecifier: registerFeatureImportPath\n });\n }\n }\n\n // Now add <RegisterFeature> components to the Extensions component.\n const extensionsIdentifier = source.getFirstDescendant(node => {\n if (!Node.isIdentifier(node)) {\n return false;\n }\n return node.getText() === \"Extensions\";\n });\n\n if (!extensionsIdentifier) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\".`\n );\n }\n\n const extensionsArrowFn = extensionsIdentifier.getNextSibling(node =>\n Node.isArrowFunction(node)\n );\n\n if (!extensionsArrowFn) {\n throw new Error(`Could not find the \"Extensions\" React component arrow function.`);\n }\n\n const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant(node => {\n return Node.isJsxFragment(node);\n });\n\n if (!extensionsArrowFnFragment) {\n throw new Error(`Could not find JSX fragment in Extensions component.`);\n }\n\n const currentContent = extensionsArrowFnFragment\n .getFullText()\n .replace(\"<>\", \"\")\n .replace(\"</>\", \"\")\n .trim();\n\n // Check if we already have the RegisterFeature components.\n if (!currentContent.includes(\"BuildParamsFeature\")) {\n const newContent = `<><RegisterFeature feature={BuildParamsFeature} /><RegisterFeature feature={BuildParamsInternalFeature} />${currentContent}</>`;\n extensionsArrowFnFragment.replaceWithText(newContent);\n }\n\n await source.save();\n}\n\nexport const AdminBuildParam = defineExtension({\n type: \"Admin/BuildParam\",\n tags: { runtimeContext: \"app-build\", appName: \"admin\" },\n description: \"Add build-time parameter to Admin app.\",\n multiple: true,\n paramsSchema: () => {\n return z.object({\n paramName: z.string(),\n value: z.union([\n z.string(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n z.number(),\n z.boolean()\n ])\n });\n },\n async build(params, ctx) {\n const buildParamsDir = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"buildParams\")\n .toString();\n\n const { paramName, value } = params;\n\n // Serialize value to a TypeScript literal.\n const valueStr = JSON.stringify(value, null, 4);\n\n // Generate a unique class name based on the paramName.\n const hash = crypto.createHash(\"sha256\").update(paramName).digest(\"hex\");\n const className = `BuildParam_${hash.slice(-10)}`;\n const fileName = `${className}.ts`;\n const filePath = path.join(buildParamsDir, fileName);\n\n // Ensure buildParams directory exists.\n if (!fs.existsSync(buildParamsDir)) {\n fs.mkdirSync(buildParamsDir, { recursive: true });\n }\n\n // Check if file already exists.\n if (!fs.existsSync(filePath)) {\n // Create the BuildParam implementation file.\n const fileContent = `import { BuildParam } from \"webiny/admin/build-params\";\n\nclass ${className} implements BuildParam.Interface {\n key = \"${paramName}\";\n value = ${valueStr};\n}\n\nexport default BuildParam.createImplementation({\n implementation: ${className},\n dependencies: []\n});\n`;\n fs.writeFileSync(filePath, fileContent, \"utf8\");\n }\n\n // Now we need to generate/update the feature file that imports all BuildParams.\n await generateBuildParamsFeature(buildParamsDir, ctx);\n }\n});\n"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,eAAe;AACxB,OAAOC,MAAM,MAAM,QAAQ;AAC3B,OAAOC,IAAI,MAAM,MAAM;AACvB,OAAOC,EAAE,MAAM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MACWjB,EAAE,CAACsB,aAAa,CAACiF,QAAQ,EAAEI,WAAW,EAAE,MAAM,CAAC;IACnD;;IAEA;IACA,MAAMxG,0BAA0B,CAACC,cAAc,EAAEC,GAAG,CAAC;EACzD;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"extensions/AdminBuildParam.js","sources":["../../src/extensions/AdminBuildParam.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport crypto from \"crypto\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport { Node, Project } from \"ts-morph\";\n\nasync function generateBuildParamsFeature(buildParamsDir: string, ctx: any) {\n const featureFilePath = path.join(buildParamsDir, \"feature.ts\");\n\n // Get all BuildParam_*.ts files.\n const files = fs\n .readdirSync(buildParamsDir)\n .filter(f => f.startsWith(\"BuildParam_\") && f.endsWith(\".ts\") && f !== \"feature.ts\");\n\n // Generate imports and registrations.\n const imports = files\n .map(file => {\n const className = path.parse(file).name;\n return `import ${className} from \"./${className}.js\";`;\n })\n .join(\"\\n\");\n\n const registrations = files\n .map(file => {\n const className = path.parse(file).name;\n return ` container.register(${className});`;\n })\n .join(\"\\n\");\n\n const featureContent = `import { createFeature } from \"@webiny/feature/admin\";\nimport { Container } from \"@webiny/di\";\n${imports}\n\nexport const BuildParamsInternalFeature = createFeature({\n name: \"BuildParamsInternal\",\n register(container: Container) {\n${registrations}\n }\n});\n`;\n\n fs.writeFileSync(featureFilePath, featureContent, \"utf8\");\n\n // Now we need to update Extensions.tsx to use RegisterFeature with this feature.\n await updateExtensionsTsx(ctx);\n}\n\nasync function updateExtensionsTsx(ctx: any) {\n const extensionsTsxFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"Extensions.tsx\")\n .toString();\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsxFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsxFilePath);\n\n // Check if we already have the imports.\n const buildParamsFeatureImport = \"./buildParams/feature.js\";\n const existingFeatureImport = source.getImportDeclaration(buildParamsFeatureImport);\n\n if (!existingFeatureImport) {\n let index = 1;\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Add import for BuildParamsInternalFeature.\n source.insertImportDeclaration(index, {\n namedImports: [\"BuildParamsInternalFeature\"],\n moduleSpecifier: buildParamsFeatureImport\n });\n\n // Add import for BuildParamsFeature.\n const buildParamsFeatureImportPath = \"@webiny/app-admin\";\n const existingBuildParamsImport = source.getImportDeclaration(buildParamsFeatureImportPath);\n\n if (!existingBuildParamsImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"BuildParamsFeature\"],\n moduleSpecifier: buildParamsFeatureImportPath\n });\n } else {\n // Add to existing import if BuildParamsFeature not already there.\n const namedImports = existingBuildParamsImport.getNamedImports();\n const hasBuildParamsFeature = namedImports.some(\n ni => ni.getName() === \"BuildParamsFeature\"\n );\n if (!hasBuildParamsFeature) {\n existingBuildParamsImport.addNamedImport(\"BuildParamsFeature\");\n }\n }\n\n // Add import for RegisterFeature if not present.\n const registerFeatureImportPath = \"@webiny/app-admin\";\n const existingRegisterFeatureImport =\n source.getImportDeclaration(registerFeatureImportPath);\n\n if (existingRegisterFeatureImport) {\n const namedImports = existingRegisterFeatureImport.getNamedImports();\n const hasRegisterFeature = namedImports.some(ni => ni.getName() === \"RegisterFeature\");\n if (!hasRegisterFeature) {\n existingRegisterFeatureImport.addNamedImport(\"RegisterFeature\");\n }\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [\"RegisterFeature\"],\n moduleSpecifier: registerFeatureImportPath\n });\n }\n }\n\n // Now add <RegisterFeature> components to the Extensions component.\n const extensionsIdentifier = source.getFirstDescendant(node => {\n if (!Node.isIdentifier(node)) {\n return false;\n }\n return node.getText() === \"Extensions\";\n });\n\n if (!extensionsIdentifier) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\".`\n );\n }\n\n const extensionsArrowFn = extensionsIdentifier.getNextSibling(node =>\n Node.isArrowFunction(node)\n );\n\n if (!extensionsArrowFn) {\n throw new Error(`Could not find the \"Extensions\" React component arrow function.`);\n }\n\n const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant(node => {\n return Node.isJsxFragment(node);\n });\n\n if (!extensionsArrowFnFragment) {\n throw new Error(`Could not find JSX fragment in Extensions component.`);\n }\n\n const currentContent = extensionsArrowFnFragment\n .getFullText()\n .replace(\"<>\", \"\")\n .replace(\"</>\", \"\")\n .trim();\n\n // Check if we already have the RegisterFeature components.\n if (!currentContent.includes(\"BuildParamsFeature\")) {\n const newContent = `<><RegisterFeature feature={BuildParamsFeature} /><RegisterFeature feature={BuildParamsInternalFeature} />${currentContent}</>`;\n extensionsArrowFnFragment.replaceWithText(newContent);\n }\n\n await source.save();\n}\n\nexport const AdminBuildParam = defineExtension({\n type: \"Admin/BuildParam\",\n tags: { runtimeContext: \"app-build\", appName: \"admin\" },\n description: \"Add build-time parameter to Admin app.\",\n multiple: true,\n paramsSchema: () => {\n return z.object({\n paramName: z.string(),\n value: z.union([\n z.string(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n z.number(),\n z.boolean()\n ])\n });\n },\n async build(params, ctx) {\n const buildParamsDir = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"buildParams\")\n .toString();\n\n const { paramName, value } = params;\n\n // Serialize value to a TypeScript literal.\n const valueStr = JSON.stringify(value, null, 4);\n\n // Generate a unique class name based on the paramName.\n const hash = crypto.createHash(\"sha256\").update(paramName).digest(\"hex\");\n const className = `BuildParam_${hash.slice(-10)}`;\n const fileName = `${className}.ts`;\n const filePath = path.join(buildParamsDir, fileName);\n\n // Ensure buildParams directory exists.\n if (!fs.existsSync(buildParamsDir)) {\n fs.mkdirSync(buildParamsDir, { recursive: true });\n }\n\n // Check if file already exists.\n if (!fs.existsSync(filePath)) {\n // Create the BuildParam implementation file.\n const fileContent = `import { BuildParam } from \"webiny/admin/build-params\";\n\nclass ${className} implements BuildParam.Interface {\n key = \"${paramName}\";\n value = ${valueStr};\n}\n\nexport default BuildParam.createImplementation({\n implementation: ${className},\n dependencies: []\n});\n`;\n fs.writeFileSync(filePath, fileContent, \"utf8\");\n }\n\n // Now we need to generate/update the feature file that imports all BuildParams.\n await generateBuildParamsFeature(buildParamsDir, ctx);\n }\n});\n"],"names":["generateBuildParamsFeature","buildParamsDir","ctx","featureFilePath","path","files","fs","f","imports","file","className","registrations","featureContent","updateExtensionsTsx","extensionsTsxFilePath","project","Project","source","buildParamsFeatureImport","existingFeatureImport","index","importDeclarations","last","buildParamsFeatureImportPath","existingBuildParamsImport","namedImports","hasBuildParamsFeature","ni","registerFeatureImportPath","existingRegisterFeatureImport","hasRegisterFeature","extensionsIdentifier","node","Node","Error","extensionsArrowFn","extensionsArrowFnFragment","currentContent","newContent","AdminBuildParam","defineExtension","z","params","paramName","value","valueStr","JSON","hash","crypto","fileName","filePath","fileContent"],"mappings":";;;;;;AAOA,eAAeA,2BAA2BC,cAAsB,EAAEC,GAAQ;IACtE,MAAMC,kBAAkBC,KAAK,IAAI,CAACH,gBAAgB;IAGlD,MAAMI,QAAQC,GAAAA,WACE,CAACL,gBACZ,MAAM,CAACM,CAAAA,IAAKA,EAAE,UAAU,CAAC,kBAAkBA,EAAE,QAAQ,CAAC,UAAUA,AAAM,iBAANA;IAGrE,MAAMC,UAAUH,MACX,GAAG,CAACI,CAAAA;QACD,MAAMC,YAAYN,KAAK,KAAK,CAACK,MAAM,IAAI;QACvC,OAAO,CAAC,OAAO,EAAEC,UAAU,SAAS,EAAEA,UAAU,KAAK,CAAC;IAC1D,GACC,IAAI,CAAC;IAEV,MAAMC,gBAAgBN,MACjB,GAAG,CAACI,CAAAA;QACD,MAAMC,YAAYN,KAAK,KAAK,CAACK,MAAM,IAAI;QACvC,OAAO,CAAC,2BAA2B,EAAEC,UAAU,EAAE,CAAC;IAC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RA,EAAE,MAAM,CAACA,EAAE,MAAM,IAAIA,EAAE,GAAG;gBAC1BA,EAAE,KAAK,CAACA,EAAE,GAAG;gBACbA,EAAE,MAAM;gBACRA,EAAE,OAAO;aACZ;QACL;IAEJ,MAAM,OAAMC,MAAM,EAAExC,GAAG;QACnB,MAAMD,iBAAiBC,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACnD,IAAI,CAAC,QAAQ,SAAS,OAAO,eAC7B,QAAQ;QAEb,MAAM,EAAEyC,SAAS,EAAEC,KAAK,EAAE,GAAGF;QAG7B,MAAMG,WAAWC,KAAK,SAAS,CAACF,OAAO,MAAM;QAG7C,MAAMG,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACL,WAAW,MAAM,CAAC;QAClE,MAAMjC,YAAY,CAAC,WAAW,EAAEqC,KAAK,KAAK,CAAC,MAAM;QACjD,MAAME,WAAW,GAAGvC,UAAU,GAAG,CAAC;QAClC,MAAMwC,WAAW9C,KAAK,IAAI,CAACH,gBAAgBgD;QAG3C,IAAI,CAAC3C,GAAG,UAAU,CAACL,iBACfK,GAAG,SAAS,CAACL,gBAAgB;YAAE,WAAW;QAAK;QAInD,IAAI,CAACK,GAAG,UAAU,CAAC4C,WAAW;YAE1B,MAAMC,cAAc,CAAC;;MAE3B,EAAEzC,UAAU;WACP,EAAEiC,UAAU;YACX,EAAEE,SAAS;;;;oBAIH,EAAEnC,UAAU;;;AAGhC,CAAC;YACWJ,GAAG,aAAa,CAAC4C,UAAUC,aAAa;QAC5C;QAGA,MAAMnD,2BAA2BC,gBAAgBC;IACrD;AACJ"}
|
|
@@ -3,97 +3,71 @@ import { ExtensionSrcResolver } from "@webiny/project";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { Node, Project } from "ts-morph";
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
source.insertImportDeclaration(index, {
|
|
70
|
-
namedImports: [{
|
|
71
|
-
name: exportName,
|
|
72
|
-
alias: componentName
|
|
73
|
-
}],
|
|
74
|
-
moduleSpecifier: importPath
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
const extensionsIdentifier = source.getFirstDescendant(node => {
|
|
78
|
-
if (!Node.isIdentifier(node)) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return node.getText() === "Extensions";
|
|
82
|
-
});
|
|
83
|
-
if (!extensionsIdentifier) {
|
|
84
|
-
throw new Error(`Could not find the "Extensions" React component in "${extensionsTsxFilePath}". Did you maybe change the name of the component?`);
|
|
85
|
-
}
|
|
86
|
-
const extensionsArrowFn = extensionsIdentifier.getNextSibling(node => Node.isArrowFunction(node));
|
|
87
|
-
if (!extensionsArrowFn) {
|
|
88
|
-
throw new Error(`Could not find the "Extensions" React component in "${extensionsTsxFilePath}". Did you maybe change its definition? It should be an arrow function.`);
|
|
6
|
+
import crypto_0 from "crypto";
|
|
7
|
+
const AdminExtension = defineExtension({
|
|
8
|
+
type: "Admin/Extension",
|
|
9
|
+
tags: {
|
|
10
|
+
runtimeContext: "app-build",
|
|
11
|
+
appName: "admin"
|
|
12
|
+
},
|
|
13
|
+
description: "Extend the Admin application with custom functionality.",
|
|
14
|
+
multiple: true,
|
|
15
|
+
paramsSchema: ({ project })=>z.object({
|
|
16
|
+
src: zodSrcPath({
|
|
17
|
+
project
|
|
18
|
+
}),
|
|
19
|
+
exportName: z.string().optional()
|
|
20
|
+
}),
|
|
21
|
+
async build (params, ctx) {
|
|
22
|
+
const extensionsTsxFilePath = ctx.project.paths.workspaceFolder.join("apps", "admin", "src", "Extensions.tsx").toString();
|
|
23
|
+
const { src: extensionFilePath } = params;
|
|
24
|
+
const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(extensionFilePath, ctx.project);
|
|
25
|
+
const extensionFileName = path.basename(absoluteExtensionFilePath);
|
|
26
|
+
const exportName = params.exportName ?? path.parse(extensionFileName).name;
|
|
27
|
+
const hash = crypto_0.createHash("sha256").update(extensionFilePath).digest("hex");
|
|
28
|
+
const componentName = `AdminExtension_${hash.slice(-10)}`;
|
|
29
|
+
const project = new Project();
|
|
30
|
+
const importPath = path.relative(path.dirname(extensionsTsxFilePath), absoluteExtensionFilePath).replace(/\.tsx?$/, ".js");
|
|
31
|
+
project.addSourceFileAtPath(extensionsTsxFilePath);
|
|
32
|
+
const source = project.getSourceFileOrThrow(extensionsTsxFilePath);
|
|
33
|
+
const existingImportDeclaration = source.getImportDeclaration(importPath);
|
|
34
|
+
if (existingImportDeclaration) return;
|
|
35
|
+
const extensionProject = new Project();
|
|
36
|
+
extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);
|
|
37
|
+
const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);
|
|
38
|
+
const hasDefaultExport = void 0 !== extensionSource.getDefaultExportSymbol();
|
|
39
|
+
let index = 1;
|
|
40
|
+
const importDeclarations = source.getImportDeclarations();
|
|
41
|
+
if (importDeclarations.length) {
|
|
42
|
+
const last = importDeclarations[importDeclarations.length - 1];
|
|
43
|
+
index = last.getChildIndex() + 1;
|
|
44
|
+
}
|
|
45
|
+
if (hasDefaultExport) source.insertImportDeclaration(index, {
|
|
46
|
+
defaultImport: componentName,
|
|
47
|
+
moduleSpecifier: importPath
|
|
48
|
+
});
|
|
49
|
+
else source.insertImportDeclaration(index, {
|
|
50
|
+
namedImports: [
|
|
51
|
+
{
|
|
52
|
+
name: exportName,
|
|
53
|
+
alias: componentName
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
moduleSpecifier: importPath
|
|
57
|
+
});
|
|
58
|
+
const extensionsIdentifier = source.getFirstDescendant((node)=>{
|
|
59
|
+
if (!Node.isIdentifier(node)) return false;
|
|
60
|
+
return "Extensions" === node.getText();
|
|
61
|
+
});
|
|
62
|
+
if (!extensionsIdentifier) throw new Error(`Could not find the "Extensions" React component in "${extensionsTsxFilePath}". Did you maybe change the name of the component?`);
|
|
63
|
+
const extensionsArrowFn = extensionsIdentifier.getNextSibling((node)=>Node.isArrowFunction(node));
|
|
64
|
+
if (!extensionsArrowFn) throw new Error(`Could not find the "Extensions" React component in "${extensionsTsxFilePath}". Did you maybe change its definition? It should be an arrow function.`);
|
|
65
|
+
const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant((node)=>Node.isJsxFragment(node));
|
|
66
|
+
const extensionsArrowFnFragmentChildrenText = extensionsArrowFnFragment.getFullText().replace("<>", "").replace("</>", "").trim();
|
|
67
|
+
extensionsArrowFnFragment.replaceWithText(`<><${componentName}/>${extensionsArrowFnFragmentChildrenText}</>`);
|
|
68
|
+
await source.save();
|
|
89
69
|
}
|
|
90
|
-
const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant(node => {
|
|
91
|
-
return Node.isJsxFragment(node);
|
|
92
|
-
});
|
|
93
|
-
const extensionsArrowFnFragmentChildrenText = extensionsArrowFnFragment.getFullText().replace("<>", "").replace("</>", "").trim();
|
|
94
|
-
extensionsArrowFnFragment.replaceWithText(`<><${componentName}/>${extensionsArrowFnFragmentChildrenText}</>`);
|
|
95
|
-
await source.save();
|
|
96
|
-
}
|
|
97
70
|
});
|
|
71
|
+
export { AdminExtension };
|
|
98
72
|
|
|
99
73
|
//# sourceMappingURL=AdminExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"extensions/AdminExtension.js","sources":["../../src/extensions/AdminExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"@webiny/project\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { type JsxFragment, Node, Project } from \"ts-morph\";\nimport crypto from \"crypto\";\n\nexport const AdminExtension = defineExtension({\n type: \"Admin/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"admin\" },\n description: \"Extend the Admin application with custom functionality.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsxFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"admin\", \"src\", \"Extensions.tsx\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name can be customized or defaults to the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Generate a constant hash-based component name to avoid using timestamps.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const componentName = `AdminExtension_${hash.slice(-10)}`;\n\n const project = new Project();\n\n const importPath = path\n .relative(path.dirname(extensionsTsxFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n project.addSourceFileAtPath(extensionsTsxFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsxFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n // Check if the extension file has a default export or named export.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n const hasDefaultExport = extensionSource.getDefaultExportSymbol() !== undefined;\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Import as default export if available, otherwise import named export.\n if (hasDefaultExport) {\n source.insertImportDeclaration(index, {\n defaultImport: componentName,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: componentName }],\n moduleSpecifier: importPath\n });\n }\n\n const extensionsIdentifier = source.getFirstDescendant(node => {\n if (!Node.isIdentifier(node)) {\n return false;\n }\n\n return node.getText() === \"Extensions\";\n });\n\n if (!extensionsIdentifier) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\". Did you maybe change the name of the component?`\n );\n }\n\n const extensionsArrowFn = extensionsIdentifier.getNextSibling(node =>\n Node.isArrowFunction(node)\n );\n if (!extensionsArrowFn) {\n throw new Error(\n `Could not find the \"Extensions\" React component in \"${extensionsTsxFilePath}\". Did you maybe change its definition? It should be an arrow function.`\n );\n }\n\n const extensionsArrowFnFragment = extensionsArrowFn.getFirstDescendant(node => {\n return Node.isJsxFragment(node);\n }) as JsxFragment;\n\n const extensionsArrowFnFragmentChildrenText = extensionsArrowFnFragment\n .getFullText()\n .replace(\"<>\", \"\")\n .replace(\"</>\", \"\")\n .trim();\n\n extensionsArrowFnFragment.replaceWithText(\n `<><${componentName}/>${extensionsArrowFnFragmentChildrenText}</>`\n );\n\n await source.save();\n }\n});\n"],"names":["AdminExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsxFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","componentName","Project","importPath","source","existingImportDeclaration","extensionProject","extensionSource","hasDefaultExport","undefined","index","importDeclarations","last","extensionsIdentifier","node","Node","Error","extensionsArrowFn","extensionsArrowFnFragment","extensionsArrowFnFragmentChildrenText"],"mappings":";;;;;;AAOO,MAAMA,iBAAiBC,gBAAgB;IAC1C,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAQ;IACtD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,KAAKC,WAAW;gBAAEF;YAAQ;YAC1B,YAAYC,EAAE,MAAM,GAAG,QAAQ;QACnC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,wBAAwBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CAC1D,IAAI,CAAC,QAAQ,SAAS,OAAO,kBAC7B,QAAQ;QAEb,MAAM,EAAE,KAAKE,iBAAiB,EAAE,GAAGH;QAGnC,MAAMI,4BAA4BC,qBAAqB,WAAW,CAC9DF,mBACAF,IAAI,OAAO;QAGf,MAAMK,oBAAoBC,KAAK,QAAQ,CAACH;QAGxC,MAAMI,aAAaR,OAAO,UAAU,IAAIO,KAAK,KAAK,CAACD,mBAAmB,IAAI;QAG1E,MAAMG,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACP,mBAAmB,MAAM,CAAC;QAC1E,MAAMQ,gBAAgB,CAAC,eAAe,EAAEF,KAAK,KAAK,CAAC,MAAM;QAEzD,MAAMZ,UAAU,IAAIe;QAEpB,MAAMC,aAAaN,KAAAA,QACN,CAACA,KAAK,OAAO,CAACL,wBAAwBE,2BAC9C,OAAO,CAAC,WAAW;QAExBP,QAAQ,mBAAmB,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AO,CAAC,OAAO,IACf,IAAI;QAETA,0BAA0B,eAAe,CACrC,CAAC,GAAG,EAAEjB,cAAc,EAAE,EAAEkB,sCAAsC,GAAG,CAAC;QAGtE,MAAMf,OAAO,IAAI;IACrB;AACJ"}
|
|
@@ -1,53 +1,42 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { Node, Project } from "ts-morph";
|
|
3
3
|
import { defineExtension } from "../defineExtension/index.js";
|
|
4
|
-
import
|
|
4
|
+
import crypto_0 from "crypto";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import fs from "fs";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
fs.mkdirSync(buildParamsDir, {
|
|
41
|
-
recursive: true
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Check if file already exists.
|
|
46
|
-
if (fs.existsSync(filePath)) {
|
|
47
|
-
// File exists, just ensure it's imported in extensions.ts
|
|
48
|
-
} else {
|
|
49
|
-
// Create the BuildParam implementation file.
|
|
50
|
-
const fileContent = `import { BuildParam } from "webiny/api/build-params";
|
|
7
|
+
const BuildParam = defineExtension({
|
|
8
|
+
type: "Api/BuildParam",
|
|
9
|
+
tags: {
|
|
10
|
+
runtimeContext: "app-build",
|
|
11
|
+
appName: "api"
|
|
12
|
+
},
|
|
13
|
+
description: "Add build-time parameter to API app.",
|
|
14
|
+
multiple: true,
|
|
15
|
+
paramsSchema: ()=>z.object({
|
|
16
|
+
paramName: z.string(),
|
|
17
|
+
value: z.union([
|
|
18
|
+
z.string(),
|
|
19
|
+
z.record(z.string(), z.any()),
|
|
20
|
+
z.array(z.any()),
|
|
21
|
+
z.number(),
|
|
22
|
+
z.boolean()
|
|
23
|
+
])
|
|
24
|
+
}),
|
|
25
|
+
async build (params, ctx) {
|
|
26
|
+
const extensionsTsFilePath = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "extensions.ts").toString();
|
|
27
|
+
const buildParamsDir = ctx.project.paths.workspaceFolder.join("apps", "api", "graphql", "src", "buildParams").toString();
|
|
28
|
+
const { paramName, value } = params;
|
|
29
|
+
const valueStr = JSON.stringify(value, null, 4);
|
|
30
|
+
const hash = crypto_0.createHash("sha256").update(paramName).digest("hex");
|
|
31
|
+
const className = `BuildParam_${hash.slice(-10)}`;
|
|
32
|
+
const fileName = `${className}.ts`;
|
|
33
|
+
const filePath = path.join(buildParamsDir, fileName);
|
|
34
|
+
if (!fs.existsSync(buildParamsDir)) fs.mkdirSync(buildParamsDir, {
|
|
35
|
+
recursive: true
|
|
36
|
+
});
|
|
37
|
+
if (fs.existsSync(filePath)) ;
|
|
38
|
+
else {
|
|
39
|
+
const fileContent = `import { BuildParam } from "webiny/api/build-params";
|
|
51
40
|
|
|
52
41
|
class ${className} implements BuildParam.Interface {
|
|
53
42
|
key = "${paramName}";
|
|
@@ -59,61 +48,46 @@ export default BuildParam.createImplementation({
|
|
|
59
48
|
dependencies: []
|
|
60
49
|
});
|
|
61
50
|
`;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// Check if import already exists.
|
|
79
|
-
const existingImportDeclaration = source.getImportDeclaration(importPath);
|
|
80
|
-
if (existingImportDeclaration) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
let index = 1;
|
|
84
|
-
const importDeclarations = source.getImportDeclarations();
|
|
85
|
-
if (importDeclarations.length) {
|
|
86
|
-
const last = importDeclarations[importDeclarations.length - 1];
|
|
87
|
-
index = last.getChildIndex() + 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Add import for the BuildParam implementation.
|
|
91
|
-
source.insertImportDeclaration(index, {
|
|
92
|
-
defaultImport: className,
|
|
93
|
-
moduleSpecifier: importPath
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// Add the registration to the plugins array.
|
|
97
|
-
const pluginsArray = source.getFirstDescendant(node => Node.isArrayLiteralExpression(node));
|
|
98
|
-
pluginsArray.addElement(`\ncreateRegisterExtensionPlugin(ctx => {\n\tregisterExtension(ctx.container, ${className});\n})`);
|
|
99
|
-
{
|
|
100
|
-
let index = 1;
|
|
101
|
-
const importDeclarations = source.getImportDeclarations();
|
|
102
|
-
if (importDeclarations.length) {
|
|
103
|
-
const last = importDeclarations[importDeclarations.length - 1];
|
|
104
|
-
index = last.getChildIndex() + 1;
|
|
105
|
-
}
|
|
106
|
-
const contextPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
|
|
107
|
-
const existingContextPluginImport = source.getImportDeclaration(contextPluginImportPath);
|
|
108
|
-
if (!existingContextPluginImport) {
|
|
51
|
+
fs.writeFileSync(filePath, fileContent, "utf8");
|
|
52
|
+
}
|
|
53
|
+
const project = new Project();
|
|
54
|
+
project.addSourceFileAtPath(extensionsTsFilePath);
|
|
55
|
+
const source = project.getSourceFileOrThrow(extensionsTsFilePath);
|
|
56
|
+
let importPath = path.relative(path.dirname(extensionsTsFilePath), filePath).replace(/\.tsx?$/, ".js");
|
|
57
|
+
if (!importPath.startsWith(".")) importPath = "./" + importPath;
|
|
58
|
+
const existingImportDeclaration = source.getImportDeclaration(importPath);
|
|
59
|
+
if (existingImportDeclaration) return;
|
|
60
|
+
let index = 1;
|
|
61
|
+
const importDeclarations = source.getImportDeclarations();
|
|
62
|
+
if (importDeclarations.length) {
|
|
63
|
+
const last = importDeclarations[importDeclarations.length - 1];
|
|
64
|
+
index = last.getChildIndex() + 1;
|
|
65
|
+
}
|
|
109
66
|
source.insertImportDeclaration(index, {
|
|
110
|
-
|
|
111
|
-
|
|
67
|
+
defaultImport: className,
|
|
68
|
+
moduleSpecifier: importPath
|
|
112
69
|
});
|
|
113
|
-
|
|
70
|
+
const pluginsArray = source.getFirstDescendant((node)=>Node.isArrayLiteralExpression(node));
|
|
71
|
+
pluginsArray.addElement(`\ncreateRegisterExtensionPlugin(ctx => {\n\tregisterExtension(ctx.container, ${className});\n})`);
|
|
72
|
+
{
|
|
73
|
+
let index = 1;
|
|
74
|
+
const importDeclarations = source.getImportDeclarations();
|
|
75
|
+
if (importDeclarations.length) {
|
|
76
|
+
const last = importDeclarations[importDeclarations.length - 1];
|
|
77
|
+
index = last.getChildIndex() + 1;
|
|
78
|
+
}
|
|
79
|
+
const contextPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
|
|
80
|
+
const existingContextPluginImport = source.getImportDeclaration(contextPluginImportPath);
|
|
81
|
+
if (!existingContextPluginImport) source.insertImportDeclaration(index, {
|
|
82
|
+
namedImports: [
|
|
83
|
+
"createRegisterExtensionPlugin"
|
|
84
|
+
],
|
|
85
|
+
moduleSpecifier: contextPluginImportPath
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
await source.save();
|
|
114
89
|
}
|
|
115
|
-
await source.save();
|
|
116
|
-
}
|
|
117
90
|
});
|
|
91
|
+
export { BuildParam };
|
|
118
92
|
|
|
119
93
|
//# sourceMappingURL=ApiBuildParam.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"extensions/ApiBuildParam.js","sources":["../../src/extensions/ApiBuildParam.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport crypto from \"crypto\";\nimport path from \"path\";\nimport fs from \"fs\";\n\nexport const BuildParam = defineExtension({\n type: \"Api/BuildParam\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add build-time parameter to API app.\",\n multiple: true,\n paramsSchema: () => {\n return z.object({\n paramName: z.string(),\n value: z.union([\n z.string(),\n z.record(z.string(), z.any()),\n z.array(z.any()),\n z.number(),\n z.boolean()\n ])\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 buildParamsDir = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"buildParams\")\n .toString();\n\n const { paramName, value } = params;\n\n // Serialize value to a TypeScript literal.\n const valueStr = JSON.stringify(value, null, 4);\n\n // Generate a unique class name based on the paramName.\n const hash = crypto.createHash(\"sha256\").update(paramName).digest(\"hex\");\n const className = `BuildParam_${hash.slice(-10)}`;\n const fileName = `${className}.ts`;\n const filePath = path.join(buildParamsDir, fileName);\n\n // Ensure buildParams directory exists.\n if (!fs.existsSync(buildParamsDir)) {\n fs.mkdirSync(buildParamsDir, { recursive: true });\n }\n\n // Check if file already exists.\n if (fs.existsSync(filePath)) {\n // File exists, just ensure it's imported in extensions.ts\n } else {\n // Create the BuildParam implementation file.\n const fileContent = `import { BuildParam } from \"webiny/api/build-params\";\n\nclass ${className} implements BuildParam.Interface {\n key = \"${paramName}\";\n value = ${valueStr};\n}\n\nexport default BuildParam.createImplementation({\n implementation: ${className},\n dependencies: []\n});\n`;\n fs.writeFileSync(filePath, fileContent, \"utf8\");\n }\n\n // Now update extensions.ts to import and register this BuildParam.\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n // Calculate import path relative to extensions.ts.\n let importPath = path\n .relative(path.dirname(extensionsTsFilePath), filePath)\n .replace(/\\.tsx?$/, \".js\");\n\n // Ensure the path starts with ./\n if (!importPath.startsWith(\".\")) {\n importPath = \"./\" + importPath;\n }\n\n // Check if import already exists.\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Add import for the BuildParam implementation.\n source.insertImportDeclaration(index, {\n defaultImport: className,\n moduleSpecifier: importPath\n });\n\n // Add the registration to the plugins array.\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${className});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const contextPluginImportPath = \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingContextPluginImport =\n source.getImportDeclaration(contextPluginImportPath);\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: contextPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"names":["BuildParam","defineExtension","z","params","ctx","extensionsTsFilePath","buildParamsDir","paramName","value","valueStr","JSON","hash","crypto","className","fileName","filePath","path","fs","fileContent","project","Project","source","importPath","existingImportDeclaration","index","importDeclarations","last","pluginsArray","node","Node","contextPluginImportPath","existingContextPluginImport"],"mappings":";;;;;;AAOO,MAAMA,aAAaC,gBAAgB;IACtC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU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