@webiny/cli-core 0.0.0-unstable.3c5210ad37 → 0.0.0-unstable.3fddf667ea
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/Cli.d.ts +2 -1
- package/Cli.js +12 -11
- package/Cli.js.map +1 -1
- package/abstractions/createAbstraction.js +3 -2
- package/abstractions/createAbstraction.js.map +1 -1
- package/abstractions/features/CliCommand.d.ts +4 -0
- package/abstractions/features/CliCommand.js +2 -1
- package/abstractions/features/CliCommand.js.map +1 -1
- package/abstractions/features/ErrorHandler.js +2 -1
- package/abstractions/features/ErrorHandler.js.map +1 -1
- package/abstractions/features/GlobalCliOption.js +2 -1
- package/abstractions/features/GlobalCliOption.js.map +1 -1
- package/abstractions/features/IsCi.js +2 -1
- package/abstractions/features/IsCi.js.map +1 -1
- package/abstractions/features/index.js +0 -2
- package/abstractions/features/types.js +0 -3
- package/abstractions/index.js +0 -2
- package/abstractions/services/ArgvParserService.js +2 -1
- package/abstractions/services/ArgvParserService.js.map +1 -1
- package/abstractions/services/CliParamsService.js +2 -1
- package/abstractions/services/CliParamsService.js.map +1 -1
- package/abstractions/services/CommandsRegistryService.js +2 -1
- package/abstractions/services/CommandsRegistryService.js.map +1 -1
- package/abstractions/services/DefaultAppsService.d.ts +8 -0
- package/abstractions/services/DefaultAppsService.js +5 -0
- package/abstractions/services/DefaultAppsService.js.map +1 -0
- package/abstractions/services/GetArgvService.js +2 -1
- package/abstractions/services/GetArgvService.js.map +1 -1
- package/abstractions/services/GetCliRunnerService.js +2 -1
- package/abstractions/services/GetCliRunnerService.js.map +1 -1
- package/abstractions/services/GetIsCiService.js +2 -1
- package/abstractions/services/GetIsCiService.js.map +1 -1
- package/abstractions/services/GetProjectSdkService.js +2 -1
- package/abstractions/services/GetProjectSdkService.js.map +1 -1
- package/abstractions/services/GlobalOptionsRegistryService.js +2 -1
- package/abstractions/services/GlobalOptionsRegistryService.js.map +1 -1
- package/abstractions/services/LoggerService.js +2 -1
- package/abstractions/services/LoggerService.js.map +1 -1
- package/abstractions/services/RunCliRunnerService.js +2 -1
- package/abstractions/services/RunCliRunnerService.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/index.d.ts +1 -0
- package/abstractions/services/index.js +1 -2
- package/createCliContainer.d.ts +1 -1
- package/createCliContainer.js +86 -119
- package/createCliContainer.js.map +1 -1
- package/decorators/CommandsWithGracefulErrorHandling.js +34 -32
- package/decorators/CommandsWithGracefulErrorHandling.js.map +1 -1
- package/decorators/index.d.ts +0 -1
- package/decorators/index.js +0 -3
- package/exports/cli/command.js +0 -2
- package/exports/cli.d.ts +2 -0
- package/exports/cli.js +2 -0
- package/exports/extensions.d.ts +1 -0
- package/exports/extensions.js +1 -0
- package/extensions/CliCommand.d.ts +3 -7
- package/extensions/CliCommand.js +16 -18
- package/extensions/CliCommand.js.map +1 -1
- package/extensions/CliCommandDecorator.d.ts +3 -7
- package/extensions/CliCommandDecorator.js +16 -18
- package/extensions/CliCommandDecorator.js.map +1 -1
- package/extensions/index.d.ts +2 -6
- package/extensions/index.js +5 -2
- package/extensions/index.js.map +1 -1
- package/features/AboutCommand.js +75 -86
- package/features/AboutCommand.js.map +1 -1
- package/features/BuildCommand/BuildCommand.d.ts +7 -3
- package/features/BuildCommand/BuildCommand.js +68 -37
- package/features/BuildCommand/BuildCommand.js.map +1 -1
- package/features/BuildCommand/buildRunners/BaseBuildRunner.js +10 -13
- package/features/BuildCommand/buildRunners/BaseBuildRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/BuildRunner.js +18 -21
- package/features/BuildCommand/buildRunners/BuildRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.js +20 -19
- package/features/BuildCommand/buildRunners/MultipleBuildsRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/SingleBuildRunner.js +15 -14
- package/features/BuildCommand/buildRunners/SingleBuildRunner.js.map +1 -1
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.js +3 -4
- package/features/BuildCommand/buildRunners/ZeroBuildsRunner.js.map +1 -1
- package/features/BuildCommand/index.js +0 -2
- package/features/ConfigCommand.js +55 -56
- package/features/ConfigCommand.js.map +1 -1
- package/features/DeployCommand/index.d.ts +20 -1
- package/features/DeployCommand/index.js +0 -3
- package/features/DepsSync/BuildDependencyTree.js +16 -21
- package/features/DepsSync/BuildDependencyTree.js.map +1 -1
- package/features/DepsSync/DependencyTree.js +108 -119
- package/features/DepsSync/DependencyTree.js.map +1 -1
- package/features/DepsSync/ListAllPackageJsonFiles.js +19 -14
- package/features/DepsSync/ListAllPackageJsonFiles.js.map +1 -1
- package/features/DepsSync/ListAllPackages.d.ts +1 -1
- package/features/DepsSync/ListAllPackages.js +9 -9
- package/features/DepsSync/ListAllPackages.js.map +1 -1
- package/features/DepsSync/commands/SyncDepsCommand.js +30 -24
- package/features/DepsSync/commands/SyncDepsCommand.js.map +1 -1
- package/features/DepsSync/commands/VerifyDepsCommand.js +69 -70
- package/features/DepsSync/commands/VerifyDepsCommand.js.map +1 -1
- package/features/DepsSync/createDependencyTree.d.ts +1 -1
- package/features/DepsSync/createDependencyTree.js +28 -18
- package/features/DepsSync/createDependencyTree.js.map +1 -1
- package/features/DepsSync/createReferenceFile.js +21 -25
- package/features/DepsSync/createReferenceFile.js.map +1 -1
- package/features/DepsSync/index.js +0 -2
- package/features/DepsSync/paths.js +3 -6
- package/features/DepsSync/paths.js.map +1 -1
- package/features/DepsSync/types.js +7 -6
- package/features/DepsSync/types.js.map +1 -1
- package/features/DisableTelemetryCommand.js +28 -25
- package/features/DisableTelemetryCommand.js.map +1 -1
- package/features/EnableTelemetryCommand.js +28 -25
- package/features/EnableTelemetryCommand.js.map +1 -1
- package/features/ExtensionCommand/ExtensionCommand.js +60 -63
- package/features/ExtensionCommand/ExtensionCommand.js.map +1 -1
- package/features/ExtensionCommand/index.js +0 -2
- package/features/IsCi/IsCi.js +14 -11
- package/features/IsCi/IsCi.js.map +1 -1
- package/features/IsCi/index.js +1 -3
- package/features/UpgradeCommand/UpgradeCommand.d.ts +29 -0
- package/features/UpgradeCommand/UpgradeCommand.js +123 -0
- package/features/UpgradeCommand/UpgradeCommand.js.map +1 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.d.ts +11 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.js +105 -0
- package/features/UpgradeCommand/UpgradeCommandHandler.js.map +1 -0
- package/features/UpgradeCommand/abstraction.d.ts +23 -0
- package/features/UpgradeCommand/abstraction.js +5 -0
- package/features/UpgradeCommand/abstraction.js.map +1 -0
- package/features/UpgradeCommand/feature.d.ts +4 -0
- package/features/UpgradeCommand/feature.js +13 -0
- package/features/UpgradeCommand/feature.js.map +1 -0
- package/features/UpgradeCommand/index.d.ts +2 -0
- package/features/UpgradeCommand/index.js +2 -0
- package/features/Wcp/LinkProjectCommand.js +120 -139
- package/features/Wcp/LinkProjectCommand.js.map +1 -1
- package/features/Wcp/LoginCommand.js +104 -118
- package/features/Wcp/LoginCommand.js.map +1 -1
- package/features/Wcp/LogoutCommand.js +29 -23
- package/features/Wcp/LogoutCommand.js.map +1 -1
- package/features/Wcp/WhoAmICommand.js +33 -29
- package/features/Wcp/WhoAmICommand.js.map +1 -1
- package/features/common/index.js +0 -2
- package/features/common/options.js +41 -50
- package/features/common/options.js.map +1 -1
- package/features/globalOptions/LogLevelGlobalOption.js +25 -16
- package/features/globalOptions/LogLevelGlobalOption.js.map +1 -1
- package/features/globalOptions/ShowLogsGlobalOption.js +16 -15
- package/features/globalOptions/ShowLogsGlobalOption.js.map +1 -1
- package/features/globalOptions/StackTraceGlobalOption.js +16 -15
- package/features/globalOptions/StackTraceGlobalOption.js.map +1 -1
- package/features/globalOptions/TraceGlobalOption.d.ts +5 -0
- package/features/globalOptions/TraceGlobalOption.js +22 -0
- package/features/globalOptions/TraceGlobalOption.js.map +1 -0
- package/features/globalOptions/index.d.ts +1 -0
- package/features/globalOptions/index.js +1 -2
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.js +12 -18
- package/features/gracefulErrorHandlers/MissingFilesInBuildGracefulErrorHandler.js.map +1 -1
- package/features/gracefulErrorHandlers/index.d.ts +0 -2
- package/features/gracefulErrorHandlers/index.js +0 -4
- package/features/index.d.ts +1 -7
- package/features/index.js +1 -9
- package/features/utils/index.js +0 -2
- package/features/utils/measureDuration.js +7 -8
- package/features/utils/measureDuration.js.map +1 -1
- package/index.js +0 -2
- package/namespaces/cli.d.ts +5 -0
- package/namespaces/cli.js +7 -0
- package/namespaces/cli.js.map +1 -0
- package/package.json +35 -28
- package/services/ArgvParserService/ArgvParserService.js +27 -33
- package/services/ArgvParserService/ArgvParserService.js.map +1 -1
- package/services/ArgvParserService/index.js +0 -2
- package/services/CliParamsService/CliParamsService.js +18 -15
- package/services/CliParamsService/CliParamsService.js.map +1 -1
- package/services/CliParamsService/index.js +0 -2
- package/services/CommandsRegistryService/CommandsRegistryService.js +19 -13
- package/services/CommandsRegistryService/CommandsRegistryService.js.map +1 -1
- package/services/CommandsRegistryService/index.js +0 -2
- package/services/DefaultAppsService/DefaultAppsService.d.ts +5 -0
- package/services/DefaultAppsService/DefaultAppsService.js +15 -0
- package/services/DefaultAppsService/DefaultAppsService.js.map +1 -0
- package/services/DefaultAppsService/index.d.ts +1 -0
- package/services/DefaultAppsService/index.js +1 -0
- package/services/GetArgvService/GetArgvService.js +14 -11
- package/services/GetArgvService/GetArgvService.js.map +1 -1
- package/services/GetArgvService/index.js +0 -2
- package/services/GetCliRunnerService/GetCliRunnerService.js +123 -148
- package/services/GetCliRunnerService/GetCliRunnerService.js.map +1 -1
- package/services/GetCliRunnerService/index.js +0 -2
- package/services/GetIsCiService/GetIsCiService.js +9 -8
- package/services/GetIsCiService/GetIsCiService.js.map +1 -1
- package/services/GetIsCiService/index.js +1 -3
- package/services/GetProjectSdkService/GetProjectSdkService.js +25 -24
- package/services/GetProjectSdkService/GetProjectSdkService.js.map +1 -1
- package/services/GetProjectSdkService/index.js +0 -2
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.js +19 -13
- package/services/GlobalOptionsRegistryService/GlobalOptionsRegistryService.js.map +1 -1
- package/services/GlobalOptionsRegistryService/index.js +0 -2
- package/services/LoggerService/LoggerService.js +76 -88
- package/services/LoggerService/LoggerService.js.map +1 -1
- package/services/LoggerService/index.js +0 -2
- package/services/RunCliRunnerService/RunCliRunnerService.d.ts +1 -1
- package/services/RunCliRunnerService/RunCliRunnerService.js +15 -13
- package/services/RunCliRunnerService/RunCliRunnerService.js.map +1 -1
- package/services/RunCliRunnerService/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.d.ts +18 -0
- package/services/UiService/UiService.js +71 -58
- package/services/UiService/UiService.js.map +1 -1
- package/services/UiService/index.js +0 -2
- package/services/index.d.ts +1 -0
- package/services/index.js +1 -2
- package/utils/ManuallyReportedError.js +7 -6
- package/utils/ManuallyReportedError.js.map +1 -1
- package/utils/ensureSameWebinyPackageVersions/ensureSameWebinyPackageVersions.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/ensureSameWebinyPackageVersions.js +53 -0
- package/utils/ensureSameWebinyPackageVersions/ensureSameWebinyPackageVersions.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/getCacheFilePath.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/getCacheFilePath.js +12 -0
- package/utils/ensureSameWebinyPackageVersions/getCacheFilePath.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/hashYarnLock.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/hashYarnLock.js +16 -0
- package/utils/ensureSameWebinyPackageVersions/hashYarnLock.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/index.d.ts +6 -0
- package/utils/ensureSameWebinyPackageVersions/index.js +6 -0
- package/utils/ensureSameWebinyPackageVersions/listWebinyPackageVersions.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/listWebinyPackageVersions.js +31 -0
- package/utils/ensureSameWebinyPackageVersions/listWebinyPackageVersions.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/readClearedYarnLockHash.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/readClearedYarnLockHash.js +13 -0
- package/utils/ensureSameWebinyPackageVersions/readClearedYarnLockHash.js.map +1 -0
- package/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.d.ts +1 -0
- package/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.js +24 -0
- package/utils/ensureSameWebinyPackageVersions/writeClearedYarnLockHash.js.map +1 -0
- package/utils/suppressPunycodeWarnings.d.ts +4 -0
- package/utils/suppressPunycodeWarnings.js +7 -0
- package/utils/suppressPunycodeWarnings.js.map +1 -0
- package/abstractions/features/index.js.map +0 -1
- package/abstractions/features/types.js.map +0 -1
- package/abstractions/index.js.map +0 -1
- package/abstractions/services/index.js.map +0 -1
- package/decorators/DeployCommandWithTelemetry.d.ts +0 -11
- package/decorators/DeployCommandWithTelemetry.js +0 -91
- package/decorators/DeployCommandWithTelemetry.js.map +0 -1
- package/decorators/index.js.map +0 -1
- package/exports/cli/command.js.map +0 -1
- package/exports/cli/index.d.ts +0 -2
- package/exports/cli/index.js +0 -4
- package/exports/cli/index.js.map +0 -1
- package/features/BuildCommand/index.js.map +0 -1
- package/features/DeployCommand/DeployCommand.d.ts +0 -30
- package/features/DeployCommand/DeployCommand.js +0 -168
- package/features/DeployCommand/DeployCommand.js.map +0 -1
- package/features/DeployCommand/deployOutputs/BaseDeployOutput.d.ts +0 -20
- package/features/DeployCommand/deployOutputs/BaseDeployOutput.js +0 -20
- package/features/DeployCommand/deployOutputs/BaseDeployOutput.js.map +0 -1
- package/features/DeployCommand/deployOutputs/DeployOutput.d.ts +0 -5
- package/features/DeployCommand/deployOutputs/DeployOutput.js +0 -24
- package/features/DeployCommand/deployOutputs/DeployOutput.js.map +0 -1
- package/features/DeployCommand/deployOutputs/NoDeploymentLogsDeployOutput.d.ts +0 -4
- package/features/DeployCommand/deployOutputs/NoDeploymentLogsDeployOutput.js +0 -61
- package/features/DeployCommand/deployOutputs/NoDeploymentLogsDeployOutput.js.map +0 -1
- package/features/DeployCommand/deployOutputs/WithDeploymentLogsDeployOutput.d.ts +0 -4
- package/features/DeployCommand/deployOutputs/WithDeploymentLogsDeployOutput.js +0 -44
- package/features/DeployCommand/deployOutputs/WithDeploymentLogsDeployOutput.js.map +0 -1
- package/features/DeployCommand/index.js.map +0 -1
- package/features/DepsSync/index.js.map +0 -1
- package/features/DestroyCommand/DestroyCommand.d.ts +0 -22
- package/features/DestroyCommand/DestroyCommand.js +0 -78
- package/features/DestroyCommand/DestroyCommand.js.map +0 -1
- package/features/DestroyCommand/index.d.ts +0 -1
- package/features/DestroyCommand/index.js +0 -3
- package/features/DestroyCommand/index.js.map +0 -1
- package/features/ExtensionCommand/index.js.map +0 -1
- package/features/InfoCommand/InfoCommand.d.ts +0 -10
- package/features/InfoCommand/InfoCommand.js +0 -64
- package/features/InfoCommand/InfoCommand.js.map +0 -1
- package/features/InfoCommand/PrintInfoForEnv.d.ts +0 -14
- package/features/InfoCommand/PrintInfoForEnv.js +0 -53
- package/features/InfoCommand/PrintInfoForEnv.js.map +0 -1
- package/features/InfoCommand/index.d.ts +0 -1
- package/features/InfoCommand/index.js +0 -3
- package/features/InfoCommand/index.js.map +0 -1
- package/features/IsCi/index.js.map +0 -1
- package/features/OpenCommand.d.ts +0 -10
- package/features/OpenCommand.js +0 -54
- package/features/OpenCommand.js.map +0 -1
- package/features/OutputCommand.d.ts +0 -12
- package/features/OutputCommand.js +0 -79
- package/features/OutputCommand.js.map +0 -1
- package/features/PulumiCommand/PulumiCommand.d.ts +0 -13
- package/features/PulumiCommand/PulumiCommand.js +0 -50
- package/features/PulumiCommand/PulumiCommand.js.map +0 -1
- package/features/PulumiCommand/index.d.ts +0 -1
- package/features/PulumiCommand/index.js +0 -3
- package/features/PulumiCommand/index.js.map +0 -1
- package/features/RefreshCommand/RefreshCommand.d.ts +0 -12
- package/features/RefreshCommand/RefreshCommand.js +0 -45
- package/features/RefreshCommand/RefreshCommand.js.map +0 -1
- package/features/RefreshCommand/index.d.ts +0 -1
- package/features/RefreshCommand/index.js +0 -3
- package/features/RefreshCommand/index.js.map +0 -1
- package/features/WatchCommand/WatchCommand.d.ts +0 -11
- package/features/WatchCommand/WatchCommand.js +0 -143
- package/features/WatchCommand/WatchCommand.js.map +0 -1
- package/features/WatchCommand/createPrefixer.d.ts +0 -2
- package/features/WatchCommand/createPrefixer.js +0 -20
- package/features/WatchCommand/createPrefixer.js.map +0 -1
- package/features/WatchCommand/getRandomColorForString.d.ts +0 -1
- package/features/WatchCommand/getRandomColorForString.js +0 -11
- package/features/WatchCommand/getRandomColorForString.js.map +0 -1
- package/features/WatchCommand/index.d.ts +0 -1
- package/features/WatchCommand/index.js +0 -3
- package/features/WatchCommand/index.js.map +0 -1
- package/features/common/index.js.map +0 -1
- package/features/globalOptions/index.js.map +0 -1
- package/features/gracefulErrorHandlers/DdbPutItemConditionalCheckFailedGracefulErrorHandler.d.ts +0 -6
- package/features/gracefulErrorHandlers/DdbPutItemConditionalCheckFailedGracefulErrorHandler.js +0 -26
- package/features/gracefulErrorHandlers/DdbPutItemConditionalCheckFailedGracefulErrorHandler.js.map +0 -1
- package/features/gracefulErrorHandlers/PendingOperationsGracefulErrorHandler.d.ts +0 -6
- package/features/gracefulErrorHandlers/PendingOperationsGracefulErrorHandler.js +0 -29
- package/features/gracefulErrorHandlers/PendingOperationsGracefulErrorHandler.js.map +0 -1
- package/features/gracefulErrorHandlers/index.js.map +0 -1
- package/features/index.js.map +0 -1
- package/features/utils/index.js.map +0 -1
- package/index.js.map +0 -1
- package/services/ArgvParserService/index.js.map +0 -1
- package/services/CliParamsService/index.js.map +0 -1
- package/services/CommandsRegistryService/index.js.map +0 -1
- package/services/GetArgvService/index.js.map +0 -1
- package/services/GetCliRunnerService/index.js.map +0 -1
- package/services/GetIsCiService/index.js.map +0 -1
- package/services/GetProjectSdkService/index.js.map +0 -1
- package/services/GlobalOptionsRegistryService/index.js.map +0 -1
- package/services/LoggerService/index.js.map +0 -1
- package/services/RunCliRunnerService/index.js.map +0 -1
- package/services/StdioService/index.js.map +0 -1
- package/services/UiService/index.js.map +0 -1
- package/services/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createImplementation","CliCommandFactory","GetProjectSdkService","LoggerService","UiService","setTimeout","open","sleep","ms","LOGIN_RETRIES_COUNT","LOGIN_RETRIES_INTERVAL","LoginCommand","constructor","getProjectSdkService","uiService","loggerService","execute","name","description","examples","options","type","handler","pat","patFromParams","projectSdk","wcp","ui","logger","getUserPat","expiresOn","createUserPat","meta","token","generatedPat","generateUserPat","queryParams","encodeURIComponent","openUrl","getWcpAppUrl","join","toString","debug","graphql","variables","headers","Authorization","retries","result","Promise","resolve","interval","setInterval","clearInterval","err","graphqlRequest","Error","storePatToLocalStorage","success","projectLinked","getProjectId","then","id","orgId","projectId","emptyLine","info","setProjectId","textBold","text","loginCommand","abstraction","implementation","dependencies"],"sources":["LoginCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IWcpUserPatModel } from \"@webiny/project/abstractions/models/index.js\";\nimport {\n CliCommandFactory,\n GetProjectSdkService,\n LoggerService,\n UiService\n} from \"~/abstractions/index.js\";\nimport { setTimeout } from \"node:timers/promises\";\nimport { WcpUserPatModel } from \"@webiny/project/models/index.js\";\nimport open from \"open\";\n\nconst sleep = (ms: number = 1500) => setTimeout(ms);\n\n// 120 retries * 2000ms interval = 4 minutes until the command returns an error.\nconst LOGIN_RETRIES_COUNT = 30;\nconst LOGIN_RETRIES_INTERVAL = 2_000;\n\ninterface ILoginCommandParams {\n pat?: string;\n}\n\nexport class LoginCommand implements CliCommandFactory.Interface<ILoginCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface,\n private loggerService: LoggerService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<ILoginCommandParams>> {\n return {\n name: \"login\",\n description: \"Log in to Webiny Control Panel\",\n examples: [\"$0 login\"],\n options: [\n {\n name: \"pat\",\n description: \"Personal Access Token (PAT) to use for authentication\",\n type: \"string\"\n }\n ],\n handler: async ({ pat: patFromParams }: ILoginCommandParams) => {\n const projectSdk = await this.getProjectSdkService.execute();\n const wcp = projectSdk.wcp;\n const ui = this.uiService;\n const logger = this.loggerService;\n\n let pat: IWcpUserPatModel | null = null;\n\n if (patFromParams) {\n pat = await wcp.getUserPat(patFromParams);\n\n // If we've received a PAT that has expiration, let's create a long-lived PAT.\n // We don't want to have our users interrupted because of an expired PAT.\n if (pat && pat.expiresOn) {\n pat = await wcp.createUserPat({ meta: pat.meta }, pat.token);\n }\n } else {\n const generatedPat = await wcp.generateUserPat();\n\n const queryParams = `pat=${generatedPat}&pat_name=${encodeURIComponent(\n \"Webiny CLI\"\n )}&ref=cli`;\n\n const openUrl = wcp.getWcpAppUrl().join(`/login/cli?${queryParams}`).toString();\n\n logger.debug(`Opening %s...`, openUrl);\n await open(openUrl);\n\n const graphql = {\n variables: { token: generatedPat },\n headers: {\n Authorization: generatedPat\n }\n };\n\n let retries = 0;\n\n const result = await new Promise<WcpUserPatModel | null>(resolve => {\n const interval = setInterval(async () => {\n retries++;\n if (retries > LOGIN_RETRIES_COUNT) {\n clearInterval(interval);\n resolve(null);\n }\n\n try {\n const pat = await wcp.getUserPat(generatedPat);\n clearInterval(interval);\n resolve(pat);\n } catch (err) {\n // Do nothing.\n logger.debug(\n {\n err,\n graphqlRequest: graphql\n },\n `Could not login. Will try again in ${LOGIN_RETRIES_INTERVAL}ms.`\n );\n }\n }, LOGIN_RETRIES_INTERVAL);\n });\n\n if (!result) {\n throw new Error(\n `Could not login. Did you complete the sign in / sign up process at ${wcp\n .getWcpAppUrl()\n .toString()}?`\n );\n }\n\n pat = result;\n }\n\n if (!pat) {\n throw new Error(\n `Could not log in. Could not obtain a valid Personal Access Token.`\n );\n }\n\n projectSdk.wcp.storePatToLocalStorage(pat.token);\n\n ui.success(`%s You've successfully logged in to Webiny Control Panel.`, \"✔\");\n\n let projectLinked = await projectSdk.getProjectId().then(id => !!id);\n if (projectLinked) {\n return;\n }\n\n // If we have `orgId` and `projectId` in PAT's metadata, let's immediately link the project.\n if (pat.meta && pat.meta.orgId && pat.meta.projectId) {\n await sleep();\n ui.emptyLine();\n\n const { orgId, projectId } = pat.meta;\n\n const id = `${orgId}/${projectId}`;\n ui.info(`Project %s detected. Linking...`, id);\n await projectSdk.setProjectId(id);\n\n await sleep();\n ui.success(`Project %s linked successfully.`, id);\n projectLinked = true;\n }\n\n await sleep();\n\n ui.emptyLine();\n ui.textBold(\"Next Steps\");\n\n if (!projectLinked) {\n ui.text(`‣ link your project via the \"yarn webiny project link\" command`);\n }\n\n ui.text(`‣ deploy your project via the \"yarn webiny deploy\" command`);\n }\n };\n }\n}\n\nexport const loginCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: LoginCommand,\n dependencies: [GetProjectSdkService, UiService, LoggerService]\n});\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,YAAY;AAEjD,SACIC,iBAAiB,EACjBC,oBAAoB,EACpBC,aAAa,EACbC,SAAS;AAEb,SAASC,UAAU,QAAQ,sBAAsB;AAEjD,OAAOC,IAAI,MAAM,MAAM;AAEvB,MAAMC,KAAK,GAAGA,CAACC,EAAU,GAAG,IAAI,KAAKH,UAAU,CAACG,EAAE,CAAC;;AAEnD;AACA,MAAMC,mBAAmB,GAAG,EAAE;AAC9B,MAAMC,sBAAsB,GAAG,KAAK;AAMpC,OAAO,MAAMC,YAAY,CAA6D;EAClFC,WAAWA,CACCC,oBAAoD,EACpDC,SAA8B,EAC9BC,aAAsC,EAChD;IAAA,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;AACjE,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"features/Wcp/LoginCommand.js","sources":["../../../src/features/Wcp/LoginCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { IWcpUserPatModel } from \"@webiny/project/abstractions/models/index.js\";\nimport {\n CliCommandFactory,\n GetProjectSdkService,\n LoggerService,\n UiService\n} from \"~/abstractions/index.js\";\nimport { setTimeout } from \"node:timers/promises\";\nimport { WcpUserPatModel } from \"@webiny/project/models/index.js\";\nimport open from \"open\";\n\nconst sleep = (ms: number = 1500) => setTimeout(ms);\n\n// 120 retries * 2000ms interval = 4 minutes until the command returns an error.\nconst LOGIN_RETRIES_COUNT = 30;\nconst LOGIN_RETRIES_INTERVAL = 2_000;\n\ninterface ILoginCommandParams {\n pat?: string;\n}\n\nexport class LoginCommand implements CliCommandFactory.Interface<ILoginCommandParams> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface,\n private loggerService: LoggerService.Interface\n ) {}\n\n async execute(): Promise<CliCommandFactory.CommandDefinition<ILoginCommandParams>> {\n return {\n name: \"login\",\n description: \"Log in to Webiny Control Panel\",\n examples: [\"$0 login\"],\n options: [\n {\n name: \"pat\",\n description: \"Personal Access Token (PAT) to use for authentication\",\n type: \"string\"\n }\n ],\n handler: async ({ pat: patFromParams }: ILoginCommandParams) => {\n const projectSdk = await this.getProjectSdkService.execute();\n const wcp = projectSdk.wcp;\n const ui = this.uiService;\n const logger = this.loggerService;\n\n let pat: IWcpUserPatModel | null = null;\n\n if (patFromParams) {\n pat = await wcp.getUserPat(patFromParams);\n\n // If we've received a PAT that has expiration, let's create a long-lived PAT.\n // We don't want to have our users interrupted because of an expired PAT.\n if (pat && pat.expiresOn) {\n pat = await wcp.createUserPat({ meta: pat.meta }, pat.token);\n }\n } else {\n const generatedPat = await wcp.generateUserPat();\n\n const queryParams = `pat=${generatedPat}&pat_name=${encodeURIComponent(\n \"Webiny CLI\"\n )}&ref=cli`;\n\n const openUrl = wcp.getWcpAppUrl().join(`/login/cli?${queryParams}`).toString();\n\n logger.debug(`Opening %s...`, openUrl);\n await open(openUrl);\n\n const graphql = {\n variables: { token: generatedPat },\n headers: {\n Authorization: generatedPat\n }\n };\n\n let retries = 0;\n\n const result = await new Promise<WcpUserPatModel | null>(resolve => {\n const interval = setInterval(async () => {\n retries++;\n if (retries > LOGIN_RETRIES_COUNT) {\n clearInterval(interval);\n resolve(null);\n }\n\n try {\n const pat = await wcp.getUserPat(generatedPat);\n clearInterval(interval);\n resolve(pat);\n } catch (err) {\n // Do nothing.\n logger.debug(\n {\n err,\n graphqlRequest: graphql\n },\n `Could not login. Will try again in ${LOGIN_RETRIES_INTERVAL}ms.`\n );\n }\n }, LOGIN_RETRIES_INTERVAL);\n });\n\n if (!result) {\n throw new Error(\n `Could not login. Did you complete the sign in / sign up process at ${wcp\n .getWcpAppUrl()\n .toString()}?`\n );\n }\n\n pat = result;\n }\n\n if (!pat) {\n throw new Error(\n `Could not log in. Could not obtain a valid Personal Access Token.`\n );\n }\n\n projectSdk.wcp.storePatToLocalStorage(pat.token);\n\n ui.success(`%s You've successfully logged in to Webiny Control Panel.`, \"✔\");\n\n let projectLinked = await projectSdk.getProjectId().then(id => !!id);\n if (projectLinked) {\n return;\n }\n\n // If we have `orgId` and `projectId` in PAT's metadata, let's immediately link the project.\n if (pat.meta && pat.meta.orgId && pat.meta.projectId) {\n await sleep();\n ui.emptyLine();\n\n const { orgId, projectId } = pat.meta;\n\n const id = `${orgId}/${projectId}`;\n ui.info(`Project %s detected. Linking...`, id);\n await projectSdk.setProjectId(id);\n\n await sleep();\n ui.success(`Project %s linked successfully.`, id);\n projectLinked = true;\n }\n\n await sleep();\n\n ui.emptyLine();\n ui.textBold(\"Next Steps\");\n\n if (!projectLinked) {\n ui.text(`‣ link your project via the \"yarn webiny project link\" command`);\n }\n\n ui.text(`‣ deploy your project via the \"yarn webiny deploy\" command`);\n }\n };\n }\n}\n\nexport const loginCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: LoginCommand,\n dependencies: [GetProjectSdkService, UiService, LoggerService]\n});\n"],"names":["sleep","ms","setTimeout","LOGIN_RETRIES_COUNT","LOGIN_RETRIES_INTERVAL","LoginCommand","getProjectSdkService","uiService","loggerService","patFromParams","projectSdk","wcp","ui","logger","pat","generatedPat","queryParams","encodeURIComponent","openUrl","open","graphql","retries","result","Promise","resolve","interval","setInterval","clearInterval","err","Error","projectLinked","id","orgId","projectId","loginCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService","LoggerService"],"mappings":";;;;AAYA,MAAMA,QAAQ,CAACC,KAAa,IAAI,GAAKC,oBAAWD;AAGhD,MAAME,sBAAsB;AAC5B,MAAMC,yBAAyB;AAMxB,MAAMC;IACT,YACYC,oBAAoD,EACpDC,SAA8B,EAC9BC,aAAsC,CAChD;aAHUF,oBAAoB,GAApBA;aACAC,SAAS,GAATA;aACAC,aAAa,GAAbA;IACT;IAEH,MAAM,UAA6E;QAC/E,OAAO;YACH,MAAM;YACN,aAAa;YACb,UAAU;gBAAC;aAAW;YACtB,SAAS;gBACL;oBACI,MAAM;oBACN,aAAa;oBACb,MAAM;gBACV;aACH;YACD,SAAS,OAAO,EAAE,KAAKC,aAAa,EAAuB;gBACvD,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;gBAC1D,MAAMC,MAAMD,WAAW,GAAG;gBAC1B,MAAME,KAAK,IAAI,CAAC,SAAS;gBACzB,MAAMC,SAAS,IAAI,CAAC,aAAa;gBAEjC,IAAIC,MAA+B;gBAEnC,IAAIL,eAAe;oBACfK,MAAM,MAAMH,IAAI,UAAU,CAACF;oBAI3B,IAAIK,OAAOA,IAAI,SAAS,EACpBA,MAAM,MAAMH,IAAI,aAAa,CAAC;wBAAE,MAAMG,IAAI,IAAI;oBAAC,GAAGA,IAAI,KAAK;gBAEnE,OAAO;oBACH,MAAMC,eAAe,MAAMJ,IAAI,eAAe;oBAE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BACNY,GAAG,SAAS;oBAEZ,MAAM,EAAEoB,KAAK,EAAEC,SAAS,EAAE,GAAGnB,IAAI,IAAI;oBAErC,MAAMiB,KAAK,GAAGC,MAAM,CAAC,EAAEC,WAAW;oBAClCrB,GAAG,IAAI,CAAC,mCAAmCmB;oBAC3C,MAAMrB,WAAW,YAAY,CAACqB;oBAE9B,MAAM/B;oBACNY,GAAG,OAAO,CAAC,mCAAmCmB;oBAC9CD,gBAAgB;gBACpB;gBAEA,MAAM9B;gBAENY,GAAG,SAAS;gBACZA,GAAG,QAAQ,CAAC;gBAEZ,IAAI,CAACkB,eACDlB,GAAG,IAAI,CAAC;gBAGZA,GAAG,IAAI,CAAC;YACZ;QACJ;IACJ;AACJ;AAEO,MAAMsB,eAAeC,qBAAqB;IAC7C,aAAaC;IACb,gBAAgB/B;IAChB,cAAc;QAACgC;QAAsBC;QAAWC;KAAc;AAClE"}
|
|
@@ -1,29 +1,35 @@
|
|
|
1
1
|
import { createImplementation } from "@webiny/di";
|
|
2
2
|
import { CliCommandFactory, GetProjectSdkService, UiService } from "../../abstractions/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
class LogoutCommand {
|
|
4
|
+
constructor(getProjectSdkService, uiService){
|
|
5
|
+
this.getProjectSdkService = getProjectSdkService;
|
|
6
|
+
this.uiService = uiService;
|
|
7
|
+
}
|
|
8
|
+
async execute() {
|
|
9
|
+
const projectSdk = await this.getProjectSdkService.execute();
|
|
10
|
+
const wcp = projectSdk.wcp;
|
|
11
|
+
const ui = this.uiService;
|
|
12
|
+
return {
|
|
13
|
+
name: "logout",
|
|
14
|
+
description: "Log out from Webiny Control Panel",
|
|
15
|
+
examples: [
|
|
16
|
+
"$0 logout"
|
|
17
|
+
],
|
|
18
|
+
handler: async ()=>{
|
|
19
|
+
wcp.unsetPatFromLocalStorage();
|
|
20
|
+
ui.success("You've successfully logged out from Webiny Control Panel.");
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const logoutCommand = createImplementation({
|
|
26
|
+
abstraction: CliCommandFactory,
|
|
27
|
+
implementation: LogoutCommand,
|
|
28
|
+
dependencies: [
|
|
29
|
+
GetProjectSdkService,
|
|
30
|
+
UiService
|
|
31
|
+
]
|
|
27
32
|
});
|
|
33
|
+
export { LogoutCommand, logoutCommand };
|
|
28
34
|
|
|
29
35
|
//# sourceMappingURL=LogoutCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/Wcp/LogoutCommand.js","sources":["../../../src/features/Wcp/LogoutCommand.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\n\nexport class LogoutCommand implements CliCommandFactory.Interface<void> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n const projectSdk = await this.getProjectSdkService.execute();\n const wcp = projectSdk.wcp;\n const ui = this.uiService;\n\n return {\n name: \"logout\",\n description: \"Log out from Webiny Control Panel\",\n examples: [\"$0 logout\"],\n handler: async () => {\n wcp.unsetPatFromLocalStorage();\n ui.success(`You've successfully logged out from Webiny Control Panel.`);\n }\n };\n }\n}\n\nexport const logoutCommand = createImplementation({\n abstraction: CliCommandFactory,\n implementation: LogoutCommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["LogoutCommand","getProjectSdkService","uiService","projectSdk","wcp","ui","logoutCommand","createImplementation","CliCommandFactory","GetProjectSdkService","UiService"],"mappings":";;AAGO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,CACxC;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;QAC1D,MAAMC,MAAMD,WAAW,GAAG;QAC1B,MAAME,KAAK,IAAI,CAAC,SAAS;QAEzB,OAAO;YACH,MAAM;YACN,aAAa;YACb,UAAU;gBAAC;aAAY;YACvB,SAAS;gBACLD,IAAI,wBAAwB;gBAC5BC,GAAG,OAAO,CAAC;YACf;QACJ;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,qBAAqB;IAC9C,aAAaC;IACb,gBAAgBR;IAChB,cAAc;QAACS;QAAsBC;KAAU;AACnD"}
|
|
@@ -1,34 +1,38 @@
|
|
|
1
1
|
import { CliCommandFactory, GetProjectSdkService, UiService } from "../../abstractions/index.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
2
|
+
class WhoAmICommand {
|
|
3
|
+
constructor(getProjectSdkService, uiService){
|
|
4
|
+
this.getProjectSdkService = getProjectSdkService;
|
|
5
|
+
this.uiService = uiService;
|
|
6
|
+
}
|
|
7
|
+
async execute() {
|
|
8
|
+
const projectSdk = await this.getProjectSdkService.execute();
|
|
9
|
+
const wcp = projectSdk.wcp;
|
|
10
|
+
const ui = this.uiService;
|
|
11
|
+
return {
|
|
12
|
+
name: "whoami",
|
|
13
|
+
description: "Display the current logged-in user",
|
|
14
|
+
examples: [
|
|
15
|
+
"$0 whoami"
|
|
16
|
+
],
|
|
17
|
+
handler: async ()=>{
|
|
18
|
+
try {
|
|
19
|
+
const user = await wcp.getUser();
|
|
20
|
+
if (!user) throw new Error();
|
|
21
|
+
ui.info("You are logged in to Webiny Control Panel as %s.", user.email);
|
|
22
|
+
} catch {
|
|
23
|
+
throw new Error('It seems you are not logged in. Please login using the "yarn webiny login" command.');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const whoAmICommand = CliCommandFactory.createImplementation({
|
|
30
|
+
implementation: WhoAmICommand,
|
|
31
|
+
dependencies: [
|
|
32
|
+
GetProjectSdkService,
|
|
33
|
+
UiService
|
|
34
|
+
]
|
|
32
35
|
});
|
|
36
|
+
export { WhoAmICommand, whoAmICommand };
|
|
33
37
|
|
|
34
38
|
//# sourceMappingURL=WhoAmICommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/Wcp/WhoAmICommand.js","sources":["../../../src/features/Wcp/WhoAmICommand.ts"],"sourcesContent":["import { CliCommandFactory, GetProjectSdkService, UiService } from \"~/abstractions/index.js\";\n\nexport class WhoAmICommand implements CliCommandFactory.Interface<void> {\n constructor(\n private getProjectSdkService: GetProjectSdkService.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n const projectSdk = await this.getProjectSdkService.execute();\n const wcp = projectSdk.wcp;\n const ui = this.uiService;\n\n return {\n name: \"whoami\",\n description: \"Display the current logged-in user\",\n examples: [\"$0 whoami\"],\n handler: async () => {\n try {\n const user = await wcp.getUser();\n if (!user) {\n throw new Error();\n }\n ui.info(\"You are logged in to Webiny Control Panel as %s.\", user.email);\n } catch {\n throw new Error(\n `It seems you are not logged in. Please login using the \"yarn webiny login\" command.`\n );\n }\n }\n };\n }\n}\n\nexport const whoAmICommand = CliCommandFactory.createImplementation({\n implementation: WhoAmICommand,\n dependencies: [GetProjectSdkService, UiService]\n});\n"],"names":["WhoAmICommand","getProjectSdkService","uiService","projectSdk","wcp","ui","user","Error","whoAmICommand","CliCommandFactory","GetProjectSdkService","UiService"],"mappings":";AAEO,MAAMA;IACT,YACYC,oBAAoD,EACpDC,SAA8B,CACxC;aAFUD,oBAAoB,GAApBA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,aAAa,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO;QAC1D,MAAMC,MAAMD,WAAW,GAAG;QAC1B,MAAME,KAAK,IAAI,CAAC,SAAS;QAEzB,OAAO;YACH,MAAM;YACN,aAAa;YACb,UAAU;gBAAC;aAAY;YACvB,SAAS;gBACL,IAAI;oBACA,MAAMC,OAAO,MAAMF,IAAI,OAAO;oBAC9B,IAAI,CAACE,MACD,MAAM,IAAIC;oBAEdF,GAAG,IAAI,CAAC,oDAAoDC,KAAK,KAAK;gBAC1E,EAAE,OAAM;oBACJ,MAAM,IAAIC,MACN;gBAER;YACJ;QACJ;IACJ;AACJ;AAEO,MAAMC,gBAAgBC,kBAAkB,oBAAoB,CAAC;IAChE,gBAAgBT;IAChB,cAAc;QAACU;QAAsBC;KAAU;AACnD"}
|
package/features/common/index.js
CHANGED
|
@@ -1,52 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
return true;
|
|
44
|
-
},
|
|
45
|
-
...overrides
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
export const createBaseAppOptions = (projectSdk, overrides = {}) => {
|
|
49
|
-
return [createEnvOption(overrides.env), createVariantOption(projectSdk, overrides.variant), createRegionOption(projectSdk, overrides.region)];
|
|
50
|
-
};
|
|
1
|
+
const createEnvOption = (overrides = {})=>({
|
|
2
|
+
name: "env",
|
|
3
|
+
description: "Environment name (dev, prod, etc.)",
|
|
4
|
+
type: "string",
|
|
5
|
+
default: "dev",
|
|
6
|
+
validation: (params)=>{
|
|
7
|
+
const p = params;
|
|
8
|
+
const hasApp = p.app || p.apps && p.apps.length > 0;
|
|
9
|
+
if (hasApp && !p.env) throw new Error("Environment name is required.");
|
|
10
|
+
return true;
|
|
11
|
+
},
|
|
12
|
+
...overrides
|
|
13
|
+
});
|
|
14
|
+
const createVariantOption = (projectSdk, overrides = {})=>({
|
|
15
|
+
name: "variant",
|
|
16
|
+
description: "Variant name",
|
|
17
|
+
type: "string",
|
|
18
|
+
validation: (params)=>{
|
|
19
|
+
const isValid = projectSdk.isValidVariantName(params.variant);
|
|
20
|
+
if (isValid.isErr()) throw isValid.error;
|
|
21
|
+
return true;
|
|
22
|
+
},
|
|
23
|
+
...overrides
|
|
24
|
+
});
|
|
25
|
+
const createRegionOption = (projectSdk, overrides = {})=>({
|
|
26
|
+
name: "region",
|
|
27
|
+
description: "Region to target",
|
|
28
|
+
type: "string",
|
|
29
|
+
validation: (params)=>{
|
|
30
|
+
const isValid = projectSdk.isValidRegionName(params.region);
|
|
31
|
+
if (isValid.isErr()) throw isValid.error;
|
|
32
|
+
return true;
|
|
33
|
+
},
|
|
34
|
+
...overrides
|
|
35
|
+
});
|
|
36
|
+
const createBaseAppOptions = (projectSdk, overrides = {})=>[
|
|
37
|
+
createEnvOption(overrides.env),
|
|
38
|
+
createVariantOption(projectSdk, overrides.variant),
|
|
39
|
+
createRegionOption(projectSdk, overrides.region)
|
|
40
|
+
];
|
|
41
|
+
export { createBaseAppOptions, createEnvOption, createRegionOption, createVariantOption };
|
|
51
42
|
|
|
52
43
|
//# sourceMappingURL=options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/common/options.js","sources":["../../../src/features/common/options.ts"],"sourcesContent":["import { CliCommandFactory } from \"~/abstractions/index.js\";\nimport { ProjectSdk } from \"@webiny/project\";\n\nexport const createEnvOption = <T extends { env?: string }>(\n overrides: Partial<CliCommandFactory.OptionDefinition<T>> = {}\n): CliCommandFactory.OptionDefinition<T> => {\n return {\n name: \"env\",\n description: \"Environment name (dev, prod, etc.)\",\n type: \"string\",\n default: \"dev\",\n validation: params => {\n const p = params as any;\n const hasApp = p.app || (p.apps && p.apps.length > 0);\n if (hasApp && !p.env) {\n throw new Error(\"Environment name is required.\");\n }\n return true;\n },\n ...overrides\n };\n};\n\nexport const createVariantOption = <T extends { variant?: string }>(\n projectSdk: ProjectSdk,\n overrides: Partial<CliCommandFactory.OptionDefinition<T>> = {}\n): CliCommandFactory.OptionDefinition<T> => {\n return {\n name: \"variant\",\n description: \"Variant name\",\n type: \"string\",\n validation: params => {\n const isValid = projectSdk.isValidVariantName(params.variant);\n if (isValid.isErr()) {\n throw isValid.error;\n }\n return true;\n },\n ...overrides\n };\n};\n\nexport const createRegionOption = <T extends { region?: string }>(\n projectSdk: ProjectSdk,\n overrides: Partial<CliCommandFactory.OptionDefinition<T>> = {}\n): CliCommandFactory.OptionDefinition<T> => {\n return {\n name: \"region\",\n description: \"Region to target\",\n type: \"string\",\n validation: params => {\n const isValid = projectSdk.isValidRegionName(params.region);\n if (isValid.isErr()) {\n throw isValid.error;\n }\n return true;\n },\n ...overrides\n };\n};\n\nexport const createBaseAppOptions = <T extends { env?: string; variant?: string; region?: string }>(\n projectSdk: ProjectSdk,\n overrides: {\n env?: Partial<CliCommandFactory.OptionDefinition<T>>;\n variant?: Partial<CliCommandFactory.OptionDefinition<T>>;\n region?: Partial<CliCommandFactory.OptionDefinition<T>>;\n } = {}\n): CliCommandFactory.OptionDefinition<T>[] => {\n return [\n createEnvOption(overrides.env),\n createVariantOption(projectSdk, overrides.variant),\n createRegionOption(projectSdk, overrides.region)\n ];\n};\n"],"names":["createEnvOption","overrides","params","p","hasApp","Error","createVariantOption","projectSdk","isValid","createRegionOption","createBaseAppOptions"],"mappings":"AAGO,MAAMA,kBAAkB,CAC3BC,YAA4D,CAAC,CAAC,GAEvD;QACH,MAAM;QACN,aAAa;QACb,MAAM;QACN,SAAS;QACT,YAAYC,CAAAA;YACR,MAAMC,IAAID;YACV,MAAME,SAASD,EAAE,GAAG,IAAKA,EAAE,IAAI,IAAIA,EAAE,IAAI,CAAC,MAAM,GAAG;YACnD,IAAIC,UAAU,CAACD,EAAE,GAAG,EAChB,MAAM,IAAIE,MAAM;YAEpB,OAAO;QACX;QACA,GAAGJ,SAAS;IAChB;AAGG,MAAMK,sBAAsB,CAC/BC,YACAN,YAA4D,CAAC,CAAC,GAEvD;QACH,MAAM;QACN,aAAa;QACb,MAAM;QACN,YAAYC,CAAAA;YACR,MAAMM,UAAUD,WAAW,kBAAkB,CAACL,OAAO,OAAO;YAC5D,IAAIM,QAAQ,KAAK,IACb,MAAMA,QAAQ,KAAK;YAEvB,OAAO;QACX;QACA,GAAGP,SAAS;IAChB;AAGG,MAAMQ,qBAAqB,CAC9BF,YACAN,YAA4D,CAAC,CAAC,GAEvD;QACH,MAAM;QACN,aAAa;QACb,MAAM;QACN,YAAYC,CAAAA;YACR,MAAMM,UAAUD,WAAW,iBAAiB,CAACL,OAAO,MAAM;YAC1D,IAAIM,QAAQ,KAAK,IACb,MAAMA,QAAQ,KAAK;YAEvB,OAAO;QACX;QACA,GAAGP,SAAS;IAChB;AAGG,MAAMS,uBAAuB,CAChCH,YACAN,YAII,CAAC,CAAC,GAEC;QACHD,gBAAgBC,UAAU,GAAG;QAC7BK,oBAAoBC,YAAYN,UAAU,OAAO;QACjDQ,mBAAmBF,YAAYN,UAAU,MAAM;KAClD"}
|
|
@@ -1,22 +1,31 @@
|
|
|
1
1
|
import { createImplementation } from "@webiny/di";
|
|
2
2
|
import { GlobalCliOption } from "../../abstractions/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
class LogLevelGlobalOption {
|
|
4
|
+
execute() {
|
|
5
|
+
return {
|
|
6
|
+
name: "log-level",
|
|
7
|
+
config: {
|
|
8
|
+
type: "string",
|
|
9
|
+
default: "info",
|
|
10
|
+
choices: [
|
|
11
|
+
"silent",
|
|
12
|
+
"fatal",
|
|
13
|
+
"error",
|
|
14
|
+
"warn",
|
|
15
|
+
"info",
|
|
16
|
+
"debug",
|
|
17
|
+
"trace"
|
|
18
|
+
],
|
|
19
|
+
description: "Set the verbosity of logs"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
15
23
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
const logLevelGlobalOption = createImplementation({
|
|
25
|
+
abstraction: GlobalCliOption,
|
|
26
|
+
implementation: LogLevelGlobalOption,
|
|
27
|
+
dependencies: []
|
|
20
28
|
});
|
|
29
|
+
export { LogLevelGlobalOption, logLevelGlobalOption };
|
|
21
30
|
|
|
22
31
|
//# sourceMappingURL=LogLevelGlobalOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/globalOptions/LogLevelGlobalOption.js","sources":["../../../src/features/globalOptions/LogLevelGlobalOption.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GlobalCliOption } from \"~/abstractions/index.js\";\n\nexport class LogLevelGlobalOption implements GlobalCliOption.Interface {\n execute(): GlobalCliOption.Definition {\n return {\n name: \"log-level\",\n config: {\n type: \"string\",\n default: \"info\",\n choices: [\"silent\", \"fatal\", \"error\", \"warn\", \"info\", \"debug\", \"trace\"],\n description: \"Set the verbosity of logs\"\n }\n };\n }\n}\n\nexport const logLevelGlobalOption = createImplementation({\n abstraction: GlobalCliOption,\n implementation: LogLevelGlobalOption,\n dependencies: []\n});\n"],"names":["LogLevelGlobalOption","logLevelGlobalOption","createImplementation","GlobalCliOption"],"mappings":";;AAGO,MAAMA;IACT,UAAsC;QAClC,OAAO;YACH,MAAM;YACN,QAAQ;gBACJ,MAAM;gBACN,SAAS;gBACT,SAAS;oBAAC;oBAAU;oBAAS;oBAAS;oBAAQ;oBAAQ;oBAAS;iBAAQ;gBACvE,aAAa;YACjB;QACJ;IACJ;AACJ;AAEO,MAAMC,uBAAuBC,qBAAqB;IACrD,aAAaC;IACb,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { createImplementation } from "@webiny/di";
|
|
2
2
|
import { GlobalCliOption } from "../../abstractions/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
class ShowLogsGlobalOption {
|
|
4
|
+
execute() {
|
|
5
|
+
return {
|
|
6
|
+
name: "show-logs",
|
|
7
|
+
config: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
default: false,
|
|
10
|
+
description: "Print logs directly in the terminal"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const showLogsGlobalOption = createImplementation({
|
|
16
|
+
abstraction: GlobalCliOption,
|
|
17
|
+
implementation: ShowLogsGlobalOption,
|
|
18
|
+
dependencies: []
|
|
19
19
|
});
|
|
20
|
+
export { ShowLogsGlobalOption, showLogsGlobalOption };
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=ShowLogsGlobalOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/globalOptions/ShowLogsGlobalOption.js","sources":["../../../src/features/globalOptions/ShowLogsGlobalOption.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GlobalCliOption } from \"~/abstractions/index.js\";\n\nexport class ShowLogsGlobalOption implements GlobalCliOption.Interface {\n execute(): GlobalCliOption.Definition {\n return {\n name: \"show-logs\",\n config: {\n type: \"boolean\",\n default: false,\n description: \"Print logs directly in the terminal\"\n }\n };\n }\n}\n\nexport const showLogsGlobalOption = createImplementation({\n abstraction: GlobalCliOption,\n implementation: ShowLogsGlobalOption,\n dependencies: []\n});\n"],"names":["ShowLogsGlobalOption","showLogsGlobalOption","createImplementation","GlobalCliOption"],"mappings":";;AAGO,MAAMA;IACT,UAAsC;QAClC,OAAO;YACH,MAAM;YACN,QAAQ;gBACJ,MAAM;gBACN,SAAS;gBACT,aAAa;YACjB;QACJ;IACJ;AACJ;AAEO,MAAMC,uBAAuBC,qBAAqB;IACrD,aAAaC;IACb,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { createImplementation } from "@webiny/di";
|
|
2
2
|
import { GlobalCliOption } from "../../abstractions/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
class StackTraceGlobalOption {
|
|
4
|
+
execute() {
|
|
5
|
+
return {
|
|
6
|
+
name: "show-stack-trace",
|
|
7
|
+
config: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
default: false,
|
|
10
|
+
description: "Show stack traces for errors"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const stackTraceGlobalOption = createImplementation({
|
|
16
|
+
abstraction: GlobalCliOption,
|
|
17
|
+
implementation: StackTraceGlobalOption,
|
|
18
|
+
dependencies: []
|
|
19
19
|
});
|
|
20
|
+
export { StackTraceGlobalOption, stackTraceGlobalOption };
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=StackTraceGlobalOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"features/globalOptions/StackTraceGlobalOption.js","sources":["../../../src/features/globalOptions/StackTraceGlobalOption.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GlobalCliOption } from \"~/abstractions/index.js\";\n\nexport class StackTraceGlobalOption implements GlobalCliOption.Interface {\n execute(): GlobalCliOption.Definition {\n return {\n name: \"show-stack-trace\",\n config: {\n type: \"boolean\",\n default: false,\n description: \"Show stack traces for errors\"\n }\n };\n }\n}\n\nexport const stackTraceGlobalOption = createImplementation({\n abstraction: GlobalCliOption,\n implementation: StackTraceGlobalOption,\n dependencies: []\n});\n"],"names":["StackTraceGlobalOption","stackTraceGlobalOption","createImplementation","GlobalCliOption"],"mappings":";;AAGO,MAAMA;IACT,UAAsC;QAClC,OAAO;YACH,MAAM;YACN,QAAQ;gBACJ,MAAM;gBACN,SAAS;gBACT,aAAa;YACjB;QACJ;IACJ;AACJ;AAEO,MAAMC,yBAAyBC,qBAAqB;IACvD,aAAaC;IACb,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GlobalCliOption } from "../../abstractions/index.js";
|
|
2
|
+
export declare class TraceGlobalOption implements GlobalCliOption.Interface {
|
|
3
|
+
execute(): GlobalCliOption.Definition;
|
|
4
|
+
}
|
|
5
|
+
export declare const traceGlobalOption: import("@webiny/di").Implementation<typeof TraceGlobalOption>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createImplementation } from "@webiny/di";
|
|
2
|
+
import { GlobalCliOption } from "../../abstractions/index.js";
|
|
3
|
+
class TraceGlobalOption {
|
|
4
|
+
execute() {
|
|
5
|
+
return {
|
|
6
|
+
name: "trace",
|
|
7
|
+
config: {
|
|
8
|
+
type: "boolean",
|
|
9
|
+
default: false,
|
|
10
|
+
description: "Print a timing breakdown of the run"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const traceGlobalOption = createImplementation({
|
|
16
|
+
abstraction: GlobalCliOption,
|
|
17
|
+
implementation: TraceGlobalOption,
|
|
18
|
+
dependencies: []
|
|
19
|
+
});
|
|
20
|
+
export { TraceGlobalOption, traceGlobalOption };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=TraceGlobalOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"features/globalOptions/TraceGlobalOption.js","sources":["../../../src/features/globalOptions/TraceGlobalOption.ts"],"sourcesContent":["import { createImplementation } from \"@webiny/di\";\nimport { GlobalCliOption } from \"~/abstractions/index.js\";\n\n/*\n * Declared here only so the flag shows up in `webiny --help`. The CLI entrypoint reads it straight\n * off `process.argv`, because tracing has to be on before yargs is built.\n */\nexport class TraceGlobalOption implements GlobalCliOption.Interface {\n execute(): GlobalCliOption.Definition {\n return {\n name: \"trace\",\n config: {\n type: \"boolean\",\n default: false,\n description: \"Print a timing breakdown of the run\"\n }\n };\n }\n}\n\nexport const traceGlobalOption = createImplementation({\n abstraction: GlobalCliOption,\n implementation: TraceGlobalOption,\n dependencies: []\n});\n"],"names":["TraceGlobalOption","traceGlobalOption","createImplementation","GlobalCliOption"],"mappings":";;AAOO,MAAMA;IACT,UAAsC;QAClC,OAAO;YACH,MAAM;YACN,QAAQ;gBACJ,MAAM;gBACN,SAAS;gBACT,aAAa;YACjB;QACJ;IACJ;AACJ;AAEO,MAAMC,oBAAoBC,qBAAqB;IAClD,aAAaC;IACb,gBAAgBH;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -2,26 +2,20 @@ import { createImplementation } from "@webiny/di";
|
|
|
2
2
|
import { ErrorHandler } from "../../abstractions/index.js";
|
|
3
3
|
import { GracefulError } from "@webiny/project";
|
|
4
4
|
const MATCH_STRING = "failed to compute archive hash for";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
class MissingFilesInBuildGracefulErrorHandler {
|
|
6
|
+
execute({ error, params }) {
|
|
7
|
+
if (!error.message) return;
|
|
8
|
+
if (!error.message.includes(MATCH_STRING)) return;
|
|
9
|
+
const message = "Looks like the deployment failed because Pulumi could not retrieve the built code. Please try again, or, alternatively, try building the app you're trying to deploy by running %s.";
|
|
10
|
+
const cmd = `yarn webiny build ${params.app} --env ${params.env}`;
|
|
11
|
+
throw GracefulError.from(error, message, cmd);
|
|
12
12
|
}
|
|
13
|
-
if (!error.message.includes(MATCH_STRING)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const message = ["Looks like the deployment failed because Pulumi could not retrieve the built code.", "Please try again, or, alternatively, try building the app you're", "trying to deploy by running %s."].join(" ");
|
|
17
|
-
const cmd = `yarn webiny build ${params.app} --env ${params.env}`;
|
|
18
|
-
throw GracefulError.from(error, message, cmd);
|
|
19
|
-
}
|
|
20
13
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
const missingFilesInBuildGracefulErrorHandler = createImplementation({
|
|
15
|
+
abstraction: ErrorHandler,
|
|
16
|
+
implementation: MissingFilesInBuildGracefulErrorHandler,
|
|
17
|
+
dependencies: []
|
|
25
18
|
});
|
|
19
|
+
export { MissingFilesInBuildGracefulErrorHandler, missingFilesInBuildGracefulErrorHandler };
|
|
26
20
|
|
|
27
21
|
//# sourceMappingURL=MissingFilesInBuildGracefulErrorHandler.js.map
|