@hubspot/cli 7.5.2-experimental.0 → 7.5.3-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/api/migrate.d.ts +12 -3
- package/api/migrate.js +9 -2
- package/bin/cli.js +100 -93
- package/commands/account/auth.d.ts +8 -0
- package/commands/account/auth.js +175 -0
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +54 -14
- package/commands/account/createOverride.d.ts +6 -0
- package/commands/account/createOverride.js +121 -0
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +36 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +38 -15
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +49 -9
- package/commands/account/removeOverride.d.ts +6 -0
- package/commands/account/removeOverride.js +93 -0
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +27 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -53
- package/commands/app/migrate.d.ts +5 -6
- package/commands/app/migrate.js +60 -44
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -10
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +37 -33
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -16
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -13
- package/commands/config/migrate.d.ts +6 -0
- package/commands/config/migrate.js +75 -0
- package/commands/config/set.d.ts +10 -1
- package/commands/config/set.js +56 -32
- package/commands/config.d.ts +3 -1
- package/commands/config.js +19 -11
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -75
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -48
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -22
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -48
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -34
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -42
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -11
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +21 -15
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +23 -17
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +24 -16
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +20 -14
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +24 -47
- package/commands/init.d.ts +3 -7
- package/commands/init.js +31 -24
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -44
- package/commands/list.d.ts +3 -7
- package/commands/list.js +21 -16
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -45
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +50 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +75 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -30
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -12
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +20 -15
- package/commands/open.d.ts +3 -7
- package/commands/open.js +20 -15
- package/commands/project/add.d.ts +8 -9
- package/commands/project/add.js +53 -85
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +51 -47
- package/commands/project/create.d.ts +4 -1
- package/commands/project/create.js +132 -81
- package/commands/project/deploy.d.ts +5 -6
- package/commands/project/deploy.js +93 -37
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +41 -26
- package/commands/project/dev/index.d.ts +4 -5
- package/commands/project/dev/index.js +103 -33
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +85 -46
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -30
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +7 -8
- package/commands/project/migrate.js +49 -26
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +10 -1
- package/commands/project/upload.js +94 -56
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +81 -0
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +49 -37
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -20
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +27 -21
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +35 -29
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -44
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +21 -15
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +28 -18
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +19 -13
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +25 -17
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -49
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -16
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -18
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +36 -30
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -48
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -135
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -76
- package/lang/en.d.ts +3218 -0
- package/lang/en.js +3075 -3313
- package/lang/en.lyaml +96 -228
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +11 -0
- package/lib/app/migrate.d.ts +33 -4
- package/lib/app/migrate.js +172 -91
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +12 -11
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +4 -7
- package/lib/commonOpts.js +47 -19
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +83 -0
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -45
- package/lib/constants.d.ts +33 -0
- package/lib/constants.js +34 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +14 -40
- package/lib/doctor/Diagnosis.d.ts +1 -2
- package/lib/doctor/Diagnosis.js +19 -16
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +2 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -9
- package/lib/doctor/Doctor.d.ts +1 -0
- package/lib/doctor/Doctor.js +60 -46
- package/lib/errorHandlers/index.js +13 -7
- package/lib/errorHandlers/suppressError.js +18 -26
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -6
- package/lib/hasFeature.d.ts +3 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +12 -0
- package/lib/mcp/setup.js +216 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +3 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +37 -3
- package/lib/middleware/fireAlarmMiddleware.d.ts +4 -0
- package/lib/middleware/fireAlarmMiddleware.js +125 -0
- package/lib/middleware/yargsChecksMiddleware.js +2 -2
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +46 -42
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +23 -15
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +214 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/projects/localDev/DevServerManagerV2.d.ts +22 -0
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +22 -19
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +57 -83
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +6 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +127 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +17 -2
- package/lib/projects/upload.js +74 -50
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +23 -1
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +20 -4
- package/lib/prompts/createProjectPrompt.js +43 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -25
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -8
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +15 -16
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +4 -2
- package/lib/prompts/promptUtils.js +3 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -9
- package/lib/prompts/setAsDefaultAccountPrompt.js +11 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +4 -2
- package/lib/ui/index.js +20 -17
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +5 -1
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +17 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +100 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +19 -11
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +14 -14
- package/lib/DevServerManagerV2.d.ts +0 -33
- package/lib/LocalDevManagerV2.d.ts +0 -64
- package/lib/LocalDevManagerV2.js +0 -377
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/index.d.ts +0 -21
- package/lib/projects/index.js +0 -194
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -40
|
@@ -9,7 +9,6 @@ const config_1 = require("@hubspot/local-dev-lib/constants/config");
|
|
|
9
9
|
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
10
10
|
const accountTypes_1 = require("../accountTypes");
|
|
11
11
|
const config_2 = require("@hubspot/local-dev-lib/config");
|
|
12
|
-
const i18nKey = 'lib.prompts.sandboxesPrompt';
|
|
13
12
|
function mapSandboxAccountChoices(portals) {
|
|
14
13
|
return (portals
|
|
15
14
|
?.filter(p => (0, accountTypes_1.isSandbox)(p))
|
|
@@ -30,15 +29,15 @@ async function sandboxTypePrompt() {
|
|
|
30
29
|
return (0, promptUtils_1.promptUser)([
|
|
31
30
|
{
|
|
32
31
|
name: 'type',
|
|
33
|
-
message: (0, lang_1.i18n)(
|
|
32
|
+
message: (0, lang_1.i18n)(`lib.prompts.sandboxesPrompt.type.message`),
|
|
34
33
|
type: 'list',
|
|
35
34
|
choices: [
|
|
36
35
|
{
|
|
37
|
-
name: (0, lang_1.i18n)(
|
|
36
|
+
name: (0, lang_1.i18n)(`lib.prompts.sandboxesPrompt.type.developer`),
|
|
38
37
|
value: config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX,
|
|
39
38
|
},
|
|
40
39
|
{
|
|
41
|
-
name: (0, lang_1.i18n)(
|
|
40
|
+
name: (0, lang_1.i18n)(`lib.prompts.sandboxesPrompt.type.standard`),
|
|
42
41
|
value: config_1.HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX,
|
|
43
42
|
},
|
|
44
43
|
],
|
|
@@ -58,8 +57,8 @@ function deleteSandboxPrompt(promptParentAccount = false) {
|
|
|
58
57
|
{
|
|
59
58
|
name: 'account',
|
|
60
59
|
message: (0, lang_1.i18n)(promptParentAccount
|
|
61
|
-
?
|
|
62
|
-
:
|
|
60
|
+
? `lib.prompts.sandboxesPrompt.selectParentAccountName`
|
|
61
|
+
: `lib.prompts.sandboxesPrompt.selectAccountName`),
|
|
63
62
|
type: 'list',
|
|
64
63
|
pageSize: 20,
|
|
65
64
|
choices,
|
|
@@ -5,14 +5,13 @@ exports.secretNamePrompt = secretNamePrompt;
|
|
|
5
5
|
exports.secretListPrompt = secretListPrompt;
|
|
6
6
|
const promptUtils_1 = require("./promptUtils");
|
|
7
7
|
const lang_1 = require("../lang");
|
|
8
|
-
const i18nKey = 'lib.prompts.secretPrompt';
|
|
9
8
|
function secretValuePrompt() {
|
|
10
9
|
return (0, promptUtils_1.promptUser)([
|
|
11
10
|
{
|
|
12
11
|
name: 'secretValue',
|
|
13
12
|
type: 'password',
|
|
14
13
|
mask: '*',
|
|
15
|
-
message: (0, lang_1.i18n)(
|
|
14
|
+
message: (0, lang_1.i18n)(`lib.prompts.secretPrompt.enterValue`),
|
|
16
15
|
},
|
|
17
16
|
]);
|
|
18
17
|
}
|
|
@@ -21,7 +20,7 @@ function secretNamePrompt() {
|
|
|
21
20
|
{
|
|
22
21
|
name: 'secretName',
|
|
23
22
|
type: 'input',
|
|
24
|
-
message: (0, lang_1.i18n)(
|
|
23
|
+
message: (0, lang_1.i18n)(`lib.prompts.secretPrompt.enterName`),
|
|
25
24
|
},
|
|
26
25
|
]);
|
|
27
26
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectAppPrompt = selectAppPrompt;
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
6
|
+
const index_1 = require("../errorHandlers/index");
|
|
7
|
+
const en_1 = require("../../lang/en");
|
|
8
|
+
const promptUtils_1 = require("../prompts/promptUtils");
|
|
9
|
+
async function selectAppPrompt(accountId, appId) {
|
|
10
|
+
let availableApps = [];
|
|
11
|
+
try {
|
|
12
|
+
const appsResponse = await (0, appsDev_1.fetchPublicAppsForPortal)(accountId);
|
|
13
|
+
if (appsResponse.data.results) {
|
|
14
|
+
availableApps = appsResponse.data.results;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
(0, index_1.debugError)(err);
|
|
19
|
+
}
|
|
20
|
+
if (availableApps.length === 0) {
|
|
21
|
+
logger_1.logger.error(en_1.lib.prompts.selectAppPrompt.errors.noApps);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (appId) {
|
|
25
|
+
const targetApp = availableApps.find(app => app.id === appId);
|
|
26
|
+
if (targetApp) {
|
|
27
|
+
return targetApp;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
logger_1.logger.error(en_1.lib.prompts.selectAppPrompt.errors.invalidAppId);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const appPromptValue = await (0, promptUtils_1.listPrompt)(en_1.lib.prompts.selectAppPrompt.selectAppId, {
|
|
34
|
+
choices: availableApps.map(app => ({
|
|
35
|
+
name: `${app.name} (${app.id})`,
|
|
36
|
+
value: app,
|
|
37
|
+
})),
|
|
38
|
+
});
|
|
39
|
+
return appPromptValue;
|
|
40
|
+
}
|
|
@@ -12,19 +12,22 @@ const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
|
12
12
|
const hubdb_1 = require("@hubspot/local-dev-lib/api/hubdb");
|
|
13
13
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
14
14
|
const path_1 = require("@hubspot/local-dev-lib/path");
|
|
15
|
-
const i18nKey = 'lib.prompts.selectHubDBTablePrompt';
|
|
16
15
|
async function fetchHubDBOptions(accountId) {
|
|
17
16
|
try {
|
|
18
17
|
const { data: { results: tables }, } = await (0, hubdb_1.fetchTables)(accountId);
|
|
19
18
|
if (tables.length === 0) {
|
|
20
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
19
|
+
logger_1.logger.log((0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.errors.noTables`, {
|
|
20
|
+
accountId,
|
|
21
|
+
}));
|
|
21
22
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
22
23
|
}
|
|
23
24
|
return tables;
|
|
24
25
|
}
|
|
25
26
|
catch (error) {
|
|
26
27
|
(0, index_1.debugError)(error, { accountId });
|
|
27
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
28
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.errors.errorFetchingTables`, {
|
|
29
|
+
accountId,
|
|
30
|
+
}));
|
|
28
31
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
29
32
|
}
|
|
30
33
|
}
|
|
@@ -35,7 +38,7 @@ async function selectHubDBTablePrompt({ accountId, options, skipDestPrompt = tru
|
|
|
35
38
|
return (0, promptUtils_1.promptUser)([
|
|
36
39
|
{
|
|
37
40
|
name: 'tableId',
|
|
38
|
-
message: (0, lang_1.i18n)(
|
|
41
|
+
message: (0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.selectTable`),
|
|
39
42
|
when: !id && !isValidTable,
|
|
40
43
|
type: 'list',
|
|
41
44
|
choices: hubdbTables.map(table => {
|
|
@@ -47,17 +50,17 @@ async function selectHubDBTablePrompt({ accountId, options, skipDestPrompt = tru
|
|
|
47
50
|
},
|
|
48
51
|
{
|
|
49
52
|
name: 'dest',
|
|
50
|
-
message: (0, lang_1.i18n)(
|
|
53
|
+
message: (0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.enterDest`),
|
|
51
54
|
when: !options.dest && !skipDestPrompt,
|
|
52
55
|
validate: (input) => {
|
|
53
56
|
if (!input) {
|
|
54
|
-
return (0, lang_1.i18n)(
|
|
57
|
+
return (0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.errors.destRequired`);
|
|
55
58
|
}
|
|
56
59
|
if (fs_1.default.existsSync(input)) {
|
|
57
|
-
return (0, lang_1.i18n)(
|
|
60
|
+
return (0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.errors.invalidDest`);
|
|
58
61
|
}
|
|
59
62
|
if (!(0, path_1.isValidPath)(input)) {
|
|
60
|
-
return (0, lang_1.i18n)(
|
|
63
|
+
return (0, lang_1.i18n)(`lib.prompts.selectHubDBTablePrompt.errors.invalidCharacters`);
|
|
61
64
|
}
|
|
62
65
|
return true;
|
|
63
66
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type PublicAppPromptResponse = {
|
|
2
2
|
appId: number;
|
|
3
3
|
};
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function selectPublicAppForMigrationPrompt({ accountId, accountName, isMigratingApp, }: {
|
|
5
5
|
accountId: number | null;
|
|
6
6
|
accountName: string;
|
|
7
7
|
isMigratingApp?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.selectPublicAppForMigrationPrompt = selectPublicAppForMigrationPrompt;
|
|
4
4
|
const promptUtils_1 = require("./promptUtils");
|
|
5
5
|
const lang_1 = require("../lang");
|
|
6
6
|
const ui_1 = require("../ui");
|
|
@@ -8,11 +8,10 @@ const index_1 = require("../errorHandlers/index");
|
|
|
8
8
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
9
|
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
10
10
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
11
|
-
const i18nKey = 'lib.prompts.selectPublicAppPrompt';
|
|
12
11
|
async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = false) {
|
|
13
12
|
try {
|
|
14
13
|
if (!accountId) {
|
|
15
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
14
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.noAccountId`));
|
|
16
15
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
17
16
|
}
|
|
18
17
|
const { data: { results: publicApps }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(accountId);
|
|
@@ -27,8 +26,8 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
27
26
|
? 'noAppsMigrationMessage'
|
|
28
27
|
: 'noAppsCloneMessage';
|
|
29
28
|
(0, ui_1.uiLine)();
|
|
30
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
31
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
29
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.${headerTranslationKey}`));
|
|
30
|
+
logger_1.logger.log((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.${messageTranslationKey}`, { accountName }));
|
|
32
31
|
(0, ui_1.uiLine)();
|
|
33
32
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
34
33
|
}
|
|
@@ -36,11 +35,11 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
36
35
|
}
|
|
37
36
|
catch (error) {
|
|
38
37
|
(0, index_1.logError)(error, accountId ? { accountId } : undefined);
|
|
39
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
38
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.errorFetchingApps`));
|
|
40
39
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
|
-
async function
|
|
42
|
+
async function selectPublicAppForMigrationPrompt({ accountId, accountName, isMigratingApp = false, }) {
|
|
44
43
|
const publicApps = await fetchPublicAppOptions(accountId, accountName, isMigratingApp);
|
|
45
44
|
const translationKey = isMigratingApp
|
|
46
45
|
? 'selectAppIdMigrate'
|
|
@@ -48,7 +47,7 @@ async function selectPublicAppPrompt({ accountId, accountName, isMigratingApp =
|
|
|
48
47
|
return (0, promptUtils_1.promptUser)([
|
|
49
48
|
{
|
|
50
49
|
name: 'appId',
|
|
51
|
-
message: (0, lang_1.i18n)(
|
|
50
|
+
message: (0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.${translationKey}`, {
|
|
52
51
|
accountName,
|
|
53
52
|
}),
|
|
54
53
|
type: 'list',
|
|
@@ -57,7 +56,7 @@ async function selectPublicAppPrompt({ accountId, accountName, isMigratingApp =
|
|
|
57
56
|
if (isMigratingApp && preventProjectMigrations && listingInfo) {
|
|
58
57
|
return {
|
|
59
58
|
name: `${app.name} (${app.id})`,
|
|
60
|
-
disabled: (0, lang_1.i18n)(
|
|
59
|
+
disabled: (0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.cannotBeMigrated`),
|
|
61
60
|
};
|
|
62
61
|
}
|
|
63
62
|
return {
|
|
@@ -4,7 +4,7 @@ exports.setAsDefaultAccountPrompt = setAsDefaultAccountPrompt;
|
|
|
4
4
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
5
|
const promptUtils_1 = require("./promptUtils");
|
|
6
6
|
const lang_1 = require("../lang");
|
|
7
|
-
const
|
|
7
|
+
const logger_1 = require("../ui/logger");
|
|
8
8
|
async function setAsDefaultAccountPrompt(accountName) {
|
|
9
9
|
// Accounts for deprecated and new config
|
|
10
10
|
const defaultAccount = (0, config_1.getConfigDefaultAccount)();
|
|
@@ -13,11 +13,20 @@ async function setAsDefaultAccountPrompt(accountName) {
|
|
|
13
13
|
name: 'setAsDefault',
|
|
14
14
|
type: 'confirm',
|
|
15
15
|
when: defaultAccount !== accountName,
|
|
16
|
-
message: (0, lang_1.i18n)(
|
|
16
|
+
message: (0, lang_1.i18n)(`lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccountMessage`),
|
|
17
17
|
},
|
|
18
18
|
]);
|
|
19
|
+
logger_1.uiLogger.log('');
|
|
19
20
|
if (setAsDefault) {
|
|
20
21
|
(0, config_1.updateDefaultAccount)(accountName);
|
|
22
|
+
logger_1.uiLogger.success((0, lang_1.i18n)('lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccount', {
|
|
23
|
+
accountName,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
logger_1.uiLogger.log((0, lang_1.i18n)('lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault', {
|
|
28
|
+
accountName: (0, config_1.getConfigDefaultAccount)(),
|
|
29
|
+
}));
|
|
21
30
|
}
|
|
22
31
|
return setAsDefault;
|
|
23
32
|
}
|
|
@@ -8,29 +8,28 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const path_2 = require("@hubspot/local-dev-lib/path");
|
|
9
9
|
const promptUtils_1 = require("./promptUtils");
|
|
10
10
|
const lang_1 = require("../lang");
|
|
11
|
-
const i18nKey = 'lib.prompts.uploadPrompt';
|
|
12
11
|
async function uploadPrompt(promptOptions = {}) {
|
|
13
12
|
return (0, promptUtils_1.promptUser)([
|
|
14
13
|
{
|
|
15
14
|
name: 'src',
|
|
16
|
-
message: (0, lang_1.i18n)(
|
|
15
|
+
message: (0, lang_1.i18n)(`lib.prompts.uploadPrompt.enterSrc`),
|
|
17
16
|
when: !promptOptions.src,
|
|
18
17
|
default: '.',
|
|
19
18
|
validate: (input) => {
|
|
20
19
|
if (!input) {
|
|
21
|
-
return (0, lang_1.i18n)(
|
|
20
|
+
return (0, lang_1.i18n)(`lib.prompts.uploadPrompt.errors.srcRequired`);
|
|
22
21
|
}
|
|
23
22
|
return true;
|
|
24
23
|
},
|
|
25
24
|
},
|
|
26
25
|
{
|
|
27
26
|
name: 'dest',
|
|
28
|
-
message: (0, lang_1.i18n)(
|
|
27
|
+
message: (0, lang_1.i18n)(`lib.prompts.uploadPrompt.enterDest`),
|
|
29
28
|
when: !promptOptions.dest,
|
|
30
29
|
default: path_1.default.basename((0, path_2.getCwd)()),
|
|
31
30
|
validate: (input) => {
|
|
32
31
|
if (!input) {
|
|
33
|
-
return (0, lang_1.i18n)(
|
|
32
|
+
return (0, lang_1.i18n)(`lib.prompts.uploadPrompt.errors.destRequired`);
|
|
34
33
|
}
|
|
35
34
|
return true;
|
|
36
35
|
},
|
package/lib/sandboxSync.js
CHANGED
|
@@ -17,7 +17,6 @@ const index_2 = require("./errorHandlers/index");
|
|
|
17
17
|
const sandboxes_2 = require("./sandboxes");
|
|
18
18
|
const ui_1 = require("./ui");
|
|
19
19
|
const accountTypes_1 = require("./accountTypes");
|
|
20
|
-
const i18nKey = 'lib.sandbox.sync';
|
|
21
20
|
async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, slimInfoMessage = false) {
|
|
22
21
|
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(accountConfig);
|
|
23
22
|
const accountId = (0, config_1.getAccountId)(id);
|
|
@@ -25,7 +24,7 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
25
24
|
const parentAccountId = (0, config_1.getAccountId)(parentId);
|
|
26
25
|
const isDevSandbox = (0, accountTypes_1.isDevelopmentSandbox)(accountConfig);
|
|
27
26
|
if (!accountId || !parentAccountId) {
|
|
28
|
-
throw new Error((0, lang_1.i18n)(
|
|
27
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.sync.failure.invalidUser`, {
|
|
29
28
|
accountName: accountId
|
|
30
29
|
? (0, ui_1.uiAccountDescription)(accountId)
|
|
31
30
|
: id.toString(),
|
|
@@ -48,23 +47,25 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
48
47
|
availableSyncTasks = await (0, sandboxes_1.getAvailableSyncTypes)(parentAccountConfig, accountConfig);
|
|
49
48
|
}
|
|
50
49
|
SpinniesManager_1.default.add('sandboxSync', {
|
|
51
|
-
text: (0, lang_1.i18n)(
|
|
50
|
+
text: (0, lang_1.i18n)(`lib.sandbox.sync.loading.startSync`),
|
|
52
51
|
});
|
|
53
52
|
await (0, sandboxSync_1.initiateSync)(parentAccountId, accountId, availableSyncTasks, accountId);
|
|
54
53
|
const spinniesText = isDevSandbox
|
|
55
|
-
?
|
|
56
|
-
:
|
|
54
|
+
? `lib.sandbox.sync.loading.succeedDevSb`
|
|
55
|
+
: `lib.sandbox.sync.loading.succeed`;
|
|
57
56
|
SpinniesManager_1.default.succeed('sandboxSync', {
|
|
58
|
-
text: (0, lang_1.i18n)(slimInfoMessage
|
|
57
|
+
text: (0, lang_1.i18n)(slimInfoMessage
|
|
58
|
+
? `lib.sandbox.sync.loading.successDevSbInfo`
|
|
59
|
+
: spinniesText, {
|
|
59
60
|
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
60
|
-
url: (0, ui_1.uiLink)((0, lang_1.i18n)(
|
|
61
|
+
url: (0, ui_1.uiLink)((0, lang_1.i18n)(`lib.sandbox.sync.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
61
62
|
}),
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
catch (err) {
|
|
65
66
|
(0, index_2.debugError)(err);
|
|
66
67
|
SpinniesManager_1.default.fail('sandboxSync', {
|
|
67
|
-
text: (0, lang_1.i18n)(
|
|
68
|
+
text: (0, lang_1.i18n)(`lib.sandbox.sync.loading.fail`),
|
|
68
69
|
});
|
|
69
70
|
logger_1.logger.log('');
|
|
70
71
|
if ((0, index_1.isSpecifiedError)(err, {
|
|
@@ -72,7 +73,7 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
72
73
|
category: 'BANNED',
|
|
73
74
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USER',
|
|
74
75
|
})) {
|
|
75
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
76
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.sync.failure.invalidUser`, {
|
|
76
77
|
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
77
78
|
parentAccountName: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
78
79
|
}));
|
|
@@ -82,7 +83,7 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
82
83
|
category: 'RATE_LIMITS',
|
|
83
84
|
subCategory: 'sandboxes-sync-api.SYNC_IN_PROGRESS',
|
|
84
85
|
})) {
|
|
85
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
86
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.sync.failure.syncInProgress`, {
|
|
86
87
|
url: `${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`,
|
|
87
88
|
}));
|
|
88
89
|
}
|
|
@@ -92,7 +93,7 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
92
93
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USERID',
|
|
93
94
|
})) {
|
|
94
95
|
// This will only trigger if a user is not a super admin of the target account.
|
|
95
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
96
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.sync.failure.notSuperAdmin`, {
|
|
96
97
|
account: (0, ui_1.uiAccountDescription)(accountId),
|
|
97
98
|
}));
|
|
98
99
|
}
|
|
@@ -101,7 +102,7 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
101
102
|
category: 'OBJECT_NOT_FOUND',
|
|
102
103
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
103
104
|
})) {
|
|
104
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
105
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.sync.failure.objectNotFound`, {
|
|
105
106
|
account: (0, ui_1.uiAccountDescription)(accountId),
|
|
106
107
|
}));
|
|
107
108
|
}
|
|
@@ -122,8 +123,8 @@ async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, s
|
|
|
122
123
|
if (!slimInfoMessage) {
|
|
123
124
|
logger_1.logger.log();
|
|
124
125
|
(0, ui_1.uiLine)();
|
|
125
|
-
logger_1.logger.info((0, lang_1.i18n)(
|
|
126
|
-
url: (0, ui_1.uiLink)((0, lang_1.i18n)(
|
|
126
|
+
logger_1.logger.info((0, lang_1.i18n)(`lib.sandbox.sync.info.${isDevSandbox ? 'syncMessageDevSb' : 'syncMessage'}`, {
|
|
127
|
+
url: (0, ui_1.uiLink)((0, lang_1.i18n)(`lib.sandbox.sync.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
127
128
|
}));
|
|
128
129
|
(0, ui_1.uiLine)();
|
|
129
130
|
logger_1.logger.log();
|
package/lib/sandboxes.js
CHANGED
|
@@ -17,7 +17,6 @@ const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
|
17
17
|
const lang_1 = require("./lang");
|
|
18
18
|
const ui_1 = require("./ui");
|
|
19
19
|
const index_2 = require("./errorHandlers/index");
|
|
20
|
-
const i18nKey = 'lib.sandbox';
|
|
21
20
|
exports.SYNC_TYPES = {
|
|
22
21
|
OBJECT_RECORDS: 'object-records',
|
|
23
22
|
};
|
|
@@ -59,11 +58,11 @@ async function getAvailableSyncTypes(parentAccountConfig, config) {
|
|
|
59
58
|
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(config);
|
|
60
59
|
const portalId = (0, config_1.getAccountId)(id);
|
|
61
60
|
if (!parentPortalId || !portalId) {
|
|
62
|
-
throw new Error((0, lang_1.i18n)(
|
|
61
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.sync.failure.syncTypeFetch`));
|
|
63
62
|
}
|
|
64
63
|
const { data: { results: syncTypes }, } = await (0, sandboxSync_1.fetchTypes)(parentPortalId, portalId);
|
|
65
64
|
if (!syncTypes) {
|
|
66
|
-
throw new Error((0, lang_1.i18n)(
|
|
65
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.sync.failure.syncTypeFetch`));
|
|
67
66
|
}
|
|
68
67
|
return syncTypes.map(t => ({ type: t.name }));
|
|
69
68
|
}
|
|
@@ -71,11 +70,11 @@ async function validateSandboxUsageLimits(accountConfig, sandboxType, env) {
|
|
|
71
70
|
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(accountConfig);
|
|
72
71
|
const accountId = (0, config_1.getAccountId)(id);
|
|
73
72
|
if (!accountId) {
|
|
74
|
-
throw new Error((0, lang_1.i18n)(
|
|
73
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.create.failure.usageLimitFetch`));
|
|
75
74
|
}
|
|
76
75
|
const { data: { usage }, } = await (0, sandboxHubs_1.getSandboxUsageLimits)(accountId);
|
|
77
76
|
if (!usage) {
|
|
78
|
-
throw new Error((0, lang_1.i18n)(
|
|
77
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.create.failure.usageLimitFetch`));
|
|
79
78
|
}
|
|
80
79
|
if (sandboxType === config_2.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
81
80
|
if (usage['DEVELOPER'].available === 0) {
|
|
@@ -83,14 +82,14 @@ async function validateSandboxUsageLimits(accountConfig, sandboxType, env) {
|
|
|
83
82
|
const plural = devSandboxLimit !== 1;
|
|
84
83
|
const hasDevelopmentSandboxes = getHasSandboxesByType(accountConfig, config_2.HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX);
|
|
85
84
|
if (hasDevelopmentSandboxes) {
|
|
86
|
-
throw new Error((0, lang_1.i18n)(
|
|
85
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.create.failure.alreadyInConfig.developer.${plural ? 'other' : 'one'}`, {
|
|
87
86
|
accountName: accountConfig.name || accountId,
|
|
88
87
|
limit: devSandboxLimit,
|
|
89
88
|
}));
|
|
90
89
|
}
|
|
91
90
|
else {
|
|
92
91
|
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
93
|
-
throw new Error((0, lang_1.i18n)(
|
|
92
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.create.failure.limit.developer.${plural ? 'other' : 'one'}`, {
|
|
94
93
|
accountName: accountConfig.name || accountId,
|
|
95
94
|
limit: devSandboxLimit,
|
|
96
95
|
link: `${baseUrl}/sandboxes-developer/${accountId}/development`,
|
|
@@ -104,14 +103,14 @@ async function validateSandboxUsageLimits(accountConfig, sandboxType, env) {
|
|
|
104
103
|
const plural = standardSandboxLimit !== 1;
|
|
105
104
|
const hasStandardSandboxes = getHasSandboxesByType(accountConfig, config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX);
|
|
106
105
|
if (hasStandardSandboxes) {
|
|
107
|
-
throw new Error((0, lang_1.i18n)(
|
|
106
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.create.failure.alreadyInConfig.standard.${plural ? 'other' : 'one'}`, {
|
|
108
107
|
accountName: accountConfig.name || accountId,
|
|
109
108
|
limit: standardSandboxLimit,
|
|
110
109
|
}));
|
|
111
110
|
}
|
|
112
111
|
else {
|
|
113
112
|
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
114
|
-
throw new Error((0, lang_1.i18n)(
|
|
113
|
+
throw new Error((0, lang_1.i18n)(`lib.sandbox.create.failure.limit.standard.${plural ? 'other' : 'one'}`, {
|
|
115
114
|
accountName: accountConfig.name || accountId,
|
|
116
115
|
limit: standardSandboxLimit,
|
|
117
116
|
link: `${baseUrl}/sandboxes-developer/${accountId}/standard`,
|
|
@@ -122,12 +121,12 @@ async function validateSandboxUsageLimits(accountConfig, sandboxType, env) {
|
|
|
122
121
|
}
|
|
123
122
|
function handleSandboxCreateError(err, env, name, accountId) {
|
|
124
123
|
if ((0, index_1.isMissingScopeError)(err)) {
|
|
125
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
124
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.create.failure.scopes.message`, {
|
|
126
125
|
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
127
126
|
}));
|
|
128
127
|
const websiteOrigin = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
129
128
|
const url = `${websiteOrigin}/personal-access-key/${accountId}`;
|
|
130
|
-
logger_1.logger.info((0, lang_1.i18n)(
|
|
129
|
+
logger_1.logger.info((0, lang_1.i18n)(`lib.sandbox.create.failure.scopes.instructions`, {
|
|
131
130
|
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
132
131
|
url,
|
|
133
132
|
}));
|
|
@@ -138,7 +137,7 @@ function handleSandboxCreateError(err, env, name, accountId) {
|
|
|
138
137
|
subCategory: 'SandboxErrors.USER_ACCESS_NOT_ALLOWED',
|
|
139
138
|
})) {
|
|
140
139
|
logger_1.logger.log('');
|
|
141
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
140
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.create.failure.invalidUser`, {
|
|
142
141
|
accountName: name,
|
|
143
142
|
parentAccountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
144
143
|
}));
|
|
@@ -150,7 +149,7 @@ function handleSandboxCreateError(err, env, name, accountId) {
|
|
|
150
149
|
subCategory: 'SandboxErrors.DEVELOPMENT_SANDBOX_ACCESS_NOT_ALLOWED',
|
|
151
150
|
})) {
|
|
152
151
|
logger_1.logger.log('');
|
|
153
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
152
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.sandbox.create.failure.403Gating`, {
|
|
154
153
|
accountName: name,
|
|
155
154
|
parentAccountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
156
155
|
accountId,
|
package/lib/serverlessLogs.js
CHANGED
|
@@ -44,8 +44,6 @@ async function verifyAccessKeyAndUserAccess(accountId, scopeGroup) {
|
|
|
44
44
|
if (!accountConfig) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
// TODO[JOE]: Update this i18n key
|
|
48
|
-
const i18nKey = 'lib.serverless';
|
|
49
47
|
const { authType } = accountConfig;
|
|
50
48
|
if (authType !== auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value) {
|
|
51
49
|
return;
|
|
@@ -56,7 +54,7 @@ async function verifyAccessKeyAndUserAccess(accountId, scopeGroup) {
|
|
|
56
54
|
scopesData = resp.data;
|
|
57
55
|
}
|
|
58
56
|
catch (e) {
|
|
59
|
-
logger_1.logger.debug((0, lang_1.i18n)(
|
|
57
|
+
logger_1.logger.debug((0, lang_1.i18n)(`lib.serverless.verifyAccessKeyAndUserAccess.fetchScopeDataError`, {
|
|
60
58
|
scopeGroup,
|
|
61
59
|
}));
|
|
62
60
|
logger_1.logger.debug(e);
|
|
@@ -64,14 +62,14 @@ async function verifyAccessKeyAndUserAccess(accountId, scopeGroup) {
|
|
|
64
62
|
}
|
|
65
63
|
const { portalScopesInGroup, userScopesInGroup } = scopesData;
|
|
66
64
|
if (!portalScopesInGroup.length) {
|
|
67
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
65
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.serverless.verifyAccessKeyAndUserAccess.portalMissingScope`));
|
|
68
66
|
return;
|
|
69
67
|
}
|
|
70
68
|
if (!portalScopesInGroup.every(s => userScopesInGroup.includes(s))) {
|
|
71
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
69
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.serverless.verifyAccessKeyAndUserAccess.userMissingScope`));
|
|
72
70
|
}
|
|
73
71
|
else {
|
|
74
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
72
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.serverless.verifyAccessKeyAndUserAccess.genericMissingScope`));
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
async function tailLogs(accountId, name, fetchLatest, tailCall, compact = false) {
|
package/lib/testUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
|
|
2
2
|
import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
|
|
3
3
|
type MockErrorResponse = {
|
|
4
4
|
status: number;
|
|
@@ -9,6 +9,6 @@ type MockErrorResponse = {
|
|
|
9
9
|
subCategory?: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare
|
|
13
|
-
export declare
|
|
12
|
+
export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
|
|
13
|
+
export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
|
|
14
14
|
export {};
|
package/lib/testUtils.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mockHubSpotHttpResponse = mockHubSpotHttpResponse;
|
|
4
|
+
exports.mockHubSpotHttpError = mockHubSpotHttpError;
|
|
4
5
|
const axios_1 = require("axios");
|
|
5
6
|
const HubSpotHttpError_1 = require("@hubspot/local-dev-lib/models/HubSpotHttpError");
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
-
|
|
8
|
-
return {
|
|
8
|
+
function mockHubSpotHttpResponse(data) {
|
|
9
|
+
return Promise.resolve({
|
|
9
10
|
data,
|
|
10
11
|
status: 200,
|
|
11
12
|
statusText: 'OK',
|
|
@@ -13,12 +14,10 @@ const mockHubSpotHttpResponse = (data) => {
|
|
|
13
14
|
config: {
|
|
14
15
|
headers: new axios_1.AxiosHeaders(),
|
|
15
16
|
},
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const mockHubSpotHttpError = (message, response) => {
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function mockHubSpotHttpError(message, response) {
|
|
20
20
|
return new HubSpotHttpError_1.HubSpotHttpError(message, {
|
|
21
21
|
cause: { isAxiosError: true, response },
|
|
22
22
|
});
|
|
23
|
-
}
|
|
24
|
-
exports.mockHubSpotHttpError = mockHubSpotHttpError;
|
|
23
|
+
}
|
package/lib/ui/boxen.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logInBox = logInBox;
|
|
4
|
+
const logger_1 = require("./logger");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const logger_2 = require("@hubspot/local-dev-lib/logger");
|
|
7
|
+
const en_1 = require("../../lang/en");
|
|
8
|
+
const defaultOptions = {
|
|
9
|
+
titleAlignment: 'left',
|
|
10
|
+
borderColor: index_1.UI_COLORS.MARIGOLD,
|
|
11
|
+
margin: 1,
|
|
12
|
+
padding: 1,
|
|
13
|
+
textAlignment: 'left',
|
|
14
|
+
borderStyle: 'round',
|
|
15
|
+
};
|
|
16
|
+
async function logInBox({ contents, options, }) {
|
|
17
|
+
try {
|
|
18
|
+
const boxen = (await import('boxen')).default;
|
|
19
|
+
logger_1.uiLogger.log(boxen(contents, { ...defaultOptions, ...options }));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger_2.logger.debug(en_1.lib.boxen.failedToLoad);
|
|
24
|
+
if (options?.title) {
|
|
25
|
+
logger_1.uiLogger.log(options.title);
|
|
26
|
+
logger_1.uiLogger.log('');
|
|
27
|
+
}
|
|
28
|
+
logger_1.uiLogger.log(contents);
|
|
29
|
+
}
|
|
30
|
+
}
|