@apimatic/cli 0.0.0-alpha.4 → 1.0.0-beta.1

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 (305) hide show
  1. package/README.md +308 -130
  2. package/bin/run.js +5 -0
  3. package/lib/actions/action-result.d.ts +13 -0
  4. package/lib/actions/action-result.js +44 -0
  5. package/lib/actions/action-result.js.map +1 -0
  6. package/lib/actions/api/transform.d.ts +15 -0
  7. package/lib/actions/api/transform.js +48 -0
  8. package/lib/actions/api/transform.js.map +1 -0
  9. package/lib/actions/api/validate.d.ts +12 -0
  10. package/lib/actions/api/validate.js +41 -0
  11. package/lib/actions/api/validate.js.map +1 -0
  12. package/lib/actions/auth/login.d.ts +13 -0
  13. package/lib/actions/auth/login.js +55 -0
  14. package/lib/actions/auth/login.js.map +1 -0
  15. package/lib/actions/auth/logout.d.ts +8 -0
  16. package/lib/actions/auth/logout.js +15 -0
  17. package/lib/actions/auth/logout.js.map +1 -0
  18. package/lib/actions/auth/status.d.ts +11 -0
  19. package/lib/actions/auth/status.js +26 -0
  20. package/lib/actions/auth/status.js.map +1 -0
  21. package/lib/actions/portal/copilot.d.ts +16 -0
  22. package/lib/actions/portal/copilot.js +89 -0
  23. package/lib/actions/portal/copilot.js.map +1 -0
  24. package/lib/actions/portal/generate.d.ts +13 -0
  25. package/lib/actions/portal/generate.js +59 -0
  26. package/lib/actions/portal/generate.js.map +1 -0
  27. package/lib/actions/portal/quickstart.d.ts +16 -0
  28. package/lib/actions/portal/quickstart.js +145 -0
  29. package/lib/actions/portal/quickstart.js.map +1 -0
  30. package/lib/actions/portal/recipe/new-recipe.d.ts +15 -0
  31. package/lib/actions/portal/recipe/new-recipe.js +176 -0
  32. package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
  33. package/lib/actions/portal/serve.d.ts +16 -0
  34. package/lib/actions/portal/serve.js +119 -0
  35. package/lib/actions/portal/serve.js.map +1 -0
  36. package/lib/actions/portal/toc/new-toc.d.ts +21 -0
  37. package/lib/actions/portal/toc/new-toc.js +97 -0
  38. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  39. package/lib/actions/sdk/generate.d.ts +13 -0
  40. package/lib/actions/sdk/generate.js +47 -0
  41. package/lib/actions/sdk/generate.js.map +1 -0
  42. package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
  43. package/lib/application/portal/recipe/portal-recipe.js +33 -0
  44. package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
  45. package/lib/application/portal/recipe/recipe-generator.d.ts +21 -0
  46. package/lib/application/portal/recipe/recipe-generator.js +146 -0
  47. package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
  48. package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
  49. package/lib/application/portal/toc/toc-content-parser.js +44 -0
  50. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  51. package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
  52. package/lib/application/portal/toc/toc-structure-generator.js +84 -0
  53. package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
  54. package/lib/client-utils/auth-manager.d.ts +8 -3
  55. package/lib/client-utils/auth-manager.js +26 -14
  56. package/lib/client-utils/auth-manager.js.map +1 -0
  57. package/lib/commands/api/transform.d.ts +11 -8
  58. package/lib/commands/api/transform.js +52 -105
  59. package/lib/commands/api/transform.js.map +1 -0
  60. package/lib/commands/api/validate.d.ts +8 -5
  61. package/lib/commands/api/validate.js +31 -63
  62. package/lib/commands/api/validate.js.map +1 -0
  63. package/lib/commands/auth/login.d.ts +4 -2
  64. package/lib/commands/auth/login.js +26 -51
  65. package/lib/commands/auth/login.js.map +1 -0
  66. package/lib/commands/auth/logout.d.ts +4 -2
  67. package/lib/commands/auth/logout.js +14 -20
  68. package/lib/commands/auth/logout.js.map +1 -0
  69. package/lib/commands/auth/status.d.ts +2 -1
  70. package/lib/commands/auth/status.js +18 -20
  71. package/lib/commands/auth/status.js.map +1 -0
  72. package/lib/commands/portal/copilot.d.ts +13 -0
  73. package/lib/commands/portal/copilot.js +34 -0
  74. package/lib/commands/portal/copilot.js.map +1 -0
  75. package/lib/commands/portal/generate.d.ts +9 -8
  76. package/lib/commands/portal/generate.js +31 -97
  77. package/lib/commands/portal/generate.js.map +1 -0
  78. package/lib/commands/portal/quickstart.d.ts +9 -0
  79. package/lib/commands/portal/quickstart.js +37 -0
  80. package/lib/commands/portal/quickstart.js.map +1 -0
  81. package/lib/commands/portal/recipe/new.d.ts +12 -0
  82. package/lib/commands/portal/recipe/new.js +46 -0
  83. package/lib/commands/portal/recipe/new.js.map +1 -0
  84. package/lib/commands/portal/serve.d.ts +16 -0
  85. package/lib/commands/portal/serve.js +54 -0
  86. package/lib/commands/portal/serve.js.map +1 -0
  87. package/lib/commands/portal/toc/new.d.ts +14 -0
  88. package/lib/commands/portal/toc/new.js +61 -0
  89. package/lib/commands/portal/toc/new.js.map +1 -0
  90. package/lib/commands/sdk/generate.d.ts +11 -9
  91. package/lib/commands/sdk/generate.js +48 -122
  92. package/lib/commands/sdk/generate.js.map +1 -0
  93. package/lib/config/axios-config.d.ts +2 -0
  94. package/lib/config/axios-config.js +10 -0
  95. package/lib/config/axios-config.js.map +1 -0
  96. package/lib/hooks/not-found.d.ts +3 -0
  97. package/lib/hooks/not-found.js +52 -0
  98. package/lib/hooks/not-found.js.map +1 -0
  99. package/lib/hooks/utils.d.ts +5 -0
  100. package/lib/hooks/utils.js +51 -0
  101. package/lib/hooks/utils.js.map +1 -0
  102. package/lib/index.d.ts +1 -1
  103. package/lib/index.js +2 -4
  104. package/lib/index.js.map +1 -0
  105. package/lib/infrastructure/api-utils.d.ts +9 -0
  106. package/lib/infrastructure/api-utils.js +34 -0
  107. package/lib/infrastructure/api-utils.js.map +1 -0
  108. package/lib/infrastructure/debounce-service.d.ts +10 -0
  109. package/lib/infrastructure/debounce-service.js +52 -0
  110. package/lib/infrastructure/debounce-service.js.map +1 -0
  111. package/lib/infrastructure/env-info.d.ts +12 -0
  112. package/lib/infrastructure/env-info.js +58 -0
  113. package/lib/infrastructure/env-info.js.map +1 -0
  114. package/lib/infrastructure/file-service.d.ts +23 -0
  115. package/lib/infrastructure/file-service.js +117 -0
  116. package/lib/infrastructure/file-service.js.map +1 -0
  117. package/lib/infrastructure/launcher-service.d.ts +7 -0
  118. package/lib/infrastructure/launcher-service.js +51 -0
  119. package/lib/infrastructure/launcher-service.js.map +1 -0
  120. package/lib/infrastructure/network-service.d.ts +3 -0
  121. package/lib/infrastructure/network-service.js +7 -0
  122. package/lib/infrastructure/network-service.js.map +1 -0
  123. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  124. package/lib/infrastructure/services/api-client-factory.js +20 -0
  125. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  126. package/lib/infrastructure/services/api-service.d.ts +10 -0
  127. package/lib/infrastructure/services/api-service.js +55 -0
  128. package/lib/infrastructure/services/api-service.js.map +1 -0
  129. package/lib/infrastructure/services/auth-service.d.ts +11 -0
  130. package/lib/infrastructure/services/auth-service.js +37 -0
  131. package/lib/infrastructure/services/auth-service.js.map +1 -0
  132. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  133. package/lib/infrastructure/services/file-download-service.js +104 -0
  134. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  135. package/lib/infrastructure/services/portal-service.d.ts +21 -0
  136. package/lib/infrastructure/services/portal-service.js +157 -0
  137. package/lib/infrastructure/services/portal-service.js.map +1 -0
  138. package/lib/infrastructure/services/telemetry-service.d.ts +9 -0
  139. package/lib/infrastructure/services/telemetry-service.js +38 -0
  140. package/lib/infrastructure/services/telemetry-service.js.map +1 -0
  141. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  142. package/lib/infrastructure/services/transformation-service.js +56 -0
  143. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  144. package/lib/infrastructure/services/validation-service.d.ts +17 -0
  145. package/lib/infrastructure/services/validation-service.js +49 -0
  146. package/lib/infrastructure/services/validation-service.js.map +1 -0
  147. package/lib/infrastructure/tmp-extensions.d.ts +2 -0
  148. package/lib/infrastructure/tmp-extensions.js +6 -0
  149. package/lib/infrastructure/tmp-extensions.js.map +1 -0
  150. package/lib/infrastructure/zip-service.d.ts +6 -0
  151. package/lib/infrastructure/zip-service.js +39 -0
  152. package/lib/infrastructure/zip-service.js.map +1 -0
  153. package/lib/prompts/api/transform.d.ts +11 -0
  154. package/lib/prompts/api/transform.js +30 -0
  155. package/lib/prompts/api/transform.js.map +1 -0
  156. package/lib/prompts/api/validate.d.ts +12 -0
  157. package/lib/prompts/api/validate.js +41 -0
  158. package/lib/prompts/api/validate.js.map +1 -0
  159. package/lib/prompts/auth/login.d.ts +10 -0
  160. package/lib/prompts/auth/login.js +22 -0
  161. package/lib/prompts/auth/login.js.map +1 -0
  162. package/lib/prompts/auth/logout.d.ts +3 -0
  163. package/lib/prompts/auth/logout.js +7 -0
  164. package/lib/prompts/auth/logout.js.map +1 -0
  165. package/lib/prompts/auth/status.d.ts +8 -0
  166. package/lib/prompts/auth/status.js +21 -0
  167. package/lib/prompts/auth/status.js.map +1 -0
  168. package/lib/prompts/format.d.ts +33 -0
  169. package/lib/prompts/format.js +99 -0
  170. package/lib/prompts/format.js.map +1 -0
  171. package/lib/prompts/portal/copilot.d.ts +18 -0
  172. package/lib/prompts/portal/copilot.js +82 -0
  173. package/lib/prompts/portal/copilot.js.map +1 -0
  174. package/lib/prompts/portal/generate.d.ts +13 -0
  175. package/lib/prompts/portal/generate.js +41 -0
  176. package/lib/prompts/portal/generate.js.map +1 -0
  177. package/lib/prompts/portal/quickstart.d.ts +31 -0
  178. package/lib/prompts/portal/quickstart.js +146 -0
  179. package/lib/prompts/portal/quickstart.js.map +1 -0
  180. package/lib/prompts/portal/recipe/new-recipe.d.ts +29 -0
  181. package/lib/prompts/portal/recipe/new-recipe.js +165 -0
  182. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
  183. package/lib/prompts/portal/serve.d.ts +11 -0
  184. package/lib/prompts/portal/serve.js +33 -0
  185. package/lib/prompts/portal/serve.js.map +1 -0
  186. package/lib/prompts/portal/toc/new-toc.d.ts +15 -0
  187. package/lib/prompts/portal/toc/new-toc.js +37 -0
  188. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  189. package/lib/prompts/sdk/generate.d.ts +11 -0
  190. package/lib/prompts/sdk/generate.js +36 -0
  191. package/lib/prompts/sdk/generate.js.map +1 -0
  192. package/lib/types/api/account.d.ts +10 -0
  193. package/lib/types/api/account.js +2 -0
  194. package/lib/types/api/account.js.map +1 -0
  195. package/lib/types/api/transform.d.ts +17 -17
  196. package/lib/types/api/transform.js +21 -6
  197. package/lib/types/api/transform.js.map +1 -0
  198. package/lib/types/build/build.d.ts +22 -0
  199. package/lib/types/build/build.js +7 -0
  200. package/lib/types/build/build.js.map +1 -0
  201. package/lib/types/build-context.d.ts +17 -0
  202. package/lib/types/build-context.js +47 -0
  203. package/lib/types/build-context.js.map +1 -0
  204. package/lib/types/common/command-metadata.d.ts +4 -0
  205. package/lib/types/common/command-metadata.js +2 -0
  206. package/lib/types/common/command-metadata.js.map +1 -0
  207. package/lib/types/events/domain-event.d.ts +8 -0
  208. package/lib/types/events/domain-event.js +11 -0
  209. package/lib/types/events/domain-event.js.map +1 -0
  210. package/lib/types/events/quickstart-completed.d.ts +7 -0
  211. package/lib/types/events/quickstart-completed.js +10 -0
  212. package/lib/types/events/quickstart-completed.js.map +1 -0
  213. package/lib/types/events/quickstart-initiated.d.ts +7 -0
  214. package/lib/types/events/quickstart-initiated.js +10 -0
  215. package/lib/types/events/quickstart-initiated.js.map +1 -0
  216. package/lib/types/events/recipe-creation-failed.d.ts +5 -0
  217. package/lib/types/events/recipe-creation-failed.js +8 -0
  218. package/lib/types/events/recipe-creation-failed.js.map +1 -0
  219. package/lib/types/events/toc-creation-failed.d.ts +5 -0
  220. package/lib/types/events/toc-creation-failed.js +8 -0
  221. package/lib/types/events/toc-creation-failed.js.map +1 -0
  222. package/lib/types/file/directory.d.ts +17 -0
  223. package/lib/types/file/directory.js +86 -0
  224. package/lib/types/file/directory.js.map +1 -0
  225. package/lib/types/file/directoryPath.d.ts +9 -0
  226. package/lib/types/file/directoryPath.js +22 -0
  227. package/lib/types/file/directoryPath.js.map +1 -0
  228. package/lib/types/file/fileName.d.ts +7 -0
  229. package/lib/types/file/fileName.js +21 -0
  230. package/lib/types/file/fileName.js.map +1 -0
  231. package/lib/types/file/filePath.d.ts +10 -0
  232. package/lib/types/file/filePath.js +32 -0
  233. package/lib/types/file/filePath.js.map +1 -0
  234. package/lib/types/file/resource-input.d.ts +5 -0
  235. package/lib/types/file/resource-input.js +42 -0
  236. package/lib/types/file/resource-input.js.map +1 -0
  237. package/lib/types/file/urlPath.d.ts +6 -0
  238. package/lib/types/file/urlPath.js +22 -0
  239. package/lib/types/file/urlPath.js.map +1 -0
  240. package/lib/types/flags-provider.d.ts +15 -0
  241. package/lib/types/flags-provider.js +34 -0
  242. package/lib/types/flags-provider.js.map +1 -0
  243. package/lib/types/portal-context.d.ts +13 -0
  244. package/lib/types/portal-context.js +38 -0
  245. package/lib/types/portal-context.js.map +1 -0
  246. package/lib/types/recipe/recipe.d.ts +22 -0
  247. package/lib/types/recipe/recipe.js +6 -0
  248. package/lib/types/recipe/recipe.js.map +1 -0
  249. package/lib/types/recipe-context.d.ts +8 -0
  250. package/lib/types/recipe-context.js +21 -0
  251. package/lib/types/recipe-context.js.map +1 -0
  252. package/lib/types/resource-context.d.ts +12 -0
  253. package/lib/types/resource-context.js +30 -0
  254. package/lib/types/resource-context.js.map +1 -0
  255. package/lib/types/sdk/generate.d.ts +9 -21
  256. package/lib/types/sdk/generate.js +25 -12
  257. package/lib/types/sdk/generate.js.map +1 -0
  258. package/lib/types/sdk-context.d.ts +14 -0
  259. package/lib/types/sdk-context.js +32 -0
  260. package/lib/types/sdk-context.js.map +1 -0
  261. package/lib/types/sdl/sdl.d.ts +21 -0
  262. package/lib/types/sdl/sdl.js +47 -0
  263. package/lib/types/sdl/sdl.js.map +1 -0
  264. package/lib/types/spec-context.d.ts +10 -0
  265. package/lib/types/spec-context.js +17 -0
  266. package/lib/types/spec-context.js.map +1 -0
  267. package/lib/types/temp-context.d.ts +11 -0
  268. package/lib/types/temp-context.js +27 -0
  269. package/lib/types/temp-context.js.map +1 -0
  270. package/lib/types/toc/toc.d.ts +31 -0
  271. package/lib/types/toc/toc.js +9 -0
  272. package/lib/types/toc/toc.js.map +1 -0
  273. package/lib/types/toc-context.d.ts +12 -0
  274. package/lib/types/toc-context.js +26 -0
  275. package/lib/types/toc-context.js.map +1 -0
  276. package/lib/types/transform-context.d.ts +13 -0
  277. package/lib/types/transform-context.js +30 -0
  278. package/lib/types/transform-context.js.map +1 -0
  279. package/lib/types/utils.d.ts +1 -6
  280. package/lib/types/utils.js +2 -2
  281. package/lib/types/utils.js.map +1 -0
  282. package/lib/utils/string-utils.d.ts +1 -0
  283. package/lib/utils/string-utils.js +10 -0
  284. package/lib/utils/string-utils.js.map +1 -0
  285. package/lib/utils/utils.d.ts +2 -18
  286. package/lib/utils/utils.js +33 -116
  287. package/lib/utils/utils.js.map +1 -0
  288. package/package.json +101 -44
  289. package/bin/run +0 -5
  290. package/lib/client-utils/sdk-client.d.ts +0 -23
  291. package/lib/client-utils/sdk-client.js +0 -119
  292. package/lib/config/env.d.ts +0 -1
  293. package/lib/config/env.js +0 -4
  294. package/lib/controllers/api/transform.d.ts +0 -5
  295. package/lib/controllers/api/transform.js +0 -49
  296. package/lib/controllers/api/validate.d.ts +0 -3
  297. package/lib/controllers/api/validate.js +0 -22
  298. package/lib/controllers/portal/generate.d.ts +0 -2
  299. package/lib/controllers/portal/generate.js +0 -49
  300. package/lib/controllers/sdk/generate.d.ts +0 -4
  301. package/lib/controllers/sdk/generate.js +0 -64
  302. package/lib/types/api/validate.d.ts +0 -12
  303. package/lib/types/api/validate.js +0 -2
  304. package/lib/types/portal/generate.d.ts +0 -9
  305. package/lib/types/portal/generate.js +0 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string-utils.js","sourceRoot":"","sources":["../../src/utils/string-utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE;IACpD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzE,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB;QAC5D,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -1,20 +1,4 @@
1
- /// <reference types="node" />
2
- /// <reference types="mocha" />
3
- import { loggers, ValidationMessages } from "../types/utils";
4
- export declare const unzipFile: (stream: NodeJS.ReadableStream, destination: string) => Promise<unknown>;
5
- export declare const deleteFile: (filePath: string) => Promise<void>;
6
- export declare const writeFileUsingReadableStream: (stream: NodeJS.ReadableStream, destinationPath: string) => Promise<unknown>;
7
- /**
8
- * Packages local files into a ZIP archive
9
- *
10
- * @param {docsPortalFolderPath} path to portal directory.
11
- * @param {destinationZipPath} path to generated zip
12
- * return {string}
13
- */
14
- export declare const zipDirectory: (sourcePath: string, destinationPath: string) => Promise<string>;
15
- export declare const startProgress: (title: string) => void;
16
- export declare const stopProgress: (isError?: boolean) => void | null;
17
1
  export declare const replaceHTML: (string: string) => string;
18
- export declare const isJSONParsable: (json: string) => boolean;
19
2
  export declare const getFileNameFromPath: (filePath: string) => string;
20
- export declare const printValidationMessages: ({ warnings, errors, messages }: ValidationMessages, { log, warn, error }: loggers) => void;
3
+ export declare function parseStreamBodyToJson(body: NodeJS.ReadableStream): Promise<unknown>;
4
+ export declare const toPascalCase: (str: string) => string;
@@ -1,121 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printValidationMessages = exports.getFileNameFromPath = exports.isJSONParsable = exports.replaceHTML = exports.stopProgress = exports.startProgress = exports.zipDirectory = exports.writeFileUsingReadableStream = exports.deleteFile = exports.unzipFile = void 0;
4
- const cli_ux_1 = require("cli-ux");
5
- const path = require("path");
6
- const fs = require("fs-extra");
7
- const archiver = require("archiver");
8
- const unzipper = require("unzipper");
9
- const stripTags = require("striptags");
10
- exports.unzipFile = (stream, destination) => {
11
- return new Promise((resolve, reject) => {
12
- stream.pipe(unzipper.Extract({ path: destination }));
13
- stream.on("close", (error) => {
14
- if (error) {
15
- reject(new Error("Couldn't extract the zip"));
16
- }
17
- resolve("Extracted");
18
- });
19
- });
20
- };
21
- exports.deleteFile = async (filePath) => {
22
- return await fs.remove(filePath);
23
- };
24
- exports.writeFileUsingReadableStream = (stream, destinationPath) => {
25
- return new Promise((resolve, reject) => {
26
- const writeStream = fs.createWriteStream(destinationPath);
27
- stream.pipe(writeStream);
28
- writeStream.on("close", (error) => {
29
- if (error) {
30
- return reject(new Error("Couldn't zip the stream"));
31
- }
32
- resolve("Zipped");
33
- });
34
- });
35
- };
36
- /**
37
- * Packages local files into a ZIP archive
38
- *
39
- * @param {docsPortalFolderPath} path to portal directory.
40
- * @param {destinationZipPath} path to generated zip
41
- * return {string}
42
- */
43
- exports.zipDirectory = async (sourcePath, destinationPath) => {
44
- // Check if the directory exists for the user or not
45
- await fs.ensureDir(sourcePath);
46
- const zipPath = path.join(destinationPath, "target.zip");
47
- const output = fs.createWriteStream(zipPath);
48
- const archive = archiver("zip");
49
- archive.on("error", (err) => {
50
- throw err;
51
- });
52
- archive.pipe(output);
53
- // append files from a sub-directory, putting its contents at the root of archive
54
- archive.directory(sourcePath, false);
55
- await archive.finalize();
56
- return zipPath;
57
- };
58
- // TODO: Instead of making progressBar a static, you should have "startProgress"
59
- // return the instance of the progress bar created, the same way "cli.progress"
60
- // method does.
61
- let progressBar;
62
- // TODO: I didn't mean to say that we should create a fake progress bar when we
63
- // set the requirements to include progress bar. You should get the download or
64
- // upload progress by tracking how much of the steam has been read/written and
65
- // compare that with the remaining size of the stream (in case of upload, you
66
- // get size from the file size and in case of download, you get it from the
67
- // content-type header). In case the progress can not be calculated, show a
68
- // spinner.
69
- exports.startProgress = (title) => {
70
- progressBar = cli_ux_1.default.progress({
71
- format: `${title} | {bar}`,
72
- barCompleteChar: "\u2588",
73
- barIncompleteChar: "\u2591"
74
- });
75
- progressBar.start();
76
- const total = 100;
77
- let count = 0;
78
- const iv = setInterval(() => {
79
- count++;
80
- progressBar.update(count);
81
- if (count === total - 1) {
82
- clearInterval(iv);
83
- }
84
- }, 50);
85
- };
86
- exports.stopProgress = (isError = false) => {
87
- if (isError) {
88
- return progressBar ? progressBar.stop() : null;
89
- }
90
- progressBar.update(100);
91
- return progressBar.stop();
92
- };
93
- exports.replaceHTML = (string) => {
1
+ import { __asyncValues } from "tslib";
2
+ import * as path from "path";
3
+ import { Buffer } from "buffer";
4
+ import stripTags from "striptags";
5
+ export const replaceHTML = (string) => {
94
6
  return stripTags(string);
95
7
  };
96
- exports.isJSONParsable = (json) => {
97
- try {
98
- JSON.parse(json);
99
- return true;
100
- }
101
- catch (e) {
102
- return false;
103
- }
104
- };
105
- exports.getFileNameFromPath = (filePath) => {
8
+ export const getFileNameFromPath = (filePath) => {
106
9
  return path.basename(filePath).split(".")[0];
107
10
  };
108
- exports.printValidationMessages = ({ warnings, errors, messages }, { log, warn, error }) => {
109
- warnings = warnings || [];
110
- messages = messages || [];
111
- const singleError = errors.join("\n") || "";
112
- messages.forEach((message) => {
113
- log(`Info: ${exports.replaceHTML(message)}`);
114
- });
115
- warnings.forEach((warning) => {
116
- warn(exports.replaceHTML(warning));
117
- });
118
- if (errors.length > 0) {
119
- error(exports.replaceHTML(singleError));
11
+ export async function parseStreamBodyToJson(body) {
12
+ var _a, e_1, _b, _c;
13
+ const chunks = [];
14
+ try {
15
+ for (var _d = true, body_1 = __asyncValues(body), body_1_1; body_1_1 = await body_1.next(), _a = body_1_1.done, !_a; _d = true) {
16
+ _c = body_1_1.value;
17
+ _d = false;
18
+ const chunk = _c;
19
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
20
+ }
120
21
  }
121
- };
22
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
23
+ finally {
24
+ try {
25
+ if (!_d && !_a && (_b = body_1.return)) await _b.call(body_1);
26
+ }
27
+ finally { if (e_1) throw e_1.error; }
28
+ }
29
+ const text = Buffer.concat(chunks).toString("utf-8");
30
+ return JSON.parse(text);
31
+ }
32
+ export const toPascalCase = (str) => {
33
+ return str
34
+ .split(" ")
35
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
36
+ .join("");
37
+ };
38
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +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,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACtD,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,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,26 +1,29 @@
1
1
  {
2
2
  "name": "@apimatic/cli",
3
3
  "description": "The official CLI for APIMatic.",
4
- "version": "0.0.0-alpha.4",
4
+ "version": "1.0.0-beta.1",
5
5
  "author": "APIMatic",
6
6
  "bin": {
7
- "apimatic": "./bin/run"
7
+ "apimatic": "./bin/run.js"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/apimatic/apimatic-cli/issues",
11
+ "email": "support@apimatic.io"
8
12
  },
9
- "bugs": "https://github.com/apimatic/apimatic-cli/issues",
10
13
  "publishConfig": {
11
14
  "access": "public"
12
15
  },
13
16
  "engines": {
14
- "node": ">=12.0.0"
17
+ "node": ">=20.0.0"
15
18
  },
16
19
  "files": [
17
- "/bin",
18
- "/lib",
20
+ "./bin",
21
+ "./lib",
19
22
  "/npm-shrinkwrap.json",
20
23
  "/oclif.manifest.json"
21
24
  ],
22
25
  "repository": "git://github.com/apimatic/apimatic-cli.git",
23
- "homepage": "https://github.com/apimatic/apimatic-cli",
26
+ "homepage": "https://docs.apimatic.io/apimatic-cli/intro-and-install/",
24
27
  "keywords": [
25
28
  "apimatic",
26
29
  "cli",
@@ -30,76 +33,130 @@
30
33
  "automation"
31
34
  ],
32
35
  "license": "MIT",
36
+ "type": "module",
33
37
  "main": "lib/index.js",
34
38
  "types": "lib/index.d.ts",
35
39
  "scripts": {
36
40
  "build": "tsc -b",
37
41
  "postpack": "rimraf oclif.manifest.json",
38
- "posttest": "eslint . --ext .ts --config .eslintrc",
39
- "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"",
42
+ "posttest": "eslint . --ext .ts",
40
43
  "prettier": "prettier \"src/**/*.{js,ts}\"",
41
44
  "format": "prettier --write \"src/**/*.{js,ts}\"",
42
45
  "lint": "eslint \"src/**/*.{js,ts}\"",
43
- "lint:fix": "eslint --fix \"src/**/*.{js,ts}\" --quiet"
46
+ "lint:fix": "eslint --fix \"src/**/*.{js,ts}\" --quiet",
47
+ "test": "tsx node_modules/mocha/bin/_mocha --forbid-only \"test/**/*.test.ts\" --timeout 99999"
44
48
  },
45
49
  "dependencies": {
46
- "@apimatic/sdk": "^0.0.1-alpha.8",
47
- "@oclif/command": "^1.8.0",
48
- "@oclif/config": "^1.17.0",
49
- "@oclif/plugin-autocomplete": "^0.3.0",
50
- "@oclif/plugin-help": "^3.2.3",
51
- "@oclif/plugin-not-found": "^1.2.4",
52
- "archiver": "^5.3.0",
53
- "axios": "^0.24.0",
54
- "base-64": "^1.0.0",
55
- "form-data": "^4.0.0",
56
- "fs-extra": "^10.0.0",
50
+ "@apimatic/sdk": "^0.2.0-alpha.4",
51
+ "@clack/prompts": "1.0.0-alpha.1",
52
+ "@oclif/core": "^4.2.8",
53
+ "@oclif/plugin-autocomplete": "^3.2.24",
54
+ "@oclif/plugin-help": "^6.2.26",
55
+ "archiver": "^7.0.1",
56
+ "async-mutex": "^0.5.0",
57
+ "axios": "^1.8.1",
58
+ "chokidar": "^3.6.0",
59
+ "connect-livereload": "^0.6.1",
60
+ "execa": "^9.6.0",
61
+ "express": "^4.17.1",
62
+ "extract-zip": "^2.0.1",
63
+ "fast-levenshtein": "^3.0.0",
64
+ "form-data": "^4.0.2",
65
+ "fs-extra": "^11.3.0",
66
+ "get-port": "^7.1.0",
67
+ "livereload": "^0.9.3",
68
+ "neverthrow": "^8.2.0",
69
+ "open": "^8.4.0",
70
+ "prettier": "^2.8.8",
57
71
  "striptags": "^3.2.0",
58
- "tslib": "^1.14.1",
59
- "unzipper": "^0.10.11"
72
+ "tmp-promise": "^3.0.3",
73
+ "tslib": "^2.8.1",
74
+ "uuid": "^11.1.0",
75
+ "yaml": "^2.8.0"
60
76
  },
61
77
  "devDependencies": {
62
78
  "@commitlint/cli": "^15.0.0",
63
79
  "@commitlint/config-conventional": "^15.0.0",
64
- "@oclif/dev-cli": "^1.26.0",
65
- "@oclif/test": "^1.2.8",
66
- "@semantic-release/changelog": "^6.0.1",
80
+ "@eslint/js": "^9.34.0",
81
+ "@oclif/test": "^4.1.13",
82
+ "@semantic-release/changelog": "^6.0.3",
67
83
  "@semantic-release/git": "^10.0.1",
68
- "@types/archiver": "^5.1.1",
69
- "@types/axios": "^0.14.0",
84
+ "@types/archiver": "^5.3.4",
70
85
  "@types/base-64": "^1.0.0",
71
- "@types/chai": "^4.2.22",
86
+ "@types/chai": "^4.3.20",
87
+ "@types/connect-livereload": "^0.5.32",
88
+ "@types/express": "^4.17.23",
89
+ "@types/fast-levenshtein": "^0.0.4",
72
90
  "@types/fs-extra": "^9.0.13",
91
+ "@types/livereload": "^0.9.5",
73
92
  "@types/mocha": "^5.2.7",
74
- "@types/node": "^10.17.60",
93
+ "@types/mock-fs": "^4.13.4",
94
+ "@types/node": "^20.17.50",
95
+ "@types/prettier": "^2.7.3",
96
+ "@types/sinon": "^17.0.4",
97
+ "@types/treeify": "^1.0.3",
75
98
  "@types/unzipper": "^0.10.4",
76
- "@typescript-eslint/eslint-plugin": "^5.0.0",
77
- "@typescript-eslint/parser": "^5.0.0",
78
- "chai": "^4.3.4",
79
- "eslint": "^7.32.0",
99
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
100
+ "@typescript-eslint/parser": "^8.0.0",
101
+ "chai": "^4.5.0",
102
+ "eslint": "^9.21.0",
80
103
  "eslint-config-prettier": "^8.3.0",
81
104
  "eslint-plugin-import": "^2.25.2",
82
- "globby": "^10.0.2",
83
105
  "husky": "^7.0.4",
84
106
  "lint-staged": "^11.2.6",
85
- "mocha": "^5.2.0",
86
- "nyc": "^14.1.1",
87
- "prettier": "^2.4.1",
88
- "rimraf": "^3.0.2",
89
- "ts-node": "^8.10.2",
90
- "typescript": "^3.9.10"
107
+ "mocha": "^11.7.1",
108
+ "mock-fs": "^5.5.0",
109
+ "nock": "^14.0.4",
110
+ "nyc": "^17.1.0",
111
+ "oclif": "^4.17.34",
112
+ "rimraf": "^6.0.1",
113
+ "sinon": "^21.0.0",
114
+ "ts-node": "^10.9.2",
115
+ "tsx": "^4.20.3",
116
+ "typescript": "^5.2.2"
91
117
  },
92
118
  "oclif": {
93
119
  "commands": "./lib/commands",
120
+ "dirname": "apimatic",
94
121
  "bin": "apimatic",
122
+ "description": "The official CLI for APIMatic. \nTo get started with APIMatic's CLI using a step by step wizard, run 'apimatic portal:quickstart'.",
123
+ "hooks": {
124
+ "command_not_found": "./lib/hooks/not-found"
125
+ },
95
126
  "plugins": [
96
127
  "@oclif/plugin-autocomplete",
97
- "@oclif/plugin-help",
98
- "@oclif/plugin-not-found"
99
- ]
128
+ "@oclif/plugin-help"
129
+ ],
130
+ "topics": {
131
+ "api": {
132
+ "description": "Transform & Validate your API specifications."
133
+ },
134
+ "auth": {
135
+ "description": "Login using your APIMatic credentials, or view your authentication status."
136
+ },
137
+ "portal": {
138
+ "description": "Generate, download and serve an API Documentation portal for your APIs."
139
+ },
140
+ "sdk": {
141
+ "description": "Generate SDKs for your APIs in multiple languages."
142
+ },
143
+ "portal:toc": {
144
+ "description": "Generate a Table of Contents (TOC) file for your API documentation portal."
145
+ }
146
+ },
147
+ "topicSeparator": " ",
148
+ "state": "Alpha"
100
149
  },
101
150
  "lint-staged": {
102
151
  "*.js": "eslint --cache --fix",
103
152
  "*.{js,ts}": "prettier --write"
153
+ },
154
+ "overrides": {
155
+ "inflight": "npm:lru-cache@^7.14.1",
156
+ "lodash.get": "npm:lodash@^4.17.21",
157
+ "@humanwhocodes/config-array": "npm:@eslint/config-array@latest",
158
+ "rimraf": "^6.0.1",
159
+ "glob": "^10.4.5",
160
+ "q": "npm:promise@^8.3.0"
104
161
  }
105
162
  }
package/bin/run DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-undef */
3
- /* eslint-disable @typescript-eslint/no-var-requires */
4
-
5
- require("@oclif/command").run().then(require("@oclif/command/flush")).catch(require("@oclif/errors/handle"));
@@ -1,23 +0,0 @@
1
- import { Client } from "@apimatic/sdk";
2
- export declare class SDKClient {
3
- static client: Client;
4
- private static instance;
5
- private static authAPI;
6
- /**
7
- * The static method that controls the access to the SDKClient instance.
8
- *
9
- * This implementation let you subclass the SDKClient class while keeping
10
- * just one instance of each subclass around.
11
- */
12
- static getInstance(): SDKClient;
13
- /**
14
- * Finally, any SDKClient should define some business logic, which can be
15
- * executed on its instance.
16
- */
17
- login(email: string, password: string, configDir: string): Promise<string>;
18
- logout(configDir: string): Promise<string>;
19
- status(configDir: string): Promise<string>;
20
- getClient(overrideAuthKey: string | null, configDir: string): Promise<Client>;
21
- private getAuthKey;
22
- setAuthKey: (authKey: string, configDir: string) => string;
23
- }
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SDKClient = void 0;
4
- const base64 = require("base-64");
5
- const axios_1 = require("axios");
6
- const sdk_1 = require("@apimatic/sdk");
7
- const env_1 = require("../config/env");
8
- const auth_manager_1 = require("./auth-manager");
9
- class SDKClient {
10
- constructor() {
11
- this.setAuthKey = (authKey, configDir) => {
12
- auth_manager_1.setAuthInfo({
13
- email: "",
14
- authKey
15
- }, configDir);
16
- return "Authentication key successfully set";
17
- };
18
- }
19
- /**
20
- * The static method that controls the access to the SDKClient instance.
21
- *
22
- * This implementation let you subclass the SDKClient class while keeping
23
- * just one instance of each subclass around.
24
- */
25
- static getInstance() {
26
- if (!SDKClient.instance) {
27
- SDKClient.instance = new SDKClient();
28
- }
29
- return SDKClient.instance;
30
- }
31
- /**
32
- * Finally, any SDKClient should define some business logic, which can be
33
- * executed on its instance.
34
- */
35
- async login(email, password, configDir) {
36
- let storedAuthInfo = await auth_manager_1.getAuthInfo(configDir);
37
- // If no config file or no credentials exist in the config file
38
- if (!storedAuthInfo) {
39
- storedAuthInfo = { email: "", authKey: "" };
40
- }
41
- const credentials = { email, password };
42
- const authKey = await this.getAuthKey(credentials);
43
- if (storedAuthInfo.email !== email) {
44
- auth_manager_1.setAuthInfo({
45
- email,
46
- authKey
47
- }, configDir);
48
- return "Logged in";
49
- }
50
- else if (authKey === storedAuthInfo.authKey) {
51
- return "Already logged in";
52
- }
53
- else {
54
- auth_manager_1.setAuthInfo({
55
- email,
56
- authKey
57
- }, configDir);
58
- return "Logged in";
59
- }
60
- }
61
- async logout(configDir) {
62
- auth_manager_1.setAuthInfo({
63
- email: "",
64
- authKey: ""
65
- }, configDir);
66
- return "Logged out";
67
- }
68
- async status(configDir) {
69
- try {
70
- let storedAuthInfo = await auth_manager_1.getAuthInfo(configDir);
71
- if (!storedAuthInfo) {
72
- // If no config file or no credentials exist in the config file
73
- storedAuthInfo = { email: "", authKey: "" };
74
- }
75
- return storedAuthInfo.email === "" && storedAuthInfo.authKey === ""
76
- ? "Not logged in"
77
- : storedAuthInfo.email === "" && storedAuthInfo.authKey !== ""
78
- ? "Logged in with authentication key"
79
- : `Currently logged in as ${storedAuthInfo.email}`;
80
- }
81
- catch (error) {
82
- throw error;
83
- }
84
- }
85
- async getClient(overrideAuthKey, configDir) {
86
- if (overrideAuthKey) {
87
- return new sdk_1.Client({
88
- timeout: 0,
89
- authorization: `X-Auth-Key ${overrideAuthKey}`
90
- });
91
- }
92
- let storedAuthInfo = await auth_manager_1.getAuthInfo(configDir);
93
- if (!storedAuthInfo) {
94
- // If no config file or no credentials exist in the config file
95
- storedAuthInfo = { email: "", authKey: "" };
96
- }
97
- if (storedAuthInfo.authKey !== "") {
98
- return new sdk_1.Client({
99
- timeout: 0,
100
- authorization: `X-Auth-Key ${storedAuthInfo.authKey}`
101
- });
102
- }
103
- else {
104
- throw new Error("Please login first or provide an authKey");
105
- }
106
- }
107
- async getAuthKey(credentials) {
108
- const config = {
109
- headers: {
110
- Authorization: `Basic ${base64.encode(`${credentials.email}:${credentials.password}`)}`
111
- }
112
- };
113
- const response = await axios_1.default.get(SDKClient.authAPI, config);
114
- const authKey = response.data.EncryptedValue;
115
- return authKey;
116
- }
117
- }
118
- exports.SDKClient = SDKClient;
119
- SDKClient.authAPI = `${env_1.baseURL}/account/authkey`;
@@ -1 +0,0 @@
1
- export declare const baseURL = "https://apimaticio-test.azurewebsites.net/api";
package/lib/config/env.js DELETED
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.baseURL = void 0;
4
- exports.baseURL = "https://apimaticio-test.azurewebsites.net/api";
@@ -1,5 +0,0 @@
1
- import { DownloadTransformationParams, TransformationIdParams } from "../../types/api/transform";
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,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValidFormat = exports.downloadTransformationFile = exports.getTransformationId = void 0;
4
- const cli_ux_1 = require("cli-ux");
5
- const fs = require("fs-extra");
6
- const utils_1 = require("../../utils/utils");
7
- const sdk_1 = require("@apimatic/sdk");
8
- exports.getTransformationId = async ({ file, url, format }, transformationController) => {
9
- cli_ux_1.default.action.start("Transforming API specification");
10
- let generation;
11
- if (file) {
12
- const fileDescriptor = new sdk_1.FileWrapper(fs.createReadStream(file));
13
- generation = await transformationController.transformViaFile(fileDescriptor, format);
14
- }
15
- else if (url) {
16
- const body = {
17
- url: url,
18
- exportFormat: format
19
- };
20
- generation = await transformationController.transformViaURL(body);
21
- }
22
- else {
23
- throw new Error("Please provide a specification file");
24
- }
25
- cli_ux_1.default.action.stop();
26
- return generation.result;
27
- };
28
- exports.downloadTransformationFile = async ({ id, destinationFilePath, transformationController }) => {
29
- cli_ux_1.default.action.start("Downloading Transformed file");
30
- const { result } = await transformationController.downloadTransformedFile(id);
31
- if (result.readable) {
32
- await utils_1.writeFileUsingReadableStream(result, destinationFilePath);
33
- }
34
- else {
35
- throw new Error("Couldn't save transformation file");
36
- }
37
- cli_ux_1.default.action.stop();
38
- return destinationFilePath;
39
- };
40
- // Get valid platform from user's input, convert simple platform to valid Platforms enum value
41
- exports.getValidFormat = (format) => {
42
- if (Object.keys(sdk_1.ExportFormats).find((exportFormat) => exportFormat === format)) {
43
- return sdk_1.ExportFormats[format];
44
- }
45
- else {
46
- const formats = Object.keys(sdk_1.ExportFormats).join("|");
47
- throw new Error(`Please provide a valid platform i.e. ${formats}`);
48
- }
49
- };
@@ -1,3 +0,0 @@
1
- import { GetValidationParams } from "../../types/api/validate";
2
- import { APIValidationExternalApisController, ApiValidationSummary } from "@apimatic/sdk";
3
- export declare const getValidation: ({ file, url }: GetValidationParams, apiValidationController: APIValidationExternalApisController) => Promise<ApiValidationSummary>;
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getValidation = void 0;
4
- const cli_ux_1 = require("cli-ux");
5
- const fs = require("fs-extra");
6
- const core_1 = require("@apimatic/core");
7
- exports.getValidation = async ({ file, url }, apiValidationController) => {
8
- let validation;
9
- cli_ux_1.default.action.start("Validating specification file");
10
- if (file) {
11
- const fileDescriptor = new core_1.FileWrapper(fs.createReadStream(file));
12
- validation = await apiValidationController.validateAPIViaFile(fileDescriptor);
13
- }
14
- else if (url) {
15
- validation = await apiValidationController.validateAPIViaURL(url);
16
- }
17
- else {
18
- throw new Error("Please provide a specification file");
19
- }
20
- cli_ux_1.default.action.stop();
21
- return validation.result;
22
- };
@@ -1,2 +0,0 @@
1
- import { GeneratePortalParams } from "../../types/portal/generate";
2
- export declare const downloadDocsPortal: ({ zippedBuildFilePath, portalFolderPath, zippedPortalPath, overrideAuthKey, zip }: GeneratePortalParams, configDir: string) => Promise<string>;