@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
package/README.md CHANGED
@@ -24,7 +24,7 @@ $ npm install -g @apimatic/cli
24
24
  $ apimatic COMMAND
25
25
  running command...
26
26
  $ apimatic (--version)
27
- @apimatic/cli/1.1.0-alpha.19 win32-x64 node-v20.18.3
27
+ @apimatic/cli/1.1.0-alpha.22 win32-x64 node-v23.4.0
28
28
  $ apimatic --help [COMMAND]
29
29
  USAGE
30
30
  $ apimatic COMMAND
@@ -34,130 +34,137 @@ USAGE
34
34
 
35
35
  # Commands
36
36
  <!-- commands -->
37
- * [`apimatic api:transform`](#apimatic-apitransform)
38
- * [`apimatic api:validate`](#apimatic-apivalidate)
39
- * [`apimatic auth:login`](#apimatic-authlogin)
40
- * [`apimatic auth:logout`](#apimatic-authlogout)
41
- * [`apimatic auth:status`](#apimatic-authstatus)
37
+ * [`apimatic api transform`](#apimatic-api-transform)
38
+ * [`apimatic api validate`](#apimatic-api-validate)
39
+ * [`apimatic auth login`](#apimatic-auth-login)
40
+ * [`apimatic auth logout`](#apimatic-auth-logout)
41
+ * [`apimatic auth status`](#apimatic-auth-status)
42
42
  * [`apimatic autocomplete [SHELL]`](#apimatic-autocomplete-shell)
43
43
  * [`apimatic help [COMMAND]`](#apimatic-help-command)
44
- * [`apimatic portal:copilot`](#apimatic-portalcopilot)
45
- * [`apimatic portal:generate`](#apimatic-portalgenerate)
46
- * [`apimatic portal:quickstart`](#apimatic-portalquickstart)
47
- * [`apimatic portal:recipe:new`](#apimatic-portalrecipenew)
48
- * [`apimatic portal:serve`](#apimatic-portalserve)
49
- * [`apimatic portal:toc:new`](#apimatic-portaltocnew)
50
- * [`apimatic sdk:generate`](#apimatic-sdkgenerate)
44
+ * [`apimatic portal copilot`](#apimatic-portal-copilot)
45
+ * [`apimatic portal generate`](#apimatic-portal-generate)
46
+ * [`apimatic portal quickstart`](#apimatic-portal-quickstart)
47
+ * [`apimatic portal recipe new`](#apimatic-portal-recipe-new)
48
+ * [`apimatic portal serve`](#apimatic-portal-serve)
49
+ * [`apimatic portal toc new`](#apimatic-portal-toc-new)
50
+ * [`apimatic sdk generate`](#apimatic-sdk-generate)
51
51
 
52
- ## `apimatic api:transform`
52
+ ## `apimatic api transform`
53
53
 
54
- Transform API specifications from one format to another. Supports [10+ different formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman Collections.
54
+ Transform API specifications between different formats.
55
55
 
56
56
  ```
57
57
  USAGE
58
- $ apimatic api:transform --format <value> [--file <value>] [--url <value>] [-d <value>] [-f] [-k <value>]
58
+ $ apimatic api transform --format
59
+ apimatic|wadl2009|wsdl|swagger10|swagger20|swaggeryaml|oas3|openapi3yaml|apiblueprint|raml|raml10|postman10|postman2
60
+ 0|graphqlschema [--file <value>] [--url <value>] [-d <value>] [-f] [-k <value>]
59
61
 
60
62
  FLAGS
61
- -d, --destination=<value> [default: ./] directory to download transformed file to
63
+ -d, --destination=<value> [default: ./] directory to save the transformed file to
62
64
  -f, --force overwrite changes without asking for user consent.
63
65
  -k, --auth-key=<value> override current authentication state with an authentication key.
64
66
  --file=<value> path to the API specification file to transform
65
- --format=<value> (required) specification format to transform API specification into
66
- APIMATIC|WADL2009|WSDL|SWAGGER10|SWAGGER20|SWAGGERYAML|OAS3|OPENAPI3YAML|APIBLUEPRINT|RAML|
67
- RAML10|POSTMAN10|POSTMAN20|GRAPHQLSCHEMA
68
- --url=<value> URL to the API specification file to transform. Can be used in place of the --file option
69
- if the API specification is publicly available.
67
+ --format=<option> (required) specification format to transform API specification into
68
+ <options: apimatic|wadl2009|wsdl|swagger10|swagger20|swaggeryaml|oas3|openapi3yaml|apibluep
69
+ rint|raml|raml10|postman10|postman20|graphqlschema>
70
+ --url=<value> URL to the API specification file to transform (publicly accessible)
70
71
 
71
72
  DESCRIPTION
72
- Transform API specifications from one format to another. Supports [10+ different
73
- formats](https://www.apimatic.io/transformer/#supported-formats) including OpenApi/Swagger, RAML, WSDL and Postman
74
- Collections.
73
+ Transform API specifications between different formats.
74
+
75
+ Transform API specifications from one format to another.
76
+ Supports multiple formats including OpenAPI/Swagger, RAML, WSDL, and Postman Collections.
75
77
 
76
78
  EXAMPLES
77
- $ apimatic api:transform --format="OpenApi3Json" --file="./specs/sample.json" --destination="D:/"
79
+ apimatic api transform --format=OPENAPI3YAML --file=./specs/sample.json --destination=./
78
80
 
79
- $ apimatic api:transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination="D:/"
81
+ apimatic api transform --format=RAML --url="https://petstore.swagger.io/v2/swagger.json" --destination=./
80
82
  ```
81
83
 
82
84
  _See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/transform.ts)_
83
85
 
84
- ## `apimatic api:validate`
86
+ ## `apimatic api validate`
85
87
 
86
- Validate the syntactic and semantic correctness of an API specification
88
+ Validate API specification for syntactic and semantic correctness.
87
89
 
88
90
  ```
89
91
  USAGE
90
- $ apimatic api:validate [--file <value>] [--url <value>] [-k <value>]
92
+ $ apimatic api validate [--file <value>] [--url <value>] [-k <value>]
91
93
 
92
94
  FLAGS
93
95
  -k, --auth-key=<value> override current authentication state with an authentication key.
94
96
  --file=<value> Path to the API specification file to validate
95
- --url=<value> URL to the specification file to validate. Can be used in place of the --file option if the
96
- API specification is publicly available.
97
+ --url=<value> URL to the API specification file to validate (publicly accessible)
97
98
 
98
99
  DESCRIPTION
99
- Validate the syntactic and semantic correctness of an API specification
100
+ Validate API specification for syntactic and semantic correctness.
101
+
102
+ Validate your API specification to ensure it adheres to syntactic and semantic standards.
100
103
 
101
104
  EXAMPLES
102
- $ apimatic api:validate --file="./specs/sample.json"
105
+ apimatic api validate --file=./specs/sample.json
103
106
 
104
- $ apimatic api:validate --url=https://petstore.swagger.io/v2/swagger.json
107
+ apimatic api validate --url="https://petstore.swagger.io/v2/swagger.json"
105
108
  ```
106
109
 
107
110
  _See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/api/validate.ts)_
108
111
 
109
- ## `apimatic auth:login`
112
+ ## `apimatic auth login`
110
113
 
111
- Login using your APIMatic credentials or an API Key
114
+ Login to your APIMatic account.
112
115
 
113
116
  ```
114
117
  USAGE
115
- $ apimatic auth:login [-k <value>]
118
+ $ apimatic auth login [-k <value>]
116
119
 
117
120
  FLAGS
118
121
  -k, --auth-key=<value> Sets authentication key for all commands.
119
122
 
120
123
  DESCRIPTION
124
+ Login to your APIMatic account.
125
+
121
126
  Login using your APIMatic credentials or an API Key
122
127
 
123
128
  EXAMPLES
124
- $ apimatic auth:login
129
+ apimatic auth login
125
130
 
126
- $ apimatic auth:login --auth-key={api-key}
131
+ apimatic auth login --auth-key={api-key}
127
132
  ```
128
133
 
129
134
  _See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/login.ts)_
130
135
 
131
- ## `apimatic auth:logout`
136
+ ## `apimatic auth logout`
132
137
 
133
138
  Clears the local login credentials.
134
139
 
135
140
  ```
136
141
  USAGE
137
- $ apimatic auth:logout
142
+ $ apimatic auth logout
138
143
 
139
144
  DESCRIPTION
140
145
  Clears the local login credentials.
141
146
 
147
+ Clears the local login credentials. This will also clear any cached credentials from the CLI.
148
+
142
149
  EXAMPLES
143
- $ apimatic auth:logout
150
+ apimatic auth logout
144
151
  ```
145
152
 
146
153
  _See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/logout.ts)_
147
154
 
148
- ## `apimatic auth:status`
155
+ ## `apimatic auth status`
149
156
 
150
157
  View the currently logged in user.
151
158
 
152
159
  ```
153
160
  USAGE
154
- $ apimatic auth:status
161
+ $ apimatic auth status
155
162
 
156
163
  DESCRIPTION
157
164
  View the currently logged in user.
158
165
 
159
166
  EXAMPLES
160
- $ apimatic auth:status
167
+ apimatic auth status
161
168
  ```
162
169
 
163
170
  _See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/auth/status.ts)_
@@ -171,7 +178,7 @@ USAGE
171
178
  $ apimatic autocomplete [SHELL] [-r]
172
179
 
173
180
  ARGUMENTS
174
- SHELL shell type
181
+ SHELL (zsh|bash|powershell) Shell type
175
182
 
176
183
  FLAGS
177
184
  -r, --refresh-cache Refresh cache (ignores displaying instructions)
@@ -181,8 +188,13 @@ DESCRIPTION
181
188
 
182
189
  EXAMPLES
183
190
  $ apimatic autocomplete
191
+
184
192
  $ apimatic autocomplete bash
193
+
185
194
  $ apimatic autocomplete zsh
195
+
196
+ $ apimatic autocomplete powershell
197
+
186
198
  $ apimatic autocomplete --refresh-cache
187
199
  ```
188
200
 
@@ -208,15 +220,16 @@ DESCRIPTION
208
220
 
209
221
  _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
210
222
 
211
- ## `apimatic portal:copilot`
223
+ ## `apimatic portal copilot`
212
224
 
213
225
  Configure API Copilot for your API Documentation portal
214
226
 
215
227
  ```
216
228
  USAGE
217
- $ apimatic portal:copilot [-i <value>] [--disable] [-k <value>]
229
+ $ apimatic portal copilot [-i <value>] [--disable] [-f] [-k <value>]
218
230
 
219
231
  FLAGS
232
+ -f, --force overwrite changes without asking for user consent.
220
233
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
221
234
  specifications and configuration files.
222
235
  -k, --auth-key=<value> override current authentication state with an authentication key.
@@ -227,23 +240,23 @@ DESCRIPTION
227
240
 
228
241
  Displays available API Copilots associated with your account and allows you to select which one to integrate with your
229
242
  portal. Each APIMatic account includes one Copilot by default. The selected Copilot will be added to your
230
- APIMATIC-BUILD.json file
243
+ 'APIMATIC-BUILD.json' file
231
244
 
232
245
  EXAMPLES
233
- $ apimatic portal:copilot --input="./"
246
+ apimatic portal copilot --input=./
234
247
 
235
- $ apimatic portal:copilot --input="./" --disable
248
+ apimatic portal copilot --input=./ --disable
236
249
  ```
237
250
 
238
251
  _See code: [src/commands/portal/copilot.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/copilot.ts)_
239
252
 
240
- ## `apimatic portal:generate`
253
+ ## `apimatic portal generate`
241
254
 
242
- Generate an API Documentation portal. Requires an input directory containing API specifications, a config file and optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/build-file-reference)
255
+ Generate an API Documentation portal.
243
256
 
244
257
  ```
245
258
  USAGE
246
- $ apimatic portal:generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
259
+ $ apimatic portal generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
247
260
 
248
261
  FLAGS
249
262
  -d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
@@ -254,100 +267,110 @@ FLAGS
254
267
  --zip download the generated portal as a .zip archive
255
268
 
256
269
  DESCRIPTION
270
+ Generate an API Documentation portal.
271
+
257
272
  Generate an API Documentation portal. Requires an input directory containing API specifications, a config file and
258
273
  optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/gu
259
274
  ides/generating-on-prem-api-portal/build-file-reference)
260
275
 
261
276
  EXAMPLES
262
- $ apimatic portal:generate
277
+ apimatic portal generate
263
278
 
264
- $ apimatic portal:generate --input="./" --destination="./portal"
279
+ apimatic portal generate --input="./" --destination="./portal"
265
280
  ```
266
281
 
267
282
  _See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
268
283
 
269
- ## `apimatic portal:quickstart`
284
+ ## `apimatic portal quickstart`
270
285
 
271
- Create your first API Portal using APIMatic's Docs as Code offering.
286
+ Get started with your first API Portal in four easy steps.
272
287
 
273
288
  ```
274
289
  USAGE
275
- $ apimatic portal:quickstart
290
+ $ apimatic portal quickstart
276
291
 
277
292
  DESCRIPTION
293
+ Get started with your first API Portal in four easy steps.
294
+
278
295
  Create your first API Portal using APIMatic's Docs as Code offering.
279
296
 
280
297
  EXAMPLES
281
- $ apimatic portal:quickstart
298
+ apimatic portal quickstart
282
299
  ```
283
300
 
284
301
  _See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/quickstart.ts)_
285
302
 
286
- ## `apimatic portal:recipe:new`
303
+ ## `apimatic portal recipe new`
287
304
 
288
- Add an API Recipe to your API Documentation portal.
305
+ Add an API Recipe to your API documentation portal.
289
306
 
290
307
  ```
291
308
  USAGE
292
- $ apimatic portal:recipe:new [--name <value>] [-i <value>]
309
+ $ apimatic portal recipe new [--name <value>] [-i <value>] [-f]
293
310
 
294
311
  FLAGS
312
+ -f, --force overwrite changes without asking for user consent.
295
313
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
296
314
  specifications and configuration files.
297
315
  --name=<value> name for the recipe
298
316
 
299
317
  DESCRIPTION
300
- Add an API Recipe to your API Documentation portal.
318
+ Add an API Recipe to your API documentation portal.
319
+
320
+ This command adds a new API Recipe file to your documentation portal.
301
321
 
302
322
  To learn more about API Recipes, visit:
303
323
  https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
304
324
 
305
325
  EXAMPLES
306
- $ apimatic portal:recipe:new
326
+ apimatic portal recipe new
307
327
 
308
- $ apimatic portal:recipe:new --name="My API Recipe" --input="./"
328
+ apimatic portal recipe new --name="My API Recipe" --input="./"
309
329
  ```
310
330
 
311
331
  _See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
312
332
 
313
- ## `apimatic portal:serve`
333
+ ## `apimatic portal serve`
314
334
 
315
- Generate and deploy a Docs as Code portal with hot reload.
335
+ Generate and serve an API Documentation Portal with hot reload.
316
336
 
317
337
  ```
318
338
  USAGE
319
- $ apimatic portal:serve [-p <value>] [-i <value>] [-d <value>] [-o] [--no-reload] [-k <value>]
339
+ $ apimatic portal serve [-p 3000] [-i <value>] [-d <value>] [-o] [--no-reload] [-k <value>]
320
340
 
321
341
  FLAGS
322
342
  -d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
323
343
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
324
344
  API specifications and configuration files.
325
345
  -k, --auth-key=<value> override current authentication state with an authentication key.
326
- -o, --open Open the portal in the default browser.
327
- -p, --port=<value> [default: 3000] port to serve the portal.
328
- --no-reload Disable hot reload.
346
+ -o, --open open the portal in the default browser.
347
+ -p, --port=3000 [default: 3000] port to serve the portal.
348
+ --no-reload disable hot reload.
329
349
 
330
350
  DESCRIPTION
331
- Generate and deploy a Docs as Code portal with hot reload.
351
+ Generate and serve an API Documentation Portal with hot reload.
352
+
353
+ Requires an input directory with API specifications, a config file, and optionally markdown guides. Supports disabling
354
+ hot reload and opening the portal in the default browser.
332
355
 
333
356
  EXAMPLES
334
- $ apimatic portal:serve
357
+ apimatic portal serve
335
358
 
336
- $ apimatic portal:serve --input="./" --destination="./portal" --port=3000 --open --no-reload
359
+ apimatic portal serve --input=./ --destination=./portal --port=3000 --open --no-reload
337
360
  ```
338
361
 
339
362
  _See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
340
363
 
341
- ## `apimatic portal:toc:new`
364
+ ## `apimatic portal toc new`
342
365
 
343
366
  Generate a Table of Contents (TOC) file for your API documentation portal
344
367
 
345
368
  ```
346
369
  USAGE
347
- $ apimatic portal:toc:new [-d <value>] [-i <value>] [-f] [--expand-endpoints] [--expand-models]
370
+ $ apimatic portal toc new [-d <value>] [-i <value>] [-f] [--expand-endpoints] [--expand-models]
348
371
 
349
372
  FLAGS
350
- -d, --destination=<value> [default: <input>/src/content] path where the 'toc.yml' will be generated.
373
+ -d, --destination=<value> [default: <input>/src/content] path where the toc.yml will be generated.
351
374
  -f, --force overwrite changes without asking for user consent.
352
375
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
353
376
  API specifications and configuration files.
@@ -368,41 +391,46 @@ DESCRIPTION
368
391
  https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal
369
392
 
370
393
  EXAMPLES
371
- $ apimatic portal:toc:new --destination="./src/content/"
394
+ apimatic portal toc new --destination=./src/content/
372
395
 
373
- $ apimatic portal:toc:new --input="./"
396
+ apimatic portal toc new --input=./
374
397
 
375
- $ apimatic portal:toc:new --input="./" --destination="./src/content/"
398
+ apimatic portal toc new --input=./ --destination=./src/content/
376
399
  ```
377
400
 
378
401
  _See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
379
402
 
380
- ## `apimatic sdk:generate`
403
+ ## `apimatic sdk generate`
381
404
 
382
405
  Generate an SDK for your API
383
406
 
384
407
  ```
385
408
  USAGE
386
- $ apimatic sdk:generate --platform csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f]
387
- [--zip] [-k <value>]
409
+ $ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f] [--zip]
410
+ [-k <value>]
388
411
 
389
412
  FLAGS
390
- -d, --destination=<value> [default: ./sdk/<platform>] path where the sdk will be generated.
413
+ -d, --destination=<value> directory where the SDK will be generated
391
414
  -f, --force overwrite changes without asking for user consent.
392
415
  -k, --auth-key=<value> override current authentication state with an authentication key.
393
- --platform=<option> (required) language platform for sdk
416
+ -l, --language=<option> (required) programming language for SDK generation
394
417
  <options: csharp|java|php|python|ruby|typescript|go>
395
- --spec=<value> [default: ./src/spec] path to the folder containing the API specification file.
418
+ --spec=<value> [default: ./src/spec] path to the folder containing the API specification file
396
419
  --zip download the generated SDK as a .zip archive
397
420
 
398
421
  DESCRIPTION
399
422
  Generate an SDK for your API
400
423
 
424
+ Generate Software Development Kits (SDKs) from API specifications.
425
+ Supports multiple programming languages including Java, C#, Python, JavaScript, and more.
426
+
401
427
  EXAMPLES
402
- $ apimatic sdk:generate --platform="java"
428
+ apimatic sdk generate --language=java
429
+
430
+ apimatic sdk generate --language=csharp --spec=./src/spec
403
431
 
404
- $ apimatic sdk:generate --platform="csharp" --spec="./src/spec"
432
+ apimatic sdk generate --language=python --destination=./sdk --zip
405
433
  ```
406
434
 
407
- _See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/sdk/generate.ts)_
435
+ _See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.1.0-alpha.21/src/commands/sdk/generate.ts)_
408
436
  <!-- commandsstop -->
@@ -1,8 +1,13 @@
1
1
  export declare class ActionResult {
2
2
  private readonly message;
3
+ private readonly resultType;
3
4
  private constructor();
4
- static error(message: string): ActionResult;
5
5
  static success(): ActionResult;
6
- map(onError: (message: string) => void): void;
7
- mapAll<T>(onSuccess: () => T, onError: (message: string) => T): T;
6
+ static failed(): ActionResult;
7
+ static cancelled(): ActionResult;
8
+ static stopped(): ActionResult;
9
+ getMessage(): string;
10
+ getExitCode(): number;
11
+ isFailed(): boolean;
12
+ mapAll<T>(onSuccess: () => T, onFailure: () => T, onCancel: () => T): T;
8
13
  }
@@ -1,24 +1,43 @@
1
+ var ResultType;
2
+ (function (ResultType) {
3
+ ResultType[ResultType["Success"] = 0] = "Success";
4
+ ResultType[ResultType["Cancel"] = 130] = "Cancel";
5
+ ResultType[ResultType["Failure"] = 1] = "Failure";
6
+ })(ResultType || (ResultType = {}));
1
7
  export class ActionResult {
2
- constructor(message) {
8
+ constructor(resultType, message) {
9
+ this.resultType = resultType;
3
10
  this.message = message;
4
11
  }
5
- static error(message) {
6
- return new ActionResult(message);
7
- }
8
12
  static success() {
9
- return new ActionResult();
13
+ return new ActionResult(ResultType.Success, " Succeeded ");
10
14
  }
11
- map(onError) {
12
- if (this.message) {
13
- onError(this.message);
14
- }
15
+ static failed() {
16
+ return new ActionResult(ResultType.Failure, " Failed ");
15
17
  }
16
- mapAll(onSuccess, onError) {
17
- if (this.message) {
18
- return onError(this.message);
19
- }
20
- else {
21
- return onSuccess();
18
+ static cancelled() {
19
+ return new ActionResult(ResultType.Cancel, " Cancelled ");
20
+ }
21
+ static stopped() {
22
+ return new ActionResult(ResultType.Cancel, " Stopped ");
23
+ }
24
+ getMessage() {
25
+ return this.message;
26
+ }
27
+ getExitCode() {
28
+ return this.resultType.valueOf();
29
+ }
30
+ isFailed() {
31
+ return this.resultType === ResultType.Failure;
32
+ }
33
+ mapAll(onSuccess, onFailure, onCancel) {
34
+ switch (this.resultType) {
35
+ case ResultType.Success:
36
+ return onSuccess();
37
+ case ResultType.Failure:
38
+ return onFailure();
39
+ case ResultType.Cancel:
40
+ return onCancel();
22
41
  }
23
42
  }
24
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAY;IAGvB,YAAoB,OAAgB;QAClC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,OAAe;QAC1B,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,EAAE,CAAC;IAC5B,CAAC;IAED,GAAG,CAAC,OAAkC;QACpC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,MAAM,CAAI,SAAiB,EAAE,OAA+B;QAC1D,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;aAAK,CAAC;YACL,OAAO,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,IAAK,UAIJ;AAJD,WAAK,UAAU;IACb,iDAAU,CAAA;IACV,iDAAY,CAAA;IACZ,iDAAU,CAAA;AACZ,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,OAAO,YAAY;IAIvB,YAAoB,UAAsB,EAAE,OAAe;QACzD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,MAAM;QACX,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,SAAS;QACd,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,OAAO;QACZ,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAC1D,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,UAAU,KAAK,UAAU,CAAC,OAAO,CAAC;IAChD,CAAC;IAEM,MAAM,CAAI,SAAkB,EAAE,SAAkB,EAAE,QAAiB;QACxE,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,EAAE,CAAC;YACrB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,EAAE,CAAC;YACrB,KAAK,UAAU,CAAC,MAAM;gBACpB,OAAO,QAAQ,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ import { ExportFormats } from "@apimatic/sdk";
4
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
5
+ import { ResourceInput } from "../../types/file/resource-input.js";
6
+ export declare class TransformAction {
7
+ private readonly prompts;
8
+ private readonly validatePrompts;
9
+ private readonly transformationService;
10
+ private readonly configDir;
11
+ private readonly commandMetadata;
12
+ private readonly authKey;
13
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
14
+ readonly execute: (resourcePath: ResourceInput, format: ExportFormats, destination: DirectoryPath, force: boolean) => Promise<ActionResult>;
15
+ }
@@ -0,0 +1,48 @@
1
+ import { ActionResult } from "../action-result.js";
2
+ import { ApiTransformPrompts } from "../../prompts/api/transform.js";
3
+ import { withDirPath } from "../../infrastructure/tmp-extensions.js";
4
+ import { TransformationService } from "../../infrastructure/services/transformation-service.js";
5
+ import { ApiValidatePrompts } from "../../prompts/api/validate.js";
6
+ import { TransformContext } from "../../types/transform-context.js";
7
+ import { ResourceContext } from "../../types/resource-context.js";
8
+ export class TransformAction {
9
+ constructor(configDir, commandMetadata, authKey = null) {
10
+ this.prompts = new ApiTransformPrompts();
11
+ this.validatePrompts = new ApiValidatePrompts();
12
+ this.transformationService = new TransformationService();
13
+ this.execute = async (resourcePath, format, destination, force) => {
14
+ return await withDirPath(async (tempDirectory) => {
15
+ const resourceContext = new ResourceContext(tempDirectory);
16
+ const specFileDirResult = await resourceContext.resolveTo(resourcePath);
17
+ if (specFileDirResult.isErr()) {
18
+ this.prompts.networkError(specFileDirResult.error);
19
+ return ActionResult.failed();
20
+ }
21
+ const transformContext = new TransformContext(specFileDirResult.value, format, destination);
22
+ if (!force && (await transformContext.exists()) && !(await this.prompts.overwriteApi(destination))) {
23
+ this.prompts.transformedApiAlreadyExists();
24
+ return ActionResult.cancelled();
25
+ }
26
+ const result = await this.prompts.transformApi(this.transformationService.transformViaFile({
27
+ file: specFileDirResult.value,
28
+ format: format,
29
+ configDir: this.configDir,
30
+ commandMetadata: this.commandMetadata,
31
+ authKey: this.authKey
32
+ }));
33
+ if (result.isErr()) {
34
+ this.prompts.logTransformationError(result.error);
35
+ return ActionResult.failed();
36
+ }
37
+ const transformedFilePath = await transformContext.save(result.value.stream);
38
+ this.validatePrompts.displayValidationMessages(result.value.apiValidationSummary);
39
+ this.validatePrompts.transformedApiSaved(transformedFilePath);
40
+ return ActionResult.success();
41
+ });
42
+ };
43
+ this.configDir = configDir;
44
+ this.commandMetadata = commandMetadata;
45
+ this.authKey = authKey;
46
+ }
47
+ }
48
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/actions/api/transform.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,12 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
4
+ import { ResourceInput } from "../../types/file/resource-input.js";
5
+ export declare class ValidateAction {
6
+ private readonly prompts;
7
+ private readonly validationService;
8
+ private readonly authKey;
9
+ private readonly commandMetadata;
10
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
11
+ readonly execute: (resourcePath: ResourceInput, displayValidationSummary?: boolean) => Promise<ActionResult>;
12
+ }