@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.
- package/LICENSE +18 -10
- package/README.md +59 -404
- package/drizzle/20261003215543_initial/migration.sql +251 -0
- package/drizzle/20261003215543_initial/snapshot.json +1941 -0
- package/package.json +75 -71
- package/src/Authoring.d.ts +41 -49
- package/src/Authoring.js +1 -1
- package/src/Blocks-BrxSemnd.js +40 -0
- package/src/Client.d.ts +8186 -0
- package/src/Client.js +41 -0
- package/src/Collections.d.ts +142 -0
- package/src/Collections.js +142 -0
- package/src/Config-CMiwciub.js +130 -0
- package/src/Config.d.ts +172 -0
- package/src/Config.js +2 -0
- package/src/Configuration-Dk2k3OIc.js +73 -0
- package/src/DataTransfer-BmECvPHB.js +488 -0
- package/src/Database-DSsNCGft.d.ts +3 -0
- package/src/Delivery.d.ts +28 -0
- package/src/Delivery.js +7 -0
- package/src/Document-CKXMSEf1.js +293 -0
- package/src/Document-TgwYKJZM.d.ts +220 -0
- package/src/DocumentRenderer-Wz2xaNyf.js +394 -0
- package/src/EditorSchema-wrDv-id6.js +296 -0
- package/src/Fields-BegSgYhj.d.ts +166 -0
- package/src/Fields-ioGaMEh9.js +130 -0
- package/src/Forms-BuKAXQxr.d.ts +203 -0
- package/src/Forms.d.ts +48 -11
- package/src/Forms.js +342 -7
- package/src/I18n-Ckf9h0rC.js +154 -0
- package/src/I18n.d.ts +45 -2
- package/src/I18n.js +2 -1
- package/src/Image-CJWPLnhP.js +110 -0
- package/src/Links-CJYyy7rC.js +28 -0
- package/src/Links-Dx1yOni8.d.ts +28 -0
- package/src/Locales-Ch7a5xuA.js +67 -0
- package/src/Locales-jwbmJaOp.d.ts +43 -0
- package/src/Locales.d.ts +3 -0
- package/src/Locales.js +3 -0
- package/src/Media-BQ0uL4w7.d.ts +15 -0
- package/src/Media-DSyvd14o.js +87 -0
- package/src/Module.d.ts +2 -10
- package/src/Module.js +1040 -152
- package/src/Operations.d.ts +57 -0
- package/src/Operations.js +263 -0
- package/src/People-DvNZauWw.js +69 -0
- package/src/PreviewFocus-C_EelZO5.js +104 -0
- package/src/Query-C0kGJF5_.d.ts +261 -0
- package/src/RevisionPreview-IVwbJ9Wy.js +133 -0
- package/src/Routes-BaZvm2LE.js +126 -0
- package/src/Routes-DM1rRp3r.d.ts +15 -0
- package/src/S3MediaObjects-y-WacEi9.js +193 -0
- package/src/Seo-BcpqxoAs.d.ts +57 -0
- package/src/Seo-CjNUtUkj.js +254 -0
- package/src/StudioApi-CXLwwocX.js +833 -0
- package/src/StudioErrors-T5zLGQ1M.js +117 -0
- package/src/StudioErrors-kq-E44lQ.d.ts +104 -0
- package/src/StudioServer.d.ts +20 -0
- package/src/StudioServer.js +34 -0
- package/src/answers-DcTg0Xv2.js +41 -0
- package/src/cli.js +681 -187
- package/src/contracts-rprW3ZOB.js +130 -0
- package/src/forms-3xuf0Ym7.d.ts +206 -0
- package/src/localeConfiguration-BPbkLi7-.js +32 -0
- package/src/localeContext-DhF3SPvM.js +59 -0
- package/src/locales-6OD4XGIZ.js +12 -0
- package/src/nuxtDelivery-BYX_Cddb.js +466 -0
- package/src/plugin-DTYuDaQu.js +7171 -0
- package/src/previewContext-dt3ZUh-w.js +4 -0
- package/src/previewRegions-CXjk5cbP.js +145 -0
- package/src/previewSource-fb-q3ESM.js +144 -0
- package/src/rendering-D9LVeEKX.js +47 -0
- package/src/rolldown-runtime-8H4AJuhK.js +14 -0
- package/src/runtime/CmsImage.js +38 -0
- package/src/runtime/DocumentPage.vue +10 -0
- package/src/runtime/DocumentPageContent.js +48 -0
- package/src/runtime/DocumentRenderer.d.ts +129 -0
- package/src/runtime/DocumentRenderer.js +2 -0
- package/src/runtime/api.js +48 -6
- package/src/runtime/delivery/useCmsDocument.js +2 -0
- package/src/runtime/delivery/useCmsDocumentQuery.js +2 -0
- package/src/runtime/delivery/useCmsDocumentSeo.js +2 -114
- package/src/runtime/delivery/useCmsLocale.js +10 -0
- package/src/runtime/plugin.js +2 -40
- package/src/runtime/preview.css +85 -0
- package/src/runtime/preview.js +277 -0
- package/src/runtime/previewSource.js +82 -0
- package/src/runtime/revisionPrivacy.js +13 -0
- package/src/runtime/studio.js +10 -0
- package/src/runtime/studioIcons.js +36 -0
- package/src/validation-3pggwcnm.js +396 -0
- package/src/validation-DpUwPC8Y.js +224 -0
- package/studio/THIRD-PARTY-LICENSES.md +2406 -0
- package/studio/chunks/AccountPage-DL3DitDM.js +288 -0
- package/studio/chunks/AccountPage-DL3DitDM.js.br +0 -0
- package/studio/chunks/AccountPage-DL3DitDM.js.gz +0 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js +584 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js.br +0 -0
- package/studio/chunks/ActivityPage-CLqVUqTh.js.gz +0 -0
- package/studio/chunks/Alert-D0D24z_a.js +335 -0
- package/studio/chunks/Alert-D0D24z_a.js.br +0 -0
- package/studio/chunks/Alert-D0D24z_a.js.gz +0 -0
- package/studio/chunks/Badge-BBFs88TI.js +346 -0
- package/studio/chunks/Badge-BBFs88TI.js.br +0 -0
- package/studio/chunks/Badge-BBFs88TI.js.gz +0 -0
- package/studio/chunks/Button-BT3ztSPx.js +14319 -0
- package/studio/chunks/Button-BT3ztSPx.js.br +0 -0
- package/studio/chunks/Button-BT3ztSPx.js.gz +0 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js +246 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js.br +0 -0
- package/studio/chunks/Collapsible-CKnEYIlp.js.gz +0 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js +1745 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js.br +0 -0
- package/studio/chunks/ContentInventory-D7nsFA6U.js.gz +0 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js +18 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js.br +0 -0
- package/studio/chunks/ContentPage-DCxt6BeD.js.gz +0 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js +2413 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js.br +0 -0
- package/studio/chunks/DashboardSearch-DjyMjJwF.js.gz +0 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js +26063 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.br +0 -0
- package/studio/chunks/DocumentLocaleMenu-0EkkOr6_.js.gz +0 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js +4400 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js.br +0 -0
- package/studio/chunks/DropdownMenu-CA9fB0uZ.js.gz +0 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js +7799 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js.br +0 -0
- package/studio/chunks/EditorPage-D_PAYEE4.js.gz +0 -0
- package/studio/chunks/FormField-CgM6l2Yn.js +198 -0
- package/studio/chunks/FormField-CgM6l2Yn.js.br +0 -0
- package/studio/chunks/FormField-CgM6l2Yn.js.gz +0 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js +552 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js.br +0 -0
- package/studio/chunks/HelpPage-C-vrFcT_.js.gz +0 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js +271 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js.br +0 -0
- package/studio/chunks/Kbd-Ot7TIhVZ.js.gz +0 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js +101 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.br +0 -0
- package/studio/chunks/MediaFolderDialog-DYu-eu-q.js.gz +0 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js +923 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js.br +0 -0
- package/studio/chunks/MediaPage-D-jaWtdl.js.gz +0 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js +837 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js.br +0 -0
- package/studio/chunks/MediaPicker-BZs2wUFz.js.gz +0 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js +1173 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.br +0 -0
- package/studio/chunks/MediaUploadPanel-C7Kyg6aR.js.gz +0 -0
- package/studio/chunks/Modal-D6hSvxHd.js +265 -0
- package/studio/chunks/Modal-D6hSvxHd.js.br +0 -0
- package/studio/chunks/Modal-D6hSvxHd.js.gz +0 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js +277 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.br +0 -0
- package/studio/chunks/NewDocumentDialog-C8B6_r3J.js.gz +0 -0
- package/studio/chunks/Pagination-D9BSo5H2.js +573 -0
- package/studio/chunks/Pagination-D9BSo5H2.js.br +0 -0
- package/studio/chunks/Pagination-D9BSo5H2.js.gz +0 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js +783 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js.br +0 -0
- package/studio/chunks/PeoplePage-CWIXitBD.js.gz +0 -0
- package/studio/chunks/Popover-B63bkTMS.js +128 -0
- package/studio/chunks/Popover-B63bkTMS.js.br +0 -0
- package/studio/chunks/Popover-B63bkTMS.js.gz +0 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js +255 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.br +0 -0
- package/studio/chunks/PublicationActionDialog-Cm_P0C3I.js.gz +0 -0
- package/studio/chunks/Routes-DLYHmulE.js +102 -0
- package/studio/chunks/Routes-DLYHmulE.js.br +0 -0
- package/studio/chunks/Routes-DLYHmulE.js.gz +0 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js +95 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js.br +0 -0
- package/studio/chunks/RovingFocusItem-QZNg-wWF.js.gz +0 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js +332 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js.br +0 -0
- package/studio/chunks/ScheduledPage-C0hqrkr5.js.gz +0 -0
- package/studio/chunks/Search-BEgCe9Aj.js +14646 -0
- package/studio/chunks/Search-BEgCe9Aj.js.br +0 -0
- package/studio/chunks/Search-BEgCe9Aj.js.gz +0 -0
- package/studio/chunks/Select-B50WZMW-.js +2145 -0
- package/studio/chunks/Select-B50WZMW-.js.br +0 -0
- package/studio/chunks/Select-B50WZMW-.js.gz +0 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js +2109 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js.br +0 -0
- package/studio/chunks/SelectMenu-DSweWGMz.js.gz +0 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js +846 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js.br +0 -0
- package/studio/chunks/SeoPage-CNNxGe4h.js.gz +0 -0
- package/studio/chunks/Skeleton-COz8dcrw.js +39 -0
- package/studio/chunks/Skeleton-COz8dcrw.js.br +2 -0
- package/studio/chunks/Skeleton-COz8dcrw.js.gz +0 -0
- package/studio/chunks/Slideover-QMMHAAys.js +289 -0
- package/studio/chunks/Slideover-QMMHAAys.js.br +0 -0
- package/studio/chunks/Slideover-QMMHAAys.js.gz +0 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js +80 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js.br +0 -0
- package/studio/chunks/StudioPage-ngEIDr5d.js.gz +0 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js +2524 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.br +0 -0
- package/studio/chunks/StudioPageToolbar-BwHnqyr6.js.gz +0 -0
- package/studio/chunks/Switch-qKl1aDn7.js +484 -0
- package/studio/chunks/Switch-qKl1aDn7.js.br +0 -0
- package/studio/chunks/Switch-qKl1aDn7.js.gz +0 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js +29 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js.br +0 -0
- package/studio/chunks/ToolPage-DxoVAJVk.js.gz +0 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js +693 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js.br +0 -0
- package/studio/chunks/Tooltip-Bu15m_DB.js.gz +0 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js +12 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js.br +0 -0
- package/studio/chunks/TrashPage-lhqLLdoG.js.gz +0 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js +2349 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js.br +0 -0
- package/studio/chunks/VersionsPage-Cqy6UAp9.js.gz +0 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js +113 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.br +0 -0
- package/studio/chunks/VisuallyHiddenInput-Cu8hQLRf.js.gz +0 -0
- package/studio/chunks/arrays-CUJkmV4I.js +10 -0
- package/studio/chunks/arrays-CUJkmV4I.js.br +0 -0
- package/studio/chunks/arrays-CUJkmV4I.js.gz +0 -0
- package/studio/chunks/base-DkTekJe8.js +213 -0
- package/studio/chunks/base-DkTekJe8.js.br +0 -0
- package/studio/chunks/base-DkTekJe8.js.gz +0 -0
- package/studio/chunks/content-DUGl3N4d.js +6012 -0
- package/studio/chunks/content-DUGl3N4d.js.br +0 -0
- package/studio/chunks/content-DUGl3N4d.js.gz +0 -0
- package/studio/chunks/destinations-DPIQVQa6.js +227 -0
- package/studio/chunks/destinations-DPIQVQa6.js.br +0 -0
- package/studio/chunks/destinations-DPIQVQa6.js.gz +0 -0
- package/studio/chunks/en-073cjKW4.js +152 -0
- package/studio/chunks/en-073cjKW4.js.br +0 -0
- package/studio/chunks/en-073cjKW4.js.gz +0 -0
- package/studio/chunks/en-Bn8mxPuf.js +134 -0
- package/studio/chunks/en-Bn8mxPuf.js.br +0 -0
- package/studio/chunks/en-Bn8mxPuf.js.gz +0 -0
- package/studio/chunks/en-C9OiaUDZ.js +251 -0
- package/studio/chunks/en-C9OiaUDZ.js.br +0 -0
- package/studio/chunks/en-C9OiaUDZ.js.gz +0 -0
- package/studio/chunks/en-CHAR6jzx.js +147 -0
- package/studio/chunks/en-CHAR6jzx.js.br +0 -0
- package/studio/chunks/en-CHAR6jzx.js.gz +0 -0
- package/studio/chunks/en-Cq4N1vEF.js +93 -0
- package/studio/chunks/en-Cq4N1vEF.js.br +2 -0
- package/studio/chunks/en-Cq4N1vEF.js.gz +0 -0
- package/studio/chunks/en-D2hRqlse.js +140 -0
- package/studio/chunks/en-D2hRqlse.js.br +0 -0
- package/studio/chunks/en-D2hRqlse.js.gz +0 -0
- package/studio/chunks/en-DiUC3-j6.js +144 -0
- package/studio/chunks/en-DiUC3-j6.js.br +0 -0
- package/studio/chunks/en-DiUC3-j6.js.gz +0 -0
- package/studio/chunks/english-Cs_Adu-u.js +8 -0
- package/studio/chunks/english-Cs_Adu-u.js.br +0 -0
- package/studio/chunks/english-Cs_Adu-u.js.gz +0 -0
- package/studio/chunks/esm-D6DqSiL1.js +752 -0
- package/studio/chunks/esm-D6DqSiL1.js.br +0 -0
- package/studio/chunks/esm-D6DqSiL1.js.gz +0 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js +23 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js.br +0 -0
- package/studio/chunks/externalRequest-CTzr2nDq.js.gz +0 -0
- package/studio/chunks/iconify-DR9ryCPv.js +1007 -0
- package/studio/chunks/iconify-DR9ryCPv.js.br +0 -0
- package/studio/chunks/iconify-DR9ryCPv.js.gz +0 -0
- package/studio/chunks/icons-D2MsAaXq.js +183 -0
- package/studio/chunks/icons-D2MsAaXq.js.br +0 -0
- package/studio/chunks/icons-D2MsAaXq.js.gz +0 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js +26 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js.br +0 -0
- package/studio/chunks/leaveGuards-D22fTGgr.js.gz +0 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js +238 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js.br +0 -0
- package/studio/chunks/lucideIcons-EyqyPBsX.js.gz +0 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js +17 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js.br +0 -0
- package/studio/chunks/mediaRoute--8cY8rUe.js.gz +0 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js +77 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js.br +0 -0
- package/studio/chunks/newDocumentPlanning-C26DHpvh.js.gz +0 -0
- package/studio/chunks/notifications-OKOLc40v.js +110 -0
- package/studio/chunks/notifications-OKOLc40v.js.br +0 -0
- package/studio/chunks/notifications-OKOLc40v.js.gz +0 -0
- package/studio/chunks/operations-CjNHyrEX.js +57 -0
- package/studio/chunks/operations-CjNHyrEX.js.br +0 -0
- package/studio/chunks/operations-CjNHyrEX.js.gz +0 -0
- package/studio/chunks/overlay-DnqFLZTc.js +1733 -0
- package/studio/chunks/overlay-DnqFLZTc.js.br +0 -0
- package/studio/chunks/overlay-DnqFLZTc.js.gz +0 -0
- package/studio/chunks/presentation-DF83w0hE.js +57 -0
- package/studio/chunks/presentation-DF83w0hE.js.br +0 -0
- package/studio/chunks/presentation-DF83w0hE.js.gz +0 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js +4557 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.br +0 -0
- package/studio/chunks/runtime-core.esm-bundler-DKFA9Rep.js.gz +0 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js +76 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js.br +0 -0
- package/studio/chunks/searchPresentation-DFwxQkt3.js.gz +0 -0
- package/studio/chunks/status-DQv6ihkU.js +38 -0
- package/studio/chunks/status-DQv6ihkU.js.br +0 -0
- package/studio/chunks/status-DQv6ihkU.js.gz +0 -0
- package/studio/chunks/studioContext-I8HozGU1.js +4953 -0
- package/studio/chunks/studioContext-I8HozGU1.js.br +0 -0
- package/studio/chunks/studioContext-I8HozGU1.js.gz +0 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js +73 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js.br +0 -0
- package/studio/chunks/studioQueries-BR-9NT5F.js.gz +0 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js +1095 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js.br +0 -0
- package/studio/chunks/studioSearch-ByaL-QpM.js.gz +0 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js +62 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.br +0 -0
- package/studio/chunks/useAcknowledgedDraft-0_c9sWI6.js.gz +0 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js +189 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.br +0 -0
- package/studio/chunks/useApi-CUWMwLLw-B3Q3g2nf.js.gz +0 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js +16 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js.br +3 -0
- package/studio/chunks/useDocumentMessage-BAWvc38w.js.gz +0 -0
- package/studio/chunks/useFilter-DzyiTR7f.js +87 -0
- package/studio/chunks/useFilter-DzyiTR7f.js.br +0 -0
- package/studio/chunks/useFilter-DzyiTR7f.js.gz +0 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js +8 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js.br +0 -0
- package/studio/chunks/useFormControl-CL7sSCUo.js.gz +0 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js +154 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js.br +0 -0
- package/studio/chunks/useGraceArea-Chcy25IQ.js.gz +0 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js +44 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.br +8 -0
- package/studio/chunks/useLeaveConfirmation-_iCSnKEp.js.gz +0 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js +35 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js.br +0 -0
- package/studio/chunks/useLinkCopy-CMjQteCy.js.gz +0 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js +16 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js.br +0 -0
- package/studio/chunks/usePointerMotion-DwRcwBNQ.js.gz +0 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js +298 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js.br +0 -0
- package/studio/chunks/useStudioNavigation-CLwtSYpb.js.gz +0 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js +79 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js.br +0 -0
- package/studio/chunks/useStudioPages-DR9qmYLg.js.gz +0 -0
- package/studio/chunks/utils-mdScC0v0.js +59 -0
- package/studio/chunks/utils-mdScC0v0.js.br +0 -0
- package/studio/chunks/utils-mdScC0v0.js.gz +0 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js +781 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js.br +0 -0
- package/studio/chunks/virtualizer-D1S0bZ4t.js.gz +0 -0
- package/studio/help/64f767fe29c2-save-and-publish.svg +7 -0
- package/studio/host.css +1 -1
- package/studio/host.css.br +0 -0
- package/studio/host.css.gz +0 -0
- package/studio/host.js +8793 -39395
- package/studio/host.js.br +0 -0
- package/studio/host.js.gz +0 -0
- package/CHANGELOG.md +0 -14
- package/bin/cms.mjs +0 -2
- package/src/ApplicationTypes.d.ts +0 -84
- package/src/ApplicationTypes.js +0 -1
- package/src/Configuration-CMweD9bn.js +0 -1191
- package/src/Configuration-CMweD9bn.js.map +0 -1
- package/src/Configuration.d.ts +0 -82
- package/src/Configuration.js +0 -8
- package/src/Configuration.js.map +0 -1
- package/src/Content.d.ts +0 -68
- package/src/Content.js +0 -373
- package/src/Content.js.map +0 -1
- package/src/ContentTransfer-BxwswWn3.js +0 -86
- package/src/ContentTransfer-BxwswWn3.js.map +0 -1
- package/src/ContentTransfer-Z9FHyLez.d.ts +0 -72
- package/src/DocumentEngine-tYtwbBjr.js +0 -978
- package/src/DocumentEngine-tYtwbBjr.js.map +0 -1
- package/src/DocumentModel.d.ts +0 -52
- package/src/DocumentModel.js +0 -66
- package/src/DocumentModel.js.map +0 -1
- package/src/Forms-CX-hwmJF.js +0 -391
- package/src/Forms-CX-hwmJF.js.map +0 -1
- package/src/Forms-CfNPTiCr.js +0 -110
- package/src/Forms-CfNPTiCr.js.map +0 -1
- package/src/Forms-R0HoTR-o.d.ts +0 -92
- package/src/Forms.js.map +0 -1
- package/src/HttpPaths-Be3vshPJ.js +0 -20
- package/src/HttpPaths-Be3vshPJ.js.map +0 -1
- package/src/I18n-wxswIRyY.d.ts +0 -30
- package/src/Media-j1bTritO.js +0 -112
- package/src/Media-j1bTritO.js.map +0 -1
- package/src/Module.js.map +0 -1
- package/src/References-CCPDAPve.js +0 -45
- package/src/References-CCPDAPve.js.map +0 -1
- package/src/S3MediaObjects-BXfjaZOu.js +0 -2756
- package/src/S3MediaObjects-BXfjaZOu.js.map +0 -1
- package/src/Seo-402YumpT.d.ts +0 -198
- package/src/cli/content.js +0 -101
- package/src/cli/content.js.map +0 -1
- package/src/cli.js.map +0 -1
- package/src/connection-BP80q4d-.js +0 -92
- package/src/connection-BP80q4d-.js.map +0 -1
- package/src/dev-lifecycle-3I_pozUl.js +0 -535
- package/src/dev-lifecycle-3I_pozUl.js.map +0 -1
- package/src/installation-DxqSSVbH.js +0 -9105
- package/src/installation-DxqSSVbH.js.map +0 -1
- package/src/internal/application-types.js +0 -43
- package/src/internal/application-types.js.map +0 -1
- package/src/internal/authoring-catalog.js +0 -158
- package/src/internal/authoring-catalog.js.map +0 -1
- package/src/internal/authoring-compiler.js +0 -146
- package/src/internal/authoring-compiler.js.map +0 -1
- package/src/internal/authoring-metadata.js +0 -191
- package/src/internal/authoring-metadata.js.map +0 -1
- package/src/internal/cms-config.js +0 -45
- package/src/internal/cms-config.js.map +0 -1
- package/src/internal/configuration.js +0 -228
- package/src/internal/configuration.js.map +0 -1
- package/src/internal/dev-lifecycle.js +0 -3
- package/src/internal/diagnostics.js +0 -47
- package/src/internal/diagnostics.js.map +0 -1
- package/src/internal/document-model.js +0 -376
- package/src/internal/document-model.js.map +0 -1
- package/src/internal/field-metadata.js +0 -7
- package/src/internal/field-metadata.js.map +0 -1
- package/src/internal/form-capabilities.js +0 -12
- package/src/internal/form-capabilities.js.map +0 -1
- package/src/internal/i18n.js +0 -73
- package/src/internal/i18n.js.map +0 -1
- package/src/internal/studio-app.js +0 -68
- package/src/internal/studio-app.js.map +0 -1
- package/src/location-CMNGO3lU.js +0 -35
- package/src/location-CMNGO3lU.js.map +0 -1
- package/src/metadata-DN9_K6Yl.js +0 -201
- package/src/metadata-DN9_K6Yl.js.map +0 -1
- package/src/models-5j67LMqW.js +0 -131
- package/src/models-5j67LMqW.js.map +0 -1
- package/src/models-VmGmG19-.js +0 -628
- package/src/models-VmGmG19-.js.map +0 -1
- package/src/runtime/api.js.map +0 -1
- package/src/runtime/blocks.js +0 -30
- package/src/runtime/blocks.js.map +0 -1
- package/src/runtime/collaboration.js +0 -45
- package/src/runtime/collaboration.js.map +0 -1
- package/src/runtime/delivery/DocumentField.js +0 -23
- package/src/runtime/delivery/DocumentField.js.map +0 -1
- package/src/runtime/delivery/DocumentRenderer.js +0 -61
- package/src/runtime/delivery/DocumentRenderer.js.map +0 -1
- package/src/runtime/delivery/DocumentScope.js +0 -41
- package/src/runtime/delivery/DocumentScope.js.map +0 -1
- package/src/runtime/delivery/blocks.js +0 -8
- package/src/runtime/delivery/blocks.js.map +0 -1
- package/src/runtime/delivery/context.js +0 -12
- package/src/runtime/delivery/context.js.map +0 -1
- package/src/runtime/delivery/document-page.js +0 -21
- package/src/runtime/delivery/document-page.js.map +0 -1
- package/src/runtime/delivery/document.js +0 -43
- package/src/runtime/delivery/document.js.map +0 -1
- package/src/runtime/delivery/error.js +0 -11
- package/src/runtime/delivery/error.js.map +0 -1
- package/src/runtime/delivery/plugin.js +0 -104
- package/src/runtime/delivery/plugin.js.map +0 -1
- package/src/runtime/delivery/preview.d.ts +0 -11
- package/src/runtime/delivery/preview.js +0 -6
- package/src/runtime/delivery/preview.js.map +0 -1
- package/src/runtime/delivery/types.d.ts +0 -2
- package/src/runtime/delivery/types.js +0 -1
- package/src/runtime/delivery/useCmsDocumentSeo.d.ts +0 -67
- package/src/runtime/delivery/useCmsDocumentSeo.js.map +0 -1
- package/src/runtime/delivery/useDocument.d.ts +0 -6
- package/src/runtime/delivery/useDocument.js +0 -23
- package/src/runtime/delivery/useDocument.js.map +0 -1
- package/src/runtime/delivery/useDocumentQuery.d.ts +0 -7
- package/src/runtime/delivery/useDocumentQuery.js +0 -29
- package/src/runtime/delivery/useDocumentQuery.js.map +0 -1
- package/src/runtime/forms/document.js +0 -38
- package/src/runtime/forms/document.js.map +0 -1
- package/src/runtime/forms/useCmsForm.js +0 -257
- package/src/runtime/forms/useCmsForm.js.map +0 -1
- package/src/runtime/i18n/translator.js +0 -58
- package/src/runtime/i18n/translator.js.map +0 -1
- package/src/runtime/i18n/useCmsI18n.d.ts +0 -13
- package/src/runtime/i18n/useCmsI18n.js +0 -38
- package/src/runtime/i18n/useCmsI18n.js.map +0 -1
- package/src/runtime/installation.js +0 -3
- package/src/runtime/plugin.js.map +0 -1
- package/src/runtime/preview/CmsStudioPreviewMarker.js +0 -29
- package/src/runtime/preview/CmsStudioPreviewMarker.js.map +0 -1
- package/src/runtime/preview/comark-document.js +0 -37
- package/src/runtime/preview/comark-document.js.map +0 -1
- package/src/runtime/preview/connection.js +0 -3
- package/src/runtime/preview/controller.js +0 -265
- package/src/runtime/preview/controller.js.map +0 -1
- package/src/runtime/preview/crypto.js +0 -16
- package/src/runtime/preview/crypto.js.map +0 -1
- package/src/runtime/preview/overlay.js +0 -122
- package/src/runtime/preview/overlay.js.map +0 -1
- package/src/runtime/preview/plugin.client.js +0 -68
- package/src/runtime/preview/plugin.client.js.map +0 -1
- package/src/runtime/preview/preview.css +0 -91
- package/src/runtime/preview/protocol.d.ts +0 -16
- package/src/runtime/preview/protocol.js +0 -23
- package/src/runtime/preview/protocol.js.map +0 -1
- package/src/runtime/preview/regions.js +0 -142
- package/src/runtime/preview/regions.js.map +0 -1
- package/src/runtime/preview/store.js +0 -4
- package/src/runtime/sitemap-entries.js +0 -17
- package/src/runtime/sitemap-entries.js.map +0 -1
- package/src/runtime/sitemap.js +0 -23
- package/src/runtime/sitemap.js.map +0 -1
- package/src/runtime/studio-app.js +0 -17
- package/src/runtime/studio-app.js.map +0 -1
- package/src/runtime/studio-document.js +0 -46
- package/src/runtime/studio-document.js.map +0 -1
- package/src/runtime/studio-entry.js +0 -19
- package/src/runtime/studio-entry.js.map +0 -1
- package/src/runtime/studio-navigation.js +0 -11
- package/src/runtime/studio-navigation.js.map +0 -1
- package/src/scalars-CA6kyipS.d.ts +0 -7
- package/src/scalars-CVZqT3L0.js +0 -22
- package/src/scalars-CVZqT3L0.js.map +0 -1
- package/src/store-X1e1o_MF.js +0 -209
- package/src/store-X1e1o_MF.js.map +0 -1
- package/src/types-DZ0IV-Ow.d.ts +0 -101
- package/studio/CreateDocumentDialog-C4_JBo1w.js +0 -335
- package/studio/SelectMenu-wXqxymUw.js +0 -34045
- package/studio/collaboration-DcK2F6v9.js +0 -4566
- package/studio/editor-P2rB7Csp.js +0 -30128
- package/studio/rolldown-runtime-Dy4uBu1J.js +0 -11
package/src/cli.js
CHANGED
|
@@ -1,199 +1,693 @@
|
|
|
1
|
-
|
|
2
|
-
import { o as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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/
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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 (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}));
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
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
|
-
|
|
161
|
-
password,
|
|
162
|
-
publish: publishContent
|
|
441
|
+
password
|
|
163
442
|
};
|
|
164
443
|
});
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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 {};
|