@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
@@ -1,151 +1,75 @@
1
- import fs from "fs";
2
- import * as path from "path";
3
- import treeify from "treeify";
4
- import { intro, outro, text, select, multiselect, log, isCancel, cancel, password } from "@clack/prompts";
5
- import { getMessageInCyanColor, getMessageInGreenColor, getMessageInOrangeColor, getMessageInMagentaColor, getMessageInRedColor, isValidUrl, directoryToJson } from "../../utils/utils.js";
6
- import { BasePrompts } from "./common/base-prompts.js";
7
- import axios from "axios";
8
- export class PortalQuickstartPrompts extends BasePrompts {
9
- constructor() {
10
- super(...arguments);
11
- this.vscodeExtensionUrl = "\u001b[4mhttps://marketplace.visualstudio.com/items?itemName=apimatic-developers.apimatic-for-vscode\u001b[0m";
12
- this.serverUrl = "\u001b[4mhttp://localhost:3000\u001b[0m";
13
- this.referenceDocumentationUrl = "\u001b[4mhttps://docs.apimatic.io/cli-getting-started/advanced-portal-setup\u001b[0m";
14
- this.customizeTheSdksUrl = "\u001b[4mhttps://docs.apimatic.io/generate-sdks/codegen-settings/codegen-settings-overview\u001b[0m";
15
- this.defaultPortalDirectoryPath = process.cwd();
16
- }
17
- displayWelcomeMessage() {
18
- intro(`Hello there 👋`);
19
- log.message(`This wizard will help you set up an API Portal via APIMatic's Docs as Code workflow in 4 simple steps.`);
20
- log.message(`Let's get started! 🚀`);
21
- }
22
- async loginPrompt() {
23
- log.message(`Please log in to continue.`);
24
- const email = await text({
25
- message: "Enter your registered email:",
26
- validate: (input) => {
27
- if (!input) {
28
- return getMessageInRedColor("Email is required.");
29
- }
30
- const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
31
- if (!emailRegex.test(input)) {
32
- return getMessageInRedColor("Please enter a valid email address.");
1
+ import { isCancel, log, multiselect, note, select, text } from "@clack/prompts";
2
+ import { format as f, getTree, withSpinner } from "../format.js";
3
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
4
+ import { removeQuotes } from "../../utils/string-utils.js";
5
+ import { getErrorMessage } from "../../infrastructure/api-utils.js";
6
+ import { createResourceInputFromInput } from "../../types/file/resource-input.js";
7
+ const vscodeExtensionUrl = "https://marketplace.visualstudio.com/items?itemName=apimatic-developers.apimatic-for-vscode";
8
+ const referenceDocumentationUrl = "https://docs.apimatic.io/cli-getting-started/advanced-portal-setup";
9
+ const defaultPortalDirectoryPath = process.cwd();
10
+ export class PortalQuickstartPrompts {
11
+ welcomeMessage() {
12
+ log.info(`Welcome to the Portal Quickstart Wizard.`);
13
+ const message = `This wizard will help you set up an API Portal via APIMatic's Docs as Code workflow in 4 simple steps.
14
+
15
+ Let's get started!`;
16
+ log.message(message);
17
+ }
18
+ importSpecStep() {
19
+ log.info(`Step 1 of 4: Import your OpenAPI Definition`);
20
+ }
21
+ async specPathPrompt(defaultSpecUrl) {
22
+ const spec = await text({
23
+ message: `Provide a local path or a public URL for your OpenAPI definition file:`,
24
+ placeholder: "Provide absolute URL/local path or press Enter to use a sample OpenAPI file from APIMatic.",
25
+ defaultValue: defaultSpecUrl.toString(),
26
+ validate: (value) => {
27
+ if (value && !createResourceInputFromInput(value)) {
28
+ return "Please enter a valid file path or URL.";
33
29
  }
34
30
  }
35
31
  });
36
- if (isCancel(email)) {
37
- cancel("Operation cancelled.");
38
- return process.exit(0);
39
- }
40
- const pass = await password({
41
- message: "Enter your password:",
42
- validate: (input) => {
43
- if (!input) {
44
- return getMessageInRedColor("Password is required.");
45
- }
46
- }
47
- });
48
- if (isCancel(pass)) {
49
- cancel("Operation cancelled.");
50
- return process.exit(0);
51
- }
52
- return { email: String(email).trim(), password: String(pass).trim() };
53
- }
54
- removeQuotes(str) {
55
- const quotes = ['"', "'"];
56
- for (const quote of quotes) {
57
- if (str.startsWith(quote) && str.endsWith(quote) && str.length > 1) {
58
- return this.removeQuotes(str.slice(1, -1)); // Recursive call
59
- }
60
- }
61
- return str;
62
- }
63
- async specPrompt() {
64
- log.step(getMessageInOrangeColor(`Step 1 of 4: Import your OpenAPI Definition`));
65
- while (true) {
66
- const spec = await text({
67
- message: `Provide a local path or a public URL for your OpenAPI definition file:`,
68
- placeholder: "Provide absolute URL/local path or press Enter to use a sample OpenAPI file from APIMatic.",
69
- defaultValue: "https://raw.githubusercontent.com/apimatic/static-portal-workflow/refs/heads/master/spec/openapi.json",
70
- validate: (input) => {
71
- var _a;
72
- if (!input)
73
- return;
74
- const cleanedPath = this.removeQuotes((_a = input.trim()) !== null && _a !== void 0 ? _a : "");
75
- if (!isValidUrl(cleanedPath)) {
76
- const dirPath = path.resolve(cleanedPath);
77
- if (!fs.existsSync(dirPath)) {
78
- return getMessageInRedColor("Error: The specified file does not exist. Please enter a valid file path.");
79
- }
80
- if (!fs.statSync(dirPath).isFile()) {
81
- return getMessageInRedColor("Error: The specified path does not point to a valid API Definition file or a zip archive containing API definition files. Please try again.");
82
- }
83
- }
84
- return; // pass sync validation
85
- },
86
- });
87
- if (isCancel(spec)) {
88
- cancel("Operation cancelled.");
89
- process.exit(0);
90
- }
91
- const cleanedPath = this.removeQuotes(String(spec).trim());
92
- // Async validation for URLs
93
- if (isValidUrl(cleanedPath)) {
94
- try {
95
- const response = await axios.head(cleanedPath);
96
- const contentType = response.headers["content-type"];
97
- if (contentType === null || contentType === void 0 ? void 0 : contentType.includes("text/html")) {
98
- log.error(getMessageInRedColor(`Invalid URL. Please check the URL and ensure it points to a valid OpenAPI definition.`));
99
- continue; // re-prompt
100
- }
101
- }
102
- catch (err) {
103
- log.error(getMessageInRedColor(`Failed to reach the URL. Please check your internet connection or the URL.`));
104
- continue; // re-prompt
105
- }
106
- }
107
- return cleanedPath; // valid local file or valid URL
32
+ if (isCancel(spec)) {
33
+ return undefined;
108
34
  }
35
+ return createResourceInputFromInput(spec);
109
36
  }
110
- displaySpecValidationMessage() {
111
- log.step(getMessageInOrangeColor(`Step 2 of 4: Validate and Lint your OpenAPI file`));
112
- this.spin.start(getMessageInMagentaColor(`Running your API Definition through APIMatic's 1200+ CodeGen Specific validation and linting rules 🔍 `));
37
+ specFileDoesNotExist() {
38
+ log.error("The specified file does not exist or is not a valid file. Please enter a valid file path.");
113
39
  }
114
- displaySpecValidationSuccessMessage() {
115
- this.spin.stop(getMessageInCyanColor(`Validation Successful.`));
40
+ noSpecSpecified() {
41
+ log.error("No API definition was provided.");
116
42
  }
117
- displaySpecValidationErrorMessage() {
118
- this.spin.stop(getMessageInRedColor(`Something went wrong while validating your spec.`), 1);
119
- }
120
- displaySpecValidationFailureMessage() {
121
- this.spin.stop(getMessageInRedColor(`❗ Oops, it looks like there are some errors in your API Definition.`), 1);
122
- }
123
- async specValidationFailurePrompt() {
124
- const useSampleSpec = await select({
43
+ async useDefaultSpecPrompt() {
44
+ const useDefaultSpec = await select({
125
45
  message: `How would you like to proceed?`,
126
46
  options: [
127
47
  {
128
- value: "exit",
129
- label: `1. Fix the issues using APIMatic's interactive VS Code Extension: ${this.vscodeExtensionUrl}`
48
+ value: "no",
49
+ label: `1. Fix the issues using APIMatic's interactive VS Code Extension: ${vscodeExtensionUrl}`
130
50
  },
131
- { value: "continue", label: `2. Use an example API spec instead (recommended)` }
51
+ { value: "yes", label: `2. Use an example API spec instead (recommended)` }
132
52
  ]
133
53
  });
134
- if (isCancel(useSampleSpec)) {
135
- cancel("Operation cancelled.");
136
- return process.exit(0);
137
- }
138
- if (useSampleSpec === "exit") {
139
- outro(getMessageInCyanColor("Good luck fixing your API definition! 🛠️ Feel free to run this command again once you're done."));
140
- return process.exit(0);
54
+ if (isCancel(useDefaultSpec)) {
55
+ return false;
141
56
  }
57
+ return useDefaultSpec === "yes";
58
+ }
59
+ fixYourSpec() {
60
+ const message = `Good luck fixing your API definition! Feel free to run this command again once you're done.`;
61
+ log.info(message);
142
62
  }
143
- async sdkLanguagesPrompt() {
144
- log.step(getMessageInOrangeColor(`Step 3 of 4: Select programming languages`));
63
+ validateSpecStep() {
64
+ log.info(`Step 2 of 4: Validate and Lint your OpenAPI file`);
65
+ }
66
+ selectLanguagesStep() {
67
+ log.info(`Step 3 of 4: Select programming languages`);
68
+ }
69
+ async selectLanguagesPrompt() {
145
70
  const languages = (await multiselect({
146
- message: "💻 Your API Portal will contain SDKs and SDK Documentation in the following Languages. Press enter to continue with all languages, or use the arrow keys and spacebar to customize your selection:",
71
+ message: "Your API Portal will contain SDKs and SDK Documentation in the following Languages. Press enter to continue with all languages, or use the arrow keys and space to customize your selection:",
147
72
  options: [
148
- { label: "HTTP", value: "http" },
149
73
  { label: "Typescript", value: "typescript" },
150
74
  { label: "Ruby", value: "ruby" },
151
75
  { label: "Python", value: "python" },
@@ -154,87 +78,69 @@ export class PortalQuickstartPrompts extends BasePrompts {
154
78
  { label: "PHP", value: "php" },
155
79
  { label: "Go", value: "go" }
156
80
  ],
157
- initialValues: ["http", "typescript", "ruby", "python", "java", "csharp", "php", "go"]
81
+ initialValues: ["typescript", "ruby", "python", "java", "csharp", "php", "go"]
158
82
  }));
159
83
  if (isCancel(languages)) {
160
- cancel("Operation cancelled.");
161
- return process.exit(0);
84
+ return undefined;
162
85
  }
163
- return languages;
86
+ return ["http", ...languages];
87
+ }
88
+ noLanguagesSelected() {
89
+ log.error("No programming languages were selected.");
164
90
  }
165
- async workingDirectoryPrompt() {
166
- log.step(getMessageInOrangeColor(`Step 4 of 4: Generate source files for Docs as Code`));
167
- const directory = await text({
91
+ selectInputDirectoryStep() {
92
+ log.info(`Step 4 of 4: Generate source files for Docs as Code`);
93
+ }
94
+ async inputDirectoryPathPrompt() {
95
+ var _a;
96
+ const inputDirectory = await text({
168
97
  message: "Enter the directory path where you would like to setup the API Portal (Requires an empty directory):",
169
98
  placeholder: "Provide absolute path to the directory or press Enter to use the current directory.",
170
- defaultValue: "./",
171
- validate: (input) => {
172
- var _a;
173
- const cleanedPath = this.removeQuotes((_a = input === null || input === void 0 ? void 0 : input.trim()) !== null && _a !== void 0 ? _a : "");
174
- const dirPath = path.resolve(cleanedPath);
175
- if (!fs.existsSync(dirPath) && dirPath != this.defaultPortalDirectoryPath) {
176
- return getMessageInRedColor("Error: The specified directory path does not exist. Please try again.");
177
- }
178
- if (dirPath !== this.defaultPortalDirectoryPath) {
179
- const files = fs.readdirSync(dirPath).filter((item) => !item.startsWith("."));
180
- if (files.length > 0) {
181
- return getMessageInRedColor("Error: The target directory is not empty. Please provide a path to an empty directory or clear its contents.");
182
- }
183
- }
184
- else if (fs.existsSync(dirPath)) {
185
- // For ignoring hidden files and folders in the current directory in MacOS.
186
- const files = fs.readdirSync(dirPath).filter((item) => !item.startsWith("."));
187
- if (files.length > 0) {
188
- return getMessageInRedColor("Error: The target directory is not empty. Please provide a path to an empty directory or clear its contents.");
189
- }
190
- }
191
- }
99
+ defaultValue: "./"
192
100
  });
193
- if (isCancel(directory)) {
194
- cancel("Operation cancelled.");
195
- return process.exit(0);
101
+ if (isCancel(inputDirectory)) {
102
+ return undefined;
196
103
  }
197
- if (directory === "./") {
198
- return this.defaultPortalDirectoryPath;
104
+ const cleanedPath = removeQuotes((_a = inputDirectory === null || inputDirectory === void 0 ? void 0 : inputDirectory.trim()) !== null && _a !== void 0 ? _a : "");
105
+ const directoryPath = new DirectoryPath(cleanedPath);
106
+ if (inputDirectory === "./") {
107
+ return new DirectoryPath(defaultPortalDirectoryPath);
199
108
  }
200
109
  else {
201
- return this.removeQuotes(String(directory).trim());
110
+ return directoryPath;
202
111
  }
203
112
  }
204
- displayBuildDirectoryGenerationMessage() {
205
- this.spin.start(getMessageInMagentaColor("Generating build directory ⚙️"));
113
+ inputDirectoryPathDoesNotExist(inputDirectory) {
114
+ log.error(`The specified directory path ${f.path(inputDirectory)} does not exist.`);
115
+ }
116
+ inputDirectoryNotEmpty(inputDirectory) {
117
+ log.error(`The target directory ${f.path(inputDirectory)} is not empty. Please provide a path to an empty directory or clear its contents.`);
206
118
  }
207
- displayBuildDirectoryGenerationErrorMessage() {
208
- this.spin.stop(getMessageInRedColor(`Something went wrong while setting up your build directory.`), 1);
119
+ noInputDirectoryProvided() {
120
+ log.error("No source directory was provided.");
209
121
  }
210
- displayBuildDirectoryGenerationSuccessMessage(targetFolder) {
211
- this.spin.stop(getMessageInCyanColor(`📁 Directory created at ${targetFolder}`));
122
+ downloadBuildDirectory(fn) {
123
+ return withSpinner("Setting up source directory", `Source directory set up successfully`, "Unable to set up source directory", fn);
212
124
  }
213
- displayBuildDirectoryAsTree(targetFolder) {
214
- const buildDirectory = directoryToJson(targetFolder);
215
- const tree = treeify.asTree(buildDirectory, true, true);
216
- const coloredLogString = tree
217
- .split("\n")
218
- .map((line) => line.replace(/#.*/, (match) => getMessageInGreenColor(match)))
219
- .join("\n");
220
- log.step(coloredLogString);
125
+ downloadSpecFile(fn) {
126
+ return withSpinner("Downloading Spec file", `Spec file downloaded`, "Unable to download spec file", fn);
221
127
  }
222
- displayOutroMessage(buildDirectory) {
223
- log.step(getMessageInCyanColor(`📢 Your API Portal is live at: ${this.serverUrl}\n`) +
224
- getMessageInCyanColor(`Hot reload enabled! Edit files in ${buildDirectory} to see changes instantly reflected in your API Portal.\n`) +
225
- getMessageInCyanColor(`Press CTRL+C to stop the server.`));
226
- outro(getMessageInCyanColor(`What's next?\n`) +
227
- getMessageInCyanColor(`- Use the API Playground or an SDK to call your API.\n`) +
228
- getMessageInCyanColor(`- Customize the Portal theme, add API recipes and enable AI features: ${this.referenceDocumentationUrl}`));
128
+ nextSteps() {
129
+ const message = `- Use the API Playground or an SDK to call your API.
130
+ - Customize the Portal theme, add API recipes and enable AI features
131
+ ${f.link(referenceDocumentationUrl)}`;
132
+ note(message, "Next steps");
229
133
  }
230
- getLoggedInFirst() {
231
- log.step("You need to be logged in to continue.");
134
+ serviceError(error) {
135
+ log.error(getErrorMessage(error));
232
136
  }
233
- displayLoggedInMessage(email) {
234
- log.success(`Successfully logged in as ${email}`);
137
+ printDirectoryStructure(inputDirectory, directory) {
138
+ const heading = `${f.var('src')} directory containing source files created at ${f.path(inputDirectory)}\n`;
139
+ const message = getTree(directory.toTreeNode());
140
+ log.info(heading + message);
235
141
  }
236
- logError(error) {
237
- log.error(error);
142
+ specValidationFailed() {
143
+ log.error(`Oops, it looks like there are some errors in your API Definition`);
238
144
  }
239
145
  }
240
146
  //# sourceMappingURL=quickstart.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/prompts/portal/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,oBAAoB,EACpB,UAAU,EACV,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,uBAAwB,SAAQ,WAAW;IAAxD;;QACmB,uBAAkB,GACjC,+GAA+G,CAAC;QACjG,cAAS,GAAG,yCAAyC,CAAC;QACtD,8BAAyB,GACxC,sFAAsF,CAAC;QACxE,wBAAmB,GAClC,qGAAqG,CAAC;QACvF,+BAA0B,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IA+S9D,CAAC;IA7SC,qBAAqB;QACnB,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACxB,GAAG,CAAC,OAAO,CACT,wGAAwG,CACzG,CAAC;QACF,GAAG,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,WAAW;QACf,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAE1C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC;YACvB,OAAO,EAAE,8BA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CAAC,IAAI,CAAC;QAC3G,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC;QAChD,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,CAAC;IAC9B,CAAC;IAEM,oBAAoB;QACzB,GAAG,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;IAChF,CAAC;CACF"}
@@ -1,24 +1,29 @@
1
- import treeify from "treeify";
2
- import { SdlEndpoint } from "../../../types/sdl/sdl.js";
1
+ import { Sdl, SdlEndpoint } from "../../../types/sdl/sdl.js";
2
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
3
+ import { TreeNode } from "../../format.js";
4
+ import { StepType } from "../../../types/recipe/recipe.js";
5
+ import { ServiceError } from "../../../infrastructure/api-utils.js";
6
+ import { Result } from "neverthrow";
3
7
  export declare class PortalRecipePrompts {
4
- private readonly spin;
5
8
  displayWelcomeMessage(): void;
6
- recipeNamePrompt(): Promise<string>;
7
- removeQuotes(str: string): string;
8
- buildConfigFilePathPrompt(buildDirectoryPath: string): Promise<string>;
9
- stepNamePrompt(defaultStepName: string): Promise<string>;
9
+ recipeNameEmpty(): void;
10
+ contentFolderNotFound(): void;
11
+ specFileEmptyInvalid(): void;
12
+ recipeNamePrompt(): Promise<string | undefined>;
13
+ stepNamePrompt(defaultStepName: string): Promise<string | undefined>;
10
14
  displayStepsInformation(): void;
11
- stepTypeSelectionPrompt(): Promise<string>;
12
- displayContentStepInfo(): void;
13
- endpointGroupNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>): Promise<string>;
14
- endpointNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>, endpointGroupName: string): Promise<string>;
15
- endpointDescriptionPrompt(endpointGroups: Map<string, SdlEndpoint[]>, endpointGroupName: string, endpointName: string): Promise<string>;
15
+ stepTypeSelectionPrompt(): Promise<StepType | undefined>;
16
+ endpointGroupNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>): Promise<string | undefined>;
17
+ endpointNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>, endpointGroupName: string): Promise<string | undefined>;
18
+ endpointDescriptionPrompt(defaultDescription: string): Promise<string | undefined>;
16
19
  addAnotherStepSelectionPrompt(): Promise<boolean>;
17
- overwriteApiRecipeInTocPrompt(): Promise<boolean>;
20
+ overwriteApiRecipeInTocPrompt(name: string): Promise<boolean>;
18
21
  displayStepAddedSuccessfullyMessage(): void;
19
- displayRecipeGenerationSuccessMessage(buildDirectoryPath: string): void;
20
- startProgressIndicatorWithMessage(message: string): void;
21
- stopProgressIndicatorWithMessage(message: string): void;
22
- displayBuildDirectoryStructureAsTree(buildDirectoryTreeObject: treeify.TreeObject): void;
23
- logError(error: string): void;
22
+ invalidBuildDirectory(directory: DirectoryPath): void;
23
+ serviceError(serviceError: ServiceError): void;
24
+ openRecipeMarkdownEditor(): void;
25
+ displayRecipeStructure(tocStructure: TreeNode): void;
26
+ nextSteps(): void;
27
+ generateSdl(fn: Promise<Result<Sdl, ServiceError>>): Promise<Result<Sdl, ServiceError>>;
28
+ recipeCreated(): void;
24
29
  }