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

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 (337) 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 +17 -13
  37. package/lib/actions/portal/toc/new-toc.js +85 -122
  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/toc/toc-content-parser.d.ts +1 -1
  55. package/lib/application/portal/toc/toc-content-parser.js +9 -11
  56. package/lib/application/portal/toc/toc-content-parser.js.map +1 -0
  57. package/lib/application/portal/toc/toc-structure-generator.d.ts +1 -1
  58. package/lib/application/portal/toc/toc-structure-generator.js +4 -8
  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 +5 -6
  91. package/lib/commands/portal/toc/new.js +45 -50
  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 +13 -8
  191. package/lib/prompts/portal/toc/new-toc.js +28 -36
  192. package/lib/prompts/portal/toc/new-toc.js.map +1 -0
  193. package/lib/prompts/prompt.d.ts +3 -0
  194. package/lib/prompts/prompt.js +37 -0
  195. package/lib/prompts/prompt.js.map +1 -0
  196. package/lib/prompts/quickstart.d.ts +6 -0
  197. package/lib/prompts/quickstart.js +25 -0
  198. package/lib/prompts/quickstart.js.map +1 -0
  199. package/lib/prompts/sdk/generate.d.ts +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/application/portal/toc/sdl-parser.d.ts +0 -13
  303. package/lib/application/portal/toc/sdl-parser.js +0 -53
  304. package/lib/client-utils/sdk-client.d.ts +0 -23
  305. package/lib/client-utils/sdk-client.js +0 -124
  306. package/lib/commands/portal/quickstart.d.ts +0 -10
  307. package/lib/commands/portal/quickstart.js +0 -79
  308. package/lib/config/env.d.ts +0 -27
  309. package/lib/config/env.js +0 -31
  310. package/lib/controllers/api/transform.d.ts +0 -5
  311. package/lib/controllers/api/transform.js +0 -56
  312. package/lib/controllers/api/validate.d.ts +0 -3
  313. package/lib/controllers/api/validate.js +0 -33
  314. package/lib/controllers/portal/generate.d.ts +0 -3
  315. package/lib/controllers/portal/generate.js +0 -110
  316. package/lib/controllers/portal/quickstart.d.ts +0 -14
  317. package/lib/controllers/portal/quickstart.js +0 -258
  318. package/lib/controllers/portal/serve.d.ts +0 -3
  319. package/lib/controllers/portal/serve.js +0 -138
  320. package/lib/controllers/sdk/generate.d.ts +0 -4
  321. package/lib/controllers/sdk/generate.js +0 -66
  322. package/lib/services/portal/server.d.ts +0 -14
  323. package/lib/services/portal/server.js +0 -101
  324. package/lib/types/api/validate.d.ts +0 -12
  325. package/lib/types/api/validate.js +0 -3
  326. package/lib/types/common/result.d.ts +0 -17
  327. package/lib/types/common/result.js +0 -36
  328. package/lib/types/portal/generate.d.ts +0 -26
  329. package/lib/types/portal/generate.js +0 -4
  330. package/lib/types/portal/quickstart.d.ts +0 -17
  331. package/lib/types/portal/quickstart.js +0 -3
  332. package/lib/validators/common/directoryValidator.d.ts +0 -9
  333. package/lib/validators/common/directoryValidator.js +0 -53
  334. package/lib/validators/common/portValidator.d.ts +0 -5
  335. package/lib/validators/common/portValidator.js +0 -20
  336. package/lib/validators/portal/serveValidator.d.ts +0 -6
  337. package/lib/validators/portal/serveValidator.js +0 -21
@@ -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
+ }
@@ -0,0 +1,11 @@
1
+ export class DomainEvent {
2
+ constructor(message, commandName, flags) {
3
+ this.message = message;
4
+ this.commandName = commandName;
5
+ this.flags = this.extractFlagKeys(flags);
6
+ }
7
+ extractFlagKeys(flags) {
8
+ return Object.keys(flags);
9
+ }
10
+ }
11
+ //# sourceMappingURL=domain-event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-event.js","sourceRoot":"","sources":["../../../src/types/events/domain-event.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,WAAW;IAM/B,YAAsB,OAAe,EAAE,WAAmB,EAAE,KAA8B;QACxF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAEO,eAAe,CAAC,KAA8B;QACpD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export declare class QuickstartCompletedEvent extends DomainEvent {
3
+ protected readonly eventName: string;
4
+ private static readonly message;
5
+ private static readonly commandName;
6
+ constructor();
7
+ }
@@ -0,0 +1,10 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export class QuickstartCompletedEvent extends DomainEvent {
3
+ constructor() {
4
+ super(QuickstartCompletedEvent.message, QuickstartCompletedEvent.commandName, {});
5
+ this.eventName = QuickstartCompletedEvent.name;
6
+ }
7
+ }
8
+ QuickstartCompletedEvent.message = "Quickstart completed.";
9
+ QuickstartCompletedEvent.commandName = "quickstart";
10
+ //# sourceMappingURL=quickstart-completed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart-completed.js","sourceRoot":"","sources":["../../../src/types/events/quickstart-completed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IAKvD;QACE,KAAK,CAAC,wBAAwB,CAAC,OAAO,EAAE,wBAAwB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QALjE,cAAS,GAAG,wBAAwB,CAAC,IAAI,CAAC;IAM7D,CAAC;;AALuB,gCAAO,GAAG,uBAAgC,AAAnC,CAAoC;AAC3C,oCAAW,GAAG,YAAqB,AAAxB,CAAyB"}
@@ -0,0 +1,7 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export declare class QuickstartInitiatedEvent extends DomainEvent {
3
+ protected readonly eventName: string;
4
+ private static readonly message;
5
+ private static readonly commandName;
6
+ constructor();
7
+ }
@@ -0,0 +1,10 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export class QuickstartInitiatedEvent extends DomainEvent {
3
+ constructor() {
4
+ super(QuickstartInitiatedEvent.message, QuickstartInitiatedEvent.commandName, {});
5
+ this.eventName = QuickstartInitiatedEvent.name;
6
+ }
7
+ }
8
+ QuickstartInitiatedEvent.message = "Quickstart initiated.";
9
+ QuickstartInitiatedEvent.commandName = "quickstart";
10
+ //# sourceMappingURL=quickstart-initiated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quickstart-initiated.js","sourceRoot":"","sources":["../../../src/types/events/quickstart-initiated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IAKvD;QACE,KAAK,CAAC,wBAAwB,CAAC,OAAO,EAAE,wBAAwB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QALjE,cAAS,GAAG,wBAAwB,CAAC,IAAI,CAAC;IAM7D,CAAC;;AALuB,gCAAO,GAAG,uBAAgC,AAAnC,CAAoC;AAC3C,oCAAW,GAAG,YAAqB,AAAxB,CAAyB"}
@@ -0,0 +1,5 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export declare class RecipeCreationFailedEvent extends DomainEvent {
3
+ protected readonly eventName: string;
4
+ constructor(message: string, commandName: string, flags: Record<string, unknown>);
5
+ }
@@ -0,0 +1,8 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export class RecipeCreationFailedEvent extends DomainEvent {
3
+ constructor(message, commandName, flags) {
4
+ super(message, commandName, flags);
5
+ this.eventName = RecipeCreationFailedEvent.name;
6
+ }
7
+ }
8
+ //# sourceMappingURL=recipe-creation-failed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recipe-creation-failed.js","sourceRoot":"","sources":["../../../src/types/events/recipe-creation-failed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IAGxD,YAAY,OAAe,EAAE,WAAmB,EAAE,KAA8B;QAC9E,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAHlB,cAAS,GAAG,yBAAyB,CAAC,IAAI,CAAC;IAI9D,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export declare class TocCreationFailedEvent extends DomainEvent {
3
+ protected readonly eventName: string;
4
+ constructor(message: string, commandName: string, flags: Record<string, unknown>);
5
+ }
@@ -0,0 +1,8 @@
1
+ import { DomainEvent } from "./domain-event.js";
2
+ export class TocCreationFailedEvent extends DomainEvent {
3
+ constructor(message, commandName, flags) {
4
+ super(message, commandName, flags);
5
+ this.eventName = TocCreationFailedEvent.name;
6
+ }
7
+ }
8
+ //# sourceMappingURL=toc-creation-failed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toc-creation-failed.js","sourceRoot":"","sources":["../../../src/types/events/toc-creation-failed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,sBAAuB,SAAQ,WAAW;IAGrD,YAAY,OAAe,EAAE,WAAmB,EAAE,KAA8B;QAC9E,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QAHlB,cAAS,GAAG,sBAAsB,CAAC,IAAI,CAAC;IAI3D,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import { DirectoryPath } from "./directoryPath.js";
2
+ import { FileName } from "./fileName.js";
3
+ import { TocGroup } from "../toc/toc.js";
4
+ import { TreeNode } from "../../prompts/format.js";
5
+ export type DirectoryItem = FileName | Directory;
6
+ export declare class Directory {
7
+ readonly directoryPath: DirectoryPath;
8
+ readonly items: DirectoryItem[];
9
+ private readonly fileService;
10
+ constructor(directoryPath: DirectoryPath, filePaths: DirectoryItem[]);
11
+ private static readonly folderDescriptions;
12
+ private static readonly fileDescriptions;
13
+ toTreeNode(): TreeNode;
14
+ parseContentFolder(baseContentPath: DirectoryPath): Promise<TocGroup[]>;
15
+ private getPageName;
16
+ private isRootContentDirectory;
17
+ }
@@ -0,0 +1,87 @@
1
+ import { FilePath } from "./filePath.js";
2
+ import { FileService } from "../../infrastructure/file-service.js";
3
+ export class Directory {
4
+ constructor(directoryPath, filePaths) {
5
+ this.fileService = new FileService();
6
+ this.directoryPath = directoryPath;
7
+ this.items = filePaths;
8
+ }
9
+ toTreeNode() {
10
+ const folderName = this.directoryPath.leafName();
11
+ const folderDescription = Directory.folderDescriptions[folderName];
12
+ return {
13
+ name: folderName,
14
+ description: folderDescription,
15
+ items: this.items.map((item) => {
16
+ if (item instanceof Directory) {
17
+ return item.toTreeNode();
18
+ }
19
+ // file case
20
+ const fileName = item.toString();
21
+ const fileDescription = Directory.fileDescriptions[fileName];
22
+ return {
23
+ name: fileName,
24
+ description: fileDescription
25
+ };
26
+ })
27
+ };
28
+ }
29
+ async parseContentFolder(baseContentPath) {
30
+ const groups = [];
31
+ const pages = [];
32
+ for (const item of this.items) {
33
+ if (item instanceof Directory) {
34
+ const subGroups = await item.parseContentFolder(baseContentPath);
35
+ if (subGroups.length > 0) {
36
+ const directoryName = item.directoryPath.leafName();
37
+ groups.push({
38
+ group: directoryName,
39
+ items: subGroups
40
+ });
41
+ }
42
+ }
43
+ else {
44
+ if (item.isMarkDown()) {
45
+ const currentFilePath = new FilePath(this.directoryPath, item);
46
+ const relativeFilePath = this.fileService.getRelativePath(currentFilePath, baseContentPath);
47
+ pages.push({
48
+ page: this.getPageName(item),
49
+ file: relativeFilePath
50
+ });
51
+ }
52
+ }
53
+ }
54
+ const allItems = [...pages, ...groups];
55
+ if (allItems.length === 0) {
56
+ return [];
57
+ }
58
+ if (this.isRootContentDirectory(baseContentPath)) {
59
+ return [
60
+ {
61
+ group: "Custom Content",
62
+ items: allItems
63
+ }
64
+ ];
65
+ }
66
+ // For subdirectories, return the items directly
67
+ return allItems;
68
+ }
69
+ getPageName(fileName) {
70
+ const fileNameStr = fileName.toString();
71
+ return fileNameStr.replace(/\.md$/, "");
72
+ }
73
+ isRootContentDirectory(baseContentPath) {
74
+ return this.directoryPath.toString() === baseContentPath.toString();
75
+ }
76
+ }
77
+ Directory.folderDescriptions = {
78
+ spec: "# Contains all API definition files",
79
+ content: "# Includes custom documentation pages in Markdown",
80
+ static: "# Includes all static files, such as images, GIFs, and PDFs"
81
+ };
82
+ Directory.fileDescriptions = {
83
+ "toc.yml": "# Controls the structure of the side navigation bar in the API portal",
84
+ "APIMATIC-BUILD.json": "# Defines all configurations for the API portal, including programming languages and themes",
85
+ "APIMATIC-META.json": "# Defines customization for SDK generation",
86
+ };
87
+ //# sourceMappingURL=directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory.js","sourceRoot":"","sources":["../../../src/types/file/directory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AAInE,MAAM,OAAO,SAAS;IAKpB,YAAmB,aAA4B,EAAE,SAA0B;QAF1D,gBAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAG/C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,SAAS,CAA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AuE;IAClF,qBAAqB,EACnB,6FAA6F;IAC/F,oBAAoB,EAAE,4CAA4C;CACnE,AALuC,CAKtC"}
@@ -0,0 +1,10 @@
1
+ export declare class DirectoryPath {
2
+ private readonly directoryPath;
3
+ constructor(directoryPath: string, ...subPaths: string[]);
4
+ static default: DirectoryPath;
5
+ static createInput(input: string | undefined): DirectoryPath;
6
+ toString(): string;
7
+ join(...subPath: string[]): DirectoryPath;
8
+ isEqual(other: DirectoryPath): boolean;
9
+ leafName(): string;
10
+ }
@@ -0,0 +1,26 @@
1
+ import * as path from "path";
2
+ export class DirectoryPath {
3
+ constructor(directoryPath, ...subPaths) {
4
+ this.directoryPath = path.resolve(directoryPath, ...subPaths);
5
+ }
6
+ static createInput(input) {
7
+ if (!input) {
8
+ return DirectoryPath.default;
9
+ }
10
+ return new DirectoryPath(input);
11
+ }
12
+ toString() {
13
+ return this.directoryPath;
14
+ }
15
+ join(...subPath) {
16
+ return new DirectoryPath(path.join(this.directoryPath, ...subPath));
17
+ }
18
+ isEqual(other) {
19
+ return this.directoryPath === other.directoryPath;
20
+ }
21
+ leafName() {
22
+ return path.basename(this.directoryPath);
23
+ }
24
+ }
25
+ DirectoryPath.default = new DirectoryPath("./");
26
+ //# sourceMappingURL=directoryPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directoryPath.js","sourceRoot":"","sources":["../../../src/types/file/directoryPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,MAAM,OAAO,aAAa;IAGxB,YAAY,aAAqB,EAAE,GAAG,QAAkB;QACtD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,QAAQ,CAAC,CAAC;IAChE,CAAC;IAIM,MAAM,CAAC,WAAW,CAAC,KAAyB;QACjD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,aAAa,CAAC,OAAO,CAAC;QAC/B,CAAC;QACD,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAEM,IAAI,CAAC,GAAG,OAAiB;QAC9B,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAEM,OAAO,CAAC,KAAoB;QACjC,OAAO,IAAI,CAAC,aAAa,KAAK,KAAK,CAAC,aAAa,CAAC;IACpD,CAAC;IACM,QAAQ;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3C,CAAC;;AAtBa,qBAAO,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare class FileName {
2
+ private readonly name;
3
+ constructor(name: string);
4
+ isMarkDown(): boolean;
5
+ normalize(): FileName;
6
+ toString(): string;
7
+ }
@@ -0,0 +1,21 @@
1
+ export class FileName {
2
+ constructor(name) {
3
+ this.name = name;
4
+ }
5
+ isMarkDown() {
6
+ return this.name.endsWith(".md");
7
+ }
8
+ normalize() {
9
+ const nameWithoutExt = this.name.replace(/\.[^/.]+$/, "");
10
+ const normalized = nameWithoutExt
11
+ .toLowerCase()
12
+ .replace(/[^a-z0-9-]/g, "-")
13
+ .replace(/-+/g, "-")
14
+ .replace(/(^-|-$)/g, "");
15
+ return new FileName(normalized);
16
+ }
17
+ toString() {
18
+ return this.name;
19
+ }
20
+ }
21
+ //# sourceMappingURL=fileName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileName.js","sourceRoot":"","sources":["../../../src/types/file/fileName.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IAGnB,YAAY,IAAY;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,UAAU;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAEM,SAAS;QACd,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC1D,MAAM,UAAU,GAAG,cAAc;aAC9B,WAAW,EAAE;aACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;aAC3B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;aACnB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QAC3B,OAAO,IAAI,QAAQ,CAAC,UAAU,CAAC,CAAC;IAClC,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { FileName } from "./fileName.js";
2
+ import { DirectoryPath } from "./directoryPath.js";
3
+ export declare class FilePath {
4
+ private readonly fileName;
5
+ private readonly directoryPath;
6
+ constructor(path: DirectoryPath, name: FileName);
7
+ replaceDirectory(newDirectory: DirectoryPath): FilePath;
8
+ toString(): string;
9
+ static create(filePath: string): FilePath | undefined;
10
+ }
@@ -0,0 +1,32 @@
1
+ import path from "path";
2
+ import { FileName } from "./fileName.js";
3
+ import { DirectoryPath } from "./directoryPath.js";
4
+ export class FilePath {
5
+ constructor(path, name) {
6
+ this.fileName = name;
7
+ this.directoryPath = path;
8
+ }
9
+ replaceDirectory(newDirectory) {
10
+ return new FilePath(newDirectory, this.fileName);
11
+ }
12
+ toString() {
13
+ return path.join(this.directoryPath.toString(), this.fileName.toString());
14
+ }
15
+ static create(filePath) {
16
+ if (!filePath) {
17
+ return undefined;
18
+ }
19
+ try {
20
+ const normalizedPath = path.normalize(filePath);
21
+ const directory = path.dirname(normalizedPath);
22
+ const filename = path.basename(normalizedPath);
23
+ const directoryPath = new DirectoryPath(directory);
24
+ const fileName = new FileName(filename);
25
+ return new FilePath(directoryPath, fileName);
26
+ }
27
+ catch (_a) {
28
+ return undefined;
29
+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,WAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { FilePath } from "./filePath.js";
2
+ import { UrlPath } from "./urlPath.js";
3
+ export type ResourceInput = FilePath | UrlPath;
4
+ export declare const createResourceInput: (file?: string, url?: string) => ResourceInput;
5
+ export declare function createResourceInputFromInput(path: string): ResourceInput | undefined;
@@ -0,0 +1,42 @@
1
+ import path from "path";
2
+ import { DirectoryPath } from "./directoryPath.js";
3
+ import { FileName } from "./fileName.js";
4
+ import { FilePath } from "./filePath.js";
5
+ import { UrlPath } from "./urlPath.js";
6
+ import { removeQuotes } from "../../utils/string-utils.js";
7
+ // Factory function to create the discriminated union
8
+ export const createResourceInput = (file, url) => {
9
+ if (file && url) {
10
+ throw new Error("Cannot specify both file and url. Please provide only one.");
11
+ }
12
+ if (!file && !url) {
13
+ throw new Error("Must specify either file or url.");
14
+ }
15
+ if (file) {
16
+ if (!file.trim()) {
17
+ throw new Error("Invalid file path provided.");
18
+ }
19
+ return new FilePath(new DirectoryPath(path.dirname(file)), new FileName(path.basename(file)));
20
+ }
21
+ if (url) {
22
+ if (!url.trim()) {
23
+ throw new Error("Invalid URL provided.");
24
+ }
25
+ return new UrlPath(url);
26
+ }
27
+ throw new Error("Must specify either file or url.");
28
+ };
29
+ export function createResourceInputFromInput(path) {
30
+ var _a;
31
+ const sanitizedPath = removeQuotes((_a = path.trim()) !== null && _a !== void 0 ? _a : "");
32
+ const urlPath = UrlPath.create(sanitizedPath);
33
+ if (urlPath) {
34
+ return urlPath;
35
+ }
36
+ const filePath = FilePath.create(sanitizedPath);
37
+ if (filePath) {
38
+ return filePath;
39
+ }
40
+ return undefined;
41
+ }
42
+ //# sourceMappingURL=resource-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-input.js","sourceRoot":"","sources":["../../../src/types/file/resource-input.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB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AAA,IAAI,CAAC,IAAI,EAAE,mCAAI,EAAE,CAAC,CAAA;IACrD,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC9C,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAChD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare class UrlPath {
2
+ private readonly url;
3
+ constructor(url: string);
4
+ static create(url: string): UrlPath | undefined;
5
+ toString(): string;
6
+ }
@@ -0,0 +1,22 @@
1
+ import { URL } from "url";
2
+ export class UrlPath {
3
+ constructor(url) {
4
+ this.url = url;
5
+ }
6
+ static create(url) {
7
+ try {
8
+ const parsed = new URL(url);
9
+ if (["http:", "https:"].includes(parsed.protocol)) {
10
+ return new UrlPath(url);
11
+ }
12
+ }
13
+ catch (_a) {
14
+ // Not a valid URL
15
+ }
16
+ return undefined;
17
+ }
18
+ toString() {
19
+ return this.url;
20
+ }
21
+ }
22
+ //# sourceMappingURL=urlPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"urlPath.js","sourceRoot":"","sources":["../../../src/types/file/urlPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,OAAO,OAAO;IAGlB,YAAY,GAAW;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,MAAM,CAAC,GAAW;QAC9B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5B,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAClD,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,kBAAkB;QACpB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ export declare class FlagsProvider {
2
+ private static readonly inputFlagName;
3
+ static input: {
4
+ [FlagsProvider.inputFlagName]: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
5
+ };
6
+ static destination(artifact: string, artifactName: string): {
7
+ destination: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ static authKey: {
10
+ "auth-key": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ static force: {
13
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
14
+ };
15
+ }
@@ -0,0 +1,34 @@
1
+ import { Flags } from "@oclif/core";
2
+ export class FlagsProvider {
3
+ static destination(artifact, artifactName) {
4
+ return {
5
+ destination: Flags.string({
6
+ char: "d",
7
+ description: `[default: <${FlagsProvider.inputFlagName}>/${artifact}] path where the ${artifactName} will be generated.`
8
+ })
9
+ };
10
+ }
11
+ }
12
+ FlagsProvider.inputFlagName = "input";
13
+ // Common folder flag group
14
+ FlagsProvider.input = {
15
+ [FlagsProvider.inputFlagName]: Flags.string({
16
+ char: "i",
17
+ description: "[default: ./] path to the parent directory containing the 'src' directory, which includes API specifications and configuration files."
18
+ })
19
+ };
20
+ // Auth key group
21
+ FlagsProvider.authKey = {
22
+ "auth-key": Flags.string({
23
+ char: "k",
24
+ description: "override current authentication state with an authentication key."
25
+ })
26
+ };
27
+ FlagsProvider.force = {
28
+ force: Flags.boolean({
29
+ char: "f",
30
+ default: false,
31
+ description: "overwrite changes without asking for user consent."
32
+ })
33
+ };
34
+ //# sourceMappingURL=flags-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags-provider.js","sourceRoot":"","sources":["../../src/types/flags-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,MAAM,OAAO,aAAa;IAWjB,MAAM,CAAC,WAAW,CAAC,QAAgB,EAAE,YAAoB;QAC9D,OAAO;YACL,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC;gBACxB,IAAI,EAAE,GAAG;gBACT,WAAW,EAAE,cAAc,aAAa,CAAC,aAAa,KAAK,QAAQ,oBAAoB,YAAY,qBAAqB;aACzH,CAAC;SACH,CAAC;IACJ,CAAC;;AAjBuB,2BAAa,GAAW,OAAgB,CAAC;AACjE,2BAA2B;AACb,mBAAK,GAAG;IACpB,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC;QAC1C,IAAI,EAAE,GAAG;QACT,WAAW,EACT,uIAAuI;KAC1I,CAAC;CACH,CAAC;AAWF,iBAAiB;AACH,qBAAO,GAAG;IACtB,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC;QACvB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,mEAAmE;KACjF,CAAC;CACH,CAAC;AAEY,mBAAK,GAAG;IACpB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,oDAAoD;KAClE,CAAC;CACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { DirectoryPath } from "./file/directoryPath.js";
2
+ import { FilePath } from "./file/filePath.js";
3
+ export declare class PortalContext {
4
+ private readonly portalDirectory;
5
+ private readonly fileService;
6
+ private readonly zipService;
7
+ constructor(portalDirectory: DirectoryPath);
8
+ private get ZipPath();
9
+ private get reportPath();
10
+ exists(): Promise<boolean>;
11
+ save(tempPortalFilePath: FilePath, zipPortal: boolean): Promise<void>;
12
+ saveError(tempErrorFilePath: FilePath): Promise<FilePath>;
13
+ }