@hubspot/cli 7.9.0 → 7.9.1-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.
Files changed (214) hide show
  1. package/bin/cli.js +5 -4
  2. package/commands/__tests__/getStarted.test.js +10 -0
  3. package/commands/__tests__/project.test.js +2 -0
  4. package/commands/account/__tests__/rename.test.js +42 -0
  5. package/commands/account/auth.js +10 -14
  6. package/commands/account/clean.js +11 -19
  7. package/commands/account/createOverride.js +17 -23
  8. package/commands/account/info.js +8 -5
  9. package/commands/account/list.js +13 -18
  10. package/commands/account/remove.js +23 -22
  11. package/commands/account/removeOverride.js +8 -16
  12. package/commands/account/rename.d.ts +1 -1
  13. package/commands/account/rename.js +6 -3
  14. package/commands/account/use.js +19 -8
  15. package/commands/app/__tests__/migrate.test.js +8 -4
  16. package/commands/app/migrate.js +2 -2
  17. package/commands/auth.js +18 -14
  18. package/commands/cms/theme/preview.js +1 -4
  19. package/commands/config/migrate.js +5 -5
  20. package/commands/config/set.js +1 -2
  21. package/commands/customObject/createSchema.js +2 -3
  22. package/commands/customObject/updateSchema.js +2 -3
  23. package/commands/getStarted.js +15 -22
  24. package/commands/hubdb/__tests__/list.test.js +1 -0
  25. package/commands/hubdb/list.js +2 -2
  26. package/commands/hubdb.d.ts +1 -1
  27. package/commands/init.js +36 -32
  28. package/commands/project/__tests__/deploy.test.js +10 -5
  29. package/commands/project/__tests__/devUnifiedFlow.test.js +6 -4
  30. package/commands/project/__tests__/logs.test.js +4 -0
  31. package/commands/project/__tests__/updateDeps.test.js +142 -0
  32. package/commands/project/__tests__/validate.test.js +2 -2
  33. package/commands/project/cloneApp.js +2 -2
  34. package/commands/project/create.js +0 -1
  35. package/commands/project/deploy.js +2 -2
  36. package/commands/project/dev/deprecatedFlow.js +4 -5
  37. package/commands/project/dev/index.js +14 -4
  38. package/commands/project/dev/unifiedFlow.js +4 -5
  39. package/commands/project/listBuilds.js +7 -1
  40. package/commands/project/logs.js +2 -3
  41. package/commands/project/profile/add.js +6 -7
  42. package/commands/project/profile/delete.js +2 -2
  43. package/commands/project/updateDeps.d.ts +6 -0
  44. package/commands/project/updateDeps.js +80 -0
  45. package/commands/project/upload.js +9 -3
  46. package/commands/project/validate.js +9 -3
  47. package/commands/project/watch.js +7 -2
  48. package/commands/project.js +2 -0
  49. package/commands/sandbox/__tests__/create.test.js +14 -5
  50. package/commands/sandbox/create.js +4 -5
  51. package/commands/sandbox/delete.js +23 -20
  52. package/commands/testAccount/__tests__/create.test.js +68 -0
  53. package/commands/testAccount/create.d.ts +8 -0
  54. package/commands/testAccount/create.js +135 -45
  55. package/commands/testAccount/delete.js +9 -8
  56. package/commands/testAccount/importData.d.ts +1 -1
  57. package/lang/en.d.ts +3199 -3185
  58. package/lang/en.js +52 -14
  59. package/lib/__tests__/buildAccount.test.js +22 -30
  60. package/lib/__tests__/commonOpts.test.js +9 -13
  61. package/lib/__tests__/dependencyManagement.test.js +273 -1
  62. package/lib/__tests__/developerTestAccounts.test.js +29 -17
  63. package/lib/__tests__/importData.test.js +20 -10
  64. package/lib/__tests__/oauth.test.js +19 -8
  65. package/lib/__tests__/sandboxSync.test.js +33 -11
  66. package/lib/__tests__/sandboxes.test.js +30 -19
  67. package/lib/__tests__/usageTracking.test.js +10 -10
  68. package/lib/__tests__/validation.test.js +32 -32
  69. package/lib/accountTypes.d.ts +9 -9
  70. package/lib/accountTypes.js +2 -4
  71. package/lib/app/__tests__/migrate.test.js +15 -0
  72. package/lib/app/__tests__/migrate_legacy.test.js +9 -0
  73. package/lib/app/migrate_legacy.d.ts +2 -2
  74. package/lib/buildAccount.d.ts +4 -4
  75. package/lib/buildAccount.js +7 -14
  76. package/lib/commonOpts.js +5 -8
  77. package/lib/configMigrate.d.ts +2 -2
  78. package/lib/configMigrate.js +42 -18
  79. package/lib/configOptions.js +3 -2
  80. package/lib/constants.d.ts +1 -0
  81. package/lib/constants.js +6 -0
  82. package/lib/dependencyManagement.d.ts +8 -2
  83. package/lib/dependencyManagement.js +75 -12
  84. package/lib/developerTestAccounts.d.ts +3 -3
  85. package/lib/developerTestAccounts.js +4 -7
  86. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
  87. package/lib/doctor/DiagnosticInfoBuilder.js +9 -6
  88. package/lib/doctor/Doctor.js +4 -3
  89. package/lib/doctor/__tests__/Diagnosis.test.js +4 -3
  90. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +17 -9
  91. package/lib/doctor/__tests__/Doctor.test.js +14 -0
  92. package/lib/importData.js +8 -7
  93. package/lib/links.js +5 -5
  94. package/lib/mcp/__tests__/setup.test.d.ts +1 -0
  95. package/lib/mcp/__tests__/setup.test.js +127 -0
  96. package/lib/mcp/setup.d.ts +4 -12
  97. package/lib/mcp/setup.js +34 -1
  98. package/lib/middleware/__test__/commandTargetingUtils.test.js +3 -3
  99. package/lib/middleware/__test__/configMiddleware.test.js +23 -22
  100. package/lib/middleware/__test__/gitMiddleware.test.js +9 -7
  101. package/lib/middleware/autoUpdateMiddleware.d.ts +3 -1
  102. package/lib/middleware/autoUpdateMiddleware.js +10 -2
  103. package/lib/middleware/commandTargetingUtils.js +2 -2
  104. package/lib/middleware/configMiddleware.d.ts +6 -1
  105. package/lib/middleware/configMiddleware.js +36 -15
  106. package/lib/middleware/gitMiddleware.js +8 -4
  107. package/lib/npm.d.ts +3 -0
  108. package/lib/npm.js +6 -0
  109. package/lib/oauth.d.ts +2 -2
  110. package/lib/oauth.js +8 -10
  111. package/lib/projects/__tests__/AppDevModeInterface.test.js +17 -6
  112. package/lib/projects/__tests__/DevServerManager.test.js +1 -0
  113. package/lib/projects/__tests__/LocalDevProcess.test.js +1 -0
  114. package/lib/projects/__tests__/components.test.js +148 -24
  115. package/lib/projects/__tests__/deploy.test.js +1 -0
  116. package/lib/projects/__tests__/platformVersion.test.js +5 -1
  117. package/lib/projects/__tests__/projects.test.js +13 -42
  118. package/lib/projects/components.js +76 -20
  119. package/lib/projects/config.js +5 -9
  120. package/lib/projects/create/__tests__/v2.test.js +11 -0
  121. package/lib/projects/localDev/AppDevModeInterface.js +2 -2
  122. package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
  123. package/lib/projects/localDev/LocalDevLogger.js +4 -4
  124. package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +3 -3
  125. package/lib/projects/localDev/helpers/account.d.ts +10 -10
  126. package/lib/projects/localDev/helpers/account.js +6 -11
  127. package/lib/projects/platformVersion.js +1 -1
  128. package/lib/projects/urls.js +5 -6
  129. package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.d.ts +1 -0
  130. package/lib/prompts/__tests__/createDeveloperTestAccountConfigPrompt.test.js +153 -0
  131. package/lib/prompts/__tests__/downloadProjectPrompt.test.js +7 -5
  132. package/lib/prompts/accountNamePrompt.js +3 -3
  133. package/lib/prompts/accountsPrompt.d.ts +1 -1
  134. package/lib/prompts/accountsPrompt.js +6 -7
  135. package/lib/prompts/confirmImportDataPrompt.js +2 -2
  136. package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +5 -0
  137. package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +76 -66
  138. package/lib/prompts/downloadProjectPrompt.d.ts +1 -0
  139. package/lib/prompts/downloadProjectPrompt.js +5 -2
  140. package/lib/prompts/importDataTestAccountSelectPrompt.js +4 -5
  141. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  142. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -3
  143. package/lib/prompts/projectDevTargetAccountPrompt.js +5 -7
  144. package/lib/prompts/sandboxesPrompt.js +7 -8
  145. package/lib/prompts/setAsDefaultAccountPrompt.js +7 -6
  146. package/lib/sandboxSync.d.ts +2 -2
  147. package/lib/sandboxSync.js +3 -9
  148. package/lib/sandboxes.d.ts +4 -4
  149. package/lib/sandboxes.js +6 -11
  150. package/lib/serverlessLogs.js +2 -2
  151. package/lib/theme/__tests__/migrate.test.js +15 -0
  152. package/lib/ui/index.js +6 -3
  153. package/lib/usageTracking.js +15 -8
  154. package/lib/validation.js +13 -11
  155. package/mcp-server/tools/cms/HsCreateFunctionTool.js +8 -2
  156. package/mcp-server/tools/cms/HsCreateModuleTool.d.ts +4 -4
  157. package/mcp-server/tools/cms/HsCreateModuleTool.js +8 -2
  158. package/mcp-server/tools/cms/HsCreateTemplateTool.js +8 -2
  159. package/mcp-server/tools/cms/HsFunctionLogsTool.d.ts +4 -4
  160. package/mcp-server/tools/cms/HsFunctionLogsTool.js +6 -2
  161. package/mcp-server/tools/cms/HsListFunctionsTool.js +5 -1
  162. package/mcp-server/tools/cms/HsListTool.js +5 -1
  163. package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -0
  164. package/mcp-server/tools/index.js +4 -0
  165. package/mcp-server/tools/project/AddFeatureToProjectTool.d.ts +1 -1
  166. package/mcp-server/tools/project/AddFeatureToProjectTool.js +9 -3
  167. package/mcp-server/tools/project/CreateProjectTool.js +8 -2
  168. package/mcp-server/tools/project/CreateTestAccountTool.d.ts +41 -0
  169. package/mcp-server/tools/project/CreateTestAccountTool.js +150 -0
  170. package/mcp-server/tools/project/DeployProjectTool.d.ts +1 -1
  171. package/mcp-server/tools/project/DeployProjectTool.js +8 -2
  172. package/mcp-server/tools/project/DocFetchTool.d.ts +1 -1
  173. package/mcp-server/tools/project/DocFetchTool.js +9 -5
  174. package/mcp-server/tools/project/DocsSearchTool.d.ts +1 -1
  175. package/mcp-server/tools/project/DocsSearchTool.js +12 -8
  176. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +1 -1
  177. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +11 -7
  178. package/mcp-server/tools/project/GetApplicationInfoTool.d.ts +1 -1
  179. package/mcp-server/tools/project/GetApplicationInfoTool.js +11 -7
  180. package/mcp-server/tools/project/GetBuildStatusTool.d.ts +26 -0
  181. package/mcp-server/tools/project/GetBuildStatusTool.js +164 -0
  182. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +1 -1
  183. package/mcp-server/tools/project/GetConfigValuesTool.js +11 -7
  184. package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
  185. package/mcp-server/tools/project/GuidedWalkthroughTool.js +7 -3
  186. package/mcp-server/tools/project/UploadProjectTools.d.ts +9 -3
  187. package/mcp-server/tools/project/UploadProjectTools.js +51 -5
  188. package/mcp-server/tools/project/ValidateProjectTool.d.ts +1 -1
  189. package/mcp-server/tools/project/ValidateProjectTool.js +7 -3
  190. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.d.ts +1 -0
  191. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +454 -0
  192. package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +5 -1
  193. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +25 -13
  194. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +7 -5
  195. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +7 -5
  196. package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +1 -0
  197. package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +240 -0
  198. package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +8 -6
  199. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +56 -4
  200. package/mcp-server/utils/__tests__/content.test.js +21 -20
  201. package/mcp-server/utils/__tests__/feedbackTracking.test.js +33 -28
  202. package/mcp-server/utils/content.d.ts +1 -1
  203. package/mcp-server/utils/content.js +2 -2
  204. package/mcp-server/utils/feedbackTracking.d.ts +1 -1
  205. package/mcp-server/utils/feedbackTracking.js +3 -3
  206. package/mcp-server/utils/toolUsageTracking.js +4 -3
  207. package/package.json +8 -7
  208. package/lang/en.lyaml +0 -1508
  209. package/lib/lang.d.ts +0 -8
  210. package/lib/lang.js +0 -72
  211. package/mcp-server/utils/__tests__/cliConfig.test.js +0 -110
  212. package/mcp-server/utils/cliConfig.d.ts +0 -1
  213. package/mcp-server/utils/cliConfig.js +0 -12
  214. /package/{mcp-server/utils/__tests__/cliConfig.test.d.ts → commands/project/__tests__/updateDeps.test.d.ts} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { getAccessToken, updateConfigWithAccessToken, } from '@hubspot/local-dev-lib/personalAccessKey';
2
- import { accountNameExistsInConfig, updateAccountConfig, writeConfig, getAccountId, } from '@hubspot/local-dev-lib/config';
3
- import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
2
+ import { getConfigAccountIfExists, updateConfigAccount, } from '@hubspot/local-dev-lib/config';
4
3
  import { uiLogger } from './ui/logger.js';
5
4
  import { createDeveloperTestAccount, fetchDeveloperTestAccountGateSyncStatus, generateDeveloperTestAccountPersonalAccessKey, } from '@hubspot/local-dev-lib/api/developerTestAccounts';
6
5
  import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
@@ -28,8 +27,8 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
28
27
  if (!updatedConfig?.name) {
29
28
  const nameForConfig = accountName.toLowerCase().split(' ').join('-');
30
29
  validName = nameForConfig;
31
- const invalidAccountName = accountNameExistsInConfig(nameForConfig);
32
- if (invalidAccountName) {
30
+ const existingAccount = getConfigAccountIfExists(nameForConfig);
31
+ if (existingAccount) {
33
32
  if (!force) {
34
33
  uiLogger.log('');
35
34
  uiLogger.warn(lib.prompts.accountNamePrompt.errors.accountNameExists(nameForConfig));
@@ -42,13 +41,10 @@ export async function saveAccountToConfig(accountId, accountName, env, personalA
42
41
  }
43
42
  }
44
43
  }
45
- updateAccountConfig({
44
+ updateConfigAccount({
46
45
  ...updatedConfig,
47
- env: updatedConfig?.env,
48
- tokenInfo: updatedConfig?.auth?.tokenInfo,
49
46
  name: validName,
50
47
  });
51
- writeConfig();
52
48
  uiLogger.log('');
53
49
  return validName;
54
50
  }
@@ -83,8 +79,7 @@ export async function createDeveloperTestAccountV2(parentAccountId, testAccountC
83
79
  return result;
84
80
  }
85
81
  export async function buildDeveloperTestAccount(testAccountName, parentAccountConfig, env, portalLimit, useV2 = false) {
86
- const id = getAccountIdentifier(parentAccountConfig);
87
- const parentAccountId = getAccountId(id);
82
+ const parentAccountId = parentAccountConfig.accountId;
88
83
  let testAccountConfig = {
89
84
  accountName: testAccountName,
90
85
  };
@@ -141,8 +136,7 @@ export async function buildSandbox(sandboxName, parentAccountConfig, sandboxType
141
136
  const sandboxTypeKey = sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX
142
137
  ? 'standard'
143
138
  : 'developer';
144
- const id = getAccountIdentifier(parentAccountConfig);
145
- const parentAccountId = getAccountId(id);
139
+ const parentAccountId = parentAccountConfig.accountId;
146
140
  if (!parentAccountId) {
147
141
  throw new Error(lib.sandbox.create[sandboxTypeKey].loading.fail(''));
148
142
  }
@@ -182,8 +176,7 @@ export async function buildV2Sandbox(sandboxName, parentAccountConfig, sandboxTy
182
176
  const sandboxTypeKey = sandboxType === HUBSPOT_ACCOUNT_TYPES.STANDARD_SANDBOX
183
177
  ? 'standard'
184
178
  : 'developer';
185
- const id = getAccountIdentifier(parentAccountConfig);
186
- const parentAccountId = getAccountId(id);
179
+ const parentAccountId = parentAccountConfig.accountId;
187
180
  if (!parentAccountId) {
188
181
  throw new Error(lib.sandbox.create[sandboxTypeKey].loading.fail(''));
189
182
  }
package/lib/commonOpts.js CHANGED
@@ -3,7 +3,7 @@ import yargsParser from 'yargs-parser';
3
3
  import { LOG_LEVEL, setLogLevel } from '@hubspot/local-dev-lib/logger';
4
4
  import { uiLogger } from './ui/logger.js';
5
5
  import { DEFAULT_CMS_PUBLISH_MODE, CMS_PUBLISH_MODE, } from '@hubspot/local-dev-lib/constants/files';
6
- import { getAccountConfig, getAndLoadConfigIfNeeded, } from '@hubspot/local-dev-lib/config';
6
+ import { getConfigAccountById, getConfig } from '@hubspot/local-dev-lib/config';
7
7
  import { debugError } from './errorHandlers/index.js';
8
8
  import { EXIT_CODES } from './enums/exitCodes.js';
9
9
  import { uiCommandReference } from './ui/index.js';
@@ -149,16 +149,13 @@ export function setCLILogLevel(options) {
149
149
  setLogLevel(LOG_LEVEL.ERROR);
150
150
  SpinniesManager.setDisableOutput(true);
151
151
  }
152
- else if (debug) {
152
+ else if (debug || networkDebug) {
153
153
  setLogLevel(LOG_LEVEL.DEBUG);
154
+ process.env.HUBSPOT_NETWORK_LOGGING = 'true';
154
155
  }
155
156
  else {
156
157
  setLogLevel(LOG_LEVEL.LOG);
157
158
  }
158
- if (networkDebug) {
159
- process.env.HUBSPOT_NETWORK_LOGGING = 'true';
160
- setLogLevel(LOG_LEVEL.DEBUG);
161
- }
162
159
  }
163
160
  export function getCommandName(argv) {
164
161
  return String(argv && argv._ && argv._[0]) || '';
@@ -171,14 +168,14 @@ export function getCmsPublishMode(options) {
171
168
  }
172
169
  // 2. config[account].defaultCmsPublishMode
173
170
  if (options.derivedAccountId) {
174
- const accountConfig = getAccountConfig(options.derivedAccountId);
171
+ const accountConfig = getConfigAccountById(options.derivedAccountId);
175
172
  if (accountConfig && accountConfig.defaultCmsPublishMode) {
176
173
  return accountConfig.defaultCmsPublishMode;
177
174
  }
178
175
  }
179
176
  // 3. config.defaultCmsPublishMode
180
177
  // 4. DEFAULT_CMS_PUBLISH_MODE
181
- const config = getAndLoadConfigIfNeeded();
178
+ const config = getConfig();
182
179
  return ((config && config.defaultCmsPublishMode) ||
183
180
  DEFAULT_CMS_PUBLISH_MODE);
184
181
  }
@@ -1,2 +1,2 @@
1
- export declare function handleMigration(deprecatedConfigPath?: string, hideWarning?: boolean): Promise<boolean>;
2
- export declare function handleMerge(deprecatedConfigPath?: string, force?: boolean, hideWarning?: boolean): Promise<boolean>;
1
+ export declare function handleMigration(hideWarning?: boolean): Promise<boolean>;
2
+ export declare function handleMerge(force?: boolean, hideWarning?: boolean): Promise<boolean>;
@@ -1,8 +1,10 @@
1
- import { getDeprecatedConfig, getGlobalConfig, getConfigPath, migrateConfig, mergeConfigProperties, mergeExistingConfigs, } from '@hubspot/local-dev-lib/config/migrate';
1
+ import { getConfigAtPath, migrateConfigAtPath, mergeConfigProperties, mergeConfigAccounts, archiveConfigAtPath, } from '@hubspot/local-dev-lib/config/migrate';
2
2
  import { ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME } from '@hubspot/local-dev-lib/constants/config';
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
+ import { getConfig, getLocalConfigFilePathIfExists, } from '@hubspot/local-dev-lib/config';
7
+ import { debugError } from './errorHandlers/index.js';
6
8
  async function promptRenameOrOmitAccount(accountName, accountId) {
7
9
  const { shouldRename } = await promptUser({
8
10
  name: 'shouldRename',
@@ -24,7 +26,7 @@ async function promptNewAccountName(account, globalConfig, renamedAccounts) {
24
26
  if (value === account.name) {
25
27
  return lib.configMigrate.handleAccountNameConflicts.errors.sameName;
26
28
  }
27
- const existingAccount = globalConfig.accounts?.some(acc => acc.name === value);
29
+ const existingAccount = globalConfig.accounts.some((acc) => acc.name === value);
28
30
  const renamedAccount = renamedAccounts.some(acc => acc.name === value);
29
31
  if (existingAccount || renamedAccount) {
30
32
  return lib.configMigrate.handleAccountNameConflicts.errors.nameAlreadyInConfig(value);
@@ -34,9 +36,10 @@ async function promptNewAccountName(account, globalConfig, renamedAccounts) {
34
36
  });
35
37
  return newAccountName;
36
38
  }
37
- export async function handleMigration(deprecatedConfigPath, hideWarning) {
39
+ export async function handleMigration(hideWarning) {
40
+ const deprecatedConfigPath = process.env.HUBSPOT_CONFIG_PATH || getLocalConfigFilePathIfExists();
38
41
  if (!hideWarning) {
39
- uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
42
+ uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || ''));
40
43
  uiLogger.log('');
41
44
  }
42
45
  uiLogger.log(lib.configMigrate.handleMigration.description(ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
@@ -49,13 +52,20 @@ export async function handleMigration(deprecatedConfigPath, hideWarning) {
49
52
  if (!shouldMigrateConfig) {
50
53
  return false;
51
54
  }
52
- const deprecatedConfig = getDeprecatedConfig(deprecatedConfigPath);
53
- migrateConfig(deprecatedConfig);
55
+ migrateConfigAtPath(deprecatedConfigPath || '');
56
+ try {
57
+ archiveConfigAtPath(deprecatedConfigPath);
58
+ }
59
+ catch (error) {
60
+ debugError(error);
61
+ uiLogger.error(lib.configMigrate.errors.archive(deprecatedConfigPath));
62
+ return true;
63
+ }
54
64
  uiLogger.success(lib.configMigrate.handleMigration.success);
55
65
  return true;
56
66
  }
57
67
  async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force) {
58
- const { initialConfig, conflicts, } = mergeConfigProperties(globalConfig, deprecatedConfig, force);
68
+ const { configWithMergedProperties, conflicts, } = mergeConfigProperties(globalConfig, deprecatedConfig, force);
59
69
  if (conflicts.length > 0) {
60
70
  const properties = conflicts.map(c => c.property);
61
71
  const propertyList = properties.length <= 2
@@ -68,15 +78,15 @@ async function handleMergeConfigProperties(globalConfig, deprecatedConfig, force
68
78
  const { shouldOverwrite } = await promptUser({
69
79
  name: 'shouldOverwrite',
70
80
  type: 'confirm',
71
- message: lib.configMigrate.handleMergeConfigProperties.mergeConfigConflictPrompt(property, newValue.toString(), oldValue.toString()),
81
+ message: lib.configMigrate.handleMergeConfigProperties.mergeConfigConflictPrompt(property, newValue.toString(), oldValue?.toString() || ''),
72
82
  });
73
83
  if (shouldOverwrite) {
74
84
  // @ts-expect-error Cannot reconcile CLIConfig_NEW and CLIConfig_DEPRECATED
75
- initialConfig[property] = oldValue;
85
+ configWithMergedProperties[property] = oldValue;
76
86
  }
77
87
  }
78
88
  }
79
- return initialConfig;
89
+ return configWithMergedProperties;
80
90
  }
81
91
  async function handleAccountNameConflicts(globalConfig, deprecatedConfig, force) {
82
92
  if (!deprecatedConfig.portals?.length || !globalConfig.accounts?.length) {
@@ -84,7 +94,7 @@ async function handleAccountNameConflicts(globalConfig, deprecatedConfig, force)
84
94
  }
85
95
  const accountsWithConflictsToRemove = new Set();
86
96
  const renamedAccounts = [];
87
- const accountsNotYetInGlobal = deprecatedConfig.portals.filter(portal => portal.portalId &&
97
+ const accountsNotYetInGlobal = (deprecatedConfig.portals || []).filter(portal => portal.portalId &&
88
98
  !globalConfig.accounts?.some(acc => acc.accountId === portal.portalId));
89
99
  const accountsWithConflicts = accountsNotYetInGlobal.filter(localAccount => globalConfig.accounts?.some(globalAccount => globalAccount.name === localAccount.name));
90
100
  if (accountsWithConflicts.length > 0) {
@@ -120,12 +130,13 @@ async function handleAccountNameConflicts(globalConfig, deprecatedConfig, force)
120
130
  }
121
131
  deprecatedConfig.portals.push(...renamedAccounts);
122
132
  }
123
- const cleanedPortals = deprecatedConfig.portals.filter(portal => !accountsWithConflictsToRemove.has(portal));
133
+ const cleanedPortals = (deprecatedConfig.portals || []).filter(portal => !accountsWithConflictsToRemove.has(portal));
124
134
  return { ...deprecatedConfig, portals: cleanedPortals };
125
135
  }
126
- export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
136
+ export async function handleMerge(force, hideWarning) {
137
+ const deprecatedConfigPath = process.env.HUBSPOT_CONFIG_PATH || getLocalConfigFilePathIfExists();
127
138
  if (!hideWarning) {
128
- uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || getConfigPath(undefined, false)));
139
+ uiLogger.warn(lib.configMigrate.deprecatedConfigWarning(deprecatedConfigPath || ''));
129
140
  uiLogger.log('');
130
141
  }
131
142
  uiLogger.log(lib.configMigrate.handleMerge.description(ARCHIVED_HUBSPOT_CONFIG_YAML_FILE_NAME));
@@ -140,19 +151,32 @@ export async function handleMerge(deprecatedConfigPath, force, hideWarning) {
140
151
  return true; // exit with "true" so the user is shown a success message instead of an error
141
152
  }
142
153
  }
143
- const deprecatedConfig = getDeprecatedConfig(deprecatedConfigPath);
144
- const globalConfig = getGlobalConfig();
145
- if (!deprecatedConfig || !globalConfig) {
154
+ let deprecatedConfig;
155
+ let globalConfig;
156
+ try {
157
+ deprecatedConfig = getConfigAtPath(deprecatedConfigPath || '');
158
+ globalConfig = getConfig();
159
+ }
160
+ catch (error) {
161
+ debugError(error);
146
162
  return true;
147
163
  }
148
164
  const mergedConfig = await handleMergeConfigProperties(globalConfig, deprecatedConfig, force);
149
165
  const cleanedDeprecatedConfig = await handleAccountNameConflicts(mergedConfig, deprecatedConfig, force);
150
- const { skippedAccountIds } = mergeExistingConfigs(mergedConfig, cleanedDeprecatedConfig);
166
+ const { skippedAccountIds } = mergeConfigAccounts(mergedConfig, cleanedDeprecatedConfig);
151
167
  if (skippedAccountIds.length > 0) {
152
168
  uiLogger.log('');
153
169
  uiLogger.log(lib.configMigrate.handleMerge.skippedExistingAccounts(skippedAccountIds));
154
170
  uiLogger.log('');
155
171
  }
172
+ try {
173
+ archiveConfigAtPath(deprecatedConfigPath);
174
+ }
175
+ catch (error) {
176
+ debugError(error);
177
+ uiLogger.error(lib.configMigrate.errors.archive(deprecatedConfigPath));
178
+ return true;
179
+ }
156
180
  uiLogger.success(lib.configMigrate.handleMerge.success);
157
181
  return true;
158
182
  }
@@ -1,4 +1,4 @@
1
- import { updateAllowUsageTracking, updateAllowAutoUpdates, updateDefaultCmsPublishMode, updateHttpTimeout, isConfigFlagEnabled, updateAutoOpenBrowser, } from '@hubspot/local-dev-lib/config';
1
+ import { updateAllowUsageTracking, updateAllowAutoUpdates, updateDefaultCmsPublishMode, updateHttpTimeout, updateAutoOpenBrowser, getConfig, } from '@hubspot/local-dev-lib/config';
2
2
  import { CMS_PUBLISH_MODE } from '@hubspot/local-dev-lib/constants/files';
3
3
  import { commaSeparatedValues } from '@hubspot/local-dev-lib/text';
4
4
  import { trackCommandUsage } from './usageTracking.js';
@@ -110,5 +110,6 @@ export async function setAutoOpenBrowser({ accountId, autoOpenBrowser, }) {
110
110
  : lib.configOptions.setAutoOpenBrowser.disabled);
111
111
  }
112
112
  export function isAutoOpenBrowserEnabled() {
113
- return isConfigFlagEnabled('autoOpenBrowser', true);
113
+ const config = getConfig();
114
+ return config?.autoOpenBrowser !== false; // Default to true
114
115
  }
@@ -139,3 +139,4 @@ export declare const LEGACY_PRIVATE_APP_FILE = "app.json";
139
139
  export declare const THEME_FILE = "theme.json";
140
140
  export declare const CMS_ASSETS_FILE = "cms-assets.json";
141
141
  export declare const LEGACY_CONFIG_FILES: string[];
142
+ export declare const ACCOUNT_LEVEL_CHOICES: readonly ["FREE", "STARTER", "PROFESSIONAL", "ENTERPRISE"];
package/lib/constants.js CHANGED
@@ -135,3 +135,9 @@ export const LEGACY_CONFIG_FILES = [
135
135
  LEGACY_PRIVATE_APP_FILE,
136
136
  LEGACY_PUBLIC_APP_FILE,
137
137
  ];
138
+ export const ACCOUNT_LEVEL_CHOICES = [
139
+ 'FREE',
140
+ 'STARTER',
141
+ 'PROFESSIONAL',
142
+ 'ENTERPRISE',
143
+ ];
@@ -1,6 +1,12 @@
1
- export declare function installPackages({ packages, installLocations, }: {
1
+ export declare function installPackages({ packages, installLocations, dev, }: {
2
2
  packages?: string[];
3
3
  installLocations?: string[];
4
+ dev?: boolean;
4
5
  }): Promise<void>;
5
- export declare function getProjectPackageJsonLocations(dir?: string): Promise<string[]>;
6
+ export declare function updatePackages({ packages, installLocations, }: {
7
+ packages?: string[];
8
+ installLocations?: string[];
9
+ }): Promise<void>;
10
+ export declare function getProjectPackageJsonLocations(dir?: string, isUpdate?: boolean): Promise<string[]>;
11
+ export declare function isPackageInstalled(directory: string, packageName: string): boolean;
6
12
  export declare function hasMissingPackages(directory: string): Promise<boolean>;
@@ -6,19 +6,21 @@ import { walk } from '@hubspot/local-dev-lib/fs';
6
6
  import { getProjectConfig } from './projects/config.js';
7
7
  import { commands } from '../lang/en.js';
8
8
  import SpinniesManager from './ui/SpinniesManager.js';
9
- import { isGloballyInstalled, executeInstall, DEFAULT_PACKAGE_MANAGER, } from './npm.js';
9
+ import { isGloballyInstalled, executeInstall, executeUpdate, DEFAULT_PACKAGE_MANAGER, } from './npm.js';
10
10
  class NoPackageJsonFilesError extends Error {
11
- constructor(projectName) {
12
- super(commands.project.installDeps.noPackageJsonInProject(projectName));
11
+ constructor(projectName, isUpdate = false) {
12
+ super(isUpdate
13
+ ? commands.project.updateDeps.noPackageJsonInProject(projectName)
14
+ : commands.project.installDeps.noPackageJsonInProject(projectName));
13
15
  }
14
16
  }
15
- export async function installPackages({ packages, installLocations, }) {
17
+ export async function installPackages({ packages, installLocations, dev = false, }) {
16
18
  const installDirs = installLocations || (await getProjectPackageJsonLocations());
17
19
  await Promise.all(installDirs.map(async (dir) => {
18
- await installPackagesInDirectory(dir, packages);
20
+ await installPackagesInDirectory(dir, packages, dev);
19
21
  }));
20
22
  }
21
- async function installPackagesInDirectory(directory, packages) {
23
+ async function installPackagesInDirectory(directory, packages, dev = false) {
22
24
  const spinner = `installingDependencies-${directory}`;
23
25
  const relativeDir = path.relative(process.cwd(), directory);
24
26
  SpinniesManager.init();
@@ -28,7 +30,8 @@ async function installPackagesInDirectory(directory, packages) {
28
30
  : commands.project.installDeps.installingDependencies(relativeDir),
29
31
  });
30
32
  try {
31
- await executeInstall(packages, null, { cwd: directory });
33
+ const flags = dev && packages && packages.length > 0 ? '--save-dev' : null;
34
+ await executeInstall(packages, flags, { cwd: directory });
32
35
  SpinniesManager.succeed(spinner, {
33
36
  text: commands.project.installDeps.installationSuccessful(relativeDir),
34
37
  });
@@ -42,26 +45,60 @@ async function installPackagesInDirectory(directory, packages) {
42
45
  });
43
46
  }
44
47
  }
45
- export async function getProjectPackageJsonLocations(dir) {
48
+ export async function updatePackages({ packages, installLocations, }) {
49
+ const installDirs = installLocations || (await getProjectPackageJsonLocations(undefined, true));
50
+ await Promise.all(installDirs.map(async (dir) => {
51
+ await updatePackagesInDirectory(dir, packages);
52
+ }));
53
+ }
54
+ async function updatePackagesInDirectory(directory, packages) {
55
+ const spinner = `updatingDependencies-${directory}`;
56
+ const relativeDir = path.relative(process.cwd(), directory);
57
+ SpinniesManager.init();
58
+ SpinniesManager.add(spinner, {
59
+ text: packages && packages.length
60
+ ? commands.project.updateDeps.updatingDependenciesToLocation(`[${packages.join(', ')}]`, relativeDir)
61
+ : commands.project.updateDeps.updatingDependencies(relativeDir),
62
+ });
63
+ try {
64
+ await executeUpdate(packages, null, { cwd: directory });
65
+ SpinniesManager.succeed(spinner, {
66
+ text: commands.project.updateDeps.updateSuccessful(relativeDir),
67
+ });
68
+ }
69
+ catch (e) {
70
+ SpinniesManager.fail(spinner, {
71
+ text: commands.project.updateDeps.updatingDependenciesFailed(relativeDir),
72
+ });
73
+ throw new Error(commands.project.updateDeps.updatingDependenciesFailed(relativeDir), {
74
+ cause: e,
75
+ });
76
+ }
77
+ }
78
+ export async function getProjectPackageJsonLocations(dir, isUpdate = false) {
46
79
  const projectConfig = await getProjectConfig(dir);
47
80
  if (!projectConfig ||
48
81
  !projectConfig.projectDir ||
49
82
  !projectConfig.projectConfig) {
50
- throw new Error(commands.project.installDeps.noProjectConfig);
83
+ throw new Error(isUpdate
84
+ ? commands.project.updateDeps.noProjectConfig
85
+ : commands.project.installDeps.noProjectConfig);
51
86
  }
52
87
  const { projectDir, projectConfig: { srcDir, name }, } = projectConfig;
53
88
  if (!(await isGloballyInstalled(DEFAULT_PACKAGE_MANAGER))) {
54
- throw new Error(commands.project.installDeps.packageManagerNotInstalled(DEFAULT_PACKAGE_MANAGER));
89
+ throw new Error(isUpdate
90
+ ? commands.project.updateDeps.packageManagerNotInstalled(DEFAULT_PACKAGE_MANAGER)
91
+ : commands.project.installDeps.packageManagerNotInstalled(DEFAULT_PACKAGE_MANAGER));
55
92
  }
56
93
  if (!fs.existsSync(projectConfig.projectDir) ||
57
94
  !fs.existsSync(path.join(projectDir, srcDir))) {
58
- throw new NoPackageJsonFilesError(name);
95
+ throw new NoPackageJsonFilesError(name, isUpdate);
59
96
  }
60
97
  const packageJsonFiles = (await walk(path.join(projectDir, srcDir))).filter(file => file.includes('package.json') &&
61
98
  !file.includes('node_modules') &&
62
99
  !file.includes('.vite'));
63
100
  if (packageJsonFiles.length === 0) {
64
- throw new NoPackageJsonFilesError(name);
101
+ throw new NoPackageJsonFilesError(name, isUpdate);
65
102
  }
66
103
  const packageParentDirs = [];
67
104
  packageJsonFiles.forEach(packageJsonFile => {
@@ -70,6 +107,32 @@ export async function getProjectPackageJsonLocations(dir) {
70
107
  });
71
108
  return packageParentDirs;
72
109
  }
110
+ function isPackageInPackageJson(directory, packageName) {
111
+ const packageJsonPath = path.join(directory, 'package.json');
112
+ try {
113
+ const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8');
114
+ const packageJson = JSON.parse(packageJsonContent);
115
+ return !!((packageJson.dependencies && packageJson.dependencies[packageName]) ||
116
+ (packageJson.devDependencies && packageJson.devDependencies[packageName]));
117
+ }
118
+ catch (error) {
119
+ return false;
120
+ }
121
+ }
122
+ function isPackageInNodeModules(directory, packageName) {
123
+ const packagePath = path.join(directory, 'node_modules', packageName);
124
+ try {
125
+ return fs.existsSync(packagePath);
126
+ }
127
+ catch (error) {
128
+ return false;
129
+ }
130
+ }
131
+ export function isPackageInstalled(directory, packageName) {
132
+ const inPackageJson = isPackageInPackageJson(directory, packageName);
133
+ const actuallyInstalled = isPackageInNodeModules(directory, packageName);
134
+ return inPackageJson && actuallyInstalled;
135
+ }
73
136
  export async function hasMissingPackages(directory) {
74
137
  const exec = util.promisify(execAsync);
75
138
  const { stdout } = await exec(`npm install --ignore-scripts --dry-run`, {
@@ -1,6 +1,6 @@
1
- import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
1
+ import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
2
  import { FetchDeveloperTestAccountsResponse } from '@hubspot/local-dev-lib/types/developerTestAccounts.js';
3
3
  import { Environment } from '@hubspot/local-dev-lib/types/Config';
4
- export declare function getHasDevTestAccounts(appDeveloperAccountConfig: CLIAccount): boolean;
5
- export declare function validateDevTestAccountUsageLimits(accountConfig: CLIAccount): Promise<FetchDeveloperTestAccountsResponse | null>;
4
+ export declare function getHasDevTestAccounts(appDeveloperAccountConfig: HubSpotConfigAccount): boolean;
5
+ export declare function validateDevTestAccountUsageLimits(accountConfig: HubSpotConfigAccount): Promise<FetchDeveloperTestAccountsResponse | null>;
6
6
  export declare function handleDeveloperTestAccountCreateError(err: unknown, accountId: number, env: Environment, portalLimit: number): never;
@@ -1,6 +1,5 @@
1
1
  import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
2
- import { getAccountId, getConfigAccounts } from '@hubspot/local-dev-lib/config';
3
- import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
2
+ import { getAllConfigAccounts } from '@hubspot/local-dev-lib/config';
4
3
  import { fetchDeveloperTestAccounts } from '@hubspot/local-dev-lib/api/developerTestAccounts';
5
4
  import { isMissingScopeError, isSpecifiedError, } from '@hubspot/local-dev-lib/errors/index';
6
5
  import { uiLogger } from './ui/logger.js';
@@ -9,9 +8,8 @@ import { lib } from '../lang/en.js';
9
8
  import { uiAccountDescription } from './ui/index.js';
10
9
  import { logError } from './errorHandlers/index.js';
11
10
  export function getHasDevTestAccounts(appDeveloperAccountConfig) {
12
- const id = getAccountIdentifier(appDeveloperAccountConfig);
13
- const parentPortalId = getAccountId(id);
14
- const accountsList = getConfigAccounts();
11
+ const parentPortalId = appDeveloperAccountConfig.accountId;
12
+ const accountsList = getAllConfigAccounts();
15
13
  if (!accountsList) {
16
14
  return false;
17
15
  }
@@ -25,8 +23,7 @@ export function getHasDevTestAccounts(appDeveloperAccountConfig) {
25
23
  return false;
26
24
  }
27
25
  export async function validateDevTestAccountUsageLimits(accountConfig) {
28
- const id = getAccountIdentifier(accountConfig);
29
- const accountId = getAccountId(id);
26
+ const accountId = accountConfig.accountId;
30
27
  if (!accountId) {
31
28
  return null;
32
29
  }
@@ -44,7 +44,7 @@ export interface DiagnosticInfo extends FilesInfo {
44
44
  warningCount?: number;
45
45
  }
46
46
  export declare class DiagnosticInfoBuilder {
47
- accountId: number | null;
47
+ accountId: number | undefined;
48
48
  readonly configSettings: {
49
49
  [key: string]: unknown;
50
50
  };
@@ -3,8 +3,8 @@ import { fetchProject } from '@hubspot/local-dev-lib/api/projects';
3
3
  import path from 'path';
4
4
  import { pkg } from '../jsonLoader.js';
5
5
  import { uiLogger } from '../ui/logger.js';
6
- import { getAccountId, getDefaultAccountOverrideFilePath, isConfigFlagEnabled, } from '@hubspot/local-dev-lib/config';
7
- import { getAccountConfig, getConfigPath } from '@hubspot/local-dev-lib/config';
6
+ import { isConfigFlagEnabled, getConfigFilePath, getConfigDefaultAccountIfExists, } from '@hubspot/local-dev-lib/config';
7
+ import { getDefaultAccountOverrideFilePath } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
8
8
  import { getAccessToken } from '@hubspot/local-dev-lib/personalAccessKey';
9
9
  import { walk } from '@hubspot/local-dev-lib/fs';
10
10
  import util from 'util';
@@ -33,15 +33,18 @@ export class DiagnosticInfoBuilder {
33
33
  files;
34
34
  processInfo;
35
35
  constructor(processInfo) {
36
- this.accountId = getAccountId();
37
- const accountConfig = getAccountConfig(this.accountId);
36
+ const accountConfig = getConfigDefaultAccountIfExists();
37
+ this.accountId = accountConfig?.accountId;
38
38
  this.configSettings = {
39
39
  httpUseLocalhost: isConfigFlagEnabled('httpUseLocalhost'),
40
40
  };
41
41
  this.env = accountConfig?.env;
42
42
  this.authType = accountConfig?.authType;
43
43
  this.accountType = accountConfig?.accountType;
44
- this.personalAccessKey = accountConfig?.personalAccessKey;
44
+ this.personalAccessKey =
45
+ accountConfig && 'personalAccessKey' in accountConfig
46
+ ? accountConfig.personalAccessKey
47
+ : undefined;
45
48
  this.processInfo = processInfo;
46
49
  }
47
50
  async generateDiagnosticInfo() {
@@ -58,7 +61,7 @@ export class DiagnosticInfoBuilder {
58
61
  platform,
59
62
  arch,
60
63
  path: mainModule?.path,
61
- config: getConfigPath(),
64
+ config: getConfigFilePath(),
62
65
  defaultAccountOverrideFile: getDefaultAccountOverrideFilePath(),
63
66
  configSettings: this.configSettings,
64
67
  versions: {
@@ -1,5 +1,6 @@
1
1
  import { uiLogger } from '../ui/logger.js';
2
- import { getAccountId, getCWDAccountOverride, } from '@hubspot/local-dev-lib/config';
2
+ import { getConfigDefaultAccountIfExists } from '@hubspot/local-dev-lib/config';
3
+ import { getDefaultAccountOverrideAccountId } from '@hubspot/local-dev-lib/config/defaultAccountOverride';
3
4
  import SpinniesManager from '../ui/SpinniesManager.js';
4
5
  import { hasMissingPackages } from '../dependencyManagement.js';
5
6
  import { getLatestCliVersion } from '../npm.js';
@@ -25,7 +26,7 @@ export class Doctor {
25
26
  diagnosticInfoBuilder;
26
27
  constructor(diagnosticInfoBuilder = new DiagnosticInfoBuilder(process)) {
27
28
  SpinniesManager.init();
28
- this.accountId = getAccountId();
29
+ this.accountId = getConfigDefaultAccountIfExists()?.accountId ?? null;
29
30
  this.diagnosticInfoBuilder = diagnosticInfoBuilder;
30
31
  }
31
32
  async diagnose() {
@@ -88,7 +89,7 @@ export class Doctor {
88
89
  });
89
90
  this.diagnosis?.addDefaultAccountOverrideFileSection({
90
91
  type: 'warning',
91
- message: lib.doctor.defaultAccountOverrideFileChecks.overrideAccountId(getCWDAccountOverride()),
92
+ message: lib.doctor.defaultAccountOverrideFileChecks.overrideAccountId(getDefaultAccountOverrideAccountId()),
92
93
  });
93
94
  }
94
95
  }
@@ -1,8 +1,8 @@
1
1
  vi.mock('@hubspot/local-dev-lib/config');
2
2
  import { Diagnosis } from '../Diagnosis.js';
3
- import { getAccountConfig as __getAccountConfig } from '@hubspot/local-dev-lib/config';
3
+ import { getConfigAccountIfExists as __getConfigAccountIfExists } from '@hubspot/local-dev-lib/config';
4
4
  import stripAnsi from 'strip-ansi';
5
- const getAccountConfig = __getAccountConfig;
5
+ const getConfigAccountIfExists = __getConfigAccountIfExists;
6
6
  describe('lib/doctor/Diagnosis', () => {
7
7
  const diagnosticInfo = {
8
8
  account: {},
@@ -31,7 +31,8 @@ describe('lib/doctor/Diagnosis', () => {
31
31
  };
32
32
  const accountId = 123456;
33
33
  beforeEach(() => {
34
- getAccountConfig.mockReturnValue({
34
+ getConfigAccountIfExists.mockReturnValue({
35
+ accountId,
35
36
  accountType: 'STANDARD',
36
37
  name: 'Standard Account',
37
38
  });