@hubspot/cli 7.3.0-experimental.2 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +25 -83
- package/commands/account/clean.js +9 -10
- package/commands/account/info.js +9 -11
- package/commands/account/list.js +7 -8
- package/commands/account/remove.js +8 -9
- package/commands/account/rename.js +4 -5
- package/commands/account/use.js +7 -8
- package/commands/cms/convertFields.js +5 -6
- package/commands/cms/getReactModule.js +7 -8
- package/commands/cms/lighthouseScore.js +15 -16
- package/commands/config/set.js +6 -7
- package/commands/create/api-sample.js +6 -7
- package/commands/create/module.js +1 -2
- package/commands/create/template.js +1 -2
- package/commands/customObject/create.js +8 -9
- package/commands/customObject/schema/create.js +5 -6
- package/commands/customObject/schema/delete.js +9 -10
- package/commands/customObject/schema/fetch-all.js +7 -8
- package/commands/customObject/schema/fetch.js +9 -10
- package/commands/customObject/schema/list.js +2 -3
- package/commands/customObject/schema/update.js +7 -8
- package/commands/customObject/schema.js +1 -2
- package/commands/filemanager/fetch.js +5 -6
- package/commands/filemanager/upload.js +12 -13
- package/commands/function/deploy.js +9 -10
- package/commands/function/list.js +4 -5
- package/commands/function/server.js +7 -8
- package/commands/project/create.js +1 -0
- package/lang/en.js +6 -1
- package/lang/en.lyaml +4 -0
- package/lib/DevServerManagerV2.d.ts +1 -2
- package/lib/DevServerManagerV2.js +1 -2
- package/lib/LocalDevManagerV2.js +10 -15
- package/lib/dependencyManagement.d.ts +5 -0
- package/lib/dependencyManagement.js +47 -22
- package/lib/doctor/Doctor.js +1 -2
- package/lib/projects/structure.d.ts +1 -2
- package/lib/projects/structure.js +0 -4
- package/package.json +3 -3
- package/types/ProjectComponents.d.ts +0 -15
- package/lib/npm.d.ts +0 -9
- package/lib/npm.js +0 -36
|
@@ -12,7 +12,6 @@ const { requestLighthouseScore, getLighthouseScoreStatus, getLighthouseScore, }
|
|
|
12
12
|
const { HUBSPOT_FOLDER, MARKETPLACE_FOLDER } = require('../../lib/constants');
|
|
13
13
|
const { uiLink } = require('../../lib/ui');
|
|
14
14
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
15
|
-
const i18nKey = 'commands.cms.subcommands.lighthouseScore';
|
|
16
15
|
const DEFAULT_TABLE_HEADER = [
|
|
17
16
|
'Accessibility',
|
|
18
17
|
'Best practices',
|
|
@@ -28,7 +27,7 @@ const selectTheme = async (accountId) => {
|
|
|
28
27
|
type: 'list',
|
|
29
28
|
look: false,
|
|
30
29
|
name: 'theme',
|
|
31
|
-
message: i18n(
|
|
30
|
+
message: i18n(`commands.cms.subcommands.lighthouseScore.info.promptMessage`),
|
|
32
31
|
choices: async () => {
|
|
33
32
|
try {
|
|
34
33
|
const { data: result } = await fetchThemes(accountId, {
|
|
@@ -43,7 +42,7 @@ const selectTheme = async (accountId) => {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
catch (err) {
|
|
46
|
-
logger.error(i18n(
|
|
45
|
+
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToFetchThemes`));
|
|
47
46
|
process.exit(EXIT_CODES.ERROR);
|
|
48
47
|
}
|
|
49
48
|
},
|
|
@@ -68,7 +67,7 @@ exports.handler = async (options) => {
|
|
|
68
67
|
isValidTheme = false;
|
|
69
68
|
}
|
|
70
69
|
if (!isValidTheme) {
|
|
71
|
-
logger.error(i18n(
|
|
70
|
+
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.themeNotFound`, { theme: themeToCheck }));
|
|
72
71
|
process.exit(EXIT_CODES.ERROR);
|
|
73
72
|
}
|
|
74
73
|
}
|
|
@@ -88,14 +87,14 @@ exports.handler = async (options) => {
|
|
|
88
87
|
logger.debug(err);
|
|
89
88
|
}
|
|
90
89
|
if (!requestResult || !requestResult.mobileId || !requestResult.desktopId) {
|
|
91
|
-
logger.error(i18n(
|
|
90
|
+
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
92
91
|
process.exit(EXIT_CODES.ERROR);
|
|
93
92
|
}
|
|
94
93
|
// Poll till scoring is finished
|
|
95
94
|
try {
|
|
96
95
|
SpinniesManager.init();
|
|
97
96
|
SpinniesManager.add('lighthouseScore', {
|
|
98
|
-
text: i18n(
|
|
97
|
+
text: i18n(`commands.cms.subcommands.lighthouseScore.info.generatingScore`, { theme: themeToCheck }),
|
|
99
98
|
});
|
|
100
99
|
const checkScoreStatus = async () => {
|
|
101
100
|
let desktopScoreStatus = 'COMPLETED';
|
|
@@ -157,7 +156,7 @@ exports.handler = async (options) => {
|
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
158
|
catch (err) {
|
|
160
|
-
logger.error(i18n(
|
|
159
|
+
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.errors.failedToGetLighthouseScore`));
|
|
161
160
|
process.exit(EXIT_CODES.ERROR);
|
|
162
161
|
}
|
|
163
162
|
if (verbose) {
|
|
@@ -176,7 +175,7 @@ exports.handler = async (options) => {
|
|
|
176
175
|
logger.log(getTableContents([tableHeader, averageTableData], {
|
|
177
176
|
border: { bodyLeft: ' ' },
|
|
178
177
|
}));
|
|
179
|
-
logger.log(i18n(
|
|
178
|
+
logger.log(i18n(`commands.cms.subcommands.lighthouseScore.info.pageTemplateScoreTitle`));
|
|
180
179
|
const table2Header = getTableHeader([
|
|
181
180
|
'Template path',
|
|
182
181
|
...DEFAULT_TABLE_HEADER,
|
|
@@ -195,19 +194,19 @@ exports.handler = async (options) => {
|
|
|
195
194
|
logger.log(getTableContents([table2Header, ...templateTableData], {
|
|
196
195
|
border: { bodyLeft: ' ' },
|
|
197
196
|
}));
|
|
198
|
-
logger.log(i18n(
|
|
197
|
+
logger.log(i18n(`commands.cms.subcommands.lighthouseScore.info.lighthouseLinksTitle`));
|
|
199
198
|
scoreResult.scores.forEach(score => {
|
|
200
199
|
logger.log(' ', uiLink(score.templatePath, score.link));
|
|
201
200
|
});
|
|
202
201
|
if (scoreResult.failedTemplatePaths.length) {
|
|
203
202
|
logger.log();
|
|
204
|
-
logger.error(i18n(
|
|
203
|
+
logger.error(i18n(`commands.cms.subcommands.lighthouseScore.info.failedTemplatePathsTitle`));
|
|
205
204
|
scoreResult.failedTemplatePaths.forEach(failedTemplatePath => {
|
|
206
205
|
logger.log(' ', failedTemplatePath);
|
|
207
206
|
});
|
|
208
207
|
}
|
|
209
208
|
logger.log();
|
|
210
|
-
logger.info(i18n(
|
|
209
|
+
logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.targetDeviceNote`, { target }));
|
|
211
210
|
}
|
|
212
211
|
else {
|
|
213
212
|
logger.log(`Theme: ${themeToCheck}`);
|
|
@@ -230,7 +229,7 @@ exports.handler = async (options) => {
|
|
|
230
229
|
logger.log(getTableContents([tableHeader, ...tableData], {
|
|
231
230
|
border: { bodyLeft: ' ' },
|
|
232
231
|
}));
|
|
233
|
-
logger.info(i18n(
|
|
232
|
+
logger.info(i18n(`commands.cms.subcommands.lighthouseScore.info.verboseOptionNote`));
|
|
234
233
|
}
|
|
235
234
|
logger.log();
|
|
236
235
|
logger.log(`Powered by ${uiLink('Google Lighthouse', 'https://developer.chrome.com/docs/lighthouse/overview/')}.`);
|
|
@@ -238,24 +237,24 @@ exports.handler = async (options) => {
|
|
|
238
237
|
};
|
|
239
238
|
exports.builder = yargs => {
|
|
240
239
|
yargs.option('theme', {
|
|
241
|
-
describe: i18n(
|
|
240
|
+
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.theme.describe`),
|
|
242
241
|
type: 'string',
|
|
243
242
|
});
|
|
244
243
|
yargs.option('target', {
|
|
245
|
-
describe: i18n(
|
|
244
|
+
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.target.describe`),
|
|
246
245
|
type: 'string',
|
|
247
246
|
choices: ['desktop', 'mobile'],
|
|
248
247
|
default: 'desktop',
|
|
249
248
|
});
|
|
250
249
|
yargs.option('verbose', {
|
|
251
|
-
describe: i18n(
|
|
250
|
+
describe: i18n(`commands.cms.subcommands.lighthouseScore.options.verbose.describe`),
|
|
252
251
|
boolean: true,
|
|
253
252
|
default: false,
|
|
254
253
|
});
|
|
255
254
|
yargs.example([
|
|
256
255
|
[
|
|
257
256
|
'$0 cms lighthouse-score --theme=my-theme',
|
|
258
|
-
i18n(
|
|
257
|
+
i18n(`commands.cms.subcommands.lighthouseScore.examples.default`),
|
|
259
258
|
],
|
|
260
259
|
]);
|
|
261
260
|
addConfigOptions(yargs);
|
package/commands/config/set.js
CHANGED
|
@@ -6,9 +6,8 @@ const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
|
6
6
|
const { promptUser } = require('../../lib/prompts/promptUtils');
|
|
7
7
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
8
8
|
const { setDefaultCmsPublishMode, setHttpTimeout, setAllowUsageTracking, } = require('../../lib/configOptions');
|
|
9
|
-
const i18nKey = 'commands.config.subcommands.set';
|
|
10
9
|
exports.command = 'set';
|
|
11
|
-
exports.describe = i18n(
|
|
10
|
+
exports.describe = i18n(`commands.config.subcommands.set.describe`);
|
|
12
11
|
const selectOptions = async () => {
|
|
13
12
|
const { cmsPublishMode } = await promptUser([
|
|
14
13
|
{
|
|
@@ -16,7 +15,7 @@ const selectOptions = async () => {
|
|
|
16
15
|
look: false,
|
|
17
16
|
name: 'cmsPublishMode',
|
|
18
17
|
pageSize: 20,
|
|
19
|
-
message: i18n(
|
|
18
|
+
message: i18n(`commands.config.subcommands.set.promptMessage`),
|
|
20
19
|
choices: [
|
|
21
20
|
{
|
|
22
21
|
name: 'Default CMS publish mode',
|
|
@@ -59,21 +58,21 @@ exports.builder = yargs => {
|
|
|
59
58
|
yargs
|
|
60
59
|
.options({
|
|
61
60
|
'default-cms-publish-mode': {
|
|
62
|
-
describe: i18n(
|
|
61
|
+
describe: i18n(`commands.config.subcommands.set.options.defaultMode.describe`),
|
|
63
62
|
type: 'string',
|
|
64
63
|
},
|
|
65
64
|
'allow-usage-tracking': {
|
|
66
|
-
describe: i18n(
|
|
65
|
+
describe: i18n(`commands.config.subcommands.set.options.allowUsageTracking.describe`),
|
|
67
66
|
type: 'boolean',
|
|
68
67
|
},
|
|
69
68
|
'http-timeout': {
|
|
70
|
-
describe: i18n(
|
|
69
|
+
describe: i18n(`commands.config.subcommands.set.options.httpTimeout.describe`),
|
|
71
70
|
type: 'string',
|
|
72
71
|
},
|
|
73
72
|
})
|
|
74
73
|
.conflicts('defaultCmsPublishMode', 'allowUsageTracking')
|
|
75
74
|
.conflicts('defaultCmsPublishMode', 'httpTimeout')
|
|
76
75
|
.conflicts('allowUsageTracking', 'httpTimeout')
|
|
77
|
-
.example([['$0 config set', i18n(
|
|
76
|
+
.example([['$0 config set', i18n(`commands.config.subcommands.set.examples.default`)]]);
|
|
78
77
|
return yargs;
|
|
79
78
|
};
|
|
@@ -11,13 +11,12 @@ const { cloneGithubRepo } = require('@hubspot/local-dev-lib/github');
|
|
|
11
11
|
const { i18n } = require('../../lib/lang');
|
|
12
12
|
const { debugError } = require('../../lib/errorHandlers');
|
|
13
13
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
14
|
-
const i18nKey = 'commands.create.subcommands.apiSample';
|
|
15
14
|
module.exports = {
|
|
16
15
|
hidden: true,
|
|
17
16
|
dest: ({ dest }) => dest,
|
|
18
17
|
validate: ({ name }) => {
|
|
19
18
|
if (!name) {
|
|
20
|
-
logger.error(i18n(
|
|
19
|
+
logger.error(i18n(`commands.create.subcommands.apiSample.errors.nameRequired`));
|
|
21
20
|
return false;
|
|
22
21
|
}
|
|
23
22
|
return true;
|
|
@@ -25,7 +24,7 @@ module.exports = {
|
|
|
25
24
|
execute: async ({ dest, name, assetType, options }) => {
|
|
26
25
|
const filePath = path.join(dest, name);
|
|
27
26
|
if (fs.existsSync(filePath)) {
|
|
28
|
-
const overwrite = await confirmPrompt(i18n(
|
|
27
|
+
const overwrite = await confirmPrompt(i18n(`commands.create.subcommands.apiSample.folderOverwritePrompt`, { folderName: filePath }), { defaultAnswer: false });
|
|
29
28
|
if (overwrite) {
|
|
30
29
|
fs.rmdirSync(filePath, { recursive: true });
|
|
31
30
|
}
|
|
@@ -42,15 +41,15 @@ module.exports = {
|
|
|
42
41
|
debugError(err);
|
|
43
42
|
}
|
|
44
43
|
if (!samplesConfig) {
|
|
45
|
-
logger.error(i18n(
|
|
44
|
+
logger.error(i18n(`commands.create.subcommands.apiSample.errors.noSamples`));
|
|
46
45
|
process.exit(EXIT_CODES.ERROR);
|
|
47
46
|
}
|
|
48
47
|
const { sampleType, sampleLanguage } = await createApiSamplePrompt(samplesConfig);
|
|
49
48
|
if (!sampleType || !sampleLanguage) {
|
|
50
|
-
logger.error(i18n(
|
|
49
|
+
logger.error(i18n(`commands.create.subcommands.apiSample.errors.noSamples`));
|
|
51
50
|
process.exit(EXIT_CODES.ERROR);
|
|
52
51
|
}
|
|
53
|
-
logger.info(i18n(
|
|
52
|
+
logger.info(i18n(`commands.create.subcommands.apiSample.info.sampleChosen`, {
|
|
54
53
|
sampleType,
|
|
55
54
|
sampleLanguage,
|
|
56
55
|
}));
|
|
@@ -63,7 +62,7 @@ module.exports = {
|
|
|
63
62
|
if (fs.existsSync(`${filePath}/.env.template`)) {
|
|
64
63
|
fs.copySync(`${filePath}/.env.template`, `${filePath}/.env`);
|
|
65
64
|
}
|
|
66
|
-
logger.success(i18n(
|
|
65
|
+
logger.success(i18n(`commands.create.subcommands.apiSample.success.sampleCreated`, {
|
|
67
66
|
filePath,
|
|
68
67
|
}));
|
|
69
68
|
}
|
|
@@ -7,12 +7,11 @@ const { i18n } = require('../../lib/lang');
|
|
|
7
7
|
const { createModulePrompt } = require('../../lib/prompts/createModulePrompt');
|
|
8
8
|
const { logError } = require('../../lib/errorHandlers/index');
|
|
9
9
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
10
|
-
const i18nKey = 'commands.create.subcommands.module';
|
|
11
10
|
module.exports = {
|
|
12
11
|
dest: ({ dest }) => dest,
|
|
13
12
|
validate: ({ name }) => {
|
|
14
13
|
if (!name) {
|
|
15
|
-
logger.error(i18n(
|
|
14
|
+
logger.error(i18n(`commands.create.subcommands.module.errors.nameRequired`));
|
|
16
15
|
return false;
|
|
17
16
|
}
|
|
18
17
|
return true;
|
|
@@ -7,12 +7,11 @@ const { logError } = require('../../lib/errorHandlers/index');
|
|
|
7
7
|
const { createTemplatePrompt, } = require('../../lib/prompts/createTemplatePrompt');
|
|
8
8
|
const { i18n } = require('../../lib/lang');
|
|
9
9
|
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
10
|
-
const i18nKey = 'commands.create.subcommands.template';
|
|
11
10
|
module.exports = {
|
|
12
11
|
dest: ({ dest }) => dest,
|
|
13
12
|
validate: ({ name }) => {
|
|
14
13
|
if (!name) {
|
|
15
|
-
logger.error(i18n(
|
|
14
|
+
logger.error(i18n(`commands.create.subcommands.template.errors.nameRequired`));
|
|
16
15
|
return false;
|
|
17
16
|
}
|
|
18
17
|
return true;
|
|
@@ -14,33 +14,32 @@ const lang_1 = require("../../lib/lang");
|
|
|
14
14
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
15
15
|
const customObject_1 = require("../../lib/customObject");
|
|
16
16
|
const commonOpts_1 = require("../../lib/commonOpts");
|
|
17
|
-
const i18nKey = 'commands.customObject.subcommands.create';
|
|
18
17
|
exports.command = 'create [name]';
|
|
19
|
-
exports.describe = (0, lang_1.i18n)(
|
|
18
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.create.describe`);
|
|
20
19
|
async function handler(args) {
|
|
21
20
|
const { path, name: providedName, derivedAccountId } = args;
|
|
22
21
|
let definitionPath = path;
|
|
23
22
|
let name = providedName;
|
|
24
23
|
(0, usageTracking_1.trackCommandUsage)('custom-object-batch-create', {}, derivedAccountId);
|
|
25
24
|
if (!name) {
|
|
26
|
-
name = await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(
|
|
25
|
+
name = await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.create.inputName`));
|
|
27
26
|
}
|
|
28
27
|
if (!definitionPath) {
|
|
29
|
-
definitionPath = await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(
|
|
28
|
+
definitionPath = await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.create.inputPath`));
|
|
30
29
|
}
|
|
31
30
|
const filePath = (0, path_1.getAbsoluteFilePath)(definitionPath);
|
|
32
31
|
const objectJson = (0, validation_1.checkAndConvertToJson)(filePath);
|
|
33
32
|
if (!(0, customObject_1.isObjectDefinition)(objectJson)) {
|
|
34
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
33
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.create.errors.invalidObjectDefinition`));
|
|
35
34
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
36
35
|
}
|
|
37
36
|
try {
|
|
38
37
|
await (0, customObjects_1.batchCreateObjects)(derivedAccountId, name, objectJson);
|
|
39
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
38
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.create.success.objectsCreated`));
|
|
40
39
|
}
|
|
41
40
|
catch (e) {
|
|
42
41
|
(0, index_1.logError)(e, { accountId: derivedAccountId });
|
|
43
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
42
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.create.errors.creationFailed`, {
|
|
44
43
|
definition: definitionPath,
|
|
45
44
|
}));
|
|
46
45
|
}
|
|
@@ -51,11 +50,11 @@ function builder(yargs) {
|
|
|
51
50
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
52
51
|
yargs
|
|
53
52
|
.positional('name', {
|
|
54
|
-
describe: (0, lang_1.i18n)(
|
|
53
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.create.positionals.name.describe`),
|
|
55
54
|
type: 'string',
|
|
56
55
|
})
|
|
57
56
|
.option('path', {
|
|
58
|
-
describe: (0, lang_1.i18n)(
|
|
57
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.create.options.path.describe`),
|
|
59
58
|
type: 'string',
|
|
60
59
|
});
|
|
61
60
|
return yargs;
|
|
@@ -16,27 +16,26 @@ const commonOpts_1 = require("../../../lib/commonOpts");
|
|
|
16
16
|
const lang_1 = require("../../../lib/lang");
|
|
17
17
|
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
18
18
|
const customObject_1 = require("../../../lib/customObject");
|
|
19
|
-
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.create';
|
|
20
19
|
exports.command = 'create';
|
|
21
|
-
exports.describe = (0, lang_1.i18n)(
|
|
20
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.create.describe`);
|
|
22
21
|
async function handler(args) {
|
|
23
22
|
const { path, derivedAccountId } = args;
|
|
24
23
|
(0, usageTracking_1.trackCommandUsage)('custom-object-schema-create', {}, derivedAccountId);
|
|
25
24
|
const filePath = (0, path_1.getAbsoluteFilePath)(path);
|
|
26
25
|
const schemaJson = (0, validation_1.checkAndConvertToJson)(filePath);
|
|
27
26
|
if (!(0, customObject_1.isSchemaDefinition)(schemaJson)) {
|
|
28
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
27
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.create.errors.invalidSchema`));
|
|
29
28
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
30
29
|
}
|
|
31
30
|
try {
|
|
32
31
|
const { data } = await (0, customObjects_1.createObjectSchema)(derivedAccountId, schemaJson);
|
|
33
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
32
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.create.success.schemaViewable`, {
|
|
34
33
|
url: `${(0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)() === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`,
|
|
35
34
|
}));
|
|
36
35
|
}
|
|
37
36
|
catch (e) {
|
|
38
37
|
(0, index_1.logError)(e, { accountId: derivedAccountId });
|
|
39
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
38
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.create.errors.creationFailed`, {
|
|
40
39
|
definition: path,
|
|
41
40
|
}));
|
|
42
41
|
}
|
|
@@ -47,7 +46,7 @@ function builder(yargs) {
|
|
|
47
46
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
48
47
|
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
49
48
|
yargs.option('path', {
|
|
50
|
-
describe: (0, lang_1.i18n)(
|
|
49
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.create.options.definition.describe`),
|
|
51
50
|
type: 'string',
|
|
52
51
|
required: true,
|
|
53
52
|
});
|
|
@@ -11,9 +11,8 @@ const usageTracking_1 = require("../../../lib/usageTracking");
|
|
|
11
11
|
const lang_1 = require("../../../lib/lang");
|
|
12
12
|
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
13
13
|
const commonOpts_1 = require("../../../lib/commonOpts");
|
|
14
|
-
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.delete';
|
|
15
14
|
exports.command = 'delete [name]';
|
|
16
|
-
exports.describe = (0, lang_1.i18n)(
|
|
15
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.describe`);
|
|
17
16
|
async function handler(args) {
|
|
18
17
|
const { name: providedName, force, derivedAccountId } = args;
|
|
19
18
|
(0, usageTracking_1.trackCommandUsage)('custom-object-schema-delete', {}, derivedAccountId);
|
|
@@ -24,23 +23,23 @@ async function handler(args) {
|
|
|
24
23
|
name =
|
|
25
24
|
providedName && typeof providedName === 'string'
|
|
26
25
|
? providedName
|
|
27
|
-
: await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(
|
|
26
|
+
: await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.selectSchema`), {
|
|
28
27
|
choices: schemaNames,
|
|
29
28
|
});
|
|
30
29
|
const shouldDelete = force ||
|
|
31
|
-
(await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(
|
|
30
|
+
(await (0, promptUtils_1.confirmPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.confirmDelete`, { name })));
|
|
32
31
|
if (!shouldDelete) {
|
|
33
|
-
logger_1.logger.info((0, lang_1.i18n)(
|
|
32
|
+
logger_1.logger.info((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.deleteCancelled`, { name }));
|
|
34
33
|
return process.exit(exitCodes_1.EXIT_CODES.SUCCESS);
|
|
35
34
|
}
|
|
36
35
|
await (0, customObjects_1.deleteObjectSchema)(derivedAccountId, name);
|
|
37
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
36
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.success.delete`, {
|
|
38
37
|
name,
|
|
39
38
|
}));
|
|
40
39
|
}
|
|
41
40
|
catch (e) {
|
|
42
41
|
(0, errorHandlers_1.logError)(e);
|
|
43
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
42
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.errors.delete`, {
|
|
44
43
|
name: name || '',
|
|
45
44
|
}));
|
|
46
45
|
}
|
|
@@ -51,14 +50,14 @@ function builder(yargs) {
|
|
|
51
50
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
52
51
|
yargs
|
|
53
52
|
.example([
|
|
54
|
-
['$0 schema delete schemaName', (0, lang_1.i18n)(
|
|
53
|
+
['$0 schema delete schemaName', (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.examples.default`)],
|
|
55
54
|
])
|
|
56
55
|
.positional('name', {
|
|
57
|
-
describe: (0, lang_1.i18n)(
|
|
56
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.positionals.name.describe`),
|
|
58
57
|
type: 'string',
|
|
59
58
|
})
|
|
60
59
|
.option('force', {
|
|
61
|
-
describe: (0, lang_1.i18n)(
|
|
60
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.delete.options.force.describe`),
|
|
62
61
|
type: 'boolean',
|
|
63
62
|
});
|
|
64
63
|
return yargs;
|
|
@@ -11,23 +11,22 @@ const lang_1 = require("../../../lib/lang");
|
|
|
11
11
|
const schema_1 = require("../../../lib/schema");
|
|
12
12
|
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
13
13
|
const commonOpts_1 = require("../../../lib/commonOpts");
|
|
14
|
-
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.fetchAll';
|
|
15
14
|
exports.command = 'fetch-all [dest]';
|
|
16
|
-
exports.describe = (0, lang_1.i18n)(
|
|
15
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.describe`);
|
|
17
16
|
async function handler(args) {
|
|
18
17
|
const { derivedAccountId, dest: providedDest } = args;
|
|
19
18
|
(0, usageTracking_1.trackCommandUsage)('custom-object-schema-fetch-all', {}, derivedAccountId);
|
|
20
19
|
try {
|
|
21
|
-
const dest = providedDest || (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(
|
|
20
|
+
const dest = providedDest || (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.inputDest`)));
|
|
22
21
|
const schemas = await (0, customObjects_1.downloadSchemas)(derivedAccountId, dest);
|
|
23
22
|
(0, schema_1.logSchemas)(schemas);
|
|
24
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
23
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.success.fetch`, {
|
|
25
24
|
path: (0, customObjects_1.getResolvedPath)(dest),
|
|
26
25
|
}));
|
|
27
26
|
}
|
|
28
27
|
catch (e) {
|
|
29
28
|
(0, errorHandlers_1.logError)(e);
|
|
30
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
29
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.errors.fetch`));
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
function builder(yargs) {
|
|
@@ -38,15 +37,15 @@ function builder(yargs) {
|
|
|
38
37
|
.example([
|
|
39
38
|
[
|
|
40
39
|
'$0 custom-object schema fetch-all',
|
|
41
|
-
(0, lang_1.i18n)(
|
|
40
|
+
(0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.examples.default`),
|
|
42
41
|
],
|
|
43
42
|
[
|
|
44
43
|
'$0 custom-object schema fetch-all my/folder',
|
|
45
|
-
(0, lang_1.i18n)(
|
|
44
|
+
(0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.examples.specifyPath`),
|
|
46
45
|
],
|
|
47
46
|
])
|
|
48
47
|
.positional('dest', {
|
|
49
|
-
describe: (0, lang_1.i18n)(
|
|
48
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetchAll.positionals.dest.describe`),
|
|
50
49
|
type: 'string',
|
|
51
50
|
});
|
|
52
51
|
return yargs;
|
|
@@ -11,9 +11,8 @@ const usageTracking_1 = require("../../../lib/usageTracking");
|
|
|
11
11
|
const lang_1 = require("../../../lib/lang");
|
|
12
12
|
const errorHandlers_1 = require("../../../lib/errorHandlers");
|
|
13
13
|
const commonOpts_1 = require("../../../lib/commonOpts");
|
|
14
|
-
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.fetch';
|
|
15
14
|
exports.command = 'fetch [name] [dest]';
|
|
16
|
-
exports.describe = (0, lang_1.i18n)(
|
|
15
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.describe`);
|
|
17
16
|
async function handler(args) {
|
|
18
17
|
const { name: providedName, dest: providedDest, derivedAccountId } = args;
|
|
19
18
|
(0, usageTracking_1.trackCommandUsage)('custom-object-schema-fetch', {}, derivedAccountId);
|
|
@@ -23,18 +22,18 @@ async function handler(args) {
|
|
|
23
22
|
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
24
23
|
name =
|
|
25
24
|
providedName ||
|
|
26
|
-
(await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(
|
|
25
|
+
(await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.selectSchema`), {
|
|
27
26
|
choices: schemaNames,
|
|
28
27
|
}));
|
|
29
|
-
const dest = providedDest || (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(
|
|
28
|
+
const dest = providedDest || (await (0, promptUtils_1.inputPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.inputDest`)));
|
|
30
29
|
await (0, customObjects_2.downloadSchema)(derivedAccountId, name, dest);
|
|
31
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
30
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.success.savedToPath`, {
|
|
32
31
|
path: (0, customObjects_2.getResolvedPath)(dest, name),
|
|
33
32
|
}));
|
|
34
33
|
}
|
|
35
34
|
catch (e) {
|
|
36
35
|
(0, errorHandlers_1.logError)(e);
|
|
37
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
36
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.errors.fetch`, {
|
|
38
37
|
name: name || '',
|
|
39
38
|
}));
|
|
40
39
|
}
|
|
@@ -47,19 +46,19 @@ function builder(yargs) {
|
|
|
47
46
|
.example([
|
|
48
47
|
[
|
|
49
48
|
'$0 custom-object schema fetch schemaName',
|
|
50
|
-
(0, lang_1.i18n)(
|
|
49
|
+
(0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.examples.default`),
|
|
51
50
|
],
|
|
52
51
|
[
|
|
53
52
|
'$0 custom-object schema fetch schemaName my/folder',
|
|
54
|
-
(0, lang_1.i18n)(
|
|
53
|
+
(0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.examples.specifyPath`),
|
|
55
54
|
],
|
|
56
55
|
])
|
|
57
56
|
.positional('name', {
|
|
58
|
-
describe: (0, lang_1.i18n)(
|
|
57
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.positionals.name.describe`),
|
|
59
58
|
type: 'string',
|
|
60
59
|
})
|
|
61
60
|
.positional('dest', {
|
|
62
|
-
describe: (0, lang_1.i18n)(
|
|
61
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.fetch.positionals.dest.describe`),
|
|
63
62
|
type: 'string',
|
|
64
63
|
});
|
|
65
64
|
return yargs;
|
|
@@ -9,9 +9,8 @@ const index_1 = require("../../../lib/errorHandlers/index");
|
|
|
9
9
|
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
10
10
|
const schema_1 = require("../../../lib/schema");
|
|
11
11
|
const lang_1 = require("../../../lib/lang");
|
|
12
|
-
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.list';
|
|
13
12
|
exports.command = 'list';
|
|
14
|
-
exports.describe = (0, lang_1.i18n)(
|
|
13
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.list.describe`);
|
|
15
14
|
async function handler(args) {
|
|
16
15
|
const { derivedAccountId } = args;
|
|
17
16
|
(0, usageTracking_1.trackCommandUsage)('custom-object-schema-list', {}, derivedAccountId);
|
|
@@ -20,7 +19,7 @@ async function handler(args) {
|
|
|
20
19
|
}
|
|
21
20
|
catch (e) {
|
|
22
21
|
(0, index_1.logError)(e);
|
|
23
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
22
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.list.errors.list`));
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
function builder(yargs) {
|
|
@@ -17,16 +17,15 @@ const commonOpts_1 = require("../../../lib/commonOpts");
|
|
|
17
17
|
const lang_1 = require("../../../lib/lang");
|
|
18
18
|
const exitCodes_1 = require("../../../lib/enums/exitCodes");
|
|
19
19
|
const customObject_1 = require("../../../lib/customObject");
|
|
20
|
-
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.update';
|
|
21
20
|
exports.command = 'update [name]';
|
|
22
|
-
exports.describe = (0, lang_1.i18n)(
|
|
21
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.describe`);
|
|
23
22
|
async function handler(args) {
|
|
24
23
|
const { path, name: providedName, derivedAccountId } = args;
|
|
25
24
|
(0, usageTracking_1.trackCommandUsage)('custom-object-schema-update', {}, derivedAccountId);
|
|
26
25
|
const filePath = (0, path_1.getAbsoluteFilePath)(path);
|
|
27
26
|
const schemaJson = (0, validation_1.checkAndConvertToJson)(filePath);
|
|
28
27
|
if (!(0, customObject_1.isSchemaDefinition)(schemaJson)) {
|
|
29
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
28
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.errors.invalidSchema`));
|
|
30
29
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
31
30
|
}
|
|
32
31
|
let name = providedName;
|
|
@@ -36,17 +35,17 @@ async function handler(args) {
|
|
|
36
35
|
name =
|
|
37
36
|
providedName && typeof providedName === 'string'
|
|
38
37
|
? providedName
|
|
39
|
-
: await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(
|
|
38
|
+
: await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.selectSchema`), {
|
|
40
39
|
choices: schemaNames,
|
|
41
40
|
});
|
|
42
41
|
const { data } = await (0, customObjects_1.updateObjectSchema)(derivedAccountId, name, schemaJson);
|
|
43
|
-
logger_1.logger.success((0, lang_1.i18n)(
|
|
42
|
+
logger_1.logger.success((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.success.viewAtUrl`, {
|
|
44
43
|
url: `${(0, urls_1.getHubSpotWebsiteOrigin)((0, config_1.getEnv)() === 'qa' ? environments_1.ENVIRONMENTS.QA : environments_1.ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`,
|
|
45
44
|
}));
|
|
46
45
|
}
|
|
47
46
|
catch (e) {
|
|
48
47
|
(0, index_1.logError)(e, { accountId: derivedAccountId });
|
|
49
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
48
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.errors.update`, {
|
|
50
49
|
definition: path,
|
|
51
50
|
}));
|
|
52
51
|
}
|
|
@@ -58,11 +57,11 @@ function builder(yargs) {
|
|
|
58
57
|
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
59
58
|
yargs
|
|
60
59
|
.positional('name', {
|
|
61
|
-
describe: (0, lang_1.i18n)(
|
|
60
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.positionals.name.describe`),
|
|
62
61
|
type: 'string',
|
|
63
62
|
})
|
|
64
63
|
.option('path', {
|
|
65
|
-
describe: (0, lang_1.i18n)(
|
|
64
|
+
describe: (0, lang_1.i18n)(`commands.customObject.subcommands.schema.subcommands.update.options.path.describe`),
|
|
66
65
|
type: 'string',
|
|
67
66
|
required: true,
|
|
68
67
|
});
|
|
@@ -43,9 +43,8 @@ const deleteCommand = __importStar(require("./schema/delete"));
|
|
|
43
43
|
const listCommand = __importStar(require("./schema/list"));
|
|
44
44
|
const updateSchema = __importStar(require("./schema/update"));
|
|
45
45
|
const lang_1 = require("../../lib/lang");
|
|
46
|
-
const i18nKey = 'commands.customObject.subcommands.schema';
|
|
47
46
|
exports.command = ['schema', 'schemas'];
|
|
48
|
-
exports.describe = (0, lang_1.i18n)(
|
|
47
|
+
exports.describe = (0, lang_1.i18n)(`commands.customObject.subcommands.schema.describe`);
|
|
49
48
|
function handler() {
|
|
50
49
|
// No specific handler needed for the schema command
|
|
51
50
|
}
|
|
@@ -11,13 +11,12 @@ const usageTracking_1 = require("../../lib/usageTracking");
|
|
|
11
11
|
const lang_1 = require("../../lib/lang");
|
|
12
12
|
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
13
13
|
const index_1 = require("../../lib/errorHandlers/index");
|
|
14
|
-
const i18nKey = 'commands.filemanager.subcommands.fetch';
|
|
15
14
|
exports.command = 'fetch <src> [dest]';
|
|
16
|
-
exports.describe = (0, lang_1.i18n)(
|
|
15
|
+
exports.describe = (0, lang_1.i18n)(`commands.filemanager.subcommands.fetch.describe`);
|
|
17
16
|
async function handler(args) {
|
|
18
17
|
const { src, includeArchived, derivedAccountId, overwrite } = args;
|
|
19
18
|
if (typeof src !== 'string') {
|
|
20
|
-
logger_1.logger.error((0, lang_1.i18n)(
|
|
19
|
+
logger_1.logger.error((0, lang_1.i18n)(`commands.filemanager.subcommands.fetch.errors.sourceRequired`));
|
|
21
20
|
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
22
21
|
}
|
|
23
22
|
const dest = (0, filesystem_1.resolveLocalPath)(args.dest);
|
|
@@ -38,16 +37,16 @@ function builder(yargs) {
|
|
|
38
37
|
(0, commonOpts_1.addOverwriteOptions)(yargs);
|
|
39
38
|
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
40
39
|
yargs.positional('src', {
|
|
41
|
-
describe: (0, lang_1.i18n)(
|
|
40
|
+
describe: (0, lang_1.i18n)(`commands.filemanager.subcommands.fetch.positionals.src.describe`),
|
|
42
41
|
type: 'string',
|
|
43
42
|
});
|
|
44
43
|
yargs.positional('dest', {
|
|
45
|
-
describe: (0, lang_1.i18n)(
|
|
44
|
+
describe: (0, lang_1.i18n)(`commands.filemanager.subcommands.fetch.positionals.dest.describe`),
|
|
46
45
|
type: 'string',
|
|
47
46
|
});
|
|
48
47
|
yargs.option('include-archived', {
|
|
49
48
|
alias: ['i'],
|
|
50
|
-
describe: (0, lang_1.i18n)(
|
|
49
|
+
describe: (0, lang_1.i18n)(`commands.filemanager.subcommands.fetch.options.includeArchived.describe`),
|
|
51
50
|
type: 'boolean',
|
|
52
51
|
});
|
|
53
52
|
return yargs;
|