@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
@@ -0,0 +1,105 @@
1
+ import { err, ok, Result } from 'neverthrow';
2
+ import { isJsonObject } from '../../utils/json-utils.js';
3
+ import { UrlPath } from '../file/urlPath.js';
4
+ import { AiConfig } from './config/ai-config.js';
5
+ import { BrandConfig } from './config/brand-config.js';
6
+ import { allOf, optional, unknownKeys } from './config/fields.js';
7
+ import { NavigationConfig } from './config/navigation-config.js';
8
+ import { SiteConfig } from './config/site-config.js';
9
+ const BLOCK = 'portal';
10
+ const NAMESPACES = ['site', 'brand', 'navigation', 'ai'];
11
+ /** The one setting outside the namespaces, named as the portal artifacts endpoint reads it. */
12
+ const PLUGIN_URL = 'pluginUrl';
13
+ export class PortalConfig {
14
+ site;
15
+ brand;
16
+ navigation;
17
+ ai;
18
+ pluginAddress;
19
+ constructor(site, brand, navigation, ai, pluginAddress) {
20
+ this.site = site;
21
+ this.brand = brand;
22
+ this.navigation = navigation;
23
+ this.ai = ai;
24
+ this.pluginAddress = pluginAddress;
25
+ }
26
+ /** The block quickstart writes: the specification's own name and description, and every default spelled out. */
27
+ static scaffolded(site) {
28
+ return new PortalConfig(SiteConfig.suggested(site), BrandConfig.defaults, NavigationConfig.defaults, AiConfig.defaults, null);
29
+ }
30
+ /**
31
+ * `block` is whatever the file holds under `portal`. `suggested` is what the only specification
32
+ * says about itself, or null when there are several; it fills the site's name and description
33
+ * when the block leaves them out.
34
+ */
35
+ static fromBlock(block, suggested) {
36
+ if (block === undefined) {
37
+ return err([`'${BLOCK}' is required.`]);
38
+ }
39
+ if (!isJsonObject(block)) {
40
+ return err([`'${BLOCK}' must be a JSON object.`]);
41
+ }
42
+ // Each parser hands back the value it accepted, so the constructor is fed only what
43
+ // validation proved.
44
+ return allOf(unknownKeys(block, [...NAMESPACES, PLUGIN_URL], BLOCK), Result.combineWithAllErrors([
45
+ SiteConfig.parse(block.site, `${BLOCK}.site`, suggested),
46
+ BrandConfig.parse(block.brand, `${BLOCK}.brand`),
47
+ NavigationConfig.parse(block.navigation, `${BLOCK}.navigation`),
48
+ AiConfig.parse(block.ai, `${BLOCK}.ai`),
49
+ optional(block.pluginUrl, (value) => secureAddress(value, `${BLOCK}.${PLUGIN_URL}`))
50
+ ])).map((settings) => new PortalConfig(...settings));
51
+ }
52
+ siteTitle() {
53
+ return this.site.siteName();
54
+ }
55
+ /** Where the context plugin is hosted when it is not bundled into the portal, or null when it is. */
56
+ pluginUrl() {
57
+ return this.pluginAddress;
58
+ }
59
+ brandSettings() {
60
+ return this.brand;
61
+ }
62
+ staticFiles() {
63
+ return this.brand.files();
64
+ }
65
+ identity() {
66
+ const origin = this.site.origin();
67
+ const logo = this.brand.logoImages();
68
+ const favicon = this.brand.faviconImage();
69
+ return {
70
+ name: this.site.siteName(),
71
+ description: this.site.siteDescription(),
72
+ siteUrl: origin === null ? null : origin.toString(),
73
+ logo: logo === null ? null : { light: logo.light().siteUrl(), dark: logo.dark().siteUrl() },
74
+ favicon: favicon === null ? null : { url: favicon.siteUrl(), type: favicon.imageType() },
75
+ colorMode: this.brand.mode(),
76
+ links: this.navigation.headerLinks().map(portalLink),
77
+ pageActions: this.ai.offersPageActions()
78
+ };
79
+ }
80
+ /** Every namespace included, defaults and all, which is what quickstart writes. */
81
+ toJSON() {
82
+ return {
83
+ site: this.site.toJSON(),
84
+ brand: this.brand.toJSON(),
85
+ navigation: this.navigation.toJSON(),
86
+ ai: this.ai.toJSON(),
87
+ ...(this.pluginAddress === null ? {} : { pluginUrl: this.pluginAddress.toString() })
88
+ };
89
+ }
90
+ }
91
+ function portalLink(link) {
92
+ return { label: link.text(), url: link.href(), external: link.isExternal() };
93
+ }
94
+ const HTTPS_ADDRESS = /^https:\/\/\S+$/i;
95
+ const PLUGIN_URL_EXAMPLE = 'https://example.com/acme-plugin.zip';
96
+ // Parsed, so the quoted install command it goes into can hold no space or quote; https, as npx runs what it fetches.
97
+ function secureAddress(value, path) {
98
+ const url = typeof value === 'string' && HTTPS_ADDRESS.test(value) ? UrlPath.create(value) : undefined;
99
+ return url === undefined
100
+ ? err([
101
+ `'${path}' must be an address starting with 'https://', with no spaces, for example '${PLUGIN_URL_EXAMPLE}'.`
102
+ ])
103
+ : ok(new UrlPath(new URL(`${url}`).href));
104
+ }
105
+ //# sourceMappingURL=portal-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-config.js","sourceRoot":"","sources":["../../../src/types/portal/portal-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAU,WAAW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C,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;AAC/E,CAAC;AAED,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEzC,MAAM,kBAAkB,GAAG,qCAAqC,CAAC;AAEjE,qHAAqH;AACrH,SAAS,aAAa,CAAC,KAAc,EAAE,IAAY;IACjD,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACvG,OAAO,GAAG,KAAK,SAAS;QACtB,CAAC,CAAC,GAAG,CAAC;YACF,IAAI,IAAI,+EAA+E,kBAAkB,IAAI;SAC9G,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { FileName } from '../file/fileName.js';
2
+ export declare const DOWNLOADS_ADDRESS = "__downloads";
3
+ export declare const SDK_DOWNLOADS_FOLDER = "sdk";
4
+ export declare const PLUGIN_DOWNLOAD: FileName;
5
+ /** Keyed by the delivered name rather than `Language`, as the artifacts are. */
6
+ export declare function sdkDownload(language: string): FileName;
7
+ export declare function sdkDownloadAddress(language: string): string;
8
+ export declare const PLUGIN_DOWNLOAD_ADDRESS: string;
@@ -0,0 +1,14 @@
1
+ import { FileName } from '../file/fileName.js';
2
+ // One place for the names both the pages' links and the laid-out downloads use, so the two agree.
3
+ export const DOWNLOADS_ADDRESS = '__downloads';
4
+ export const SDK_DOWNLOADS_FOLDER = 'sdk';
5
+ export const PLUGIN_DOWNLOAD = new FileName('plugin.zip');
6
+ /** Keyed by the delivered name rather than `Language`, as the artifacts are. */
7
+ export function sdkDownload(language) {
8
+ return new FileName(`${language}.zip`);
9
+ }
10
+ export function sdkDownloadAddress(language) {
11
+ return `/${DOWNLOADS_ADDRESS}/${SDK_DOWNLOADS_FOLDER}/${sdkDownload(language)}`;
12
+ }
13
+ export const PLUGIN_DOWNLOAD_ADDRESS = `/${DOWNLOADS_ADDRESS}/${PLUGIN_DOWNLOAD}`;
14
+ //# sourceMappingURL=portal-downloads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-downloads.js","sourceRoot":"","sources":["../../../src/types/portal/portal-downloads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;AAE1D,gFAAgF;AAChF,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,IAAI,QAAQ,CAAC,GAAG,QAAQ,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAgB;IACjD,OAAO,IAAI,iBAAiB,IAAI,oBAAoB,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;AAClF,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,iBAAiB,IAAI,eAAe,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { Result } from 'neverthrow';
2
+ import { ConfigFinding } from '../apimatic-config/document.js';
3
+ import { PortalSdk } from './portal-sdk.js';
4
+ /**
5
+ * Read from the top-level `languages` block the plugin commands share. An entry without a
6
+ * `publishing` record counts: it is a language the project wants and has not published yet.
7
+ */
8
+ export declare class PortalLanguages {
9
+ private readonly sdks;
10
+ private constructor();
11
+ /** `findings` already covers a block or an entry of the wrong shape, so neither is checked here. */
12
+ static fromBlock(block: Record<string, unknown> | undefined, findings: readonly ConfigFinding[]): Result<PortalLanguages, string[]>;
13
+ /** In the order the block lists them. */
14
+ listed(): PortalSdk[];
15
+ }
@@ -0,0 +1,45 @@
1
+ import { err, ok } from 'neverthrow';
2
+ import { findingSentences } from '../apimatic-config/document.js';
3
+ import { LANGUAGES_EXAMPLE } from '../apimatic-config/languages-block.js';
4
+ import { Language, PORTAL_LANGUAGES } from '../sdk/generate.js';
5
+ import { quotedList } from './config/fields.js';
6
+ import { PortalSdk } from './portal-sdk.js';
7
+ const KNOWN_LANGUAGES = Object.values(Language);
8
+ const SUPPORTED_LANGUAGES = PORTAL_LANGUAGES;
9
+ // Written out in full so the one-line fix is in the message: nothing in the portal's own
10
+ // commands writes this block yet.
11
+ const REQUIRED = `'languages' must name at least one SDK language, for example ${LANGUAGES_EXAMPLE}. ` +
12
+ `It is the project's one list of SDK languages, which the plugin commands read too, and ` +
13
+ `'apimatic sdk publish' adds to it.`;
14
+ /**
15
+ * Read from the top-level `languages` block the plugin commands share. An entry without a
16
+ * `publishing` record counts: it is a language the project wants and has not published yet.
17
+ */
18
+ export class PortalLanguages {
19
+ sdks;
20
+ constructor(sdks) {
21
+ this.sdks = sdks;
22
+ }
23
+ /** `findings` already covers a block or an entry of the wrong shape, so neither is checked here. */
24
+ static fromBlock(block, findings) {
25
+ const errors = findingSentences(findings);
26
+ const entries = Object.entries(block ?? {});
27
+ if (entries.length === 0 && findings.length === 0) {
28
+ errors.push(REQUIRED);
29
+ }
30
+ for (const [key] of entries.filter(([key]) => !SUPPORTED_LANGUAGES.includes(key))) {
31
+ errors.push(KNOWN_LANGUAGES.includes(key)
32
+ ? `'languages.${key}' is not available yet; the portal supports ${quotedList(SUPPORTED_LANGUAGES)} today.`
33
+ : `'languages.${key}' is not an SDK language; name one of ${quotedList(SUPPORTED_LANGUAGES, 'or')}.`);
34
+ }
35
+ if (errors.length > 0) {
36
+ return err(errors);
37
+ }
38
+ return ok(new PortalLanguages(entries.map(([key, entry]) => PortalSdk.fromEntry(key, entry))));
39
+ }
40
+ /** In the order the block lists them. */
41
+ listed() {
42
+ return [...this.sdks];
43
+ }
44
+ }
45
+ //# sourceMappingURL=portal-languages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-languages.js","sourceRoot":"","sources":["../../../src/types/portal/portal-languages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAU,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAiB,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,eAAe,GAAsB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAEnE,MAAM,mBAAmB,GAAsB,gBAAgB,CAAC;AAEhE,yFAAyF;AACzF,kCAAkC;AAClC,MAAM,QAAQ,GACZ,gEAAgE,iBAAiB,IAAI;IACrF,yFAAyF;IACzF,oCAAoC,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,eAAe;IACW,IAAI;IAAzC,YAAqC,IAA0B;oBAA1B,IAAI;IAAyB,CAAC;IAEnE,oGAAoG;IAC7F,MAAM,CAAC,SAAS,CACrB,KAA0C,EAC1C,QAAkC;QAElC,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClD,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxB,CAAC;QACD,KAAK,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAClF,MAAM,CAAC,IAAI,CACT,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAC3B,CAAC,CAAC,cAAc,GAAG,+CAA+C,UAAU,CAAC,mBAAmB,CAAC,SAAS;gBAC1G,CAAC,CAAC,cAAc,GAAG,yCAAyC,UAAU,CAAC,mBAAmB,EAAE,IAAI,CAAC,GAAG,CACvG,CAAC;QACJ,CAAC;QACD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,CAAC,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,GAAe,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7G,CAAC;IAED,yCAAyC;IAClC,MAAM;QACX,OAAO,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,65 @@
1
+ import { Result } from 'neverthrow';
2
+ /** The directory the reference is mounted at, which `content/api/` shares, and so the name someone guesses for it. */
3
+ export declare const API_REFERENCE_NAME = "api";
4
+ /** The page a folder below the content root links to, which is never one of its children. */
5
+ export declare const INDEX_NAME = "index";
6
+ /** A `(group)` folder, which a page's address leaves out and a folder's name leaves unbracketed. */
7
+ export declare const GROUP_FOLDER: RegExp;
8
+ export declare const NAVIGATION_FILE_NAME = "nav.json";
9
+ /** Where a `nav.json` sits, and what its entries are allowed to address. */
10
+ export interface NavigationContext {
11
+ /** The file's path relative to `src/`, as messages name it. */
12
+ label: string;
13
+ /** Every `apimatic:` token resolves to a node that lives at the content root. */
14
+ isContentRoot: boolean;
15
+ /** `content/api/`, where the reference is mounted, which is always a tab. */
16
+ isApiDirectory: boolean;
17
+ /**
18
+ * Whether this directory becomes a folder in the sidebar at all. A directory with no page
19
+ * anywhere beneath it does not, and the template drops the node Fumadocs builds for its
20
+ * `nav.json`, so a title here would name nothing.
21
+ */
22
+ becomesFolder: boolean;
23
+ /** Pages and subfolders in the same directory; page names carry no extension. */
24
+ childNames: string[];
25
+ /** Subdirectories with no page in them or below them, which are no folder in the sidebar. */
26
+ emptyFolders: string[];
27
+ /** Subfolders that serve the home page, as a `(group)` folder's index page can at the content root. */
28
+ homePageFolders: string[];
29
+ }
30
+ /** What a valid `nav.json` says about its directory. */
31
+ export interface NavigationSettings {
32
+ /** The name it gives its folder, or at the content root the Home tab. */
33
+ title: string | undefined;
34
+ /** Its entries, trimmed; at the content root, each folder they name is a tab. */
35
+ pages: string[];
36
+ }
37
+ /**
38
+ * The rules of a `nav.json`, applied to one file. The template re-reads the file itself and
39
+ * orders the page tree from it, so nothing here travels into the build: this exists to
40
+ * refuse a file that would otherwise produce a quietly wrong sidebar. Fumadocs drops an
41
+ * entry it cannot resolve without a word, which is why the CLI validates instead.
42
+ */
43
+ export declare class PortalNavigation {
44
+ static validate(json: string, context: NavigationContext): Result<NavigationSettings, string[]>;
45
+ private static entryErrors;
46
+ private static checkEntry;
47
+ private static checkToken;
48
+ private static parseObject;
49
+ /** Whether a page and a folder in this directory both answer to the name. */
50
+ private static isSharedName;
51
+ /**
52
+ * A folder is named after its directory, or after the title of its index page; `title`
53
+ * outranks both. At the content root it names the Home tab, which holds the pages there and
54
+ * the folders the file does not list.
55
+ */
56
+ private static titleErrors;
57
+ private static describeUnknownField;
58
+ /** A near miss is nearly always a typo or a forgotten extension, so name the candidate. */
59
+ private static suggestion;
60
+ /**
61
+ * The section an entry was most likely meant to position: one named after its address, or
62
+ * after the word its token ends in, which for the context plugin is not the same word.
63
+ */
64
+ private static sectionGuessed;
65
+ }
@@ -0,0 +1,217 @@
1
+ import { err, ok } from 'neverthrow';
2
+ import { isJsonObject } from '../../utils/json-utils.js';
3
+ import { quotedList } from './config/fields.js';
4
+ import { GENERATED_SECTIONS } from './generated-pages.js';
5
+ import { unknownFieldErrors } from './unknown-fields.js';
6
+ const BYTE_ORDER_MARK = 0xfeff;
7
+ /** Everything in this directory that no other entry names. */
8
+ const REST_TOKEN = '...';
9
+ /** The API reference, positioned as one node. */
10
+ const API_REFERENCE_TOKEN = 'apimatic:api';
11
+ const APIMATIC_PREFIX = 'apimatic:';
12
+ /** Each generated section's tab, and the API reference. */
13
+ const TOKENS = [...GENERATED_SECTIONS.map((section) => section.token), API_REFERENCE_TOKEN];
14
+ /** The directory the reference is mounted at, which `content/api/` shares, and so the name someone guesses for it. */
15
+ export const API_REFERENCE_NAME = 'api';
16
+ /** The page a folder below the content root links to, which is never one of its children. */
17
+ export const INDEX_NAME = 'index';
18
+ /** A `(group)` folder, which a page's address leaves out and a folder's name leaves unbracketed. */
19
+ export const GROUP_FOLDER = /^\((.+)\)$/;
20
+ export const NAVIGATION_FILE_NAME = 'nav.json';
21
+ // A misspelled field would otherwise be stripped by Fumadocs' own schema and leave the
22
+ // sidebar in its default order with nothing said, so every unknown field is reported. The
23
+ // file has so few settings that a misspelling is answered by listing them all rather than
24
+ // guessing at the one it meant.
25
+ const KNOWN_FIELDS = new Set(['pages', 'title']);
26
+ /**
27
+ * The rules of a `nav.json`, applied to one file. The template re-reads the file itself and
28
+ * orders the page tree from it, so nothing here travels into the build: this exists to
29
+ * refuse a file that would otherwise produce a quietly wrong sidebar. Fumadocs drops an
30
+ * entry it cannot resolve without a word, which is why the CLI validates instead.
31
+ */
32
+ export class PortalNavigation {
33
+ static validate(json, context) {
34
+ const document = PortalNavigation.parseObject(json, context);
35
+ if (document.isErr()) {
36
+ return err(document.error);
37
+ }
38
+ const unknownFields = unknownFieldErrors(document.value, KNOWN_FIELDS, (field) => PortalNavigation.describeUnknownField(field, context));
39
+ const settingErrors = [...unknownFields, ...PortalNavigation.titleErrors(document.value.title, context)];
40
+ const title = typeof document.value.title === 'string' ? document.value.title.trim() : undefined;
41
+ const pages = document.value.pages;
42
+ if (pages === undefined) {
43
+ // A file with no `pages` orders nothing, which is odd but not wrong. It may still name
44
+ // the folder, which is why the title is checked above rather than alongside the entries.
45
+ return settingErrors.length > 0 ? err(settingErrors) : ok({ title, pages: [] });
46
+ }
47
+ if (!Array.isArray(pages) || pages.some((entry) => typeof entry !== 'string')) {
48
+ return err([...settingErrors, `${context.label}: 'pages' must be an array of strings.`]);
49
+ }
50
+ const entries = pages.map((entry) => entry.trim());
51
+ // Every bad entry is reported at once rather than stopping at the first, so one edit
52
+ // fixes the file.
53
+ const errors = [...settingErrors, ...PortalNavigation.entryErrors(entries, context)];
54
+ return errors.length > 0 ? err(errors) : ok({ title, pages: entries });
55
+ }
56
+ static entryErrors(entries, context) {
57
+ const errors = [];
58
+ // Keyed by the node an entry positions rather than its text: `content/api` is where the
59
+ // reference is mounted, so at the content root the name and the token reach one node --
60
+ // a directory the user keeps there merges into it rather than making a second. Naming it
61
+ // twice would have the template honour whichever came first without a word.
62
+ const seen = new Map();
63
+ for (const entry of entries) {
64
+ const node = context.isContentRoot && entry === API_REFERENCE_NAME ? API_REFERENCE_TOKEN : entry;
65
+ const earlier = seen.get(node);
66
+ if (earlier !== undefined) {
67
+ errors.push(earlier === entry
68
+ ? `${context.label}: '${entry}' is listed more than once.`
69
+ : `${context.label}: '${earlier}' and '${entry}' both position the API reference; keep one of them.`);
70
+ continue;
71
+ }
72
+ seen.set(node, entry);
73
+ const checked = PortalNavigation.checkEntry(entry, context);
74
+ if (checked.isErr()) {
75
+ errors.push(checked.error);
76
+ }
77
+ }
78
+ return errors;
79
+ }
80
+ static checkEntry(entry, context) {
81
+ if (entry === REST_TOKEN) {
82
+ return ok(undefined);
83
+ }
84
+ if (entry.startsWith(APIMATIC_PREFIX)) {
85
+ return PortalNavigation.checkToken(entry, context);
86
+ }
87
+ if (entry.length === 0) {
88
+ return err(`${context.label}: 'pages' must not contain an empty entry.`);
89
+ }
90
+ // Naming a nested path would claim the node out of its folder and leave the folder
91
+ // behind as an empty one, so only direct children are addressable.
92
+ if (entry.includes('/') || entry.includes('\\')) {
93
+ return err(`${context.label}: '${entry}' addresses another directory. An entry names a page or ` +
94
+ `folder in this directory; order a subfolder's pages with its own ${NAVIGATION_FILE_NAME}.`);
95
+ }
96
+ // A page of the same name is what the entry names, since the template drops the empty folder.
97
+ if (!context.childNames.includes(entry) && context.emptyFolders.includes(entry)) {
98
+ return err(`${context.label}: '${entry}' is a folder with no page in it or below it, so it is not in the ` +
99
+ `sidebar. Add a page to it, or remove the entry.`);
100
+ }
101
+ if (!context.childNames.includes(entry)) {
102
+ return err(`${context.label}: '${entry}' is not a page or folder in this directory.${PortalNavigation.suggestion(entry, context)}`);
103
+ }
104
+ // A page and a folder of one name are both children, and an entry positions the folder,
105
+ // as it does in Fumadocs' own metadata. The page could then never be positioned, which
106
+ // is the quietly wrong sidebar this file exists to refuse.
107
+ if (PortalNavigation.isSharedName(entry, context)) {
108
+ // At the content root the folder of that name is the API reference, mounted there
109
+ // whether or not a directory exists to see. "Both a page and a folder" would send the
110
+ // user looking for one.
111
+ return err(context.isContentRoot && entry === API_REFERENCE_NAME
112
+ ? `${context.label}: '${entry}' is where the API reference is mounted, so the entry positions ` +
113
+ `the reference rather than the page of that name. Rename the page to position it.`
114
+ : `${context.label}: '${entry}' is both a page and a folder in this directory, and the entry ` +
115
+ `positions the folder. Rename the page to position it.`);
116
+ }
117
+ // Below the content root the index page is the folder's own, not one of the pages it orders.
118
+ if (entry === INDEX_NAME && !context.isContentRoot) {
119
+ return err(`${context.label}: '${INDEX_NAME}' is the page this folder opens on, so it cannot be positioned ` +
120
+ `among its pages. Remove the entry; the folder itself is positioned by the ${NAVIGATION_FILE_NAME} ` +
121
+ `one level up.`);
122
+ }
123
+ // Each folder the content root lists is a tab, and the home page is the Home tab's.
124
+ if (context.homePageFolders.includes(entry)) {
125
+ return err(`${context.label}: '${entry}' serves the home page, which belongs to the Home tab, so it cannot ` +
126
+ `be a tab of its own. Remove the entry, or move the page out of the folder.`);
127
+ }
128
+ return ok(undefined);
129
+ }
130
+ static checkToken(entry, context) {
131
+ if (!TOKENS.includes(entry)) {
132
+ return err(`${context.label}: '${entry}' is not a ${NAVIGATION_FILE_NAME} token. ` +
133
+ `The tokens are ${quotedList(TOKENS)}.`);
134
+ }
135
+ if (!context.isContentRoot) {
136
+ return err(`${context.label}: '${entry}' can only be used in the ${NAVIGATION_FILE_NAME} at the top ` +
137
+ `of the content directory, because that is where the node it positions lives.`);
138
+ }
139
+ return ok(undefined);
140
+ }
141
+ static parseObject(json, context) {
142
+ // Unlike `apimatic.json`, this file is not read by the CLI alone: the build reads it again
143
+ // from the content directory with a bare `JSON.parse`, which a byte-order mark breaks.
144
+ // Accepting the mark here would pass a file the build then refuses with an opaque error.
145
+ if (json.codePointAt(0) === BYTE_ORDER_MARK) {
146
+ return err([
147
+ `${context.label} starts with a byte-order mark, which the build cannot read. ` +
148
+ `Save the file as UTF-8 without a BOM.`
149
+ ]);
150
+ }
151
+ let data;
152
+ try {
153
+ data = JSON.parse(json);
154
+ }
155
+ catch {
156
+ return err([`${context.label} is not valid JSON.`]);
157
+ }
158
+ if (!isJsonObject(data)) {
159
+ return err([`${context.label} must contain a JSON object.`]);
160
+ }
161
+ return ok(data);
162
+ }
163
+ /** Whether a page and a folder in this directory both answer to the name. */
164
+ static isSharedName(entry, context) {
165
+ return context.childNames.filter((name) => name === entry).length > 1;
166
+ }
167
+ /**
168
+ * A folder is named after its directory, or after the title of its index page; `title`
169
+ * outranks both. At the content root it names the Home tab, which holds the pages there and
170
+ * the folders the file does not list.
171
+ */
172
+ static titleErrors(title, context) {
173
+ if (title === undefined) {
174
+ return [];
175
+ }
176
+ // At the root it names the Home tab, which exists without a page; a folder without one does not.
177
+ if (!context.isContentRoot && !context.becomesFolder) {
178
+ return [
179
+ `${context.label}: 'title' names this folder, but a directory with no page in it or ` +
180
+ `below it is no folder in the sidebar. Add a page, or remove the setting.`
181
+ ];
182
+ }
183
+ if (typeof title !== 'string' || title.trim().length === 0) {
184
+ return [`${context.label}: 'title' must be a non-empty string.`];
185
+ }
186
+ return [];
187
+ }
188
+ static describeUnknownField(field, context) {
189
+ // Listed from the same set the check uses, so a setting added later is named here too.
190
+ const settings = quotedList([...KNOWN_FIELDS]);
191
+ return `${context.label}: '${field}' is not a ${NAVIGATION_FILE_NAME} setting. The settings are ${settings}.`;
192
+ }
193
+ /** A near miss is nearly always a typo or a forgotten extension, so name the candidate. */
194
+ static suggestion(entry, context) {
195
+ const lowered = entry.toLowerCase();
196
+ const withoutExtension = lowered.replace(/\.mdx?$/i, '');
197
+ // Matched without the extension too, so `api.md` is answered like `api` rather than
198
+ // pointed at a name that is refused the moment they write it.
199
+ if (withoutExtension === API_REFERENCE_NAME && context.isContentRoot) {
200
+ return ` The API reference is positioned with '${API_REFERENCE_TOKEN}'.`;
201
+ }
202
+ const section = context.isContentRoot ? PortalNavigation.sectionGuessed(withoutExtension) : undefined;
203
+ if (section !== undefined) {
204
+ return ` '${section.token}' positions ${section.description}.`;
205
+ }
206
+ const candidate = context.childNames.find((name) => name.toLowerCase() === lowered || name.toLowerCase() === withoutExtension);
207
+ return candidate === undefined ? '' : ` Did you mean '${candidate}'?`;
208
+ }
209
+ /**
210
+ * The section an entry was most likely meant to position: one named after its address, or
211
+ * after the word its token ends in, which for the context plugin is not the same word.
212
+ */
213
+ static sectionGuessed(name) {
214
+ return GENERATED_SECTIONS.find((section) => name === section.folder || name === section.token.slice(APIMATIC_PREFIX.length));
215
+ }
216
+ }
217
+ //# sourceMappingURL=portal-navigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-navigation.js","sourceRoot":"","sources":["../../../src/types/portal/portal-navigation.ts"],"names":[],"mappings":"AAAA,OAAO,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,CAAC;QACjE,CAAC;QACD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CACvC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,gBAAgB,CACpF,CAAC;QACF,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,SAAS,IAAI,CAAC;IACxE,CAAC;IAED;;;OAGG;IACK,MAAM,CAAC,cAAc,CAAC,IAAY;QACxC,OAAO,kBAAkB,CAAC,IAAI,CAC5B,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,IAAI,KAAK,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAC7F,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { UrlPath } from '../file/urlPath.js';
2
+ import { Language } from '../sdk/generate.js';
3
+ import { PublishedPackage } from './published-package.js';
4
+ /** One SDK language of the portal, with what `apimatic sdk publish` recorded about it. */
5
+ export declare class PortalSdk {
6
+ readonly language: Language;
7
+ private readonly repository;
8
+ private readonly published;
9
+ private constructor();
10
+ /** The document checked the shapes down to `publishing`; a wrongly shaped field below it reads as not recorded. */
11
+ static fromEntry(language: Language, entry: unknown): PortalSdk;
12
+ sourceRepository(): UrlPath | null;
13
+ /** Null until a release is recorded, or when the configuration does not name the package. */
14
+ publishedPackage(): PublishedPackage | null;
15
+ }
@@ -0,0 +1,28 @@
1
+ import { recordedPublishing } from '../apimatic-config/languages-block.js';
2
+ import { UrlPath } from '../file/urlPath.js';
3
+ import { publishedPackage } from './published-package.js';
4
+ /** One SDK language of the portal, with what `apimatic sdk publish` recorded about it. */
5
+ export class PortalSdk {
6
+ language;
7
+ repository;
8
+ published;
9
+ constructor(language, repository, published) {
10
+ this.language = language;
11
+ this.repository = repository;
12
+ this.published = published;
13
+ }
14
+ /** The document checked the shapes down to `publishing`; a wrongly shaped field below it reads as not recorded. */
15
+ static fromEntry(language, entry) {
16
+ const { repositoryUrl, version, packageConfiguration } = recordedPublishing(entry);
17
+ const hasRelease = (version?.trim() ?? '').length > 0;
18
+ return new PortalSdk(language, repositoryUrl === null ? null : UrlPath.create(repositoryUrl) ?? null, hasRelease ? publishedPackage(language, packageConfiguration) : null);
19
+ }
20
+ sourceRepository() {
21
+ return this.repository;
22
+ }
23
+ /** Null until a release is recorded, or when the configuration does not name the package. */
24
+ publishedPackage() {
25
+ return this.published;
26
+ }
27
+ }
28
+ //# sourceMappingURL=portal-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portal-sdk.js","sourceRoot":"","sources":["../../../src/types/portal/portal-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAoB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,0FAA0F;AAC1F,MAAM,OAAO,SAAS;IAEF,QAAQ;IACP,UAAU;IACV,SAAS;IAH5B,YACkB,QAAkB,EACjB,UAA0B,EAC1B,SAAkC;wBAFnC,QAAQ;0BACP,UAAU;yBACV,SAAS;IACzB,CAAC;IAEJ,mHAAmH;IAC5G,MAAM,CAAC,SAAS,CAAC,QAAkB,EAAE,KAAc;QACxD,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnF,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QAEtD,OAAO,IAAI,SAAS,CAClB,QAAQ,EACR,aAAa,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,IAAI,EACrE,UAAU,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,IAAI,CACrE,CAAC;IACJ,CAAC;IAEM,gBAAgB;QACrB,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,6FAA6F;IACtF,gBAAgB;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}