@hubspot/cli 7.8.12-experimental.0 → 7.9.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/cms.test.js +44 -1
- package/commands/__tests__/customObject.test.js +22 -1
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/__tests__/project.test.js +2 -0
- package/commands/account/auth.js +1 -0
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/app.js +1 -6
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +17 -7
- package/commands/{__tests__/remove.test.js → cms/__tests__/delete.test.js} +8 -8
- package/commands/{__tests__ → cms/__tests__}/fetch.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/function.test.js +7 -3
- package/commands/{__tests__ → cms/__tests__}/lint.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/list.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/mv.test.js +3 -3
- package/commands/{__tests__ → cms/__tests__}/theme.test.js +9 -2
- package/commands/cms/app/create.d.ts +9 -0
- package/commands/cms/app/create.js +82 -0
- package/commands/cms/app.d.ts +3 -0
- package/commands/cms/app.js +17 -0
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/delete.d.ts +6 -0
- package/commands/cms/delete.js +43 -0
- package/commands/cms/fetch.d.ts +12 -0
- package/commands/cms/fetch.js +79 -0
- package/commands/{__tests__ → cms/function/__tests__}/logs.test.js +4 -5
- package/commands/cms/function/create.d.ts +12 -0
- package/commands/cms/function/create.js +84 -0
- package/commands/cms/function/deploy.d.ts +6 -0
- package/commands/cms/function/deploy.js +89 -0
- package/commands/cms/function/list.d.ts +6 -0
- package/commands/cms/function/list.js +60 -0
- package/commands/cms/function/logs.d.ts +10 -0
- package/commands/cms/function/logs.js +135 -0
- package/commands/cms/function/server.d.ts +10 -0
- package/commands/cms/function/server.js +69 -0
- package/commands/cms/function.d.ts +3 -0
- package/commands/cms/function.js +27 -0
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms/lint.d.ts +6 -0
- package/commands/cms/lint.js +83 -0
- package/commands/cms/list.d.ts +6 -0
- package/commands/cms/list.js +96 -0
- package/commands/cms/module/create.d.ts +11 -0
- package/commands/cms/module/create.js +84 -0
- package/commands/cms/module/marketplace-validate.d.ts +6 -0
- package/commands/cms/module/marketplace-validate.js +45 -0
- package/commands/cms/module.d.ts +3 -0
- package/commands/cms/module.js +17 -0
- package/commands/cms/mv.d.ts +7 -0
- package/commands/cms/mv.js +60 -0
- package/commands/cms/template/create.d.ts +9 -0
- package/commands/cms/template/create.js +72 -0
- package/commands/cms/template.d.ts +3 -0
- package/commands/cms/template.js +17 -0
- package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.js +2 -2
- package/commands/{theme → cms/theme}/__tests__/preview.test.js +2 -2
- package/commands/cms/theme/create.d.ts +6 -0
- package/commands/cms/theme/create.js +58 -0
- package/commands/cms/theme/generate-selectors.d.ts +6 -0
- package/commands/cms/theme/generate-selectors.js +171 -0
- package/commands/cms/theme/marketplace-validate.d.ts +6 -0
- package/commands/cms/theme/marketplace-validate.js +46 -0
- package/commands/cms/theme/preview.d.ts +12 -0
- package/commands/cms/theme/preview.js +224 -0
- package/commands/cms/theme.d.ts +3 -0
- package/commands/cms/theme.js +25 -0
- package/commands/cms/upload.d.ts +12 -0
- package/commands/cms/upload.js +212 -0
- package/commands/cms/watch.d.ts +14 -0
- package/commands/cms/watch.js +138 -0
- package/commands/cms/webpack/create.d.ts +6 -0
- package/commands/cms/webpack/create.js +58 -0
- package/commands/cms/webpack.d.ts +3 -0
- package/commands/cms/webpack.js +17 -0
- package/commands/cms.js +28 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +6 -4
- package/commands/customObject/{schema/__tests__/create.test.js → __tests__/createSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/delete.test.js → __tests__/deleteSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch-all.test.js → __tests__/fetch-all-schemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/fetch.test.js → __tests__/fetchSchema.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/list.test.js → __tests__/listSchemas.test.js} +5 -5
- package/commands/customObject/{schema/__tests__/update.test.js → __tests__/updateSchema.test.js} +5 -5
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/createSchema.d.ts +6 -0
- package/commands/customObject/createSchema.js +56 -0
- package/commands/customObject/deleteSchema.d.ts +7 -0
- package/commands/customObject/deleteSchema.js +69 -0
- package/commands/customObject/fetchAllSchemas.d.ts +6 -0
- package/commands/customObject/fetchAllSchemas.js +57 -0
- package/commands/customObject/fetchSchema.d.ts +7 -0
- package/commands/customObject/fetchSchema.js +67 -0
- package/commands/customObject/listSchemas.d.ts +4 -0
- package/commands/customObject/listSchemas.js +35 -0
- package/commands/customObject/schema/create.d.ts +4 -6
- package/commands/customObject/schema/create.js +13 -38
- package/commands/customObject/schema/delete.d.ts +4 -7
- package/commands/customObject/schema/delete.js +15 -50
- package/commands/customObject/schema/fetch-all.d.ts +4 -6
- package/commands/customObject/schema/fetch-all.js +14 -40
- package/commands/customObject/schema/fetch.d.ts +4 -7
- package/commands/customObject/schema/fetch.js +14 -49
- package/commands/customObject/schema/list.d.ts +4 -4
- package/commands/customObject/schema/list.js +10 -19
- package/commands/customObject/schema/update.d.ts +4 -7
- package/commands/customObject/schema/update.js +15 -50
- package/commands/customObject/schema.js +5 -3
- package/commands/customObject/updateSchema.d.ts +7 -0
- package/commands/customObject/updateSchema.js +71 -0
- package/commands/customObject.js +22 -8
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +7 -12
- package/commands/fetch.d.ts +4 -12
- package/commands/fetch.js +20 -47
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.d.ts +4 -6
- package/commands/function/deploy.js +14 -89
- package/commands/function/list.d.ts +4 -6
- package/commands/function/list.js +14 -40
- package/commands/function/server.d.ts +4 -10
- package/commands/function/server.js +22 -31
- package/commands/function.d.ts +2 -4
- package/commands/function.js +25 -14
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.d.ts +4 -6
- package/commands/lint.js +13 -65
- package/commands/list.d.ts +4 -6
- package/commands/list.js +14 -81
- package/commands/logs.d.ts +4 -10
- package/commands/logs.js +25 -94
- package/commands/module/marketplace-validate.d.ts +4 -6
- package/commands/module/marketplace-validate.js +15 -27
- package/commands/module.d.ts +2 -2
- package/commands/module.js +17 -15
- package/commands/mv.d.ts +4 -7
- package/commands/mv.js +14 -51
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +15 -13
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/devUnifiedFlow.test.js +32 -0
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +6 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +6 -5
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +1 -2
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +9 -18
- package/commands/project/dev/index.js +19 -17
- package/commands/project/dev/unifiedFlow.js +11 -4
- package/commands/project/download.js +15 -15
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +9 -8
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +5 -2
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.d.ts +2 -2
- package/commands/project/upload.js +17 -26
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +4 -6
- package/commands/remove.js +12 -24
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/create.js +2 -5
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/generate-selectors.d.ts +4 -6
- package/commands/theme/generate-selectors.js +14 -152
- package/commands/theme/marketplace-validate.d.ts +4 -6
- package/commands/theme/marketplace-validate.js +14 -25
- package/commands/theme/preview.d.ts +4 -12
- package/commands/theme/preview.js +18 -183
- package/commands/theme.d.ts +2 -2
- package/commands/theme.js +19 -13
- package/commands/upload.d.ts +4 -12
- package/commands/upload.js +19 -169
- package/commands/watch.d.ts +4 -14
- package/commands/watch.js +23 -88
- package/lang/en.d.ts +863 -542
- package/lang/en.js +912 -595
- package/lang/en.lyaml +4 -4
- package/lib/__tests__/buildAccount.test.js +4 -3
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +32 -64
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configMigrate.js +88 -9
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +15 -1
- package/lib/constants.js +19 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/generateSelectors.js +1 -1
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/autoUpdateMiddleware.d.ts +2 -1
- package/lib/middleware/autoUpdateMiddleware.js +12 -2
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +74 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projectProfiles.d.ts +1 -1
- package/lib/projectProfiles.js +2 -10
- package/lib/projects/__tests__/AppDevModeInterface.test.js +101 -135
- package/lib/projects/__tests__/DevServerManager.test.js +183 -0
- package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +76 -45
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.d.ts +1 -0
- package/lib/projects/__tests__/UIExtensionsDevModeInterface.test.js +161 -0
- package/lib/projects/__tests__/deploy.test.js +9 -9
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v2AddComponent.test.d.ts +1 -0
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +39 -39
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +3 -3
- package/lib/projects/create/index.js +4 -4
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +5 -5
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +11 -3
- package/lib/projects/localDev/AppDevModeInterface.js +128 -115
- package/lib/projects/localDev/DevServerManager.d.ts +10 -29
- package/lib/projects/localDev/DevServerManager.js +20 -76
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +10 -11
- package/lib/projects/localDev/LocalDevProcess.js +3 -2
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +46 -16
- package/lib/projects/localDev/UIExtensionsDevModeInterface.d.ts +13 -0
- package/lib/projects/localDev/UIExtensionsDevModeInterface.js +37 -0
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/process.d.ts +1 -0
- package/lib/projects/localDev/helpers/process.js +15 -0
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +39 -3
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.d.ts +2 -2
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +2 -3
- package/lib/projects/upload.js +17 -9
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +7 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +6 -6
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +6 -0
- package/lib/ui/index.js +55 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +73 -0
- package/lib/ui/uiMessages.js +76 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +8 -7
- package/types/Cms.d.ts +6 -6
- package/types/Yargs.d.ts +1 -1
- package/commands/app/__tests__/install.test.js +0 -47
- package/commands/app/install.d.ts +0 -8
- package/commands/app/install.js +0 -122
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- /package/commands/{customObject/schema → cms}/__tests__/delete.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/fetch.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/function.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/lint.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/list.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/mv.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/__tests__}/theme.test.d.ts +0 -0
- /package/commands/{__tests__ → cms/function/__tests__}/logs.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/generate-selectors.test.js +0 -0
- /package/commands/{theme → cms/theme}/__tests__/marketplace-validate.test.d.ts +0 -0
- /package/commands/{theme → cms/theme}/__tests__/preview.test.d.ts +0 -0
- /package/commands/{__tests__/remove.test.d.ts → customObject/__tests__/createSchema.test.d.ts} +0 -0
- /package/commands/{app/__tests__/install.test.d.ts → customObject/__tests__/deleteSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/create.test.d.ts → __tests__/fetch-all-schemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch-all.test.d.ts → __tests__/fetchSchema.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/fetch.test.d.ts → __tests__/listSchemas.test.d.ts} +0 -0
- /package/commands/customObject/{schema/__tests__/list.test.d.ts → __tests__/updateSchema.test.d.ts} +0 -0
- /package/commands/{customObject/schema/__tests__/update.test.d.ts → project/__tests__/list.test.d.ts} +0 -0
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/api-sample.js +0 -0
- /package/{commands/create → lib/cmsAssets}/app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/function.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/function.js +0 -0
- /package/{commands/create → lib/cmsAssets}/index.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/index.js +0 -0
- /package/{commands/create → lib/cmsAssets}/module.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/module.js +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/react-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/template.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/template.js +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/vue-app.js +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/webpack-serverless.js +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.d.ts +0 -0
- /package/{commands/create → lib/cmsAssets}/website-theme.js +0 -0
- /package/lib/{projects/add/__tests__/v3AddComponent.test.d.ts → middleware/__test__/commandTargetingUtils.test.d.ts} +0 -0
- /package/lib/projects/{create/__tests__/v3.test.d.ts → __tests__/DevServerManager.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
2
2
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
3
3
|
import { deleteSandbox } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
4
4
|
import { getEnv, removeSandboxAccountFromConfig, updateDefaultAccount, getAccountId, getConfigAccounts, } from '@hubspot/local-dev-lib/config';
|
|
@@ -7,15 +7,15 @@ import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
|
7
7
|
import { getValidEnv } from '@hubspot/local-dev-lib/environment';
|
|
8
8
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
9
9
|
import { logError, debugError } from '../../lib/errorHandlers/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { commands } from '../../lang/en.js';
|
|
11
11
|
import { deleteSandboxPrompt } from '../../lib/prompts/sandboxesPrompt.js';
|
|
12
12
|
import { selectAccountFromConfig } from '../../lib/prompts/accountsPrompt.js';
|
|
13
13
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
14
14
|
import { promptUser } from '../../lib/prompts/promptUtils.js';
|
|
15
|
-
import {
|
|
15
|
+
import { uiAuthCommandReference, uiBetaTag } from '../../lib/ui/index.js';
|
|
16
16
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
17
17
|
const command = 'delete';
|
|
18
|
-
const describe = uiBetaTag(
|
|
18
|
+
const describe = uiBetaTag(commands.sandbox.subcommands.delete.describe, false);
|
|
19
19
|
async function handler(args) {
|
|
20
20
|
const { userProvidedAccount, derivedAccountId, force } = args;
|
|
21
21
|
trackCommandUsage('sandbox-delete', {}, derivedAccountId);
|
|
@@ -26,21 +26,19 @@ async function handler(args) {
|
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
// Account is required, throw error if force flag is present and no account is specified
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
uiLogger.log('');
|
|
30
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.noAccount);
|
|
31
31
|
process.exit(EXIT_CODES.ERROR);
|
|
32
32
|
}
|
|
33
33
|
if (!accountPrompt) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
authCommand: uiCommandReference('hs auth'),
|
|
37
|
-
}));
|
|
34
|
+
uiLogger.log('');
|
|
35
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.noSandboxAccounts);
|
|
38
36
|
process.exit(EXIT_CODES.ERROR);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
39
|
const sandboxAccountId = getAccountId(userProvidedAccount || accountPrompt.account);
|
|
42
40
|
if (!sandboxAccountId) {
|
|
43
|
-
|
|
41
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.noSandboxAccountId);
|
|
44
42
|
process.exit(EXIT_CODES.ERROR);
|
|
45
43
|
}
|
|
46
44
|
const isDefaultAccount = sandboxAccountId === getAccountId();
|
|
@@ -55,41 +53,32 @@ async function handler(args) {
|
|
|
55
53
|
else if (!force) {
|
|
56
54
|
const parentAccountPrompt = await deleteSandboxPrompt(true);
|
|
57
55
|
if (!parentAccountPrompt) {
|
|
58
|
-
|
|
59
|
-
authCommand: uiCommandReference('hs auth'),
|
|
60
|
-
}));
|
|
56
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentAccount);
|
|
61
57
|
process.exit(EXIT_CODES.ERROR);
|
|
62
58
|
}
|
|
63
59
|
parentAccountId = getAccountId(parentAccountPrompt.account);
|
|
64
60
|
}
|
|
65
61
|
else {
|
|
66
|
-
|
|
67
|
-
authCommand: uiCommandReference('hs auth'),
|
|
68
|
-
}));
|
|
62
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentAccount);
|
|
69
63
|
process.exit(EXIT_CODES.ERROR);
|
|
70
64
|
}
|
|
71
65
|
}
|
|
72
66
|
}
|
|
73
67
|
const url = `${baseUrl}/sandboxes/${parentAccountId}`;
|
|
74
|
-
const command =
|
|
68
|
+
const command = uiAuthCommandReference({
|
|
69
|
+
accountId: parentAccountId || undefined,
|
|
70
|
+
qa: getEnv(sandboxAccountId) === 'qa',
|
|
71
|
+
});
|
|
75
72
|
if (parentAccountId && !getAccountId(parentAccountId)) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
url,
|
|
80
|
-
command,
|
|
81
|
-
}));
|
|
82
|
-
logger.log('');
|
|
73
|
+
uiLogger.log('');
|
|
74
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.noParentPortalAvailable(command, url));
|
|
75
|
+
uiLogger.log('');
|
|
83
76
|
process.exit(EXIT_CODES.ERROR);
|
|
84
77
|
}
|
|
85
|
-
|
|
86
|
-
account: uiAccountDescription(sandboxAccountId),
|
|
87
|
-
}));
|
|
78
|
+
uiLogger.debug(commands.sandbox.subcommands.delete.debug.deleting(sandboxAccountId));
|
|
88
79
|
if (isDefaultAccount) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}));
|
|
92
|
-
logger.log('');
|
|
80
|
+
uiLogger.info(commands.sandbox.subcommands.delete.defaultAccountWarning(sandboxAccountId));
|
|
81
|
+
uiLogger.log('');
|
|
93
82
|
}
|
|
94
83
|
try {
|
|
95
84
|
if (!force) {
|
|
@@ -97,9 +86,7 @@ async function handler(args) {
|
|
|
97
86
|
{
|
|
98
87
|
name: 'confirmSandboxDeletePrompt',
|
|
99
88
|
type: 'confirm',
|
|
100
|
-
message:
|
|
101
|
-
account: uiAccountDescription(sandboxAccountId),
|
|
102
|
-
}),
|
|
89
|
+
message: commands.sandbox.subcommands.delete.confirm(sandboxAccountId),
|
|
103
90
|
},
|
|
104
91
|
]);
|
|
105
92
|
if (!confirmed) {
|
|
@@ -107,15 +94,11 @@ async function handler(args) {
|
|
|
107
94
|
}
|
|
108
95
|
}
|
|
109
96
|
await deleteSandbox(parentAccountId, sandboxAccountId);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
account: userProvidedAccount || accountPrompt.account,
|
|
116
|
-
sandboxHubId: sandboxAccountId || '',
|
|
117
|
-
}));
|
|
118
|
-
logger.log('');
|
|
97
|
+
uiLogger.log('');
|
|
98
|
+
uiLogger.success(isDefaultAccount
|
|
99
|
+
? commands.sandbox.subcommands.delete.success.deleteDefault(userProvidedAccount || accountPrompt.account, sandboxAccountId)
|
|
100
|
+
: commands.sandbox.subcommands.delete.success.delete(userProvidedAccount || accountPrompt.account, sandboxAccountId));
|
|
101
|
+
uiLogger.log('');
|
|
119
102
|
const promptDefaultAccount = removeSandboxAccountFromConfig(sandboxAccountId);
|
|
120
103
|
if (promptDefaultAccount && !force) {
|
|
121
104
|
const newDefaultAccount = await selectAccountFromConfig();
|
|
@@ -132,34 +115,26 @@ async function handler(args) {
|
|
|
132
115
|
if (isSpecifiedError(err, { statusCode: 401 })) {
|
|
133
116
|
// Intercept invalid key error
|
|
134
117
|
// This command uses the parent portal PAK to delete a sandbox, so we must specify which account needs a new key
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
account: uiAccountDescription(parentAccountId),
|
|
138
|
-
authCommand: uiCommandReference('hs auth'),
|
|
139
|
-
}));
|
|
118
|
+
uiLogger.log('');
|
|
119
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.invalidKey(parentAccountId));
|
|
140
120
|
}
|
|
141
121
|
else if (isSpecifiedError(err, {
|
|
142
122
|
statusCode: 403,
|
|
143
123
|
category: 'BANNED',
|
|
144
124
|
subCategory: 'SandboxErrors.USER_ACCESS_NOT_ALLOWED',
|
|
145
125
|
})) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
parentAccountName: uiAccountDescription(parentAccountId),
|
|
150
|
-
}));
|
|
151
|
-
logger.log('');
|
|
126
|
+
uiLogger.log('');
|
|
127
|
+
uiLogger.error(commands.sandbox.subcommands.delete.failure.invalidUser(sandboxAccountId, parentAccountId));
|
|
128
|
+
uiLogger.log('');
|
|
152
129
|
}
|
|
153
130
|
else if (isSpecifiedError(err, {
|
|
154
131
|
statusCode: 404,
|
|
155
132
|
category: 'OBJECT_NOT_FOUND',
|
|
156
133
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
157
134
|
})) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}));
|
|
162
|
-
logger.log('');
|
|
135
|
+
uiLogger.log('');
|
|
136
|
+
uiLogger.warn(commands.sandbox.subcommands.delete.failure.objectNotFound(sandboxAccountId));
|
|
137
|
+
uiLogger.log('');
|
|
163
138
|
const promptDefaultAccount = removeSandboxAccountFromConfig(sandboxAccountId);
|
|
164
139
|
if (promptDefaultAccount && !force) {
|
|
165
140
|
const newDefaultAccount = await selectAccountFromConfig();
|
|
@@ -179,18 +154,18 @@ async function handler(args) {
|
|
|
179
154
|
}
|
|
180
155
|
function sandboxDeleteBuilder(yargs) {
|
|
181
156
|
yargs.option('account', {
|
|
182
|
-
describe:
|
|
157
|
+
describe: commands.sandbox.subcommands.delete.options.account.describe,
|
|
183
158
|
type: 'string',
|
|
184
159
|
});
|
|
185
160
|
yargs.option('force', {
|
|
186
161
|
type: 'boolean',
|
|
187
162
|
alias: 'f',
|
|
188
|
-
describe:
|
|
163
|
+
describe: commands.sandbox.subcommands.delete.options.force.describe,
|
|
189
164
|
});
|
|
190
165
|
yargs.example([
|
|
191
166
|
[
|
|
192
167
|
'$0 sandbox delete --account=MySandboxAccount',
|
|
193
|
-
|
|
168
|
+
commands.sandbox.subcommands.delete.examples.default,
|
|
194
169
|
],
|
|
195
170
|
]);
|
|
196
171
|
return yargs;
|
package/commands/sandbox.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { commands } from '../lang/en.js';
|
|
2
2
|
import { uiBetaTag } from '../lib/ui/index.js';
|
|
3
3
|
import create from './sandbox/create.js';
|
|
4
4
|
import del from './sandbox/delete.js';
|
|
5
5
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
6
6
|
const command = ['sandbox', 'sandboxes'];
|
|
7
|
-
const describe = uiBetaTag(
|
|
7
|
+
const describe = uiBetaTag(commands.sandbox.describe, false);
|
|
8
8
|
function sandboxBuilder(yargs) {
|
|
9
9
|
yargs.command(create).command(del).demandCommand(1, '');
|
|
10
10
|
return yargs;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { addSecret, fetchSecrets } from '@hubspot/local-dev-lib/api/secrets';
|
|
3
2
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
4
3
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
|
-
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
6
4
|
import { secretValuePrompt, secretNamePrompt, } from '../../lib/prompts/secretPrompt.js';
|
|
7
|
-
import {
|
|
5
|
+
import { commands } from '../../lang/en.js';
|
|
6
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
8
7
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
9
|
-
import { uiCommandReference } from '../../lib/ui/index.js';
|
|
10
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
11
9
|
const command = 'add [name]';
|
|
12
|
-
const describe =
|
|
10
|
+
const describe = commands.secret.subcommands.add.describe;
|
|
13
11
|
async function handler(args) {
|
|
14
12
|
const { name, derivedAccountId } = args;
|
|
15
13
|
let secretName = name;
|
|
@@ -21,23 +19,15 @@ async function handler(args) {
|
|
|
21
19
|
}
|
|
22
20
|
const { data: { results: secrets }, } = await fetchSecrets(derivedAccountId);
|
|
23
21
|
if (secrets.includes(secretName)) {
|
|
24
|
-
|
|
25
|
-
secretName,
|
|
26
|
-
command: uiCommandReference('hs secret update'),
|
|
27
|
-
}));
|
|
22
|
+
uiLogger.error(commands.secret.subcommands.add.errors.alreadyExists(secretName));
|
|
28
23
|
process.exit(EXIT_CODES.ERROR);
|
|
29
24
|
}
|
|
30
25
|
const { secretValue } = await secretValuePrompt();
|
|
31
26
|
await addSecret(derivedAccountId, secretName, secretValue);
|
|
32
|
-
|
|
33
|
-
accountIdentifier: uiAccountDescription(derivedAccountId),
|
|
34
|
-
secretName,
|
|
35
|
-
}));
|
|
27
|
+
uiLogger.success(commands.secret.subcommands.add.success.add(secretName, derivedAccountId));
|
|
36
28
|
}
|
|
37
29
|
catch (err) {
|
|
38
|
-
|
|
39
|
-
secretName: secretName || '',
|
|
40
|
-
}));
|
|
30
|
+
uiLogger.error(commands.secret.subcommands.add.errors.add(secretName || ''));
|
|
41
31
|
logError(err, new ApiErrorContext({
|
|
42
32
|
request: 'add secret',
|
|
43
33
|
accountId: derivedAccountId,
|
|
@@ -46,7 +36,7 @@ async function handler(args) {
|
|
|
46
36
|
}
|
|
47
37
|
function addSecretBuilder(yargs) {
|
|
48
38
|
yargs.positional('name', {
|
|
49
|
-
describe:
|
|
39
|
+
describe: commands.secret.subcommands.add.positionals.name.describe,
|
|
50
40
|
type: 'string',
|
|
51
41
|
});
|
|
52
42
|
return yargs;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { deleteSecret, fetchSecrets } from '@hubspot/local-dev-lib/api/secrets';
|
|
3
2
|
import { secretListPrompt } from '../../lib/prompts/secretPrompt.js';
|
|
4
3
|
import { confirmPrompt } from '../../lib/prompts/promptUtils.js';
|
|
5
4
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
6
5
|
import { ApiErrorContext, logError } from '../../lib/errorHandlers/index.js';
|
|
7
6
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { commands } from './../../lang/en.js';
|
|
8
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
10
9
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
11
10
|
const command = 'delete [name]';
|
|
12
|
-
const describe =
|
|
11
|
+
const describe = commands.secret.subcommands.delete.describe;
|
|
13
12
|
async function handler(args) {
|
|
14
13
|
const { name, derivedAccountId, force } = args;
|
|
15
14
|
let secretName = name;
|
|
@@ -17,36 +16,27 @@ async function handler(args) {
|
|
|
17
16
|
try {
|
|
18
17
|
const { data: { results: secrets }, } = await fetchSecrets(derivedAccountId);
|
|
19
18
|
if (secretName && !secrets.includes(secretName)) {
|
|
20
|
-
|
|
21
|
-
secretName,
|
|
22
|
-
}));
|
|
19
|
+
uiLogger.error(commands.secret.subcommands.delete.errors.noSecret(secretName));
|
|
23
20
|
process.exit(EXIT_CODES.ERROR);
|
|
24
21
|
}
|
|
25
22
|
if (!secretName) {
|
|
26
|
-
const { secretToModify } = await secretListPrompt(secrets,
|
|
23
|
+
const { secretToModify } = await secretListPrompt(secrets, commands.secret.subcommands.delete.selectSecret);
|
|
27
24
|
secretName = secretToModify;
|
|
28
25
|
}
|
|
29
26
|
const confirmDelete = force ||
|
|
30
|
-
(await confirmPrompt(
|
|
31
|
-
secretName,
|
|
32
|
-
}), {
|
|
27
|
+
(await confirmPrompt(commands.secret.subcommands.delete.confirmDelete(secretName), {
|
|
33
28
|
defaultAnswer: false,
|
|
34
29
|
}));
|
|
35
30
|
if (!confirmDelete) {
|
|
36
|
-
|
|
31
|
+
uiLogger.success(commands.secret.subcommands.delete.deleteCanceled);
|
|
37
32
|
process.exit(EXIT_CODES.SUCCESS);
|
|
38
33
|
}
|
|
39
34
|
await deleteSecret(derivedAccountId, secretName);
|
|
40
|
-
|
|
41
|
-
accountIdentifier: uiAccountDescription(derivedAccountId),
|
|
42
|
-
secretName,
|
|
43
|
-
}));
|
|
35
|
+
uiLogger.success(commands.secret.subcommands.delete.success.delete(secretName, derivedAccountId));
|
|
44
36
|
}
|
|
45
37
|
catch (err) {
|
|
46
38
|
if (secretName) {
|
|
47
|
-
|
|
48
|
-
secretName,
|
|
49
|
-
}));
|
|
39
|
+
uiLogger.error(commands.secret.subcommands.delete.errors.delete(secretName));
|
|
50
40
|
}
|
|
51
41
|
logError(err, new ApiErrorContext({
|
|
52
42
|
request: 'delete a secret',
|
|
@@ -57,7 +47,7 @@ async function handler(args) {
|
|
|
57
47
|
function deleteSecretBuilder(yargs) {
|
|
58
48
|
yargs
|
|
59
49
|
.positional('name', {
|
|
60
|
-
describe:
|
|
50
|
+
describe: commands.secret.subcommands.delete.positionals.name.describe,
|
|
61
51
|
type: 'string',
|
|
62
52
|
})
|
|
63
53
|
.options('force', {
|
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { fetchSecrets } from '@hubspot/local-dev-lib/api/secrets';
|
|
3
2
|
import { logError, ApiErrorContext } from '../../lib/errorHandlers/index.js';
|
|
4
3
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
5
4
|
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
6
|
-
import {
|
|
5
|
+
import { commands } from '../../lang/en.js';
|
|
6
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
7
7
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
8
8
|
const command = 'list';
|
|
9
|
-
const describe =
|
|
9
|
+
const describe = commands.secret.subcommands.list.describe;
|
|
10
10
|
async function handler(args) {
|
|
11
11
|
const { derivedAccountId } = args;
|
|
12
12
|
trackCommandUsage('secrets-list', {}, derivedAccountId);
|
|
13
13
|
try {
|
|
14
14
|
const { data: { results }, } = await fetchSecrets(derivedAccountId);
|
|
15
|
-
const groupLabel =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
results.forEach(secret => logger.log(secret));
|
|
20
|
-
logger.groupEnd();
|
|
15
|
+
const groupLabel = commands.secret.subcommands.list.groupLabel(uiAccountDescription(derivedAccountId));
|
|
16
|
+
uiLogger.group(groupLabel);
|
|
17
|
+
results.forEach(secret => uiLogger.log(secret));
|
|
18
|
+
uiLogger.groupEnd();
|
|
21
19
|
}
|
|
22
20
|
catch (err) {
|
|
23
|
-
|
|
21
|
+
uiLogger.error(commands.secret.subcommands.list.errors.list);
|
|
24
22
|
logError(err, new ApiErrorContext({
|
|
25
23
|
request: 'add secret',
|
|
26
24
|
accountId: derivedAccountId,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { updateSecret, fetchSecrets } from '@hubspot/local-dev-lib/api/secrets';
|
|
2
2
|
import { EXIT_CODES } from '../../lib/enums/exitCodes.js';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { ApiErrorContext, logError } from '../../lib/errorHandlers/index.js';
|
|
5
4
|
import { trackCommandUsage } from '../../lib/usageTracking.js';
|
|
6
|
-
import { uiAccountDescription } from '../../lib/ui/index.js';
|
|
7
5
|
import { secretValuePrompt, secretListPrompt, } from '../../lib/prompts/secretPrompt.js';
|
|
8
|
-
import {
|
|
6
|
+
import { commands } from '../../lang/en.js';
|
|
7
|
+
import { uiLogger } from '../../lib/ui/logger.js';
|
|
9
8
|
import { makeYargsBuilder } from '../../lib/yargsUtils.js';
|
|
10
9
|
const command = 'update [name]';
|
|
11
|
-
const describe =
|
|
10
|
+
const describe = commands.secret.subcommands.update.describe;
|
|
12
11
|
async function handler(args) {
|
|
13
12
|
const { name, derivedAccountId } = args;
|
|
14
13
|
let secretName = name;
|
|
@@ -16,27 +15,20 @@ async function handler(args) {
|
|
|
16
15
|
try {
|
|
17
16
|
const { data: { results: secrets }, } = await fetchSecrets(derivedAccountId);
|
|
18
17
|
if (secretName && !secrets.includes(secretName)) {
|
|
19
|
-
|
|
20
|
-
secretName,
|
|
21
|
-
}));
|
|
18
|
+
uiLogger.error(commands.secret.subcommands.update.errors.noSecret(secretName));
|
|
22
19
|
process.exit(EXIT_CODES.ERROR);
|
|
23
20
|
}
|
|
24
21
|
if (!secretName) {
|
|
25
|
-
const { secretToModify } = await secretListPrompt(secrets,
|
|
22
|
+
const { secretToModify } = await secretListPrompt(secrets, commands.secret.subcommands.update.selectSecret);
|
|
26
23
|
secretName = secretToModify;
|
|
27
24
|
}
|
|
28
25
|
const { secretValue } = await secretValuePrompt();
|
|
29
26
|
await updateSecret(derivedAccountId, secretName, secretValue);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
secretName,
|
|
33
|
-
}));
|
|
34
|
-
logger.log(i18n(`commands.secret.subcommands.update.success.updateExplanation`));
|
|
27
|
+
uiLogger.success(commands.secret.subcommands.update.success.update(secretName, derivedAccountId));
|
|
28
|
+
uiLogger.log(commands.secret.subcommands.update.success.updateExplanation);
|
|
35
29
|
}
|
|
36
30
|
catch (err) {
|
|
37
|
-
|
|
38
|
-
secretName: secretName || '',
|
|
39
|
-
}));
|
|
31
|
+
uiLogger.error(commands.secret.subcommands.update.errors.update(secretName || ''));
|
|
40
32
|
logError(err, new ApiErrorContext({
|
|
41
33
|
request: 'update secret',
|
|
42
34
|
accountId: derivedAccountId,
|
|
@@ -45,7 +37,7 @@ async function handler(args) {
|
|
|
45
37
|
}
|
|
46
38
|
function updateSecretBuilder(yargs) {
|
|
47
39
|
yargs.positional('name', {
|
|
48
|
-
describe:
|
|
40
|
+
describe: commands.secret.subcommands.update.positionals.name.describe,
|
|
49
41
|
type: 'string',
|
|
50
42
|
});
|
|
51
43
|
return yargs;
|
package/commands/secret.js
CHANGED
|
@@ -2,10 +2,10 @@ import addSecretCommand from './secret/addSecret.js';
|
|
|
2
2
|
import listSecretCommand from './secret/listSecret.js';
|
|
3
3
|
import deleteSecretCommand from './secret/deleteSecret.js';
|
|
4
4
|
import updateSecretCommand from './secret/updateSecret.js';
|
|
5
|
-
import {
|
|
5
|
+
import { commands } from '../lang/en.js';
|
|
6
6
|
import { makeYargsBuilder } from '../lib/yargsUtils.js';
|
|
7
7
|
const command = ['secret', 'secrets'];
|
|
8
|
-
const describe =
|
|
8
|
+
const describe = commands.secret.describe;
|
|
9
9
|
function secretBuilder(yargs) {
|
|
10
10
|
yargs
|
|
11
11
|
.command(listSecretCommand)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import {
|
|
2
|
+
import { addConfigOptions, addUseEnvironmentOptions, addTestingOptions, } from '../../../lib/commonOpts.js';
|
|
3
3
|
import testAccountDeleteCommand from '../delete.js';
|
|
4
4
|
vi.mock('../../../lib/commonOpts');
|
|
5
5
|
describe('commands/testAccount/delete', () => {
|
|
6
6
|
const yargsMock = yargs;
|
|
7
7
|
describe('command', () => {
|
|
8
8
|
it('should have the correct command structure', () => {
|
|
9
|
-
expect(testAccountDeleteCommand.command).toEqual('delete
|
|
9
|
+
expect(testAccountDeleteCommand.command).toEqual('delete [test-account]');
|
|
10
10
|
});
|
|
11
11
|
});
|
|
12
12
|
describe('describe', () => {
|
|
@@ -20,8 +20,6 @@ describe('commands/testAccount/delete', () => {
|
|
|
20
20
|
expect(yargsMock.example).toHaveBeenCalledTimes(1);
|
|
21
21
|
expect(addTestingOptions).toHaveBeenCalledTimes(1);
|
|
22
22
|
expect(addTestingOptions).toHaveBeenCalledWith(yargsMock);
|
|
23
|
-
expect(addAccountOptions).toHaveBeenCalledTimes(1);
|
|
24
|
-
expect(addAccountOptions).toHaveBeenCalledWith(yargsMock);
|
|
25
23
|
expect(addConfigOptions).toHaveBeenCalledTimes(1);
|
|
26
24
|
expect(addConfigOptions).toHaveBeenCalledWith(yargsMock);
|
|
27
25
|
expect(addUseEnvironmentOptions).toHaveBeenCalledTimes(1);
|
|
@@ -13,7 +13,7 @@ import { commands } from '../../lang/en.js';
|
|
|
13
13
|
import { createDeveloperTestAccountConfigPrompt } from '../../lib/prompts/createDeveloperTestAccountConfigPrompt.js';
|
|
14
14
|
import { debugError, logError } from '../../lib/errorHandlers/index.js';
|
|
15
15
|
import SpinniesManager from '../../lib/ui/SpinniesManager.js';
|
|
16
|
-
import {
|
|
16
|
+
import { createDeveloperTestAccountV2, saveAccountToConfig, } from '../../lib/buildAccount.js';
|
|
17
17
|
const command = 'create';
|
|
18
18
|
const describe = commands.testAccount.create.describe;
|
|
19
19
|
async function handler(args) {
|
|
@@ -69,15 +69,12 @@ async function handler(args) {
|
|
|
69
69
|
text: commands.testAccount.create.polling.start(testAccountConfig.accountName),
|
|
70
70
|
});
|
|
71
71
|
try {
|
|
72
|
-
const createResult = await
|
|
72
|
+
const createResult = await createDeveloperTestAccountV2(derivedAccountId, testAccountConfig);
|
|
73
73
|
resultJson.accountName = createResult.accountName;
|
|
74
74
|
resultJson.accountId = createResult.accountId;
|
|
75
75
|
resultJson.personalAccessKey = createResult.personalAccessKey;
|
|
76
76
|
}
|
|
77
77
|
catch (err) {
|
|
78
|
-
SpinniesManager.fail('createTestAccount', {
|
|
79
|
-
text: commands.testAccount.create.polling.createFailure,
|
|
80
|
-
});
|
|
81
78
|
logError(err);
|
|
82
79
|
SpinniesManager.fail('createTestAccount', {
|
|
83
80
|
text: commands.testAccount.create.polling.createFailure,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CommonArgs, ConfigArgs,
|
|
2
|
-
type DeleteTestAccountArgs = CommonArgs &
|
|
3
|
-
|
|
1
|
+
import { CommonArgs, ConfigArgs, EnvironmentArgs, TestingArgs, YargsCommandModule } from '../../types/Yargs.js';
|
|
2
|
+
type DeleteTestAccountArgs = CommonArgs & ConfigArgs & TestingArgs & EnvironmentArgs & {
|
|
3
|
+
testAccount?: string | number;
|
|
4
|
+
force?: boolean;
|
|
4
5
|
};
|
|
5
6
|
declare const deleteTestAccountCommand: YargsCommandModule<unknown, DeleteTestAccountArgs>;
|
|
6
7
|
export default deleteTestAccountCommand;
|