@apimatic/cli 1.1.0-alpha.2 → 1.1.0-alpha.20

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 (251) hide show
  1. package/README.md +249 -99
  2. package/bin/run.js +5 -0
  3. package/lib/actions/action-result.d.ts +8 -0
  4. package/lib/actions/action-result.js +25 -0
  5. package/lib/actions/action-result.js.map +1 -0
  6. package/lib/actions/auth/login.d.ts +12 -0
  7. package/lib/actions/auth/login.js +63 -0
  8. package/lib/actions/auth/login.js.map +1 -0
  9. package/lib/actions/portal/copilot.d.ts +11 -0
  10. package/lib/actions/portal/copilot.js +49 -0
  11. package/lib/actions/portal/copilot.js.map +1 -0
  12. package/lib/actions/portal/generate.d.ts +13 -0
  13. package/lib/actions/portal/generate.js +61 -0
  14. package/lib/actions/portal/generate.js.map +1 -0
  15. package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
  16. package/lib/actions/portal/recipe/new-recipe.js +250 -0
  17. package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
  18. package/lib/actions/portal/serve.d.ts +14 -0
  19. package/lib/actions/portal/serve.js +24 -0
  20. package/lib/actions/portal/serve.js.map +1 -0
  21. package/lib/actions/portal/toc/new-toc.d.ts +20 -0
  22. package/lib/actions/portal/toc/new-toc.js +133 -0
  23. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  24. package/lib/actions/sdk/generate.d.ts +14 -0
  25. package/lib/actions/sdk/generate.js +72 -0
  26. package/lib/actions/sdk/generate.js.map +1 -0
  27. package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
  28. package/lib/application/portal/recipe/portal-recipe.js +33 -0
  29. package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
  30. package/lib/application/portal/recipe/recipe-generator.d.ts +16 -0
  31. package/lib/application/portal/recipe/recipe-generator.js +147 -0
  32. package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
  33. package/lib/application/portal/serve/portal-watcher.d.ts +11 -0
  34. package/lib/application/portal/serve/portal-watcher.js +64 -0
  35. package/lib/application/portal/serve/portal-watcher.js.map +1 -0
  36. package/lib/application/portal/serve/serve-handler.d.ts +16 -0
  37. package/lib/application/portal/serve/serve-handler.js +91 -0
  38. package/lib/application/portal/serve/serve-handler.js.map +1 -0
  39. package/lib/application/portal/serve/watcher-handler.d.ts +10 -0
  40. package/lib/application/portal/serve/watcher-handler.js +51 -0
  41. package/lib/application/portal/serve/watcher-handler.js.map +1 -0
  42. package/lib/application/portal/toc/sdl-parser.d.ts +19 -0
  43. package/lib/application/portal/toc/sdl-parser.js +90 -0
  44. package/lib/application/portal/toc/sdl-parser.js.map +1 -0
  45. package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
  46. package/lib/application/portal/toc/toc-content-parser.js +44 -0
  47. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  48. package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
  49. package/lib/application/portal/toc/toc-structure-generator.js +84 -0
  50. package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
  51. package/lib/client-utils/auth-manager.d.ts +8 -3
  52. package/lib/client-utils/auth-manager.js +23 -10
  53. package/lib/client-utils/auth-manager.js.map +1 -0
  54. package/lib/client-utils/sdk-client.d.ts +0 -1
  55. package/lib/client-utils/sdk-client.js +25 -55
  56. package/lib/client-utils/sdk-client.js.map +1 -0
  57. package/lib/commands/api/transform.d.ts +7 -7
  58. package/lib/commands/api/transform.js +43 -51
  59. package/lib/commands/api/transform.js.map +1 -0
  60. package/lib/commands/api/validate.d.ts +4 -4
  61. package/lib/commands/api/validate.js +26 -33
  62. package/lib/commands/api/validate.js.map +1 -0
  63. package/lib/commands/auth/login.d.ts +3 -2
  64. package/lib/commands/auth/login.js +22 -53
  65. package/lib/commands/auth/login.js.map +1 -0
  66. package/lib/commands/auth/logout.d.ts +1 -1
  67. package/lib/commands/auth/logout.js +8 -13
  68. package/lib/commands/auth/logout.js.map +1 -0
  69. package/lib/commands/auth/status.d.ts +1 -1
  70. package/lib/commands/auth/status.js +9 -13
  71. package/lib/commands/auth/status.js.map +1 -0
  72. package/lib/commands/portal/copilot.d.ts +12 -0
  73. package/lib/commands/portal/copilot.js +32 -0
  74. package/lib/commands/portal/copilot.js.map +1 -0
  75. package/lib/commands/portal/generate.d.ts +10 -8
  76. package/lib/commands/portal/generate.js +28 -107
  77. package/lib/commands/portal/generate.js.map +1 -0
  78. package/lib/commands/portal/quickstart.d.ts +10 -0
  79. package/lib/commands/portal/quickstart.js +105 -0
  80. package/lib/commands/portal/quickstart.js.map +1 -0
  81. package/lib/commands/portal/recipe/new.d.ts +10 -0
  82. package/lib/commands/portal/recipe/new.js +38 -0
  83. package/lib/commands/portal/recipe/new.js.map +1 -0
  84. package/lib/commands/portal/serve.d.ts +16 -0
  85. package/lib/commands/portal/serve.js +80 -0
  86. package/lib/commands/portal/serve.js.map +1 -0
  87. package/lib/commands/portal/toc/new.d.ts +14 -0
  88. package/lib/commands/portal/toc/new.js +52 -0
  89. package/lib/commands/portal/toc/new.js.map +1 -0
  90. package/lib/commands/sdk/generate.d.ts +9 -8
  91. package/lib/commands/sdk/generate.js +39 -128
  92. package/lib/commands/sdk/generate.js.map +1 -0
  93. package/lib/config/axios-config.d.ts +2 -0
  94. package/lib/config/axios-config.js +10 -0
  95. package/lib/config/axios-config.js.map +1 -0
  96. package/lib/config/env.d.ts +26 -1
  97. package/lib/config/env.js +27 -4
  98. package/lib/config/env.js.map +1 -0
  99. package/lib/controllers/api/transform.d.ts +1 -1
  100. package/lib/controllers/api/transform.js +23 -22
  101. package/lib/controllers/api/transform.js.map +1 -0
  102. package/lib/controllers/api/validate.d.ts +3 -3
  103. package/lib/controllers/api/validate.js +19 -12
  104. package/lib/controllers/api/validate.js.map +1 -0
  105. package/lib/controllers/portal/quickstart.d.ts +15 -0
  106. package/lib/controllers/portal/quickstart.js +217 -0
  107. package/lib/controllers/portal/quickstart.js.map +1 -0
  108. package/lib/index.d.ts +1 -1
  109. package/lib/index.js +2 -4
  110. package/lib/index.js.map +1 -0
  111. package/lib/infrastructure/api-utils.d.ts +9 -0
  112. package/lib/infrastructure/api-utils.js +33 -0
  113. package/lib/infrastructure/api-utils.js.map +1 -0
  114. package/lib/infrastructure/env-info.d.ts +8 -0
  115. package/lib/infrastructure/env-info.js +37 -0
  116. package/lib/infrastructure/env-info.js.map +1 -0
  117. package/lib/infrastructure/file-service.d.ts +18 -0
  118. package/lib/infrastructure/file-service.js +76 -0
  119. package/lib/infrastructure/file-service.js.map +1 -0
  120. package/lib/infrastructure/services/api-service.d.ts +10 -0
  121. package/lib/infrastructure/services/api-service.js +54 -0
  122. package/lib/infrastructure/services/api-service.js.map +1 -0
  123. package/lib/infrastructure/services/auth-service.d.ts +11 -0
  124. package/lib/infrastructure/services/auth-service.js +33 -0
  125. package/lib/infrastructure/services/auth-service.js.map +1 -0
  126. package/lib/infrastructure/services/portal-service.d.ts +20 -0
  127. package/lib/infrastructure/services/portal-service.js +163 -0
  128. package/lib/infrastructure/services/portal-service.js.map +1 -0
  129. package/lib/infrastructure/services/telemetry-service.d.ts +8 -0
  130. package/lib/infrastructure/services/telemetry-service.js +40 -0
  131. package/lib/infrastructure/services/telemetry-service.js.map +1 -0
  132. package/lib/infrastructure/tmp-extensions.d.ts +2 -0
  133. package/lib/infrastructure/tmp-extensions.js +6 -0
  134. package/lib/infrastructure/tmp-extensions.js.map +1 -0
  135. package/lib/infrastructure/zip-service.d.ts +6 -0
  136. package/lib/infrastructure/zip-service.js +39 -0
  137. package/lib/infrastructure/zip-service.js.map +1 -0
  138. package/lib/prompts/auth/login.d.ts +5 -0
  139. package/lib/prompts/auth/login.js +13 -0
  140. package/lib/prompts/auth/login.js.map +1 -0
  141. package/lib/prompts/portal/common/base-prompts.d.ts +7 -0
  142. package/lib/prompts/portal/common/base-prompts.js +19 -0
  143. package/lib/prompts/portal/common/base-prompts.js.map +1 -0
  144. package/lib/prompts/portal/copilot.d.ts +8 -0
  145. package/lib/prompts/portal/copilot.js +54 -0
  146. package/lib/prompts/portal/copilot.js.map +1 -0
  147. package/lib/prompts/portal/generate.d.ts +11 -0
  148. package/lib/prompts/portal/generate.js +42 -0
  149. package/lib/prompts/portal/generate.js.map +1 -0
  150. package/lib/prompts/portal/quickstart.d.ts +30 -0
  151. package/lib/prompts/portal/quickstart.js +240 -0
  152. package/lib/prompts/portal/quickstart.js.map +1 -0
  153. package/lib/prompts/portal/recipe/new-recipe.d.ts +24 -0
  154. package/lib/prompts/portal/recipe/new-recipe.js +203 -0
  155. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
  156. package/lib/prompts/portal/serve.d.ts +4 -0
  157. package/lib/prompts/portal/serve.js +14 -0
  158. package/lib/prompts/portal/serve.js.map +1 -0
  159. package/lib/prompts/portal/toc/new-toc.d.ts +11 -0
  160. package/lib/prompts/portal/toc/new-toc.js +39 -0
  161. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  162. package/lib/prompts/sdk/generate.d.ts +11 -0
  163. package/lib/prompts/sdk/generate.js +42 -0
  164. package/lib/prompts/sdk/generate.js.map +1 -0
  165. package/lib/types/api/account.d.ts +10 -0
  166. package/lib/types/api/account.js +2 -0
  167. package/lib/types/api/account.js.map +1 -0
  168. package/lib/types/api/transform.d.ts +19 -4
  169. package/lib/types/api/transform.js +19 -4
  170. package/lib/types/api/transform.js.map +1 -0
  171. package/lib/types/api/validate.d.ts +3 -3
  172. package/lib/types/api/validate.js +2 -2
  173. package/lib/types/api/validate.js.map +1 -0
  174. package/lib/types/build/build.d.ts +14 -0
  175. package/lib/types/build/build.js +4 -0
  176. package/lib/types/build/build.js.map +1 -0
  177. package/lib/types/build-context.d.ts +13 -0
  178. package/lib/types/build-context.js +30 -0
  179. package/lib/types/build-context.js.map +1 -0
  180. package/lib/types/common/result.d.ts +17 -0
  181. package/lib/types/common/result.js +32 -0
  182. package/lib/types/common/result.js.map +1 -0
  183. package/lib/types/events/domain-event.d.ts +8 -0
  184. package/lib/types/events/domain-event.js +11 -0
  185. package/lib/types/events/domain-event.js.map +1 -0
  186. package/lib/types/events/recipe-creation-failed.d.ts +5 -0
  187. package/lib/types/events/recipe-creation-failed.js +8 -0
  188. package/lib/types/events/recipe-creation-failed.js.map +1 -0
  189. package/lib/types/events/toc-creation-failed.d.ts +5 -0
  190. package/lib/types/events/toc-creation-failed.js +8 -0
  191. package/lib/types/events/toc-creation-failed.js.map +1 -0
  192. package/lib/types/file/directoryPath.d.ts +7 -0
  193. package/lib/types/file/directoryPath.js +16 -0
  194. package/lib/types/file/directoryPath.js.map +1 -0
  195. package/lib/types/file/fileName.d.ts +5 -0
  196. package/lib/types/file/fileName.js +9 -0
  197. package/lib/types/file/fileName.js.map +1 -0
  198. package/lib/types/file/filePath.d.ts +8 -0
  199. package/lib/types/file/filePath.js +11 -0
  200. package/lib/types/file/filePath.js.map +1 -0
  201. package/lib/types/flags-provider.d.ts +15 -0
  202. package/lib/types/flags-provider.js +34 -0
  203. package/lib/types/flags-provider.js.map +1 -0
  204. package/lib/types/portal/generate.d.ts +13 -9
  205. package/lib/types/portal/generate.js +3 -2
  206. package/lib/types/portal/generate.js.map +1 -0
  207. package/lib/types/portal/quickstart.d.ts +17 -0
  208. package/lib/types/portal/quickstart.js +2 -0
  209. package/lib/types/portal/quickstart.js.map +1 -0
  210. package/lib/types/portal/serve.d.ts +12 -0
  211. package/lib/types/portal/serve.js +2 -0
  212. package/lib/types/portal/serve.js.map +1 -0
  213. package/lib/types/portal-context.d.ts +11 -0
  214. package/lib/types/portal-context.js +28 -0
  215. package/lib/types/portal-context.js.map +1 -0
  216. package/lib/types/recipe/recipe.d.ts +37 -0
  217. package/lib/types/recipe/recipe.js +6 -0
  218. package/lib/types/recipe/recipe.js.map +1 -0
  219. package/lib/types/sdk/generate.d.ts +11 -10
  220. package/lib/types/sdk/generate.js +11 -12
  221. package/lib/types/sdk/generate.js.map +1 -0
  222. package/lib/types/sdk-context.d.ts +13 -0
  223. package/lib/types/sdk-context.js +28 -0
  224. package/lib/types/sdk-context.js.map +1 -0
  225. package/lib/types/sdl/sdl.d.ts +12 -0
  226. package/lib/types/sdl/sdl.js +2 -0
  227. package/lib/types/sdl/sdl.js.map +1 -0
  228. package/lib/types/spec-context.d.ts +7 -0
  229. package/lib/types/spec-context.js +12 -0
  230. package/lib/types/spec-context.js.map +1 -0
  231. package/lib/types/toc/toc.d.ts +31 -0
  232. package/lib/types/toc/toc.js +9 -0
  233. package/lib/types/toc/toc.js.map +1 -0
  234. package/lib/types/utils.d.ts +3 -3
  235. package/lib/types/utils.js +2 -2
  236. package/lib/types/utils.js.map +1 -0
  237. package/lib/utils/utils.d.ts +16 -7
  238. package/lib/utils/utils.js +142 -86
  239. package/lib/utils/utils.js.map +1 -0
  240. package/lib/validators/common/directoryValidator.d.ts +5 -0
  241. package/lib/validators/common/directoryValidator.js +22 -0
  242. package/lib/validators/common/directoryValidator.js.map +1 -0
  243. package/lib/validators/portal/serve-validator.d.ts +6 -0
  244. package/lib/validators/portal/serve-validator.js +15 -0
  245. package/lib/validators/portal/serve-validator.js.map +1 -0
  246. package/package.json +96 -40
  247. package/bin/run +0 -5
  248. package/lib/controllers/portal/generate.d.ts +0 -2
  249. package/lib/controllers/portal/generate.js +0 -49
  250. package/lib/controllers/sdk/generate.d.ts +0 -4
  251. package/lib/controllers/sdk/generate.js +0 -64
@@ -0,0 +1,105 @@
1
+ import getPort from "get-port";
2
+ import { Command } from "@oclif/core";
3
+ import { ApiValidationExternalApisController } from "@apimatic/sdk";
4
+ import { SDKClient } from "../../client-utils/sdk-client.js";
5
+ import { PortalQuickstartPrompts } from "../../prompts/portal/quickstart.js";
6
+ import { PortalQuickstartController } from "../../controllers/portal/quickstart.js";
7
+ import { getMessageInRedColor } from "../../utils/utils.js";
8
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
9
+ import { PortalServeAction } from "../../actions/portal/serve.js";
10
+ import { ServeHandler } from "../../application/portal/serve/serve-handler.js";
11
+ import { PortalService } from "../../infrastructure/services/portal-service.js";
12
+ import { PortalServePrompts } from "../../prompts/portal/serve.js";
13
+ import { GenerateAction } from "../../actions/portal/generate.js";
14
+ import { LoginAction } from "../../actions/auth/login.js";
15
+ class PortalQuickstart extends Command {
16
+ async getSpecFile(prompts, controller) {
17
+ const specPath = await prompts.specPrompt();
18
+ const specFile = await controller.getSpecFile(specPath);
19
+ prompts.displaySpecValidationMessage();
20
+ return specFile;
21
+ }
22
+ async getSpecValidationSummary(prompts, controller, specFile, apiValidationController) {
23
+ const apiValidationSummary = await controller.getSpecValidationSummary(prompts, specFile, apiValidationController);
24
+ if (!apiValidationSummary.success) {
25
+ prompts.displaySpecValidationFailureMessage();
26
+ await prompts.specValidationFailurePrompt();
27
+ }
28
+ else {
29
+ prompts.displaySpecValidationSuccessMessage();
30
+ }
31
+ return apiValidationSummary;
32
+ }
33
+ async getWorkingDirectory(prompts, controller, specFile, apiValidationSummary, languages) {
34
+ const workingDirectory = await prompts.workingDirectoryPrompt();
35
+ prompts.displayBuildDirectoryGenerationMessage();
36
+ const buildDirectory = new DirectoryPath(workingDirectory, "src").toString();
37
+ await controller.setupBuildDirectory(prompts, buildDirectory, specFile, apiValidationSummary, languages);
38
+ prompts.displayBuildDirectoryGenerationSuccessMessage(buildDirectory);
39
+ prompts.displayBuildDirectoryAsTree(buildDirectory);
40
+ return workingDirectory;
41
+ }
42
+ async run() {
43
+ const prompts = new PortalQuickstartPrompts();
44
+ const controller = new PortalQuickstartController();
45
+ prompts.displayWelcomeMessage();
46
+ let loggedIn = await controller.isUserAuthenticated(this.config.configDir);
47
+ if (!loggedIn) {
48
+ prompts.getLoggedInFirst();
49
+ const loginAction = new LoginAction(new DirectoryPath(this.config.configDir));
50
+ const loginResult = await loginAction.execute();
51
+ loginResult.match(e => prompts.displayLoggedInMessage(e), error => prompts.logError(error));
52
+ if (loginResult.isErr())
53
+ return;
54
+ }
55
+ const client = await SDKClient.getInstance().getClient(null, this.config.configDir);
56
+ const apiValidationController = new ApiValidationExternalApisController(client);
57
+ try {
58
+ const specFile = await this.getSpecFile(prompts, controller);
59
+ const apiValidationSummary = await this.getSpecValidationSummary(prompts, controller, specFile, apiValidationController);
60
+ const languages = await prompts.sdkLanguagesPrompt();
61
+ const workingDirectory = await this.getWorkingDirectory(prompts, controller, specFile, apiValidationSummary, languages);
62
+ const portalServePrompts = new PortalServePrompts();
63
+ const portalServeAction = new PortalServeAction(portalServePrompts, new ServeHandler(), new PortalService());
64
+ //TODO: This needs to be moved within the action. Port should not be initialized again here.
65
+ const port = await this.getServerPort(3000);
66
+ const buildDirectory = new DirectoryPath(workingDirectory, "src");
67
+ const portalDirectory = new DirectoryPath(workingDirectory, "portal");
68
+ const generatePortalAction = new GenerateAction(new DirectoryPath(this.config.configDir), null);
69
+ const serveFlags = {
70
+ folder: buildDirectory.toString(),
71
+ destination: portalDirectory.toString(),
72
+ port: port,
73
+ open: true,
74
+ "no-reload": false,
75
+ "auth-key": undefined
76
+ };
77
+ const serverPaths = {
78
+ sourceDirectoryPath: buildDirectory.toString(),
79
+ destinationDirectoryPath: portalDirectory.toString()
80
+ };
81
+ const servePortalResult = await portalServeAction.servePortal(serveFlags, serverPaths, generatePortalAction.execute);
82
+ if (servePortalResult.isFailed()) {
83
+ portalServePrompts.logError(getMessageInRedColor(servePortalResult.error));
84
+ return;
85
+ }
86
+ if (servePortalResult.isCancelled()) {
87
+ portalServePrompts.logError(getMessageInRedColor(servePortalResult.value));
88
+ return;
89
+ }
90
+ prompts.displayOutroMessage(buildDirectory.toString());
91
+ }
92
+ catch (error) {
93
+ this.error(getMessageInRedColor(error instanceof Error ? error.message : String(error)));
94
+ }
95
+ }
96
+ async getServerPort(port) {
97
+ const defaultPorts = [3000, 3001, 3002];
98
+ const preferredPorts = typeof port === "number" ? [port, ...defaultPorts.filter((p) => p !== port)] : defaultPorts;
99
+ return await getPort({ port: preferredPorts });
100
+ }
101
+ }
102
+ PortalQuickstart.description = "Create your first API Portal using APIMatic's Docs as Code offering.";
103
+ PortalQuickstart.examples = ["apimatic portal:quickstart"];
104
+ export default PortalQuickstart;
105
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/commands/portal/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,mCAAmC,EAAgC,MAAM,eAAe,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AAEpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAqB,gBAAiB,SAAQ,OAAO;IAK3C,KAAK,CAAC,WAAW,CACvB,OAAgC,EAChC,UAAsC;QAEtC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;QAE5C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAExD,OAAO,CAAC,4BAA4B,EAAE,CAAC;QAEvC,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,wBAAwB,CACpC,OAAgC,EAChC,UAAsC,EACtC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KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC3F,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,IAAwB;QAClD,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAExC,MAAM,cAAc,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QAEnH,OAAO,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;IACjD,CAAC;;AA7JM,4BAAW,GAAG,sEAAsE,CAAC;AAErF,yBAAQ,GAAG,CAAC,4BAA4B,CAAC,CAAC;eAH9B,gBAAgB"}
@@ -0,0 +1,10 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class PortalRecipeNew extends Command {
3
+ static summary: string;
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,38 @@
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { PortalRecipeAction } from "../../../actions/portal/recipe/new-recipe.js";
3
+ import { PortalRecipePrompts } from "../../../prompts/portal/recipe/new-recipe.js";
4
+ import { getMessageInRedColor } from "../../../utils/utils.js";
5
+ import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
6
+ import { RecipeCreationFailedEvent } from "../../../types/events/recipe-creation-failed.js";
7
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
8
+ import { FlagsProvider } from "../../../types/flags-provider.js";
9
+ const DEFAULT_WORKING_DIRECTORY = "./";
10
+ class PortalRecipeNew extends Command {
11
+ async run() {
12
+ var _a;
13
+ const { flags } = await this.parse(PortalRecipeNew);
14
+ const telemetryService = new TelemetryService(this.config.configDir);
15
+ const portalRecipeAction = new PortalRecipeAction();
16
+ const portalRecipePrompts = new PortalRecipePrompts();
17
+ const workingDirectory = new DirectoryPath((_a = flags.input) !== null && _a !== void 0 ? _a : DEFAULT_WORKING_DIRECTORY);
18
+ const buildDirectory = flags.input ? new DirectoryPath(flags.input, "src") : workingDirectory.join("src");
19
+ const createRecipeResult = await portalRecipeAction.createRecipe(buildDirectory, this.config.configDir, flags.name);
20
+ //TODO: Add a mapper for automatically mapping events to logger and telemetry service.
21
+ if (createRecipeResult.isFailed()) {
22
+ await telemetryService.trackEvent(new RecipeCreationFailedEvent(createRecipeResult.error, PortalRecipeNew.id, flags));
23
+ portalRecipePrompts.logError(getMessageInRedColor(createRecipeResult.error));
24
+ }
25
+ if (createRecipeResult.isCancelled()) {
26
+ portalRecipePrompts.logError(getMessageInRedColor(createRecipeResult.value));
27
+ }
28
+ }
29
+ }
30
+ PortalRecipeNew.summary = "Add an API Recipe to your API Documentation portal.";
31
+ PortalRecipeNew.description = "To learn more about API Recipes, visit: https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes";
32
+ PortalRecipeNew.examples = [
33
+ `apimatic portal:recipe:new`,
34
+ `apimatic portal:recipe:new --name="My API Recipe" --input="./"`
35
+ ];
36
+ PortalRecipeNew.flags = Object.assign({ name: Flags.string({ description: "name for the recipe" }) }, FlagsProvider.input);
37
+ export default PortalRecipeNew;
38
+ //# 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,MAAM,aAAa,C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;YAClC,MAAM,gBAAgB,CAAC,UAAU,CAAC,IAAI,yBAAyB,CAAC,kBAAkB,CAAC,KAAM,EAAE,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YACvH,mBAAmB,CAAC,QAAQ,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,KAAM,CAAC,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,kBAAkB,CAAC,WAAW,EAAE,EAAE,CAAC;YACrC,mBAAmB,CAAC,QAAQ,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,KAAM,CAAC,CAAC,CAAC;QAChF,CAAC;IACH,CAAC;;AAjCe,uBAAO,GAAG,qDAAqD,CAAC;AAEhE,2BAAW,GACzB,uIAAuI,CAAC;AAE1H,wBAAQ,GAAG;IACzB,4BAA4B;IAC5B,gEAAgE;CACjE,CAAC;AACc,qBAAK,mBACnB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC,IACvD,aAAa,CAAC,KAAK,EACtB;eAbiB,eAAe"}
@@ -0,0 +1,16 @@
1
+ import { Command, Config } from "@oclif/core";
2
+ export default class PortalServe extends Command {
3
+ static description: string;
4
+ static flags: {
5
+ "auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ open: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ "no-reload": import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ port: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ private readonly prompts;
12
+ constructor(argv: string[], config: Config);
13
+ static examples: string[];
14
+ run(): Promise<void>;
15
+ private getServerPort;
16
+ }
@@ -0,0 +1,80 @@
1
+ import getPort from "get-port";
2
+ import { Command, Flags } from "@oclif/core";
3
+ import { PortalServePrompts } from "../../prompts/portal/serve.js";
4
+ import { PortalServeAction } from "../../actions/portal/serve.js";
5
+ import { getMessageInRedColor } from "../../utils/utils.js";
6
+ import { ServeHandler } from "../../application/portal/serve/serve-handler.js";
7
+ import { PortalService } from "../../infrastructure/services/portal-service.js";
8
+ import { GenerateAction } from "../../actions/portal/generate.js";
9
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
10
+ import { FlagsProvider } from "../../types/flags-provider.js";
11
+ const DEFAULT_WORKING_DIRECTORY = "./";
12
+ class PortalServe extends Command {
13
+ constructor(argv, config) {
14
+ super(argv, config);
15
+ this.prompts = new PortalServePrompts();
16
+ }
17
+ async run() {
18
+ var _a;
19
+ const { flags } = await this.parse(PortalServe);
20
+ const portalServePrompts = new PortalServePrompts();
21
+ const portalServeAction = new PortalServeAction(portalServePrompts, new ServeHandler(), new PortalService());
22
+ //TODO: This needs to be moved within the action. Port should not be initialized again here.
23
+ const port = await this.getServerPort(flags.port);
24
+ const workingDirectory = new DirectoryPath((_a = flags.input) !== null && _a !== void 0 ? _a : DEFAULT_WORKING_DIRECTORY);
25
+ const buildDirectory = flags.input ? new DirectoryPath(flags.input, "src") : workingDirectory.join("src");
26
+ const portalDirectory = flags.destination ? new DirectoryPath(flags.destination) : workingDirectory.join("portal");
27
+ const generatePortalAction = new GenerateAction(new DirectoryPath(this.config.configDir), flags["auth-key"]);
28
+ const serveFlags = {
29
+ folder: buildDirectory.toString(),
30
+ destination: portalDirectory.toString(),
31
+ "auth-key": flags["auth-key"],
32
+ port: port,
33
+ open: flags.open,
34
+ "no-reload": flags["no-reload"]
35
+ };
36
+ const servePaths = {
37
+ sourceDirectoryPath: buildDirectory.toString(),
38
+ destinationDirectoryPath: portalDirectory.toString()
39
+ };
40
+ const servePortalResult = await portalServeAction.servePortal(serveFlags, servePaths, generatePortalAction.execute);
41
+ //TODO: Convert below statements to result.mapAll after changing servePortalResult to ActionResult.
42
+ if (servePortalResult.isFailed()) {
43
+ portalServePrompts.logError(getMessageInRedColor(servePortalResult.error));
44
+ }
45
+ if (servePortalResult.isCancelled()) {
46
+ portalServePrompts.logError(getMessageInRedColor(servePortalResult.value));
47
+ }
48
+ if (servePortalResult.isSuccess()) {
49
+ this.prompts.displayOutroMessage(buildDirectory.toString(), portalDirectory.toString(), port, flags["no-reload"]);
50
+ }
51
+ }
52
+ async getServerPort(port) {
53
+ const defaultPorts = [3000, 3001, 3002];
54
+ const preferredPorts = typeof port === "number" ? [port, ...defaultPorts.filter((p) => p !== port)] : defaultPorts;
55
+ const availablePort = await getPort({ port: preferredPorts });
56
+ // Show warning only if user provided --port and it is not available
57
+ if (typeof port === "number" && availablePort !== port) {
58
+ this.prompts.displayInfo(`⚠️ Port ${port} is already in use. Available port ${availablePort} will be used.`);
59
+ }
60
+ return availablePort;
61
+ }
62
+ }
63
+ PortalServe.description = "Generate and deploy a Docs as Code portal with hot reload.";
64
+ PortalServe.flags = Object.assign(Object.assign(Object.assign(Object.assign({ port: Flags.integer({
65
+ char: "p",
66
+ description: "[default: 3000] port to serve the portal."
67
+ }) }, FlagsProvider.input), FlagsProvider.destination("portal", "portal")), { open: Flags.boolean({
68
+ char: "o",
69
+ description: "Open the portal in the default browser.",
70
+ default: false
71
+ }), "no-reload": Flags.boolean({
72
+ description: "Disable hot reload.",
73
+ default: false
74
+ }) }), FlagsProvider.authKey);
75
+ PortalServe.examples = [
76
+ "apimatic portal:serve",
77
+ 'apimatic portal:serve --input="./" --destination="./portal" --port=3000 --open --no-reload'
78
+ ];
79
+ export default PortalServe;
80
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../../src/commands/portal/serve.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE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,EACxB;AASK,oBAAQ,GAAG;IAChB,uBAAuB;IACvB,4FAA4F;CAC7F,CAAC;eAhCiB,WAAW"}
@@ -0,0 +1,14 @@
1
+ import { Command, Config } from "@oclif/core";
2
+ export default class PortalTocNew extends Command {
3
+ static summary: string;
4
+ static description: string;
5
+ static flags: {
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>;
10
+ };
11
+ static examples: string[];
12
+ constructor(argv: string[], config: Config);
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,52 @@
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { PortalNewTocAction } from "../../../actions/portal/toc/new-toc.js";
3
+ import { TelemetryService } from "../../../infrastructure/services/telemetry-service.js";
4
+ import { TocCreationFailedEvent } from "../../../types/events/toc-creation-failed.js";
5
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
6
+ import { FlagsProvider } from "../../../types/flags-provider.js";
7
+ const DEFAULT_WORKING_DIRECTORY = "./";
8
+ class PortalTocNew extends Command {
9
+ constructor(argv, config) {
10
+ super(argv, config);
11
+ }
12
+ async run() {
13
+ var _a;
14
+ const { flags } = await this.parse(PortalTocNew);
15
+ const telemetryService = new TelemetryService(this.config.configDir);
16
+ const portalNewTocAction = new PortalNewTocAction();
17
+ const workingDirectory = new DirectoryPath((_a = flags.input) !== null && _a !== void 0 ? _a : DEFAULT_WORKING_DIRECTORY);
18
+ const buildDirectory = flags.input ? new DirectoryPath(flags.input, "src") : workingDirectory.join("src");
19
+ let tocDirectory;
20
+ if (flags.destination) {
21
+ tocDirectory = new DirectoryPath(flags.destination);
22
+ }
23
+ const result = await portalNewTocAction.createToc(buildDirectory, this.config.configDir, tocDirectory, flags.force, flags["expand-endpoints"], flags["expand-models"]);
24
+ //TODO: Add a mapper for automatically mapping events to logger and telemetry service.
25
+ if (result.isFailed()) {
26
+ await telemetryService.trackEvent(new TocCreationFailedEvent(result.error, PortalTocNew.id, flags));
27
+ this.error(result.error);
28
+ }
29
+ }
30
+ }
31
+ PortalTocNew.summary = "Generate a Table of Contents (TOC) file for your API documentation portal";
32
+ PortalTocNew.description = `This command generates a new Table of Contents (TOC) file used in the
33
+ generation of your API documentation portal.
34
+
35
+ The output is a YAML file with the .yml extension.
36
+
37
+ To learn more about the TOC file and APIMatic build directory structure, visit:
38
+ https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal`;
39
+ PortalTocNew.flags = Object.assign(Object.assign(Object.assign(Object.assign({}, FlagsProvider.destination("src/content", `'toc.yml'`)), FlagsProvider.input), FlagsProvider.force), { "expand-endpoints": Flags.boolean({
40
+ default: false,
41
+ description: "include individual entries for each endpoint in the generated 'toc.yml'. Requires a valid API specification in the working directory."
42
+ }), "expand-models": Flags.boolean({
43
+ default: false,
44
+ description: "include individual entries for each model in the generated 'toc.yml'. Requires a valid API specification in the working directory."
45
+ }) });
46
+ PortalTocNew.examples = [
47
+ `apimatic portal:toc:new --destination="./src/content/"`,
48
+ `apimatic portal:toc:new --input="./"`,
49
+ `apimatic portal:toc:new --input="./" --destination="./src/content/"`
50
+ ];
51
+ export default PortalTocNew;
52
+ //# sourceMappingURL=new.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new.js","sourceRoot":"","sources":["../../../../src/commands/portal/toc/new.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAs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CAAC,KAAM,EAAE,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;YACrG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAM,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;;AAjEM,oBAAO,GACZ,2EAA2E,CAAC;AAEvE,wBAAW,GAAG;;;;;;iHAM0F,CAAC;AAEzG,kBAAK,+DACP,aAAa,CAAC,WAAW,CAAC,aAAa,EAAE,WAAW,CAAC,GACrD,aAAa,CAAC,KAAK,GACnB,aAAa,CAAC,KAAK,KACtB,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC;QAChC,OAAO,EAAE,KAAK;QACd,WAAW,EACT,uIAAuI;KAC1I,CAAC,EACF,eAAe,EAAE,KAAK,CAAC,OAAO,CAAC;QAC7B,OAAO,EAAE,KAAK;QACd,WAAW,EACT,oIAAoI;KACvI,CAAC,IACF;AAEK,qBAAQ,GAAG;IAChB,wDAAwD;IACxD,sCAAsC;IACtC,qEAAqE;CACtE,CAAC;eAhCiB,YAAY"}
@@ -1,15 +1,16 @@
1
- import { Command, flags } from "@oclif/command";
1
+ import { Command } from "@oclif/core";
2
2
  export default class SdkGenerate extends Command {
3
3
  static description: string;
4
4
  static flags: {
5
- platform: flags.IOptionFlag<string>;
6
- file: flags.IOptionFlag<string>;
7
- url: flags.IOptionFlag<string>;
8
- destination: flags.IOptionFlag<string>;
9
- force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
10
- zip: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
11
- "auth-key": flags.IOptionFlag<string>;
5
+ "auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
+ zip: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ platform: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
11
  };
13
12
  static examples: string[];
13
+ private readonly prompts;
14
14
  run(): Promise<void>;
15
+ private getConfigDir;
15
16
  }
@@ -1,135 +1,46 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const path = require("path");
4
- const fs = require("fs-extra");
5
- const command_1 = require("@oclif/command");
6
- const sdk_client_1 = require("../../client-utils/sdk-client");
7
- const sdk_1 = require("@apimatic/sdk");
8
- const utils_1 = require("../../utils/utils");
9
- const generate_1 = require("../../controllers/sdk/generate");
10
- class SdkGenerate extends command_1.Command {
1
+ import { Command, Flags } from "@oclif/core";
2
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
3
+ import { FlagsProvider } from "../../types/flags-provider.js";
4
+ import { SdkGeneratePrompts } from "../../prompts/sdk/generate.js";
5
+ import { GenerateAction } from "../../actions/sdk/generate.js";
6
+ import { LanguagePlatform } from "../../types/sdk/generate.js";
7
+ const DEFAULT_WORKING_DIRECTORY = "./";
8
+ class SdkGenerate extends Command {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.prompts = new SdkGeneratePrompts();
12
+ this.getConfigDir = () => {
13
+ return new DirectoryPath(this.config.configDir);
14
+ };
15
+ }
11
16
  async run() {
12
- const { flags } = this.parse(SdkGenerate);
13
- const zip = flags.zip;
14
- const fileName = flags.file ? utils_1.getFileNameFromPath(flags.file) : utils_1.getFileNameFromPath(flags.url);
15
- const sdkFolderPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}`.toLowerCase());
16
- const zippedSDKPath = path.join(flags.destination, `${fileName}_sdk_${flags.platform}.zip`.toLowerCase());
17
- // Check if at destination, SDK already exists and throw error if force flag is not set for both zip and extracted
18
- if (fs.existsSync(sdkFolderPath) && !flags.force && !zip) {
19
- throw new Error(`Can't download SDK to path ${sdkFolderPath}, because it already exists`);
20
- }
21
- else if (fs.existsSync(zippedSDKPath) && !flags.force && zip) {
22
- throw new Error(`Can't download SDK to path ${zippedSDKPath}, because it already exists`);
23
- }
24
- try {
25
- if (!(await fs.pathExists(path.resolve(flags.destination)))) {
26
- throw new Error(`Destination path ${flags.destination} does not exist`);
27
- }
28
- else if (!(await fs.pathExists(path.resolve(flags.file)))) {
29
- throw new Error(`Specification file ${flags.file} does not exist`);
30
- }
31
- const overrideAuthKey = flags["auth-key"] ? flags["auth-key"] : null;
32
- const client = await sdk_client_1.SDKClient.getInstance().getClient(overrideAuthKey, this.config.configDir);
33
- const sdkGenerationController = new sdk_1.CodeGenerationExternalApisController(client);
34
- // Get generation id for the specification and platform
35
- const codeGenId = await generate_1.getSDKGenerationId(flags, sdkGenerationController);
36
- // If user wanted to download the SDK as well
37
- const sdkDownloadParams = {
38
- codeGenId,
39
- zippedSDKPath,
40
- sdkFolderPath,
41
- zip
42
- };
43
- const sdkPath = await generate_1.downloadGeneratedSDK(sdkDownloadParams, sdkGenerationController);
44
- this.log(`Success! Your SDK is located at ${sdkPath}`);
45
- }
46
- catch (error) {
47
- if (error.result) {
48
- const apiError = error;
49
- const result = apiError.result;
50
- if (apiError.statusCode === 400 && utils_1.isJSONParsable(result.message)) {
51
- const errors = JSON.parse(result.message);
52
- if (Array.isArray(errors.Errors) && apiError.statusCode === 400) {
53
- this.error(utils_1.replaceHTML(`${JSON.parse(result.message).Errors[0]}`));
54
- }
55
- }
56
- else if (apiError.statusCode === 401 && apiError.body && typeof apiError.body === "string") {
57
- this.error("You are not authorized to perform this action");
58
- }
59
- else if (apiError.statusCode === 500 &&
60
- apiError.body &&
61
- typeof apiError.body === "string" &&
62
- utils_1.isJSONParsable(apiError.body)) {
63
- this.error(JSON.parse(apiError.body).message);
64
- }
65
- else if (apiError.statusCode === 422 &&
66
- apiError.body &&
67
- typeof apiError.body === "string" &&
68
- utils_1.isJSONParsable(apiError.body)) {
69
- this.error(JSON.parse(apiError.body)["dto.Url"][0]);
70
- }
71
- else {
72
- this.error(utils_1.replaceHTML(result.message));
73
- }
74
- }
75
- else if (error.statusCode === 401) {
76
- this.error("You are not authorized to perform this action");
77
- }
78
- else if (error.statusCode === 402 &&
79
- error.body &&
80
- typeof error.body === "string") {
81
- this.error(utils_1.replaceHTML(error.body));
82
- }
83
- else {
84
- this.error(`${error.message}`);
85
- }
86
- }
17
+ const { flags: { platform, spec, destination, force, zip: zipSdk, "auth-key": authKey } } = await this.parse(SdkGenerate);
18
+ const workingDirectory = new DirectoryPath(DEFAULT_WORKING_DIRECTORY);
19
+ const specDirectory = new DirectoryPath(spec);
20
+ const sdkDirectory = destination ? new DirectoryPath(destination) : workingDirectory.join("sdk").join(platform);
21
+ var action = new GenerateAction(this.getConfigDir(), authKey);
22
+ const result = await action.execute(specDirectory, sdkDirectory, platform, force, zipSdk);
23
+ result.mapAll(() => this.prompts.displayOutroMessage(sdkDirectory), (message) => this.prompts.logError(message));
87
24
  }
88
25
  }
89
- exports.default = SdkGenerate;
90
- SdkGenerate.description = "Generate SDK for your APIs";
91
- SdkGenerate.flags = {
92
- platform: command_1.flags.string({
93
- parse: (input) => input.toUpperCase(),
26
+ SdkGenerate.description = "Generate an SDK for your API";
27
+ SdkGenerate.flags = Object.assign(Object.assign(Object.assign({ platform: Flags.string({
94
28
  required: true,
95
- description: `language platform for sdk
96
- Simple: CSHARP|JAVA|PYTHON|RUBY|PHP|TYPESCRIPT
97
- Legacy: CS_NET_STANDARD_LIB|JAVA_ECLIPSE_JRE_LIB|PHP_GENERIC_LIB|PYTHON_GENERIC_LIB|RUBY_GENERIC_LIB|TS_GENERIC_LIB`
98
- }),
99
- file: command_1.flags.string({
100
- parse: (input) => path.resolve(input),
101
- default: "",
102
- description: "path to the API specification to generate SDKs for"
103
- }),
104
- url: command_1.flags.string({
105
- default: "",
106
- description: "URL to the API specification to generate SDKs for. Can be used in place of the --file option if the API specification is publicly available."
107
- }),
108
- destination: command_1.flags.string({
109
- parse: (input) => path.resolve(input),
110
- default: path.resolve("./"),
111
- description: "directory to download the generated SDK to"
112
- }),
113
- force: command_1.flags.boolean({
114
- char: "f",
29
+ options: Object.values(LanguagePlatform).map((p) => p.toString()),
30
+ description: `language platform for sdk`
31
+ }), spec: Flags.string({
32
+ description: "path to the folder containing the API specification file.",
33
+ default: "./src/spec"
34
+ }), destination: Flags.string({
35
+ char: "d",
36
+ description: `[default: ./sdk/<platform>] path where the sdk will be generated.`
37
+ }) }, FlagsProvider.force), { zip: Flags.boolean({
115
38
  default: false,
116
- description: "overwrite if an SDK already exists in the destination"
117
- }),
118
- zip: command_1.flags.boolean({ default: false, description: "download the generated SDK as a .zip archive" }),
119
- "auth-key": command_1.flags.string({
120
- default: "",
121
- description: "override current authentication state with an authentication key"
122
- })
123
- };
39
+ description: "download the generated SDK as a .zip archive"
40
+ }) }), FlagsProvider.authKey);
124
41
  SdkGenerate.examples = [
125
- `$ apimatic sdk:generate --platform="CSHARP" --file="./specs/sample.json"
126
- Generating SDK... done
127
- Downloading SDK... done
128
- Success! Your SDK is located at swagger_sdk_csharp`,
129
- `
130
- $ apimatic sdk:generate --platform="CSHARP" --url=https://petstore.swagger.io/v2/swagger.json
131
- Generating SDK... done
132
- Downloading SDK... done
133
- Success! Your SDK is located at swagger_sdk_csharp
134
- `
42
+ `apimatic sdk:generate --platform="java"`,
43
+ `apimatic sdk:generate --platform="csharp" --spec="./src/spec"`
135
44
  ];
45
+ export default SdkGenerate;
46
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/commands/sdk/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO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AAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAC5C,CAAC;IACJ,CAAC;;AA9CM,uBAAW,GAAG,8BAA8B,AAAjC,CAAkC;AAC7C,iBAAK,+CACV,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC;QACrB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;QACjE,WAAW,EAAE,2BAA2B;KACzC,CAAC,EACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,2DAA2D;QACxE,OAAO,EAAE,YAAY;KACtB,CAAC,EACF,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;QACxB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mEAAmE;KACjF,CAAC,IACC,aAAa,CAAC,KAAK,KACtB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;QACjB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,8CAA8C;KAC5D,CAAC,KACC,aAAa,CAAC,OAAO,CAnBd,CAoBV;AAEK,oBAAQ,GAAG;IAChB,yCAAyC;IACzC,+DAA+D;CAChE,AAHc,CAGb;eA3BiB,WAAW"}
@@ -0,0 +1,2 @@
1
+ declare const axiosInstance: import("axios").AxiosInstance;
2
+ export default axiosInstance;
@@ -0,0 +1,10 @@
1
+ import axios from "axios";
2
+ const fiftyMBsInBytes = 50 * 1024 * 1024;
3
+ const fiveMinutesInMilliseconds = 5 * 60 * 1000;
4
+ const axiosInstance = axios.create({
5
+ maxContentLength: fiftyMBsInBytes,
6
+ maxBodyLength: fiftyMBsInBytes,
7
+ timeout: fiveMinutesInMilliseconds
8
+ });
9
+ export default axiosInstance;
10
+ //# sourceMappingURL=axios-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios-config.js","sourceRoot":"","sources":["../../src/config/axios-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,yBAAyB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEhD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC;IACjC,gBAAgB,EAAE,eAAe;IACjC,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,yBAAyB;CACnC,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
@@ -1 +1,26 @@
1
- export declare const baseURL = "https://www.apimatic.io/api";
1
+ export declare const baseURL = "https://api.apimatic.io";
2
+ export declare const metadataFileContent: {
3
+ ImportSettings: {
4
+ AutoGenerateTestCases: boolean;
5
+ ImportAdditionalHeader: boolean;
6
+ ImportAdditionalTypeCombinatorModels: boolean;
7
+ ImportTypeCombinatorsWithOnlyOneType: boolean;
8
+ };
9
+ CodeGenSettings: {
10
+ Timeout: number;
11
+ ValidateRequiredParameters: boolean;
12
+ AddSingleAuthDeprecatedCode: boolean;
13
+ EnableGlobalUserAgent: boolean;
14
+ UserAgent: string;
15
+ EnableLogging: boolean;
16
+ EnableModelKeywordArgsInRuby: boolean;
17
+ SymbolizeHashKeysInRuby: boolean;
18
+ ReturnCompleteHttpResponse: boolean;
19
+ UserConfigurableRetries: boolean;
20
+ UseEnumPrefix: boolean;
21
+ ExtendedAdditionalPropertiesSupport: boolean;
22
+ EnforceStandardizedCasing: boolean;
23
+ ControllerPostfix: string;
24
+ DoNotSplitWords: string[];
25
+ };
26
+ };