@apimatic/cli 1.1.0-alpha.20 → 1.1.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/README.md +119 -91
  2. package/lib/actions/action-result.d.ts +8 -3
  3. package/lib/actions/action-result.js +34 -15
  4. package/lib/actions/action-result.js.map +1 -1
  5. package/lib/actions/api/transform.d.ts +15 -0
  6. package/lib/actions/api/transform.js +48 -0
  7. package/lib/actions/api/transform.js.map +1 -0
  8. package/lib/actions/api/validate.d.ts +12 -0
  9. package/lib/actions/api/validate.js +41 -0
  10. package/lib/actions/api/validate.js.map +1 -0
  11. package/lib/actions/auth/login.d.ts +6 -5
  12. package/lib/actions/auth/login.js +25 -33
  13. package/lib/actions/auth/login.js.map +1 -1
  14. package/lib/actions/auth/logout.d.ts +8 -0
  15. package/lib/actions/auth/logout.js +15 -0
  16. package/lib/actions/auth/logout.js.map +1 -0
  17. package/lib/actions/auth/status.d.ts +11 -0
  18. package/lib/actions/auth/status.js +26 -0
  19. package/lib/actions/auth/status.js.map +1 -0
  20. package/lib/actions/portal/copilot.d.ts +7 -2
  21. package/lib/actions/portal/copilot.js +72 -32
  22. package/lib/actions/portal/copilot.js.map +1 -1
  23. package/lib/actions/portal/generate.d.ts +5 -5
  24. package/lib/actions/portal/generate.js +33 -35
  25. package/lib/actions/portal/generate.js.map +1 -1
  26. package/lib/actions/portal/quickstart.d.ts +16 -0
  27. package/lib/actions/portal/quickstart.js +145 -0
  28. package/lib/actions/portal/quickstart.js.map +1 -0
  29. package/lib/actions/portal/recipe/new-recipe.d.ts +11 -20
  30. package/lib/actions/portal/recipe/new-recipe.js +147 -221
  31. package/lib/actions/portal/recipe/new-recipe.js.map +1 -1
  32. package/lib/actions/portal/serve.d.ts +12 -10
  33. package/lib/actions/portal/serve.js +112 -17
  34. package/lib/actions/portal/serve.js.map +1 -1
  35. package/lib/actions/portal/toc/new-toc.d.ts +16 -15
  36. package/lib/actions/portal/toc/new-toc.js +80 -116
  37. package/lib/actions/portal/toc/new-toc.js.map +1 -1
  38. package/lib/actions/sdk/generate.d.ts +5 -6
  39. package/lib/actions/sdk/generate.js +22 -47
  40. package/lib/actions/sdk/generate.js.map +1 -1
  41. package/lib/application/portal/recipe/portal-recipe.d.ts +2 -2
  42. package/lib/application/portal/recipe/portal-recipe.js +9 -9
  43. package/lib/application/portal/recipe/portal-recipe.js.map +1 -1
  44. package/lib/application/portal/recipe/recipe-generator.d.ts +7 -2
  45. package/lib/application/portal/recipe/recipe-generator.js +21 -22
  46. package/lib/application/portal/recipe/recipe-generator.js.map +1 -1
  47. package/lib/client-utils/auth-manager.d.ts +1 -1
  48. package/lib/client-utils/auth-manager.js +3 -4
  49. package/lib/client-utils/auth-manager.js.map +1 -1
  50. package/lib/commands/api/transform.d.ts +6 -3
  51. package/lib/commands/api/transform.js +43 -91
  52. package/lib/commands/api/transform.js.map +1 -1
  53. package/lib/commands/api/validate.d.ts +6 -3
  54. package/lib/commands/api/validate.js +27 -60
  55. package/lib/commands/api/validate.js.map +1 -1
  56. package/lib/commands/auth/login.d.ts +2 -1
  57. package/lib/commands/auth/login.js +15 -9
  58. package/lib/commands/auth/login.js.map +1 -1
  59. package/lib/commands/auth/logout.d.ts +3 -1
  60. package/lib/commands/auth/logout.js +12 -13
  61. package/lib/commands/auth/logout.js.map +1 -1
  62. package/lib/commands/auth/status.d.ts +1 -0
  63. package/lib/commands/auth/status.js +13 -11
  64. package/lib/commands/auth/status.js.map +1 -1
  65. package/lib/commands/portal/copilot.d.ts +3 -2
  66. package/lib/commands/portal/copilot.js +23 -21
  67. package/lib/commands/portal/copilot.js.map +1 -1
  68. package/lib/commands/portal/generate.d.ts +3 -4
  69. package/lib/commands/portal/generate.js +18 -13
  70. package/lib/commands/portal/generate.js.map +1 -1
  71. package/lib/commands/portal/quickstart.d.ts +3 -4
  72. package/lib/commands/portal/quickstart.js +27 -95
  73. package/lib/commands/portal/quickstart.js.map +1 -1
  74. package/lib/commands/portal/recipe/new.d.ts +3 -1
  75. package/lib/commands/portal/recipe/new.js +31 -23
  76. package/lib/commands/portal/recipe/new.js.map +1 -1
  77. package/lib/commands/portal/serve.d.ts +5 -5
  78. package/lib/commands/portal/serve.js +31 -57
  79. package/lib/commands/portal/serve.js.map +1 -1
  80. package/lib/commands/portal/toc/new.d.ts +2 -2
  81. package/lib/commands/portal/toc/new.js +35 -26
  82. package/lib/commands/portal/toc/new.js.map +1 -1
  83. package/lib/commands/sdk/generate.d.ts +5 -4
  84. package/lib/commands/sdk/generate.js +26 -17
  85. package/lib/commands/sdk/generate.js.map +1 -1
  86. package/lib/hooks/not-found.d.ts +3 -0
  87. package/lib/hooks/not-found.js +52 -0
  88. package/lib/hooks/not-found.js.map +1 -0
  89. package/lib/hooks/utils.d.ts +5 -0
  90. package/lib/hooks/utils.js +51 -0
  91. package/lib/hooks/utils.js.map +1 -0
  92. package/lib/infrastructure/api-utils.js +3 -2
  93. package/lib/infrastructure/api-utils.js.map +1 -1
  94. package/lib/{application/portal/serve/watcher-handler.d.ts → infrastructure/debounce-service.d.ts} +3 -3
  95. package/lib/{application/portal/serve/watcher-handler.js → infrastructure/debounce-service.js} +5 -4
  96. package/lib/infrastructure/debounce-service.js.map +1 -0
  97. package/lib/infrastructure/env-info.d.ts +5 -1
  98. package/lib/infrastructure/env-info.js +23 -2
  99. package/lib/infrastructure/env-info.js.map +1 -1
  100. package/lib/infrastructure/file-service.d.ts +7 -2
  101. package/lib/infrastructure/file-service.js +49 -8
  102. package/lib/infrastructure/file-service.js.map +1 -1
  103. package/lib/infrastructure/launcher-service.d.ts +7 -0
  104. package/lib/infrastructure/launcher-service.js +51 -0
  105. package/lib/infrastructure/launcher-service.js.map +1 -0
  106. package/lib/infrastructure/network-service.d.ts +3 -0
  107. package/lib/infrastructure/network-service.js +7 -0
  108. package/lib/infrastructure/network-service.js.map +1 -0
  109. package/lib/infrastructure/services/api-client-factory.d.ts +6 -0
  110. package/lib/infrastructure/services/api-client-factory.js +20 -0
  111. package/lib/infrastructure/services/api-client-factory.js.map +1 -0
  112. package/lib/infrastructure/services/api-service.d.ts +2 -2
  113. package/lib/infrastructure/services/api-service.js +8 -7
  114. package/lib/infrastructure/services/api-service.js.map +1 -1
  115. package/lib/infrastructure/services/auth-service.d.ts +1 -1
  116. package/lib/infrastructure/services/auth-service.js +10 -6
  117. package/lib/infrastructure/services/auth-service.js.map +1 -1
  118. package/lib/infrastructure/services/file-download-service.d.ts +15 -0
  119. package/lib/infrastructure/services/file-download-service.js +104 -0
  120. package/lib/infrastructure/services/file-download-service.js.map +1 -0
  121. package/lib/infrastructure/services/portal-service.d.ts +12 -11
  122. package/lib/infrastructure/services/portal-service.js +77 -83
  123. package/lib/infrastructure/services/portal-service.js.map +1 -1
  124. package/lib/infrastructure/services/telemetry-service.d.ts +3 -2
  125. package/lib/infrastructure/services/telemetry-service.js +4 -6
  126. package/lib/infrastructure/services/telemetry-service.js.map +1 -1
  127. package/lib/infrastructure/services/transformation-service.d.ts +23 -0
  128. package/lib/infrastructure/services/transformation-service.js +56 -0
  129. package/lib/infrastructure/services/transformation-service.js.map +1 -0
  130. package/lib/infrastructure/services/validation-service.d.ts +17 -0
  131. package/lib/infrastructure/services/validation-service.js +49 -0
  132. package/lib/infrastructure/services/validation-service.js.map +1 -0
  133. package/lib/prompts/api/transform.d.ts +11 -0
  134. package/lib/prompts/api/transform.js +30 -0
  135. package/lib/prompts/api/transform.js.map +1 -0
  136. package/lib/prompts/api/validate.d.ts +12 -0
  137. package/lib/prompts/api/validate.js +41 -0
  138. package/lib/prompts/api/validate.js.map +1 -0
  139. package/lib/prompts/auth/login.d.ts +6 -1
  140. package/lib/prompts/auth/login.js +12 -3
  141. package/lib/prompts/auth/login.js.map +1 -1
  142. package/lib/prompts/auth/logout.d.ts +3 -0
  143. package/lib/prompts/auth/logout.js +7 -0
  144. package/lib/prompts/auth/logout.js.map +1 -0
  145. package/lib/prompts/auth/status.d.ts +8 -0
  146. package/lib/prompts/auth/status.js +21 -0
  147. package/lib/prompts/auth/status.js.map +1 -0
  148. package/lib/prompts/format.d.ts +33 -0
  149. package/lib/prompts/format.js +99 -0
  150. package/lib/prompts/format.js.map +1 -0
  151. package/lib/prompts/portal/copilot.d.ts +15 -5
  152. package/lib/prompts/portal/copilot.js +49 -21
  153. package/lib/prompts/portal/copilot.js.map +1 -1
  154. package/lib/prompts/portal/generate.d.ts +9 -7
  155. package/lib/prompts/portal/generate.js +22 -23
  156. package/lib/prompts/portal/generate.js.map +1 -1
  157. package/lib/prompts/portal/quickstart.d.ts +30 -29
  158. package/lib/prompts/portal/quickstart.js +99 -193
  159. package/lib/prompts/portal/quickstart.js.map +1 -1
  160. package/lib/prompts/portal/recipe/new-recipe.d.ts +23 -18
  161. package/lib/prompts/portal/recipe/new-recipe.js +70 -108
  162. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -1
  163. package/lib/prompts/portal/serve.d.ts +10 -3
  164. package/lib/prompts/portal/serve.js +30 -11
  165. package/lib/prompts/portal/serve.js.map +1 -1
  166. package/lib/prompts/portal/toc/new-toc.d.ts +12 -8
  167. package/lib/prompts/portal/toc/new-toc.js +20 -22
  168. package/lib/prompts/portal/toc/new-toc.js.map +1 -1
  169. package/lib/prompts/sdk/generate.d.ts +7 -7
  170. package/lib/prompts/sdk/generate.js +17 -23
  171. package/lib/prompts/sdk/generate.js.map +1 -1
  172. package/lib/types/api/account.d.ts +1 -1
  173. package/lib/types/api/transform.d.ts +14 -25
  174. package/lib/types/api/transform.js +16 -16
  175. package/lib/types/api/transform.js.map +1 -1
  176. package/lib/types/build/build.d.ts +9 -1
  177. package/lib/types/build/build.js +5 -2
  178. package/lib/types/build/build.js.map +1 -1
  179. package/lib/types/build-context.d.ts +5 -1
  180. package/lib/types/build-context.js +21 -4
  181. package/lib/types/build-context.js.map +1 -1
  182. package/lib/types/common/command-metadata.d.ts +4 -0
  183. package/lib/types/common/command-metadata.js +2 -0
  184. package/lib/types/common/command-metadata.js.map +1 -0
  185. package/lib/types/events/domain-event.d.ts +1 -1
  186. package/lib/types/events/domain-event.js.map +1 -1
  187. package/lib/types/events/quickstart-completed.d.ts +7 -0
  188. package/lib/types/events/quickstart-completed.js +10 -0
  189. package/lib/types/events/quickstart-completed.js.map +1 -0
  190. package/lib/types/events/quickstart-initiated.d.ts +7 -0
  191. package/lib/types/events/quickstart-initiated.js +10 -0
  192. package/lib/types/events/quickstart-initiated.js.map +1 -0
  193. package/lib/types/events/recipe-creation-failed.d.ts +1 -1
  194. package/lib/types/events/recipe-creation-failed.js +1 -1
  195. package/lib/types/events/recipe-creation-failed.js.map +1 -1
  196. package/lib/types/events/toc-creation-failed.d.ts +1 -1
  197. package/lib/types/events/toc-creation-failed.js +1 -1
  198. package/lib/types/events/toc-creation-failed.js.map +1 -1
  199. package/lib/types/file/directory.d.ts +17 -0
  200. package/lib/types/file/directory.js +86 -0
  201. package/lib/types/file/directory.js.map +1 -0
  202. package/lib/types/file/directoryPath.d.ts +3 -1
  203. package/lib/types/file/directoryPath.js +8 -2
  204. package/lib/types/file/directoryPath.js.map +1 -1
  205. package/lib/types/file/fileName.d.ts +3 -1
  206. package/lib/types/file/fileName.js +14 -2
  207. package/lib/types/file/fileName.js.map +1 -1
  208. package/lib/types/file/filePath.d.ts +2 -0
  209. package/lib/types/file/filePath.js +21 -0
  210. package/lib/types/file/filePath.js.map +1 -1
  211. package/lib/types/file/resource-input.d.ts +5 -0
  212. package/lib/types/file/resource-input.js +42 -0
  213. package/lib/types/file/resource-input.js.map +1 -0
  214. package/lib/types/file/urlPath.d.ts +6 -0
  215. package/lib/types/file/urlPath.js +22 -0
  216. package/lib/types/file/urlPath.js.map +1 -0
  217. package/lib/types/portal-context.d.ts +3 -1
  218. package/lib/types/portal-context.js +10 -0
  219. package/lib/types/portal-context.js.map +1 -1
  220. package/lib/types/recipe/recipe.d.ts +2 -17
  221. package/lib/types/recipe-context.d.ts +8 -0
  222. package/lib/types/recipe-context.js +21 -0
  223. package/lib/types/recipe-context.js.map +1 -0
  224. package/lib/types/resource-context.d.ts +12 -0
  225. package/lib/types/resource-context.js +30 -0
  226. package/lib/types/resource-context.js.map +1 -0
  227. package/lib/types/sdk/generate.d.ts +2 -15
  228. package/lib/types/sdk/generate.js +24 -10
  229. package/lib/types/sdk/generate.js.map +1 -1
  230. package/lib/types/sdk-context.d.ts +6 -5
  231. package/lib/types/sdk-context.js +12 -8
  232. package/lib/types/sdk-context.js.map +1 -1
  233. package/lib/types/sdl/sdl.d.ts +9 -0
  234. package/lib/types/sdl/sdl.js +46 -1
  235. package/lib/types/sdl/sdl.js.map +1 -1
  236. package/lib/types/spec-context.d.ts +3 -0
  237. package/lib/types/spec-context.js +7 -2
  238. package/lib/types/spec-context.js.map +1 -1
  239. package/lib/types/temp-context.d.ts +11 -0
  240. package/lib/types/temp-context.js +27 -0
  241. package/lib/types/temp-context.js.map +1 -0
  242. package/lib/types/toc-context.d.ts +12 -0
  243. package/lib/types/toc-context.js +26 -0
  244. package/lib/types/toc-context.js.map +1 -0
  245. package/lib/types/transform-context.d.ts +13 -0
  246. package/lib/types/transform-context.js +30 -0
  247. package/lib/types/transform-context.js.map +1 -0
  248. package/lib/types/utils.d.ts +0 -9
  249. package/lib/utils/string-utils.d.ts +1 -0
  250. package/lib/utils/string-utils.js +10 -0
  251. package/lib/utils/string-utils.js.map +1 -0
  252. package/lib/utils/utils.d.ts +2 -27
  253. package/lib/utils/utils.js +6 -145
  254. package/lib/utils/utils.js.map +1 -1
  255. package/package.json +11 -10
  256. package/lib/application/portal/serve/portal-watcher.d.ts +0 -11
  257. package/lib/application/portal/serve/portal-watcher.js +0 -64
  258. package/lib/application/portal/serve/portal-watcher.js.map +0 -1
  259. package/lib/application/portal/serve/serve-handler.d.ts +0 -16
  260. package/lib/application/portal/serve/serve-handler.js +0 -91
  261. package/lib/application/portal/serve/serve-handler.js.map +0 -1
  262. package/lib/application/portal/serve/watcher-handler.js.map +0 -1
  263. package/lib/application/portal/toc/sdl-parser.d.ts +0 -19
  264. package/lib/application/portal/toc/sdl-parser.js +0 -90
  265. package/lib/application/portal/toc/sdl-parser.js.map +0 -1
  266. package/lib/client-utils/sdk-client.d.ts +0 -22
  267. package/lib/client-utils/sdk-client.js +0 -89
  268. package/lib/client-utils/sdk-client.js.map +0 -1
  269. package/lib/config/env.d.ts +0 -26
  270. package/lib/config/env.js +0 -27
  271. package/lib/config/env.js.map +0 -1
  272. package/lib/controllers/api/transform.d.ts +0 -5
  273. package/lib/controllers/api/transform.js +0 -50
  274. package/lib/controllers/api/transform.js.map +0 -1
  275. package/lib/controllers/api/validate.d.ts +0 -3
  276. package/lib/controllers/api/validate.js +0 -29
  277. package/lib/controllers/api/validate.js.map +0 -1
  278. package/lib/controllers/portal/quickstart.d.ts +0 -15
  279. package/lib/controllers/portal/quickstart.js +0 -217
  280. package/lib/controllers/portal/quickstart.js.map +0 -1
  281. package/lib/prompts/portal/common/base-prompts.d.ts +0 -7
  282. package/lib/prompts/portal/common/base-prompts.js +0 -19
  283. package/lib/prompts/portal/common/base-prompts.js.map +0 -1
  284. package/lib/types/api/validate.d.ts +0 -12
  285. package/lib/types/api/validate.js +0 -2
  286. package/lib/types/api/validate.js.map +0 -1
  287. package/lib/types/common/result.d.ts +0 -17
  288. package/lib/types/common/result.js +0 -32
  289. package/lib/types/common/result.js.map +0 -1
  290. package/lib/types/portal/generate.d.ts +0 -13
  291. package/lib/types/portal/generate.js +0 -3
  292. package/lib/types/portal/generate.js.map +0 -1
  293. package/lib/types/portal/quickstart.d.ts +0 -17
  294. package/lib/types/portal/quickstart.js +0 -2
  295. package/lib/types/portal/quickstart.js.map +0 -1
  296. package/lib/types/portal/serve.d.ts +0 -12
  297. package/lib/types/portal/serve.js +0 -2
  298. package/lib/types/portal/serve.js.map +0 -1
  299. package/lib/validators/common/directoryValidator.d.ts +0 -5
  300. package/lib/validators/common/directoryValidator.js +0 -22
  301. package/lib/validators/common/directoryValidator.js.map +0 -1
  302. package/lib/validators/portal/serve-validator.d.ts +0 -6
  303. package/lib/validators/portal/serve-validator.js +0 -15
  304. package/lib/validators/portal/serve-validator.js.map +0 -1
@@ -0,0 +1,41 @@
1
+ import { log } from "@clack/prompts";
2
+ import { replaceHTML } from "../../utils/utils.js";
3
+ import { withSpinner } from "../format.js";
4
+ import { getErrorMessage } from "../../infrastructure/api-utils.js";
5
+ import { format as f } from "../format.js";
6
+ export class ApiValidatePrompts {
7
+ async validateApi(fn) {
8
+ return withSpinner("Validating API", "API validation completed", "API validation failed", fn);
9
+ }
10
+ displayValidationMessages({ warnings, errors, messages }) {
11
+ if (messages.length > 0) {
12
+ log.info("Messages");
13
+ messages.forEach((msg) => {
14
+ log.message(`${replaceHTML(msg)}`);
15
+ });
16
+ }
17
+ if (warnings.length > 0) {
18
+ log.warning("Warnings");
19
+ warnings.forEach((war) => {
20
+ log.message(`${replaceHTML(war)}`);
21
+ });
22
+ }
23
+ if (errors.length > 0) {
24
+ log.error("Errors");
25
+ errors.forEach((err) => {
26
+ log.message(`${replaceHTML(err)}`);
27
+ });
28
+ }
29
+ }
30
+ logValidationError(error) {
31
+ log.error(error);
32
+ }
33
+ networkError(serviceError) {
34
+ const message = getErrorMessage(serviceError);
35
+ log.error(message);
36
+ }
37
+ transformedApiSaved(filePath) {
38
+ log.info(`Transformed API has been saved to ${f.path(filePath)}.`);
39
+ }
40
+ }
41
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/prompts/api/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAgB,MAAM,mCAAmC,CAAC;AAElF,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,cAAc,CAAC;AAE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CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,mBAAmB,CAAC,QAAkB;QAC3C,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACrE,CAAC;CACF"}
@@ -1,5 +1,10 @@
1
+ import { ServiceError } from "../../infrastructure/api-utils.js";
2
+ import { SubscriptionInfo } from "../../types/api/account.js";
3
+ import { Result } from "neverthrow";
1
4
  export declare class LoginPrompts {
2
- logError(error: string): void;
3
5
  loginSuccessful(email: string): void;
4
6
  openBrowser(): void;
7
+ invalidKeyProvided(serviceError: ServiceError): void;
8
+ loginTimeout(): void;
9
+ accountInfoSpinner(fn: Promise<Result<SubscriptionInfo, ServiceError>>): Promise<Result<SubscriptionInfo, ServiceError>>;
5
10
  }
@@ -1,13 +1,22 @@
1
1
  import { log } from "@clack/prompts";
2
+ import { getErrorMessage } from "../../infrastructure/api-utils.js";
3
+ import { withSpinner } from "../format.js";
2
4
  export class LoginPrompts {
3
- logError(error) {
4
- log.error(error);
5
- }
6
5
  loginSuccessful(email) {
7
6
  log.success(`Successfully logged in as ${email}`);
8
7
  }
9
8
  openBrowser() {
10
9
  log.info("Please continue with authentication in the opened browser window.");
11
10
  }
11
+ invalidKeyProvided(serviceError) {
12
+ const message = serviceError === "NETWORK_ERROR" /* ServiceError.NetworkError */ ? "Invalid API key provided." : getErrorMessage(serviceError);
13
+ log.error(message);
14
+ }
15
+ loginTimeout() {
16
+ log.error("Authentication timed out. Please try again.");
17
+ }
18
+ accountInfoSpinner(fn) {
19
+ return withSpinner("Retrieving your subscription info", "Retrieved subscription info", "Error retrieving subscription info", fn);
20
+ }
12
21
  }
13
22
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/prompts/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAErC,MAAM,OAAO,YAAY;IACvB,QAAQ,CAAC,KAAa;QACpB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,eAAe,CAAC,KAAa;QAC3B,GAAG,CAAC,OAAO,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,WAAW;QACT,GAAG,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IAChF,CAAC;CACF"}
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/prompts/auth/login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,eAAe,EAAgB,MAAM,mCAAmC,CAAC;AAGlF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,OAAO,YAAY;IAChB,eAAe,CAAC,KAAa;QAClC,GAAG,CAAC,OAAO,CAAC,6BAA6B,KAAK,EAAE,CAAC,CAAC;IACpD,CAAC;IAEM,WAAW;QAChB,GAAG,CAAC,IAAI,CAAC,mEAAmE,CAAC,CAAC;IAChF,CAAC;IAEM,kBAAkB,CAAC,YAA0B;QAClD,MAAM,OAAO,GACX,YAAY,oDAA8B,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAC3G,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,YAAY;QACjB,GAAG,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC3D,CAAC;IAEM,kBAAkB,CAAC,EAAmD;QAC3E,OAAO,WAAW,CAChB,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,EAAE,CACH,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export declare class LogoutPrompts {
2
+ removeAuthInfo(): void;
3
+ }
@@ -0,0 +1,7 @@
1
+ import { log } from "@clack/prompts";
2
+ export class LogoutPrompts {
3
+ removeAuthInfo() {
4
+ log.info("Logged out successfully.");
5
+ }
6
+ }
7
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/prompts/auth/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGrC,MAAM,OAAO,aAAa;IAEjB,cAAc;QACnB,GAAG,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { Result } from "neverthrow";
2
+ import { SubscriptionInfo } from "../../types/api/account.js";
3
+ import { ServiceError } from "../../infrastructure/api-utils.js";
4
+ export declare class StatusPrompts {
5
+ accountInfoSpinner(fn: Promise<Result<SubscriptionInfo, ServiceError>>): Promise<Result<SubscriptionInfo, ServiceError>>;
6
+ invalidKeyProvided(serviceError: ServiceError): void;
7
+ showAccountInfo(info: SubscriptionInfo): void;
8
+ }
@@ -0,0 +1,21 @@
1
+ import { getErrorMessage } from "../../infrastructure/api-utils.js";
2
+ import { format, withSpinner } from "../format.js";
3
+ import { log } from "@clack/prompts";
4
+ import { mapLanguages } from "../../types/sdk/generate.js";
5
+ export class StatusPrompts {
6
+ accountInfoSpinner(fn) {
7
+ return withSpinner("Retrieving your subscription info", "Retrieved subscription info", "Error retrieving subscription info", fn);
8
+ }
9
+ invalidKeyProvided(serviceError) {
10
+ const message = serviceError === "UNAUTHORIZED" /* ServiceError.UnAuthorized */ ? "Invalid API key provided." : getErrorMessage(serviceError);
11
+ log.error(message);
12
+ }
13
+ showAccountInfo(info) {
14
+ const languages = mapLanguages(info.allowedLanguages);
15
+ const message = `Account Information:
16
+ Email: ${format.var(info.Email)}
17
+ Allowed Languages: ${languages.map((language) => format.var(language)).join(", ")}`;
18
+ log.info(`${message}`);
19
+ }
20
+ }
21
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/prompts/auth/status.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAgB,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,OAAO,aAAa;IACjB,kBAAkB,CAAC,EAAmD;QAC3E,OAAO,WAAW,CAChB,mCAAmC,EACnC,6BAA6B,EAC7B,oCAAoC,EACpC,EAAE,CACH,CAAC;IACJ,CAAC;IAEM,kBAAkB,CAAC,YAA0B;QAClD,MAAM,OAAO,GACX,YAAY,mDAA8B,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;QAC3G,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,eAAe,CAAC,IAAsB;QAC3C,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACtD,MAAM,OAAO,GAAG;WACT,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;uBACV,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAClF,GAAG,CAAC,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ import { Result } from "neverthrow";
2
+ import { ActionResult } from "../actions/action-result.js";
3
+ import { Directory } from "../types/file/directory.js";
4
+ import { DirectoryPath } from "../types/file/directoryPath.js";
5
+ import { FilePath } from "../types/file/filePath.js";
6
+ export declare const format: {
7
+ var: (text: string) => string;
8
+ path: (text: DirectoryPath | FilePath) => string;
9
+ cmd: (cmd: string, ...args: string[]) => string;
10
+ cmdAlt: (cmd: string, ...args: string[]) => string;
11
+ link: (text: string) => string;
12
+ description: (text: string) => string;
13
+ flag: (name: string, value?: string | undefined) => string;
14
+ success: (text: string) => string;
15
+ error: (text: string) => string;
16
+ info: (text: string) => string;
17
+ intro: (text: string) => string;
18
+ outroSuccess: (text: string) => string;
19
+ outroFailure: (text: string) => string;
20
+ outroCancelled: (text: string) => string;
21
+ };
22
+ export declare function intro(text: string): void;
23
+ export declare function outro(result: ActionResult): void;
24
+ export declare function withSpinner<T, E>(intro: string, success: string, failure: string, fn: Promise<Result<T, E>>): Promise<Result<T, E>>;
25
+ export declare function getDirectoryTree(dir: Directory, prefix?: string, isLast?: boolean): string;
26
+ export interface LeafNode {
27
+ name: string;
28
+ description?: string;
29
+ }
30
+ export interface TreeNode extends LeafNode {
31
+ items: Array<TreeNode | LeafNode>;
32
+ }
33
+ export declare function getTree(dir: TreeNode, prefix?: string, isLast?: boolean): string;
@@ -0,0 +1,99 @@
1
+ import pc from "picocolors";
2
+ import { intro as i, outro as o, spinner } from '@clack/prompts';
3
+ import { Directory } from "../types/file/directory.js";
4
+ export const format = {
5
+ // Core element types
6
+ var: (text) => pc.magenta(`'${text}'`),
7
+ path: (text) => pc.cyan(`'${text}'`),
8
+ cmd: (cmd, ...args) => `${pc.blueBright(cmd)} ${args.map(arg => pc.dim(arg)).join(" ")}`,
9
+ cmdAlt: (cmd, ...args) => `${pc.blueBright(cmd)} ${args.map(arg => pc.blueBright(arg)).join(" ")}`,
10
+ link: (text) => pc.underline(pc.blueBright(text)),
11
+ description: (text) => pc.greenBright(`${text}`),
12
+ flag: (name, value = undefined) => {
13
+ if (value) {
14
+ return `${pc.green(`--${name}`)}=${pc.dim(value)}`;
15
+ }
16
+ return `${pc.green(`--${name}`)}`;
17
+ },
18
+ // Common message styles
19
+ success: (text) => pc.green(text),
20
+ error: (text) => pc.red(text),
21
+ info: (text) => pc.cyan(text),
22
+ intro: (text) => pc.bgCyan(text),
23
+ outroSuccess: (text) => pc.bgGreen(text),
24
+ outroFailure: (text) => pc.bgRed(text),
25
+ outroCancelled: (text) => pc.bgWhite(pc.blackBright(text)),
26
+ };
27
+ export function intro(text) {
28
+ i(format.intro(` ${text} `));
29
+ }
30
+ export function outro(result) {
31
+ const exitCode = result.getExitCode();
32
+ const message = result.getMessage();
33
+ const outroMessage = result.mapAll(() => format.outroSuccess(message), () => format.outroFailure(message), () => format.outroCancelled(message));
34
+ o(outroMessage);
35
+ process.exitCode = exitCode;
36
+ }
37
+ export async function withSpinner(intro, success, failure, fn) {
38
+ const s = spinner({
39
+ cancelMessage: "cancelled",
40
+ errorMessage: "failed",
41
+ frames: ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'],
42
+ });
43
+ s.start(intro);
44
+ const result = await fn;
45
+ result.match(() => s.stop(success, 0), () => s.stop(failure, 1));
46
+ return result;
47
+ }
48
+ export function getDirectoryTree(dir, prefix = "", isLast = true) {
49
+ const folderDescription = {
50
+ spec: "# Contains all API definition files",
51
+ content: "# Includes custom documentation pages in Markdown",
52
+ static: "# Includes all static files, such as images, GIFs, and PDFs"
53
+ };
54
+ const fileDescriptions = {
55
+ "toc.yml": "# Controls the structure of the side navigation bar in the API portal",
56
+ "APIMATIC-BUILD.json": "# Defines all configurations for the API portal, including programming languages and themes"
57
+ };
58
+ const pointer = isLast ? "└─ " : "├─ ";
59
+ const folderName = dir.directoryPath.leafName();
60
+ const description = folderDescription[folderName] ? format.description(folderDescription[folderName]) : "";
61
+ let output = `${prefix}${pointer}${folderName}${description ? " " + description : ""}\n`;
62
+ const items = dir.items;
63
+ const newPrefix = prefix + (isLast ? " " : "| ");
64
+ items.forEach((item, index) => {
65
+ const last = index === items.length - 1;
66
+ if (item instanceof Directory) {
67
+ output += getDirectoryTree(item, newPrefix, last);
68
+ }
69
+ else {
70
+ const filePointer = last ? "└─ " : "├─ ";
71
+ const fileName = item.toString();
72
+ const fileDescription = fileDescriptions[fileName] ? format.description(fileDescriptions[fileName]) : "";
73
+ output += `${newPrefix}${filePointer}${fileName}${fileDescription ? " " + fileDescription : ""}\n`;
74
+ }
75
+ });
76
+ return output;
77
+ }
78
+ export function getTree(dir, prefix = "", isLast = true) {
79
+ const pointer = isLast ? "└─ " : "├─ ";
80
+ const folderName = dir.name;
81
+ const description = dir.description ? format.description(dir.description) : "";
82
+ let output = `${prefix}${pointer}${folderName}${description ? " " + description : ""}\n`;
83
+ const items = dir.items;
84
+ const newPrefix = prefix + (isLast ? " " : "| ");
85
+ items.forEach((item, index) => {
86
+ const last = index === items.length - 1;
87
+ if ('items' in item) {
88
+ output += getTree(item, newPrefix, last);
89
+ }
90
+ else {
91
+ const filePointer = last ? "└─ " : "├─ ";
92
+ const fileName = item.name;
93
+ const fileDescription = item.description ? format.description(item.description) : "";
94
+ output += `${newPrefix}${filePointer}${fileName}${fileDescription ? " " + fileDescription : ""}\n`;
95
+ }
96
+ });
97
+ return output;
98
+ }
99
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/prompts/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,KAAK,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAIvD,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,qBAAqB;IACrB,GAAG,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC;IAC9C,IAAI,EAAE,CAAC,IAA8B,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC;IAC9D,GAAG,EAAE,CAAC,GAAW,EAAE,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AM,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;IAEzF,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;IACxB,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAEpD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC5B,MAAM,IAAI,GAAG,KAAK,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAExC,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,MAAM,IAAI,OAAO,CAAC,IAAgB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QACvD,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;YACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;YAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACrF,MAAM,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;QACrG,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,8 +1,18 @@
1
- import { CopilotConfig } from "../../types/build/build.js";
1
+ import { Result } from "neverthrow";
2
+ import { SubscriptionInfo } from "../../types/api/account.js";
3
+ import { ServiceError } from "../../infrastructure/api-utils.js";
4
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
5
  export declare class PortalCopilotPrompts {
3
- selectCopilotKey(keys: string[]): Promise<string>;
4
- copilotConfigured(apiCopilotConfig: CopilotConfig): void;
6
+ displayApiCopilotKeyUsageWarning(): Promise<void>;
7
+ openWelcomeMessageEditor(): void;
8
+ selectCopilotKey(keys: string[]): Promise<string | null>;
9
+ copilotConfigured(status: boolean, copilotId: string): void;
5
10
  confirmOverwrite(): Promise<boolean>;
6
- logError(error: string): void;
7
- getWelcomeMessage(): Promise<string | undefined>;
11
+ spinnerAccountInfo(fn: Promise<Result<SubscriptionInfo, ServiceError>>): Promise<Result<SubscriptionInfo, ServiceError>>;
12
+ confirmSingleKeyUsage(apiCopilotKey: string): Promise<boolean>;
13
+ srcDirectoryEmpty(directory: DirectoryPath): void;
14
+ cancelled(): void;
15
+ serviceError(serviceError: ServiceError): void;
16
+ noCopilotKeyFound(): void;
17
+ noCopilotKeySelected(): void;
8
18
  }
@@ -1,6 +1,13 @@
1
- import { select, cancel, isCancel, outro, confirm, log, text, } from "@clack/prompts";
2
- import { getMessageInCyanColor } from "../../utils/utils.js";
1
+ import { confirm, isCancel, log, note, select } from "@clack/prompts";
2
+ import { getErrorMessage } from "../../infrastructure/api-utils.js";
3
+ import { format as f, withSpinner } from "../format.js";
3
4
  export class PortalCopilotPrompts {
5
+ async displayApiCopilotKeyUsageWarning() {
6
+ log.warn("API Copilot can only be active on one Portal at a time. Configuring it on this Portal will disable it on any previously configured Portal.");
7
+ }
8
+ openWelcomeMessageEditor() {
9
+ log.step("Opening markdown editor for you to enter welcome message in...");
10
+ }
4
11
  async selectCopilotKey(keys) {
5
12
  const selectedKey = await select({
6
13
  message: "Select the ID for the API Copilot you would like to add to this API Portal:",
@@ -11,25 +18,29 @@ export class PortalCopilotPrompts {
11
18
  }))
12
19
  });
13
20
  if (isCancel(selectedKey)) {
14
- cancel("Operation cancelled.");
15
- return process.exit(0);
21
+ return null;
16
22
  }
17
23
  return selectedKey;
18
24
  }
19
- copilotConfigured(apiCopilotConfig) {
20
- outro(`API Copilot configured successfully!
25
+ copilotConfigured(status, copilotId) {
26
+ log.info(`API Copilot configured successfully!
21
27
 
22
- Copilot ID: ${getMessageInCyanColor(apiCopilotConfig.key)}
23
- Welcome Message: ${getMessageInCyanColor(apiCopilotConfig.welcomeMessage)}
24
- Status: ${getMessageInCyanColor(apiCopilotConfig.isEnabled ? "Enabled" : "Disabled")}
28
+ Copilot ID: ${f.var(copilotId)}
29
+ Status: ${f.var(status ? "Enabled" : "Disabled")}
25
30
 
26
- Configuration saved to: APIMATIC-BUILD.json
31
+ Configuration saved to: ${f.var("APIMATIC-BUILD.json")}`);
32
+ note(`API Copilot will index your content the next time you run
33
+ '${f.cmdAlt("apimatic", "portal", "generate")}' or '${f.cmdAlt("apimatic", "portal", "serve")}'.
34
+ This process can take up to 10 minutes, depending on your API’s size.
27
35
 
28
- Run 'apimatic portal:serve' to preview your API Portal and try out the API Copilot.`);
36
+ To see your copilot: If your portal is already running, refresh the page.
37
+ Otherwise, run '${f.cmdAlt("apimatic", "portal", "serve")}',
38
+ select any programming language in the Portal and
39
+ look for the chat icon in the bottom-right corner.`, `Next Steps`);
29
40
  }
30
41
  async confirmOverwrite() {
31
42
  const shouldOverwrite = await confirm({
32
- message: "API Copilot configuration already exists. Do you want to overwrite?",
43
+ message: "API Copilot is already configured for this Portal, do you want to overwrite it?",
33
44
  initialValue: false
34
45
  });
35
46
  if (isCancel(shouldOverwrite)) {
@@ -37,18 +48,35 @@ Run 'apimatic portal:serve' to preview your API Portal and try out the API Copil
37
48
  }
38
49
  return shouldOverwrite;
39
50
  }
40
- logError(error) {
41
- log.error(error);
51
+ async spinnerAccountInfo(fn) {
52
+ return withSpinner("Retrieving your subscription info", "Subscription info retrieved", "Subscription info retrieval failed", fn);
42
53
  }
43
- async getWelcomeMessage() {
44
- const welcomeMessage = await text({
45
- message: "Enter a welcome message for your API Copilot:",
46
- placeholder: "Enter your welcome message here..."
54
+ async confirmSingleKeyUsage(apiCopilotKey) {
55
+ const confirmKeyUsage = await confirm({
56
+ message: "API Copilot can only be active on one Portal at a time. Configuring it on this Portal will disable it on any previously configured Portal.\n" +
57
+ `Do you want to use this key: ${f.var(apiCopilotKey)}?`,
58
+ initialValue: true
47
59
  });
48
- if (isCancel(welcomeMessage)) {
49
- return undefined;
60
+ if (isCancel(confirmKeyUsage)) {
61
+ return false;
50
62
  }
51
- return welcomeMessage;
63
+ return confirmKeyUsage;
64
+ }
65
+ srcDirectoryEmpty(directory) {
66
+ const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
67
+ log.error(message);
68
+ }
69
+ cancelled() {
70
+ log.warning("Exiting without making any change.");
71
+ }
72
+ serviceError(serviceError) {
73
+ log.error(getErrorMessage(serviceError));
74
+ }
75
+ noCopilotKeyFound() {
76
+ log.error(`No copilot key found for the current subscription. Please contact support at ${f.var("support@apimatic.io")}.`);
77
+ }
78
+ noCopilotKeySelected() {
79
+ log.error("No API Copilot key was selected.");
52
80
  }
53
81
  }
54
82
  //# sourceMappingURL=copilot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/prompts/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,GAAI,MAAM,gBAAgB,CAAC;AAEvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,MAAM,OAAO,oBAAoB;IACxB,KAAK,CAAC,gBAAgB,CAAC,IAAc;QAC1C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC;YAC/B,OAAO,EAAE,6EAA6E;YACtF,QAAQ,EAAE,EAAE;YACZ,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAC1B,KAAK,EAAE,GAAG;gBACV,KAAK,EAAE,GAAG;aACX,CAAC,CAAC;SACJ,CAAC,CAAC;QAEH,IAAI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CAAC,GAAG,CAAC,qBAAqB,CAAC,GAAG,CAChH,CAAC;IACJ,CAAC;IAEM,oBAAoB;QACzB,GAAG,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -1,11 +1,13 @@
1
1
  import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ import { Result } from "neverthrow";
3
+ import { FilePath } from "../../types/file/filePath.js";
2
4
  export declare class PortalGeneratePrompts {
3
- private readonly spin;
4
5
  overwritePortal(directory: DirectoryPath): Promise<boolean>;
5
- displayPortalGenerationMessage(): void;
6
- displayPortalGenerationSuccessMessage(): void;
7
- displayPortalGenerationErrorMessage(): void;
8
- displayOutroMessage(generatedPortalPath: string): void;
9
- logError(error: string): void;
10
- private cleanUpStandardInput;
6
+ directoryCannotBeSame(directory: DirectoryPath): void;
7
+ srcDirectoryEmpty(directory: DirectoryPath): void;
8
+ portalDirectoryNotEmpty(): void;
9
+ generatePortal(fn: Promise<Result<NodeJS.ReadableStream, string | NodeJS.ReadableStream>>): Promise<Result<NodeJS.ReadableStream, string | NodeJS.ReadableStream>>;
10
+ portalGenerationError(error: string): void;
11
+ portalGenerationErrorWithReport(reportPath: FilePath): void;
12
+ portalGenerated(portal: DirectoryPath): void;
11
13
  }
@@ -1,12 +1,9 @@
1
- import { outro, spinner, isCancel, confirm, log } from "@clack/prompts";
2
- import { getMessageInRedColor, getMessageInMagentaColor, getMessageInCyanColor } from "../../utils/utils.js";
1
+ import { isCancel, confirm, log } from "@clack/prompts";
2
+ import { format as f, withSpinner } from "../format.js";
3
3
  export class PortalGeneratePrompts {
4
- constructor() {
5
- this.spin = spinner();
6
- }
7
4
  async overwritePortal(directory) {
8
5
  const overwrite = await confirm({
9
- message: `The destination '${directory}' is not empty, do you want to overwrite?`,
6
+ message: `The destination ${f.path(directory)} is not empty, do you want to overwrite?`,
10
7
  initialValue: false
11
8
  });
12
9
  if (isCancel(overwrite)) {
@@ -14,29 +11,31 @@ export class PortalGeneratePrompts {
14
11
  }
15
12
  return overwrite;
16
13
  }
17
- displayPortalGenerationMessage() {
18
- this.spin.start(getMessageInMagentaColor("Generating portal"));
14
+ directoryCannotBeSame(directory) {
15
+ const message = `The ${f.var("src")} and ${f.var("portal")} directories must be different. Current value: ${f.path(directory)}`;
16
+ log.error(message);
19
17
  }
20
- displayPortalGenerationSuccessMessage() {
21
- this.spin.stop(getMessageInCyanColor("Portal generated successfully."));
22
- this.cleanUpStandardInput();
18
+ srcDirectoryEmpty(directory) {
19
+ const message = `The ${f.var("src")} directory is either empty or invalid: ${f.path(directory)}`;
20
+ log.error(message);
23
21
  }
24
- displayPortalGenerationErrorMessage() {
25
- this.spin.stop(getMessageInRedColor(`Portal Generation failed.`), 1);
26
- this.cleanUpStandardInput();
22
+ portalDirectoryNotEmpty() {
23
+ const message = `Please enter a different destination folder or remove the existing files and try again.`;
24
+ log.error(message);
27
25
  }
28
- displayOutroMessage(generatedPortalPath) {
29
- outro(`The generated portal can be found at ${generatedPortalPath}`);
26
+ generatePortal(fn) {
27
+ return withSpinner("Generating portal", "Portal generated successfully.", "Portal Generation failed.", fn);
30
28
  }
31
- logError(error) {
29
+ portalGenerationError(error) {
32
30
  log.error(error);
33
31
  }
34
- //This clears the standard input to allow interrupts like CTRL+C to work properly.
35
- cleanUpStandardInput() {
36
- if (process.stdin.isTTY) {
37
- process.stdin.setRawMode(false);
38
- process.stdin.pause();
39
- }
32
+ portalGenerationErrorWithReport(reportPath) {
33
+ const message = `An error occurred during portal generation.
34
+ A report has been written at the destination path ${f.path(reportPath)}`;
35
+ log.error(message);
36
+ }
37
+ portalGenerated(portal) {
38
+ log.info(`Portal artifacts can be found at ${f.path(portal)}.`);
40
39
  }
41
40
  }
42
41
  //# sourceMappingURL=generate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/prompts/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAA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EM,cAAc,CAAC,EAA0E;QAC9F,OAAO,WAAW,CAAC,mBAAmB,EAAE,gCAAgC,EAAE,2BAA2B,EAAE,EAAE,CAAC,CAAC;IAC7G,CAAC;IAEM,qBAAqB,CAAC,KAAa;QACxC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,+BAA+B,CAAC,UAAoB;QAClD,MAAM,OAAO,GAAG;oDACgC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACrE,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,eAAe,CAAC,MAAqB;QAC1C,GAAG,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;CACF"}
@@ -1,30 +1,31 @@
1
- import { BasePrompts } from "./common/base-prompts.js";
2
- export declare class PortalQuickstartPrompts extends BasePrompts {
3
- private readonly vscodeExtensionUrl;
4
- private readonly serverUrl;
5
- private readonly referenceDocumentationUrl;
6
- private readonly customizeTheSdksUrl;
7
- private readonly defaultPortalDirectoryPath;
8
- displayWelcomeMessage(): void;
9
- loginPrompt(): Promise<{
10
- email: string;
11
- password: string;
12
- }>;
13
- removeQuotes(str: string): string;
14
- specPrompt(): Promise<string>;
15
- displaySpecValidationMessage(): void;
16
- displaySpecValidationSuccessMessage(): void;
17
- displaySpecValidationErrorMessage(): void;
18
- displaySpecValidationFailureMessage(): void;
19
- specValidationFailurePrompt(): Promise<void>;
20
- sdkLanguagesPrompt(): Promise<string[]>;
21
- workingDirectoryPrompt(): Promise<string>;
22
- displayBuildDirectoryGenerationMessage(): void;
23
- displayBuildDirectoryGenerationErrorMessage(): void;
24
- displayBuildDirectoryGenerationSuccessMessage(targetFolder: string): void;
25
- displayBuildDirectoryAsTree(targetFolder: string): void;
26
- displayOutroMessage(buildDirectory: string): void;
27
- getLoggedInFirst(): void;
28
- displayLoggedInMessage(email: string): void;
29
- logError(error: string): void;
1
+ import { Result } from "neverthrow";
2
+ import { UrlPath } from "../../types/file/urlPath.js";
3
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
4
+ import { ServiceError } from "../../infrastructure/api-utils.js";
5
+ import { Directory } from "../../types/file/directory.js";
6
+ import { ResourceInput } from "../../types/file/resource-input.js";
7
+ import { FileDownloadResponse } from "../../infrastructure/services/file-download-service.js";
8
+ export declare class PortalQuickstartPrompts {
9
+ welcomeMessage(): void;
10
+ importSpecStep(): void;
11
+ specPathPrompt(defaultSpecUrl: UrlPath): Promise<ResourceInput | undefined>;
12
+ specFileDoesNotExist(): void;
13
+ noSpecSpecified(): void;
14
+ useDefaultSpecPrompt(): Promise<boolean>;
15
+ fixYourSpec(): void;
16
+ validateSpecStep(): void;
17
+ selectLanguagesStep(): void;
18
+ selectLanguagesPrompt(): Promise<string[] | undefined>;
19
+ noLanguagesSelected(): void;
20
+ selectInputDirectoryStep(): void;
21
+ inputDirectoryPathPrompt(): Promise<DirectoryPath | undefined>;
22
+ inputDirectoryPathDoesNotExist(inputDirectory: DirectoryPath): void;
23
+ inputDirectoryNotEmpty(inputDirectory: DirectoryPath): void;
24
+ noInputDirectoryProvided(): void;
25
+ downloadBuildDirectory(fn: Promise<Result<FileDownloadResponse, ServiceError>>): Promise<Result<FileDownloadResponse, ServiceError>>;
26
+ downloadSpecFile(fn: Promise<Result<FileDownloadResponse, ServiceError>>): Promise<Result<FileDownloadResponse, ServiceError>>;
27
+ nextSteps(): void;
28
+ serviceError(error: ServiceError): void;
29
+ printDirectoryStructure(inputDirectory: DirectoryPath, directory: Directory): void;
30
+ specValidationFailed(): void;
30
31
  }