@hubspot/cli 7.0.1 → 7.0.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/commands/project/dev.js +4 -3
- package/commands/project/upload.js +7 -2
- package/commands/sandbox/create.js +5 -10
- package/commands/theme/preview.js +3 -2
- package/lang/en.lyaml +2 -0
- package/lib/DevServerManager.d.ts +40 -1
- package/lib/DevServerManager.js +39 -30
- package/lib/LocalDevManager.js +7 -6
- package/lib/buildAccount.js +3 -3
- package/lib/dependencyManagement.d.ts +9 -4
- package/lib/dependencyManagement.js +45 -49
- package/lib/errorHandlers/index.js +5 -2
- package/lib/localDev.js +1 -7
- package/lib/projects/structure.d.ts +2 -71
- package/lib/projects/structure.js +6 -10
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +27 -5
- package/lib/sandboxSync.d.ts +4 -1
- package/lib/sandboxSync.js +67 -68
- package/lib/sandboxes.d.ts +20 -1
- package/lib/sandboxes.js +77 -175
- package/package.json +7 -5
- package/types/Projects.d.ts +68 -0
- package/types/Projects.js +7 -0
- package/types/Sandboxes.d.ts +3 -0
- package/types/Sandboxes.js +2 -0
|
@@ -1,78 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type Component = {
|
|
3
|
-
type: ComponentTypes;
|
|
4
|
-
config: object;
|
|
5
|
-
runnable: boolean;
|
|
6
|
-
path: string;
|
|
7
|
-
};
|
|
8
|
-
type PrivateAppComponentConfig = {
|
|
9
|
-
name: string;
|
|
10
|
-
description: string;
|
|
11
|
-
uid: string;
|
|
12
|
-
scopes: Array<string>;
|
|
13
|
-
public: boolean;
|
|
14
|
-
extensions?: {
|
|
15
|
-
crm: {
|
|
16
|
-
cards: Array<{
|
|
17
|
-
file: string;
|
|
18
|
-
}>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
type PublicAppComponentConfig = {
|
|
23
|
-
name: string;
|
|
24
|
-
uid: string;
|
|
25
|
-
description: string;
|
|
26
|
-
allowedUrls: Array<string>;
|
|
27
|
-
auth: {
|
|
28
|
-
redirectUrls: Array<string>;
|
|
29
|
-
requiredScopes: Array<string>;
|
|
30
|
-
optionalScopes: Array<string>;
|
|
31
|
-
conditionallyRequiredScopes: Array<string>;
|
|
32
|
-
};
|
|
33
|
-
support: {
|
|
34
|
-
supportEmail: string;
|
|
35
|
-
documentationUrl: string;
|
|
36
|
-
supportUrl: string;
|
|
37
|
-
supportPhone: string;
|
|
38
|
-
};
|
|
39
|
-
extensions?: {
|
|
40
|
-
crm: {
|
|
41
|
-
cards: Array<{
|
|
42
|
-
file: string;
|
|
43
|
-
}>;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
webhooks?: {
|
|
47
|
-
file: string;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
type AppCardComponentConfig = {
|
|
51
|
-
type: 'crm-card';
|
|
52
|
-
data: {
|
|
53
|
-
title: string;
|
|
54
|
-
uid: string;
|
|
55
|
-
location: string;
|
|
56
|
-
module: {
|
|
57
|
-
file: string;
|
|
58
|
-
};
|
|
59
|
-
objectTypes: Array<{
|
|
60
|
-
name: string;
|
|
61
|
-
}>;
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
export declare const COMPONENT_TYPES: {
|
|
65
|
-
readonly privateApp: "private-app";
|
|
66
|
-
readonly publicApp: "public-app";
|
|
67
|
-
readonly hublTheme: "hubl-theme";
|
|
68
|
-
};
|
|
69
|
-
type ComponentTypes = ValueOf<typeof COMPONENT_TYPES>;
|
|
1
|
+
import { ComponentTypes, Component, PublicAppComponentConfig, PrivateAppComponentConfig, AppCardComponentConfig } from '../../types/Projects';
|
|
70
2
|
export declare const CONFIG_FILES: {
|
|
71
|
-
[k in
|
|
3
|
+
[k in ComponentTypes]: string;
|
|
72
4
|
};
|
|
73
5
|
export declare function getAppCardConfigs(appConfig: PublicAppComponentConfig | PrivateAppComponentConfig, appPath: string): Array<AppCardComponentConfig>;
|
|
74
6
|
export declare function findProjectComponents(projectSourceDir: string): Promise<Array<Component>>;
|
|
75
7
|
export declare function getProjectComponentTypes(components: Array<Component>): {
|
|
76
8
|
[key in ComponentTypes]?: boolean;
|
|
77
9
|
};
|
|
78
|
-
export {};
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.CONFIG_FILES =
|
|
36
|
+
exports.CONFIG_FILES = void 0;
|
|
37
37
|
exports.getAppCardConfigs = getAppCardConfigs;
|
|
38
38
|
exports.findProjectComponents = findProjectComponents;
|
|
39
39
|
exports.getProjectComponentTypes = getProjectComponentTypes;
|
|
@@ -42,15 +42,11 @@ const path = __importStar(require("path"));
|
|
|
42
42
|
const fs_1 = require("@hubspot/local-dev-lib/fs");
|
|
43
43
|
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
44
44
|
const index_1 = require("../errorHandlers/index");
|
|
45
|
-
|
|
46
|
-
privateApp: 'private-app',
|
|
47
|
-
publicApp: 'public-app',
|
|
48
|
-
hublTheme: 'hubl-theme',
|
|
49
|
-
};
|
|
45
|
+
const Projects_1 = require("../../types/Projects");
|
|
50
46
|
exports.CONFIG_FILES = {
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
47
|
+
[Projects_1.ComponentTypes.PrivateApp]: 'app.json',
|
|
48
|
+
[Projects_1.ComponentTypes.PublicApp]: 'public-app.json',
|
|
49
|
+
[Projects_1.ComponentTypes.HublTheme]: 'theme.json',
|
|
54
50
|
};
|
|
55
51
|
function getComponentTypeFromConfigFile(configFile) {
|
|
56
52
|
let key;
|
|
@@ -129,7 +125,7 @@ async function findProjectComponents(projectSourceDir) {
|
|
|
129
125
|
const parsedConfig = loadConfigFile(projectFile);
|
|
130
126
|
if (parsedConfig) {
|
|
131
127
|
const isLegacy = getIsLegacyApp(parsedConfig, dir);
|
|
132
|
-
const isHublTheme = base === exports.CONFIG_FILES[
|
|
128
|
+
const isHublTheme = base === exports.CONFIG_FILES[Projects_1.ComponentTypes.HublTheme];
|
|
133
129
|
const componentType = getComponentTypeFromConfigFile(base);
|
|
134
130
|
if (componentType) {
|
|
135
131
|
components.push({
|
package/lib/projects/upload.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ type ProjectUploadCallbackFunction<T> = (accountId: number, projectConfig: Proje
|
|
|
4
4
|
type ProjectUploadDefaultResult = {
|
|
5
5
|
uploadError?: unknown;
|
|
6
6
|
};
|
|
7
|
-
export declare function handleProjectUpload<T = ProjectUploadDefaultResult>(accountId: number, projectConfig: ProjectConfig, projectDir: string, callbackFunc: ProjectUploadCallbackFunction<T>, uploadMessage: string): Promise<unknown>;
|
|
7
|
+
export declare function handleProjectUpload<T = ProjectUploadDefaultResult>(accountId: number, projectConfig: ProjectConfig, projectDir: string, callbackFunc: ProjectUploadCallbackFunction<T>, uploadMessage: string, sendIR?: boolean): Promise<unknown>;
|
|
8
8
|
export {};
|
package/lib/projects/upload.js
CHANGED
|
@@ -15,8 +15,11 @@ const SpinniesManager_1 = __importDefault(require("../ui/SpinniesManager"));
|
|
|
15
15
|
const ui_1 = require("../ui");
|
|
16
16
|
const lang_1 = require("../lang");
|
|
17
17
|
const exitCodes_1 = require("../enums/exitCodes");
|
|
18
|
+
const project_parsing_lib_1 = require("@hubspot/project-parsing-lib");
|
|
19
|
+
const errorHandlers_1 = require("../errorHandlers");
|
|
20
|
+
const node_util_1 = __importDefault(require("node:util"));
|
|
18
21
|
const i18nKey = 'lib.projectUpload';
|
|
19
|
-
async function uploadProjectFiles(accountId, projectName, filePath, uploadMessage, platformVersion) {
|
|
22
|
+
async function uploadProjectFiles(accountId, projectName, filePath, uploadMessage, platformVersion, intermediateRepresentation) {
|
|
20
23
|
SpinniesManager_1.default.init({});
|
|
21
24
|
const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId);
|
|
22
25
|
SpinniesManager_1.default.add('upload', {
|
|
@@ -29,7 +32,7 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
|
|
|
29
32
|
let buildId;
|
|
30
33
|
let error;
|
|
31
34
|
try {
|
|
32
|
-
const { data: upload } = await (0, projects_1.uploadProject)(accountId, projectName, filePath, uploadMessage, platformVersion);
|
|
35
|
+
const { data: upload } = await (0, projects_1.uploadProject)(accountId, projectName, filePath, uploadMessage, platformVersion, intermediateRepresentation);
|
|
33
36
|
buildId = upload.buildId;
|
|
34
37
|
SpinniesManager_1.default.succeed('upload', {
|
|
35
38
|
text: (0, lang_1.i18n)(`${i18nKey}.uploadProjectFiles.succeed`, {
|
|
@@ -55,7 +58,7 @@ async function uploadProjectFiles(accountId, projectName, filePath, uploadMessag
|
|
|
55
58
|
}
|
|
56
59
|
return { buildId, error };
|
|
57
60
|
}
|
|
58
|
-
async function handleProjectUpload(accountId, projectConfig, projectDir, callbackFunc, uploadMessage) {
|
|
61
|
+
async function handleProjectUpload(accountId, projectConfig, projectDir, callbackFunc, uploadMessage, sendIR = false) {
|
|
59
62
|
const srcDir = path_1.default.resolve(projectDir, projectConfig.srcDir);
|
|
60
63
|
const filenames = fs_extra_1.default.readdirSync(srcDir);
|
|
61
64
|
if (!filenames || filenames.length === 0) {
|
|
@@ -75,9 +78,28 @@ async function handleProjectUpload(accountId, projectConfig, projectDir, callbac
|
|
|
75
78
|
logger_1.logger.debug((0, lang_1.i18n)(`${i18nKey}.handleProjectUpload.compressed`, {
|
|
76
79
|
byteCount: archive.pointer(),
|
|
77
80
|
}));
|
|
78
|
-
|
|
81
|
+
let intermediateRepresentation;
|
|
82
|
+
if (sendIR) {
|
|
83
|
+
try {
|
|
84
|
+
intermediateRepresentation = await (0, project_parsing_lib_1.translate)({
|
|
85
|
+
projectSourceDir: path_1.default.join(projectDir, projectConfig.srcDir),
|
|
86
|
+
platformVersion: projectConfig.platformVersion,
|
|
87
|
+
accountId,
|
|
88
|
+
});
|
|
89
|
+
logger_1.logger.debug(node_util_1.default.inspect(intermediateRepresentation, false, null, true));
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
if ((0, project_parsing_lib_1.isTranslationError)(e)) {
|
|
93
|
+
logger_1.logger.error(e.toString());
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
(0, errorHandlers_1.logError)(e);
|
|
97
|
+
}
|
|
98
|
+
return process.exit(exitCodes_1.EXIT_CODES.ERROR);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const { buildId, error } = await uploadProjectFiles(accountId, projectConfig.name, tempFile.name, uploadMessage, projectConfig.platformVersion, intermediateRepresentation);
|
|
79
102
|
if (error) {
|
|
80
|
-
console.log(error);
|
|
81
103
|
uploadResult = { uploadError: error };
|
|
82
104
|
}
|
|
83
105
|
else if (callbackFunc) {
|
package/lib/sandboxSync.d.ts
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
|
+
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
3
|
+
import { SandboxSyncTask } from '../types/Sandboxes';
|
|
4
|
+
export declare function syncSandbox(accountConfig: CLIAccount, parentAccountConfig: CLIAccount, env: Environment, syncTasks: Array<SandboxSyncTask>, slimInfoMessage?: boolean): Promise<void>;
|
package/lib/sandboxSync.js
CHANGED
|
@@ -1,128 +1,127 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
6
|
+
exports.syncSandbox = syncSandbox;
|
|
7
|
+
const SpinniesManager_1 = __importDefault(require("./ui/SpinniesManager"));
|
|
8
|
+
const urls_1 = require("@hubspot/local-dev-lib/urls");
|
|
9
|
+
const logger_1 = require("@hubspot/local-dev-lib/logger");
|
|
10
|
+
const sandboxSync_1 = require("@hubspot/local-dev-lib/api/sandboxSync");
|
|
11
|
+
const index_1 = require("@hubspot/local-dev-lib/errors/index");
|
|
12
|
+
const config_1 = require("@hubspot/local-dev-lib/config");
|
|
13
|
+
const getAccountIdentifier_1 = require("@hubspot/local-dev-lib/config/getAccountIdentifier");
|
|
14
|
+
const lang_1 = require("./lang");
|
|
15
|
+
const sandboxes_1 = require("./sandboxes");
|
|
16
|
+
const index_2 = require("./errorHandlers/index");
|
|
17
|
+
const sandboxes_2 = require("./sandboxes");
|
|
18
|
+
const ui_1 = require("./ui");
|
|
19
|
+
const accountTypes_1 = require("./accountTypes");
|
|
17
20
|
const i18nKey = 'lib.sandbox.sync';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
SpinniesManager.init({
|
|
21
|
+
async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, slimInfoMessage = false) {
|
|
22
|
+
const id = (0, getAccountIdentifier_1.getAccountIdentifier)(accountConfig);
|
|
23
|
+
const accountId = (0, config_1.getAccountId)(id);
|
|
24
|
+
const parentId = (0, getAccountIdentifier_1.getAccountIdentifier)(parentAccountConfig);
|
|
25
|
+
const parentAccountId = (0, config_1.getAccountId)(parentId);
|
|
26
|
+
const isDevSandbox = (0, accountTypes_1.isDevelopmentSandbox)(accountConfig);
|
|
27
|
+
if (!accountId || !parentAccountId) {
|
|
28
|
+
throw new Error((0, lang_1.i18n)(`${i18nKey}.failure.invalidUser`, {
|
|
29
|
+
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
30
|
+
parentAccountName: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
SpinniesManager_1.default.init({
|
|
32
34
|
succeedColor: 'white',
|
|
33
35
|
});
|
|
34
36
|
let availableSyncTasks = syncTasks;
|
|
35
|
-
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
36
|
-
const syncStatusUrl = `${baseUrl}/sandboxes-developer/${parentAccountId}/${getSandboxTypeAsString(accountConfig.accountType)}`;
|
|
37
|
+
const baseUrl = (0, urls_1.getHubSpotWebsiteOrigin)(env);
|
|
38
|
+
const syncStatusUrl = `${baseUrl}/sandboxes-developer/${parentAccountId}/${(0, sandboxes_2.getSandboxTypeAsString)(accountConfig.accountType)}`;
|
|
37
39
|
try {
|
|
38
40
|
// If no sync tasks exist, fetch sync types based on default account. Parent account required for fetch
|
|
39
41
|
if (!availableSyncTasks ||
|
|
40
42
|
(typeof availableSyncTasks === 'object' &&
|
|
41
43
|
availableSyncTasks.length === 0)) {
|
|
42
|
-
availableSyncTasks = await getAvailableSyncTypes(parentAccountConfig, accountConfig);
|
|
44
|
+
availableSyncTasks = await (0, sandboxes_1.getAvailableSyncTypes)(parentAccountConfig, accountConfig);
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
text: i18n(`${i18nKey}.loading.startSync`),
|
|
46
|
+
SpinniesManager_1.default.add('sandboxSync', {
|
|
47
|
+
text: (0, lang_1.i18n)(`${i18nKey}.loading.startSync`),
|
|
46
48
|
});
|
|
47
|
-
await initiateSync(parentAccountId, accountId, availableSyncTasks, accountId);
|
|
49
|
+
await (0, sandboxSync_1.initiateSync)(parentAccountId, accountId, availableSyncTasks, accountId);
|
|
48
50
|
const spinniesText = isDevSandbox
|
|
49
51
|
? `${i18nKey}.loading.succeedDevSb`
|
|
50
52
|
: `${i18nKey}.loading.succeed`;
|
|
51
|
-
|
|
52
|
-
text: i18n(slimInfoMessage ? `${i18nKey}.loading.successDevSbInfo` : spinniesText, {
|
|
53
|
-
accountName: uiAccountDescription(accountId),
|
|
54
|
-
url: uiLink(i18n(`${i18nKey}.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
53
|
+
SpinniesManager_1.default.succeed('sandboxSync', {
|
|
54
|
+
text: (0, lang_1.i18n)(slimInfoMessage ? `${i18nKey}.loading.successDevSbInfo` : spinniesText, {
|
|
55
|
+
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
56
|
+
url: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
55
57
|
}),
|
|
56
58
|
});
|
|
57
59
|
}
|
|
58
60
|
catch (err) {
|
|
59
|
-
debugError(err);
|
|
60
|
-
|
|
61
|
-
text: i18n(`${i18nKey}.loading.fail`),
|
|
61
|
+
(0, index_2.debugError)(err);
|
|
62
|
+
SpinniesManager_1.default.fail('sandboxSync', {
|
|
63
|
+
text: (0, lang_1.i18n)(`${i18nKey}.loading.fail`),
|
|
62
64
|
});
|
|
63
|
-
logger.log('');
|
|
64
|
-
if (isSpecifiedError(err, {
|
|
65
|
+
logger_1.logger.log('');
|
|
66
|
+
if ((0, index_1.isSpecifiedError)(err, {
|
|
65
67
|
statusCode: 403,
|
|
66
68
|
category: 'BANNED',
|
|
67
69
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USER',
|
|
68
70
|
})) {
|
|
69
|
-
logger.error(i18n(`${i18nKey}.failure.invalidUser`, {
|
|
70
|
-
accountName: uiAccountDescription(accountId),
|
|
71
|
-
parentAccountName: uiAccountDescription(parentAccountId),
|
|
71
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.failure.invalidUser`, {
|
|
72
|
+
accountName: (0, ui_1.uiAccountDescription)(accountId),
|
|
73
|
+
parentAccountName: (0, ui_1.uiAccountDescription)(parentAccountId),
|
|
72
74
|
}));
|
|
73
75
|
}
|
|
74
|
-
else if (isSpecifiedError(err, {
|
|
76
|
+
else if ((0, index_1.isSpecifiedError)(err, {
|
|
75
77
|
statusCode: 429,
|
|
76
78
|
category: 'RATE_LIMITS',
|
|
77
79
|
subCategory: 'sandboxes-sync-api.SYNC_IN_PROGRESS',
|
|
78
80
|
})) {
|
|
79
|
-
logger.error(i18n(`${i18nKey}.failure.syncInProgress`, {
|
|
81
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.failure.syncInProgress`, {
|
|
80
82
|
url: `${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`,
|
|
81
83
|
}));
|
|
82
84
|
}
|
|
83
|
-
else if (isSpecifiedError(err, {
|
|
85
|
+
else if ((0, index_1.isSpecifiedError)(err, {
|
|
84
86
|
statusCode: 403,
|
|
85
87
|
category: 'BANNED',
|
|
86
88
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USERID',
|
|
87
89
|
})) {
|
|
88
90
|
// This will only trigger if a user is not a super admin of the target account.
|
|
89
|
-
logger.error(i18n(`${i18nKey}.failure.notSuperAdmin`, {
|
|
90
|
-
account: uiAccountDescription(accountId),
|
|
91
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.failure.notSuperAdmin`, {
|
|
92
|
+
account: (0, ui_1.uiAccountDescription)(accountId),
|
|
91
93
|
}));
|
|
92
94
|
}
|
|
93
|
-
else if (isSpecifiedError(err, {
|
|
95
|
+
else if ((0, index_1.isSpecifiedError)(err, {
|
|
94
96
|
statusCode: 404,
|
|
95
97
|
category: 'OBJECT_NOT_FOUND',
|
|
96
98
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
97
99
|
})) {
|
|
98
|
-
logger.error(i18n(`${i18nKey}.failure.objectNotFound`, {
|
|
99
|
-
account: uiAccountDescription(accountId),
|
|
100
|
+
logger_1.logger.error((0, lang_1.i18n)(`${i18nKey}.failure.objectNotFound`, {
|
|
101
|
+
account: (0, ui_1.uiAccountDescription)(accountId),
|
|
100
102
|
}));
|
|
101
103
|
}
|
|
102
|
-
else if (isSpecifiedError(err, {
|
|
104
|
+
else if ((0, index_1.isSpecifiedError)(err, {
|
|
103
105
|
statusCode: 404,
|
|
104
106
|
})) {
|
|
105
|
-
uiCommandDisabledBanner('hs sandbox sync', 'https://app.hubspot.com/l/docs/guides/crm/project-cli-commands#developer-projects-cli-commands-beta');
|
|
107
|
+
(0, ui_1.uiCommandDisabledBanner)('hs sandbox sync', 'https://app.hubspot.com/l/docs/guides/crm/project-cli-commands#developer-projects-cli-commands-beta');
|
|
106
108
|
}
|
|
107
109
|
else {
|
|
108
|
-
logError(err, new ApiErrorContext({
|
|
110
|
+
(0, index_2.logError)(err, new index_2.ApiErrorContext({
|
|
109
111
|
accountId: parentAccountId,
|
|
110
112
|
request: 'sandbox sync',
|
|
111
113
|
}));
|
|
112
114
|
}
|
|
113
|
-
logger.log('');
|
|
115
|
+
logger_1.logger.log('');
|
|
114
116
|
throw err;
|
|
115
117
|
}
|
|
116
118
|
if (!slimInfoMessage) {
|
|
117
|
-
logger.log();
|
|
118
|
-
uiLine();
|
|
119
|
-
logger.info(i18n(`${i18nKey}.info.${isDevSandbox ? 'syncMessageDevSb' : 'syncMessage'}`, {
|
|
120
|
-
url: uiLink(i18n(`${i18nKey}.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
119
|
+
logger_1.logger.log();
|
|
120
|
+
(0, ui_1.uiLine)();
|
|
121
|
+
logger_1.logger.info((0, lang_1.i18n)(`${i18nKey}.info.${isDevSandbox ? 'syncMessageDevSb' : 'syncMessage'}`, {
|
|
122
|
+
url: (0, ui_1.uiLink)((0, lang_1.i18n)(`${i18nKey}.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
121
123
|
}));
|
|
122
|
-
uiLine();
|
|
123
|
-
logger.log();
|
|
124
|
+
(0, ui_1.uiLine)();
|
|
125
|
+
logger_1.logger.log();
|
|
124
126
|
}
|
|
125
|
-
}
|
|
126
|
-
module.exports = {
|
|
127
|
-
syncSandbox,
|
|
128
|
-
};
|
|
127
|
+
}
|
package/lib/sandboxes.d.ts
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { AccountType, CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
2
|
+
import { Environment } from '@hubspot/local-dev-lib/types/Config';
|
|
3
|
+
import { SandboxSyncTask } from '../types/Sandboxes';
|
|
4
|
+
export declare const SYNC_TYPES: {
|
|
5
|
+
readonly OBJECT_RECORDS: "object-records";
|
|
6
|
+
};
|
|
7
|
+
export declare const SANDBOX_TYPE_MAP: {
|
|
8
|
+
readonly dev: "DEVELOPMENT_SANDBOX";
|
|
9
|
+
readonly developer: "DEVELOPMENT_SANDBOX";
|
|
10
|
+
readonly development: "DEVELOPMENT_SANDBOX";
|
|
11
|
+
readonly standard: "STANDARD_SANDBOX";
|
|
12
|
+
};
|
|
13
|
+
export declare const SANDBOX_API_TYPE_MAP: {
|
|
14
|
+
readonly STANDARD_SANDBOX: 1;
|
|
15
|
+
readonly DEVELOPMENT_SANDBOX: 2;
|
|
16
|
+
};
|
|
17
|
+
export declare function getSandboxTypeAsString(accountType?: AccountType): string;
|
|
18
|
+
export declare function getAvailableSyncTypes(parentAccountConfig: CLIAccount, config: CLIAccount): Promise<Array<SandboxSyncTask>>;
|
|
19
|
+
export declare function validateSandboxUsageLimits(accountConfig: CLIAccount, sandboxType: AccountType, env: Environment): Promise<void>;
|
|
20
|
+
export declare function handleSandboxCreateError(err: unknown, env: Environment, name: string, accountId: number): void;
|