@apimatic/cli 1.1.0-alpha.9 → 1.1.0-beta.2

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 (337) hide show
  1. package/README.md +436 -374
  2. package/bin/run.js +5 -0
  3. package/lib/actions/action-result.d.ts +13 -0
  4. package/lib/actions/action-result.js +44 -0
  5. package/lib/actions/action-result.js.map +1 -0
  6. package/lib/actions/api/transform.d.ts +15 -0
  7. package/lib/actions/api/transform.js +48 -0
  8. package/lib/actions/api/transform.js.map +1 -0
  9. package/lib/actions/api/validate.d.ts +12 -0
  10. package/lib/actions/api/validate.js +41 -0
  11. package/lib/actions/api/validate.js.map +1 -0
  12. package/lib/actions/auth/login.d.ts +13 -0
  13. package/lib/actions/auth/login.js +55 -0
  14. package/lib/actions/auth/login.js.map +1 -0
  15. package/lib/actions/auth/logout.d.ts +8 -0
  16. package/lib/actions/auth/logout.js +15 -0
  17. package/lib/actions/auth/logout.js.map +1 -0
  18. package/lib/actions/auth/status.d.ts +11 -0
  19. package/lib/actions/auth/status.js +26 -0
  20. package/lib/actions/auth/status.js.map +1 -0
  21. package/lib/actions/portal/copilot.d.ts +16 -0
  22. package/lib/actions/portal/copilot.js +89 -0
  23. package/lib/actions/portal/copilot.js.map +1 -0
  24. package/lib/actions/portal/generate.d.ts +11 -5
  25. package/lib/actions/portal/generate.js +60 -55
  26. package/lib/actions/portal/generate.js.map +1 -0
  27. package/lib/actions/portal/quickstart.d.ts +16 -0
  28. package/lib/actions/portal/quickstart.js +146 -0
  29. package/lib/actions/portal/quickstart.js.map +1 -0
  30. package/lib/actions/portal/recipe/new-recipe.d.ts +15 -0
  31. package/lib/actions/portal/recipe/new-recipe.js +177 -0
  32. package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
  33. package/lib/actions/portal/serve.d.ts +15 -0
  34. package/lib/actions/portal/serve.js +118 -0
  35. package/lib/actions/portal/serve.js.map +1 -0
  36. package/lib/actions/portal/toc/new-toc.d.ts +17 -13
  37. package/lib/actions/portal/toc/new-toc.js +85 -122
  38. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  39. package/lib/actions/quickstart.d.ts +10 -0
  40. package/lib/actions/quickstart.js +30 -0
  41. package/lib/actions/quickstart.js.map +1 -0
  42. package/lib/actions/sdk/generate.d.ts +13 -0
  43. package/lib/actions/sdk/generate.js +47 -0
  44. package/lib/actions/sdk/generate.js.map +1 -0
  45. package/lib/actions/sdk/quickstart.d.ts +14 -0
  46. package/lib/actions/sdk/quickstart.js +149 -0
  47. package/lib/actions/sdk/quickstart.js.map +1 -0
  48. package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
  49. package/lib/application/portal/recipe/portal-recipe.js +33 -0
  50. package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
  51. package/lib/application/portal/recipe/recipe-generator.d.ts +21 -0
  52. package/lib/application/portal/recipe/recipe-generator.js +145 -0
  53. package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
  54. package/lib/application/portal/toc/toc-content-parser.d.ts +1 -1
  55. package/lib/application/portal/toc/toc-content-parser.js +9 -11
  56. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  57. package/lib/application/portal/toc/toc-structure-generator.d.ts +1 -1
  58. package/lib/application/portal/toc/toc-structure-generator.js +4 -8
  59. package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
  60. package/lib/client-utils/auth-manager.d.ts +7 -2
  61. package/lib/client-utils/auth-manager.js +26 -14
  62. package/lib/client-utils/auth-manager.js.map +1 -0
  63. package/lib/commands/api/transform.d.ts +10 -7
  64. package/lib/commands/api/transform.js +51 -111
  65. package/lib/commands/api/transform.js.map +1 -0
  66. package/lib/commands/api/validate.d.ts +7 -4
  67. package/lib/commands/api/validate.js +31 -74
  68. package/lib/commands/api/validate.js.map +1 -0
  69. package/lib/commands/auth/login.d.ts +3 -1
  70. package/lib/commands/auth/login.js +26 -68
  71. package/lib/commands/auth/login.js.map +1 -0
  72. package/lib/commands/auth/logout.d.ts +3 -1
  73. package/lib/commands/auth/logout.js +14 -21
  74. package/lib/commands/auth/logout.js.map +1 -0
  75. package/lib/commands/auth/status.d.ts +1 -0
  76. package/lib/commands/auth/status.js +18 -21
  77. package/lib/commands/auth/status.js.map +1 -0
  78. package/lib/commands/portal/copilot.d.ts +13 -0
  79. package/lib/commands/portal/copilot.js +34 -0
  80. package/lib/commands/portal/copilot.js.map +1 -0
  81. package/lib/commands/portal/generate.d.ts +7 -11
  82. package/lib/commands/portal/generate.js +26 -89
  83. package/lib/commands/portal/generate.js.map +1 -0
  84. package/lib/commands/portal/recipe/new.d.ts +12 -0
  85. package/lib/commands/portal/recipe/new.js +45 -0
  86. package/lib/commands/portal/recipe/new.js.map +1 -0
  87. package/lib/commands/portal/serve.d.ts +8 -8
  88. package/lib/commands/portal/serve.js +41 -125
  89. package/lib/commands/portal/serve.js.map +1 -0
  90. package/lib/commands/portal/toc/new.d.ts +5 -6
  91. package/lib/commands/portal/toc/new.js +45 -50
  92. package/lib/commands/portal/toc/new.js.map +1 -0
  93. package/lib/commands/quickstart.d.ts +9 -0
  94. package/lib/commands/quickstart.js +37 -0
  95. package/lib/commands/quickstart.js.map +1 -0
  96. package/lib/commands/sdk/generate.d.ts +10 -8
  97. package/lib/commands/sdk/generate.js +46 -131
  98. package/lib/commands/sdk/generate.js.map +1 -0
  99. package/lib/config/axios-config.js +4 -6
  100. package/lib/config/axios-config.js.map +1 -0
  101. package/lib/hooks/not-found.d.ts +3 -0
  102. package/lib/hooks/not-found.js +52 -0
  103. package/lib/hooks/not-found.js.map +1 -0
  104. package/lib/hooks/utils.d.ts +5 -0
  105. package/lib/hooks/utils.js +51 -0
  106. package/lib/hooks/utils.js.map +1 -0
  107. package/lib/index.js +2 -5
  108. package/lib/index.js.map +1 -0
  109. package/lib/infrastructure/debounce-service.d.ts +10 -0
  110. package/lib/infrastructure/debounce-service.js +52 -0
  111. package/lib/infrastructure/debounce-service.js.map +1 -0
  112. package/lib/infrastructure/env-info.d.ts +12 -0
  113. package/lib/infrastructure/env-info.js +58 -0
  114. package/lib/infrastructure/env-info.js.map +1 -0
  115. package/lib/infrastructure/file-service.d.ts +24 -0
  116. package/lib/infrastructure/file-service.js +120 -0
  117. package/lib/infrastructure/file-service.js.map +1 -0
  118. package/lib/infrastructure/launcher-service.d.ts +9 -0
  119. package/lib/infrastructure/launcher-service.js +72 -0
  120. package/lib/infrastructure/launcher-service.js.map +1 -0
  121. package/lib/infrastructure/network-service.d.ts +3 -0
  122. package/lib/infrastructure/network-service.js +7 -0
  123. package/lib/infrastructure/network-service.js.map +1 -0
  124. package/lib/infrastructure/service-error.d.ts +16 -0
  125. package/lib/infrastructure/service-error.js +49 -0
  126. package/lib/infrastructure/service-error.js.map +1 -0
  127. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  128. package/lib/infrastructure/services/api-client-factory.js +20 -0
  129. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  130. package/lib/infrastructure/services/api-service.d.ts +12 -0
  131. package/lib/infrastructure/services/api-service.js +79 -0
  132. package/lib/infrastructure/services/api-service.js.map +1 -0
  133. package/lib/infrastructure/services/auth-service.d.ts +11 -0
  134. package/lib/infrastructure/services/auth-service.js +37 -0
  135. package/lib/infrastructure/services/auth-service.js.map +1 -0
  136. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  137. package/lib/infrastructure/services/file-download-service.js +104 -0
  138. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  139. package/lib/infrastructure/services/portal-service.d.ts +17 -12
  140. package/lib/infrastructure/services/portal-service.js +134 -99
  141. package/lib/infrastructure/services/portal-service.js.map +1 -0
  142. package/lib/infrastructure/services/telemetry-service.d.ts +9 -0
  143. package/lib/infrastructure/services/telemetry-service.js +38 -0
  144. package/lib/infrastructure/services/telemetry-service.js.map +1 -0
  145. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  146. package/lib/infrastructure/services/transformation-service.js +56 -0
  147. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  148. package/lib/infrastructure/services/validation-service.d.ts +17 -0
  149. package/lib/infrastructure/services/validation-service.js +49 -0
  150. package/lib/infrastructure/services/validation-service.js.map +1 -0
  151. package/lib/infrastructure/tmp-extensions.d.ts +2 -0
  152. package/lib/infrastructure/tmp-extensions.js +6 -0
  153. package/lib/infrastructure/tmp-extensions.js.map +1 -0
  154. package/lib/infrastructure/zip-service.d.ts +6 -0
  155. package/lib/infrastructure/zip-service.js +39 -0
  156. package/lib/infrastructure/zip-service.js.map +1 -0
  157. package/lib/prompts/api/transform.d.ts +11 -0
  158. package/lib/prompts/api/transform.js +29 -0
  159. package/lib/prompts/api/transform.js.map +1 -0
  160. package/lib/prompts/api/validate.d.ts +12 -0
  161. package/lib/prompts/api/validate.js +40 -0
  162. package/lib/prompts/api/validate.js.map +1 -0
  163. package/lib/prompts/auth/login.d.ts +10 -0
  164. package/lib/prompts/auth/login.js +22 -0
  165. package/lib/prompts/auth/login.js.map +1 -0
  166. package/lib/prompts/auth/logout.d.ts +3 -0
  167. package/lib/prompts/auth/logout.js +7 -0
  168. package/lib/prompts/auth/logout.js.map +1 -0
  169. package/lib/prompts/auth/status.d.ts +8 -0
  170. package/lib/prompts/auth/status.js +22 -0
  171. package/lib/prompts/auth/status.js.map +1 -0
  172. package/lib/prompts/format.d.ts +31 -0
  173. package/lib/prompts/format.js +89 -0
  174. package/lib/prompts/format.js.map +1 -0
  175. package/lib/prompts/portal/copilot.d.ts +18 -0
  176. package/lib/prompts/portal/copilot.js +82 -0
  177. package/lib/prompts/portal/copilot.js.map +1 -0
  178. package/lib/prompts/portal/generate.d.ts +13 -8
  179. package/lib/prompts/portal/generate.js +36 -53
  180. package/lib/prompts/portal/generate.js.map +1 -0
  181. package/lib/prompts/portal/quickstart.d.ts +28 -29
  182. package/lib/prompts/portal/quickstart.js +102 -185
  183. package/lib/prompts/portal/quickstart.js.map +1 -0
  184. package/lib/prompts/portal/recipe/new-recipe.d.ts +29 -0
  185. package/lib/prompts/portal/recipe/new-recipe.js +165 -0
  186. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
  187. package/lib/prompts/portal/serve.d.ts +9 -5
  188. package/lib/prompts/portal/serve.js +29 -19
  189. package/lib/prompts/portal/serve.js.map +1 -0
  190. package/lib/prompts/portal/toc/new-toc.d.ts +13 -8
  191. package/lib/prompts/portal/toc/new-toc.js +28 -36
  192. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  193. package/lib/prompts/prompt.d.ts +3 -0
  194. package/lib/prompts/prompt.js +37 -0
  195. package/lib/prompts/prompt.js.map +1 -0
  196. package/lib/prompts/quickstart.d.ts +6 -0
  197. package/lib/prompts/quickstart.js +25 -0
  198. package/lib/prompts/quickstart.js.map +1 -0
  199. package/lib/prompts/sdk/generate.d.ts +11 -0
  200. package/lib/prompts/sdk/generate.js +37 -0
  201. package/lib/prompts/sdk/generate.js.map +1 -0
  202. package/lib/prompts/sdk/quickstart.d.ts +32 -0
  203. package/lib/prompts/sdk/quickstart.js +140 -0
  204. package/lib/prompts/sdk/quickstart.js.map +1 -0
  205. package/lib/types/api/account.d.ts +10 -0
  206. package/lib/types/api/account.js +2 -0
  207. package/lib/types/api/account.js.map +1 -0
  208. package/lib/types/api/transform.d.ts +14 -25
  209. package/lib/types/api/transform.js +20 -23
  210. package/lib/types/api/transform.js.map +1 -0
  211. package/lib/types/build/build.d.ts +22 -0
  212. package/lib/types/build/build.js +7 -0
  213. package/lib/types/build/build.js.map +1 -0
  214. package/lib/types/build-context.d.ts +13 -0
  215. package/lib/types/build-context.js +33 -0
  216. package/lib/types/build-context.js.map +1 -0
  217. package/lib/types/common/command-metadata.d.ts +4 -0
  218. package/lib/types/common/command-metadata.js +2 -0
  219. package/lib/types/common/command-metadata.js.map +1 -0
  220. package/lib/types/events/domain-event.d.ts +8 -0
  221. package/lib/types/events/domain-event.js +11 -0
  222. package/lib/types/events/domain-event.js.map +1 -0
  223. package/lib/types/events/quickstart-completed.d.ts +7 -0
  224. package/lib/types/events/quickstart-completed.js +10 -0
  225. package/lib/types/events/quickstart-completed.js.map +1 -0
  226. package/lib/types/events/quickstart-initiated.d.ts +7 -0
  227. package/lib/types/events/quickstart-initiated.js +10 -0
  228. package/lib/types/events/quickstart-initiated.js.map +1 -0
  229. package/lib/types/events/recipe-creation-failed.d.ts +5 -0
  230. package/lib/types/events/recipe-creation-failed.js +8 -0
  231. package/lib/types/events/recipe-creation-failed.js.map +1 -0
  232. package/lib/types/events/toc-creation-failed.d.ts +5 -0
  233. package/lib/types/events/toc-creation-failed.js +8 -0
  234. package/lib/types/events/toc-creation-failed.js.map +1 -0
  235. package/lib/types/file/directory.d.ts +17 -0
  236. package/lib/types/file/directory.js +87 -0
  237. package/lib/types/file/directory.js.map +1 -0
  238. package/lib/types/file/directoryPath.d.ts +10 -0
  239. package/lib/types/file/directoryPath.js +26 -0
  240. package/lib/types/file/directoryPath.js.map +1 -0
  241. package/lib/types/file/fileName.d.ts +7 -0
  242. package/lib/types/file/fileName.js +21 -0
  243. package/lib/types/file/fileName.js.map +1 -0
  244. package/lib/types/file/filePath.d.ts +10 -0
  245. package/lib/types/file/filePath.js +32 -0
  246. package/lib/types/file/filePath.js.map +1 -0
  247. package/lib/types/file/resource-input.d.ts +5 -0
  248. package/lib/types/file/resource-input.js +42 -0
  249. package/lib/types/file/resource-input.js.map +1 -0
  250. package/lib/types/file/urlPath.d.ts +6 -0
  251. package/lib/types/file/urlPath.js +22 -0
  252. package/lib/types/file/urlPath.js.map +1 -0
  253. package/lib/types/flags-provider.d.ts +15 -0
  254. package/lib/types/flags-provider.js +34 -0
  255. package/lib/types/flags-provider.js.map +1 -0
  256. package/lib/types/portal-context.d.ts +13 -0
  257. package/lib/types/portal-context.js +38 -0
  258. package/lib/types/portal-context.js.map +1 -0
  259. package/lib/types/recipe/recipe.d.ts +22 -0
  260. package/lib/types/recipe/recipe.js +6 -0
  261. package/lib/types/recipe/recipe.js.map +1 -0
  262. package/lib/types/recipe-context.d.ts +9 -0
  263. package/lib/types/recipe-context.js +26 -0
  264. package/lib/types/recipe-context.js.map +1 -0
  265. package/lib/types/resource-context.d.ts +12 -0
  266. package/lib/types/resource-context.js +30 -0
  267. package/lib/types/resource-context.js.map +1 -0
  268. package/lib/types/sdk/generate.d.ts +9 -22
  269. package/lib/types/sdk/generate.js +25 -14
  270. package/lib/types/sdk/generate.js.map +1 -0
  271. package/lib/types/sdk-context.d.ts +14 -0
  272. package/lib/types/sdk-context.js +32 -0
  273. package/lib/types/sdk-context.js.map +1 -0
  274. package/lib/types/sdl/sdl.d.ts +10 -0
  275. package/lib/types/sdl/sdl.js +47 -3
  276. package/lib/types/sdl/sdl.js.map +1 -0
  277. package/lib/types/spec-context.d.ts +12 -0
  278. package/lib/types/spec-context.js +29 -0
  279. package/lib/types/spec-context.js.map +1 -0
  280. package/lib/types/temp-context.d.ts +11 -0
  281. package/lib/types/temp-context.js +27 -0
  282. package/lib/types/temp-context.js.map +1 -0
  283. package/lib/types/toc/toc.js +2 -10
  284. package/lib/types/toc/toc.js.map +1 -0
  285. package/lib/types/toc-context.d.ts +12 -0
  286. package/lib/types/toc-context.js +26 -0
  287. package/lib/types/toc-context.js.map +1 -0
  288. package/lib/types/transform-context.d.ts +13 -0
  289. package/lib/types/transform-context.js +30 -0
  290. package/lib/types/transform-context.js.map +1 -0
  291. package/lib/types/utils.d.ts +0 -9
  292. package/lib/types/utils.js +2 -3
  293. package/lib/types/utils.js.map +1 -0
  294. package/lib/utils/string-utils.d.ts +2 -0
  295. package/lib/utils/string-utils.js +37 -0
  296. package/lib/utils/string-utils.js.map +1 -0
  297. package/lib/utils/utils.d.ts +2 -44
  298. package/lib/utils/utils.js +14 -366
  299. package/lib/utils/utils.js.map +1 -0
  300. package/package.json +50 -31
  301. package/bin/run +0 -9
  302. package/lib/application/portal/toc/sdl-parser.d.ts +0 -13
  303. package/lib/application/portal/toc/sdl-parser.js +0 -53
  304. package/lib/client-utils/sdk-client.d.ts +0 -23
  305. package/lib/client-utils/sdk-client.js +0 -124
  306. package/lib/commands/portal/quickstart.d.ts +0 -10
  307. package/lib/commands/portal/quickstart.js +0 -79
  308. package/lib/config/env.d.ts +0 -27
  309. package/lib/config/env.js +0 -31
  310. package/lib/controllers/api/transform.d.ts +0 -5
  311. package/lib/controllers/api/transform.js +0 -56
  312. package/lib/controllers/api/validate.d.ts +0 -3
  313. package/lib/controllers/api/validate.js +0 -33
  314. package/lib/controllers/portal/generate.d.ts +0 -3
  315. package/lib/controllers/portal/generate.js +0 -110
  316. package/lib/controllers/portal/quickstart.d.ts +0 -14
  317. package/lib/controllers/portal/quickstart.js +0 -258
  318. package/lib/controllers/portal/serve.d.ts +0 -3
  319. package/lib/controllers/portal/serve.js +0 -138
  320. package/lib/controllers/sdk/generate.d.ts +0 -4
  321. package/lib/controllers/sdk/generate.js +0 -66
  322. package/lib/services/portal/server.d.ts +0 -14
  323. package/lib/services/portal/server.js +0 -101
  324. package/lib/types/api/validate.d.ts +0 -12
  325. package/lib/types/api/validate.js +0 -3
  326. package/lib/types/common/result.d.ts +0 -17
  327. package/lib/types/common/result.js +0 -36
  328. package/lib/types/portal/generate.d.ts +0 -26
  329. package/lib/types/portal/generate.js +0 -4
  330. package/lib/types/portal/quickstart.d.ts +0 -17
  331. package/lib/types/portal/quickstart.js +0 -3
  332. package/lib/validators/common/directoryValidator.d.ts +0 -9
  333. package/lib/validators/common/directoryValidator.js +0 -53
  334. package/lib/validators/common/portValidator.d.ts +0 -5
  335. package/lib/validators/common/portValidator.js +0 -20
  336. package/lib/validators/portal/serveValidator.d.ts +0 -6
  337. package/lib/validators/portal/serveValidator.js +0 -21
@@ -1,134 +1,97 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PortalNewTocAction = void 0;
4
- const path = require("path");
5
- const fs = require("fs-extra");
6
- const new_toc_1 = require("../../../prompts/portal/toc/new-toc");
7
- const result_1 = require("../../../types/common/result");
8
- const utils_1 = require("../../../utils/utils");
9
- const sdl_parser_1 = require("../../../application/portal/toc/sdl-parser");
10
- const toc_structure_generator_1 = require("../../../application/portal/toc/toc-structure-generator");
11
- const toc_content_parser_1 = require("../../../application/portal/toc/toc-content-parser");
12
- const portal_service_1 = require("../../../infrastructure/services/portal-service");
13
- const DEFAULT_TOC_FILENAME = "toc.yml";
14
- const APIMATIC_BUILD_FILENAME = "APIMATIC-BUILD.json";
15
- class PortalNewTocAction {
16
- constructor() {
17
- this.prompts = new new_toc_1.PortalNewTocPrompts();
18
- this.sdlParser = new sdl_parser_1.SdlParser(new portal_service_1.PortalService());
19
- this.tocGenerator = new toc_structure_generator_1.TocStructureGenerator();
20
- this.contentParser = new toc_content_parser_1.TocContentParser();
1
+ import { ok } from "neverthrow";
2
+ import { PortalNewTocPrompts } from "../../../prompts/portal/toc/new-toc.js";
3
+ import { TocStructureGenerator } from "../../../application/portal/toc/toc-structure-generator.js";
4
+ import { ActionResult } from "../../action-result.js";
5
+ import { TocContext } from "../../../types/toc-context.js";
6
+ import { FileService } from "../../../infrastructure/file-service.js";
7
+ import { BuildContext } from "../../../types/build-context.js";
8
+ import { getEndpointGroupsAndModels } from "../../../types/sdl/sdl.js";
9
+ import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
10
+ import { TempContext } from "../../../types/temp-context.js";
11
+ import { PortalService } from "../../../infrastructure/services/portal-service.js";
12
+ export class ContentContext {
13
+ constructor(contentDirectory) {
14
+ this.contentDirectory = contentDirectory;
15
+ this.fileService = new FileService();
21
16
  }
22
- async createToc(workingDirectory, configDir, destination, force = false, expandEndpoints = false, expandModels = false) {
23
- try {
24
- const tocDir = await this.getDestinationPath(workingDirectory, destination);
25
- const tocPath = path.join(tocDir, DEFAULT_TOC_FILENAME);
26
- const tocCheckResult = await this.handleExistingToc(tocPath, force);
27
- if (!tocCheckResult.isSuccess()) {
28
- return tocCheckResult;
29
- }
30
- const { endpointGroups, models } = await this.extractSdlComponents(workingDirectory, configDir, expandEndpoints, expandModels);
31
- const contentGroups = await this.extractContentGroups(workingDirectory);
32
- const toc = this.tocGenerator.createTocStructure(endpointGroups, models, expandEndpoints, expandModels, contentGroups);
33
- const yamlString = this.tocGenerator.transformToYaml(toc);
34
- await this.writeToc(tocPath, yamlString, "utf8");
35
- this.prompts.displayOutroMessage(tocPath);
36
- return result_1.Result.success(tocPath);
37
- }
38
- catch (error) {
39
- this.prompts.logError((0, utils_1.getMessageInRedColor)(`${error}`));
40
- return result_1.Result.failure(`❌ An unexpected error occurred while generating the TOC file.`);
41
- }
42
- }
43
- async writeToc(path, content, encoding) {
44
- await fs.ensureFile(path);
45
- await fs.writeFile(path, content, encoding);
46
- }
47
- async handleExistingToc(tocPath, force) {
48
- const shouldContinue = await this.checkExistingToc(tocPath, force);
49
- if (!shouldContinue) {
50
- return result_1.Result.cancelled("Operation was cancelled by the user.");
51
- }
52
- return result_1.Result.success("TOC check passed.");
17
+ async exists() {
18
+ return this.fileService.directoryExists(this.contentDirectory);
53
19
  }
54
- async extractSdlComponents(workingDirectory, configDir, expandEndpoints, expandModels) {
55
- if (!expandEndpoints && !expandModels) {
56
- return { endpointGroups: new Map(), models: [] };
57
- }
58
- this.prompts.startProgressIndicatorWithMessage("Extracting endpoints and/or models from the API specification...");
59
- const specFolderPath = await this.getSpecFolderPath(workingDirectory);
60
- if (!(await fs.pathExists(specFolderPath))) {
61
- this.prompts.stopProgressIndicatorWithMessage(`⚠️ Could not find the specification folder at: ${specFolderPath}`);
62
- this.prompts.displayInfo("Falling back to default TOC structure without expanded endpoints or models...");
63
- return { endpointGroups: new Map(), models: [] };
64
- }
65
- const sdlResult = await this.sdlParser.getTocComponentsFromSdl(specFolderPath, workingDirectory, configDir);
66
- if (!sdlResult.isSuccess()) {
67
- this.prompts.stopProgressIndicatorWithMessage(`⚠️ ${sdlResult.error}`);
68
- this.prompts.displayInfo("Falling back to default TOC structure without expanded endpoints or models...");
69
- return { endpointGroups: new Map(), models: [] };
70
- }
71
- this.prompts.stopProgressIndicatorWithMessage("✅ Successfully extracted endpoints and/or models from the specification.");
72
- return sdlResult.value;
20
+ async extractContentGroups() {
21
+ const directory = await this.fileService.getDirectory(this.contentDirectory);
22
+ return await directory.parseContentFolder(this.contentDirectory);
73
23
  }
74
- async extractContentGroups(workingDirectory) {
75
- const contentFolderPath = await this.getContentFolderPath(workingDirectory);
76
- if (!(await fs.pathExists(contentFolderPath))) {
77
- this.prompts.displayInfo(`⚠️ Could not locate the content folder at: ${contentFolderPath}`);
78
- this.prompts.displayInfo("Skipping custom content addition in TOC...");
79
- return [];
80
- }
81
- return await this.contentParser.parseContentFolder(contentFolderPath, contentFolderPath);
24
+ }
25
+ export class PortalNewTocAction {
26
+ constructor(configDirectory, commandMetadata) {
27
+ this.configDirectory = configDirectory;
28
+ this.commandMetadata = commandMetadata;
29
+ this.prompts = new PortalNewTocPrompts();
30
+ this.tocGenerator = new TocStructureGenerator();
31
+ this.fileService = new FileService();
32
+ this.portalService = new PortalService();
82
33
  }
83
- async getDestinationPath(workingDirectory, providedDestination) {
84
- if (providedDestination === undefined) {
85
- const inferredDestination = await this.getContentFolderPath(workingDirectory);
86
- return inferredDestination;
34
+ async execute(buildDirectory, tocDirectory, force = false, expandEndpoints = false, expandModels = false) {
35
+ var _a, _b;
36
+ // Validate build directory
37
+ const buildContext = new BuildContext(buildDirectory);
38
+ if (!(await buildContext.validate())) {
39
+ this.prompts.invalidBuildDirectory(buildDirectory);
40
+ return ActionResult.failed();
87
41
  }
88
- return providedDestination;
89
- }
90
- async checkExistingToc(tocPath, force) {
91
- if ((await fs.pathExists(tocPath)) && !force) {
92
- return await this.prompts.overwriteExistingTocPrompt();
42
+ const buildConfig = await buildContext.getBuildFileContents();
43
+ const contentDirectory = buildDirectory.join((_b = (_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder) !== null && _b !== void 0 ? _b : "content");
44
+ const tocDir = tocDirectory !== null && tocDirectory !== void 0 ? tocDirectory : contentDirectory;
45
+ const tocContext = new TocContext(tocDir);
46
+ if (!force && (await tocContext.exists()) && !(await this.prompts.overwriteToc(tocContext.tocPath))) {
47
+ this.prompts.tocFileAlreadyExists();
48
+ return ActionResult.cancelled();
93
49
  }
94
- return true;
95
- }
96
- async getContentFolderPath(workingDirectory) {
97
- var _a;
98
- const buildFilePath = path.join(workingDirectory, APIMATIC_BUILD_FILENAME);
99
- const defaultContentFolder = path.join(workingDirectory, "content");
100
- if (!(await fs.pathExists(buildFilePath))) {
101
- return defaultContentFolder;
102
- }
103
- try {
104
- const buildConfig = await fs.readJson(buildFilePath, "utf8");
105
- if (((_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.contentFolder) == null) {
106
- return defaultContentFolder;
50
+ let sdlComponents = { endpointGroups: new Map(), models: [] };
51
+ if (expandEndpoints || expandModels) {
52
+ const specDirectory = buildDirectory.join("spec");
53
+ if (!(await this.fileService.directoryExists(specDirectory))) {
54
+ this.prompts.fallingBackToDefault();
107
55
  }
108
- return path.join(workingDirectory, buildConfig.generatePortal.contentFolder, "content");
109
- }
110
- catch (_b) {
111
- return defaultContentFolder;
112
- }
113
- }
114
- async getSpecFolderPath(workingDirectory) {
115
- var _a;
116
- const buildFilePath = path.join(workingDirectory, APIMATIC_BUILD_FILENAME);
117
- const defaultSpecFolder = path.join(workingDirectory, "spec");
118
- if (!(await fs.pathExists(buildFilePath))) {
119
- return defaultSpecFolder;
120
- }
121
- try {
122
- const buildConfig = await fs.readJson(buildFilePath, "utf8");
123
- if (((_a = buildConfig.generatePortal) === null || _a === void 0 ? void 0 : _a.apiSpecPath) == null) {
124
- return defaultSpecFolder;
56
+ else {
57
+ const sdlResult = await withDirPath(async (tempDirectory) => {
58
+ const tempContext = new TempContext(tempDirectory);
59
+ const specZipPath = await tempContext.zip(specDirectory);
60
+ const specFileStream = await this.fileService.getStream(specZipPath);
61
+ try {
62
+ const result = await this.prompts.extractEndpointGroupsAndModels(this.portalService.generateSdl(specFileStream, this.configDirectory, this.commandMetadata));
63
+ if (result.isErr()) {
64
+ this.prompts.fallingBackToDefault();
65
+ return ok({ endpointGroups: new Map(), models: [] });
66
+ }
67
+ return ok(getEndpointGroupsAndModels(result.value));
68
+ }
69
+ finally {
70
+ specFileStream.close();
71
+ }
72
+ });
73
+ if (sdlResult.isErr()) {
74
+ this.prompts.logError(sdlResult.error);
75
+ return ActionResult.failed();
76
+ }
77
+ sdlComponents = sdlResult.value;
125
78
  }
126
- return path.join(workingDirectory, buildConfig.generatePortal.apiSpecPath);
127
79
  }
128
- catch (_b) {
129
- return defaultSpecFolder;
80
+ const contentContext = new ContentContext(contentDirectory);
81
+ const contentExists = await contentContext.exists();
82
+ let contentGroups;
83
+ if (!contentExists) {
84
+ this.prompts.contentDirectoryNotFound(contentDirectory);
85
+ contentGroups = [];
86
+ }
87
+ else {
88
+ contentGroups = await contentContext.extractContentGroups();
130
89
  }
90
+ const toc = this.tocGenerator.createTocStructure(sdlComponents.endpointGroups, sdlComponents.models, expandEndpoints, expandModels, contentGroups);
91
+ const yamlString = this.tocGenerator.transformToYaml(toc);
92
+ const tocFilePath = await tocContext.save(yamlString);
93
+ this.prompts.tocCreated(tocFilePath);
94
+ return ActionResult.success();
131
95
  }
132
96
  }
133
- exports.PortalNewTocAction = PortalNewTocAction;
134
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3LXRvYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9hY3Rpb25zL3BvcnRhbC90b2MvbmV3LXRvYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBNkI7QUFDN0IsK0JBQStCO0FBQy9CLGlFQUEwRTtBQUMxRSx5REFBc0Q7QUFDdEQsZ0RBQTREO0FBQzVELDJFQUF1RTtBQUN2RSxxR0FBZ0c7QUFDaEcsMkZBQXNGO0FBRXRGLG9GQUFnRjtBQUVoRixNQUFNLG9CQUFvQixHQUFHLFNBQVMsQ0FBQztBQUN2QyxN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AAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAGtD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;QAEpC,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { CommandMetadata } from "../types/common/command-metadata.js";
2
+ import { DirectoryPath } from "../types/file/directoryPath.js";
3
+ import { ActionResult } from "./action-result.js";
4
+ export declare class QuickstartAction {
5
+ private readonly configDir;
6
+ private readonly commandMetadata;
7
+ private readonly prompts;
8
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
9
+ readonly execute: () => Promise<ActionResult>;
10
+ }
@@ -0,0 +1,30 @@
1
+ import { QuickstartPrompts } from "../prompts/quickstart.js";
2
+ import { ActionResult } from "./action-result.js";
3
+ import { PortalQuickstartAction } from "./portal/quickstart.js";
4
+ import { SdkQuickstartAction } from "./sdk/quickstart.js";
5
+ export class QuickstartAction {
6
+ constructor(configDir, commandMetadata) {
7
+ this.configDir = configDir;
8
+ this.commandMetadata = commandMetadata;
9
+ this.prompts = new QuickstartPrompts();
10
+ this.execute = async () => {
11
+ this.prompts.welcomeMessage();
12
+ const selectedFlow = await this.prompts.selectQuickstartFlow();
13
+ switch (selectedFlow) {
14
+ case "portal": {
15
+ const action = new PortalQuickstartAction(this.configDir, this.commandMetadata);
16
+ return await action.execute();
17
+ }
18
+ case "sdk": {
19
+ const action = new SdkQuickstartAction(this.configDir, this.commandMetadata);
20
+ return await action.execute();
21
+ }
22
+ case undefined: {
23
+ this.prompts.noQuickstartFlowSelected();
24
+ return ActionResult.cancelled();
25
+ }
26
+ }
27
+ };
28
+ }
29
+ }
30
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sour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,13 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
4
+ import { Language } from "../../types/sdk/generate.js";
5
+ export declare class GenerateAction {
6
+ private readonly prompts;
7
+ private readonly portalService;
8
+ private readonly configDir;
9
+ private readonly commandMetadata;
10
+ private readonly authKey;
11
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
12
+ readonly execute: (specDirectory: DirectoryPath, sdkDirectory: DirectoryPath, language: Language, force: boolean, zipSdk: boolean) => Promise<ActionResult>;
13
+ }
@@ -0,0 +1,47 @@
1
+ import { PortalService } from "../../infrastructure/services/portal-service.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ import { withDirPath } from "../../infrastructure/tmp-extensions.js";
4
+ import { SdkContext } from "../../types/sdk-context.js";
5
+ import { SpecContext } from "../../types/spec-context.js";
6
+ import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
7
+ import { TempContext } from "../../types/temp-context.js";
8
+ export class GenerateAction {
9
+ constructor(configDir, commandMetadata, authKey = null) {
10
+ this.prompts = new SdkGeneratePrompts();
11
+ this.portalService = new PortalService();
12
+ this.execute = async (specDirectory, sdkDirectory, language, force, zipSdk) => {
13
+ if (specDirectory.isEqual(sdkDirectory)) {
14
+ this.prompts.sameSpecAndSdkDir(specDirectory);
15
+ return ActionResult.failed();
16
+ }
17
+ const specContext = new SpecContext(specDirectory);
18
+ if (!(await specContext.validate())) {
19
+ this.prompts.invalidSpecDirectory(specDirectory);
20
+ return ActionResult.failed();
21
+ }
22
+ const sdkContext = new SdkContext(sdkDirectory, language);
23
+ if (!force && (await sdkContext.exists()) && !(await this.prompts.overwriteSdk(sdkContext.sdkLanguageDirectory))) {
24
+ this.prompts.destinationDirNotEmpty();
25
+ return ActionResult.cancelled();
26
+ }
27
+ return await withDirPath(async (tempDirectory) => {
28
+ const tempContext = new TempContext(tempDirectory);
29
+ const specZipPath = await tempContext.zip(specDirectory);
30
+ const response = await this.prompts.generateSDK(this.portalService.generateSdk(specZipPath, language, this.configDir, this.commandMetadata, this.authKey));
31
+ // TODO: this should be service error
32
+ if (response.isErr()) {
33
+ this.prompts.logGenerationError(response.error);
34
+ return ActionResult.failed();
35
+ }
36
+ const tempSdkFilePath = await tempContext.save(response.value);
37
+ const sdkLanguageDirectory = await sdkContext.save(tempSdkFilePath, zipSdk);
38
+ this.prompts.sdkGenerated(sdkLanguageDirectory);
39
+ return ActionResult.success();
40
+ });
41
+ };
42
+ this.configDir = configDir;
43
+ this.commandMetadata = commandMetadata;
44
+ this.authKey = authKey;
45
+ }
46
+ }
47
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/actions/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAEhF,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,MAAM,OAAO,cAAc;IAOzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QANpF,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QACvD,kBAAa,GAAkB,IAAI,aAAa,EAAE,CAAC;QAWpD,YAAO,GAAG,KAAK,EAC7B,aAA4B,EAC5B,YAA2B,EAC3B,QAAkB,EAClB,KAAc,EACd,MAAe,EACQ,EAAE;YACzB,IAAI,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,CAAC;gBACxC,IA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kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;oBAChD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,eAAe,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;gBAC/D,MAAM,oBAAoB,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;gBAE5E,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;gBAEhD,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAlDA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CAgDF"}
@@ -0,0 +1,14 @@
1
+ import { ActionResult } from "../action-result.js";
2
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
3
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
4
+ export declare class SdkQuickstartAction {
5
+ private readonly configDir;
6
+ private readonly commandMetadata;
7
+ private readonly prompts;
8
+ private readonly fileDownloadService;
9
+ private readonly fileService;
10
+ private readonly launcherService;
11
+ private readonly zipService;
12
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
13
+ readonly execute: () => Promise<ActionResult>;
14
+ }
@@ -0,0 +1,149 @@
1
+ import { SdkQuickstartPrompts } from "../../prompts/sdk/quickstart.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ import { UrlPath } from "../../types/file/urlPath.js";
4
+ import { LoginAction } from "../auth/login.js";
5
+ import { getAuthInfo } from "../../client-utils/auth-manager.js";
6
+ import { withDirPath } from "../../infrastructure/tmp-extensions.js";
7
+ import { FilePath } from "../../types/file/filePath.js";
8
+ import { SpecContext } from "../../types/spec-context.js";
9
+ import { ValidateAction } from "../api/validate.js";
10
+ import { FileDownloadService } from "../../infrastructure/services/file-download-service.js";
11
+ import { FileService } from "../../infrastructure/file-service.js";
12
+ import { GenerateAction } from "./generate.js";
13
+ import { LauncherService } from "../../infrastructure/launcher-service.js";
14
+ import { ZipService } from "../../infrastructure/zip-service.js";
15
+ import { FileName } from "../../types/file/fileName.js";
16
+ const defaultSpecUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/openapi.json`);
17
+ const metadataFileUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/APIMATIC-META.json`);
18
+ export class SdkQuickstartAction {
19
+ constructor(configDir, commandMetadata) {
20
+ this.configDir = configDir;
21
+ this.commandMetadata = commandMetadata;
22
+ this.prompts = new SdkQuickstartPrompts();
23
+ this.fileDownloadService = new FileDownloadService();
24
+ this.fileService = new FileService();
25
+ this.launcherService = new LauncherService();
26
+ this.zipService = new ZipService();
27
+ this.execute = async () => {
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(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(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.selectLanguageStep();
86
+ const language = await this.prompts.selectLanguagePrompt();
87
+ if (!language) {
88
+ this.prompts.noLanguageSelected();
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
+ // Setup source directory with the spec folder
112
+ const apimaticMetaFile = await this.prompts.downloadMetadataFile(this.fileDownloadService.downloadFile(metadataFileUrl));
113
+ if (apimaticMetaFile.isErr()) {
114
+ this.prompts.serviceError(apimaticMetaFile.error);
115
+ return ActionResult.failed();
116
+ }
117
+ const tempSpecDirectory = tempDirectory.join("spec");
118
+ await this.fileService.createDirectoryIfNotExists(tempSpecDirectory);
119
+ const metadataFilePath = new FilePath(tempSpecDirectory, apimaticMetaFile.value.filename);
120
+ await this.fileService.writeFile(metadataFilePath, apimaticMetaFile.value.stream);
121
+ if (await this.fileService.isZipFile(specPath)) {
122
+ await this.zipService.unArchive(specPath, tempSpecDirectory);
123
+ }
124
+ else {
125
+ await this.fileService.copyToDir(specPath, tempSpecDirectory);
126
+ }
127
+ const sourceDirectory = inputDirectory.join("src");
128
+ const specDirectory = sourceDirectory.join("spec");
129
+ await this.fileService.copyDirectoryContents(tempSpecDirectory, specDirectory);
130
+ const srcDirectoryStructure = await this.fileService.getDirectory(sourceDirectory);
131
+ this.prompts.printDirectoryStructure(inputDirectory, srcDirectoryStructure);
132
+ const sdkDirectory = inputDirectory.join("sdk");
133
+ const sdkGenerateAction = new GenerateAction(this.configDir, this.commandMetadata);
134
+ const result = await sdkGenerateAction.execute(specDirectory, sdkDirectory, language, true, false);
135
+ if (result.isFailed()) {
136
+ return ActionResult.failed();
137
+ }
138
+ const languageDirectory = sdkDirectory.join(language);
139
+ const readmeFilePath = new FilePath(languageDirectory, new FileName("README.md"));
140
+ if (await this.launcherService.openFolderInIde(languageDirectory, readmeFilePath)) {
141
+ this.prompts.sdkOpenedInEditor();
142
+ }
143
+ this.prompts.nextSteps(language, inputDirectory);
144
+ return ActionResult.success();
145
+ });
146
+ };
147
+ }
148
+ }
149
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/actions/sdk/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAo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 private readonly recipe;
4
+ constructor(name: string);
5
+ addContentStep(key: string, content: string): void;
6
+ addEndpointStep(key: string, description: string, endpointGroupName: string, endpointName: string): void;
7
+ toSerializableRecipe(): SerializableRecipe;
8
+ }
@@ -0,0 +1,33 @@
1
+ import { StepType } from "../../../types/recipe/recipe.js";
2
+ export class PortalRecipe {
3
+ constructor(name) {
4
+ this.recipe = {
5
+ name,
6
+ steps: []
7
+ };
8
+ }
9
+ addContentStep(key, content) {
10
+ this.recipe.steps.push({
11
+ key,
12
+ name: key, //TODO: Check if key is required
13
+ type: StepType.Content,
14
+ config: { content }
15
+ });
16
+ }
17
+ addEndpointStep(key, description, endpointGroupName, endpointName) {
18
+ const endpointPermalink = `$e/${[endpointGroupName, endpointName].map(encodeURIComponent).join("/")}`;
19
+ this.recipe.steps.push({
20
+ key,
21
+ name: key, //TODO: Check if key is required
22
+ type: StepType.Endpoint,
23
+ config: {
24
+ description,
25
+ endpointPermalink
26
+ }
27
+ });
28
+ }
29
+ toSerializableRecipe() {
30
+ return this.recipe;
31
+ }
32
+ }
33
+ //# sourceMappingURL=portal-recipe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-recipe.js","sourceRoot":"","sources":["../../../../src/application/portal/recipe/portal-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAE/E,MAAM,OAAO,YAAY;IAGvB,YAAY,IAAY;QACtB,IAAI,CAAC,MAAM,GAAG;YACZ,IAAI;YACJ,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,cAAc,CAAC,GAAW,EAAE,OAAe;QACzC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACrB,GAAG;YACH,IAAI,EAAE,GAAG,EAAE,gCAAgC;YAC3C,IAAI,EAAE,QAAQ,CAAC,OAAO;YACtB,MAAM,EAAE,EAAE,OAAO,EAAE;SACpB,CAAC,CAAC;IACL,CAAC;IAED,eAAe,CAAC,GAAW,EAAE,WAAmB,EAAE,iBAAyB,EAAE,YAAoB;QAC/F,MAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACtG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;YACrB,GAAG;YACH,IAAI,EAAE,GAAG,EAAE,gCAAgC;YAC3C,IAAI,EAAE,QAAQ,CAAC,QAAQ;YACvB,MAAM,EAAE;gBACN,WAAW;gBACX,iBAAiB;aAClB;SACF,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import { SerializableRecipe } from "../../../types/recipe/recipe.js";
2
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
3
+ import { Toc } from "../../../types/toc/toc.js";
4
+ import { FilePath } from "../../../types/file/filePath.js";
5
+ import { FileName } from "../../../types/file/fileName.js";
6
+ import { BuildContext } from "../../../types/build-context.js";
7
+ export declare class PortalRecipeGenerator {
8
+ private readonly fileService;
9
+ createRecipe(recipe: SerializableRecipe, tocFileContent: Toc, tocFilePath: FilePath, recipeName: string, recipeScriptFileName: FileName, recipeMarkdownFileName: FileName, buildContext: BuildContext, buildDirectory: DirectoryPath): Promise<void>;
10
+ private addRecipeToToc;
11
+ private registerRecipeInBuildConfigFile;
12
+ private createMarkdownFile;
13
+ private createScriptFromRecipe;
14
+ private saveGeneratedRecipeScriptToBuildDirectory;
15
+ private generateVerifyFunction;
16
+ private addContentStepToScript;
17
+ private addEndpointStepToScript;
18
+ private getMarkdownFileContent;
19
+ private formatScript;
20
+ private toPascalCase;
21
+ }