@apimatic/cli 1.1.0-alpha.9 → 1.1.0-beta.10

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 (341) hide show
  1. package/README.md +443 -374
  2. package/bin/run.js +5 -0
  3. package/lib/actions/action-result.d.ts +19 -0
  4. package/lib/actions/action-result.js +70 -0
  5. package/lib/actions/action-result.js.map +1 -0
  6. package/lib/actions/api/transform.d.ts +15 -0
  7. package/lib/actions/api/transform.js +48 -0
  8. package/lib/actions/api/transform.js.map +1 -0
  9. package/lib/actions/api/validate.d.ts +14 -0
  10. package/lib/actions/api/validate.js +52 -0
  11. package/lib/actions/api/validate.js.map +1 -0
  12. package/lib/actions/auth/login.d.ts +13 -0
  13. package/lib/actions/auth/login.js +55 -0
  14. package/lib/actions/auth/login.js.map +1 -0
  15. package/lib/actions/auth/logout.d.ts +8 -0
  16. package/lib/actions/auth/logout.js +15 -0
  17. package/lib/actions/auth/logout.js.map +1 -0
  18. package/lib/actions/auth/status.d.ts +11 -0
  19. package/lib/actions/auth/status.js +26 -0
  20. package/lib/actions/auth/status.js.map +1 -0
  21. package/lib/actions/portal/copilot.d.ts +16 -0
  22. package/lib/actions/portal/copilot.js +89 -0
  23. package/lib/actions/portal/copilot.js.map +1 -0
  24. package/lib/actions/portal/generate.d.ts +11 -5
  25. package/lib/actions/portal/generate.js +60 -55
  26. package/lib/actions/portal/generate.js.map +1 -0
  27. package/lib/actions/portal/quickstart.d.ts +17 -0
  28. package/lib/actions/portal/quickstart.js +169 -0
  29. package/lib/actions/portal/quickstart.js.map +1 -0
  30. package/lib/actions/portal/recipe/new-recipe.d.ts +15 -0
  31. package/lib/actions/portal/recipe/new-recipe.js +177 -0
  32. package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
  33. package/lib/actions/portal/serve.d.ts +15 -0
  34. package/lib/actions/portal/serve.js +104 -0
  35. package/lib/actions/portal/serve.js.map +1 -0
  36. package/lib/actions/portal/toc/new-toc.d.ts +17 -13
  37. package/lib/actions/portal/toc/new-toc.js +85 -123
  38. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  39. package/lib/actions/quickstart.d.ts +10 -0
  40. package/lib/actions/quickstart.js +30 -0
  41. package/lib/actions/quickstart.js.map +1 -0
  42. package/lib/actions/sdk/generate.d.ts +13 -0
  43. package/lib/actions/sdk/generate.js +77 -0
  44. package/lib/actions/sdk/generate.js.map +1 -0
  45. package/lib/actions/sdk/quickstart.d.ts +17 -0
  46. package/lib/actions/sdk/quickstart.js +171 -0
  47. package/lib/actions/sdk/quickstart.js.map +1 -0
  48. package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
  49. package/lib/application/portal/recipe/portal-recipe.js +33 -0
  50. package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
  51. package/lib/application/portal/recipe/recipe-generator.d.ts +21 -0
  52. package/lib/application/portal/recipe/recipe-generator.js +145 -0
  53. package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
  54. package/lib/application/portal/toc/toc-content-parser.d.ts +1 -1
  55. package/lib/application/portal/toc/toc-content-parser.js +9 -11
  56. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  57. package/lib/application/portal/toc/toc-structure-generator.d.ts +23 -2
  58. package/lib/application/portal/toc/toc-structure-generator.js +133 -66
  59. package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
  60. package/lib/client-utils/auth-manager.d.ts +7 -2
  61. package/lib/client-utils/auth-manager.js +26 -14
  62. package/lib/client-utils/auth-manager.js.map +1 -0
  63. package/lib/commands/api/transform.d.ts +10 -7
  64. package/lib/commands/api/transform.js +51 -111
  65. package/lib/commands/api/transform.js.map +1 -0
  66. package/lib/commands/api/validate.d.ts +7 -4
  67. package/lib/commands/api/validate.js +31 -74
  68. package/lib/commands/api/validate.js.map +1 -0
  69. package/lib/commands/auth/login.d.ts +3 -1
  70. package/lib/commands/auth/login.js +26 -68
  71. package/lib/commands/auth/login.js.map +1 -0
  72. package/lib/commands/auth/logout.d.ts +3 -1
  73. package/lib/commands/auth/logout.js +14 -21
  74. package/lib/commands/auth/logout.js.map +1 -0
  75. package/lib/commands/auth/status.d.ts +1 -0
  76. package/lib/commands/auth/status.js +18 -21
  77. package/lib/commands/auth/status.js.map +1 -0
  78. package/lib/commands/portal/copilot.d.ts +13 -0
  79. package/lib/commands/portal/copilot.js +34 -0
  80. package/lib/commands/portal/copilot.js.map +1 -0
  81. package/lib/commands/portal/generate.d.ts +7 -11
  82. package/lib/commands/portal/generate.js +26 -89
  83. package/lib/commands/portal/generate.js.map +1 -0
  84. package/lib/commands/portal/recipe/new.d.ts +12 -0
  85. package/lib/commands/portal/recipe/new.js +45 -0
  86. package/lib/commands/portal/recipe/new.js.map +1 -0
  87. package/lib/commands/portal/serve.d.ts +8 -8
  88. package/lib/commands/portal/serve.js +41 -125
  89. package/lib/commands/portal/serve.js.map +1 -0
  90. package/lib/commands/portal/toc/new.d.ts +8 -7
  91. package/lib/commands/portal/toc/new.js +52 -49
  92. package/lib/commands/portal/toc/new.js.map +1 -0
  93. package/lib/commands/quickstart.d.ts +9 -0
  94. package/lib/commands/quickstart.js +37 -0
  95. package/lib/commands/quickstart.js.map +1 -0
  96. package/lib/commands/sdk/generate.d.ts +10 -8
  97. package/lib/commands/sdk/generate.js +46 -131
  98. package/lib/commands/sdk/generate.js.map +1 -0
  99. package/lib/config/axios-config.js +4 -6
  100. package/lib/config/axios-config.js.map +1 -0
  101. package/lib/hooks/not-found.d.ts +3 -0
  102. package/lib/hooks/not-found.js +52 -0
  103. package/lib/hooks/not-found.js.map +1 -0
  104. package/lib/hooks/utils.d.ts +5 -0
  105. package/lib/hooks/utils.js +51 -0
  106. package/lib/hooks/utils.js.map +1 -0
  107. package/lib/index.js +2 -5
  108. package/lib/index.js.map +1 -0
  109. package/lib/infrastructure/debounce-service.d.ts +10 -0
  110. package/lib/infrastructure/debounce-service.js +55 -0
  111. package/lib/infrastructure/debounce-service.js.map +1 -0
  112. package/lib/infrastructure/env-info.d.ts +12 -0
  113. package/lib/infrastructure/env-info.js +58 -0
  114. package/lib/infrastructure/env-info.js.map +1 -0
  115. package/lib/infrastructure/file-service.d.ts +25 -0
  116. package/lib/infrastructure/file-service.js +131 -0
  117. package/lib/infrastructure/file-service.js.map +1 -0
  118. package/lib/infrastructure/launcher-service.d.ts +9 -0
  119. package/lib/infrastructure/launcher-service.js +72 -0
  120. package/lib/infrastructure/launcher-service.js.map +1 -0
  121. package/lib/infrastructure/network-service.d.ts +3 -0
  122. package/lib/infrastructure/network-service.js +7 -0
  123. package/lib/infrastructure/network-service.js.map +1 -0
  124. package/lib/infrastructure/service-error.d.ts +16 -0
  125. package/lib/infrastructure/service-error.js +49 -0
  126. package/lib/infrastructure/service-error.js.map +1 -0
  127. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  128. package/lib/infrastructure/services/api-client-factory.js +20 -0
  129. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  130. package/lib/infrastructure/services/api-service.d.ts +13 -0
  131. package/lib/infrastructure/services/api-service.js +103 -0
  132. package/lib/infrastructure/services/api-service.js.map +1 -0
  133. package/lib/infrastructure/services/auth-service.d.ts +11 -0
  134. package/lib/infrastructure/services/auth-service.js +37 -0
  135. package/lib/infrastructure/services/auth-service.js.map +1 -0
  136. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  137. package/lib/infrastructure/services/file-download-service.js +104 -0
  138. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  139. package/lib/infrastructure/services/portal-service.d.ts +15 -12
  140. package/lib/infrastructure/services/portal-service.js +152 -99
  141. package/lib/infrastructure/services/portal-service.js.map +1 -0
  142. package/lib/infrastructure/services/telemetry-service.d.ts +9 -0
  143. package/lib/infrastructure/services/telemetry-service.js +38 -0
  144. package/lib/infrastructure/services/telemetry-service.js.map +1 -0
  145. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  146. package/lib/infrastructure/services/transformation-service.js +56 -0
  147. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  148. package/lib/infrastructure/services/validation-service.d.ts +43 -0
  149. package/lib/infrastructure/services/validation-service.js +142 -0
  150. package/lib/infrastructure/services/validation-service.js.map +1 -0
  151. package/lib/infrastructure/tmp-extensions.d.ts +2 -0
  152. package/lib/infrastructure/tmp-extensions.js +6 -0
  153. package/lib/infrastructure/tmp-extensions.js.map +1 -0
  154. package/lib/infrastructure/zip-service.d.ts +6 -0
  155. package/lib/infrastructure/zip-service.js +39 -0
  156. package/lib/infrastructure/zip-service.js.map +1 -0
  157. package/lib/prompts/api/transform.d.ts +11 -0
  158. package/lib/prompts/api/transform.js +29 -0
  159. package/lib/prompts/api/transform.js.map +1 -0
  160. package/lib/prompts/api/validate.d.ts +15 -0
  161. package/lib/prompts/api/validate.js +76 -0
  162. package/lib/prompts/api/validate.js.map +1 -0
  163. package/lib/prompts/auth/login.d.ts +10 -0
  164. package/lib/prompts/auth/login.js +22 -0
  165. package/lib/prompts/auth/login.js.map +1 -0
  166. package/lib/prompts/auth/logout.d.ts +3 -0
  167. package/lib/prompts/auth/logout.js +7 -0
  168. package/lib/prompts/auth/logout.js.map +1 -0
  169. package/lib/prompts/auth/status.d.ts +8 -0
  170. package/lib/prompts/auth/status.js +22 -0
  171. package/lib/prompts/auth/status.js.map +1 -0
  172. package/lib/prompts/format.d.ts +31 -0
  173. package/lib/prompts/format.js +89 -0
  174. package/lib/prompts/format.js.map +1 -0
  175. package/lib/prompts/portal/copilot.d.ts +18 -0
  176. package/lib/prompts/portal/copilot.js +82 -0
  177. package/lib/prompts/portal/copilot.js.map +1 -0
  178. package/lib/prompts/portal/generate.d.ts +13 -8
  179. package/lib/prompts/portal/generate.js +36 -53
  180. package/lib/prompts/portal/generate.js.map +1 -0
  181. package/lib/prompts/portal/quickstart.d.ts +31 -29
  182. package/lib/prompts/portal/quickstart.js +139 -185
  183. package/lib/prompts/portal/quickstart.js.map +1 -0
  184. package/lib/prompts/portal/recipe/new-recipe.d.ts +29 -0
  185. package/lib/prompts/portal/recipe/new-recipe.js +165 -0
  186. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
  187. package/lib/prompts/portal/serve.d.ts +9 -5
  188. package/lib/prompts/portal/serve.js +29 -19
  189. package/lib/prompts/portal/serve.js.map +1 -0
  190. package/lib/prompts/portal/toc/new-toc.d.ts +13 -8
  191. package/lib/prompts/portal/toc/new-toc.js +36 -36
  192. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  193. package/lib/prompts/prompt.d.ts +3 -0
  194. package/lib/prompts/prompt.js +37 -0
  195. package/lib/prompts/prompt.js.map +1 -0
  196. package/lib/prompts/quickstart.d.ts +6 -0
  197. package/lib/prompts/quickstart.js +25 -0
  198. package/lib/prompts/quickstart.js.map +1 -0
  199. package/lib/prompts/sdk/generate.d.ts +16 -0
  200. package/lib/prompts/sdk/generate.js +57 -0
  201. package/lib/prompts/sdk/generate.js.map +1 -0
  202. package/lib/prompts/sdk/quickstart.d.ts +35 -0
  203. package/lib/prompts/sdk/quickstart.js +177 -0
  204. package/lib/prompts/sdk/quickstart.js.map +1 -0
  205. package/lib/types/api/account.d.ts +10 -0
  206. package/lib/types/api/account.js +2 -0
  207. package/lib/types/api/account.js.map +1 -0
  208. package/lib/types/api/transform.d.ts +14 -25
  209. package/lib/types/api/transform.js +20 -23
  210. package/lib/types/api/transform.js.map +1 -0
  211. package/lib/types/build/build.d.ts +22 -0
  212. package/lib/types/build/build.js +7 -0
  213. package/lib/types/build/build.js.map +1 -0
  214. package/lib/types/build-context.d.ts +13 -0
  215. package/lib/types/build-context.js +33 -0
  216. package/lib/types/build-context.js.map +1 -0
  217. package/lib/types/common/command-metadata.d.ts +4 -0
  218. package/lib/types/common/command-metadata.js +2 -0
  219. package/lib/types/common/command-metadata.js.map +1 -0
  220. package/lib/types/events/domain-event.d.ts +8 -0
  221. package/lib/types/events/domain-event.js +11 -0
  222. package/lib/types/events/domain-event.js.map +1 -0
  223. package/lib/types/events/quickstart-completed.d.ts +7 -0
  224. package/lib/types/events/quickstart-completed.js +10 -0
  225. package/lib/types/events/quickstart-completed.js.map +1 -0
  226. package/lib/types/events/quickstart-initiated.d.ts +7 -0
  227. package/lib/types/events/quickstart-initiated.js +10 -0
  228. package/lib/types/events/quickstart-initiated.js.map +1 -0
  229. package/lib/types/events/recipe-creation-failed.d.ts +5 -0
  230. package/lib/types/events/recipe-creation-failed.js +8 -0
  231. package/lib/types/events/recipe-creation-failed.js.map +1 -0
  232. package/lib/types/events/toc-creation-failed.d.ts +5 -0
  233. package/lib/types/events/toc-creation-failed.js +8 -0
  234. package/lib/types/events/toc-creation-failed.js.map +1 -0
  235. package/lib/types/file/directory.d.ts +17 -0
  236. package/lib/types/file/directory.js +87 -0
  237. package/lib/types/file/directory.js.map +1 -0
  238. package/lib/types/file/directoryPath.d.ts +10 -0
  239. package/lib/types/file/directoryPath.js +26 -0
  240. package/lib/types/file/directoryPath.js.map +1 -0
  241. package/lib/types/file/fileName.d.ts +7 -0
  242. package/lib/types/file/fileName.js +21 -0
  243. package/lib/types/file/fileName.js.map +1 -0
  244. package/lib/types/file/filePath.d.ts +10 -0
  245. package/lib/types/file/filePath.js +32 -0
  246. package/lib/types/file/filePath.js.map +1 -0
  247. package/lib/types/file/resource-input.d.ts +5 -0
  248. package/lib/types/file/resource-input.js +42 -0
  249. package/lib/types/file/resource-input.js.map +1 -0
  250. package/lib/types/file/urlPath.d.ts +6 -0
  251. package/lib/types/file/urlPath.js +22 -0
  252. package/lib/types/file/urlPath.js.map +1 -0
  253. package/lib/types/flags-provider.d.ts +15 -0
  254. package/lib/types/flags-provider.js +34 -0
  255. package/lib/types/flags-provider.js.map +1 -0
  256. package/lib/types/portal-context.d.ts +13 -0
  257. package/lib/types/portal-context.js +38 -0
  258. package/lib/types/portal-context.js.map +1 -0
  259. package/lib/types/recipe/recipe.d.ts +22 -0
  260. package/lib/types/recipe/recipe.js +6 -0
  261. package/lib/types/recipe/recipe.js.map +1 -0
  262. package/lib/types/recipe-context.d.ts +9 -0
  263. package/lib/types/recipe-context.js +26 -0
  264. package/lib/types/recipe-context.js.map +1 -0
  265. package/lib/types/resource-context.d.ts +12 -0
  266. package/lib/types/resource-context.js +30 -0
  267. package/lib/types/resource-context.js.map +1 -0
  268. package/lib/types/sdk/generate.d.ts +9 -22
  269. package/lib/types/sdk/generate.js +25 -14
  270. package/lib/types/sdk/generate.js.map +1 -0
  271. package/lib/types/sdk-context.d.ts +14 -0
  272. package/lib/types/sdk-context.js +32 -0
  273. package/lib/types/sdk-context.js.map +1 -0
  274. package/lib/types/sdl/sdl.d.ts +27 -0
  275. package/lib/types/sdl/sdl.js +145 -3
  276. package/lib/types/sdl/sdl.js.map +1 -0
  277. package/lib/types/spec-context.d.ts +12 -0
  278. package/lib/types/spec-context.js +29 -0
  279. package/lib/types/spec-context.js.map +1 -0
  280. package/lib/types/temp-context.d.ts +11 -0
  281. package/lib/types/temp-context.js +27 -0
  282. package/lib/types/temp-context.js.map +1 -0
  283. package/lib/types/toc/toc.d.ts +31 -6
  284. package/lib/types/toc/toc.js +2 -10
  285. package/lib/types/toc/toc.js.map +1 -0
  286. package/lib/types/toc-context.d.ts +12 -0
  287. package/lib/types/toc-context.js +26 -0
  288. package/lib/types/toc-context.js.map +1 -0
  289. package/lib/types/transform-context.d.ts +13 -0
  290. package/lib/types/transform-context.js +30 -0
  291. package/lib/types/transform-context.js.map +1 -0
  292. package/lib/types/utils.d.ts +0 -9
  293. package/lib/types/utils.js +2 -3
  294. package/lib/types/utils.js.map +1 -0
  295. package/lib/types/versioned-build-context.d.ts +15 -0
  296. package/lib/types/versioned-build-context.js +28 -0
  297. package/lib/types/versioned-build-context.js.map +1 -0
  298. package/lib/utils/string-utils.d.ts +3 -0
  299. package/lib/utils/string-utils.js +79 -0
  300. package/lib/utils/string-utils.js.map +1 -0
  301. package/lib/utils/utils.d.ts +2 -44
  302. package/lib/utils/utils.js +14 -366
  303. package/lib/utils/utils.js.map +1 -0
  304. package/package.json +50 -31
  305. package/bin/run +0 -9
  306. package/lib/application/portal/toc/sdl-parser.d.ts +0 -13
  307. package/lib/application/portal/toc/sdl-parser.js +0 -53
  308. package/lib/client-utils/sdk-client.d.ts +0 -23
  309. package/lib/client-utils/sdk-client.js +0 -124
  310. package/lib/commands/portal/quickstart.d.ts +0 -10
  311. package/lib/commands/portal/quickstart.js +0 -79
  312. package/lib/config/env.d.ts +0 -27
  313. package/lib/config/env.js +0 -31
  314. package/lib/controllers/api/transform.d.ts +0 -5
  315. package/lib/controllers/api/transform.js +0 -56
  316. package/lib/controllers/api/validate.d.ts +0 -3
  317. package/lib/controllers/api/validate.js +0 -33
  318. package/lib/controllers/portal/generate.d.ts +0 -3
  319. package/lib/controllers/portal/generate.js +0 -110
  320. package/lib/controllers/portal/quickstart.d.ts +0 -14
  321. package/lib/controllers/portal/quickstart.js +0 -258
  322. package/lib/controllers/portal/serve.d.ts +0 -3
  323. package/lib/controllers/portal/serve.js +0 -138
  324. package/lib/controllers/sdk/generate.d.ts +0 -4
  325. package/lib/controllers/sdk/generate.js +0 -66
  326. package/lib/services/portal/server.d.ts +0 -14
  327. package/lib/services/portal/server.js +0 -101
  328. package/lib/types/api/validate.d.ts +0 -12
  329. package/lib/types/api/validate.js +0 -3
  330. package/lib/types/common/result.d.ts +0 -17
  331. package/lib/types/common/result.js +0 -36
  332. package/lib/types/portal/generate.d.ts +0 -26
  333. package/lib/types/portal/generate.js +0 -4
  334. package/lib/types/portal/quickstart.d.ts +0 -17
  335. package/lib/types/portal/quickstart.js +0 -3
  336. package/lib/validators/common/directoryValidator.d.ts +0 -9
  337. package/lib/validators/common/directoryValidator.js +0 -53
  338. package/lib/validators/common/portValidator.d.ts +0 -5
  339. package/lib/validators/common/portValidator.js +0 -20
  340. package/lib/validators/portal/serveValidator.d.ts +0 -6
  341. package/lib/validators/portal/serveValidator.js +0 -21
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,19 @@
1
+ export declare class ActionResult<T = void> {
2
+ private readonly message;
3
+ private readonly resultType;
4
+ private readonly value?;
5
+ private constructor();
6
+ static success<T>(value?: T): ActionResult<T>;
7
+ static failed<T = never>(message?: string): ActionResult<T>;
8
+ static cancelled<T = never>(message?: string): ActionResult<T>;
9
+ static stopped<T = never>(message?: string): ActionResult<T>;
10
+ getMessage(): string;
11
+ getExitCode(): number;
12
+ isFailed(): boolean;
13
+ isSuccess(): boolean;
14
+ isCancelled(): boolean;
15
+ match<R>(onSuccess: (value: T) => R, onFailure: (message: string) => R, onCancel: (message: string) => R): R;
16
+ getValue(): T;
17
+ getValueOr(defaultValue: T): T;
18
+ mapAll<R>(onSuccess: (value?: T) => R, onFailure: () => R, onCancel: () => R): R;
19
+ }
@@ -0,0 +1,70 @@
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 = {}));
7
+ export class ActionResult {
8
+ constructor(resultType, message, value) {
9
+ this.resultType = resultType;
10
+ this.message = message;
11
+ this.value = value;
12
+ }
13
+ static success(value) {
14
+ return new ActionResult(ResultType.Success, "Succeeded", value);
15
+ }
16
+ static failed(message = "Failed") {
17
+ return new ActionResult(ResultType.Failure, message);
18
+ }
19
+ static cancelled(message = "Cancelled") {
20
+ return new ActionResult(ResultType.Cancel, message);
21
+ }
22
+ static stopped(message = "Stopped") {
23
+ return new ActionResult(ResultType.Cancel, message);
24
+ }
25
+ getMessage() {
26
+ return this.message;
27
+ }
28
+ getExitCode() {
29
+ return this.resultType.valueOf();
30
+ }
31
+ isFailed() {
32
+ return this.resultType === ResultType.Failure;
33
+ }
34
+ isSuccess() {
35
+ return this.resultType === ResultType.Success;
36
+ }
37
+ isCancelled() {
38
+ return this.resultType === ResultType.Cancel;
39
+ }
40
+ match(onSuccess, onFailure, onCancel) {
41
+ switch (this.resultType) {
42
+ case ResultType.Success:
43
+ return onSuccess(this.value);
44
+ case ResultType.Failure:
45
+ return onFailure(this.message);
46
+ case ResultType.Cancel:
47
+ return onCancel(this.message);
48
+ }
49
+ }
50
+ getValue() {
51
+ if (!this.isSuccess()) {
52
+ throw new Error(`Cannot unwrap ${ResultType[this.resultType]} result: ${this.message}`);
53
+ }
54
+ return this.value;
55
+ }
56
+ getValueOr(defaultValue) {
57
+ return this.isSuccess() ? this.value : defaultValue;
58
+ }
59
+ mapAll(onSuccess, onFailure, onCancel) {
60
+ switch (this.resultType) {
61
+ case ResultType.Success:
62
+ return onSuccess(this.value);
63
+ case ResultType.Failure:
64
+ return onFailure();
65
+ case ResultType.Cancel:
66
+ return onCancel();
67
+ }
68
+ }
69
+ }
70
+ //# sourceMappingURL=action-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-result.js","sourceRoot":"","sources":["../../src/actions/action-result.ts"],"names":[],"mappings":"AAAA,IAAK,UAIJ;AAJD,WAAK,UAAU;IACb,iDAAW,CAAA;IACX,iDAAY,CAAA;IACZ,iDAAW,CAAA;AACb,CAAC,EAJI,UAAU,KAAV,UAAU,QAId;AAED,MAAM,OAAO,YAAY;IAKvB,YAAoB,UAAsB,EAAE,OAAe,EAAE,KAAS;QACpE,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM,CAAC,OAAO,CAAI,KAAS;QACzB,OAAO,IAAI,YAAY,CAAI,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,MAAM,CAAY,OAAO,GAAG,QAAQ;QACzC,OAAO,IAAI,YAAY,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAA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AC,KAAM,CAAC;IACrB,CAAC;IAEM,UAAU,CAAC,YAAe;QAC/B,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAM,CAAC,CAAC,CAAC,YAAY,CAAC;IACvD,CAAC;IAEM,MAAM,CACX,SAA2B,EAC3B,SAAkB,EAClB,QAAiB;QAEjB,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,KAAK,UAAU,CAAC,OAAO;gBACrB,OAAO,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/B,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":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;A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CAAC;gBAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAC5C,IAAI,CAAC,qBAAqB,CAAC,gBAAgB,CAAC;oBAC1C,IAAI,EAAE,iBAAiB,CAAC,KAAK;oBAC7B,MAAM,EAAE,MAAM;oBACd,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,eAAe,EAAE,IAAI,CAAC,eAAe;oBACrC,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAC,CACH,CAAC;gBAEF,IAAI,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;oBACnB,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBAClD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,MAAM,mBAAmB,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBAC7E,IAAI,CAAC,eAAe,CAAC,yBAAyB,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;gBAElF,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;gBAE9D,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QA9CA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CA4CF"}
@@ -0,0 +1,14 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ import { UnallowedFeaturesResponse } from "../../infrastructure/services/validation-service.js";
4
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
5
+ import { ResourceInput } from "../../types/file/resource-input.js";
6
+ export declare class ValidateAction {
7
+ private readonly prompts;
8
+ private readonly validationService;
9
+ private readonly authKey;
10
+ private readonly commandMetadata;
11
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
12
+ readonly execute: (resourcePath: ResourceInput, displayValidationSummary?: boolean) => Promise<ActionResult<UnallowedFeaturesResponse | null>>;
13
+ private hasValidationIssues;
14
+ }
@@ -0,0 +1,52 @@
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
+ if (this.hasValidationIssues(validationSummary.result.validation)) {
29
+ this.prompts.displayValidationSummary(validationSummary.result.validation);
30
+ }
31
+ if (this.hasValidationIssues(validationSummary.result.linting)) {
32
+ this.prompts.displayValidationSummary(validationSummary.result.linting);
33
+ }
34
+ }
35
+ if (!validationSummary.result.validation.isSuccess || !validationSummary.result.linting.isSuccess) {
36
+ return ActionResult.failed();
37
+ }
38
+ return ActionResult.success(validationSummary.unallowedFeatures);
39
+ });
40
+ };
41
+ this.authKey = authKey;
42
+ this.validationService = new ValidationService(configDir);
43
+ this.commandMetadata = commandMetadata;
44
+ }
45
+ hasValidationIssues(summary) {
46
+ return (summary.blocking.length > 0 ||
47
+ summary.errors.length > 0 ||
48
+ summary.warnings.length > 0 ||
49
+ summary.information.length > 0);
50
+ }
51
+ }
52
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/actions/api/validate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAA6B,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAGnH,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGlE,MAAM,OAAO,cAAc;IAMzB,YAAY,SAAwB,EAAE,eAAgC,EAAE,UAAyB,IAAI;QALpF,YAAO,GAAuB,IAAI,kBAAkB,EAAE,CAAC;QAWxD,YAAO,GAAG,KAAK,EAC7B,YAA2B,EAC3B,wBAAwB,GAAG,IAAI,EAC0B,EAAE;YAC3D,OAAO,MAAM,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE;gBAC/C,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,aAAa,CAAC,CAAC;gBAC3D,MAAM,iBAAiB,GAAG,MAAM,eAAe,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;gBACxE,IAAI,iBAAiB,CAAC,KAAK,EAAE,EAAE,CAAC;oBAC9B,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;oBACnD,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBACD,MAAM,uBAAuB,GAAG,MAAM,IAAI,CAA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B,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC1D,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAyCO,mBAAmB,CAAC,OAA0B;QACpD,OAAO,CACL,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;YACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAC3B,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAC/B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
3
+ import { ActionResult } from "../action-result.js";
4
+ export declare class LoginAction {
5
+ private readonly configDir;
6
+ private readonly commandMetadata;
7
+ private readonly authService;
8
+ private readonly apiService;
9
+ private readonly prompts;
10
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
11
+ execute(apiKey?: string | undefined): Promise<ActionResult>;
12
+ private pollDeviceToken;
13
+ }
@@ -0,0 +1,55 @@
1
+ import { AuthService } from "../../infrastructure/services/auth-service.js";
2
+ import { ApiService } from "../../infrastructure/services/api-service.js";
3
+ import { v4 as uuid } from "uuid";
4
+ import open from "open";
5
+ import { setAuthInfo } from "../../client-utils/auth-manager.js";
6
+ import { LoginPrompts } from "../../prompts/auth/login.js";
7
+ import { ActionResult } from "../action-result.js";
8
+ import { err, ok } from "neverthrow";
9
+ export class LoginAction {
10
+ constructor(configDir, commandMetadata) {
11
+ this.configDir = configDir;
12
+ this.commandMetadata = commandMetadata;
13
+ this.authService = new AuthService();
14
+ this.apiService = new ApiService();
15
+ this.prompts = new LoginPrompts();
16
+ }
17
+ async execute(apiKey = undefined) {
18
+ const apiKeyResult = await this.pollDeviceToken(apiKey, this.commandMetadata.shell);
19
+ if (apiKeyResult.isErr()) {
20
+ this.prompts.loginTimeout();
21
+ return ActionResult.failed();
22
+ }
23
+ // TODO: Use status endpoint here
24
+ // Problem, we don't have email info here, just the key and required for setAuthInfo
25
+ const accountInfoResult = await this.prompts.accountInfoSpinner(this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, apiKeyResult.value));
26
+ if (accountInfoResult.isErr()) {
27
+ this.prompts.invalidKeyProvided(accountInfoResult.error);
28
+ return ActionResult.failed();
29
+ }
30
+ await setAuthInfo(accountInfoResult.value.Email, apiKeyResult.value, false, this.configDir);
31
+ this.prompts.loginSuccessful(accountInfoResult.value.Email);
32
+ return ActionResult.success();
33
+ }
34
+ async pollDeviceToken(apiKey, shell) {
35
+ if (apiKey)
36
+ return ok(apiKey);
37
+ const state = uuid();
38
+ this.prompts.openBrowser();
39
+ await open(this.authService.getDeviceLoginUrl(state));
40
+ const timeoutDuration = 5 * 60 * 1000; // 5 minutes in milliseconds
41
+ const startTime = Date.now();
42
+ const delayMs = 3 * 1000;
43
+ while (true) {
44
+ if (Date.now() - startTime > timeoutDuration) {
45
+ return err("TIMEOUT");
46
+ }
47
+ const result = await this.authService.getDeviceLoginToken(state, shell);
48
+ if (result.isOk()) {
49
+ return ok(result.value.apiKey);
50
+ }
51
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
52
+ }
53
+ }
54
+ }
55
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/actions/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CA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;QAC5F,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;IAEO,KAAK,CAAC,eAAe,CAAC,MAA0B,EAAE,KAAa;QACrE,IAAI,MAAM;YAAE,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;QAC9B,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC;QAEtD,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,4BAA4B;QACnE,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,CAAC;QAEzB,OAAO,IAAI,EAAE,CAAC;YACZ,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,eAAe,EAAE,CAAC;gBAC7C,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC;YACxB,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACxE,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;gBAClB,OAAO,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACjC,CAAC;YACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { ActionResult } from "../action-result.js";
3
+ export declare class LogoutAction {
4
+ private readonly configDir;
5
+ private readonly prompts;
6
+ constructor(configDir: DirectoryPath);
7
+ execute(): Promise<ActionResult>;
8
+ }
@@ -0,0 +1,15 @@
1
+ import { ActionResult } from "../action-result.js";
2
+ import { removeAuthInfo } from "../../client-utils/auth-manager.js";
3
+ import { LogoutPrompts } from "../../prompts/auth/logout.js";
4
+ export class LogoutAction {
5
+ constructor(configDir) {
6
+ this.configDir = configDir;
7
+ this.prompts = new LogoutPrompts();
8
+ }
9
+ async execute() {
10
+ await removeAuthInfo(this.configDir);
11
+ this.prompts.removeAuthInfo();
12
+ return ActionResult.success();
13
+ }
14
+ }
15
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/actions/auth/logout.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,OAAO,YAAY;IAGvB,YAA6B,SAAwB;QAAxB,cAAS,GAAT,SAAS,CAAe;QAFpC,YAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IAES,CAAC;IAElD,KAAK,CAAC,OAAO;QAClB,MAAM,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { ActionResult } from "../action-result.js";
2
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
3
+ import { CommandMetadata } from "../../types/common/command-metadata.js";
4
+ export declare class StatusAction {
5
+ private readonly configDir;
6
+ private readonly commandMetadata;
7
+ private readonly prompts;
8
+ private readonly apiService;
9
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata);
10
+ execute(authKey: string | null): Promise<ActionResult>;
11
+ }
@@ -0,0 +1,26 @@
1
+ import { ActionResult } from "../action-result.js";
2
+ import { getAuthInfo } from "../../client-utils/auth-manager.js";
3
+ import { StatusPrompts } from "../../prompts/auth/status.js";
4
+ import { ApiService } from "../../infrastructure/services/api-service.js";
5
+ export class StatusAction {
6
+ constructor(configDir, commandMetadata) {
7
+ this.configDir = configDir;
8
+ this.commandMetadata = commandMetadata;
9
+ this.prompts = new StatusPrompts();
10
+ this.apiService = new ApiService();
11
+ }
12
+ async execute(authKey) {
13
+ const accountInfo = await getAuthInfo(this.configDir.toString());
14
+ if (accountInfo === null) {
15
+ return ActionResult.failed();
16
+ }
17
+ const result = await this.prompts.accountInfoSpinner(this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, authKey));
18
+ if (result.isErr()) {
19
+ this.prompts.invalidKeyProvided(result.error);
20
+ return ActionResult.failed();
21
+ }
22
+ this.prompts.showAccountInfo(result.value);
23
+ return ActionResult.success();
24
+ }
25
+ }
26
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/actions/auth/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAE1E,MAAM,OAAO,YAAY;IAIvB,YAA6B,SAAwB,EAAmB,eAAgC;QAA3E,cAAS,GAAT,SAAS,CAAe;QAAmB,oBAAe,GAAf,eAAe,CAAiB;QAHvF,YAAO,GAAG,IAAI,aAAa,EAAE,CAAC;QAC9B,eAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAE4D,CAAC;IAErG,KAAK,CAAC,OAAO,CAAC,OAAsB;QACzC,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjE,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;YACzB,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;QAC/B,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAClD,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CACpF,CAAC;QACF,IAAI,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;QAC/B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3C,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,16 @@
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
+ export declare class CopilotAction {
5
+ private readonly apiService;
6
+ private readonly fileService;
7
+ private readonly launcherService;
8
+ private readonly prompts;
9
+ private readonly configDir;
10
+ private readonly commandMetadata;
11
+ private readonly authKey;
12
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
13
+ readonly execute: (buildDirectory: DirectoryPath, force: boolean, enable: boolean) => Promise<ActionResult>;
14
+ private selectCopilotKey;
15
+ private prepareWelcomeMessage;
16
+ }
@@ -0,0 +1,89 @@
1
+ import { ApiService } from "../../infrastructure/services/api-service.js";
2
+ import { PortalCopilotPrompts } from "../../prompts/portal/copilot.js";
3
+ import { ActionResult } from "../action-result.js";
4
+ import { BuildContext } from "../../types/build-context.js";
5
+ import { withDirPath } from "../../infrastructure/tmp-extensions.js";
6
+ import { FilePath } from "../../types/file/filePath.js";
7
+ import { FileName } from "../../types/file/fileName.js";
8
+ import { FileService } from "../../infrastructure/file-service.js";
9
+ import { LauncherService } from "../../infrastructure/launcher-service.js";
10
+ import { err, ok } from "neverthrow";
11
+ export class CopilotAction {
12
+ constructor(configDir, commandMetadata, authKey = null) {
13
+ this.apiService = new ApiService();
14
+ this.fileService = new FileService();
15
+ this.launcherService = new LauncherService();
16
+ this.prompts = new PortalCopilotPrompts();
17
+ this.execute = async (buildDirectory, force, enable) => {
18
+ const buildContext = new BuildContext(buildDirectory);
19
+ if (!(await buildContext.validate())) {
20
+ this.prompts.srcDirectoryEmpty(buildDirectory);
21
+ return ActionResult.failed();
22
+ }
23
+ const buildJson = await buildContext.getBuildFileContents();
24
+ if (!force && buildJson.apiCopilotConfig != null && !(await this.prompts.confirmOverwrite())) {
25
+ this.prompts.cancelled();
26
+ return ActionResult.cancelled();
27
+ }
28
+ const response = await this.prompts.spinnerAccountInfo(this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, this.authKey));
29
+ if (response.isErr()) {
30
+ this.prompts.serviceError(response.error);
31
+ return ActionResult.failed();
32
+ }
33
+ const apiCopilotKeyResult = await this.selectCopilotKey(response.value, force);
34
+ if (apiCopilotKeyResult.isErr()) {
35
+ if (apiCopilotKeyResult.error === "cancelled")
36
+ return ActionResult.cancelled();
37
+ return ActionResult.failed();
38
+ }
39
+ const welcomeMessage = await this.prepareWelcomeMessage();
40
+ buildJson.apiCopilotConfig = {
41
+ isEnabled: enable,
42
+ key: apiCopilotKeyResult.value,
43
+ welcomeMessage: welcomeMessage
44
+ };
45
+ await buildContext.updateBuildFileContents(buildJson);
46
+ this.prompts.copilotConfigured(enable, apiCopilotKeyResult.value);
47
+ return ActionResult.success();
48
+ };
49
+ this.configDir = configDir;
50
+ this.commandMetadata = commandMetadata;
51
+ this.authKey = authKey;
52
+ }
53
+ async selectCopilotKey(subscription, force) {
54
+ if (subscription.ApiCopilotKeys === undefined || subscription.ApiCopilotKeys.length === 0) {
55
+ this.prompts.noCopilotKeyFound();
56
+ return err("failed");
57
+ }
58
+ if (subscription.ApiCopilotKeys.length === 1) {
59
+ if (force || (await this.prompts.confirmSingleKeyUsage(subscription.ApiCopilotKeys[0])))
60
+ return ok(subscription.ApiCopilotKeys[0]);
61
+ this.prompts.noCopilotKeySelected();
62
+ return err("cancelled");
63
+ }
64
+ const key = await this.prompts.selectCopilotKey(subscription.ApiCopilotKeys);
65
+ if (key === null) {
66
+ this.prompts.noCopilotKeySelected();
67
+ return err("cancelled");
68
+ }
69
+ await this.prompts.displayApiCopilotKeyUsageWarning();
70
+ return ok(key);
71
+ }
72
+ async prepareWelcomeMessage() {
73
+ return await withDirPath(async (tempDir) => {
74
+ const tempFile = new FilePath(tempDir, new FileName("welcome-message.md"));
75
+ const defaultContent = "Hi there! I'm your API Integration Assistant, here to help you learn and integrate with this API.\n" +
76
+ "\n" +
77
+ "Ask me anything about this API or try one of these example prompts:\n" +
78
+ "\n" +
79
+ "- `What authentication methods does this API support?`\n" +
80
+ "- `[Enter another prompt here]`";
81
+ await this.fileService.writeContents(tempFile, defaultContent);
82
+ this.prompts.openWelcomeMessageEditor();
83
+ await this.launcherService.openInEditor(tempFile);
84
+ const welcomeMessage = await this.fileService.getContents(tempFile);
85
+ return welcomeMessage.replace(/\r\n|\r/g, "\n");
86
+ });
87
+ }
88
+ }
89
+ //# sourceMappingURL=copilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/actions/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,8B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BACvE,IAAI;gBACJ,0DAA0D;gBAC1D,iCAAiC,CAAC;YACpC,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;YAC/D,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,CAAC;YACxC,MAAM,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;YAClD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACpE,OAAO,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,7 +1,13 @@
1
- import { PortalPaths, GenerateFlags } from "../../types/portal/generate";
2
- export declare class PortalGenerateAction {
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
+ export declare class GenerateAction {
3
5
  private readonly prompts;
4
- constructor();
5
- generatePortal(paths: PortalPaths, flags: GenerateFlags, configDir: string): Promise<void>;
6
- private saveGeneratedPortalStreamToZipFile;
6
+ private readonly launcherService;
7
+ private readonly portalService;
8
+ private readonly configDir;
9
+ private readonly commandMetadata;
10
+ private readonly authKey;
11
+ constructor(configDir: DirectoryPath, commandMetadata: CommandMetadata, authKey?: string | null);
12
+ readonly execute: (buildDirectory: DirectoryPath, portalDirectory: DirectoryPath, force: boolean, zipPortal: boolean, displayMessages?: boolean) => Promise<ActionResult>;
7
13
  }