@xleddyl/nuxt-cms 0.9.3 → 0.10.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/README.md +1 -1
- package/dist/module.d.mts +20 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1037 -148
- package/dist/runtime/app/blocks/CmsBlocks.d.vue.ts +1 -1
- package/dist/runtime/app/blocks/CmsBlocks.vue +57 -9
- package/dist/runtime/app/blocks/CmsBlocks.vue.d.ts +1 -1
- package/dist/runtime/app/blocks/CmsField.d.ts +24 -0
- package/dist/runtime/app/blocks/CmsField.js +16 -0
- package/dist/runtime/app/blocks/node.d.ts +37 -0
- package/dist/runtime/app/blocks/node.js +17 -0
- package/dist/runtime/app/blocks/resolve.d.ts +18 -0
- package/dist/runtime/app/blocks/resolve.js +34 -0
- package/dist/runtime/app/components/cms/BlockPicker.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue +87 -0
- package/dist/runtime/app/components/cms/BlockPicker.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.d.vue.ts +38 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue +44 -0
- package/dist/runtime/app/components/cms/BlockPickerPopover.vue.d.ts +38 -0
- package/dist/runtime/app/components/cms/BlockTree.d.vue.ts +29 -0
- package/dist/runtime/app/components/cms/BlockTree.vue +322 -0
- package/dist/runtime/app/components/cms/BlockTree.vue.d.ts +29 -0
- package/dist/runtime/app/components/cms/BlocksField.vue +569 -218
- package/dist/runtime/app/components/cms/BrandMark.vue +7 -13
- package/dist/runtime/app/components/cms/ConfirmGroups.vue +15 -13
- package/dist/runtime/app/components/cms/{BlockPalette.vue.d.ts → EditorHistory.d.vue.ts} +6 -5
- package/dist/runtime/app/components/cms/EditorHistory.vue +34 -0
- package/dist/runtime/app/components/cms/{BlockPalette.d.vue.ts → EditorHistory.vue.d.ts} +6 -5
- package/dist/runtime/app/components/cms/EntryDrawer.d.vue.ts +11 -5
- package/dist/runtime/app/components/cms/EntryDrawer.vue +183 -152
- package/dist/runtime/app/components/cms/EntryDrawer.vue.d.ts +11 -5
- package/dist/runtime/app/components/cms/EntryForm.d.vue.ts +16 -4
- package/dist/runtime/app/components/cms/EntryForm.vue +106 -146
- package/dist/runtime/app/components/cms/EntryForm.vue.d.ts +16 -4
- package/dist/runtime/app/components/cms/FieldInput.vue +10 -2
- package/dist/runtime/app/components/cms/FormSections.d.vue.ts +22 -0
- package/dist/runtime/app/components/cms/FormSections.vue +71 -0
- package/dist/runtime/app/components/cms/FormSections.vue.d.ts +22 -0
- package/dist/runtime/app/components/cms/ImportModal.vue +46 -58
- package/dist/runtime/app/components/cms/LinkField.d.vue.ts +16 -0
- package/dist/runtime/app/components/cms/LinkField.vue +250 -0
- package/dist/runtime/app/components/cms/LinkField.vue.d.ts +16 -0
- package/dist/runtime/app/components/cms/ListFilters.vue +10 -12
- package/dist/runtime/app/components/cms/LocaleSwitch.d.vue.ts +2 -1
- package/dist/runtime/app/components/cms/LocaleSwitch.vue +29 -5
- package/dist/runtime/app/components/cms/LocaleSwitch.vue.d.ts +2 -1
- package/dist/runtime/app/components/cms/MediaDetail.d.vue.ts +2 -0
- package/dist/runtime/app/components/cms/MediaDetail.vue +112 -83
- package/dist/runtime/app/components/cms/MediaDetail.vue.d.ts +2 -0
- package/dist/runtime/app/components/cms/MediaField.vue +35 -25
- package/dist/runtime/app/components/cms/MediaFolderPicker.vue +26 -71
- package/dist/runtime/app/components/cms/MediaGallery.d.vue.ts +1 -0
- package/dist/runtime/app/components/cms/MediaGallery.vue +442 -419
- package/dist/runtime/app/components/cms/MediaGallery.vue.d.ts +1 -0
- package/dist/runtime/app/components/cms/MediaThumb.vue +9 -25
- package/dist/runtime/app/components/cms/MediaUpload.vue +1 -1
- package/dist/runtime/app/components/cms/{BlockOutline.d.vue.ts → NestedBlockList.d.vue.ts} +5 -5
- package/dist/runtime/app/components/cms/NestedBlockList.vue +87 -0
- package/dist/runtime/app/components/cms/{BlockOutline.vue.d.ts → NestedBlockList.vue.d.ts} +5 -5
- package/dist/runtime/app/components/cms/PoweredBy.vue +12 -5
- package/dist/runtime/app/components/cms/PresetModal.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/PresetModal.vue +70 -0
- package/dist/runtime/app/components/cms/PresetModal.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/RelationField.vue +2 -8
- package/dist/runtime/app/components/cms/SettingsAccount.vue +60 -71
- package/dist/runtime/app/components/cms/SettingsColumns.vue +47 -69
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEmptyAdd.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue +50 -0
- package/dist/runtime/app/components/cms/SettingsEntries.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsEntry.d.vue.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntry.vue +11 -95
- package/dist/runtime/app/components/cms/SettingsEntry.vue.d.ts +1 -10
- package/dist/runtime/app/components/cms/SettingsEntryActions.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue +42 -0
- package/dist/runtime/app/components/cms/SettingsEntryActions.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue +21 -0
- package/dist/runtime/app/components/cms/SettingsEntryTabs.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue +17 -0
- package/dist/runtime/app/components/cms/SettingsFormAction.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsLayout.vue +18 -14
- package/dist/runtime/app/components/cms/SettingsPresetForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue +60 -0
- package/dist/runtime/app/components/cms/SettingsPresetForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsPresets.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue +65 -0
- package/dist/runtime/app/components/cms/SettingsPresets.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.d.vue.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue +45 -0
- package/dist/runtime/app/components/cms/SettingsRecordActions.vue.d.ts +32 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue +59 -0
- package/dist/runtime/app/components/cms/SettingsRedirectActions.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue +77 -0
- package/dist/runtime/app/components/cms/SettingsRedirectForm.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.d.vue.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue +117 -0
- package/dist/runtime/app/components/cms/SettingsRedirects.vue.d.ts +13 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue +43 -0
- package/dist/runtime/app/components/cms/SettingsSecretCard.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/SettingsSite.d.vue.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue +140 -0
- package/dist/runtime/app/components/cms/SettingsSite.vue.d.ts +3 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.d.vue.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue +82 -0
- package/dist/runtime/app/components/cms/SettingsUserCreate.vue.d.ts +8 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.d.vue.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue +179 -0
- package/dist/runtime/app/components/cms/SettingsUserDetail.vue.d.ts +11 -0
- package/dist/runtime/app/components/cms/SettingsUsers.d.vue.ts +9 -6
- package/dist/runtime/app/components/cms/SettingsUsers.vue +88 -234
- package/dist/runtime/app/components/cms/SettingsUsers.vue.d.ts +9 -6
- package/dist/runtime/app/components/cms/SharePreview.d.vue.ts +18 -0
- package/dist/runtime/app/components/cms/SharePreview.vue +219 -0
- package/dist/runtime/app/components/cms/SharePreview.vue.d.ts +18 -0
- package/dist/runtime/app/components/cms/SlugField.vue +5 -3
- package/dist/runtime/app/components/cms/StatusBadge.vue +9 -8
- package/dist/runtime/app/components/cms/TranslationBadges.d.vue.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue +45 -0
- package/dist/runtime/app/components/cms/TranslationBadges.vue.d.ts +7 -0
- package/dist/runtime/app/components/cms/TranslationMenu.d.vue.ts +17 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue +28 -0
- package/dist/runtime/app/components/cms/TranslationMenu.vue.d.ts +17 -0
- package/dist/runtime/app/components/cms/VisualEditor.d.vue.ts +22 -4
- package/dist/runtime/app/components/cms/VisualEditor.vue +1152 -335
- package/dist/runtime/app/components/cms/VisualEditor.vue.d.ts +22 -4
- package/dist/runtime/app/components/cms/WelcomeModal.vue +32 -50
- package/dist/runtime/app/composables/cms-clipboard.d.ts +8 -0
- package/dist/runtime/app/composables/cms-clipboard.js +38 -0
- package/dist/runtime/app/composables/cms-confirm.d.ts +6 -8
- package/dist/runtime/app/composables/cms-confirm.js +5 -7
- package/dist/runtime/app/composables/cms-entry-disabled.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry-disabled.js +7 -0
- package/dist/runtime/app/composables/cms-entry-form.d.ts +15 -0
- package/dist/runtime/app/composables/cms-entry-form.js +40 -0
- package/dist/runtime/app/composables/cms-entry-settings.d.ts +30 -0
- package/dist/runtime/app/composables/cms-entry-settings.js +122 -0
- package/dist/runtime/app/composables/cms-entry.d.ts +5 -1
- package/dist/runtime/app/composables/cms-entry.js +36 -11
- package/dist/runtime/app/composables/cms-history.d.ts +10 -0
- package/dist/runtime/app/composables/cms-history.js +24 -0
- package/dist/runtime/app/composables/cms-link-targets.d.ts +10 -0
- package/dist/runtime/app/composables/cms-link-targets.js +40 -0
- package/dist/runtime/app/composables/cms-link-usage.d.ts +1 -0
- package/dist/runtime/app/composables/cms-link-usage.js +45 -0
- package/dist/runtime/app/composables/cms-media-library.d.ts +19 -9
- package/dist/runtime/app/composables/cms-media-library.js +31 -13
- package/dist/runtime/app/composables/cms-media-uploader.js +6 -20
- package/dist/runtime/app/composables/cms-permissions.d.ts +18 -0
- package/dist/runtime/app/composables/cms-permissions.js +54 -0
- package/dist/runtime/app/composables/cms-presets.d.ts +11 -0
- package/dist/runtime/app/composables/cms-presets.js +40 -0
- package/dist/runtime/app/composables/cms-preview-mode.d.ts +4 -0
- package/dist/runtime/app/composables/cms-preview-mode.js +8 -0
- package/dist/runtime/app/composables/cms-query.d.ts +3 -0
- package/dist/runtime/app/composables/cms-query.js +45 -20
- package/dist/runtime/app/composables/cms-record-list.d.ts +31 -0
- package/dist/runtime/app/composables/cms-record-list.js +75 -0
- package/dist/runtime/app/composables/cms-route.d.ts +6 -0
- package/dist/runtime/app/composables/cms-route.js +36 -0
- package/dist/runtime/app/composables/cms-runtime.d.ts +1 -0
- package/dist/runtime/app/composables/cms-save-handoff.d.ts +4 -0
- package/dist/runtime/app/composables/cms-save-handoff.js +19 -0
- package/dist/runtime/app/composables/cms-seo.d.ts +12 -0
- package/dist/runtime/app/composables/cms-seo.js +69 -0
- package/dist/runtime/app/composables/cms-settings-form.d.ts +13 -0
- package/dist/runtime/app/composables/cms-settings-form.js +29 -0
- package/dist/runtime/app/composables/cms-settings-sections.d.ts +26 -0
- package/dist/runtime/app/composables/cms-settings-sections.js +181 -0
- package/dist/runtime/app/composables/cms-settings-stores.d.ts +52 -0
- package/dist/runtime/app/composables/cms-settings-stores.js +156 -0
- package/dist/runtime/app/composables/cms-settings.d.ts +3 -3
- package/dist/runtime/app/composables/cms-settings.js +14 -8
- package/dist/runtime/app/composables/cms-site-disabled.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site-disabled.js +8 -0
- package/dist/runtime/app/composables/cms-site.d.ts +7 -0
- package/dist/runtime/app/composables/cms-site.js +22 -0
- package/dist/runtime/app/composables/cms-toast.d.ts +2 -8
- package/dist/runtime/app/composables/cms-toast.js +3 -9
- package/dist/runtime/app/composables/cms-translation-actions.d.ts +15 -0
- package/dist/runtime/app/composables/cms-translation-actions.js +108 -0
- package/dist/runtime/app/css-url.d.ts +4 -0
- package/dist/runtime/app/image/CmsImage.d.vue.ts +89 -0
- package/dist/runtime/app/image/CmsImage.vue +91 -0
- package/dist/runtime/app/image/CmsImage.vue.d.ts +89 -0
- package/dist/runtime/app/layouts/cms-admin.d.vue.ts +2 -2
- package/dist/runtime/app/layouts/cms-admin.vue +98 -76
- package/dist/runtime/app/layouts/cms-admin.vue.d.ts +2 -2
- package/dist/runtime/app/layouts/cms-editor.vue +7 -2
- package/dist/runtime/app/links/CmsLink.d.vue.ts +18 -0
- package/dist/runtime/app/links/CmsLink.vue +18 -0
- package/dist/runtime/app/links/CmsLink.vue.d.ts +18 -0
- package/dist/runtime/app/middleware/cms-auth.js +13 -1
- package/dist/runtime/app/pages/admin-collection.vue +473 -297
- package/dist/runtime/app/pages/admin-content.vue +190 -53
- package/dist/runtime/app/pages/admin-entry.vue +79 -75
- package/dist/runtime/app/pages/admin-index.vue +18 -5
- package/dist/runtime/app/pages/admin-login.vue +1 -1
- package/dist/runtime/app/pages/admin-logout.vue +1 -1
- package/dist/runtime/app/pages/admin-media.vue +3 -3
- package/dist/runtime/app/pages/admin-preview.vue +112 -24
- package/dist/runtime/app/plugins/cms-field.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-field.js +8 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview-banner.client.js +19 -0
- package/dist/runtime/app/plugins/cms-preview.d.ts +2 -0
- package/dist/runtime/app/plugins/cms-preview.js +27 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.d.vue.ts +7 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue +63 -0
- package/dist/runtime/app/preview/CmsPreviewBanner.vue.d.ts +7 -0
- package/dist/runtime/app/preview/PreviewOverlay.d.vue.ts +17 -3
- package/dist/runtime/app/preview/PreviewOverlay.vue +629 -166
- package/dist/runtime/app/preview/PreviewOverlay.vue.d.ts +17 -3
- package/dist/runtime/app/preview/field-marker.d.ts +12 -0
- package/dist/runtime/app/preview/field-marker.js +20 -0
- package/dist/runtime/app/preview/inline-text.d.ts +15 -0
- package/dist/runtime/app/preview/inline-text.js +158 -0
- package/dist/runtime/app/utils/block-editor.d.ts +22 -0
- package/dist/runtime/app/utils/block-editor.js +12 -0
- package/dist/runtime/app/utils/keyboard.d.ts +6 -0
- package/dist/runtime/app/utils/keyboard.js +52 -0
- package/dist/runtime/app/utils/redirects.d.ts +6 -0
- package/dist/runtime/app/utils/redirects.js +7 -0
- package/dist/runtime/app/utils/ui.d.ts +8 -0
- package/dist/runtime/app/utils/ui.js +15 -1
- package/dist/runtime/app/utils/users.d.ts +15 -0
- package/dist/runtime/app/utils/users.js +14 -0
- package/dist/runtime/assets/cms.css +1 -1
- package/dist/runtime/generate.js +16 -2
- package/dist/runtime/server/api/collection-export.get.js +3 -2
- package/dist/runtime/server/api/collection-import.post.js +39 -11
- package/dist/runtime/server/api/collection.get.js +29 -10
- package/dist/runtime/server/api/collection.post.js +28 -11
- package/dist/runtime/server/api/collection.put.js +35 -13
- package/dist/runtime/server/api/item.delete.js +19 -7
- package/dist/runtime/server/api/item.get.js +3 -2
- package/dist/runtime/server/api/item.put.js +52 -18
- package/dist/runtime/server/api/link-usage.post.d.ts +5 -0
- package/dist/runtime/server/api/link-usage.post.js +21 -0
- package/dist/runtime/server/api/media-delete.post.js +4 -2
- package/dist/runtime/server/api/media-download.get.js +2 -2
- package/dist/runtime/server/api/media-folder.delete.js +8 -2
- package/dist/runtime/server/api/media-folder.patch.js +10 -2
- package/dist/runtime/server/api/media-folder.post.js +4 -2
- package/dist/runtime/server/api/media-move.post.js +7 -4
- package/dist/runtime/server/api/media-presign.post.js +2 -2
- package/dist/runtime/server/api/media-upload.put.js +2 -2
- package/dist/runtime/server/api/media-usage.post.d.ts +2 -4
- package/dist/runtime/server/api/media-usage.post.js +13 -9
- package/dist/runtime/server/api/media.delete.js +4 -2
- package/dist/runtime/server/api/media.get.js +22 -7
- package/dist/runtime/server/api/media.post.js +4 -2
- package/dist/runtime/server/api/media.put.js +33 -16
- package/dist/runtime/server/api/preset.delete.d.ts +4 -0
- package/dist/runtime/server/api/preset.delete.js +9 -0
- package/dist/runtime/server/api/preset.put.d.ts +3 -0
- package/dist/runtime/server/api/preset.put.js +23 -0
- package/dist/runtime/server/api/presets-field.get.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.get.js +13 -0
- package/dist/runtime/server/api/presets-field.post.d.ts +3 -0
- package/dist/runtime/server/api/presets-field.post.js +36 -0
- package/dist/runtime/server/api/presets.get.d.ts +3 -0
- package/dist/runtime/server/api/presets.get.js +7 -0
- package/dist/runtime/server/api/preview-link.delete.d.ts +4 -0
- package/dist/runtime/server/api/preview-link.delete.js +15 -0
- package/dist/runtime/server/api/preview-links.get.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.get.js +10 -0
- package/dist/runtime/server/api/preview-links.post.d.ts +3 -0
- package/dist/runtime/server/api/preview-links.post.js +17 -0
- package/dist/runtime/server/api/preview.get.d.ts +3 -0
- package/dist/runtime/server/api/preview.get.js +7 -0
- package/dist/runtime/server/api/redirect.delete.d.ts +4 -0
- package/dist/runtime/server/api/redirect.delete.js +10 -0
- package/dist/runtime/server/api/redirect.put.d.ts +3 -0
- package/dist/runtime/server/api/redirect.put.js +8 -0
- package/dist/runtime/server/api/redirects-import.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects-import.post.js +13 -0
- package/dist/runtime/server/api/redirects.get.d.ts +3 -0
- package/dist/runtime/server/api/redirects.get.js +7 -0
- package/dist/runtime/server/api/redirects.post.d.ts +3 -0
- package/dist/runtime/server/api/redirects.post.js +7 -0
- package/dist/runtime/server/api/search.get.js +8 -3
- package/dist/runtime/server/api/settings.delete.js +2 -2
- package/dist/runtime/server/api/settings.get.js +4 -2
- package/dist/runtime/server/api/settings.put.js +2 -2
- package/dist/runtime/server/api/site.get.d.ts +3 -0
- package/dist/runtime/server/api/site.get.js +7 -0
- package/dist/runtime/server/api/site.put.d.ts +3 -0
- package/dist/runtime/server/api/site.put.js +16 -0
- package/dist/runtime/server/api/tags.get.js +3 -2
- package/dist/runtime/server/api/user.delete.js +8 -2
- package/dist/runtime/server/api/user.put.js +14 -4
- package/dist/runtime/server/api/users.get.js +2 -2
- package/dist/runtime/server/api/users.post.js +8 -4
- package/dist/runtime/server/middleware/hidden-site.d.ts +2 -0
- package/dist/runtime/server/middleware/hidden-site.js +8 -0
- package/dist/runtime/server/middleware/preview-links.d.ts +2 -0
- package/dist/runtime/server/middleware/preview-links.js +6 -0
- package/dist/runtime/server/middleware/redirects.d.ts +2 -0
- package/dist/runtime/server/middleware/redirects.js +18 -0
- package/dist/runtime/server/plugins/session-validate.js +4 -1
- package/dist/runtime/server/plugins/webhooks.d.ts +3 -0
- package/dist/runtime/server/plugins/webhooks.js +27 -0
- package/dist/runtime/server/routes/graphql.js +5 -3
- package/dist/runtime/server/routes/robots.d.ts +2 -0
- package/dist/runtime/server/routes/robots.js +16 -0
- package/dist/runtime/server/routes/sitemap.d.ts +2 -0
- package/dist/runtime/server/routes/sitemap.js +67 -0
- package/dist/runtime/server/utils/cached-value.d.ts +5 -0
- package/dist/runtime/server/utils/cached-value.js +24 -0
- package/dist/runtime/server/utils/content-routes.d.ts +5 -0
- package/dist/runtime/server/utils/content-routes.js +29 -0
- package/dist/runtime/server/utils/field-rules.d.ts +19 -0
- package/dist/runtime/server/utils/field-rules.js +72 -0
- package/dist/runtime/server/utils/graphql.d.ts +3 -1
- package/dist/runtime/server/utils/graphql.js +145 -29
- package/dist/runtime/server/utils/hooks.d.ts +14 -0
- package/dist/runtime/server/utils/hooks.js +71 -0
- package/dist/runtime/server/utils/import.d.ts +7 -2
- package/dist/runtime/server/utils/import.js +108 -14
- package/dist/runtime/server/utils/link-usage.d.ts +4 -0
- package/dist/runtime/server/utils/link-usage.js +28 -0
- package/dist/runtime/server/utils/media-references.d.ts +6 -1
- package/dist/runtime/server/utils/media-references.js +49 -20
- package/dist/runtime/server/utils/media-usage.d.ts +2 -0
- package/dist/runtime/server/utils/media-usage.js +5 -3
- package/dist/runtime/server/utils/page-rows.d.ts +2 -0
- package/dist/runtime/server/utils/page-rows.js +42 -29
- package/dist/runtime/server/utils/permissions.d.ts +14 -0
- package/dist/runtime/server/utils/permissions.js +43 -0
- package/dist/runtime/server/utils/presets.d.ts +18 -0
- package/dist/runtime/server/utils/presets.js +68 -0
- package/dist/runtime/server/utils/preview-links.d.ts +207 -0
- package/dist/runtime/server/utils/preview-links.js +161 -0
- package/dist/runtime/server/utils/redirects.d.ts +31 -0
- package/dist/runtime/server/utils/redirects.js +240 -0
- package/dist/runtime/server/utils/registry.js +4 -1
- package/dist/runtime/server/utils/relations.d.ts +8 -0
- package/dist/runtime/server/utils/relations.js +25 -6
- package/dist/runtime/server/utils/require-admin.d.ts +0 -1
- package/dist/runtime/server/utils/require-admin.js +4 -8
- package/dist/runtime/server/utils/search.d.ts +1 -0
- package/dist/runtime/server/utils/search.js +44 -19
- package/dist/runtime/server/utils/single-row.d.ts +3 -0
- package/dist/runtime/server/utils/single-row.js +4 -0
- package/dist/runtime/server/utils/site.d.ts +23 -0
- package/dist/runtime/server/utils/site.js +79 -0
- package/dist/runtime/server/utils/sitemap.d.ts +12 -0
- package/dist/runtime/server/utils/sitemap.js +109 -0
- package/dist/runtime/server/utils/user-management.d.ts +4 -0
- package/dist/runtime/server/utils/user-management.js +20 -0
- package/dist/runtime/server/utils/users.d.ts +1 -1
- package/dist/runtime/server/utils/users.js +1 -1
- package/dist/runtime/server/utils/visibility.d.ts +1 -0
- package/dist/runtime/server/utils/visibility.js +6 -1
- package/dist/runtime/server/utils/webhooks.d.ts +24 -0
- package/dist/runtime/server/utils/webhooks.js +90 -0
- package/dist/runtime/shared/block-paths.d.ts +66 -0
- package/dist/runtime/shared/block-paths.js +310 -0
- package/dist/runtime/shared/block-picker.d.ts +18 -0
- package/dist/runtime/shared/block-picker.js +31 -0
- package/dist/runtime/shared/block-signature.d.ts +4 -0
- package/dist/runtime/shared/block-signature.js +46 -0
- package/dist/runtime/shared/clipboard.d.ts +31 -0
- package/dist/runtime/shared/clipboard.js +206 -0
- package/dist/runtime/shared/conditions.d.ts +36 -0
- package/dist/runtime/shared/conditions.js +100 -0
- package/dist/runtime/shared/content-routes.d.ts +42 -0
- package/dist/runtime/shared/content-routes.js +237 -0
- package/dist/runtime/shared/duplicate.js +2 -1
- package/dist/runtime/shared/editor-layout.d.ts +18 -0
- package/dist/runtime/shared/editor-layout.js +9 -0
- package/dist/runtime/shared/field-options.d.ts +21 -0
- package/dist/runtime/shared/field-options.js +90 -0
- package/dist/runtime/shared/graphql-sdl.d.ts +1 -0
- package/dist/runtime/shared/graphql-sdl.js +50 -26
- package/dist/runtime/shared/history.d.ts +27 -0
- package/dist/runtime/shared/history.js +123 -0
- package/dist/runtime/shared/hooks.d.ts +45 -0
- package/dist/runtime/shared/hooks.js +28 -0
- package/dist/runtime/shared/index.d.ts +90 -21
- package/dist/runtime/shared/index.js +121 -37
- package/dist/runtime/shared/inline-text.d.ts +38 -0
- package/dist/runtime/shared/inline-text.js +85 -0
- package/dist/runtime/shared/layout.d.ts +2 -1
- package/dist/runtime/shared/layout.js +3 -0
- package/dist/runtime/shared/links.d.ts +48 -0
- package/dist/runtime/shared/links.js +155 -0
- package/dist/runtime/shared/list-filters.d.ts +2 -0
- package/dist/runtime/shared/list-filters.js +2 -0
- package/dist/runtime/shared/media-focal.d.ts +30 -0
- package/dist/runtime/shared/media-focal.js +52 -0
- package/dist/runtime/shared/migrations-dir.d.ts +14 -0
- package/dist/runtime/shared/migrations-dir.js +48 -2
- package/dist/runtime/shared/presets.d.ts +67 -0
- package/dist/runtime/shared/presets.js +127 -0
- package/dist/runtime/shared/preview-links.d.ts +64 -0
- package/dist/runtime/shared/preview-links.js +54 -0
- package/dist/runtime/shared/preview.d.ts +124 -21
- package/dist/runtime/shared/preview.js +419 -81
- package/dist/runtime/shared/redirects.d.ts +75 -0
- package/dist/runtime/shared/redirects.js +230 -0
- package/dist/runtime/shared/roles.d.ts +57 -0
- package/dist/runtime/shared/roles.js +293 -0
- package/dist/runtime/shared/save-state.d.ts +8 -0
- package/dist/runtime/shared/save-state.js +15 -0
- package/dist/runtime/shared/search.d.ts +16 -1
- package/dist/runtime/shared/search.js +41 -7
- package/dist/runtime/shared/seo.d.ts +167 -0
- package/dist/runtime/shared/seo.js +335 -0
- package/dist/runtime/shared/transfer.js +2 -1
- package/dist/runtime/shared/translations.d.ts +29 -0
- package/dist/runtime/shared/translations.js +123 -0
- package/dist/runtime/shared/users.d.ts +1 -1
- package/dist/runtime/shared/validation.d.ts +23 -1
- package/dist/runtime/shared/validation.js +214 -64
- package/dist/runtime/webhooks.d.ts +33 -0
- package/dist/runtime/webhooks.js +57 -0
- package/dist/types.d.mts +5 -1
- package/package.json +6 -2
- package/dist/runtime/app/components/cms/BlockOutline.vue +0 -88
- package/dist/runtime/app/components/cms/BlockPalette.vue +0 -31
- package/dist/runtime/app/components/cms/SettingsModal.d.vue.ts +0 -12
- package/dist/runtime/app/components/cms/SettingsModal.vue +0 -126
- package/dist/runtime/app/components/cms/SettingsModal.vue.d.ts +0 -12
- package/dist/runtime/app/composables/cms-field-focus.d.ts +0 -4
- package/dist/runtime/app/composables/cms-field-focus.js +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldConfig } from './index.js';
|
|
1
|
+
import type { BlockConfig, FieldConfig } from './index.js';
|
|
2
2
|
export declare const MAX_LAYOUT_ROW_FIELDS = 4;
|
|
3
3
|
export type CmsLayoutRow = string | string[];
|
|
4
4
|
export interface CmsLayoutSectionInput {
|
|
@@ -28,6 +28,7 @@ export interface CmsEntrySettings {
|
|
|
28
28
|
export type CmsSettingsMap = Record<string, CmsEntrySettings>;
|
|
29
29
|
export declare function layoutFromConfig(input: CmsLayoutBlock[] | undefined): CmsFormLayout;
|
|
30
30
|
export declare function resolveFormLayout(fields: Record<string, FieldConfig>, layout: CmsFormLayout | undefined): CmsFormLayout;
|
|
31
|
+
export declare function blockFormLayout(block: Pick<BlockConfig, 'fields' | 'layout'>): CmsFormLayout;
|
|
31
32
|
export declare function defaultListColumns(fields: Record<string, FieldConfig>, list: CmsListInput | undefined, extra?: string[]): string[];
|
|
32
33
|
export declare function resolveListColumns(fields: Record<string, FieldConfig>, saved: string[] | undefined, list: CmsListInput | undefined, extra?: string[]): string[];
|
|
33
34
|
export declare function layoutErrors(at: string, fields: Record<string, FieldConfig>, input: CmsLayoutBlock[] | undefined): string[];
|
|
@@ -78,6 +78,9 @@ export function resolveFormLayout(fields, layout) {
|
|
|
78
78
|
}
|
|
79
79
|
return { main };
|
|
80
80
|
}
|
|
81
|
+
export function blockFormLayout(block) {
|
|
82
|
+
return resolveFormLayout(block.fields, layoutFromConfig(block.layout));
|
|
83
|
+
}
|
|
81
84
|
export function defaultListColumns(fields, list, extra = []) {
|
|
82
85
|
const available = [...Object.keys(fields), ...extra];
|
|
83
86
|
const configured = list?.columns?.filter((key) => available.includes(key));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CmsConfig, CmsEntry, FieldConfig } from './index.js';
|
|
2
|
+
export declare const LINK_URL_MAX_LENGTH = 2048;
|
|
3
|
+
export declare const LINK_URL_SCHEMES: readonly string[];
|
|
4
|
+
export declare const LINK_TARGET_SEPARATOR = ":";
|
|
5
|
+
export interface CmsLinkValue {
|
|
6
|
+
url?: string;
|
|
7
|
+
entry?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
label?: string | Record<string, string>;
|
|
10
|
+
newTab?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface CmsLink {
|
|
13
|
+
href: string | null;
|
|
14
|
+
label: string | null;
|
|
15
|
+
newTab: boolean;
|
|
16
|
+
external: boolean;
|
|
17
|
+
entry: string | null;
|
|
18
|
+
id: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface CmsLinkTarget {
|
|
21
|
+
entry: string;
|
|
22
|
+
id: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CmsLinkReference extends CmsLinkTarget {
|
|
25
|
+
field: string;
|
|
26
|
+
}
|
|
27
|
+
export type CmsLinkUrlKind = 'absolute' | 'path' | 'anchor';
|
|
28
|
+
export declare function linkUrlKind(url: string): CmsLinkUrlKind | null;
|
|
29
|
+
export declare function linkUrlError(url: unknown): string | null;
|
|
30
|
+
export declare function isExternalLinkUrl(url: string | null | undefined): boolean;
|
|
31
|
+
export declare function isLinkTargetEntry(entry: CmsEntry | null | undefined): boolean;
|
|
32
|
+
export declare function declaredLinkTargets(field: FieldConfig): string[] | null;
|
|
33
|
+
export declare function linkTargetNames(config: CmsConfig, field: FieldConfig): string[];
|
|
34
|
+
export declare function allowsExternalLinks(field: FieldConfig): boolean;
|
|
35
|
+
export declare function linkTargetKey(entry: string, id: string): string;
|
|
36
|
+
export declare function parseLinkTargetKey(key: string): CmsLinkTarget | null;
|
|
37
|
+
export declare function readLinkValue(value: unknown): CmsLinkValue | null;
|
|
38
|
+
export declare function linkTargetOf(value: unknown): CmsLinkTarget | null;
|
|
39
|
+
export declare function linkLabelText(label: unknown, locale: string, defaultLocale: string): string | null;
|
|
40
|
+
export declare function linkLabelTexts(label: unknown): {
|
|
41
|
+
locale: string | null;
|
|
42
|
+
text: string;
|
|
43
|
+
}[];
|
|
44
|
+
export declare function pageLinkPath(entry: CmsEntry | undefined, id: string): string | null;
|
|
45
|
+
export declare function linkHref(config: CmsConfig, link: CmsLinkValue | null, locale: string, target?: Record<string, unknown> | null): string | null;
|
|
46
|
+
export declare function resolveCmsLink(config: CmsConfig, value: unknown, locale: string, defaultLocale: string, target?: Record<string, unknown> | null): CmsLink | null;
|
|
47
|
+
export declare function linkReferences(fields: Record<string, FieldConfig>, values: Record<string, unknown>): CmsLinkReference[];
|
|
48
|
+
export declare function linkDisplayText(value: unknown, locale: string, defaultLocale: string, targetTitle?: string | null): string;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { blockReferenceLabel, walkBlocks } from "./block-paths.js";
|
|
2
|
+
import { contentItemPath, isRoutedContent } from "./content-routes.js";
|
|
3
|
+
export const LINK_URL_MAX_LENGTH = 2048;
|
|
4
|
+
export const LINK_URL_SCHEMES = ["http", "https", "mailto", "tel"];
|
|
5
|
+
export const LINK_TARGET_SEPARATOR = ":";
|
|
6
|
+
const SCHEME = /^([a-z][a-z\d+.-]*):/i;
|
|
7
|
+
const UNSAFE_CHARACTERS = /[\s\u0000-\u001F\u007F]/;
|
|
8
|
+
const TEL_NUMBER = /^\+?[\d().\-/]+$/;
|
|
9
|
+
export function linkUrlKind(url) {
|
|
10
|
+
if (url.startsWith("#")) return "anchor";
|
|
11
|
+
if (url.startsWith("/") && !url.startsWith("//") && !url.startsWith("/\\")) return "path";
|
|
12
|
+
const scheme = SCHEME.exec(url)?.[1]?.toLowerCase();
|
|
13
|
+
return scheme && LINK_URL_SCHEMES.includes(scheme) ? "absolute" : null;
|
|
14
|
+
}
|
|
15
|
+
export function linkUrlError(url) {
|
|
16
|
+
if (typeof url !== "string" || !url) return "Enter a URL";
|
|
17
|
+
if (url.length > LINK_URL_MAX_LENGTH) return "The URL is too long";
|
|
18
|
+
if (UNSAFE_CHARACTERS.test(url)) return "A URL cannot contain spaces";
|
|
19
|
+
if (url.startsWith("//") || url.startsWith("/\\") || url.startsWith("\\"))
|
|
20
|
+
return "Use https:// for links to other sites";
|
|
21
|
+
if (url.startsWith("/")) return null;
|
|
22
|
+
if (url.startsWith("#")) return url.length > 1 ? null : "Add an anchor name after #";
|
|
23
|
+
const scheme = SCHEME.exec(url)?.[1]?.toLowerCase();
|
|
24
|
+
if (!scheme) return "Use a full URL (https://...), a path starting with / or an #anchor";
|
|
25
|
+
if (!LINK_URL_SCHEMES.includes(scheme))
|
|
26
|
+
return `${scheme}: links are not allowed (use http, https, mailto or tel)`;
|
|
27
|
+
const rest = url.slice(scheme.length + 1);
|
|
28
|
+
if (scheme === "mailto") return rest ? null : "Add an email address after mailto:";
|
|
29
|
+
if (scheme === "tel") return TEL_NUMBER.test(rest) ? null : "Add a phone number after tel:";
|
|
30
|
+
if (!rest.startsWith("//")) return "Invalid URL";
|
|
31
|
+
try {
|
|
32
|
+
return new URL(url).hostname ? null : "Invalid URL";
|
|
33
|
+
} catch {
|
|
34
|
+
return "Invalid URL";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function isExternalLinkUrl(url) {
|
|
38
|
+
return !!url && linkUrlKind(url) === "absolute";
|
|
39
|
+
}
|
|
40
|
+
export function isLinkTargetEntry(entry) {
|
|
41
|
+
return !!entry && (entry.kind === "page" || isRoutedContent(entry));
|
|
42
|
+
}
|
|
43
|
+
export function declaredLinkTargets(field) {
|
|
44
|
+
const to = field.to;
|
|
45
|
+
if (!Array.isArray(to)) return null;
|
|
46
|
+
return to.filter((name) => typeof name === "string");
|
|
47
|
+
}
|
|
48
|
+
export function linkTargetNames(config, field) {
|
|
49
|
+
const declared = declaredLinkTargets(field);
|
|
50
|
+
if (declared) return declared.filter((name) => isLinkTargetEntry(config[name]));
|
|
51
|
+
return Object.entries(config).filter(([, entry]) => isLinkTargetEntry(entry)).map(([name]) => name);
|
|
52
|
+
}
|
|
53
|
+
export function allowsExternalLinks(field) {
|
|
54
|
+
return field.external !== false;
|
|
55
|
+
}
|
|
56
|
+
export function linkTargetKey(entry, id) {
|
|
57
|
+
return `${entry}${LINK_TARGET_SEPARATOR}${id}`;
|
|
58
|
+
}
|
|
59
|
+
export function parseLinkTargetKey(key) {
|
|
60
|
+
const index = key.indexOf(LINK_TARGET_SEPARATOR);
|
|
61
|
+
if (index <= 0 || index === key.length - 1) return null;
|
|
62
|
+
return { entry: key.slice(0, index), id: key.slice(index + 1) };
|
|
63
|
+
}
|
|
64
|
+
function isRecord(value) {
|
|
65
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
66
|
+
}
|
|
67
|
+
export function readLinkValue(value) {
|
|
68
|
+
let parsed = value;
|
|
69
|
+
if (typeof parsed === "string") {
|
|
70
|
+
const text = parsed.trim();
|
|
71
|
+
if (!text.startsWith("{")) return text ? { url: text } : null;
|
|
72
|
+
try {
|
|
73
|
+
parsed = JSON.parse(text);
|
|
74
|
+
} catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (!isRecord(parsed)) return null;
|
|
79
|
+
const link = {};
|
|
80
|
+
if (typeof parsed.url === "string" && parsed.url) link.url = parsed.url;
|
|
81
|
+
if (typeof parsed.entry === "string" && parsed.entry) link.entry = parsed.entry;
|
|
82
|
+
if (typeof parsed.id === "string" && parsed.id) link.id = parsed.id;
|
|
83
|
+
if (typeof parsed.label === "string" || isRecord(parsed.label))
|
|
84
|
+
link.label = parsed.label;
|
|
85
|
+
if (parsed.newTab === true) link.newTab = true;
|
|
86
|
+
return link;
|
|
87
|
+
}
|
|
88
|
+
export function linkTargetOf(value) {
|
|
89
|
+
const link = readLinkValue(value);
|
|
90
|
+
if (!link?.entry || !link.id || link.url) return null;
|
|
91
|
+
return { entry: link.entry, id: link.id };
|
|
92
|
+
}
|
|
93
|
+
export function linkLabelText(label, locale, defaultLocale) {
|
|
94
|
+
if (typeof label === "string") return label || null;
|
|
95
|
+
if (!isRecord(label)) return null;
|
|
96
|
+
const pick = (key) => {
|
|
97
|
+
const text = label[key];
|
|
98
|
+
return typeof text === "string" && text ? text : null;
|
|
99
|
+
};
|
|
100
|
+
return pick(locale) ?? pick(defaultLocale) ?? Object.keys(label).map(pick).find((text) => text !== null) ?? null;
|
|
101
|
+
}
|
|
102
|
+
export function linkLabelTexts(label) {
|
|
103
|
+
if (typeof label === "string") return label ? [{ locale: null, text: label }] : [];
|
|
104
|
+
if (!isRecord(label)) return [];
|
|
105
|
+
return Object.entries(label).filter((pair) => typeof pair[1] === "string" && !!pair[1]).map(([locale, text]) => ({ locale, text }));
|
|
106
|
+
}
|
|
107
|
+
export function pageLinkPath(entry, id) {
|
|
108
|
+
if (entry?.kind !== "page") return null;
|
|
109
|
+
return entry.pages?.find((route) => route.key === id)?.path ?? null;
|
|
110
|
+
}
|
|
111
|
+
export function linkHref(config, link, locale, target) {
|
|
112
|
+
if (!link) return null;
|
|
113
|
+
if (link.url) return linkUrlError(link.url) ? null : link.url;
|
|
114
|
+
if (!link.entry || !link.id) return null;
|
|
115
|
+
const entry = config[link.entry];
|
|
116
|
+
if (entry?.kind === "page") return pageLinkPath(entry, link.id);
|
|
117
|
+
if (!target || !isRoutedContent(entry)) return null;
|
|
118
|
+
return contentItemPath(entry, target, locale);
|
|
119
|
+
}
|
|
120
|
+
export function resolveCmsLink(config, value, locale, defaultLocale, target) {
|
|
121
|
+
const link = readLinkValue(value);
|
|
122
|
+
if (!link || !link.url && !(link.entry && link.id)) return null;
|
|
123
|
+
return {
|
|
124
|
+
href: linkHref(config, link, locale, target),
|
|
125
|
+
label: linkLabelText(link.label, locale, defaultLocale),
|
|
126
|
+
newTab: !!link.newTab,
|
|
127
|
+
external: isExternalLinkUrl(link.url),
|
|
128
|
+
entry: link.url ? null : link.entry ?? null,
|
|
129
|
+
id: link.url ? null : link.id ?? null
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export function linkReferences(fields, values) {
|
|
133
|
+
const references = [];
|
|
134
|
+
for (const [key, field] of Object.entries(fields)) {
|
|
135
|
+
if (field.type !== "link") continue;
|
|
136
|
+
const target = linkTargetOf(values[key]);
|
|
137
|
+
if (target) references.push({ field: key, ...target });
|
|
138
|
+
}
|
|
139
|
+
walkBlocks(fields, values, ({ item, block, path }) => {
|
|
140
|
+
for (const [blockFieldKey, blockField] of Object.entries(block.fields)) {
|
|
141
|
+
if (blockField.type !== "link") continue;
|
|
142
|
+
const target = linkTargetOf(item[blockFieldKey]);
|
|
143
|
+
if (target) references.push({ field: blockReferenceLabel(path, blockFieldKey), ...target });
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return references;
|
|
147
|
+
}
|
|
148
|
+
export function linkDisplayText(value, locale, defaultLocale, targetTitle) {
|
|
149
|
+
const link = readLinkValue(value);
|
|
150
|
+
if (!link) return "";
|
|
151
|
+
const label = linkLabelText(link.label, locale, defaultLocale);
|
|
152
|
+
const target = link.url ?? targetTitle ?? null;
|
|
153
|
+
if (label && target) return `${label} (${target})`;
|
|
154
|
+
return label ?? target ?? (link.entry && link.id ? `${link.entry} #${link.id}` : "");
|
|
155
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { CmsEntry, SelectOption } from './index.js';
|
|
2
2
|
export declare const LIST_FILTER_PREFIX = "filter.";
|
|
3
|
+
export declare const LIST_SEARCH_PARAM = "q";
|
|
3
4
|
export declare const LIST_FILTER_STATUS = "status";
|
|
4
5
|
export declare const LIST_FILTER_ID_MAX = 256;
|
|
6
|
+
export declare const LIST_IDS_MAX = 1000;
|
|
5
7
|
export type CmsListFilters = Record<string, string>;
|
|
6
8
|
type FilterEntry = Pick<CmsEntry, 'kind' | 'fields' | 'drafts' | 'list'>;
|
|
7
9
|
export declare function listFilterExtras(entry: FilterEntry): string[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { isCollectionKind, listFilterKeys, selectOptions } from "./index.js";
|
|
2
2
|
export const LIST_FILTER_PREFIX = "filter.";
|
|
3
|
+
export const LIST_SEARCH_PARAM = "q";
|
|
3
4
|
export const LIST_FILTER_STATUS = "status";
|
|
4
5
|
export const LIST_FILTER_ID_MAX = 256;
|
|
6
|
+
export const LIST_IDS_MAX = 1e3;
|
|
5
7
|
const STATUS_OPTIONS = [
|
|
6
8
|
{ value: "draft", label: "Draft" },
|
|
7
9
|
{ value: "published", label: "Published" }
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface CmsFocalPoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface CmsFocalMedia {
|
|
6
|
+
focalX?: number | null;
|
|
7
|
+
focalY?: number | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function isFocalCoordinate(value: unknown): value is number;
|
|
10
|
+
export declare function roundFocalCoordinate(value: number): number;
|
|
11
|
+
export declare function focalPointOf(media: CmsFocalMedia | null | undefined): CmsFocalPoint | null;
|
|
12
|
+
export declare function focalPointIssue(focalX: unknown, focalY: unknown): string | null;
|
|
13
|
+
export declare function focalObjectPosition(media: CmsFocalMedia | null | undefined): string | undefined;
|
|
14
|
+
export declare function imgixFocalModifiers(media: CmsFocalMedia | null | undefined): Record<string, string | number>;
|
|
15
|
+
export interface CmsImageMedia extends CmsFocalMedia {
|
|
16
|
+
url: string | null;
|
|
17
|
+
type?: string | null;
|
|
18
|
+
alt?: string | null;
|
|
19
|
+
width?: number | null;
|
|
20
|
+
height?: number | null;
|
|
21
|
+
}
|
|
22
|
+
export interface CmsImageSizeInput {
|
|
23
|
+
width?: number | string | null;
|
|
24
|
+
height?: number | string | null;
|
|
25
|
+
}
|
|
26
|
+
export declare function cmsImageSize(media: Pick<CmsImageMedia, 'width' | 'height'> | null | undefined, input?: CmsImageSizeInput): {
|
|
27
|
+
width: number | undefined;
|
|
28
|
+
height: number | undefined;
|
|
29
|
+
};
|
|
30
|
+
export declare function isRenderableImage(media: CmsImageMedia | null | undefined): media is CmsImageMedia;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const FOCAL_PRECISION = 1e4;
|
|
2
|
+
export function isFocalCoordinate(value) {
|
|
3
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
4
|
+
}
|
|
5
|
+
export function roundFocalCoordinate(value) {
|
|
6
|
+
return Math.round(Math.min(1, Math.max(0, value)) * FOCAL_PRECISION) / FOCAL_PRECISION;
|
|
7
|
+
}
|
|
8
|
+
export function focalPointOf(media) {
|
|
9
|
+
if (!media) return null;
|
|
10
|
+
const { focalX, focalY } = media;
|
|
11
|
+
if (!isFocalCoordinate(focalX) || !isFocalCoordinate(focalY)) return null;
|
|
12
|
+
return { x: focalX, y: focalY };
|
|
13
|
+
}
|
|
14
|
+
export function focalPointIssue(focalX, focalY) {
|
|
15
|
+
const unset = (value) => value === null || value === void 0;
|
|
16
|
+
if (unset(focalX) && unset(focalY)) return null;
|
|
17
|
+
if (unset(focalX) || unset(focalY)) return "focalX and focalY must be set together";
|
|
18
|
+
if (!isFocalCoordinate(focalX) || !isFocalCoordinate(focalY))
|
|
19
|
+
return "focalX and focalY must be numbers from 0 to 1";
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
function percent(value) {
|
|
23
|
+
return `${Math.round(value * 1e4) / 100}%`;
|
|
24
|
+
}
|
|
25
|
+
export function focalObjectPosition(media) {
|
|
26
|
+
const point = focalPointOf(media);
|
|
27
|
+
return point ? `${percent(point.x)} ${percent(point.y)}` : void 0;
|
|
28
|
+
}
|
|
29
|
+
export function imgixFocalModifiers(media) {
|
|
30
|
+
const point = focalPointOf(media);
|
|
31
|
+
if (!point) return {};
|
|
32
|
+
return { crop: "focalpoint", focalPointXPosition: point.x, focalPointYPosition: point.y };
|
|
33
|
+
}
|
|
34
|
+
function toPixels(value) {
|
|
35
|
+
if (value === null || value === void 0 || value === "") return void 0;
|
|
36
|
+
const parsed = typeof value === "number" ? value : Number(value);
|
|
37
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : void 0;
|
|
38
|
+
}
|
|
39
|
+
export function cmsImageSize(media, input = {}) {
|
|
40
|
+
const naturalWidth = toPixels(media?.width);
|
|
41
|
+
const naturalHeight = toPixels(media?.height);
|
|
42
|
+
const width = toPixels(input.width);
|
|
43
|
+
const height = toPixels(input.height);
|
|
44
|
+
const ratio = naturalWidth && naturalHeight ? naturalWidth / naturalHeight : void 0;
|
|
45
|
+
if (width && height) return { width, height };
|
|
46
|
+
if (width) return { width, height: ratio ? Math.round(width / ratio) : void 0 };
|
|
47
|
+
if (height) return { width: ratio ? Math.round(height * ratio) : void 0, height };
|
|
48
|
+
return { width: naturalWidth, height: naturalHeight };
|
|
49
|
+
}
|
|
50
|
+
export function isRenderableImage(media) {
|
|
51
|
+
return !!media?.url && (media.type === void 0 || media.type === null || media.type === "image");
|
|
52
|
+
}
|
|
@@ -1 +1,15 @@
|
|
|
1
1
|
export declare function migrationsDirFor(root: string, driver: string): string;
|
|
2
|
+
export interface CmsUniqueTextColumn {
|
|
3
|
+
table: string;
|
|
4
|
+
column: string;
|
|
5
|
+
}
|
|
6
|
+
export type CmsMigrationDialect = 'sqlite' | 'turso' | 'postgresql';
|
|
7
|
+
export declare function blankUniqueValuesToNull(sql: string, columns: readonly CmsUniqueTextColumn[], dialect: CmsMigrationDialect): string;
|
|
8
|
+
export declare function migrationSqlFiles(dir: string): string[];
|
|
9
|
+
export declare function fixNewMigrations(dir: string, before: readonly string[], columns: readonly CmsUniqueTextColumn[], dialect: CmsMigrationDialect): string[];
|
|
10
|
+
export declare const MIGRATION_FIXES_FILE = "migration-fixes.json";
|
|
11
|
+
export interface CmsMigrationFixes {
|
|
12
|
+
dialect: CmsMigrationDialect;
|
|
13
|
+
out: string;
|
|
14
|
+
uniqueTextColumns: CmsUniqueTextColumn[];
|
|
15
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
3
|
const MIGRATIONS_ROOT = "server/db/migrations";
|
|
4
4
|
export function migrationsDirFor(root, driver) {
|
|
5
5
|
if (driver === "postgres") return resolve(root, `${MIGRATIONS_ROOT}/postgres`);
|
|
@@ -7,3 +7,49 @@ export function migrationsDirFor(root, driver) {
|
|
|
7
7
|
if (driver !== "sqlite" && existsSync(perDriver)) return perDriver;
|
|
8
8
|
return resolve(root, `${MIGRATIONS_ROOT}/sqlite`);
|
|
9
9
|
}
|
|
10
|
+
const STATEMENT_BREAKPOINT = "--> statement-breakpoint";
|
|
11
|
+
const SQLITE_UNIQUE_INDEX = /^CREATE UNIQUE INDEX [`"]?[\w]+[`"]? ON [`"]?(\w+)[`"]? \([`"]?(\w+)[`"]?\)/i;
|
|
12
|
+
const POSTGRES_UNIQUE_CONSTRAINT = /^ALTER TABLE "(?:\w+"\.")?(\w+)" ADD CONSTRAINT "\w+" UNIQUE(?: NULLS NOT DISTINCT)?\("(\w+)"\)/i;
|
|
13
|
+
function uniqueTarget(statement) {
|
|
14
|
+
const match = SQLITE_UNIQUE_INDEX.exec(statement) ?? POSTGRES_UNIQUE_CONSTRAINT.exec(statement);
|
|
15
|
+
return match ? { table: match[1], column: match[2] } : null;
|
|
16
|
+
}
|
|
17
|
+
function blankToNullStatement(target, dialect) {
|
|
18
|
+
const quote = dialect === "postgresql" ? '"' : "`";
|
|
19
|
+
const table = `${quote}${target.table}${quote}`;
|
|
20
|
+
const column = `${quote}${target.column}${quote}`;
|
|
21
|
+
return `UPDATE ${table} SET ${column} = NULL WHERE trim(${column}) = '';`;
|
|
22
|
+
}
|
|
23
|
+
export function blankUniqueValuesToNull(sql, columns, dialect) {
|
|
24
|
+
const out = [];
|
|
25
|
+
for (const part of sql.split(STATEMENT_BREAKPOINT)) {
|
|
26
|
+
const target = uniqueTarget(part.trim());
|
|
27
|
+
const listed = columns.some(
|
|
28
|
+
(column) => column.table === target?.table && column.column === target?.column
|
|
29
|
+
);
|
|
30
|
+
if (target && listed) {
|
|
31
|
+
const leading = /^\s*/.exec(part)[0];
|
|
32
|
+
out.push(`${leading}${blankToNullStatement(target, dialect)}`, `
|
|
33
|
+
${part.trimStart()}`);
|
|
34
|
+
} else out.push(part);
|
|
35
|
+
}
|
|
36
|
+
return out.join(STATEMENT_BREAKPOINT);
|
|
37
|
+
}
|
|
38
|
+
export function migrationSqlFiles(dir) {
|
|
39
|
+
return existsSync(dir) ? readdirSync(dir).filter((file) => file.endsWith(".sql")) : [];
|
|
40
|
+
}
|
|
41
|
+
export function fixNewMigrations(dir, before, columns, dialect) {
|
|
42
|
+
const fixed = [];
|
|
43
|
+
if (!columns.length) return fixed;
|
|
44
|
+
for (const file of migrationSqlFiles(dir)) {
|
|
45
|
+
if (before.includes(file)) continue;
|
|
46
|
+
const path = join(dir, file);
|
|
47
|
+
const sql = readFileSync(path, "utf8");
|
|
48
|
+
const next = blankUniqueValuesToNull(sql, columns, dialect);
|
|
49
|
+
if (next === sql) continue;
|
|
50
|
+
writeFileSync(path, next);
|
|
51
|
+
fixed.push(file);
|
|
52
|
+
}
|
|
53
|
+
return fixed;
|
|
54
|
+
}
|
|
55
|
+
export const MIGRATION_FIXES_FILE = "migration-fixes.json";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { CmsI18n, FieldConfig } from './index.js';
|
|
3
|
+
import type { CmsClipboardNotice, CmsPasteResult } from './clipboard.js';
|
|
4
|
+
import type { CmsBlockValue } from './preview.js';
|
|
5
|
+
export declare const CMS_PRESET_KEY_PREFIX = "cms:presets:";
|
|
6
|
+
export declare const CMS_PRESET_NAME_MAX = 80;
|
|
7
|
+
export declare const CMS_PRESET_DESCRIPTION_MAX = 300;
|
|
8
|
+
export declare const CMS_PRESET_MAX_ITEMS = 100;
|
|
9
|
+
export declare const CMS_PRESET_MAX_BYTES = 1000000;
|
|
10
|
+
export declare const CMS_PRESET_MAX_COUNT = 500;
|
|
11
|
+
export type CmsPresetAction = 'use' | 'manage';
|
|
12
|
+
export declare function presetPermission(action: CmsPresetAction, entry: string): string;
|
|
13
|
+
export interface CmsBlockPreset {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
source: string;
|
|
18
|
+
types: string[];
|
|
19
|
+
signatures?: Record<string, string>;
|
|
20
|
+
items: CmsBlockValue[];
|
|
21
|
+
createdAt: string;
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const presetCreateSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
description: z.ZodOptional<z.ZodString>;
|
|
27
|
+
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export declare const presetUpdateSchema: z.ZodObject<{
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
description: z.ZodOptional<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export interface CmsPresetDetails {
|
|
34
|
+
name: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
}
|
|
37
|
+
export type CmsPresetCreate = z.infer<typeof presetCreateSchema>;
|
|
38
|
+
export type CmsPresetUpdate = z.infer<typeof presetUpdateSchema>;
|
|
39
|
+
export declare function presetKey(id: string): string;
|
|
40
|
+
export declare function presetTypes(items: readonly CmsBlockValue[]): string[];
|
|
41
|
+
export declare function presetFits(preset: Pick<CmsBlockPreset, 'types' | 'signatures' | 'source'>, field: Pick<FieldConfig, 'blocks'>, source: string): boolean;
|
|
42
|
+
export declare function presetSourceEntry(preset: Pick<CmsBlockPreset, 'source'>): string;
|
|
43
|
+
export declare function presetReadable(preset: Pick<CmsBlockPreset, 'source'>, canRead: (permission: string) => boolean): boolean;
|
|
44
|
+
export declare function parseStoredPreset(raw: string): CmsBlockPreset | null;
|
|
45
|
+
export declare function sortPresets(presets: readonly CmsBlockPreset[]): CmsBlockPreset[];
|
|
46
|
+
export type CmsPresetBuild = {
|
|
47
|
+
preset: CmsBlockPreset;
|
|
48
|
+
} | {
|
|
49
|
+
error: string;
|
|
50
|
+
};
|
|
51
|
+
export declare function buildPreset(input: CmsPresetCreate, field: Pick<FieldConfig, 'blocks'>, i18n: CmsI18n, meta: {
|
|
52
|
+
id: string;
|
|
53
|
+
source: string;
|
|
54
|
+
now: string;
|
|
55
|
+
}): CmsPresetBuild;
|
|
56
|
+
export declare function renamePreset(preset: CmsBlockPreset, input: CmsPresetUpdate, now: string): CmsBlockPreset;
|
|
57
|
+
export declare function presetBlockCount(count: number): string;
|
|
58
|
+
export declare function presetInsertNotice(result: CmsPasteResult, field: Pick<FieldConfig, 'max'>, preset: Pick<CmsBlockPreset, 'name'>): CmsClipboardNotice;
|
|
59
|
+
export declare const CMS_PRESET_PICKER_GROUP = "Presets";
|
|
60
|
+
export declare const CMS_PRESET_ICON = "bookmark";
|
|
61
|
+
export interface CmsPresetPickerItem {
|
|
62
|
+
id: string;
|
|
63
|
+
label: string;
|
|
64
|
+
description: string;
|
|
65
|
+
keywords: string[];
|
|
66
|
+
}
|
|
67
|
+
export declare function presetPickerItem(preset: CmsBlockPreset): CmsPresetPickerItem;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { pasteBlocks, skippedText } from "./clipboard.js";
|
|
3
|
+
import { blockSignature, blockSignatures } from "./block-signature.js";
|
|
4
|
+
export const CMS_PRESET_KEY_PREFIX = "cms:presets:";
|
|
5
|
+
export const CMS_PRESET_NAME_MAX = 80;
|
|
6
|
+
export const CMS_PRESET_DESCRIPTION_MAX = 300;
|
|
7
|
+
export const CMS_PRESET_MAX_ITEMS = 100;
|
|
8
|
+
export const CMS_PRESET_MAX_BYTES = 1e6;
|
|
9
|
+
export const CMS_PRESET_MAX_COUNT = 500;
|
|
10
|
+
export function presetPermission(action, entry) {
|
|
11
|
+
return action === "use" ? `${entry}.update` : "settings.manage";
|
|
12
|
+
}
|
|
13
|
+
const name = z.string().trim().min(1, "Give the preset a name").max(CMS_PRESET_NAME_MAX);
|
|
14
|
+
const description = z.string().trim().max(CMS_PRESET_DESCRIPTION_MAX);
|
|
15
|
+
const item = z.record(z.string(), z.unknown()).refine(
|
|
16
|
+
(value) => typeof value.type === "string" && value.type !== "",
|
|
17
|
+
"Every block needs a type"
|
|
18
|
+
);
|
|
19
|
+
export const presetCreateSchema = z.object({
|
|
20
|
+
name,
|
|
21
|
+
description: description.optional(),
|
|
22
|
+
items: z.array(item).min(1, "A preset needs at least one block").max(CMS_PRESET_MAX_ITEMS)
|
|
23
|
+
}).strict();
|
|
24
|
+
export const presetUpdateSchema = z.object({ name, description: description.optional() }).strict();
|
|
25
|
+
const storedSchema = z.object({
|
|
26
|
+
id: z.string().min(1),
|
|
27
|
+
name: z.string().min(1),
|
|
28
|
+
description: z.string().optional(),
|
|
29
|
+
source: z.string(),
|
|
30
|
+
types: z.array(z.string()),
|
|
31
|
+
signatures: z.record(z.string(), z.string()).optional(),
|
|
32
|
+
items: z.array(z.record(z.string(), z.unknown())),
|
|
33
|
+
createdAt: z.string(),
|
|
34
|
+
updatedAt: z.string()
|
|
35
|
+
});
|
|
36
|
+
export function presetKey(id) {
|
|
37
|
+
return `${CMS_PRESET_KEY_PREFIX}${id}`;
|
|
38
|
+
}
|
|
39
|
+
export function presetTypes(items) {
|
|
40
|
+
return [...new Set(items.map((value) => String(value.type)))].sort();
|
|
41
|
+
}
|
|
42
|
+
export function presetFits(preset, field, source) {
|
|
43
|
+
const blocks = field.blocks ?? {};
|
|
44
|
+
if (!preset.types.length || !preset.types.every((type) => Object.hasOwn(blocks, type)))
|
|
45
|
+
return false;
|
|
46
|
+
const signatures = preset.signatures;
|
|
47
|
+
if (!signatures) return preset.source === source;
|
|
48
|
+
return preset.types.every(
|
|
49
|
+
(type) => Object.hasOwn(signatures, type) && signatures[type] === blockSignature(blocks[type])
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
export function presetSourceEntry(preset) {
|
|
53
|
+
return preset.source.split(".")[0] ?? "";
|
|
54
|
+
}
|
|
55
|
+
export function presetReadable(preset, canRead) {
|
|
56
|
+
const entry = presetSourceEntry(preset);
|
|
57
|
+
return !!entry && canRead(`${entry}.read`);
|
|
58
|
+
}
|
|
59
|
+
export function parseStoredPreset(raw) {
|
|
60
|
+
try {
|
|
61
|
+
const parsed = storedSchema.safeParse(JSON.parse(raw));
|
|
62
|
+
if (!parsed.success) return null;
|
|
63
|
+
const { description: text, ...rest } = parsed.data;
|
|
64
|
+
return { ...rest, ...text ? { description: text } : {} };
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function sortPresets(presets) {
|
|
70
|
+
return [...presets].sort(
|
|
71
|
+
(a, b) => a.name.localeCompare(b.name, void 0, { sensitivity: "base" }) || a.createdAt.localeCompare(b.createdAt)
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
export function buildPreset(input, field, i18n, meta) {
|
|
75
|
+
const result = pasteBlocks([], 0, input.items, { blocks: field.blocks }, i18n);
|
|
76
|
+
if (result.unknown.length)
|
|
77
|
+
return {
|
|
78
|
+
error: `Not a block of this field: ${[...new Set(result.unknown)].join(", ")}`
|
|
79
|
+
};
|
|
80
|
+
const types = presetTypes(result.list);
|
|
81
|
+
const preset = {
|
|
82
|
+
id: meta.id,
|
|
83
|
+
name: input.name,
|
|
84
|
+
...input.description ? { description: input.description } : {},
|
|
85
|
+
source: meta.source,
|
|
86
|
+
types,
|
|
87
|
+
signatures: blockSignatures(field.blocks, types),
|
|
88
|
+
items: result.list,
|
|
89
|
+
createdAt: meta.now,
|
|
90
|
+
updatedAt: meta.now
|
|
91
|
+
};
|
|
92
|
+
if (JSON.stringify(preset).length > CMS_PRESET_MAX_BYTES)
|
|
93
|
+
return { error: "The preset is too large" };
|
|
94
|
+
return { preset };
|
|
95
|
+
}
|
|
96
|
+
export function renamePreset(preset, input, now) {
|
|
97
|
+
const { description: _description, ...rest } = preset;
|
|
98
|
+
return {
|
|
99
|
+
...rest,
|
|
100
|
+
name: input.name,
|
|
101
|
+
...input.description ? { description: input.description } : {},
|
|
102
|
+
updatedAt: now
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export function presetBlockCount(count) {
|
|
106
|
+
return `${count} ${count === 1 ? "block" : "blocks"}`;
|
|
107
|
+
}
|
|
108
|
+
export function presetInsertNotice(result, field, preset) {
|
|
109
|
+
const description2 = skippedText(result, field);
|
|
110
|
+
if (!result.pasted) return { title: "Nothing inserted", description: description2, color: "error" };
|
|
111
|
+
return {
|
|
112
|
+
title: `${preset.name} inserted`,
|
|
113
|
+
description: description2 ?? presetBlockCount(result.pasted),
|
|
114
|
+
color: description2 ? void 0 : "success"
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export const CMS_PRESET_PICKER_GROUP = "Presets";
|
|
118
|
+
export const CMS_PRESET_ICON = "bookmark";
|
|
119
|
+
export function presetPickerItem(preset) {
|
|
120
|
+
const count = presetBlockCount(preset.items.length);
|
|
121
|
+
return {
|
|
122
|
+
id: preset.id,
|
|
123
|
+
label: preset.name,
|
|
124
|
+
description: preset.description ? `${count} \xB7 ${preset.description}` : count,
|
|
125
|
+
keywords: [CMS_PRESET_PICKER_GROUP, ...preset.types]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const PREVIEW_QUERY_PARAM = "cms-preview";
|
|
2
|
+
export declare const PREVIEW_HEADER = "x-cms-preview";
|
|
3
|
+
export declare const PREVIEW_TOKEN_BYTES = 32;
|
|
4
|
+
export declare const PREVIEW_RESPONSE_HEADERS: {
|
|
5
|
+
readonly 'cache-control': "private, no-store";
|
|
6
|
+
readonly 'x-robots-tag': "noindex, nofollow";
|
|
7
|
+
readonly 'referrer-policy': "same-origin";
|
|
8
|
+
};
|
|
9
|
+
export declare const PREVIEW_LINK_DURATIONS: readonly [{
|
|
10
|
+
readonly value: "1h";
|
|
11
|
+
readonly label: "1 hour";
|
|
12
|
+
readonly ms: 3600000;
|
|
13
|
+
}, {
|
|
14
|
+
readonly value: "1d";
|
|
15
|
+
readonly label: "1 day";
|
|
16
|
+
readonly ms: number;
|
|
17
|
+
}, {
|
|
18
|
+
readonly value: "7d";
|
|
19
|
+
readonly label: "7 days";
|
|
20
|
+
readonly ms: number;
|
|
21
|
+
}, {
|
|
22
|
+
readonly value: "30d";
|
|
23
|
+
readonly label: "30 days";
|
|
24
|
+
readonly ms: number;
|
|
25
|
+
}];
|
|
26
|
+
export type CmsPreviewLinkDuration = (typeof PREVIEW_LINK_DURATIONS)[number]['value'];
|
|
27
|
+
export declare const DEFAULT_PREVIEW_LINK_DURATION: CmsPreviewLinkDuration;
|
|
28
|
+
export interface CmsPreviewLink {
|
|
29
|
+
id: string;
|
|
30
|
+
entry: string;
|
|
31
|
+
itemId: string;
|
|
32
|
+
locale: string | null;
|
|
33
|
+
path: string;
|
|
34
|
+
createdBy: string | null;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
expiresAt: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CmsCreatedPreviewLink {
|
|
39
|
+
link: CmsPreviewLink;
|
|
40
|
+
url: string;
|
|
41
|
+
}
|
|
42
|
+
export interface CmsPreviewGrant {
|
|
43
|
+
entry: string;
|
|
44
|
+
itemId: string;
|
|
45
|
+
expiresAt: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CmsPreviewMode {
|
|
48
|
+
entry: string;
|
|
49
|
+
id: string;
|
|
50
|
+
expiresAt: string;
|
|
51
|
+
}
|
|
52
|
+
export interface CmsPreviewLinkState {
|
|
53
|
+
expiresAt: string;
|
|
54
|
+
revokedAt: string | null;
|
|
55
|
+
}
|
|
56
|
+
export declare function isPreviewToken(value: unknown): value is string;
|
|
57
|
+
export declare function previewTokenFrom(value: unknown): string | null;
|
|
58
|
+
export declare function hasPreviewQuery(path: string): boolean;
|
|
59
|
+
export declare function isPreviewLinkDuration(value: unknown): value is CmsPreviewLinkDuration;
|
|
60
|
+
export declare function previewLinkExpiry(duration: CmsPreviewLinkDuration, now?: Date): string;
|
|
61
|
+
export declare function isPreviewLinkActive(link: CmsPreviewLinkState, now?: Date): boolean;
|
|
62
|
+
export declare function previewGrantAllows(grant: CmsPreviewGrant | null | undefined, entry: string, itemId?: string): boolean;
|
|
63
|
+
export declare function previewLinkUrl(path: string, token: string): string;
|
|
64
|
+
export declare function previewBannerErrors(banner: unknown): string[];
|