@hubspot/cli 7.8.0-beta.0 → 7.8.0-beta.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/commands/__tests__/project.test.js +2 -0
- package/commands/account/auth.js +1 -0
- package/commands/auth.js +1 -0
- package/commands/feedback.js +1 -1
- package/commands/project/__tests__/add.test.js +12 -12
- package/commands/project/__tests__/list.test.js +31 -0
- package/commands/project/__tests__/migrate.test.js +1 -0
- package/commands/project/add.d.ts +2 -2
- package/commands/project/add.js +3 -2
- package/commands/project/create.js +1 -1
- package/commands/project/dev/deprecatedFlow.js +2 -2
- package/commands/project/dev/index.js +5 -5
- package/commands/project/dev/unifiedFlow.js +6 -3
- package/commands/project/download.js +5 -2
- package/commands/project/installDeps.d.ts +2 -2
- package/commands/project/installDeps.js +1 -0
- package/commands/project/list.d.ts +4 -0
- package/commands/project/list.js +62 -0
- package/commands/project/migrate.js +5 -2
- package/commands/project.js +2 -0
- package/commands/sandbox/delete.js +5 -2
- package/commands/testAccount/create.js +2 -2
- package/commands/theme/preview.js +1 -4
- package/lang/en.d.ts +49 -14
- package/lang/en.js +121 -86
- package/lang/en.lyaml +2 -2
- package/lib/__tests__/buildAccount.test.js +2 -2
- package/lib/app/migrate.js +1 -1
- package/lib/buildAccount.d.ts +2 -2
- package/lib/buildAccount.js +7 -7
- package/lib/configMigrate.js +88 -9
- package/lib/constants.d.ts +8 -1
- package/lib/constants.js +8 -1
- package/lib/doctor/Doctor.js +2 -2
- package/lib/errorHandlers/suppressError.js +2 -2
- package/lib/middleware/commandTargetingUtils.d.ts +1 -1
- package/lib/middleware/commandTargetingUtils.js +16 -20
- package/lib/projects/__tests__/AppDevModeInterface.test.js +85 -90
- package/lib/projects/__tests__/LocalDevProcess.test.js +6 -5
- package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +6 -6
- package/lib/projects/__tests__/deploy.test.js +9 -9
- package/lib/projects/__tests__/upload.test.js +2 -2
- package/lib/projects/add/__tests__/{v3AddComponent.test.js → v2AddComponent.test.js} +35 -35
- package/lib/projects/add/{v3AddComponent.d.ts → v2AddComponent.d.ts} +1 -1
- package/lib/projects/add/{v3AddComponent.js → v2AddComponent.js} +5 -5
- package/lib/projects/create/__tests__/v2.test.d.ts +1 -0
- package/lib/projects/create/__tests__/{v3.test.js → v2.test.js} +2 -2
- package/lib/projects/create/index.js +2 -2
- package/lib/projects/create/{v3.d.ts → v2.d.ts} +3 -3
- package/lib/projects/create/{v3.js → v2.js} +3 -3
- package/lib/projects/deploy.d.ts +1 -1
- package/lib/projects/deploy.js +2 -2
- package/lib/projects/localDev/AppDevModeInterface.d.ts +8 -1
- package/lib/projects/localDev/AppDevModeInterface.js +106 -86
- package/lib/projects/localDev/DevServerManager.d.ts +11 -29
- package/lib/projects/localDev/DevServerManager.js +19 -61
- package/lib/projects/localDev/DevServerManager_DEPRECATED.d.ts +40 -0
- package/lib/projects/localDev/DevServerManager_DEPRECATED.js +120 -0
- package/lib/projects/localDev/{LocalDevManager.js → LocalDevManager_DEPRECATED.js} +6 -6
- package/lib/projects/localDev/LocalDevProcess.js +3 -2
- package/lib/projects/localDev/LocalDevState.d.ts +3 -0
- package/lib/projects/localDev/LocalDevState.js +9 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.d.ts +4 -0
- package/lib/projects/localDev/LocalDevWebsocketServer.js +34 -2
- package/lib/projects/localDev/helpers/account.d.ts +1 -1
- package/lib/projects/localDev/helpers/account.js +2 -2
- package/lib/projects/localDev/helpers/project.js +2 -3
- package/lib/projects/localDev/localDevWebsocketServerUtils.d.ts +3 -0
- package/lib/projects/localDev/localDevWebsocketServerUtils.js +9 -0
- package/lib/projects/urls.d.ts +0 -1
- package/lib/projects/urls.js +0 -3
- package/lib/prompts/__tests__/downloadProjectPrompt.test.js +1 -0
- package/lib/prompts/__tests__/projectAddPrompt.test.js +10 -10
- package/lib/prompts/installAppPrompt.d.ts +1 -6
- package/lib/prompts/installAppPrompt.js +1 -6
- package/lib/prompts/projectAddPrompt.d.ts +2 -2
- package/lib/prompts/projectAddPrompt.js +1 -1
- package/lib/prompts/projectDevTargetAccountPrompt.js +1 -1
- package/lib/theme/__tests__/migrate.test.js +4 -4
- package/lib/ui/index.d.ts +4 -0
- package/lib/ui/index.js +9 -1
- package/lib/ui/uiMessages.d.ts +4 -0
- package/lib/ui/uiMessages.js +4 -0
- package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +1 -1
- package/package.json +6 -5
- package/lib/projects/localDev/DevServerManagerV2.d.ts +0 -22
- package/lib/projects/localDev/DevServerManagerV2.js +0 -81
- /package/{lib/projects/add/__tests__/v3AddComponent.test.d.ts → commands/project/__tests__/list.test.d.ts} +0 -0
- /package/lib/projects/{create/__tests__/v3.test.d.ts → add/__tests__/v2AddComponent.test.d.ts} +0 -0
- /package/lib/projects/localDev/{LocalDevManager.d.ts → LocalDevManager_DEPRECATED.d.ts} +0 -0
package/lang/en.lyaml
CHANGED
|
@@ -2,7 +2,7 @@ en:
|
|
|
2
2
|
commands:
|
|
3
3
|
generalErrors:
|
|
4
4
|
updateNotify:
|
|
5
|
-
notifyTitle: "
|
|
5
|
+
notifyTitle: "CLI update available"
|
|
6
6
|
cmsUpdateNotification: "{{#bold}}The CMS CLI is now the HubSpot CLI{{/bold}}\n\nTo upgrade, uninstall {{#bold}}{{ packageName }}{{/bold}}\nand then run {{ updateCommand }}"
|
|
7
7
|
cliUpdateNotification: "HubSpot CLI version {{#cyan}}{{#bold}}{currentVersion}{{/bold}}{{/cyan}} is outdated.\nRun {{ updateCommand }} to upgrade to version {{#cyan}}{{#bold}}{latestVersion}{{/bold}}{{/cyan}}"
|
|
8
8
|
srcIsProject: "\"{{ src }}\" is in a project folder. Did you mean \"hs project {{command}}\"?"
|
|
@@ -801,7 +801,7 @@ en:
|
|
|
801
801
|
uploadFailed: "Failed to upload file \"{{ filePath }}\" to \"{{ remotePath }}\""
|
|
802
802
|
deleteFileFailed: "Failed to delete file \"{{ remotePath }}\""
|
|
803
803
|
deleteFolderFailed: "Failed to delete folder \"{{ remotePath }}\""
|
|
804
|
-
|
|
804
|
+
v2ApiError: "{{ command }} is not supported for platform version '{{ platformVersion}}', use {{ newCommand }} instead to develop locally. {{ linkToDocs }}"
|
|
805
805
|
download:
|
|
806
806
|
describe: "Download your project files from HubSpot."
|
|
807
807
|
examples:
|
|
@@ -102,7 +102,7 @@ describe('lib/buildAccount', () => {
|
|
|
102
102
|
expect(result).toBe('test-account-with-new-name');
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
describe('
|
|
105
|
+
describe('createDeveloperTestAccountV2()', () => {
|
|
106
106
|
const parentAccountId = 123456;
|
|
107
107
|
const mockDeveoperTestAccountConfig = {
|
|
108
108
|
accountName: 'Developer Test Account',
|
|
@@ -120,7 +120,7 @@ describe('lib/buildAccount', () => {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
it('should create a developer test account successfully', async () => {
|
|
123
|
-
const result = await buildAccount.
|
|
123
|
+
const result = await buildAccount.createDeveloperTestAccountV2(parentAccountId, mockDeveoperTestAccountConfig);
|
|
124
124
|
expect(result).toEqual({
|
|
125
125
|
accountName: mockDeveoperTestAccountConfig.accountName,
|
|
126
126
|
accountId: 123456,
|
package/lib/app/migrate.js
CHANGED
|
@@ -358,6 +358,6 @@ export async function migrateApp2025_2(derivedAccountId, options, projectConfig)
|
|
|
358
358
|
export function logInvalidAccountError() {
|
|
359
359
|
uiLine();
|
|
360
360
|
uiLogger.error(lib.migrate.errors.invalidAccountTypeTitle);
|
|
361
|
-
uiLogger.log(lib.migrate.errors.invalidAccountTypeDescription(uiCommandReference('hs account use')
|
|
361
|
+
uiLogger.log(lib.migrate.errors.invalidAccountTypeDescription(uiCommandReference('hs account use')));
|
|
362
362
|
uiLine();
|
|
363
363
|
}
|
package/lib/buildAccount.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
|
|
|
4
4
|
import { SandboxResponse, V2Sandbox } from '@hubspot/local-dev-lib/types/Sandbox';
|
|
5
5
|
import { SandboxAccountType } from '../types/Sandboxes.js';
|
|
6
6
|
export declare function saveAccountToConfig(accountId: number | undefined, accountName: string, env: Environment, personalAccessKey?: string, force?: boolean): Promise<string>;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function createDeveloperTestAccountV2(parentAccountId: number, testAccountConfig: DeveloperTestAccountConfig): Promise<{
|
|
8
8
|
accountName: string;
|
|
9
9
|
accountId?: number;
|
|
10
10
|
personalAccessKey?: string;
|
|
11
11
|
}>;
|
|
12
|
-
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number,
|
|
12
|
+
export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number, useV2?: boolean): Promise<number>;
|
|
13
13
|
type SandboxAccount = SandboxResponse & {
|
|
14
14
|
name: string;
|
|
15
15
|
};
|
package/lib/buildAccount.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
|
|
|
52
52
|
uiLogger.log('');
|
|
53
53
|
return validName;
|
|
54
54
|
}
|
|
55
|
-
export async function
|
|
55
|
+
export async function createDeveloperTestAccountV2(parentAccountId, testAccountConfig) {
|
|
56
56
|
const result = {
|
|
57
57
|
accountName: testAccountConfig.accountName,
|
|
58
58
|
};
|
|
@@ -66,7 +66,7 @@ export async function createDeveloperTestAccountV3(parentAccountId, testAccountC
|
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
68
68
|
debugError(err);
|
|
69
|
-
throw new Error(lib.buildAccount.
|
|
69
|
+
throw new Error(lib.buildAccount.createDeveloperTestAccountV2.syncFailure);
|
|
70
70
|
}
|
|
71
71
|
// HACK: The status endpoint sometimes returns an early success status.
|
|
72
72
|
// Sleep for an extra 5 seconds to make sure the sync is actually complete.
|
|
@@ -78,11 +78,11 @@ export async function createDeveloperTestAccountV3(parentAccountId, testAccountC
|
|
|
78
78
|
}
|
|
79
79
|
catch (err) {
|
|
80
80
|
debugError(err);
|
|
81
|
-
throw new Error(lib.buildAccount.
|
|
81
|
+
throw new Error(lib.buildAccount.createDeveloperTestAccountV2.pakFailure);
|
|
82
82
|
}
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
|
-
export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit,
|
|
85
|
+
export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV2 = false) {
|
|
86
86
|
const id = getAccountIdentifier(parentAccountConfig);
|
|
87
87
|
const parentAccountId = getAccountId(id);
|
|
88
88
|
let testAccountConfig = {
|
|
@@ -91,7 +91,7 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
|
|
|
91
91
|
if (!parentAccountId) {
|
|
92
92
|
throw new Error(lib.developerTestAccount.create.loading.fail(''));
|
|
93
93
|
}
|
|
94
|
-
if (
|
|
94
|
+
if (useV2) {
|
|
95
95
|
testAccountConfig = await createDeveloperTestAccountConfigPrompt({
|
|
96
96
|
name: testAccountConfig.accountName,
|
|
97
97
|
description: 'Test Account created by the HubSpot CLI',
|
|
@@ -107,8 +107,8 @@ export async function buildDeveloperTestAccount(testAccountName, parentAccountCo
|
|
|
107
107
|
let developerTestAccountId;
|
|
108
108
|
let developerTestAccountPersonalAccessKey;
|
|
109
109
|
try {
|
|
110
|
-
if (
|
|
111
|
-
const result = await
|
|
110
|
+
if (useV2) {
|
|
111
|
+
const result = await createDeveloperTestAccountV2(parentAccountId, testAccountConfig);
|
|
112
112
|
developerTestAccountId = result.accountId;
|
|
113
113
|
developerTestAccountPersonalAccessKey = result.personalAccessKey;
|
|
114
114
|
}
|
package/lib/configMigrate.js
CHANGED
|
@@ -3,6 +3,37 @@ import { ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME } from '@hubspot/local-dev-lib/c
|
|
|
3
3
|
import { promptUser } from './prompts/promptUtils.js';
|
|
4
4
|
import { lib } from '../lang/en.js';
|
|
5
5
|
import { uiLogger } from './ui/logger.js';
|
|
6
|
+
async function promptRenameOrOmitAccount(accountName, accountId) {
|
|
7
|
+
const { shouldRename } = await promptUser({
|
|
8
|
+
name: 'shouldRename',
|
|
9
|
+
type: 'confirm',
|
|
10
|
+
message: lib.configMigrate.handleAccountNameConflicts.prompts.renameOrOmitAccountPrompt(accountName, accountId),
|
|
11
|
+
});
|
|
12
|
+
return shouldRename;
|
|
13
|
+
}
|
|
14
|
+
async function promptNewAccountName(account, globalConfig, renamedAccounts) {
|
|
15
|
+
const { newAccountName } = await promptUser({
|
|
16
|
+
name: 'newAccountName',
|
|
17
|
+
type: 'input',
|
|
18
|
+
default: `${account.name}_${account.portalId}`,
|
|
19
|
+
message: lib.configMigrate.handleAccountNameConflicts.prompts.newAccountNamePrompt(account.name, account.portalId),
|
|
20
|
+
validate: value => {
|
|
21
|
+
if (!value) {
|
|
22
|
+
return lib.configMigrate.handleAccountNameConflicts.errors.nameRequired;
|
|
23
|
+
}
|
|
24
|
+
if (value === account.name) {
|
|
25
|
+
return lib.configMigrate.handleAccountNameConflicts.errors.sameName;
|
|
26
|
+
}
|
|
27
|
+
const existingAccount = globalConfig.accounts.some(acc => acc.name === value);
|
|
28
|
+
const renamedAccount = renamedAccounts.some(acc => acc.name === value);
|
|
29
|
+
if (existingAccount || renamedAccount) {
|
|
30
|
+
return lib.configMigrate.handleAccountNameConflicts.errors.nameAlreadyInConfig(value);
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
return newAccountName;
|
|
36
|
+
}
|
|
6
37
|
export async function handleMigration(deprecatedConfigPath, hideWarning) {
|
|
7
38
|
if (!hideWarning) {
|
|
8
39
|
uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
|
|
@@ -47,20 +78,67 @@ async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force
|
|
|
47
78
|
}
|
|
48
79
|
return initialConfig;
|
|
49
80
|
}
|
|
81
|
+
async function handleAccountNameConflicts(globalConfig, deprecatedConfig, force) {
|
|
82
|
+
if (!deprecatedConfig.portals?.length || !globalConfig.accounts?.length) {
|
|
83
|
+
return deprecatedConfig;
|
|
84
|
+
}
|
|
85
|
+
const accountsWithConflictsToRemove = new Set();
|
|
86
|
+
const renamedAccounts = [];
|
|
87
|
+
const accountsNotYetInGlobal = deprecatedConfig.portals.filter(portal => portal.portalId &&
|
|
88
|
+
!globalConfig.accounts.some(acc => acc.accountId === portal.portalId));
|
|
89
|
+
const accountsWithConflicts = accountsNotYetInGlobal.filter(localAccount => globalConfig.accounts.some(globalAccount => globalAccount.name === localAccount.name));
|
|
90
|
+
if (accountsWithConflicts.length > 0) {
|
|
91
|
+
uiLogger.log('');
|
|
92
|
+
uiLogger.warn(lib.configMigrate.handleAccountNameConflicts.warnings.accountNameConflictMessage(accountsWithConflicts.length));
|
|
93
|
+
if (force) {
|
|
94
|
+
const renameDetails = [];
|
|
95
|
+
for (const account of accountsWithConflicts) {
|
|
96
|
+
accountsWithConflictsToRemove.add(account);
|
|
97
|
+
const newAccountName = `${account.name}_${account.portalId}`;
|
|
98
|
+
renamedAccounts.push({
|
|
99
|
+
...account,
|
|
100
|
+
name: newAccountName,
|
|
101
|
+
});
|
|
102
|
+
renameDetails.push(` "${account.name}" → "${newAccountName}" (ID: ${account.portalId})`);
|
|
103
|
+
}
|
|
104
|
+
uiLogger.warn(lib.configMigrate.handleAccountNameConflicts.warnings.forceFlagDetected(accountsWithConflicts.length, renameDetails.join('\n')));
|
|
105
|
+
uiLogger.log('');
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
for (const account of accountsWithConflicts) {
|
|
109
|
+
uiLogger.log('');
|
|
110
|
+
const shouldRename = await promptRenameOrOmitAccount(account.name, account.portalId);
|
|
111
|
+
accountsWithConflictsToRemove.add(account);
|
|
112
|
+
if (shouldRename) {
|
|
113
|
+
const newAccountName = await promptNewAccountName(account, globalConfig, renamedAccounts);
|
|
114
|
+
renamedAccounts.push({
|
|
115
|
+
...account,
|
|
116
|
+
name: newAccountName,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
deprecatedConfig.portals.push(...renamedAccounts);
|
|
122
|
+
}
|
|
123
|
+
const cleanedPortals = deprecatedConfig.portals.filter(portal => !accountsWithConflictsToRemove.has(portal));
|
|
124
|
+
return { ...deprecatedConfig, portals: cleanedPortals };
|
|
125
|
+
}
|
|
50
126
|
export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
|
|
51
127
|
if (!hideWarning) {
|
|
52
128
|
uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
|
|
53
129
|
uiLogger.log('');
|
|
54
130
|
}
|
|
55
131
|
uiLogger.log(lib.configMigrate.handleMerge.description(ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
132
|
+
if (!force) {
|
|
133
|
+
uiLogger.log('');
|
|
134
|
+
const { shouldMergeConfigs } = await promptUser({
|
|
135
|
+
name: 'shouldMergeConfigs',
|
|
136
|
+
type: 'confirm',
|
|
137
|
+
message: lib.configMigrate.handleMerge.confirmPrompt,
|
|
138
|
+
});
|
|
139
|
+
if (shouldMergeConfigs === false) {
|
|
140
|
+
return true; // exit with "true" so the user is shown a success message instead of an error
|
|
141
|
+
}
|
|
64
142
|
}
|
|
65
143
|
const deprecatedConfig = getDeprecatedConfig(deprecatedConfigPath);
|
|
66
144
|
const globalConfig = getGlobalConfig();
|
|
@@ -68,7 +146,8 @@ export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
|
|
|
68
146
|
return true;
|
|
69
147
|
}
|
|
70
148
|
const mergedConfig = await handleMergeConfigProperties(globalConfig, deprecatedConfig, force);
|
|
71
|
-
const
|
|
149
|
+
const cleanedDeprecatedConfig = await handleAccountNameConflicts(mergedConfig, deprecatedConfig, force);
|
|
150
|
+
const { skippedAccountIds } = mergeExistingConfigs(mergedConfig, cleanedDeprecatedConfig);
|
|
72
151
|
if (skippedAccountIds.length > 0) {
|
|
73
152
|
uiLogger.log('');
|
|
74
153
|
uiLogger.log(lib.configMigrate.handleMerge.skippedExistingAccounts(skippedAccountIds));
|
package/lib/constants.d.ts
CHANGED
|
@@ -76,7 +76,6 @@ export declare const APP_AUTH_TYPES: {
|
|
|
76
76
|
readonly STATIC: "static";
|
|
77
77
|
};
|
|
78
78
|
export declare const FEATURES: {
|
|
79
|
-
readonly UNIFIED_THEME_PREVIEW: "cms:react:unifiedThemePreview";
|
|
80
79
|
readonly UNIFIED_APPS: "Developers:UnifiedApps:PrivateBeta";
|
|
81
80
|
readonly SANDBOXES_V2: "sandboxes:v2:enabled";
|
|
82
81
|
readonly SANDBOXES_V2_CLI: "sandboxes:v2:cliEnabled";
|
|
@@ -96,16 +95,21 @@ export declare const LOCAL_DEV_UI_MESSAGE_SEND_TYPES: {
|
|
|
96
95
|
UPDATE_PROJECT_DATA: string;
|
|
97
96
|
UPDATE_UPLOAD_WARNINGS: string;
|
|
98
97
|
CLI_METADATA: string;
|
|
98
|
+
DEV_SERVERS_STARTED: string;
|
|
99
99
|
};
|
|
100
100
|
export declare const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES: {
|
|
101
101
|
UPLOAD: string;
|
|
102
102
|
DEPLOY: string;
|
|
103
103
|
VIEWED_WELCOME_SCREEN: string;
|
|
104
|
+
APP_INSTALL_SUCCESS: string;
|
|
105
|
+
APP_INSTALL_INITIATED: string;
|
|
106
|
+
APP_INSTALL_FAILURE: string;
|
|
104
107
|
};
|
|
105
108
|
export declare const APP_INSTALLATION_STATES: {
|
|
106
109
|
readonly NOT_INSTALLED: "NOT_INSTALLED";
|
|
107
110
|
readonly INSTALLED: "INSTALLED";
|
|
108
111
|
readonly INSTALLED_WITH_OUTDATED_SCOPES: "INSTALLED_WITH_OUTDATED_SCOPES";
|
|
112
|
+
readonly UNKNOWN: "UNKNOWN";
|
|
109
113
|
};
|
|
110
114
|
export declare const staticAuth = "static";
|
|
111
115
|
export declare const oAuth = "oauth";
|
|
@@ -119,6 +123,9 @@ export declare const GET_STARTED_OPTIONS: {
|
|
|
119
123
|
export declare const LOCAL_DEV_SERVER_MESSAGE_TYPES: {
|
|
120
124
|
readonly INITIAL: "INITIAL";
|
|
121
125
|
readonly WEBSOCKET_SERVER_CONNECTED: "WEBSOCKET_SERVER_CONNECTED";
|
|
126
|
+
readonly STATIC_AUTH_APP_INSTALL_SUCCESS: "APP_INSTALL_SUCCESS";
|
|
127
|
+
readonly STATIC_AUTH_APP_INSTALL_FAILURE: "APP_INSTALL_FAILURE";
|
|
128
|
+
readonly OAUTH_APP_INSTALL_INITIATED: "APP_INSTALL_INITIATED";
|
|
122
129
|
};
|
|
123
130
|
export declare const CONFIG_LOCAL_STATE_FLAGS: {
|
|
124
131
|
readonly LOCAL_DEV_UI_WELCOME: "LOCAL_DEV_UI_WELCOME";
|
package/lib/constants.js
CHANGED
|
@@ -68,7 +68,6 @@ export const APP_AUTH_TYPES = {
|
|
|
68
68
|
STATIC: 'static',
|
|
69
69
|
};
|
|
70
70
|
export const FEATURES = {
|
|
71
|
-
UNIFIED_THEME_PREVIEW: 'cms:react:unifiedThemePreview',
|
|
72
71
|
UNIFIED_APPS: 'Developers:UnifiedApps:PrivateBeta',
|
|
73
72
|
SANDBOXES_V2: 'sandboxes:v2:enabled',
|
|
74
73
|
SANDBOXES_V2_CLI: 'sandboxes:v2:cliEnabled',
|
|
@@ -88,16 +87,21 @@ export const LOCAL_DEV_UI_MESSAGE_SEND_TYPES = {
|
|
|
88
87
|
UPDATE_PROJECT_DATA: 'server:updateProjectData',
|
|
89
88
|
UPDATE_UPLOAD_WARNINGS: 'server:updateUploadWarnings',
|
|
90
89
|
CLI_METADATA: 'server:cliMetadata',
|
|
90
|
+
DEV_SERVERS_STARTED: 'server:devServersStarted',
|
|
91
91
|
};
|
|
92
92
|
export const LOCAL_DEV_UI_MESSAGE_RECEIVE_TYPES = {
|
|
93
93
|
UPLOAD: 'client:upload',
|
|
94
94
|
DEPLOY: 'client:deploy',
|
|
95
95
|
VIEWED_WELCOME_SCREEN: 'client:viewedWelcomeScreen',
|
|
96
|
+
APP_INSTALL_SUCCESS: 'client:installSuccess',
|
|
97
|
+
APP_INSTALL_INITIATED: 'client:installInitiated',
|
|
98
|
+
APP_INSTALL_FAILURE: 'client:installFailure',
|
|
96
99
|
};
|
|
97
100
|
export const APP_INSTALLATION_STATES = {
|
|
98
101
|
NOT_INSTALLED: 'NOT_INSTALLED',
|
|
99
102
|
INSTALLED: 'INSTALLED',
|
|
100
103
|
INSTALLED_WITH_OUTDATED_SCOPES: 'INSTALLED_WITH_OUTDATED_SCOPES',
|
|
104
|
+
UNKNOWN: 'UNKNOWN',
|
|
101
105
|
};
|
|
102
106
|
export const staticAuth = 'static';
|
|
103
107
|
export const oAuth = 'oauth';
|
|
@@ -111,6 +115,9 @@ export const GET_STARTED_OPTIONS = {
|
|
|
111
115
|
export const LOCAL_DEV_SERVER_MESSAGE_TYPES = {
|
|
112
116
|
INITIAL: 'INITIAL',
|
|
113
117
|
WEBSOCKET_SERVER_CONNECTED: 'WEBSOCKET_SERVER_CONNECTED',
|
|
118
|
+
STATIC_AUTH_APP_INSTALL_SUCCESS: 'APP_INSTALL_SUCCESS',
|
|
119
|
+
STATIC_AUTH_APP_INSTALL_FAILURE: 'APP_INSTALL_FAILURE',
|
|
120
|
+
OAUTH_APP_INSTALL_INITIATED: 'APP_INSTALL_INITIATED',
|
|
114
121
|
};
|
|
115
122
|
export const CONFIG_LOCAL_STATE_FLAGS = {
|
|
116
123
|
LOCAL_DEV_UI_WELCOME: 'LOCAL_DEV_UI_WELCOME',
|
package/lib/doctor/Doctor.js
CHANGED
|
@@ -115,7 +115,7 @@ export class Doctor {
|
|
|
115
115
|
this.diagnosis?.addCLIConfigSection({
|
|
116
116
|
type: 'warning',
|
|
117
117
|
message: lib.doctor.accountChecks.pak.incomplete,
|
|
118
|
-
secondaryMessaging: lib.doctor.accountChecks.pak.incompleteSecondary(
|
|
118
|
+
secondaryMessaging: lib.doctor.accountChecks.pak.incompleteSecondary(linkToPakUI),
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
@@ -155,7 +155,7 @@ export class Doctor {
|
|
|
155
155
|
this.diagnosis?.addCLIConfigSection({
|
|
156
156
|
type: 'error',
|
|
157
157
|
message: lib.doctor.accountChecks.pak.invalid,
|
|
158
|
-
secondaryMessaging: lib.doctor.accountChecks.pak.invalidSecondary
|
|
158
|
+
secondaryMessaging: lib.doctor.accountChecks.pak.invalidSecondary,
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
@@ -2,7 +2,7 @@ import { isSpecifiedError, isMissingScopeError, } from '@hubspot/local-dev-lib/e
|
|
|
2
2
|
import { uiLogger } from '../ui/logger.js';
|
|
3
3
|
import { PLATFORM_VERSION_ERROR_TYPES } from '../constants.js';
|
|
4
4
|
import { lib } from '../../lang/en.js';
|
|
5
|
-
import { uiAccountDescription, uiLine, uiLink
|
|
5
|
+
import { uiAccountDescription, uiLine, uiLink } from '../ui/index.js';
|
|
6
6
|
function createPlatformVersionError(err, subCategory) {
|
|
7
7
|
let translationKey = 'unspecifiedPlatformVersion';
|
|
8
8
|
let platformVersion = 'unspecified platformVersion';
|
|
@@ -28,7 +28,7 @@ function createPlatformVersionError(err, subCategory) {
|
|
|
28
28
|
}
|
|
29
29
|
export function shouldSuppressError(err, context) {
|
|
30
30
|
if (isMissingScopeError(err)) {
|
|
31
|
-
uiLogger.error(lib.errorHandlers.suppressErrors.missingScopeError(context?.request || 'request', context?.accountId ? uiAccountDescription(context.accountId) : ''
|
|
31
|
+
uiLogger.error(lib.errorHandlers.suppressErrors.missingScopeError(context?.request || 'request', context?.accountId ? uiAccountDescription(context.accountId) : ''));
|
|
32
32
|
return true;
|
|
33
33
|
}
|
|
34
34
|
if (isSpecifiedError(err, {
|
|
@@ -3,6 +3,6 @@ type TargetCommandMap = {
|
|
|
3
3
|
};
|
|
4
4
|
export declare function isTargetedCommand(commandParts: (string | number)[], targetCommandMap: TargetCommandMap): boolean;
|
|
5
5
|
export declare function shouldLoadConfigForCommand(commandParts: (string | number)[]): boolean;
|
|
6
|
-
export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
7
6
|
export declare function shouldRunConfigValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
7
|
+
export declare function shouldRunAccountValidationForCommand(commandParts: (string | number)[]): boolean;
|
|
8
8
|
export {};
|
|
@@ -33,6 +33,19 @@ export function shouldLoadConfigForCommand(commandParts) {
|
|
|
33
33
|
return (!isGlobalConfigMigration &&
|
|
34
34
|
!isTargetedCommand(commandParts, SKIP_CONFIG_LOADING_COMMANDS));
|
|
35
35
|
}
|
|
36
|
+
const SKIP_CONFIG_VALIDATION_COMMANDS = {
|
|
37
|
+
auth: true,
|
|
38
|
+
mcp: {
|
|
39
|
+
setup: true,
|
|
40
|
+
start: true,
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
// Returns true if the command requires a valid config file to be present
|
|
44
|
+
// Should only run if config has been loaded
|
|
45
|
+
export function shouldRunConfigValidationForCommand(commandParts) {
|
|
46
|
+
return (shouldLoadConfigForCommand(commandParts) &&
|
|
47
|
+
!isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS));
|
|
48
|
+
}
|
|
36
49
|
const accountsSubCommands = {
|
|
37
50
|
auth: true,
|
|
38
51
|
clean: true,
|
|
@@ -45,12 +58,6 @@ const sandboxesSubCommands = {
|
|
|
45
58
|
delete: true,
|
|
46
59
|
};
|
|
47
60
|
const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
|
|
48
|
-
init: true,
|
|
49
|
-
auth: true,
|
|
50
|
-
mcp: {
|
|
51
|
-
setup: true,
|
|
52
|
-
start: true,
|
|
53
|
-
},
|
|
54
61
|
account: accountsSubCommands,
|
|
55
62
|
accounts: accountsSubCommands,
|
|
56
63
|
sandbox: sandboxesSubCommands,
|
|
@@ -58,21 +65,10 @@ const SKIP_ACCOUNT_VALIDATION_COMMANDS = {
|
|
|
58
65
|
config: {
|
|
59
66
|
migrate: true,
|
|
60
67
|
},
|
|
61
|
-
feedback: true,
|
|
62
68
|
};
|
|
63
69
|
// Returns true if the command requires a valid account to be set in the config
|
|
70
|
+
// Should only run if config has been loaded and validated
|
|
64
71
|
export function shouldRunAccountValidationForCommand(commandParts) {
|
|
65
|
-
return
|
|
66
|
-
|
|
67
|
-
const SKIP_CONFIG_VALIDATION_COMMANDS = {
|
|
68
|
-
init: true,
|
|
69
|
-
auth: true,
|
|
70
|
-
mcp: {
|
|
71
|
-
setup: true,
|
|
72
|
-
start: true,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
// Returns true if the command requires a valid config file to be present
|
|
76
|
-
export function shouldRunConfigValidationForCommand(commandParts) {
|
|
77
|
-
return !isTargetedCommand(commandParts, SKIP_CONFIG_VALIDATION_COMMANDS);
|
|
72
|
+
return (shouldRunConfigValidationForCommand(commandParts) &&
|
|
73
|
+
!isTargetedCommand(commandParts, SKIP_ACCOUNT_VALIDATION_COMMANDS));
|
|
78
74
|
}
|