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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/README.md +119 -91
  2. package/lib/actions/action-result.d.ts +8 -3
  3. package/lib/actions/action-result.js +34 -15
  4. package/lib/actions/action-result.js.map +1 -1
  5. package/lib/actions/api/transform.d.ts +15 -0
  6. package/lib/actions/api/transform.js +48 -0
  7. package/lib/actions/api/transform.js.map +1 -0
  8. package/lib/actions/api/validate.d.ts +12 -0
  9. package/lib/actions/api/validate.js +41 -0
  10. package/lib/actions/api/validate.js.map +1 -0
  11. package/lib/actions/auth/login.d.ts +6 -5
  12. package/lib/actions/auth/login.js +25 -33
  13. package/lib/actions/auth/login.js.map +1 -1
  14. package/lib/actions/auth/logout.d.ts +8 -0
  15. package/lib/actions/auth/logout.js +15 -0
  16. package/lib/actions/auth/logout.js.map +1 -0
  17. package/lib/actions/auth/status.d.ts +11 -0
  18. package/lib/actions/auth/status.js +26 -0
  19. package/lib/actions/auth/status.js.map +1 -0
  20. package/lib/actions/portal/copilot.d.ts +7 -2
  21. package/lib/actions/portal/copilot.js +72 -32
  22. package/lib/actions/portal/copilot.js.map +1 -1
  23. package/lib/actions/portal/generate.d.ts +5 -5
  24. package/lib/actions/portal/generate.js +33 -35
  25. package/lib/actions/portal/generate.js.map +1 -1
  26. package/lib/actions/portal/quickstart.d.ts +16 -0
  27. package/lib/actions/portal/quickstart.js +145 -0
  28. package/lib/actions/portal/quickstart.js.map +1 -0
  29. package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
  30. package/lib/actions/portal/recipe/new-recipe.js +147 -221
  31. package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
  32. package/lib/actions/portal/serve.d.ts +12 -10
  33. package/lib/actions/portal/serve.js +112 -17
  34. package/lib/actions/portal/serve.js.map +1 -1
  35. package/lib/actions/portal/toc/new-toc.d.ts +16 -15
  36. package/lib/actions/portal/toc/new-toc.js +80 -116
  37. package/lib/actions/portal/toc/new-toc.js.map +1 -1
  38. package/lib/actions/sdk/generate.d.ts +5 -6
  39. package/lib/actions/sdk/generate.js +22 -47
  40. package/lib/actions/sdk/generate.js.map +1 -1
  41. package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
  42. package/lib/application/portal/recipe/portal-recipe.js +9 -9
  43. package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
  44. package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
  45. package/lib/application/portal/recipe/recipe-generator.js +21 -22
  46. package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
  47. package/lib/client-utils/auth-manager.d.ts +1 -1
  48. package/lib/client-utils/auth-manager.js +3 -4
  49. package/lib/client-utils/auth-manager.js.map +1 -1
  50. package/lib/commands/api/transform.d.ts +6 -3
  51. package/lib/commands/api/transform.js +43 -91
  52. package/lib/commands/api/transform.js.map +1 -1
  53. package/lib/commands/api/validate.d.ts +6 -3
  54. package/lib/commands/api/validate.js +27 -60
  55. package/lib/commands/api/validate.js.map +1 -1
  56. package/lib/commands/auth/login.d.ts +2 -1
  57. package/lib/commands/auth/login.js +15 -9
  58. package/lib/commands/auth/login.js.map +1 -1
  59. package/lib/commands/auth/logout.d.ts +3 -1
  60. package/lib/commands/auth/logout.js +12 -13
  61. package/lib/commands/auth/logout.js.map +1 -1
  62. package/lib/commands/auth/status.d.ts +1 -0
  63. package/lib/commands/auth/status.js +13 -11
  64. package/lib/commands/auth/status.js.map +1 -1
  65. package/lib/commands/portal/copilot.d.ts +3 -2
  66. package/lib/commands/portal/copilot.js +23 -21
  67. package/lib/commands/portal/copilot.js.map +1 -1
  68. package/lib/commands/portal/generate.d.ts +3 -4
  69. package/lib/commands/portal/generate.js +18 -13
  70. package/lib/commands/portal/generate.js.map +1 -1
  71. package/lib/commands/portal/quickstart.d.ts +3 -4
  72. package/lib/commands/portal/quickstart.js +27 -95
  73. package/lib/commands/portal/quickstart.js.map +1 -1
  74. package/lib/commands/portal/recipe/new.d.ts +3 -1
  75. package/lib/commands/portal/recipe/new.js +31 -23
  76. package/lib/commands/portal/recipe/new.js.map +1 -1
  77. package/lib/commands/portal/serve.d.ts +5 -5
  78. package/lib/commands/portal/serve.js +31 -57
  79. package/lib/commands/portal/serve.js.map +1 -1
  80. package/lib/commands/portal/toc/new.d.ts +2 -2
  81. package/lib/commands/portal/toc/new.js +35 -26
  82. package/lib/commands/portal/toc/new.js.map +1 -1
  83. package/lib/commands/sdk/generate.d.ts +5 -4
  84. package/lib/commands/sdk/generate.js +26 -17
  85. package/lib/commands/sdk/generate.js.map +1 -1
  86. package/lib/hooks/not-found.d.ts +3 -0
  87. package/lib/hooks/not-found.js +52 -0
  88. package/lib/hooks/not-found.js.map +1 -0
  89. package/lib/hooks/utils.d.ts +5 -0
  90. package/lib/hooks/utils.js +51 -0
  91. package/lib/hooks/utils.js.map +1 -0
  92. package/lib/infrastructure/api-utils.js +3 -2
  93. package/lib/infrastructure/api-utils.js.map +1 -1
  94. package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
  95. package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
  96. package/lib/infrastructure/debounce-service.js.map +1 -0
  97. package/lib/infrastructure/env-info.d.ts +5 -1
  98. package/lib/infrastructure/env-info.js +23 -2
  99. package/lib/infrastructure/env-info.js.map +1 -1
  100. package/lib/infrastructure/file-service.d.ts +7 -2
  101. package/lib/infrastructure/file-service.js +49 -8
  102. package/lib/infrastructure/file-service.js.map +1 -1
  103. package/lib/infrastructure/launcher-service.d.ts +7 -0
  104. package/lib/infrastructure/launcher-service.js +51 -0
  105. package/lib/infrastructure/launcher-service.js.map +1 -0
  106. package/lib/infrastructure/network-service.d.ts +3 -0
  107. package/lib/infrastructure/network-service.js +7 -0
  108. package/lib/infrastructure/network-service.js.map +1 -0
  109. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  110. package/lib/infrastructure/services/api-client-factory.js +20 -0
  111. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  112. package/lib/infrastructure/services/api-service.d.ts +2 -2
  113. package/lib/infrastructure/services/api-service.js +8 -7
  114. package/lib/infrastructure/services/api-service.js.map +1 -1
  115. package/lib/infrastructure/services/auth-service.d.ts +1 -1
  116. package/lib/infrastructure/services/auth-service.js +10 -6
  117. package/lib/infrastructure/services/auth-service.js.map +1 -1
  118. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  119. package/lib/infrastructure/services/file-download-service.js +104 -0
  120. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  121. package/lib/infrastructure/services/portal-service.d.ts +12 -11
  122. package/lib/infrastructure/services/portal-service.js +77 -83
  123. package/lib/infrastructure/services/portal-service.js.map +1 -1
  124. package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
  125. package/lib/infrastructure/services/telemetry-service.js +4 -6
  126. package/lib/infrastructure/services/telemetry-service.js.map +1 -1
  127. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  128. package/lib/infrastructure/services/transformation-service.js +56 -0
  129. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  130. package/lib/infrastructure/services/validation-service.d.ts +17 -0
  131. package/lib/infrastructure/services/validation-service.js +49 -0
  132. package/lib/infrastructure/services/validation-service.js.map +1 -0
  133. package/lib/prompts/api/transform.d.ts +11 -0
  134. package/lib/prompts/api/transform.js +30 -0
  135. package/lib/prompts/api/transform.js.map +1 -0
  136. package/lib/prompts/api/validate.d.ts +12 -0
  137. package/lib/prompts/api/validate.js +41 -0
  138. package/lib/prompts/api/validate.js.map +1 -0
  139. package/lib/prompts/auth/login.d.ts +6 -1
  140. package/lib/prompts/auth/login.js +12 -3
  141. package/lib/prompts/auth/login.js.map +1 -1
  142. package/lib/prompts/auth/logout.d.ts +3 -0
  143. package/lib/prompts/auth/logout.js +7 -0
  144. package/lib/prompts/auth/logout.js.map +1 -0
  145. package/lib/prompts/auth/status.d.ts +8 -0
  146. package/lib/prompts/auth/status.js +21 -0
  147. package/lib/prompts/auth/status.js.map +1 -0
  148. package/lib/prompts/format.d.ts +33 -0
  149. package/lib/prompts/format.js +99 -0
  150. package/lib/prompts/format.js.map +1 -0
  151. package/lib/prompts/portal/copilot.d.ts +15 -5
  152. package/lib/prompts/portal/copilot.js +49 -21
  153. package/lib/prompts/portal/copilot.js.map +1 -1
  154. package/lib/prompts/portal/generate.d.ts +9 -7
  155. package/lib/prompts/portal/generate.js +22 -23
  156. package/lib/prompts/portal/generate.js.map +1 -1
  157. package/lib/prompts/portal/quickstart.d.ts +30 -29
  158. package/lib/prompts/portal/quickstart.js +99 -193
  159. package/lib/prompts/portal/quickstart.js.map +1 -1
  160. package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
  161. package/lib/prompts/portal/recipe/new-recipe.js +70 -108
  162. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
  163. package/lib/prompts/portal/serve.d.ts +10 -3
  164. package/lib/prompts/portal/serve.js +30 -11
  165. package/lib/prompts/portal/serve.js.map +1 -1
  166. package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
  167. package/lib/prompts/portal/toc/new-toc.js +20 -22
  168. package/lib/prompts/portal/toc/new-toc.js.map +1 -1
  169. package/lib/prompts/sdk/generate.d.ts +7 -7
  170. package/lib/prompts/sdk/generate.js +17 -23
  171. package/lib/prompts/sdk/generate.js.map +1 -1
  172. package/lib/types/api/account.d.ts +1 -1
  173. package/lib/types/api/transform.d.ts +14 -25
  174. package/lib/types/api/transform.js +16 -16
  175. package/lib/types/api/transform.js.map +1 -1
  176. package/lib/types/build/build.d.ts +9 -1
  177. package/lib/types/build/build.js +5 -2
  178. package/lib/types/build/build.js.map +1 -1
  179. package/lib/types/build-context.d.ts +5 -1
  180. package/lib/types/build-context.js +21 -4
  181. package/lib/types/build-context.js.map +1 -1
  182. package/lib/types/common/command-metadata.d.ts +4 -0
  183. package/lib/types/common/command-metadata.js +2 -0
  184. package/lib/types/common/command-metadata.js.map +1 -0
  185. package/lib/types/events/domain-event.d.ts +1 -1
  186. package/lib/types/events/domain-event.js.map +1 -1
  187. package/lib/types/events/quickstart-completed.d.ts +7 -0
  188. package/lib/types/events/quickstart-completed.js +10 -0
  189. package/lib/types/events/quickstart-completed.js.map +1 -0
  190. package/lib/types/events/quickstart-initiated.d.ts +7 -0
  191. package/lib/types/events/quickstart-initiated.js +10 -0
  192. package/lib/types/events/quickstart-initiated.js.map +1 -0
  193. package/lib/types/events/recipe-creation-failed.d.ts +1 -1
  194. package/lib/types/events/recipe-creation-failed.js +1 -1
  195. package/lib/types/events/recipe-creation-failed.js.map +1 -1
  196. package/lib/types/events/toc-creation-failed.d.ts +1 -1
  197. package/lib/types/events/toc-creation-failed.js +1 -1
  198. package/lib/types/events/toc-creation-failed.js.map +1 -1
  199. package/lib/types/file/directory.d.ts +17 -0
  200. package/lib/types/file/directory.js +86 -0
  201. package/lib/types/file/directory.js.map +1 -0
  202. package/lib/types/file/directoryPath.d.ts +3 -1
  203. package/lib/types/file/directoryPath.js +8 -2
  204. package/lib/types/file/directoryPath.js.map +1 -1
  205. package/lib/types/file/fileName.d.ts +3 -1
  206. package/lib/types/file/fileName.js +14 -2
  207. package/lib/types/file/fileName.js.map +1 -1
  208. package/lib/types/file/filePath.d.ts +2 -0
  209. package/lib/types/file/filePath.js +21 -0
  210. package/lib/types/file/filePath.js.map +1 -1
  211. package/lib/types/file/resource-input.d.ts +5 -0
  212. package/lib/types/file/resource-input.js +42 -0
  213. package/lib/types/file/resource-input.js.map +1 -0
  214. package/lib/types/file/urlPath.d.ts +6 -0
  215. package/lib/types/file/urlPath.js +22 -0
  216. package/lib/types/file/urlPath.js.map +1 -0
  217. package/lib/types/portal-context.d.ts +3 -1
  218. package/lib/types/portal-context.js +10 -0
  219. package/lib/types/portal-context.js.map +1 -1
  220. package/lib/types/recipe/recipe.d.ts +2 -17
  221. package/lib/types/recipe-context.d.ts +8 -0
  222. package/lib/types/recipe-context.js +21 -0
  223. package/lib/types/recipe-context.js.map +1 -0
  224. package/lib/types/resource-context.d.ts +12 -0
  225. package/lib/types/resource-context.js +30 -0
  226. package/lib/types/resource-context.js.map +1 -0
  227. package/lib/types/sdk/generate.d.ts +2 -15
  228. package/lib/types/sdk/generate.js +24 -10
  229. package/lib/types/sdk/generate.js.map +1 -1
  230. package/lib/types/sdk-context.d.ts +6 -5
  231. package/lib/types/sdk-context.js +12 -8
  232. package/lib/types/sdk-context.js.map +1 -1
  233. package/lib/types/sdl/sdl.d.ts +9 -0
  234. package/lib/types/sdl/sdl.js +46 -1
  235. package/lib/types/sdl/sdl.js.map +1 -1
  236. package/lib/types/spec-context.d.ts +3 -0
  237. package/lib/types/spec-context.js +7 -2
  238. package/lib/types/spec-context.js.map +1 -1
  239. package/lib/types/temp-context.d.ts +11 -0
  240. package/lib/types/temp-context.js +27 -0
  241. package/lib/types/temp-context.js.map +1 -0
  242. package/lib/types/toc-context.d.ts +12 -0
  243. package/lib/types/toc-context.js +26 -0
  244. package/lib/types/toc-context.js.map +1 -0
  245. package/lib/types/transform-context.d.ts +13 -0
  246. package/lib/types/transform-context.js +30 -0
  247. package/lib/types/transform-context.js.map +1 -0
  248. package/lib/types/utils.d.ts +0 -9
  249. package/lib/utils/string-utils.d.ts +1 -0
  250. package/lib/utils/string-utils.js +10 -0
  251. package/lib/utils/string-utils.js.map +1 -0
  252. package/lib/utils/utils.d.ts +2 -27
  253. package/lib/utils/utils.js +6 -145
  254. package/lib/utils/utils.js.map +1 -1
  255. package/package.json +11 -10
  256. package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
  257. package/lib/application/portal/serve/portal-watcher.js +0 -64
  258. package/lib/application/portal/serve/portal-watcher.js.map +0 -1
  259. package/lib/application/portal/serve/serve-handler.d.ts +0 -16
  260. package/lib/application/portal/serve/serve-handler.js +0 -91
  261. package/lib/application/portal/serve/serve-handler.js.map +0 -1
  262. package/lib/application/portal/serve/watcher-handler.js.map +0 -1
  263. package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
  264. package/lib/application/portal/toc/sdl-parser.js +0 -90
  265. package/lib/application/portal/toc/sdl-parser.js.map +0 -1
  266. package/lib/client-utils/sdk-client.d.ts +0 -22
  267. package/lib/client-utils/sdk-client.js +0 -89
  268. package/lib/client-utils/sdk-client.js.map +0 -1
  269. package/lib/config/env.d.ts +0 -26
  270. package/lib/config/env.js +0 -27
  271. package/lib/config/env.js.map +0 -1
  272. package/lib/controllers/api/transform.d.ts +0 -5
  273. package/lib/controllers/api/transform.js +0 -50
  274. package/lib/controllers/api/transform.js.map +0 -1
  275. package/lib/controllers/api/validate.d.ts +0 -3
  276. package/lib/controllers/api/validate.js +0 -29
  277. package/lib/controllers/api/validate.js.map +0 -1
  278. package/lib/controllers/portal/quickstart.d.ts +0 -15
  279. package/lib/controllers/portal/quickstart.js +0 -217
  280. package/lib/controllers/portal/quickstart.js.map +0 -1
  281. package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
  282. package/lib/prompts/portal/common/base-prompts.js +0 -19
  283. package/lib/prompts/portal/common/base-prompts.js.map +0 -1
  284. package/lib/types/api/validate.d.ts +0 -12
  285. package/lib/types/api/validate.js +0 -2
  286. package/lib/types/api/validate.js.map +0 -1
  287. package/lib/types/common/result.d.ts +0 -17
  288. package/lib/types/common/result.js +0 -32
  289. package/lib/types/common/result.js.map +0 -1
  290. package/lib/types/portal/generate.d.ts +0 -13
  291. package/lib/types/portal/generate.js +0 -3
  292. package/lib/types/portal/generate.js.map +0 -1
  293. package/lib/types/portal/quickstart.d.ts +0 -17
  294. package/lib/types/portal/quickstart.js +0 -2
  295. package/lib/types/portal/quickstart.js.map +0 -1
  296. package/lib/types/portal/serve.d.ts +0 -12
  297. package/lib/types/portal/serve.js +0 -2
  298. package/lib/types/portal/serve.js.map +0 -1
  299. package/lib/validators/common/directoryValidator.d.ts +0 -5
  300. package/lib/validators/common/directoryValidator.js +0 -22
  301. package/lib/validators/common/directoryValidator.js.map +0 -1
  302. package/lib/validators/portal/serve-validator.d.ts +0 -6
  303. package/lib/validators/portal/serve-validator.js +0 -15
  304. package/lib/validators/portal/serve-validator.js.map +0 -1
@@ -1,89 +0,0 @@
1
- import base64 from "base-64";
2
- import axios from "axios";
3
- import { Client } from "@apimatic/sdk";
4
- import { baseURL } from "../config/env.js";
5
- import { getAuthInfo, removeAuthInfo, setAuthInfo } from "./auth-manager.js";
6
- import { DirectoryPath } from "../types/file/directoryPath.js";
7
- export class SDKClient {
8
- /**
9
- * The static method that controls the access to the SDKClient instance.
10
- *
11
- * This implementation let you subclass the SDKClient class while keeping
12
- * just one instance of each subclass around.
13
- */
14
- static getInstance() {
15
- if (!SDKClient.instance) {
16
- SDKClient.instance = new SDKClient();
17
- }
18
- return SDKClient.instance;
19
- }
20
- /**
21
- * Finally, any SDKClient should define some business logic, which can be
22
- * executed on its instance.
23
- */
24
- async login(email, password, configDir) {
25
- const credentials = { email, password };
26
- const authKey = await this.getAuthKey(credentials);
27
- const isTelemetryOptedOut = process.env.APIMATIC_CLI_TELEMETRY_OPTOUT === "1";
28
- await setAuthInfo(email, authKey, isTelemetryOptedOut, new DirectoryPath(configDir));
29
- return "Logged in successfully as " + email;
30
- }
31
- async logout(configDir) {
32
- await removeAuthInfo(configDir);
33
- return "Logged out";
34
- }
35
- async status(configDir) {
36
- try {
37
- let storedAuthInfo = await getAuthInfo(configDir);
38
- if (!storedAuthInfo) {
39
- // If no config file or no credentials exist in the config file
40
- storedAuthInfo = { email: "", authKey: "" };
41
- }
42
- return storedAuthInfo.email === "" && storedAuthInfo.authKey === ""
43
- ? "Not logged in"
44
- : storedAuthInfo.email === "" && storedAuthInfo.authKey !== ""
45
- ? "Logged in with authentication key"
46
- : `Currently logged in as ${storedAuthInfo.email}`;
47
- }
48
- catch (error) {
49
- throw error;
50
- }
51
- }
52
- async getClient(overrideAuthKey, configDir) {
53
- if (overrideAuthKey) {
54
- return new Client({
55
- timeout: 0,
56
- customHeaderAuthenticationCredentials: {
57
- Authorization: `X-Auth-Key ${overrideAuthKey}`
58
- }
59
- });
60
- }
61
- let storedAuthInfo = await getAuthInfo(configDir);
62
- if (!storedAuthInfo) {
63
- // If no config file or no credentials exist in the config file
64
- storedAuthInfo = { email: "", authKey: "" };
65
- }
66
- if (storedAuthInfo.authKey !== "") {
67
- return new Client({
68
- timeout: 0,
69
- customHeaderAuthenticationCredentials: {
70
- Authorization: `X-Auth-Key ${storedAuthInfo.authKey}`
71
- }
72
- });
73
- }
74
- else {
75
- throw new Error("Please login first or provide an authKey");
76
- }
77
- }
78
- async getAuthKey(credentials) {
79
- const config = {
80
- headers: {
81
- Authorization: `Basic ${base64.encode(`${credentials.email}:${credentials.password}`)}`
82
- }
83
- };
84
- const response = await axios.get(SDKClient.authAPI, config);
85
- return response.data.EncryptedValue;
86
- }
87
- }
88
- SDKClient.authAPI = `${baseURL}/account/authkey`;
89
- //# sourceMappingURL=sdk-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk-client.js","sourceRoot":"","sources":["../../src/client-utils/sdk-client.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAY,WAAW,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAU/D,MAAM,OAAO,SAAS;IAKpB;;;;;OAKG;IACI,MAAM,CAAC,WAAW;QACvB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;YACxB,SAAS,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;QACvC,CAAC;QAED,OAAO,SAAS,CAAC,QAAQ,CAAC;IAC5B,CAAC;IAED;;;OAGG;IAEI,KAAK,CAAC,KAAK,CAAC,KA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,IAAI,MAAM,CAAC;gBAChB,OAAO,EAAE,CAAC;gBACV,qCAAqC,EAAE;oBACrC,aAAa,EAAE,cAAc,eAAe,EAAE;iBAC/C;aACF,CAAC,CAAC;QACL,CAAC;QACD,IAAI,cAAc,GAAoB,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;QAEnE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,+DAA+D;YAC/D,cAAc,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;QAC9C,CAAC;QACD,IAAI,cAAc,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;YAClC,OAAO,IAAI,MAAM,CAAC;gBAChB,OAAO,EAAE,CAAC;gBACV,qCAAqC,EAAE;oBACrC,aAAa,EAAE,cAAc,cAAc,CAAC,OAAO,EAAE;iBACtD;aACF,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,WAAwB;QAC/C,MAAM,MAAM,GAAG;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,MAAM,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE;aACxF;SACF,CAAC;QACF,MAAM,QAAQ,GAAkB,MAAM,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC3E,OAAO,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC;IACtC,CAAC;;AA1Fc,iBAAO,GAAG,GAAG,OAAO,kBAAkB,CAAC"}
@@ -1,26 +0,0 @@
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
- };
package/lib/config/env.js DELETED
@@ -1,27 +0,0 @@
1
- export const baseURL = "https://api.apimatic.io";
2
- export const metadataFileContent = {
3
- ImportSettings: {
4
- AutoGenerateTestCases: false,
5
- ImportAdditionalHeader: false,
6
- ImportAdditionalTypeCombinatorModels: false,
7
- ImportTypeCombinatorsWithOnlyOneType: false
8
- },
9
- CodeGenSettings: {
10
- Timeout: 30,
11
- ValidateRequiredParameters: true,
12
- AddSingleAuthDeprecatedCode: false,
13
- EnableGlobalUserAgent: true,
14
- UserAgent: "{language}-SDK/{version} (OS: {os-info}, Engine: {engine}/{engine-version})",
15
- EnableLogging: true,
16
- EnableModelKeywordArgsInRuby: true,
17
- SymbolizeHashKeysInRuby: true,
18
- ReturnCompleteHttpResponse: true,
19
- UserConfigurableRetries: true,
20
- UseEnumPrefix: false,
21
- ExtendedAdditionalPropertiesSupport: true,
22
- EnforceStandardizedCasing: true,
23
- ControllerPostfix: "Api",
24
- DoNotSplitWords: ["oauth"]
25
- }
26
- };
27
- //# sourceMappingURL=env.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/config/env.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,yBAAyB,CAAC;AACjD,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc,EAAE;QACd,qBAAqB,EAAE,KAAK;QAC5B,sBAAsB,EAAE,KAAK;QAC7B,oCAAoC,EAAE,KAAK;QAC3C,oCAAoC,EAAE,KAAK;KAC5C;IACD,eAAe,EAAE;QACf,OAAO,EAAE,EAAE;QACX,0BAA0B,EAAE,IAAI;QAChC,2BAA2B,EAAE,KAAK;QAClC,qBAAqB,EAAE,IAAI;QAC3B,SAAS,EAAE,6EAA6E;QACxF,aAAa,EAAE,IAAI;QACnB,4BAA4B,EAAE,IAAI;QAClC,uBAAuB,EAAE,IAAI;QAC7B,0BAA0B,EAAE,IAAI;QAChC,uBAAuB,EAAE,IAAI;QAC7B,aAAa,EAAE,KAAK;QACpB,mCAAmC,EAAE,IAAI;QACzC,yBAAyB,EAAE,IAAI;QAC/B,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,CAAC,OAAO,CAAC;KAC3B;CACF,CAAC"}
@@ -1,5 +0,0 @@
1
- import { DownloadTransformationParams, TransformationIdParams } from "../../types/api/transform.js";
2
- import { ExportFormats, Transformation, TransformationController } from "@apimatic/sdk";
3
- export declare const getTransformationId: ({ file, url, format }: TransformationIdParams, transformationController: TransformationController) => Promise<Transformation>;
4
- export declare const downloadTransformationFile: ({ id, destinationFilePath, transformationController }: DownloadTransformationParams) => Promise<string>;
5
- export declare const getValidFormat: (format: string) => ExportFormats;
@@ -1,50 +0,0 @@
1
- import { ux } from "@oclif/core";
2
- import fsExtra from "fs-extra";
3
- import { writeFileUsingReadableStream } from "../../utils/utils.js";
4
- import { TransformationFormats } from "../../types/api/transform.js";
5
- import { ContentType, ExportFormats, FileWrapper } from "@apimatic/sdk";
6
- export const getTransformationId = async ({ file, url, format }, transformationController) => {
7
- ux.action.start("Transforming API specification");
8
- let generation;
9
- if (file) {
10
- const fileDescriptor = new FileWrapper(fsExtra.createReadStream(file));
11
- generation = await transformationController.transformViaFile(ContentType.EnumMultipartformdata, fileDescriptor, format);
12
- }
13
- else if (url) {
14
- const body = {
15
- url: url,
16
- exportFormat: format
17
- };
18
- generation = await transformationController.transformViaUrl(body);
19
- }
20
- else {
21
- throw new Error("Please provide a specification file");
22
- }
23
- ux.action.stop();
24
- return generation.result;
25
- };
26
- export const downloadTransformationFile = async ({ id, destinationFilePath, transformationController }) => {
27
- ux.action.start("Downloading Transformed file");
28
- const { result } = await transformationController.downloadTransformedFile(id);
29
- if (result.readable) {
30
- await writeFileUsingReadableStream(result, destinationFilePath);
31
- }
32
- else {
33
- throw new Error("Couldn't save transformation file");
34
- }
35
- ux.action.stop();
36
- return destinationFilePath;
37
- };
38
- // Get valid platform from user's input, convert simple platform to valid Platforms enum value
39
- export const getValidFormat = (format) => {
40
- const key = Object.keys(TransformationFormats).find((value) => value === format);
41
- if (key) {
42
- const transformationFormat = TransformationFormats[key];
43
- return ExportFormats[transformationFormat];
44
- }
45
- else {
46
- const formats = Object.keys(TransformationFormats).join("|");
47
- throw new Error(`Please provide a valid platform, e.g. ${formats}`);
48
- }
49
- };
50
- //# sourceMappingURL=transform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/controllers/api/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,OAAO,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAGL,qBAAqB,EAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,WAAW,EACX,aAAa,EACb,WAAW,EAIZ,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACtC,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAA0B,EAC7C,wBAAkD,EACzB,EAAE;IAC3B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAElD,IAAI,UAAuC,CAAC;IAC5C,IAAI,IAAI,EAAE,CA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AG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAElE,CAAC;IACd,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,GAAG,CAA+B,CAAC;QACtF,OAAO,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,KAAK,CAAC,yCAAyC,OAAO,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import { ApiValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
2
- import { GetValidationParams } from "../../types/api/validate.js";
3
- export declare const getValidationSummary: ({ file, url }: GetValidationParams, apiValidationController: ApiValidationExternalApisController) => Promise<ApiValidationSummary>;
@@ -1,29 +0,0 @@
1
- import fsExtra from "fs-extra";
2
- import { ContentType, FileWrapper } from "@apimatic/sdk";
3
- import { createTempDirectory, deleteFile, zipDirectory } from "../../utils/utils.js";
4
- export const getValidationSummary = async ({ file, url }, apiValidationController) => {
5
- let validation;
6
- if (file) {
7
- const fileStatus = fsExtra.statSync(file);
8
- if (fileStatus.isDirectory()) {
9
- const tempDir = await createTempDirectory();
10
- const zipPath = await zipDirectory(file, tempDir);
11
- const zipFile = new FileWrapper(fsExtra.createReadStream(zipPath));
12
- validation = await apiValidationController.validateApiViaFile(ContentType.EnumMultipartformdata, zipFile);
13
- await deleteFile(zipPath);
14
- await fsExtra.remove(tempDir);
15
- }
16
- else {
17
- const fileDescriptor = new FileWrapper(fsExtra.createReadStream(file));
18
- validation = await apiValidationController.validateApiViaFile(ContentType.EnumMultipartformdata, fileDescriptor);
19
- }
20
- }
21
- else if (url) {
22
- validation = await apiValidationController.validateApiViaUrl(url);
23
- }
24
- else {
25
- throw new Error("Please provide a specification file");
26
- }
27
- return validation.result;
28
- };
29
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/controllers/api/validate.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAA0E,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjI,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAErF,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,EAAE,IAAI,EAAE,GAAG,EAAuB,EAClC,uBAA4D,EAC7B,EAAE;IACjC,IAAI,UAA6C,CAAC;IAElD,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;YAC7B,MAAM,OAAO,GAAG,MAAM,mBAAmB,EAAE,CAAC;YAC5C,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;YACnE,UAAU,GAAG,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,WAAW,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;YAE1G,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;YAE1B,MAAM,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,MAAM,cAAc,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;YACvE,UAAU,GAAG,MAAM,uBAAuB,CAAC,kBAAkB,CAAC,WAAW,CAAC,qBAAqB,EAAE,cAAc,CAAC,CAAC;QACnH,CAAC;IACH,CAAC;SAAM,IAAI,GAAG,EAAE,CAAC;QACf,UAAU,GAAG,MAAM,uBAAuB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,UAAU,CAAC,MAAM,CAAC;AAC3B,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- import { ApiValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
2
- import { LoginCredentials, SpecFile } from "../../types/portal/quickstart.js";
3
- import { SDKClient } from "../../client-utils/sdk-client.js";
4
- import { PortalQuickstartPrompts } from "../../prompts/portal/quickstart.js";
5
- export declare class PortalQuickstartController {
6
- private readonly zipService;
7
- private readonly fileService;
8
- private readonly specUrl;
9
- isUserAuthenticated(configDir: string): Promise<boolean>;
10
- userLogin(credentials: LoginCredentials, client: SDKClient, configDir: string): Promise<void>;
11
- getSpecFile(spec: string): Promise<SpecFile>;
12
- getSpecValidationSummary(prompts: PortalQuickstartPrompts, specFile: SpecFile, apiValidationController: ApiValidationExternalApisController): Promise<ApiValidationSummary>;
13
- private downloadRepositoryFromGitHub;
14
- setupBuildDirectory(prompts: PortalQuickstartPrompts, targetFolder: string, specFile: SpecFile, validationSummary: ApiValidationSummary, languages: string[]): Promise<void>;
15
- }
@@ -1,217 +0,0 @@
1
- import axios from "axios";
2
- import * as path from "path";
3
- import filetype from "file-type";
4
- import fs from "fs";
5
- import fsExtra from "fs-extra";
6
- import { readdir } from "fs/promises";
7
- import { getAuthInfo } from "../../client-utils/auth-manager.js";
8
- import { createTempDirectory, isValidUrl, getMessageInRedColor, clearDirectory, deleteFile } from "../../utils/utils.js";
9
- import { getValidationSummary } from "../api/validate.js";
10
- import { metadataFileContent } from "../../config/env.js";
11
- import { ZipService } from "../../infrastructure/zip-service.js";
12
- import { FilePath } from "../../types/file/filePath.js";
13
- import { DirectoryPath } from "../../types/file/directoryPath.js";
14
- import { FileName } from "../../types/file/fileName.js";
15
- import { withDirPath } from "../../infrastructure/tmp-extensions.js";
16
- import { FileService } from "../../infrastructure/file-service.js";
17
- export class PortalQuickstartController {
18
- constructor() {
19
- this.zipService = new ZipService();
20
- this.fileService = new FileService();
21
- this.specUrl = "https://github.com/apimatic/static-portal-workflow/blob/master/spec/openapi.json";
22
- }
23
- async isUserAuthenticated(configDir) {
24
- const storedAuth = await getAuthInfo(configDir);
25
- if (!(storedAuth === null || storedAuth === void 0 ? void 0 : storedAuth.authKey)) {
26
- return false;
27
- }
28
- return true;
29
- }
30
- async userLogin(credentials, client, configDir) {
31
- await client.login(credentials.email, credentials.password, configDir);
32
- }
33
- async getSpecFile(spec) {
34
- const tempSpecDir = await createTempDirectory();
35
- if (spec) {
36
- let specPath = String(spec);
37
- if (isValidUrl(specPath)) {
38
- try {
39
- const response = await axios.head(specPath);
40
- if (response.headers["content-type"].includes("text/html")) {
41
- throw new Error(getMessageInRedColor(`Invalid URL. Please check the URL and ensure it points to a valid OpenAPI definition.`));
42
- }
43
- const specFile = await axios.get(specPath, { responseType: "arraybuffer" });
44
- const fileName = path.basename(specPath);
45
- const filePath = path.join(tempSpecDir, fileName);
46
- await fsExtra.writeFile(filePath, specFile.data);
47
- }
48
- catch (error) {
49
- if (axios.isAxiosError(error)) {
50
- if (error.response) {
51
- if (error.response.status === 404) {
52
- throw new Error(getMessageInRedColor(`Unable to download the API Definition. The server returned a 404 Not Found error. Please verify that the provided URL is correct and publicly accessible.`));
53
- }
54
- else {
55
- throw new Error(getMessageInRedColor(`Unable to download the API Definition. The server returned ${error.response.status} ${error.response.statusText}`));
56
- }
57
- }
58
- else if (error.request) {
59
- if (error.code === "ECONNABORTED") {
60
- throw new Error(getMessageInRedColor(`Unable to download the API Definition, your request timed out. Please check your internet connection and try again, or contact APIMatic support for help if your problem persists.`));
61
- }
62
- else if (error.code === "ENOTFOUND" || error.code === "ERR_NETWORK") {
63
- throw new Error(getMessageInRedColor(`Failed to download the API Definition file due to network issues. Please check your internet connection and try again.`));
64
- }
65
- else {
66
- throw new Error(getMessageInRedColor(`Failed to download the API Definition file, no response was received from the server. Please try again later.`));
67
- }
68
- }
69
- else {
70
- throw new Error(getMessageInRedColor(`Failed to download API Definition: ${error.message}`));
71
- }
72
- }
73
- else {
74
- throw new Error(getMessageInRedColor(`Unable to save API Definition : ${error instanceof Error ? error.message : "Unknown error"}`));
75
- }
76
- }
77
- }
78
- else {
79
- specPath = path.normalize(specPath);
80
- const fileType = await filetype.fromFile(specPath);
81
- if ((fileType === null || fileType === void 0 ? void 0 : fileType.ext) === "zip") {
82
- await this.zipService.unArchive(new FilePath(new DirectoryPath(path.dirname(specPath)), new FileName(path.basename(specPath))), new DirectoryPath(tempSpecDir));
83
- }
84
- else {
85
- const destinationPath = path.join(tempSpecDir, path.basename(specPath));
86
- await fsExtra.copy(specPath, destinationPath);
87
- }
88
- }
89
- }
90
- return { localPath: tempSpecDir, url: this.specUrl };
91
- }
92
- async getSpecValidationSummary(prompts, specFile, apiValidationController) {
93
- const validationFlags = {
94
- file: specFile.localPath,
95
- url: specFile.url
96
- };
97
- try {
98
- const validationSummary = await getValidationSummary(validationFlags, apiValidationController);
99
- return validationSummary;
100
- }
101
- catch (error) {
102
- prompts.displaySpecValidationErrorMessage();
103
- if (axios.isAxiosError(error)) {
104
- if (error.response) {
105
- if (error.response.status === 400) {
106
- throw new Error(getMessageInRedColor(`The provided spec file is not valid. Please ensure that the spec you have provided is a valid API definition file.`));
107
- }
108
- else if (error.response.status === 500) {
109
- throw new Error(getMessageInRedColor(`The server encountered an error while validating your spec file, please try again later. If the issue persists, contact our team at support@apimatic.io`));
110
- }
111
- else {
112
- throw new Error(getMessageInRedColor(`Something went wrong while validating your spec file. The server returned the following error ${error.response.status} ${error.response.statusText}. Please try again later. If the issue persists, contact our team at support@apimatic.io`));
113
- }
114
- }
115
- else if (error.request) {
116
- if (error.code === "ECONNABORTED") {
117
- throw new Error(getMessageInRedColor(`The spec validation request timed out. Please try again.`));
118
- }
119
- else if (error.code === "ENOTFOUND" || error.code === "ERR_NETWORK") {
120
- throw new Error(getMessageInRedColor(`Network error encountered while validating the spec file. Please check your connection and try again.`));
121
- }
122
- else {
123
- throw new Error(getMessageInRedColor(`Something went wrong while validating the spec file, please try again. If the issue persists, reach out to our support team at support@apimatic.io`));
124
- }
125
- }
126
- else {
127
- throw new Error(getMessageInRedColor(`Failed to validate spec file: ${error.message}`));
128
- }
129
- }
130
- else if (error.result) {
131
- const apiError = error;
132
- if (error.body && apiError.statusCode === 401) {
133
- throw new Error("You are not authorized to perform this action.");
134
- }
135
- else {
136
- throw new Error(error.message);
137
- }
138
- }
139
- else if (error.statusCode === 401) {
140
- throw new Error("You are not authorized to perform this action.");
141
- }
142
- else if (error.statusCode === 402 &&
143
- error.body &&
144
- typeof error.body === "string") {
145
- throw new Error(error.body);
146
- }
147
- else {
148
- throw new Error(getMessageInRedColor(`Something went wrong while validating the spec file, please try again later. If the issue persists, contact our team at support@apimatic.io`));
149
- }
150
- }
151
- }
152
- async downloadRepositoryFromGitHub(targetFolder) {
153
- return await withDirPath(async (tempDirectory) => {
154
- const zipUrl = `https://github.com/apimatic/static-portal-workflow/archive/refs/heads/master.zip`;
155
- const response = await fetch(zipUrl);
156
- const repositoryFolderName = "static-portal-workflow-master";
157
- if (!response.ok) {
158
- throw new Error(`Unable to setup your portal, please try again later.`);
159
- }
160
- const arrayBuffer = await response.arrayBuffer();
161
- const tempZipPath = new FilePath(tempDirectory, new FileName("static-repo.zip"));
162
- await this.fileService.writeBuffer(tempZipPath, Buffer.from(arrayBuffer));
163
- await this.zipService.unArchive(tempZipPath, tempDirectory);
164
- const extractedFolderPath = new DirectoryPath(tempDirectory.toString(), repositoryFolderName);
165
- await this.fileService.copyDirectoryContents(extractedFolderPath, new DirectoryPath(targetFolder));
166
- });
167
- }
168
- async setupBuildDirectory(prompts, targetFolder, specFile, validationSummary, languages) {
169
- fsExtra.emptyDirSync(targetFolder);
170
- try {
171
- await this.downloadRepositoryFromGitHub(targetFolder);
172
- }
173
- catch (error) {
174
- prompts.displayBuildDirectoryGenerationErrorMessage();
175
- if (error instanceof Error) {
176
- if (error.message.includes("timed out") || error.message.includes("timeout")) {
177
- throw new Error(getMessageInRedColor("The operation timed out while setting up the build directory. Please check your internet connection and try again."));
178
- }
179
- else if (error.message.includes("Could not resolve host")) {
180
- throw new Error(getMessageInRedColor("Unable to resolve the host. Please check your network settings and try again."));
181
- }
182
- else {
183
- throw new Error(getMessageInRedColor(`Failed to set up the build directory. ${error.message}`));
184
- }
185
- }
186
- else {
187
- throw new Error(getMessageInRedColor(`Failed to set up the build directory. ${error}`));
188
- }
189
- }
190
- await clearDirectory(path.join(targetFolder, ".github"));
191
- if (specFile.localPath && validationSummary.success) {
192
- const specFolder = path.join(targetFolder, "spec");
193
- await deleteFile(path.join(specFolder, "openapi.json"));
194
- const files = await readdir(specFile.localPath);
195
- for (const file of files) {
196
- const srcPath = path.join(specFile.localPath, file);
197
- const destPath = path.join(specFolder, file);
198
- await fsExtra.copy(srcPath, destPath);
199
- }
200
- }
201
- const buildFilePath = path.join(targetFolder, "APIMATIC-BUILD.json");
202
- const buildFileContent = JSON.parse(fs.readFileSync(buildFilePath, "utf8"));
203
- const languageConfig = languages.reduce((config, lang) => {
204
- config[lang] = {};
205
- return config;
206
- }, {});
207
- buildFileContent.generatePortal.languageConfig = languageConfig;
208
- fs.writeFileSync(buildFilePath, JSON.stringify(buildFileContent, null, 2));
209
- const specFolder = path.join(targetFolder, "spec");
210
- const metadataFile = fs.readdirSync(specFolder).find((file) => file.startsWith("APIMATIC-META"));
211
- if (!metadataFile) {
212
- const newMetadataFilePath = path.join(specFolder, "APIMATIC-META.json");
213
- fs.writeFileSync(newMetadataFilePath, JSON.stringify(metadataFileContent, null, 2));
214
- }
215
- }
216
- }
217
- //# sourceMappingURL=quickstart.js.map
@@ -1 +0,0 @@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GAAG,cAAc,CAAC;QAEhE,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAE3E,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAEnD,MAAM,YAAY,GAAG,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;QAEjG,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;YACxE,EAAE,CAAC,aAAa,CAAC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;CACF"}
@@ -1,7 +0,0 @@
1
- export declare abstract class BasePrompts {
2
- protected readonly spin: import("@clack/prompts").SpinnerResult;
3
- startProgressIndicator(message: string): void;
4
- stopProgressIndicator(message: string): void;
5
- displayInfo(message: string): void;
6
- logError(errorMessage: string): void;
7
- }
@@ -1,19 +0,0 @@
1
- import { log, spinner } from "@clack/prompts";
2
- export class BasePrompts {
3
- constructor() {
4
- this.spin = spinner();
5
- }
6
- startProgressIndicator(message) {
7
- this.spin.start(message);
8
- }
9
- stopProgressIndicator(message) {
10
- this.spin.stop(message);
11
- }
12
- displayInfo(message) {
13
- log.step(message);
14
- }
15
- logError(errorMessage) {
16
- log.error(errorMessage);
17
- }
18
- }
19
- //# sourceMappingURL=base-prompts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-prompts.js","sourceRoot":"","sources":["../../../../src/prompts/portal/common/base-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAgB,WAAW;IAAjC;QACuB,SAAI,GAAG,OAAO,EAAE,CAAC;IAiBxC,CAAC;IAfU,sBAAsB,CAAC,OAAe;QACzC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAEM,qBAAqB,CAAC,OAAe;QACxC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,OAAe;QAC9B,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAEM,QAAQ,CAAC,YAAoB;QAChC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC;CACJ"}
@@ -1,12 +0,0 @@
1
- export type GetValidationParams = {
2
- file: string;
3
- url: string;
4
- };
5
- export type APIValidateError = {
6
- modelState: {
7
- "exception Error": string[];
8
- };
9
- };
10
- export type AuthorizationError = {
11
- body: string;
12
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/types/api/validate.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- export declare class Result<T, TError> {
2
- private readonly Status;
3
- readonly value?: T | undefined;
4
- readonly error?: TError | undefined;
5
- private constructor();
6
- static success<T, TError>(value: T): Result<T, TError>;
7
- static failure<T, TError>(error: TError): Result<T, TError>;
8
- static cancelled<T, TError>(value: T): Result<T, TError>;
9
- isFailed(): boolean;
10
- isCancelled(): boolean;
11
- isSuccess(): boolean;
12
- }
13
- export declare enum ResultStatus {
14
- Success = 0,
15
- Failed = 1,
16
- Cancelled = 2
17
- }
@@ -1,32 +0,0 @@
1
- export class Result {
2
- constructor(Status, value, error) {
3
- this.Status = Status;
4
- this.value = value;
5
- this.error = error;
6
- }
7
- static success(value) {
8
- return new Result(ResultStatus.Success, value, undefined);
9
- }
10
- static failure(error) {
11
- return new Result(ResultStatus.Failed, undefined, error);
12
- }
13
- static cancelled(value) {
14
- return new Result(ResultStatus.Cancelled, value, undefined);
15
- }
16
- isFailed() {
17
- return this.Status == ResultStatus.Failed;
18
- }
19
- isCancelled() {
20
- return this.Status == ResultStatus.Cancelled;
21
- }
22
- isSuccess() {
23
- return this.Status == ResultStatus.Success;
24
- }
25
- }
26
- export var ResultStatus;
27
- (function (ResultStatus) {
28
- ResultStatus[ResultStatus["Success"] = 0] = "Success";
29
- ResultStatus[ResultStatus["Failed"] = 1] = "Failed";
30
- ResultStatus[ResultStatus["Cancelled"] = 2] = "Cancelled";
31
- })(ResultStatus || (ResultStatus = {}));
32
- //# sourceMappingURL=result.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/types/common/result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,MAAM;IACjB,YACmB,MAAoB,EACrB,KAAS,EACT,KAAc;QAFb,WAAM,GAAN,MAAM,CAAc;QACrB,UAAK,GAAL,KAAK,CAAI;QACT,UAAK,GAAL,KAAK,CAAS;IAC7B,CAAC;IAEG,MAAM,CAAC,OAAO,CAAY,KAAQ;QACvC,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC;IAEM,MAAM,CAAC,OAAO,CAAY,KAAa;QAC5C,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAEM,MAAM,CAAC,SAAS,CAAY,KAAQ;QACzC,OAAO,IAAI,MAAM,CAAY,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,CAAC;IAC5C,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,SAAS,CAAC;IAC/C,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,IAAI,YAAY,CAAC,OAAO,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,qDAAO,CAAA;IACP,mDAAM,CAAA;IACN,yDAAS,CAAA;AACX,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB"}
@@ -1,13 +0,0 @@
1
- export interface GeneratePortalParams {
2
- readonly sourceBuildInputZipFilePath: string;
3
- readonly generatedPortalArtifactsFolderPath: string;
4
- readonly generatedPortalArtifactsZipFilePath: string;
5
- readonly overrideAuthKey: string | null;
6
- readonly generateZipFile: boolean;
7
- }
8
- export interface ErrorResponse {
9
- readonly title: string;
10
- readonly detail?: string;
11
- readonly errors: Record<string, string[]>;
12
- readonly message?: string;
13
- }