@hubspot/cli 7.5.4-experimental.0 → 7.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/migrate.d.ts +14 -4
- package/api/migrate.js +16 -2
- package/bin/cli.js +100 -95
- package/commands/account/auth.d.ts +5 -7
- package/commands/account/auth.js +87 -80
- package/commands/account/clean.d.ts +3 -7
- package/commands/account/clean.js +16 -9
- package/commands/account/createOverride.d.ts +3 -7
- package/commands/account/createOverride.js +23 -6
- package/commands/account/info.d.ts +3 -7
- package/commands/account/info.js +13 -5
- package/commands/account/list.d.ts +3 -7
- package/commands/account/list.js +15 -8
- package/commands/account/remove.d.ts +3 -7
- package/commands/account/remove.js +21 -9
- package/commands/account/removeOverride.d.ts +3 -7
- package/commands/account/removeOverride.js +23 -6
- package/commands/account/rename.d.ts +3 -7
- package/commands/account/rename.js +16 -9
- package/commands/account/use.d.ts +5 -9
- package/commands/account/use.js +14 -6
- package/commands/account.d.ts +3 -4
- package/commands/account.js +33 -58
- package/commands/app/migrate.d.ts +5 -6
- package/commands/app/migrate.js +60 -44
- package/commands/app/secret/add.d.ts +7 -0
- package/commands/app/secret/add.js +64 -0
- package/commands/app/secret/delete.d.ts +8 -0
- package/commands/app/secret/delete.js +87 -0
- package/commands/app/secret/list.d.ts +6 -0
- package/commands/app/secret/list.js +64 -0
- package/commands/app/secret/update.d.ts +7 -0
- package/commands/app/secret/update.js +77 -0
- package/commands/app/secret.d.ts +3 -0
- package/commands/app/secret.js +30 -0
- package/commands/app.d.ts +2 -5
- package/commands/app.js +10 -10
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +35 -35
- package/commands/cms/convertFields.d.ts +7 -1
- package/commands/cms/convertFields.js +57 -41
- package/commands/cms/getReactModule.d.ts +7 -1
- package/commands/cms/getReactModule.js +52 -34
- package/commands/cms/lighthouseScore.d.ts +8 -1
- package/commands/cms/lighthouseScore.js +129 -100
- package/commands/cms.d.ts +3 -1
- package/commands/cms.js +22 -16
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -13
- package/commands/config/migrate.d.ts +3 -7
- package/commands/config/migrate.js +37 -46
- package/commands/config/set.d.ts +5 -6
- package/commands/config/set.js +38 -14
- package/commands/config.d.ts +3 -4
- package/commands/config.js +18 -44
- package/commands/create/api-sample.d.ts +3 -1
- package/commands/create/api-sample.js +34 -38
- package/commands/create/app.d.ts +3 -1
- package/commands/create/app.js +9 -7
- package/commands/create/function.d.ts +3 -1
- package/commands/create/function.js +11 -10
- package/commands/create/index.d.ts +5 -1
- package/commands/create/index.js +23 -11
- package/commands/create/module.d.ts +3 -1
- package/commands/create/module.js +14 -13
- package/commands/create/react-app.d.ts +3 -1
- package/commands/create/react-app.js +10 -7
- package/commands/create/template.d.ts +3 -1
- package/commands/create/template.js +14 -14
- package/commands/create/vue-app.d.ts +3 -1
- package/commands/create/vue-app.js +10 -7
- package/commands/create/webpack-serverless.d.ts +3 -1
- package/commands/create/webpack-serverless.js +10 -7
- package/commands/create/website-theme.d.ts +3 -1
- package/commands/create/website-theme.js +10 -9
- package/commands/create.d.ts +4 -24
- package/commands/create.js +62 -75
- package/commands/customObject/create.d.ts +4 -9
- package/commands/customObject/create.js +17 -10
- package/commands/customObject/schema/create.d.ts +4 -9
- package/commands/customObject/schema/create.js +18 -11
- package/commands/customObject/schema/delete.d.ts +4 -9
- package/commands/customObject/schema/delete.js +17 -10
- package/commands/customObject/schema/fetch-all.d.ts +4 -9
- package/commands/customObject/schema/fetch-all.js +17 -10
- package/commands/customObject/schema/fetch.d.ts +4 -9
- package/commands/customObject/schema/fetch.js +17 -10
- package/commands/customObject/schema/list.d.ts +4 -8
- package/commands/customObject/schema/list.js +17 -10
- package/commands/customObject/schema/update.d.ts +4 -9
- package/commands/customObject/schema/update.js +18 -11
- package/commands/customObject/schema.d.ts +3 -5
- package/commands/customObject/schema.js +27 -54
- package/commands/customObject.d.ts +3 -4
- package/commands/customObject.js +20 -48
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -22
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -48
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -34
- package/commands/filemanager/fetch.d.ts +4 -9
- package/commands/filemanager/fetch.js +18 -11
- package/commands/filemanager/upload.d.ts +4 -9
- package/commands/filemanager/upload.js +17 -11
- package/commands/filemanager.d.ts +3 -4
- package/commands/filemanager.js +18 -42
- package/commands/function/deploy.d.ts +6 -1
- package/commands/function/deploy.js +70 -50
- package/commands/function/list.d.ts +6 -1
- package/commands/function/list.js +44 -32
- package/commands/function/server.d.ts +10 -1
- package/commands/function/server.js +49 -38
- package/commands/function.d.ts +5 -1
- package/commands/function.js +22 -11
- package/commands/getStarted.d.ts +9 -0
- package/commands/getStarted.js +227 -0
- package/commands/hubdb/clear.d.ts +4 -9
- package/commands/hubdb/clear.js +21 -15
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +23 -17
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +24 -16
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +20 -14
- package/commands/hubdb/list.d.ts +4 -0
- package/commands/hubdb/list.js +83 -0
- package/commands/hubdb.d.ts +3 -2
- package/commands/hubdb.js +24 -47
- package/commands/init.d.ts +3 -7
- package/commands/init.js +25 -17
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -44
- package/commands/list.d.ts +3 -7
- package/commands/list.js +21 -16
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -45
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +50 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +75 -0
- package/commands/mcp.d.ts +3 -0
- package/commands/mcp.js +26 -0
- package/commands/module/marketplace-validate.d.ts +6 -1
- package/commands/module/marketplace-validate.js +39 -30
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -12
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +20 -15
- package/commands/open.d.ts +3 -7
- package/commands/open.js +20 -15
- package/commands/project/add.d.ts +8 -9
- package/commands/project/add.js +53 -85
- package/commands/project/cloneApp.d.ts +6 -8
- package/commands/project/cloneApp.js +51 -47
- package/commands/project/create.d.ts +4 -1
- package/commands/project/create.js +132 -81
- package/commands/project/deploy.d.ts +5 -6
- package/commands/project/deploy.js +93 -37
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +41 -26
- package/commands/project/dev/index.d.ts +4 -5
- package/commands/project/dev/index.js +103 -33
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +85 -46
- package/commands/project/download.d.ts +3 -7
- package/commands/project/download.js +18 -19
- package/commands/project/installDeps.d.ts +6 -1
- package/commands/project/installDeps.js +48 -32
- package/commands/project/listBuilds.d.ts +3 -7
- package/commands/project/listBuilds.js +32 -30
- package/commands/project/logs.d.ts +10 -1
- package/commands/project/logs.js +73 -65
- package/commands/project/migrate.d.ts +7 -0
- package/commands/project/migrate.js +71 -0
- package/commands/project/migrateApp.d.ts +3 -8
- package/commands/project/migrateApp.js +23 -20
- package/commands/project/open.d.ts +3 -7
- package/commands/project/open.js +29 -21
- package/commands/project/profile/add.d.ts +7 -0
- package/commands/project/profile/add.js +209 -0
- package/commands/project/profile/delete.d.ts +6 -0
- package/commands/project/profile/delete.js +123 -0
- package/commands/project/profile.d.ts +3 -0
- package/commands/project/profile.js +25 -0
- package/commands/project/upload.d.ts +10 -1
- package/commands/project/upload.js +94 -56
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project/watch.d.ts +6 -1
- package/commands/project/watch.js +95 -61
- package/commands/project.d.ts +3 -1
- package/commands/project.js +49 -35
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -20
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +27 -21
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +35 -29
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -44
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +21 -15
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +28 -18
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +19 -13
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +25 -17
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -49
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -16
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -18
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +36 -30
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -48
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -135
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -76
- package/lang/en.d.ts +3217 -0
- package/lang/en.js +3074 -3318
- package/lang/en.lyaml +41 -246
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +11 -0
- package/lib/app/migrate.d.ts +33 -4
- package/lib/app/migrate.js +232 -99
- package/lib/app/migrate_legacy.d.ts +2 -2
- package/lib/app/migrate_legacy.js +16 -13
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/buildAccount.d.ts +1 -2
- package/lib/buildAccount.js +11 -10
- package/lib/commonOpts.d.ts +4 -7
- package/lib/commonOpts.js +47 -19
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +39 -60
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -45
- package/lib/constants.d.ts +33 -0
- package/lib/constants.js +34 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +14 -40
- package/lib/doctor/Diagnosis.js +10 -11
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
- package/lib/doctor/DiagnosticInfoBuilder.js +10 -10
- package/lib/doctor/Doctor.js +45 -49
- package/lib/errorHandlers/index.js +13 -7
- package/lib/errorHandlers/suppressError.js +18 -26
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -6
- package/lib/hasFeature.d.ts +3 -1
- package/lib/interpolation.d.ts +2 -3
- package/lib/lang.d.ts +2 -3
- package/lib/marketplaceValidate.d.ts +12 -2
- package/lib/marketplaceValidate.js +22 -29
- package/lib/mcp/setup.d.ts +21 -0
- package/lib/mcp/setup.js +218 -0
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +3 -3
- package/lib/middleware/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +32 -2
- package/lib/middleware/fireAlarmMiddleware.d.ts +2 -2
- package/lib/middleware/fireAlarmMiddleware.js +12 -24
- package/lib/middleware/yargsChecksMiddleware.js +2 -2
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/oauth.js +1 -2
- package/lib/process.js +1 -2
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- package/lib/projects/ProjectLogsManager.d.ts +1 -1
- package/lib/projects/ProjectLogsManager.js +16 -21
- package/lib/projects/add/legacyAddComponent.d.ts +5 -0
- package/lib/projects/add/legacyAddComponent.js +48 -0
- package/lib/projects/add/v3AddComponent.d.ts +8 -0
- package/lib/projects/add/v3AddComponent.js +85 -0
- package/lib/projects/buildAndDeploy.js +46 -42
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -0
- package/lib/projects/config.d.ts +9 -0
- package/lib/projects/config.js +79 -0
- package/lib/projects/create/index.d.ts +23 -0
- package/lib/projects/create/index.js +33 -0
- package/lib/projects/create/legacy.d.ts +6 -0
- package/lib/projects/{create.js → create/legacy.js} +23 -15
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/ensureProjectExists.d.ts +11 -0
- package/lib/projects/ensureProjectExists.js +97 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/{DevServerManager.d.ts → projects/localDev/DevServerManager.d.ts} +1 -1
- package/lib/{DevServerManager.js → projects/localDev/DevServerManager.js} +6 -6
- package/lib/projects/localDev/DevServerManagerV2.d.ts +22 -0
- package/lib/{DevServerManagerV2.js → projects/localDev/DevServerManagerV2.js} +22 -19
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/{LocalDevManager.d.ts → projects/localDev/LocalDevManager.d.ts} +1 -1
- package/lib/{LocalDevManager.js → projects/localDev/LocalDevManager.js} +57 -83
- package/lib/projects/localDev/LocalDevProcess.d.ts +34 -0
- package/lib/projects/localDev/LocalDevProcess.js +201 -0
- package/lib/projects/localDev/LocalDevState.d.ts +50 -0
- package/lib/projects/localDev/LocalDevState.js +119 -0
- package/lib/projects/localDev/LocalDevWatcher.d.ts +10 -0
- package/lib/projects/localDev/LocalDevWatcher.js +53 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +20 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +131 -0
- package/lib/{localDev.d.ts → projects/localDev/helpers.d.ts} +6 -4
- package/lib/{localDev.js → projects/localDev/helpers.js} +127 -114
- package/lib/projects/ui.d.ts +1 -0
- package/lib/projects/ui.js +15 -0
- package/lib/projects/upload.d.ts +17 -2
- package/lib/projects/upload.js +74 -50
- package/lib/projects/urls.d.ts +4 -0
- package/lib/projects/urls.js +23 -1
- package/lib/projects/watch.d.ts +1 -1
- package/lib/projects/watch.js +21 -18
- package/lib/prompts/accountNamePrompt.js +16 -13
- package/lib/prompts/accountsPrompt.js +1 -2
- package/lib/prompts/cmsFieldPrompt.js +1 -2
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createApiSamplePrompt.js +4 -5
- package/lib/prompts/createFunctionPrompt.js +13 -14
- package/lib/prompts/createModulePrompt.js +8 -9
- package/lib/prompts/createProjectPrompt.d.ts +20 -4
- package/lib/prompts/createProjectPrompt.js +43 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/createTemplatePrompt.js +1 -2
- package/lib/prompts/downloadProjectPrompt.js +3 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -25
- package/lib/prompts/previewPrompt.js +5 -6
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -8
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +15 -16
- package/lib/prompts/projectNamePrompt.js +5 -6
- package/lib/prompts/projectsLogsPrompt.js +3 -2
- package/lib/prompts/promptUtils.d.ts +4 -2
- package/lib/prompts/promptUtils.js +3 -1
- package/lib/prompts/sandboxesPrompt.js +5 -6
- package/lib/prompts/secretPrompt.js +2 -3
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/selectHubDBTablePrompt.js +11 -8
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -9
- package/lib/prompts/setAsDefaultAccountPrompt.js +11 -2
- package/lib/prompts/uploadPrompt.js +4 -5
- package/lib/sandboxSync.js +15 -14
- package/lib/sandboxes.js +12 -13
- package/lib/serverlessLogs.js +4 -6
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/boxen.d.ts +5 -0
- package/lib/ui/boxen.js +30 -0
- package/lib/ui/git.js +8 -9
- package/lib/ui/index.d.ts +3 -2
- package/lib/ui/index.js +15 -17
- package/lib/ui/logger.d.ts +10 -0
- package/lib/ui/logger.js +15 -0
- package/lib/ui/serverlessFunctionLogs.js +2 -3
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +5 -1
- package/lib/yargsUtils.js +6 -0
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.js +18 -0
- package/mcp-server/tools/index.d.ts +2 -0
- package/mcp-server/tools/index.js +19 -0
- package/mcp-server/tools/project/AddFeatureToProject.d.ts +29 -0
- package/mcp-server/tools/project/AddFeatureToProject.js +85 -0
- package/mcp-server/tools/project/CreateProjectTool.d.ts +35 -0
- package/mcp-server/tools/project/CreateProjectTool.js +104 -0
- package/mcp-server/tools/project/DeployProject.d.ts +20 -0
- package/mcp-server/tools/project/DeployProject.js +50 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +17 -0
- package/mcp-server/tools/project/GuidedWalkthroughTool.js +58 -0
- package/mcp-server/tools/project/UploadProjectTools.d.ts +17 -0
- package/mcp-server/tools/project/UploadProjectTools.js +35 -0
- package/mcp-server/tools/project/ValidateProjectTool.d.ts +17 -0
- package/mcp-server/tools/project/ValidateProjectTool.js +35 -0
- package/mcp-server/tools/project/constants.d.ts +3 -0
- package/mcp-server/tools/project/constants.js +13 -0
- package/mcp-server/types.d.ts +14 -0
- package/mcp-server/types.js +17 -0
- package/mcp-server/utils/command.d.ts +3 -0
- package/mcp-server/utils/command.js +16 -0
- package/mcp-server/utils/content.d.ts +3 -0
- package/mcp-server/utils/content.js +21 -0
- package/mcp-server/utils/project.d.ts +5 -0
- package/mcp-server/utils/project.js +17 -0
- package/package.json +25 -17
- package/types/Cms.d.ts +30 -0
- package/types/Cms.js +2 -0
- package/types/LocalDev.d.ts +35 -0
- package/types/LocalDev.js +2 -0
- package/types/Projects.d.ts +19 -2
- package/types/Prompts.d.ts +0 -7
- package/types/Yargs.d.ts +14 -11
- package/lib/DevServerManagerV2.d.ts +0 -33
- package/lib/LocalDevManagerV2.d.ts +0 -64
- package/lib/LocalDevManagerV2.js +0 -377
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/index.d.ts +0 -20
- package/lib/projects/index.js +0 -194
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -40
package/api/migrate.d.ts
CHANGED
|
@@ -10,10 +10,14 @@ interface BaseMigrationApp {
|
|
|
10
10
|
}
|
|
11
11
|
export interface MigratableApp extends BaseMigrationApp {
|
|
12
12
|
isMigratable: true;
|
|
13
|
+
unmigratableReason?: undefined;
|
|
13
14
|
}
|
|
15
|
+
export declare const CLI_UNMIGRATABLE_REASONS: {
|
|
16
|
+
readonly PART_OF_PROJECT_ALREADY: "PART_OF_PROJECT_ALREADY";
|
|
17
|
+
};
|
|
14
18
|
export interface UnmigratableApp extends BaseMigrationApp {
|
|
15
19
|
isMigratable: false;
|
|
16
|
-
unmigratableReason: keyof typeof UNMIGRATABLE_REASONS;
|
|
20
|
+
unmigratableReason: keyof typeof UNMIGRATABLE_REASONS | keyof typeof CLI_UNMIGRATABLE_REASONS;
|
|
17
21
|
}
|
|
18
22
|
export type MigrationApp = MigratableApp | UnmigratableApp;
|
|
19
23
|
export interface ListAppsResponse {
|
|
@@ -48,13 +52,19 @@ export interface MigrationSuccess extends MigrationBaseStatus {
|
|
|
48
52
|
status: typeof MIGRATION_STATUS.SUCCESS;
|
|
49
53
|
buildId: number;
|
|
50
54
|
}
|
|
55
|
+
interface ComponentError {
|
|
56
|
+
componentType: string;
|
|
57
|
+
developerSymbol?: string;
|
|
58
|
+
errorMessage: string;
|
|
59
|
+
}
|
|
51
60
|
export interface MigrationFailed extends MigrationBaseStatus {
|
|
52
61
|
status: typeof MIGRATION_STATUS.FAILURE;
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
projectErrorDetail: string;
|
|
63
|
+
componentErrors: ComponentError[];
|
|
55
64
|
}
|
|
56
65
|
export type MigrationStatus = MigrationInProgress | MigrationInputRequired | MigrationSuccess | MigrationFailed;
|
|
57
|
-
export declare function
|
|
66
|
+
export declare function isMigrationStatus(error: unknown): error is MigrationStatus;
|
|
67
|
+
export declare function listAppsForMigration(accountId: number, platformVersion: string): HubSpotPromise<ListAppsResponse>;
|
|
58
68
|
export declare function initializeMigration(accountId: number, applicationId: number, platformVersion: string): HubSpotPromise<InitializeMigrationResponse>;
|
|
59
69
|
export declare function continueMigration(portalId: number, migrationId: number, componentUids: Record<string, string>, projectName: string): HubSpotPromise<ContinueMigrationResponse>;
|
|
60
70
|
export declare function checkMigrationStatusV2(accountId: number, id: number): HubSpotPromise<MigrationStatus>;
|
package/api/migrate.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLI_UNMIGRATABLE_REASONS = void 0;
|
|
4
|
+
exports.isMigrationStatus = isMigrationStatus;
|
|
3
5
|
exports.listAppsForMigration = listAppsForMigration;
|
|
4
6
|
exports.initializeMigration = initializeMigration;
|
|
5
7
|
exports.continueMigration = continueMigration;
|
|
@@ -7,9 +9,21 @@ exports.checkMigrationStatusV2 = checkMigrationStatusV2;
|
|
|
7
9
|
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
8
10
|
const http_1 = require("@hubspot/local-dev-lib/http");
|
|
9
11
|
const MIGRATIONS_API_PATH_V2 = 'dfs/migrations/v2';
|
|
10
|
-
|
|
12
|
+
exports.CLI_UNMIGRATABLE_REASONS = {
|
|
13
|
+
PART_OF_PROJECT_ALREADY: 'PART_OF_PROJECT_ALREADY',
|
|
14
|
+
};
|
|
15
|
+
function isMigrationStatus(error) {
|
|
16
|
+
return (typeof error === 'object' &&
|
|
17
|
+
error !== null &&
|
|
18
|
+
'id' in error &&
|
|
19
|
+
'status' in error);
|
|
20
|
+
}
|
|
21
|
+
async function listAppsForMigration(accountId, platformVersion) {
|
|
11
22
|
return http_1.http.get(accountId, {
|
|
12
23
|
url: `${MIGRATIONS_API_PATH_V2}/list-apps`,
|
|
24
|
+
params: {
|
|
25
|
+
platformVersion: mapPlatformVersionToEnum(platformVersion),
|
|
26
|
+
},
|
|
13
27
|
});
|
|
14
28
|
}
|
|
15
29
|
function mapPlatformVersionToEnum(platformVersion) {
|
|
@@ -37,7 +51,7 @@ async function continueMigration(portalId, migrationId, componentUids, projectNa
|
|
|
37
51
|
},
|
|
38
52
|
});
|
|
39
53
|
}
|
|
40
|
-
function checkMigrationStatusV2(accountId, id) {
|
|
54
|
+
async function checkMigrationStatusV2(accountId, id) {
|
|
41
55
|
return http_1.http.get(accountId, {
|
|
42
56
|
url: `${MIGRATIONS_API_PATH_V2}/migrations/${id}/status`,
|
|
43
57
|
});
|
package/bin/cli.js
CHANGED
|
@@ -1,79 +1,85 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
8
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
9
|
+
const index_1 = require("../lib/errorHandlers/index");
|
|
10
|
+
const commonOpts_1 = require("../lib/commonOpts");
|
|
11
|
+
const usageTracking_1 = require("../lib/usageTracking");
|
|
12
|
+
const exitCodes_1 = require("../lib/enums/exitCodes");
|
|
13
|
+
const configMiddleware_1 = require("../lib/middleware/configMiddleware");
|
|
14
|
+
const autoUpdateMiddleware_1 = require("../lib/middleware/autoUpdateMiddleware");
|
|
15
|
+
const gitMiddleware_1 = require("../lib/middleware/gitMiddleware");
|
|
16
|
+
const yargsChecksMiddleware_1 = require("../lib/middleware/yargsChecksMiddleware");
|
|
17
|
+
const requestMiddleware_1 = require("../lib/middleware/requestMiddleware");
|
|
18
|
+
const fireAlarmMiddleware_1 = require("../lib/middleware/fireAlarmMiddleware");
|
|
19
|
+
const remove_1 = __importDefault(require("../commands/remove"));
|
|
20
|
+
const init_1 = __importDefault(require("../commands/init"));
|
|
21
|
+
const logs_1 = __importDefault(require("../commands/logs"));
|
|
22
|
+
const lint_1 = __importDefault(require("../commands/lint"));
|
|
23
|
+
const hubdb_1 = __importDefault(require("../commands/hubdb"));
|
|
24
|
+
const watch_1 = __importDefault(require("../commands/watch"));
|
|
25
|
+
const auth_1 = __importDefault(require("../commands/auth"));
|
|
26
|
+
const upload_1 = __importDefault(require("../commands/upload"));
|
|
27
|
+
const create_1 = __importDefault(require("../commands/create"));
|
|
28
|
+
const fetch_1 = __importDefault(require("../commands/fetch"));
|
|
29
|
+
const filemanager_1 = __importDefault(require("../commands/filemanager"));
|
|
30
|
+
const secret_1 = __importDefault(require("../commands/secret"));
|
|
31
|
+
const customObject_1 = __importDefault(require("../commands/customObject"));
|
|
32
|
+
const function_1 = __importDefault(require("../commands/function"));
|
|
33
|
+
const list_1 = __importDefault(require("../commands/list"));
|
|
34
|
+
const open_1 = __importDefault(require("../commands/open"));
|
|
35
|
+
const mv_1 = __importDefault(require("../commands/mv"));
|
|
36
|
+
const project_1 = __importDefault(require("../commands/project"));
|
|
37
|
+
const theme_1 = __importDefault(require("../commands/theme"));
|
|
38
|
+
const module_1 = __importDefault(require("../commands/module"));
|
|
39
|
+
const config_1 = __importDefault(require("../commands/config"));
|
|
40
|
+
const account_1 = __importDefault(require("../commands/account"));
|
|
41
|
+
const sandbox_1 = __importDefault(require("../commands/sandbox"));
|
|
42
|
+
const cms_1 = __importDefault(require("../commands/cms"));
|
|
43
|
+
const feedback_1 = __importDefault(require("../commands/feedback"));
|
|
44
|
+
const doctor_1 = __importDefault(require("../commands/doctor"));
|
|
45
|
+
const completion_1 = __importDefault(require("../commands/completion"));
|
|
46
|
+
const app_1 = __importDefault(require("../commands/app"));
|
|
47
|
+
const getStarted_1 = __importDefault(require("../commands/getStarted"));
|
|
48
|
+
const mcp_1 = __importDefault(require("../commands/mcp"));
|
|
49
|
+
function getTerminalWidth() {
|
|
50
|
+
const width = yargs_1.default.terminalWidth();
|
|
46
51
|
if (width >= 100)
|
|
47
52
|
return width * 0.9;
|
|
48
53
|
return width;
|
|
49
|
-
}
|
|
50
|
-
|
|
54
|
+
}
|
|
55
|
+
function handleFailure(msg, err, yargs) {
|
|
51
56
|
if (msg) {
|
|
52
|
-
logger.error(msg);
|
|
57
|
+
logger_1.logger.error(msg);
|
|
53
58
|
}
|
|
54
59
|
else if (err) {
|
|
55
|
-
logError(err);
|
|
60
|
+
(0, index_1.logError)(err);
|
|
56
61
|
}
|
|
57
62
|
if (msg === null) {
|
|
58
63
|
yargs.showHelp('log');
|
|
59
|
-
process.exit(EXIT_CODES.SUCCESS);
|
|
64
|
+
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
60
65
|
}
|
|
61
66
|
else {
|
|
62
|
-
process.exit(EXIT_CODES.ERROR);
|
|
67
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
63
68
|
}
|
|
64
|
-
}
|
|
65
|
-
const argv =
|
|
69
|
+
}
|
|
70
|
+
const argv = yargs_1.default
|
|
66
71
|
.usage('The command line interface to interact with HubSpot.')
|
|
67
72
|
// loadConfigMiddleware loads the new hidden config for all commands
|
|
68
73
|
.middleware([
|
|
69
|
-
setLogLevel,
|
|
70
|
-
setRequestHeaders,
|
|
71
|
-
handleDeprecatedEnvVariables,
|
|
72
|
-
loadConfigMiddleware,
|
|
73
|
-
injectAccountIdMiddleware,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
commonOpts_1.setLogLevel,
|
|
75
|
+
requestMiddleware_1.setRequestHeaders,
|
|
76
|
+
configMiddleware_1.handleDeprecatedEnvVariables,
|
|
77
|
+
configMiddleware_1.loadConfigMiddleware,
|
|
78
|
+
configMiddleware_1.injectAccountIdMiddleware,
|
|
79
|
+
autoUpdateMiddleware_1.autoUpdateCLI,
|
|
80
|
+
gitMiddleware_1.checkAndWarnGitInclusionMiddleware,
|
|
81
|
+
configMiddleware_1.validateAccountOptions,
|
|
82
|
+
fireAlarmMiddleware_1.checkFireAlarms,
|
|
77
83
|
])
|
|
78
84
|
.exitProcess(false)
|
|
79
85
|
.fail(handleFailure)
|
|
@@ -89,47 +95,46 @@ const argv = yargs
|
|
|
89
95
|
hidden: true,
|
|
90
96
|
type: 'boolean',
|
|
91
97
|
})
|
|
92
|
-
.check(performChecks)
|
|
93
|
-
.command(
|
|
94
|
-
.command(
|
|
95
|
-
.command(
|
|
96
|
-
.command(
|
|
97
|
-
.command(
|
|
98
|
-
.command(
|
|
99
|
-
.command(
|
|
100
|
-
.command(
|
|
101
|
-
.command(
|
|
102
|
-
.command(
|
|
103
|
-
.command(
|
|
104
|
-
.command(
|
|
105
|
-
.command(
|
|
106
|
-
.command(
|
|
107
|
-
.command(
|
|
108
|
-
.command(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
.command(
|
|
113
|
-
.command(
|
|
114
|
-
.command(
|
|
115
|
-
.command(
|
|
116
|
-
.command(
|
|
117
|
-
.command(
|
|
118
|
-
.command(
|
|
119
|
-
.command(
|
|
120
|
-
.command(
|
|
121
|
-
.command(
|
|
122
|
-
.command(
|
|
123
|
-
.command(appCommand)
|
|
98
|
+
.check(yargsChecksMiddleware_1.performChecks)
|
|
99
|
+
.command(auth_1.default)
|
|
100
|
+
.command(init_1.default)
|
|
101
|
+
.command(logs_1.default)
|
|
102
|
+
.command(cms_1.default)
|
|
103
|
+
.command(lint_1.default)
|
|
104
|
+
.command(hubdb_1.default)
|
|
105
|
+
.command(watch_1.default)
|
|
106
|
+
.command(remove_1.default)
|
|
107
|
+
.command(upload_1.default)
|
|
108
|
+
.command(create_1.default)
|
|
109
|
+
.command(fetch_1.default)
|
|
110
|
+
.command(filemanager_1.default)
|
|
111
|
+
.command(secret_1.default)
|
|
112
|
+
.command(customObject_1.default)
|
|
113
|
+
.command(function_1.default)
|
|
114
|
+
.command(list_1.default)
|
|
115
|
+
.command(open_1.default)
|
|
116
|
+
.command(mv_1.default)
|
|
117
|
+
.command(project_1.default)
|
|
118
|
+
.command(theme_1.default)
|
|
119
|
+
.command(module_1.default)
|
|
120
|
+
.command(config_1.default)
|
|
121
|
+
.command(account_1.default)
|
|
122
|
+
.command(sandbox_1.default)
|
|
123
|
+
.command(feedback_1.default)
|
|
124
|
+
.command(doctor_1.default)
|
|
125
|
+
.command(completion_1.default)
|
|
126
|
+
.command(app_1.default)
|
|
127
|
+
.command(getStarted_1.default)
|
|
128
|
+
.command(mcp_1.default)
|
|
124
129
|
.help()
|
|
125
130
|
.alias('h', 'help')
|
|
126
131
|
.recommendCommands()
|
|
127
132
|
.demandCommand(1, '')
|
|
128
133
|
.wrap(getTerminalWidth())
|
|
129
134
|
.strict().argv;
|
|
130
|
-
if (argv.help) {
|
|
131
|
-
trackHelpUsage(getCommandName(argv));
|
|
135
|
+
if ('help' in argv && argv.help !== undefined) {
|
|
136
|
+
(0, usageTracking_1.trackHelpUsage)((0, commonOpts_1.getCommandName)(argv));
|
|
132
137
|
}
|
|
133
|
-
if (argv.convertFields) {
|
|
134
|
-
trackConvertFieldsUsage(getCommandName(argv));
|
|
138
|
+
if ('convertFields' in argv && argv.convertFields !== undefined) {
|
|
139
|
+
(0, usageTracking_1.trackConvertFieldsUsage)((0, commonOpts_1.getCommandName)(argv));
|
|
135
140
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const describe: string;
|
|
4
|
-
export declare const command = "auth";
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
type AccountAuthArgs = CommonArgs & ConfigArgs & {
|
|
6
3
|
disableTracking?: boolean;
|
|
4
|
+
} & {
|
|
5
|
+
personalAccessKey?: string;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
7
|
+
declare const accountAuthCommand: YargsCommandModule<unknown, AccountAuthArgs>;
|
|
8
|
+
export default accountAuthCommand;
|
package/commands/account/auth.js
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.command = exports.describe = void 0;
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
3
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
7
4
|
const migrate_1 = require("@hubspot/local-dev-lib/config/migrate");
|
|
8
5
|
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
9
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
6
|
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
11
7
|
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
12
8
|
const text_1 = require("@hubspot/local-dev-lib/text");
|
|
13
9
|
const auth_1 = require("@hubspot/local-dev-lib/constants/auth");
|
|
14
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
15
10
|
const configMigrate_1 = require("../../lib/configMigrate");
|
|
16
11
|
const process_1 = require("../../lib/process");
|
|
17
12
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
18
|
-
const lang_1 = require("../../lib/lang");
|
|
19
13
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
20
14
|
const personalAccessKeyPrompt_1 = require("../../lib/prompts/personalAccessKeyPrompt");
|
|
21
15
|
const accountNamePrompt_1 = require("../../lib/prompts/accountNamePrompt");
|
|
22
16
|
const setAsDefaultAccountPrompt_1 = require("../../lib/prompts/setAsDefaultAccountPrompt");
|
|
23
17
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
24
|
-
const usageTracking_2 = require("../../lib/usageTracking");
|
|
25
18
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
26
19
|
const ui_1 = require("../../lib/ui");
|
|
20
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
21
|
+
const en_1 = require("../../lang/en");
|
|
22
|
+
const logger_1 = require("../../lib/ui/logger");
|
|
27
23
|
const TRACKING_STATUS = {
|
|
28
24
|
STARTED: 'started',
|
|
29
25
|
ERROR: 'error',
|
|
30
26
|
COMPLETE: 'complete',
|
|
31
27
|
};
|
|
32
|
-
|
|
28
|
+
const authType = auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value;
|
|
29
|
+
async function updateConfigWithNewAccount(env, configAlreadyExists, providedPersonalAccessKey, accountId) {
|
|
33
30
|
try {
|
|
34
|
-
const { personalAccessKey } =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
const { personalAccessKey } = providedPersonalAccessKey
|
|
32
|
+
? { personalAccessKey: providedPersonalAccessKey }
|
|
33
|
+
: await (0, personalAccessKeyPrompt_1.personalAccessKeyPrompt)({
|
|
34
|
+
env,
|
|
35
|
+
account: accountId,
|
|
36
|
+
});
|
|
38
37
|
const token = await (0, personalAccessKey_1.getAccessToken)(personalAccessKey, env);
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
const defaultAccountName = token.hubName
|
|
39
|
+
? (0, text_1.toKebabCase)(token.hubName)
|
|
40
|
+
: undefined;
|
|
41
|
+
const accountName = configAlreadyExists
|
|
41
42
|
? undefined
|
|
42
|
-
: (await (0, accountNamePrompt_1.cliAccountNamePrompt)(
|
|
43
|
-
const updatedConfig = await (0, personalAccessKey_1.updateConfigWithAccessToken)(token, personalAccessKey, env,
|
|
43
|
+
: (await (0, accountNamePrompt_1.cliAccountNamePrompt)(defaultAccountName)).name;
|
|
44
|
+
const updatedConfig = await (0, personalAccessKey_1.updateConfigWithAccessToken)(token, personalAccessKey, env, accountName, !configAlreadyExists);
|
|
44
45
|
if (!updatedConfig)
|
|
45
46
|
return null;
|
|
46
|
-
if
|
|
47
|
-
|
|
47
|
+
// Can happen if the user is re-authenticating an account with no name
|
|
48
|
+
if (configAlreadyExists && !updatedConfig.name) {
|
|
49
|
+
updatedConfig.name = (await (0, accountNamePrompt_1.cliAccountNamePrompt)(defaultAccountName)).name;
|
|
48
50
|
(0, config_1.updateAccountConfig)({
|
|
49
51
|
...updatedConfig,
|
|
50
52
|
});
|
|
@@ -53,91 +55,81 @@ async function updateConfig(env, doesConfigExist, disableTracking, authType, acc
|
|
|
53
55
|
return updatedConfig;
|
|
54
56
|
}
|
|
55
57
|
catch (e) {
|
|
56
|
-
if (!disableTracking) {
|
|
57
|
-
await (0, usageTracking_1.trackAuthAction)('account-auth', authType, TRACKING_STATUS.ERROR);
|
|
58
|
-
}
|
|
59
58
|
(0, index_1.debugError)(e);
|
|
60
59
|
return null;
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
|
|
64
|
-
exports.command = 'auth';
|
|
65
|
-
async function handler(args) {
|
|
66
|
-
const { providedAccountId, disableTracking } = args;
|
|
67
|
-
const authType = auth_1.PERSONAL_ACCESS_KEY_AUTH_METHOD.value;
|
|
62
|
+
async function handleConfigMigration() {
|
|
68
63
|
const deprecatedConfigExists = (0, migrate_1.configFileExists)(false);
|
|
69
64
|
const globalConfigExists = (0, migrate_1.configFileExists)(true);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}, providedAccountId);
|
|
82
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
65
|
+
// No deprecated config exists, so no migration is needed
|
|
66
|
+
if (!deprecatedConfigExists) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
// Global config exists, so we need to merge the deprecated config with the global config
|
|
70
|
+
if (globalConfigExists) {
|
|
71
|
+
try {
|
|
72
|
+
const mergeConfirmed = await (0, configMigrate_1.handleMerge)();
|
|
73
|
+
if (!mergeConfirmed) {
|
|
74
|
+
logger_1.uiLogger.log('');
|
|
75
|
+
logger_1.uiLogger.log(en_1.commands.account.subcommands.auth.errors.mergeNotConfirmed);
|
|
83
76
|
}
|
|
77
|
+
return mergeConfirmed;
|
|
84
78
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
97
|
-
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
(0, index_2.logError)(error);
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Global config does not exist, so we only need to migrate the deprecated config
|
|
85
|
+
try {
|
|
86
|
+
const migrationConfirmed = await (0, configMigrate_1.handleMigration)();
|
|
87
|
+
if (!migrationConfirmed) {
|
|
88
|
+
logger_1.uiLogger.log('');
|
|
89
|
+
logger_1.uiLogger.log(en_1.commands.account.subcommands.auth.errors.migrationNotConfirmed);
|
|
98
90
|
}
|
|
91
|
+
return migrationConfirmed;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
(0, index_2.logError)(error);
|
|
95
|
+
return false;
|
|
99
96
|
}
|
|
97
|
+
}
|
|
98
|
+
const describe = en_1.commands.account.subcommands.auth.describe;
|
|
99
|
+
const command = 'auth';
|
|
100
|
+
async function handler(args) {
|
|
101
|
+
const { providedAccountId, disableTracking, personalAccessKey: providedPersonalAccessKey, } = args;
|
|
100
102
|
if (!disableTracking) {
|
|
101
103
|
(0, usageTracking_1.trackCommandUsage)('account-auth', {}, providedAccountId);
|
|
102
104
|
await (0, usageTracking_1.trackAuthAction)('account-auth', authType, TRACKING_STATUS.STARTED);
|
|
103
105
|
}
|
|
104
|
-
const
|
|
106
|
+
const configMigrationSuccess = await handleConfigMigration();
|
|
107
|
+
if (!configMigrationSuccess) {
|
|
108
|
+
await (0, usageTracking_1.trackAuthAction)('account-auth', authType, TRACKING_STATUS.ERROR);
|
|
109
|
+
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
110
|
+
}
|
|
105
111
|
const configAlreadyExists = (0, migrate_1.configFileExists)(true);
|
|
106
112
|
if (!configAlreadyExists) {
|
|
107
113
|
(0, config_1.createEmptyConfigFile)({}, true);
|
|
108
114
|
}
|
|
109
115
|
(0, config_1.loadConfig)('');
|
|
110
116
|
(0, process_1.handleExit)(config_1.deleteEmptyConfigFile);
|
|
111
|
-
const updatedConfig = await
|
|
117
|
+
const updatedConfig = await updateConfigWithNewAccount(args.qa ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD, configAlreadyExists, providedPersonalAccessKey, providedAccountId);
|
|
112
118
|
if (!updatedConfig) {
|
|
113
|
-
|
|
119
|
+
if (!disableTracking) {
|
|
120
|
+
await (0, usageTracking_1.trackAuthAction)('account-auth', authType, TRACKING_STATUS.ERROR);
|
|
121
|
+
}
|
|
122
|
+
logger_1.uiLogger.error(en_1.commands.account.subcommands.auth.errors.failedToUpdateConfig);
|
|
114
123
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
115
124
|
}
|
|
116
|
-
const { name } = updatedConfig;
|
|
117
125
|
const accountId = (0, getAccountIdentifier_1.getAccountIdentifier)(updatedConfig);
|
|
118
|
-
// If the config file was just created, we don't need to prompt the user to set as default
|
|
119
126
|
if (!configAlreadyExists) {
|
|
120
|
-
logger_1.
|
|
121
|
-
logger_1.
|
|
122
|
-
|
|
123
|
-
}));
|
|
124
|
-
logger_1.logger.success((0, lang_1.i18n)('commands.account.subcommands.auth.success.configFileUpdated', {
|
|
125
|
-
account: name || accountId || '',
|
|
126
|
-
}));
|
|
127
|
+
logger_1.uiLogger.log('');
|
|
128
|
+
logger_1.uiLogger.success(en_1.commands.account.subcommands.auth.success.configFileCreated((0, migrate_1.getConfigPath)('', true)));
|
|
129
|
+
logger_1.uiLogger.success(en_1.commands.account.subcommands.auth.success.configFileUpdated(accountId));
|
|
127
130
|
}
|
|
128
131
|
else {
|
|
129
|
-
|
|
130
|
-
logger_1.logger.log('');
|
|
131
|
-
if (setAsDefault) {
|
|
132
|
-
logger_1.logger.success((0, lang_1.i18n)(`lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccount`, {
|
|
133
|
-
accountName: name,
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
logger_1.logger.info((0, lang_1.i18n)(`lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault`, {
|
|
138
|
-
accountName: (0, config_1.getConfigDefaultAccount)(),
|
|
139
|
-
}));
|
|
140
|
-
}
|
|
132
|
+
await (0, setAsDefaultAccountPrompt_1.setAsDefaultAccountPrompt)(updatedConfig.name);
|
|
141
133
|
}
|
|
142
134
|
(0, ui_1.uiFeatureHighlight)([
|
|
143
135
|
'helpCommand',
|
|
@@ -149,10 +141,10 @@ async function handler(args) {
|
|
|
149
141
|
}
|
|
150
142
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
151
143
|
}
|
|
152
|
-
function
|
|
144
|
+
function accountAuthBuilder(yargs) {
|
|
153
145
|
yargs.options({
|
|
154
146
|
account: {
|
|
155
|
-
describe:
|
|
147
|
+
describe: en_1.commands.account.subcommands.auth.options.account,
|
|
156
148
|
type: 'string',
|
|
157
149
|
alias: 'a',
|
|
158
150
|
},
|
|
@@ -161,8 +153,23 @@ function builder(yargs) {
|
|
|
161
153
|
hidden: true,
|
|
162
154
|
default: false,
|
|
163
155
|
},
|
|
156
|
+
'personal-access-key': {
|
|
157
|
+
describe: en_1.commands.account.subcommands.auth.options.personalAccessKey,
|
|
158
|
+
type: 'string',
|
|
159
|
+
hidden: false,
|
|
160
|
+
alias: 'pak',
|
|
161
|
+
},
|
|
164
162
|
});
|
|
165
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
166
|
-
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
167
163
|
return yargs;
|
|
168
164
|
}
|
|
165
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(accountAuthBuilder, command, en_1.commands.account.subcommands.auth.verboseDescribe, {
|
|
166
|
+
useGlobalOptions: true,
|
|
167
|
+
useTestingOptions: true,
|
|
168
|
+
});
|
|
169
|
+
const accountAuthCommand = {
|
|
170
|
+
command,
|
|
171
|
+
describe,
|
|
172
|
+
handler,
|
|
173
|
+
builder,
|
|
174
|
+
};
|
|
175
|
+
exports.default = accountAuthCommand;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CommonArgs, ConfigArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "clean";
|
|
4
|
-
export declare const describe: string;
|
|
1
|
+
import { CommonArgs, ConfigArgs, YargsCommandModule } from '../../types/Yargs';
|
|
5
2
|
type AccountCleanArgs = CommonArgs & ConfigArgs & {
|
|
6
3
|
qa?: boolean;
|
|
7
4
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export {};
|
|
5
|
+
declare const accountCleanCommand: YargsCommandModule<unknown, AccountCleanArgs>;
|
|
6
|
+
export default accountCleanCommand;
|
|
@@ -3,9 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.describe = exports.command = void 0;
|
|
7
|
-
exports.handler = handler;
|
|
8
|
-
exports.builder = builder;
|
|
9
6
|
const fs_1 = __importDefault(require("fs"));
|
|
10
7
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
11
8
|
const personalAccessKey_1 = require("@hubspot/local-dev-lib/personalAccessKey");
|
|
@@ -16,15 +13,15 @@ const config_2 = require("@hubspot/local-dev-lib/config");
|
|
|
16
13
|
const usageTracking_1 = require("../../lib/usageTracking");
|
|
17
14
|
const lang_1 = require("../../lib/lang");
|
|
18
15
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
19
|
-
const commonOpts_1 = require("../../lib/commonOpts");
|
|
20
16
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
21
17
|
const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
22
18
|
const table_1 = require("../../lib/ui/table");
|
|
23
19
|
const SpinniesManager_1 = __importDefault(require("../../lib/ui/SpinniesManager"));
|
|
24
20
|
const ui_1 = require("../../lib/ui");
|
|
25
21
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
23
|
+
const command = 'clean';
|
|
24
|
+
const describe = (0, lang_1.i18n)(`commands.account.subcommands.clean.describe`);
|
|
28
25
|
async function handler(args) {
|
|
29
26
|
const { qa } = args;
|
|
30
27
|
(0, usageTracking_1.trackCommandUsage)('accounts-clean');
|
|
@@ -131,9 +128,19 @@ async function handler(args) {
|
|
|
131
128
|
logger_1.logger.log('');
|
|
132
129
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
133
130
|
}
|
|
134
|
-
function
|
|
135
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
136
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
131
|
+
function accountCleanBuilder(yargs) {
|
|
137
132
|
yargs.example([['$0 accounts clean']]);
|
|
138
133
|
return yargs;
|
|
139
134
|
}
|
|
135
|
+
const builder = (0, yargsUtils_1.makeYargsBuilder)(accountCleanBuilder, command, describe, {
|
|
136
|
+
useGlobalOptions: true,
|
|
137
|
+
useConfigOptions: true,
|
|
138
|
+
useTestingOptions: true,
|
|
139
|
+
});
|
|
140
|
+
const accountCleanCommand = {
|
|
141
|
+
command,
|
|
142
|
+
describe,
|
|
143
|
+
handler,
|
|
144
|
+
builder,
|
|
145
|
+
};
|
|
146
|
+
exports.default = accountCleanCommand;
|