@apimatic/cli 1.5.0 → 2.0.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 (610) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -212
  3. package/apimatic.schema.json +550 -0
  4. package/lib/actions/action-result.js +3 -0
  5. package/lib/actions/action-result.js.map +1 -1
  6. package/lib/actions/api/transform.js +36 -33
  7. package/lib/actions/api/transform.js.map +1 -1
  8. package/lib/actions/api/validate.d.ts +9 -6
  9. package/lib/actions/api/validate.js +44 -38
  10. package/lib/actions/api/validate.js.map +1 -1
  11. package/lib/actions/auth/login.js +7 -4
  12. package/lib/actions/auth/login.js.map +1 -1
  13. package/lib/actions/auth/logout.js +2 -1
  14. package/lib/actions/auth/logout.js.map +1 -1
  15. package/lib/actions/auth/status.js +5 -3
  16. package/lib/actions/auth/status.js.map +1 -1
  17. package/lib/actions/plugin/generate.d.ts +5 -1
  18. package/lib/actions/plugin/generate.js +83 -56
  19. package/lib/actions/plugin/generate.js.map +1 -1
  20. package/lib/actions/plugin/publish.d.ts +2 -1
  21. package/lib/actions/plugin/publish.js +34 -37
  22. package/lib/actions/plugin/publish.js.map +1 -1
  23. package/lib/actions/plugin/record-metadata.d.ts +3 -2
  24. package/lib/actions/plugin/record-metadata.js +33 -30
  25. package/lib/actions/plugin/record-metadata.js.map +1 -1
  26. package/lib/actions/portal/generate.d.ts +8 -6
  27. package/lib/actions/portal/generate.js +50 -61
  28. package/lib/actions/portal/generate.js.map +1 -1
  29. package/lib/actions/portal/prepare-project.d.ts +25 -0
  30. package/lib/actions/portal/prepare-project.js +68 -0
  31. package/lib/actions/portal/prepare-project.js.map +1 -0
  32. package/lib/actions/portal/serve.d.ts +21 -6
  33. package/lib/actions/portal/serve.js +170 -153
  34. package/lib/actions/portal/serve.js.map +1 -1
  35. package/lib/actions/publishing/profile/list.js +4 -2
  36. package/lib/actions/publishing/profile/list.js.map +1 -1
  37. package/lib/actions/quickstart.d.ts +23 -5
  38. package/lib/actions/quickstart.js +221 -21
  39. package/lib/actions/quickstart.js.map +1 -1
  40. package/lib/actions/sdk/generate.d.ts +4 -7
  41. package/lib/actions/sdk/generate.js +53 -93
  42. package/lib/actions/sdk/generate.js.map +1 -1
  43. package/lib/actions/sdk/publish/interactive.d.ts +4 -3
  44. package/lib/actions/sdk/publish/interactive.js +96 -97
  45. package/lib/actions/sdk/publish/interactive.js.map +1 -1
  46. package/lib/actions/sdk/publish/non-interactive.d.ts +4 -2
  47. package/lib/actions/sdk/publish/non-interactive.js +91 -90
  48. package/lib/actions/sdk/publish/non-interactive.js.map +1 -1
  49. package/lib/actions/sdk/publish.d.ts +3 -2
  50. package/lib/actions/sdk/publish.js +55 -53
  51. package/lib/actions/sdk/publish.js.map +1 -1
  52. package/lib/actions/sdk/record-published-sdk.d.ts +14 -0
  53. package/lib/actions/sdk/record-published-sdk.js +57 -0
  54. package/lib/actions/sdk/record-published-sdk.js.map +1 -0
  55. package/lib/client-utils/auth-manager.js +1 -1
  56. package/lib/client-utils/auth-manager.js.map +1 -1
  57. package/lib/commands/api/transform.d.ts +1 -1
  58. package/lib/commands/api/transform.js +44 -40
  59. package/lib/commands/api/transform.js.map +1 -1
  60. package/lib/commands/api/validate.js +16 -16
  61. package/lib/commands/api/validate.js.map +1 -1
  62. package/lib/commands/auth/login.js +14 -15
  63. package/lib/commands/auth/login.js.map +1 -1
  64. package/lib/commands/auth/logout.js +5 -6
  65. package/lib/commands/auth/logout.js.map +1 -1
  66. package/lib/commands/auth/status.js +4 -5
  67. package/lib/commands/auth/status.js.map +1 -1
  68. package/lib/commands/plugin/generate.d.ts +3 -3
  69. package/lib/commands/plugin/generate.js +20 -20
  70. package/lib/commands/plugin/generate.js.map +1 -1
  71. package/lib/commands/plugin/publish.js +18 -18
  72. package/lib/commands/plugin/publish.js.map +1 -1
  73. package/lib/commands/portal/generate.d.ts +9 -8
  74. package/lib/commands/portal/generate.js +36 -27
  75. package/lib/commands/portal/generate.js.map +1 -1
  76. package/lib/commands/portal/serve.d.ts +7 -9
  77. package/lib/commands/portal/serve.js +41 -44
  78. package/lib/commands/portal/serve.js.map +1 -1
  79. package/lib/commands/publishing/profile/list.js +8 -12
  80. package/lib/commands/publishing/profile/list.js.map +1 -1
  81. package/lib/commands/quickstart.d.ts +5 -5
  82. package/lib/commands/quickstart.js +18 -24
  83. package/lib/commands/quickstart.js.map +1 -1
  84. package/lib/commands/sdk/generate.d.ts +5 -7
  85. package/lib/commands/sdk/generate.js +58 -70
  86. package/lib/commands/sdk/generate.js.map +1 -1
  87. package/lib/commands/sdk/publish.d.ts +6 -7
  88. package/lib/commands/sdk/publish.js +66 -60
  89. package/lib/commands/sdk/publish.js.map +1 -1
  90. package/lib/hooks/node-version.d.ts +3 -0
  91. package/lib/hooks/node-version.js +12 -0
  92. package/lib/hooks/node-version.js.map +1 -0
  93. package/lib/hooks/not-found.js +2 -3
  94. package/lib/hooks/not-found.js.map +1 -1
  95. package/lib/hooks/utils.d.ts +4 -2
  96. package/lib/hooks/utils.js +2 -2
  97. package/lib/hooks/utils.js.map +1 -1
  98. package/lib/infrastructure/env-info.d.ts +3 -0
  99. package/lib/infrastructure/env-info.js +13 -6
  100. package/lib/infrastructure/env-info.js.map +1 -1
  101. package/lib/infrastructure/file-service.d.ts +35 -8
  102. package/lib/infrastructure/file-service.js +149 -53
  103. package/lib/infrastructure/file-service.js.map +1 -1
  104. package/lib/infrastructure/file-watch-service.d.ts +40 -0
  105. package/lib/infrastructure/file-watch-service.js +167 -0
  106. package/lib/infrastructure/file-watch-service.js.map +1 -0
  107. package/lib/infrastructure/generation-status-poller.d.ts +8 -7
  108. package/lib/infrastructure/generation-status-poller.js +20 -12
  109. package/lib/infrastructure/generation-status-poller.js.map +1 -1
  110. package/lib/infrastructure/launcher-service.js +6 -6
  111. package/lib/infrastructure/launcher-service.js.map +1 -1
  112. package/lib/infrastructure/network-service.d.ts +3 -0
  113. package/lib/infrastructure/network-service.js +15 -1
  114. package/lib/infrastructure/network-service.js.map +1 -1
  115. package/lib/infrastructure/portal-build-service.d.ts +19 -0
  116. package/lib/infrastructure/portal-build-service.js +58 -0
  117. package/lib/infrastructure/portal-build-service.js.map +1 -0
  118. package/lib/infrastructure/portal-dev-server-service.d.ts +29 -0
  119. package/lib/infrastructure/portal-dev-server-service.js +135 -0
  120. package/lib/infrastructure/portal-dev-server-service.js.map +1 -0
  121. package/lib/infrastructure/portal-pages-service.d.ts +17 -0
  122. package/lib/infrastructure/portal-pages-service.js +103 -0
  123. package/lib/infrastructure/portal-pages-service.js.map +1 -0
  124. package/lib/infrastructure/portal-project-service.d.ts +77 -0
  125. package/lib/infrastructure/portal-project-service.js +309 -0
  126. package/lib/infrastructure/portal-project-service.js.map +1 -0
  127. package/lib/infrastructure/service-error.d.ts +1 -0
  128. package/lib/infrastructure/service-error.js +39 -41
  129. package/lib/infrastructure/service-error.js.map +1 -1
  130. package/lib/infrastructure/services/api-client-factory.js +15 -13
  131. package/lib/infrastructure/services/api-client-factory.js.map +1 -1
  132. package/lib/infrastructure/services/api-service.d.ts +7 -5
  133. package/lib/infrastructure/services/api-service.js +28 -20
  134. package/lib/infrastructure/services/api-service.js.map +1 -1
  135. package/lib/infrastructure/services/auth-service.js +4 -9
  136. package/lib/infrastructure/services/auth-service.js.map +1 -1
  137. package/lib/infrastructure/services/file-download-service.js +3 -3
  138. package/lib/infrastructure/services/file-download-service.js.map +1 -1
  139. package/lib/infrastructure/services/plugin-service.d.ts +1 -8
  140. package/lib/infrastructure/services/plugin-service.js +11 -22
  141. package/lib/infrastructure/services/plugin-service.js.map +1 -1
  142. package/lib/infrastructure/services/portal-artifacts-service.d.ts +44 -0
  143. package/lib/infrastructure/services/portal-artifacts-service.js +268 -0
  144. package/lib/infrastructure/services/portal-artifacts-service.js.map +1 -0
  145. package/lib/infrastructure/services/portal-authorization-service.d.ts +22 -0
  146. package/lib/infrastructure/services/portal-authorization-service.js +23 -0
  147. package/lib/infrastructure/services/portal-authorization-service.js.map +1 -0
  148. package/lib/infrastructure/services/publishing-api-service.d.ts +1 -1
  149. package/lib/infrastructure/services/publishing-api-service.js +11 -15
  150. package/lib/infrastructure/services/publishing-api-service.js.map +1 -1
  151. package/lib/infrastructure/services/sdk-generation-service.d.ts +21 -0
  152. package/lib/infrastructure/services/sdk-generation-service.js +118 -0
  153. package/lib/infrastructure/services/sdk-generation-service.js.map +1 -0
  154. package/lib/infrastructure/services/telemetry-service.js +5 -4
  155. package/lib/infrastructure/services/telemetry-service.js.map +1 -1
  156. package/lib/infrastructure/services/transformation-service.js +29 -32
  157. package/lib/infrastructure/services/transformation-service.js.map +1 -1
  158. package/lib/infrastructure/services/validation-service.d.ts +12 -53
  159. package/lib/infrastructure/services/validation-service.js +24 -199
  160. package/lib/infrastructure/services/validation-service.js.map +1 -1
  161. package/lib/infrastructure/timer-extensions.d.ts +2 -0
  162. package/lib/infrastructure/timer-extensions.js +10 -0
  163. package/lib/infrastructure/timer-extensions.js.map +1 -0
  164. package/lib/infrastructure/tmp-extensions.d.ts +31 -1
  165. package/lib/infrastructure/tmp-extensions.js +86 -3
  166. package/lib/infrastructure/tmp-extensions.js.map +1 -1
  167. package/lib/infrastructure/zip-service.js +2 -2
  168. package/lib/infrastructure/zip-service.js.map +1 -1
  169. package/lib/prompts/api/validate.d.ts +6 -7
  170. package/lib/prompts/api/validate.js +12 -12
  171. package/lib/prompts/api/validate.js.map +1 -1
  172. package/lib/prompts/format.d.ts +4 -0
  173. package/lib/prompts/format.js +5 -0
  174. package/lib/prompts/format.js.map +1 -1
  175. package/lib/prompts/plugin/generate.d.ts +17 -12
  176. package/lib/prompts/plugin/generate.js +94 -44
  177. package/lib/prompts/plugin/generate.js.map +1 -1
  178. package/lib/prompts/plugin/publish.d.ts +2 -1
  179. package/lib/prompts/plugin/publish.js +8 -7
  180. package/lib/prompts/plugin/publish.js.map +1 -1
  181. package/lib/prompts/plugin/record-metadata.d.ts +1 -0
  182. package/lib/prompts/plugin/record-metadata.js +10 -7
  183. package/lib/prompts/plugin/record-metadata.js.map +1 -1
  184. package/lib/prompts/portal/artifacts.d.ts +8 -0
  185. package/lib/prompts/portal/artifacts.js +26 -0
  186. package/lib/prompts/portal/artifacts.js.map +1 -0
  187. package/lib/prompts/portal/authorization.d.ts +6 -0
  188. package/lib/prompts/portal/authorization.js +29 -0
  189. package/lib/prompts/portal/authorization.js.map +1 -0
  190. package/lib/prompts/portal/code-samples.d.ts +1 -0
  191. package/lib/prompts/portal/code-samples.js +9 -0
  192. package/lib/prompts/portal/code-samples.js.map +1 -0
  193. package/lib/prompts/portal/generate.d.ts +14 -9
  194. package/lib/prompts/portal/generate.js +48 -26
  195. package/lib/prompts/portal/generate.js.map +1 -1
  196. package/lib/prompts/portal/prepare-project.d.ts +20 -0
  197. package/lib/prompts/portal/prepare-project.js +36 -0
  198. package/lib/prompts/portal/prepare-project.js.map +1 -0
  199. package/lib/prompts/portal/serve.d.ts +32 -12
  200. package/lib/prompts/portal/serve.js +100 -39
  201. package/lib/prompts/portal/serve.js.map +1 -1
  202. package/lib/prompts/portal/source.d.ts +26 -0
  203. package/lib/prompts/portal/source.js +253 -0
  204. package/lib/prompts/portal/source.js.map +1 -0
  205. package/lib/prompts/prompt.d.ts +11 -3
  206. package/lib/prompts/prompt.js +39 -15
  207. package/lib/prompts/prompt.js.map +1 -1
  208. package/lib/prompts/quickstart.d.ts +46 -3
  209. package/lib/prompts/quickstart.js +193 -12
  210. package/lib/prompts/quickstart.js.map +1 -1
  211. package/lib/prompts/sdk/generate.d.ts +15 -13
  212. package/lib/prompts/sdk/generate.js +29 -32
  213. package/lib/prompts/sdk/generate.js.map +1 -1
  214. package/lib/prompts/sdk/publish/interactive.d.ts +10 -6
  215. package/lib/prompts/sdk/publish/interactive.js +26 -24
  216. package/lib/prompts/sdk/publish/interactive.js.map +1 -1
  217. package/lib/prompts/sdk/publish/non-interactive.d.ts +2 -1
  218. package/lib/prompts/sdk/publish/non-interactive.js +5 -4
  219. package/lib/prompts/sdk/publish/non-interactive.js.map +1 -1
  220. package/lib/prompts/sdk/publish.d.ts +3 -3
  221. package/lib/prompts/sdk/publish.js +13 -17
  222. package/lib/prompts/sdk/publish.js.map +1 -1
  223. package/lib/prompts/sdk/record-published-sdk.d.ts +7 -0
  224. package/lib/prompts/sdk/record-published-sdk.js +26 -0
  225. package/lib/prompts/sdk/record-published-sdk.js.map +1 -0
  226. package/lib/types/apimatic-config/document.d.ts +68 -0
  227. package/lib/types/apimatic-config/document.js +161 -0
  228. package/lib/types/apimatic-config/document.js.map +1 -0
  229. package/lib/types/apimatic-config/languages-block.d.ts +39 -0
  230. package/lib/types/apimatic-config/languages-block.js +58 -0
  231. package/lib/types/apimatic-config/languages-block.js.map +1 -0
  232. package/lib/types/apimatic-config-context.d.ts +48 -0
  233. package/lib/types/apimatic-config-context.js +121 -0
  234. package/lib/types/apimatic-config-context.js.map +1 -0
  235. package/lib/types/build/build.d.ts +1 -89
  236. package/lib/types/build/build.js +6 -161
  237. package/lib/types/build/build.js.map +1 -1
  238. package/lib/types/events/domain-event.js +3 -0
  239. package/lib/types/events/domain-event.js.map +1 -1
  240. package/lib/types/events/quickstart-completed.js +3 -3
  241. package/lib/types/events/quickstart-completed.js.map +1 -1
  242. package/lib/types/events/quickstart-initiated.js +3 -3
  243. package/lib/types/events/quickstart-initiated.js.map +1 -1
  244. package/lib/types/events/sdk-publish-validation-failed.js +1 -1
  245. package/lib/types/events/sdk-publish-validation-failed.js.map +1 -1
  246. package/lib/types/file/directory.d.ts +4 -9
  247. package/lib/types/file/directory.js +17 -65
  248. package/lib/types/file/directory.js.map +1 -1
  249. package/lib/types/file/directoryPath.d.ts +17 -0
  250. package/lib/types/file/directoryPath.js +47 -2
  251. package/lib/types/file/directoryPath.js.map +1 -1
  252. package/lib/types/file/fileName.d.ts +8 -0
  253. package/lib/types/file/fileName.js +28 -6
  254. package/lib/types/file/fileName.js.map +1 -1
  255. package/lib/types/file/filePath.d.ts +18 -2
  256. package/lib/types/file/filePath.js +39 -4
  257. package/lib/types/file/filePath.js.map +1 -1
  258. package/lib/types/file/resource-input.js +1 -2
  259. package/lib/types/file/resource-input.js.map +1 -1
  260. package/lib/types/file/urlPath.js +2 -1
  261. package/lib/types/file/urlPath.js.map +1 -1
  262. package/lib/types/flags-provider.js +22 -22
  263. package/lib/types/flags-provider.js.map +1 -1
  264. package/lib/types/package-settings-context.js +2 -1
  265. package/lib/types/package-settings-context.js.map +1 -1
  266. package/lib/types/plugin/plugin-config.d.ts +10 -50
  267. package/lib/types/plugin/plugin-config.js +7 -1
  268. package/lib/types/plugin/plugin-config.js.map +1 -1
  269. package/lib/types/plugin-config-context.d.ts +30 -37
  270. package/lib/types/plugin-config-context.js +108 -139
  271. package/lib/types/plugin-config-context.js.map +1 -1
  272. package/lib/types/plugin-context.js +3 -2
  273. package/lib/types/plugin-context.js.map +1 -1
  274. package/lib/types/portal/code-samples.d.ts +27 -0
  275. package/lib/types/portal/code-samples.js +67 -0
  276. package/lib/types/portal/code-samples.js.map +1 -0
  277. package/lib/types/portal/config/ai-config.d.ts +15 -0
  278. package/lib/types/portal/config/ai-config.js +26 -0
  279. package/lib/types/portal/config/ai-config.js.map +1 -0
  280. package/lib/types/portal/config/brand-config.d.ts +55 -0
  281. package/lib/types/portal/config/brand-config.js +105 -0
  282. package/lib/types/portal/config/brand-config.js.map +1 -0
  283. package/lib/types/portal/config/color.d.ts +19 -0
  284. package/lib/types/portal/config/color.js +43 -0
  285. package/lib/types/portal/config/color.js.map +1 -0
  286. package/lib/types/portal/config/fields.d.ts +23 -0
  287. package/lib/types/portal/config/fields.js +67 -0
  288. package/lib/types/portal/config/fields.js.map +1 -0
  289. package/lib/types/portal/config/link.d.ts +18 -0
  290. package/lib/types/portal/config/link.js +72 -0
  291. package/lib/types/portal/config/link.js.map +1 -0
  292. package/lib/types/portal/config/navigation-config.d.ts +13 -0
  293. package/lib/types/portal/config/navigation-config.js +30 -0
  294. package/lib/types/portal/config/navigation-config.js.map +1 -0
  295. package/lib/types/portal/config/site-config.d.ts +32 -0
  296. package/lib/types/portal/config/site-config.js +88 -0
  297. package/lib/types/portal/config/site-config.js.map +1 -0
  298. package/lib/types/portal/config/static-asset.d.ts +25 -0
  299. package/lib/types/portal/config/static-asset.js +77 -0
  300. package/lib/types/portal/config/static-asset.js.map +1 -0
  301. package/lib/types/portal/content-notices.d.ts +20 -0
  302. package/lib/types/portal/content-notices.js +2 -0
  303. package/lib/types/portal/content-notices.js.map +1 -0
  304. package/lib/types/portal/content-tree.d.ts +103 -0
  305. package/lib/types/portal/content-tree.js +344 -0
  306. package/lib/types/portal/content-tree.js.map +1 -0
  307. package/lib/types/portal/endpoint.d.ts +6 -0
  308. package/lib/types/portal/endpoint.js +12 -0
  309. package/lib/types/portal/endpoint.js.map +1 -0
  310. package/lib/types/portal/generated-pages.d.ts +68 -0
  311. package/lib/types/portal/generated-pages.js +111 -0
  312. package/lib/types/portal/generated-pages.js.map +1 -0
  313. package/lib/types/portal/generation-status.d.ts +31 -0
  314. package/lib/types/portal/generation-status.js +26 -0
  315. package/lib/types/portal/generation-status.js.map +1 -0
  316. package/lib/types/portal/openapi-document.d.ts +48 -0
  317. package/lib/types/portal/openapi-document.js +138 -0
  318. package/lib/types/portal/openapi-document.js.map +1 -0
  319. package/lib/types/portal/page-fragments.d.ts +13 -0
  320. package/lib/types/portal/page-fragments.js +24 -0
  321. package/lib/types/portal/page-fragments.js.map +1 -0
  322. package/lib/types/portal/page-template.d.ts +15 -0
  323. package/lib/types/portal/page-template.js +64 -0
  324. package/lib/types/portal/page-template.js.map +1 -0
  325. package/lib/types/portal/page.d.ts +24 -0
  326. package/lib/types/portal/page.js +100 -0
  327. package/lib/types/portal/page.js.map +1 -0
  328. package/lib/types/portal/portal-artifacts.d.ts +25 -0
  329. package/lib/types/portal/portal-artifacts.js +30 -0
  330. package/lib/types/portal/portal-artifacts.js.map +1 -0
  331. package/lib/types/portal/portal-config.d.ts +69 -0
  332. package/lib/types/portal/portal-config.js +105 -0
  333. package/lib/types/portal/portal-config.js.map +1 -0
  334. package/lib/types/portal/portal-downloads.d.ts +8 -0
  335. package/lib/types/portal/portal-downloads.js +14 -0
  336. package/lib/types/portal/portal-downloads.js.map +1 -0
  337. package/lib/types/portal/portal-languages.d.ts +15 -0
  338. package/lib/types/portal/portal-languages.js +45 -0
  339. package/lib/types/portal/portal-languages.js.map +1 -0
  340. package/lib/types/portal/portal-navigation.d.ts +65 -0
  341. package/lib/types/portal/portal-navigation.js +217 -0
  342. package/lib/types/portal/portal-navigation.js.map +1 -0
  343. package/lib/types/portal/portal-sdk.d.ts +15 -0
  344. package/lib/types/portal/portal-sdk.js +28 -0
  345. package/lib/types/portal/portal-sdk.js.map +1 -0
  346. package/lib/types/portal/portal-source.d.ts +129 -0
  347. package/lib/types/portal/portal-source.js +2 -0
  348. package/lib/types/portal/portal-source.js.map +1 -0
  349. package/lib/types/portal/portal-stylesheet.d.ts +19 -0
  350. package/lib/types/portal/portal-stylesheet.js +40 -0
  351. package/lib/types/portal/portal-stylesheet.js.map +1 -0
  352. package/lib/types/portal/portal-tabs.d.ts +33 -0
  353. package/lib/types/portal/portal-tabs.js +38 -0
  354. package/lib/types/portal/portal-tabs.js.map +1 -0
  355. package/lib/types/portal/preview-config.d.ts +20 -0
  356. package/lib/types/portal/preview-config.js +32 -0
  357. package/lib/types/portal/preview-config.js.map +1 -0
  358. package/lib/types/portal/preview-content.d.ts +18 -0
  359. package/lib/types/portal/preview-content.js +50 -0
  360. package/lib/types/portal/preview-content.js.map +1 -0
  361. package/lib/types/portal/published-package.d.ts +12 -0
  362. package/lib/types/portal/published-package.js +35 -0
  363. package/lib/types/portal/published-package.js.map +1 -0
  364. package/lib/types/portal/unknown-fields.d.ts +5 -0
  365. package/lib/types/portal/unknown-fields.js +10 -0
  366. package/lib/types/portal/unknown-fields.js.map +1 -0
  367. package/lib/types/portal-context.d.ts +38 -6
  368. package/lib/types/portal-context.js +71 -24
  369. package/lib/types/portal-context.js.map +1 -1
  370. package/lib/types/portal-source-context.d.ts +77 -0
  371. package/lib/types/portal-source-context.js +408 -0
  372. package/lib/types/portal-source-context.js.map +1 -0
  373. package/lib/types/project-context.d.ts +49 -0
  374. package/lib/types/project-context.js +151 -0
  375. package/lib/types/project-context.js.map +1 -0
  376. package/lib/types/project-layout.d.ts +9 -0
  377. package/lib/types/project-layout.js +10 -0
  378. package/lib/types/project-layout.js.map +1 -0
  379. package/lib/types/publish/package-settings-configuration.d.ts +2 -0
  380. package/lib/types/publish/profile-id.js +1 -0
  381. package/lib/types/publish/profile-id.js.map +1 -1
  382. package/lib/types/publish/publishing-profile.d.ts +3 -1
  383. package/lib/types/publish/publishing-profile.js +33 -15
  384. package/lib/types/publish/publishing-profile.js.map +1 -1
  385. package/lib/types/publish/publishing-profiles.js +2 -1
  386. package/lib/types/publish/publishing-profiles.js.map +1 -1
  387. package/lib/types/publish/version.js +1 -0
  388. package/lib/types/publish/version.js.map +1 -1
  389. package/lib/types/resource-context.js +3 -2
  390. package/lib/types/resource-context.js.map +1 -1
  391. package/lib/types/sdk/generate.d.ts +22 -16
  392. package/lib/types/sdk/generate.js +64 -41
  393. package/lib/types/sdk/generate.js.map +1 -1
  394. package/lib/types/sdk/stability-choice.d.ts +12 -0
  395. package/lib/types/sdk/stability-choice.js +24 -0
  396. package/lib/types/sdk/stability-choice.js.map +1 -0
  397. package/lib/types/sdk-context.d.ts +4 -5
  398. package/lib/types/sdk-context.js +10 -18
  399. package/lib/types/sdk-context.js.map +1 -1
  400. package/lib/types/spec-context.d.ts +5 -4
  401. package/lib/types/spec-context.js +9 -8
  402. package/lib/types/spec-context.js.map +1 -1
  403. package/lib/types/temp-context.d.ts +1 -1
  404. package/lib/types/temp-context.js +5 -4
  405. package/lib/types/temp-context.js.map +1 -1
  406. package/lib/types/transform-context.d.ts +9 -5
  407. package/lib/types/transform-context.js +21 -18
  408. package/lib/types/transform-context.js.map +1 -1
  409. package/lib/utils/error-utils.d.ts +2 -0
  410. package/lib/utils/error-utils.js +5 -0
  411. package/lib/utils/error-utils.js.map +1 -0
  412. package/lib/utils/json-utils.d.ts +2 -0
  413. package/lib/utils/json-utils.js +4 -0
  414. package/lib/utils/json-utils.js.map +1 -0
  415. package/lib/utils/string-utils.d.ts +8 -1
  416. package/lib/utils/string-utils.js +13 -26
  417. package/lib/utils/string-utils.js.map +1 -1
  418. package/lib/utils/utils.d.ts +1 -3
  419. package/lib/utils/utils.js +12 -40
  420. package/lib/utils/utils.js.map +1 -1
  421. package/oclif.manifest.json +154 -442
  422. package/package.json +47 -25
  423. package/portal-pages/context-plugin.mdx +26 -0
  424. package/portal-pages/sdk.mdx +8 -0
  425. package/portal-pages/sdks.mdx +11 -0
  426. package/portal-template/NOTICE +37 -0
  427. package/portal-template/downloads.ts +41 -0
  428. package/portal-template/generated-pages-reload.ts +51 -0
  429. package/portal-template/package.json +11 -0
  430. package/portal-template/portal-config.ts +32 -0
  431. package/portal-template/prerender-pages.ts +81 -0
  432. package/portal-template/spec-reload.ts +26 -0
  433. package/portal-template/src/components/api-page.tsx +15 -0
  434. package/portal-template/src/components/code-block.tsx +9 -0
  435. package/portal-template/src/components/command-block.tsx +50 -0
  436. package/portal-template/src/components/example-layout.tsx +99 -0
  437. package/portal-template/src/components/logos.tsx +127 -0
  438. package/portal-template/src/components/mdx.tsx +28 -0
  439. package/portal-template/src/components/not-found.tsx +11 -0
  440. package/portal-template/src/components/plugin-install.tsx +22 -0
  441. package/portal-template/src/components/plugin-support.tsx +53 -0
  442. package/portal-template/src/components/sdk-actions.tsx +79 -0
  443. package/portal-template/src/components/sdk-cards.tsx +100 -0
  444. package/portal-template/src/components/search.tsx +41 -0
  445. package/portal-template/src/components/usage-tabs.tsx +92 -0
  446. package/portal-template/src/lib/code-samples.server.ts +40 -0
  447. package/portal-template/src/lib/code-samples.ts +43 -0
  448. package/portal-template/src/lib/code-titles.ts +29 -0
  449. package/portal-template/src/lib/install-command.ts +13 -0
  450. package/portal-template/src/lib/json.ts +5 -0
  451. package/portal-template/src/lib/layout.shared.tsx +41 -0
  452. package/portal-template/src/lib/layout.tsx +16 -0
  453. package/portal-template/src/lib/llms.server.ts +54 -0
  454. package/portal-template/src/lib/media-adapters.ts +34 -0
  455. package/portal-template/src/lib/navigation.ts +406 -0
  456. package/portal-template/src/lib/openapi-bundle.server.ts +343 -0
  457. package/portal-template/src/lib/openapi-filter.ts +191 -0
  458. package/portal-template/src/lib/openapi-labels.ts +15 -0
  459. package/portal-template/src/lib/openapi-methods.ts +12 -0
  460. package/portal-template/src/lib/openapi-section.server.ts +280 -0
  461. package/portal-template/src/lib/openapi-slim.ts +202 -0
  462. package/portal-template/src/lib/openapi.server.ts +16 -0
  463. package/portal-template/src/lib/portal-types.ts +36 -0
  464. package/portal-template/src/lib/portal.server.ts +13 -0
  465. package/portal-template/src/lib/portal.ts +11 -0
  466. package/portal-template/src/lib/rehype-code-titles.ts +53 -0
  467. package/portal-template/src/lib/request-examples.ts +72 -0
  468. package/portal-template/src/lib/seo.ts +21 -0
  469. package/portal-template/src/lib/shared.ts +51 -0
  470. package/portal-template/src/lib/shiki-bundle.ts +104 -0
  471. package/portal-template/src/lib/sitemap.server.ts +20 -0
  472. package/portal-template/src/lib/source.server.ts +27 -0
  473. package/portal-template/src/lib/source.ts +49 -0
  474. package/portal-template/src/lib/tabs.ts +37 -0
  475. package/portal-template/src/router.tsx +12 -0
  476. package/portal-template/src/routes/$.tsx +194 -0
  477. package/portal-template/src/routes/__root.tsx +56 -0
  478. package/portal-template/src/routes/api/search[.]json.ts +9 -0
  479. package/portal-template/src/routes/llms-full[.]txt.ts +10 -0
  480. package/portal-template/src/routes/llms[.]txt.ts +10 -0
  481. package/portal-template/src/routes/robots[.]txt.ts +10 -0
  482. package/portal-template/src/routes/sitemap[.]xml.ts +10 -0
  483. package/portal-template/src/routes/spa-shell.tsx +7 -0
  484. package/portal-template/src/routes/{$}[.]md.ts +21 -0
  485. package/portal-template/src/styles/app.css +33 -0
  486. package/portal-template/tsconfig.json +26 -0
  487. package/portal-template/vite.config.ts +68 -0
  488. package/lib/actions/plugin/record-sdk.d.ts +0 -14
  489. package/lib/actions/plugin/record-sdk.js +0 -60
  490. package/lib/actions/plugin/record-sdk.js.map +0 -1
  491. package/lib/actions/portal/copilot.d.ts +0 -17
  492. package/lib/actions/portal/copilot.js +0 -89
  493. package/lib/actions/portal/copilot.js.map +0 -1
  494. package/lib/actions/portal/quickstart.d.ts +0 -18
  495. package/lib/actions/portal/quickstart.js +0 -238
  496. package/lib/actions/portal/quickstart.js.map +0 -1
  497. package/lib/actions/portal/recipe/new-recipe.d.ts +0 -15
  498. package/lib/actions/portal/recipe/new-recipe.js +0 -177
  499. package/lib/actions/portal/recipe/new-recipe.js.map +0 -1
  500. package/lib/actions/portal/toc/new-toc.d.ts +0 -21
  501. package/lib/actions/portal/toc/new-toc.js +0 -95
  502. package/lib/actions/portal/toc/new-toc.js.map +0 -1
  503. package/lib/actions/sdk/merge-source-tree.d.ts +0 -12
  504. package/lib/actions/sdk/merge-source-tree.js +0 -78
  505. package/lib/actions/sdk/merge-source-tree.js.map +0 -1
  506. package/lib/actions/sdk/quickstart.d.ts +0 -18
  507. package/lib/actions/sdk/quickstart.js +0 -188
  508. package/lib/actions/sdk/quickstart.js.map +0 -1
  509. package/lib/actions/sdk/save-changes.d.ts +0 -8
  510. package/lib/actions/sdk/save-changes.js +0 -93
  511. package/lib/actions/sdk/save-changes.js.map +0 -1
  512. package/lib/application/portal/recipe/portal-recipe.d.ts +0 -8
  513. package/lib/application/portal/recipe/portal-recipe.js +0 -33
  514. package/lib/application/portal/recipe/portal-recipe.js.map +0 -1
  515. package/lib/application/portal/recipe/recipe-generator.d.ts +0 -21
  516. package/lib/application/portal/recipe/recipe-generator.js +0 -130
  517. package/lib/application/portal/recipe/recipe-generator.js.map +0 -1
  518. package/lib/application/portal/toc/toc-content-parser.d.ts +0 -5
  519. package/lib/application/portal/toc/toc-content-parser.js +0 -44
  520. package/lib/application/portal/toc/toc-content-parser.js.map +0 -1
  521. package/lib/application/portal/toc/toc-structure-generator.d.ts +0 -11
  522. package/lib/application/portal/toc/toc-structure-generator.js +0 -165
  523. package/lib/application/portal/toc/toc-structure-generator.js.map +0 -1
  524. package/lib/commands/portal/copilot.d.ts +0 -13
  525. package/lib/commands/portal/copilot.js +0 -34
  526. package/lib/commands/portal/copilot.js.map +0 -1
  527. package/lib/commands/portal/recipe/new.d.ts +0 -12
  528. package/lib/commands/portal/recipe/new.js +0 -45
  529. package/lib/commands/portal/recipe/new.js.map +0 -1
  530. package/lib/commands/portal/toc/new.d.ts +0 -16
  531. package/lib/commands/portal/toc/new.js +0 -68
  532. package/lib/commands/portal/toc/new.js.map +0 -1
  533. package/lib/commands/sdk/save-changes.d.ts +0 -14
  534. package/lib/commands/sdk/save-changes.js +0 -51
  535. package/lib/commands/sdk/save-changes.js.map +0 -1
  536. package/lib/infrastructure/debounce-service.d.ts +0 -10
  537. package/lib/infrastructure/debounce-service.js +0 -55
  538. package/lib/infrastructure/debounce-service.js.map +0 -1
  539. package/lib/infrastructure/services/portal-service.d.ts +0 -43
  540. package/lib/infrastructure/services/portal-service.js +0 -337
  541. package/lib/infrastructure/services/portal-service.js.map +0 -1
  542. package/lib/prompts/plugin/record-sdk.d.ts +0 -9
  543. package/lib/prompts/plugin/record-sdk.js +0 -40
  544. package/lib/prompts/plugin/record-sdk.js.map +0 -1
  545. package/lib/prompts/portal/copilot.d.ts +0 -18
  546. package/lib/prompts/portal/copilot.js +0 -82
  547. package/lib/prompts/portal/copilot.js.map +0 -1
  548. package/lib/prompts/portal/quickstart.d.ts +0 -42
  549. package/lib/prompts/portal/quickstart.js +0 -243
  550. package/lib/prompts/portal/quickstart.js.map +0 -1
  551. package/lib/prompts/portal/recipe/new-recipe.d.ts +0 -29
  552. package/lib/prompts/portal/recipe/new-recipe.js +0 -165
  553. package/lib/prompts/portal/recipe/new-recipe.js.map +0 -1
  554. package/lib/prompts/portal/toc/new-toc.d.ts +0 -16
  555. package/lib/prompts/portal/toc/new-toc.js +0 -50
  556. package/lib/prompts/portal/toc/new-toc.js.map +0 -1
  557. package/lib/prompts/sdk/merge-source-tree.d.ts +0 -22
  558. package/lib/prompts/sdk/merge-source-tree.js +0 -90
  559. package/lib/prompts/sdk/merge-source-tree.js.map +0 -1
  560. package/lib/prompts/sdk/quickstart.d.ts +0 -38
  561. package/lib/prompts/sdk/quickstart.js +0 -196
  562. package/lib/prompts/sdk/quickstart.js.map +0 -1
  563. package/lib/prompts/sdk/save-changes.d.ts +0 -21
  564. package/lib/prompts/sdk/save-changes.js +0 -84
  565. package/lib/prompts/sdk/save-changes.js.map +0 -1
  566. package/lib/types/build-context.d.ts +0 -26
  567. package/lib/types/build-context.js +0 -111
  568. package/lib/types/build-context.js.map +0 -1
  569. package/lib/types/events/recipe-creation-failed.d.ts +0 -5
  570. package/lib/types/events/recipe-creation-failed.js +0 -8
  571. package/lib/types/events/recipe-creation-failed.js.map +0 -1
  572. package/lib/types/events/sdk-changes-saved.d.ts +0 -8
  573. package/lib/types/events/sdk-changes-saved.js +0 -11
  574. package/lib/types/events/sdk-changes-saved.js.map +0 -1
  575. package/lib/types/events/sdk-changes-tracked.d.ts +0 -8
  576. package/lib/types/events/sdk-changes-tracked.js +0 -11
  577. package/lib/types/events/sdk-changes-tracked.js.map +0 -1
  578. package/lib/types/events/sdk-conflicts-resolved.d.ts +0 -8
  579. package/lib/types/events/sdk-conflicts-resolved.js +0 -11
  580. package/lib/types/events/sdk-conflicts-resolved.js.map +0 -1
  581. package/lib/types/events/toc-creation-failed.d.ts +0 -5
  582. package/lib/types/events/toc-creation-failed.js +0 -8
  583. package/lib/types/events/toc-creation-failed.js.map +0 -1
  584. package/lib/types/merge-source-tree-context.d.ts +0 -28
  585. package/lib/types/merge-source-tree-context.js +0 -63
  586. package/lib/types/merge-source-tree-context.js.map +0 -1
  587. package/lib/types/plugin/language-entry.d.ts +0 -9
  588. package/lib/types/plugin/language-entry.js +0 -64
  589. package/lib/types/plugin/language-entry.js.map +0 -1
  590. package/lib/types/recipe/recipe.d.ts +0 -22
  591. package/lib/types/recipe/recipe.js +0 -6
  592. package/lib/types/recipe/recipe.js.map +0 -1
  593. package/lib/types/recipe-context.d.ts +0 -9
  594. package/lib/types/recipe-context.js +0 -26
  595. package/lib/types/recipe-context.js.map +0 -1
  596. package/lib/types/save-changes-context.d.ts +0 -17
  597. package/lib/types/save-changes-context.js +0 -42
  598. package/lib/types/save-changes-context.js.map +0 -1
  599. package/lib/types/sdl/sdl.d.ts +0 -10
  600. package/lib/types/sdl/sdl.js +0 -18
  601. package/lib/types/sdl/sdl.js.map +0 -1
  602. package/lib/types/toc/toc-components.d.ts +0 -36
  603. package/lib/types/toc/toc-components.js +0 -94
  604. package/lib/types/toc/toc-components.js.map +0 -1
  605. package/lib/types/toc/toc.d.ts +0 -67
  606. package/lib/types/toc/toc.js +0 -2
  607. package/lib/types/toc/toc.js.map +0 -1
  608. package/lib/types/toc-context.d.ts +0 -12
  609. package/lib/types/toc-context.js +0 -26
  610. package/lib/types/toc-context.js.map +0 -1
@@ -1,238 +0,0 @@
1
- import { getAuthInfo } from '../../client-utils/auth-manager.js';
2
- import { FileService } from '../../infrastructure/file-service.js';
3
- import { withDirPath } from '../../infrastructure/tmp-extensions.js';
4
- import { ZipService } from '../../infrastructure/zip-service.js';
5
- import { PortalQuickstartPrompts } from '../../prompts/portal/quickstart.js';
6
- import { UrlPath } from '../../types/file/urlPath.js';
7
- import { LoginAction } from '../auth/login.js';
8
- import { ActionResult } from '../action-result.js';
9
- import { PortalServeAction } from './serve.js';
10
- import { ValidateAction } from '../api/validate.js';
11
- import { BuildContext } from '../../types/build-context.js';
12
- import { TempContext } from '../../types/temp-context.js';
13
- import { FileDownloadService } from '../../infrastructure/services/file-download-service.js';
14
- import { SpecContext } from '../../types/spec-context.js';
15
- import { ValidationService } from '../../infrastructure/services/validation-service.js';
16
- import { FileName } from '../../types/file/fileName.js';
17
- import { ApiService } from '../../infrastructure/services/api-service.js';
18
- import { DEFAULT_COPILOT_WELCOME_MESSAGE } from './copilot.js';
19
- import { mapLanguages } from '../../types/sdk/generate.js';
20
- const defaultPort = 23513;
21
- const defaultBaseUrl = new UrlPath(`http://localhost:${defaultPort}`);
22
- export class PortalQuickstartAction {
23
- constructor(configDir, commandMetadata) {
24
- this.prompts = new PortalQuickstartPrompts();
25
- this.zipService = new ZipService();
26
- this.fileService = new FileService();
27
- this.fileDownloadService = new FileDownloadService();
28
- this.apiService = new ApiService();
29
- this.buildFileUrl = new UrlPath(`https://github.com/apimatic/sample-docs-as-code-portal/archive/refs/heads/master.zip`);
30
- this.defaultSpecUrl = new UrlPath(`https://raw.githubusercontent.com/apimatic/sample-docs-as-code-portal/refs/heads/master/src/spec/openapi.json`);
31
- this.repositoryFolderName = 'sample-docs-as-code-portal-master/src';
32
- this.execute = async () => {
33
- const storedAuth = await getAuthInfo(this.configDir.toString());
34
- if (!(storedAuth === null || storedAuth === void 0 ? void 0 : storedAuth.authKey)) {
35
- const loginResult = await new LoginAction(this.configDir, this.commandMetadata).execute();
36
- if (loginResult.isFailed()) {
37
- return ActionResult.failed();
38
- }
39
- }
40
- return await withDirPath(async (tempDirectory) => {
41
- var _a, _b;
42
- // Fetch account info before anything else so the plan is known up front: it
43
- // gates the on-prem generation exit below, feeds the language step the allowed
44
- // SDK languages, and resolves the API Copilot key later. A lookup failure is fatal.
45
- const accountInfo = await this.apiService.getAccountInfo(this.configDir, this.commandMetadata.shell, null);
46
- if (accountInfo.isErr()) {
47
- this.prompts.accountInfoFetchFailed(accountInfo.error);
48
- return ActionResult.failed();
49
- }
50
- // Quickstart generates the portal locally (on-prem); a plan that doesn't allow
51
- // on-prem generation can't run it, so stop before importing or pruning a spec.
52
- if (!accountInfo.value.isOnPremGenerationAllowed) {
53
- this.prompts.onPremGenerationNotAllowedOnPlan();
54
- return ActionResult.cancelled();
55
- }
56
- const allowedLanguages = mapLanguages(accountInfo.value.allowedLanguages);
57
- // Step 1/4
58
- this.prompts.importSpecStep();
59
- let specPath;
60
- while (!specPath) {
61
- const inputPath = await this.prompts.specPathPrompt(this.defaultSpecUrl);
62
- if (!inputPath) {
63
- this.prompts.noSpecSpecified();
64
- return ActionResult.cancelled();
65
- }
66
- if (inputPath instanceof UrlPath) {
67
- const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(inputPath));
68
- if (downloadFileResult.isErr()) {
69
- this.prompts.serviceError(downloadFileResult.error);
70
- }
71
- else {
72
- const specContext = new SpecContext(tempDirectory);
73
- specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
74
- }
75
- }
76
- else {
77
- const fileExists = await this.fileService.fileExists(inputPath);
78
- if (!fileExists) {
79
- this.prompts.specFileDoesNotExist();
80
- }
81
- else {
82
- specPath = inputPath;
83
- }
84
- }
85
- }
86
- // Step 2/4
87
- this.prompts.validateSpecStep();
88
- const validateAction = new ValidateAction(this.configDir, this.commandMetadata);
89
- const validationResult = await validateAction.execute(specPath, false);
90
- if (validationResult.isFailed()) {
91
- this.prompts.specValidationFailed();
92
- if (!(await this.prompts.useDefaultSpecPrompt())) {
93
- this.prompts.fixYourSpec();
94
- return ActionResult.cancelled();
95
- }
96
- const downloadFileResult = await this.prompts.downloadSpecFile(this.fileDownloadService.downloadFile(this.defaultSpecUrl));
97
- if (downloadFileResult.isErr()) {
98
- this.prompts.serviceError(downloadFileResult.error);
99
- }
100
- else {
101
- const specContext = new SpecContext(tempDirectory);
102
- specPath = await specContext.save(downloadFileResult.value.stream, downloadFileResult.value.filename);
103
- }
104
- }
105
- if (validationResult.isSuccess()) {
106
- const unallowed = validationResult.getValue();
107
- if (unallowed && (((_a = unallowed.Features) === null || _a === void 0 ? void 0 : _a.length) > 0 || unallowed.EndpointCount > unallowed.EndpointLimit)) {
108
- const config = {
109
- features: unallowed.Features.filter((name) => !!name),
110
- endpointsToKeep: unallowed.EndpointLimit
111
- };
112
- const stripUnallowedFeaturesResult = await this.validationService.stripUnallowedFeatures(specPath, config);
113
- if (stripUnallowedFeaturesResult.isErr()) {
114
- this.prompts.splitSpecDetected(unallowed);
115
- return ActionResult.failed();
116
- }
117
- else {
118
- this.prompts.stripUnallowedFeaturesStep(unallowed);
119
- const specContext = new SpecContext(tempDirectory);
120
- specPath = await specContext.save(stripUnallowedFeaturesResult.value, new FileName('pruned-spec.zip'));
121
- }
122
- }
123
- }
124
- // Step 3/4
125
- this.prompts.selectLanguagesStep();
126
- let languages;
127
- if (allowedLanguages.length === 0) {
128
- // With no SDK languages on the plan there's nothing to select, so skip the
129
- // menu and build the portal with HTTP documentation only.
130
- this.prompts.httpOnlyPortalOnPlan();
131
- languages = ['http'];
132
- }
133
- else {
134
- const selectedLanguages = await this.prompts.selectLanguagesPrompt(allowedLanguages);
135
- if (!selectedLanguages) {
136
- this.prompts.noLanguagesSelected();
137
- return ActionResult.cancelled();
138
- }
139
- languages = selectedLanguages;
140
- }
141
- // Step 4/4
142
- this.prompts.selectInputDirectoryStep();
143
- let inputDirectory;
144
- while (true) {
145
- inputDirectory = await this.prompts.inputDirectoryPathPrompt();
146
- if (!inputDirectory) {
147
- this.prompts.noInputDirectoryProvided();
148
- return ActionResult.cancelled();
149
- }
150
- if (!(await this.fileService.directoryExists(inputDirectory))) {
151
- this.prompts.inputDirectoryPathDoesNotExist(inputDirectory);
152
- // TODO: Prompt user if he wants to create the directory
153
- continue;
154
- }
155
- if (!(await this.fileService.directoryEmpty(inputDirectory))) {
156
- this.prompts.inputDirectoryNotEmpty(inputDirectory);
157
- continue;
158
- }
159
- break;
160
- }
161
- // Resolve the API Copilot key to enable, if any, before setting up the source
162
- // directory. An account with no key continues silently (no Copilot); cancelling
163
- // the multi-key selection aborts quickstart. (Account info was already fetched
164
- // above for the language step.) Whether Copilot is actually on the plan is only
165
- // known after the prune below, so the "enabled" caution is deferred until then.
166
- let copilotKey;
167
- const copilotKeys = (_b = accountInfo.value.ApiCopilotKeys) !== null && _b !== void 0 ? _b : [];
168
- if (copilotKeys.length === 1) {
169
- copilotKey = copilotKeys[0];
170
- }
171
- else if (copilotKeys.length > 1) {
172
- copilotKey = await this.prompts.selectCopilotKey(copilotKeys);
173
- if (!copilotKey) {
174
- this.prompts.noCopilotKeySelected();
175
- return ActionResult.cancelled();
176
- }
177
- }
178
- const masterBuildFile = await this.prompts.downloadBuildDirectory(this.fileDownloadService.downloadFile(this.buildFileUrl));
179
- if (masterBuildFile.isErr()) {
180
- this.prompts.serviceError(masterBuildFile.error);
181
- return ActionResult.failed();
182
- }
183
- const tempContext = new TempContext(tempDirectory);
184
- const masterBuildFilePath = await tempContext.save(masterBuildFile.value.stream);
185
- await this.zipService.unArchive(masterBuildFilePath, tempDirectory);
186
- const extractedFolder = tempDirectory.join(this.repositoryFolderName);
187
- // Clean up the workflow dir from the template before copying
188
- const tempBuildContext = new BuildContext(extractedFolder);
189
- await tempBuildContext.deleteWorkflowDir();
190
- // Copy the template into the final destination
191
- const sourceDirectory = inputDirectory.join('src');
192
- await this.fileService.copyDirectoryContents(extractedFolder, sourceDirectory);
193
- // Update the build file in its final location via BuildContext,
194
- // mirroring exactly how CopilotAction reads and writes the build file
195
- const buildContext = new BuildContext(sourceDirectory);
196
- const baseConfig = (await buildContext.getBuildFileContents()).withPortalLanguages(languages);
197
- const buildConfig = copilotKey
198
- ? baseConfig.withApiCopilotForPortal(copilotKey, DEFAULT_COPILOT_WELCOME_MESSAGE, defaultBaseUrl)
199
- : baseConfig;
200
- await buildContext.updateBuildFileContents(buildConfig);
201
- // Prune the build file to what the plan allows (SDK languages + AI features)
202
- // before serving. Fail closed: a prune failure aborts rather than serving a
203
- // build the plan can't generate.
204
- const pruneResult = await this.validationService.pruneBuildFile(buildContext.buildConfigFilePath());
205
- if (pruneResult.isErr()) {
206
- this.prompts.serviceError(pruneResult.error);
207
- return ActionResult.failed();
208
- }
209
- const { buildFile: prunedConfig, report } = pruneResult.value;
210
- await buildContext.updateBuildFileContents(prunedConfig);
211
- this.prompts.buildFilePruned(report);
212
- // Only surface the Copilot caution if Copilot survived the prune — i.e. it's
213
- // actually on the plan. If it was stripped, buildFilePruned already reported it.
214
- if (prunedConfig.hasApiCopilot() && copilotKey) {
215
- this.prompts.copilotEnabled(copilotKey);
216
- }
217
- const specDirectory = sourceDirectory.join('spec');
218
- const specContext = new SpecContext(specDirectory);
219
- await specContext.replaceDefaultSpec(specPath);
220
- const buildDirectoryStructure = await this.fileService.getDirectory(sourceDirectory);
221
- this.prompts.printDirectoryStructure(inputDirectory, buildDirectoryStructure);
222
- const portalDirectory = inputDirectory.join('portal');
223
- const portalServeAction = new PortalServeAction(this.configDir, this.commandMetadata, null);
224
- const result = await portalServeAction.execute(sourceDirectory, portalDirectory, defaultPort, true, false, () => {
225
- this.prompts.nextSteps(prunedConfig.hasAiIntegration());
226
- });
227
- if (result.isFailed()) {
228
- return ActionResult.failed();
229
- }
230
- return ActionResult.success();
231
- });
232
- };
233
- this.configDir = configDir;
234
- this.commandMetadata = commandMetadata;
235
- this.validationService = new ValidationService(this.configDir);
236
- }
237
- }
238
- //# sourceMappingURL=quickstart.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quickstart.js","sourceRoot":"","sources":["../../../src/actions/portal/quickstart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EAAE,c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,OAAO,CAAC,uBAAuB,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;gBAE9E,MAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtD,MAAM,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;gBAC5F,MAAM,MAAM,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;oBAC9G,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBAC1D,CAAC,CAAC,CAAC;gBAEH,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;oBACtB,OAAO,YAAY,CAAC,MAAM,EAAE,CAAC;gBAC/B,CAAC;gBAED,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;QAnOA,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;CAiOF"}
@@ -1,15 +0,0 @@
1
- import { DirectoryPath } from "../../../types/file/directoryPath.js";
2
- import { CommandMetadata } from "../../../types/common/command-metadata.js";
3
- import { ActionResult } from "../../action-result.js";
4
- export declare class PortalRecipeAction {
5
- private readonly configDirectory;
6
- private readonly commandMetadata;
7
- private readonly prompts;
8
- private readonly launcherService;
9
- private readonly fileService;
10
- private readonly portalService;
11
- constructor(configDirectory: DirectoryPath, commandMetadata: CommandMetadata);
12
- execute(buildDirectory: DirectoryPath, name?: string): Promise<ActionResult>;
13
- private promptForContent;
14
- private getTocStructure;
15
- }
@@ -1,177 +0,0 @@
1
- import { PortalRecipePrompts } from "../../../prompts/portal/recipe/new-recipe.js";
2
- import { StepType } from "../../../types/recipe/recipe.js";
3
- import { PortalService } from "../../../infrastructure/services/portal-service.js";
4
- import { getEndpointDescription, getEndpointGroupsFromSdl } from "../../../types/sdl/sdl.js";
5
- import { ActionResult } from "../../action-result.js";
6
- import { TocContext } from "../../../types/toc-context.js";
7
- import { FileName } from "../../../types/file/fileName.js";
8
- import { PortalRecipe } from "../../../application/portal/recipe/portal-recipe.js";
9
- import { PortalRecipeGenerator } from "../../../application/portal/recipe/recipe-generator.js";
10
- import { BuildContext } from "../../../types/build-context.js";
11
- import { ContentContext } from "../toc/new-toc.js";
12
- import { SpecContext } from "../../../types/spec-context.js";
13
- import { LauncherService } from "../../../infrastructure/launcher-service.js";
14
- import { FileService } from "../../../infrastructure/file-service.js";
15
- import { FilePath } from "../../../types/file/filePath.js";
16
- import { withDirPath } from "../../../infrastructure/tmp-extensions.js";
17
- import { TempContext } from "../../../types/temp-context.js";
18
- import { RecipeContext } from "../../../types/recipe-context.js";
19
- export class PortalRecipeAction {
20
- constructor(configDirectory, commandMetadata) {
21
- this.configDirectory = configDirectory;
22
- this.commandMetadata = commandMetadata;
23
- this.prompts = new PortalRecipePrompts();
24
- this.launcherService = new LauncherService();
25
- this.fileService = new FileService();
26
- this.portalService = new PortalService();
27
- }
28
- async execute(buildDirectory, name) {
29
- this.prompts.displayWelcomeMessage();
30
- const buildContext = new BuildContext(buildDirectory);
31
- if (!(await buildContext.validate())) {
32
- this.prompts.invalidBuildDirectory(buildDirectory);
33
- return ActionResult.failed();
34
- }
35
- const recipeName = name !== null && name !== void 0 ? name : (await this.prompts.recipeNamePrompt());
36
- if (!recipeName) {
37
- this.prompts.recipeNameEmpty();
38
- return ActionResult.cancelled();
39
- }
40
- const contentDirectory = buildDirectory.join("content");
41
- const contentContext = new ContentContext(contentDirectory);
42
- if (!(await contentContext.exists())) {
43
- this.prompts.contentFolderNotFound();
44
- return ActionResult.failed();
45
- }
46
- const specDirectory = buildDirectory.join("spec");
47
- const specContext = new SpecContext(specDirectory);
48
- if (!(await specContext.validate())) {
49
- this.prompts.specFileEmptyInvalid();
50
- return ActionResult.failed();
51
- }
52
- // Setup TOC context
53
- const tocContext = new TocContext(contentDirectory);
54
- const tocData = await tocContext.parseTocData();
55
- // Setup recipe context
56
- const recipeContext = new RecipeContext(recipeName);
57
- const recipeScriptFileName = recipeContext.getRecipeScriptFileName();
58
- const recipeMarkdownFileName = recipeContext.getRecipeMarkdownFileName();
59
- // Check if the recipe already exists
60
- const recipeAlreadyExists = recipeContext.exists(tocData, recipeName, recipeMarkdownFileName);
61
- if (recipeAlreadyExists && !(await this.prompts.overwriteApiRecipeInTocPrompt(recipeName))) {
62
- return ActionResult.cancelled();
63
- }
64
- // Build the recipe
65
- const recipe = new PortalRecipe(recipeName);
66
- let stepIndex = 0;
67
- this.prompts.displayStepsInformation();
68
- let endpointGroups;
69
- do {
70
- const stepType = await this.prompts.stepTypeSelectionPrompt();
71
- if (!stepType)
72
- return ActionResult.cancelled();
73
- const stepName = await this.prompts.stepNamePrompt(`Step ${++stepIndex}`);
74
- if (!stepName)
75
- return ActionResult.cancelled();
76
- switch (stepType) {
77
- case StepType.Content: {
78
- const contentResult = await this.promptForContent();
79
- recipe.addContentStep(stepName, contentResult);
80
- this.prompts.displayStepAddedSuccessfullyMessage();
81
- break;
82
- }
83
- case StepType.Endpoint: {
84
- if (!endpointGroups) {
85
- const sdlResult = await withDirPath(async (tempDirectory) => {
86
- const tempContext = new TempContext(tempDirectory);
87
- const specZipPath = await tempContext.zip(specDirectory);
88
- const specFileStream = await this.fileService.getStream(specZipPath);
89
- try {
90
- return await this.prompts.generateSdl(this.portalService.generateSdl(specFileStream, this.configDirectory, this.commandMetadata));
91
- }
92
- finally {
93
- specFileStream.close();
94
- }
95
- });
96
- if (sdlResult.isErr()) {
97
- this.prompts.serviceError(sdlResult.error);
98
- return ActionResult.failed();
99
- }
100
- endpointGroups = getEndpointGroupsFromSdl(sdlResult.value);
101
- }
102
- const endpointGroupName = await this.prompts.endpointGroupNamePrompt(endpointGroups);
103
- if (!endpointGroupName)
104
- return ActionResult.cancelled();
105
- const endpointName = await this.prompts.endpointNamePrompt(endpointGroups, endpointGroupName);
106
- if (!endpointName)
107
- return ActionResult.cancelled();
108
- const defaultDescription = getEndpointDescription(endpointGroups, endpointGroupName, endpointName);
109
- const description = await this.prompts.endpointDescriptionPrompt(defaultDescription);
110
- if (!description)
111
- return ActionResult.cancelled();
112
- recipe.addEndpointStep(stepName, description, endpointGroupName, endpointName);
113
- this.prompts.displayStepAddedSuccessfullyMessage();
114
- break;
115
- }
116
- }
117
- } while (await this.prompts.addAnotherStepSelectionPrompt());
118
- const serializableRecipe = recipe.toSerializableRecipe();
119
- // Generate the recipe
120
- const recipeGenerator = new PortalRecipeGenerator();
121
- await recipeGenerator.createRecipe(serializableRecipe, tocData, tocContext.tocPath, recipeName, recipeScriptFileName, recipeMarkdownFileName, buildContext, buildDirectory);
122
- const tocStructure = this.getTocStructure(recipeScriptFileName);
123
- this.prompts.recipeCreated();
124
- this.prompts.displayRecipeStructure(tocStructure);
125
- this.prompts.nextSteps();
126
- return ActionResult.success();
127
- }
128
- async promptForContent() {
129
- return await withDirPath(async (tempDir) => {
130
- const tempFile = new FilePath(tempDir, new FileName(`recipe-markdown-content.md`));
131
- const defaultContent = "# The Heading Goes Here\n\n" +
132
- "This is placeholder text for your API Recipe content step. " +
133
- "Feel free to edit this. Save your changes and then close the file once you're done.";
134
- await this.fileService.writeContents(tempFile, defaultContent);
135
- this.prompts.openRecipeMarkdownEditor();
136
- await this.launcherService.openInEditor(tempFile);
137
- const fileContent = await this.fileService.getContents(tempFile);
138
- return fileContent.replace(/\r\n|\r/g, "\n");
139
- });
140
- }
141
- getTocStructure(recipeFileName) {
142
- return {
143
- name: "src",
144
- items: [
145
- {
146
- name: "content",
147
- items: [
148
- {
149
- name: "toc.yml",
150
- description: "# Contains the API Recipes group with a new page for your API recipe"
151
- }
152
- ]
153
- },
154
- {
155
- name: "static",
156
- items: [
157
- {
158
- name: "scripts",
159
- items: [
160
- {
161
- name: "recipes",
162
- items: [
163
- {
164
- name: `${recipeFileName}`,
165
- description: "# Generated recipe script file containing all of the steps"
166
- }
167
- ]
168
- }
169
- ]
170
- }
171
- ]
172
- }
173
- ]
174
- };
175
- }
176
- }
177
- //# sourceMappingURL=new-recipe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-recipe.js","sourceRoot":"","sources":["../../../../src/actions/portal/recipe/new-recipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,wBAAwB,EAAe,MAAM,2BAA2B,CAAC;AAG1G,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EAA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4BACE,IAAI,EAAE,SAAS;4BACf,WAAW,EAAE,sEAAsE;yBACpF;qBACF;iBACF;gBACD;oBACE,IAAI,EAAE,QAAQ;oBACd,KAAK,EAAE;wBACL;4BACE,IAAI,EAAE,SAAS;4BACf,KAAK,EAAE;gCACL;oCACE,IAAI,EAAE,SAAS;oCACf,KAAK,EAAE;wCACL;4CACE,IAAI,EAAE,GAAG,cAAc,EAAE;4CACzB,WAAW,EAAE,4DAA4D;yCAC1E;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -1,21 +0,0 @@
1
- import { TocGroup } from '../../../types/toc/toc.js';
2
- import { DirectoryPath } from '../../../types/file/directoryPath.js';
3
- import { CommandMetadata } from '../../../types/common/command-metadata.js';
4
- import { ActionResult } from '../../action-result.js';
5
- export declare class ContentContext {
6
- private readonly contentDirectory;
7
- private readonly fileService;
8
- constructor(contentDirectory: DirectoryPath);
9
- exists(): Promise<boolean>;
10
- extractContentGroups(): Promise<TocGroup[]>;
11
- }
12
- export declare class PortalNewTocAction {
13
- private readonly configDirectory;
14
- private readonly commandMetadata;
15
- private readonly prompts;
16
- private readonly tocGenerator;
17
- private readonly fileService;
18
- private readonly portalService;
19
- constructor(configDirectory: DirectoryPath, commandMetadata: CommandMetadata);
20
- execute(buildDirectory: DirectoryPath, tocDirectory?: DirectoryPath, force?: boolean, expandEndpoints?: boolean, expandModels?: boolean, expandWebhooks?: boolean, expandCallbacks?: boolean): Promise<ActionResult>;
21
- }
@@ -1,95 +0,0 @@
1
- import { PortalNewTocPrompts } from '../../../prompts/portal/toc/new-toc.js';
2
- import { TocStructureGenerator } from '../../../application/portal/toc/toc-structure-generator.js';
3
- import { ActionResult } from '../../action-result.js';
4
- import { TocContext } from '../../../types/toc-context.js';
5
- import { FileService } from '../../../infrastructure/file-service.js';
6
- import { BuildContext } from '../../../types/build-context.js';
7
- import { TocComponents } from '../../../types/toc/toc-components.js';
8
- import { withDirPath } from '../../../infrastructure/tmp-extensions.js';
9
- import { TempContext } from '../../../types/temp-context.js';
10
- import { PortalService } from '../../../infrastructure/services/portal-service.js';
11
- import { err, ok } from 'neverthrow';
12
- export class ContentContext {
13
- constructor(contentDirectory) {
14
- this.contentDirectory = contentDirectory;
15
- this.fileService = new FileService();
16
- }
17
- async exists() {
18
- return this.fileService.directoryExists(this.contentDirectory);
19
- }
20
- async extractContentGroups() {
21
- const directory = await this.fileService.getDirectory(this.contentDirectory);
22
- return await directory.parseContentFolder(this.contentDirectory);
23
- }
24
- }
25
- export class PortalNewTocAction {
26
- constructor(configDirectory, commandMetadata) {
27
- this.configDirectory = configDirectory;
28
- this.commandMetadata = commandMetadata;
29
- this.prompts = new PortalNewTocPrompts();
30
- this.tocGenerator = new TocStructureGenerator();
31
- this.fileService = new FileService();
32
- this.portalService = new PortalService();
33
- }
34
- async execute(buildDirectory, tocDirectory, force = false, expandEndpoints = false, expandModels = false, expandWebhooks = false, expandCallbacks = false) {
35
- // Validate build directory
36
- const buildContext = new BuildContext(buildDirectory);
37
- if (!(await buildContext.validate())) {
38
- this.prompts.invalidBuildDirectory(buildDirectory);
39
- return ActionResult.failed();
40
- }
41
- const specDirectory = buildDirectory.join('spec');
42
- if (!(await this.fileService.directoryExists(specDirectory))) {
43
- this.prompts.specDirectoryNotFound(buildDirectory);
44
- return ActionResult.failed();
45
- }
46
- if (!(await buildContext.getSpecContext().validate())) {
47
- this.prompts.specDirectoryEmpty(buildDirectory);
48
- return ActionResult.failed();
49
- }
50
- const buildConfig = await buildContext.getBuildFileContents();
51
- const contentDirectory = buildDirectory.join(buildConfig.contentFolder());
52
- const tocDir = tocDirectory !== null && tocDirectory !== void 0 ? tocDirectory : contentDirectory;
53
- const tocContext = new TocContext(tocDir);
54
- if (!force && (await tocContext.exists()) && !(await this.prompts.overwriteToc(tocContext.tocPath))) {
55
- this.prompts.tocFileAlreadyExists();
56
- return ActionResult.cancelled();
57
- }
58
- const tocComponentsResult = await withDirPath(async (tempDirectory) => {
59
- const tempContext = new TempContext(tempDirectory);
60
- const specZipPath = await tempContext.zip(specDirectory);
61
- const specFileStream = await this.fileService.getStream(specZipPath);
62
- try {
63
- const result = await this.prompts.extractTocData(this.portalService.generateTocData(specFileStream, this.configDirectory, this.commandMetadata), expandEndpoints, expandModels, expandWebhooks, expandCallbacks);
64
- if (result.isErr()) {
65
- return err(result.error);
66
- }
67
- return ok(TocComponents.fromTocData(result.value));
68
- }
69
- finally {
70
- specFileStream.close();
71
- }
72
- });
73
- if (tocComponentsResult.isErr()) {
74
- this.prompts.tocExtractionFailed(tocComponentsResult.error.errorMessage);
75
- return ActionResult.failed();
76
- }
77
- const tocComponents = tocComponentsResult.value;
78
- const contentContext = new ContentContext(contentDirectory);
79
- const contentExists = await contentContext.exists();
80
- let contentGroups;
81
- if (!contentExists) {
82
- this.prompts.contentDirectoryNotFound(contentDirectory);
83
- contentGroups = [];
84
- }
85
- else {
86
- contentGroups = await contentContext.extractContentGroups();
87
- }
88
- const toc = this.tocGenerator.createTocStructure(tocComponents, expandEndpoints, expandModels, expandWebhooks, expandCallbacks, contentGroups);
89
- const yamlString = this.tocGenerator.transformToYaml(toc);
90
- const tocFilePath = await tocContext.save(yamlString);
91
- this.prompts.tocCreated(tocFilePath);
92
- return ActionResult.success();
93
- }
94
- }
95
- //# sourceMappingURL=new-toc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-toc.js","sourceRoot":"","sources":["../../../../src/actions/portal/toc/new-toc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AAInG,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAA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CAAC;QAC5D,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,MAAM,EAAE,CAAC;QAEpD,IAAI,aAAyB,CAAC;QAC9B,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;YACxD,aAAa,GAAG,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,aAAa,GAAG,MAAM,cAAc,CAAC,oBAAoB,EAAE,CAAC;QAC9D,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAC9C,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,CACd,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC1D,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEtD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAErC,OAAO,YAAY,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
@@ -1,12 +0,0 @@
1
- import { DirectoryPath } from "../../types/file/directoryPath.js";
2
- import { FilePath } from "../../types/file/filePath.js";
3
- import { Language } from "../../types/sdk/generate.js";
4
- import { ActionResult } from "../action-result.js";
5
- export declare class MergeSourceTreeAction {
6
- private readonly prompts;
7
- private readonly launcherService;
8
- readonly execute: (sdkWithSourceTree: DirectoryPath, sdkWithoutSourceTree: DirectoryPath, destinationSourceTreePath: FilePath, trackChanges: boolean, skipChanges: boolean, hasSdkSourceTree: boolean, language: Language, outputSdkDirectory: DirectoryPath, version: string | undefined, zipSdk: boolean) => Promise<ActionResult<{
9
- sourceTreeTrackingInitiated: boolean;
10
- conflictsResolved: boolean;
11
- }>>;
12
- }