@phtngyn/cms 0.2.0-beta.8 → 0.3.0

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 (524) hide show
  1. package/LICENSE +18 -10
  2. package/README.md +59 -404
  3. package/drizzle/20261003215543_initial/migration.sql +251 -0
  4. package/drizzle/20261003215543_initial/snapshot.json +1941 -0
  5. package/package.json +75 -71
  6. package/src/Authoring.d.ts +41 -49
  7. package/src/Authoring.js +1 -1
  8. package/src/Blocks-BrxSemnd.js +40 -0
  9. package/src/Client.d.ts +8186 -0
  10. package/src/Client.js +41 -0
  11. package/src/Collections.d.ts +142 -0
  12. package/src/Collections.js +142 -0
  13. package/src/Config-CMiwciub.js +130 -0
  14. package/src/Config.d.ts +172 -0
  15. package/src/Config.js +2 -0
  16. package/src/Configuration-Dk2k3OIc.js +73 -0
  17. package/src/DataTransfer-BmECvPHB.js +488 -0
  18. package/src/Database-DSsNCGft.d.ts +3 -0
  19. package/src/Delivery.d.ts +28 -0
  20. package/src/Delivery.js +7 -0
  21. package/src/Document-CKXMSEf1.js +293 -0
  22. package/src/Document-TgwYKJZM.d.ts +220 -0
  23. package/src/DocumentRenderer-Wz2xaNyf.js +394 -0
  24. package/src/EditorSchema-wrDv-id6.js +296 -0
  25. package/src/Fields-BegSgYhj.d.ts +166 -0
  26. package/src/Fields-ioGaMEh9.js +130 -0
  27. package/src/Forms-BuKAXQxr.d.ts +203 -0
  28. package/src/Forms.d.ts +48 -11
  29. package/src/Forms.js +342 -7
  30. package/src/I18n-Ckf9h0rC.js +154 -0
  31. package/src/I18n.d.ts +45 -2
  32. package/src/I18n.js +2 -1
  33. package/src/Image-CJWPLnhP.js +110 -0
  34. package/src/Links-CJYyy7rC.js +28 -0
  35. package/src/Links-Dx1yOni8.d.ts +28 -0
  36. package/src/Locales-Ch7a5xuA.js +67 -0
  37. package/src/Locales-jwbmJaOp.d.ts +43 -0
  38. package/src/Locales.d.ts +3 -0
  39. package/src/Locales.js +3 -0
  40. package/src/Media-BQ0uL4w7.d.ts +15 -0
  41. package/src/Media-DSyvd14o.js +87 -0
  42. package/src/Module.d.ts +2 -10
  43. package/src/Module.js +1040 -152
  44. package/src/Operations.d.ts +57 -0
  45. package/src/Operations.js +263 -0
  46. package/src/People-DvNZauWw.js +69 -0
  47. package/src/PreviewFocus-C_EelZO5.js +104 -0
  48. package/src/Query-C0kGJF5_.d.ts +261 -0
  49. package/src/RevisionPreview-IVwbJ9Wy.js +133 -0
  50. package/src/Routes-BaZvm2LE.js +126 -0
  51. package/src/Routes-DM1rRp3r.d.ts +15 -0
  52. package/src/S3MediaObjects-y-WacEi9.js +193 -0
  53. package/src/Seo-BcpqxoAs.d.ts +57 -0
  54. package/src/Seo-CjNUtUkj.js +254 -0
  55. package/src/StudioApi-CXLwwocX.js +833 -0
  56. package/src/StudioErrors-T5zLGQ1M.js +117 -0
  57. package/src/StudioErrors-kq-E44lQ.d.ts +104 -0
  58. package/src/StudioServer.d.ts +20 -0
  59. package/src/StudioServer.js +34 -0
  60. package/src/answers-DcTg0Xv2.js +41 -0
  61. package/src/cli.js +681 -187
  62. package/src/contracts-rprW3ZOB.js +130 -0
  63. package/src/forms-3xuf0Ym7.d.ts +206 -0
  64. package/src/localeConfiguration-BPbkLi7-.js +32 -0
  65. package/src/localeContext-DhF3SPvM.js +59 -0
  66. package/src/locales-6OD4XGIZ.js +12 -0
  67. package/src/nuxtDelivery-BYX_Cddb.js +466 -0
  68. package/src/plugin-DTYuDaQu.js +7171 -0
  69. package/src/previewContext-dt3ZUh-w.js +4 -0
  70. package/src/previewRegions-CXjk5cbP.js +145 -0
  71. package/src/previewSource-fb-q3ESM.js +144 -0
  72. package/src/rendering-D9LVeEKX.js +47 -0
  73. package/src/rolldown-runtime-8H4AJuhK.js +14 -0
  74. package/src/runtime/CmsImage.js +38 -0
  75. package/src/runtime/DocumentPage.vue +10 -0
  76. package/src/runtime/DocumentPageContent.js +48 -0
  77. package/src/runtime/DocumentRenderer.d.ts +129 -0
  78. package/src/runtime/DocumentRenderer.js +2 -0
  79. package/src/runtime/api.js +48 -6
  80. package/src/runtime/delivery/useCmsDocument.js +2 -0
  81. package/src/runtime/delivery/useCmsDocumentQuery.js +2 -0
  82. package/src/runtime/delivery/useCmsDocumentSeo.js +2 -114
  83. package/src/runtime/delivery/useCmsLocale.js +10 -0
  84. package/src/runtime/plugin.js +2 -40
  85. package/src/runtime/preview.css +85 -0
  86. package/src/runtime/preview.js +277 -0
  87. package/src/runtime/previewSource.js +82 -0
  88. package/src/runtime/revisionPrivacy.js +13 -0
  89. package/src/runtime/studio.js +10 -0
  90. package/src/runtime/studioIcons.js +36 -0
  91. package/src/validation-3pggwcnm.js +396 -0
  92. package/src/validation-DpUwPC8Y.js +224 -0
  93. package/studio/THIRD-PARTY-LICENSES.md +2406 -0
  94. package/studio/chunks/AccountPage-DL3DitDM.js +288 -0
  95. package/studio/chunks/AccountPage-DL3DitDM.js.br +0 -0
  96. package/studio/chunks/AccountPage-DL3DitDM.js.gz +0 -0
  97. package/studio/chunks/ActivityPage-CLqVUqTh.js +584 -0
  98. package/studio/chunks/ActivityPage-CLqVUqTh.js.br +0 -0
  99. package/studio/chunks/ActivityPage-CLqVUqTh.js.gz +0 -0
  100. package/studio/chunks/Alert-D0D24z_a.js +335 -0
  101. package/studio/chunks/Alert-D0D24z_a.js.br +0 -0
  102. package/studio/chunks/Alert-D0D24z_a.js.gz +0 -0
  103. package/studio/chunks/Badge-BBFs88TI.js +346 -0
  104. package/studio/chunks/Badge-BBFs88TI.js.br +0 -0
  105. package/studio/chunks/Badge-BBFs88TI.js.gz +0 -0
  106. package/studio/chunks/Button-BT3ztSPx.js +14319 -0
  107. package/studio/chunks/Button-BT3ztSPx.js.br +0 -0
  108. package/studio/chunks/Button-BT3ztSPx.js.gz +0 -0
  109. package/studio/chunks/Collapsible-CKnEYIlp.js +246 -0
  110. package/studio/chunks/Collapsible-CKnEYIlp.js.br +0 -0
  111. package/studio/chunks/Collapsible-CKnEYIlp.js.gz +0 -0
  112. package/studio/chunks/ContentInventory-D7nsFA6U.js +1745 -0
  113. package/studio/chunks/ContentInventory-D7nsFA6U.js.br +0 -0
  114. package/studio/chunks/ContentInventory-D7nsFA6U.js.gz +0 -0
  115. package/studio/chunks/ContentPage-DCxt6BeD.js +18 -0
  116. package/studio/chunks/ContentPage-DCxt6BeD.js.br +0 -0
  117. package/studio/chunks/ContentPage-DCxt6BeD.js.gz +0 -0
  118. package/studio/chunks/DashboardSearch-DjyMjJwF.js +2413 -0
  119. package/studio/chunks/DashboardSearch-DjyMjJwF.js.br +0 -0
  120. package/studio/chunks/DashboardSearch-DjyMjJwF.js.gz +0 -0
  121. package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js +26063 -0
  122. package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.br +0 -0
  123. package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.gz +0 -0
  124. package/studio/chunks/DropdownMenu-CA9fB0uZ.js +4400 -0
  125. package/studio/chunks/DropdownMenu-CA9fB0uZ.js.br +0 -0
  126. package/studio/chunks/DropdownMenu-CA9fB0uZ.js.gz +0 -0
  127. package/studio/chunks/EditorPage-D_PAYEE4.js +7799 -0
  128. package/studio/chunks/EditorPage-D_PAYEE4.js.br +0 -0
  129. package/studio/chunks/EditorPage-D_PAYEE4.js.gz +0 -0
  130. package/studio/chunks/FormField-CgM6l2Yn.js +198 -0
  131. package/studio/chunks/FormField-CgM6l2Yn.js.br +0 -0
  132. package/studio/chunks/FormField-CgM6l2Yn.js.gz +0 -0
  133. package/studio/chunks/HelpPage-C-vrFcT_.js +552 -0
  134. package/studio/chunks/HelpPage-C-vrFcT_.js.br +0 -0
  135. package/studio/chunks/HelpPage-C-vrFcT_.js.gz +0 -0
  136. package/studio/chunks/Kbd-Ot7TIhVZ.js +271 -0
  137. package/studio/chunks/Kbd-Ot7TIhVZ.js.br +0 -0
  138. package/studio/chunks/Kbd-Ot7TIhVZ.js.gz +0 -0
  139. package/studio/chunks/MediaFolderDialog-DYu-eu-q.js +101 -0
  140. package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.br +0 -0
  141. package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.gz +0 -0
  142. package/studio/chunks/MediaPage-D-jaWtdl.js +923 -0
  143. package/studio/chunks/MediaPage-D-jaWtdl.js.br +0 -0
  144. package/studio/chunks/MediaPage-D-jaWtdl.js.gz +0 -0
  145. package/studio/chunks/MediaPicker-BZs2wUFz.js +837 -0
  146. package/studio/chunks/MediaPicker-BZs2wUFz.js.br +0 -0
  147. package/studio/chunks/MediaPicker-BZs2wUFz.js.gz +0 -0
  148. package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js +1173 -0
  149. package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.br +0 -0
  150. package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.gz +0 -0
  151. package/studio/chunks/Modal-D6hSvxHd.js +265 -0
  152. package/studio/chunks/Modal-D6hSvxHd.js.br +0 -0
  153. package/studio/chunks/Modal-D6hSvxHd.js.gz +0 -0
  154. package/studio/chunks/NewDocumentDialog-C8B6_r3J.js +277 -0
  155. package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.br +0 -0
  156. package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.gz +0 -0
  157. package/studio/chunks/Pagination-D9BSo5H2.js +573 -0
  158. package/studio/chunks/Pagination-D9BSo5H2.js.br +0 -0
  159. package/studio/chunks/Pagination-D9BSo5H2.js.gz +0 -0
  160. package/studio/chunks/PeoplePage-CWIXitBD.js +783 -0
  161. package/studio/chunks/PeoplePage-CWIXitBD.js.br +0 -0
  162. package/studio/chunks/PeoplePage-CWIXitBD.js.gz +0 -0
  163. package/studio/chunks/Popover-B63bkTMS.js +128 -0
  164. package/studio/chunks/Popover-B63bkTMS.js.br +0 -0
  165. package/studio/chunks/Popover-B63bkTMS.js.gz +0 -0
  166. package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js +255 -0
  167. package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.br +0 -0
  168. package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.gz +0 -0
  169. package/studio/chunks/Routes-DLYHmulE.js +102 -0
  170. package/studio/chunks/Routes-DLYHmulE.js.br +0 -0
  171. package/studio/chunks/Routes-DLYHmulE.js.gz +0 -0
  172. package/studio/chunks/RovingFocusItem-QZNg-wWF.js +95 -0
  173. package/studio/chunks/RovingFocusItem-QZNg-wWF.js.br +0 -0
  174. package/studio/chunks/RovingFocusItem-QZNg-wWF.js.gz +0 -0
  175. package/studio/chunks/ScheduledPage-C0hqrkr5.js +332 -0
  176. package/studio/chunks/ScheduledPage-C0hqrkr5.js.br +0 -0
  177. package/studio/chunks/ScheduledPage-C0hqrkr5.js.gz +0 -0
  178. package/studio/chunks/Search-BEgCe9Aj.js +14646 -0
  179. package/studio/chunks/Search-BEgCe9Aj.js.br +0 -0
  180. package/studio/chunks/Search-BEgCe9Aj.js.gz +0 -0
  181. package/studio/chunks/Select-B50WZMW-.js +2145 -0
  182. package/studio/chunks/Select-B50WZMW-.js.br +0 -0
  183. package/studio/chunks/Select-B50WZMW-.js.gz +0 -0
  184. package/studio/chunks/SelectMenu-DSweWGMz.js +2109 -0
  185. package/studio/chunks/SelectMenu-DSweWGMz.js.br +0 -0
  186. package/studio/chunks/SelectMenu-DSweWGMz.js.gz +0 -0
  187. package/studio/chunks/SeoPage-CNNxGe4h.js +846 -0
  188. package/studio/chunks/SeoPage-CNNxGe4h.js.br +0 -0
  189. package/studio/chunks/SeoPage-CNNxGe4h.js.gz +0 -0
  190. package/studio/chunks/Skeleton-COz8dcrw.js +39 -0
  191. package/studio/chunks/Skeleton-COz8dcrw.js.br +2 -0
  192. package/studio/chunks/Skeleton-COz8dcrw.js.gz +0 -0
  193. package/studio/chunks/Slideover-QMMHAAys.js +289 -0
  194. package/studio/chunks/Slideover-QMMHAAys.js.br +0 -0
  195. package/studio/chunks/Slideover-QMMHAAys.js.gz +0 -0
  196. package/studio/chunks/StudioPage-ngEIDr5d.js +80 -0
  197. package/studio/chunks/StudioPage-ngEIDr5d.js.br +0 -0
  198. package/studio/chunks/StudioPage-ngEIDr5d.js.gz +0 -0
  199. package/studio/chunks/StudioPageToolbar-BwHnqyr6.js +2524 -0
  200. package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.br +0 -0
  201. package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.gz +0 -0
  202. package/studio/chunks/Switch-qKl1aDn7.js +484 -0
  203. package/studio/chunks/Switch-qKl1aDn7.js.br +0 -0
  204. package/studio/chunks/Switch-qKl1aDn7.js.gz +0 -0
  205. package/studio/chunks/ToolPage-DxoVAJVk.js +29 -0
  206. package/studio/chunks/ToolPage-DxoVAJVk.js.br +0 -0
  207. package/studio/chunks/ToolPage-DxoVAJVk.js.gz +0 -0
  208. package/studio/chunks/Tooltip-Bu15m_DB.js +693 -0
  209. package/studio/chunks/Tooltip-Bu15m_DB.js.br +0 -0
  210. package/studio/chunks/Tooltip-Bu15m_DB.js.gz +0 -0
  211. package/studio/chunks/TrashPage-lhqLLdoG.js +12 -0
  212. package/studio/chunks/TrashPage-lhqLLdoG.js.br +0 -0
  213. package/studio/chunks/TrashPage-lhqLLdoG.js.gz +0 -0
  214. package/studio/chunks/VersionsPage-Cqy6UAp9.js +2349 -0
  215. package/studio/chunks/VersionsPage-Cqy6UAp9.js.br +0 -0
  216. package/studio/chunks/VersionsPage-Cqy6UAp9.js.gz +0 -0
  217. package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js +113 -0
  218. package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.br +0 -0
  219. package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.gz +0 -0
  220. package/studio/chunks/arrays-CUJkmV4I.js +10 -0
  221. package/studio/chunks/arrays-CUJkmV4I.js.br +0 -0
  222. package/studio/chunks/arrays-CUJkmV4I.js.gz +0 -0
  223. package/studio/chunks/base-DkTekJe8.js +213 -0
  224. package/studio/chunks/base-DkTekJe8.js.br +0 -0
  225. package/studio/chunks/base-DkTekJe8.js.gz +0 -0
  226. package/studio/chunks/content-DUGl3N4d.js +6012 -0
  227. package/studio/chunks/content-DUGl3N4d.js.br +0 -0
  228. package/studio/chunks/content-DUGl3N4d.js.gz +0 -0
  229. package/studio/chunks/destinations-DPIQVQa6.js +227 -0
  230. package/studio/chunks/destinations-DPIQVQa6.js.br +0 -0
  231. package/studio/chunks/destinations-DPIQVQa6.js.gz +0 -0
  232. package/studio/chunks/en-073cjKW4.js +152 -0
  233. package/studio/chunks/en-073cjKW4.js.br +0 -0
  234. package/studio/chunks/en-073cjKW4.js.gz +0 -0
  235. package/studio/chunks/en-Bn8mxPuf.js +134 -0
  236. package/studio/chunks/en-Bn8mxPuf.js.br +0 -0
  237. package/studio/chunks/en-Bn8mxPuf.js.gz +0 -0
  238. package/studio/chunks/en-C9OiaUDZ.js +251 -0
  239. package/studio/chunks/en-C9OiaUDZ.js.br +0 -0
  240. package/studio/chunks/en-C9OiaUDZ.js.gz +0 -0
  241. package/studio/chunks/en-CHAR6jzx.js +147 -0
  242. package/studio/chunks/en-CHAR6jzx.js.br +0 -0
  243. package/studio/chunks/en-CHAR6jzx.js.gz +0 -0
  244. package/studio/chunks/en-Cq4N1vEF.js +93 -0
  245. package/studio/chunks/en-Cq4N1vEF.js.br +2 -0
  246. package/studio/chunks/en-Cq4N1vEF.js.gz +0 -0
  247. package/studio/chunks/en-D2hRqlse.js +140 -0
  248. package/studio/chunks/en-D2hRqlse.js.br +0 -0
  249. package/studio/chunks/en-D2hRqlse.js.gz +0 -0
  250. package/studio/chunks/en-DiUC3-j6.js +144 -0
  251. package/studio/chunks/en-DiUC3-j6.js.br +0 -0
  252. package/studio/chunks/en-DiUC3-j6.js.gz +0 -0
  253. package/studio/chunks/english-Cs_Adu-u.js +8 -0
  254. package/studio/chunks/english-Cs_Adu-u.js.br +0 -0
  255. package/studio/chunks/english-Cs_Adu-u.js.gz +0 -0
  256. package/studio/chunks/esm-D6DqSiL1.js +752 -0
  257. package/studio/chunks/esm-D6DqSiL1.js.br +0 -0
  258. package/studio/chunks/esm-D6DqSiL1.js.gz +0 -0
  259. package/studio/chunks/externalRequest-CTzr2nDq.js +23 -0
  260. package/studio/chunks/externalRequest-CTzr2nDq.js.br +0 -0
  261. package/studio/chunks/externalRequest-CTzr2nDq.js.gz +0 -0
  262. package/studio/chunks/iconify-DR9ryCPv.js +1007 -0
  263. package/studio/chunks/iconify-DR9ryCPv.js.br +0 -0
  264. package/studio/chunks/iconify-DR9ryCPv.js.gz +0 -0
  265. package/studio/chunks/icons-D2MsAaXq.js +183 -0
  266. package/studio/chunks/icons-D2MsAaXq.js.br +0 -0
  267. package/studio/chunks/icons-D2MsAaXq.js.gz +0 -0
  268. package/studio/chunks/leaveGuards-D22fTGgr.js +26 -0
  269. package/studio/chunks/leaveGuards-D22fTGgr.js.br +0 -0
  270. package/studio/chunks/leaveGuards-D22fTGgr.js.gz +0 -0
  271. package/studio/chunks/lucideIcons-EyqyPBsX.js +238 -0
  272. package/studio/chunks/lucideIcons-EyqyPBsX.js.br +0 -0
  273. package/studio/chunks/lucideIcons-EyqyPBsX.js.gz +0 -0
  274. package/studio/chunks/mediaRoute--8cY8rUe.js +17 -0
  275. package/studio/chunks/mediaRoute--8cY8rUe.js.br +0 -0
  276. package/studio/chunks/mediaRoute--8cY8rUe.js.gz +0 -0
  277. package/studio/chunks/newDocumentPlanning-C26DHpvh.js +77 -0
  278. package/studio/chunks/newDocumentPlanning-C26DHpvh.js.br +0 -0
  279. package/studio/chunks/newDocumentPlanning-C26DHpvh.js.gz +0 -0
  280. package/studio/chunks/notifications-OKOLc40v.js +110 -0
  281. package/studio/chunks/notifications-OKOLc40v.js.br +0 -0
  282. package/studio/chunks/notifications-OKOLc40v.js.gz +0 -0
  283. package/studio/chunks/operations-CjNHyrEX.js +57 -0
  284. package/studio/chunks/operations-CjNHyrEX.js.br +0 -0
  285. package/studio/chunks/operations-CjNHyrEX.js.gz +0 -0
  286. package/studio/chunks/overlay-DnqFLZTc.js +1733 -0
  287. package/studio/chunks/overlay-DnqFLZTc.js.br +0 -0
  288. package/studio/chunks/overlay-DnqFLZTc.js.gz +0 -0
  289. package/studio/chunks/presentation-DF83w0hE.js +57 -0
  290. package/studio/chunks/presentation-DF83w0hE.js.br +0 -0
  291. package/studio/chunks/presentation-DF83w0hE.js.gz +0 -0
  292. package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js +4557 -0
  293. package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.br +0 -0
  294. package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.gz +0 -0
  295. package/studio/chunks/searchPresentation-DFwxQkt3.js +76 -0
  296. package/studio/chunks/searchPresentation-DFwxQkt3.js.br +0 -0
  297. package/studio/chunks/searchPresentation-DFwxQkt3.js.gz +0 -0
  298. package/studio/chunks/status-DQv6ihkU.js +38 -0
  299. package/studio/chunks/status-DQv6ihkU.js.br +0 -0
  300. package/studio/chunks/status-DQv6ihkU.js.gz +0 -0
  301. package/studio/chunks/studioContext-I8HozGU1.js +4953 -0
  302. package/studio/chunks/studioContext-I8HozGU1.js.br +0 -0
  303. package/studio/chunks/studioContext-I8HozGU1.js.gz +0 -0
  304. package/studio/chunks/studioQueries-BR-9NT5F.js +73 -0
  305. package/studio/chunks/studioQueries-BR-9NT5F.js.br +0 -0
  306. package/studio/chunks/studioQueries-BR-9NT5F.js.gz +0 -0
  307. package/studio/chunks/studioSearch-ByaL-QpM.js +1095 -0
  308. package/studio/chunks/studioSearch-ByaL-QpM.js.br +0 -0
  309. package/studio/chunks/studioSearch-ByaL-QpM.js.gz +0 -0
  310. package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js +62 -0
  311. package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.br +0 -0
  312. package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.gz +0 -0
  313. package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js +189 -0
  314. package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.br +0 -0
  315. package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.gz +0 -0
  316. package/studio/chunks/useDocumentMessage-BAWvc38w.js +16 -0
  317. package/studio/chunks/useDocumentMessage-BAWvc38w.js.br +3 -0
  318. package/studio/chunks/useDocumentMessage-BAWvc38w.js.gz +0 -0
  319. package/studio/chunks/useFilter-DzyiTR7f.js +87 -0
  320. package/studio/chunks/useFilter-DzyiTR7f.js.br +0 -0
  321. package/studio/chunks/useFilter-DzyiTR7f.js.gz +0 -0
  322. package/studio/chunks/useFormControl-CL7sSCUo.js +8 -0
  323. package/studio/chunks/useFormControl-CL7sSCUo.js.br +0 -0
  324. package/studio/chunks/useFormControl-CL7sSCUo.js.gz +0 -0
  325. package/studio/chunks/useGraceArea-Chcy25IQ.js +154 -0
  326. package/studio/chunks/useGraceArea-Chcy25IQ.js.br +0 -0
  327. package/studio/chunks/useGraceArea-Chcy25IQ.js.gz +0 -0
  328. package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js +44 -0
  329. package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.br +8 -0
  330. package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.gz +0 -0
  331. package/studio/chunks/useLinkCopy-CMjQteCy.js +35 -0
  332. package/studio/chunks/useLinkCopy-CMjQteCy.js.br +0 -0
  333. package/studio/chunks/useLinkCopy-CMjQteCy.js.gz +0 -0
  334. package/studio/chunks/usePointerMotion-DwRcwBNQ.js +16 -0
  335. package/studio/chunks/usePointerMotion-DwRcwBNQ.js.br +0 -0
  336. package/studio/chunks/usePointerMotion-DwRcwBNQ.js.gz +0 -0
  337. package/studio/chunks/useStudioNavigation-CLwtSYpb.js +298 -0
  338. package/studio/chunks/useStudioNavigation-CLwtSYpb.js.br +0 -0
  339. package/studio/chunks/useStudioNavigation-CLwtSYpb.js.gz +0 -0
  340. package/studio/chunks/useStudioPages-DR9qmYLg.js +79 -0
  341. package/studio/chunks/useStudioPages-DR9qmYLg.js.br +0 -0
  342. package/studio/chunks/useStudioPages-DR9qmYLg.js.gz +0 -0
  343. package/studio/chunks/utils-mdScC0v0.js +59 -0
  344. package/studio/chunks/utils-mdScC0v0.js.br +0 -0
  345. package/studio/chunks/utils-mdScC0v0.js.gz +0 -0
  346. package/studio/chunks/virtualizer-D1S0bZ4t.js +781 -0
  347. package/studio/chunks/virtualizer-D1S0bZ4t.js.br +0 -0
  348. package/studio/chunks/virtualizer-D1S0bZ4t.js.gz +0 -0
  349. package/studio/help/64f767fe29c2-save-and-publish.svg +7 -0
  350. package/studio/host.css +1 -1
  351. package/studio/host.css.br +0 -0
  352. package/studio/host.css.gz +0 -0
  353. package/studio/host.js +8793 -39395
  354. package/studio/host.js.br +0 -0
  355. package/studio/host.js.gz +0 -0
  356. package/CHANGELOG.md +0 -14
  357. package/bin/cms.mjs +0 -2
  358. package/src/ApplicationTypes.d.ts +0 -84
  359. package/src/ApplicationTypes.js +0 -1
  360. package/src/Configuration-CMweD9bn.js +0 -1191
  361. package/src/Configuration-CMweD9bn.js.map +0 -1
  362. package/src/Configuration.d.ts +0 -82
  363. package/src/Configuration.js +0 -8
  364. package/src/Configuration.js.map +0 -1
  365. package/src/Content.d.ts +0 -68
  366. package/src/Content.js +0 -373
  367. package/src/Content.js.map +0 -1
  368. package/src/ContentTransfer-BxwswWn3.js +0 -86
  369. package/src/ContentTransfer-BxwswWn3.js.map +0 -1
  370. package/src/ContentTransfer-Z9FHyLez.d.ts +0 -72
  371. package/src/DocumentEngine-tYtwbBjr.js +0 -978
  372. package/src/DocumentEngine-tYtwbBjr.js.map +0 -1
  373. package/src/DocumentModel.d.ts +0 -52
  374. package/src/DocumentModel.js +0 -66
  375. package/src/DocumentModel.js.map +0 -1
  376. package/src/Forms-CX-hwmJF.js +0 -391
  377. package/src/Forms-CX-hwmJF.js.map +0 -1
  378. package/src/Forms-CfNPTiCr.js +0 -110
  379. package/src/Forms-CfNPTiCr.js.map +0 -1
  380. package/src/Forms-R0HoTR-o.d.ts +0 -92
  381. package/src/Forms.js.map +0 -1
  382. package/src/HttpPaths-Be3vshPJ.js +0 -20
  383. package/src/HttpPaths-Be3vshPJ.js.map +0 -1
  384. package/src/I18n-wxswIRyY.d.ts +0 -30
  385. package/src/Media-j1bTritO.js +0 -112
  386. package/src/Media-j1bTritO.js.map +0 -1
  387. package/src/Module.js.map +0 -1
  388. package/src/References-CCPDAPve.js +0 -45
  389. package/src/References-CCPDAPve.js.map +0 -1
  390. package/src/S3MediaObjects-BXfjaZOu.js +0 -2756
  391. package/src/S3MediaObjects-BXfjaZOu.js.map +0 -1
  392. package/src/Seo-402YumpT.d.ts +0 -198
  393. package/src/cli/content.js +0 -101
  394. package/src/cli/content.js.map +0 -1
  395. package/src/cli.js.map +0 -1
  396. package/src/connection-BP80q4d-.js +0 -92
  397. package/src/connection-BP80q4d-.js.map +0 -1
  398. package/src/dev-lifecycle-3I_pozUl.js +0 -535
  399. package/src/dev-lifecycle-3I_pozUl.js.map +0 -1
  400. package/src/installation-DxqSSVbH.js +0 -9105
  401. package/src/installation-DxqSSVbH.js.map +0 -1
  402. package/src/internal/application-types.js +0 -43
  403. package/src/internal/application-types.js.map +0 -1
  404. package/src/internal/authoring-catalog.js +0 -158
  405. package/src/internal/authoring-catalog.js.map +0 -1
  406. package/src/internal/authoring-compiler.js +0 -146
  407. package/src/internal/authoring-compiler.js.map +0 -1
  408. package/src/internal/authoring-metadata.js +0 -191
  409. package/src/internal/authoring-metadata.js.map +0 -1
  410. package/src/internal/cms-config.js +0 -45
  411. package/src/internal/cms-config.js.map +0 -1
  412. package/src/internal/configuration.js +0 -228
  413. package/src/internal/configuration.js.map +0 -1
  414. package/src/internal/dev-lifecycle.js +0 -3
  415. package/src/internal/diagnostics.js +0 -47
  416. package/src/internal/diagnostics.js.map +0 -1
  417. package/src/internal/document-model.js +0 -376
  418. package/src/internal/document-model.js.map +0 -1
  419. package/src/internal/field-metadata.js +0 -7
  420. package/src/internal/field-metadata.js.map +0 -1
  421. package/src/internal/form-capabilities.js +0 -12
  422. package/src/internal/form-capabilities.js.map +0 -1
  423. package/src/internal/i18n.js +0 -73
  424. package/src/internal/i18n.js.map +0 -1
  425. package/src/internal/studio-app.js +0 -68
  426. package/src/internal/studio-app.js.map +0 -1
  427. package/src/location-CMNGO3lU.js +0 -35
  428. package/src/location-CMNGO3lU.js.map +0 -1
  429. package/src/metadata-DN9_K6Yl.js +0 -201
  430. package/src/metadata-DN9_K6Yl.js.map +0 -1
  431. package/src/models-5j67LMqW.js +0 -131
  432. package/src/models-5j67LMqW.js.map +0 -1
  433. package/src/models-VmGmG19-.js +0 -628
  434. package/src/models-VmGmG19-.js.map +0 -1
  435. package/src/runtime/api.js.map +0 -1
  436. package/src/runtime/blocks.js +0 -30
  437. package/src/runtime/blocks.js.map +0 -1
  438. package/src/runtime/collaboration.js +0 -45
  439. package/src/runtime/collaboration.js.map +0 -1
  440. package/src/runtime/delivery/DocumentField.js +0 -23
  441. package/src/runtime/delivery/DocumentField.js.map +0 -1
  442. package/src/runtime/delivery/DocumentRenderer.js +0 -61
  443. package/src/runtime/delivery/DocumentRenderer.js.map +0 -1
  444. package/src/runtime/delivery/DocumentScope.js +0 -41
  445. package/src/runtime/delivery/DocumentScope.js.map +0 -1
  446. package/src/runtime/delivery/blocks.js +0 -8
  447. package/src/runtime/delivery/blocks.js.map +0 -1
  448. package/src/runtime/delivery/context.js +0 -12
  449. package/src/runtime/delivery/context.js.map +0 -1
  450. package/src/runtime/delivery/document-page.js +0 -21
  451. package/src/runtime/delivery/document-page.js.map +0 -1
  452. package/src/runtime/delivery/document.js +0 -43
  453. package/src/runtime/delivery/document.js.map +0 -1
  454. package/src/runtime/delivery/error.js +0 -11
  455. package/src/runtime/delivery/error.js.map +0 -1
  456. package/src/runtime/delivery/plugin.js +0 -104
  457. package/src/runtime/delivery/plugin.js.map +0 -1
  458. package/src/runtime/delivery/preview.d.ts +0 -11
  459. package/src/runtime/delivery/preview.js +0 -6
  460. package/src/runtime/delivery/preview.js.map +0 -1
  461. package/src/runtime/delivery/types.d.ts +0 -2
  462. package/src/runtime/delivery/types.js +0 -1
  463. package/src/runtime/delivery/useCmsDocumentSeo.d.ts +0 -67
  464. package/src/runtime/delivery/useCmsDocumentSeo.js.map +0 -1
  465. package/src/runtime/delivery/useDocument.d.ts +0 -6
  466. package/src/runtime/delivery/useDocument.js +0 -23
  467. package/src/runtime/delivery/useDocument.js.map +0 -1
  468. package/src/runtime/delivery/useDocumentQuery.d.ts +0 -7
  469. package/src/runtime/delivery/useDocumentQuery.js +0 -29
  470. package/src/runtime/delivery/useDocumentQuery.js.map +0 -1
  471. package/src/runtime/forms/document.js +0 -38
  472. package/src/runtime/forms/document.js.map +0 -1
  473. package/src/runtime/forms/useCmsForm.js +0 -257
  474. package/src/runtime/forms/useCmsForm.js.map +0 -1
  475. package/src/runtime/i18n/translator.js +0 -58
  476. package/src/runtime/i18n/translator.js.map +0 -1
  477. package/src/runtime/i18n/useCmsI18n.d.ts +0 -13
  478. package/src/runtime/i18n/useCmsI18n.js +0 -38
  479. package/src/runtime/i18n/useCmsI18n.js.map +0 -1
  480. package/src/runtime/installation.js +0 -3
  481. package/src/runtime/plugin.js.map +0 -1
  482. package/src/runtime/preview/CmsStudioPreviewMarker.js +0 -29
  483. package/src/runtime/preview/CmsStudioPreviewMarker.js.map +0 -1
  484. package/src/runtime/preview/comark-document.js +0 -37
  485. package/src/runtime/preview/comark-document.js.map +0 -1
  486. package/src/runtime/preview/connection.js +0 -3
  487. package/src/runtime/preview/controller.js +0 -265
  488. package/src/runtime/preview/controller.js.map +0 -1
  489. package/src/runtime/preview/crypto.js +0 -16
  490. package/src/runtime/preview/crypto.js.map +0 -1
  491. package/src/runtime/preview/overlay.js +0 -122
  492. package/src/runtime/preview/overlay.js.map +0 -1
  493. package/src/runtime/preview/plugin.client.js +0 -68
  494. package/src/runtime/preview/plugin.client.js.map +0 -1
  495. package/src/runtime/preview/preview.css +0 -91
  496. package/src/runtime/preview/protocol.d.ts +0 -16
  497. package/src/runtime/preview/protocol.js +0 -23
  498. package/src/runtime/preview/protocol.js.map +0 -1
  499. package/src/runtime/preview/regions.js +0 -142
  500. package/src/runtime/preview/regions.js.map +0 -1
  501. package/src/runtime/preview/store.js +0 -4
  502. package/src/runtime/sitemap-entries.js +0 -17
  503. package/src/runtime/sitemap-entries.js.map +0 -1
  504. package/src/runtime/sitemap.js +0 -23
  505. package/src/runtime/sitemap.js.map +0 -1
  506. package/src/runtime/studio-app.js +0 -17
  507. package/src/runtime/studio-app.js.map +0 -1
  508. package/src/runtime/studio-document.js +0 -46
  509. package/src/runtime/studio-document.js.map +0 -1
  510. package/src/runtime/studio-entry.js +0 -19
  511. package/src/runtime/studio-entry.js.map +0 -1
  512. package/src/runtime/studio-navigation.js +0 -11
  513. package/src/runtime/studio-navigation.js.map +0 -1
  514. package/src/scalars-CA6kyipS.d.ts +0 -7
  515. package/src/scalars-CVZqT3L0.js +0 -22
  516. package/src/scalars-CVZqT3L0.js.map +0 -1
  517. package/src/store-X1e1o_MF.js +0 -209
  518. package/src/store-X1e1o_MF.js.map +0 -1
  519. package/src/types-DZ0IV-Ow.d.ts +0 -101
  520. package/studio/CreateDocumentDialog-C4_JBo1w.js +0 -335
  521. package/studio/SelectMenu-wXqxymUw.js +0 -34045
  522. package/studio/collaboration-DcK2F6v9.js +0 -4566
  523. package/studio/editor-P2rB7Csp.js +0 -30128
  524. package/studio/rolldown-runtime-Dy4uBu1J.js +0 -11
package/src/cli.js CHANGED
@@ -1,199 +1,693 @@
1
- import { applyContent, diffContent, exportContent, planContent } from "./cli/content.js";
2
- import { o as renderConfigurationReport } from "./installation-DxqSSVbH.js";
3
- import { a as resetCmsDevelopment, i as loadCmsProjectEnvironment, n as checkCmsConfiguration, r as doctorCmsDevelopment, t as bootstrapCmsDevelopment } from "./dev-lifecycle-3I_pozUl.js";
4
- import { diagnosticFromCause, renderDiagnostic } from "./internal/diagnostics.js";
5
- import { Config, Console, Effect, Layer, Match, Option, Redacted, Runtime, Schema } from "effect";
6
- import { NodeChildProcessSpawner, NodeCrypto, NodeFileSystem, NodePath, NodeRuntime, NodeStdio, NodeTerminal } from "@effect/platform-node-shared";
7
- import { FetchHttpClient } from "effect/unstable/http";
8
- import { Argument, CliError, Command, Flag, Prompt } from "effect/unstable/cli";
9
-
10
- //#region package.json
11
- var version = "0.2.0-beta.8";
12
-
1
+ #!/usr/bin/env -S node --
2
+ import { o as mediaStorageOptions, t as Administrator } from "./Config-CMiwciub.js";
3
+ import { t as load$1 } from "./Configuration-Dk2k3OIc.js";
4
+ import { S as PublicationPlan, w as PublicationSelection } from "./StudioApi-CXLwwocX.js";
5
+ import { a as ReadinessError, n as make$1, o as layer$2, r as errorDetails, s as make$2, t as ImportError } from "./DataTransfer-BmECvPHB.js";
6
+ import { createRequire } from "node:module";
7
+ import { Cause, Console, Context, Crypto, Effect, FileSystem, Layer, Option, Path, Result, Schema, Stdio, Stream } from "effect";
8
+ import { mkdir, readFile, rename, rm, stat } from "node:fs/promises";
9
+ import { dirname, join, resolve } from "node:path";
10
+ import { existsSync } from "node:fs";
11
+ import { fileURLToPath, pathToFileURL } from "node:url";
12
+ import * as NodeServices from "@effect/platform-node/NodeServices";
13
+ import { createHash, randomBytes } from "node:crypto";
14
+ import { BucketLocationConstraint, CreateBucketCommand, HeadBucketCommand, S3Client, S3ServiceException } from "@aws-sdk/client-s3";
15
+ import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
16
+ import { homedir } from "node:os";
17
+ import { Argument, CliConfig, CliError, Command, Flag, GlobalFlag } from "effect/cli";
18
+ import { format } from "node:util";
19
+ import { createServer } from "node:net";
20
+ import { DatabaseSync } from "node:sqlite";
21
+ import { ChildProcess } from "effect/process";
22
+ //#region ../cli/src/internal/files.ts
23
+ /** Replace a file atomically and clean up the private temporary file on failure. */
24
+ const writeAtomic = Effect.fn("Files.writeAtomic")(function* (target, contents, mode) {
25
+ const fs = yield* FileSystem.FileSystem;
26
+ const temporary = `${target}.${yield* (yield* Crypto.Crypto).randomUUIDv4}.tmp`;
27
+ yield* (Schema.is(Schema.String)(contents) ? fs.writeFileString(temporary, contents, {
28
+ flag: "wx",
29
+ mode
30
+ }) : fs.writeFile(temporary, contents, {
31
+ flag: "wx",
32
+ mode
33
+ })).pipe(Effect.flatMap(() => fs.rename(temporary, target)), Effect.onError(() => fs.remove(temporary, { force: true }).pipe(Effect.ignore)));
34
+ });
13
35
  //#endregion
14
- //#region src/cli.ts
15
- const rootDirectory = Flag.String("root").pipe(Flag.withDefault("."));
16
- const envFile = Flag.String("env-file").pipe(Flag.withDefault(""));
17
- const verbose = Flag.Boolean("verbose").pipe(Flag.withDefault(false));
18
- const json = Flag.Boolean("json").pipe(Flag.withDefault(false));
19
- const root = Command.make("cms").pipe(Command.withSharedFlags({
20
- url: Flag.String("url").pipe(Flag.withDefault("")),
21
- email: Flag.String("email").pipe(Flag.withDefault("")),
22
- rootDirectory,
23
- envFile,
24
- verbose,
25
- json
36
+ //#region ../cli/src/Sessions.ts
37
+ const StoredSessions = Schema.fromJsonString(Schema.Record(Schema.String, Schema.String));
38
+ var SessionError = class extends Schema.TaggedError()("Sessions.SessionError", {
39
+ message: Schema.String,
40
+ cause: Schema.optionalKey(Schema.Defect())
41
+ }) {};
42
+ function make(directory) {
43
+ const sessionFile = Effect.gen(function* () {
44
+ return (yield* Path.Path).join(directory, "sessions.json");
45
+ });
46
+ const storedSessions = Effect.fn("Sessions.storedSessions")(function* () {
47
+ const fs = yield* FileSystem.FileSystem;
48
+ const file = yield* sessionFile;
49
+ if (!(yield* fs.exists(file))) return {};
50
+ return yield* Schema.decodeEffect(StoredSessions)(yield* fs.readFileString(file));
51
+ }, Effect.mapError((cause) => new SessionError({
52
+ message: "Could not read the CMS session.",
53
+ cause
54
+ })));
55
+ const writeSessions = Effect.fn("Sessions.writeSessions")(function* (sessions) {
56
+ const fs = yield* FileSystem.FileSystem;
57
+ const file = yield* sessionFile;
58
+ yield* fs.makeDirectory(directory, {
59
+ recursive: true,
60
+ mode: 448
61
+ });
62
+ yield* writeAtomic(file, `${JSON.stringify(sessions)}\n`, 384);
63
+ });
64
+ return {
65
+ read: Effect.fn("Sessions.read")(function* (site) {
66
+ const cookie = (yield* storedSessions())[site.origin];
67
+ if (!cookie) return yield* new SessionError({ message: `No CMS session for ${site.origin}. Run cms login.` });
68
+ return cookie;
69
+ }),
70
+ save: Effect.fn("Sessions.save")(function* (site, cookie) {
71
+ const sessions = yield* storedSessions();
72
+ yield* writeSessions({
73
+ ...sessions,
74
+ [site.origin]: cookie
75
+ }).pipe(Effect.mapError((cause) => new SessionError({
76
+ message: "Could not save the CMS session.",
77
+ cause
78
+ })));
79
+ }),
80
+ remove: Effect.fn("Sessions.remove")(function* (site) {
81
+ const sessions = { ...yield* storedSessions() };
82
+ delete sessions[site.origin];
83
+ yield* writeSessions(sessions).pipe(Effect.mapError((cause) => new SessionError({
84
+ message: "Could not remove the CMS session.",
85
+ cause
86
+ })));
87
+ })
88
+ };
89
+ }
90
+ var SessionStore = class extends Context.Service()("cli/SessionStore") {};
91
+ const layer$1 = (directory) => Layer.effect(SessionStore, Effect.gen(function* () {
92
+ const context = yield* Effect.context();
93
+ const store = make(directory);
94
+ return {
95
+ read: (site) => store.read(site).pipe(Effect.provide(context)),
96
+ save: (site, cookie) => store.save(site, cookie).pipe(Effect.provide(context)),
97
+ remove: (site) => store.remove(site).pipe(Effect.provide(context))
98
+ };
26
99
  }));
27
- const directory = Argument.String("directory");
28
- const overwrite = Flag.Boolean("overwrite").pipe(Flag.withDefault(false));
29
- const publish = Flag.Boolean("publish").pipe(Flag.withDefault(false));
30
- const exportCommand = Command.make("export", { directory }, ({ directory }) => Effect.gen(function* () {
31
- const { url, email } = yield* root;
32
- return yield* exportContent({
33
- url,
34
- email
35
- }, directory);
36
- })).pipe(Command.withDescription("Export authored Markdown from a CMS installation"));
37
- const diffCommand = Command.make("diff", { directory }, ({ directory }) => Effect.gen(function* () {
38
- const { url, email } = yield* root;
39
- return yield* diffContent({
40
- url,
41
- email
42
- }, directory);
43
- })).pipe(Command.withDescription("Compare local Markdown with the current CMS content"));
44
- const planCommand = Command.make("plan", {
45
- directory,
46
- overwrite,
47
- publish
48
- }, ({ directory, overwrite, publish }) => Effect.gen(function* () {
49
- const { url, email } = yield* root;
50
- return yield* planContent({
51
- url,
52
- email
53
- }, directory, {
54
- overwrite,
55
- publish
56
- });
57
- })).pipe(Command.withDescription("Preview content changes without writing to the CMS"));
58
- const applyCommand = Command.make("apply", {
59
- directory,
60
- overwrite,
61
- publish
62
- }, ({ directory, overwrite, publish }) => Effect.gen(function* () {
63
- const { url, email } = yield* root;
64
- return yield* applyContent({
65
- url,
66
- email
67
- }, directory, {
68
- overwrite,
69
- publish
70
- });
71
- })).pipe(Command.withDescription("Apply a validated content plan to the CMS"));
72
- const content = Command.make("content").pipe(Command.withSubcommands([
73
- exportCommand,
74
- diffCommand,
75
- planCommand,
76
- applyCommand
77
- ]));
78
- const configurationCheckCommand = Command.make("check", {}, () => Effect.gen(function* () {
79
- const options = yield* root;
80
- const report = yield* attempt("configuration.check", options, () => checkCmsConfiguration(options.rootDirectory, options.envFile || void 0, options.verbose));
81
- if (options.json) yield* Console.log(JSON.stringify(report));
82
- else yield* Console.log(renderConfigurationReport(report));
83
- if (!report.compatible) return yield* options.json ? new JsonCommandFailed({}) : cliError("The candidate CMS configuration is incompatible with stored content.");
84
- })).pipe(Command.withDescription("Compare the candidate configuration with the accepted catalog and stored content"));
85
- const configuration = Command.make("configuration").pipe(Command.withSubcommands([configurationCheckCommand]));
86
- const full = Flag.Boolean("full").pipe(Flag.withDefault(false));
87
- const contentDirectory = Flag.String("content").pipe(Flag.withDefault(""));
88
- const administratorName = Flag.String("name").pipe(Flag.withDefault(""));
89
- const database = Flag.Boolean("database").pipe(Flag.withDefault(false));
90
- const media = Flag.Boolean("media").pipe(Flag.withDefault(false));
91
- const bootstrap = Flag.Boolean("bootstrap").pipe(Flag.withDefault(false));
92
- const yes = Flag.Boolean("yes").pipe(Flag.withDefault(false));
93
- const doctorCommand = Command.make("doctor", { full }, ({ full }) => Effect.gen(function* () {
94
- const options = yield* root;
95
- const report = yield* attempt("doctor.configuration", options, () => doctorCmsDevelopment(options.rootDirectory, full, options.envFile || void 0));
96
- if (options.json) yield* Console.log(JSON.stringify(report));
97
- else for (const check of report.checks) {
98
- const icon = Match.value(check.status).pipe(Match.when("pass", () => "✓"), Match.when("fail", () => "✗"), Match.when("not-verified", () => "−"), Match.exhaustive);
99
- yield* Console.log(`${icon} ${check.label}${check.detail ? `\n\n ${check.detail}` : ""}`);
100
+ //#endregion
101
+ //#region ../cli/src/internal/commandOutput.ts
102
+ const write = (value) => console.log(JSON.stringify(value));
103
+ /** Keep framework help out of failed commands' stdout and render each failure once. */
104
+ const run$4 = Effect.fn("Cli.output")((operation) => Effect.gen(function* () {
105
+ const output = [];
106
+ const current = yield* Console.Console;
107
+ const buffered = Object.assign(Object.create(current), { log: (...values) => {
108
+ output.push(format(...values));
109
+ } });
110
+ const result = yield* operation.pipe(Effect.provideService(Console.Console, buffered));
111
+ yield* Effect.sync(() => {
112
+ for (const line of output) current.log(line);
113
+ });
114
+ return result;
115
+ }).pipe(Effect.onError((cause) => Effect.sync(() => {
116
+ if (Cause.hasInterruptsOnly(cause)) return;
117
+ const error = Cause.squash(cause);
118
+ if (error instanceof ImportError) {
119
+ console.error(JSON.stringify({ error: {
120
+ code: error._tag,
121
+ message: error.message,
122
+ phase: error.phase,
123
+ outcome: error.outcome,
124
+ uploadedMedia: error.uploadedMedia,
125
+ uncertainMediaId: error.uncertainMediaId,
126
+ cause: error.error
127
+ } }));
128
+ return;
100
129
  }
101
- if (!report.ok) return yield* options.json ? new JsonCommandFailed({}) : cliError("One or more CMS development checks failed.");
102
- })).pipe(Command.withDescription("Check local CMS configuration and infrastructure"));
103
- const bootstrapCommand = Command.make("bootstrap", {
104
- contentDirectory,
105
- administratorName,
106
- publish
107
- }, ({ contentDirectory, administratorName, publish }) => Effect.gen(function* () {
108
- const options = yield* root;
109
- yield* attempt("bootstrap.environment", options, () => loadCmsProjectEnvironment(options.rootDirectory, options.envFile || void 0));
110
- const administrator = yield* administratorOptions(administratorName, contentDirectory, publish, options, "bootstrap.credentials");
111
- const result = yield* attempt("bootstrap.installation", options, () => bootstrapCmsDevelopment({
112
- rootDir: options.rootDirectory,
113
- envFile: options.envFile || void 0,
114
- verbose: options.verbose,
115
- ...administrator
116
- }));
117
- if (options.json) yield* Console.log(JSON.stringify(result));
118
- else yield* Console.log(`Bootstrap complete: administrator ${result.administrator}${result.contentApplied ? ", content applied" : ""}.`);
119
- })).pipe(Command.withDescription("Provision and initialize a local CMS installation"));
120
- const resetCommand = Command.make("reset", {
121
- bootstrap,
122
- contentDirectory,
123
- database,
124
- media,
125
- publish,
126
- yes
127
- }, ({ bootstrap, contentDirectory, database, media, publish, yes }) => Effect.gen(function* () {
128
- const options = yield* root;
129
- if (!database && !media) return yield* commandFailure("reset.arguments", options, /* @__PURE__ */ new Error("Choose --database, --media, or both."));
130
- if (bootstrap && yes) yield* attempt("reset.environment", options, () => loadCmsProjectEnvironment(options.rootDirectory, options.envFile || void 0));
131
- const administrator = bootstrap && yes ? yield* administratorOptions("", contentDirectory, publish, options, "reset.credentials") : void 0;
132
- const result = yield* attempt("reset.installation", options, () => resetCmsDevelopment({
133
- rootDir: options.rootDirectory,
134
- envFile: options.envFile || void 0,
130
+ if (error instanceof CliError.ShowHelp) {
131
+ const details = error.errors.map((item) => ({
132
+ code: `Cli.${item._tag}`,
133
+ message: item.message
134
+ }));
135
+ console.error(JSON.stringify({ error: {
136
+ code: "Cli.InvalidArguments",
137
+ message: details.map((item) => item.message).join(" ") || "Choose a command. Run cms --help.",
138
+ details
139
+ } }));
140
+ return;
141
+ }
142
+ console.error(JSON.stringify({ error: CliError.isCliError(error) ? {
143
+ code: `Cli.${error._tag}`,
144
+ message: error.message
145
+ } : errorDetails(error) }));
146
+ }))));
147
+ //#endregion
148
+ //#region ../cli/src/Lifecycle.ts
149
+ var LifecycleError = class extends Schema.TaggedError()("Lifecycle.Error", { message: Schema.String }) {};
150
+ /** The framework owns its launcher; the CLI owns the server's scope and installation workflow. */
151
+ var DevelopmentServer = class extends Context.Service()("cli/DevelopmentServer") {};
152
+ //#endregion
153
+ //#region ../cli/src/internal/project.ts
154
+ const attempt = (message, operation) => Effect.tryPromise({
155
+ try: operation,
156
+ catch: (error) => error instanceof LifecycleError ? error : new LifecycleError({ message })
157
+ });
158
+ const Phase = Schema.Literals([
159
+ "initialize",
160
+ "import",
161
+ "accounts",
162
+ "seo",
163
+ "ready"
164
+ ]);
165
+ const exists = async (file) => {
166
+ try {
167
+ await stat(file);
168
+ return true;
169
+ } catch (error) {
170
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") return false;
171
+ throw error;
172
+ }
173
+ };
174
+ const load = Effect.fn("Project.load")(function* (directory, envName = "development", envFile, progressScope = "origin") {
175
+ const configured = yield* load$1(directory, envName, envFile);
176
+ const data = join(configured.project, ".data");
177
+ const database = resolve(configured.project, configured.configuration.runtime.databaseFile);
178
+ const target = progressScope === "database" ? database : `${configured.site.origin}\0${database}`;
179
+ const identity = createHash("sha256").update(target).digest("hex").slice(0, 16);
180
+ return {
181
+ ...configured,
182
+ data,
135
183
  database,
136
- media,
137
- yes,
138
- verbose: options.verbose,
139
- bootstrap: administrator
184
+ phaseFile: join(data, `cms-bootstrap-${identity}.json`)
185
+ };
186
+ });
187
+ /** Only an explicit preparation command generates a secret; config loading and server startup never do. */
188
+ const prepare$1 = Effect.fn("Project.prepare")(function* (project) {
189
+ if (project.configuration.runtime.installationSecret) return project;
190
+ if (process.env.NUXT_CMS_INSTALLATION_SECRET !== void 0) return yield* new LifecycleError({ message: "NUXT_CMS_INSTALLATION_SECRET is explicitly empty. Unset it to generate a persistent secret, or provide a real secret." });
191
+ const secret = randomBytes(32).toString("hex");
192
+ const contents = yield* attempt(`Could not read ${project.environmentFile}.`, async () => {
193
+ return (await exists(project.environmentFile) ? await readFile(project.environmentFile, "utf8") : "").replace(/^(?:export\s+)?NUXT_CMS_INSTALLATION_SECRET\s*=.*$/gmu, "");
194
+ });
195
+ yield* writeAtomic(project.environmentFile, `${contents}\nNUXT_CMS_INSTALLATION_SECRET=${secret}\n`, 384).pipe(Effect.mapError(() => new LifecycleError({ message: `Could not save the installation secret to ${project.environmentFile}.` })));
196
+ return {
197
+ ...project,
198
+ environment: {
199
+ ...project.environment,
200
+ NUXT_CMS_INSTALLATION_SECRET: secret
201
+ },
202
+ configuration: {
203
+ ...project.configuration,
204
+ runtime: {
205
+ ...project.configuration.runtime,
206
+ installationSecret: secret
207
+ }
208
+ }
209
+ };
210
+ });
211
+ const checkLocal = (project) => {
212
+ const { site } = project;
213
+ if (site.protocol !== "http:" || site.hostname !== "127.0.0.1" || !site.port) return Effect.fail(new LifecycleError({ message: "Running Nuxt locally requires an HTTP origin on 127.0.0.1 with an explicit port. Set runtime.origin or NUXT_CMS_ORIGIN." }));
214
+ if (dirname(project.database) !== project.data) return Effect.fail(new LifecycleError({ message: "Local development and reset require a database file inside the project .data directory." }));
215
+ return Effect.void;
216
+ };
217
+ const lock = Effect.fn("Project.lock")(function* (directory) {
218
+ const data = resolve(directory, ".data");
219
+ const file = join(data, "cms.lock");
220
+ return yield* Effect.acquireRelease(attempt(`Could not acquire local development ownership in ${data}. Check directory access and the lock database.`, async () => {
221
+ await mkdir(data, { recursive: true });
222
+ const owner = new DatabaseSync(file, { timeout: 0 });
223
+ try {
224
+ owner.exec("BEGIN EXCLUSIVE");
225
+ return owner;
226
+ } catch (error) {
227
+ owner.close();
228
+ if (error instanceof Error && "errcode" in error && error.errcode === 5) throw new LifecycleError({ message: `Another CMS lifecycle command owns ${resolve(directory)}. Stop it before preparing, setting up, starting, or resetting.` });
229
+ throw error;
230
+ }
231
+ }), (owned) => Effect.sync(() => owned.close()));
232
+ });
233
+ const checkPort = (site) => attempt(`${site.origin} is already in use. Stop the running server or change runtime.origin or NUXT_CMS_ORIGIN.`, () => new Promise((fulfill, reject) => {
234
+ const probe = createServer();
235
+ probe.once("error", reject);
236
+ probe.listen(Number(site.port), site.hostname, () => probe.close((error) => error ? reject(error) : fulfill()));
237
+ }));
238
+ const readPhase = (project) => attempt("Could not read local initialization progress. Inspect .data/cms-bootstrap-*.json.", async () => await exists(project.phaseFile) ? Schema.decodeSync(Schema.fromJsonString(Phase))(await readFile(project.phaseFile, "utf8")) : void 0);
239
+ const writePhase = (project, phase) => writeAtomic(project.phaseFile, JSON.stringify(phase), 384).pipe(Effect.mapError(() => new LifecycleError({ message: "Could not save initialization progress." })));
240
+ const reset = (project) => attempt("Could not retain the previous local database before reset.", async () => {
241
+ const backup = join(project.data, `before-reset-${Date.now()}`);
242
+ await mkdir(backup);
243
+ for (const suffix of [
244
+ "",
245
+ "-wal",
246
+ "-shm"
247
+ ]) if (await exists(`${project.database}${suffix}`)) await rename(`${project.database}${suffix}`, join(backup, `cms.sqlite${suffix}`));
248
+ await rm(project.phaseFile, { force: true });
249
+ return backup;
250
+ });
251
+ //#endregion
252
+ //#region ../cli/src/internal/provision.ts
253
+ const run$3 = Effect.fn("Provision.run")(function* (project) {
254
+ const provision = project.configuration.provision;
255
+ const runtime = project.configuration.runtime.s3;
256
+ if (provision?.compose) {
257
+ console.log("Starting configured infrastructure…");
258
+ if ((yield* (yield* ChildProcess.make("docker", [
259
+ "compose",
260
+ "-f",
261
+ resolve(project.project, provision.compose.file),
262
+ "up",
263
+ "-d",
264
+ "--wait",
265
+ provision.compose.service
266
+ ], {
267
+ cwd: project.project,
268
+ env: project.environment,
269
+ extendEnv: true,
270
+ stdin: "ignore",
271
+ stdout: "inherit",
272
+ stderr: "inherit"
273
+ }).pipe(Effect.mapError(() => new LifecycleError({ message: "Could not start configured infrastructure. Start Docker and check the Compose file." })))).exitCode) !== 0) return yield* new LifecycleError({ message: "Infrastructure failed to start. Check Docker Compose output and rerun." });
274
+ }
275
+ if (!provision?.createBucket) return;
276
+ const client = yield* Effect.acquireRelease(Effect.try({
277
+ try: () => new S3Client(mediaStorageOptions(runtime)),
278
+ catch: () => new LifecycleError({ message: "Bucket creation requires an S3 bucket, region, and a complete credential pair or cloud identity." })
279
+ }), (owned) => Effect.sync(() => owned.destroy()));
280
+ yield* attempt("Could not prepare the media bucket. Check runtime.s3 and its NUXT_CMS_S3_* overrides.", async (signal) => {
281
+ const Bucket = runtime.bucket;
282
+ try {
283
+ await client.send(new HeadBucketCommand({ Bucket }), { abortSignal: signal });
284
+ } catch (error) {
285
+ if (!(error instanceof S3ServiceException && error.$metadata.httpStatusCode === 404)) throw error;
286
+ const location = Object.values(BucketLocationConstraint).find((region) => region === runtime.region);
287
+ if (runtime.region !== "us-east-1" && !location) throw new LifecycleError({ message: "Bucket creation requires a region supported by the S3 client." });
288
+ await client.send(new CreateBucketCommand({
289
+ Bucket,
290
+ ...runtime.region === "us-east-1" ? void 0 : { CreateBucketConfiguration: { LocationConstraint: location } }
291
+ }), { abortSignal: signal });
292
+ }
293
+ }).pipe(Effect.timeoutOrElse({
294
+ duration: "15 seconds",
295
+ orElse: () => Effect.fail(new LifecycleError({ message: "Media bucket preparation timed out. Check the S3 endpoint." }))
140
296
  }));
141
- if (options.json) return yield* Console.log(JSON.stringify(result));
142
- for (const target of result.targets) yield* Console.log(`${result.executed ? "✓ Reset" : "Would reset"} ${target}`);
143
- if (!result.executed) yield* Console.log("Dry run only. Add --yes to execute these exact targets.");
144
- })).pipe(Command.withDescription("Reset CMS-owned local data with a dry-run default"));
145
- const dev = Command.make("dev").pipe(Command.withSubcommands([
146
- doctorCommand,
147
- bootstrapCommand,
148
- resetCommand
149
- ]));
150
- const administratorOptions = Effect.fn("CmsCli.dev.administratorOptions")(function* (name, content, publishContent, options, phase) {
151
- const email = yield* Config.String("CMS_EMAIL").pipe(Config.withDefault(""));
152
- const configuredPassword = yield* Config.Redacted("CMS_PASSWORD").pipe(Config.option);
153
- if (!email) return yield* commandFailure(phase, options, /* @__PURE__ */ new Error("CMS_EMAIL is required."));
154
- if (Option.isNone(configuredPassword) && options.json) return yield* commandFailure(phase, options, /* @__PURE__ */ new Error("CMS_PASSWORD is required."));
155
- const password = Option.isSome(configuredPassword) ? Redacted.value(configuredPassword.value) : Redacted.value(yield* Prompt.Password({ message: `Password for ${email}` }));
156
- if (!password) return yield* commandFailure(phase, options, /* @__PURE__ */ new Error("CMS_PASSWORD is required."));
297
+ });
298
+ //#endregion
299
+ //#region ../cli/src/internal/bootstrap.ts
300
+ const ready = Effect.fn("Bootstrap.ready")(function* (connection) {
301
+ while (true) {
302
+ const result = yield* connection.readiness().pipe(Effect.result);
303
+ if (Result.isSuccess(result)) {
304
+ if (result.success.status === "ready") return;
305
+ const failures = Object.values(result.success.checks).filter((check) => check.status === "failed");
306
+ if (result.success.checks.installation.action !== "retry" && failures.some((check) => check.action !== "retry")) return yield* new LifecycleError({ message: failures.map((check) => check.message).join(" ") });
307
+ }
308
+ yield* Effect.sleep("500 millis");
309
+ }
310
+ }, (operation) => operation.pipe(Effect.timeoutOrElse({
311
+ duration: "60 seconds",
312
+ orElse: () => Effect.fail(new LifecycleError({ message: "CMS startup timed out. Inspect the server output and run cms doctor." }))
313
+ })));
314
+ const run$2 = Effect.fn("Bootstrap.run")(function* (project, connection) {
315
+ const bootstrap = project.configuration.bootstrap;
316
+ if (!bootstrap) return;
317
+ let phase = yield* readPhase(project);
318
+ const { initialized } = yield* connection.api.session.installation();
319
+ if (!initialized) {
320
+ phase = "initialize";
321
+ yield* writePhase(project, phase);
322
+ } else if (!phase || phase === "ready") return;
323
+ const administrator = yield* Schema.decodeEffect(Administrator)(bootstrap.administrator).pipe(Effect.mapError(() => new LifecycleError({ message: "Bootstrap requires a valid administrator email, password of at least eight characters, and name. Configure bootstrap.administrator or its NUXT_CMS_BOOTSTRAP_ADMINISTRATOR_* overrides." })));
324
+ if (phase === "initialize") {
325
+ if (initialized) yield* connection.signIn(administrator.email, administrator.password);
326
+ else yield* connection.initialize({
327
+ ...administrator,
328
+ installationSecret: project.configuration.runtime.installationSecret
329
+ });
330
+ phase = "import";
331
+ yield* writePhase(project, phase);
332
+ } else yield* connection.signIn(administrator.email, administrator.password);
333
+ if (phase === "import") {
334
+ const snapshot = bootstrap.snapshot;
335
+ if (snapshot) {
336
+ console.log("Importing the configured snapshot…");
337
+ yield* make$1(connection).import(resolve(project.project, snapshot));
338
+ }
339
+ phase = "accounts";
340
+ yield* writePhase(project, phase);
341
+ }
342
+ if (phase === "accounts") {
343
+ for (const account of bootstrap.accounts) {
344
+ const { people } = yield* connection.api.people.list({ query: { search: account.email } });
345
+ const person = people.find((person) => person.email === account.email);
346
+ if (!person) return yield* new LifecycleError({ message: `The configured bootstrap account ${account.email} is missing from the snapshot.` });
347
+ const invitation = yield* connection.api.people.invite({ params: { id: person.id } });
348
+ yield* connection.resetPassword(invitation.token, account.password);
349
+ }
350
+ phase = "seo";
351
+ yield* writePhase(project, phase);
352
+ }
353
+ if (phase === "seo") {
354
+ const seo = yield* connection.api.seo.state();
355
+ const updated = seo.working.settings.canonicalOrigin !== project.site.origin ? yield* connection.api.seo.save({ payload: {
356
+ expectedVersion: seo.working.version,
357
+ settings: {
358
+ ...seo.working.settings,
359
+ canonicalOrigin: project.site.origin
360
+ }
361
+ } }) : seo;
362
+ if (updated.published.settings.canonicalOrigin !== project.site.origin) yield* connection.api.seo.publish({ payload: {
363
+ expectedVersion: updated.working.version,
364
+ confirmedSiteWideChange: true
365
+ } });
366
+ yield* (yield* SessionStore).save(project.site, connection.session);
367
+ yield* writePhase(project, "ready");
368
+ }
369
+ });
370
+ //#endregion
371
+ //#region ../cli/src/internal/development.ts
372
+ const run$1 = Effect.fn("Development.run")(function* (mode, directory, envName = "development", envFile) {
373
+ yield* lock(directory);
374
+ const loaded = yield* load(directory, envName, envFile, "database");
375
+ yield* checkLocal(loaded);
376
+ yield* checkPort(loaded.site);
377
+ const project = yield* prepare$1(loaded);
378
+ if (mode === "reset" && !project.configuration.bootstrap?.snapshot) return yield* new LifecycleError({ message: "cms reset requires bootstrap.snapshot in cms.config.ts." });
379
+ const snapshot = project.configuration.bootstrap?.snapshot;
380
+ if (snapshot) yield* attempt(`Could not access the demo snapshot ${snapshot}.`, async () => {
381
+ if (!await exists(resolve(project.project, snapshot))) throw new Error("Missing snapshot");
382
+ });
383
+ yield* run$3(project);
384
+ if (mode === "reset") console.log(`Previous database retained in ${yield* reset(project)}`);
385
+ const server = yield* (yield* DevelopmentServer).start({
386
+ project: project.project,
387
+ site: project.site,
388
+ environment: project.environment,
389
+ envName: project.envName,
390
+ environmentFile: project.environmentFile,
391
+ watch: mode === "dev"
392
+ });
393
+ const connection = yield* make$2(project.site);
394
+ yield* Effect.raceFirst(Effect.gen(function* () {
395
+ yield* ready(connection);
396
+ yield* run$2(project, connection);
397
+ yield* ready(connection);
398
+ }), server.exited);
399
+ console.log(`CMS ready\nWebsite: ${project.site.origin}\nStudio: ${project.site.origin}/_cms/app`);
400
+ if (mode === "reset") console.log("Demo restored. Run cms dev.");
401
+ else return yield* server.exited;
402
+ }, Effect.scoped);
403
+ //#endregion
404
+ //#region ../cli/src/Command.ts
405
+ var UsageError = class extends Schema.TaggedError()("Cli.UsageError", { message: Schema.String }) {};
406
+ const root = Command.make("cms").pipe(Command.withDescription("Develop and operate a CMS installation. Commands never prompt."), Command.withSharedFlags({
407
+ project: Flag.String("project").pipe(Flag.withDefault(".")),
408
+ envFile: Flag.String("env-file").pipe(Flag.optional),
409
+ envName: Flag.String("envName").pipe(Flag.withDefault("development"))
410
+ }));
411
+ const context = Effect.gen(function* () {
412
+ const { project, envName, envFile } = yield* root;
413
+ return yield* load$1(project, envName, Option.getOrUndefined(envFile));
414
+ });
415
+ const authenticated = Effect.gen(function* () {
416
+ const current = yield* context;
417
+ const session = yield* (yield* SessionStore).read(current.site);
418
+ const connection = yield* make$2(current.site, session);
157
419
  return {
158
- content: content || void 0,
420
+ ...current,
421
+ connection
422
+ };
423
+ });
424
+ const credentials = {
425
+ username: Flag.String("username").pipe(Flag.optional),
426
+ passwordStdin: Flag.Boolean("password-stdin").pipe(Flag.withDefault(false))
427
+ };
428
+ const readCredentials = Effect.fn("Cli.credentials")(function* (username, passwordStdin) {
429
+ const current = yield* context;
430
+ let password;
431
+ if (passwordStdin) {
432
+ const stdio = yield* Stdio.Stdio;
433
+ if (yield* stdio.stdinIsTerminal) return yield* new UsageError({ message: "Pipe a password into --password-stdin." });
434
+ password = (yield* stdio.stdin.pipe(Stream.decodeText, Stream.mkString)).replace(/\r?\n$/u, "");
435
+ }
436
+ const email = Option.getOrUndefined(username);
437
+ if (!email || !password) return yield* new UsageError({ message: "Supply --username and pipe a password into --password-stdin." });
438
+ return {
439
+ ...current,
159
440
  email,
160
- name: name || (yield* Config.String("CMS_NAME").pipe(Config.withDefault("Administrator"))),
161
- password,
162
- publish: publishContent
441
+ password
163
442
  };
164
443
  });
165
- function cliError(message) {
166
- return new CliError.UserError({
167
- cause: new Error(message),
168
- userMessage: message
444
+ const snapshot = Argument.String("snapshot.zip");
445
+ const force = Flag.Boolean("force").pipe(Flag.withDefault(false));
446
+ const login = Command.make("login", credentials).pipe(Command.withHandler(Effect.fn("Cli.login")(function* ({ username, passwordStdin }) {
447
+ const { site, email, password } = yield* readCredentials(username, passwordStdin);
448
+ const connection = yield* make$2(site);
449
+ const actor = yield* connection.signIn(email, password);
450
+ yield* (yield* SessionStore).save(site, connection.session);
451
+ write({
452
+ site: site.origin,
453
+ actor
169
454
  });
170
- }
171
- var CliOperationFailed = class extends Schema.TaggedError()("CliOperationFailed", { cause: Schema.Defect() }) {};
172
- var JsonCommandFailed = class extends Schema.TaggedError()("JsonCommandFailed", {}) {
173
- [Runtime.errorExitCode] = 1;
174
- [Runtime.errorReported] = false;
175
- };
176
- function attempt(phase, options, operation) {
177
- return Effect.tryPromise({
178
- try: () => Promise.resolve(operation()),
179
- catch: (cause) => new CliOperationFailed({ cause })
180
- }).pipe(Effect.catch((failure) => commandFailure(phase, options, failure.cause)));
181
- }
182
- function commandFailure(phase, options, cause) {
183
- return Effect.gen(function* () {
184
- const diagnostic = diagnosticFromCause(phase, cause);
185
- if (!options.json) return yield* cliError(renderDiagnostic(diagnostic, options.verbose));
186
- const { details: _details, ...output } = diagnostic;
187
- yield* Console.log(JSON.stringify(output));
188
- return yield* new JsonCommandFailed({});
455
+ })));
456
+ const prepare = Command.make("prepare").pipe(Command.withDescription("Prepare the configured infrastructure and persist a missing installation secret."), Command.withHandler(() => Effect.gen(function* () {
457
+ const { project, envName, envFile } = yield* root;
458
+ yield* lock(project);
459
+ const configured = yield* prepare$1(yield* load(project, envName, Option.getOrUndefined(envFile)));
460
+ yield* run$3(configured);
461
+ write({
462
+ site: configured.site.origin,
463
+ prepared: true
189
464
  });
190
- }
191
- root.pipe(Command.withSubcommands([
192
- configuration,
193
- content,
194
- dev
195
- ]), Command.run({ version }), Effect.provide(Layer.mergeAll(NodeFileSystem.layer, NodePath.layer, NodeCrypto.layer, NodeTerminal.layer, NodeStdio.layer, NodeChildProcessSpawner.layer.pipe(Layer.provide(Layer.merge(NodeFileSystem.layer, NodePath.layer))), FetchHttpClient.layer)), NodeRuntime.runMain);
196
-
465
+ })));
466
+ const setup = Command.make("setup").pipe(Command.withDescription("Bootstrap a running installation from cms.config.ts, then save the administrator session. Existing authored installations are preserved."), Command.withHandler(() => Effect.gen(function* () {
467
+ const { project, envName, envFile } = yield* root;
468
+ yield* lock(project);
469
+ const configured = yield* load(project, envName, Option.getOrUndefined(envFile));
470
+ if (!configured.configuration.bootstrap) return yield* new UsageError({ message: "Setup requires bootstrap.administrator in cms.config.ts." });
471
+ const connection = yield* make$2(configured.site);
472
+ yield* ready(connection);
473
+ yield* run$2(configured, connection);
474
+ write({
475
+ site: configured.site.origin,
476
+ initialized: true
477
+ });
478
+ })));
479
+ const whoami = Command.make("whoami").pipe(Command.withHandler(() => Effect.gen(function* () {
480
+ const { site, connection } = yield* authenticated;
481
+ write({
482
+ site: site.origin,
483
+ actor: yield* connection.api.connection.user()
484
+ });
485
+ })));
486
+ const doctor = Command.make("doctor").pipe(Command.withDescription("Read-only installation diagnostics; no login required. Prints one JSON object with site, status, and checks (connection, configuration, database, media, installation). Each check has status, code, message, and action. Exit 0 means ready; exit 1 means unavailable. Requests time out after five seconds."), Command.withHandler(() => Effect.gen(function* () {
487
+ let site = null;
488
+ const result = yield* Effect.gen(function* () {
489
+ const current = yield* context;
490
+ site = current.site.origin;
491
+ const report = yield* (yield* make$2(current.site)).readiness();
492
+ return {
493
+ status: report.status,
494
+ checks: {
495
+ connection: {
496
+ status: "passed",
497
+ code: "connection_ready",
498
+ action: "none",
499
+ message: "The CMS readiness endpoint returned a valid report."
500
+ },
501
+ ...report.checks
502
+ }
503
+ };
504
+ }).pipe(Effect.catch((error) => {
505
+ const connection = error instanceof ReadinessError ? {
506
+ status: "failed",
507
+ code: error.code,
508
+ message: error.message,
509
+ action: error.action
510
+ } : {
511
+ status: "failed",
512
+ code: "client_configuration_invalid",
513
+ action: "check_configuration",
514
+ message: "Check --project, --env-file, and runtime.origin or NUXT_CMS_ORIGIN. Use HTTPS, or HTTP on localhost, without credentials in the URL."
515
+ };
516
+ const skipped = {
517
+ status: "skipped",
518
+ code: "report_unavailable",
519
+ action: connection.action,
520
+ message: "The CMS readiness report could not be obtained."
521
+ };
522
+ return Effect.succeed({
523
+ status: "unavailable",
524
+ checks: {
525
+ connection,
526
+ configuration: skipped,
527
+ database: skipped,
528
+ media: skipped,
529
+ installation: skipped
530
+ }
531
+ });
532
+ }));
533
+ write({
534
+ site,
535
+ ...result
536
+ });
537
+ if (result.status === "unavailable") process.exitCode = 1;
538
+ })));
539
+ const logout = Command.make("logout").pipe(Command.withHandler(() => Effect.gen(function* () {
540
+ const { site } = yield* context;
541
+ const sessions = yield* SessionStore;
542
+ yield* (yield* make$2(site, yield* sessions.read(site))).signOut();
543
+ yield* sessions.remove(site);
544
+ write({
545
+ site: site.origin,
546
+ signedOut: true
547
+ });
548
+ })));
549
+ const exportCommand = Command.make("export", {
550
+ snapshot,
551
+ force
552
+ }).pipe(Command.withDescription("Export full CMS history and media into one ZIP snapshot. --force replaces an existing file."), Command.withHandler(Effect.fn("Cli.export")(function* ({ snapshot, force }) {
553
+ const { site, connection } = yield* authenticated;
554
+ write({
555
+ site: site.origin,
556
+ ...yield* make$1(connection).export(snapshot, force)
557
+ });
558
+ })));
559
+ const importCommand = Command.make("import", {
560
+ snapshot,
561
+ dryRun: Flag.Boolean("dry-run").pipe(Flag.withDefault(false)),
562
+ replace: Flag.Boolean("replace").pipe(Flag.withDefault(false))
563
+ }).pipe(Command.withDescription("Import a CMS ZIP snapshot with full history and website selection, keeping local passwords. --dry-run previews it; --replace replaces authored data."), Command.withHandler(Effect.fn("Cli.import")(function* ({ snapshot, dryRun, replace }) {
564
+ const { site, connection } = yield* authenticated;
565
+ write({
566
+ site: site.origin,
567
+ ...yield* make$1(connection).import(snapshot, {
568
+ dryRun,
569
+ replace
570
+ })
571
+ });
572
+ })));
573
+ const documents = Command.make("documents").pipe(Command.withSubcommands([Command.make("list").pipe(Command.withHandler(() => Effect.gen(function* () {
574
+ const { connection } = yield* authenticated;
575
+ write(yield* connection.api.documents.catalog());
576
+ })))]));
577
+ const publication = Command.make("publication").pipe(Command.withSubcommands([Command.make("plan", { file: Argument.String("selection-file") }).pipe(Command.withHandler(Effect.fn("Cli.publicationPlan")(function* ({ file }) {
578
+ const { connection } = yield* authenticated;
579
+ const fs = yield* FileSystem.FileSystem;
580
+ const payload = yield* Schema.decodeEffect(Schema.fromJsonString(PublicationSelection))(yield* fs.readFileString(file));
581
+ write(yield* connection.api.publication.plan({ payload }));
582
+ }))), Command.make("apply", { file: Argument.String("plan-file") }).pipe(Command.withHandler(Effect.fn("Cli.publicationApply")(function* ({ file }) {
583
+ const { connection } = yield* authenticated;
584
+ const fs = yield* FileSystem.FileSystem;
585
+ const plan = yield* Schema.decodeEffect(Schema.fromJsonString(PublicationPlan))(yield* fs.readFileString(file));
586
+ write(yield* connection.api.publication.apply({ payload: {
587
+ changes: plan.changes,
588
+ stamp: plan.stamp
589
+ } }));
590
+ })))]));
591
+ const localCommands = ["dev", "reset"].map((mode) => Command.make(mode).pipe(Command.withDescription(mode === "dev" ? "Prepare and run local Nuxt development, initializing a fresh installation from cms.config.ts." : "Stop development first. Retain the local database and restore the configured demo snapshot."), Command.withHandler(() => Effect.gen(function* () {
592
+ const { project, envName, envFile } = yield* root;
593
+ yield* run$1(mode, project, envName, Option.getOrUndefined(envFile));
594
+ }))));
595
+ const run = Command.run(root.pipe(Command.withSubcommands([
596
+ ...localCommands,
597
+ prepare,
598
+ setup,
599
+ login,
600
+ whoami,
601
+ doctor,
602
+ logout,
603
+ exportCommand,
604
+ importCommand,
605
+ documents,
606
+ publication
607
+ ])), {
608
+ version: "0.0.0",
609
+ renderErrors: false
610
+ }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(layer$2, NodeServices.layer, CliConfig.layer({ builtIns: [
611
+ GlobalFlag.Help,
612
+ GlobalFlag.Version,
613
+ GlobalFlag.Completions
614
+ ] }), layer$1(join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "phtngyn-cms")).pipe(Layer.provide(NodeServices.layer)))), run$4);
615
+ //#endregion
616
+ //#region src/internal/developmentServer.ts
617
+ const prepareStudio = Effect.fn("Development.prepareStudio")(function* (packageRoot, watch) {
618
+ if (existsSync(resolve(packageRoot, "studio/host.js"))) return;
619
+ const studio = resolve(packageRoot, "../studio");
620
+ if (!existsSync(resolve(studio, "package.json"))) return yield* new LifecycleError({ message: "CMS Studio assets are missing. Reinstall @phtngyn/cms." });
621
+ const vite = yield* Effect.tryPromise({
622
+ try: () => import(pathToFileURL(createRequire(resolve(studio, "../../package.json")).resolve("vite")).href),
623
+ catch: () => new LifecycleError({ message: "Could not load the workspace Studio builder." })
624
+ });
625
+ console.log(watch ? "Building and watching Studio…" : "Building Studio…");
626
+ if (!watch) {
627
+ yield* Effect.tryPromise({
628
+ try: () => vite.build({
629
+ root: studio,
630
+ logLevel: "warn"
631
+ }),
632
+ catch: () => new LifecycleError({ message: "Studio build failed. Inspect the build output." })
633
+ });
634
+ return;
635
+ }
636
+ const watcher = yield* Effect.acquireRelease(Effect.tryPromise({
637
+ try: () => vite.build({
638
+ root: studio,
639
+ logLevel: "warn",
640
+ build: { watch: {} }
641
+ }),
642
+ catch: () => new LifecycleError({ message: "Could not start the Studio watcher." })
643
+ }), (owned) => Effect.promise(async () => {
644
+ if ("close" in owned) await owned.close();
645
+ }));
646
+ if (!("on" in watcher)) return yield* new LifecycleError({ message: "Studio watcher did not start." });
647
+ yield* Effect.callback((resume) => {
648
+ watcher.on("event", (event) => {
649
+ if (event.code === "BUNDLE_END") {
650
+ event.result.close();
651
+ resume(Effect.void);
652
+ } else if (event.code === "ERROR") {
653
+ console.error(event.error);
654
+ resume(Effect.fail(new LifecycleError({ message: "Studio build failed. Inspect the build output." })));
655
+ }
656
+ });
657
+ });
658
+ });
659
+ const layer = (packageRoot) => Layer.succeed(DevelopmentServer, { start: Effect.fn("Development.startNuxt")(function* (options) {
660
+ const entry = yield* Effect.try({
661
+ try: () => {
662
+ const manifest = createRequire(resolve(options.project, "package.json")).resolve("nuxt/package.json");
663
+ return resolve(dirname(manifest), "bin/nuxt.mjs");
664
+ },
665
+ catch: () => new LifecycleError({ message: "Nuxt is missing from the app. Install its dependencies and rerun cms dev." })
666
+ });
667
+ yield* prepareStudio(packageRoot, options.watch);
668
+ return { exited: (yield* ChildProcess.make(process.execPath, [
669
+ entry,
670
+ "dev",
671
+ "--host",
672
+ options.site.hostname,
673
+ "--port",
674
+ options.site.port,
675
+ "--envName",
676
+ options.envName,
677
+ "--dotenv",
678
+ options.environmentFile
679
+ ], {
680
+ cwd: options.project,
681
+ env: options.environment,
682
+ extendEnv: true,
683
+ stdin: "ignore",
684
+ stdout: "inherit",
685
+ stderr: "inherit",
686
+ forceKillAfter: "5 seconds"
687
+ }).pipe(Effect.mapError(() => new LifecycleError({ message: "Could not start Nuxt. Install the app dependencies and rerun cms dev." })))).exitCode.pipe(Effect.flatMap((code) => Effect.fail(new LifecycleError({ message: `Nuxt exited with code ${code}. Inspect the server output.` }))), Effect.mapError((error) => error instanceof LifecycleError ? error : new LifecycleError({ message: "Could not observe the Nuxt process." }))) };
688
+ }) });
689
+ //#endregion
690
+ //#region src/cli.ts
691
+ NodeRuntime.runMain(run.pipe(Effect.provide(layer(resolve(dirname(fileURLToPath(import.meta.url)), "..")))), { disableErrorReporting: true });
197
692
  //#endregion
198
- export { };
199
- //# sourceMappingURL=cli.js.map
693
+ export {};