@apimatic/cli 1.1.0-alpha.2 → 1.1.0-alpha.21

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 (269) hide show
  1. package/README.md +257 -101
  2. package/bin/run.js +5 -0
  3. package/lib/actions/action-result.d.ts +8 -0
  4. package/lib/actions/action-result.js +25 -0
  5. package/lib/actions/action-result.js.map +1 -0
  6. package/lib/actions/auth/login.d.ts +12 -0
  7. package/lib/actions/auth/login.js +63 -0
  8. package/lib/actions/auth/login.js.map +1 -0
  9. package/lib/actions/portal/copilot.d.ts +14 -0
  10. package/lib/actions/portal/copilot.js +79 -0
  11. package/lib/actions/portal/copilot.js.map +1 -0
  12. package/lib/actions/portal/generate.d.ts +14 -0
  13. package/lib/actions/portal/generate.js +66 -0
  14. package/lib/actions/portal/generate.js.map +1 -0
  15. package/lib/actions/portal/recipe/new-recipe.d.ts +24 -0
  16. package/lib/actions/portal/recipe/new-recipe.js +250 -0
  17. package/lib/actions/portal/recipe/new-recipe.js.map +1 -0
  18. package/lib/actions/portal/serve.d.ts +14 -0
  19. package/lib/actions/portal/serve.js +24 -0
  20. package/lib/actions/portal/serve.js.map +1 -0
  21. package/lib/actions/portal/toc/new-toc.d.ts +20 -0
  22. package/lib/actions/portal/toc/new-toc.js +133 -0
  23. package/lib/actions/portal/toc/new-toc.js.map +1 -0
  24. package/lib/actions/sdk/generate.d.ts +14 -0
  25. package/lib/actions/sdk/generate.js +72 -0
  26. package/lib/actions/sdk/generate.js.map +1 -0
  27. package/lib/application/portal/recipe/portal-recipe.d.ts +8 -0
  28. package/lib/application/portal/recipe/portal-recipe.js +33 -0
  29. package/lib/application/portal/recipe/portal-recipe.js.map +1 -0
  30. package/lib/application/portal/recipe/recipe-generator.d.ts +16 -0
  31. package/lib/application/portal/recipe/recipe-generator.js +147 -0
  32. package/lib/application/portal/recipe/recipe-generator.js.map +1 -0
  33. package/lib/application/portal/serve/portal-watcher.d.ts +11 -0
  34. package/lib/application/portal/serve/portal-watcher.js +64 -0
  35. package/lib/application/portal/serve/portal-watcher.js.map +1 -0
  36. package/lib/application/portal/serve/serve-handler.d.ts +16 -0
  37. package/lib/application/portal/serve/serve-handler.js +91 -0
  38. package/lib/application/portal/serve/serve-handler.js.map +1 -0
  39. package/lib/application/portal/serve/watcher-handler.d.ts +10 -0
  40. package/lib/application/portal/serve/watcher-handler.js +51 -0
  41. package/lib/application/portal/serve/watcher-handler.js.map +1 -0
  42. package/lib/application/portal/toc/sdl-parser.d.ts +19 -0
  43. package/lib/application/portal/toc/sdl-parser.js +90 -0
  44. package/lib/application/portal/toc/sdl-parser.js.map +1 -0
  45. package/lib/application/portal/toc/toc-content-parser.d.ts +5 -0
  46. package/lib/application/portal/toc/toc-content-parser.js +44 -0
  47. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  48. package/lib/application/portal/toc/toc-structure-generator.d.ts +6 -0
  49. package/lib/application/portal/toc/toc-structure-generator.js +84 -0
  50. package/lib/application/portal/toc/toc-structure-generator.js.map +1 -0
  51. package/lib/client-utils/auth-manager.d.ts +8 -3
  52. package/lib/client-utils/auth-manager.js +23 -10
  53. package/lib/client-utils/auth-manager.js.map +1 -0
  54. package/lib/client-utils/sdk-client.d.ts +4 -9
  55. package/lib/client-utils/sdk-client.js +9 -87
  56. package/lib/client-utils/sdk-client.js.map +1 -0
  57. package/lib/commands/api/transform.d.ts +7 -7
  58. package/lib/commands/api/transform.js +46 -51
  59. package/lib/commands/api/transform.js.map +1 -0
  60. package/lib/commands/api/validate.d.ts +4 -4
  61. package/lib/commands/api/validate.js +35 -36
  62. package/lib/commands/api/validate.js.map +1 -0
  63. package/lib/commands/auth/login.d.ts +3 -2
  64. package/lib/commands/auth/login.js +22 -53
  65. package/lib/commands/auth/login.js.map +1 -0
  66. package/lib/commands/auth/logout.d.ts +1 -1
  67. package/lib/commands/auth/logout.js +8 -13
  68. package/lib/commands/auth/logout.js.map +1 -0
  69. package/lib/commands/auth/status.d.ts +1 -1
  70. package/lib/commands/auth/status.js +9 -13
  71. package/lib/commands/auth/status.js.map +1 -0
  72. package/lib/commands/portal/copilot.d.ts +13 -0
  73. package/lib/commands/portal/copilot.js +32 -0
  74. package/lib/commands/portal/copilot.js.map +1 -0
  75. package/lib/commands/portal/generate.d.ts +10 -8
  76. package/lib/commands/portal/generate.js +28 -107
  77. package/lib/commands/portal/generate.js.map +1 -0
  78. package/lib/commands/portal/quickstart.d.ts +10 -0
  79. package/lib/commands/portal/quickstart.js +114 -0
  80. package/lib/commands/portal/quickstart.js.map +1 -0
  81. package/lib/commands/portal/recipe/new.d.ts +10 -0
  82. package/lib/commands/portal/recipe/new.js +38 -0
  83. package/lib/commands/portal/recipe/new.js.map +1 -0
  84. package/lib/commands/portal/serve.d.ts +16 -0
  85. package/lib/commands/portal/serve.js +80 -0
  86. package/lib/commands/portal/serve.js.map +1 -0
  87. package/lib/commands/portal/toc/new.d.ts +14 -0
  88. package/lib/commands/portal/toc/new.js +52 -0
  89. package/lib/commands/portal/toc/new.js.map +1 -0
  90. package/lib/commands/sdk/generate.d.ts +9 -8
  91. package/lib/commands/sdk/generate.js +39 -128
  92. package/lib/commands/sdk/generate.js.map +1 -0
  93. package/lib/config/axios-config.d.ts +2 -0
  94. package/lib/config/axios-config.js +10 -0
  95. package/lib/config/axios-config.js.map +1 -0
  96. package/lib/config/env.d.ts +26 -1
  97. package/lib/config/env.js +27 -4
  98. package/lib/config/env.js.map +1 -0
  99. package/lib/controllers/api/transform.d.ts +1 -1
  100. package/lib/controllers/api/transform.js +23 -22
  101. package/lib/controllers/api/transform.js.map +1 -0
  102. package/lib/controllers/api/validate.d.ts +3 -3
  103. package/lib/controllers/api/validate.js +19 -12
  104. package/lib/controllers/api/validate.js.map +1 -0
  105. package/lib/controllers/portal/quickstart.d.ts +13 -0
  106. package/lib/controllers/portal/quickstart.js +214 -0
  107. package/lib/controllers/portal/quickstart.js.map +1 -0
  108. package/lib/hooks/not-found.d.ts +3 -0
  109. package/lib/hooks/not-found.js +52 -0
  110. package/lib/hooks/not-found.js.map +1 -0
  111. package/lib/hooks/utils.d.ts +5 -0
  112. package/lib/hooks/utils.js +51 -0
  113. package/lib/hooks/utils.js.map +1 -0
  114. package/lib/index.d.ts +1 -1
  115. package/lib/index.js +2 -4
  116. package/lib/index.js.map +1 -0
  117. package/lib/infrastructure/api-client-utils.d.ts +6 -0
  118. package/lib/infrastructure/api-client-utils.js +34 -0
  119. package/lib/infrastructure/api-client-utils.js.map +1 -0
  120. package/lib/infrastructure/api-utils.d.ts +9 -0
  121. package/lib/infrastructure/api-utils.js +33 -0
  122. package/lib/infrastructure/api-utils.js.map +1 -0
  123. package/lib/infrastructure/env-info.d.ts +12 -0
  124. package/lib/infrastructure/env-info.js +58 -0
  125. package/lib/infrastructure/env-info.js.map +1 -0
  126. package/lib/infrastructure/file-service.d.ts +18 -0
  127. package/lib/infrastructure/file-service.js +76 -0
  128. package/lib/infrastructure/file-service.js.map +1 -0
  129. package/lib/infrastructure/launcher-service.d.ts +5 -0
  130. package/lib/infrastructure/launcher-service.js +47 -0
  131. package/lib/infrastructure/launcher-service.js.map +1 -0
  132. package/lib/infrastructure/services/api-service.d.ts +10 -0
  133. package/lib/infrastructure/services/api-service.js +55 -0
  134. package/lib/infrastructure/services/api-service.js.map +1 -0
  135. package/lib/infrastructure/services/auth-service.d.ts +11 -0
  136. package/lib/infrastructure/services/auth-service.js +35 -0
  137. package/lib/infrastructure/services/auth-service.js.map +1 -0
  138. package/lib/infrastructure/services/portal-service.d.ts +23 -0
  139. package/lib/infrastructure/services/portal-service.js +186 -0
  140. package/lib/infrastructure/services/portal-service.js.map +1 -0
  141. package/lib/infrastructure/services/telemetry-service.d.ts +8 -0
  142. package/lib/infrastructure/services/telemetry-service.js +40 -0
  143. package/lib/infrastructure/services/telemetry-service.js.map +1 -0
  144. package/lib/infrastructure/tmp-extensions.d.ts +2 -0
  145. package/lib/infrastructure/tmp-extensions.js +6 -0
  146. package/lib/infrastructure/tmp-extensions.js.map +1 -0
  147. package/lib/infrastructure/zip-service.d.ts +6 -0
  148. package/lib/infrastructure/zip-service.js +39 -0
  149. package/lib/infrastructure/zip-service.js.map +1 -0
  150. package/lib/prompts/auth/login.d.ts +5 -0
  151. package/lib/prompts/auth/login.js +13 -0
  152. package/lib/prompts/auth/login.js.map +1 -0
  153. package/lib/prompts/portal/common/base-prompts.d.ts +7 -0
  154. package/lib/prompts/portal/common/base-prompts.js +19 -0
  155. package/lib/prompts/portal/common/base-prompts.js.map +1 -0
  156. package/lib/prompts/portal/copilot.d.ts +14 -0
  157. package/lib/prompts/portal/copilot.js +71 -0
  158. package/lib/prompts/portal/copilot.js.map +1 -0
  159. package/lib/prompts/portal/generate.d.ts +11 -0
  160. package/lib/prompts/portal/generate.js +42 -0
  161. package/lib/prompts/portal/generate.js.map +1 -0
  162. package/lib/prompts/portal/quickstart.d.ts +30 -0
  163. package/lib/prompts/portal/quickstart.js +240 -0
  164. package/lib/prompts/portal/quickstart.js.map +1 -0
  165. package/lib/prompts/portal/recipe/new-recipe.d.ts +24 -0
  166. package/lib/prompts/portal/recipe/new-recipe.js +203 -0
  167. package/lib/prompts/portal/recipe/new-recipe.js.map +1 -0
  168. package/lib/prompts/portal/serve.d.ts +4 -0
  169. package/lib/prompts/portal/serve.js +14 -0
  170. package/lib/prompts/portal/serve.js.map +1 -0
  171. package/lib/prompts/portal/toc/new-toc.d.ts +11 -0
  172. package/lib/prompts/portal/toc/new-toc.js +39 -0
  173. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  174. package/lib/prompts/sdk/generate.d.ts +11 -0
  175. package/lib/prompts/sdk/generate.js +42 -0
  176. package/lib/prompts/sdk/generate.js.map +1 -0
  177. package/lib/types/api/account.d.ts +10 -0
  178. package/lib/types/api/account.js +2 -0
  179. package/lib/types/api/account.js.map +1 -0
  180. package/lib/types/api/transform.d.ts +19 -4
  181. package/lib/types/api/transform.js +19 -4
  182. package/lib/types/api/transform.js.map +1 -0
  183. package/lib/types/api/validate.d.ts +3 -3
  184. package/lib/types/api/validate.js +2 -2
  185. package/lib/types/api/validate.js.map +1 -0
  186. package/lib/types/build/build.d.ts +14 -0
  187. package/lib/types/build/build.js +4 -0
  188. package/lib/types/build/build.js.map +1 -0
  189. package/lib/types/build-context.d.ts +13 -0
  190. package/lib/types/build-context.js +30 -0
  191. package/lib/types/build-context.js.map +1 -0
  192. package/lib/types/common/result.d.ts +17 -0
  193. package/lib/types/common/result.js +32 -0
  194. package/lib/types/common/result.js.map +1 -0
  195. package/lib/types/events/domain-event.d.ts +8 -0
  196. package/lib/types/events/domain-event.js +11 -0
  197. package/lib/types/events/domain-event.js.map +1 -0
  198. package/lib/types/events/quickstart-completed.d.ts +7 -0
  199. package/lib/types/events/quickstart-completed.js +10 -0
  200. package/lib/types/events/quickstart-completed.js.map +1 -0
  201. package/lib/types/events/quickstart-initiated.d.ts +7 -0
  202. package/lib/types/events/quickstart-initiated.js +10 -0
  203. package/lib/types/events/quickstart-initiated.js.map +1 -0
  204. package/lib/types/events/recipe-creation-failed.d.ts +5 -0
  205. package/lib/types/events/recipe-creation-failed.js +8 -0
  206. package/lib/types/events/recipe-creation-failed.js.map +1 -0
  207. package/lib/types/events/toc-creation-failed.d.ts +5 -0
  208. package/lib/types/events/toc-creation-failed.js +8 -0
  209. package/lib/types/events/toc-creation-failed.js.map +1 -0
  210. package/lib/types/file/directoryPath.d.ts +7 -0
  211. package/lib/types/file/directoryPath.js +16 -0
  212. package/lib/types/file/directoryPath.js.map +1 -0
  213. package/lib/types/file/fileName.d.ts +5 -0
  214. package/lib/types/file/fileName.js +9 -0
  215. package/lib/types/file/fileName.js.map +1 -0
  216. package/lib/types/file/filePath.d.ts +8 -0
  217. package/lib/types/file/filePath.js +11 -0
  218. package/lib/types/file/filePath.js.map +1 -0
  219. package/lib/types/flags-provider.d.ts +15 -0
  220. package/lib/types/flags-provider.js +34 -0
  221. package/lib/types/flags-provider.js.map +1 -0
  222. package/lib/types/portal/generate.d.ts +13 -9
  223. package/lib/types/portal/generate.js +3 -2
  224. package/lib/types/portal/generate.js.map +1 -0
  225. package/lib/types/portal/quickstart.d.ts +17 -0
  226. package/lib/types/portal/quickstart.js +2 -0
  227. package/lib/types/portal/quickstart.js.map +1 -0
  228. package/lib/types/portal/serve.d.ts +12 -0
  229. package/lib/types/portal/serve.js +2 -0
  230. package/lib/types/portal/serve.js.map +1 -0
  231. package/lib/types/portal-context.d.ts +11 -0
  232. package/lib/types/portal-context.js +28 -0
  233. package/lib/types/portal-context.js.map +1 -0
  234. package/lib/types/recipe/recipe.d.ts +37 -0
  235. package/lib/types/recipe/recipe.js +6 -0
  236. package/lib/types/recipe/recipe.js.map +1 -0
  237. package/lib/types/sdk/generate.d.ts +11 -10
  238. package/lib/types/sdk/generate.js +11 -12
  239. package/lib/types/sdk/generate.js.map +1 -0
  240. package/lib/types/sdk-context.d.ts +13 -0
  241. package/lib/types/sdk-context.js +28 -0
  242. package/lib/types/sdk-context.js.map +1 -0
  243. package/lib/types/sdl/sdl.d.ts +12 -0
  244. package/lib/types/sdl/sdl.js +2 -0
  245. package/lib/types/sdl/sdl.js.map +1 -0
  246. package/lib/types/spec-context.d.ts +7 -0
  247. package/lib/types/spec-context.js +12 -0
  248. package/lib/types/spec-context.js.map +1 -0
  249. package/lib/types/toc/toc.d.ts +31 -0
  250. package/lib/types/toc/toc.js +9 -0
  251. package/lib/types/toc/toc.js.map +1 -0
  252. package/lib/types/utils.d.ts +3 -3
  253. package/lib/types/utils.js +2 -2
  254. package/lib/types/utils.js.map +1 -0
  255. package/lib/utils/utils.d.ts +16 -7
  256. package/lib/utils/utils.js +142 -86
  257. package/lib/utils/utils.js.map +1 -0
  258. package/lib/validators/common/directoryValidator.d.ts +5 -0
  259. package/lib/validators/common/directoryValidator.js +22 -0
  260. package/lib/validators/common/directoryValidator.js.map +1 -0
  261. package/lib/validators/portal/serve-validator.d.ts +6 -0
  262. package/lib/validators/portal/serve-validator.js +15 -0
  263. package/lib/validators/portal/serve-validator.js.map +1 -0
  264. package/package.json +100 -43
  265. package/bin/run +0 -5
  266. package/lib/controllers/portal/generate.d.ts +0 -2
  267. package/lib/controllers/portal/generate.js +0 -49
  268. package/lib/controllers/sdk/generate.d.ts +0 -4
  269. package/lib/controllers/sdk/generate.js +0 -64
@@ -0,0 +1,13 @@
1
+ import { log } from "@clack/prompts";
2
+ export class LoginPrompts {
3
+ logError(error) {
4
+ log.error(error);
5
+ }
6
+ loginSuccessful(email) {
7
+ log.success(`Successfully logged in as ${email}`);
8
+ }
9
+ openBrowser() {
10
+ log.info("Please continue with authentication in the opened browser window.");
11
+ }
12
+ }
13
+ //# sourceMappingURL=login.js.map
@@ -0,0 +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"}
@@ -0,0 +1,7 @@
1
+ export declare abstract class BasePrompts {
2
+ protected readonly spin: import("@clack/prompts").SpinnerResult;
3
+ startProgressIndicator(message: string): void;
4
+ stopProgressIndicator(message: string): void;
5
+ displayInfo(message: string): void;
6
+ logError(errorMessage: string): void;
7
+ }
@@ -0,0 +1,19 @@
1
+ import { log, spinner } from "@clack/prompts";
2
+ export class BasePrompts {
3
+ constructor() {
4
+ this.spin = spinner();
5
+ }
6
+ startProgressIndicator(message) {
7
+ this.spin.start(message);
8
+ }
9
+ stopProgressIndicator(message) {
10
+ this.spin.stop(message);
11
+ }
12
+ displayInfo(message) {
13
+ log.step(message);
14
+ }
15
+ logError(errorMessage) {
16
+ log.error(errorMessage);
17
+ }
18
+ }
19
+ //# sourceMappingURL=base-prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-prompts.js","sourceRoot":"","sources":["../../../../src/prompts/portal/common/base-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,OAAgB,WAAW;IAAjC;QACuB,SAAI,GAAG,OAAO,EAAE,CAAC;IAiBxC,CAAC;IAfU,sBAAsB,CAAC,OAAe;QACzC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAEM,qBAAqB,CAAC,OAAe;QACxC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAEM,WAAW,CAAC,OAAe;QAC9B,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAEM,QAAQ,CAAC,YAAoB;QAChC,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC;CACJ"}
@@ -0,0 +1,14 @@
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 PortalCopilotPrompts {
5
+ openWelcomeMessageEditor(): void;
6
+ displayApiCopilotKeyUsageWarning(): Promise<void>;
7
+ selectCopilotKey(keys: string[]): Promise<string | null>;
8
+ copilotConfigured(status: boolean, copilotId: string): void;
9
+ confirmOverwrite(): Promise<boolean>;
10
+ logError(error: string): void;
11
+ spinnerAccountInfo(fn: () => Promise<Result<SubscriptionInfo, ServiceError>>): Promise<Result<SubscriptionInfo, ServiceError>>;
12
+ private withSpinner;
13
+ confirmSingleKeyUsage(apiCopilotKey: string): Promise<boolean>;
14
+ }
@@ -0,0 +1,71 @@
1
+ import { confirm, isCancel, log, outro, select, spinner } from "@clack/prompts";
2
+ import { getMessageInCyanColor } from "../../utils/utils.js";
3
+ export class PortalCopilotPrompts {
4
+ openWelcomeMessageEditor() {
5
+ log.step("Opening markdown editor for you to enter welcome message in...");
6
+ }
7
+ async displayApiCopilotKeyUsageWarning() {
8
+ 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.');
9
+ }
10
+ async selectCopilotKey(keys) {
11
+ const selectedKey = await select({
12
+ message: "Select the ID for the API Copilot you would like to add to this API Portal:",
13
+ maxItems: 10,
14
+ options: keys.map((key) => ({
15
+ value: key,
16
+ label: key
17
+ }))
18
+ });
19
+ if (isCancel(selectedKey)) {
20
+ return null;
21
+ }
22
+ return selectedKey;
23
+ }
24
+ copilotConfigured(status, copilotId) {
25
+ outro(`API Copilot configured successfully!
26
+
27
+ Copilot ID: ${getMessageInCyanColor(copilotId)}
28
+ Status: ${getMessageInCyanColor(status ? "Enabled" : "Disabled")}
29
+
30
+ Configuration saved to: APIMATIC-BUILD.json
31
+
32
+ API Copilot will index your content the next time you run \`apimatic portal:generate\` or \`apimatic portal:serve\`. This process can take up to 10 minutes, depending on your API’s size.
33
+
34
+ To see your copilot: If your portal is already running, refresh the page. Otherwise, run \`apimatic portal:serve\`, select any programming language in the Portal and look for the chat icon in the bottom-right corner.`);
35
+ }
36
+ async confirmOverwrite() {
37
+ const shouldOverwrite = await confirm({
38
+ message: "API Copilot is already configured for this Portal, do you want to overwrite it?",
39
+ initialValue: false
40
+ });
41
+ if (isCancel(shouldOverwrite)) {
42
+ return false;
43
+ }
44
+ return shouldOverwrite;
45
+ }
46
+ logError(error) {
47
+ log.error(error);
48
+ }
49
+ async spinnerAccountInfo(fn) {
50
+ return this.withSpinner("Retrieving your subscription info", "Retrieved subscription info", "Error retrieving subscription info", fn);
51
+ }
52
+ async withSpinner(intro, success, failure, fn) {
53
+ const s = spinner();
54
+ s.start(intro);
55
+ const result = await fn();
56
+ result.match(() => s.stop(success, 0), () => s.stop(failure, 1));
57
+ return result;
58
+ }
59
+ async confirmSingleKeyUsage(apiCopilotKey) {
60
+ const confirmKeyUsage = await confirm({
61
+ 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" +
62
+ `Do you want to use this key: '${apiCopilotKey}'?`,
63
+ initialValue: true
64
+ });
65
+ if (isCancel(confirmKeyUsage)) {
66
+ return false;
67
+ }
68
+ return confirmKeyUsage;
69
+ }
70
+ }
71
+ //# sourceMappingURL=copilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot.js","sourceRoot":"","sources":["../../../src/prompts/portal/copilot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAK7D,MAAM,OAAO,oBAAoB;IACxB,wBAAwB;QAC7B,GAAG,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IAC7E,CAAC;IACM,KAAK,CAAC,gCAAgC;QACzC,GAAG,CAAC,IAAI,CAAC,4IAA4I,CAAC,CAAA;IAC1J,CAAC;IACM,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,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,iBAAiB,CAAC,MAAe,EAA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a,IAAI;YACpD,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC9B,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ import { DirectoryPath } from "../../types/file/directoryPath.js";
2
+ export declare class PortalGeneratePrompts {
3
+ private readonly spin;
4
+ 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;
11
+ }
@@ -0,0 +1,42 @@
1
+ import { outro, spinner, isCancel, confirm, log } from "@clack/prompts";
2
+ import { getMessageInRedColor, getMessageInMagentaColor, getMessageInCyanColor } from "../../utils/utils.js";
3
+ export class PortalGeneratePrompts {
4
+ constructor() {
5
+ this.spin = spinner();
6
+ }
7
+ async overwritePortal(directory) {
8
+ const overwrite = await confirm({
9
+ message: `The destination '${directory}' is not empty, do you want to overwrite?`,
10
+ initialValue: false
11
+ });
12
+ if (isCancel(overwrite)) {
13
+ return false;
14
+ }
15
+ return overwrite;
16
+ }
17
+ displayPortalGenerationMessage() {
18
+ this.spin.start(getMessageInMagentaColor("Generating portal"));
19
+ }
20
+ displayPortalGenerationSuccessMessage() {
21
+ this.spin.stop(getMessageInCyanColor("Portal generated successfully."));
22
+ this.cleanUpStandardInput();
23
+ }
24
+ displayPortalGenerationErrorMessage() {
25
+ this.spin.stop(getMessageInRedColor(`Portal Generation failed.`), 1);
26
+ this.cleanUpStandardInput();
27
+ }
28
+ displayOutroMessage(generatedPortalPath) {
29
+ outro(`The generated portal can be found at ${generatedPortalPath}`);
30
+ }
31
+ logError(error) {
32
+ log.error(error);
33
+ }
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
+ }
40
+ }
41
+ }
42
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../../src/prompts/portal/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG7G,MAAM,OAAO,qBAAqB;IAAlC;QACmB,SAAI,GAAG,OAAO,EAAE,CAAC;IA4CpC,CAAC;IA1CQ,KAAK,CAAC,eAAe,CAAC,SAAwB;QACnD,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC;YAC9B,OAAO,EAAE,oBAAoB,SAAS,2CAA2C;YACjF,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;IAED,8BAA8B;QAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,qCAAqC;QACnC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,gCAAgC,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,mCAAmC;QACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,mBAAmB,CAAC,mBAA2B;QAC7C,KAAK,CAAC,wCAAwC,mBAAmB,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,QAAQ,CAAC,KAAa;QACpB,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,kFAAkF;IAC1E,oBAAoB;QAC1B,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YAChC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,30 @@
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;
30
+ }
@@ -0,0 +1,240 @@
1
+ import fs from "fs";
2
+ import * as path from "path";
3
+ import treeify from "treeify";
4
+ import { intro, outro, text, select, multiselect, log, isCancel, cancel, password } from "@clack/prompts";
5
+ import { getMessageInCyanColor, getMessageInGreenColor, getMessageInOrangeColor, getMessageInMagentaColor, getMessageInRedColor, isValidUrl, directoryToJson } from "../../utils/utils.js";
6
+ import { BasePrompts } from "./common/base-prompts.js";
7
+ import axios from "axios";
8
+ export class PortalQuickstartPrompts extends BasePrompts {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.vscodeExtensionUrl = "\u001b[4mhttps://marketplace.visualstudio.com/items?itemName=apimatic-developers.apimatic-for-vscode\u001b[0m";
12
+ this.serverUrl = "\u001b[4mhttp://localhost:3000\u001b[0m";
13
+ this.referenceDocumentationUrl = "\u001b[4mhttps://docs.apimatic.io/cli-getting-started/advanced-portal-setup\u001b[0m";
14
+ this.customizeTheSdksUrl = "\u001b[4mhttps://docs.apimatic.io/generate-sdks/codegen-settings/codegen-settings-overview\u001b[0m";
15
+ this.defaultPortalDirectoryPath = process.cwd();
16
+ }
17
+ displayWelcomeMessage() {
18
+ intro(`Hello there 👋`);
19
+ log.message(`This wizard will help you set up an API Portal via APIMatic's Docs as Code workflow in 4 simple steps.`);
20
+ log.message(`Let's get started! 🚀`);
21
+ }
22
+ async loginPrompt() {
23
+ log.message(`Please log in to continue.`);
24
+ const email = await text({
25
+ message: "Enter your registered email:",
26
+ validate: (input) => {
27
+ if (!input) {
28
+ return getMessageInRedColor("Email is required.");
29
+ }
30
+ const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
31
+ if (!emailRegex.test(input)) {
32
+ return getMessageInRedColor("Please enter a valid email address.");
33
+ }
34
+ }
35
+ });
36
+ if (isCancel(email)) {
37
+ cancel("Operation cancelled.");
38
+ return process.exit(0);
39
+ }
40
+ const pass = await password({
41
+ message: "Enter your password:",
42
+ validate: (input) => {
43
+ if (!input) {
44
+ return getMessageInRedColor("Password is required.");
45
+ }
46
+ }
47
+ });
48
+ if (isCancel(pass)) {
49
+ cancel("Operation cancelled.");
50
+ return process.exit(0);
51
+ }
52
+ return { email: String(email).trim(), password: String(pass).trim() };
53
+ }
54
+ removeQuotes(str) {
55
+ const quotes = ['"', "'"];
56
+ for (const quote of quotes) {
57
+ if (str.startsWith(quote) && str.endsWith(quote) && str.length > 1) {
58
+ return this.removeQuotes(str.slice(1, -1)); // Recursive call
59
+ }
60
+ }
61
+ return str;
62
+ }
63
+ async specPrompt() {
64
+ log.step(getMessageInOrangeColor(`Step 1 of 4: Import your OpenAPI Definition`));
65
+ while (true) {
66
+ const spec = await text({
67
+ message: `Provide a local path or a public URL for your OpenAPI definition file:`,
68
+ placeholder: "Provide absolute URL/local path or press Enter to use a sample OpenAPI file from APIMatic.",
69
+ defaultValue: "https://raw.githubusercontent.com/apimatic/static-portal-workflow/refs/heads/master/spec/openapi.json",
70
+ validate: (input) => {
71
+ var _a;
72
+ if (!input)
73
+ return;
74
+ const cleanedPath = this.removeQuotes((_a = input.trim()) !== null && _a !== void 0 ? _a : "");
75
+ if (!isValidUrl(cleanedPath)) {
76
+ const dirPath = path.resolve(cleanedPath);
77
+ if (!fs.existsSync(dirPath)) {
78
+ return getMessageInRedColor("Error: The specified file does not exist. Please enter a valid file path.");
79
+ }
80
+ if (!fs.statSync(dirPath).isFile()) {
81
+ return getMessageInRedColor("Error: The specified path does not point to a valid API Definition file or a zip archive containing API definition files. Please try again.");
82
+ }
83
+ }
84
+ return; // pass sync validation
85
+ },
86
+ });
87
+ if (isCancel(spec)) {
88
+ cancel("Operation cancelled.");
89
+ process.exit(0);
90
+ }
91
+ const cleanedPath = this.removeQuotes(String(spec).trim());
92
+ // Async validation for URLs
93
+ if (isValidUrl(cleanedPath)) {
94
+ try {
95
+ const response = await axios.head(cleanedPath);
96
+ const contentType = response.headers["content-type"];
97
+ if (contentType === null || contentType === void 0 ? void 0 : contentType.includes("text/html")) {
98
+ log.error(getMessageInRedColor(`Invalid URL. Please check the URL and ensure it points to a valid OpenAPI definition.`));
99
+ continue; // re-prompt
100
+ }
101
+ }
102
+ catch (err) {
103
+ log.error(getMessageInRedColor(`Failed to reach the URL. Please check your internet connection or the URL.`));
104
+ continue; // re-prompt
105
+ }
106
+ }
107
+ return cleanedPath; // valid local file or valid URL
108
+ }
109
+ }
110
+ displaySpecValidationMessage() {
111
+ log.step(getMessageInOrangeColor(`Step 2 of 4: Validate and Lint your OpenAPI file`));
112
+ this.spin.start(getMessageInMagentaColor(`Running your API Definition through APIMatic's 1200+ CodeGen Specific validation and linting rules 🔍 `));
113
+ }
114
+ displaySpecValidationSuccessMessage() {
115
+ this.spin.stop(getMessageInCyanColor(`Validation Successful.`));
116
+ }
117
+ displaySpecValidationErrorMessage() {
118
+ this.spin.stop(getMessageInRedColor(`Something went wrong while validating your spec.`), 1);
119
+ }
120
+ displaySpecValidationFailureMessage() {
121
+ this.spin.stop(getMessageInRedColor(`❗ Oops, it looks like there are some errors in your API Definition.`), 1);
122
+ }
123
+ async specValidationFailurePrompt() {
124
+ const useSampleSpec = await select({
125
+ message: `How would you like to proceed?`,
126
+ options: [
127
+ {
128
+ value: "exit",
129
+ label: `1. Fix the issues using APIMatic's interactive VS Code Extension: ${this.vscodeExtensionUrl}`
130
+ },
131
+ { value: "continue", label: `2. Use an example API spec instead (recommended)` }
132
+ ]
133
+ });
134
+ if (isCancel(useSampleSpec)) {
135
+ cancel("Operation cancelled.");
136
+ return process.exit(0);
137
+ }
138
+ if (useSampleSpec === "exit") {
139
+ outro(getMessageInCyanColor("Good luck fixing your API definition! 🛠️ Feel free to run this command again once you're done."));
140
+ return process.exit(0);
141
+ }
142
+ }
143
+ async sdkLanguagesPrompt() {
144
+ log.step(getMessageInOrangeColor(`Step 3 of 4: Select programming languages`));
145
+ const languages = (await multiselect({
146
+ message: "💻 Your API Portal will contain SDKs and SDK Documentation in the following Languages. Press enter to continue with all languages, or use the arrow keys and spacebar to customize your selection:",
147
+ options: [
148
+ { label: "HTTP", value: "http" },
149
+ { label: "Typescript", value: "typescript" },
150
+ { label: "Ruby", value: "ruby" },
151
+ { label: "Python", value: "python" },
152
+ { label: "Java", value: "java" },
153
+ { label: "C#", value: "csharp" },
154
+ { label: "PHP", value: "php" },
155
+ { label: "Go", value: "go" }
156
+ ],
157
+ initialValues: ["http", "typescript", "ruby", "python", "java", "csharp", "php", "go"]
158
+ }));
159
+ if (isCancel(languages)) {
160
+ cancel("Operation cancelled.");
161
+ return process.exit(0);
162
+ }
163
+ return languages;
164
+ }
165
+ async workingDirectoryPrompt() {
166
+ log.step(getMessageInOrangeColor(`Step 4 of 4: Generate source files for Docs as Code`));
167
+ const directory = await text({
168
+ message: "Enter the directory path where you would like to setup the API Portal (Requires an empty directory):",
169
+ placeholder: "Provide absolute path to the directory or press Enter to use the current directory.",
170
+ defaultValue: "./",
171
+ validate: (input) => {
172
+ var _a;
173
+ const cleanedPath = this.removeQuotes((_a = input === null || input === void 0 ? void 0 : input.trim()) !== null && _a !== void 0 ? _a : "");
174
+ const dirPath = path.resolve(cleanedPath);
175
+ if (!fs.existsSync(dirPath) && dirPath != this.defaultPortalDirectoryPath) {
176
+ return getMessageInRedColor("Error: The specified directory path does not exist. Please try again.");
177
+ }
178
+ if (dirPath !== this.defaultPortalDirectoryPath) {
179
+ const files = fs.readdirSync(dirPath).filter((item) => !item.startsWith("."));
180
+ if (files.length > 0) {
181
+ return getMessageInRedColor("Error: The target directory is not empty. Please provide a path to an empty directory or clear its contents.");
182
+ }
183
+ }
184
+ else if (fs.existsSync(dirPath)) {
185
+ // For ignoring hidden files and folders in the current directory in MacOS.
186
+ const files = fs.readdirSync(dirPath).filter((item) => !item.startsWith("."));
187
+ if (files.length > 0) {
188
+ return getMessageInRedColor("Error: The target directory is not empty. Please provide a path to an empty directory or clear its contents.");
189
+ }
190
+ }
191
+ }
192
+ });
193
+ if (isCancel(directory)) {
194
+ cancel("Operation cancelled.");
195
+ return process.exit(0);
196
+ }
197
+ if (directory === "./") {
198
+ return this.defaultPortalDirectoryPath;
199
+ }
200
+ else {
201
+ return this.removeQuotes(String(directory).trim());
202
+ }
203
+ }
204
+ displayBuildDirectoryGenerationMessage() {
205
+ this.spin.start(getMessageInMagentaColor("Generating build directory ⚙️"));
206
+ }
207
+ displayBuildDirectoryGenerationErrorMessage() {
208
+ this.spin.stop(getMessageInRedColor(`Something went wrong while setting up your build directory.`), 1);
209
+ }
210
+ displayBuildDirectoryGenerationSuccessMessage(targetFolder) {
211
+ this.spin.stop(getMessageInCyanColor(`📁 Directory created at ${targetFolder}`));
212
+ }
213
+ displayBuildDirectoryAsTree(targetFolder) {
214
+ const buildDirectory = directoryToJson(targetFolder);
215
+ const tree = treeify.asTree(buildDirectory, true, true);
216
+ const coloredLogString = tree
217
+ .split("\n")
218
+ .map((line) => line.replace(/#.*/, (match) => getMessageInGreenColor(match)))
219
+ .join("\n");
220
+ log.step(coloredLogString);
221
+ }
222
+ displayOutroMessage(buildDirectory) {
223
+ log.step(getMessageInCyanColor(`📢 Your API Portal is live at: ${this.serverUrl}\n`) +
224
+ getMessageInCyanColor(`Hot reload enabled! Edit files in ${buildDirectory} to see changes instantly reflected in your API Portal.\n`) +
225
+ getMessageInCyanColor(`Press CTRL+C to stop the server.`));
226
+ outro(getMessageInCyanColor(`What's next?\n`) +
227
+ getMessageInCyanColor(`- Use the API Playground or an SDK to call your API.\n`) +
228
+ getMessageInCyanColor(`- Customize the Portal theme, add API recipes and enable AI features: ${this.referenceDocumentationUrl}`));
229
+ }
230
+ getLoggedInFirst() {
231
+ log.step("You need to be logged in to continue.");
232
+ }
233
+ displayLoggedInMessage(email) {
234
+ log.success(`Successfully logged in as ${email}`);
235
+ }
236
+ logError(error) {
237
+ log.error(error);
238
+ }
239
+ }
240
+ //# sourceMappingURL=quickstart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/prompts/portal/quickstart.ts"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dl/sdl.js";
3
+ export declare class PortalRecipePrompts {
4
+ private readonly spin;
5
+ displayWelcomeMessage(): void;
6
+ recipeNamePrompt(): Promise<string>;
7
+ removeQuotes(str: string): string;
8
+ buildConfigFilePathPrompt(buildDirectoryPath: string): Promise<string>;
9
+ stepNamePrompt(defaultStepName: string): Promise<string>;
10
+ displayStepsInformation(): void;
11
+ stepTypeSelectionPrompt(): Promise<string>;
12
+ displayContentStepInfo(): void;
13
+ endpointGroupNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>): Promise<string>;
14
+ endpointNamePrompt(endpointGroups: Map<string, SdlEndpoint[]>, endpointGroupName: string): Promise<string>;
15
+ endpointDescriptionPrompt(endpointGroups: Map<string, SdlEndpoint[]>, endpointGroupName: string, endpointName: string): Promise<string>;
16
+ addAnotherStepSelectionPrompt(): Promise<boolean>;
17
+ overwriteApiRecipeInTocPrompt(): Promise<boolean>;
18
+ displayStepAddedSuccessfullyMessage(): void;
19
+ displayRecipeGenerationSuccessMessage(buildDirectoryPath: string): void;
20
+ startProgressIndicatorWithMessage(message: string): void;
21
+ stopProgressIndicatorWithMessage(message: string): void;
22
+ displayBuildDirectoryStructureAsTree(buildDirectoryTreeObject: treeify.TreeObject): void;
23
+ logError(error: string): void;
24
+ }