@hubspot/cli 7.6.0-beta.3 → 7.6.0-beta.5

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 (330) hide show
  1. package/api/__tests__/migrate.test.d.ts +1 -0
  2. package/api/__tests__/migrate.test.js +183 -0
  3. package/bin/cli.js +6 -2
  4. package/commands/__tests__/account.test.d.ts +1 -0
  5. package/commands/__tests__/account.test.js +74 -0
  6. package/commands/__tests__/auth.test.d.ts +1 -0
  7. package/commands/__tests__/auth.test.js +43 -0
  8. package/commands/__tests__/cms.test.d.ts +1 -0
  9. package/commands/__tests__/cms.test.js +49 -0
  10. package/commands/__tests__/config.test.d.ts +1 -0
  11. package/commands/__tests__/config.test.js +49 -0
  12. package/commands/__tests__/create.test.d.ts +1 -0
  13. package/commands/__tests__/create.test.js +38 -0
  14. package/commands/__tests__/customObject.test.d.ts +1 -0
  15. package/commands/__tests__/customObject.test.js +54 -0
  16. package/commands/__tests__/doctor.test.d.ts +1 -0
  17. package/commands/__tests__/doctor.test.js +139 -0
  18. package/commands/__tests__/feedback.test.d.ts +1 -0
  19. package/commands/__tests__/feedback.test.js +62 -0
  20. package/commands/__tests__/fetch.test.d.ts +1 -0
  21. package/commands/__tests__/fetch.test.js +56 -0
  22. package/commands/__tests__/filemanager.test.d.ts +1 -0
  23. package/commands/__tests__/filemanager.test.js +50 -0
  24. package/commands/__tests__/function.test.d.ts +1 -0
  25. package/commands/__tests__/function.test.js +51 -0
  26. package/commands/__tests__/getStarted.test.d.ts +1 -0
  27. package/commands/__tests__/getStarted.test.js +160 -0
  28. package/commands/__tests__/hubdb.test.d.ts +1 -0
  29. package/commands/__tests__/hubdb.test.js +55 -0
  30. package/commands/__tests__/init.test.d.ts +1 -0
  31. package/commands/__tests__/init.test.js +47 -0
  32. package/commands/__tests__/lint.test.d.ts +1 -0
  33. package/commands/__tests__/lint.test.js +38 -0
  34. package/commands/__tests__/list.test.d.ts +1 -0
  35. package/commands/__tests__/list.test.js +47 -0
  36. package/commands/__tests__/logs.test.d.ts +1 -0
  37. package/commands/__tests__/logs.test.js +70 -0
  38. package/commands/__tests__/mcp.test.d.ts +1 -0
  39. package/commands/__tests__/mcp.test.js +51 -0
  40. package/commands/__tests__/mv.test.d.ts +1 -0
  41. package/commands/__tests__/mv.test.js +84 -0
  42. package/commands/__tests__/open.test.d.ts +1 -0
  43. package/commands/__tests__/open.test.js +96 -0
  44. package/commands/__tests__/project.test.d.ts +1 -0
  45. package/commands/__tests__/project.test.js +100 -0
  46. package/commands/__tests__/remove.test.d.ts +1 -0
  47. package/commands/__tests__/remove.test.js +77 -0
  48. package/commands/__tests__/sandbox.test.d.ts +1 -0
  49. package/commands/__tests__/sandbox.test.js +49 -0
  50. package/commands/__tests__/secret.test.d.ts +1 -0
  51. package/commands/__tests__/secret.test.js +54 -0
  52. package/commands/__tests__/testAccount.test.d.ts +1 -0
  53. package/commands/__tests__/testAccount.test.js +60 -0
  54. package/commands/__tests__/theme.test.d.ts +1 -0
  55. package/commands/__tests__/theme.test.js +52 -0
  56. package/commands/account/__tests__/auth.test.d.ts +1 -0
  57. package/commands/account/__tests__/auth.test.js +31 -0
  58. package/commands/account/__tests__/clean.test.d.ts +1 -0
  59. package/commands/account/__tests__/clean.test.js +33 -0
  60. package/commands/account/__tests__/createOverride.test.d.ts +1 -0
  61. package/commands/account/__tests__/createOverride.test.js +37 -0
  62. package/commands/account/__tests__/info.test.d.ts +1 -0
  63. package/commands/account/__tests__/info.test.js +33 -0
  64. package/commands/account/__tests__/list.test.d.ts +1 -0
  65. package/commands/account/__tests__/list.test.js +33 -0
  66. package/commands/account/__tests__/remove.test.d.ts +1 -0
  67. package/commands/account/__tests__/remove.test.js +41 -0
  68. package/commands/account/__tests__/removeOverride.d.ts +1 -0
  69. package/commands/account/__tests__/removeOverride.js +30 -0
  70. package/commands/account/__tests__/rename.test.d.ts +1 -0
  71. package/commands/account/__tests__/rename.test.js +47 -0
  72. package/commands/account/__tests__/use.test.d.ts +1 -0
  73. package/commands/account/__tests__/use.test.js +37 -0
  74. package/commands/app/__tests__/migrate.test.d.ts +1 -0
  75. package/commands/app/__tests__/migrate.test.js +129 -0
  76. package/commands/app/secret/__tests__/add.test.d.ts +1 -0
  77. package/commands/app/secret/__tests__/add.test.js +33 -0
  78. package/commands/app/secret/__tests__/delete.test.d.ts +1 -0
  79. package/commands/app/secret/__tests__/delete.test.js +33 -0
  80. package/commands/app/secret/__tests__/list.test.d.ts +1 -0
  81. package/commands/app/secret/__tests__/list.test.js +30 -0
  82. package/commands/app/secret/__tests__/update.test.d.ts +1 -0
  83. package/commands/app/secret/__tests__/update.test.js +33 -0
  84. package/commands/customObject/__tests__/create.test.d.ts +1 -0
  85. package/commands/customObject/__tests__/create.test.js +45 -0
  86. package/commands/customObject/__tests__/schema.test.d.ts +1 -0
  87. package/commands/customObject/__tests__/schema.test.js +58 -0
  88. package/commands/customObject/schema/__tests__/create.test.d.ts +1 -0
  89. package/commands/customObject/schema/__tests__/create.test.js +33 -0
  90. package/commands/customObject/schema/__tests__/delete.test.d.ts +1 -0
  91. package/commands/customObject/schema/__tests__/delete.test.js +47 -0
  92. package/commands/customObject/schema/__tests__/fetch-all.test.d.ts +1 -0
  93. package/commands/customObject/schema/__tests__/fetch-all.test.js +46 -0
  94. package/commands/customObject/schema/__tests__/fetch.test.d.ts +1 -0
  95. package/commands/customObject/schema/__tests__/fetch.test.js +50 -0
  96. package/commands/customObject/schema/__tests__/list.test.d.ts +1 -0
  97. package/commands/customObject/schema/__tests__/list.test.js +34 -0
  98. package/commands/customObject/schema/__tests__/update.test.d.ts +1 -0
  99. package/commands/customObject/schema/__tests__/update.test.js +45 -0
  100. package/commands/fetch.js +0 -1
  101. package/commands/filemanager/__tests__/fetch.test.d.ts +1 -0
  102. package/commands/filemanager/__tests__/fetch.test.js +37 -0
  103. package/commands/filemanager/__tests__/upload.test.d.ts +1 -0
  104. package/commands/filemanager/__tests__/upload.test.js +35 -0
  105. package/commands/getStarted.js +13 -34
  106. package/commands/hubdb/__tests__/clear.test.d.ts +1 -0
  107. package/commands/hubdb/__tests__/clear.test.js +33 -0
  108. package/commands/hubdb/__tests__/create.test.d.ts +1 -0
  109. package/commands/hubdb/__tests__/create.test.js +33 -0
  110. package/commands/hubdb/__tests__/delete.test.d.ts +1 -0
  111. package/commands/hubdb/__tests__/delete.test.js +33 -0
  112. package/commands/hubdb/__tests__/fetch.test.d.ts +1 -0
  113. package/commands/hubdb/__tests__/fetch.test.js +33 -0
  114. package/commands/hubdb/__tests__/list.test.d.ts +1 -0
  115. package/commands/hubdb/__tests__/list.test.js +101 -0
  116. package/commands/logs.js +0 -1
  117. package/commands/mcp/__tests__/setup.test.d.ts +1 -0
  118. package/commands/mcp/__tests__/setup.test.js +31 -0
  119. package/commands/mcp/__tests__/start.test.d.ts +1 -0
  120. package/commands/mcp/__tests__/start.test.js +32 -0
  121. package/commands/mcp/setup.js +1 -0
  122. package/commands/mcp/start.d.ts +4 -1
  123. package/commands/mcp/start.js +8 -3
  124. package/commands/open.js +14 -12
  125. package/commands/project/__tests__/add.test.d.ts +1 -0
  126. package/commands/project/__tests__/add.test.js +48 -0
  127. package/commands/project/__tests__/create.test.d.ts +1 -0
  128. package/commands/project/__tests__/create.test.js +45 -0
  129. package/commands/project/__tests__/deploy.test.d.ts +1 -0
  130. package/commands/project/__tests__/deploy.test.js +346 -0
  131. package/commands/project/__tests__/devUnifiedFlow.test.d.ts +1 -0
  132. package/commands/project/__tests__/devUnifiedFlow.test.js +423 -0
  133. package/commands/project/__tests__/download.test.d.ts +1 -0
  134. package/commands/project/__tests__/download.test.js +44 -0
  135. package/commands/project/__tests__/fixtures/exampleProject.json +33 -0
  136. package/commands/project/__tests__/installDeps.test.d.ts +1 -0
  137. package/commands/project/__tests__/installDeps.test.js +180 -0
  138. package/commands/project/__tests__/listBuilds.test.d.ts +1 -0
  139. package/commands/project/__tests__/listBuilds.test.js +43 -0
  140. package/commands/project/__tests__/logs.test.d.ts +1 -0
  141. package/commands/project/__tests__/logs.test.js +246 -0
  142. package/commands/project/__tests__/migrate.test.d.ts +1 -0
  143. package/commands/project/__tests__/migrate.test.js +116 -0
  144. package/commands/project/__tests__/migrateApp.test.d.ts +1 -0
  145. package/commands/project/__tests__/migrateApp.test.js +87 -0
  146. package/commands/project/__tests__/open.test.d.ts +1 -0
  147. package/commands/project/__tests__/open.test.js +44 -0
  148. package/commands/project/__tests__/profile.test.d.ts +1 -0
  149. package/commands/project/__tests__/profile.test.js +47 -0
  150. package/commands/project/__tests__/upload.test.d.ts +1 -0
  151. package/commands/project/__tests__/upload.test.js +48 -0
  152. package/commands/project/__tests__/watch.test.d.ts +1 -0
  153. package/commands/project/__tests__/watch.test.js +40 -0
  154. package/commands/project/deploy.d.ts +3 -2
  155. package/commands/project/deploy.js +61 -55
  156. package/commands/project/dev/unifiedFlow.js +7 -6
  157. package/commands/sandbox/__tests__/create.test.d.ts +1 -0
  158. package/commands/sandbox/__tests__/create.test.js +36 -0
  159. package/commands/sandbox/__tests__/delete.test.d.ts +1 -0
  160. package/commands/sandbox/__tests__/delete.test.js +36 -0
  161. package/commands/secret/__tests__/addSecret.test.d.ts +1 -0
  162. package/commands/secret/__tests__/addSecret.test.js +34 -0
  163. package/commands/secret/__tests__/deleteSecret.test.d.ts +1 -0
  164. package/commands/secret/__tests__/deleteSecret.test.js +46 -0
  165. package/commands/secret/__tests__/listSecret.test.d.ts +1 -0
  166. package/commands/secret/__tests__/listSecret.test.js +34 -0
  167. package/commands/secret/__tests__/updateSecret.test.d.ts +1 -0
  168. package/commands/secret/__tests__/updateSecret.test.js +34 -0
  169. package/commands/testAccount/__tests__/create.test.d.ts +1 -0
  170. package/commands/testAccount/__tests__/create.test.js +38 -0
  171. package/commands/testAccount/__tests__/createConfig.test.d.ts +1 -0
  172. package/commands/testAccount/__tests__/createConfig.test.js +37 -0
  173. package/commands/testAccount/__tests__/delete.test.d.ts +1 -0
  174. package/commands/testAccount/__tests__/delete.test.js +36 -0
  175. package/commands/testAccount/create.js +11 -24
  176. package/commands/testAccount/createConfig.d.ts +0 -2
  177. package/commands/testAccount/createConfig.js +7 -8
  178. package/commands/theme/__tests__/generate-selectors.test.d.ts +1 -0
  179. package/commands/theme/__tests__/generate-selectors.test.js +33 -0
  180. package/commands/theme/__tests__/marketplace-validate.test.d.ts +1 -0
  181. package/commands/theme/__tests__/marketplace-validate.test.js +41 -0
  182. package/commands/theme/__tests__/preview.test.d.ts +1 -0
  183. package/commands/theme/__tests__/preview.test.js +65 -0
  184. package/lang/en.d.ts +36 -19
  185. package/lang/en.js +36 -19
  186. package/lang/en.lyaml +0 -26
  187. package/lib/__tests__/accountTypes.test.d.ts +1 -0
  188. package/lib/__tests__/accountTypes.test.js +100 -0
  189. package/lib/__tests__/buildAccount.test.d.ts +1 -0
  190. package/lib/__tests__/buildAccount.test.js +259 -0
  191. package/lib/__tests__/commonOpts.test.d.ts +1 -0
  192. package/lib/__tests__/commonOpts.test.js +87 -0
  193. package/lib/__tests__/dependencyManagement.test.d.ts +1 -0
  194. package/lib/__tests__/dependencyManagement.test.js +180 -0
  195. package/lib/__tests__/developerTestAccounts.test.d.ts +1 -0
  196. package/lib/__tests__/developerTestAccounts.test.js +180 -0
  197. package/lib/__tests__/hasFeature.test.d.ts +1 -0
  198. package/lib/__tests__/hasFeature.test.js +37 -0
  199. package/lib/__tests__/npm.test.d.ts +1 -0
  200. package/lib/__tests__/npm.test.js +62 -0
  201. package/lib/__tests__/oauth.test.d.ts +1 -0
  202. package/lib/__tests__/oauth.test.js +113 -0
  203. package/lib/__tests__/parsing.test.d.ts +1 -0
  204. package/lib/__tests__/parsing.test.js +36 -0
  205. package/lib/__tests__/polling.test.d.ts +1 -0
  206. package/lib/__tests__/polling.test.js +78 -0
  207. package/lib/__tests__/process.test.d.ts +1 -0
  208. package/lib/__tests__/process.test.js +90 -0
  209. package/lib/__tests__/projectProfiles.test.d.ts +1 -0
  210. package/lib/__tests__/projectProfiles.test.js +134 -0
  211. package/lib/__tests__/sandboxSync.test.d.ts +1 -0
  212. package/lib/__tests__/sandboxSync.test.js +131 -0
  213. package/lib/__tests__/sandboxes.test.d.ts +1 -0
  214. package/lib/__tests__/sandboxes.test.js +148 -0
  215. package/lib/__tests__/serverlessLogs.test.d.ts +1 -0
  216. package/lib/__tests__/serverlessLogs.test.js +154 -0
  217. package/lib/__tests__/usageTracking.test.d.ts +1 -0
  218. package/lib/__tests__/usageTracking.test.js +165 -0
  219. package/lib/__tests__/validation.test.d.ts +1 -0
  220. package/lib/__tests__/validation.test.js +145 -0
  221. package/lib/__tests__/yargsUtils.test.d.ts +1 -0
  222. package/lib/__tests__/yargsUtils.test.js +74 -0
  223. package/lib/app/__tests__/migrate.test.d.ts +1 -0
  224. package/lib/app/__tests__/migrate.test.js +495 -0
  225. package/lib/app/__tests__/migrate_legacy.test.d.ts +1 -0
  226. package/lib/app/__tests__/migrate_legacy.test.js +136 -0
  227. package/lib/app/migrate.js +2 -6
  228. package/lib/buildAccount.d.ts +7 -1
  229. package/lib/buildAccount.js +54 -4
  230. package/lib/dependencyManagement.d.ts +1 -1
  231. package/lib/dependencyManagement.js +2 -2
  232. package/lib/doctor/Diagnosis.js +11 -11
  233. package/lib/doctor/Doctor.js +42 -42
  234. package/lib/doctor/__tests__/Diagnosis.test.d.ts +1 -0
  235. package/lib/doctor/__tests__/Diagnosis.test.js +87 -0
  236. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.d.ts +1 -0
  237. package/lib/doctor/__tests__/DiagnosticInfoBuilder.test.js +172 -0
  238. package/lib/doctor/__tests__/Doctor.test.d.ts +1 -0
  239. package/lib/doctor/__tests__/Doctor.test.js +398 -0
  240. package/lib/mcp/setup.js +26 -5
  241. package/lib/middleware/__test__/configMiddleware.test.js +12 -12
  242. package/lib/middleware/__test__/gitMiddleware.test.js +4 -4
  243. package/lib/middleware/__test__/notificationsMiddleware.test.js +2 -2
  244. package/lib/middleware/__test__/requestMiddleware.test.js +2 -2
  245. package/lib/middleware/__test__/yargsChecksMiddleware.test.js +7 -7
  246. package/lib/middleware/notificationsMiddleware.js +16 -13
  247. package/lib/projects/__tests__/AppDevModeInterface.test.d.ts +1 -0
  248. package/lib/projects/__tests__/AppDevModeInterface.test.js +517 -0
  249. package/lib/projects/__tests__/LocalDevProcess.test.d.ts +1 -0
  250. package/lib/projects/__tests__/LocalDevProcess.test.js +314 -0
  251. package/lib/projects/__tests__/LocalDevWebsocketServer.test.d.ts +1 -0
  252. package/lib/projects/__tests__/LocalDevWebsocketServer.test.js +175 -0
  253. package/lib/projects/__tests__/ProjectLogsManager.test.d.ts +1 -0
  254. package/lib/projects/__tests__/ProjectLogsManager.test.js +191 -0
  255. package/lib/projects/__tests__/buildAndDeploy.test.d.ts +1 -0
  256. package/lib/projects/__tests__/buildAndDeploy.test.js +25 -0
  257. package/lib/projects/__tests__/components.test.d.ts +1 -0
  258. package/lib/projects/__tests__/components.test.js +186 -0
  259. package/lib/projects/__tests__/projects.test.d.ts +1 -0
  260. package/lib/projects/__tests__/projects.test.js +89 -0
  261. package/lib/projects/__tests__/structure.test.d.ts +1 -0
  262. package/lib/projects/__tests__/structure.test.js +249 -0
  263. package/lib/projects/add/__tests__/legacyAddComponent.test.d.ts +1 -0
  264. package/lib/projects/add/__tests__/legacyAddComponent.test.js +206 -0
  265. package/lib/projects/add/__tests__/v3AddComponent.test.d.ts +1 -0
  266. package/lib/projects/add/__tests__/v3AddComponent.test.js +190 -0
  267. package/lib/projects/create/__tests__/legacy.test.d.ts +1 -0
  268. package/lib/projects/create/__tests__/legacy.test.js +126 -0
  269. package/lib/projects/create/__tests__/v3.test.d.ts +1 -0
  270. package/lib/projects/create/__tests__/v3.test.js +80 -0
  271. package/lib/projects/create/v3.d.ts +3 -2
  272. package/lib/projects/create/v3.js +2 -2
  273. package/lib/projects/localDev/DevServerManager.js +0 -3
  274. package/lib/projects/localDev/DevServerManagerV2.js +0 -2
  275. package/lib/projects/localDev/helpers.d.ts +1 -1
  276. package/lib/projects/localDev/helpers.js +2 -2
  277. package/lib/projects/upload.js +1 -1
  278. package/lib/prompts/__tests__/downloadProjectPrompt.test.d.ts +1 -0
  279. package/lib/prompts/__tests__/downloadProjectPrompt.test.js +30 -0
  280. package/lib/prompts/__tests__/projectsLogsPrompt.test.d.ts +1 -0
  281. package/lib/prompts/__tests__/projectsLogsPrompt.test.js +42 -0
  282. package/lib/prompts/createDeveloperTestAccountConfigPrompt.d.ts +11 -10
  283. package/lib/prompts/createDeveloperTestAccountConfigPrompt.js +78 -35
  284. package/lib/prompts/createModulePrompt.js +1 -2
  285. package/lib/prompts/projectAddPrompt.d.ts +2 -1
  286. package/lib/prompts/projectAddPrompt.js +2 -1
  287. package/lib/prompts/promptUtils.d.ts +2 -2
  288. package/lib/prompts/promptUtils.js +172 -36
  289. package/lib/prompts/selectProjectTemplatePrompt.d.ts +2 -1
  290. package/lib/prompts/selectProjectTemplatePrompt.js +2 -1
  291. package/lib/schema.js +5 -1
  292. package/lib/testUtils.js +1 -2
  293. package/lib/ui/SpinniesManager.js +0 -1
  294. package/lib/ui/index.js +1 -1
  295. package/lib/ui/supportHyperlinks.js +2 -2
  296. package/lib/ui/supportsColor.js +2 -2
  297. package/lib/usageTracking.d.ts +11 -0
  298. package/lib/usageTracking.js +67 -73
  299. package/lib/utils/hasFlag.d.ts +1 -0
  300. package/lib/utils/hasFlag.js +15 -0
  301. package/lib/yargsUtils.d.ts +2 -1
  302. package/lib/yargsUtils.js +3 -13
  303. package/mcp-server/tools/project/AddFeatureToProject.js +4 -1
  304. package/mcp-server/tools/project/CreateProjectTool.d.ts +2 -2
  305. package/mcp-server/tools/project/CreateProjectTool.js +4 -1
  306. package/mcp-server/tools/project/DeployProject.js +4 -1
  307. package/mcp-server/tools/project/GuidedWalkthroughTool.js +4 -1
  308. package/mcp-server/tools/project/UploadProjectTools.js +4 -1
  309. package/mcp-server/tools/project/ValidateProjectTool.js +4 -1
  310. package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.d.ts +1 -0
  311. package/mcp-server/tools/project/__tests__/AddFeatureToProject.test.js +153 -0
  312. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.d.ts +1 -0
  313. package/mcp-server/tools/project/__tests__/CreateProjectTool.test.js +130 -0
  314. package/mcp-server/tools/project/__tests__/DeployProject.test.d.ts +1 -0
  315. package/mcp-server/tools/project/__tests__/DeployProject.test.js +121 -0
  316. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.d.ts +1 -0
  317. package/mcp-server/tools/project/__tests__/GuidedWalkthroughTool.test.js +128 -0
  318. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.d.ts +1 -0
  319. package/mcp-server/tools/project/__tests__/UploadProjectTools.test.js +109 -0
  320. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.d.ts +1 -0
  321. package/mcp-server/tools/project/__tests__/ValidateProjectTool.test.js +112 -0
  322. package/mcp-server/utils/__tests__/command.test.d.ts +1 -0
  323. package/mcp-server/utils/__tests__/command.test.js +47 -0
  324. package/mcp-server/utils/__tests__/project.test.d.ts +1 -0
  325. package/mcp-server/utils/__tests__/project.test.js +84 -0
  326. package/mcp-server/utils/project.js +3 -0
  327. package/mcp-server/utils/toolUsageTracking.d.ts +1 -0
  328. package/mcp-server/utils/toolUsageTracking.js +25 -0
  329. package/package.json +10 -10
  330. package/types/Prompts.d.ts +4 -2
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
37
+ const github = __importStar(require("@hubspot/local-dev-lib/api/github"));
38
+ const exitCodes_1 = require("../../../enums/exitCodes");
39
+ const legacy_1 = require("../legacy");
40
+ const constants_1 = require("../../../constants");
41
+ vi.mock('@hubspot/local-dev-lib/logger');
42
+ vi.mock('@hubspot/local-dev-lib/api/github');
43
+ const mockedFetchRepoFile = vi.mocked(github.fetchRepoFile);
44
+ const repoConfig = {
45
+ [constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS]: [
46
+ {
47
+ label: 'Component 1',
48
+ path: 'component1',
49
+ type: 'Component',
50
+ },
51
+ ],
52
+ [constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]: [
53
+ {
54
+ name: 'project1',
55
+ label: 'Project 1',
56
+ path: 'project1',
57
+ },
58
+ ],
59
+ };
60
+ describe('lib/projects/create/legacy', () => {
61
+ describe('getProjectComponentListFromRepo()', () => {
62
+ it('returns a list of components', async () => {
63
+ // @ts-expect-error - Mocking AxiosResponse
64
+ mockedFetchRepoFile.mockResolvedValue({
65
+ data: repoConfig,
66
+ });
67
+ const components = await (0, legacy_1.getProjectComponentListFromRepo)('gh-ref');
68
+ expect(components).toEqual(repoConfig[constants_1.PROJECT_COMPONENT_TYPES.COMPONENTS]);
69
+ });
70
+ it('returns an empty list if no components are found', async () => {
71
+ mockedFetchRepoFile.mockRejectedValue(new Error('Not found'));
72
+ const components = await (0, legacy_1.getProjectComponentListFromRepo)('gh-ref');
73
+ expect(components).toEqual([]);
74
+ });
75
+ });
76
+ describe('getProjectTemplateListFromRepo()', () => {
77
+ let exitMock;
78
+ beforeEach(() => {
79
+ // @ts-expect-error - Mocking process.exit
80
+ exitMock = vi
81
+ .spyOn(process, 'exit')
82
+ .mockImplementation(() => undefined);
83
+ });
84
+ afterEach(() => {
85
+ exitMock.mockRestore();
86
+ });
87
+ it('returns a list of project templates', async () => {
88
+ // @ts-expect-error - Mocking AxiosResponse
89
+ mockedFetchRepoFile.mockResolvedValue({
90
+ data: repoConfig,
91
+ });
92
+ const templates = await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
93
+ expect(templates).toEqual(repoConfig[constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]);
94
+ });
95
+ it('Logs an error and exits the process if the request for the template list fails', async () => {
96
+ mockedFetchRepoFile.mockRejectedValue(new Error('Not found'));
97
+ await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
98
+ expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Failed to fetch the config.json file from the target repository/));
99
+ expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
100
+ });
101
+ it('Logs an error and exits the process if there are no projects listed in the repo config', async () => {
102
+ // @ts-expect-error - Mocking AxiosResponse
103
+ mockedFetchRepoFile.mockResolvedValue({});
104
+ await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
105
+ expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Unable to find any projects in the target repository's config.json file/));
106
+ expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
107
+ });
108
+ it('Logs an error and exits the process if any of the projects in the repo config are missing required properties', async () => {
109
+ // @ts-expect-error - Mocking AxiosResponse
110
+ mockedFetchRepoFile.mockResolvedValue({
111
+ data: {
112
+ ...repoConfig,
113
+ [constants_1.PROJECT_COMPONENT_TYPES.PROJECTS]: [
114
+ {
115
+ name: 'project1',
116
+ label: 'Project 1',
117
+ },
118
+ ],
119
+ },
120
+ });
121
+ await (0, legacy_1.getProjectTemplateListFromRepo)(constants_1.HUBSPOT_PROJECT_COMPONENTS_GITHUB_PATH, 'gh-ref');
122
+ expect(logger_1.logger.error).toHaveBeenCalledWith(expect.stringMatching(/Found misconfigured projects in the target repository's config.json file/));
123
+ expect(exitMock).toHaveBeenCalledWith(exitCodes_1.EXIT_CODES.ERROR);
124
+ });
125
+ });
126
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const v3_1 = require("../v3");
4
+ vi.mock('@hubspot/local-dev-lib/logger');
5
+ vi.mock('@hubspot/local-dev-lib/api/github');
6
+ describe('lib/projects/create/v3', () => {
7
+ describe('calculateComponentTemplateChoices()', () => {
8
+ const mockComponents = [
9
+ {
10
+ label: 'Module Component',
11
+ path: 'module',
12
+ type: 'module',
13
+ supportedAuthTypes: ['oauth'],
14
+ supportedDistributions: ['private'],
15
+ },
16
+ {
17
+ label: 'Card Component',
18
+ path: 'card',
19
+ type: 'card',
20
+ supportedAuthTypes: ['oauth', 'static'],
21
+ supportedDistributions: ['private', 'marketplace'],
22
+ },
23
+ ];
24
+ const mockProjectMetadataForChoices = {
25
+ hsMetaFiles: [],
26
+ components: {
27
+ module: { count: 0, maxCount: 5, hsMetaFiles: [] },
28
+ card: { count: 3, maxCount: 3, hsMetaFiles: [] },
29
+ },
30
+ };
31
+ it('returns enabled components when they meet all requirements', () => {
32
+ const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'oauth', 'private', mockProjectMetadataForChoices);
33
+ expect(choices).toHaveLength(3); // includes separator
34
+ expect(choices[0]).toEqual({
35
+ name: 'Module Component',
36
+ value: mockComponents[0],
37
+ });
38
+ expect(choices[2]).toEqual({
39
+ name: expect.stringContaining('Card Component'),
40
+ value: mockComponents[1],
41
+ disabled: expect.stringContaining('maximum'),
42
+ });
43
+ });
44
+ it('disables components when auth type is not supported', () => {
45
+ const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'privatekey', 'private', mockProjectMetadataForChoices);
46
+ // All components should be disabled, so they come after the separator
47
+ expect(choices[1]).toEqual({
48
+ name: expect.stringContaining('Module Component'),
49
+ value: mockComponents[0],
50
+ disabled: expect.stringContaining('privatekey'),
51
+ });
52
+ });
53
+ it('disables components when distribution is not supported', () => {
54
+ const choices = (0, v3_1.calculateComponentTemplateChoices)(mockComponents, 'oauth', 'enterprise', mockProjectMetadataForChoices);
55
+ // All components should be disabled, so they come after the separator
56
+ expect(choices[1]).toEqual({
57
+ name: expect.stringContaining('Module Component'),
58
+ value: mockComponents[0],
59
+ disabled: expect.stringContaining('enterprise'),
60
+ });
61
+ });
62
+ it('handles components without auth type or distribution restrictions', () => {
63
+ const componentsWithoutRestrictions = [
64
+ {
65
+ label: 'Unrestricted Component',
66
+ path: 'unrestricted',
67
+ type: 'module',
68
+ },
69
+ ];
70
+ const choices = (0, v3_1.calculateComponentTemplateChoices)(componentsWithoutRestrictions, 'oauth', 'private', {
71
+ hsMetaFiles: [],
72
+ components: { module: { count: 0, maxCount: 5, hsMetaFiles: [] } },
73
+ });
74
+ expect(choices[0]).toEqual({
75
+ name: 'Unrestricted Component',
76
+ value: componentsWithoutRestrictions[0],
77
+ });
78
+ });
79
+ });
80
+ });
@@ -1,3 +1,4 @@
1
+ import { Separator } from '@inquirer/prompts';
1
2
  import { ComponentTemplate, ComponentTemplateChoice, ProjectTemplateRepoConfig } from '../../../types/Projects';
2
3
  import { ProjectMetadata } from '@hubspot/project-parsing-lib/src/lib/project';
3
4
  import { SelectProjectTemplatePromptResponse } from '../../prompts/selectProjectTemplatePrompt';
@@ -7,13 +8,13 @@ export declare function createV3App(providedAuth: string | undefined, providedDi
7
8
  authType: string;
8
9
  distribution: string;
9
10
  }>;
10
- export declare function calculateComponentTemplateChoices(components: ComponentTemplate[], authType: string | undefined, distribution: string | undefined, projectMetadata?: ProjectMetadata): ComponentTemplateChoice[];
11
+ export declare function calculateComponentTemplateChoices(components: ComponentTemplate[], authType: string | undefined, distribution: string | undefined, projectMetadata?: ProjectMetadata): (ComponentTemplateChoice | Separator)[];
11
12
  type V3ComponentInfo = {
12
13
  authType?: string;
13
14
  distribution?: string;
14
15
  repoConfig?: ProjectTemplateRepoConfig;
15
16
  projectContents?: string;
16
- componentTemplateChoices?: ComponentTemplateChoice[];
17
+ componentTemplateChoices?: (ComponentTemplateChoice | Separator)[];
17
18
  };
18
19
  export declare function v3ComponentFlow(platformVersion: string, projectBase: string | undefined, providedAuth: string | undefined, providedDistribution: string | undefined): Promise<V3ComponentInfo>;
19
20
  export declare function generateComponentPaths({ selectProjectTemplatePromptResponse, platformVersion, repoConfig, projectContents, authType, distribution, }: {
@@ -8,6 +8,7 @@ exports.createV3App = createV3App;
8
8
  exports.calculateComponentTemplateChoices = calculateComponentTemplateChoices;
9
9
  exports.v3ComponentFlow = v3ComponentFlow;
10
10
  exports.generateComponentPaths = generateComponentPaths;
11
+ const prompts_1 = require("@inquirer/prompts");
11
12
  const constants_1 = require("../../constants");
12
13
  const en_1 = require("../../../lang/en");
13
14
  const promptUtils_1 = require("../../prompts/promptUtils");
@@ -17,7 +18,6 @@ const path_1 = __importDefault(require("path"));
17
18
  const legacy_1 = require("./legacy");
18
19
  const errorHandlers_1 = require("../../errorHandlers");
19
20
  const exitCodes_1 = require("../../enums/exitCodes");
20
- const inquirer = require('inquirer');
21
21
  exports.EMPTY_PROJECT = 'empty';
22
22
  exports.PROJECT_WITH_APP = 'app';
23
23
  async function createV3App(providedAuth, providedDistribution) {
@@ -96,7 +96,7 @@ function calculateComponentTemplateChoices(components, authType, distribution, p
96
96
  }
97
97
  });
98
98
  return disabledComponents.length
99
- ? [...enabledComponents, new inquirer.Separator(), ...disabledComponents]
99
+ ? [...enabledComponents, new prompts_1.Separator(), ...disabledComponents]
100
100
  : [...enabledComponents];
101
101
  }
102
102
  async function v3ComponentFlow(platformVersion, projectBase, providedAuth, providedDistribution) {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const logger_1 = require("@hubspot/local-dev-lib/logger");
4
- const promptUtils_1 = require("../../prompts/promptUtils");
5
4
  const ui_extensions_dev_server_1 = require("@hubspot/ui-extensions-dev-server");
6
5
  const portManager_1 = require("@hubspot/local-dev-lib/portManager");
7
6
  const urls_1 = require("@hubspot/local-dev-lib/urls");
@@ -71,7 +70,6 @@ class DevServerManager {
71
70
  await serverInterface.setup({
72
71
  components: compatibleComponents,
73
72
  onUploadRequired,
74
- promptUser: promptUtils_1.promptUser,
75
73
  logger: logger_1.logger,
76
74
  urls: {
77
75
  api: (0, urls_1.getHubSpotApiOrigin)(env),
@@ -122,4 +120,3 @@ class DevServerManager {
122
120
  }
123
121
  const Manager = new DevServerManager();
124
122
  exports.default = Manager;
125
- module.exports = Manager;
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const logger_1 = require("@hubspot/local-dev-lib/logger");
7
- const promptUtils_1 = require("../../prompts/promptUtils");
8
7
  const portManager_1 = require("@hubspot/local-dev-lib/portManager");
9
8
  const urls_1 = require("@hubspot/local-dev-lib/urls");
10
9
  const config_1 = require("@hubspot/local-dev-lib/config");
@@ -40,7 +39,6 @@ class DevServerManagerV2 {
40
39
  // @TODO: In the future, update UIE Dev Server to use LocalDevState
41
40
  await serverInterface.setup({
42
41
  components: this.localDevState.projectNodes,
43
- promptUser: promptUtils_1.promptUser,
44
42
  logger: logger_1.logger,
45
43
  urls: {
46
44
  api: (0, urls_1.getHubSpotApiOrigin)(env),
@@ -11,7 +11,7 @@ export declare function checkIfParentAccountIsAuthed(accountConfig: CLIAccount):
11
11
  export declare function checkIfAccountFlagIsSupported(accountConfig: CLIAccount, hasPublicApps: boolean): void;
12
12
  export declare function suggestRecommendedNestedAccount(accounts: CLIAccount[], accountConfig: CLIAccount, hasPublicApps: boolean): Promise<ProjectDevTargetAccountPromptResponse>;
13
13
  export declare function createSandboxForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
14
- export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment): Promise<number>;
14
+ export declare function createDeveloperTestAccountForLocalDev(accountId: number, accountConfig: CLIAccount, env: Environment, useV3?: boolean): Promise<number>;
15
15
  export declare function useExistingDevTestAccount(env: Environment, account: DeveloperTestAccount): Promise<void>;
16
16
  export declare function createNewProjectForLocalDev(projectConfig: ProjectConfig, targetAccountId: number, shouldCreateWithoutConfirmation: boolean, hasPublicApps: boolean): Promise<Project>;
17
17
  export declare function createInitialBuildForNewProject(projectConfig: ProjectConfig, projectDir: string, targetAccountId: number, sendIR?: boolean, profile?: string): Promise<Build>;
@@ -152,7 +152,7 @@ async function createSandboxForLocalDev(accountId, accountConfig, env) {
152
152
  }
153
153
  }
154
154
  // Create a developer test account and return its accountId
155
- async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env) {
155
+ async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, env, useV3 = false) {
156
156
  let currentPortalCount = 0;
157
157
  let maxTestPortals = 10;
158
158
  try {
@@ -182,7 +182,7 @@ async function createDeveloperTestAccountForLocalDev(accountId, accountConfig, e
182
182
  accountType: config_1.HUBSPOT_ACCOUNT_TYPES.DEVELOPER_TEST,
183
183
  });
184
184
  (0, usageTracking_1.trackCommandMetadataUsage)('developer-test-account-create', { step: 'project-dev' }, accountId);
185
- const result = await (0, buildAccount_1.buildDeveloperTestAccount)(name, accountConfig, env, maxTestPortals);
185
+ const result = await (0, buildAccount_1.buildDeveloperTestAccount)(name, accountConfig, env, maxTestPortals, useV3);
186
186
  return result;
187
187
  }
188
188
  catch (err) {
@@ -25,7 +25,7 @@ const buildAndDeploy_1 = require("./buildAndDeploy");
25
25
  const exitCodes_1 = require("../enums/exitCodes");
26
26
  async function uploadProjectFiles(accountId, projectName, filePath, uploadMessage, platformVersion, intermediateRepresentation) {
27
27
  SpinniesManager_1.default.init({});
28
- const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId);
28
+ const accountIdentifier = (0, ui_1.uiAccountDescription)(accountId) || `${accountId}`;
29
29
  SpinniesManager_1.default.add('upload', {
30
30
  text: en_1.lib.projectUpload.uploadProjectFiles.add(projectName, accountIdentifier),
31
31
  succeedColor: 'white',
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_1 = require("@hubspot/local-dev-lib/config");
4
+ const projects_1 = require("@hubspot/local-dev-lib/api/projects");
5
+ const downloadProjectPrompt_1 = require("../downloadProjectPrompt");
6
+ vi.mock('../promptUtils', () => ({
7
+ promptUser: vi.fn().mockResolvedValue({ project: 'test-project' }),
8
+ }));
9
+ vi.mock('@hubspot/local-dev-lib/api/projects', () => ({
10
+ fetchProjects: vi.fn().mockResolvedValue({
11
+ data: { results: [] },
12
+ }),
13
+ }));
14
+ vi.mock('@hubspot/local-dev-lib/config', () => ({
15
+ getAccountId: vi.fn().mockImplementation(() => 123456789),
16
+ }));
17
+ describe('lib/prompts/downloadProjectPrompt', () => {
18
+ it('should honor the account passed as an option', async () => {
19
+ const account = 'Prod';
20
+ await (0, downloadProjectPrompt_1.downloadProjectPrompt)({ account });
21
+ expect(config_1.getAccountId).toHaveBeenCalledTimes(1);
22
+ expect(config_1.getAccountId).toHaveBeenCalledWith(account);
23
+ });
24
+ it('should fetch the projects for the correct accountId', async () => {
25
+ const account = 'Prod';
26
+ await (0, downloadProjectPrompt_1.downloadProjectPrompt)({ account });
27
+ expect(projects_1.fetchProjects).toHaveBeenCalledTimes(1);
28
+ expect(projects_1.fetchProjects).toHaveBeenCalledWith(123456789);
29
+ });
30
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const projectsLogsPrompt_1 = require("../projectsLogsPrompt");
7
+ const promptUtils_1 = require("../promptUtils");
8
+ const chalk_1 = __importDefault(require("chalk"));
9
+ vi.mock('../promptUtils');
10
+ describe('lib/prompts/projectsLogsPrompt', () => {
11
+ it('should return undefined functionName when functionChoices is undefined', async () => {
12
+ const actual = await (0, projectsLogsPrompt_1.projectLogsPrompt)({ functionChoices: undefined });
13
+ expect(actual).toEqual({});
14
+ expect(promptUtils_1.promptUser).not.toHaveBeenCalled();
15
+ });
16
+ it('should return the functionName without prompting when there is only one functionChoice', async () => {
17
+ const functionChoice = 'this-is-the-only-function';
18
+ const { functionName } = await (0, projectsLogsPrompt_1.projectLogsPrompt)({
19
+ functionChoices: [functionChoice],
20
+ });
21
+ expect(functionName).toEqual(functionChoice);
22
+ expect(promptUtils_1.promptUser).not.toHaveBeenCalled();
23
+ });
24
+ it('should prompt the user if there is more than one choice', async () => {
25
+ const functionChoices = ['choice 1', 'choice 2'];
26
+ const projectName = 'my cool project';
27
+ await (0, projectsLogsPrompt_1.projectLogsPrompt)({
28
+ functionChoices,
29
+ projectName,
30
+ });
31
+ expect(promptUtils_1.promptUser).toHaveBeenCalledTimes(1);
32
+ expect(promptUtils_1.promptUser).toHaveBeenLastCalledWith(expect.arrayContaining([
33
+ expect.objectContaining({
34
+ name: 'functionName',
35
+ type: 'list',
36
+ message: `[--function] Select function in ${chalk_1.default.bold(projectName)} project`,
37
+ when: expect.any(Function),
38
+ choices: functionChoices,
39
+ }),
40
+ ]));
41
+ });
42
+ });
@@ -1,17 +1,18 @@
1
- import { DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
1
+ import { AccountLevel, DeveloperTestAccountConfig } from '@hubspot/local-dev-lib/types/developerTestAccounts';
2
2
  declare const hubs: {
3
- readonly MARKETING: "marketingLevel";
4
- readonly OPS: "opsLevel";
5
- readonly SERVICE: "serviceLevel";
6
- readonly SALES: "salesLevel";
7
- readonly CONTENT: "contentLevel";
3
+ MARKETING: string;
4
+ OPS: string;
5
+ SERVICE: string;
6
+ SALES: string;
7
+ CONTENT: string;
8
8
  };
9
9
  type HubName = keyof typeof hubs;
10
- type HubTier = 'STARTER' | 'PROFESSIONAL' | 'ENTERPRISE';
11
- export type HubConfig = `${HubName}:${HubTier}`;
10
+ export type HubConfig = {
11
+ hub: HubName;
12
+ tier: AccountLevel;
13
+ };
12
14
  export declare function createDeveloperTestAccountConfigPrompt(args?: {
13
15
  name?: string;
14
16
  description?: string;
15
- tiers?: HubConfig[];
16
- }): Promise<DeveloperTestAccountConfig>;
17
+ }, supportFlags?: boolean): Promise<DeveloperTestAccountConfig>;
17
18
  export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createDeveloperTestAccountConfigPrompt = createDeveloperTestAccountConfigPrompt;
4
+ const prompts_1 = require("@inquirer/prompts");
4
5
  const en_1 = require("../../lang/en");
5
6
  const promptUtils_1 = require("./promptUtils");
6
7
  const hubs = {
@@ -10,63 +11,108 @@ const hubs = {
10
11
  SALES: 'salesLevel',
11
12
  CONTENT: 'contentLevel',
12
13
  };
14
+ const AccountTiers = {
15
+ FREE: 'FREE',
16
+ STARTER: 'STARTER',
17
+ PROFESSIONAL: 'PROFESSIONAL',
18
+ ENTERPRISE: 'ENTERPRISE',
19
+ };
20
+ const makeHubTiers = (hubKey) => {
21
+ const hubTypeKey = hubKey.toLowerCase();
22
+ const hubName = en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.hubTypes[hubTypeKey];
23
+ return [
24
+ {
25
+ name: `${hubName} [${AccountTiers.FREE}]`,
26
+ value: { hub: hubKey, tier: AccountTiers.FREE },
27
+ },
28
+ {
29
+ name: `${hubName} [${AccountTiers.STARTER}]`,
30
+ value: { hub: hubKey, tier: AccountTiers.STARTER },
31
+ },
32
+ {
33
+ name: `${hubName} [${AccountTiers.PROFESSIONAL}]`,
34
+ value: { hub: hubKey, tier: AccountTiers.PROFESSIONAL },
35
+ },
36
+ {
37
+ name: `${hubName} [${AccountTiers.ENTERPRISE}]`,
38
+ value: { hub: hubKey, tier: AccountTiers.ENTERPRISE },
39
+ },
40
+ ];
41
+ };
13
42
  const TEST_ACCOUNT_TIERS = [
14
- { name: 'Marketing STARTER', value: 'MARKETING:STARTER' },
15
- {
16
- name: 'Marketing PROFESSIONAL',
17
- value: 'MARKETING:PROFESSIONAL',
18
- },
19
- { name: 'Marketing ENTERPRISE', value: 'MARKETING:ENTERPRISE' },
20
- promptUtils_1.Separator,
21
- { name: 'Ops STARTER', value: 'OPS:STARTER' },
22
- { name: 'Ops PROFESSIONAL', value: 'OPS:PROFESSIONAL' },
23
- { name: 'Ops ENTERPRISE', value: 'OPS:ENTERPRISE' },
24
- promptUtils_1.Separator,
25
- { name: 'Service STARTER', value: 'SERVICE:STARTER' },
26
- { name: 'Service PROFESSIONAL', value: 'SERVICE:PROFESSIONAL' },
27
- { name: 'Service ENTERPRISE', value: 'SERVICE:ENTERPRISE' },
28
- promptUtils_1.Separator,
29
- { name: 'Sales STARTER', value: 'SALES:STARTER' },
30
- { name: 'Sales PROFESSIONAL', value: 'SALES:PROFESSIONAL' },
31
- { name: 'Sales ENTERPRISE', value: 'SALES:ENTERPRISE' },
32
- promptUtils_1.Separator,
33
- { name: 'Content STARTER', value: 'CONTENT:STARTER' },
34
- { name: 'Content PROFESSIONAL', value: 'CONTENT:PROFESSIONAL' },
35
- { name: 'Content ENTERPRISE', value: 'CONTENT:ENTERPRISE' },
36
- promptUtils_1.Separator,
43
+ ...makeHubTiers('MARKETING'),
44
+ new prompts_1.Separator(),
45
+ ...makeHubTiers('OPS'),
46
+ new prompts_1.Separator(),
47
+ ...makeHubTiers('SERVICE'),
48
+ new prompts_1.Separator(),
49
+ ...makeHubTiers('SALES'),
50
+ new prompts_1.Separator(),
51
+ ...makeHubTiers('CONTENT'),
52
+ new prompts_1.Separator(),
37
53
  ];
38
- async function createDeveloperTestAccountConfigPrompt(args = {}) {
39
- const { name, description, tiers } = args;
54
+ async function createDeveloperTestAccountConfigPrompt(args = {}, supportFlags = true) {
55
+ const { name, description } = args;
40
56
  let accountName = name;
41
57
  let accountDescription = description;
42
- let accountLevelsArray = tiers;
58
+ let accountLevelsArray = [];
43
59
  if (!accountName) {
44
60
  const namePromptResult = await (0, promptUtils_1.promptUser)({
45
61
  name: 'accountName',
46
- message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt,
62
+ message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.namePrompt(supportFlags),
47
63
  type: 'input',
64
+ validate: value => {
65
+ if (!value) {
66
+ return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
67
+ .nameRequired;
68
+ }
69
+ return true;
70
+ },
48
71
  });
49
72
  accountName = namePromptResult.accountName;
50
73
  }
51
74
  if (!accountDescription) {
52
75
  const descriptionPromptResult = await (0, promptUtils_1.promptUser)({
53
76
  name: 'description',
54
- message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt,
77
+ message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.descriptionPrompt(supportFlags),
55
78
  type: 'input',
56
79
  });
57
80
  accountDescription = descriptionPromptResult.description;
58
81
  }
59
- if (!accountLevelsArray) {
82
+ const useDefaultAccountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
83
+ name: 'useDefaultAccountLevels',
84
+ message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
85
+ .useDefaultAccountLevelsPrompt.message,
86
+ type: 'list',
87
+ choices: [
88
+ {
89
+ name: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
90
+ .useDefaultAccountLevelsPrompt.default,
91
+ value: 'default',
92
+ },
93
+ {
94
+ name: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt
95
+ .useDefaultAccountLevelsPrompt.manual,
96
+ value: 'manual',
97
+ },
98
+ ],
99
+ });
100
+ if (useDefaultAccountLevelsPromptResult.useDefaultAccountLevels === 'manual') {
60
101
  const accountLevelsPromptResult = await (0, promptUtils_1.promptUser)({
61
102
  name: 'testAccountLevels',
62
103
  message: en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.tiersPrompt,
63
104
  type: 'checkbox',
105
+ pageSize: 13,
64
106
  choices: TEST_ACCOUNT_TIERS,
65
107
  validate: choices => {
66
- if (choices?.length > 1) {
108
+ if (choices?.length < Object.keys(hubs).length) {
109
+ return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
110
+ .allHubsRequired;
111
+ }
112
+ else {
67
113
  const hubMap = {};
68
114
  for (const choice of choices) {
69
- const hub = choice.split(':')[0];
115
+ const { hub } = choice.value;
70
116
  if (hubMap[hub]) {
71
117
  return en_1.lib.prompts.createDeveloperTestAccountConfigPrompt.errors
72
118
  .tiersError;
@@ -79,11 +125,8 @@ async function createDeveloperTestAccountConfigPrompt(args = {}) {
79
125
  });
80
126
  accountLevelsArray = accountLevelsPromptResult.testAccountLevels;
81
127
  }
82
- if (!accountLevelsArray) {
83
- accountLevelsArray = [];
84
- }
85
128
  const accountLevels = accountLevelsArray.reduce((acc, level) => {
86
- const [hubName, hubTier] = level.split(':');
129
+ const { hub: hubName, tier: hubTier } = level;
87
130
  const hubLevel = hubs[hubName];
88
131
  acc[hubLevel] = hubTier;
89
132
  return acc;
@@ -26,9 +26,8 @@ const CONTENT_TYPES_PROMPT = {
26
26
  type: 'checkbox',
27
27
  name: 'contentTypes',
28
28
  message: (0, lang_1.i18n)(`lib.prompts.createModulePrompt.selectContentType`),
29
- default: ['ANY'],
30
29
  choices: [
31
- { name: 'Any', value: 'ANY' },
30
+ { name: 'Any', value: 'ANY', checked: true },
32
31
  { name: 'Landing page', value: 'LANDING_PAGE' },
33
32
  { name: 'Site page', value: 'SITE_PAGE' },
34
33
  { name: 'Blog post', value: 'BLOG_POST' },
@@ -1,3 +1,4 @@
1
+ import { Separator } from '@inquirer/prompts';
1
2
  import { ComponentTemplate, ComponentTemplateChoice } from '../../types/Projects';
2
3
  type ProjectAddPromptResponse = {
3
4
  componentTemplate: ComponentTemplate;
@@ -10,5 +11,5 @@ export declare function projectAddPrompt(components: ComponentTemplate[], prompt
10
11
  name?: string;
11
12
  type?: string;
12
13
  }): Promise<ProjectAddPromptResponse>;
13
- export declare function projectAddPromptV3(components: ComponentTemplateChoice[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
14
+ export declare function projectAddPromptV3(components: (ComponentTemplateChoice | Separator)[], selectedFeatures: string[] | undefined): Promise<ProjectAddPromptResponseV3>;
14
15
  export {};
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.projectAddPrompt = projectAddPrompt;
4
4
  exports.projectAddPromptV3 = projectAddPromptV3;
5
+ const prompts_1 = require("@inquirer/prompts");
5
6
  const promptUtils_1 = require("./promptUtils");
6
7
  const en_1 = require("../../lang/en");
7
8
  function findComponentByPathOrLabel(components, componentPathOrLabel) {
@@ -51,7 +52,7 @@ async function projectAddPromptV3(components, selectedFeatures) {
51
52
  const selectedComponents = [];
52
53
  if (selectedFeatures) {
53
54
  components.forEach(template => {
54
- if (!template.value) {
55
+ if (template instanceof prompts_1.Separator || !template.value) {
55
56
  return;
56
57
  }
57
58
  if (selectedFeatures?.includes(template.value.type)) {