@hubspot/cli 7.5.11-experimental.0 → 7.6.0-beta.1
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 +102 -95
- package/commands/account/auth.d.ts +5 -7
- package/commands/account/auth.js +74 -87
- 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 +1 -2
- package/commands/app/migrate.js +7 -8
- 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 -8
- package/commands/auth.d.ts +5 -7
- package/commands/auth.js +29 -28
- 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 -15
- package/commands/completion.d.ts +3 -1
- package/commands/completion.js +23 -12
- 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 -74
- 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 +18 -45
- package/commands/doctor.d.ts +6 -8
- package/commands/doctor.js +30 -21
- package/commands/feedback.d.ts +4 -1
- package/commands/feedback.js +38 -47
- package/commands/fetch.d.ts +12 -1
- package/commands/fetch.js +49 -33
- 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 -41
- 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 -10
- 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 +17 -10
- package/commands/hubdb/create.d.ts +4 -9
- package/commands/hubdb/create.js +17 -10
- package/commands/hubdb/delete.d.ts +4 -9
- package/commands/hubdb/delete.js +17 -10
- package/commands/hubdb/fetch.d.ts +4 -9
- package/commands/hubdb/fetch.js +17 -10
- 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 +23 -45
- package/commands/init.d.ts +3 -7
- package/commands/init.js +17 -8
- package/commands/lint.d.ts +6 -4
- package/commands/lint.js +42 -43
- package/commands/list.d.ts +3 -7
- package/commands/list.js +17 -11
- package/commands/logs.d.ts +10 -1
- package/commands/logs.js +53 -44
- package/commands/mcp/setup.d.ts +7 -0
- package/commands/mcp/setup.js +52 -0
- package/commands/mcp/start.d.ts +3 -0
- package/commands/mcp/start.js +77 -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 -29
- package/commands/module.d.ts +3 -1
- package/commands/module.js +23 -10
- package/commands/mv.d.ts +3 -7
- package/commands/mv.js +17 -11
- package/commands/open.d.ts +3 -7
- package/commands/open.js +17 -11
- package/commands/project/add.d.ts +5 -2
- package/commands/project/add.js +43 -80
- package/commands/project/cloneApp.d.ts +1 -1
- package/commands/project/cloneApp.js +2 -2
- package/commands/project/create.d.ts +2 -8
- package/commands/project/create.js +84 -55
- package/commands/project/deploy.d.ts +2 -0
- package/commands/project/deploy.js +67 -13
- package/commands/project/dev/deprecatedFlow.d.ts +8 -2
- package/commands/project/dev/deprecatedFlow.js +9 -1
- package/commands/project/dev/index.d.ts +1 -4
- package/commands/project/dev/index.js +88 -31
- package/commands/project/dev/unifiedFlow.d.ts +11 -2
- package/commands/project/dev/unifiedFlow.js +81 -41
- package/commands/project/listBuilds.js +2 -5
- package/commands/project/migrate.d.ts +1 -0
- 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 +1 -0
- package/commands/project/upload.js +22 -8
- package/commands/project/validate.d.ts +6 -0
- package/commands/project/validate.js +82 -0
- package/commands/project.js +4 -2
- package/commands/remove.d.ts +3 -7
- package/commands/remove.js +22 -22
- package/commands/sandbox/create.d.ts +4 -9
- package/commands/sandbox/create.js +18 -11
- package/commands/sandbox/delete.d.ts +4 -9
- package/commands/sandbox/delete.js +18 -11
- package/commands/sandbox.d.ts +3 -4
- package/commands/sandbox.js +18 -43
- package/commands/secret/addSecret.d.ts +4 -9
- package/commands/secret/addSecret.js +17 -10
- package/commands/secret/deleteSecret.d.ts +4 -9
- package/commands/secret/deleteSecret.js +17 -10
- package/commands/secret/listSecret.d.ts +4 -9
- package/commands/secret/listSecret.js +17 -10
- package/commands/secret/updateSecret.d.ts +4 -9
- package/commands/secret/updateSecret.js +17 -10
- package/commands/secret.d.ts +3 -4
- package/commands/secret.js +23 -48
- package/commands/testAccount/create.d.ts +6 -0
- package/commands/testAccount/create.js +100 -0
- package/commands/testAccount/createConfig.d.ts +10 -0
- package/commands/testAccount/createConfig.js +98 -0
- package/commands/testAccount/delete.d.ts +6 -0
- package/commands/testAccount/delete.js +48 -0
- package/commands/testAccount.d.ts +3 -0
- package/commands/testAccount.js +28 -0
- package/commands/theme/generate-selectors.d.ts +3 -7
- package/commands/theme/generate-selectors.js +20 -15
- package/commands/theme/marketplace-validate.d.ts +4 -9
- package/commands/theme/marketplace-validate.js +22 -17
- package/commands/theme/preview.d.ts +4 -9
- package/commands/theme/preview.js +32 -26
- package/commands/theme.d.ts +3 -4
- package/commands/theme.js +22 -47
- package/commands/upload.d.ts +12 -1
- package/commands/upload.js +116 -134
- package/commands/watch.d.ts +14 -1
- package/commands/watch.js +74 -75
- package/lang/en.d.ts +1135 -660
- package/lang/en.js +935 -471
- package/lang/en.lyaml +30 -213
- package/lib/accountTypes.js +1 -2
- package/lib/app/migrate.d.ts +23 -0
- package/lib/app/migrate.js +29 -6
- package/lib/app/migrate_legacy.js +7 -7
- package/lib/app/urls.d.ts +16 -0
- package/lib/app/urls.js +16 -0
- package/lib/commonOpts.d.ts +1 -3
- package/lib/commonOpts.js +1 -1
- package/lib/configMigrate.d.ts +2 -2
- package/lib/configMigrate.js +34 -55
- package/lib/configOptions.d.ts +4 -0
- package/lib/configOptions.js +41 -46
- package/lib/constants.d.ts +29 -0
- package/lib/constants.js +30 -1
- package/lib/dependencyManagement.d.ts +0 -5
- package/lib/dependencyManagement.js +13 -39
- package/lib/doctor/Doctor.js +3 -2
- package/lib/errorHandlers/index.js +7 -0
- package/lib/filesystem.d.ts +1 -1
- package/lib/generateSelectors.js +3 -5
- 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/autoUpdateMiddleware.d.ts +1 -0
- package/lib/middleware/autoUpdateMiddleware.js +89 -0
- package/lib/middleware/configMiddleware.js +23 -0
- package/lib/middleware/fireAlarmMiddleware.d.ts +2 -2
- package/lib/middleware/fireAlarmMiddleware.js +5 -3
- package/lib/npm.d.ts +9 -0
- package/lib/npm.js +36 -0
- package/lib/projectProfiles.d.ts +7 -0
- package/lib/projectProfiles.js +83 -0
- 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 +18 -3
- package/lib/projects/components.d.ts +2 -0
- package/lib/projects/components.js +82 -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} +20 -11
- package/lib/projects/create/v3.d.ts +27 -0
- package/lib/projects/create/v3.js +158 -0
- package/lib/projects/localDev/AppDevModeInterface.d.ts +30 -0
- package/lib/projects/localDev/AppDevModeInterface.js +215 -0
- package/lib/projects/localDev/DevServerManagerV2.d.ts +11 -22
- package/lib/projects/localDev/DevServerManagerV2.js +19 -15
- package/lib/projects/localDev/LocalDevLogger.d.ts +30 -0
- package/lib/projects/localDev/LocalDevLogger.js +159 -0
- package/lib/projects/localDev/LocalDevManager.js +12 -5
- 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/projects/localDev/helpers.d.ts +3 -2
- package/lib/projects/localDev/helpers.js +32 -2
- package/lib/projects/upload.d.ts +5 -1
- package/lib/projects/upload.js +60 -20
- package/lib/projects/urls.d.ts +3 -0
- package/lib/projects/urls.js +17 -1
- package/lib/prompts/createApiSamplePrompt.d.ts +2 -10
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +17 -0
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +96 -0
- package/lib/prompts/createProjectPrompt.d.ts +14 -5
- package/lib/prompts/createProjectPrompt.js +38 -13
- package/lib/prompts/createTemplatePrompt.d.ts +22 -4
- package/lib/prompts/installAppPrompt.d.ts +2 -0
- package/lib/prompts/installAppPrompt.js +45 -0
- package/lib/prompts/personalAccessKeyPrompt.js +35 -24
- package/lib/prompts/projectAddPrompt.d.ts +5 -1
- package/lib/prompts/projectAddPrompt.js +35 -7
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +6 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +6 -6
- package/lib/prompts/promptUtils.d.ts +4 -1
- package/lib/prompts/promptUtils.js +5 -1
- package/lib/prompts/selectAppPrompt.d.ts +2 -0
- package/lib/prompts/selectAppPrompt.js +40 -0
- package/lib/prompts/{selectPublicAppPrompt.d.ts → selectPublicAppForMigrationPrompt.d.ts} +1 -1
- package/lib/prompts/{selectPublicAppPrompt.js → selectPublicAppForMigrationPrompt.js} +8 -8
- package/lib/prompts/setAsDefaultAccountPrompt.js +10 -0
- package/lib/testUtils.d.ts +3 -3
- package/lib/testUtils.js +8 -9
- package/lib/ui/index.js +4 -1
- package/lib/upload.d.ts +1 -1
- package/lib/validation.js +4 -5
- package/lib/yargsUtils.d.ts +4 -0
- 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 +24 -16
- 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 +10 -1
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/localDev/LocalDevManagerV2.d.ts +0 -64
- package/lib/projects/localDev/LocalDevManagerV2.js +0 -345
- package/lib/prompts/installPublicAppPrompt.d.ts +0 -1
- package/lib/prompts/installPublicAppPrompt.js +0 -41
|
@@ -12,9 +12,9 @@ const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
|
12
12
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
13
13
|
const promptUtils_1 = require("./promptUtils");
|
|
14
14
|
const accountNamePrompt_1 = require("./accountNamePrompt");
|
|
15
|
-
const lang_1 = require("../lang");
|
|
16
15
|
const ui_1 = require("../ui");
|
|
17
16
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
17
|
+
const en_1 = require("../../lang/en");
|
|
18
18
|
/**
|
|
19
19
|
* Displays notification to user that we are about to open the browser,
|
|
20
20
|
* then opens their browser to the personal-access-key shortlink
|
|
@@ -23,24 +23,26 @@ async function personalAccessKeyPrompt({ env, account, }) {
|
|
|
23
23
|
const websiteOrigin = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
24
24
|
let url = `${websiteOrigin}/l/personal-access-key`;
|
|
25
25
|
if (process.env.BROWSER !== 'none') {
|
|
26
|
-
(0, ui_1.uiInfoSection)(
|
|
27
|
-
logger_1.logger.log(
|
|
26
|
+
(0, ui_1.uiInfoSection)(en_1.lib.prompts.personalAccessKeyPrompt.personalAccessKeySetupTitle, () => {
|
|
27
|
+
logger_1.logger.log(en_1.lib.prompts.personalAccessKeyPrompt.personalAccessKeyBrowserOpenPrep);
|
|
28
28
|
});
|
|
29
29
|
if (account) {
|
|
30
30
|
url = `${websiteOrigin}/personal-access-key/${account}`;
|
|
31
31
|
}
|
|
32
|
-
const { personalAcessKeyBrowserOpenPrep:
|
|
32
|
+
const { personalAcessKeyBrowserOpenPrep: choice } = await (0, promptUtils_1.promptUser)([
|
|
33
33
|
PERSONAL_ACCESS_KEY_BROWSER_OPEN_PREP,
|
|
34
34
|
]);
|
|
35
|
-
if (
|
|
36
|
-
(0, open_1.default)(url, { url: true });
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
35
|
+
if (!choice) {
|
|
39
36
|
(0, config_1.deleteEmptyConfigFile)();
|
|
40
37
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
41
38
|
}
|
|
39
|
+
if (choice ===
|
|
40
|
+
en_1.lib.prompts.personalAccessKeyPrompt.personalAccessKeyPromptChoices
|
|
41
|
+
.OPEN_BROWSER) {
|
|
42
|
+
(0, open_1.default)(url, { url: true });
|
|
43
|
+
logger_1.logger.log(en_1.lib.prompts.personalAccessKeyPrompt.logs.openingWebBrowser(url));
|
|
44
|
+
}
|
|
42
45
|
}
|
|
43
|
-
logger_1.logger.log((0, lang_1.i18n)(`lib.prompts.personalAccessKeyPrompt.logs.openingWebBrowser`, { url }));
|
|
44
46
|
const { personalAccessKey } = await (0, promptUtils_1.promptUser)(PERSONAL_ACCESS_KEY);
|
|
45
47
|
return {
|
|
46
48
|
personalAccessKey,
|
|
@@ -49,52 +51,59 @@ async function personalAccessKeyPrompt({ env, account, }) {
|
|
|
49
51
|
}
|
|
50
52
|
const ACCOUNT_ID = {
|
|
51
53
|
name: 'accountId',
|
|
52
|
-
message:
|
|
54
|
+
message: en_1.lib.prompts.personalAccessKeyPrompt.enterAccountId,
|
|
53
55
|
type: 'number',
|
|
54
56
|
validate(val) {
|
|
55
57
|
if (!Number.isNaN(val) && val !== undefined && val > 0) {
|
|
56
58
|
return true;
|
|
57
59
|
}
|
|
58
|
-
return
|
|
60
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors.invalidAccountId;
|
|
59
61
|
},
|
|
60
62
|
};
|
|
61
63
|
const CLIENT_ID = {
|
|
62
64
|
name: 'clientId',
|
|
63
|
-
message:
|
|
65
|
+
message: en_1.lib.prompts.personalAccessKeyPrompt.enterClientId,
|
|
64
66
|
validate(val) {
|
|
65
67
|
if (typeof val !== 'string') {
|
|
66
|
-
return
|
|
68
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors.invalidOauthClientId;
|
|
67
69
|
}
|
|
68
70
|
else if (val.length !== 36) {
|
|
69
|
-
return
|
|
71
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors
|
|
72
|
+
.invalidOauthClientIdLength;
|
|
70
73
|
}
|
|
71
74
|
return true;
|
|
72
75
|
},
|
|
73
76
|
};
|
|
74
77
|
const CLIENT_SECRET = {
|
|
75
78
|
name: 'clientSecret',
|
|
76
|
-
message:
|
|
79
|
+
message: en_1.lib.prompts.personalAccessKeyPrompt.enterClientSecret,
|
|
77
80
|
validate(val) {
|
|
78
81
|
if (typeof val !== 'string') {
|
|
79
|
-
return
|
|
82
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors
|
|
83
|
+
.invalidOauthClientSecret;
|
|
80
84
|
}
|
|
81
85
|
else if (val.length !== 36) {
|
|
82
|
-
return
|
|
86
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors
|
|
87
|
+
.invalidOauthClientSecretLength;
|
|
83
88
|
}
|
|
84
89
|
else if (val[0] === '*') {
|
|
85
|
-
return
|
|
90
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors
|
|
91
|
+
.invalidOauthClientSecretCopy;
|
|
86
92
|
}
|
|
87
93
|
return true;
|
|
88
94
|
},
|
|
89
95
|
};
|
|
90
96
|
const PERSONAL_ACCESS_KEY_BROWSER_OPEN_PREP = {
|
|
91
97
|
name: 'personalAcessKeyBrowserOpenPrep',
|
|
92
|
-
type: '
|
|
93
|
-
message:
|
|
98
|
+
type: 'list',
|
|
99
|
+
message: 'Choose your preferred method of authentication',
|
|
100
|
+
choices: Object.values(en_1.lib.prompts.personalAccessKeyPrompt.personalAccessKeyPromptChoices),
|
|
101
|
+
default: en_1.lib.prompts.personalAccessKeyPrompt.personalAccessKeyPromptChoices
|
|
102
|
+
.OPEN_BROWSER,
|
|
94
103
|
};
|
|
95
104
|
const PERSONAL_ACCESS_KEY = {
|
|
96
105
|
name: 'personalAccessKey',
|
|
97
|
-
message:
|
|
106
|
+
message: en_1.lib.prompts.personalAccessKeyPrompt.enterPersonalAccessKey,
|
|
98
107
|
transformer: (val) => {
|
|
99
108
|
if (!val)
|
|
100
109
|
return val;
|
|
@@ -106,10 +115,12 @@ const PERSONAL_ACCESS_KEY = {
|
|
|
106
115
|
},
|
|
107
116
|
validate(val) {
|
|
108
117
|
if (!val || typeof val !== 'string') {
|
|
109
|
-
return
|
|
118
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors
|
|
119
|
+
.invalidPersonalAccessKey;
|
|
110
120
|
}
|
|
111
121
|
else if (val[0] === '•') {
|
|
112
|
-
return
|
|
122
|
+
return en_1.lib.prompts.personalAccessKeyPrompt.errors
|
|
123
|
+
.invalidPersonalAccessKeyCopy;
|
|
113
124
|
}
|
|
114
125
|
return true;
|
|
115
126
|
},
|
|
@@ -117,7 +128,7 @@ const PERSONAL_ACCESS_KEY = {
|
|
|
117
128
|
const SCOPES = {
|
|
118
129
|
type: 'checkbox',
|
|
119
130
|
name: 'scopes',
|
|
120
|
-
message:
|
|
131
|
+
message: en_1.lib.prompts.personalAccessKeyPrompt.selectScopes,
|
|
121
132
|
default: [...auth_1.DEFAULT_OAUTH_SCOPES],
|
|
122
133
|
choices: [...auth_1.OAUTH_SCOPES],
|
|
123
134
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { ComponentTemplate } from '../../types/Projects';
|
|
1
|
+
import { ComponentTemplate, ComponentTemplateChoice } from '../../types/Projects';
|
|
2
2
|
type ProjectAddPromptResponse = {
|
|
3
3
|
componentTemplate: ComponentTemplate;
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
6
|
+
type ProjectAddPromptResponseV3 = {
|
|
7
|
+
componentTemplate: ComponentTemplate[];
|
|
8
|
+
};
|
|
6
9
|
export declare function projectAddPrompt(components: ComponentTemplate[], promptOptions?: {
|
|
7
10
|
name?: string;
|
|
8
11
|
type?: string;
|
|
9
12
|
}): Promise<ProjectAddPromptResponse>;
|
|
13
|
+
export declare function projectAddPromptV3(components: ComponentTemplateChoice[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
|
|
10
14
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.projectAddPrompt = projectAddPrompt;
|
|
4
|
+
exports.projectAddPromptV3 = projectAddPromptV3;
|
|
4
5
|
const promptUtils_1 = require("./promptUtils");
|
|
5
|
-
const
|
|
6
|
+
const en_1 = require("../../lang/en");
|
|
6
7
|
function findComponentByPathOrLabel(components, componentPathOrLabel) {
|
|
7
8
|
return components.find(c => c.path === componentPathOrLabel || c.label === componentPathOrLabel);
|
|
8
9
|
}
|
|
@@ -14,10 +15,8 @@ async function projectAddPrompt(components, promptOptions = {}) {
|
|
|
14
15
|
name: 'componentTemplate',
|
|
15
16
|
message: () => {
|
|
16
17
|
return promptOptions.type && !providedTypeIsValid
|
|
17
|
-
?
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
: (0, lang_1.i18n)(`lib.prompts.projectAddPrompt.selectType`);
|
|
18
|
+
? en_1.lib.prompts.projectAddPrompt.errors.invalidType(promptOptions.type)
|
|
19
|
+
: en_1.lib.prompts.projectAddPrompt.selectType;
|
|
21
20
|
},
|
|
22
21
|
when: !providedTypeIsValid,
|
|
23
22
|
type: 'list',
|
|
@@ -30,11 +29,11 @@ async function projectAddPrompt(components, promptOptions = {}) {
|
|
|
30
29
|
},
|
|
31
30
|
{
|
|
32
31
|
name: 'name',
|
|
33
|
-
message:
|
|
32
|
+
message: en_1.lib.prompts.projectAddPrompt.enterName,
|
|
34
33
|
when: !promptOptions.name,
|
|
35
34
|
validate: (input) => {
|
|
36
35
|
if (!input) {
|
|
37
|
-
return
|
|
36
|
+
return en_1.lib.prompts.projectAddPrompt.errors.nameRequired;
|
|
38
37
|
}
|
|
39
38
|
return true;
|
|
40
39
|
},
|
|
@@ -48,3 +47,32 @@ async function projectAddPrompt(components, promptOptions = {}) {
|
|
|
48
47
|
}
|
|
49
48
|
return result;
|
|
50
49
|
}
|
|
50
|
+
async function projectAddPromptV3(components, selectedFeatures) {
|
|
51
|
+
const selectedComponents = [];
|
|
52
|
+
if (selectedFeatures) {
|
|
53
|
+
components.forEach(template => {
|
|
54
|
+
if (!template.value) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (selectedFeatures?.includes(template.value.type)) {
|
|
58
|
+
if (template.disabled) {
|
|
59
|
+
throw new Error(en_1.lib.prompts.projectAddPrompt.errors.cannotAddFeature(template.value.type, template.disabled));
|
|
60
|
+
}
|
|
61
|
+
selectedComponents.push(template.value);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const result = await (0, promptUtils_1.promptUser)([
|
|
66
|
+
{
|
|
67
|
+
name: 'componentTemplate',
|
|
68
|
+
message: en_1.lib.prompts.projectAddPrompt.selectType,
|
|
69
|
+
when: !selectedFeatures && selectedComponents.length === 0,
|
|
70
|
+
type: 'checkbox',
|
|
71
|
+
choices: components,
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
74
|
+
if (!result.componentTemplate) {
|
|
75
|
+
result.componentTemplate = selectedComponents;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
2
|
import { DeveloperTestAccount } from '@hubspot/local-dev-lib/types/developerTestAccounts';
|
|
3
|
-
|
|
3
|
+
export type ProjectDevTargetAccountPromptResponse = {
|
|
4
|
+
targetAccountId: number | null;
|
|
5
|
+
createNestedAccount: boolean;
|
|
6
|
+
parentAccountId?: number | null;
|
|
7
|
+
notInConfigAccount?: DeveloperTestAccount | null;
|
|
8
|
+
};
|
|
4
9
|
export declare function selectSandboxTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
5
10
|
export declare function selectDeveloperTestTargetAccountPrompt(accounts: CLIAccount[], defaultAccountConfig: CLIAccount): Promise<ProjectDevTargetAccountPromptResponse>;
|
|
6
11
|
export declare function confirmDefaultAccountPrompt(accountName: string, accountType: string): Promise<boolean>;
|
|
@@ -4,16 +4,16 @@ exports.selectSandboxTargetAccountPrompt = selectSandboxTargetAccountPrompt;
|
|
|
4
4
|
exports.selectDeveloperTestTargetAccountPrompt = selectDeveloperTestTargetAccountPrompt;
|
|
5
5
|
exports.confirmDefaultAccountPrompt = confirmDefaultAccountPrompt;
|
|
6
6
|
exports.confirmUseExistingDeveloperTestAccountPrompt = confirmUseExistingDeveloperTestAccountPrompt;
|
|
7
|
-
const promptUtils_1 = require("./promptUtils");
|
|
8
|
-
const lang_1 = require("../lang");
|
|
9
|
-
const ui_1 = require("../ui");
|
|
10
|
-
const accountTypes_1 = require("../accountTypes");
|
|
11
7
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
12
8
|
const sandboxHubs_1 = require("@hubspot/local-dev-lib/api/sandboxHubs");
|
|
13
9
|
const config_2 = require("@hubspot/local-dev-lib/constants/config");
|
|
14
10
|
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
15
11
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
16
12
|
const developerTestAccounts_1 = require("@hubspot/local-dev-lib/api/developerTestAccounts");
|
|
13
|
+
const promptUtils_1 = require("./promptUtils");
|
|
14
|
+
const lang_1 = require("../lang");
|
|
15
|
+
const ui_1 = require("../ui");
|
|
16
|
+
const accountTypes_1 = require("../accountTypes");
|
|
17
17
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
18
18
|
function mapNestedAccount(accountConfig) {
|
|
19
19
|
const parentAccountId = accountConfig.parentAccountId ?? null;
|
|
@@ -42,7 +42,7 @@ async function selectSandboxTargetAccountPrompt(accounts, defaultAccountConfig)
|
|
|
42
42
|
sandboxUsage = data.usage;
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
logger_1.logger.error(`lib.prompts.projectDevTargetAccountPrompt.noAccountId`);
|
|
45
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.projectDevTargetAccountPrompt.noAccountId`));
|
|
46
46
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -101,7 +101,7 @@ async function selectDeveloperTestTargetAccountPrompt(accounts, defaultAccountCo
|
|
|
101
101
|
devTestAccountsResponse = data;
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
|
-
logger_1.logger.error(`lib.prompts.projectDevTargetAccountPrompt.noAccountId`);
|
|
104
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.projectDevTargetAccountPrompt.noAccountId`));
|
|
105
105
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { PromptConfig, GenericPromptResponse, PromptWhen, PromptChoices } from '../../types/Prompts';
|
|
2
|
+
export declare const Separator: any;
|
|
2
3
|
export declare function promptUser<T extends GenericPromptResponse>(config: PromptConfig<T> | PromptConfig<T>[]): Promise<T>;
|
|
3
4
|
export declare function confirmPrompt(message: string, options?: {
|
|
4
5
|
defaultAnswer?: boolean;
|
|
5
6
|
when?: PromptWhen;
|
|
6
7
|
}): Promise<boolean>;
|
|
7
|
-
export declare function listPrompt<T = string>(message: string, { choices, when, }: {
|
|
8
|
+
export declare function listPrompt<T = string>(message: string, { choices, when, defaultAnswer, validate, }: {
|
|
8
9
|
choices: PromptChoices<T>;
|
|
9
10
|
when?: PromptWhen;
|
|
11
|
+
defaultAnswer?: string | number | boolean;
|
|
12
|
+
validate?: (input: T[]) => (boolean | string) | Promise<boolean | string>;
|
|
10
13
|
}): Promise<T>;
|
|
11
14
|
export declare function inputPrompt(message: string, { when, validate, defaultAnswer, }?: {
|
|
12
15
|
when?: boolean | (() => boolean);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Separator = void 0;
|
|
3
4
|
exports.promptUser = promptUser;
|
|
4
5
|
exports.confirmPrompt = confirmPrompt;
|
|
5
6
|
exports.listPrompt = listPrompt;
|
|
6
7
|
exports.inputPrompt = inputPrompt;
|
|
7
8
|
const inquirer = require('inquirer');
|
|
8
9
|
const promptModule = inquirer.createPromptModule();
|
|
10
|
+
exports.Separator = new inquirer.Separator();
|
|
9
11
|
function promptUser(config) {
|
|
10
12
|
return promptModule(config);
|
|
11
13
|
}
|
|
@@ -22,7 +24,7 @@ async function confirmPrompt(message, options = {}) {
|
|
|
22
24
|
]);
|
|
23
25
|
return choice;
|
|
24
26
|
}
|
|
25
|
-
async function listPrompt(message, { choices, when, }) {
|
|
27
|
+
async function listPrompt(message, { choices, when, defaultAnswer, validate, }) {
|
|
26
28
|
const { choice } = await promptUser([
|
|
27
29
|
{
|
|
28
30
|
name: 'choice',
|
|
@@ -30,6 +32,8 @@ async function listPrompt(message, { choices, when, }) {
|
|
|
30
32
|
message,
|
|
31
33
|
choices,
|
|
32
34
|
when,
|
|
35
|
+
default: defaultAnswer,
|
|
36
|
+
validate,
|
|
33
37
|
},
|
|
34
38
|
]);
|
|
35
39
|
return choice;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.selectAppPrompt = selectAppPrompt;
|
|
4
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
5
|
+
const appsDev_1 = require("@hubspot/local-dev-lib/api/appsDev");
|
|
6
|
+
const index_1 = require("../errorHandlers/index");
|
|
7
|
+
const en_1 = require("../../lang/en");
|
|
8
|
+
const promptUtils_1 = require("../prompts/promptUtils");
|
|
9
|
+
async function selectAppPrompt(accountId, appId) {
|
|
10
|
+
let availableApps = [];
|
|
11
|
+
try {
|
|
12
|
+
const appsResponse = await (0, appsDev_1.fetchPublicAppsForPortal)(accountId);
|
|
13
|
+
if (appsResponse.data.results) {
|
|
14
|
+
availableApps = appsResponse.data.results;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
(0, index_1.debugError)(err);
|
|
19
|
+
}
|
|
20
|
+
if (availableApps.length === 0) {
|
|
21
|
+
logger_1.logger.error(en_1.lib.prompts.selectAppPrompt.errors.noApps);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (appId) {
|
|
25
|
+
const targetApp = availableApps.find(app => app.id === appId);
|
|
26
|
+
if (targetApp) {
|
|
27
|
+
return targetApp;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
logger_1.logger.error(en_1.lib.prompts.selectAppPrompt.errors.invalidAppId);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const appPromptValue = await (0, promptUtils_1.listPrompt)(en_1.lib.prompts.selectAppPrompt.selectAppId, {
|
|
34
|
+
choices: availableApps.map(app => ({
|
|
35
|
+
name: `${app.name} (${app.id})`,
|
|
36
|
+
value: app,
|
|
37
|
+
})),
|
|
38
|
+
});
|
|
39
|
+
return appPromptValue;
|
|
40
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type PublicAppPromptResponse = {
|
|
2
2
|
appId: number;
|
|
3
3
|
};
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function selectPublicAppForMigrationPrompt({ accountId, accountName, isMigratingApp, }: {
|
|
5
5
|
accountId: number | null;
|
|
6
6
|
accountName: string;
|
|
7
7
|
isMigratingApp?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.selectPublicAppForMigrationPrompt = selectPublicAppForMigrationPrompt;
|
|
4
4
|
const promptUtils_1 = require("./promptUtils");
|
|
5
5
|
const lang_1 = require("../lang");
|
|
6
6
|
const ui_1 = require("../ui");
|
|
@@ -11,7 +11,7 @@ const exitCodes_1 = require("../enums/exitCodes");
|
|
|
11
11
|
async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = false) {
|
|
12
12
|
try {
|
|
13
13
|
if (!accountId) {
|
|
14
|
-
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.
|
|
14
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.noAccountId`));
|
|
15
15
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
16
16
|
}
|
|
17
17
|
const { data: { results: publicApps }, } = await (0, appsDev_1.fetchPublicAppsForPortal)(accountId);
|
|
@@ -26,8 +26,8 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
26
26
|
? 'noAppsMigrationMessage'
|
|
27
27
|
: 'noAppsCloneMessage';
|
|
28
28
|
(0, ui_1.uiLine)();
|
|
29
|
-
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.
|
|
30
|
-
logger_1.logger.log((0, lang_1.i18n)(`lib.prompts.
|
|
29
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.${headerTranslationKey}`));
|
|
30
|
+
logger_1.logger.log((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.${messageTranslationKey}`, { accountName }));
|
|
31
31
|
(0, ui_1.uiLine)();
|
|
32
32
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
33
33
|
}
|
|
@@ -35,11 +35,11 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
37
|
(0, index_1.logError)(error, accountId ? { accountId } : undefined);
|
|
38
|
-
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.
|
|
38
|
+
logger_1.logger.error((0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.errorFetchingApps`));
|
|
39
39
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
async function
|
|
42
|
+
async function selectPublicAppForMigrationPrompt({ accountId, accountName, isMigratingApp = false, }) {
|
|
43
43
|
const publicApps = await fetchPublicAppOptions(accountId, accountName, isMigratingApp);
|
|
44
44
|
const translationKey = isMigratingApp
|
|
45
45
|
? 'selectAppIdMigrate'
|
|
@@ -47,7 +47,7 @@ async function selectPublicAppPrompt({ accountId, accountName, isMigratingApp =
|
|
|
47
47
|
return (0, promptUtils_1.promptUser)([
|
|
48
48
|
{
|
|
49
49
|
name: 'appId',
|
|
50
|
-
message: (0, lang_1.i18n)(`lib.prompts.
|
|
50
|
+
message: (0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.${translationKey}`, {
|
|
51
51
|
accountName,
|
|
52
52
|
}),
|
|
53
53
|
type: 'list',
|
|
@@ -56,7 +56,7 @@ async function selectPublicAppPrompt({ accountId, accountName, isMigratingApp =
|
|
|
56
56
|
if (isMigratingApp && preventProjectMigrations && listingInfo) {
|
|
57
57
|
return {
|
|
58
58
|
name: `${app.name} (${app.id})`,
|
|
59
|
-
disabled: (0, lang_1.i18n)(`lib.prompts.
|
|
59
|
+
disabled: (0, lang_1.i18n)(`lib.prompts.selectPublicAppForMigrationPrompt.errors.cannotBeMigrated`),
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
return {
|
|
@@ -4,6 +4,7 @@ exports.setAsDefaultAccountPrompt = setAsDefaultAccountPrompt;
|
|
|
4
4
|
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
5
5
|
const promptUtils_1 = require("./promptUtils");
|
|
6
6
|
const lang_1 = require("../lang");
|
|
7
|
+
const logger_1 = require("../ui/logger");
|
|
7
8
|
async function setAsDefaultAccountPrompt(accountName) {
|
|
8
9
|
// Accounts for deprecated and new config
|
|
9
10
|
const defaultAccount = (0, config_1.getConfigDefaultAccount)();
|
|
@@ -15,8 +16,17 @@ async function setAsDefaultAccountPrompt(accountName) {
|
|
|
15
16
|
message: (0, lang_1.i18n)(`lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccountMessage`),
|
|
16
17
|
},
|
|
17
18
|
]);
|
|
19
|
+
logger_1.uiLogger.log('');
|
|
18
20
|
if (setAsDefault) {
|
|
19
21
|
(0, config_1.updateDefaultAccount)(accountName);
|
|
22
|
+
logger_1.uiLogger.success((0, lang_1.i18n)('lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccount', {
|
|
23
|
+
accountName,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
logger_1.uiLogger.log((0, lang_1.i18n)('lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault', {
|
|
28
|
+
accountName: (0, config_1.getConfigDefaultAccount)(),
|
|
29
|
+
}));
|
|
20
30
|
}
|
|
21
31
|
return setAsDefault;
|
|
22
32
|
}
|
package/lib/testUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HubSpotPromise } from '@hubspot/local-dev-lib/types/Http';
|
|
2
2
|
import { HubSpotHttpError } from '@hubspot/local-dev-lib/models/HubSpotHttpError';
|
|
3
3
|
type MockErrorResponse = {
|
|
4
4
|
status: number;
|
|
@@ -9,6 +9,6 @@ type MockErrorResponse = {
|
|
|
9
9
|
subCategory?: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export declare
|
|
13
|
-
export declare
|
|
12
|
+
export declare function mockHubSpotHttpResponse<T>(data?: any): HubSpotPromise<T>;
|
|
13
|
+
export declare function mockHubSpotHttpError(message: string, response: MockErrorResponse): HubSpotHttpError;
|
|
14
14
|
export {};
|
package/lib/testUtils.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mockHubSpotHttpResponse = mockHubSpotHttpResponse;
|
|
4
|
+
exports.mockHubSpotHttpError = mockHubSpotHttpError;
|
|
4
5
|
const axios_1 = require("axios");
|
|
5
6
|
const HubSpotHttpError_1 = require("@hubspot/local-dev-lib/models/HubSpotHttpError");
|
|
6
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
-
|
|
8
|
-
return {
|
|
8
|
+
function mockHubSpotHttpResponse(data) {
|
|
9
|
+
return Promise.resolve({
|
|
9
10
|
data,
|
|
10
11
|
status: 200,
|
|
11
12
|
statusText: 'OK',
|
|
@@ -13,12 +14,10 @@ const mockHubSpotHttpResponse = (data) => {
|
|
|
13
14
|
config: {
|
|
14
15
|
headers: new axios_1.AxiosHeaders(),
|
|
15
16
|
},
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const mockHubSpotHttpError = (message, response) => {
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function mockHubSpotHttpError(message, response) {
|
|
20
20
|
return new HubSpotHttpError_1.HubSpotHttpError(message, {
|
|
21
21
|
cause: { isAxiosError: true, response },
|
|
22
22
|
});
|
|
23
|
-
}
|
|
24
|
-
exports.mockHubSpotHttpError = mockHubSpotHttpError;
|
|
23
|
+
}
|
package/lib/ui/index.js
CHANGED
|
@@ -61,7 +61,10 @@ function uiAccountDescription(accountId, bold = true) {
|
|
|
61
61
|
if (account && account.accountType) {
|
|
62
62
|
message = `${account.name} [${HUBSPOT_ACCOUNT_TYPE_STRINGS[account.accountType]}] (${accountId})`;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
else {
|
|
65
|
+
message = accountId ? accountId.toString() : '';
|
|
66
|
+
}
|
|
67
|
+
return bold ? chalk_1.default.bold(message) : message;
|
|
65
68
|
}
|
|
66
69
|
function uiInfoSection(title, logContent) {
|
|
67
70
|
uiLine();
|
package/lib/upload.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getUploadableFileList(src: string, convertFields
|
|
1
|
+
export declare function getUploadableFileList(src: string, convertFields?: boolean): Promise<string[]>;
|
package/lib/validation.js
CHANGED
|
@@ -145,28 +145,27 @@ function validateCmsPublishMode(options) {
|
|
|
145
145
|
return false;
|
|
146
146
|
}
|
|
147
147
|
function fileExists(_path) {
|
|
148
|
-
let isFile;
|
|
149
148
|
try {
|
|
150
149
|
const absoluteSrcPath = path.resolve((0, path_1.getCwd)(), _path);
|
|
151
150
|
if (!absoluteSrcPath)
|
|
152
151
|
return false;
|
|
153
152
|
const stats = fs.statSync(absoluteSrcPath);
|
|
154
|
-
isFile = stats.isFile();
|
|
153
|
+
const isFile = stats.isFile();
|
|
155
154
|
if (!isFile) {
|
|
156
|
-
logger_1.logger.error(`The path "${_path}" is not a path to a file`);
|
|
157
155
|
return false;
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
catch (e) {
|
|
161
|
-
logger_1.logger.error(`The path "${_path}" is not a path to a file`);
|
|
162
159
|
return false;
|
|
163
160
|
}
|
|
164
161
|
return true;
|
|
165
162
|
}
|
|
166
163
|
function checkAndConvertToJson(_path) {
|
|
167
164
|
const filePath = (0, path_1.getAbsoluteFilePath)(_path);
|
|
168
|
-
if (!fileExists(filePath))
|
|
165
|
+
if (!fileExists(filePath)) {
|
|
166
|
+
logger_1.logger.error(`The path "${_path}" is not a path to a file`);
|
|
169
167
|
return null;
|
|
168
|
+
}
|
|
170
169
|
if ((0, path_1.getExt)(_path) !== 'json') {
|
|
171
170
|
logger_1.logger.error(`The file "${_path}" must be a valid JSON file`);
|
|
172
171
|
return null;
|
package/lib/yargsUtils.d.ts
CHANGED
|
@@ -6,4 +6,8 @@ export declare function makeYargsBuilder<T>(callback: (yargs: Argv) => Argv<T>,
|
|
|
6
6
|
useConfigOptions?: boolean;
|
|
7
7
|
useEnvironmentOptions?: boolean;
|
|
8
8
|
useTestingOptions?: boolean;
|
|
9
|
+
useCmsPublishModeOptions?: boolean | {
|
|
10
|
+
read?: boolean;
|
|
11
|
+
write?: boolean;
|
|
12
|
+
};
|
|
9
13
|
}): (yargs: Argv) => Promise<Argv<T>>;
|
package/lib/yargsUtils.js
CHANGED
|
@@ -32,6 +32,12 @@ function makeYargsBuilder(callback, command, describe, options = {}) {
|
|
|
32
32
|
if (options.useTestingOptions) {
|
|
33
33
|
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
34
34
|
}
|
|
35
|
+
if (options.useCmsPublishModeOptions) {
|
|
36
|
+
const opts = typeof options.useCmsPublishModeOptions === 'object'
|
|
37
|
+
? options.useCmsPublishModeOptions
|
|
38
|
+
: { write: true };
|
|
39
|
+
(0, commonOpts_1.addCmsPublishModeOptions)(yargs, opts);
|
|
40
|
+
}
|
|
35
41
|
const result = callback(yargs);
|
|
36
42
|
// Must go last to pick up available options
|
|
37
43
|
await (0, commonOpts_1.addCustomHelpOutput)(result, command, describe);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
4
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
5
|
+
const tools_1 = require("./tools");
|
|
6
|
+
const server = new mcp_js_1.McpServer({
|
|
7
|
+
name: 'HubSpot CLI MCP Server',
|
|
8
|
+
version: '0.0.1',
|
|
9
|
+
description: 'Helps perform tasks for local development of HubSpot projects.',
|
|
10
|
+
capabilities: {
|
|
11
|
+
tools: {},
|
|
12
|
+
prompts: {},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
(0, tools_1.registerProjectTools)(server);
|
|
16
|
+
// Start receiving messages on stdin and sending messages on stdout
|
|
17
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
18
|
+
server.connect(transport);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerProjectTools = registerProjectTools;
|
|
4
|
+
const UploadProjectTools_1 = require("./project/UploadProjectTools");
|
|
5
|
+
const CreateProjectTool_1 = require("./project/CreateProjectTool");
|
|
6
|
+
const GuidedWalkthroughTool_1 = require("./project/GuidedWalkthroughTool");
|
|
7
|
+
const DeployProject_1 = require("./project/DeployProject");
|
|
8
|
+
const AddFeatureToProject_1 = require("./project/AddFeatureToProject");
|
|
9
|
+
const ValidateProjectTool_1 = require("./project/ValidateProjectTool");
|
|
10
|
+
function registerProjectTools(mcpServer) {
|
|
11
|
+
return [
|
|
12
|
+
new UploadProjectTools_1.UploadProjectTools(mcpServer).register(),
|
|
13
|
+
new CreateProjectTool_1.CreateProjectTool(mcpServer).register(),
|
|
14
|
+
new GuidedWalkthroughTool_1.GuidedWalkthroughTool(mcpServer).register(),
|
|
15
|
+
new DeployProject_1.DeployProject(mcpServer).register(),
|
|
16
|
+
new AddFeatureToProject_1.AddFeatureToProject(mcpServer).register(),
|
|
17
|
+
new ValidateProjectTool_1.ValidateProjectTool(mcpServer).register(),
|
|
18
|
+
];
|
|
19
|
+
}
|