@apimatic/cli 1.4.0 → 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +222 -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 +102 -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 +199 -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 +70 -0
  227. package/lib/types/apimatic-config/document.js +167 -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 +69 -357
  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
@@ -0,0 +1,77 @@
1
+ import { Result } from 'neverthrow';
2
+ import { DirectoryPath } from '../types/file/directoryPath.js';
3
+ import { FilePath } from '../types/file/filePath.js';
4
+ import { CheckedFile } from '../types/portal/content-tree.js';
5
+ import { PortalArtifacts } from '../types/portal/portal-artifacts.js';
6
+ import { PortalSettings, PortalSource } from '../types/portal/portal-source.js';
7
+ export declare const COPIED_DEPENDENCIES: string[];
8
+ export declare const LINKED_DEPENDENCIES: string[];
9
+ export declare const TEMPLATE_DEPENDENCIES: string[];
10
+ /** Where the SDKs and the context plugin are laid out as the site serves them, inside the project. */
11
+ export declare const DOWNLOADS_DIRECTORY_NAME = "downloads";
12
+ /** Where the project keeps its copy of `content/`, and an empty one where the source has none. */
13
+ export declare const CONTENT_COPY_DIRECTORY_NAME = "content";
14
+ export interface PortalProjectPaths {
15
+ projectDirectory: DirectoryPath;
16
+ /** Vite's CLI entry point, resolved from the CLI's own dependencies. */
17
+ viteBinary: FilePath;
18
+ /** The source's `content/`, which the project's copy stands in for; null where the source has none. */
19
+ contentSource: DirectoryPath | null;
20
+ }
21
+ /** `portal.config.json`, which the template reads as `BuildPaths`; a test holds the two to one shape. */
22
+ export interface PortalBuildPaths {
23
+ specs: Record<string, string>;
24
+ codeSamples: string | null;
25
+ contentDir: string;
26
+ generatedDir: string;
27
+ staticDir: string | null;
28
+ downloadsDir: string | null;
29
+ }
30
+ /**
31
+ * Prepares the throwaway Vite project that both `portal generate` and `portal serve` run.
32
+ * The project points at the user's `src/` by absolute path, but for a copy of `content/`: the
33
+ * browser bundle names the pages' directory, and a preview keeps the copy at what it last accepted.
34
+ */
35
+ export declare class PortalProjectService {
36
+ private readonly fileService;
37
+ private readonly pagesService;
38
+ private readonly require;
39
+ /** Checks this installation can run the portal build at all, before any work is done. */
40
+ runtimeProblem(): string | null;
41
+ prepare(projectDirectory: DirectoryPath, source: PortalSource, artifacts: PortalArtifacts): Promise<Result<PortalProjectPaths, string>>;
42
+ /**
43
+ * Environment for the child process. Deliberately an allow-list: the auth key must not
44
+ * reach the build, and any stray `VITE_*` variable would be inlined into the output.
45
+ */
46
+ childEnvironment(): Record<string, string>;
47
+ private writeCodeSamples;
48
+ private writeFragments;
49
+ private writeDownloads;
50
+ private linkDependencies;
51
+ private copyDependencies;
52
+ /** The project's copy of `content/`, which stands empty where the source has none. */
53
+ private contentDirectory;
54
+ private writeConfiguration;
55
+ /**
56
+ * The dev server picks the files up and reloads the browser. Each is written only when its
57
+ * contents change, so an edit that leaves the site as it was, such as a plugin command
58
+ * rewriting its own block, reloads nothing; the answer says whether anything was written.
59
+ */
60
+ applyConfig(projectDirectory: DirectoryPath, settings: PortalSettings): Promise<Result<boolean, string>>;
61
+ /**
62
+ * Brings the project's copy of `content/` in line: `checked` files as checked, since a later save went
63
+ * unchecked, the rest as on disk, nothing the source lost, and only what changed, so little reloads.
64
+ */
65
+ applyContent(projectDirectory: DirectoryPath, contentDirectory: DirectoryPath, checked: CheckedFile[]): Promise<Result<void, string>>;
66
+ private syncContent;
67
+ /** Every file below `directory` that the build reads, and none when it is gone. */
68
+ private contentFiles;
69
+ private writeAppearance;
70
+ /**
71
+ * The browser imports `portal.identity.json` whole, since a retained JSON module is not
72
+ * tree-shaken per property, which is why it holds nothing that addresses this machine.
73
+ */
74
+ private appearanceFiles;
75
+ private templateDirectory;
76
+ private packageDirectory;
77
+ }
@@ -0,0 +1,309 @@
1
+ import { createRequire } from 'node:module';
2
+ import path from 'node:path';
3
+ import fsExtra from 'fs-extra';
4
+ import { err, ok } from 'neverthrow';
5
+ import { DirectoryPath } from '../types/file/directoryPath.js';
6
+ import { FileName } from '../types/file/fileName.js';
7
+ import { FilePath } from '../types/file/filePath.js';
8
+ import { isSkippedWithin } from '../types/portal/content-tree.js';
9
+ import { GENERATED_DIRECTORY_NAME } from '../types/portal/generated-pages.js';
10
+ import { GENERATED_INCLUDES_DIRECTORY_NAME, pageFragments } from '../types/portal/page-fragments.js';
11
+ import { PLUGIN_DOWNLOAD, SDK_DOWNLOADS_FOLDER, sdkDownload } from '../types/portal/portal-downloads.js';
12
+ import { PortalStylesheet } from '../types/portal/portal-stylesheet.js';
13
+ import { errorMessage } from '../utils/error-utils.js';
14
+ import { envInfo } from './env-info.js';
15
+ import { FileService } from './file-service.js';
16
+ import { PortalPagesService } from './portal-pages-service.js';
17
+ // Copied, not linked: Tailwind rebases their `url()`s onto the project, and no relative path crosses drives.
18
+ export const COPIED_DEPENDENCIES = ['@fontsource-variable/geist', '@fontsource-variable/geist-mono'];
19
+ // Linked one by one rather than through a single link to the CLI's `node_modules`: under a
20
+ // pnpm global install, `npx` or `pnpm dlx` the package has no nested `node_modules`, and a
21
+ // single link also lets Vite write its scratch files into the CLI's own install directory.
22
+ export const LINKED_DEPENDENCIES = [
23
+ '@fumadocs/api-docs',
24
+ '@scalar/json-magic',
25
+ '@tailwindcss/vite',
26
+ '@tanstack/react-router',
27
+ '@tanstack/react-start',
28
+ '@tanstack/start-static-server-functions',
29
+ '@vitejs/plugin-react',
30
+ 'fumadocs-core',
31
+ 'fumadocs-mdx',
32
+ 'fumadocs-openapi',
33
+ 'fumadocs-ui',
34
+ 'lucide-react',
35
+ 'react',
36
+ 'react-dom',
37
+ 'rehype-raw',
38
+ 'shiki',
39
+ 'tailwindcss',
40
+ 'tslib',
41
+ 'vite',
42
+ 'yaml'
43
+ ];
44
+ export const TEMPLATE_DEPENDENCIES = [...COPIED_DEPENDENCIES, ...LINKED_DEPENDENCIES];
45
+ /** Beside `portal.config.json`; `src/lib/portal.ts` imports it. */
46
+ const IDENTITY_FILE_NAME = 'portal.identity.json';
47
+ /** In `src/styles/`, beside `app.css`, which imports it. */
48
+ const STYLESHEET_FILE_NAME = 'theme.css';
49
+ /** Where the SDKs and the context plugin are laid out as the site serves them, inside the project. */
50
+ export const DOWNLOADS_DIRECTORY_NAME = 'downloads';
51
+ /** Where the project keeps its copy of `content/`, and an empty one where the source has none. */
52
+ export const CONTENT_COPY_DIRECTORY_NAME = 'content';
53
+ /**
54
+ * Prepares the throwaway Vite project that both `portal generate` and `portal serve` run.
55
+ * The project points at the user's `src/` by absolute path, but for a copy of `content/`: the
56
+ * browser bundle names the pages' directory, and a preview keeps the copy at what it last accepted.
57
+ */
58
+ export class PortalProjectService {
59
+ fileService = new FileService();
60
+ pagesService = new PortalPagesService();
61
+ require = createRequire(import.meta.url);
62
+ /** Checks this installation can run the portal build at all, before any work is done. */
63
+ runtimeProblem() {
64
+ for (const dependency of TEMPLATE_DEPENDENCIES) {
65
+ if (this.packageDirectory(dependency) === undefined) {
66
+ return `The portal build dependency '${dependency}' is missing from this installation. Reinstall the CLI and try again.`;
67
+ }
68
+ }
69
+ return null;
70
+ }
71
+ async prepare(projectDirectory, source, artifacts) {
72
+ const template = this.templateDirectory();
73
+ if (template === undefined) {
74
+ return err('The bundled portal template is missing from this installation. Reinstall the CLI and try again.');
75
+ }
76
+ const viteDirectory = this.packageDirectory('vite');
77
+ if (viteDirectory === undefined) {
78
+ return err("The portal build dependency 'vite' is missing from this installation. Reinstall the CLI and try again.");
79
+ }
80
+ await this.fileService.copyDirectoryContents(template, projectDirectory);
81
+ await this.linkDependencies(projectDirectory);
82
+ await this.copyDependencies(projectDirectory);
83
+ await this.writeConfiguration(projectDirectory, source, await this.contentDirectory(projectDirectory, source), await this.writeCodeSamples(projectDirectory, artifacts.codeSampleCatalogs), await this.writeDownloads(projectDirectory, artifacts));
84
+ const pages = await this.pagesService.write(projectDirectory.join(GENERATED_DIRECTORY_NAME), source.generatedPages);
85
+ if (pages.isErr()) {
86
+ return err(pages.error);
87
+ }
88
+ // Once: they change only with the artifacts, which a preview fetches when it starts.
89
+ await this.writeFragments(projectDirectory.join(GENERATED_INCLUDES_DIRECTORY_NAME), pageFragments(artifacts.sdkDocs));
90
+ return ok({
91
+ projectDirectory,
92
+ viteBinary: new FilePath(viteDirectory.join('bin'), new FileName('vite.js')),
93
+ contentSource: source.contentDirectory
94
+ });
95
+ }
96
+ /**
97
+ * Environment for the child process. Deliberately an allow-list: the auth key must not
98
+ * reach the build, and any stray `VITE_*` variable would be inlined into the output.
99
+ */
100
+ childEnvironment() {
101
+ const allowed = [
102
+ 'PATH',
103
+ 'Path',
104
+ 'HOME',
105
+ 'USERPROFILE',
106
+ 'TMPDIR',
107
+ 'TEMP',
108
+ 'TMP',
109
+ 'LANG',
110
+ 'LC_ALL',
111
+ 'SYSTEMROOT',
112
+ 'SystemRoot',
113
+ 'SystemDrive'
114
+ ];
115
+ const environment = {};
116
+ for (const name of allowed) {
117
+ const value = process.env[name];
118
+ if (value !== undefined) {
119
+ environment[name] = value;
120
+ }
121
+ }
122
+ // Large specs push the prerender pass past Node's default heap. V8 honours the last
123
+ // occurrence of the flag, so appending unconditionally would override a limit the user
124
+ // raised on purpose, and lower it on a machine whose default is already higher.
125
+ const nodeOptions = process.env.NODE_OPTIONS ?? '';
126
+ environment.NODE_OPTIONS = /--max[-_]old[-_]space[-_]size/.test(nodeOptions)
127
+ ? nodeOptions
128
+ : `${nodeOptions} --max-old-space-size=4096`.trim();
129
+ return environment;
130
+ }
131
+ // The template places the samples on the specs as it bundles them, so the specs are read where they are.
132
+ async writeCodeSamples(projectDirectory, codeSampleCatalogs) {
133
+ if (codeSampleCatalogs.isEmpty()) {
134
+ return null;
135
+ }
136
+ const file = new FilePath(projectDirectory, new FileName('code-samples.json'));
137
+ await this.fileService.writeContents(file, JSON.stringify(codeSampleCatalogs.toJson()));
138
+ return file;
139
+ }
140
+ async writeFragments(directory, fragments) {
141
+ for (const { folder, fileName, contents } of fragments) {
142
+ const target = directory.join(folder);
143
+ await this.fileService.createDirectoryIfNotExists(target);
144
+ await this.fileService.writeContents(new FilePath(target, fileName), contents);
145
+ }
146
+ }
147
+ async writeDownloads(projectDirectory, artifacts) {
148
+ if (artifacts.sdks.size === 0 && artifacts.plugin === undefined) {
149
+ return null;
150
+ }
151
+ const downloads = projectDirectory.join(DOWNLOADS_DIRECTORY_NAME);
152
+ await this.fileService.createDirectoryIfNotExists(downloads);
153
+ for (const [language, archive] of artifacts.sdks) {
154
+ const sdks = downloads.join(SDK_DOWNLOADS_FOLDER);
155
+ await this.fileService.createDirectoryIfNotExists(sdks);
156
+ await this.fileService.copy(archive, new FilePath(sdks, sdkDownload(language)));
157
+ }
158
+ if (artifacts.plugin !== undefined) {
159
+ await this.fileService.copy(artifacts.plugin, new FilePath(downloads, PLUGIN_DOWNLOAD));
160
+ }
161
+ return downloads;
162
+ }
163
+ async linkDependencies(projectDirectory) {
164
+ const modules = projectDirectory.join('node_modules');
165
+ await this.fileService.createDirectoryIfNotExists(modules);
166
+ for (const dependency of LINKED_DEPENDENCIES) {
167
+ const target = this.packageDirectory(dependency);
168
+ if (target === undefined) {
169
+ continue;
170
+ }
171
+ const link = modules.join(dependency);
172
+ if (dependency.includes('/')) {
173
+ await this.fileService.createDirectoryIfNotExists(new DirectoryPath(path.dirname(link.toString())));
174
+ }
175
+ // A junction is the only link type Windows grants without elevation.
176
+ await fsExtra.symlink(target.toString(), link.toString(), process.platform === 'win32' ? 'junction' : 'dir');
177
+ }
178
+ }
179
+ async copyDependencies(projectDirectory) {
180
+ for (const dependency of COPIED_DEPENDENCIES) {
181
+ const target = this.packageDirectory(dependency);
182
+ if (target !== undefined) {
183
+ await this.fileService.copyDirectoryContents(target, projectDirectory.join('node_modules', dependency));
184
+ }
185
+ }
186
+ }
187
+ /** The project's copy of `content/`, which stands empty where the source has none. */
188
+ async contentDirectory(projectDirectory, source) {
189
+ const copy = projectDirectory.join(CONTENT_COPY_DIRECTORY_NAME);
190
+ await this.fileService.createDirectoryIfNotExists(copy);
191
+ if (source.contentDirectory !== null) {
192
+ // Before the dev server starts: it lists the pages once, and one missing then stays missing.
193
+ await this.syncContent(source.contentDirectory, copy, []);
194
+ }
195
+ return copy;
196
+ }
197
+ async writeConfiguration(projectDirectory, source, contentDirectory, codeSamples, downloads) {
198
+ const specs = {};
199
+ for (const spec of source.specs) {
200
+ specs[spec.slug] = spec.file.toPosix();
201
+ }
202
+ // Everything here addresses this machine, so it stays behind `portal.server.ts` and the
203
+ // build's own config files.
204
+ const configuration = {
205
+ specs,
206
+ codeSamples: codeSamples === null ? null : codeSamples.toPosix(),
207
+ contentDir: contentDirectory.toPosix(),
208
+ generatedDir: projectDirectory.join(GENERATED_DIRECTORY_NAME).toPosix(),
209
+ staticDir: source.staticDirectory === null ? null : source.staticDirectory.toPosix(),
210
+ downloadsDir: downloads === null ? null : downloads.toPosix()
211
+ };
212
+ await this.fileService.writeContents(new FilePath(projectDirectory, new FileName('portal.config.json')), JSON.stringify(configuration, null, 2));
213
+ await this.writeAppearance(projectDirectory, source.config);
214
+ }
215
+ /**
216
+ * The dev server picks the files up and reloads the browser. Each is written only when its
217
+ * contents change, so an edit that leaves the site as it was, such as a plugin command
218
+ * rewriting its own block, reloads nothing; the answer says whether anything was written.
219
+ */
220
+ async applyConfig(projectDirectory, settings) {
221
+ let written = false;
222
+ try {
223
+ for (const [file, contents] of this.appearanceFiles(projectDirectory, settings.config)) {
224
+ if (await this.fileService.replaceContentsIfChanged(file, contents)) {
225
+ written = true;
226
+ }
227
+ }
228
+ }
229
+ catch (error) {
230
+ return err(errorMessage(error));
231
+ }
232
+ const pages = await this.pagesService.write(projectDirectory.join(GENERATED_DIRECTORY_NAME), settings.generatedPages);
233
+ return pages.map((pagesWritten) => written || pagesWritten);
234
+ }
235
+ /**
236
+ * Brings the project's copy of `content/` in line: `checked` files as checked, since a later save went
237
+ * unchecked, the rest as on disk, nothing the source lost, and only what changed, so little reloads.
238
+ */
239
+ async applyContent(projectDirectory, contentDirectory, checked) {
240
+ try {
241
+ await this.syncContent(contentDirectory, projectDirectory.join(CONTENT_COPY_DIRECTORY_NAME), checked);
242
+ return ok(undefined);
243
+ }
244
+ catch (error) {
245
+ return err(errorMessage(error));
246
+ }
247
+ }
248
+ async syncContent(from, to, checked) {
249
+ const files = await this.contentFiles(from);
250
+ for (const file of files) {
251
+ const target = file.rebased(from, to);
252
+ const read = checked.find((each) => each.file.isEqual(file));
253
+ if (read === undefined) {
254
+ await this.fileService.copyIfChanged(file, target);
255
+ }
256
+ else {
257
+ await this.fileService.replaceContentsIfChanged(target, read.contents);
258
+ }
259
+ }
260
+ for (const copied of await this.contentFiles(to)) {
261
+ if (!files.some((file) => file.rebased(from, to).isEqual(copied))) {
262
+ await this.fileService.deleteFile(copied);
263
+ }
264
+ }
265
+ }
266
+ /** Every file below `directory` that the build reads, and none when it is gone. */
267
+ async contentFiles(directory) {
268
+ if (!(await this.fileService.directoryExists(directory))) {
269
+ return [];
270
+ }
271
+ return (await this.fileService.getDirectory(directory))
272
+ .getAllFiles()
273
+ .filter((file) => !isSkippedWithin(file, directory));
274
+ }
275
+ async writeAppearance(projectDirectory, config) {
276
+ for (const [file, contents] of this.appearanceFiles(projectDirectory, config)) {
277
+ await this.fileService.writeContents(file, contents);
278
+ }
279
+ }
280
+ /**
281
+ * The browser imports `portal.identity.json` whole, since a retained JSON module is not
282
+ * tree-shaken per property, which is why it holds nothing that addresses this machine.
283
+ */
284
+ appearanceFiles(projectDirectory, config) {
285
+ return [
286
+ [new FilePath(projectDirectory, new FileName(IDENTITY_FILE_NAME)), JSON.stringify(config.identity(), null, 2)],
287
+ [
288
+ new FilePath(projectDirectory.join('src').join('styles'), new FileName(STYLESHEET_FILE_NAME)),
289
+ PortalStylesheet.of(config).toString()
290
+ ]
291
+ ];
292
+ }
293
+ templateDirectory() {
294
+ const template = envInfo.packageRoot().join('portal-template');
295
+ return this.fileService.directoryExistsSync(template) ? template : undefined;
296
+ }
297
+ // `require.resolve` cannot be used directly: a package whose `exports` map hides
298
+ // `package.json` throws, so the candidate roots are walked instead.
299
+ packageDirectory(name) {
300
+ for (const candidate of this.require.resolve.paths(name) ?? []) {
301
+ const manifest = path.join(candidate, name, 'package.json');
302
+ if (fsExtra.existsSync(manifest)) {
303
+ return new DirectoryPath(path.dirname(manifest));
304
+ }
305
+ }
306
+ return undefined;
307
+ }
308
+ }
309
+ //# sourceMappingURL=portal-project-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-project-service.js","sourceRoot":"","sources":["../../src/infrastructure/portal-project-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAe,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,iCAAiC,EAAgB,aA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C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -21,6 +21,7 @@ export declare class ServiceError {
21
21
  static badRequest(customMessage: string, errors: Record<string, string[]>): ServiceError;
22
22
  static forbidden(customMessage: string): ServiceError;
23
23
  static notFound(customMessage: string): ServiceError;
24
+ static invalidResponse(customMessage: string): ServiceError;
24
25
  static timeout(customMessage: string): ServiceError;
25
26
  static unauthorizedWithHint(apiMessage: string | null): ServiceError;
26
27
  static readonly values: ServiceError[];
@@ -1,4 +1,3 @@
1
- var _a;
2
1
  import axios from "axios";
3
2
  import { ApiError, ProblemDetailsError } from "@apimatic/sdk";
4
3
  import { format as f } from "../prompts/format.js";
@@ -15,28 +14,47 @@ export var ServiceErrorCode;
15
14
  ServiceErrorCode["Timeout"] = "TIMEOUT";
16
15
  })(ServiceErrorCode || (ServiceErrorCode = {}));
17
16
  export class ServiceError {
17
+ code;
18
+ defaultMessage;
19
+ errors;
20
+ static defaultErrorMessage = `An unexpected error occurred, please try again later. If the problem persists, please reach out to our team at ${f.var("support@apimatic.io")}`;
21
+ static NotFound = new ServiceError(ServiceErrorCode.NotFound, "Resource not found.", {});
22
+ static ServerError = new ServiceError(ServiceErrorCode.ServerError, this.defaultErrorMessage, {});
23
+ static NetworkError = new ServiceError(ServiceErrorCode.NetworkError, "Unable to connect to the server.", {});
24
+ static InvalidResponse = new ServiceError(ServiceErrorCode.InvalidResponse, this.defaultErrorMessage, {});
25
+ static UnAuthorized = new ServiceError(ServiceErrorCode.UnAuthorized, "Unauthorized access.", {});
18
26
  static badRequest(customMessage, errors) {
19
- return new _a(ServiceErrorCode.BadRequest, customMessage, errors);
27
+ return new ServiceError(ServiceErrorCode.BadRequest, customMessage, errors);
20
28
  }
21
29
  static forbidden(customMessage) {
22
- return new _a(ServiceErrorCode.Forbidden, customMessage, {});
30
+ return new ServiceError(ServiceErrorCode.Forbidden, customMessage, {});
23
31
  }
24
32
  static notFound(customMessage) {
25
- return new _a(ServiceErrorCode.NotFound, customMessage, {});
33
+ return new ServiceError(ServiceErrorCode.NotFound, customMessage, {});
34
+ }
35
+ static invalidResponse(customMessage) {
36
+ return new ServiceError(ServiceErrorCode.InvalidResponse, customMessage, {});
26
37
  }
27
38
  static timeout(customMessage) {
28
- return new _a(ServiceErrorCode.Timeout, customMessage, {});
39
+ return new ServiceError(ServiceErrorCode.Timeout, customMessage, {});
29
40
  }
30
41
  static unauthorizedWithHint(apiMessage) {
31
42
  // Both remedies name the full `auth login` command: the key is supplied to
32
43
  // that command, not to whichever one hit the 401 — most of them don't accept
33
44
  // an --auth-key flag at all.
34
45
  const loginCommand = f.cmdAlt("apimatic", "auth", "login");
35
- const message = `${apiMessage !== null && apiMessage !== void 0 ? apiMessage : "Authorization has been denied for this request."} ` +
46
+ const message = `${apiMessage ?? "Authorization has been denied for this request."} ` +
36
47
  `Please run ${loginCommand} to log in via browser, ` +
37
48
  `or provide a valid auth key using the ${loginCommand} ${f.flag("auth-key")}`;
38
- return new _a(ServiceErrorCode.UnAuthorized, message, {});
39
- }
49
+ return new ServiceError(ServiceErrorCode.UnAuthorized, message, {});
50
+ }
51
+ static values = [
52
+ ServiceError.NotFound,
53
+ ServiceError.ServerError,
54
+ ServiceError.NetworkError,
55
+ ServiceError.InvalidResponse,
56
+ ServiceError.UnAuthorized
57
+ ];
40
58
  constructor(code, defaultMessage, errors) {
41
59
  this.code = code;
42
60
  this.defaultMessage = defaultMessage;
@@ -49,30 +67,15 @@ export class ServiceError {
49
67
  return this.errors[key];
50
68
  }
51
69
  }
52
- _a = ServiceError;
53
- ServiceError.defaultErrorMessage = `An unexpected error occurred, please try again later. If the problem persists, please reach out to our team at ${f.var("support@apimatic.io")}`;
54
- ServiceError.NotFound = new _a(ServiceErrorCode.NotFound, "Resource not found.", {});
55
- ServiceError.ServerError = new _a(ServiceErrorCode.ServerError, _a.defaultErrorMessage, {});
56
- ServiceError.NetworkError = new _a(ServiceErrorCode.NetworkError, "Unable to connect to the server.", {});
57
- ServiceError.InvalidResponse = new _a(ServiceErrorCode.InvalidResponse, _a.defaultErrorMessage, {});
58
- ServiceError.UnAuthorized = new _a(ServiceErrorCode.UnAuthorized, "Unauthorized access.", {});
59
- ServiceError.values = [
60
- _a.NotFound,
61
- _a.ServerError,
62
- _a.NetworkError,
63
- _a.InvalidResponse,
64
- _a.UnAuthorized
65
- ];
66
70
  // A ProblemDetails body carries a `title` plus a map of field errors; surface
67
71
  // the title and the first field message.
68
72
  function mapProblemDetailsError(error) {
69
- var _b, _c, _d, _e, _f;
70
73
  // ProblemDetails.title and .errors are optional and result may be absent — guard
71
74
  // all three so a sparse body can't crash or render a trailing "- null".
72
75
  // TODO: This only picks the first error message, improve it to show all errors.
73
- const errors = ((_c = (_b = error.result) === null || _b === void 0 ? void 0 : _b.errors) !== null && _c !== void 0 ? _c : {});
74
- const firstFieldMessage = (_d = Object.values(errors)[0]) === null || _d === void 0 ? void 0 : _d[0];
75
- const title = (_f = (_e = error.result) === null || _e === void 0 ? void 0 : _e.title) !== null && _f !== void 0 ? _f : "Request failed.";
76
+ const errors = (error.result?.errors ?? {});
77
+ const firstFieldMessage = Object.values(errors)[0]?.[0];
78
+ const title = error.result?.title ?? "Request failed.";
76
79
  const errorMessage = firstFieldMessage ? `${title}\n- ${firstFieldMessage}` : title;
77
80
  if (error.statusCode === 400)
78
81
  return ServiceError.badRequest(errorMessage, errors);
@@ -83,14 +86,13 @@ function mapProblemDetailsError(error) {
83
86
  // SDK controllers throw typed `ApiError`s (not axios errors). The API reports
84
87
  // the reason as {"message": "..."} deserialized into `result`.
85
88
  function mapApiError(error) {
86
- var _b, _c;
87
89
  if (error instanceof ProblemDetailsError) {
88
90
  const serviceError = mapProblemDetailsError(error);
89
91
  if (serviceError)
90
92
  return serviceError;
91
93
  }
92
94
  if (error.statusCode === 401) {
93
- const apiMessage = (_c = (_b = error.result) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : null;
95
+ const apiMessage = error.result?.message ?? null;
94
96
  return ServiceError.unauthorizedWithHint(apiMessage);
95
97
  }
96
98
  if (error.statusCode === 404)
@@ -104,22 +106,21 @@ function mapApiError(error) {
104
106
  * map. Every other status is left to `mapTransportError`.
105
107
  */
106
108
  function mapAxiosProblemDetails(error) {
107
- var _b, _c, _d, _e, _f, _g;
108
109
  if (!axios.isAxiosError(error)) {
109
110
  return undefined;
110
111
  }
111
- const body = (_b = error.response) === null || _b === void 0 ? void 0 : _b.data;
112
+ const body = error.response?.data;
112
113
  if (typeof body !== "object" || body === null) {
113
114
  return undefined;
114
115
  }
115
- const errors = (_c = body.errors) !== null && _c !== void 0 ? _c : {};
116
- const firstMessage = (_d = Object.values(errors).flat()[0]) !== null && _d !== void 0 ? _d : body.detail;
117
- const title = (_e = body.title) !== null && _e !== void 0 ? _e : "Request failed.";
116
+ const errors = body.errors ?? {};
117
+ const firstMessage = Object.values(errors).flat()[0] ?? body.detail;
118
+ const title = body.title ?? "Request failed.";
118
119
  const message = firstMessage ? `${title}\n- ${firstMessage}` : title;
119
- if (((_f = error.response) === null || _f === void 0 ? void 0 : _f.status) === 400) {
120
+ if (error.response?.status === 400) {
120
121
  return ServiceError.badRequest(message, errors);
121
122
  }
122
- if (((_g = error.response) === null || _g === void 0 ? void 0 : _g.status) === 403) {
123
+ if (error.response?.status === 403) {
123
124
  return ServiceError.forbidden(message);
124
125
  }
125
126
  return undefined;
@@ -129,19 +130,16 @@ function mapAxiosProblemDetails(error) {
129
130
  * user with nothing to act on — the SDK path names the remedy but the axios path does not.
130
131
  */
131
132
  export function mapTransportError(error) {
132
- var _b;
133
- if (axios.isAxiosError(error) && ((_b = error.response) === null || _b === void 0 ? void 0 : _b.status) === 401) {
133
+ if (axios.isAxiosError(error) && error.response?.status === 401) {
134
134
  return ServiceError.unauthorizedWithHint(null);
135
135
  }
136
136
  return handleServiceError(error);
137
137
  }
138
138
  /** For responses whose body is readable JSON; a streamed body can only be mapped by status. */
139
139
  export function mapRequestError(error) {
140
- var _b;
141
- return (_b = mapAxiosProblemDetails(error)) !== null && _b !== void 0 ? _b : mapTransportError(error);
140
+ return mapAxiosProblemDetails(error) ?? mapTransportError(error);
142
141
  }
143
142
  export function handleServiceError(error) {
144
- var _b;
145
143
  if (error instanceof ApiError) {
146
144
  // A `callAsStream` error body would otherwise hang the CLI. Order against
147
145
  // `mapApiError` is free: `error.result` is only populated when the SDK
@@ -152,7 +150,7 @@ export function handleServiceError(error) {
152
150
  return serviceError;
153
151
  }
154
152
  if (axios.isAxiosError(error)) {
155
- const status = (_b = error.response) === null || _b === void 0 ? void 0 : _b.status;
153
+ const status = error.response?.status;
156
154
  if (status === 401)
157
155
  return ServiceError.UnAuthorized;
158
156
  if (status === 404)
@@ -1 +1 @@
1
- {"version":3,"file":"service-error.js","sourceRoot":"","sources":["../../src/infrastructure/service-error.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,0CAAsB,CAAA;IACtB,gDAA4B,CAAA;IAC5B,kDAA8B,CAAA;IAC9B,wDAAoC,CAAA;IACpC,iDAA6B,CAAA;IAC7B,8CAA0B,CAAA;IAC1B,2CAAuB,CAAA;IACvB,uCAAmB,CAAA;AACrB,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAED,MAAM,OAAO,YAAY;IAUvB,MAAM,CAAC,UAAU,CAAC,aAAqB,EAAE,MAAgC;QACvE,OAAO,IAAI,EAAY,CAAC,gBAAgB,CAAC,UAAU,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;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