@hubspot/cli 7.10.0-beta.2 → 7.10.0-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 (198) 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 +3 -0
  4. package/commands/account/__tests__/rename.test.js +10 -3
  5. package/commands/account/auth.js +10 -14
  6. package/commands/account/clean.js +11 -19
  7. package/commands/account/createOverride.js +15 -11
  8. package/commands/account/info.js +8 -5
  9. package/commands/account/list.js +15 -19
  10. package/commands/account/remove.js +23 -22
  11. package/commands/account/removeOverride.js +6 -6
  12. package/commands/account/rename.js +2 -2
  13. package/commands/account/use.js +19 -8
  14. package/commands/app/__tests__/migrate.test.js +8 -4
  15. package/commands/app/migrate.js +2 -2
  16. package/commands/auth.js +18 -14
  17. package/commands/config/migrate.js +5 -5
  18. package/commands/customObject/createSchema.js +2 -3
  19. package/commands/customObject/updateSchema.js +2 -3
  20. package/commands/getStarted.js +2 -3
  21. package/commands/hubdb/__tests__/list.test.js +1 -0
  22. package/commands/hubdb/list.js +2 -2
  23. package/commands/init.js +36 -32
  24. package/commands/project/__tests__/deploy.test.js +10 -5
  25. package/commands/project/__tests__/devUnifiedFlow.test.js +6 -4
  26. package/commands/project/__tests__/lint.test.js +709 -0
  27. package/commands/project/__tests__/logs.test.js +4 -0
  28. package/commands/project/__tests__/validate.test.js +2 -2
  29. package/commands/project/cloneApp.js +2 -2
  30. package/commands/project/deploy.js +2 -2
  31. package/commands/project/dev/deprecatedFlow.js +4 -5
  32. package/commands/project/dev/index.js +6 -3
  33. package/commands/project/dev/unifiedFlow.js +4 -5
  34. package/commands/project/lint.d.ts +6 -0
  35. package/commands/project/lint.js +178 -0
  36. package/commands/project/logs.js +2 -3
  37. package/commands/project/profile/add.js +6 -7
  38. package/commands/project/profile/delete.js +2 -2
  39. package/commands/project/upload.js +2 -2
  40. package/commands/project/validate.js +2 -2
  41. package/commands/project.js +2 -0
  42. package/commands/sandbox/__tests__/create.test.js +14 -5
  43. package/commands/sandbox/create.js +4 -5
  44. package/commands/sandbox/delete.js +23 -20
  45. package/commands/testAccount/create.js +2 -2
  46. package/commands/testAccount/delete.js +9 -8
  47. package/lang/en.d.ts +40 -6
  48. package/lang/en.js +49 -9
  49. package/lib/__tests__/buildAccount.test.js +22 -30
  50. package/lib/__tests__/commonOpts.test.js +9 -13
  51. package/lib/__tests__/developerTestAccounts.test.js +29 -17
  52. package/lib/__tests__/importData.test.js +20 -10
  53. package/lib/__tests__/oauth.test.js +19 -8
  54. package/lib/__tests__/sandboxSync.test.js +33 -11
  55. package/lib/__tests__/sandboxes.test.js +30 -19
  56. package/lib/__tests__/usageTracking.test.js +10 -10
  57. package/lib/__tests__/validation.test.js +32 -32
  58. package/lib/accountTypes.d.ts +9 -9
  59. package/lib/accountTypes.js +2 -4
  60. package/lib/app/__tests__/migrate.test.js +15 -0
  61. package/lib/app/__tests__/migrate_legacy.test.js +9 -0
  62. package/lib/app/migrate_legacy.d.ts +2 -2
  63. package/lib/buildAccount.d.ts +4 -4
  64. package/lib/buildAccount.js +7 -14
  65. package/lib/commonOpts.js +3 -3
  66. package/lib/configMigrate.d.ts +2 -2
  67. package/lib/configMigrate.js +42 -18
  68. package/lib/configOptions.js +3 -2
  69. package/lib/developerTestAccounts.d.ts +3 -3
  70. package/lib/developerTestAccounts.js +4 -7
  71. package/lib/doctor/DiagnosticInfoBuilder.d.ts +1 -1
  72. package/lib/doctor/DiagnosticInfoBuilder.js +9 -6
  73. package/lib/doctor/Doctor.js +4 -3
  74. package/lib/doctor/__tests__/Diagnosis.test.js +4 -3
  75. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +17 -9
  76. package/lib/doctor/__tests__/Doctor.test.js +14 -0
  77. package/lib/importData.js +8 -7
  78. package/lib/links.js +5 -5
  79. package/lib/middleware/{__test__ → __tests__}/commandTargetingUtils.test.js +3 -3
  80. package/lib/middleware/{__test__ → __tests__}/configMiddleware.test.js +23 -22
  81. package/lib/middleware/{__test__ → __tests__}/gitMiddleware.test.js +9 -7
  82. package/lib/middleware/autoUpdateMiddleware.js +12 -4
  83. package/lib/middleware/commandTargetingUtils.js +3 -2
  84. package/lib/middleware/configMiddleware.d.ts +6 -1
  85. package/lib/middleware/configMiddleware.js +36 -15
  86. package/lib/middleware/gitMiddleware.js +8 -4
  87. package/lib/oauth.d.ts +2 -2
  88. package/lib/oauth.js +8 -10
  89. package/lib/projects/__tests__/AppDevModeInterface.test.js +17 -6
  90. package/lib/projects/__tests__/DevServerManager.test.js +1 -0
  91. package/lib/projects/__tests__/LocalDevProcess.test.js +1 -0
  92. package/lib/projects/__tests__/deploy.test.js +1 -0
  93. package/lib/projects/__tests__/uieLinting.test.js +640 -0
  94. package/lib/projects/create/__tests__/v2.test.js +11 -0
  95. package/lib/projects/localDev/AppDevModeInterface.js +2 -2
  96. package/lib/projects/localDev/DevServerManager_DEPRECATED.js +2 -2
  97. package/lib/projects/localDev/DevSessionManager.d.ts +17 -0
  98. package/lib/projects/localDev/DevSessionManager.js +56 -0
  99. package/lib/projects/localDev/LocalDevLogger.d.ts +3 -0
  100. package/lib/projects/localDev/LocalDevLogger.js +13 -4
  101. package/lib/projects/localDev/LocalDevManager_DEPRECATED.js +3 -3
  102. package/lib/projects/localDev/LocalDevProcess.d.ts +1 -0
  103. package/lib/projects/localDev/LocalDevProcess.js +12 -1
  104. package/lib/projects/localDev/LocalDevState.d.ts +3 -0
  105. package/lib/projects/localDev/LocalDevState.js +9 -0
  106. package/lib/projects/localDev/helpers/account.d.ts +10 -10
  107. package/lib/projects/localDev/helpers/account.js +6 -11
  108. package/lib/projects/localDev/helpers/devSessionsApi.d.ts +9 -0
  109. package/lib/projects/localDev/helpers/devSessionsApi.js +19 -0
  110. package/lib/projects/uieLinting.d.ts +33 -0
  111. package/lib/projects/uieLinting.js +222 -0
  112. package/lib/projects/urls.js +5 -6
  113. package/lib/prompts/__tests__/downloadProjectPrompt.test.js +7 -5
  114. package/lib/prompts/accountNamePrompt.js +3 -3
  115. package/lib/prompts/accountsPrompt.d.ts +1 -1
  116. package/lib/prompts/accountsPrompt.js +6 -7
  117. package/lib/prompts/confirmImportDataPrompt.js +2 -2
  118. package/lib/prompts/downloadProjectPrompt.d.ts +1 -0
  119. package/lib/prompts/downloadProjectPrompt.js +5 -2
  120. package/lib/prompts/importDataTestAccountSelectPrompt.js +4 -5
  121. package/lib/prompts/personalAccessKeyPrompt.js +2 -2
  122. package/lib/prompts/projectDevTargetAccountPrompt.d.ts +3 -3
  123. package/lib/prompts/projectDevTargetAccountPrompt.js +5 -7
  124. package/lib/prompts/sandboxesPrompt.js +7 -8
  125. package/lib/prompts/setAsDefaultAccountPrompt.js +7 -6
  126. package/lib/sandboxSync.d.ts +2 -2
  127. package/lib/sandboxSync.js +3 -9
  128. package/lib/sandboxes.d.ts +4 -4
  129. package/lib/sandboxes.js +6 -11
  130. package/lib/serverlessLogs.js +2 -2
  131. package/lib/theme/__tests__/migrate.test.js +15 -0
  132. package/lib/ui/index.js +6 -3
  133. package/lib/usageTracking.js +15 -8
  134. package/lib/validation.js +13 -11
  135. package/mcp-server/tools/cms/HsCreateFunctionTool.js +4 -2
  136. package/mcp-server/tools/cms/HsCreateModuleTool.js +4 -2
  137. package/mcp-server/tools/cms/HsCreateTemplateTool.js +4 -2
  138. package/mcp-server/tools/cms/HsFunctionLogsTool.js +4 -2
  139. package/mcp-server/tools/cms/HsListFunctionsTool.js +3 -1
  140. package/mcp-server/tools/cms/HsListTool.js +3 -1
  141. package/mcp-server/tools/cms/__tests__/HsCreateFunctionTool.test.js +1 -0
  142. package/mcp-server/tools/index.js +4 -0
  143. package/mcp-server/tools/project/AddFeatureToProjectTool.js +4 -2
  144. package/mcp-server/tools/project/CreateProjectTool.js +4 -2
  145. package/mcp-server/tools/project/CreateTestAccountTool.js +17 -7
  146. package/mcp-server/tools/project/DeployProjectTool.js +3 -1
  147. package/mcp-server/tools/project/DocFetchTool.js +6 -4
  148. package/mcp-server/tools/project/DocsSearchTool.d.ts +1 -1
  149. package/mcp-server/tools/project/DocsSearchTool.js +10 -8
  150. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.d.ts +1 -1
  151. package/mcp-server/tools/project/GetApiUsagePatternsByAppIdTool.js +9 -7
  152. package/mcp-server/tools/project/GetApplicationInfoTool.js +8 -6
  153. package/mcp-server/tools/project/GetBuildLogsTool.d.ts +26 -0
  154. package/mcp-server/tools/project/GetBuildLogsTool.js +125 -0
  155. package/mcp-server/tools/project/GetBuildStatusTool.d.ts +26 -0
  156. package/mcp-server/tools/project/GetBuildStatusTool.js +166 -0
  157. package/mcp-server/tools/project/GetConfigValuesTool.d.ts +1 -1
  158. package/mcp-server/tools/project/GetConfigValuesTool.js +9 -7
  159. package/mcp-server/tools/project/GuidedWalkthroughTool.d.ts +1 -1
  160. package/mcp-server/tools/project/GuidedWalkthroughTool.js +5 -3
  161. package/mcp-server/tools/project/UploadProjectTools.js +3 -1
  162. package/mcp-server/tools/project/ValidateProjectTool.js +4 -2
  163. package/mcp-server/tools/project/__tests__/CreateTestAccountTool.test.js +12 -2
  164. package/mcp-server/tools/project/__tests__/DocFetchTool.test.js +5 -1
  165. package/mcp-server/tools/project/__tests__/DocsSearchTool.test.js +23 -11
  166. package/mcp-server/tools/project/__tests__/GetApiUsagePatternsByAppIdTool.test.js +7 -5
  167. package/mcp-server/tools/project/__tests__/GetApplicationInfoTool.test.js +7 -5
  168. package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.d.ts +1 -0
  169. package/mcp-server/tools/project/__tests__/GetBuildLogsTool.test.js +305 -0
  170. package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.d.ts +1 -0
  171. package/mcp-server/tools/project/__tests__/GetBuildStatusTool.test.js +240 -0
  172. package/mcp-server/tools/project/__tests__/GetConfigValuesTool.test.js +8 -6
  173. package/mcp-server/utils/__tests__/content.test.js +21 -20
  174. package/mcp-server/utils/__tests__/feedbackTracking.test.js +34 -28
  175. package/mcp-server/utils/config.d.ts +1 -0
  176. package/mcp-server/utils/config.js +10 -0
  177. package/mcp-server/utils/content.d.ts +1 -1
  178. package/mcp-server/utils/content.js +2 -2
  179. package/mcp-server/utils/feedbackTracking.d.ts +1 -1
  180. package/mcp-server/utils/feedbackTracking.js +3 -3
  181. package/mcp-server/utils/toolUsageTracking.js +4 -3
  182. package/package.json +8 -7
  183. package/types/LocalDev.d.ts +1 -0
  184. package/lib/middleware/__test__/notificationsMiddleware.test.js +0 -8
  185. package/lib/middleware/notificationsMiddleware.d.ts +0 -1
  186. package/lib/middleware/notificationsMiddleware.js +0 -28
  187. package/mcp-server/utils/__tests__/cliConfig.test.js +0 -110
  188. package/mcp-server/utils/cliConfig.d.ts +0 -1
  189. package/mcp-server/utils/cliConfig.js +0 -12
  190. /package/{lib/middleware/__test__/commandTargetingUtils.test.d.ts → commands/project/__tests__/lint.test.d.ts} +0 -0
  191. /package/lib/middleware/{__test__/configMiddleware.test.d.ts → __tests__/commandTargetingUtils.test.d.ts} +0 -0
  192. /package/lib/middleware/{__test__/gitMiddleware.test.d.ts → __tests__/configMiddleware.test.d.ts} +0 -0
  193. /package/lib/middleware/{__test__/notificationsMiddleware.test.d.ts → __tests__/gitMiddleware.test.d.ts} +0 -0
  194. /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.d.ts +0 -0
  195. /package/lib/middleware/{__test__ → __tests__}/requestMiddleware.test.js +0 -0
  196. /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.d.ts +0 -0
  197. /package/lib/middleware/{__test__ → __tests__}/yargsChecksMiddleware.test.js +0 -0
  198. /package/{mcp-server/utils/__tests__/cliConfig.test.d.ts → lib/projects/__tests__/uieLinting.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { getAccountId, getAccountConfig } from '@hubspot/local-dev-lib/config';
1
+ import { getConfigAccountById, getConfigAccountIfExists, } from '@hubspot/local-dev-lib/config';
2
2
  import { getOauthManager } from '@hubspot/local-dev-lib/oauth';
3
3
  import { accessTokenForPersonalAccessKey } from '@hubspot/local-dev-lib/personalAccessKey';
4
4
  import { validateAccount } from '../validation.js';
@@ -14,47 +14,47 @@ const yargsOption = (option) => ({
14
14
  ...option,
15
15
  });
16
16
  describe('lib/validation', () => {
17
- const getAccountIdMock = getAccountId;
18
- const getAccountConfigMock = getAccountConfig;
17
+ const getConfigAccountIfExistsMock = getConfigAccountIfExists;
18
+ const getConfigAccountByIdMock = getConfigAccountById;
19
19
  const getOauthManagerMock = getOauthManager;
20
20
  const accessTokenForPersonalAccessKeyMock = accessTokenForPersonalAccessKey;
21
21
  describe('validateAccount', () => {
22
22
  it('returns false if an account is missing', async () => {
23
- getAccountIdMock.mockReturnValueOnce(null);
24
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
23
+ getConfigAccountIfExistsMock.mockReturnValueOnce(null);
24
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
25
25
  });
26
26
  it('returns false if an account config is missing', async () => {
27
- getAccountIdMock.mockReturnValueOnce('123');
28
- getAccountConfigMock.mockReturnValueOnce(undefined);
29
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
27
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
28
+ getConfigAccountByIdMock.mockReturnValueOnce(undefined);
29
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
30
30
  });
31
31
  it('returns false for oauth2 authType if auth is missing', async () => {
32
- getAccountIdMock.mockReturnValueOnce('123');
33
- getAccountConfigMock.mockReturnValueOnce({
32
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
33
+ getConfigAccountByIdMock.mockReturnValueOnce({
34
34
  accountId: '123',
35
35
  authType: 'oauth2',
36
36
  });
37
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
37
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
38
38
  });
39
39
  it('returns false if OAuth is missing configuration', async () => {
40
- getAccountIdMock.mockReturnValueOnce('123');
41
- getAccountConfigMock.mockReturnValueOnce({
40
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
41
+ getConfigAccountByIdMock.mockReturnValueOnce({
42
42
  accountId: '123',
43
43
  authType: 'oauth2',
44
44
  auth: {
45
45
  clientId: 'foo',
46
46
  },
47
47
  });
48
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
48
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
49
49
  });
50
50
  it('returns false if an access token was not retrieved', async () => {
51
- getAccountIdMock.mockReturnValueOnce('123');
51
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
52
52
  getOauthManagerMock.mockReturnValueOnce({
53
53
  accessToken() {
54
54
  return null;
55
55
  },
56
56
  });
57
- getAccountConfigMock.mockReturnValueOnce({
57
+ getConfigAccountByIdMock.mockReturnValueOnce({
58
58
  accountId: '123',
59
59
  authType: 'oauth2',
60
60
  auth: {
@@ -65,16 +65,16 @@ describe('lib/validation', () => {
65
65
  },
66
66
  },
67
67
  });
68
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
68
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
69
69
  });
70
70
  it('returns false if an getting an access token throws', async () => {
71
- getAccountIdMock.mockReturnValueOnce('123');
71
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
72
72
  getOauthManagerMock.mockReturnValueOnce({
73
73
  accessToken() {
74
74
  throw new Error('It failed');
75
75
  },
76
76
  });
77
- getAccountConfigMock.mockReturnValueOnce({
77
+ getConfigAccountByIdMock.mockReturnValueOnce({
78
78
  accountId: '123',
79
79
  authType: 'oauth2',
80
80
  auth: {
@@ -85,16 +85,16 @@ describe('lib/validation', () => {
85
85
  },
86
86
  },
87
87
  });
88
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
88
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
89
89
  });
90
90
  it('returns true if OAuth is configured and an access token is received', async () => {
91
- getAccountIdMock.mockReturnValueOnce('123');
91
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
92
92
  getOauthManagerMock.mockReturnValueOnce({
93
93
  accessToken() {
94
94
  return 'yep';
95
95
  },
96
96
  });
97
- getAccountConfigMock.mockReturnValueOnce({
97
+ getConfigAccountByIdMock.mockReturnValueOnce({
98
98
  accountId: '123',
99
99
  authType: 'oauth2',
100
100
  auth: {
@@ -105,40 +105,40 @@ describe('lib/validation', () => {
105
105
  },
106
106
  },
107
107
  });
108
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(true);
108
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(true);
109
109
  });
110
110
  it('returns false if "personalaccesskey" configured and getting an access token throws', async () => {
111
- getAccountIdMock.mockReturnValueOnce('123');
111
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
112
112
  accessTokenForPersonalAccessKeyMock.mockImplementationOnce(() => {
113
113
  throw new Error('It failed');
114
114
  });
115
- getAccountConfigMock.mockReturnValueOnce({
115
+ getConfigAccountByIdMock.mockReturnValueOnce({
116
116
  accountId: '123',
117
117
  authType: 'personalaccesskey',
118
118
  personalAccessKey: 'foo',
119
119
  });
120
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(false);
120
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(false);
121
121
  });
122
122
  it('returns true if "personalaccesskey" configured and an access token is received', async () => {
123
- getAccountIdMock.mockReturnValueOnce('123');
123
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
124
124
  accessTokenForPersonalAccessKeyMock.mockImplementationOnce(() => {
125
125
  return 'secret-stuff';
126
126
  });
127
- getAccountConfigMock.mockReturnValueOnce({
127
+ getConfigAccountByIdMock.mockReturnValueOnce({
128
128
  accountId: '123',
129
129
  authType: 'personalaccesskey',
130
130
  personalAccessKey: 'foo',
131
131
  });
132
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(true);
132
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(true);
133
133
  });
134
134
  it('returns true if apiKey is configured and present', async () => {
135
- getAccountIdMock.mockReturnValueOnce('123');
136
- getAccountConfigMock.mockReturnValueOnce({
135
+ getConfigAccountIfExistsMock.mockReturnValueOnce('123');
136
+ getConfigAccountByIdMock.mockReturnValueOnce({
137
137
  accountId: '123',
138
138
  authType: 'apikey',
139
139
  apiKey: 'my-secret-key',
140
140
  });
141
- expect(await validateAccount(yargsOption({ account: '123' }))).toBe(true);
141
+ expect(await validateAccount(yargsOption({ derivedAccountId: '123' }))).toBe(true);
142
142
  });
143
143
  });
144
144
  });
@@ -1,9 +1,9 @@
1
- import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
- export declare function isStandardAccount(accountConfig: CLIAccount): boolean;
3
- export declare function isSandbox(accountConfig: CLIAccount): boolean;
4
- export declare function isStandardSandbox(accountConfig: CLIAccount): boolean;
5
- export declare function isDevelopmentSandbox(accountConfig: CLIAccount): boolean;
6
- export declare function isDeveloperTestAccount(accountConfig: CLIAccount): boolean;
7
- export declare function isAppDeveloperAccount(accountConfig: CLIAccount): boolean;
8
- export declare function isTestAccountOrSandbox(accountConfig: CLIAccount): boolean;
9
- export declare function isUnifiedAccount(account: CLIAccount): Promise<boolean>;
1
+ import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
+ export declare function isStandardAccount(accountConfig: HubSpotConfigAccount): boolean;
3
+ export declare function isSandbox(accountConfig: HubSpotConfigAccount): boolean;
4
+ export declare function isStandardSandbox(accountConfig: HubSpotConfigAccount): boolean;
5
+ export declare function isDevelopmentSandbox(accountConfig: HubSpotConfigAccount): boolean;
6
+ export declare function isDeveloperTestAccount(accountConfig: HubSpotConfigAccount): boolean;
7
+ export declare function isAppDeveloperAccount(accountConfig: HubSpotConfigAccount): boolean;
8
+ export declare function isTestAccountOrSandbox(accountConfig: HubSpotConfigAccount): boolean;
9
+ export declare function isUnifiedAccount(account: HubSpotConfigAccount): Promise<boolean>;
@@ -1,6 +1,5 @@
1
1
  import { HUBSPOT_ACCOUNT_TYPES } from '@hubspot/local-dev-lib/constants/config';
2
2
  import { hasUnfiedAppsAccess } from './hasFeature.js';
3
- import { getAccountIdentifier } from '@hubspot/local-dev-lib/config/getAccountIdentifier';
4
3
  function isAccountType(accountConfig, accountType) {
5
4
  return Boolean(accountConfig.accountType && accountType.includes(accountConfig.accountType));
6
5
  }
@@ -35,9 +34,8 @@ export function isTestAccountOrSandbox(accountConfig) {
35
34
  ]);
36
35
  }
37
36
  export async function isUnifiedAccount(account) {
38
- const accountId = getAccountIdentifier(account);
39
- if (!accountId) {
37
+ if (!account.accountId) {
40
38
  return false;
41
39
  }
42
- return hasUnfiedAppsAccess(accountId);
40
+ return hasUnfiedAppsAccess(account.accountId);
43
41
  }
@@ -1,6 +1,7 @@
1
1
  import { uiLogger } from '../../ui/logger.js';
2
2
  import { getCwd, sanitizeFileName } from '@hubspot/local-dev-lib/path';
3
3
  import { extractZipArchive } from '@hubspot/local-dev-lib/archive';
4
+ import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
4
5
  import { validateUid } from '@hubspot/project-parsing-lib';
5
6
  import { UNMIGRATABLE_REASONS } from '@hubspot/local-dev-lib/constants/projects';
6
7
  import { MIGRATION_STATUS } from '@hubspot/local-dev-lib/types/Migration';
@@ -26,6 +27,7 @@ vi.mock('../../ui/SpinniesManager');
26
27
  vi.mock('../../polling');
27
28
  vi.mock('../../../api/migrate');
28
29
  vi.mock('../../hasFeature');
30
+ vi.mock('@hubspot/local-dev-lib/config');
29
31
  vi.mock('../../projects/urls');
30
32
  vi.mock('fs');
31
33
  const mockedUiLogger = uiLogger;
@@ -34,6 +36,7 @@ const mockedSanitizeFileName = sanitizeFileName;
34
36
  const mockedExtractZipArchive = extractZipArchive;
35
37
  const mockedValidateUid = validateUid;
36
38
  const mockedDownloadProject = downloadProject;
39
+ const mockedGetConfigAccountById = getConfigAccountById;
37
40
  const mockedConfirmPrompt = confirmPrompt;
38
41
  const mockedInputPrompt = inputPrompt;
39
42
  const mockedListPrompt = listPrompt;
@@ -83,6 +86,18 @@ describe('lib/app/migrate', () => {
83
86
  mockedValidateUid.mockReturnValue(undefined);
84
87
  mockedHasUnfiedAppsAccess.mockResolvedValue(true);
85
88
  mockedFs.renameSync.mockImplementation(() => { });
89
+ // Mock account config for the test account ID
90
+ mockedGetConfigAccountById.mockReturnValue({
91
+ accountId: ACCOUNT_ID,
92
+ name: 'Test Account',
93
+ authType: 'personalaccesskey',
94
+ auth: {
95
+ tokenInfo: {
96
+ accessToken: 'test-token',
97
+ },
98
+ },
99
+ env: 'prod',
100
+ });
86
101
  });
87
102
  describe('getUnmigratableReason', () => {
88
103
  const testCases = [
@@ -9,6 +9,7 @@ import { projectNameAndDestPrompt as _projectNameAndDestPrompt } from '../../pro
9
9
  import { ensureProjectExists as _ensureProjectExists } from '../../projects/ensureProjectExists.js';
10
10
  import { poll as _poll } from '../../polling.js';
11
11
  import { migrateApp2023_2 } from '../migrate_legacy.js';
12
+ import { getConfigAccountById } from '@hubspot/local-dev-lib/config';
12
13
  // Mock all external dependencies
13
14
  vi.mock('@hubspot/local-dev-lib/api/appsDev');
14
15
  vi.mock('../../ui/logger.js');
@@ -26,6 +27,7 @@ vi.mock('../../usageTracking');
26
27
  vi.mock('../../ui/SpinniesManager');
27
28
  vi.mock('../../process');
28
29
  vi.mock('../../polling');
30
+ vi.mock('@hubspot/local-dev-lib/config');
29
31
  const isAppDeveloperAccount = _isAppDeveloperAccount;
30
32
  const isUnifiedAccount = _isUnifiedAccount;
31
33
  const selectPublicAppForMigrationPrompt = _selectPublicAppForMigrationPrompt;
@@ -57,6 +59,13 @@ describe('migrateApp2023_2', () => {
57
59
  beforeEach(() => {
58
60
  // @ts-expect-error function mismatch
59
61
  vi.spyOn(process, 'exit').mockImplementation(() => { });
62
+ getConfigAccountById.mockReturnValue({
63
+ accountId: mockDerivedAccountId,
64
+ name: 'Test Account',
65
+ authType: 'personalaccesskey',
66
+ personalAccessKey: 'test-key',
67
+ env: 'prod',
68
+ });
60
69
  selectPublicAppForMigrationPrompt.mockResolvedValue({
61
70
  appId,
62
71
  });
@@ -1,4 +1,4 @@
1
- import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
1
+ import { HubSpotConfigAccount } from '@hubspot/local-dev-lib/types/Accounts';
2
2
  import { ArgumentsCamelCase } from 'yargs';
3
3
  import { MigrateAppArgs } from './migrate.js';
4
- export declare function migrateApp2023_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppArgs>, accountConfig: CLIAccount): Promise<void>;
4
+ export declare function migrateApp2023_2(derivedAccountId: number, options: ArgumentsCamelCase<MigrateAppArgs>, accountConfig: HubSpotConfigAccount): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
2
2
  import { Environment } from '@hubspot/local-dev-lib/types/Config';
3
- import { CLIAccount } from '@hubspot/local-dev-lib/types/Accounts';
3
+ import { HubSpotConfigAccount } 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>;
@@ -9,12 +9,12 @@ export declare function createDeveloperTestAccountV2(parentAccountId: number, te
9
9
  accountId?: number;
10
10
  personalAccessKey?: string;
11
11
  }>;
12
- export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: CLIAccount, env: Environment, portalLimit: number, useV2?: boolean): Promise<number>;
12
+ export declare function buildDeveloperTestAccount(testAccountName: string, parentAccountConfig: HubSpotConfigAccount, env: Environment, portalLimit: number, useV2?: boolean): Promise<number>;
13
13
  type SandboxAccount = SandboxResponse & {
14
14
  name: string;
15
15
  };
16
- export declare function buildSandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType: SandboxAccountType, env: Environment, force?: boolean): Promise<SandboxAccount>;
17
- export declare function buildV2Sandbox(sandboxName: string, parentAccountConfig: CLIAccount, sandboxType: SandboxAccountType, syncObjectRecords: boolean, env: Environment, force?: boolean): Promise<{
16
+ export declare function buildSandbox(sandboxName: string, parentAccountConfig: HubSpotConfigAccount, sandboxType: SandboxAccountType, env: Environment, force?: boolean): Promise<SandboxAccount>;
17
+ export declare function buildV2Sandbox(sandboxName: string, parentAccountConfig: HubSpotConfigAccount, sandboxType: SandboxAccountType, syncObjectRecords: boolean, env: Environment, force?: boolean): Promise<{
18
18
  sandbox: V2Sandbox;
19
19
  }>;
20
20
  export {};
@@ -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';
@@ -168,14 +168,14 @@ export function getCmsPublishMode(options) {
168
168
  }
169
169
  // 2. config[account].defaultCmsPublishMode
170
170
  if (options.derivedAccountId) {
171
- const accountConfig = getAccountConfig(options.derivedAccountId);
171
+ const accountConfig = getConfigAccountById(options.derivedAccountId);
172
172
  if (accountConfig && accountConfig.defaultCmsPublishMode) {
173
173
  return accountConfig.defaultCmsPublishMode;
174
174
  }
175
175
  }
176
176
  // 3. config.defaultCmsPublishMode
177
177
  // 4. DEFAULT_CMS_PUBLISH_MODE
178
- const config = getAndLoadConfigIfNeeded();
178
+ const config = getConfig();
179
179
  return ((config && config.defaultCmsPublishMode) ||
180
180
  DEFAULT_CMS_PUBLISH_MODE);
181
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
  }
@@ -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
  };