@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
@@ -0,0 +1,45 @@
1
+ var _a;
2
+ import { Command, Flags } from "@oclif/core";
3
+ import { PortalRecipeAction } from "../../../actions/portal/recipe/new-recipe.js";
4
+ import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
5
+ import { RecipeCreationFailedEvent } from "../../../types/events/recipe-creation-failed.js";
6
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
7
+ import { FlagsProvider } from "../../../types/flags-provider.js";
8
+ import { format, intro, outro } from "../../../prompts/format.js";
9
+ class PortalRecipeNew extends Command {
10
+ async run() {
11
+ const { flags: { name, input, force } } = await this.parse(_a);
12
+ const workingDirectory = DirectoryPath.createInput(input);
13
+ const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
14
+ const commandMetadata = {
15
+ commandName: _a.id,
16
+ shell: this.config.shell
17
+ };
18
+ intro("New Recipe");
19
+ const action = new PortalRecipeAction(new DirectoryPath(this.config.configDir), commandMetadata);
20
+ const result = await action.execute(buildDirectory, name);
21
+ outro(result);
22
+ result.mapAll(() => { }, async () => {
23
+ const telemetryService = new TelemetryService(new DirectoryPath(this.config.configDir));
24
+ await telemetryService.trackEvent(new RecipeCreationFailedEvent("error", _a.id, {
25
+ name,
26
+ input,
27
+ force
28
+ }), commandMetadata.shell);
29
+ }, () => { });
30
+ }
31
+ }
32
+ _a = PortalRecipeNew;
33
+ PortalRecipeNew.summary = "Add an API Recipe to your API documentation portal.";
34
+ PortalRecipeNew.description = `This command adds a new API Recipe file to your documentation portal.
35
+
36
+ To learn more about API Recipes, visit:
37
+ ${format.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes")}`;
38
+ PortalRecipeNew.flags = Object.assign(Object.assign({ name: Flags.string({ description: "name for the recipe" }) }, FlagsProvider.input), FlagsProvider.force);
39
+ PortalRecipeNew.cmdTxt = format.cmd("apimatic", "portal", "recipe", "new");
40
+ PortalRecipeNew.examples = [
41
+ `${_a.cmdTxt}`,
42
+ `${_a.cmdTxt} ${format.flag("name", '"My API Recipe"')} ${format.flag("input", '"./"')}`
43
+ ];
44
+ export default PortalRecipeNew;
45
+ //# sourceMappingURL=new.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new.js","sourceRoot":"","sources":["../../../../src/commands/portal/recipe/new.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE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ACR,KAAK,IAAI,EAAE;YACT,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;YACxF,MAAM,gBAAgB,CAAC,UAAU,CAC/B,IAAI,yBAAyB,CAAC,OAAO,EAAE,EAAe,CAAC,EAAE,EAAE;gBACzD,IAAI;gBACJ,KAAK;gBACL,KAAK;aACN,CAAC,EACF,eAAe,CAAC,KAAK,CACtB,CAAC;QACJ,CAAC,EACD,GAAG,EAAE,GAAE,CAAC,CACT,CAAC;IACJ,CAAC;;;AAtDM,uBAAO,GAAG,qDAAqD,AAAxD,CAAyD;AAEhE,2BAAW,GAAG;;;EAGrB,MAAM,CAAC,IAAI,CACX,+FAA+F,CAChG,EAAE,AALiB,CAKhB;AAEK,qBAAK,iCACV,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC,IACvD,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,KAAK,CAHZ,CAIV;AAEc,sBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,AAApD,CAAqD;AAC3D,wBAAQ,GAAG;IACzB,GAAG,EAAI,CAAC,MAAM,EAAE;IAChB,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;CAC3F,AAHuB,CAGtB;eApBiB,eAAe"}
@@ -1,16 +1,16 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export default class PortalServe extends Command {
3
+ static summary: string;
3
4
  static description: string;
4
5
  static flags: {
5
- port: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
6
- destination: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- source: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- open: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
- "no-reload": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
- ignore: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
11
- "auth-key": import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
6
+ "auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
+ open: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ "no-reload": import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ port: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
12
11
  };
12
+ static cmdTxt: string;
13
13
  static examples: string[];
14
14
  run(): Promise<void>;
15
- private handleError;
15
+ private getConfigDir;
16
16
  }
@@ -1,137 +1,53 @@
1
- "use strict";
2
1
  var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const path = require("path");
5
- const axios_1 = require("axios");
6
- const core_1 = require("@oclif/core");
7
- const serve_1 = require("../../controllers/portal/serve");
8
- const server_1 = require("../../services/portal/server");
9
- const serve_2 = require("../../prompts/portal/serve");
10
- const utils_1 = require("../../utils/utils");
11
- const serveValidator_1 = require("../../validators/portal/serveValidator");
12
- class PortalServe extends core_1.Command {
2
+ import { Command, Flags } from "@oclif/core";
3
+ import { PortalServeAction } from "../../actions/portal/serve.js";
4
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
5
+ import { FlagsProvider } from "../../types/flags-provider.js";
6
+ import { format, intro, outro } from "../../prompts/format.js";
7
+ class PortalServe extends Command {
13
8
  async run() {
14
- var _b;
15
- const { flags } = await this.parse(_a);
16
- const ignoredPaths = flags.ignore.split(",").map((path) => path.trim());
17
- const portalDir = path.resolve(flags.destination);
18
- const sourceDir = path.resolve(flags.source);
19
- const port = flags.port;
20
- const overrideAuthKey = (_b = flags["auth-key"]) !== null && _b !== void 0 ? _b : null;
21
- const serverService = new server_1.PortalServerService();
22
- const prompts = new serve_2.PortalServePrompts();
23
- const validator = new serveValidator_1.PortalServeValidator(this.error);
24
- const allIgnoredPaths = [...ignoredPaths, ...(0, utils_1.getGeneratedFilesPaths)(sourceDir, portalDir)];
25
- await validator.validate(port, flags.destination, sourceDir, portalDir);
26
- try {
27
- prompts.displayGeneratingPortalMessage();
28
- await (0, serve_1.generatePortal)(sourceDir, portalDir, this.config.configDir, allIgnoredPaths, overrideAuthKey);
29
- prompts.displayGeneratedPortalMessage(portalDir);
30
- await (0, utils_1.cleanUpGeneratedPortalFiles)(sourceDir);
31
- }
32
- catch (error) {
33
- prompts.displayGeneratingPortalErrorMessage();
34
- await (0, utils_1.cleanUpGeneratedPortalFiles)(sourceDir);
35
- this.handleError(error);
36
- }
37
- serverService.setupServer(portalDir);
38
- serverService.startServer({
39
- generatedPortalPath: portalDir,
40
- targetFolder: sourceDir,
41
- configDir: this.config.configDir,
42
- authKey: overrideAuthKey,
43
- ignoredPaths: allIgnoredPaths,
44
- port,
45
- openInBrowser: flags.open
46
- }, flags["no-reload"]);
47
- prompts.displayOutroMessage(port);
9
+ const { flags: { input, destination, port, open, "no-reload": noReload, "auth-key": authKey } } = await this.parse(_a);
10
+ const workingDirectory = DirectoryPath.createInput(input);
11
+ const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
12
+ const portalDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("portal");
13
+ const commandMetadata = {
14
+ commandName: _a.id,
15
+ shell: this.config.shell
16
+ };
17
+ intro("Portal Serve");
18
+ const portalServeAction = new PortalServeAction(this.getConfigDir(), commandMetadata, authKey);
19
+ const result = await portalServeAction.execute(buildDirectory, portalDirectory, port, open, !noReload);
20
+ outro(result);
48
21
  }
49
- handleError(error) {
50
- if (axios_1.default.isAxiosError(error)) {
51
- const axiosError = error;
52
- if (axiosError.response) {
53
- if (axiosError.response.status === 400) {
54
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files.`));
55
- }
56
- else if (axiosError.response.status === 401) {
57
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that you are logged in or have provided a valid Auth key.`));
58
- }
59
- else if (axiosError.response.status === 403) {
60
- this.error((0, utils_1.getMessageInRedColor)(`Access denied. It looks like you don’t have access to APIMatic’s Docs as Code offering. Check your subscription details and contact our team at support@apimatic.io if you believe this is a mistake.`));
61
- }
62
- else if (axiosError.response.status === 422) {
63
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files.`));
64
- }
65
- else if (axiosError.response.status === 500) {
66
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files. If the issue persists, reach out to our team at support@apimatic.io`));
67
- }
68
- else {
69
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal. Please ensure that the provided build directory follows the correct structure and contains valid API definition and build files. If the issue persists, reach out to our team at support@apimatic.io`));
70
- }
71
- }
72
- else if (axiosError.request) {
73
- if (axiosError.code === "ECONNABORTED") {
74
- this.error((0, utils_1.getMessageInRedColor)(`Your request timed out. Please try again or reach out to our team at support@apimatic.io for help if your problem persists.`));
75
- }
76
- else if (error.code === "ENOTFOUND" || error.code === "ERR_NETWORK") {
77
- this.error((0, utils_1.getMessageInRedColor)(`Network error. Please check your internet connection and try again.`));
78
- }
79
- else {
80
- this.error((0, utils_1.getMessageInRedColor)(`No response received from the server. Please try again later.`));
81
- }
82
- }
83
- else {
84
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal: ${axiosError.message}`));
85
- }
86
- }
87
- else if (error instanceof Error) {
88
- this.error((0, utils_1.getMessageInRedColor)(`Failed to generate the portal: ${error.message}`));
89
- }
90
- else {
91
- this.error((0, utils_1.getMessageInRedColor)(`Something went wrong while generating the portal, please try again later. If the issue persists, contact our team at support@apimatic.io`));
92
- }
22
+ getConfigDir() {
23
+ return new DirectoryPath(this.config.configDir);
93
24
  }
94
25
  }
95
26
  _a = PortalServe;
96
- PortalServe.description = "Generate and deploy a Docs as Code portal with hot reload.";
97
- PortalServe.flags = {
98
- port: core_1.Flags.integer({
27
+ PortalServe.summary = "Generate and serve an API Documentation Portal with hot reload.";
28
+ PortalServe.description = "Requires an input directory with API specifications, a config file, and optionally markdown guides. Supports disabling hot reload and opening the portal in the default browser.";
29
+ PortalServe.flags = Object.assign(Object.assign(Object.assign(Object.assign({ port: Flags.integer({
99
30
  char: "p",
100
- description: "Port to serve the portal.",
101
- default: 3000
102
- }),
103
- destination: core_1.Flags.string({
104
- char: "d",
105
- description: "Directory to store and serve the generated portal.",
106
- default: "./generated_portal",
107
- parse: async (input) => path.resolve(input)
108
- }),
109
- source: core_1.Flags.string({
110
- char: "s",
111
- description: "Source directory containing specs, content, and build file. By default, the current directory is used.",
112
- default: "./",
113
- parse: async (input) => path.resolve(input)
114
- }),
115
- open: core_1.Flags.boolean({
31
+ description: "port to serve the portal.",
32
+ default: 3000,
33
+ helpValue: "3000"
34
+ }) }, FlagsProvider.input), FlagsProvider.destination("portal", "portal")), { open: Flags.boolean({
116
35
  char: "o",
117
- description: "Open the portal in the default browser.",
36
+ description: "open the portal in the default browser.",
118
37
  default: false
119
- }),
120
- "no-reload": core_1.Flags.boolean({
121
- description: "Disable hot reload.",
38
+ }), "no-reload": Flags.boolean({
39
+ description: "disable hot reload.",
122
40
  default: false
123
- }),
124
- ignore: core_1.Flags.string({
125
- char: "i",
126
- description: "Comma-separated list of files/directories to ignore.",
127
- default: ""
128
- }),
129
- "auth-key": core_1.Flags.string({
130
- description: "Override current authentication state with an authentication key."
131
- })
132
- };
41
+ }) }), FlagsProvider.authKey);
42
+ PortalServe.cmdTxt = format.cmd("apimatic", "portal", "serve");
133
43
  PortalServe.examples = [
134
- '$ apimatic portal:serve --source="./" --destination="./generated_portal" --port=3000 --open --no-reload'
44
+ _a.cmdTxt,
45
+ `${_a.cmdTxt} ` +
46
+ `${format.flag("input", './')} ` +
47
+ `${format.flag("destination", './portal')} ` +
48
+ `${format.flag("port", "3000")} ` +
49
+ `${format.flag("open")} ` +
50
+ `${format.flag("no-reload")}`
135
51
  ];
136
- exports.default = PortalServe;
137
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VydmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbWFuZHMvcG9ydGFsL3NlcnZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDZCQUE2QjtBQUM3QixpQ0FBMEI7QUFDMUIsc0NBQTZDO0FBQzdDLDBEQUFnRTtBQUNoRSx5REFBbUU7QUFDbkUsc0RBQWdFO0FBQ2hFLDZDQUE4RztBQUM5RywyRUFBOEU7QUFFOUUsTUFBcUIsV0FBWSxTQUFRLGNBQU87SUE2QzlDLEtBQUssQ0FBQyxHQUFHOztRQUNQLE1BQU0sRUFBRSxLQUFLLEVBQUUsR0FBRyxNQUFNLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBVyxDQUFDLENBQUM7UUFDaEQsTUFBTSxZQUFZLEdBQUcsS0FBSyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxJQUFJLENBQUMsSUFBSSxFQUFFLENBQUMsQ0FBQztRQUN4RSxNQUFNLFNBQVMsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMs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,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QACjC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;QACzB,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;CAChC,AARc,CAQb;eApCiB,WAAW"}
@@ -3,13 +3,12 @@ export default class PortalTocNew extends Command {
3
3
  static summary: string;
4
4
  static description: string;
5
5
  static flags: {
6
- destination: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- folder: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
9
- "expand-endpoints": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
- "expand-models": import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
+ "expand-endpoints": import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ "expand-models": import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
10
  };
11
+ static cmdTxt: string;
12
12
  static examples: string[];
13
- constructor(argv: string[], config: any);
14
13
  run(): Promise<void>;
15
14
  }
@@ -1,65 +1,60 @@
1
- "use strict";
2
1
  var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const path = require("path");
5
- const core_1 = require("@oclif/core");
6
- const new_toc_1 = require("../../../actions/portal/toc/new-toc");
7
- const DEFAULT_FOLDER = process.cwd();
8
- class PortalTocNew extends core_1.Command {
9
- constructor(argv, config) {
10
- super(argv, config);
11
- }
2
+ import { Command, Flags } from "@oclif/core";
3
+ import { PortalNewTocAction } from "../../../actions/portal/toc/new-toc.js";
4
+ import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
5
+ import { TocCreationFailedEvent } from "../../../types/events/toc-creation-failed.js";
6
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
7
+ import { FlagsProvider } from "../../../types/flags-provider.js";
8
+ import { format, intro, outro } from "../../../prompts/format.js";
9
+ class PortalTocNew extends Command {
12
10
  async run() {
13
- const { flags } = await this.parse(_a);
14
- const portalNewTocAction = new new_toc_1.PortalNewTocAction();
15
- const result = await portalNewTocAction.createToc(flags.folder, this.config.configDir, flags.destination, flags.force, flags["expand-endpoints"], flags["expand-models"]);
16
- if (result.isFailed()) {
17
- this.error(result.error);
18
- }
11
+ const { flags: { input, destination, force, "expand-endpoints": expandEndpoints, "expand-models": expandModels } } = await this.parse(_a);
12
+ const workingDirectory = DirectoryPath.createInput(input);
13
+ const buildDirectory = input ? new DirectoryPath(input, "src") : workingDirectory.join("src");
14
+ const tocDirectory = destination ? new DirectoryPath(destination) : undefined;
15
+ const commandMetadata = {
16
+ commandName: _a.id,
17
+ shell: this.config.shell
18
+ };
19
+ intro("New TOC");
20
+ const action = new PortalNewTocAction(new DirectoryPath(this.config.configDir), commandMetadata);
21
+ const result = await action.execute(buildDirectory, tocDirectory, force, expandEndpoints, expandModels);
22
+ outro(result);
23
+ result.mapAll(() => { }, async () => {
24
+ const telemetryService = new TelemetryService(new DirectoryPath(this.config.configDir));
25
+ await telemetryService.trackEvent(
26
+ // TODO: fix Toc error message
27
+ new TocCreationFailedEvent("error", _a.id, {
28
+ input,
29
+ destination,
30
+ force,
31
+ "expand-endpoints": expandEndpoints,
32
+ "expand-models": expandModels
33
+ }), commandMetadata.shell);
34
+ }, () => { });
19
35
  }
20
36
  }
21
37
  _a = PortalTocNew;
22
- PortalTocNew.summary = 'Generates a TOC file based on the content directory and spec folder provided in your working directory';
38
+ PortalTocNew.summary = "Generate a Table of Contents (TOC) file for your API documentation portal";
23
39
  PortalTocNew.description = `This command generates a new Table of Contents (TOC) file used in the
24
40
  generation of your API documentation portal.
25
41
 
26
42
  The output is a YAML file with the .yml extension.
27
43
 
28
44
  To learn more about the TOC file and APIMatic build directory structure, visit:
29
- https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal`;
30
- PortalTocNew.flags = {
31
- destination: core_1.Flags.string({
32
- parse: async (input) => path.resolve(input),
33
- description: "optional path where the generated TOC file will be saved. Defaults to the current working directory if not provided.",
34
- }),
35
- folder: core_1.Flags.string({
36
- parse: async (input) => path.resolve(input),
37
- description: "path to the working directory containing the API project files. Defaults to the current working directory if not specified.",
38
- default: DEFAULT_FOLDER
39
- }),
40
- force: core_1.Flags.boolean({
41
- default: false,
42
- description: "overwrite the TOC file if one already exists at the destination.",
43
- }),
44
- "expand-endpoints": core_1.Flags.boolean({
45
+ ${format.link("https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal")}`;
46
+ PortalTocNew.flags = Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.destination("src/content", `toc.yml`)), FlagsProvider.input), FlagsProvider.force), { "expand-endpoints": Flags.boolean({
45
47
  default: false,
46
- description: "include individual entries for each endpoint in the generated TOC. Requires a valid API specification in the working directory."
47
- }),
48
- "expand-models": core_1.Flags.boolean({
48
+ description: `include individual entries for each endpoint in the generated ${format.var("toc.yml")}. Requires a valid API specification in the working directory.`
49
+ }), "expand-models": Flags.boolean({
49
50
  default: false,
50
- description: "include individual entries for each model in the generated TOC. Requires a valid API specification in the working directory."
51
- })
52
- };
51
+ description: `include individual entries for each model in the generated ${format.var("toc.yml")}. Requires a valid API specification in the working directory.`
52
+ }) });
53
+ PortalTocNew.cmdTxt = format.cmd("apimatic", "portal", "toc", "new");
53
54
  PortalTocNew.examples = [
54
- `$ apimatic portal:toc:new --destination="./portal/content/"
55
- A new toc file has been created at ./portal/content/toc.yml
56
- `,
57
- `$ apimatic portal:toc:new --folder="./my-project"
58
- A new toc file has been created at ./my-project/content/toc.yml
59
- `,
60
- `$ apimatic portal:toc:new --folder="./my-project" --destination="./portal/content/"
61
- A new toc file has been created at ./portal/content/toc.yml
62
- `
55
+ `${_a.cmdTxt} ${format.flag("destination", './src/content/')}`,
56
+ `${_a.cmdTxt} ${format.flag("input", './')}`,
57
+ `${_a.cmdTxt} ${format.flag("input", './')} ${format.flag("destination", './src/content/')}`
63
58
  ];
64
- exports.default = PortalTocNew;
65
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmV3LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2NvbW1hbmRzL3BvcnRhbC90b2MvbmV3LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDZCQUE2QjtBQUM3QixzQ0FBNkM7QUFDN0MsaUVBQXlFO0FBRXpFLE1BQU0sY0FBYyxHQUFHLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQztBQUVyQyxNQUFxQixZQUFhLFNBQVEsY0FBTztJQStDL0MsWUFBWSxJQUFjLEVBQUUsTUFBVztRQUNyQyxLQUFLLENBQUMsSUFBSSxFQUFFLE1BQU0sQ0FBQyxDQUFDO0lBQ3RCLENBQUM7SUFFRCxLQUFLLENBQUMsR0FBRztRQUNQLE1BQU0sRUFBRSxLQUFLLEVBQUUsR0FBRyxNQUFNLElBQUksQ0FBQyxLQUFLLENBQUMsRUFBWSxDQUFDLENBQUM7UUFDakQsTUFBTSxrQkFBa0IsR0FBRyxJQUFJLDRCQUFrQixFQUFFLENBQUM7UUFDcEQsTUFBTSxNQUFNLEdBQUcsTUFBTSxrQkFBa0IsQ0FBQyxTQUFTLENBQy9DLEtBQUssQ0FBQyxNQUFNLEVBQ1osSUFBSSxDQUFDLE1BQU0sQ0FBQyxTQUFTLEVBQ3JCLEtBQUssQ0FBQyxXQUFXLEVBQ2pCLEtBQUssQ0FBQyxLQUFLLEVBQ1gsS0FBSyxDQUFDLGtCQUFrQixDQUFDLEVBQ3pCLEtBQUssQ0FBQyxlQUFlLENBQUMsQ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AK,GACnB,aAAa,CAAC,KAAK,KACtB,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC;QAChC,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,iEAAiE,MAAM,CAAC,GAAG,CACtF,SAAS,CACV,gEAAgE;KAClE,CAAC,EACF,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC;QAC7B,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,8DAA8D,MAAM,CAAC,GAAG,CACnF,SAAS,CACV,gEAAgE;KAClE,CAAC,GAfQ,CAgBV;AAEK,mBAAM,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,AAAjD,CAAkD;AACxD,qBAAQ,GAAG;IAChB,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAE;IAChE,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE;IAC9C,GAAG,EAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,EAAE;CAC/F,AAJc,CAIb;eApCiB,YAAY"}
@@ -0,0 +1,9 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class Quickstart extends Command {
3
+ static description: string;
4
+ static summary: string;
5
+ static cmdTxt: string;
6
+ static examples: string[];
7
+ run(): Promise<void>;
8
+ private readonly getConfigDir;
9
+ }
@@ -0,0 +1,37 @@
1
+ var _a;
2
+ import { Command } from "@oclif/core";
3
+ import { format, intro, outro } from "../prompts/format.js";
4
+ import { TelemetryService } from "../infrastructure/services/telemetry-service.js";
5
+ import { DirectoryPath } from "../types/file/directoryPath.js";
6
+ import { QuickstartInitiatedEvent } from "../types/events/quickstart-initiated.js";
7
+ import { QuickstartAction } from "../actions/quickstart.js";
8
+ import { QuickstartCompletedEvent } from "../types/events/quickstart-completed.js";
9
+ class Quickstart extends Command {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.getConfigDir = () => {
13
+ return new DirectoryPath(this.config.configDir);
14
+ };
15
+ }
16
+ async run() {
17
+ const telemetryService = new TelemetryService(this.getConfigDir());
18
+ const commandMetadata = {
19
+ commandName: _a.id,
20
+ shell: this.config.shell
21
+ };
22
+ await telemetryService.trackEvent(new QuickstartInitiatedEvent(), commandMetadata.shell);
23
+ intro("Quickstart");
24
+ const action = new QuickstartAction(this.getConfigDir(), commandMetadata);
25
+ const result = await action.execute();
26
+ outro(result);
27
+ // TODO: Remove this, find a solution for tracking.
28
+ await result.mapAll(async () => await telemetryService.trackEvent(new QuickstartCompletedEvent(), commandMetadata.shell), () => new Promise(() => { }), () => new Promise(() => { }));
29
+ }
30
+ }
31
+ _a = Quickstart;
32
+ Quickstart.description = "Get started with your first SDK or API Portal in four easy steps.";
33
+ Quickstart.summary = "Create your first SDK or API Portal using APIMatic.";
34
+ Quickstart.cmdTxt = format.cmd("apimatic", "quickstart");
35
+ Quickstart.examples = [_a.cmdTxt];
36
+ export default Quickstart;
37
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../src/commands/quickstart.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,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wC;AAE9C,mBAAQ,GAAG,CAAC,EAAI,CAAC,MAAM,CAAC,AAAhB,CAAiB;eAPb,UAAU"}
@@ -1,15 +1,17 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export default class SdkGenerate extends Command {
3
- static description: string;
3
+ static readonly summary = "Generate an SDK for your API";
4
+ static readonly description = "Generate Software Development Kits (SDKs) from API specifications.\nSupports multiple programming languages including Java, C#, Python, JavaScript, and more.";
5
+ static readonly cmdTxt: string;
4
6
  static flags: {
5
- platform: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
6
- file: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
- url: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
8
- destination: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
9
- force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
10
- zip: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
11
- "auth-key": import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
7
+ "auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ zip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ language: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
13
  };
13
14
  static examples: string[];
14
15
  run(): Promise<void>;
16
+ private readonly getConfigDir;
15
17
  }