@hubspot/cli 7.2.0-experimental.0 → 7.2.2-experimental.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 +52 -3
- package/commands/account/auth.d.ts +10 -0
- package/commands/account/auth.js +154 -0
- package/commands/account/createOverride.d.ts +10 -0
- package/commands/account/createOverride.js +62 -0
- package/commands/account/list.js +4 -0
- package/commands/account.js +4 -0
- package/commands/auth.js +9 -5
- package/commands/config/migrate.d.ts +10 -0
- package/commands/config/migrate.js +86 -0
- package/commands/config/set.d.ts +12 -0
- package/commands/config/set.js +30 -29
- package/commands/config.d.ts +4 -1
- package/commands/config.js +45 -10
- package/commands/create/api-sample.js +4 -14
- package/commands/customObject/create.d.ts +0 -11
- package/commands/customObject/create.js +28 -37
- package/commands/customObject/schema/create.d.ts +0 -10
- package/commands/customObject/schema/create.js +42 -40
- package/commands/customObject/schema/delete.d.ts +0 -11
- package/commands/customObject/schema/delete.js +27 -34
- package/commands/customObject/schema/fetch-all.d.ts +0 -10
- package/commands/customObject/schema/fetch-all.js +24 -31
- package/commands/customObject/schema/fetch.d.ts +0 -11
- package/commands/customObject/schema/fetch.js +42 -34
- package/commands/customObject/schema/list.d.ts +0 -7
- package/commands/customObject/schema/list.js +14 -23
- package/commands/customObject/schema/update.d.ts +0 -11
- package/commands/customObject/schema/update.js +46 -44
- package/commands/customObject/schema.d.ts +1 -5
- package/commands/customObject/schema.js +11 -49
- package/commands/customObject.d.ts +1 -4
- package/commands/customObject.js +21 -54
- package/commands/filemanager/fetch.d.ts +0 -12
- package/commands/filemanager/fetch.js +30 -33
- package/commands/filemanager/upload.d.ts +0 -11
- package/commands/filemanager/upload.js +47 -53
- package/commands/filemanager.d.ts +1 -4
- package/commands/filemanager.js +7 -41
- package/commands/init.js +15 -26
- package/commands/project/add.js +16 -62
- package/commands/project/cloneApp.js +3 -3
- package/commands/project/create.js +15 -70
- package/commands/project/dev.d.ts +0 -7
- package/commands/project/dev.js +75 -96
- package/commands/project/migrateApp.js +3 -3
- package/commands/project/upload.js +2 -7
- package/commands/sandbox/create.d.ts +0 -12
- package/commands/sandbox/create.js +72 -90
- package/commands/sandbox/delete.d.ts +0 -11
- package/commands/sandbox/delete.js +95 -112
- package/commands/sandbox.d.ts +1 -4
- package/commands/sandbox.js +10 -44
- package/commands/theme/generate-selectors.d.ts +0 -9
- package/commands/theme/generate-selectors.js +43 -61
- package/commands/theme/marketplace-validate.d.ts +0 -10
- package/commands/theme/marketplace-validate.js +26 -32
- package/commands/theme/preview.d.ts +0 -16
- package/commands/theme/preview.js +97 -104
- package/commands/theme.d.ts +1 -4
- package/commands/theme.js +10 -44
- package/lang/en.lyaml +67 -39
- package/lib/LocalDevManager.d.ts +2 -2
- package/lib/buildAccount.d.ts +3 -2
- package/lib/configMigrate.d.ts +2 -0
- package/lib/configMigrate.js +83 -0
- package/lib/constants.d.ts +3 -0
- package/lib/constants.js +4 -1
- package/lib/doctor/Diagnosis.d.ts +1 -0
- package/lib/doctor/Diagnosis.js +7 -0
- package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -6
- package/lib/doctor/DiagnosticInfoBuilder.js +1 -5
- package/lib/doctor/Doctor.d.ts +1 -1
- package/lib/doctor/Doctor.js +14 -6
- package/lib/localDev.d.ts +1 -2
- package/lib/marketplaceValidate.d.ts +2 -2
- package/lib/projects/buildAndDeploy.js +1 -4
- package/lib/projects/index.d.ts +5 -1
- package/lib/projects/index.js +62 -1
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +2 -2
- package/lib/prompts/accountNamePrompt.d.ts +1 -1
- package/lib/prompts/createProjectPrompt.d.ts +8 -6
- package/lib/prompts/createProjectPrompt.js +54 -26
- package/lib/prompts/projectAddPrompt.d.ts +3 -3
- package/lib/prompts/projectAddPrompt.js +6 -16
- package/lib/prompts/projectDevTargetAccountPrompt.d.ts +2 -3
- package/lib/prompts/sandboxesPrompt.d.ts +2 -3
- package/lib/prompts/sandboxesPrompt.js +1 -1
- package/lib/sandboxSync.js +2 -6
- package/lib/sandboxes.d.ts +5 -2
- package/lib/ui/index.d.ts +1 -1
- package/lib/ui/index.js +0 -1
- package/lib/upload.d.ts +1 -1
- package/lib/upload.js +20 -20
- package/lib/usageTracking.d.ts +1 -1
- package/lib/validation.d.ts +1 -1
- package/package.json +3 -4
- package/types/Projects.d.ts +6 -1
- package/types/Prompts.d.ts +0 -7
- package/types/Sandboxes.d.ts +0 -2
- package/types/Yargs.d.ts +0 -7
- package/lib/customObject.d.ts +0 -3
- package/lib/customObject.js +0 -15
- package/lib/projects/create.d.ts +0 -5
- package/lib/projects/create.js +0 -51
- package/lib/testUtils.d.ts +0 -12
- package/lib/testUtils.js +0 -10
|
@@ -1,66 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
6
|
-
const customObjects_1 = require("@hubspot/local-dev-lib/api/customObjects");
|
|
7
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
-
const customObjects_2 = require("@hubspot/local-dev-lib/customObjects");
|
|
3
|
+
// @ts-nocheck
|
|
9
4
|
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
5
|
+
const customObjects_1 = require("@hubspot/local-dev-lib/api/customObjects");
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const { isConfigFlagEnabled } = require('@hubspot/local-dev-lib/config');
|
|
8
|
+
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
9
|
+
const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
10
|
+
const { downloadSchema, getResolvedPath, } = require('@hubspot/local-dev-lib/customObjects');
|
|
11
|
+
const { fetchSchema } = require('@hubspot/local-dev-lib/api/fileTransport');
|
|
12
|
+
const { getCwd } = require('@hubspot/local-dev-lib/path');
|
|
13
|
+
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
14
|
+
const { i18n } = require('../../../lib/lang');
|
|
15
|
+
const { logError } = require('../../../lib/errorHandlers');
|
|
14
16
|
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.fetch';
|
|
15
17
|
exports.command = 'fetch [name] [dest]';
|
|
16
|
-
exports.describe =
|
|
17
|
-
async
|
|
18
|
-
const { name: providedName, dest: providedDest, derivedAccountId } =
|
|
19
|
-
|
|
18
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
19
|
+
exports.handler = async (options) => {
|
|
20
|
+
const { name: providedName, dest: providedDest, derivedAccountId } = options;
|
|
21
|
+
trackCommandUsage('custom-object-schema-fetch', null, derivedAccountId);
|
|
20
22
|
let name;
|
|
21
23
|
try {
|
|
22
24
|
const { data: { results }, } = await (0, customObjects_1.fetchObjectSchemas)(derivedAccountId);
|
|
23
25
|
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
24
26
|
name =
|
|
25
27
|
providedName ||
|
|
26
|
-
(await (0, promptUtils_1.listPrompt)(
|
|
28
|
+
(await (0, promptUtils_1.listPrompt)(i18n(`${i18nKey}.selectSchema`), {
|
|
27
29
|
choices: schemaNames,
|
|
28
30
|
}));
|
|
29
|
-
const dest = providedDest || (await (0, promptUtils_1.inputPrompt)(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const dest = providedDest || (await (0, promptUtils_1.inputPrompt)(i18n(`${i18nKey}.inputDest`)));
|
|
32
|
+
if (isConfigFlagEnabled(CONFIG_FLAGS.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
33
|
+
const fullpath = path.resolve(getCwd(), dest);
|
|
34
|
+
await fetchSchema(derivedAccountId, name, fullpath);
|
|
35
|
+
logger.success(i18n(`${i18nKey}.success.save`, {
|
|
36
|
+
name,
|
|
37
|
+
path: fullpath,
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
await downloadSchema(derivedAccountId, name, dest);
|
|
42
|
+
logger.success(i18n(`${i18nKey}.success.savedToPath`, {
|
|
43
|
+
path: getResolvedPath(dest, name),
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
34
46
|
}
|
|
35
47
|
catch (e) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
name
|
|
48
|
+
logError(e);
|
|
49
|
+
logger.error(i18n(`${i18nKey}.errors.fetch`, {
|
|
50
|
+
name,
|
|
39
51
|
}));
|
|
40
52
|
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
44
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
45
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
53
|
+
};
|
|
54
|
+
exports.builder = yargs => {
|
|
46
55
|
yargs
|
|
47
56
|
.example([
|
|
48
57
|
[
|
|
49
58
|
'$0 custom-object schema fetch schemaName',
|
|
50
|
-
|
|
59
|
+
i18n(`${i18nKey}.examples.default`),
|
|
51
60
|
],
|
|
52
61
|
[
|
|
53
62
|
'$0 custom-object schema fetch schemaName my/folder',
|
|
54
|
-
|
|
63
|
+
i18n(`${i18nKey}.examples.specifyPath`),
|
|
55
64
|
],
|
|
56
65
|
])
|
|
57
66
|
.positional('name', {
|
|
58
|
-
describe:
|
|
67
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
59
68
|
type: 'string',
|
|
60
69
|
})
|
|
61
70
|
.positional('dest', {
|
|
62
|
-
describe:
|
|
71
|
+
describe: i18n(`${i18nKey}.positionals.dest.describe`),
|
|
63
72
|
type: 'string',
|
|
64
73
|
});
|
|
65
|
-
|
|
66
|
-
}
|
|
74
|
+
};
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs } from '../../../types/Yargs';
|
|
3
|
-
export declare const command = "list";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
export declare function handler(args: ArgumentsCamelCase<CombinedArgs>): Promise<void>;
|
|
7
|
-
export declare function builder(yargs: Argv): Argv<CombinedArgs>;
|
|
8
1
|
export {};
|
|
@@ -1,31 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const usageTracking_1 = require("../../../lib/usageTracking");
|
|
10
|
-
const schema_1 = require("../../../lib/schema");
|
|
11
|
-
const lang_1 = require("../../../lib/lang");
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
5
|
+
const { logError } = require('../../../lib/errorHandlers/index');
|
|
6
|
+
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
7
|
+
const { listSchemas } = require('../../../lib/schema');
|
|
8
|
+
const { i18n } = require('../../../lib/lang');
|
|
12
9
|
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.list';
|
|
13
10
|
exports.command = 'list';
|
|
14
|
-
exports.describe =
|
|
15
|
-
async
|
|
16
|
-
const { derivedAccountId } =
|
|
17
|
-
|
|
11
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
12
|
+
exports.handler = async (options) => {
|
|
13
|
+
const { derivedAccountId } = options;
|
|
14
|
+
trackCommandUsage('custom-object-schema-list', null, derivedAccountId);
|
|
18
15
|
try {
|
|
19
|
-
await
|
|
16
|
+
await listSchemas(derivedAccountId);
|
|
20
17
|
}
|
|
21
18
|
catch (e) {
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
logError(e);
|
|
20
|
+
logger.error(i18n(`${i18nKey}.errors.list`));
|
|
24
21
|
}
|
|
25
|
-
}
|
|
26
|
-
function builder(yargs) {
|
|
27
|
-
(0, commonOpts_1.addConfigOptions)(yargs);
|
|
28
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
29
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
30
|
-
return yargs;
|
|
31
|
-
}
|
|
22
|
+
};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { CommonArgs, ConfigArgs, AccountArgs, EnvironmentArgs, TestingArgs } from '../../../types/Yargs';
|
|
3
|
-
export declare const command = "update [name]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & TestingArgs;
|
|
6
|
-
type SchemaUpdateArgs = CombinedArgs & {
|
|
7
|
-
name?: string;
|
|
8
|
-
path: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function handler(args: ArgumentsCamelCase<SchemaUpdateArgs>): Promise<void>;
|
|
11
|
-
export declare function builder(yargs: Argv): Argv<SchemaUpdateArgs>;
|
|
12
1
|
export {};
|
|
@@ -1,70 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
exports.handler = handler;
|
|
5
|
-
exports.builder = builder;
|
|
3
|
+
// @ts-nocheck
|
|
6
4
|
const customObjects_1 = require("@hubspot/local-dev-lib/api/customObjects");
|
|
7
|
-
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
8
|
-
const path_1 = require("@hubspot/local-dev-lib/path");
|
|
9
|
-
const environments_1 = require("@hubspot/local-dev-lib/constants/environments");
|
|
10
|
-
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
11
|
-
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
12
5
|
const promptUtils_1 = require("../../../lib/prompts/promptUtils");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
6
|
+
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
7
|
+
const { logError } = require('../../../lib/errorHandlers/index');
|
|
8
|
+
const { getAbsoluteFilePath } = require('@hubspot/local-dev-lib/path');
|
|
9
|
+
const { ENVIRONMENTS, } = require('@hubspot/local-dev-lib/constants/environments');
|
|
10
|
+
const { checkAndConvertToJson } = require('../../../lib/validation');
|
|
11
|
+
const { trackCommandUsage } = require('../../../lib/usageTracking');
|
|
12
|
+
const { addTestingOptions } = require('../../../lib/commonOpts');
|
|
13
|
+
const { CONFIG_FLAGS } = require('../../../lib/constants');
|
|
14
|
+
const { getEnv, isConfigFlagEnabled, } = require('@hubspot/local-dev-lib/config');
|
|
15
|
+
const { updateObjectSchema, } = require('@hubspot/local-dev-lib/api/customObjects');
|
|
16
|
+
const { updateSchema: updateSchemaFromHubFile, } = require('@hubspot/local-dev-lib/api/fileTransport');
|
|
17
|
+
const { getHubSpotWebsiteOrigin } = require('@hubspot/local-dev-lib/urls');
|
|
18
|
+
const { i18n } = require('../../../lib/lang');
|
|
20
19
|
const i18nKey = 'commands.customObject.subcommands.schema.subcommands.update';
|
|
20
|
+
const { EXIT_CODES } = require('../../../lib/enums/exitCodes');
|
|
21
21
|
exports.command = 'update [name]';
|
|
22
|
-
exports.describe =
|
|
23
|
-
async
|
|
24
|
-
const { path, name: providedName, derivedAccountId } =
|
|
25
|
-
|
|
26
|
-
const filePath =
|
|
27
|
-
const schemaJson =
|
|
28
|
-
if (!
|
|
29
|
-
|
|
30
|
-
process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
22
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
23
|
+
exports.handler = async (options) => {
|
|
24
|
+
const { path, name: providedName, derivedAccountId } = options;
|
|
25
|
+
trackCommandUsage('custom-object-schema-update', null, derivedAccountId);
|
|
26
|
+
const filePath = getAbsoluteFilePath(path);
|
|
27
|
+
const schemaJson = checkAndConvertToJson(filePath);
|
|
28
|
+
if (!schemaJson) {
|
|
29
|
+
process.exit(EXIT_CODES.ERROR);
|
|
31
30
|
}
|
|
32
31
|
let name = providedName;
|
|
33
32
|
try {
|
|
34
33
|
const { data: { results }, } = await (0, customObjects_1.fetchObjectSchemas)(derivedAccountId);
|
|
35
34
|
const schemaNames = results?.map(({ name: schemaName }) => schemaName);
|
|
36
35
|
name =
|
|
37
|
-
providedName
|
|
38
|
-
|
|
39
|
-
: await (0, promptUtils_1.listPrompt)((0, lang_1.i18n)(`${i18nKey}.selectSchema`), {
|
|
36
|
+
providedName ||
|
|
37
|
+
(await (0, promptUtils_1.listPrompt)(i18n(`${i18nKey}.selectSchema`), {
|
|
40
38
|
choices: schemaNames,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
}));
|
|
40
|
+
if (isConfigFlagEnabled(CONFIG_FLAGS.USE_CUSTOM_OBJECT_HUBFILE)) {
|
|
41
|
+
await updateSchemaFromHubFile(derivedAccountId, filePath);
|
|
42
|
+
logger.success(i18n(`${i18nKey}.success.update`, {
|
|
43
|
+
accountId: derivedAccountId,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const { data } = await updateObjectSchema(derivedAccountId, name, schemaJson);
|
|
48
|
+
logger.success(i18n(`${i18nKey}.success.viewAtUrl`, {
|
|
49
|
+
url: `${getHubSpotWebsiteOrigin(getEnv() === 'qa' ? ENVIRONMENTS.QA : ENVIRONMENTS.PROD)}/contacts/${derivedAccountId}/objects/${data.objectTypeId}`,
|
|
50
|
+
}));
|
|
51
|
+
}
|
|
46
52
|
}
|
|
47
53
|
catch (e) {
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
logError(e, { accountId: derivedAccountId });
|
|
55
|
+
logger.error(i18n(`${i18nKey}.errors.update`, {
|
|
50
56
|
definition: path,
|
|
51
57
|
}));
|
|
52
58
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
(
|
|
56
|
-
(0, commonOpts_1.addAccountOptions)(yargs);
|
|
57
|
-
(0, commonOpts_1.addUseEnvironmentOptions)(yargs);
|
|
58
|
-
(0, commonOpts_1.addTestingOptions)(yargs);
|
|
59
|
+
};
|
|
60
|
+
exports.builder = yargs => {
|
|
61
|
+
addTestingOptions(yargs);
|
|
59
62
|
yargs
|
|
60
63
|
.positional('name', {
|
|
61
|
-
describe:
|
|
64
|
+
describe: i18n(`${i18nKey}.positionals.name.describe`),
|
|
62
65
|
type: 'string',
|
|
63
66
|
})
|
|
64
67
|
.option('path', {
|
|
65
|
-
describe:
|
|
68
|
+
describe: i18n(`${i18nKey}.options.path.describe`),
|
|
66
69
|
type: 'string',
|
|
67
70
|
required: true,
|
|
68
71
|
});
|
|
69
|
-
|
|
70
|
-
}
|
|
72
|
+
};
|
|
@@ -1,55 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const updateSchema = __importStar(require("./schema/update"));
|
|
45
|
-
const lang_1 = require("../../lib/lang");
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
const createCommand = require('./schema/create');
|
|
5
|
+
const fetchCommand = require('./schema/fetch');
|
|
6
|
+
const fetchAllCommand = require('./schema/fetch-all');
|
|
7
|
+
const deleteCommand = require('./schema/delete');
|
|
8
|
+
const listCommand = require('./schema/list');
|
|
9
|
+
const updateSchema = require('./schema/update');
|
|
10
|
+
const { i18n } = require('../../lib/lang');
|
|
46
11
|
const i18nKey = 'commands.customObject.subcommands.schema';
|
|
47
12
|
exports.command = ['schema', 'schemas'];
|
|
48
|
-
exports.describe =
|
|
49
|
-
|
|
50
|
-
// No specific handler needed for the schema command
|
|
51
|
-
}
|
|
52
|
-
function builder(yargs) {
|
|
13
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
14
|
+
exports.builder = yargs => {
|
|
53
15
|
yargs
|
|
54
16
|
.command(listCommand)
|
|
55
17
|
.command(fetchCommand)
|
|
@@ -59,4 +21,4 @@ function builder(yargs) {
|
|
|
59
21
|
.command(deleteCommand)
|
|
60
22
|
.demandCommand(1, '');
|
|
61
23
|
return yargs;
|
|
62
|
-
}
|
|
24
|
+
};
|
package/commands/customObject.js
CHANGED
|
@@ -1,59 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const ui_1 = require("../lib/ui");
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
const { addGlobalOptions } = require('../lib/commonOpts');
|
|
5
|
+
const schemaCommand = require('./customObject/schema');
|
|
6
|
+
const createCommand = require('./customObject/create');
|
|
7
|
+
const { i18n } = require('../lib/lang');
|
|
8
|
+
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
9
|
+
const { uiBetaTag, uiLink } = require('../lib/ui');
|
|
44
10
|
const i18nKey = 'commands.customObject';
|
|
45
11
|
exports.command = ['custom-object', 'custom-objects', 'co'];
|
|
46
|
-
exports.describe =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
yargs
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
12
|
+
exports.describe = uiBetaTag(i18n(`${i18nKey}.describe`), false);
|
|
13
|
+
const logBetaMessage = () => {
|
|
14
|
+
uiBetaTag(i18n(`${i18nKey}.betaMessage`));
|
|
15
|
+
logger.log(uiLink(i18n(`${i18nKey}.seeMoreLink`), 'https://developers.hubspot.com/docs/api/crm/crm-custom-objects'));
|
|
16
|
+
logger.log();
|
|
17
|
+
};
|
|
18
|
+
exports.builder = yargs => {
|
|
19
|
+
addGlobalOptions(yargs);
|
|
20
|
+
yargs
|
|
21
|
+
.middleware([logBetaMessage])
|
|
22
|
+
.command(schemaCommand)
|
|
23
|
+
.command(createCommand)
|
|
24
|
+
.demandCommand(1, '');
|
|
58
25
|
return yargs;
|
|
59
|
-
}
|
|
26
|
+
};
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs, OverwriteArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "fetch <src> [dest]";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs & OverwriteArgs;
|
|
6
|
-
type FileManagerFetchArgs = CombinedArgs & {
|
|
7
|
-
src: string;
|
|
8
|
-
dest: string;
|
|
9
|
-
includeArchived?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare function handler(args: ArgumentsCamelCase<FileManagerFetchArgs>): Promise<void>;
|
|
12
|
-
export declare function builder(yargs: Argv): Argv<FileManagerFetchArgs>;
|
|
13
1
|
export {};
|
|
@@ -1,54 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const usageTracking_1 = require("../../lib/usageTracking");
|
|
11
|
-
const lang_1 = require("../../lib/lang");
|
|
12
|
-
const exitCodes_1 = require("../../lib/enums/exitCodes");
|
|
13
|
-
const index_1 = require("../../lib/errorHandlers/index");
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
const { downloadFileOrFolder } = require('@hubspot/local-dev-lib/fileManager');
|
|
5
|
+
const { logger } = require('@hubspot/local-dev-lib/logger');
|
|
6
|
+
const { resolveLocalPath } = require('../../lib/filesystem');
|
|
7
|
+
const { addConfigOptions, addAccountOptions, addOverwriteOptions, addGlobalOptions, addUseEnvironmentOptions, } = require('../../lib/commonOpts');
|
|
8
|
+
const { trackCommandUsage } = require('../../lib/usageTracking');
|
|
9
|
+
const { i18n } = require('../../lib/lang');
|
|
14
10
|
const i18nKey = 'commands.filemanager.subcommands.fetch';
|
|
11
|
+
const { EXIT_CODES } = require('../../lib/enums/exitCodes');
|
|
12
|
+
const { logError } = require('../../lib/errorHandlers/index');
|
|
15
13
|
exports.command = 'fetch <src> [dest]';
|
|
16
|
-
exports.describe =
|
|
17
|
-
async
|
|
18
|
-
const { src, includeArchived, derivedAccountId, overwrite } =
|
|
14
|
+
exports.describe = i18n(`${i18nKey}.describe`);
|
|
15
|
+
exports.handler = async (options) => {
|
|
16
|
+
const { src, includeArchived, derivedAccountId, overwrite } = options;
|
|
19
17
|
if (typeof src !== 'string') {
|
|
20
|
-
|
|
21
|
-
process.exit(
|
|
18
|
+
logger.error(i18n(`${i18nKey}.errors.sourceRequired`));
|
|
19
|
+
process.exit(EXIT_CODES.ERROR);
|
|
22
20
|
}
|
|
23
|
-
const dest =
|
|
24
|
-
|
|
21
|
+
const dest = resolveLocalPath(options.dest);
|
|
22
|
+
trackCommandUsage('filemanager-fetch', null, derivedAccountId);
|
|
25
23
|
try {
|
|
26
24
|
// Fetch and write file/folder.
|
|
27
|
-
await
|
|
25
|
+
await downloadFileOrFolder(derivedAccountId, src, dest, overwrite, includeArchived || false);
|
|
28
26
|
}
|
|
29
27
|
catch (err) {
|
|
30
|
-
|
|
31
|
-
process.exit(
|
|
28
|
+
logError(err);
|
|
29
|
+
process.exit(EXIT_CODES.ERROR);
|
|
32
30
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
};
|
|
32
|
+
exports.builder = yargs => {
|
|
33
|
+
addGlobalOptions(yargs);
|
|
34
|
+
addConfigOptions(yargs);
|
|
35
|
+
addAccountOptions(yargs);
|
|
36
|
+
addOverwriteOptions(yargs);
|
|
37
|
+
addUseEnvironmentOptions(yargs);
|
|
40
38
|
yargs.positional('src', {
|
|
41
|
-
describe:
|
|
39
|
+
describe: i18n(`${i18nKey}.positionals.src.describe`),
|
|
42
40
|
type: 'string',
|
|
43
41
|
});
|
|
44
42
|
yargs.positional('dest', {
|
|
45
|
-
describe:
|
|
43
|
+
describe: i18n(`${i18nKey}.positionals.dest.describe`),
|
|
46
44
|
type: 'string',
|
|
47
45
|
});
|
|
48
46
|
yargs.option('include-archived', {
|
|
49
47
|
alias: ['i'],
|
|
50
|
-
describe:
|
|
48
|
+
describe: i18n(`${i18nKey}.options.includeArchived.describe`),
|
|
51
49
|
type: 'boolean',
|
|
52
50
|
});
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import { Argv, ArgumentsCamelCase } from 'yargs';
|
|
2
|
-
import { AccountArgs, CommonArgs, ConfigArgs, EnvironmentArgs } from '../../types/Yargs';
|
|
3
|
-
export declare const command = "upload <src> <dest>";
|
|
4
|
-
export declare const describe: string;
|
|
5
|
-
type CombinedArgs = CommonArgs & ConfigArgs & AccountArgs & EnvironmentArgs;
|
|
6
|
-
type FileManagerUploadArgs = CombinedArgs & {
|
|
7
|
-
src: string;
|
|
8
|
-
dest: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function handler(args: ArgumentsCamelCase<FileManagerUploadArgs>): Promise<void>;
|
|
11
|
-
export declare function builder(yargs: Argv): Argv<FileManagerUploadArgs>;
|
|
12
1
|
export {};
|