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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/README.md +112 -90
  2. package/lib/actions/action-result.d.ts +8 -3
  3. package/lib/actions/action-result.js +34 -15
  4. package/lib/actions/action-result.js.map +1 -1
  5. package/lib/actions/api/transform.d.ts +15 -0
  6. package/lib/actions/api/transform.js +48 -0
  7. package/lib/actions/api/transform.js.map +1 -0
  8. package/lib/actions/api/validate.d.ts +12 -0
  9. package/lib/actions/api/validate.js +41 -0
  10. package/lib/actions/api/validate.js.map +1 -0
  11. package/lib/actions/auth/login.d.ts +6 -5
  12. package/lib/actions/auth/login.js +25 -33
  13. package/lib/actions/auth/login.js.map +1 -1
  14. package/lib/actions/auth/logout.d.ts +8 -0
  15. package/lib/actions/auth/logout.js +15 -0
  16. package/lib/actions/auth/logout.js.map +1 -0
  17. package/lib/actions/auth/status.d.ts +11 -0
  18. package/lib/actions/auth/status.js +26 -0
  19. package/lib/actions/auth/status.js.map +1 -0
  20. package/lib/actions/portal/copilot.d.ts +5 -3
  21. package/lib/actions/portal/copilot.js +47 -37
  22. package/lib/actions/portal/copilot.js.map +1 -1
  23. package/lib/actions/portal/generate.d.ts +4 -5
  24. package/lib/actions/portal/generate.js +30 -37
  25. package/lib/actions/portal/generate.js.map +1 -1
  26. package/lib/actions/portal/quickstart.d.ts +16 -0
  27. package/lib/actions/portal/quickstart.js +145 -0
  28. package/lib/actions/portal/quickstart.js.map +1 -0
  29. package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
  30. package/lib/actions/portal/recipe/new-recipe.js +147 -221
  31. package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
  32. package/lib/actions/portal/serve.d.ts +12 -10
  33. package/lib/actions/portal/serve.js +112 -17
  34. package/lib/actions/portal/serve.js.map +1 -1
  35. package/lib/actions/portal/toc/new-toc.d.ts +16 -15
  36. package/lib/actions/portal/toc/new-toc.js +80 -116
  37. package/lib/actions/portal/toc/new-toc.js.map +1 -1
  38. package/lib/actions/sdk/generate.d.ts +5 -6
  39. package/lib/actions/sdk/generate.js +22 -47
  40. package/lib/actions/sdk/generate.js.map +1 -1
  41. package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
  42. package/lib/application/portal/recipe/portal-recipe.js +9 -9
  43. package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
  44. package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
  45. package/lib/application/portal/recipe/recipe-generator.js +21 -22
  46. package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
  47. package/lib/client-utils/auth-manager.d.ts +1 -1
  48. package/lib/client-utils/auth-manager.js +3 -4
  49. package/lib/client-utils/auth-manager.js.map +1 -1
  50. package/lib/commands/api/transform.d.ts +6 -3
  51. package/lib/commands/api/transform.js +43 -94
  52. package/lib/commands/api/transform.js.map +1 -1
  53. package/lib/commands/api/validate.d.ts +6 -3
  54. package/lib/commands/api/validate.js +27 -66
  55. package/lib/commands/api/validate.js.map +1 -1
  56. package/lib/commands/auth/login.d.ts +2 -1
  57. package/lib/commands/auth/login.js +15 -9
  58. package/lib/commands/auth/login.js.map +1 -1
  59. package/lib/commands/auth/logout.d.ts +3 -1
  60. package/lib/commands/auth/logout.js +12 -13
  61. package/lib/commands/auth/logout.js.map +1 -1
  62. package/lib/commands/auth/status.d.ts +1 -0
  63. package/lib/commands/auth/status.js +13 -11
  64. package/lib/commands/auth/status.js.map +1 -1
  65. package/lib/commands/portal/copilot.d.ts +2 -2
  66. package/lib/commands/portal/copilot.js +22 -20
  67. package/lib/commands/portal/copilot.js.map +1 -1
  68. package/lib/commands/portal/generate.d.ts +3 -4
  69. package/lib/commands/portal/generate.js +19 -14
  70. package/lib/commands/portal/generate.js.map +1 -1
  71. package/lib/commands/portal/quickstart.d.ts +3 -4
  72. package/lib/commands/portal/quickstart.js +24 -101
  73. package/lib/commands/portal/quickstart.js.map +1 -1
  74. package/lib/commands/portal/recipe/new.d.ts +3 -1
  75. package/lib/commands/portal/recipe/new.js +31 -23
  76. package/lib/commands/portal/recipe/new.js.map +1 -1
  77. package/lib/commands/portal/serve.d.ts +5 -5
  78. package/lib/commands/portal/serve.js +31 -57
  79. package/lib/commands/portal/serve.js.map +1 -1
  80. package/lib/commands/portal/toc/new.d.ts +2 -2
  81. package/lib/commands/portal/toc/new.js +35 -26
  82. package/lib/commands/portal/toc/new.js.map +1 -1
  83. package/lib/commands/sdk/generate.d.ts +5 -4
  84. package/lib/commands/sdk/generate.js +26 -17
  85. package/lib/commands/sdk/generate.js.map +1 -1
  86. package/lib/hooks/not-found.js +1 -1
  87. package/lib/hooks/not-found.js.map +1 -1
  88. package/lib/infrastructure/api-utils.js +3 -2
  89. package/lib/infrastructure/api-utils.js.map +1 -1
  90. package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
  91. package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
  92. package/lib/infrastructure/debounce-service.js.map +1 -0
  93. package/lib/infrastructure/env-info.d.ts +1 -1
  94. package/lib/infrastructure/env-info.js +2 -2
  95. package/lib/infrastructure/env-info.js.map +1 -1
  96. package/lib/infrastructure/file-service.d.ts +7 -2
  97. package/lib/infrastructure/file-service.js +46 -5
  98. package/lib/infrastructure/file-service.js.map +1 -1
  99. package/lib/infrastructure/launcher-service.d.ts +2 -0
  100. package/lib/infrastructure/launcher-service.js +4 -0
  101. package/lib/infrastructure/launcher-service.js.map +1 -1
  102. package/lib/infrastructure/network-service.d.ts +3 -0
  103. package/lib/infrastructure/network-service.js +7 -0
  104. package/lib/infrastructure/network-service.js.map +1 -0
  105. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  106. package/lib/infrastructure/services/api-client-factory.js +20 -0
  107. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  108. package/lib/infrastructure/services/api-service.d.ts +2 -2
  109. package/lib/infrastructure/services/api-service.js +6 -6
  110. package/lib/infrastructure/services/api-service.js.map +1 -1
  111. package/lib/infrastructure/services/auth-service.d.ts +1 -1
  112. package/lib/infrastructure/services/auth-service.js +7 -5
  113. package/lib/infrastructure/services/auth-service.js.map +1 -1
  114. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  115. package/lib/infrastructure/services/file-download-service.js +104 -0
  116. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  117. package/lib/infrastructure/services/portal-service.d.ts +11 -13
  118. package/lib/infrastructure/services/portal-service.js +73 -102
  119. package/lib/infrastructure/services/portal-service.js.map +1 -1
  120. package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
  121. package/lib/infrastructure/services/telemetry-service.js +4 -6
  122. package/lib/infrastructure/services/telemetry-service.js.map +1 -1
  123. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  124. package/lib/infrastructure/services/transformation-service.js +56 -0
  125. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  126. package/lib/infrastructure/services/validation-service.d.ts +17 -0
  127. package/lib/infrastructure/services/validation-service.js +49 -0
  128. package/lib/infrastructure/services/validation-service.js.map +1 -0
  129. package/lib/prompts/api/transform.d.ts +11 -0
  130. package/lib/prompts/api/transform.js +30 -0
  131. package/lib/prompts/api/transform.js.map +1 -0
  132. package/lib/prompts/api/validate.d.ts +12 -0
  133. package/lib/prompts/api/validate.js +41 -0
  134. package/lib/prompts/api/validate.js.map +1 -0
  135. package/lib/prompts/auth/login.d.ts +6 -1
  136. package/lib/prompts/auth/login.js +12 -3
  137. package/lib/prompts/auth/login.js.map +1 -1
  138. package/lib/prompts/auth/logout.d.ts +3 -0
  139. package/lib/prompts/auth/logout.js +7 -0
  140. package/lib/prompts/auth/logout.js.map +1 -0
  141. package/lib/prompts/auth/status.d.ts +8 -0
  142. package/lib/prompts/auth/status.js +21 -0
  143. package/lib/prompts/auth/status.js.map +1 -0
  144. package/lib/prompts/format.d.ts +33 -0
  145. package/lib/prompts/format.js +99 -0
  146. package/lib/prompts/format.js.map +1 -0
  147. package/lib/prompts/portal/copilot.d.ts +8 -4
  148. package/lib/prompts/portal/copilot.js +35 -24
  149. package/lib/prompts/portal/copilot.js.map +1 -1
  150. package/lib/prompts/portal/generate.d.ts +9 -7
  151. package/lib/prompts/portal/generate.js +22 -23
  152. package/lib/prompts/portal/generate.js.map +1 -1
  153. package/lib/prompts/portal/quickstart.d.ts +30 -29
  154. package/lib/prompts/portal/quickstart.js +99 -193
  155. package/lib/prompts/portal/quickstart.js.map +1 -1
  156. package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
  157. package/lib/prompts/portal/recipe/new-recipe.js +70 -108
  158. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
  159. package/lib/prompts/portal/serve.d.ts +10 -3
  160. package/lib/prompts/portal/serve.js +30 -11
  161. package/lib/prompts/portal/serve.js.map +1 -1
  162. package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
  163. package/lib/prompts/portal/toc/new-toc.js +20 -22
  164. package/lib/prompts/portal/toc/new-toc.js.map +1 -1
  165. package/lib/prompts/sdk/generate.d.ts +7 -7
  166. package/lib/prompts/sdk/generate.js +17 -23
  167. package/lib/prompts/sdk/generate.js.map +1 -1
  168. package/lib/types/api/account.d.ts +1 -1
  169. package/lib/types/api/transform.d.ts +14 -25
  170. package/lib/types/api/transform.js +16 -16
  171. package/lib/types/api/transform.js.map +1 -1
  172. package/lib/types/build/build.d.ts +9 -1
  173. package/lib/types/build/build.js +5 -2
  174. package/lib/types/build/build.js.map +1 -1
  175. package/lib/types/build-context.d.ts +5 -1
  176. package/lib/types/build-context.js +21 -4
  177. package/lib/types/build-context.js.map +1 -1
  178. package/lib/types/common/command-metadata.d.ts +4 -0
  179. package/lib/types/common/command-metadata.js +2 -0
  180. package/lib/types/common/command-metadata.js.map +1 -0
  181. package/lib/types/events/domain-event.d.ts +1 -1
  182. package/lib/types/events/domain-event.js.map +1 -1
  183. package/lib/types/events/quickstart-completed.js +1 -1
  184. package/lib/types/events/quickstart-initiated.js +1 -1
  185. package/lib/types/events/recipe-creation-failed.d.ts +1 -1
  186. package/lib/types/events/recipe-creation-failed.js +1 -1
  187. package/lib/types/events/recipe-creation-failed.js.map +1 -1
  188. package/lib/types/events/toc-creation-failed.d.ts +1 -1
  189. package/lib/types/events/toc-creation-failed.js +1 -1
  190. package/lib/types/events/toc-creation-failed.js.map +1 -1
  191. package/lib/types/file/directory.d.ts +17 -0
  192. package/lib/types/file/directory.js +86 -0
  193. package/lib/types/file/directory.js.map +1 -0
  194. package/lib/types/file/directoryPath.d.ts +3 -1
  195. package/lib/types/file/directoryPath.js +8 -2
  196. package/lib/types/file/directoryPath.js.map +1 -1
  197. package/lib/types/file/fileName.d.ts +2 -0
  198. package/lib/types/file/fileName.js +12 -0
  199. package/lib/types/file/fileName.js.map +1 -1
  200. package/lib/types/file/filePath.d.ts +2 -0
  201. package/lib/types/file/filePath.js +21 -0
  202. package/lib/types/file/filePath.js.map +1 -1
  203. package/lib/types/file/resource-input.d.ts +5 -0
  204. package/lib/types/file/resource-input.js +42 -0
  205. package/lib/types/file/resource-input.js.map +1 -0
  206. package/lib/types/file/urlPath.d.ts +6 -0
  207. package/lib/types/file/urlPath.js +22 -0
  208. package/lib/types/file/urlPath.js.map +1 -0
  209. package/lib/types/portal-context.d.ts +3 -1
  210. package/lib/types/portal-context.js +10 -0
  211. package/lib/types/portal-context.js.map +1 -1
  212. package/lib/types/recipe/recipe.d.ts +2 -17
  213. package/lib/types/recipe-context.d.ts +8 -0
  214. package/lib/types/recipe-context.js +21 -0
  215. package/lib/types/recipe-context.js.map +1 -0
  216. package/lib/types/resource-context.d.ts +12 -0
  217. package/lib/types/resource-context.js +30 -0
  218. package/lib/types/resource-context.js.map +1 -0
  219. package/lib/types/sdk/generate.d.ts +2 -15
  220. package/lib/types/sdk/generate.js +24 -10
  221. package/lib/types/sdk/generate.js.map +1 -1
  222. package/lib/types/sdk-context.d.ts +6 -5
  223. package/lib/types/sdk-context.js +12 -8
  224. package/lib/types/sdk-context.js.map +1 -1
  225. package/lib/types/sdl/sdl.d.ts +9 -0
  226. package/lib/types/sdl/sdl.js +46 -1
  227. package/lib/types/sdl/sdl.js.map +1 -1
  228. package/lib/types/spec-context.d.ts +3 -0
  229. package/lib/types/spec-context.js +7 -2
  230. package/lib/types/spec-context.js.map +1 -1
  231. package/lib/types/temp-context.d.ts +11 -0
  232. package/lib/types/temp-context.js +27 -0
  233. package/lib/types/temp-context.js.map +1 -0
  234. package/lib/types/toc-context.d.ts +12 -0
  235. package/lib/types/toc-context.js +26 -0
  236. package/lib/types/toc-context.js.map +1 -0
  237. package/lib/types/transform-context.d.ts +13 -0
  238. package/lib/types/transform-context.js +30 -0
  239. package/lib/types/transform-context.js.map +1 -0
  240. package/lib/types/utils.d.ts +0 -9
  241. package/lib/utils/string-utils.d.ts +1 -0
  242. package/lib/utils/string-utils.js +10 -0
  243. package/lib/utils/string-utils.js.map +1 -0
  244. package/lib/utils/utils.d.ts +2 -27
  245. package/lib/utils/utils.js +6 -145
  246. package/lib/utils/utils.js.map +1 -1
  247. package/package.json +4 -4
  248. package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
  249. package/lib/application/portal/serve/portal-watcher.js +0 -64
  250. package/lib/application/portal/serve/portal-watcher.js.map +0 -1
  251. package/lib/application/portal/serve/serve-handler.d.ts +0 -16
  252. package/lib/application/portal/serve/serve-handler.js +0 -91
  253. package/lib/application/portal/serve/serve-handler.js.map +0 -1
  254. package/lib/application/portal/serve/watcher-handler.js.map +0 -1
  255. package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
  256. package/lib/application/portal/toc/sdl-parser.js +0 -90
  257. package/lib/application/portal/toc/sdl-parser.js.map +0 -1
  258. package/lib/client-utils/sdk-client.d.ts +0 -18
  259. package/lib/client-utils/sdk-client.js +0 -41
  260. package/lib/client-utils/sdk-client.js.map +0 -1
  261. package/lib/config/env.d.ts +0 -26
  262. package/lib/config/env.js +0 -27
  263. package/lib/config/env.js.map +0 -1
  264. package/lib/controllers/api/transform.d.ts +0 -5
  265. package/lib/controllers/api/transform.js +0 -50
  266. package/lib/controllers/api/transform.js.map +0 -1
  267. package/lib/controllers/api/validate.d.ts +0 -3
  268. package/lib/controllers/api/validate.js +0 -29
  269. package/lib/controllers/api/validate.js.map +0 -1
  270. package/lib/controllers/portal/quickstart.d.ts +0 -13
  271. package/lib/controllers/portal/quickstart.js +0 -214
  272. package/lib/controllers/portal/quickstart.js.map +0 -1
  273. package/lib/infrastructure/api-client-utils.d.ts +0 -6
  274. package/lib/infrastructure/api-client-utils.js +0 -34
  275. package/lib/infrastructure/api-client-utils.js.map +0 -1
  276. package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
  277. package/lib/prompts/portal/common/base-prompts.js +0 -19
  278. package/lib/prompts/portal/common/base-prompts.js.map +0 -1
  279. package/lib/types/api/validate.d.ts +0 -12
  280. package/lib/types/api/validate.js +0 -2
  281. package/lib/types/api/validate.js.map +0 -1
  282. package/lib/types/common/result.d.ts +0 -17
  283. package/lib/types/common/result.js +0 -32
  284. package/lib/types/common/result.js.map +0 -1
  285. package/lib/types/portal/generate.d.ts +0 -13
  286. package/lib/types/portal/generate.js +0 -3
  287. package/lib/types/portal/generate.js.map +0 -1
  288. package/lib/types/portal/quickstart.d.ts +0 -17
  289. package/lib/types/portal/quickstart.js +0 -2
  290. package/lib/types/portal/quickstart.js.map +0 -1
  291. package/lib/types/portal/serve.d.ts +0 -12
  292. package/lib/types/portal/serve.js +0 -2
  293. package/lib/types/portal/serve.js.map +0 -1
  294. package/lib/validators/common/directoryValidator.d.ts +0 -5
  295. package/lib/validators/common/directoryValidator.js +0 -22
  296. package/lib/validators/common/directoryValidator.js.map +0 -1
  297. package/lib/validators/portal/serve-validator.d.ts +0 -6
  298. package/lib/validators/portal/serve-validator.js +0 -15
  299. package/lib/validators/portal/serve-validator.js.map +0 -1
@@ -1,140 +1,13 @@
1
1
  import { __asyncValues } from "tslib";
2
2
  import * as path from "path";
3
- import fs from "fs";
4
- import fsExtra from "fs-extra";
5
- import os from "os";
6
- import archiver from "archiver";
3
+ import { Buffer } from "buffer";
7
4
  import stripTags from "striptags";
8
- import colors from "picocolors";
9
- export const createTempDirectory = async () => {
10
- return fs.mkdtempSync(path.join(os.tmpdir(), "apimatic-cli-"));
11
- };
12
- export const clearDirectory = async (folderPath) => {
13
- if (!fs.existsSync(folderPath)) {
14
- throw new Error(`Directory ${folderPath} does not exist`);
15
- }
16
- const files = await fsExtra.readdir(folderPath);
17
- for (const file of files) {
18
- const filePath = path.join(folderPath, file);
19
- await deleteFile(filePath);
20
- }
21
- await deleteFile(folderPath);
22
- };
23
- // TODO: Move to portal:quickstart command.
24
- const descriptions = Object.entries({
25
- "APIMATIC-BUILD.json": "# Defines all configurations for the API portal, including programming languages and themes",
26
- spec: "# Contains all API definition files",
27
- content: "# Includes custom documentation pages in Markdown",
28
- "content/toc.yml": "# Controls the structure of the side navigation bar in the API portal",
29
- static: "# Includes all static files, such as images, GIFs, and PDFs"
30
- }).reduce((acc, [key, value]) => {
31
- acc[path.normalize(key)] = value;
32
- return acc;
33
- }, {});
34
- // TODO: Move to portal:quickstart command.
35
- export const directoryToJson = (dirPath, parentPath = "") => {
36
- const directoryStructure = {};
37
- const items = fs.readdirSync(dirPath);
38
- items.forEach((item) => {
39
- if (item === ".git")
40
- return; // Skip .git directory
41
- const itemPath = path.join(dirPath, item);
42
- const relativePath = path.join(parentPath, item);
43
- const stats = fs.statSync(itemPath);
44
- if (stats.isDirectory()) {
45
- const subdirectoryStructure = directoryToJson(itemPath, relativePath);
46
- const folderName = descriptions[path.normalize(relativePath)]
47
- ? `${item} : ${descriptions[path.normalize(relativePath)]}`
48
- : item;
49
- directoryStructure[folderName] = subdirectoryStructure;
50
- }
51
- else {
52
- directoryStructure[descriptions[path.normalize(relativePath)] ? `${item} : ${descriptions[path.normalize(relativePath)]}` : item] = null;
53
- }
54
- });
55
- return directoryStructure;
56
- };
57
- export const isValidUrl = (input) => {
58
- if (!input) {
59
- return false;
60
- }
61
- try {
62
- const url = new URL(input);
63
- if (!["http:", "https:"].includes(url.protocol)) {
64
- return false;
65
- }
66
- if (url.protocol === "file:" || fs.existsSync(input)) {
67
- return false;
68
- }
69
- if (!url.host) {
70
- return false;
71
- }
72
- return true;
73
- }
74
- catch (_) {
75
- return false;
76
- }
77
- };
78
- export const deleteFile = async (filePath) => {
79
- return await fsExtra.remove(filePath);
80
- };
81
- export const writeFileUsingReadableStream = (stream, destinationPath) => {
82
- return new Promise((resolve) => {
83
- const writeStream = fs.createWriteStream(destinationPath);
84
- stream.pipe(writeStream);
85
- writeStream.on("close", () => {
86
- resolve("Zipped");
87
- });
88
- });
89
- };
90
- /**
91
- * Packages local files into a ZIP archive
92
- *
93
- * @param {docsPortalFolderPath} path to portal directory.
94
- * @param {destinationZipPath} path to generated zip
95
- * return {string}
96
- */
97
- export const zipDirectory = async (sourcePath, destinationPath) => {
98
- // Check if the directory exists for the user or not
99
- await fsExtra.ensureDir(sourcePath);
100
- const zipPath = path.join(destinationPath, ".target.zip");
101
- const output = fs.createWriteStream(zipPath);
102
- const archive = archiver("zip");
103
- return new Promise((resolve, reject) => {
104
- archive.on("error", (err) => {
105
- reject(new Error(err.message));
106
- });
107
- output.on("error", (err) => {
108
- reject(new Error(err.message));
109
- });
110
- output.on("close", () => {
111
- resolve(zipPath);
112
- });
113
- archive.pipe(output);
114
- archive.directory(sourcePath, false);
115
- archive.finalize().catch(reject);
116
- });
117
- };
118
5
  export const replaceHTML = (string) => {
119
6
  return stripTags(string);
120
7
  };
121
8
  export const getFileNameFromPath = (filePath) => {
122
9
  return path.basename(filePath).split(".")[0];
123
10
  };
124
- export const printValidationMessages = ({ warnings, errors, messages }, { log, warn, error }) => {
125
- warnings = warnings || [];
126
- messages = messages || [];
127
- const singleError = errors.join("\n") || "";
128
- messages.forEach((message) => {
129
- log(`Info: ${replaceHTML(message)}`);
130
- });
131
- warnings.forEach((warning) => {
132
- warn(replaceHTML(warning));
133
- });
134
- if (errors.length > 0) {
135
- error(replaceHTML(singleError));
136
- }
137
- };
138
11
  export async function parseStreamBodyToJson(body) {
139
12
  var _a, e_1, _b, _c;
140
13
  const chunks = [];
@@ -156,22 +29,10 @@ export async function parseStreamBodyToJson(body) {
156
29
  const text = Buffer.concat(chunks).toString("utf-8");
157
30
  return JSON.parse(text);
158
31
  }
159
- export const getMessageInOrangeColor = (message) => {
160
- return colors.yellow(message);
161
- };
162
- export const getMessageInBlueColor = (message) => {
163
- return colors.blueBright(message);
164
- };
165
- export const getMessageInCyanColor = (message) => {
166
- return colors.cyan(message);
167
- };
168
- export const getMessageInGreenColor = (message) => {
169
- return colors.greenBright(message);
170
- };
171
- export const getMessageInMagentaColor = (message) => {
172
- return colors.magentaBright(message);
173
- };
174
- export const getMessageInRedColor = (message) => {
175
- return colors.redBright(message);
32
+ export const toPascalCase = (str) => {
33
+ return str
34
+ .split(" ")
35
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
36
+ .join("");
176
37
  };
177
38
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,MAAM,MAAM,YAAY,CAAC;AAIhC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,IAAI,EAAE;IAC5C,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAA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,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,IAA2B;;IACrE,MAAM,MAAM,GAAa,EAAE,CAAC;;QAC5B,KAA0B,eAAA,SAAA,cAAA,IAAI,CAAA,UAAA,sEAAE,CAAC;YAAP,oBAAI;YAAJ,WAAI;YAAnB,MAAM,KAAK,KAAA,CAAA;YACpB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACnE,CAAC;;;;;;;;;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAU,EAAE;IAClD,OAAO,GAAG;SACP,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACzE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@apimatic/cli",
3
3
  "description": "The official CLI for APIMatic.",
4
- "version": "1.1.0-alpha.21",
4
+ "version": "1.1.0-alpha.22",
5
5
  "author": "APIMatic",
6
6
  "bin": {
7
7
  "apimatic": "./bin/run.js"
@@ -61,7 +61,6 @@
61
61
  "express": "^4.17.1",
62
62
  "extract-zip": "^2.0.1",
63
63
  "fast-levenshtein": "^3.0.0",
64
- "file-type": "^15.0.0",
65
64
  "form-data": "^4.0.2",
66
65
  "fs-extra": "^11.3.0",
67
66
  "get-port": "^7.1.0",
@@ -71,7 +70,6 @@
71
70
  "prettier": "^2.8.8",
72
71
  "striptags": "^3.2.0",
73
72
  "tmp-promise": "^3.0.3",
74
- "treeify": "^1.1.0",
75
73
  "tslib": "^2.8.1",
76
74
  "uuid": "^11.1.0",
77
75
  "yaml": "^2.8.0"
@@ -79,10 +77,11 @@
79
77
  "devDependencies": {
80
78
  "@commitlint/cli": "^15.0.0",
81
79
  "@commitlint/config-conventional": "^15.0.0",
80
+ "@eslint/js": "^9.34.0",
82
81
  "@oclif/test": "^4.1.13",
83
82
  "@semantic-release/changelog": "^6.0.3",
84
83
  "@semantic-release/git": "^10.0.1",
85
- "@types/archiver": "^5.1.1",
84
+ "@types/archiver": "^5.3.4",
86
85
  "@types/base-64": "^1.0.0",
87
86
  "@types/chai": "^4.3.20",
88
87
  "@types/connect-livereload": "^0.5.32",
@@ -145,6 +144,7 @@
145
144
  "description": "Generate a Table of Contents (TOC) file for your API documentation portal."
146
145
  }
147
146
  },
147
+ "topicSeparator": " ",
148
148
  "state": "Alpha"
149
149
  },
150
150
  "lint-staged": {
@@ -1,11 +0,0 @@
1
- import chokidar from "chokidar";
2
- import { ServePaths } from "../../../types/portal/serve.js";
3
- import { DirectoryPath } from "../../../types/file/directoryPath.js";
4
- import { ActionResult } from "../../../actions/action-result.js";
5
- export declare class PortalWatcher {
6
- private watcherHandler;
7
- constructor();
8
- watchAndRegeneratePortalOnChange(paths: ServePaths, commandName: string, generatePortal: (buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, commandName: string, force: boolean, zipPortal: boolean) => Promise<ActionResult>): Promise<chokidar.FSWatcher>;
9
- cancelPendingOperations(): void;
10
- protected handleFileChange(paths: ServePaths, eventQueue: Map<string, string>, eventId: string, commandName: string, generatePortal: (buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, commandName: string, force: boolean, zipPortal: boolean) => Promise<ActionResult>): Promise<void>;
11
- }
@@ -1,64 +0,0 @@
1
- import chokidar from "chokidar";
2
- import crypto from "crypto";
3
- import console from "console";
4
- import { Mutex } from "async-mutex";
5
- import { WatcherHandler } from "./watcher-handler.js";
6
- import { DirectoryPath } from "../../../types/file/directoryPath.js";
7
- export class PortalWatcher {
8
- constructor() {
9
- this.watcherHandler = new WatcherHandler();
10
- }
11
- async watchAndRegeneratePortalOnChange(paths, commandName, generatePortal) {
12
- //Regex matches any hidden files and folders.
13
- const watcher = chokidar.watch(paths.sourceDirectoryPath, {
14
- ignored: [/(^|[/\\])\..+/],
15
- ignoreInitial: true,
16
- persistent: true,
17
- awaitWriteFinish: true,
18
- atomic: true
19
- });
20
- const deletedDirectories = new Set();
21
- const eventQueue = new Map();
22
- const mutex = new Mutex();
23
- watcher
24
- .on("all", async (event, path) => {
25
- if (event == "unlinkDir") {
26
- deletedDirectories.add(path);
27
- }
28
- if (event == "unlink") {
29
- for (const dir of deletedDirectories) {
30
- if (path.startsWith(dir)) {
31
- return;
32
- }
33
- }
34
- }
35
- const eventId = `${Date.now()}-${crypto.randomUUID()}`;
36
- await mutex.runExclusive(async () => {
37
- eventQueue.clear();
38
- eventQueue.set(eventId, path);
39
- });
40
- await this.watcherHandler.execute(async () => {
41
- await this.handleFileChange(paths, eventQueue, eventId, commandName, generatePortal);
42
- });
43
- })
44
- .on("error", () => {
45
- console.error("An unexpected error occurred while watching your build folder for changes. Please try again later. If the issue persists, contact our team at support@apimatic.io");
46
- watcher.close();
47
- });
48
- return watcher;
49
- }
50
- // TODO: Remove this method. Figure out a better way to do this.
51
- cancelPendingOperations() {
52
- if (this.watcherHandler) {
53
- this.watcherHandler.cancel();
54
- }
55
- }
56
- async handleFileChange(paths, eventQueue, eventId, commandName, generatePortal) {
57
- if (!eventQueue.has(eventId)) {
58
- return;
59
- }
60
- const result = await generatePortal(new DirectoryPath(paths.sourceDirectoryPath), new DirectoryPath(paths.destinationDirectoryPath), commandName, true, false);
61
- result.map((error) => console.log(error));
62
- }
63
- }
64
- //# sourceMappingURL=portal-watcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"portal-watcher.js","sourceRoot":"","sources":["../../../../src/application/portal/serve/portal-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,MAAM,OAAO,aAAa;IAGxB;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;IAC7C,CAAC;IAEM,KAAK,CAAC,gCAAgC,CAC3C,KAAiB,EACjB,WAAmB,EACnB,cAM0B;QAE1B,6CAA6C;QAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE;YACxD,OAAO,EAAE,CAAC,eAAe,CAAC;YAC1B,aAAa,EAAE,IAAI;YACnB,UAAU,EAAE,IAAI;YAChB,gBAAgB,EAAE,IAAI;YACtB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,MAAM,kBAAkB,GAAG,IAAI,GAAG,EAAU,CAAC;QAC7C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;QAE1B,OAAO;aACJ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YAC/B,IAAI,KAAK,IAAI,WAAW,EAAE,CAAC;gBACzB,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;YAED,IAAI,KAAK,IAAI,QAAQ,EAAE,CAAC;gBACtB,KAAK,MAAM,GAAG,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,aAAa,CAAC,KAAK,CAAC,wBAAwB,CAAC,EACjD,WAAW,EACX,IAAI,EACJ,KAAK,CACN,CAAC;QACF,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5C,CAAC;CACF"}
@@ -1,16 +0,0 @@
1
- import { Result } from "../../../types/common/result.js";
2
- import { ServeFlags, ServePaths } from "../../../types/portal/serve.js";
3
- import { DirectoryPath } from "../../../types/file/directoryPath.js";
4
- import { ActionResult } from "../../../actions/action-result.js";
5
- export declare class ServeHandler {
6
- private server;
7
- private liveReloadServer;
8
- private readonly app;
9
- private readonly portalWatcher;
10
- constructor();
11
- setupServer(generatedPortalArtifactsDirectoryPath: string): Promise<Result<string, string>>;
12
- startServer(paths: ServePaths, flags: ServeFlags, commandName: string, generatePortal: (buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, commandName: string, force: boolean, zipPortal: boolean) => Promise<ActionResult>, displayShutdownMessages?: boolean): Promise<Result<boolean, string>>;
13
- private stopServer;
14
- private createLiveReloadServer;
15
- private getPortForReloadServer;
16
- }
@@ -1,91 +0,0 @@
1
- import express from "express";
2
- import livereload from "livereload";
3
- import connectLivereload from "connect-livereload";
4
- import open from "open";
5
- import process from "process";
6
- import getPort from "get-port";
7
- import console from "console";
8
- import { Result } from "../../../types/common/result.js";
9
- import { PortalWatcher } from "./portal-watcher.js";
10
- export class ServeHandler {
11
- constructor() {
12
- this.app = express();
13
- this.portalWatcher = new PortalWatcher();
14
- }
15
- //TODO: Needs to be refactored after refactoring quickstart.
16
- async setupServer(generatedPortalArtifactsDirectoryPath) {
17
- const createLiveReloadServerResult = await this.createLiveReloadServer(generatedPortalArtifactsDirectoryPath);
18
- if (createLiveReloadServerResult.isFailed()) {
19
- return Result.failure(createLiveReloadServerResult.error);
20
- }
21
- this.app.use(express.static(generatedPortalArtifactsDirectoryPath, { extensions: ["html"] }));
22
- return Result.success(`Server is set up and serving files from ${generatedPortalArtifactsDirectoryPath}`);
23
- }
24
- //TODO: Needs to be refactored after refactoring quickstart.
25
- async startServer(paths, flags, commandName, generatePortal, displayShutdownMessages = true) {
26
- return new Promise((resolve, reject) => {
27
- this.server = this.app
28
- .listen(flags.port, async () => {
29
- if (flags.open) {
30
- await open(`http://localhost:${flags.port}`);
31
- }
32
- if (!flags["no-reload"]) {
33
- await this.portalWatcher.watchAndRegeneratePortalOnChange(paths, commandName, generatePortal);
34
- }
35
- if (process.platform !== "darwin") {
36
- //For non-macOS users.
37
- if (process.stdin.setRawMode) {
38
- process.stdin.setRawMode(false);
39
- }
40
- }
41
- resolve(Result.success(true));
42
- })
43
- .on("error", () => {
44
- reject(new Error(`Something went wrong while serving your portal. Please try again later. If the issue persists, contact our team at support@apimatic.io`));
45
- });
46
- const shutdown = async () => {
47
- if (displayShutdownMessages) {
48
- console.log("Shutting down server...");
49
- }
50
- await this.stopServer();
51
- if (displayShutdownMessages) {
52
- console.log("Server shut down successfully.");
53
- }
54
- resolve(Result.success(true));
55
- process.exit(0);
56
- };
57
- process.on("SIGINT", shutdown);
58
- process.on("SIGTERM", shutdown);
59
- });
60
- }
61
- async stopServer() {
62
- this.portalWatcher.cancelPendingOperations();
63
- if (this.liveReloadServer) {
64
- this.liveReloadServer.close();
65
- }
66
- if (this.server) {
67
- await new Promise((resolve) => {
68
- this.server.close(() => resolve());
69
- });
70
- }
71
- }
72
- async createLiveReloadServer(generatedPortalPath) {
73
- try {
74
- const availablePort = await this.getPortForReloadServer();
75
- this.liveReloadServer = livereload.createServer({
76
- port: availablePort
77
- });
78
- this.liveReloadServer.watch(generatedPortalPath);
79
- this.app.use(connectLivereload());
80
- return Result.success("Live Reload Server setup successfully.");
81
- }
82
- catch (_a) {
83
- return Result.failure("An unexpected error occurred while serving your portal, please try again later. If the issue persists, contact our team at support@apimatic.io for assistance.");
84
- }
85
- }
86
- async getPortForReloadServer() {
87
- const defaultPorts = [35729, 35730, 35731];
88
- return await getPort({ port: defaultPorts });
89
- }
90
- }
91
- //# sourceMappingURL=serve-handler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serve-handler.js","sourceRoot":"","sources":["../../../../src/application/portal/serve/serve-handler.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,OAAO,YAAY;IAMvB;QACE,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;IAC3C,CAAC;IAED,4DAA4D;IACrD,KAAK,CAAC,WAAW,CAAC,qCAA6C;QACpE,MAAM,4BAA4B,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,qCAAqC,CAAC,CAAC;QAC9G,IAAI,4BAA4B,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,4BAA4B,CAAC,KAAM,CAAC,CAAC;QAC7D,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,qCAAqC,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAE9F,OAAO,MAAM,CAAC,OAAO,CAAC,2CAA2C,qCAAqC,EAAE,CAAC,CAAC;IAC5G,CAAC;IAED,4DAA4D;IACrD,KAAK,CAAC,WAAW,CACtB,KAAiB,EACjB,KAAiB,EACjB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KAAK,CAAC,sBAAsB;QAClC,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3C,OAAO,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"watcher-handler.js","sourceRoot":"","sources":["../../../../src/application/portal/serve/watcher-handler.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAMzB,YAAY,aAAqB,GAAG;QAL5B,iBAAY,GAAG,KAAK,CAAC;QACrB,kBAAa,GAAiC,IAAI,CAAC;QACnD,kBAAa,GAA0B,IAAI,CAAC;QAIlD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAA4B;QACxC,kCAAkC;QAClC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAE7B,iFAAiF;QACjF,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO;QACT,CAAC;QAED,2BAA2B;QAC3B,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;QAED,6BAA6B;QAC7B,IAAI,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAEO,iBAAiB;QACvB,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,KAAK,IAAI,EAAE;YACzC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YACzB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAE1B,IAAI,CAAC;gBACH,0CAA0C;gBAC1C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;oBACvB,MAAM,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC;oBAC1C,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;oBAC1B,MAAM,cAAc,EAAE,CAAC;gBACzB,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC5B,CAAC;QACH,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACtB,CAAC;IAED,yCAAyC;IAClC,MAAM;QACX,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACvB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF"}
@@ -1,19 +0,0 @@
1
- import { PortalService } from "../../../infrastructure/services/portal-service.js";
2
- import { TocEndpoint, TocModel } from "../../../types/toc/toc.js";
3
- import { Result } from "../../../types/common/result.js";
4
- import { SdlEndpoint } from "../../../types/sdl/sdl.js";
5
- export declare class SdlParser {
6
- private readonly portalService;
7
- private readonly zipArchiver;
8
- private readonly fileService;
9
- constructor(portalService: PortalService);
10
- getTocComponentsFromSdl(specFolderPath: string, configDir: string, commandName: string): Promise<Result<{
11
- endpointGroups: Map<string, TocEndpoint[]>;
12
- models: TocModel[];
13
- }, string>>;
14
- getEndpointGroupsFromSdl(specFolderPath: string, configDir: string, commandName: string): Promise<Result<Map<string, SdlEndpoint[]>, string>>;
15
- private generateSdlFromSpec;
16
- private extractEndpointGroupsForRecipe;
17
- private extractEndpointGroupsForToc;
18
- private extractModelsForToc;
19
- }
@@ -1,90 +0,0 @@
1
- import { Result } from "../../../types/common/result.js";
2
- import { DirectoryPath } from "../../../types/file/directoryPath.js";
3
- import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
4
- import { FileName } from "../../../types/file/fileName.js";
5
- import { ZipService } from "../../../infrastructure/zip-service.js";
6
- import { FilePath } from "../../../types/file/filePath.js";
7
- import { FileService } from "../../../infrastructure/file-service.js";
8
- export class SdlParser {
9
- constructor(portalService) {
10
- this.portalService = portalService;
11
- this.zipArchiver = new ZipService();
12
- this.fileService = new FileService();
13
- }
14
- async getTocComponentsFromSdl(specFolderPath, configDir, commandName) {
15
- const sdlResult = await this.generateSdlFromSpec(specFolderPath, configDir, commandName);
16
- if (!sdlResult.isSuccess()) {
17
- return Result.failure("Failed to extract endpoints/models from the specification. Please validate your spec using APIMatic's interactive VS Code Extension and then try again.");
18
- }
19
- const sdl = sdlResult.value;
20
- const endpointGroups = this.extractEndpointGroupsForToc(sdl);
21
- const models = this.extractModelsForToc(sdl);
22
- return Result.success({ endpointGroups, models });
23
- }
24
- async getEndpointGroupsFromSdl(specFolderPath, configDir, commandName) {
25
- const sdlResult = await this.generateSdlFromSpec(specFolderPath, configDir, commandName);
26
- if (!sdlResult.isSuccess()) {
27
- return Result.failure("Failed to extract endpoints from the API specification. Please validate your spec using APIMatic's interactive VS Code Extension and then try again.");
28
- }
29
- const sdl = sdlResult.value;
30
- const endpointGroups = this.extractEndpointGroupsForRecipe(sdl);
31
- return Result.success(endpointGroups);
32
- }
33
- async generateSdlFromSpec(specFolderPath, configDir, commandName) {
34
- return await withDirPath(async (tempDirectory) => {
35
- const specZipPath = new FilePath(tempDirectory, new FileName("spec.zip"));
36
- await this.zipArchiver.archive(new DirectoryPath(specFolderPath), specZipPath);
37
- const specFileStream = await this.fileService.getStream(specZipPath);
38
- let result;
39
- try {
40
- result = await this.portalService.generateSdl(specFileStream, configDir, commandName);
41
- }
42
- finally {
43
- specFileStream.close();
44
- }
45
- if (!result.isSuccess()) {
46
- return Result.failure("Failed to generate SDL from the API specification. Please validate your spec using APIMatic's interactive VS Code Extension.");
47
- }
48
- return Result.success(result.value);
49
- });
50
- }
51
- extractEndpointGroupsForRecipe(sdl) {
52
- const endpointGroups = new Map();
53
- for (const endpoint of sdl.Endpoints) {
54
- if (!endpointGroups.has(endpoint.Group)) {
55
- endpointGroups.set(endpoint.Group, []);
56
- }
57
- endpointGroups.get(endpoint.Group).push({
58
- Name: endpoint.Name,
59
- Description: endpoint.Description,
60
- Group: endpoint.Group
61
- });
62
- }
63
- return endpointGroups;
64
- }
65
- extractEndpointGroupsForToc(sdl) {
66
- const endpointGroups = new Map();
67
- const endpoints = sdl.Endpoints.map((e) => ({
68
- generate: null,
69
- from: "endpoint",
70
- endpointName: e.Name,
71
- endpointGroup: e.Group
72
- }));
73
- endpoints.forEach((endpoint) => {
74
- const group = endpoint.endpointGroup;
75
- if (!endpointGroups.has(group)) {
76
- endpointGroups.set(group, []);
77
- }
78
- endpointGroups.get(group).push(endpoint);
79
- });
80
- return endpointGroups;
81
- }
82
- extractModelsForToc(sdl) {
83
- return sdl.CustomTypes.map((e) => ({
84
- generate: null,
85
- from: "model",
86
- modelName: e.Name
87
- }));
88
- }
89
- }
90
- //# sourceMappingURL=sdl-parser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdl-parser.js","sourceRoot":"","sources":["../../../../src/application/portal/toc/sdl-parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,MAAM,OAAO,SAAS;IAIpB,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAHxC,gBAAW,GAAe,IAAI,UAAU,EAAE,CAAC;QAC3C,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;IAEW,CAAC;IAEtD,KAAK,CAAC,uBAAuB,CAClC,cAAsB,EACtB,SAAiB,EACjB,WAAmB;QAEnB,MA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AAC;QAExD,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CACjC,CAAC,CAAc,EAAe,EAAE,CAAC,CAAC;YAChC,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,UAAU;YAChB,YAAY,EAAE,CAAC,CAAC,IAAI;YACpB,aAAa,EAAE,CAAC,CAAC,KAAK;SACvB,CAAC,CACH,CAAC;QAEF,SAAS,CAAC,OAAO,CAAC,CAAC,QAAqB,EAAE,EAAE;YAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC;YACrC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChC,CAAC;YACD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,OAAO,cAAc,CAAC;IACxB,CAAC;IAEO,mBAAmB,CAAC,GAAQ;QAClC,OAAO,GAAG,CAAC,WAAW,CAAC,GAAG,CACxB,CAAC,CAAW,EAAY,EAAE,CAAC,CAAC;YAC1B,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,CAAC,CAAC,IAAI;SAClB,CAAC,CACH,CAAC;IACJ,CAAC;CACF"}
@@ -1,18 +0,0 @@
1
- import { Client } from "@apimatic/sdk";
2
- /**
3
- * The Singleton class defines the `getInstance` method that lets clients access
4
- * the unique singleton instance.
5
- */
6
- export declare class SDKClient {
7
- static client: Client;
8
- private static instance;
9
- /**
10
- * The static method that controls the access to the SDKClient instance.
11
- *
12
- * This implementation let you subclass the SDKClient class while keeping
13
- * just one instance of each subclass around.
14
- */
15
- static getInstance(): SDKClient;
16
- logout(configDir: string): Promise<string>;
17
- status(configDir: string): Promise<string>;
18
- }
@@ -1,41 +0,0 @@
1
- import { getAuthInfo, removeAuthInfo } from "./auth-manager.js";
2
- /**
3
- * The Singleton class defines the `getInstance` method that lets clients access
4
- * the unique singleton instance.
5
- */
6
- export class SDKClient {
7
- /**
8
- * The static method that controls the access to the SDKClient instance.
9
- *
10
- * This implementation let you subclass the SDKClient class while keeping
11
- * just one instance of each subclass around.
12
- */
13
- static getInstance() {
14
- if (!SDKClient.instance) {
15
- SDKClient.instance = new SDKClient();
16
- }
17
- return SDKClient.instance;
18
- }
19
- async logout(configDir) {
20
- await removeAuthInfo(configDir);
21
- return "Logged out";
22
- }
23
- async status(configDir) {
24
- try {
25
- let storedAuthInfo = await getAuthInfo(configDir);
26
- if (!storedAuthInfo) {
27
- // If no config file or no credentials exist in the config file
28
- storedAuthInfo = { email: "", authKey: "" };
29
- }
30
- return storedAuthInfo.email === "" && storedAuthInfo.authKey === ""
31
- ? "Not logged in"
32
- : storedAuthInfo.email === "" && storedAuthInfo.authKey !== ""
33
- ? "Logged in with authentication key"
34
- : `Currently logged in as ${storedAuthInfo.email}`;
35
- }
36
- catch (error) {
37
- throw error;
38
- }
39
- }
40
- }
41
- //# 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":"AACA,OAAO,EAAY,WAAW,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;GAGG;AACH,MAAM,OAAO,SAAS;IAIpB;;;;;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;IAEM,KAAK,CAAC,MAAM,CAAC,SAAiB;QACnC,MAAM,cAAc,CAAC,SAAS,CAAC,CAAC;QAChC,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,SAAiB;QACnC,IAAI,CAAC;YACH,IAAI,cAAc,GAAoB,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;YAEnE,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,+DAA+D;gBAC/D,cAAc,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;YAC9C,CAAC;YAED,OAAO,cAAc,CAAC,KAAK,KAAK,EAAE,IAAI,cAAc,CAAC,OAAO,KAAK,EAAE;gBACjE,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,cAAc,CAAC,KAAK,KAAK,EAAE,IAAI,cAAc,CAAC,OAAO,KAAK,EAAE;oBAC9D,CAAC,CAAC,mCAAmC;oBACrC,CAAC,CAAC,0BAA0B,cAAc,CAAC,KAAK,EAAE,CAAC;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,KAAc,CAAC;QACvB,CAAC;IACH,CAAC;CACF"}
@@ -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
- };