@apimatic/cli 1.1.0-alpha.8 → 1.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/README.md +436 -374
  2. package/bin/run.js +5 -0
  3. package/lib/actions/action-result.d.ts +13 -0
  4. package/lib/actions/action-result.js +44 -0
  5. package/lib/actions/action-result.js.map +1 -0
  6. package/lib/actions/api/transform.d.ts +15 -0
  7. package/lib/actions/api/transform.js +48 -0
  8. package/lib/actions/api/transform.js.map +1 -0
  9. package/lib/actions/api/validate.d.ts +12 -0
  10. package/lib/actions/api/validate.js +41 -0
  11. package/lib/actions/api/validate.js.map +1 -0
  12. package/lib/actions/auth/login.d.ts +13 -0
  13. package/lib/actions/auth/login.js +55 -0
  14. package/lib/actions/auth/login.js.map +1 -0
  15. package/lib/actions/auth/logout.d.ts +8 -0
  16. package/lib/actions/auth/logout.js +15 -0
  17. package/lib/actions/auth/logout.js.map +1 -0
  18. package/lib/actions/auth/status.d.ts +11 -0
  19. package/lib/actions/auth/status.js +26 -0
  20. package/lib/actions/auth/status.js.map +1 -0
  21. package/lib/actions/portal/copilot.d.ts +16 -0
  22. package/lib/actions/portal/copilot.js +89 -0
  23. package/lib/actions/portal/copilot.js.map +1 -0
  24. package/lib/actions/portal/generate.d.ts +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 +16 -0
  28. package/lib/actions/portal/quickstart.js +146 -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 +118 -0
  35. package/lib/actions/portal/serve.js.map +1 -0
  36. package/lib/actions/portal/toc/new-toc.d.ts +21 -0
  37. package/lib/actions/portal/toc/new-toc.js +97 -0
  38. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  39. package/lib/actions/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 +47 -0
  44. package/lib/actions/sdk/generate.js.map +1 -0
  45. package/lib/actions/sdk/quickstart.d.ts +14 -0
  46. package/lib/actions/sdk/quickstart.js +149 -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/{new/toc → toc}/toc-content-parser.d.ts +1 -1
  55. package/lib/application/portal/toc/toc-content-parser.js +44 -0
  56. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  57. package/lib/application/portal/{new/toc → toc}/toc-structure-generator.d.ts +1 -1
  58. package/lib/application/portal/toc/toc-structure-generator.js +84 -0
  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 +14 -0
  91. package/lib/commands/portal/toc/new.js +60 -0
  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 +52 -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 +24 -0
  116. package/lib/infrastructure/file-service.js +120 -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 +12 -0
  131. package/lib/infrastructure/services/api-service.js +79 -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 +17 -12
  140. package/lib/infrastructure/services/portal-service.js +134 -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 +17 -0
  149. package/lib/infrastructure/services/validation-service.js +49 -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 +12 -0
  161. package/lib/prompts/api/validate.js +40 -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 +28 -29
  182. package/lib/prompts/portal/quickstart.js +102 -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 +15 -0
  191. package/lib/prompts/portal/toc/new-toc.js +38 -0
  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 +11 -0
  200. package/lib/prompts/sdk/generate.js +37 -0
  201. package/lib/prompts/sdk/generate.js.map +1 -0
  202. package/lib/prompts/sdk/quickstart.d.ts +32 -0
  203. package/lib/prompts/sdk/quickstart.js +140 -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 +10 -0
  275. package/lib/types/sdl/sdl.js +47 -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.js +2 -10
  284. package/lib/types/toc/toc.js.map +1 -0
  285. package/lib/types/toc-context.d.ts +12 -0
  286. package/lib/types/toc-context.js +26 -0
  287. package/lib/types/toc-context.js.map +1 -0
  288. package/lib/types/transform-context.d.ts +13 -0
  289. package/lib/types/transform-context.js +30 -0
  290. package/lib/types/transform-context.js.map +1 -0
  291. package/lib/types/utils.d.ts +0 -9
  292. package/lib/types/utils.js +2 -3
  293. package/lib/types/utils.js.map +1 -0
  294. package/lib/utils/string-utils.d.ts +2 -0
  295. package/lib/utils/string-utils.js +37 -0
  296. package/lib/utils/string-utils.js.map +1 -0
  297. package/lib/utils/utils.d.ts +2 -44
  298. package/lib/utils/utils.js +14 -366
  299. package/lib/utils/utils.js.map +1 -0
  300. package/package.json +50 -31
  301. package/bin/run +0 -9
  302. package/lib/actions/portal/new/toc.d.ts +0 -17
  303. package/lib/actions/portal/new/toc.js +0 -134
  304. package/lib/application/portal/new/toc/sdl-parser.d.ts +0 -13
  305. package/lib/application/portal/new/toc/sdl-parser.js +0 -53
  306. package/lib/application/portal/new/toc/toc-content-parser.js +0 -46
  307. package/lib/application/portal/new/toc/toc-structure-generator.js +0 -88
  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/new/toc.d.ts +0 -15
  311. package/lib/commands/portal/new/toc.js +0 -65
  312. package/lib/commands/portal/quickstart.d.ts +0 -10
  313. package/lib/commands/portal/quickstart.js +0 -79
  314. package/lib/config/env.d.ts +0 -27
  315. package/lib/config/env.js +0 -31
  316. package/lib/controllers/api/transform.d.ts +0 -5
  317. package/lib/controllers/api/transform.js +0 -56
  318. package/lib/controllers/api/validate.d.ts +0 -3
  319. package/lib/controllers/api/validate.js +0 -33
  320. package/lib/controllers/portal/generate.d.ts +0 -3
  321. package/lib/controllers/portal/generate.js +0 -110
  322. package/lib/controllers/portal/quickstart.d.ts +0 -14
  323. package/lib/controllers/portal/quickstart.js +0 -258
  324. package/lib/controllers/portal/serve.d.ts +0 -3
  325. package/lib/controllers/portal/serve.js +0 -138
  326. package/lib/controllers/sdk/generate.d.ts +0 -4
  327. package/lib/controllers/sdk/generate.js +0 -66
  328. package/lib/prompts/portal/new/toc.d.ts +0 -10
  329. package/lib/prompts/portal/new/toc.js +0 -46
  330. package/lib/services/portal/server.d.ts +0 -14
  331. package/lib/services/portal/server.js +0 -101
  332. package/lib/types/api/validate.d.ts +0 -12
  333. package/lib/types/api/validate.js +0 -3
  334. package/lib/types/common/result.d.ts +0 -17
  335. package/lib/types/common/result.js +0 -36
  336. package/lib/types/portal/generate.d.ts +0 -26
  337. package/lib/types/portal/generate.js +0 -4
  338. package/lib/types/portal/quickstart.d.ts +0 -17
  339. package/lib/types/portal/quickstart.js +0 -3
  340. package/lib/validators/common/directoryValidator.d.ts +0 -9
  341. package/lib/validators/common/directoryValidator.js +0 -53
  342. package/lib/validators/common/portValidator.d.ts +0 -5
  343. package/lib/validators/common/portValidator.js +0 -20
  344. package/lib/validators/portal/serveValidator.d.ts +0 -6
  345. package/lib/validators/portal/serveValidator.js +0 -21
@@ -0,0 +1,15 @@
1
+ import { FilePath } from "../../../types/file/filePath.js";
2
+ import { Result } from "neverthrow";
3
+ import { DirectoryPath } from "../../../types/file/directoryPath.js";
4
+ import { ServiceError } from "../../../infrastructure/service-error.js";
5
+ import { Sdl } from "../../../types/sdl/sdl.js";
6
+ export declare class PortalNewTocPrompts {
7
+ overwriteToc(tocPath: FilePath): Promise<boolean>;
8
+ fallingBackToDefault(): void;
9
+ tocFileAlreadyExists(): void;
10
+ logError(message: string): void;
11
+ contentDirectoryNotFound(contentFolderPath: DirectoryPath): void;
12
+ invalidBuildDirectory(directory: DirectoryPath): void;
13
+ extractEndpointGroupsAndModels(fn: Promise<Result<Sdl, ServiceError>>): Promise<Result<Sdl, ServiceError>>;
14
+ tocCreated(tocPath: FilePath): void;
15
+ }
@@ -0,0 +1,38 @@
1
+ import { confirm, isCancel, log } from "@clack/prompts";
2
+ import { format as f } from "../../format.js";
3
+ import { withSpinner } from "../../prompt.js";
4
+ export class PortalNewTocPrompts {
5
+ async overwriteToc(tocPath) {
6
+ const overwrite = await confirm({
7
+ message: `The destination file ${f.path(tocPath)} already exists, do you want to overwrite it?`,
8
+ initialValue: false
9
+ });
10
+ if (isCancel(overwrite)) {
11
+ return false;
12
+ }
13
+ return overwrite;
14
+ }
15
+ fallingBackToDefault() {
16
+ log.warn(`Falling back to the default TOC structure.`);
17
+ }
18
+ tocFileAlreadyExists() {
19
+ log.error(`Please enter a different destination path or delete the existing toc.yml file and try again.`);
20
+ }
21
+ logError(message) {
22
+ log.error(message);
23
+ }
24
+ contentDirectoryNotFound(contentFolderPath) {
25
+ log.error(`Content folder not found at: ${contentFolderPath}`);
26
+ }
27
+ invalidBuildDirectory(directory) {
28
+ const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
29
+ log.error(message);
30
+ }
31
+ extractEndpointGroupsAndModels(fn) {
32
+ return withSpinner("Extracting endpoint groups and models", "Endpoint groups and models extracted", "Endpoint groups and models extraction failed", fn);
33
+ }
34
+ tocCreated(tocPath) {
35
+ log.info(`The TOC file successfully created at: ${f.path(tocPath)}`);
36
+ }
37
+ }
38
+ //# sourceMappingURL=new-toc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/prompts/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,iBAAiB,CAAC;AAI9C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,OAAO,mBAAmB;IACvB,KAAK,CAAC,YAAY,CAAC,OAAiB;QACzC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC;YAC9B,OAAO,EAAE,wBAAwB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,+CAA+C;YAC/F,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,oBAAoB;QACzB,GAAG,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IACzD,CAAC;IAEM,oBAAoB;QACzB,GAAG,CAAC,KAAK,CAAC,8FAA8F,CAAC,CAAC;IAC5G,CAAC;IAEM,QAAQ,CAAC,OAAe;QAC7B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,wBAAwB,CAAC,iBAAgC;QAC9D,GAAG,CAAC,KAAK,CAAC,gCAAgC,iBAAiB,EAAE,CAAC,CAAC;IACjE,CAAC;IAEM,qBAAqB,CAAC,SAAwB;QACnD,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACjG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,8BAA8B,CAAC,EAAsC;QAC1E,OAAO,WAAW,CAChB,uCAAuC,EACvC,sCAAsC,EACtC,8CAA8C,EAC9C,EAAE,CACH,CAAC;IACJ,CAAC;IAEM,UAAU,CAAC,OAAiB;QACjC,GAAG,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ import { Result } from "neverthrow";
2
+ export declare function withSpinner<T, E>(intro: string, success: string, failure: string, fn: Promise<Result<T, E>>): Promise<Result<T, E>>;
3
+ export declare const noteWrapped: (message: string, title: string) => void;
@@ -0,0 +1,37 @@
1
+ import pc from "picocolors";
2
+ import { getColumns } from "@clack/core";
3
+ import { log, note, S_BAR_H, S_CONNECT_LEFT, spinner } from "@clack/prompts";
4
+ import { stripAnsi } from "../utils/string-utils.js";
5
+ export async function withSpinner(intro, success, failure, fn) {
6
+ const s = spinner({
7
+ cancelMessage: "cancelled",
8
+ errorMessage: "failed",
9
+ frames: ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
10
+ });
11
+ s.start(intro);
12
+ const result = await fn;
13
+ result.match(() => s.stop(success, 0), () => s.stop(failure, 1));
14
+ return result;
15
+ }
16
+ export const noteWrapped = (message, title) => {
17
+ const output = process.stdout;
18
+ const columns = getColumns(output) || 80;
19
+ const messages = message.split("\n");
20
+ const messageHasOverFlow = messages.some((msg) => {
21
+ const clean = stripAnsi(msg);
22
+ return clean.length + 6 > columns;
23
+ });
24
+ if (messageHasOverFlow) {
25
+ const startLine = S_BAR_H.repeat(columns - title.length - 4);
26
+ log.step(`${title} ${pc.gray(startLine)}`);
27
+ log.message(message);
28
+ output.write(pc.gray(S_CONNECT_LEFT + S_BAR_H.repeat(columns - 1)) + "\n");
29
+ }
30
+ else {
31
+ const opts = {
32
+ format: (line) => line
33
+ };
34
+ note(message, title, opts);
35
+ }
36
+ };
37
+ //# sourceMappingURL=prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/prompts/prompt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAe,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAO,KAAa,EAAE,OAAe,EAAE,OAAe,EAAE,EAAyB;IAChH,MAAM,CAAC,GAAG,OAAO,CAAC;QAChB,aAAa,EAAE,WAAW;QAC1B,YAAY,EAAE,QAAQ;QACtB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;KAC3D,CAAC,CAAC;IACH,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,KAAK,CACV,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,EACxB,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CACzB,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,KAAa,EAAE,EAAE;IAC5D,MAAM,MAAM,GAAa,OAAO,CAAC,MAAM,CAAC;IACxC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/C,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC;IACpC,CAAC,CAAC,CAAC;IACH,IAAI,kBAAkB,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC7D,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAC3C,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7E,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,GAAgB;YACxB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI;SACvB,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type QuickstartFlow = "sdk" | "portal" | undefined;
2
+ export declare class QuickstartPrompts {
3
+ welcomeMessage(): void;
4
+ selectQuickstartFlow(): Promise<QuickstartFlow>;
5
+ noQuickstartFlowSelected(): void;
6
+ }
@@ -0,0 +1,25 @@
1
+ import { isCancel, log, select } from "@clack/prompts";
2
+ export class QuickstartPrompts {
3
+ welcomeMessage() {
4
+ log.info(`Welcome to the APIMatic quickstart wizard.`);
5
+ log.message(`This wizard will guide you through creating your first SDK or API Documentation Portal in just four easy steps.
6
+ Let's get started!`);
7
+ }
8
+ async selectQuickstartFlow() {
9
+ const option = await select({
10
+ message: "What would you like to create?",
11
+ options: [
12
+ { value: "portal", label: "API Documentation Portal", hint: "Generate API docs + SDKs" },
13
+ { value: "sdk", label: "SDK" }
14
+ ]
15
+ });
16
+ if (isCancel(option)) {
17
+ return undefined;
18
+ }
19
+ return option;
20
+ }
21
+ noQuickstartFlowSelected() {
22
+ log.error("No option was selected.");
23
+ }
24
+ }
25
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../src/prompts/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIvD,MAAM,OAAO,iBAAiB;IACrB,cAAc;QACnB,GAAG,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;QACvD,GAAG,CAAC,OAAO,CAAC;mBACG,CAAC,CAAC;IACnB,CAAC;IAEM,KAAK,CAAC,oBAAoB;QAC/B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC;YAC1B,OAAO,EAAE,gCAAgC;YACzC,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,0BAA0B,EAAE,IAAI,EAAE,0BAA0B,EAAE;gBACxF,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;aAC/B;SACF,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACrB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,wBAAwB;QAC7B,GAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { Result } from "neverthrow";
3
+ export declare class SdkGeneratePrompts {
4
+ overwriteSdk(directory: DirectoryPath): Promise<boolean>;
5
+ sameSpecAndSdkDir(directory: DirectoryPath): void;
6
+ invalidSpecDirectory(directory: DirectoryPath): void;
7
+ destinationDirNotEmpty(): void;
8
+ generateSDK(fn: Promise<Result<NodeJS.ReadableStream, string>>): Promise<Result<NodeJS.ReadableStream, string>>;
9
+ logGenerationError(error: string): void;
10
+ sdkGenerated(sdk: DirectoryPath): void;
11
+ }
@@ -0,0 +1,37 @@
1
+ import { isCancel, confirm, log } from "@clack/prompts";
2
+ import { format as f, } from "../format.js";
3
+ import { withSpinner } from "../prompt.js";
4
+ export class SdkGeneratePrompts {
5
+ async overwriteSdk(directory) {
6
+ const overwrite = await confirm({
7
+ message: `The destination ${f.path(directory)} is not empty, do you want to overwrite?`,
8
+ initialValue: false
9
+ });
10
+ if (isCancel(overwrite)) {
11
+ return false;
12
+ }
13
+ return overwrite;
14
+ }
15
+ sameSpecAndSdkDir(directory) {
16
+ const message = `The ${f.var("src")} and ${f.var("portal")} directories must be different. Current value: ${f.path(directory)}`;
17
+ this.logGenerationError(message);
18
+ }
19
+ invalidSpecDirectory(directory) {
20
+ const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
21
+ this.logGenerationError(message);
22
+ }
23
+ destinationDirNotEmpty() {
24
+ const message = `Please enter a different destination folder or remove the existing files and try again.`;
25
+ this.logGenerationError(message);
26
+ }
27
+ generateSDK(fn) {
28
+ return withSpinner("Generating SDK", "SDK generated successfully.", "SDK Generation failed.", fn);
29
+ }
30
+ logGenerationError(error) {
31
+ log.error(error);
32
+ }
33
+ sdkGenerated(sdk) {
34
+ log.info(`Generated SDK can be found at ${f.path(sdk)}.`);
35
+ }
36
+ }
37
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version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gBAAgB,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,EAAE,CAAC,CAAC;IACpG,CAAC;IAEM,kBAAkB,CAAC,KAAa;QACrC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAEM,YAAY,CAAC,GAAkB;QACpC,GAAG,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ import { Result } from "neverthrow";
2
+ import { UrlPath } from "../../types/file/urlPath.js";
3
+ import { ResourceInput } from "../../types/file/resource-input.js";
4
+ import { FileDownloadResponse } from "../../infrastructure/services/file-download-service.js";
5
+ import { ServiceError } from "../../infrastructure/service-error.js";
6
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
7
+ import { Directory } from "../../types/file/directory.js";
8
+ import { Language } from "../../types/sdk/generate.js";
9
+ export declare class SdkQuickstartPrompts {
10
+ importSpecStep(): void;
11
+ specPathPrompt(defaultSpecUrl: UrlPath): Promise<ResourceInput | undefined>;
12
+ specFileDoesNotExist(): void;
13
+ noSpecSpecified(): void;
14
+ downloadSpecFile(fn: Promise<Result<FileDownloadResponse, ServiceError>>): Promise<Result<FileDownloadResponse, ServiceError>>;
15
+ serviceError(serviceError: ServiceError): void;
16
+ validateSpecStep(): void;
17
+ specValidationFailed(): void;
18
+ useDefaultSpecPrompt(): Promise<boolean>;
19
+ fixYourSpec(): void;
20
+ selectLanguageStep(): void;
21
+ selectLanguagePrompt(): Promise<Language | undefined>;
22
+ noLanguageSelected(): void;
23
+ selectInputDirectoryStep(): void;
24
+ inputDirectoryPathPrompt(): Promise<DirectoryPath | undefined>;
25
+ noInputDirectoryProvided(): void;
26
+ inputDirectoryPathDoesNotExist(inputDirectory: DirectoryPath): void;
27
+ inputDirectoryNotEmpty(inputDirectory: DirectoryPath): void;
28
+ downloadMetadataFile(fn: Promise<Result<FileDownloadResponse, ServiceError>>): Promise<Result<FileDownloadResponse, ServiceError>>;
29
+ printDirectoryStructure(inputDirectory: DirectoryPath, directory: Directory): void;
30
+ sdkOpenedInEditor(): void;
31
+ nextSteps(language: Language, specDirectory: DirectoryPath): void;
32
+ }
@@ -0,0 +1,140 @@
1
+ import { isCancel, log, select, text } from "@clack/prompts";
2
+ import { format as f, getTree } from "../format.js";
3
+ import { noteWrapped, withSpinner } from "../prompt.js";
4
+ import { createResourceInputFromInput } from "../../types/file/resource-input.js";
5
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
6
+ import { removeQuotes } from "../../utils/string-utils.js";
7
+ import { Language } from "../../types/sdk/generate.js";
8
+ const vscodeExtensionUrl = "https://marketplace.visualstudio.com/items?itemName=apimatic-developers.apimatic-for-vscode";
9
+ const sdkCustomizationUrl = "https://docs.apimatic.io/generate-sdks/codegen-settings/codegen-settings-overview/";
10
+ const defaultSrcDirectoryPath = process.cwd();
11
+ export class SdkQuickstartPrompts {
12
+ importSpecStep() {
13
+ log.info(`Step 1 of 4: Import your OpenAPI Definition`);
14
+ }
15
+ async specPathPrompt(defaultSpecUrl) {
16
+ const spec = await text({
17
+ message: `Provide a local path or a public URL for your OpenAPI Definition file:`,
18
+ placeholder: "Provide absolute URL/local path or press Enter to use a sample OpenAPI Definition file from APIMatic.",
19
+ defaultValue: defaultSpecUrl.toString(),
20
+ validate: (value) => {
21
+ if (value && !createResourceInputFromInput(value)) {
22
+ return "Please enter a valid file path or URL.";
23
+ }
24
+ }
25
+ });
26
+ if (isCancel(spec)) {
27
+ return undefined;
28
+ }
29
+ return createResourceInputFromInput(spec);
30
+ }
31
+ specFileDoesNotExist() {
32
+ log.error("The specified file does not exist or is not a valid file. Please enter a valid file path.");
33
+ }
34
+ noSpecSpecified() {
35
+ log.error("No API Definition was provided.");
36
+ }
37
+ downloadSpecFile(fn) {
38
+ return withSpinner("Downloading API Definition", `API Definition downloaded`, "Unable to download API Definition", fn);
39
+ }
40
+ serviceError(serviceError) {
41
+ log.error(serviceError.errorMessage);
42
+ }
43
+ validateSpecStep() {
44
+ log.info(`Step 2 of 4: Validate and Lint your OpenAPI Definition`);
45
+ }
46
+ specValidationFailed() {
47
+ log.error(`Oops, it looks like there are some errors in your API Definition`);
48
+ }
49
+ async useDefaultSpecPrompt() {
50
+ const useDefaultSpec = await select({
51
+ message: `How would you like to proceed?`,
52
+ options: [
53
+ {
54
+ value: "no",
55
+ label: `1. Fix the issues using APIMatic's interactive VS Code Extension: ${vscodeExtensionUrl}`
56
+ },
57
+ { value: "yes", label: `2. Use an example API Definition instead (recommended)` }
58
+ ]
59
+ });
60
+ if (isCancel(useDefaultSpec)) {
61
+ return false;
62
+ }
63
+ return useDefaultSpec === "yes";
64
+ }
65
+ fixYourSpec() {
66
+ const message = `Good luck fixing your API Definition! Feel free to run this command again once you're done.`;
67
+ log.info(message);
68
+ }
69
+ selectLanguageStep() {
70
+ log.info(`Step 3 of 4: Select programming language`);
71
+ }
72
+ async selectLanguagePrompt() {
73
+ const language = await select({
74
+ message: "Choose the programming language for your SDK:",
75
+ options: [
76
+ { label: "Typescript", value: Language.TYPESCRIPT },
77
+ { label: "Ruby", value: Language.RUBY },
78
+ { label: "Python", value: Language.PYTHON },
79
+ { label: "Java", value: Language.JAVA },
80
+ { label: "C#", value: Language.CSHARP },
81
+ { label: "PHP", value: Language.PHP },
82
+ { label: "Go", value: Language.GO }
83
+ ]
84
+ });
85
+ if (isCancel(language)) {
86
+ return undefined;
87
+ }
88
+ return language;
89
+ }
90
+ noLanguageSelected() {
91
+ log.error("No programming language was selected.");
92
+ }
93
+ selectInputDirectoryStep() {
94
+ log.info(`Step 4 of 4: Setup directory for SDK Generation`);
95
+ }
96
+ async inputDirectoryPathPrompt() {
97
+ var _a;
98
+ const inputDirectory = await text({
99
+ message: "Enter the directory path where you would like to setup the SDK (Requires an empty directory):",
100
+ placeholder: "Provide absolute path to the directory or press Enter to use the current directory.",
101
+ defaultValue: "./"
102
+ });
103
+ if (isCancel(inputDirectory)) {
104
+ return undefined;
105
+ }
106
+ const cleanedPath = removeQuotes((_a = inputDirectory === null || inputDirectory === void 0 ? void 0 : inputDirectory.trim()) !== null && _a !== void 0 ? _a : "");
107
+ return new DirectoryPath(cleanedPath);
108
+ }
109
+ noInputDirectoryProvided() {
110
+ log.error("No directory was specified.");
111
+ }
112
+ inputDirectoryPathDoesNotExist(inputDirectory) {
113
+ log.error(`The specified directory path ${f.path(inputDirectory)} does not exist.`);
114
+ }
115
+ inputDirectoryNotEmpty(inputDirectory) {
116
+ log.error(`The target directory ${f.path(inputDirectory)} is not empty. Please provide a path to an empty directory or clear its contents.`);
117
+ }
118
+ downloadMetadataFile(fn) {
119
+ return withSpinner("Setting up source directory", `Source directory set up successfully`, "Unable to set up source directory", fn);
120
+ }
121
+ printDirectoryStructure(inputDirectory, directory) {
122
+ const heading = `${f.var("src")} directory containing source files created at ${f.path(inputDirectory)}\n`;
123
+ const message = getTree(directory.toTreeNode());
124
+ log.info(heading + message);
125
+ }
126
+ sdkOpenedInEditor() {
127
+ log.info("Opened the SDK directory in VS Code. To get started with your SDK, review the README file.");
128
+ }
129
+ nextSteps(language, specDirectory) {
130
+ const specDirectoryFlag = !specDirectory.isEqual(DirectoryPath.default) ? `${f.flag("spec", specDirectory.toString())} ` : "";
131
+ const message = `Run the command
132
+ '${f.cmdAlt("apimatic", "sdk", "generate")} ${specDirectoryFlag}${f.flag("language", language)}'
133
+ to regenerate your SDK.
134
+
135
+ To learn more about customizing your SDK, visit:
136
+ ${f.link(sdkCustomizationUrl)}`;
137
+ noteWrapped(message, "Next Steps");
138
+ }
139
+ }
140
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/prompts/sdk/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,EAAE,MAAM,I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AY,CAAC,CAAC;IACrC,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export interface SubscriptionInfo {
2
+ Id: string;
3
+ Email: string;
4
+ FullName: string;
5
+ SecurityStamp: string;
6
+ tenantId: string;
7
+ allowedLanguages: number;
8
+ isPackagePublishingAllowed: boolean;
9
+ ApiCopilotKeys: string[];
10
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"account.js","sourceRoot":"","sources":["../../../src/types/api/account.ts"],"names":[],"mappings":""}
@@ -1,14 +1,3 @@
1
- import { TransformationController } from "@apimatic/sdk";
2
- export type TransformationIdParams = {
3
- file: string;
4
- url: string;
5
- format: string;
6
- };
7
- export type DownloadTransformationParams = {
8
- id: string;
9
- destinationFilePath: string;
10
- transformationController: TransformationController;
11
- };
12
1
  export type TransformationData = {
13
2
  result: NodeJS.ReadableStream | Blob;
14
3
  };
@@ -28,18 +17,18 @@ export declare const DestinationFormats: {
28
17
  GraphQlSchema: string;
29
18
  };
30
19
  export declare enum TransformationFormats {
31
- APIMATIC = "Apimatic",
32
- WADL2009 = "Wadl2009",
33
- WSDL = "Wsdl",
34
- SWAGGER10 = "Swagger10",
35
- SWAGGER20 = "Swagger20",
36
- SWAGGERYAML = "Swaggeryaml",
37
- OAS3 = "Oas3",
38
- OPENAPI3YAML = "Openapi3Yaml",
39
- APIBLUEPRINT = "Apiblueprint",
40
- RAML = "Raml",
41
- RAML10 = "Raml10",
42
- POSTMAN10 = "Postman10",
43
- POSTMAN20 = "Postman20",
44
- GRAPHQLSCHEMA = "Graphqlschema"
20
+ apimatic = "Apimatic",
21
+ wadl2009 = "Wadl2009",
22
+ wsdl = "Wsdl",
23
+ swagger10 = "Swagger10",
24
+ swagger20 = "Swagger20",
25
+ swaggeryaml = "Swaggeryaml",
26
+ oas3 = "Oas3",
27
+ openapi3yaml = "Openapi3Yaml",
28
+ apiblueprint = "Apiblueprint",
29
+ raml = "Raml",
30
+ raml10 = "Raml10",
31
+ postman10 = "Postman10",
32
+ postman20 = "Postman20",
33
+ graphqlschema = "Graphqlschema"
45
34
  }
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TransformationFormats = exports.DestinationFormats = void 0;
4
- exports.DestinationFormats = {
1
+ export const DestinationFormats = {
5
2
  OpenApi3Json: "json",
6
3
  OpenApi3Yaml: "yaml",
7
4
  APIMATIC: "json",
@@ -10,27 +7,27 @@ exports.DestinationFormats = {
10
7
  Swagger10: "json",
11
8
  Swagger20: "json",
12
9
  SwaggerYaml: "yaml",
13
- RAML: "yaml",
14
- RAML10: "yaml",
10
+ RAML: "raml",
11
+ RAML10: "raml",
15
12
  Postman10: "json",
16
13
  Postman20: "json",
17
14
  GraphQlSchema: "json"
18
15
  };
19
- var TransformationFormats;
16
+ export var TransformationFormats;
20
17
  (function (TransformationFormats) {
21
- TransformationFormats["APIMATIC"] = "Apimatic";
22
- TransformationFormats["WADL2009"] = "Wadl2009";
23
- TransformationFormats["WSDL"] = "Wsdl";
24
- TransformationFormats["SWAGGER10"] = "Swagger10";
25
- TransformationFormats["SWAGGER20"] = "Swagger20";
26
- TransformationFormats["SWAGGERYAML"] = "Swaggeryaml";
27
- TransformationFormats["OAS3"] = "Oas3";
28
- TransformationFormats["OPENAPI3YAML"] = "Openapi3Yaml";
29
- TransformationFormats["APIBLUEPRINT"] = "Apiblueprint";
30
- TransformationFormats["RAML"] = "Raml";
31
- TransformationFormats["RAML10"] = "Raml10";
32
- TransformationFormats["POSTMAN10"] = "Postman10";
33
- TransformationFormats["POSTMAN20"] = "Postman20";
34
- TransformationFormats["GRAPHQLSCHEMA"] = "Graphqlschema";
35
- })(TransformationFormats || (exports.TransformationFormats = TransformationFormats = {}));
36
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3R5cGVzL2FwaS90cmFuc2Zvcm0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBa0JhLFFBQUEsa0JBQWtCLEdBQUc7SUFDaEMsWUFBWSxFQUFFLE1BQU07SUFDcEIsWUFBWSxFQUFFLE1BQU07SUFDcEIsUUFBUSxFQUFFLE1BQU07SUFDaEIsUUFBUSxFQUFFLEtBQUs7SUFDZixJQUFJLEVBQUUsS0FBSztJQUNYLFNBQVMsRUFBRSxNQUFNO0lBQ2pCLFNBQVMsRUFBRSxNQUFNO0lBQ2pCLFdBQVcsRUFBRSxNQUFNO0lBQ25CLElBQUksRUFBRSxNQUFNO0lBQ1osTUFBTSxFQUFFLE1BQU07SUFDZCxTQUFTLEVBQUUsTUFBTTtJQUNqQixTQUFTLEVBQUUsTUFBTTtJQUNqQixhQUFhLEVBQUUsTUFBTTtDQUN0QixDQUFDO0FBRUYsSUFBWSxxQkFlWDtBQWZELFdBQVkscUJBQXFCO0lBQy9CLDhDQUFxQixDQUFBO0lBQ3JCLDhDQUFxQixDQUFBO0lBQ3JCLHNDQUFhLENBQUE7SUFDYixnREFBdUIsQ0FBQTtJQUN2QixnREFBdUIsQ0FBQTtJQUN2QixvREFBMkIsQ0FBQTtJQUMzQixzQ0FBYSxDQUFBO0lBQ2Isc0RBQTZCLENBQUE7SUFDN0Isc0RBQTZCLENBQUE7SUFDN0Isc0NBQWEsQ0FBQTtJQUNiLDBDQUFpQixDQUFBO0lBQ2pCLGdEQUF1QixDQUFBO0lBQ3ZCLGdEQUF1QixDQUFBO0lBQ3ZCLHdEQUErQixDQUFBO0FBQ2pDLENBQUMsRUFmVyxxQkFBcUIscUNBQXJCLHFCQUFxQixRQWVoQyJ9
18
+ TransformationFormats["apimatic"] = "Apimatic";
19
+ TransformationFormats["wadl2009"] = "Wadl2009";
20
+ TransformationFormats["wsdl"] = "Wsdl";
21
+ TransformationFormats["swagger10"] = "Swagger10";
22
+ TransformationFormats["swagger20"] = "Swagger20";
23
+ TransformationFormats["swaggeryaml"] = "Swaggeryaml";
24
+ TransformationFormats["oas3"] = "Oas3";
25
+ TransformationFormats["openapi3yaml"] = "Openapi3Yaml";
26
+ TransformationFormats["apiblueprint"] = "Apiblueprint";
27
+ TransformationFormats["raml"] = "Raml";
28
+ TransformationFormats["raml10"] = "Raml10";
29
+ TransformationFormats["postman10"] = "Postman10";
30
+ TransformationFormats["postman20"] = "Postman20";
31
+ TransformationFormats["graphqlschema"] = "Graphqlschema";
32
+ })(TransformationFormats || (TransformationFormats = {}));
33
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform.js","sourceRoot":"","sources":["../../../src/types/api/transform.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY,EAAE,MAAM;IACpB,YAAY,EAAE,MAAM;IACpB,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;CACtB,CAAC;AAEF,MAAM,CAAN,IAAY,qBAeX;AAfD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,8CAAqB,CAAA;IACrB,sCAAa,CAAA;IACb,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,oDAA2B,CAAA;IAC3B,sCAAa,CAAA;IACb,sDAA6B,CAAA;IAC7B,sDAA6B,CAAA;IAC7B,sCAAa,CAAA;IACb,0CAAiB,CAAA;IACjB,gDAAuB,CAAA;IACvB,gDAAuB,CAAA;IACvB,wDAA+B,CAAA;AACjC,CAAC,EAfW,qBAAqB,KAArB,qBAAqB,QAehC"}
@@ -0,0 +1,22 @@
1
+ import { DirectoryPath } from "../file/directoryPath.js";
2
+ export interface BuildConfig {
3
+ generatePortal?: PortalConfig;
4
+ apiCopilotConfig?: CopilotConfig;
5
+ [key: string]: unknown;
6
+ }
7
+ export interface PortalConfig {
8
+ contentFolder?: string;
9
+ languageConfig: {
10
+ [key: string]: object;
11
+ };
12
+ [key: string]: unknown;
13
+ apiSpecPath?: DirectoryPath;
14
+ }
15
+ export interface CopilotConfig {
16
+ isEnabled: boolean;
17
+ key: string;
18
+ welcomeMessage: string;
19
+ }
20
+ export declare function getLanguagesConfig(selectedLanguages: string[]): {
21
+ [key: string]: object;
22
+ };
@@ -0,0 +1,7 @@
1
+ export function getLanguagesConfig(selectedLanguages) {
2
+ return selectedLanguages.reduce((config, lang) => {
3
+ config[lang] = {};
4
+ return config;
5
+ }, {});
6
+ }
7
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../../src/types/build/build.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,kBAAkB,CAAC,iBAA2B;IAC5D,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;QAC/C,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAClB,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAA+B,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { DirectoryPath } from "./file/directoryPath.js";
2
+ import { BuildConfig } from "./build/build.js";
3
+ export declare class BuildContext {
4
+ private readonly fileService;
5
+ private readonly buildDirectory;
6
+ constructor(buildDirectory: DirectoryPath);
7
+ private get buildFile();
8
+ validate(): Promise<boolean>;
9
+ exists(): Promise<boolean>;
10
+ getBuildFileContents(): Promise<BuildConfig>;
11
+ updateBuildFileContents(buildJson: BuildConfig): Promise<void>;
12
+ deleteWorkflowDir(): Promise<void>;
13
+ }
@@ -0,0 +1,33 @@
1
+ import { FileService } from "../infrastructure/file-service.js";
2
+ import { FilePath } from "./file/filePath.js";
3
+ import { FileName } from "./file/fileName.js";
4
+ export class BuildContext {
5
+ constructor(buildDirectory) {
6
+ this.fileService = new FileService();
7
+ this.buildDirectory = buildDirectory;
8
+ }
9
+ get buildFile() {
10
+ // TODO: add checks for build file path
11
+ return new FilePath(this.buildDirectory, new FileName("APIMATIC-BUILD.json"));
12
+ }
13
+ async validate() {
14
+ // TODO: add more checks here
15
+ if (!(await this.fileService.directoryExists(this.buildDirectory)))
16
+ return false;
17
+ return await this.fileService.fileExists(this.buildFile);
18
+ }
19
+ async exists() {
20
+ return !(await this.fileService.directoryEmpty(this.buildDirectory));
21
+ }
22
+ async getBuildFileContents() {
23
+ const buildFileContent = await this.fileService.getContents(this.buildFile);
24
+ return JSON.parse(buildFileContent);
25
+ }
26
+ async updateBuildFileContents(buildJson) {
27
+ await this.fileService.writeContents(this.buildFile, JSON.stringify(buildJson, null, 2));
28
+ }
29
+ async deleteWorkflowDir() {
30
+ await this.fileService.deleteDirectory(this.buildDirectory.join(".github"));
31
+ }
32
+ }
33
+ //# sourceMappingURL=build-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-context.js","sourceRoot":"","sources":["../../src/types/build-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,MAAM,OAAO,YAAY;IAIvB,YAAY,cAA6B;QAHxB,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAI/C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,IAAY,SAAS;QACnB,uCAAuC;QACvC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,QAAQ,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAChF,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,6BAA6B;QAC7B,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;QAEjF,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IACvE,CAAC;IAEM,KAAK,CAAC,oBAAoB;QAC/B,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5E,OAAO,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAgB,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,uBAAuB,CAAC,SAAsB;QACzD,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3F,CAAC;IAEM,KAAK,CAAC,iBAAiB;QAC5B,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9E,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ export interface CommandMetadata {
2
+ readonly commandName: string;
3
+ readonly shell: string;
4
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=command-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-metadata.js","sourceRoot":"","sources":["../../../src/types/common/command-metadata.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export declare abstract class DomainEvent {
2
+ protected abstract readonly eventName: string;
3
+ private readonly message;
4
+ private readonly commandName;
5
+ private readonly flags;
6
+ protected constructor(message: string, commandName: string, flags: Record<string, unknown>);
7
+ private extractFlagKeys;
8
+ }