@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,29 +1,29 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
3
3
|
import { promptUser } from './promptUtils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
5
|
export async function uploadPrompt(promptOptions = {}) {
|
|
6
6
|
return promptUser([
|
|
7
7
|
{
|
|
8
8
|
name: 'src',
|
|
9
|
-
message:
|
|
9
|
+
message: lib.prompts.uploadPrompt.enterSrc,
|
|
10
10
|
when: !promptOptions.src,
|
|
11
11
|
default: '.',
|
|
12
12
|
validate: (input) => {
|
|
13
13
|
if (!input) {
|
|
14
|
-
return
|
|
14
|
+
return lib.prompts.uploadPrompt.errors.srcRequired;
|
|
15
15
|
}
|
|
16
16
|
return true;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'dest',
|
|
21
|
-
message:
|
|
21
|
+
message: lib.prompts.uploadPrompt.enterDest,
|
|
22
22
|
when: !promptOptions.dest,
|
|
23
23
|
default: path.basename(getCwd()),
|
|
24
24
|
validate: (input) => {
|
|
25
25
|
if (!input) {
|
|
26
|
-
return
|
|
26
|
+
return lib.prompts.uploadPrompt.errors.destRequired;
|
|
27
27
|
}
|
|
28
28
|
return true;
|
|
29
29
|
},
|
package/lib/sandboxSync.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import SpinniesManager from './ui/SpinniesManager.js';
|
|
2
2
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from './ui/logger.js';
|
|
4
4
|
import { initiateSync } from '@hubspot/local-dev-lib/api/sandboxSync';
|
|
5
5
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
6
6
|
import { getAccountId } from '@hubspot/local-dev-lib/config';
|
|
7
7
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
8
|
-
import {
|
|
8
|
+
import { lib } from '../lang/en.js';
|
|
9
9
|
import { getAvailableSyncTypes, getSandboxTypeAsString } from './sandboxes.js';
|
|
10
10
|
import { debugError, logError, ApiErrorContext, } from './errorHandlers/index.js';
|
|
11
|
-
import { uiAccountDescription, uiLine,
|
|
11
|
+
import { uiAccountDescription, uiLine, uiCommandDisabledBanner, } from './ui/index.js';
|
|
12
12
|
import { isDevelopmentSandbox } from './accountTypes.js';
|
|
13
13
|
export async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, slimInfoMessage = false) {
|
|
14
14
|
const id = getAccountIdentifier(accountConfig);
|
|
@@ -17,14 +17,9 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
17
17
|
const parentAccountId = getAccountId(parentId);
|
|
18
18
|
const isDevSandbox = isDevelopmentSandbox(accountConfig);
|
|
19
19
|
if (!accountId || !parentAccountId) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
: id.toString(),
|
|
24
|
-
parentAccountName: parentAccountId
|
|
25
|
-
? uiAccountDescription(parentAccountId)
|
|
26
|
-
: parentId.toString(),
|
|
27
|
-
}));
|
|
20
|
+
throw new Error(lib.sandbox.sync.failure.invalidUser(accountId ? uiAccountDescription(accountId) : id.toString(), parentAccountId
|
|
21
|
+
? uiAccountDescription(parentAccountId)
|
|
22
|
+
: parentId.toString()));
|
|
28
23
|
}
|
|
29
24
|
SpinniesManager.init({
|
|
30
25
|
succeedColor: 'white',
|
|
@@ -40,45 +35,37 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
40
35
|
availableSyncTasks = await getAvailableSyncTypes(parentAccountConfig, accountConfig);
|
|
41
36
|
}
|
|
42
37
|
SpinniesManager.add('sandboxSync', {
|
|
43
|
-
text:
|
|
38
|
+
text: lib.sandbox.sync.loading.startSync,
|
|
44
39
|
});
|
|
45
40
|
await initiateSync(parentAccountId, accountId, availableSyncTasks, accountId);
|
|
46
41
|
const spinniesText = isDevSandbox
|
|
47
|
-
?
|
|
48
|
-
:
|
|
42
|
+
? lib.sandbox.sync.loading.succeedDevSb(accountId)
|
|
43
|
+
: lib.sandbox.sync.loading.succeed(accountId);
|
|
49
44
|
SpinniesManager.succeed('sandboxSync', {
|
|
50
|
-
text:
|
|
51
|
-
?
|
|
52
|
-
: spinniesText,
|
|
53
|
-
accountName: uiAccountDescription(accountId),
|
|
54
|
-
url: uiLink(i18n(`lib.sandbox.sync.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
55
|
-
}),
|
|
45
|
+
text: slimInfoMessage
|
|
46
|
+
? lib.sandbox.sync.loading.successDevSbInfo(accountId, syncStatusUrl)
|
|
47
|
+
: spinniesText,
|
|
56
48
|
});
|
|
57
49
|
}
|
|
58
50
|
catch (err) {
|
|
59
51
|
debugError(err);
|
|
60
52
|
SpinniesManager.fail('sandboxSync', {
|
|
61
|
-
text:
|
|
53
|
+
text: lib.sandbox.sync.loading.fail(accountId),
|
|
62
54
|
});
|
|
63
|
-
|
|
55
|
+
uiLogger.log('');
|
|
64
56
|
if (isSpecifiedError(err, {
|
|
65
57
|
statusCode: 403,
|
|
66
58
|
category: 'BANNED',
|
|
67
59
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USER',
|
|
68
60
|
})) {
|
|
69
|
-
|
|
70
|
-
accountName: uiAccountDescription(accountId),
|
|
71
|
-
parentAccountName: uiAccountDescription(parentAccountId),
|
|
72
|
-
}));
|
|
61
|
+
uiLogger.error(lib.sandbox.sync.failure.invalidUser(uiAccountDescription(accountId), uiAccountDescription(parentAccountId)));
|
|
73
62
|
}
|
|
74
63
|
else if (isSpecifiedError(err, {
|
|
75
64
|
statusCode: 429,
|
|
76
65
|
category: 'RATE_LIMITS',
|
|
77
66
|
subCategory: 'sandboxes-sync-api.SYNC_IN_PROGRESS',
|
|
78
67
|
})) {
|
|
79
|
-
|
|
80
|
-
url: `${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`,
|
|
81
|
-
}));
|
|
68
|
+
uiLogger.error(lib.sandbox.sync.failure.syncInProgress(`${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`));
|
|
82
69
|
}
|
|
83
70
|
else if (isSpecifiedError(err, {
|
|
84
71
|
statusCode: 403,
|
|
@@ -86,18 +73,14 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
86
73
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USERID',
|
|
87
74
|
})) {
|
|
88
75
|
// This will only trigger if a user is not a super admin of the target account.
|
|
89
|
-
|
|
90
|
-
account: uiAccountDescription(accountId),
|
|
91
|
-
}));
|
|
76
|
+
uiLogger.error(lib.sandbox.sync.failure.notSuperAdmin(accountId));
|
|
92
77
|
}
|
|
93
78
|
else if (isSpecifiedError(err, {
|
|
94
79
|
statusCode: 404,
|
|
95
80
|
category: 'OBJECT_NOT_FOUND',
|
|
96
81
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
97
82
|
})) {
|
|
98
|
-
|
|
99
|
-
account: uiAccountDescription(accountId),
|
|
100
|
-
}));
|
|
83
|
+
uiLogger.error(lib.sandbox.sync.failure.objectNotFound(accountId));
|
|
101
84
|
}
|
|
102
85
|
else if (isSpecifiedError(err, {
|
|
103
86
|
statusCode: 404,
|
|
@@ -110,16 +93,16 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
110
93
|
request: 'sandbox sync',
|
|
111
94
|
}));
|
|
112
95
|
}
|
|
113
|
-
|
|
96
|
+
uiLogger.log('');
|
|
114
97
|
throw err;
|
|
115
98
|
}
|
|
116
99
|
if (!slimInfoMessage) {
|
|
117
|
-
|
|
100
|
+
uiLogger.log('');
|
|
118
101
|
uiLine();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
uiLogger.info(isDevSandbox
|
|
103
|
+
? lib.sandbox.sync.info.syncMessageDevSb(syncStatusUrl)
|
|
104
|
+
: lib.sandbox.sync.info.syncMessage(syncStatusUrl));
|
|
122
105
|
uiLine();
|
|
123
|
-
|
|
106
|
+
uiLogger.log('');
|
|
124
107
|
}
|
|
125
108
|
}
|
package/lib/sandboxes.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { getSandboxUsageLimits } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
3
2
|
import { fetchTypes } from '@hubspot/local-dev-lib/api/sandboxSync';
|
|
4
3
|
import { getAccountId, getConfigAccounts } from '@hubspot/local-dev-lib/config';
|
|
@@ -6,9 +5,10 @@ import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
|
6
5
|
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
7
6
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
8
7
|
import { isMissingScopeError, isSpecifiedError, } from '@hubspot/local-dev-lib/errors/index';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { uiLogger } from './ui/logger.js';
|
|
9
|
+
import { lib } from '../lang/en.js';
|
|
11
10
|
import { logError } from './errorHandlers/index.js';
|
|
11
|
+
import { uiAccountDescription } from './ui/index.js';
|
|
12
12
|
export const SYNC_TYPES = {
|
|
13
13
|
OBJECT_RECORDS: 'object-records',
|
|
14
14
|
};
|
|
@@ -54,11 +54,11 @@ export async function getAvailableSyncTypes(parentAccountConfig, config) {
|
|
|
54
54
|
const id = getAccountIdentifier(config);
|
|
55
55
|
const portalId = getAccountId(id);
|
|
56
56
|
if (!parentPortalId || !portalId) {
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error(lib.sandbox.sync.failure.syncTypeFetch);
|
|
58
58
|
}
|
|
59
59
|
const { data: { results: syncTypes }, } = await fetchTypes(parentPortalId, portalId);
|
|
60
60
|
if (!syncTypes) {
|
|
61
|
-
throw new Error(
|
|
61
|
+
throw new Error(lib.sandbox.sync.failure.syncTypeFetch);
|
|
62
62
|
}
|
|
63
63
|
return syncTypes.map(t => ({ type: t.name }));
|
|
64
64
|
}
|
|
@@ -66,91 +66,63 @@ export async function validateSandboxUsageLimits(accountConfig, sandboxType, env
|
|
|
66
66
|
const id = getAccountIdentifier(accountConfig);
|
|
67
67
|
const accountId = getAccountId(id);
|
|
68
68
|
if (!accountId) {
|
|
69
|
-
throw new Error(
|
|
69
|
+
throw new Error(lib.sandbox.create.failure.usageLimitsFetch);
|
|
70
70
|
}
|
|
71
71
|
const { data: { usage }, } = await getSandboxUsageLimits(accountId);
|
|
72
72
|
if (!usage) {
|
|
73
|
-
throw new Error(
|
|
73
|
+
throw new Error(lib.sandbox.create.failure.usageLimitsFetch);
|
|
74
74
|
}
|
|
75
75
|
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
76
76
|
if (usage['DEVELOPER'].available === 0) {
|
|
77
77
|
const devSandboxLimit = usage['DEVELOPER'].limit;
|
|
78
|
-
const plural = devSandboxLimit !== 1;
|
|
79
78
|
const hasDevelopmentSandboxes = getHasSandboxesByType(accountConfig, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX);
|
|
80
79
|
if (hasDevelopmentSandboxes) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
accountName: accountConfig.name || accountId,
|
|
83
|
-
limit: devSandboxLimit,
|
|
84
|
-
}));
|
|
80
|
+
throw new Error(lib.sandbox.create.developer.failure.alreadyInConfig(accountId, devSandboxLimit));
|
|
85
81
|
}
|
|
86
82
|
else {
|
|
87
83
|
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
88
|
-
throw new Error(
|
|
89
|
-
accountName: accountConfig.name || accountId,
|
|
90
|
-
limit: devSandboxLimit,
|
|
91
|
-
link: `${baseUrl}/sandboxes-developer/${accountId}/development`,
|
|
92
|
-
}));
|
|
84
|
+
throw new Error(lib.sandbox.create.developer.failure.limit(accountId, devSandboxLimit, `${baseUrl}/sandboxes-developer/${accountId}/development`));
|
|
93
85
|
}
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX) {
|
|
97
89
|
if (usage['STANDARD'].available === 0) {
|
|
98
90
|
const standardSandboxLimit = usage['STANDARD'].limit;
|
|
99
|
-
const plural = standardSandboxLimit !== 1;
|
|
100
91
|
const hasStandardSandboxes = getHasSandboxesByType(accountConfig, HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX);
|
|
101
92
|
if (hasStandardSandboxes) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
accountName: accountConfig.name || accountId,
|
|
104
|
-
limit: standardSandboxLimit,
|
|
105
|
-
}));
|
|
93
|
+
throw new Error(lib.sandbox.create.standard.failure.alreadyInConfig(accountId, standardSandboxLimit));
|
|
106
94
|
}
|
|
107
95
|
else {
|
|
108
96
|
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
109
|
-
throw new Error(
|
|
110
|
-
accountName: accountConfig.name || accountId,
|
|
111
|
-
limit: standardSandboxLimit,
|
|
112
|
-
link: `${baseUrl}/sandboxes-developer/${accountId}/standard`,
|
|
113
|
-
}));
|
|
97
|
+
throw new Error(lib.sandbox.create.standard.failure.limit(accountId, standardSandboxLimit, `${baseUrl}/sandboxes-developer/${accountId}/standard`));
|
|
114
98
|
}
|
|
115
99
|
}
|
|
116
100
|
}
|
|
117
101
|
}
|
|
118
102
|
export function handleSandboxCreateError(err, env, name, accountId) {
|
|
119
103
|
if (isMissingScopeError(err)) {
|
|
120
|
-
|
|
121
|
-
accountName: uiAccountDescription(accountId),
|
|
122
|
-
}));
|
|
104
|
+
uiLogger.error(lib.sandbox.create.failure.scopes.message);
|
|
123
105
|
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
124
106
|
const url = `${websiteOrigin}/personal-access-key/${accountId}`;
|
|
125
|
-
|
|
126
|
-
accountName: uiAccountDescription(accountId),
|
|
127
|
-
url,
|
|
128
|
-
}));
|
|
107
|
+
uiLogger.info(lib.sandbox.create.failure.scopes.instructions(uiAccountDescription(accountId), url));
|
|
129
108
|
}
|
|
130
109
|
else if (isSpecifiedError(err, {
|
|
131
110
|
statusCode: 403,
|
|
132
111
|
category: 'BANNED',
|
|
133
112
|
subCategory: 'SandboxErrors.USER_ACCESS_NOT_ALLOWED',
|
|
134
113
|
})) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
parentAccountName: uiAccountDescription(accountId),
|
|
139
|
-
}));
|
|
140
|
-
logger.log('');
|
|
114
|
+
uiLogger.log('');
|
|
115
|
+
uiLogger.error(lib.sandbox.create.failure.invalidUser(name, accountId));
|
|
116
|
+
uiLogger.log('');
|
|
141
117
|
}
|
|
142
118
|
else if (isSpecifiedError(err, {
|
|
143
119
|
statusCode: 403,
|
|
144
120
|
category: 'BANNED',
|
|
145
121
|
subCategory: 'SandboxErrors.DEVELOPMENT_SANDBOX_ACCESS_NOT_ALLOWED',
|
|
146
122
|
})) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
parentAccountName: uiAccountDescription(accountId),
|
|
151
|
-
accountId,
|
|
152
|
-
}));
|
|
153
|
-
logger.log('');
|
|
123
|
+
uiLogger.log('');
|
|
124
|
+
uiLogger.error(lib.sandbox.create.failure['403Gating'](name, accountId));
|
|
125
|
+
uiLogger.log('');
|
|
154
126
|
}
|
|
155
127
|
else {
|
|
156
128
|
logError(err);
|
package/lib/schema.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { table, getBorderCharacters } from 'table';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { fetchObjectSchemas } from '@hubspot/local-dev-lib/api/customObjects';
|
|
4
|
+
import { uiLogger } from './ui/logger.js';
|
|
5
5
|
export function logSchemas(schemas) {
|
|
6
6
|
const data = schemas
|
|
7
7
|
.map(r => [r.labels.singular, r.name, r.objectTypeId || ''])
|
|
8
8
|
.sort((a, b) => (a[1] > b[1] ? 1 : -1));
|
|
9
9
|
if (data.length === 0) {
|
|
10
|
-
|
|
10
|
+
uiLogger.log('No Schemas were found');
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
data.unshift([
|
|
@@ -19,7 +19,7 @@ export function logSchemas(schemas) {
|
|
|
19
19
|
singleLine: true,
|
|
20
20
|
border: getBorderCharacters('honeywell'),
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
uiLogger.log(table(data, tableConfig));
|
|
23
23
|
}
|
|
24
24
|
export async function listSchemas(accountId) {
|
|
25
25
|
const { data } = await fetchObjectSchemas(accountId);
|
package/lib/serverlessLogs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import https from 'https';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from './ui/logger.js';
|
|
4
4
|
import { isHubSpotHttpError, isMissingScopeError, } from '@hubspot/local-dev-lib/errors/index';
|
|
5
5
|
import { SCOPE_GROUPS, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
|
|
6
6
|
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
@@ -10,7 +10,7 @@ import { logError, ApiErrorContext } from './errorHandlers/index.js';
|
|
|
10
10
|
import SpinniesManager from './ui/SpinniesManager.js';
|
|
11
11
|
import { handleExit, handleKeypress } from './process.js';
|
|
12
12
|
import { EXIT_CODES } from './enums/exitCodes.js';
|
|
13
|
-
import {
|
|
13
|
+
import { lib } from '../lang/en.js';
|
|
14
14
|
const TAIL_DELAY = 5000;
|
|
15
15
|
function base64EncodeString(valueToEncode) {
|
|
16
16
|
if (typeof valueToEncode !== 'string') {
|
|
@@ -47,22 +47,20 @@ async function verifyAccessKeyAndUserAccess(accountId, scopeGroup) {
|
|
|
47
47
|
scopesData = resp.data;
|
|
48
48
|
}
|
|
49
49
|
catch (e) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}));
|
|
53
|
-
logger.debug(e);
|
|
50
|
+
uiLogger.debug(lib.serverless.verifyAccessKeyAndUserAccess.fetchScopeDataError(scopeGroup));
|
|
51
|
+
uiLogger.debug(e);
|
|
54
52
|
return;
|
|
55
53
|
}
|
|
56
54
|
const { portalScopesInGroup, userScopesInGroup } = scopesData;
|
|
57
55
|
if (!portalScopesInGroup.length) {
|
|
58
|
-
|
|
56
|
+
uiLogger.error(lib.serverless.verifyAccessKeyAndUserAccess.portalMissingScope);
|
|
59
57
|
return;
|
|
60
58
|
}
|
|
61
59
|
if (!portalScopesInGroup.every(s => userScopesInGroup.includes(s))) {
|
|
62
|
-
|
|
60
|
+
uiLogger.error(lib.serverless.verifyAccessKeyAndUserAccess.userMissingScope);
|
|
63
61
|
}
|
|
64
62
|
else {
|
|
65
|
-
|
|
63
|
+
uiLogger.error(lib.serverless.verifyAccessKeyAndUserAccess.genericMissingScope);
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
export async function tailLogs(accountId, name, fetchLatest, tailCall, compact = false) {
|
|
@@ -120,7 +118,7 @@ export async function tailLogs(accountId, name, fetchLatest, tailCall, compact =
|
|
|
120
118
|
}
|
|
121
119
|
export async function outputBuildLog(buildLogUrl) {
|
|
122
120
|
if (!buildLogUrl) {
|
|
123
|
-
|
|
121
|
+
uiLogger.debug('Unable to display build output. No build log URL was provided.');
|
|
124
122
|
return '';
|
|
125
123
|
}
|
|
126
124
|
return new Promise(resolve => {
|
|
@@ -135,16 +133,16 @@ export async function outputBuildLog(buildLogUrl) {
|
|
|
135
133
|
data += chunk;
|
|
136
134
|
});
|
|
137
135
|
response.on('end', () => {
|
|
138
|
-
|
|
136
|
+
uiLogger.log(data);
|
|
139
137
|
resolve(data);
|
|
140
138
|
});
|
|
141
139
|
})
|
|
142
140
|
.on('error', () => {
|
|
143
|
-
|
|
141
|
+
uiLogger.error('The build log could not be retrieved.');
|
|
144
142
|
});
|
|
145
143
|
}
|
|
146
144
|
catch (e) {
|
|
147
|
-
|
|
145
|
+
uiLogger.error('The build log could not be retrieved.');
|
|
148
146
|
resolve('');
|
|
149
147
|
}
|
|
150
148
|
});
|
|
@@ -2,11 +2,11 @@ import { getProjectThemeDetails, migrateThemes, } from '@hubspot/project-parsing
|
|
|
2
2
|
import { confirmPrompt } from '../../prompts/promptUtils.js';
|
|
3
3
|
import { writeProjectConfig, } from '../../projects/config.js';
|
|
4
4
|
import { ensureProjectExists } from '../../projects/ensureProjectExists.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isV2Project } from '../../projects/platformVersion.js';
|
|
6
6
|
import { fetchMigrationApps } from '../../app/migrate.js';
|
|
7
7
|
import { getHasMigratableThemes, validateMigrationAppsAndThemes, handleThemesMigration, migrateThemes2025_2, } from '../migrate.js';
|
|
8
8
|
import { lib } from '../../../lang/en.js';
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('../../ui/logger.js');
|
|
10
10
|
vi.mock('@hubspot/project-parsing-lib');
|
|
11
11
|
vi.mock('../../prompts/promptUtils');
|
|
12
12
|
vi.mock('../../projects/config');
|
|
@@ -18,7 +18,7 @@ const mockedMigrateThemes = migrateThemes;
|
|
|
18
18
|
const mockedConfirmPrompt = confirmPrompt;
|
|
19
19
|
const mockedWriteProjectConfig = writeProjectConfig;
|
|
20
20
|
const mockedEnsureProjectExists = ensureProjectExists;
|
|
21
|
-
const
|
|
21
|
+
const mockedUseV2Api = isV2Project;
|
|
22
22
|
const mockedFetchMigrationApps = fetchMigrationApps;
|
|
23
23
|
const ACCOUNT_ID = 123;
|
|
24
24
|
const PROJECT_NAME = 'Test Project';
|
|
@@ -30,7 +30,7 @@ const createLoadedProjectConfig = (name) => ({
|
|
|
30
30
|
});
|
|
31
31
|
describe('lib/theme/migrate', () => {
|
|
32
32
|
beforeEach(() => {
|
|
33
|
-
|
|
33
|
+
mockedUseV2Api.mockReturnValue(false);
|
|
34
34
|
});
|
|
35
35
|
describe('getHasMigratableThemes', () => {
|
|
36
36
|
it('should return false when no projectConfig is provided', async () => {
|
|
@@ -121,8 +121,8 @@ describe('lib/theme/migrate', () => {
|
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
123
|
describe('validateMigrationAppsAndThemes', () => {
|
|
124
|
-
it('should throw an error when themes are already migrated (
|
|
125
|
-
|
|
124
|
+
it('should throw an error when themes are already migrated (v2 API)', async () => {
|
|
125
|
+
mockedUseV2Api.mockReturnValue(true);
|
|
126
126
|
const projectConfig = createLoadedProjectConfig(PROJECT_NAME);
|
|
127
127
|
await expect(validateMigrationAppsAndThemes(0, projectConfig)).rejects.toThrow(lib.migrate.errors.project.themesAlreadyMigrated);
|
|
128
128
|
});
|
package/lib/theme/migrate.js
CHANGED
|
@@ -7,7 +7,7 @@ import { lib } from '../../lang/en.js';
|
|
|
7
7
|
import { PROJECT_CONFIG_FILE } from '../constants.js';
|
|
8
8
|
import { uiLogger } from '../ui/logger.js';
|
|
9
9
|
import { debugError } from '../errorHandlers/index.js';
|
|
10
|
-
import {
|
|
10
|
+
import { isV2Project } from '../projects/platformVersion.js';
|
|
11
11
|
import { confirmPrompt } from '../prompts/promptUtils.js';
|
|
12
12
|
import { fetchMigrationApps } from '../app/migrate.js';
|
|
13
13
|
export async function getHasMigratableThemes(projectConfig) {
|
|
@@ -22,7 +22,7 @@ export async function getHasMigratableThemes(projectConfig) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
export async function validateMigrationAppsAndThemes(hasApps, projectConfig) {
|
|
25
|
-
if (
|
|
25
|
+
if (isV2Project(projectConfig?.projectConfig?.platformVersion)) {
|
|
26
26
|
throw new Error(lib.migrate.errors.project.themesAlreadyMigrated);
|
|
27
27
|
}
|
|
28
28
|
if (hasApps > 0 && projectConfig) {
|
|
@@ -3,6 +3,7 @@ interface SpinnerState extends BaseSpinnerOptions {
|
|
|
3
3
|
name?: string;
|
|
4
4
|
}
|
|
5
5
|
declare class SpinniesManager {
|
|
6
|
+
private disableOutput;
|
|
6
7
|
private options;
|
|
7
8
|
private spinners;
|
|
8
9
|
private isCursorHidden;
|
|
@@ -14,6 +15,7 @@ declare class SpinniesManager {
|
|
|
14
15
|
constructor();
|
|
15
16
|
init(options?: Partial<SpinnerState>): void;
|
|
16
17
|
private resetState;
|
|
18
|
+
setDisableOutput(disableOutput: boolean): void;
|
|
17
19
|
pick(name: string): SpinnerState | undefined;
|
|
18
20
|
add(name: string, options?: Partial<SpinnerState>): SpinnerState & {
|
|
19
21
|
name: string;
|
|
@@ -19,6 +19,7 @@ function safeColor(text, color) {
|
|
|
19
19
|
return text;
|
|
20
20
|
}
|
|
21
21
|
class SpinniesManager {
|
|
22
|
+
disableOutput = false;
|
|
22
23
|
options;
|
|
23
24
|
spinners = {};
|
|
24
25
|
isCursorHidden = false;
|
|
@@ -61,6 +62,9 @@ class SpinniesManager {
|
|
|
61
62
|
this.lineCount = 0;
|
|
62
63
|
this.currentFrameIndex = 0;
|
|
63
64
|
}
|
|
65
|
+
setDisableOutput(disableOutput) {
|
|
66
|
+
this.disableOutput = disableOutput;
|
|
67
|
+
}
|
|
64
68
|
pick(name) {
|
|
65
69
|
return this.spinners?.[name];
|
|
66
70
|
}
|
|
@@ -142,6 +146,9 @@ class SpinniesManager {
|
|
|
142
146
|
this.spinners[name] = { ...this.spinners[name], ...options, status };
|
|
143
147
|
}
|
|
144
148
|
updateSpinnerState() {
|
|
149
|
+
if (this.disableOutput) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
145
152
|
if (this.spin) {
|
|
146
153
|
if (this.currentInterval) {
|
|
147
154
|
clearInterval(this.currentInterval);
|
package/lib/ui/boxen.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { uiLogger } from './logger.js';
|
|
2
2
|
import { UI_COLORS } from './index.js';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { lib } from '../../lang/en.js';
|
|
5
4
|
const defaultOptions = {
|
|
6
5
|
titleAlignment: 'left',
|
|
@@ -17,7 +16,7 @@ export async function logInBox({ contents, options, }) {
|
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
catch (error) {
|
|
20
|
-
|
|
19
|
+
uiLogger.debug(lib.boxen.failedToLoad);
|
|
21
20
|
if (options?.title) {
|
|
22
21
|
uiLogger.log(options.title);
|
|
23
22
|
uiLogger.log('');
|
package/lib/ui/git.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import { checkGitInclusion } from '@hubspot/local-dev-lib/gitignore';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { uiLogger } from './logger.js';
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
|
+
import { uiLine } from './index.js';
|
|
5
6
|
export function checkAndWarnGitInclusion(configPath) {
|
|
6
7
|
try {
|
|
7
8
|
const { inGit, configIgnored } = checkGitInclusion(configPath);
|
|
8
9
|
if (!inGit || configIgnored)
|
|
9
10
|
return;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
uiLine();
|
|
12
|
+
uiLogger.warn(lib.ui.git.securityIssue);
|
|
13
|
+
uiLogger.log(lib.ui.git.configFileTracked);
|
|
14
|
+
uiLogger.log(lib.ui.git.fileName(configPath));
|
|
15
|
+
uiLogger.log('');
|
|
16
|
+
uiLogger.log(lib.ui.git.moveConfig(os.homedir()));
|
|
17
|
+
uiLogger.log(lib.ui.git.addGitignore(configPath));
|
|
18
|
+
uiLogger.log(lib.ui.git.noRemote);
|
|
19
|
+
uiLine();
|
|
17
20
|
}
|
|
18
21
|
catch (e) {
|
|
19
22
|
// fail silently
|
|
20
|
-
|
|
23
|
+
uiLogger.debug(lib.ui.git.checkFailed);
|
|
21
24
|
}
|
|
22
25
|
}
|
package/lib/ui/index.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export declare function uiLink(linkText: string, url: string): string;
|
|
|
13
13
|
export declare function uiAccountDescription(accountId?: number | null, bold?: boolean): string;
|
|
14
14
|
export declare function uiInfoSection(title: string, logContent: () => void): void;
|
|
15
15
|
export declare function uiCommandReference(command: string, withQuotes?: boolean): string;
|
|
16
|
+
export declare function uiAuthCommandReference({ accountId, qa, }?: {
|
|
17
|
+
accountId?: number | string;
|
|
18
|
+
qa?: boolean;
|
|
19
|
+
}): string;
|
|
16
20
|
export declare function uiFeatureHighlight(features: string[], title?: string): void;
|
|
17
21
|
export declare function uiBetaTag(message: string, log?: true): undefined;
|
|
18
22
|
export declare function uiBetaTag(message: string, log: false): string;
|
|
@@ -20,6 +24,8 @@ export declare function uiDeprecatedTag(message: string, log?: true): undefined;
|
|
|
20
24
|
export declare function uiDeprecatedTag(message: string, log: false): string;
|
|
21
25
|
export declare function uiCommandDisabledBanner(command: string, url?: string, message?: string): void;
|
|
22
26
|
export declare function uiDeprecatedDescription(message: string, command: string, url?: string): undefined;
|
|
27
|
+
export declare function uiCommandRenamedDescription(describe: string | false | undefined, newCommand: string): string | undefined;
|
|
23
28
|
export declare function uiDeprecatedMessage(command: string, url?: string, message?: string): void;
|
|
29
|
+
export declare function uiCommandRelocatedMessage(newCommand: string): void;
|
|
24
30
|
export declare function indent(level: number): string;
|
|
25
31
|
export {};
|