@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
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.21 win32-x64 node-v23.4.0
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=OPENAPI3YAML --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)_
@@ -213,13 +220,13 @@ DESCRIPTION
213
220
 
214
221
  _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/main/src/commands/help.ts)_
215
222
 
216
- ## `apimatic portal:copilot`
223
+ ## `apimatic portal copilot`
217
224
 
218
225
  Configure API Copilot for your API Documentation portal
219
226
 
220
227
  ```
221
228
  USAGE
222
- $ apimatic portal:copilot [-i <value>] [--disable] [-f] [-k <value>]
229
+ $ apimatic portal copilot [-i <value>] [--disable] [-f] [-k <value>]
223
230
 
224
231
  FLAGS
225
232
  -f, --force overwrite changes without asking for user consent.
@@ -233,23 +240,23 @@ DESCRIPTION
233
240
 
234
241
  Displays available API Copilots associated with your account and allows you to select which one to integrate with your
235
242
  portal. Each APIMatic account includes one Copilot by default. The selected Copilot will be added to your
236
- APIMATIC-BUILD.json file
243
+ 'APIMATIC-BUILD.json' file
237
244
 
238
245
  EXAMPLES
239
- $ apimatic portal:copilot --input="./"
246
+ apimatic portal copilot --input=./
240
247
 
241
- $ apimatic portal:copilot --input="./" --disable
248
+ apimatic portal copilot --input=./ --disable
242
249
  ```
243
250
 
244
251
  _See code: [src/commands/portal/copilot.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/copilot.ts)_
245
252
 
246
- ## `apimatic portal:generate`
253
+ ## `apimatic portal generate`
247
254
 
248
- 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.
249
256
 
250
257
  ```
251
258
  USAGE
252
- $ apimatic portal:generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
259
+ $ apimatic portal generate [-i <value>] [-d <value>] [-f] [--zip] [-k <value>]
253
260
 
254
261
  FLAGS
255
262
  -d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
@@ -260,100 +267,110 @@ FLAGS
260
267
  --zip download the generated portal as a .zip archive
261
268
 
262
269
  DESCRIPTION
270
+ Generate an API Documentation portal.
271
+
263
272
  Generate an API Documentation portal. Requires an input directory containing API specifications, a config file and
264
273
  optionally, markdown guides. For details, refer to the [documentation](https://docs.apimatic.io/platform-api/#/http/gu
265
274
  ides/generating-on-prem-api-portal/build-file-reference)
266
275
 
267
276
  EXAMPLES
268
- $ apimatic portal:generate
277
+ apimatic portal generate
269
278
 
270
- $ apimatic portal:generate --input="./" --destination="./portal"
279
+ apimatic portal generate --input="./" --destination="./portal"
271
280
  ```
272
281
 
273
282
  _See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/generate.ts)_
274
283
 
275
- ## `apimatic portal:quickstart`
284
+ ## `apimatic portal quickstart`
276
285
 
277
- Create your first API Portal using APIMatic's Docs as Code offering.
286
+ Get started with your first API Portal in four easy steps.
278
287
 
279
288
  ```
280
289
  USAGE
281
- $ apimatic portal:quickstart
290
+ $ apimatic portal quickstart
282
291
 
283
292
  DESCRIPTION
293
+ Get started with your first API Portal in four easy steps.
294
+
284
295
  Create your first API Portal using APIMatic's Docs as Code offering.
285
296
 
286
297
  EXAMPLES
287
- $ apimatic portal:quickstart
298
+ apimatic portal quickstart
288
299
  ```
289
300
 
290
301
  _See code: [src/commands/portal/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/quickstart.ts)_
291
302
 
292
- ## `apimatic portal:recipe:new`
303
+ ## `apimatic portal recipe new`
293
304
 
294
- Add an API Recipe to your API Documentation portal.
305
+ Add an API Recipe to your API documentation portal.
295
306
 
296
307
  ```
297
308
  USAGE
298
- $ apimatic portal:recipe:new [--name <value>] [-i <value>]
309
+ $ apimatic portal recipe new [--name <value>] [-i <value>] [-f]
299
310
 
300
311
  FLAGS
312
+ -f, --force overwrite changes without asking for user consent.
301
313
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes API
302
314
  specifications and configuration files.
303
315
  --name=<value> name for the recipe
304
316
 
305
317
  DESCRIPTION
306
- 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.
307
321
 
308
322
  To learn more about API Recipes, visit:
309
323
  https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/api-recipes
310
324
 
311
325
  EXAMPLES
312
- $ apimatic portal:recipe:new
326
+ apimatic portal recipe new
313
327
 
314
- $ apimatic portal:recipe:new --name="My API Recipe" --input="./"
328
+ apimatic portal recipe new --name="My API Recipe" --input="./"
315
329
  ```
316
330
 
317
331
  _See code: [src/commands/portal/recipe/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/recipe/new.ts)_
318
332
 
319
- ## `apimatic portal:serve`
333
+ ## `apimatic portal serve`
320
334
 
321
- Generate and deploy a Docs as Code portal with hot reload.
335
+ Generate and serve an API Documentation Portal with hot reload.
322
336
 
323
337
  ```
324
338
  USAGE
325
- $ 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>]
326
340
 
327
341
  FLAGS
328
342
  -d, --destination=<value> [default: <input>/portal] path where the portal will be generated.
329
343
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
330
344
  API specifications and configuration files.
331
345
  -k, --auth-key=<value> override current authentication state with an authentication key.
332
- -o, --open Open the portal in the default browser.
333
- -p, --port=<value> [default: 3000] port to serve the portal.
334
- --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.
335
349
 
336
350
  DESCRIPTION
337
- 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.
338
355
 
339
356
  EXAMPLES
340
- $ apimatic portal:serve
357
+ apimatic portal serve
341
358
 
342
- $ apimatic portal:serve --input="./" --destination="./portal" --port=3000 --open --no-reload
359
+ apimatic portal serve --input=./ --destination=./portal --port=3000 --open --no-reload
343
360
  ```
344
361
 
345
362
  _See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/serve.ts)_
346
363
 
347
- ## `apimatic portal:toc:new`
364
+ ## `apimatic portal toc new`
348
365
 
349
366
  Generate a Table of Contents (TOC) file for your API documentation portal
350
367
 
351
368
  ```
352
369
  USAGE
353
- $ 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]
354
371
 
355
372
  FLAGS
356
- -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.
357
374
  -f, --force overwrite changes without asking for user consent.
358
375
  -i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which includes
359
376
  API specifications and configuration files.
@@ -374,41 +391,46 @@ DESCRIPTION
374
391
  https://docs.apimatic.io/platform-api/#/http/guides/generating-on-prem-api-portal/overview-generating-api-portal
375
392
 
376
393
  EXAMPLES
377
- $ apimatic portal:toc:new --destination="./src/content/"
394
+ apimatic portal toc new --destination=./src/content/
378
395
 
379
- $ apimatic portal:toc:new --input="./"
396
+ apimatic portal toc new --input=./
380
397
 
381
- $ apimatic portal:toc:new --input="./" --destination="./src/content/"
398
+ apimatic portal toc new --input=./ --destination=./src/content/
382
399
  ```
383
400
 
384
401
  _See code: [src/commands/portal/toc/new.ts](https://github.com/apimatic/apimatic-cli/blob/alpha/src/commands/portal/toc/new.ts)_
385
402
 
386
- ## `apimatic sdk:generate`
403
+ ## `apimatic sdk generate`
387
404
 
388
405
  Generate an SDK for your API
389
406
 
390
407
  ```
391
408
  USAGE
392
- $ apimatic sdk:generate --platform csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f]
393
- [--zip] [-k <value>]
409
+ $ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [--spec <value>] [-d <value>] [-f] [--zip]
410
+ [-k <value>]
394
411
 
395
412
  FLAGS
396
- -d, --destination=<value> [default: ./sdk/<platform>] path where the sdk will be generated.
413
+ -d, --destination=<value> directory where the SDK will be generated
397
414
  -f, --force overwrite changes without asking for user consent.
398
415
  -k, --auth-key=<value> override current authentication state with an authentication key.
399
- --platform=<option> (required) language platform for sdk
416
+ -l, --language=<option> (required) programming language for SDK generation
400
417
  <options: csharp|java|php|python|ruby|typescript|go>
401
- --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
402
419
  --zip download the generated SDK as a .zip archive
403
420
 
404
421
  DESCRIPTION
405
422
  Generate an SDK for your API
406
423
 
424
+ Generate Software Development Kits (SDKs) from API specifications.
425
+ Supports multiple programming languages including Java, C#, Python, JavaScript, and more.
426
+
407
427
  EXAMPLES
408
- $ apimatic sdk:generate --platform=java
428
+ apimatic sdk generate --language=java
429
+
430
+ apimatic sdk generate --language=csharp --spec=./src/spec
409
431
 
410
- $ apimatic sdk:generate --platform=csharp --spec="./src/spec"
432
+ apimatic sdk generate --language=python --destination=./sdk --zip
411
433
  ```
412
434
 
413
- _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)_
414
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
+ }
@@ -0,0 +1,41 @@
1
+ import { ActionResult } from "../action-result.js";
2
+ import { ApiValidatePrompts } from "../../prompts/api/validate.js";
3
+ import { ValidationService } from "../../infrastructure/services/validation-service.js";
4
+ import { withDirPath } from "../../infrastructure/tmp-extensions.js";
5
+ import { ResourceContext } from "../../types/resource-context.js";
6
+ export class ValidateAction {
7
+ constructor(configDir, commandMetadata, authKey = null) {
8
+ this.prompts = new ApiValidatePrompts();
9
+ this.execute = async (resourcePath, displayValidationSummary = true) => {
10
+ return await withDirPath(async (tempDirectory) => {
11
+ const resourceContext = new ResourceContext(tempDirectory);
12
+ const specFileDirResult = await resourceContext.resolveTo(resourcePath);
13
+ if (specFileDirResult.isErr()) {
14
+ this.prompts.networkError(specFileDirResult.error);
15
+ return ActionResult.failed();
16
+ }
17
+ const validationSummaryResult = await this.prompts.validateApi(this.validationService.validateViaFile({
18
+ file: specFileDirResult.value,
19
+ commandMetadata: this.commandMetadata,
20
+ authKey: this.authKey
21
+ }));
22
+ if (validationSummaryResult.isErr()) {
23
+ this.prompts.logValidationError(validationSummaryResult.error);
24
+ return ActionResult.failed();
25
+ }
26
+ const validationSummary = validationSummaryResult.value;
27
+ if (displayValidationSummary) {
28
+ this.prompts.displayValidationMessages(validationSummary);
29
+ }
30
+ if (!validationSummary.success) {
31
+ return ActionResult.failed();
32
+ }
33
+ return ActionResult.success();
34
+ });
35
+ };
36
+ this.authKey = authKey;
37
+ this.validationService = new ValidationService(configDir);
38
+ this.commandMetadata = commandMetadata;
39
+ }
40
+ }
41
+ //# sourceMappingURL=validate.js.map