@hubspot/cli 7.8.11-experimental.0 → 7.8.12-experimental.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +31 -25
- package/commands/__tests__/auth.test.js +5 -0
- package/commands/__tests__/doctor.test.js +16 -16
- package/commands/account/clean.js +18 -27
- package/commands/account/createOverride.js +13 -31
- package/commands/account/info.js +20 -31
- package/commands/account/list.js +16 -22
- package/commands/account/remove.js +12 -20
- package/commands/account/removeOverride.js +11 -21
- package/commands/account/rename.js +6 -9
- package/commands/account/use.js +12 -26
- package/commands/account.js +2 -2
- package/commands/app/__tests__/migrate.test.js +5 -5
- package/commands/app/migrate.js +13 -18
- package/commands/auth.d.ts +1 -0
- package/commands/auth.js +16 -7
- package/commands/cms/convertFields.js +7 -9
- package/commands/cms/getReactModule.js +9 -14
- package/commands/cms/lighthouseScore.js +33 -36
- package/commands/cms.js +2 -2
- package/commands/completion.js +3 -3
- package/commands/config/set.d.ts +1 -1
- package/commands/config/set.js +64 -36
- package/commands/config.js +2 -2
- package/commands/create.js +2 -2
- package/commands/customObject/create.js +10 -12
- package/commands/customObject/schema/create.js +9 -11
- package/commands/customObject/schema/delete.js +16 -16
- package/commands/customObject/schema/fetch-all.js +12 -11
- package/commands/customObject/schema/fetch.js +15 -15
- package/commands/customObject/schema/list.js +4 -4
- package/commands/customObject/schema/update.js +13 -13
- package/commands/customObject/schema.js +2 -2
- package/commands/customObject.js +6 -7
- package/commands/doctor.js +8 -11
- package/commands/feedback.js +6 -11
- package/commands/fetch.js +8 -8
- package/commands/filemanager/fetch.js +7 -7
- package/commands/filemanager/upload.js +15 -34
- package/commands/filemanager.js +2 -2
- package/commands/function/deploy.js +11 -29
- package/commands/function/list.js +8 -8
- package/commands/function/server.js +9 -11
- package/commands/function.d.ts +1 -1
- package/commands/function.js +2 -2
- package/commands/getStarted.js +2 -2
- package/commands/hubdb/clear.js +7 -15
- package/commands/hubdb/create.js +9 -15
- package/commands/hubdb/delete.js +8 -15
- package/commands/hubdb/fetch.js +6 -9
- package/commands/hubdb.d.ts +1 -1
- package/commands/hubdb.js +2 -2
- package/commands/init.js +2 -3
- package/commands/lint.js +16 -16
- package/commands/list.js +8 -14
- package/commands/logs.js +14 -20
- package/commands/mv.js +6 -17
- package/commands/open.js +5 -5
- package/commands/project/__tests__/add.test.js +4 -2
- package/commands/project/__tests__/deploy.test.js +3 -4
- package/commands/project/__tests__/installDeps.test.js +8 -8
- package/commands/project/__tests__/logs.test.js +1 -1
- package/commands/project/__tests__/migrate.test.js +5 -5
- package/commands/project/__tests__/migrateApp.test.js +2 -5
- package/commands/project/__tests__/validate.test.js +98 -0
- package/commands/project/add.js +3 -3
- package/commands/project/cloneApp.js +14 -19
- package/commands/project/create.js +0 -1
- package/commands/project/deploy.js +3 -3
- package/commands/project/dev/deprecatedFlow.js +7 -16
- package/commands/project/dev/index.js +14 -12
- package/commands/project/dev/unifiedFlow.js +3 -1
- package/commands/project/download.js +10 -13
- package/commands/project/installDeps.js +8 -8
- package/commands/project/listBuilds.js +11 -20
- package/commands/project/logs.js +21 -24
- package/commands/project/migrate.js +14 -16
- package/commands/project/migrateApp.js +9 -15
- package/commands/project/open.js +6 -13
- package/commands/project/upload.js +16 -25
- package/commands/project/validate.js +6 -6
- package/commands/project/watch.js +13 -22
- package/commands/project.js +2 -2
- package/commands/sandbox/__tests__/create.test.js +5 -5
- package/commands/sandbox/create.js +22 -32
- package/commands/sandbox/delete.js +38 -63
- package/commands/sandbox.js +2 -2
- package/commands/secret/addSecret.js +7 -17
- package/commands/secret/deleteSecret.js +10 -20
- package/commands/secret/listSecret.js +8 -10
- package/commands/secret/updateSecret.js +9 -17
- package/commands/secret.js +2 -2
- package/commands/testAccount/__tests__/delete.test.js +2 -4
- package/commands/testAccount/delete.d.ts +4 -3
- package/commands/testAccount/delete.js +155 -14
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +310 -102
- package/lang/en.js +351 -147
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -1
- package/lib/__tests__/commonOpts.test.js +1 -1
- package/lib/__tests__/dependencyManagement.test.js +1 -1
- package/lib/__tests__/developerTestAccounts.test.js +3 -3
- package/lib/__tests__/npm.test.js +1 -1
- package/lib/__tests__/oauth.test.js +4 -4
- package/lib/__tests__/process.test.js +10 -5
- package/lib/__tests__/sandboxSync.test.js +8 -8
- package/lib/__tests__/sandboxes.test.js +8 -8
- package/lib/__tests__/serverlessLogs.test.js +1 -1
- package/lib/__tests__/usageTracking.test.js +5 -5
- package/lib/__tests__/validation.test.js +2 -1
- package/lib/__tests__/yargsUtils.test.js +83 -9
- package/lib/app/__tests__/migrate.test.js +5 -5
- package/lib/app/__tests__/migrate_legacy.test.js +1 -1
- package/lib/app/migrate.js +1 -1
- package/lib/app/migrate_legacy.js +20 -24
- package/lib/buildAccount.js +25 -57
- package/lib/commonOpts.d.ts +1 -1
- package/lib/commonOpts.js +25 -22
- package/lib/configOptions.js +7 -0
- package/lib/constants.d.ts +6 -1
- package/lib/constants.js +10 -1
- package/lib/dependencyManagement.js +9 -27
- package/lib/developerTestAccounts.js +9 -23
- package/lib/doctor/Diagnosis.js +11 -23
- package/lib/doctor/DiagnosticInfoBuilder.js +12 -11
- package/lib/doctor/Doctor.js +42 -90
- package/lib/doctor/__tests__/Doctor.test.js +4 -4
- package/lib/errorHandlers/index.js +12 -20
- package/lib/errorHandlers/suppressError.js +11 -18
- package/lib/lang.js +6 -5
- package/lib/links.js +4 -4
- package/lib/middleware/__test__/commandTargetingUtils.test.d.ts +1 -0
- package/lib/middleware/__test__/commandTargetingUtils.test.js +99 -0
- package/lib/middleware/__test__/configMiddleware.test.js +11 -11
- package/lib/middleware/__test__/yargsChecksMiddleware.test.js +6 -8
- package/lib/middleware/commandTargetingUtils.d.ts +8 -0
- package/lib/middleware/commandTargetingUtils.js +78 -0
- package/lib/middleware/configMiddleware.d.ts +1 -1
- package/lib/middleware/configMiddleware.js +21 -81
- package/lib/middleware/fireAlarmMiddleware.js +15 -17
- package/lib/middleware/gitMiddleware.js +5 -1
- package/lib/middleware/notificationsMiddleware.js +5 -11
- package/lib/middleware/yargsChecksMiddleware.js +6 -9
- package/lib/npm.js +2 -2
- package/lib/oauth.js +5 -5
- package/lib/process.js +5 -4
- package/lib/projects/__tests__/AppDevModeInterface.test.js +14 -34
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +70 -39
- package/lib/projects/__tests__/localDevProjectHelpers.test.js +2 -0
- package/lib/projects/__tests__/platformVersion.test.js +8 -8
- package/lib/projects/__tests__/projects.test.js +12 -12
- package/lib/projects/__tests__/structure.test.js +3 -3
- package/lib/projects/__tests__/upload.test.d.ts +1 -0
- package/lib/projects/__tests__/upload.test.js +82 -0
- package/lib/projects/add/__tests__/legacyAddComponent.test.js +6 -6
- package/lib/projects/add/__tests__/v3AddComponent.test.js +4 -4
- package/lib/projects/create/__tests__/legacy.test.js +5 -5
- package/lib/projects/create/__tests__/v3.test.js +1 -1
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/legacy.js +2 -2
- package/lib/projects/create/v3.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +2 -0
- package/lib/projects/localDev/AppDevModeInterface.js +22 -20
- package/lib/projects/localDev/LocalDevLogger.js +10 -11
- package/lib/projects/localDev/LocalDevManager.js +4 -5
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +0 -1
- package/lib/projects/localDev/LocalDevWebsocketServer.js +7 -10
- package/lib/projects/localDev/helpers/project.d.ts +1 -0
- package/lib/projects/localDev/helpers/project.js +37 -0
- package/lib/projects/platformVersion.d.ts +1 -1
- package/lib/projects/platformVersion.js +1 -1
- package/lib/projects/structure.js +6 -6
- package/lib/projects/upload.d.ts +1 -1
- package/lib/projects/upload.js +17 -8
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/accountNamePrompt.js +14 -19
- package/lib/prompts/accountsPrompt.js +2 -2
- package/lib/prompts/cmsFieldPrompt.js +2 -2
- package/lib/prompts/createApiSamplePrompt.js +5 -5
- package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +10 -1
- package/lib/prompts/createFunctionPrompt.js +14 -14
- package/lib/prompts/createModulePrompt.js +9 -9
- package/lib/prompts/createTemplatePrompt.js +2 -2
- package/lib/prompts/downloadProjectPrompt.js +5 -8
- package/lib/prompts/personalAccessKeyPrompt.js +3 -3
- package/lib/prompts/previewPrompt.js +6 -6
- package/lib/prompts/projectAddPrompt.js +6 -0
- package/lib/prompts/projectDevTargetAccountPrompt.js +20 -32
- package/lib/prompts/projectNamePrompt.js +4 -8
- package/lib/prompts/projectsLogsPrompt.js +2 -4
- package/lib/prompts/promptUtils.js +27 -9
- package/lib/prompts/sandboxesPrompt.js +7 -7
- package/lib/prompts/secretPrompt.js +3 -3
- package/lib/prompts/selectAppPrompt.js +3 -3
- package/lib/prompts/selectHubDBTablePrompt.js +9 -13
- package/lib/prompts/selectPublicAppForMigrationPrompt.js +15 -19
- package/lib/prompts/setAsDefaultAccountPrompt.js +4 -8
- package/lib/prompts/uploadPrompt.js +5 -5
- package/lib/sandboxSync.js +24 -41
- package/lib/sandboxes.js +19 -47
- package/lib/schema.js +3 -3
- package/lib/serverlessLogs.js +11 -13
- package/lib/theme/__tests__/migrate.test.js +3 -3
- package/lib/theme/migrate.js +2 -2
- package/lib/ui/SpinniesManager.d.ts +2 -0
- package/lib/ui/SpinniesManager.js +7 -0
- package/lib/ui/boxen.js +1 -2
- package/lib/ui/git.js +13 -10
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +47 -38
- package/lib/ui/serverlessFunctionLogs.js +9 -7
- package/lib/ui/uiMessages.d.ts +68 -0
- package/lib/ui/uiMessages.js +71 -0
- package/lib/usageTracking.js +7 -7
- package/lib/validation.js +20 -23
- package/lib/yargsUtils.d.ts +1 -1
- package/lib/yargsUtils.js +12 -5
- package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +2 -2
- package/mcp-server/tools/index.js +4 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +23 -0
- package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +68 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +11 -0
- package/mcp-server/tools/project/GetApplicationInfoTool.js +49 -0
- package/mcp-server/tools/project/GetConfigValuesTool.js +2 -2
- package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +2 -2
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +169 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.d.ts +1 -0
- package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +115 -0
- package/mcp-server/utils/toolUsageTracking.js +2 -2
- package/package.json +7 -7
- package/ui/components/BoxWithTitle.d.ts +8 -0
- package/ui/components/BoxWithTitle.js +9 -0
- package/ui/components/HorizontalSelectPrompt.d.ts +8 -0
- package/ui/components/HorizontalSelectPrompt.js +30 -0
- package/ui/components/StatusMessageBoxes.d.ts +12 -0
- package/ui/components/StatusMessageBoxes.js +31 -0
- package/ui/index.d.ts +1 -0
- package/ui/index.js +6 -0
- package/ui/lib/ui-testing-utils.d.ts +9 -0
- package/ui/lib/ui-testing-utils.js +47 -0
- package/ui/lib/useTerminalSize.d.ts +13 -0
- package/ui/lib/useTerminalSize.js +31 -0
- package/ui/styles.d.ts +18 -0
- package/ui/styles.js +18 -0
- package/ui/views/UiSandbox.d.ts +5 -0
- package/ui/views/UiSandbox.js +25 -0
- package/lib/middleware/__test__/utils.test.js +0 -51
- package/lib/middleware/utils.d.ts +0 -8
- package/lib/middleware/utils.js +0 -14
- /package/{lib/middleware/__test__/utils.test.d.ts → commands/project/__tests__/validate.test.d.ts} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
export function secretValuePrompt() {
|
|
4
4
|
return promptUser([
|
|
5
5
|
{
|
|
6
6
|
name: 'secretValue',
|
|
7
7
|
type: 'password',
|
|
8
8
|
mask: '*',
|
|
9
|
-
message:
|
|
9
|
+
message: lib.prompts.secretPrompt.enterValue,
|
|
10
10
|
},
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
@@ -15,7 +15,7 @@ export function secretNamePrompt() {
|
|
|
15
15
|
{
|
|
16
16
|
name: 'secretName',
|
|
17
17
|
type: 'input',
|
|
18
|
-
message:
|
|
18
|
+
message: lib.prompts.secretPrompt.enterName,
|
|
19
19
|
},
|
|
20
20
|
]);
|
|
21
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { uiLogger } from '../ui/logger.js';
|
|
2
2
|
import { fetchPublicAppsForPortal } from '@hubspot/local-dev-lib/api/appsDev';
|
|
3
3
|
import { debugError } from '../errorHandlers/index.js';
|
|
4
4
|
import { lib } from '../../lang/en.js';
|
|
@@ -15,7 +15,7 @@ export async function selectAppPrompt(accountId, appId) {
|
|
|
15
15
|
debugError(err);
|
|
16
16
|
}
|
|
17
17
|
if (availableApps.length === 0) {
|
|
18
|
-
|
|
18
|
+
uiLogger.error(lib.prompts.selectAppPrompt.errors.noApps);
|
|
19
19
|
return null;
|
|
20
20
|
}
|
|
21
21
|
if (appId) {
|
|
@@ -24,7 +24,7 @@ export async function selectAppPrompt(accountId, appId) {
|
|
|
24
24
|
return targetApp;
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
-
|
|
27
|
+
uiLogger.error(lib.prompts.selectAppPrompt.errors.invalidAppId);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
const appPromptValue = await listPrompt(lib.prompts.selectAppPrompt.selectAppId, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { lib } from '../../lang/en.js';
|
|
4
4
|
import { debugError } from '../errorHandlers/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { fetchTables } from '@hubspot/local-dev-lib/api/hubdb';
|
|
7
7
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
8
8
|
import { isValidPath, untildify } from '@hubspot/local-dev-lib/path';
|
|
@@ -10,18 +10,14 @@ async function fetchHubDBOptions(accountId) {
|
|
|
10
10
|
try {
|
|
11
11
|
const { data: { results: tables }, } = await fetchTables(accountId);
|
|
12
12
|
if (tables.length === 0) {
|
|
13
|
-
|
|
14
|
-
accountId,
|
|
15
|
-
}));
|
|
13
|
+
uiLogger.log(lib.prompts.selectHubDBTablePrompt.errors.noTables(accountId.toString()));
|
|
16
14
|
process.exit(EXIT_CODES.SUCCESS);
|
|
17
15
|
}
|
|
18
16
|
return tables;
|
|
19
17
|
}
|
|
20
18
|
catch (error) {
|
|
21
19
|
debugError(error, { accountId });
|
|
22
|
-
|
|
23
|
-
accountId,
|
|
24
|
-
}));
|
|
20
|
+
uiLogger.error(lib.prompts.selectHubDBTablePrompt.errors.errorFetchingTables(accountId.toString()));
|
|
25
21
|
process.exit(EXIT_CODES.ERROR);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
@@ -32,7 +28,7 @@ export async function selectHubDBTablePrompt({ accountId, options, skipDestPromp
|
|
|
32
28
|
return promptUser([
|
|
33
29
|
{
|
|
34
30
|
name: 'tableId',
|
|
35
|
-
message:
|
|
31
|
+
message: lib.prompts.selectHubDBTablePrompt.selectTable,
|
|
36
32
|
when: !id && !isValidTable,
|
|
37
33
|
type: 'list',
|
|
38
34
|
choices: hubdbTables.map(table => {
|
|
@@ -44,17 +40,17 @@ export async function selectHubDBTablePrompt({ accountId, options, skipDestPromp
|
|
|
44
40
|
},
|
|
45
41
|
{
|
|
46
42
|
name: 'dest',
|
|
47
|
-
message:
|
|
43
|
+
message: lib.prompts.selectHubDBTablePrompt.enterDest,
|
|
48
44
|
when: !options.dest && !skipDestPrompt,
|
|
49
45
|
validate: (input) => {
|
|
50
46
|
if (!input) {
|
|
51
|
-
return
|
|
47
|
+
return lib.prompts.selectHubDBTablePrompt.errors.destRequired;
|
|
52
48
|
}
|
|
53
49
|
if (fs.existsSync(input)) {
|
|
54
|
-
return
|
|
50
|
+
return lib.prompts.selectHubDBTablePrompt.errors.invalidDest;
|
|
55
51
|
}
|
|
56
52
|
if (!isValidPath(input)) {
|
|
57
|
-
return
|
|
53
|
+
return lib.prompts.selectHubDBTablePrompt.errors.invalidCharacters;
|
|
58
54
|
}
|
|
59
55
|
return true;
|
|
60
56
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { promptUser } from './promptUtils.js';
|
|
2
|
-
import {
|
|
2
|
+
import { lib } from '../../lang/en.js';
|
|
3
3
|
import { uiLine } from '../ui/index.js';
|
|
4
4
|
import { logError } from '../errorHandlers/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { uiLogger } from '../ui/logger.js';
|
|
6
6
|
import { fetchPublicAppsForPortal } from '@hubspot/local-dev-lib/api/appsDev';
|
|
7
7
|
import { EXIT_CODES } from '../enums/exitCodes.js';
|
|
8
8
|
async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = false) {
|
|
9
9
|
try {
|
|
10
10
|
if (!accountId) {
|
|
11
|
-
|
|
11
|
+
uiLogger.error(lib.prompts.selectPublicAppForMigrationPrompt.errors.noAccountId);
|
|
12
12
|
process.exit(EXIT_CODES.ERROR);
|
|
13
13
|
}
|
|
14
14
|
const { data: { results: publicApps }, } = await fetchPublicAppsForPortal(accountId);
|
|
@@ -16,15 +16,13 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
16
16
|
if (!filteredPublicApps.length ||
|
|
17
17
|
(isMigratingApp &&
|
|
18
18
|
!filteredPublicApps.some(app => !app.preventProjectMigrations || !app.listingInfo))) {
|
|
19
|
-
const headerTranslationKey = isMigratingApp
|
|
20
|
-
? 'noAppsMigration'
|
|
21
|
-
: 'noAppsClone';
|
|
22
|
-
const messageTranslationKey = isMigratingApp
|
|
23
|
-
? 'noAppsMigrationMessage'
|
|
24
|
-
: 'noAppsCloneMessage';
|
|
25
19
|
uiLine();
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
if (isMigratingApp) {
|
|
21
|
+
uiLogger.error(`${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigration}\n${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsMigrationMessage(accountName)}`);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
uiLogger.error(`${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsClone}\n${lib.prompts.selectPublicAppForMigrationPrompt.errors.noAppsCloneMessage(accountName)}`);
|
|
25
|
+
}
|
|
28
26
|
uiLine();
|
|
29
27
|
process.exit(EXIT_CODES.SUCCESS);
|
|
30
28
|
}
|
|
@@ -32,28 +30,26 @@ async function fetchPublicAppOptions(accountId, accountName, isMigratingApp = fa
|
|
|
32
30
|
}
|
|
33
31
|
catch (error) {
|
|
34
32
|
logError(error, accountId ? { accountId } : undefined);
|
|
35
|
-
|
|
33
|
+
uiLogger.error(lib.prompts.selectPublicAppForMigrationPrompt.errors.errorFetchingApps);
|
|
36
34
|
process.exit(EXIT_CODES.ERROR);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
export async function selectPublicAppForMigrationPrompt({ accountId, accountName, isMigratingApp = false, }) {
|
|
40
38
|
const publicApps = await fetchPublicAppOptions(accountId, accountName, isMigratingApp);
|
|
41
|
-
const translationKey = isMigratingApp
|
|
42
|
-
? 'selectAppIdMigrate'
|
|
43
|
-
: 'selectAppIdClone';
|
|
44
39
|
return promptUser([
|
|
45
40
|
{
|
|
46
41
|
name: 'appId',
|
|
47
|
-
message:
|
|
48
|
-
accountName
|
|
49
|
-
|
|
42
|
+
message: isMigratingApp
|
|
43
|
+
? lib.prompts.selectPublicAppForMigrationPrompt.selectAppIdMigrate(accountName)
|
|
44
|
+
: lib.prompts.selectPublicAppForMigrationPrompt.selectAppIdClone(accountName),
|
|
50
45
|
type: 'list',
|
|
51
46
|
choices: publicApps.map(app => {
|
|
52
47
|
const { preventProjectMigrations, listingInfo } = app;
|
|
53
48
|
if (isMigratingApp && preventProjectMigrations && listingInfo) {
|
|
54
49
|
return {
|
|
55
50
|
name: `${app.name} (${app.id})`,
|
|
56
|
-
disabled:
|
|
51
|
+
disabled: lib.prompts.selectPublicAppForMigrationPrompt.errors
|
|
52
|
+
.cannotBeMigrated,
|
|
57
53
|
};
|
|
58
54
|
}
|
|
59
55
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { updateDefaultAccount, getConfigDefaultAccount, } from '@hubspot/local-dev-lib/config';
|
|
2
2
|
import { promptUser } from './promptUtils.js';
|
|
3
|
-
import {
|
|
3
|
+
import { lib } from '../../lang/en.js';
|
|
4
4
|
import { uiLogger } from '../ui/logger.js';
|
|
5
5
|
export async function setAsDefaultAccountPrompt(accountName) {
|
|
6
6
|
// Accounts for deprecated and new config
|
|
@@ -10,20 +10,16 @@ export async function setAsDefaultAccountPrompt(accountName) {
|
|
|
10
10
|
name: 'setAsDefault',
|
|
11
11
|
type: 'confirm',
|
|
12
12
|
when: defaultAccount !== accountName,
|
|
13
|
-
message:
|
|
13
|
+
message: lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccountMessage,
|
|
14
14
|
},
|
|
15
15
|
]);
|
|
16
16
|
uiLogger.log('');
|
|
17
17
|
if (setAsDefault) {
|
|
18
18
|
updateDefaultAccount(accountName);
|
|
19
|
-
uiLogger.success(
|
|
20
|
-
accountName,
|
|
21
|
-
}));
|
|
19
|
+
uiLogger.success(lib.prompts.setAsDefaultAccountPrompt.setAsDefaultAccount(accountName));
|
|
22
20
|
}
|
|
23
21
|
else {
|
|
24
|
-
uiLogger.log(
|
|
25
|
-
accountName: getConfigDefaultAccount(),
|
|
26
|
-
}));
|
|
22
|
+
uiLogger.log(lib.prompts.setAsDefaultAccountPrompt.keepingCurrentDefault(getConfigDefaultAccount()));
|
|
27
23
|
}
|
|
28
24
|
return setAsDefault;
|
|
29
25
|
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getCwd } from '@hubspot/local-dev-lib/path';
|
|
3
3
|
import { promptUser } from './promptUtils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { lib } from '../../lang/en.js';
|
|
5
5
|
export async function uploadPrompt(promptOptions = {}) {
|
|
6
6
|
return promptUser([
|
|
7
7
|
{
|
|
8
8
|
name: 'src',
|
|
9
|
-
message:
|
|
9
|
+
message: lib.prompts.uploadPrompt.enterSrc,
|
|
10
10
|
when: !promptOptions.src,
|
|
11
11
|
default: '.',
|
|
12
12
|
validate: (input) => {
|
|
13
13
|
if (!input) {
|
|
14
|
-
return
|
|
14
|
+
return lib.prompts.uploadPrompt.errors.srcRequired;
|
|
15
15
|
}
|
|
16
16
|
return true;
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'dest',
|
|
21
|
-
message:
|
|
21
|
+
message: lib.prompts.uploadPrompt.enterDest,
|
|
22
22
|
when: !promptOptions.dest,
|
|
23
23
|
default: path.basename(getCwd()),
|
|
24
24
|
validate: (input) => {
|
|
25
25
|
if (!input) {
|
|
26
|
-
return
|
|
26
|
+
return lib.prompts.uploadPrompt.errors.destRequired;
|
|
27
27
|
}
|
|
28
28
|
return true;
|
|
29
29
|
},
|
package/lib/sandboxSync.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import SpinniesManager from './ui/SpinniesManager.js';
|
|
2
2
|
import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from './ui/logger.js';
|
|
4
4
|
import { initiateSync } from '@hubspot/local-dev-lib/api/sandboxSync';
|
|
5
5
|
import { isSpecifiedError } from '@hubspot/local-dev-lib/errors/index';
|
|
6
6
|
import { getAccountId } from '@hubspot/local-dev-lib/config';
|
|
7
7
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
8
|
-
import {
|
|
8
|
+
import { lib } from '../lang/en.js';
|
|
9
9
|
import { getAvailableSyncTypes, getSandboxTypeAsString } from './sandboxes.js';
|
|
10
10
|
import { debugError, logError, ApiErrorContext, } from './errorHandlers/index.js';
|
|
11
|
-
import { uiAccountDescription, uiLine,
|
|
11
|
+
import { uiAccountDescription, uiLine, uiCommandDisabledBanner, } from './ui/index.js';
|
|
12
12
|
import { isDevelopmentSandbox } from './accountTypes.js';
|
|
13
13
|
export async function syncSandbox(accountConfig, parentAccountConfig, env, syncTasks, slimInfoMessage = false) {
|
|
14
14
|
const id = getAccountIdentifier(accountConfig);
|
|
@@ -17,14 +17,9 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
17
17
|
const parentAccountId = getAccountId(parentId);
|
|
18
18
|
const isDevSandbox = isDevelopmentSandbox(accountConfig);
|
|
19
19
|
if (!accountId || !parentAccountId) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
: id.toString(),
|
|
24
|
-
parentAccountName: parentAccountId
|
|
25
|
-
? uiAccountDescription(parentAccountId)
|
|
26
|
-
: parentId.toString(),
|
|
27
|
-
}));
|
|
20
|
+
throw new Error(lib.sandbox.sync.failure.invalidUser(accountId ? uiAccountDescription(accountId) : id.toString(), parentAccountId
|
|
21
|
+
? uiAccountDescription(parentAccountId)
|
|
22
|
+
: parentId.toString()));
|
|
28
23
|
}
|
|
29
24
|
SpinniesManager.init({
|
|
30
25
|
succeedColor: 'white',
|
|
@@ -40,45 +35,37 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
40
35
|
availableSyncTasks = await getAvailableSyncTypes(parentAccountConfig, accountConfig);
|
|
41
36
|
}
|
|
42
37
|
SpinniesManager.add('sandboxSync', {
|
|
43
|
-
text:
|
|
38
|
+
text: lib.sandbox.sync.loading.startSync,
|
|
44
39
|
});
|
|
45
40
|
await initiateSync(parentAccountId, accountId, availableSyncTasks, accountId);
|
|
46
41
|
const spinniesText = isDevSandbox
|
|
47
|
-
?
|
|
48
|
-
:
|
|
42
|
+
? lib.sandbox.sync.loading.succeedDevSb(accountId)
|
|
43
|
+
: lib.sandbox.sync.loading.succeed(accountId);
|
|
49
44
|
SpinniesManager.succeed('sandboxSync', {
|
|
50
|
-
text:
|
|
51
|
-
?
|
|
52
|
-
: spinniesText,
|
|
53
|
-
accountName: uiAccountDescription(accountId),
|
|
54
|
-
url: uiLink(i18n(`lib.sandbox.sync.info.syncStatusDetailsLinkText`), syncStatusUrl),
|
|
55
|
-
}),
|
|
45
|
+
text: slimInfoMessage
|
|
46
|
+
? lib.sandbox.sync.loading.successDevSbInfo(accountId, syncStatusUrl)
|
|
47
|
+
: spinniesText,
|
|
56
48
|
});
|
|
57
49
|
}
|
|
58
50
|
catch (err) {
|
|
59
51
|
debugError(err);
|
|
60
52
|
SpinniesManager.fail('sandboxSync', {
|
|
61
|
-
text:
|
|
53
|
+
text: lib.sandbox.sync.loading.fail(accountId),
|
|
62
54
|
});
|
|
63
|
-
|
|
55
|
+
uiLogger.log('');
|
|
64
56
|
if (isSpecifiedError(err, {
|
|
65
57
|
statusCode: 403,
|
|
66
58
|
category: 'BANNED',
|
|
67
59
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USER',
|
|
68
60
|
})) {
|
|
69
|
-
|
|
70
|
-
accountName: uiAccountDescription(accountId),
|
|
71
|
-
parentAccountName: uiAccountDescription(parentAccountId),
|
|
72
|
-
}));
|
|
61
|
+
uiLogger.error(lib.sandbox.sync.failure.invalidUser(uiAccountDescription(accountId), uiAccountDescription(parentAccountId)));
|
|
73
62
|
}
|
|
74
63
|
else if (isSpecifiedError(err, {
|
|
75
64
|
statusCode: 429,
|
|
76
65
|
category: 'RATE_LIMITS',
|
|
77
66
|
subCategory: 'sandboxes-sync-api.SYNC_IN_PROGRESS',
|
|
78
67
|
})) {
|
|
79
|
-
|
|
80
|
-
url: `${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`,
|
|
81
|
-
}));
|
|
68
|
+
uiLogger.error(lib.sandbox.sync.failure.syncInProgress(`${baseUrl}/sandboxes-developer/${parentAccountId}/syncactivitylog`));
|
|
82
69
|
}
|
|
83
70
|
else if (isSpecifiedError(err, {
|
|
84
71
|
statusCode: 403,
|
|
@@ -86,18 +73,14 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
86
73
|
subCategory: 'sandboxes-sync-api.SYNC_NOT_ALLOWED_INVALID_USERID',
|
|
87
74
|
})) {
|
|
88
75
|
// This will only trigger if a user is not a super admin of the target account.
|
|
89
|
-
|
|
90
|
-
account: uiAccountDescription(accountId),
|
|
91
|
-
}));
|
|
76
|
+
uiLogger.error(lib.sandbox.sync.failure.notSuperAdmin(accountId));
|
|
92
77
|
}
|
|
93
78
|
else if (isSpecifiedError(err, {
|
|
94
79
|
statusCode: 404,
|
|
95
80
|
category: 'OBJECT_NOT_FOUND',
|
|
96
81
|
subCategory: 'SandboxErrors.SANDBOX_NOT_FOUND',
|
|
97
82
|
})) {
|
|
98
|
-
|
|
99
|
-
account: uiAccountDescription(accountId),
|
|
100
|
-
}));
|
|
83
|
+
uiLogger.error(lib.sandbox.sync.failure.objectNotFound(accountId));
|
|
101
84
|
}
|
|
102
85
|
else if (isSpecifiedError(err, {
|
|
103
86
|
statusCode: 404,
|
|
@@ -110,16 +93,16 @@ export async function syncSandbox(accountConfig, parentAccountConfig, env, syncT
|
|
|
110
93
|
request: 'sandbox sync',
|
|
111
94
|
}));
|
|
112
95
|
}
|
|
113
|
-
|
|
96
|
+
uiLogger.log('');
|
|
114
97
|
throw err;
|
|
115
98
|
}
|
|
116
99
|
if (!slimInfoMessage) {
|
|
117
|
-
|
|
100
|
+
uiLogger.log('');
|
|
118
101
|
uiLine();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
uiLogger.info(isDevSandbox
|
|
103
|
+
? lib.sandbox.sync.info.syncMessageDevSb(syncStatusUrl)
|
|
104
|
+
: lib.sandbox.sync.info.syncMessage(syncStatusUrl));
|
|
122
105
|
uiLine();
|
|
123
|
-
|
|
106
|
+
uiLogger.log('');
|
|
124
107
|
}
|
|
125
108
|
}
|
package/lib/sandboxes.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
2
1
|
import { getSandboxUsageLimits } from '@hubspot/local-dev-lib/api/sandboxHubs';
|
|
3
2
|
import { fetchTypes } from '@hubspot/local-dev-lib/api/sandboxSync';
|
|
4
3
|
import { getAccountId, getConfigAccounts } from '@hubspot/local-dev-lib/config';
|
|
@@ -6,9 +5,10 @@ import { getHubSpotWebsiteOrigin } from '@hubspot/local-dev-lib/urls';
|
|
|
6
5
|
import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
|
|
7
6
|
import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
|
|
8
7
|
import { isMissingScopeError, isSpecifiedError, } from '@hubspot/local-dev-lib/errors/index';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { uiLogger } from './ui/logger.js';
|
|
9
|
+
import { lib } from '../lang/en.js';
|
|
11
10
|
import { logError } from './errorHandlers/index.js';
|
|
11
|
+
import { uiAccountDescription } from './ui/index.js';
|
|
12
12
|
export const SYNC_TYPES = {
|
|
13
13
|
OBJECT_RECORDS: 'object-records',
|
|
14
14
|
};
|
|
@@ -54,11 +54,11 @@ export async function getAvailableSyncTypes(parentAccountConfig, config) {
|
|
|
54
54
|
const id = getAccountIdentifier(config);
|
|
55
55
|
const portalId = getAccountId(id);
|
|
56
56
|
if (!parentPortalId || !portalId) {
|
|
57
|
-
throw new Error(
|
|
57
|
+
throw new Error(lib.sandbox.sync.failure.syncTypeFetch);
|
|
58
58
|
}
|
|
59
59
|
const { data: { results: syncTypes }, } = await fetchTypes(parentPortalId, portalId);
|
|
60
60
|
if (!syncTypes) {
|
|
61
|
-
throw new Error(
|
|
61
|
+
throw new Error(lib.sandbox.sync.failure.syncTypeFetch);
|
|
62
62
|
}
|
|
63
63
|
return syncTypes.map(t => ({ type: t.name }));
|
|
64
64
|
}
|
|
@@ -66,91 +66,63 @@ export async function validateSandboxUsageLimits(accountConfig, sandboxType, env
|
|
|
66
66
|
const id = getAccountIdentifier(accountConfig);
|
|
67
67
|
const accountId = getAccountId(id);
|
|
68
68
|
if (!accountId) {
|
|
69
|
-
throw new Error(
|
|
69
|
+
throw new Error(lib.sandbox.create.failure.usageLimitsFetch);
|
|
70
70
|
}
|
|
71
71
|
const { data: { usage }, } = await getSandboxUsageLimits(accountId);
|
|
72
72
|
if (!usage) {
|
|
73
|
-
throw new Error(
|
|
73
|
+
throw new Error(lib.sandbox.create.failure.usageLimitsFetch);
|
|
74
74
|
}
|
|
75
75
|
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX) {
|
|
76
76
|
if (usage['DEVELOPER'].available === 0) {
|
|
77
77
|
const devSandboxLimit = usage['DEVELOPER'].limit;
|
|
78
|
-
const plural = devSandboxLimit !== 1;
|
|
79
78
|
const hasDevelopmentSandboxes = getHasSandboxesByType(accountConfig, HUBSPOT_ACCOUNT_TYPES.DEVELOPMENT_SANDBOX);
|
|
80
79
|
if (hasDevelopmentSandboxes) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
accountName: accountConfig.name || accountId,
|
|
83
|
-
limit: devSandboxLimit,
|
|
84
|
-
}));
|
|
80
|
+
throw new Error(lib.sandbox.create.developer.failure.alreadyInConfig(accountId, devSandboxLimit));
|
|
85
81
|
}
|
|
86
82
|
else {
|
|
87
83
|
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
88
|
-
throw new Error(
|
|
89
|
-
accountName: accountConfig.name || accountId,
|
|
90
|
-
limit: devSandboxLimit,
|
|
91
|
-
link: `${baseUrl}/sandboxes-developer/${accountId}/development`,
|
|
92
|
-
}));
|
|
84
|
+
throw new Error(lib.sandbox.create.developer.failure.limit(accountId, devSandboxLimit, `${baseUrl}/sandboxes-developer/${accountId}/development`));
|
|
93
85
|
}
|
|
94
86
|
}
|
|
95
87
|
}
|
|
96
88
|
if (sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX) {
|
|
97
89
|
if (usage['STANDARD'].available === 0) {
|
|
98
90
|
const standardSandboxLimit = usage['STANDARD'].limit;
|
|
99
|
-
const plural = standardSandboxLimit !== 1;
|
|
100
91
|
const hasStandardSandboxes = getHasSandboxesByType(accountConfig, HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX);
|
|
101
92
|
if (hasStandardSandboxes) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
accountName: accountConfig.name || accountId,
|
|
104
|
-
limit: standardSandboxLimit,
|
|
105
|
-
}));
|
|
93
|
+
throw new Error(lib.sandbox.create.standard.failure.alreadyInConfig(accountId, standardSandboxLimit));
|
|
106
94
|
}
|
|
107
95
|
else {
|
|
108
96
|
const baseUrl = getHubSpotWebsiteOrigin(env);
|
|
109
|
-
throw new Error(
|
|
110
|
-
accountName: accountConfig.name || accountId,
|
|
111
|
-
limit: standardSandboxLimit,
|
|
112
|
-
link: `${baseUrl}/sandboxes-developer/${accountId}/standard`,
|
|
113
|
-
}));
|
|
97
|
+
throw new Error(lib.sandbox.create.standard.failure.limit(accountId, standardSandboxLimit, `${baseUrl}/sandboxes-developer/${accountId}/standard`));
|
|
114
98
|
}
|
|
115
99
|
}
|
|
116
100
|
}
|
|
117
101
|
}
|
|
118
102
|
export function handleSandboxCreateError(err, env, name, accountId) {
|
|
119
103
|
if (isMissingScopeError(err)) {
|
|
120
|
-
|
|
121
|
-
accountName: uiAccountDescription(accountId),
|
|
122
|
-
}));
|
|
104
|
+
uiLogger.error(lib.sandbox.create.failure.scopes.message);
|
|
123
105
|
const websiteOrigin = getHubSpotWebsiteOrigin(env);
|
|
124
106
|
const url = `${websiteOrigin}/personal-access-key/${accountId}`;
|
|
125
|
-
|
|
126
|
-
accountName: uiAccountDescription(accountId),
|
|
127
|
-
url,
|
|
128
|
-
}));
|
|
107
|
+
uiLogger.info(lib.sandbox.create.failure.scopes.instructions(uiAccountDescription(accountId), url));
|
|
129
108
|
}
|
|
130
109
|
else if (isSpecifiedError(err, {
|
|
131
110
|
statusCode: 403,
|
|
132
111
|
category: 'BANNED',
|
|
133
112
|
subCategory: 'SandboxErrors.USER_ACCESS_NOT_ALLOWED',
|
|
134
113
|
})) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
parentAccountName: uiAccountDescription(accountId),
|
|
139
|
-
}));
|
|
140
|
-
logger.log('');
|
|
114
|
+
uiLogger.log('');
|
|
115
|
+
uiLogger.error(lib.sandbox.create.failure.invalidUser(name, accountId));
|
|
116
|
+
uiLogger.log('');
|
|
141
117
|
}
|
|
142
118
|
else if (isSpecifiedError(err, {
|
|
143
119
|
statusCode: 403,
|
|
144
120
|
category: 'BANNED',
|
|
145
121
|
subCategory: 'SandboxErrors.DEVELOPMENT_SANDBOX_ACCESS_NOT_ALLOWED',
|
|
146
122
|
})) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
parentAccountName: uiAccountDescription(accountId),
|
|
151
|
-
accountId,
|
|
152
|
-
}));
|
|
153
|
-
logger.log('');
|
|
123
|
+
uiLogger.log('');
|
|
124
|
+
uiLogger.error(lib.sandbox.create.failure['403Gating'](name, accountId));
|
|
125
|
+
uiLogger.log('');
|
|
154
126
|
}
|
|
155
127
|
else {
|
|
156
128
|
logError(err);
|
package/lib/schema.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { table, getBorderCharacters } from 'table';
|
|
3
|
-
import { logger } from '@hubspot/local-dev-lib/logger';
|
|
4
3
|
import { fetchObjectSchemas } from '@hubspot/local-dev-lib/api/customObjects';
|
|
4
|
+
import { uiLogger } from './ui/logger.js';
|
|
5
5
|
export function logSchemas(schemas) {
|
|
6
6
|
const data = schemas
|
|
7
7
|
.map(r => [r.labels.singular, r.name, r.objectTypeId || ''])
|
|
8
8
|
.sort((a, b) => (a[1] > b[1] ? 1 : -1));
|
|
9
9
|
if (data.length === 0) {
|
|
10
|
-
|
|
10
|
+
uiLogger.log('No Schemas were found');
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
13
|
data.unshift([
|
|
@@ -19,7 +19,7 @@ export function logSchemas(schemas) {
|
|
|
19
19
|
singleLine: true,
|
|
20
20
|
border: getBorderCharacters('honeywell'),
|
|
21
21
|
};
|
|
22
|
-
|
|
22
|
+
uiLogger.log(table(data, tableConfig));
|
|
23
23
|
}
|
|
24
24
|
export async function listSchemas(accountId) {
|
|
25
25
|
const { data } = await fetchObjectSchemas(accountId);
|
package/lib/serverlessLogs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import https from 'https';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import {
|
|
3
|
+
import { uiLogger } from './ui/logger.js';
|
|
4
4
|
import { isHubSpotHttpError, isMissingScopeError, } from '@hubspot/local-dev-lib/errors/index';
|
|
5
5
|
import { SCOPE_GROUPS, PERSONAL_ACCESS_KEY_AUTH_METHOD, } from '@hubspot/local-dev-lib/constants/auth';
|
|
6
6
|
import { getAccountConfig } from '@hubspot/local-dev-lib/config';
|
|
@@ -10,7 +10,7 @@ import { logError, ApiErrorContext } from './errorHandlers/index.js';
|
|
|
10
10
|
import SpinniesManager from './ui/SpinniesManager.js';
|
|
11
11
|
import { handleExit, handleKeypress } from './process.js';
|
|
12
12
|
import { EXIT_CODES } from './enums/exitCodes.js';
|
|
13
|
-
import {
|
|
13
|
+
import { lib } from '../lang/en.js';
|
|
14
14
|
const TAIL_DELAY = 5000;
|
|
15
15
|
function base64EncodeString(valueToEncode) {
|
|
16
16
|
if (typeof valueToEncode !== 'string') {
|
|
@@ -47,22 +47,20 @@ async function verifyAccessKeyAndUserAccess(accountId, scopeGroup) {
|
|
|
47
47
|
scopesData = resp.data;
|
|
48
48
|
}
|
|
49
49
|
catch (e) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}));
|
|
53
|
-
logger.debug(e);
|
|
50
|
+
uiLogger.debug(lib.serverless.verifyAccessKeyAndUserAccess.fetchScopeDataError(scopeGroup));
|
|
51
|
+
uiLogger.debug(e);
|
|
54
52
|
return;
|
|
55
53
|
}
|
|
56
54
|
const { portalScopesInGroup, userScopesInGroup } = scopesData;
|
|
57
55
|
if (!portalScopesInGroup.length) {
|
|
58
|
-
|
|
56
|
+
uiLogger.error(lib.serverless.verifyAccessKeyAndUserAccess.portalMissingScope);
|
|
59
57
|
return;
|
|
60
58
|
}
|
|
61
59
|
if (!portalScopesInGroup.every(s => userScopesInGroup.includes(s))) {
|
|
62
|
-
|
|
60
|
+
uiLogger.error(lib.serverless.verifyAccessKeyAndUserAccess.userMissingScope);
|
|
63
61
|
}
|
|
64
62
|
else {
|
|
65
|
-
|
|
63
|
+
uiLogger.error(lib.serverless.verifyAccessKeyAndUserAccess.genericMissingScope);
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
export async function tailLogs(accountId, name, fetchLatest, tailCall, compact = false) {
|
|
@@ -120,7 +118,7 @@ export async function tailLogs(accountId, name, fetchLatest, tailCall, compact =
|
|
|
120
118
|
}
|
|
121
119
|
export async function outputBuildLog(buildLogUrl) {
|
|
122
120
|
if (!buildLogUrl) {
|
|
123
|
-
|
|
121
|
+
uiLogger.debug('Unable to display build output. No build log URL was provided.');
|
|
124
122
|
return '';
|
|
125
123
|
}
|
|
126
124
|
return new Promise(resolve => {
|
|
@@ -135,16 +133,16 @@ export async function outputBuildLog(buildLogUrl) {
|
|
|
135
133
|
data += chunk;
|
|
136
134
|
});
|
|
137
135
|
response.on('end', () => {
|
|
138
|
-
|
|
136
|
+
uiLogger.log(data);
|
|
139
137
|
resolve(data);
|
|
140
138
|
});
|
|
141
139
|
})
|
|
142
140
|
.on('error', () => {
|
|
143
|
-
|
|
141
|
+
uiLogger.error('The build log could not be retrieved.');
|
|
144
142
|
});
|
|
145
143
|
}
|
|
146
144
|
catch (e) {
|
|
147
|
-
|
|
145
|
+
uiLogger.error('The build log could not be retrieved.');
|
|
148
146
|
resolve('');
|
|
149
147
|
}
|
|
150
148
|
});
|
|
@@ -2,11 +2,11 @@ import { getProjectThemeDetails, migrateThemes, } from '@hubspot/project-parsing
|
|
|
2
2
|
import { confirmPrompt } from '../../prompts/promptUtils.js';
|
|
3
3
|
import { writeProjectConfig, } from '../../projects/config.js';
|
|
4
4
|
import { ensureProjectExists } from '../../projects/ensureProjectExists.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isV2Project } from '../../projects/platformVersion.js';
|
|
6
6
|
import { fetchMigrationApps } from '../../app/migrate.js';
|
|
7
7
|
import { getHasMigratableThemes, validateMigrationAppsAndThemes, handleThemesMigration, migrateThemes2025_2, } from '../migrate.js';
|
|
8
8
|
import { lib } from '../../../lang/en.js';
|
|
9
|
-
vi.mock('
|
|
9
|
+
vi.mock('../../ui/logger.js');
|
|
10
10
|
vi.mock('@hubspot/project-parsing-lib');
|
|
11
11
|
vi.mock('../../prompts/promptUtils');
|
|
12
12
|
vi.mock('../../projects/config');
|
|
@@ -18,7 +18,7 @@ const mockedMigrateThemes = migrateThemes;
|
|
|
18
18
|
const mockedConfirmPrompt = confirmPrompt;
|
|
19
19
|
const mockedWriteProjectConfig = writeProjectConfig;
|
|
20
20
|
const mockedEnsureProjectExists = ensureProjectExists;
|
|
21
|
-
const mockedUseV3Api =
|
|
21
|
+
const mockedUseV3Api = isV2Project;
|
|
22
22
|
const mockedFetchMigrationApps = fetchMigrationApps;
|
|
23
23
|
const ACCOUNT_ID = 123;
|
|
24
24
|
const PROJECT_NAME = 'Test Project';
|