@apimatic/cli 1.1.0-alpha.21 → 1.1.0-alpha.22

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 (299) hide show
  1. package/README.md +112 -90
  2. package/lib/actions/action-result.d.ts +8 -3
  3. package/lib/actions/action-result.js +34 -15
  4. package/lib/actions/action-result.js.map +1 -1
  5. package/lib/actions/api/transform.d.ts +15 -0
  6. package/lib/actions/api/transform.js +48 -0
  7. package/lib/actions/api/transform.js.map +1 -0
  8. package/lib/actions/api/validate.d.ts +12 -0
  9. package/lib/actions/api/validate.js +41 -0
  10. package/lib/actions/api/validate.js.map +1 -0
  11. package/lib/actions/auth/login.d.ts +6 -5
  12. package/lib/actions/auth/login.js +25 -33
  13. package/lib/actions/auth/login.js.map +1 -1
  14. package/lib/actions/auth/logout.d.ts +8 -0
  15. package/lib/actions/auth/logout.js +15 -0
  16. package/lib/actions/auth/logout.js.map +1 -0
  17. package/lib/actions/auth/status.d.ts +11 -0
  18. package/lib/actions/auth/status.js +26 -0
  19. package/lib/actions/auth/status.js.map +1 -0
  20. package/lib/actions/portal/copilot.d.ts +5 -3
  21. package/lib/actions/portal/copilot.js +47 -37
  22. package/lib/actions/portal/copilot.js.map +1 -1
  23. package/lib/actions/portal/generate.d.ts +4 -5
  24. package/lib/actions/portal/generate.js +30 -37
  25. package/lib/actions/portal/generate.js.map +1 -1
  26. package/lib/actions/portal/quickstart.d.ts +16 -0
  27. package/lib/actions/portal/quickstart.js +145 -0
  28. package/lib/actions/portal/quickstart.js.map +1 -0
  29. package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
  30. package/lib/actions/portal/recipe/new-recipe.js +147 -221
  31. package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
  32. package/lib/actions/portal/serve.d.ts +12 -10
  33. package/lib/actions/portal/serve.js +112 -17
  34. package/lib/actions/portal/serve.js.map +1 -1
  35. package/lib/actions/portal/toc/new-toc.d.ts +16 -15
  36. package/lib/actions/portal/toc/new-toc.js +80 -116
  37. package/lib/actions/portal/toc/new-toc.js.map +1 -1
  38. package/lib/actions/sdk/generate.d.ts +5 -6
  39. package/lib/actions/sdk/generate.js +22 -47
  40. package/lib/actions/sdk/generate.js.map +1 -1
  41. package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
  42. package/lib/application/portal/recipe/portal-recipe.js +9 -9
  43. package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
  44. package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
  45. package/lib/application/portal/recipe/recipe-generator.js +21 -22
  46. package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
  47. package/lib/client-utils/auth-manager.d.ts +1 -1
  48. package/lib/client-utils/auth-manager.js +3 -4
  49. package/lib/client-utils/auth-manager.js.map +1 -1
  50. package/lib/commands/api/transform.d.ts +6 -3
  51. package/lib/commands/api/transform.js +43 -94
  52. package/lib/commands/api/transform.js.map +1 -1
  53. package/lib/commands/api/validate.d.ts +6 -3
  54. package/lib/commands/api/validate.js +27 -66
  55. package/lib/commands/api/validate.js.map +1 -1
  56. package/lib/commands/auth/login.d.ts +2 -1
  57. package/lib/commands/auth/login.js +15 -9
  58. package/lib/commands/auth/login.js.map +1 -1
  59. package/lib/commands/auth/logout.d.ts +3 -1
  60. package/lib/commands/auth/logout.js +12 -13
  61. package/lib/commands/auth/logout.js.map +1 -1
  62. package/lib/commands/auth/status.d.ts +1 -0
  63. package/lib/commands/auth/status.js +13 -11
  64. package/lib/commands/auth/status.js.map +1 -1
  65. package/lib/commands/portal/copilot.d.ts +2 -2
  66. package/lib/commands/portal/copilot.js +22 -20
  67. package/lib/commands/portal/copilot.js.map +1 -1
  68. package/lib/commands/portal/generate.d.ts +3 -4
  69. package/lib/commands/portal/generate.js +19 -14
  70. package/lib/commands/portal/generate.js.map +1 -1
  71. package/lib/commands/portal/quickstart.d.ts +3 -4
  72. package/lib/commands/portal/quickstart.js +24 -101
  73. package/lib/commands/portal/quickstart.js.map +1 -1
  74. package/lib/commands/portal/recipe/new.d.ts +3 -1
  75. package/lib/commands/portal/recipe/new.js +31 -23
  76. package/lib/commands/portal/recipe/new.js.map +1 -1
  77. package/lib/commands/portal/serve.d.ts +5 -5
  78. package/lib/commands/portal/serve.js +31 -57
  79. package/lib/commands/portal/serve.js.map +1 -1
  80. package/lib/commands/portal/toc/new.d.ts +2 -2
  81. package/lib/commands/portal/toc/new.js +35 -26
  82. package/lib/commands/portal/toc/new.js.map +1 -1
  83. package/lib/commands/sdk/generate.d.ts +5 -4
  84. package/lib/commands/sdk/generate.js +26 -17
  85. package/lib/commands/sdk/generate.js.map +1 -1
  86. package/lib/hooks/not-found.js +1 -1
  87. package/lib/hooks/not-found.js.map +1 -1
  88. package/lib/infrastructure/api-utils.js +3 -2
  89. package/lib/infrastructure/api-utils.js.map +1 -1
  90. package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
  91. package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
  92. package/lib/infrastructure/debounce-service.js.map +1 -0
  93. package/lib/infrastructure/env-info.d.ts +1 -1
  94. package/lib/infrastructure/env-info.js +2 -2
  95. package/lib/infrastructure/env-info.js.map +1 -1
  96. package/lib/infrastructure/file-service.d.ts +7 -2
  97. package/lib/infrastructure/file-service.js +46 -5
  98. package/lib/infrastructure/file-service.js.map +1 -1
  99. package/lib/infrastructure/launcher-service.d.ts +2 -0
  100. package/lib/infrastructure/launcher-service.js +4 -0
  101. package/lib/infrastructure/launcher-service.js.map +1 -1
  102. package/lib/infrastructure/network-service.d.ts +3 -0
  103. package/lib/infrastructure/network-service.js +7 -0
  104. package/lib/infrastructure/network-service.js.map +1 -0
  105. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  106. package/lib/infrastructure/services/api-client-factory.js +20 -0
  107. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  108. package/lib/infrastructure/services/api-service.d.ts +2 -2
  109. package/lib/infrastructure/services/api-service.js +6 -6
  110. package/lib/infrastructure/services/api-service.js.map +1 -1
  111. package/lib/infrastructure/services/auth-service.d.ts +1 -1
  112. package/lib/infrastructure/services/auth-service.js +7 -5
  113. package/lib/infrastructure/services/auth-service.js.map +1 -1
  114. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  115. package/lib/infrastructure/services/file-download-service.js +104 -0
  116. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  117. package/lib/infrastructure/services/portal-service.d.ts +11 -13
  118. package/lib/infrastructure/services/portal-service.js +73 -102
  119. package/lib/infrastructure/services/portal-service.js.map +1 -1
  120. package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
  121. package/lib/infrastructure/services/telemetry-service.js +4 -6
  122. package/lib/infrastructure/services/telemetry-service.js.map +1 -1
  123. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  124. package/lib/infrastructure/services/transformation-service.js +56 -0
  125. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  126. package/lib/infrastructure/services/validation-service.d.ts +17 -0
  127. package/lib/infrastructure/services/validation-service.js +49 -0
  128. package/lib/infrastructure/services/validation-service.js.map +1 -0
  129. package/lib/prompts/api/transform.d.ts +11 -0
  130. package/lib/prompts/api/transform.js +30 -0
  131. package/lib/prompts/api/transform.js.map +1 -0
  132. package/lib/prompts/api/validate.d.ts +12 -0
  133. package/lib/prompts/api/validate.js +41 -0
  134. package/lib/prompts/api/validate.js.map +1 -0
  135. package/lib/prompts/auth/login.d.ts +6 -1
  136. package/lib/prompts/auth/login.js +12 -3
  137. package/lib/prompts/auth/login.js.map +1 -1
  138. package/lib/prompts/auth/logout.d.ts +3 -0
  139. package/lib/prompts/auth/logout.js +7 -0
  140. package/lib/prompts/auth/logout.js.map +1 -0
  141. package/lib/prompts/auth/status.d.ts +8 -0
  142. package/lib/prompts/auth/status.js +21 -0
  143. package/lib/prompts/auth/status.js.map +1 -0
  144. package/lib/prompts/format.d.ts +33 -0
  145. package/lib/prompts/format.js +99 -0
  146. package/lib/prompts/format.js.map +1 -0
  147. package/lib/prompts/portal/copilot.d.ts +8 -4
  148. package/lib/prompts/portal/copilot.js +35 -24
  149. package/lib/prompts/portal/copilot.js.map +1 -1
  150. package/lib/prompts/portal/generate.d.ts +9 -7
  151. package/lib/prompts/portal/generate.js +22 -23
  152. package/lib/prompts/portal/generate.js.map +1 -1
  153. package/lib/prompts/portal/quickstart.d.ts +30 -29
  154. package/lib/prompts/portal/quickstart.js +99 -193
  155. package/lib/prompts/portal/quickstart.js.map +1 -1
  156. package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
  157. package/lib/prompts/portal/recipe/new-recipe.js +70 -108
  158. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
  159. package/lib/prompts/portal/serve.d.ts +10 -3
  160. package/lib/prompts/portal/serve.js +30 -11
  161. package/lib/prompts/portal/serve.js.map +1 -1
  162. package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
  163. package/lib/prompts/portal/toc/new-toc.js +20 -22
  164. package/lib/prompts/portal/toc/new-toc.js.map +1 -1
  165. package/lib/prompts/sdk/generate.d.ts +7 -7
  166. package/lib/prompts/sdk/generate.js +17 -23
  167. package/lib/prompts/sdk/generate.js.map +1 -1
  168. package/lib/types/api/account.d.ts +1 -1
  169. package/lib/types/api/transform.d.ts +14 -25
  170. package/lib/types/api/transform.js +16 -16
  171. package/lib/types/api/transform.js.map +1 -1
  172. package/lib/types/build/build.d.ts +9 -1
  173. package/lib/types/build/build.js +5 -2
  174. package/lib/types/build/build.js.map +1 -1
  175. package/lib/types/build-context.d.ts +5 -1
  176. package/lib/types/build-context.js +21 -4
  177. package/lib/types/build-context.js.map +1 -1
  178. package/lib/types/common/command-metadata.d.ts +4 -0
  179. package/lib/types/common/command-metadata.js +2 -0
  180. package/lib/types/common/command-metadata.js.map +1 -0
  181. package/lib/types/events/domain-event.d.ts +1 -1
  182. package/lib/types/events/domain-event.js.map +1 -1
  183. package/lib/types/events/quickstart-completed.js +1 -1
  184. package/lib/types/events/quickstart-initiated.js +1 -1
  185. package/lib/types/events/recipe-creation-failed.d.ts +1 -1
  186. package/lib/types/events/recipe-creation-failed.js +1 -1
  187. package/lib/types/events/recipe-creation-failed.js.map +1 -1
  188. package/lib/types/events/toc-creation-failed.d.ts +1 -1
  189. package/lib/types/events/toc-creation-failed.js +1 -1
  190. package/lib/types/events/toc-creation-failed.js.map +1 -1
  191. package/lib/types/file/directory.d.ts +17 -0
  192. package/lib/types/file/directory.js +86 -0
  193. package/lib/types/file/directory.js.map +1 -0
  194. package/lib/types/file/directoryPath.d.ts +3 -1
  195. package/lib/types/file/directoryPath.js +8 -2
  196. package/lib/types/file/directoryPath.js.map +1 -1
  197. package/lib/types/file/fileName.d.ts +2 -0
  198. package/lib/types/file/fileName.js +12 -0
  199. package/lib/types/file/fileName.js.map +1 -1
  200. package/lib/types/file/filePath.d.ts +2 -0
  201. package/lib/types/file/filePath.js +21 -0
  202. package/lib/types/file/filePath.js.map +1 -1
  203. package/lib/types/file/resource-input.d.ts +5 -0
  204. package/lib/types/file/resource-input.js +42 -0
  205. package/lib/types/file/resource-input.js.map +1 -0
  206. package/lib/types/file/urlPath.d.ts +6 -0
  207. package/lib/types/file/urlPath.js +22 -0
  208. package/lib/types/file/urlPath.js.map +1 -0
  209. package/lib/types/portal-context.d.ts +3 -1
  210. package/lib/types/portal-context.js +10 -0
  211. package/lib/types/portal-context.js.map +1 -1
  212. package/lib/types/recipe/recipe.d.ts +2 -17
  213. package/lib/types/recipe-context.d.ts +8 -0
  214. package/lib/types/recipe-context.js +21 -0
  215. package/lib/types/recipe-context.js.map +1 -0
  216. package/lib/types/resource-context.d.ts +12 -0
  217. package/lib/types/resource-context.js +30 -0
  218. package/lib/types/resource-context.js.map +1 -0
  219. package/lib/types/sdk/generate.d.ts +2 -15
  220. package/lib/types/sdk/generate.js +24 -10
  221. package/lib/types/sdk/generate.js.map +1 -1
  222. package/lib/types/sdk-context.d.ts +6 -5
  223. package/lib/types/sdk-context.js +12 -8
  224. package/lib/types/sdk-context.js.map +1 -1
  225. package/lib/types/sdl/sdl.d.ts +9 -0
  226. package/lib/types/sdl/sdl.js +46 -1
  227. package/lib/types/sdl/sdl.js.map +1 -1
  228. package/lib/types/spec-context.d.ts +3 -0
  229. package/lib/types/spec-context.js +7 -2
  230. package/lib/types/spec-context.js.map +1 -1
  231. package/lib/types/temp-context.d.ts +11 -0
  232. package/lib/types/temp-context.js +27 -0
  233. package/lib/types/temp-context.js.map +1 -0
  234. package/lib/types/toc-context.d.ts +12 -0
  235. package/lib/types/toc-context.js +26 -0
  236. package/lib/types/toc-context.js.map +1 -0
  237. package/lib/types/transform-context.d.ts +13 -0
  238. package/lib/types/transform-context.js +30 -0
  239. package/lib/types/transform-context.js.map +1 -0
  240. package/lib/types/utils.d.ts +0 -9
  241. package/lib/utils/string-utils.d.ts +1 -0
  242. package/lib/utils/string-utils.js +10 -0
  243. package/lib/utils/string-utils.js.map +1 -0
  244. package/lib/utils/utils.d.ts +2 -27
  245. package/lib/utils/utils.js +6 -145
  246. package/lib/utils/utils.js.map +1 -1
  247. package/package.json +4 -4
  248. package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
  249. package/lib/application/portal/serve/portal-watcher.js +0 -64
  250. package/lib/application/portal/serve/portal-watcher.js.map +0 -1
  251. package/lib/application/portal/serve/serve-handler.d.ts +0 -16
  252. package/lib/application/portal/serve/serve-handler.js +0 -91
  253. package/lib/application/portal/serve/serve-handler.js.map +0 -1
  254. package/lib/application/portal/serve/watcher-handler.js.map +0 -1
  255. package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
  256. package/lib/application/portal/toc/sdl-parser.js +0 -90
  257. package/lib/application/portal/toc/sdl-parser.js.map +0 -1
  258. package/lib/client-utils/sdk-client.d.ts +0 -18
  259. package/lib/client-utils/sdk-client.js +0 -41
  260. package/lib/client-utils/sdk-client.js.map +0 -1
  261. package/lib/config/env.d.ts +0 -26
  262. package/lib/config/env.js +0 -27
  263. package/lib/config/env.js.map +0 -1
  264. package/lib/controllers/api/transform.d.ts +0 -5
  265. package/lib/controllers/api/transform.js +0 -50
  266. package/lib/controllers/api/transform.js.map +0 -1
  267. package/lib/controllers/api/validate.d.ts +0 -3
  268. package/lib/controllers/api/validate.js +0 -29
  269. package/lib/controllers/api/validate.js.map +0 -1
  270. package/lib/controllers/portal/quickstart.d.ts +0 -13
  271. package/lib/controllers/portal/quickstart.js +0 -214
  272. package/lib/controllers/portal/quickstart.js.map +0 -1
  273. package/lib/infrastructure/api-client-utils.d.ts +0 -6
  274. package/lib/infrastructure/api-client-utils.js +0 -34
  275. package/lib/infrastructure/api-client-utils.js.map +0 -1
  276. package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
  277. package/lib/prompts/portal/common/base-prompts.js +0 -19
  278. package/lib/prompts/portal/common/base-prompts.js.map +0 -1
  279. package/lib/types/api/validate.d.ts +0 -12
  280. package/lib/types/api/validate.js +0 -2
  281. package/lib/types/api/validate.js.map +0 -1
  282. package/lib/types/common/result.d.ts +0 -17
  283. package/lib/types/common/result.js +0 -32
  284. package/lib/types/common/result.js.map +0 -1
  285. package/lib/types/portal/generate.d.ts +0 -13
  286. package/lib/types/portal/generate.js +0 -3
  287. package/lib/types/portal/generate.js.map +0 -1
  288. package/lib/types/portal/quickstart.d.ts +0 -17
  289. package/lib/types/portal/quickstart.js +0 -2
  290. package/lib/types/portal/quickstart.js.map +0 -1
  291. package/lib/types/portal/serve.d.ts +0 -12
  292. package/lib/types/portal/serve.js +0 -2
  293. package/lib/types/portal/serve.js.map +0 -1
  294. package/lib/validators/common/directoryValidator.d.ts +0 -5
  295. package/lib/validators/common/directoryValidator.js +0 -22
  296. package/lib/validators/common/directoryValidator.js.map +0 -1
  297. package/lib/validators/portal/serve-validator.d.ts +0 -6
  298. package/lib/validators/portal/serve-validator.js +0 -15
  299. package/lib/validators/portal/serve-validator.js.map +0 -1
@@ -0,0 +1,145 @@
1
+ import { getAuthInfo } from "../../client-utils/auth-manager.js";
2
+ import { FileService } from "../../infrastructure/file-service.js";
3
+ import { withDirPath } from "../../infrastructure/tmp-extensions.js";
4
+ import { ZipService } from "../../infrastructure/zip-service.js";
5
+ import { PortalQuickstartPrompts } from "../../prompts/portal/quickstart.js";
6
+ import { UrlPath } from "../../types/file/urlPath.js";
7
+ import { LoginAction } from "../auth/login.js";
8
+ import { ActionResult } from "../action-result.js";
9
+ import { PortalServeAction } from "./serve.js";
10
+ import { ValidateAction } from "../api/validate.js";
11
+ import { BuildContext } from "../../types/build-context.js";
12
+ import { TempContext } from "../../types/temp-context.js";
13
+ import { FileDownloadService } from "../../infrastructure/services/file-download-service.js";
14
+ import { getLanguagesConfig } from "../../types/build/build.js";
15
+ import { SpecContext } from "../../types/spec-context.js";
16
+ const defaultPort = 3000;
17
+ export class PortalQuickstartAction {
18
+ constructor(configDir, commandMetadata) {
19
+ this.prompts = new PortalQuickstartPrompts();
20
+ this.zipService = new ZipService();
21
+ this.fileService = new FileService();
22
+ this.fileDownloadService = new FileDownloadService();
23
+ this.buildFileUrl = new UrlPath(`https://github.com/apimatic/static-portal-workflow/archive/refs/heads/master.zip`);
24
+ this.defaultSpecUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/static-portal-workflow/refs/heads/master/spec/openapi.json`);
25
+ this.repositoryFolderName = "static-portal-workflow-master";
26
+ this.execute = async () => {
27
+ this.prompts.welcomeMessage();
28
+ const storedAuth = await getAuthInfo(this.configDir.toString());
29
+ if (!(storedAuth === null || storedAuth === void 0 ? void 0 : storedAuth.authKey)) {
30
+ const loginResult = await new LoginAction(this.configDir, this.commandMetadata).execute();
31
+ if (loginResult.isFailed()) {
32
+ return ActionResult.failed();
33
+ }
34
+ }
35
+ return await withDirPath(async (tempDirectory) => {
36
+ // Step 1/4
37
+ this.prompts.importSpecStep();
38
+ let specPath;
39
+ while (!specPath) {
40
+ const inputPath = await this.prompts.specPathPrompt(this.defaultSpecUrl);
41
+ if (!inputPath) {
42
+ this.prompts.noSpecSpecified();
43
+ return ActionResult.cancelled();
44
+ }
45
+ if (inputPath instanceof UrlPath) {
46
+ const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(inputPath));
47
+ if (downloadFileResult.isErr()) {
48
+ this.prompts.serviceError(downloadFileResult.error);
49
+ }
50
+ else {
51
+ const specContext = new SpecContext(tempDirectory);
52
+ specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
53
+ }
54
+ }
55
+ else {
56
+ const fileExists = await this.fileService.fileExists(inputPath);
57
+ if (!fileExists) {
58
+ this.prompts.specFileDoesNotExist();
59
+ }
60
+ else {
61
+ specPath = inputPath;
62
+ }
63
+ }
64
+ }
65
+ // Step 2/4
66
+ this.prompts.validateSpecStep();
67
+ const validateAction = new ValidateAction(this.configDir, this.commandMetadata);
68
+ const validationResult = await validateAction.execute(specPath, false);
69
+ if (validationResult.isFailed()) {
70
+ this.prompts.specValidationFailed();
71
+ if (!(await this.prompts.useDefaultSpecPrompt())) {
72
+ this.prompts.fixYourSpec();
73
+ return ActionResult.cancelled();
74
+ }
75
+ const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(this.defaultSpecUrl));
76
+ if (downloadFileResult.isErr()) {
77
+ this.prompts.serviceError(downloadFileResult.error);
78
+ }
79
+ else {
80
+ const specContext = new SpecContext(tempDirectory);
81
+ specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
82
+ }
83
+ }
84
+ // Step 3/4
85
+ this.prompts.selectLanguagesStep();
86
+ const languages = await this.prompts.selectLanguagesPrompt();
87
+ if (!languages) {
88
+ this.prompts.noLanguagesSelected();
89
+ return ActionResult.cancelled();
90
+ }
91
+ // Step 4/4
92
+ this.prompts.selectInputDirectoryStep();
93
+ let inputDirectory;
94
+ while (true) {
95
+ inputDirectory = await this.prompts.inputDirectoryPathPrompt();
96
+ if (!inputDirectory) {
97
+ this.prompts.noInputDirectoryProvided();
98
+ return ActionResult.cancelled();
99
+ }
100
+ if (!(await this.fileService.directoryExists(inputDirectory))) {
101
+ this.prompts.inputDirectoryPathDoesNotExist(inputDirectory);
102
+ // TODO: Prompt user if he wants to create the directory
103
+ continue;
104
+ }
105
+ if (!(await this.fileService.directoryEmpty(inputDirectory))) {
106
+ this.prompts.inputDirectoryNotEmpty(inputDirectory);
107
+ continue;
108
+ }
109
+ break;
110
+ }
111
+ const masterBuildFile = await this.prompts.downloadBuildDirectory(this.fileDownloadService.downloadFile(this.buildFileUrl));
112
+ if (masterBuildFile.isErr()) {
113
+ this.prompts.serviceError(masterBuildFile.error);
114
+ return ActionResult.failed();
115
+ }
116
+ const tempContext = new TempContext(tempDirectory);
117
+ const masterBuildFilePath = await tempContext.save(masterBuildFile.value.stream);
118
+ await this.zipService.unArchive(masterBuildFilePath, tempDirectory);
119
+ const extractedFolder = tempDirectory.join(this.repositoryFolderName);
120
+ const tempBuildContext = new BuildContext(extractedFolder);
121
+ await tempBuildContext.replaceDefaultSpec(specPath);
122
+ await tempBuildContext.deleteWorkflowDir();
123
+ const buildFile = await tempBuildContext.getBuildFileContents();
124
+ buildFile.generatePortal.languageConfig = getLanguagesConfig(languages);
125
+ await tempBuildContext.updateBuildFileContents(buildFile);
126
+ const sourceDirectory = inputDirectory.join("src");
127
+ await this.fileService.copyDirectoryContents(extractedFolder, sourceDirectory);
128
+ const buildDirectoryStructure = await this.fileService.getDirectory(sourceDirectory);
129
+ this.prompts.printDirectoryStructure(inputDirectory, buildDirectoryStructure);
130
+ const portalDirectory = inputDirectory.join("portal");
131
+ const portalServeAction = new PortalServeAction(this.configDir, this.commandMetadata, null);
132
+ const result = await portalServeAction.execute(sourceDirectory, portalDirectory, defaultPort, true, false, () => {
133
+ this.prompts.nextSteps();
134
+ });
135
+ if (result.isFailed()) {
136
+ return ActionResult.failed();
137
+ }
138
+ return ActionResult.success();
139
+ });
140
+ };
141
+ this.configDir = configDir;
142
+ this.commandMetadata = commandMetadata;
143
+ }
144
+ }
145
+ //# sourceMappingURL=quickstart.js.map
@@ -0,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gB,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;gBAE1D,MAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACnD,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;gBAE/E,MAAM,uBAAuB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;gBACrF,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;gBAE9E,MAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtD,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBAC5F,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;oBAC9G,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;gBAC3B,CAAC,CAAC,CAAC;gBACH,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACtB,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBACD,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAxIA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;CAuIF"}
@@ -1,24 +1,15 @@
1
- import { Result } from "../../../types/common/result.js";
2
1
  import { DirectoryPath } from "../../../types/file/directoryPath.js";
2
+ import { CommandMetadata } from "../../../types/common/command-metadata.js";
3
+ import { ActionResult } from "../../action-result.js";
3
4
  export declare class PortalRecipeAction {
5
+ private readonly configDirectory;
6
+ private readonly commandMetadata;
4
7
  private readonly prompts;
5
- private readonly sdlParser;
6
- private readonly BUILD_FILE_NAME;
7
- constructor();
8
- createRecipe(buildDirectoryPath: DirectoryPath, configDir: string, commandName: string, name?: string): Promise<Result<string, string>>;
9
- private createRecipeFileName;
10
- private toPascalCase;
11
- private validateBuildDirectoryPath;
12
- private promptUserAndBuildNewRecipe;
13
- private promptUserAndAddContentStepToRecipe;
14
- private promptUserAndAddEndpointStepToRecipe;
15
- private parseTocFile;
16
- private createPermalink;
17
- private getBuildConfigFilePath;
18
- private parseBuildConfig;
19
- private checkRecipeAlreadyExists;
20
- private getBuildDirectoryStructure;
21
- private extractEndpointGroupsFromSdl;
22
- private getSpecFolderPath;
23
- private getContentFolderPath;
8
+ private readonly launcherService;
9
+ private readonly fileService;
10
+ private readonly portalService;
11
+ constructor(configDirectory: DirectoryPath, commandMetadata: CommandMetadata);
12
+ execute(buildDirectory: DirectoryPath, name?: string): Promise<ActionResult>;
13
+ private promptForContent;
14
+ private getTocStructure;
24
15
  }
@@ -1,250 +1,176 @@
1
- import * as path from "path";
2
- import fs from "fs";
3
- import fsExtra from "fs-extra";
4
- import { parse } from "yaml";
5
- import { tmpdir } from "os";
6
- import { execa } from "execa";
7
1
  import { PortalRecipePrompts } from "../../../prompts/portal/recipe/new-recipe.js";
8
2
  import { StepType } from "../../../types/recipe/recipe.js";
9
- import { Result } from "../../../types/common/result.js";
3
+ import { PortalService } from "../../../infrastructure/services/portal-service.js";
4
+ import { getEndpointDescription, getEndpointGroupsFromSdl } from "../../../types/sdl/sdl.js";
5
+ import { ActionResult } from "../../action-result.js";
6
+ import { TocContext } from "../../../types/toc-context.js";
7
+ import { FileName } from "../../../types/file/fileName.js";
10
8
  import { PortalRecipe } from "../../../application/portal/recipe/portal-recipe.js";
11
9
  import { PortalRecipeGenerator } from "../../../application/portal/recipe/recipe-generator.js";
12
- import { SdlParser } from "../../../application/portal/toc/sdl-parser.js";
13
- import { PortalService } from "../../../infrastructure/services/portal-service.js";
10
+ import { BuildContext } from "../../../types/build-context.js";
11
+ import { ContentContext } from "../toc/new-toc.js";
12
+ import { SpecContext } from "../../../types/spec-context.js";
13
+ import { LauncherService } from "../../../infrastructure/launcher-service.js";
14
+ import { FileService } from "../../../infrastructure/file-service.js";
15
+ import { FilePath } from "../../../types/file/filePath.js";
16
+ import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
17
+ import { TempContext } from "../../../types/temp-context.js";
18
+ import { RecipeContext } from "../../../types/recipe-context.js";
14
19
  export class PortalRecipeAction {
15
- constructor() {
16
- this.BUILD_FILE_NAME = "APIMATIC-BUILD.json";
20
+ constructor(configDirectory, commandMetadata) {
21
+ this.configDirectory = configDirectory;
22
+ this.commandMetadata = commandMetadata;
17
23
  this.prompts = new PortalRecipePrompts();
18
- this.sdlParser = new SdlParser(new PortalService());
24
+ this.launcherService = new LauncherService();
25
+ this.fileService = new FileService();
26
+ this.portalService = new PortalService();
19
27
  }
20
- async createRecipe(buildDirectoryPath, configDir, commandName, name) {
28
+ async execute(buildDirectory, name) {
21
29
  this.prompts.displayWelcomeMessage();
22
- const recipeName = name !== null && name !== void 0 ? name : (await this.prompts.recipeNamePrompt());
23
- const recipeFileName = this.createRecipeFileName(recipeName);
24
- const validateBuildDirectoryPathResult = await this.validateBuildDirectoryPath(buildDirectoryPath);
25
- if (validateBuildDirectoryPathResult.isFailed()) {
26
- return Result.failure(`Unable to locate a valid "src" directory. Navigate to the directory containing your APIMatic Portal source or set up a new project by running apimatic portal:quickstart.`);
27
- }
28
- //TODO: Create a type for the build config and use that here instead of any.
29
- const buildConfigFilePath = await this.getBuildConfigFilePath(buildDirectoryPath);
30
- const buildConfigResult = await this.parseBuildConfig(buildConfigFilePath);
31
- if (buildConfigResult.isFailed()) {
32
- return Result.failure(`Unable to generate API Recipe: ${buildConfigResult.error}`);
33
- }
34
- const contentFolderPath = this.getContentFolderPath(buildConfigResult.value, buildDirectoryPath);
35
- const tocFilePath = path.join(contentFolderPath, "content", "toc.yml");
36
- //TODO: Replace any type of tocFileResult.value to concrete type.
37
- const tocFileResult = await this.parseTocFile(tocFilePath);
38
- if (tocFileResult.isFailed()) {
39
- return Result.failure(`Unable to generate API Recipe: ${tocFileResult.error}`);
40
- }
41
- const recipeAlreadyExists = this.checkRecipeAlreadyExists(tocFileResult.value, recipeName, recipeFileName);
42
- if (recipeAlreadyExists && !(await this.prompts.overwriteApiRecipeInTocPrompt())) {
43
- return Result.cancelled("Operation was cancelled by the user.");
44
- }
45
- const recipeResult = await this.promptUserAndBuildNewRecipe(buildConfigResult.value, contentFolderPath, recipeName, configDir, commandName);
46
- if (recipeResult.isFailed()) {
47
- return Result.failure(`Unable to generate API Recipe: ${recipeResult.error}`);
30
+ const buildContext = new BuildContext(buildDirectory);
31
+ if (!(await buildContext.validate())) {
32
+ this.prompts.invalidBuildDirectory(buildDirectory);
33
+ return ActionResult.failed();
48
34
  }
49
- const recipeGenerator = new PortalRecipeGenerator();
50
- await recipeGenerator.createRecipe(recipeResult.value, buildConfigResult.value, tocFileResult.value, tocFilePath, recipeName, recipeFileName, buildConfigFilePath, contentFolderPath);
51
- const buildDirectoryStructure = await this.getBuildDirectoryStructure(recipeFileName);
52
- this.prompts.displayBuildDirectoryStructureAsTree(buildDirectoryStructure);
53
- this.prompts.displayRecipeGenerationSuccessMessage(contentFolderPath);
54
- return Result.success("Generated recipe successfully.");
55
- }
56
- createRecipeFileName(recipeName) {
57
- return this.toPascalCase(recipeName.trim());
58
- }
59
- toPascalCase(str) {
60
- return str
61
- .split(" ")
62
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
63
- .join("");
64
- }
65
- async validateBuildDirectoryPath(buildDirectoryPath) {
66
- if (!(await fsExtra.pathExists(buildDirectoryPath.toString()))) {
67
- return Result.failure(`Portal build input folder ${buildDirectoryPath.toString()} does not exist.`);
68
- }
69
- return Result.success("Portal build input folder path validated successfully.");
70
- }
71
- //TODO: Figure out a better way to do this without the while loop.
72
- async promptUserAndBuildNewRecipe(buildConfig, contentFolderPath, recipeName, configDir, commandName) {
35
+ const recipeName = name !== null && name !== void 0 ? name : (await this.prompts.recipeNamePrompt());
36
+ if (!recipeName) {
37
+ this.prompts.recipeNameEmpty();
38
+ return ActionResult.cancelled();
39
+ }
40
+ const contentDirectory = buildDirectory.join("content");
41
+ const contentContext = new ContentContext(contentDirectory);
42
+ if (!(await contentContext.exists())) {
43
+ this.prompts.contentFolderNotFound();
44
+ return ActionResult.failed();
45
+ }
46
+ const specDirectory = buildDirectory.join("spec");
47
+ const specContext = new SpecContext(specDirectory);
48
+ if (!(await specContext.validate())) {
49
+ this.prompts.specFileEmptyInvalid();
50
+ return ActionResult.failed();
51
+ }
52
+ // Setup TOC context
53
+ const tocContext = new TocContext(contentDirectory);
54
+ const tocData = await tocContext.parseTocData();
55
+ // Setup recipe context
56
+ const recipeContext = new RecipeContext(recipeName);
57
+ const recipeFileName = recipeContext.getRecipeName();
58
+ // Check if the recipe already exists
59
+ const recipeAlreadyExists = recipeContext.exists(tocData, recipeName, recipeFileName);
60
+ if (recipeAlreadyExists && !(await this.prompts.overwriteApiRecipeInTocPrompt(recipeName))) {
61
+ return ActionResult.cancelled();
62
+ }
63
+ // Build the recipe
73
64
  const recipe = new PortalRecipe(recipeName);
74
- let endpointGroups;
75
- let idx = 1;
76
- let addAnotherStep = true;
65
+ let stepIndex = 0;
77
66
  this.prompts.displayStepsInformation();
78
- while (addAnotherStep) {
67
+ let endpointGroups;
68
+ do {
79
69
  const stepType = await this.prompts.stepTypeSelectionPrompt();
80
- const stepName = await this.prompts.stepNamePrompt("Step " + idx);
70
+ if (!stepType)
71
+ return ActionResult.cancelled();
72
+ const stepName = await this.prompts.stepNamePrompt(`Step ${++stepIndex}`);
73
+ if (!stepName)
74
+ return ActionResult.cancelled();
81
75
  switch (stepType) {
82
76
  case StepType.Content: {
83
- const addContentStepResult = await this.promptUserAndAddContentStepToRecipe(recipe, stepName);
84
- if (addContentStepResult.isFailed()) {
85
- return Result.failure(addContentStepResult.error);
86
- }
77
+ const contentResult = await this.promptForContent();
78
+ recipe.addContentStep(stepName, contentResult);
79
+ this.prompts.displayStepAddedSuccessfullyMessage();
87
80
  break;
88
81
  }
89
82
  case StepType.Endpoint: {
90
83
  if (!endpointGroups) {
91
- const extractEndpointGroupsFromSdlResult = await this.extractEndpointGroupsFromSdl(buildConfig, contentFolderPath, configDir, commandName);
92
- if (extractEndpointGroupsFromSdlResult.isFailed()) {
93
- return Result.failure(`${extractEndpointGroupsFromSdlResult.error}`);
84
+ const sdlResult = await withDirPath(async (tempDirectory) => {
85
+ const tempContext = new TempContext(tempDirectory);
86
+ const specZipPath = await tempContext.zip(specDirectory);
87
+ const specFileStream = await this.fileService.getStream(specZipPath);
88
+ try {
89
+ return await this.prompts.generateSdl(this.portalService.generateSdl(specFileStream, this.configDirectory, this.commandMetadata));
90
+ }
91
+ finally {
92
+ specFileStream.close();
93
+ }
94
+ });
95
+ if (sdlResult.isErr()) {
96
+ this.prompts.serviceError(sdlResult.error);
97
+ return ActionResult.failed();
94
98
  }
95
- endpointGroups = extractEndpointGroupsFromSdlResult.value;
99
+ endpointGroups = getEndpointGroupsFromSdl(sdlResult.value);
96
100
  }
97
- await this.promptUserAndAddEndpointStepToRecipe(recipe, endpointGroups, stepName);
101
+ const endpointGroupName = await this.prompts.endpointGroupNamePrompt(endpointGroups);
102
+ if (!endpointGroupName)
103
+ return ActionResult.cancelled();
104
+ const endpointName = await this.prompts.endpointNamePrompt(endpointGroups, endpointGroupName);
105
+ if (!endpointName)
106
+ return ActionResult.cancelled();
107
+ const defaultDescription = getEndpointDescription(endpointGroups, endpointGroupName, endpointName);
108
+ const description = await this.prompts.endpointDescriptionPrompt(defaultDescription);
109
+ if (!description)
110
+ return ActionResult.cancelled();
111
+ recipe.addEndpointStep(stepName, description, endpointGroupName, endpointName);
112
+ this.prompts.displayStepAddedSuccessfullyMessage();
98
113
  break;
99
114
  }
100
115
  }
101
- addAnotherStep = await this.prompts.addAnotherStepSelectionPrompt();
102
- idx++;
103
- }
104
- return Result.success(recipe.toSerializableRecipe());
105
- }
106
- async promptUserAndAddContentStepToRecipe(recipe, stepName) {
107
- this.prompts.displayContentStepInfo();
108
- let editor = process.env.EDITOR;
109
- let editorArgs = [];
110
- const tempFilePath = path.join(tmpdir(), `recipe-markdown-content-${Date.now()}.txt`);
111
- const template = `# The Heading Goes Here\n\nThis is placeholder text for your API Recipe content step. Feel free to edit this. Save your changes and then close the file once you're done.`;
112
- await fsExtra.writeFile(tempFilePath, template, "utf-8");
113
- try {
114
- if (!editor) {
115
- if (process.platform === "win32") {
116
- await execa("cmd", ["/c", "start", "/wait", "notepad", tempFilePath], { stdio: "ignore" });
117
- }
118
- else if (process.platform === "darwin" || process.platform === "linux") {
119
- editor = "vim";
120
- try {
121
- await execa(editor, [tempFilePath], { stdio: "inherit" });
122
- }
123
- catch (_a) {
124
- // User exiting vim can throw a non-zero exit code leading to exception, ignore it.
125
- }
126
- }
127
- }
128
- else {
129
- if (editor === "code" || editor.endsWith("code.cmd") || editor.endsWith("code.exe")) {
130
- editorArgs.push("--wait");
131
- }
132
- editorArgs.push(tempFilePath);
133
- await execa(editor, editorArgs, { stdio: "ignore" });
134
- }
135
- const fileContent = await fsExtra.readFile(tempFilePath, "utf-8");
136
- recipe.addContentStep(stepName, stepName, fileContent);
137
- this.prompts.displayStepAddedSuccessfullyMessage();
138
- return Result.success("Added content step successfully.");
139
- }
140
- catch (error) {
141
- return Result.failure(`Unable to add content step. Please try again later.`);
142
- }
143
- finally {
144
- await fsExtra.unlink(tempFilePath);
145
- }
146
- }
147
- async promptUserAndAddEndpointStepToRecipe(recipe, endpointGroups, stepName) {
148
- const endpointGroupName = await this.prompts.endpointGroupNamePrompt(endpointGroups);
149
- const endpointName = await this.prompts.endpointNamePrompt(endpointGroups, endpointGroupName);
150
- const description = await this.prompts.endpointDescriptionPrompt(endpointGroups, endpointGroupName, endpointName);
151
- const endpointPermalink = await this.createPermalink([endpointGroupName, endpointName]);
152
- recipe.addEndpointStep(stepName, stepName, description, endpointPermalink);
153
- this.prompts.displayStepAddedSuccessfullyMessage();
154
- }
155
- //TODO: Replace any with concrete toc file object.
156
- async parseTocFile(tocFilePath) {
157
- // Check if the file exists
158
- if (!fs.existsSync(tocFilePath)) {
159
- return Result.failure(`toc.yml file not found at ${tocFilePath}. Please run 'apimatic:toc:new' to create your toc.yml file first.`);
160
- }
161
- try {
162
- const tocContent = await fs.promises.readFile(tocFilePath, "utf-8");
163
- return Result.success(parse(tocContent));
164
- }
165
- catch (_a) {
166
- return Result.failure(`Unable to parse the toc.yml file located at ${tocFilePath}. Please make sure that the toc.yml is a valid YAML file.`);
167
- }
168
- }
169
- async createPermalink(pathPieces) {
170
- return `$e/${pathPieces.map(encodeURIComponent).join("/")}`;
171
- }
172
- async getBuildConfigFilePath(buildDirectoryPath) {
173
- const files = await fs.promises.readdir(buildDirectoryPath.toString());
174
- const buildFileExists = files.find((file) => file === this.BUILD_FILE_NAME);
175
- if (!buildFileExists) {
176
- return await this.prompts.buildConfigFilePathPrompt(buildDirectoryPath.toString());
177
- }
178
- return path.join(buildDirectoryPath.toString(), this.BUILD_FILE_NAME);
179
- }
180
- //TODO: Create a type for the build config and use that here instead of any.
181
- async parseBuildConfig(buildConfigFilePath) {
182
- try {
183
- const fileData = await fs.promises.readFile(buildConfigFilePath, "utf-8");
184
- return Result.success(JSON.parse(fileData));
185
- }
186
- catch (_a) {
187
- return Result.failure(`There was an error parsing the build config file located at "${buildConfigFilePath}". Please check your build config file and try again later.`);
188
- }
189
- }
190
- checkRecipeAlreadyExists(tocData, recipeName, recipeFileName) {
191
- var _a;
192
- let apiRecipesGroup = (_a = tocData.toc) === null || _a === void 0 ? void 0 : _a.find((item) => item.group === "API Recipes");
193
- if (!apiRecipesGroup) {
194
- return false;
195
- }
196
- // Check if recipe name or file name already exists
197
- const existingRecipe = apiRecipesGroup.items.find((item) => item.page === recipeName || item.file === `recipes/${recipeFileName}.md`);
198
- if (existingRecipe) {
199
- return true;
200
- }
201
- return false;
202
- }
203
- async getBuildDirectoryStructure(recipeFileName) {
116
+ } while (await this.prompts.addAnotherStepSelectionPrompt());
117
+ const serializableRecipe = recipe.toSerializableRecipe();
118
+ // Generate the recipe
119
+ const recipeGenerator = new PortalRecipeGenerator();
120
+ await recipeGenerator.createRecipe(serializableRecipe, tocData, tocContext.tocPath, recipeName, recipeFileName, buildContext, buildDirectory);
121
+ const tocStructure = this.getTocStructure(recipeFileName);
122
+ this.prompts.recipeCreated();
123
+ this.prompts.displayRecipeStructure(tocStructure);
124
+ this.prompts.nextSteps();
125
+ return ActionResult.success();
126
+ }
127
+ async promptForContent() {
128
+ return await withDirPath(async (tempDir) => {
129
+ const tempFile = new FilePath(tempDir, new FileName(`recipe-markdown-content.md`));
130
+ const defaultContent = "# The Heading Goes Here\n\n" +
131
+ "This is placeholder text for your API Recipe content step. " +
132
+ "Feel free to edit this. Save your changes and then close the file once you're done.";
133
+ await this.fileService.writeContents(tempFile, defaultContent);
134
+ this.prompts.openRecipeMarkdownEditor();
135
+ await this.launcherService.openInEditor(tempFile);
136
+ const fileContent = await this.fileService.getContents(tempFile);
137
+ return fileContent.replace(/\r\n|\r/g, "\n");
138
+ });
139
+ }
140
+ getTocStructure(recipeFileName) {
204
141
  return {
205
- content: {
206
- "toc.yml : # Contains the API Recipes group with a new page for your API recipe": null
207
- },
208
- static: {
209
- scripts: {
210
- recipes: {
211
- [`${recipeFileName}.js : # Generated recipe script file containing all of the steps`]: null
212
- }
142
+ name: "src",
143
+ items: [
144
+ {
145
+ name: "content",
146
+ items: [
147
+ {
148
+ name: "toc.yml",
149
+ description: "# Contains the API Recipes group with a new page for your API recipe"
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ name: "static",
155
+ items: [
156
+ {
157
+ name: "scripts",
158
+ items: [
159
+ {
160
+ name: "recipes",
161
+ items: [
162
+ {
163
+ name: `${recipeFileName}`,
164
+ description: "# Generated recipe script file containing all of the steps"
165
+ }
166
+ ]
167
+ }
168
+ ]
169
+ }
170
+ ]
213
171
  }
214
- }
172
+ ]
215
173
  };
216
174
  }
217
- async extractEndpointGroupsFromSdl(buildConfig, contentFolderPath, configDir, commandName) {
218
- const specFolderPath = this.getSpecFolderPath(buildConfig, contentFolderPath);
219
- if (!(await fsExtra.pathExists(specFolderPath))) {
220
- return Result.failure(`API specification file not found at ${specFolderPath}.`);
221
- }
222
- this.prompts.startProgressIndicatorWithMessage("Extracting endpoint groups and endpoints from the API specification.");
223
- const endpointGroupsResult = await this.sdlParser.getEndpointGroupsFromSdl(specFolderPath, configDir, commandName);
224
- if (endpointGroupsResult.isFailed()) {
225
- this.prompts.stopProgressIndicatorWithMessage("Unable to extract endpoints from your API specification.");
226
- return Result.failure(`${endpointGroupsResult.error}`);
227
- }
228
- this.prompts.stopProgressIndicatorWithMessage("Successfully extracted endpoint groups and endpoints from the API specification.");
229
- return Result.success(endpointGroupsResult.value);
230
- }
231
- //TODO: Replace type of buildConfig from any to actual BuildConfig type after creating it.
232
- getSpecFolderPath(buildConfig, contentFolderPath) {
233
- var _a;
234
- const apiSpecPath = (_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.apiSpecPath;
235
- if (apiSpecPath) {
236
- return path.join(contentFolderPath, apiSpecPath);
237
- }
238
- return path.join(contentFolderPath, "spec");
239
- }
240
- //TODO: Replace type of buildConfig from any to actual BuildConfig type after creating it.
241
- getContentFolderPath(buildConfig, buildDirectoryPath) {
242
- var _a;
243
- const contentFolder = (_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder;
244
- if (contentFolder) {
245
- return path.join(buildDirectoryPath.toString(), contentFolder);
246
- }
247
- return buildDirectoryPath.toString();
248
- }
249
175
  }
250
176
  //# sourceMappingURL=new-recipe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"new-recipe.js","sourceRoot":"","sources":["../../../../src/actions/portal/recipe/new-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,KA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