@hubspot/cli 7.4.3-beta.0 → 7.4.4-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/migrate.d.ts +11 -2
- package/api/migrate.js +4 -0
- package/commands/app/migrate.d.ts +0 -1
- package/commands/app/migrate.js +15 -9
- package/commands/auth.js +9 -10
- package/commands/cms.js +1 -2
- package/commands/completion.js +2 -3
- package/commands/create.js +7 -8
- package/commands/customObject.js +3 -4
- package/commands/doctor.js +5 -6
- package/commands/feedback.js +7 -8
- package/commands/fetch.js +6 -7
- package/commands/filemanager.js +1 -2
- package/commands/function.js +1 -2
- package/commands/hubdb/clear.js +5 -6
- package/commands/hubdb/create.js +7 -8
- package/commands/hubdb/delete.js +8 -7
- package/commands/hubdb/fetch.js +4 -5
- package/commands/hubdb.js +1 -2
- package/commands/init.js +10 -11
- package/commands/lint.js +3 -4
- package/commands/list.js +5 -6
- package/commands/logs.js +12 -13
- package/commands/module/marketplace-validate.js +5 -6
- package/commands/module.js +1 -3
- package/commands/mv.js +4 -5
- package/commands/open.js +4 -5
- package/commands/project/add.js +17 -13
- package/commands/project/cloneApp.js +16 -11
- package/commands/project/create.js +18 -14
- package/commands/project/deploy.js +17 -15
- package/commands/project/dev/deprecatedFlow.js +19 -12
- package/commands/project/dev/index.js +11 -7
- package/commands/project/dev/unifiedFlow.js +2 -3
- package/commands/project/download.js +8 -9
- package/commands/project/installDeps.js +9 -7
- package/commands/project/listBuilds.js +15 -11
- package/commands/project/logs.js +19 -17
- package/commands/project/migrate.js +20 -7
- package/commands/project/migrateApp.d.ts +1 -1
- package/commands/project/migrateApp.js +7 -5
- package/commands/project/open.js +11 -5
- package/commands/project/upload.js +12 -8
- package/commands/project/watch.js +10 -6
- package/commands/project.js +1 -2
- package/commands/remove.js +7 -5
- package/commands/sandbox/create.js +10 -11
- package/commands/sandbox/delete.js +18 -19
- package/commands/sandbox.js +1 -2
- package/commands/secret/addSecret.js +5 -6
- package/commands/secret/deleteSecret.js +12 -9
- package/commands/secret/listSecret.js +3 -4
- package/commands/secret/updateSecret.js +9 -8
- package/commands/secret.js +1 -2
- package/commands/theme/generate-selectors.js +5 -6
- package/commands/theme/marketplace-validate.js +5 -6
- package/commands/theme/preview.js +14 -14
- package/commands/theme.js +1 -2
- package/commands/upload.js +23 -24
- package/commands/watch.js +18 -19
- package/lang/en.d.ts +2212 -2262
- package/lang/en.js +14 -14
- package/lang/en.lyaml +3 -9
- package/lib/accountTypes.d.ts +1 -0
- package/lib/accountTypes.js +12 -0
- package/lib/app/migrate.js +53 -21
- package/lib/app/migrate_legacy.js +2 -1
- package/lib/constants.d.ts +4 -0
- package/lib/constants.js +5 -1
- package/lib/hasFeature.d.ts +3 -1
- package/lib/localDev.d.ts +2 -1
- package/lib/localDev.js +21 -3
- package/package.json +1 -1
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.describe = exports.command = void 0;
|
|
4
4
|
exports.handler = handler;
|
|
5
5
|
exports.builder = builder;
|
|
6
|
-
const lang_1 = require("../../lib/lang");
|
|
7
6
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
7
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
9
8
|
const migrate_1 = require("../../lib/app/migrate");
|
|
@@ -11,20 +10,28 @@ const projects_1 = require("../../lib/projects");
|
|
|
11
10
|
const projects_2 = require("@hubspot/local-dev-lib/constants/projects");
|
|
12
11
|
const errorHandlers_1 = require("../../lib/errorHandlers");
|
|
13
12
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
13
|
+
const ui_1 = require("../../lib/ui");
|
|
14
|
+
const en_1 = require("../../lang/en");
|
|
15
|
+
const { v2025_2 } = projects_2.PLATFORM_VERSIONS;
|
|
14
16
|
exports.command = 'migrate';
|
|
15
|
-
exports.describe = undefined;
|
|
17
|
+
exports.describe = undefined;
|
|
16
18
|
async function handler(options) {
|
|
19
|
+
const { platformVersion, unstable } = options;
|
|
17
20
|
const projectConfig = await (0, projects_1.getProjectConfig)();
|
|
18
21
|
if (!projectConfig.projectConfig) {
|
|
19
|
-
logger_1.logger.error(
|
|
22
|
+
logger_1.logger.error(en_1.commands.project.migrate.errors.noProjectConfig((0, ui_1.uiCommandReference)('hs app migrate')));
|
|
20
23
|
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
21
24
|
}
|
|
25
|
+
logger_1.logger.log();
|
|
26
|
+
logger_1.logger.log((0, ui_1.uiBetaTag)(en_1.commands.project.migrate.preamble(platformVersion), false));
|
|
22
27
|
const { derivedAccountId } = options;
|
|
23
28
|
try {
|
|
24
29
|
await (0, migrate_1.migrateApp2025_2)(derivedAccountId, {
|
|
25
30
|
...options,
|
|
26
31
|
name: projectConfig?.projectConfig?.name,
|
|
27
|
-
platformVersion:
|
|
32
|
+
platformVersion: unstable
|
|
33
|
+
? projects_2.PLATFORM_VERSIONS.unstable
|
|
34
|
+
: platformVersion,
|
|
28
35
|
}, projectConfig);
|
|
29
36
|
}
|
|
30
37
|
catch (error) {
|
|
@@ -37,10 +44,16 @@ function builder(yargs) {
|
|
|
37
44
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
38
45
|
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
39
46
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
40
|
-
yargs
|
|
47
|
+
yargs
|
|
48
|
+
.option('platform-version', {
|
|
41
49
|
type: 'string',
|
|
42
|
-
choices:
|
|
43
|
-
default:
|
|
50
|
+
choices: [v2025_2],
|
|
51
|
+
default: v2025_2,
|
|
52
|
+
hidden: true,
|
|
53
|
+
})
|
|
54
|
+
.option('unstable', {
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
default: false,
|
|
44
57
|
hidden: true,
|
|
45
58
|
});
|
|
46
59
|
return yargs;
|
|
@@ -3,7 +3,7 @@ import { MigrateAppArgs } from '../../lib/app/migrate';
|
|
|
3
3
|
export declare const command = "migrate-app";
|
|
4
4
|
export declare const describe: string | undefined;
|
|
5
5
|
export declare const deprecated = true;
|
|
6
|
-
export declare function handler(
|
|
6
|
+
export declare function handler(options: ArgumentsCamelCase<MigrateAppArgs>): Promise<void>;
|
|
7
7
|
export declare function builder(yargs: Argv): Argv<MigrateAppArgs>;
|
|
8
8
|
declare const migrateAppCommand: CommandModule<unknown, MigrateAppArgs>;
|
|
9
9
|
export default migrateAppCommand;
|
|
@@ -8,16 +8,18 @@ const ui_1 = require("../../lib/ui");
|
|
|
8
8
|
const migrate_1 = require("../app/migrate");
|
|
9
9
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
10
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
11
|
+
const projects_1 = require("@hubspot/local-dev-lib/constants/projects");
|
|
12
|
+
const { v2023_2, v2025_2 } = projects_1.PLATFORM_VERSIONS;
|
|
11
13
|
exports.command = 'migrate-app';
|
|
12
14
|
// TODO: Leave this as deprecated and remove in the next major release
|
|
13
15
|
exports.describe = (0, ui_1.uiDeprecatedTag)((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.describe`), false);
|
|
14
16
|
exports.deprecated = true;
|
|
15
|
-
async function handler(
|
|
17
|
+
async function handler(options) {
|
|
16
18
|
logger_1.logger.warn((0, lang_1.i18n)(`commands.project.subcommands.migrateApp.deprecationWarning`, {
|
|
17
19
|
oldCommand: (0, ui_1.uiCommandReference)('hs project migrate-app'),
|
|
18
|
-
newCommand: (0, ui_1.uiCommandReference)(
|
|
20
|
+
newCommand: (0, ui_1.uiCommandReference)(`hs app migrate --platform-version=${options.platformVersion}`),
|
|
19
21
|
}));
|
|
20
|
-
await (0, migrate_1.handler)(
|
|
22
|
+
await (0, migrate_1.handler)(options);
|
|
21
23
|
}
|
|
22
24
|
function builder(yargs) {
|
|
23
25
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
@@ -38,9 +40,9 @@ function builder(yargs) {
|
|
|
38
40
|
},
|
|
39
41
|
'platform-version': {
|
|
40
42
|
type: 'string',
|
|
41
|
-
choices:
|
|
43
|
+
choices: [v2023_2, v2025_2],
|
|
42
44
|
hidden: true,
|
|
43
|
-
default:
|
|
45
|
+
default: v2023_2,
|
|
44
46
|
},
|
|
45
47
|
});
|
|
46
48
|
yargs.example([
|
package/commands/project/open.js
CHANGED
|
@@ -16,9 +16,8 @@ const urls_1 = require("../../lib/projects/urls");
|
|
|
16
16
|
const projectNamePrompt_1 = require("../../lib/prompts/projectNamePrompt");
|
|
17
17
|
const ui_1 = require("../../lib/ui");
|
|
18
18
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
19
|
-
const i18nKey = 'commands.project.subcommands.open';
|
|
20
19
|
exports.command = 'open';
|
|
21
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
20
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.open.describe`), false);
|
|
22
21
|
async function handler(args) {
|
|
23
22
|
const { project, derivedAccountId } = args;
|
|
24
23
|
(0, usageTracking_1.trackCommandUsage)('project-open', undefined, derivedAccountId);
|
|
@@ -41,7 +40,9 @@ async function handler(args) {
|
|
|
41
40
|
}
|
|
42
41
|
const url = (0, urls_1.getProjectDetailUrl)(projectName, derivedAccountId);
|
|
43
42
|
(0, open_1.default)(url, { url: true });
|
|
44
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
43
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.project.subcommands.open.success`, {
|
|
44
|
+
projectName: projectName,
|
|
45
|
+
}));
|
|
45
46
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
46
47
|
}
|
|
47
48
|
function builder(yargs) {
|
|
@@ -51,11 +52,16 @@ function builder(yargs) {
|
|
|
51
52
|
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
52
53
|
yargs.options({
|
|
53
54
|
project: {
|
|
54
|
-
describe: (0, lang_1.i18n)(
|
|
55
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.open.options.project.describe`),
|
|
55
56
|
type: 'string',
|
|
56
57
|
},
|
|
57
58
|
});
|
|
58
|
-
yargs.example([
|
|
59
|
+
yargs.example([
|
|
60
|
+
[
|
|
61
|
+
'$0 project open',
|
|
62
|
+
(0, lang_1.i18n)(`commands.project.subcommands.open.examples.default`),
|
|
63
|
+
],
|
|
64
|
+
]);
|
|
59
65
|
return yargs;
|
|
60
66
|
}
|
|
61
67
|
module.exports = {
|
|
@@ -20,9 +20,8 @@ const constants_1 = require("../../lib/constants");
|
|
|
20
20
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
21
21
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
22
22
|
const yargsUtils_1 = require("../../lib/yargsUtils");
|
|
23
|
-
const i18nKey = 'commands.project.subcommands.upload';
|
|
24
23
|
exports.command = 'upload';
|
|
25
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
24
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.project.subcommands.upload.describe`), false);
|
|
26
25
|
async function handler(args) {
|
|
27
26
|
const { forceCreate, message, derivedAccountId, skipValidation } = args;
|
|
28
27
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
@@ -41,7 +40,7 @@ async function handler(args) {
|
|
|
41
40
|
subCategory: constants_1.PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
42
41
|
})) {
|
|
43
42
|
logger_1.logger.log();
|
|
44
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
43
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.project.subcommands.upload.errors.projectLockedError`));
|
|
45
44
|
logger_1.logger.log();
|
|
46
45
|
}
|
|
47
46
|
else {
|
|
@@ -53,10 +52,10 @@ async function handler(args) {
|
|
|
53
52
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
54
53
|
}
|
|
55
54
|
if (result && result.succeeded && !result.buildResult.isAutoDeployEnabled) {
|
|
56
|
-
logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(
|
|
55
|
+
logger_1.logger.log(chalk_1.default.bold((0, lang_1.i18n)(`commands.project.subcommands.upload.logs.buildSucceeded`, {
|
|
57
56
|
buildId: result.buildId,
|
|
58
57
|
})));
|
|
59
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
58
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.project.subcommands.upload.logs.autoDeployDisabled`, {
|
|
60
59
|
deployCommand: (0, ui_1.uiCommandReference)(`hs project deploy --build=${result.buildId}`),
|
|
61
60
|
}));
|
|
62
61
|
(0, projects_1.logFeedbackMessage)(result.buildId);
|
|
@@ -76,13 +75,13 @@ async function handler(args) {
|
|
|
76
75
|
function projectUploadBuilder(yargs) {
|
|
77
76
|
yargs.options({
|
|
78
77
|
'force-create': {
|
|
79
|
-
describe: (0, lang_1.i18n)(
|
|
78
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.upload.options.forceCreate.describe`),
|
|
80
79
|
type: 'boolean',
|
|
81
80
|
default: false,
|
|
82
81
|
},
|
|
83
82
|
message: {
|
|
84
83
|
alias: 'm',
|
|
85
|
-
describe: (0, lang_1.i18n)(
|
|
84
|
+
describe: (0, lang_1.i18n)(`commands.project.subcommands.upload.options.message.describe`),
|
|
86
85
|
type: 'string',
|
|
87
86
|
default: '',
|
|
88
87
|
},
|
|
@@ -92,7 +91,12 @@ function projectUploadBuilder(yargs) {
|
|
|
92
91
|
default: false,
|
|
93
92
|
},
|
|
94
93
|
});
|
|
95
|
-
yargs.example([
|
|
94
|
+
yargs.example([
|
|
95
|
+
[
|
|
96
|
+
'$0 project upload',
|
|
97
|
+
(0, lang_1.i18n)(`commands.project.subcommands.upload.examples.default`),
|
|
98
|
+
],
|
|
99
|
+
]);
|
|
96
100
|
return yargs;
|
|
97
101
|
}
|
|
98
102
|
exports.builder = (0, yargsUtils_1.makeYargsBuilder)(projectUploadBuilder, exports.command, exports.describe, {
|
|
@@ -19,9 +19,8 @@ const { cancelStagedBuild, fetchProjectBuilds, } = require('@hubspot/local-dev-l
|
|
|
19
19
|
const { isSpecifiedError } = require('@hubspot/local-dev-lib/errors/index');
|
|
20
20
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
21
21
|
const { handleKeypress, handleExit } = require('../../lib/process');
|
|
22
|
-
const i18nKey = 'commands.project.subcommands.watch';
|
|
23
22
|
exports.command = 'watch';
|
|
24
|
-
exports.describe = uiBetaTag(i18n(
|
|
23
|
+
exports.describe = uiBetaTag(i18n(`commands.project.subcommands.watch.describe`), false);
|
|
25
24
|
const handleBuildStatus = async (accountId, projectName, buildId) => {
|
|
26
25
|
const { isAutoDeployEnabled, deployStatusTaskLocator } = await pollBuildStatus(accountId, projectName, buildId);
|
|
27
26
|
if (isAutoDeployEnabled && deployStatusTaskLocator) {
|
|
@@ -31,7 +30,7 @@ const handleBuildStatus = async (accountId, projectName, buildId) => {
|
|
|
31
30
|
};
|
|
32
31
|
const handleUserInput = (accountId, projectName, currentBuildId) => {
|
|
33
32
|
const onTerminate = async () => {
|
|
34
|
-
logger.log(i18n(
|
|
33
|
+
logger.log(i18n(`commands.project.subcommands.watch.logs.processExited`));
|
|
35
34
|
if (currentBuildId) {
|
|
36
35
|
try {
|
|
37
36
|
await cancelStagedBuild(accountId, projectName);
|
|
@@ -89,7 +88,7 @@ exports.handler = async (options) => {
|
|
|
89
88
|
subCategory: PROJECT_ERROR_TYPES.PROJECT_LOCKED,
|
|
90
89
|
})) {
|
|
91
90
|
logger.log();
|
|
92
|
-
logger.error(i18n(
|
|
91
|
+
logger.error(i18n(`commands.project.subcommands.watch.errors.projectLockedError`));
|
|
93
92
|
logger.log();
|
|
94
93
|
}
|
|
95
94
|
else {
|
|
@@ -112,10 +111,15 @@ exports.handler = async (options) => {
|
|
|
112
111
|
exports.builder = yargs => {
|
|
113
112
|
yargs.option('initial-upload', {
|
|
114
113
|
alias: 'i',
|
|
115
|
-
describe: i18n(
|
|
114
|
+
describe: i18n(`commands.project.subcommands.watch.options.initialUpload.describe`),
|
|
116
115
|
type: 'boolean',
|
|
117
116
|
});
|
|
118
|
-
yargs.example([
|
|
117
|
+
yargs.example([
|
|
118
|
+
[
|
|
119
|
+
'$0 project watch',
|
|
120
|
+
i18n(`commands.project.subcommands.watch.examples.default`),
|
|
121
|
+
],
|
|
122
|
+
]);
|
|
119
123
|
addConfigOptions(yargs);
|
|
120
124
|
addAccountOptions(yargs);
|
|
121
125
|
addUseEnvironmentOptions(yargs);
|
package/commands/project.js
CHANGED
|
@@ -18,9 +18,8 @@ const migrateApp = require('./project/migrateApp');
|
|
|
18
18
|
const migrate = require('./project/migrate');
|
|
19
19
|
const cloneApp = require('./project/cloneApp');
|
|
20
20
|
const installDeps = require('./project/installDeps');
|
|
21
|
-
const i18nKey = 'commands.project';
|
|
22
21
|
exports.command = ['project', 'projects'];
|
|
23
|
-
exports.describe = uiBetaTag(i18n(
|
|
22
|
+
exports.describe = uiBetaTag(i18n(`commands.project.describe`), false);
|
|
24
23
|
exports.builder = yargs => {
|
|
25
24
|
addGlobalOptions(yargs);
|
|
26
25
|
yargs
|
package/commands/remove.js
CHANGED
|
@@ -9,18 +9,20 @@ const index_1 = require("../lib/errorHandlers/index");
|
|
|
9
9
|
const commonOpts_1 = require("../lib/commonOpts");
|
|
10
10
|
const usageTracking_1 = require("../lib/usageTracking");
|
|
11
11
|
const lang_1 = require("../lib/lang");
|
|
12
|
-
const i18nKey = 'commands.remove';
|
|
13
12
|
exports.command = 'remove <path>';
|
|
14
|
-
exports.describe = (0, lang_1.i18n)(
|
|
13
|
+
exports.describe = (0, lang_1.i18n)(`commands.remove.describe`);
|
|
15
14
|
async function handler(args) {
|
|
16
15
|
const { path: hsPath, derivedAccountId } = args;
|
|
17
16
|
(0, usageTracking_1.trackCommandUsage)('remove', undefined, derivedAccountId);
|
|
18
17
|
try {
|
|
19
18
|
await (0, fileMapper_1.deleteFile)(derivedAccountId, hsPath);
|
|
20
|
-
logger_1.logger.log((0, lang_1.i18n)(
|
|
19
|
+
logger_1.logger.log((0, lang_1.i18n)(`commands.remove.deleted`, {
|
|
20
|
+
accountId: derivedAccountId,
|
|
21
|
+
path: hsPath,
|
|
22
|
+
}));
|
|
21
23
|
}
|
|
22
24
|
catch (error) {
|
|
23
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
25
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.remove.errors.deleteFailed`, {
|
|
24
26
|
accountId: derivedAccountId,
|
|
25
27
|
path: hsPath,
|
|
26
28
|
}));
|
|
@@ -36,7 +38,7 @@ function builder(yargs) {
|
|
|
36
38
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
37
39
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
38
40
|
yargs.positional('path', {
|
|
39
|
-
describe: (0, lang_1.i18n)(
|
|
41
|
+
describe: (0, lang_1.i18n)(`commands.remove.positionals.path.describe`),
|
|
40
42
|
type: 'string',
|
|
41
43
|
});
|
|
42
44
|
return yargs;
|
|
@@ -21,9 +21,8 @@ const sandboxSync_1 = require("../../lib/sandboxSync");
|
|
|
21
21
|
const index_2 = require("../../lib/errorHandlers/index");
|
|
22
22
|
const buildAccount_1 = require("../../lib/buildAccount");
|
|
23
23
|
const accountNamePrompt_1 = require("../../lib/prompts/accountNamePrompt");
|
|
24
|
-
const i18nKey = 'commands.sandbox.subcommands.create';
|
|
25
24
|
exports.command = 'create';
|
|
26
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
25
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.create.describe`), false);
|
|
27
26
|
async function handler(args) {
|
|
28
27
|
const { name, type, force, derivedAccountId } = args;
|
|
29
28
|
const accountConfig = (0, config_1.getAccountConfig)(derivedAccountId);
|
|
@@ -31,7 +30,7 @@ async function handler(args) {
|
|
|
31
30
|
(0, usageTracking_1.trackCommandUsage)('sandbox-create', {}, derivedAccountId);
|
|
32
31
|
// Check if account config exists
|
|
33
32
|
if (!accountConfig) {
|
|
34
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
33
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.noAccountConfig`, {
|
|
35
34
|
accountId: derivedAccountId,
|
|
36
35
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
37
36
|
}));
|
|
@@ -40,7 +39,7 @@ async function handler(args) {
|
|
|
40
39
|
// Default account is not a production portal
|
|
41
40
|
if (accountConfig.accountType &&
|
|
42
41
|
accountConfig.accountType !== config_2.HUBSPOT_ACCOUNT_TYPES.STANDARD) {
|
|
43
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
42
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.invalidAccountType`, {
|
|
44
43
|
accountType: config_2.HUBSPOT_ACCOUNT_TYPE_STRINGS[config_2.HUBSPOT_ACCOUNT_TYPES[accountConfig.accountType]],
|
|
45
44
|
accountName: accountConfig.name || '',
|
|
46
45
|
}));
|
|
@@ -53,7 +52,7 @@ async function handler(args) {
|
|
|
53
52
|
typePrompt = await (0, sandboxesPrompt_1.sandboxTypePrompt)();
|
|
54
53
|
}
|
|
55
54
|
else {
|
|
56
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
55
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.optionMissing.type`));
|
|
57
56
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
58
57
|
}
|
|
59
58
|
}
|
|
@@ -86,7 +85,7 @@ async function handler(args) {
|
|
|
86
85
|
namePrompt = await (0, accountNamePrompt_1.hubspotAccountNamePrompt)({ accountType: sandboxType });
|
|
87
86
|
}
|
|
88
87
|
else {
|
|
89
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
88
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.optionMissing.name`));
|
|
90
89
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
@@ -111,7 +110,7 @@ async function handler(args) {
|
|
|
111
110
|
const sandboxAccountConfig = (0, config_1.getAccountConfig)(result.sandbox.sandboxHubId);
|
|
112
111
|
// Check if sandbox account config exists
|
|
113
112
|
if (!sandboxAccountConfig) {
|
|
114
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
113
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.create.failure.noSandboxAccountConfig`, {
|
|
115
114
|
accountId: result.sandbox.sandboxHubId,
|
|
116
115
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
117
116
|
}));
|
|
@@ -151,20 +150,20 @@ function builder(yargs) {
|
|
|
151
150
|
yargs.option('force', {
|
|
152
151
|
type: 'boolean',
|
|
153
152
|
alias: 'f',
|
|
154
|
-
describe: (0, lang_1.i18n)(
|
|
153
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.create.options.force.describe`),
|
|
155
154
|
});
|
|
156
155
|
yargs.option('name', {
|
|
157
|
-
describe: (0, lang_1.i18n)(
|
|
156
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.create.options.name.describe`),
|
|
158
157
|
type: 'string',
|
|
159
158
|
});
|
|
160
159
|
yargs.option('type', {
|
|
161
|
-
describe: (0, lang_1.i18n)(
|
|
160
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.create.options.type.describe`),
|
|
162
161
|
choices: Object.keys(sandboxes_1.SANDBOX_TYPE_MAP),
|
|
163
162
|
});
|
|
164
163
|
yargs.example([
|
|
165
164
|
[
|
|
166
165
|
'$0 sandbox create --name=MySandboxAccount --type=STANDARD',
|
|
167
|
-
(0, lang_1.i18n)(
|
|
166
|
+
(0, lang_1.i18n)(`commands.sandbox.subcommands.create.examples.default`),
|
|
168
167
|
],
|
|
169
168
|
]);
|
|
170
169
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
@@ -19,9 +19,8 @@ const accountsPrompt_1 = require("../../lib/prompts/accountsPrompt");
|
|
|
19
19
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
20
20
|
const promptUtils_1 = require("../../lib/prompts/promptUtils");
|
|
21
21
|
const ui_1 = require("../../lib/ui");
|
|
22
|
-
const i18nKey = 'commands.sandbox.subcommands.delete';
|
|
23
22
|
exports.command = 'delete';
|
|
24
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
23
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.describe`), false);
|
|
25
24
|
async function handler(args) {
|
|
26
25
|
const { providedAccountId, force } = args;
|
|
27
26
|
(0, usageTracking_1.trackCommandUsage)('sandbox-delete', {}, providedAccountId);
|
|
@@ -33,12 +32,12 @@ async function handler(args) {
|
|
|
33
32
|
else {
|
|
34
33
|
// Account is required, throw error if force flag is present and no account is specified
|
|
35
34
|
logger_1.logger.log('');
|
|
36
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
35
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noAccount`));
|
|
37
36
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
38
37
|
}
|
|
39
38
|
if (!accountPrompt) {
|
|
40
39
|
logger_1.logger.log('');
|
|
41
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
40
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noSandboxAccounts`, {
|
|
42
41
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
43
42
|
}));
|
|
44
43
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -46,7 +45,7 @@ async function handler(args) {
|
|
|
46
45
|
}
|
|
47
46
|
const sandboxAccountId = (0, config_1.getAccountId)(providedAccountId || accountPrompt.account);
|
|
48
47
|
if (!sandboxAccountId) {
|
|
49
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
48
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noSandboxAccountId`));
|
|
50
49
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
51
50
|
}
|
|
52
51
|
const isDefaultAccount = sandboxAccountId === (0, config_1.getAccountId)();
|
|
@@ -61,7 +60,7 @@ async function handler(args) {
|
|
|
61
60
|
else if (!force) {
|
|
62
61
|
const parentAccountPrompt = await (0, sandboxesPrompt_1.deleteSandboxPrompt)(true);
|
|
63
62
|
if (!parentAccountPrompt) {
|
|
64
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
63
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noParentAccount`, {
|
|
65
64
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
66
65
|
}));
|
|
67
66
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -69,7 +68,7 @@ async function handler(args) {
|
|
|
69
68
|
parentAccountId = (0, config_1.getAccountId)(parentAccountPrompt.account);
|
|
70
69
|
}
|
|
71
70
|
else {
|
|
72
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
71
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noParentAccount`, {
|
|
73
72
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
74
73
|
}));
|
|
75
74
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
@@ -80,7 +79,7 @@ async function handler(args) {
|
|
|
80
79
|
const command = `hs auth ${(0, config_1.getEnv)(sandboxAccountId) === 'qa' ? '--qa' : ''} --account=${parentAccountId}`;
|
|
81
80
|
if (parentAccountId && !(0, config_1.getAccountId)(parentAccountId)) {
|
|
82
81
|
logger_1.logger.log('');
|
|
83
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
82
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.noParentPortalAvailable`, {
|
|
84
83
|
parentAccountId,
|
|
85
84
|
url,
|
|
86
85
|
command,
|
|
@@ -88,11 +87,11 @@ async function handler(args) {
|
|
|
88
87
|
logger_1.logger.log('');
|
|
89
88
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
90
89
|
}
|
|
91
|
-
logger_1.logger.debug((0, lang_1.i18n)(
|
|
90
|
+
logger_1.logger.debug((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.debug.deleting`, {
|
|
92
91
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
93
92
|
}));
|
|
94
93
|
if (isDefaultAccount) {
|
|
95
|
-
logger_1.logger.info((0, lang_1.i18n)(
|
|
94
|
+
logger_1.logger.info((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.defaultAccountWarning`, {
|
|
96
95
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
97
96
|
}));
|
|
98
97
|
logger_1.logger.log('');
|
|
@@ -103,7 +102,7 @@ async function handler(args) {
|
|
|
103
102
|
{
|
|
104
103
|
name: 'confirmSandboxDeletePrompt',
|
|
105
104
|
type: 'confirm',
|
|
106
|
-
message: (0, lang_1.i18n)(
|
|
105
|
+
message: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.confirm`, {
|
|
107
106
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
108
107
|
}),
|
|
109
108
|
},
|
|
@@ -114,8 +113,8 @@ async function handler(args) {
|
|
|
114
113
|
}
|
|
115
114
|
await (0, sandboxHubs_1.deleteSandbox)(parentAccountId, sandboxAccountId);
|
|
116
115
|
const deleteKey = isDefaultAccount
|
|
117
|
-
?
|
|
118
|
-
:
|
|
116
|
+
? `commands.sandbox.subcommands.delete.success.deleteDefault`
|
|
117
|
+
: `commands.sandbox.subcommands.delete.success.delete`;
|
|
119
118
|
logger_1.logger.log('');
|
|
120
119
|
logger_1.logger.success((0, lang_1.i18n)(deleteKey, {
|
|
121
120
|
account: providedAccountId || accountPrompt.account,
|
|
@@ -139,7 +138,7 @@ async function handler(args) {
|
|
|
139
138
|
// Intercept invalid key error
|
|
140
139
|
// This command uses the parent portal PAK to delete a sandbox, so we must specify which account needs a new key
|
|
141
140
|
logger_1.logger.log('');
|
|
142
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
141
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.invalidKey`, {
|
|
143
142
|
account: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
144
143
|
authCommand: (0, ui_1.uiCommandReference)('hs auth'),
|
|
145
144
|
}));
|
|
@@ -150,7 +149,7 @@ async function handler(args) {
|
|
|
150
149
|
subCategory: 'SandboxErrors.USER_ACCESS_NOT_ALLOWED',
|
|
151
150
|
})) {
|
|
152
151
|
logger_1.logger.log('');
|
|
153
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
152
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.invalidUser`, {
|
|
154
153
|
accountName: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
155
154
|
parentAccountName: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
156
155
|
}));
|
|
@@ -162,7 +161,7 @@ async function handler(args) {
|
|
|
162
161
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
163
162
|
})) {
|
|
164
163
|
logger_1.logger.log('');
|
|
165
|
-
logger_1.logger.warn((0, lang_1.i18n)(
|
|
164
|
+
logger_1.logger.warn((0, lang_1.i18n)(`commands.sandbox.subcommands.delete.failure.objectNotFound`, {
|
|
166
165
|
account: (0, ui_1.uiAccountDescription)(sandboxAccountId),
|
|
167
166
|
}));
|
|
168
167
|
logger_1.logger.log('');
|
|
@@ -185,18 +184,18 @@ async function handler(args) {
|
|
|
185
184
|
}
|
|
186
185
|
function builder(yargs) {
|
|
187
186
|
yargs.option('account', {
|
|
188
|
-
describe: (0, lang_1.i18n)(
|
|
187
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.options.account.describe`),
|
|
189
188
|
type: 'string',
|
|
190
189
|
});
|
|
191
190
|
yargs.option('force', {
|
|
192
191
|
type: 'boolean',
|
|
193
192
|
alias: 'f',
|
|
194
|
-
describe: (0, lang_1.i18n)(
|
|
193
|
+
describe: (0, lang_1.i18n)(`commands.sandbox.subcommands.delete.options.force.describe`),
|
|
195
194
|
});
|
|
196
195
|
yargs.example([
|
|
197
196
|
[
|
|
198
197
|
'$0 sandbox delete --account=MySandboxAccount',
|
|
199
|
-
(0, lang_1.i18n)(
|
|
198
|
+
(0, lang_1.i18n)(`commands.sandbox.subcommands.delete.examples.default`),
|
|
200
199
|
],
|
|
201
200
|
]);
|
|
202
201
|
(0, commonOpts_1.addConfigOptions)(yargs);
|
package/commands/sandbox.js
CHANGED
|
@@ -40,9 +40,8 @@ const lang_1 = require("../lib/lang");
|
|
|
40
40
|
const ui_1 = require("../lib/ui");
|
|
41
41
|
const create = __importStar(require("./sandbox/create"));
|
|
42
42
|
const del = __importStar(require("./sandbox/delete"));
|
|
43
|
-
const i18nKey = 'commands.sandbox';
|
|
44
43
|
exports.command = ['sandbox', 'sandboxes'];
|
|
45
|
-
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(
|
|
44
|
+
exports.describe = (0, ui_1.uiBetaTag)((0, lang_1.i18n)(`commands.sandbox.describe`), false);
|
|
46
45
|
function builder(yargs) {
|
|
47
46
|
(0, commonOpts_1.addGlobalOptions)(yargs);
|
|
48
47
|
yargs.command(create).command(del).demandCommand(1, '');
|
|
@@ -13,9 +13,8 @@ const secretPrompt_1 = require("../../lib/prompts/secretPrompt");
|
|
|
13
13
|
const lang_1 = require("../../lib/lang");
|
|
14
14
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
15
|
const ui_2 = require("../../lib/ui");
|
|
16
|
-
const i18nKey = 'commands.secret.subcommands.add';
|
|
17
16
|
exports.command = 'add [name]';
|
|
18
|
-
exports.describe = (0, lang_1.i18n)(
|
|
17
|
+
exports.describe = (0, lang_1.i18n)(`commands.secret.subcommands.add.describe`);
|
|
19
18
|
async function handler(args) {
|
|
20
19
|
const { name, derivedAccountId } = args;
|
|
21
20
|
let secretName = name;
|
|
@@ -27,7 +26,7 @@ async function handler(args) {
|
|
|
27
26
|
}
|
|
28
27
|
const { data: { results: secrets }, } = await (0, secrets_1.fetchSecrets)(derivedAccountId);
|
|
29
28
|
if (secrets.includes(secretName)) {
|
|
30
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
29
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.add.errors.alreadyExists`, {
|
|
31
30
|
secretName,
|
|
32
31
|
command: (0, ui_2.uiCommandReference)('hs secret update'),
|
|
33
32
|
}));
|
|
@@ -35,13 +34,13 @@ async function handler(args) {
|
|
|
35
34
|
}
|
|
36
35
|
const { secretValue } = await (0, secretPrompt_1.secretValuePrompt)();
|
|
37
36
|
await (0, secrets_1.addSecret)(derivedAccountId, secretName, secretValue);
|
|
38
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
37
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.secret.subcommands.add.success.add`, {
|
|
39
38
|
accountIdentifier: (0, ui_1.uiAccountDescription)(derivedAccountId),
|
|
40
39
|
secretName,
|
|
41
40
|
}));
|
|
42
41
|
}
|
|
43
42
|
catch (err) {
|
|
44
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
43
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.add.errors.add`, {
|
|
45
44
|
secretName: secretName || '',
|
|
46
45
|
}));
|
|
47
46
|
(0, index_1.logError)(err, new index_1.ApiErrorContext({
|
|
@@ -55,7 +54,7 @@ function builder(yargs) {
|
|
|
55
54
|
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
56
55
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
57
56
|
yargs.positional('name', {
|
|
58
|
-
describe: (0, lang_1.i18n)(
|
|
57
|
+
describe: (0, lang_1.i18n)(`commands.secret.subcommands.add.positionals.name.describe`),
|
|
59
58
|
type: 'string',
|
|
60
59
|
});
|
|
61
60
|
return yargs;
|
|
@@ -13,9 +13,8 @@ const usageTracking_1 = require("../../lib/usageTracking");
|
|
|
13
13
|
const ui_1 = require("../../lib/ui");
|
|
14
14
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
15
15
|
const lang_1 = require("../../lib/lang");
|
|
16
|
-
const i18nKey = 'commands.secret.subcommands.delete';
|
|
17
16
|
exports.command = 'delete [name]';
|
|
18
|
-
exports.describe = (0, lang_1.i18n)(
|
|
17
|
+
exports.describe = (0, lang_1.i18n)(`commands.secret.subcommands.delete.describe`);
|
|
19
18
|
async function handler(args) {
|
|
20
19
|
const { name, derivedAccountId, force } = args;
|
|
21
20
|
let secretName = name;
|
|
@@ -23,30 +22,34 @@ async function handler(args) {
|
|
|
23
22
|
try {
|
|
24
23
|
const { data: { results: secrets }, } = await (0, secrets_1.fetchSecrets)(derivedAccountId);
|
|
25
24
|
if (secretName && !secrets.includes(secretName)) {
|
|
26
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
25
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.delete.errors.noSecret`, {
|
|
26
|
+
secretName,
|
|
27
|
+
}));
|
|
27
28
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
28
29
|
}
|
|
29
30
|
if (!secretName) {
|
|
30
|
-
const { secretToModify } = await (0, secretPrompt_1.secretListPrompt)(secrets, (0, lang_1.i18n)(
|
|
31
|
+
const { secretToModify } = await (0, secretPrompt_1.secretListPrompt)(secrets, (0, lang_1.i18n)(`commands.secret.subcommands.delete.selectSecret`));
|
|
31
32
|
secretName = secretToModify;
|
|
32
33
|
}
|
|
33
34
|
const confirmDelete = force ||
|
|
34
|
-
(await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(
|
|
35
|
+
(await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(`commands.secret.subcommands.delete.confirmDelete`, {
|
|
36
|
+
secretName,
|
|
37
|
+
}), {
|
|
35
38
|
defaultAnswer: false,
|
|
36
39
|
}));
|
|
37
40
|
if (!confirmDelete) {
|
|
38
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
41
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.secret.subcommands.delete.deleteCanceled`));
|
|
39
42
|
process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
40
43
|
}
|
|
41
44
|
await (0, secrets_1.deleteSecret)(derivedAccountId, secretName);
|
|
42
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
45
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.secret.subcommands.delete.success.delete`, {
|
|
43
46
|
accountIdentifier: (0, ui_1.uiAccountDescription)(derivedAccountId),
|
|
44
47
|
secretName,
|
|
45
48
|
}));
|
|
46
49
|
}
|
|
47
50
|
catch (err) {
|
|
48
51
|
if (secretName) {
|
|
49
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
52
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.secret.subcommands.delete.errors.delete`, {
|
|
50
53
|
secretName,
|
|
51
54
|
}));
|
|
52
55
|
}
|
|
@@ -62,7 +65,7 @@ function builder(yargs) {
|
|
|
62
65
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
63
66
|
yargs
|
|
64
67
|
.positional('name', {
|
|
65
|
-
describe: (0, lang_1.i18n)(
|
|
68
|
+
describe: (0, lang_1.i18n)(`commands.secret.subcommands.delete.positionals.name.describe`),
|
|
66
69
|
type: 'string',
|
|
67
70
|
})
|
|
68
71
|
.options('force', {
|