@basicbenframework/cms 0.0.0-stage → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +206 -2
- package/db/migrations/001_create_users.js +15 -0
- package/db/migrations/002_create_posts.js +18 -0
- package/db/migrations/003_create_categories.js +19 -0
- package/db/migrations/004_create_tags.js +16 -0
- package/db/migrations/005_create_post_tags.js +16 -0
- package/db/migrations/006_create_pages.js +26 -0
- package/db/migrations/007_create_comments.js +24 -0
- package/db/migrations/008_create_media.js +22 -0
- package/db/migrations/009_update_posts_blogging.js +27 -0
- package/db/migrations/010_create_settings.js +29 -0
- package/db/migrations/011_add_user_roles.js +23 -0
- package/db/migrations/012_create_auth_tokens.js +30 -0
- package/db/migrations/013_add_email_verified.js +24 -0
- package/db/migrations/014_create_user_two_factor.js +30 -0
- package/db/migrations/015_create_user_credentials.js +35 -0
- package/db/migrations/016_create_rate_limits.js +31 -0
- package/db/migrations/017_add_content_html.js +38 -0
- package/db/migrations/018_create_api_tokens.js +34 -0
- package/db/migrations/019_create_post_categories.js +40 -0
- package/db/migrations/020_add_author_profiles.js +60 -0
- package/db/migrations/021_add_page_featured_image.js +23 -0
- package/db/migrations/022_backfill_post_slugs_and_excerpts.js +57 -0
- package/db/migrations/023_add_user_session_controls.js +25 -0
- package/db/migrations/024_add_post_status_and_trash.js +45 -0
- package/db/migrations/025_add_social_and_indexing_fields.js +40 -0
- package/db/migrations/026_create_post_revisions.js +29 -0
- package/db/migrations/027_add_media_dimensions.js +19 -0
- package/db/migrations/028_create_navigation_menus.js +65 -0
- package/db/migrations/029_create_redirects.js +40 -0
- package/db/migrations/030_add_comment_status_and_notifications.js +53 -0
- package/db/migrations/031_create_post_locks.js +38 -0
- package/db/migrations/032_create_snippets.js +31 -0
- package/db/migrations/033_create_members.js +70 -0
- package/db/migrations/034_add_post_visibility.js +28 -0
- package/db/migrations/035_create_newsletters.js +72 -0
- package/db/migrations/036_create_analytics.js +89 -0
- package/db/migrations/037_create_ops_heartbeats.js +30 -0
- package/db/migrations/038_create_content_types.js +84 -0
- package/db/migrations/039_create_content_type_fields.js +47 -0
- package/db/migrations/040_create_taxonomies.js +80 -0
- package/db/migrations/041_add_newsletter_handoff.js +28 -0
- package/db/migrations/042_create_mysendbox_contacts.js +63 -0
- package/lib/cli/backup.d.mts +2 -0
- package/lib/cli/backup.mjs +124 -0
- package/lib/cli/export.d.mts +2 -0
- package/lib/cli/export.mjs +54 -0
- package/lib/cli/import-ghost.d.mts +2 -0
- package/lib/cli/import-ghost.mjs +50 -0
- package/lib/cli/import-json.d.mts +2 -0
- package/lib/cli/import-json.mjs +61 -0
- package/lib/cli/import-wordpress.d.mts +2 -0
- package/lib/cli/import-wordpress.mjs +169 -0
- package/lib/cli/import-wxr.d.mts +2 -0
- package/lib/cli/import-wxr.mjs +55 -0
- package/lib/cli/index.d.mts +2 -0
- package/lib/cli/index.mjs +53 -0
- package/lib/cli/lib/backup.d.mts +112 -0
- package/lib/cli/lib/backup.mjs +297 -0
- package/lib/cli/lib/ghost.d.mts +30 -0
- package/lib/cli/lib/ghost.mjs +201 -0
- package/lib/cli/lib/html-to-markdown.d.mts +61 -0
- package/lib/cli/lib/html-to-markdown.mjs +523 -0
- package/lib/cli/lib/import-common.d.mts +100 -0
- package/lib/cli/lib/import-common.mjs +252 -0
- package/lib/cli/lib/json-import.d.mts +22 -0
- package/lib/cli/lib/json-import.mjs +422 -0
- package/lib/cli/lib/site-import.d.mts +32 -0
- package/lib/cli/lib/site-import.mjs +456 -0
- package/lib/cli/lib/wordpress-rest.d.mts +25 -0
- package/lib/cli/lib/wordpress-rest.mjs +177 -0
- package/lib/cli/lib/wxr.d.mts +18 -0
- package/lib/cli/lib/wxr.mjs +307 -0
- package/lib/cli/lib/xml.d.mts +33 -0
- package/lib/cli/lib/xml.mjs +186 -0
- package/lib/cli/restore.d.mts +2 -0
- package/lib/cli/restore.mjs +98 -0
- package/lib/client/components/Alert.d.ts +7 -0
- package/lib/client/components/Alert.js +8 -0
- package/lib/client/components/Avatar.d.ts +15 -0
- package/lib/client/components/Avatar.js +10 -0
- package/lib/client/components/BackLink.d.ts +7 -0
- package/lib/client/components/BackLink.js +6 -0
- package/lib/client/components/Button.d.ts +7 -0
- package/lib/client/components/Button.js +12 -0
- package/lib/client/components/Card.d.ts +7 -0
- package/lib/client/components/Card.js +6 -0
- package/lib/client/components/CommentThread.d.ts +15 -0
- package/lib/client/components/CommentThread.js +101 -0
- package/lib/client/components/Empty.d.ts +6 -0
- package/lib/client/components/Empty.js +6 -0
- package/lib/client/components/Input.d.ts +6 -0
- package/lib/client/components/Input.js +6 -0
- package/lib/client/components/Link.d.ts +31 -0
- package/lib/client/components/Link.js +49 -0
- package/lib/client/components/Loading.d.ts +1 -0
- package/lib/client/components/Loading.js +6 -0
- package/lib/client/components/Logo.d.ts +5 -0
- package/lib/client/components/Logo.js +4 -0
- package/lib/client/components/MarkdownEditor.d.ts +41 -0
- package/lib/client/components/MarkdownEditor.js +156 -0
- package/lib/client/components/Nav/DarkModeToggle.d.ts +6 -0
- package/lib/client/components/Nav/DarkModeToggle.js +6 -0
- package/lib/client/components/Nav/DesktopNav.d.ts +8 -0
- package/lib/client/components/Nav/DesktopNav.js +9 -0
- package/lib/client/components/Nav/MobileNav.d.ts +9 -0
- package/lib/client/components/Nav/MobileNav.js +15 -0
- package/lib/client/components/NavLink.d.ts +8 -0
- package/lib/client/components/NavLink.js +6 -0
- package/lib/client/components/PageHeader.d.ts +8 -0
- package/lib/client/components/PageHeader.js +6 -0
- package/lib/client/components/PostCard.d.ts +8 -0
- package/lib/client/components/PostCard.js +7 -0
- package/lib/client/components/Textarea.d.ts +6 -0
- package/lib/client/components/Textarea.js +6 -0
- package/lib/client/components/ThemeContext.d.ts +18 -0
- package/lib/client/components/ThemeContext.js +8 -0
- package/lib/client/components/admin/AdminIcons.d.ts +13 -0
- package/lib/client/components/admin/AdminIcons.js +66 -0
- package/lib/client/components/admin/ContentModelPanels.d.ts +22 -0
- package/lib/client/components/admin/ContentModelPanels.js +93 -0
- package/lib/client/components/admin/FeaturedImageBox.d.ts +21 -0
- package/lib/client/components/admin/FeaturedImageBox.js +24 -0
- package/lib/client/components/admin/MediaGrid.d.ts +23 -0
- package/lib/client/components/admin/MediaGrid.js +69 -0
- package/lib/client/components/admin/MediaPicker.d.ts +17 -0
- package/lib/client/components/admin/MediaPicker.js +61 -0
- package/lib/client/components/admin/Pagination.d.ts +27 -0
- package/lib/client/components/admin/Pagination.js +29 -0
- package/lib/client/components/admin/SnippetPicker.d.ts +27 -0
- package/lib/client/components/admin/SnippetPicker.js +65 -0
- package/lib/client/components/admin/TermPicker.d.ts +52 -0
- package/lib/client/components/admin/TermPicker.js +58 -0
- package/lib/client/contexts/ToastContext.d.ts +12 -0
- package/lib/client/contexts/ToastContext.js +49 -0
- package/lib/client/features.d.ts +11 -0
- package/lib/client/features.js +7 -0
- package/lib/client/hooks/useContentTypes.d.ts +48 -0
- package/lib/client/hooks/useContentTypes.js +48 -0
- package/lib/client/hooks/useMediaLibrary.d.ts +46 -0
- package/lib/client/hooks/useMediaLibrary.js +189 -0
- package/lib/client/hooks/usePostLock.d.ts +32 -0
- package/lib/client/hooks/usePostLock.js +107 -0
- package/lib/client/host/index.d.ts +71 -0
- package/lib/client/host/index.js +58 -0
- package/lib/client/i18n/index.d.ts +79 -0
- package/lib/client/i18n/index.js +177 -0
- package/lib/client/i18n/locales/es/content.d.ts +4 -0
- package/lib/client/i18n/locales/es/content.js +220 -0
- package/lib/client/i18n/locales/es/editor.d.ts +9 -0
- package/lib/client/i18n/locales/es/editor.js +144 -0
- package/lib/client/i18n/locales/es/index.d.ts +8 -0
- package/lib/client/i18n/locales/es/index.js +7 -0
- package/lib/client/i18n/locales/es/layout.d.ts +4 -0
- package/lib/client/i18n/locales/es/layout.js +35 -0
- package/lib/client/i18n/locales/es/people.d.ts +4 -0
- package/lib/client/i18n/locales/es/people.js +187 -0
- package/lib/client/i18n/locales/es/site.d.ts +4 -0
- package/lib/client/i18n/locales/es/site.js +208 -0
- package/lib/client/layouts/AdminLayout.d.ts +7 -0
- package/lib/client/layouts/AdminLayout.js +1046 -0
- package/lib/client/layouts/AppLayout.d.ts +6 -0
- package/lib/client/layouts/AppLayout.js +19 -0
- package/lib/client/layouts/AuthLayout.d.ts +6 -0
- package/lib/client/layouts/AuthLayout.js +14 -0
- package/lib/client/layouts/DocsLayout.d.ts +6 -0
- package/lib/client/layouts/DocsLayout.js +28 -0
- package/lib/client/layouts/RootLayout.d.ts +6 -0
- package/lib/client/layouts/RootLayout.js +11 -0
- package/lib/client/pages/AcceptInvite.d.ts +8 -0
- package/lib/client/pages/AcceptInvite.js +60 -0
- package/lib/client/pages/Auth.d.ts +1 -0
- package/lib/client/pages/Auth.js +40 -0
- package/lib/client/pages/Authentication.d.ts +1 -0
- package/lib/client/pages/Authentication.js +230 -0
- package/lib/client/pages/Content.d.ts +1 -0
- package/lib/client/pages/Content.js +21 -0
- package/lib/client/pages/Database.d.ts +1 -0
- package/lib/client/pages/Database.js +264 -0
- package/lib/client/pages/Extending.d.ts +1 -0
- package/lib/client/pages/Extending.js +28 -0
- package/lib/client/pages/Feed.d.ts +1 -0
- package/lib/client/pages/Feed.js +19 -0
- package/lib/client/pages/FeedPost.d.ts +1 -0
- package/lib/client/pages/FeedPost.js +31 -0
- package/lib/client/pages/ForgotPassword.d.ts +8 -0
- package/lib/client/pages/ForgotPassword.js +38 -0
- package/lib/client/pages/GettingStarted.d.ts +1 -0
- package/lib/client/pages/GettingStarted.js +84 -0
- package/lib/client/pages/Headless.d.ts +1 -0
- package/lib/client/pages/Headless.js +49 -0
- package/lib/client/pages/Home.d.ts +1 -0
- package/lib/client/pages/Home.js +67 -0
- package/lib/client/pages/PostForm.d.ts +1 -0
- package/lib/client/pages/PostForm.js +55 -0
- package/lib/client/pages/Posts.d.ts +1 -0
- package/lib/client/pages/Posts.js +35 -0
- package/lib/client/pages/Profile.d.ts +1 -0
- package/lib/client/pages/Profile.js +153 -0
- package/lib/client/pages/ResetPassword.d.ts +8 -0
- package/lib/client/pages/ResetPassword.js +52 -0
- package/lib/client/pages/Routing.d.ts +1 -0
- package/lib/client/pages/Routing.js +192 -0
- package/lib/client/pages/Storage.d.ts +1 -0
- package/lib/client/pages/Storage.js +54 -0
- package/lib/client/pages/Testing.d.ts +1 -0
- package/lib/client/pages/Testing.js +141 -0
- package/lib/client/pages/Validation.d.ts +1 -0
- package/lib/client/pages/Validation.js +123 -0
- package/lib/client/pages/admin/Categories.d.ts +2 -0
- package/lib/client/pages/admin/Categories.js +75 -0
- package/lib/client/pages/admin/Comments.d.ts +11 -0
- package/lib/client/pages/admin/Comments.js +247 -0
- package/lib/client/pages/admin/ContentTypes.d.ts +2 -0
- package/lib/client/pages/admin/ContentTypes.js +163 -0
- package/lib/client/pages/admin/Dashboard.d.ts +2 -0
- package/lib/client/pages/admin/Dashboard.js +66 -0
- package/lib/client/pages/admin/Health.d.ts +12 -0
- package/lib/client/pages/admin/Health.js +148 -0
- package/lib/client/pages/admin/Media.d.ts +2 -0
- package/lib/client/pages/admin/Media.js +101 -0
- package/lib/client/pages/admin/Navigation.d.ts +9 -0
- package/lib/client/pages/admin/Navigation.js +230 -0
- package/lib/client/pages/admin/Pages.d.ts +2 -0
- package/lib/client/pages/admin/Pages.js +53 -0
- package/lib/client/pages/admin/PostEditor.d.ts +17 -0
- package/lib/client/pages/admin/PostEditor.js +532 -0
- package/lib/client/pages/admin/Posts.d.ts +2 -0
- package/lib/client/pages/admin/Posts.js +152 -0
- package/lib/client/pages/admin/Redirects.d.ts +10 -0
- package/lib/client/pages/admin/Redirects.js +87 -0
- package/lib/client/pages/admin/Settings.d.ts +2 -0
- package/lib/client/pages/admin/Settings.js +111 -0
- package/lib/client/pages/admin/Snippets.d.ts +14 -0
- package/lib/client/pages/admin/Snippets.js +85 -0
- package/lib/client/pages/admin/Tags.d.ts +2 -0
- package/lib/client/pages/admin/Tags.js +74 -0
- package/lib/client/pages/admin/Taxonomies.d.ts +2 -0
- package/lib/client/pages/admin/Taxonomies.js +130 -0
- package/lib/client/pages/admin/Tokens.d.ts +9 -0
- package/lib/client/pages/admin/Tokens.js +260 -0
- package/lib/client/pages/admin/Tools.d.ts +12 -0
- package/lib/client/pages/admin/Tools.js +111 -0
- package/lib/client/pages/admin/Users.d.ts +13 -0
- package/lib/client/pages/admin/Users.js +313 -0
- package/lib/client/pages/api-reference.d.ts +33 -0
- package/lib/client/pages/api-reference.js +198 -0
- package/lib/client/styles.css +37 -0
- package/lib/config.d.ts +24 -0
- package/lib/config.js +39 -0
- package/lib/controllers/AdminController.d.ts +46 -0
- package/lib/controllers/AdminController.js +134 -0
- package/lib/controllers/AuthController.d.ts +15 -0
- package/lib/controllers/AuthController.js +194 -0
- package/lib/controllers/AuthorController.d.ts +17 -0
- package/lib/controllers/AuthorController.js +19 -0
- package/lib/controllers/CategoryController.d.ts +10 -0
- package/lib/controllers/CategoryController.js +88 -0
- package/lib/controllers/CommentController.d.ts +68 -0
- package/lib/controllers/CommentController.js +438 -0
- package/lib/controllers/ContentTypeController.d.ts +24 -0
- package/lib/controllers/ContentTypeController.js +91 -0
- package/lib/controllers/EmailVerificationController.d.ts +33 -0
- package/lib/controllers/EmailVerificationController.js +116 -0
- package/lib/controllers/ExportController.d.ts +15 -0
- package/lib/controllers/ExportController.js +41 -0
- package/lib/controllers/FeedController.d.ts +14 -0
- package/lib/controllers/FeedController.js +246 -0
- package/lib/controllers/HealthController.d.ts +21 -0
- package/lib/controllers/HealthController.js +176 -0
- package/lib/controllers/HomeController.d.ts +12 -0
- package/lib/controllers/HomeController.js +16 -0
- package/lib/controllers/MediaController.d.ts +24 -0
- package/lib/controllers/MediaController.js +189 -0
- package/lib/controllers/NavigationController.d.ts +22 -0
- package/lib/controllers/NavigationController.js +176 -0
- package/lib/controllers/PageController.d.ts +13 -0
- package/lib/controllers/PageController.js +172 -0
- package/lib/controllers/PasskeyController.d.ts +36 -0
- package/lib/controllers/PasskeyController.js +201 -0
- package/lib/controllers/PasswordResetController.d.ts +44 -0
- package/lib/controllers/PasswordResetController.js +160 -0
- package/lib/controllers/PostController.d.ts +51 -0
- package/lib/controllers/PostController.js +538 -0
- package/lib/controllers/PostLockController.d.ts +62 -0
- package/lib/controllers/PostLockController.js +101 -0
- package/lib/controllers/ProfileController.d.ts +13 -0
- package/lib/controllers/ProfileController.js +160 -0
- package/lib/controllers/PublicApiController.d.ts +23 -0
- package/lib/controllers/PublicApiController.js +100 -0
- package/lib/controllers/RedirectController.d.ts +32 -0
- package/lib/controllers/RedirectController.js +95 -0
- package/lib/controllers/SettingsController.d.ts +28 -0
- package/lib/controllers/SettingsController.js +105 -0
- package/lib/controllers/SnippetController.d.ts +27 -0
- package/lib/controllers/SnippetController.js +123 -0
- package/lib/controllers/TagController.d.ts +9 -0
- package/lib/controllers/TagController.js +70 -0
- package/lib/controllers/TaxonomyController.d.ts +24 -0
- package/lib/controllers/TaxonomyController.js +149 -0
- package/lib/controllers/TokenController.d.ts +27 -0
- package/lib/controllers/TokenController.js +83 -0
- package/lib/controllers/TwoFactorController.d.ts +31 -0
- package/lib/controllers/TwoFactorController.js +213 -0
- package/lib/controllers/UserController.d.ts +110 -0
- package/lib/controllers/UserController.js +504 -0
- package/lib/features/analytics/AnalyticsPage.d.ts +11 -0
- package/lib/features/analytics/AnalyticsPage.js +123 -0
- package/lib/features/analytics/admin.d.ts +3 -0
- package/lib/features/analytics/admin.js +9 -0
- package/lib/features/analytics/controller.d.ts +19 -0
- package/lib/features/analytics/controller.js +79 -0
- package/lib/features/analytics/helpers.d.ts +84 -0
- package/lib/features/analytics/helpers.js +181 -0
- package/lib/features/analytics/i18n/es.d.ts +4 -0
- package/lib/features/analytics/i18n/es.js +31 -0
- package/lib/features/analytics/index.d.ts +28 -0
- package/lib/features/analytics/index.js +91 -0
- package/lib/features/analytics/manifest.d.ts +8 -0
- package/lib/features/analytics/manifest.js +18 -0
- package/lib/features/analytics/model.d.ts +130 -0
- package/lib/features/analytics/model.js +206 -0
- package/lib/features/members/Member.d.ts +93 -0
- package/lib/features/members/Member.js +194 -0
- package/lib/features/members/MemberAdminController.d.ts +60 -0
- package/lib/features/members/MemberAdminController.js +262 -0
- package/lib/features/members/MemberController.d.ts +88 -0
- package/lib/features/members/MemberController.js +250 -0
- package/lib/features/members/MembersPage.d.ts +10 -0
- package/lib/features/members/MembersPage.js +216 -0
- package/lib/features/members/PostAccessBox.d.ts +15 -0
- package/lib/features/members/PostAccessBox.js +70 -0
- package/lib/features/members/admin.d.ts +3 -0
- package/lib/features/members/admin.js +12 -0
- package/lib/features/members/csv.d.ts +21 -0
- package/lib/features/members/csv.js +74 -0
- package/lib/features/members/events.d.ts +34 -0
- package/lib/features/members/events.js +34 -0
- package/lib/features/members/i18n/es.d.ts +4 -0
- package/lib/features/members/i18n/es.js +106 -0
- package/lib/features/members/index.d.ts +44 -0
- package/lib/features/members/index.js +106 -0
- package/lib/features/members/manifest.d.ts +8 -0
- package/lib/features/members/manifest.js +18 -0
- package/lib/features/members/middleware.d.ts +42 -0
- package/lib/features/members/middleware.js +74 -0
- package/lib/features/members/newsletter.d.ts +177 -0
- package/lib/features/members/newsletter.js +439 -0
- package/lib/features/members/rate-limits.d.ts +34 -0
- package/lib/features/members/rate-limits.js +50 -0
- package/lib/features/members/request.d.ts +13 -0
- package/lib/features/members/request.js +6 -0
- package/lib/features/members/routes.d.ts +15 -0
- package/lib/features/members/routes.js +59 -0
- package/lib/features/members/session.d.ts +102 -0
- package/lib/features/members/session.js +158 -0
- package/lib/features/members/settings.d.ts +14 -0
- package/lib/features/members/settings.js +23 -0
- package/lib/features/mysendbox/MySendboxSettingsCard.d.ts +7 -0
- package/lib/features/mysendbox/MySendboxSettingsCard.js +48 -0
- package/lib/features/mysendbox/admin.d.ts +3 -0
- package/lib/features/mysendbox/admin.js +9 -0
- package/lib/features/mysendbox/broadcasts.d.ts +61 -0
- package/lib/features/mysendbox/broadcasts.js +124 -0
- package/lib/features/mysendbox/client.d.ts +95 -0
- package/lib/features/mysendbox/client.js +61 -0
- package/lib/features/mysendbox/config.d.ts +27 -0
- package/lib/features/mysendbox/config.js +74 -0
- package/lib/features/mysendbox/contacts.d.ts +121 -0
- package/lib/features/mysendbox/contacts.js +378 -0
- package/lib/features/mysendbox/controller.d.ts +11 -0
- package/lib/features/mysendbox/controller.js +47 -0
- package/lib/features/mysendbox/i18n/es.d.ts +4 -0
- package/lib/features/mysendbox/i18n/es.js +28 -0
- package/lib/features/mysendbox/index.d.ts +18 -0
- package/lib/features/mysendbox/index.js +71 -0
- package/lib/features/mysendbox/manifest.d.ts +7 -0
- package/lib/features/mysendbox/manifest.js +6 -0
- package/lib/features/mysendbox/routes.d.ts +6 -0
- package/lib/features/mysendbox/routes.js +14 -0
- package/lib/features/mysendbox/webhook.d.ts +23 -0
- package/lib/features/mysendbox/webhook.js +104 -0
- package/lib/features/theme/OEmbedController.d.ts +31 -0
- package/lib/features/theme/OEmbedController.js +128 -0
- package/lib/features/theme/ThemeController.d.ts +20 -0
- package/lib/features/theme/ThemeController.js +256 -0
- package/lib/features/theme/ThemeSettingsCard.d.ts +7 -0
- package/lib/features/theme/ThemeSettingsCard.js +12 -0
- package/lib/features/theme/admin.d.ts +3 -0
- package/lib/features/theme/admin.js +9 -0
- package/lib/features/theme/html.d.ts +48 -0
- package/lib/features/theme/html.js +97 -0
- package/lib/features/theme/i18n/es.d.ts +4 -0
- package/lib/features/theme/i18n/es.js +9 -0
- package/lib/features/theme/index.d.ts +11 -0
- package/lib/features/theme/index.js +23 -0
- package/lib/features/theme/manifest.d.ts +7 -0
- package/lib/features/theme/manifest.js +6 -0
- package/lib/features/theme/oembed.d.ts +36 -0
- package/lib/features/theme/oembed.js +58 -0
- package/lib/features/theme/routes.d.ts +17 -0
- package/lib/features/theme/routes.js +54 -0
- package/lib/features/theme/templates.d.ts +103 -0
- package/lib/features/theme/templates.js +283 -0
- package/lib/features.d.ts +15 -0
- package/lib/features.js +6 -0
- package/lib/features.manifest.d.ts +10 -0
- package/lib/features.manifest.js +6 -0
- package/lib/helpers/access.d.ts +62 -0
- package/lib/helpers/access.js +92 -0
- package/lib/helpers/api.d.ts +20 -0
- package/lib/helpers/api.js +44 -0
- package/lib/helpers/comment-guard.d.ts +145 -0
- package/lib/helpers/comment-guard.js +253 -0
- package/lib/helpers/comment-mail.d.ts +53 -0
- package/lib/helpers/comment-mail.js +188 -0
- package/lib/helpers/content-model.d.ts +50 -0
- package/lib/helpers/content-model.js +84 -0
- package/lib/helpers/content-paths.d.ts +107 -0
- package/lib/helpers/content-paths.js +200 -0
- package/lib/helpers/export-data.d.ts +85 -0
- package/lib/helpers/export-data.js +229 -0
- package/lib/helpers/gating.d.ts +53 -0
- package/lib/helpers/gating.js +83 -0
- package/lib/helpers/health.d.ts +91 -0
- package/lib/helpers/health.js +279 -0
- package/lib/helpers/heartbeat.d.ts +35 -0
- package/lib/helpers/heartbeat.js +55 -0
- package/lib/helpers/image-size.d.ts +18 -0
- package/lib/helpers/image-size.js +83 -0
- package/lib/helpers/images.d.ts +29 -0
- package/lib/helpers/images.js +41 -0
- package/lib/helpers/mail-templates.d.ts +11 -0
- package/lib/helpers/mail-templates.js +42 -0
- package/lib/helpers/publish-due.d.ts +28 -0
- package/lib/helpers/publish-due.js +67 -0
- package/lib/helpers/redirects.d.ts +43 -0
- package/lib/helpers/redirects.js +80 -0
- package/lib/helpers/seo-fields.d.ts +13 -0
- package/lib/helpers/seo-fields.js +52 -0
- package/lib/helpers/session.d.ts +30 -0
- package/lib/helpers/session.js +27 -0
- package/lib/helpers/site-settings.d.ts +98 -0
- package/lib/helpers/site-settings.js +232 -0
- package/lib/helpers/site.d.ts +14 -0
- package/lib/helpers/site.js +23 -0
- package/lib/helpers/write-hooks.d.ts +33 -0
- package/lib/helpers/write-hooks.js +37 -0
- package/lib/hooks.d.ts +17 -0
- package/lib/hooks.js +101 -0
- package/lib/host/core-tasks.d.ts +4 -0
- package/lib/host/core-tasks.js +26 -0
- package/lib/host/cron.d.ts +39 -0
- package/lib/host/cron.js +85 -0
- package/lib/host/enabled.d.ts +4 -0
- package/lib/host/enabled.js +40 -0
- package/lib/host/index.d.ts +81 -0
- package/lib/host/index.js +87 -0
- package/lib/host/manifest.d.ts +34 -0
- package/lib/host/manifest.js +7 -0
- package/lib/host/menu.d.ts +18 -0
- package/lib/host/menu.js +15 -0
- package/lib/main.d.ts +1 -0
- package/lib/main.js +24 -0
- package/lib/middleware/api-auth.d.ts +59 -0
- package/lib/middleware/api-auth.js +164 -0
- package/lib/middleware/auth.d.ts +49 -0
- package/lib/middleware/auth.js +112 -0
- package/lib/middleware/cache.d.ts +17 -0
- package/lib/middleware/cache.js +52 -0
- package/lib/middleware/rate-limits.d.ts +199 -0
- package/lib/middleware/rate-limits.js +276 -0
- package/lib/middleware/viewer.d.ts +13 -0
- package/lib/middleware/viewer.js +16 -0
- package/lib/models/Category.d.ts +24 -0
- package/lib/models/Category.js +102 -0
- package/lib/models/Comment.d.ts +120 -0
- package/lib/models/Comment.js +283 -0
- package/lib/models/ContentType.d.ts +142 -0
- package/lib/models/ContentType.js +462 -0
- package/lib/models/Credential.d.ts +21 -0
- package/lib/models/Credential.js +31 -0
- package/lib/models/Media.d.ts +53 -0
- package/lib/models/Media.js +132 -0
- package/lib/models/Menu.d.ts +131 -0
- package/lib/models/Menu.js +312 -0
- package/lib/models/Page.d.ts +55 -0
- package/lib/models/Page.js +218 -0
- package/lib/models/Post.d.ts +136 -0
- package/lib/models/Post.js +406 -0
- package/lib/models/PostLock.d.ts +67 -0
- package/lib/models/PostLock.js +112 -0
- package/lib/models/PostRevision.d.ts +45 -0
- package/lib/models/PostRevision.js +82 -0
- package/lib/models/PublicContent.d.ts +283 -0
- package/lib/models/PublicContent.js +577 -0
- package/lib/models/Redirect.d.ts +123 -0
- package/lib/models/Redirect.js +225 -0
- package/lib/models/Settings.d.ts +61 -0
- package/lib/models/Settings.js +128 -0
- package/lib/models/Snippet.d.ts +36 -0
- package/lib/models/Snippet.js +64 -0
- package/lib/models/Tag.d.ts +23 -0
- package/lib/models/Tag.js +117 -0
- package/lib/models/Taxonomy.d.ts +127 -0
- package/lib/models/Taxonomy.js +321 -0
- package/lib/models/TwoFactor.d.ts +26 -0
- package/lib/models/TwoFactor.js +60 -0
- package/lib/models/User.d.ts +49 -0
- package/lib/models/User.js +128 -0
- package/lib/models/derive.d.ts +69 -0
- package/lib/models/derive.js +81 -0
- package/lib/models/pagination.d.ts +30 -0
- package/lib/models/pagination.js +36 -0
- package/lib/models/visibility.d.ts +31 -0
- package/lib/models/visibility.js +47 -0
- package/lib/routes/App.d.ts +2 -0
- package/lib/routes/App.js +146 -0
- package/lib/routes/api/admin.d.ts +6 -0
- package/lib/routes/api/admin.js +11 -0
- package/lib/routes/api/auth.d.ts +6 -0
- package/lib/routes/api/auth.js +24 -0
- package/lib/routes/api/authors.d.ts +5 -0
- package/lib/routes/api/authors.js +8 -0
- package/lib/routes/api/categories.d.ts +8 -0
- package/lib/routes/api/categories.js +15 -0
- package/lib/routes/api/comments.d.ts +8 -0
- package/lib/routes/api/comments.js +35 -0
- package/lib/routes/api/content-model.d.ts +17 -0
- package/lib/routes/api/content-model.js +67 -0
- package/lib/routes/api/cron.d.ts +6 -0
- package/lib/routes/api/cron.js +9 -0
- package/lib/routes/api/export.d.ts +5 -0
- package/lib/routes/api/export.js +11 -0
- package/lib/routes/api/feed.d.ts +5 -0
- package/lib/routes/api/feed.js +16 -0
- package/lib/routes/api/media.d.ts +8 -0
- package/lib/routes/api/media.js +25 -0
- package/lib/routes/api/navigation.d.ts +12 -0
- package/lib/routes/api/navigation.js +17 -0
- package/lib/routes/api/ops.d.ts +9 -0
- package/lib/routes/api/ops.js +19 -0
- package/lib/routes/api/pages.d.ts +8 -0
- package/lib/routes/api/pages.js +21 -0
- package/lib/routes/api/passkeys.d.ts +7 -0
- package/lib/routes/api/passkeys.js +13 -0
- package/lib/routes/api/posts.d.ts +8 -0
- package/lib/routes/api/posts.js +39 -0
- package/lib/routes/api/profile.d.ts +6 -0
- package/lib/routes/api/profile.js +8 -0
- package/lib/routes/api/redirects.d.ts +12 -0
- package/lib/routes/api/redirects.js +13 -0
- package/lib/routes/api/settings.d.ts +8 -0
- package/lib/routes/api/settings.js +15 -0
- package/lib/routes/api/snippets.d.ts +15 -0
- package/lib/routes/api/snippets.js +16 -0
- package/lib/routes/api/tags.d.ts +8 -0
- package/lib/routes/api/tags.js +14 -0
- package/lib/routes/api/tokens.d.ts +7 -0
- package/lib/routes/api/tokens.js +15 -0
- package/lib/routes/api/two-factor.d.ts +7 -0
- package/lib/routes/api/two-factor.js +15 -0
- package/lib/routes/api/users.d.ts +8 -0
- package/lib/routes/api/users.js +25 -0
- package/lib/routes/api/v1.d.ts +12 -0
- package/lib/routes/api/v1.js +55 -0
- package/lib/routes/api/verification.d.ts +6 -0
- package/lib/routes/api/verification.js +11 -0
- package/lib/server/index.d.ts +24 -0
- package/lib/server/index.js +110 -0
- package/lib/types/index.d.ts +298 -0
- package/lib/types/index.js +1 -0
- package/lib/vite.d.ts +2 -0
- package/lib/vite.js +101 -0
- package/mail/comment-moderation.html +27 -0
- package/mail/comment-moderation.txt +13 -0
- package/mail/comment-reply.html +28 -0
- package/mail/comment-reply.txt +14 -0
- package/mail/invitation.html +25 -0
- package/mail/invitation.txt +11 -0
- package/mail/member-magic-link.html +23 -0
- package/mail/member-magic-link.txt +10 -0
- package/mail/newsletter.html +26 -0
- package/mail/newsletter.txt +13 -0
- package/mail/password-reset.html +26 -0
- package/mail/password-reset.txt +10 -0
- package/mail/verify-email.html +25 -0
- package/mail/verify-email.txt +8 -0
- package/package.json +85 -4
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { getDb, query } from '@basicbenframework/core/db';
|
|
2
|
+
import { parseStoredTimestamp } from "./visibility.js";
|
|
3
|
+
/** How many saved revisions a post keeps. The oldest beyond this are pruned. */
|
|
4
|
+
const KEEP = 50;
|
|
5
|
+
/**
|
|
6
|
+
* Revisions of a post.
|
|
7
|
+
*
|
|
8
|
+
* A revision is a copy of the post *before* a save changed it, so the newest
|
|
9
|
+
* revision plus the post itself is the whole history. Autosaves live in the
|
|
10
|
+
* same table, flagged, one per post and author: replaced on every autosave
|
|
11
|
+
* and cleared when the author saves for real.
|
|
12
|
+
*/
|
|
13
|
+
export const PostRevision = {
|
|
14
|
+
/** Record what a post said before a save, if the save changes it. */
|
|
15
|
+
async snapshot(before, after, userId) {
|
|
16
|
+
const changed = (after.title !== undefined && after.title !== before.title) ||
|
|
17
|
+
(after.content !== undefined && after.content !== before.content) ||
|
|
18
|
+
(after.excerpt !== undefined && (after.excerpt ?? null) !== (before.excerpt ?? null));
|
|
19
|
+
if (!changed)
|
|
20
|
+
return;
|
|
21
|
+
await (await query('post_revisions')).insert({
|
|
22
|
+
post_id: before.id,
|
|
23
|
+
user_id: userId,
|
|
24
|
+
title: before.title,
|
|
25
|
+
content: before.content,
|
|
26
|
+
excerpt: before.excerpt ?? null,
|
|
27
|
+
autosave: 0,
|
|
28
|
+
created_at: new Date().toISOString()
|
|
29
|
+
});
|
|
30
|
+
await this.prune(before.id);
|
|
31
|
+
},
|
|
32
|
+
async list(postId) {
|
|
33
|
+
const db = await getDb();
|
|
34
|
+
return db.all(`SELECT r.id, r.post_id, r.user_id, r.title, r.excerpt, r.autosave, r.created_at,
|
|
35
|
+
u.name AS author_name
|
|
36
|
+
FROM post_revisions r
|
|
37
|
+
LEFT JOIN users u ON u.id = r.user_id
|
|
38
|
+
WHERE r.post_id = ?
|
|
39
|
+
ORDER BY r.created_at DESC, r.id DESC`, [postId]);
|
|
40
|
+
},
|
|
41
|
+
async find(postId, id) {
|
|
42
|
+
const db = await getDb();
|
|
43
|
+
return db.get(`SELECT r.*, u.name AS author_name FROM post_revisions r
|
|
44
|
+
LEFT JOIN users u ON u.id = r.user_id
|
|
45
|
+
WHERE r.post_id = ? AND r.id = ?`, [postId, id]);
|
|
46
|
+
},
|
|
47
|
+
/** Replace this author's autosave of this post. */
|
|
48
|
+
async autosave(postId, userId, data) {
|
|
49
|
+
const db = await getDb();
|
|
50
|
+
await db.run('DELETE FROM post_revisions WHERE post_id = ? AND user_id = ? AND autosave = 1', [postId, userId]);
|
|
51
|
+
const result = await (await query('post_revisions')).insert({
|
|
52
|
+
post_id: postId,
|
|
53
|
+
user_id: userId,
|
|
54
|
+
title: data.title,
|
|
55
|
+
content: data.content,
|
|
56
|
+
excerpt: data.excerpt ?? null,
|
|
57
|
+
autosave: 1,
|
|
58
|
+
created_at: new Date().toISOString()
|
|
59
|
+
});
|
|
60
|
+
return this.find(postId, Number(result.lastInsertRowid));
|
|
61
|
+
},
|
|
62
|
+
/** An author's pending autosave of a post, if it is newer than the post. */
|
|
63
|
+
async pendingAutosave(postId, userId, postUpdatedAt) {
|
|
64
|
+
const db = await getDb();
|
|
65
|
+
const row = (await db.get('SELECT * FROM post_revisions WHERE post_id = ? AND user_id = ? AND autosave = 1', [postId, userId]));
|
|
66
|
+
if (!row)
|
|
67
|
+
return undefined;
|
|
68
|
+
return parseStoredTimestamp(row.created_at) > parseStoredTimestamp(postUpdatedAt) ? row : undefined;
|
|
69
|
+
},
|
|
70
|
+
async clearAutosave(postId, userId) {
|
|
71
|
+
const db = await getDb();
|
|
72
|
+
await db.run('DELETE FROM post_revisions WHERE post_id = ? AND user_id = ? AND autosave = 1', [postId, userId]);
|
|
73
|
+
},
|
|
74
|
+
/** Keep the newest KEEP saved revisions; autosaves are not counted. */
|
|
75
|
+
async prune(postId) {
|
|
76
|
+
const db = await getDb();
|
|
77
|
+
const rows = (await db.all('SELECT id FROM post_revisions WHERE post_id = ? AND autosave = 0 ORDER BY created_at DESC, id DESC', [postId]));
|
|
78
|
+
for (const row of rows.slice(KEEP)) {
|
|
79
|
+
await db.run('DELETE FROM post_revisions WHERE id = ?', [row.id]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queries for the public content API.
|
|
3
|
+
*
|
|
4
|
+
* Separate from the admin models on purpose. Every column reaching an anonymous
|
|
5
|
+
* or token-bearing reader is named here, so adding a column to `posts` cannot
|
|
6
|
+
* quietly publish it — which is exactly what `SELECT posts.*` plus a list of
|
|
7
|
+
* fields to strip would do. The admin models keep using `*`; they answer to a
|
|
8
|
+
* signed-in user whose role was already checked.
|
|
9
|
+
*
|
|
10
|
+
* Comments are absent from this surface deliberately: the table stores
|
|
11
|
+
* `author_email` for unauthenticated commenters, and a public feed of reader
|
|
12
|
+
* email addresses is a data-protection incident rather than a feature.
|
|
13
|
+
*/
|
|
14
|
+
import { type ResponsiveImage } from '../helpers/images.ts';
|
|
15
|
+
import { type Viewer } from '../helpers/access.ts';
|
|
16
|
+
export type ContentFormat = 'html' | 'markdown';
|
|
17
|
+
/**
|
|
18
|
+
* A post as the content API returns it.
|
|
19
|
+
*
|
|
20
|
+
* The field comments here are the API reference: `scripts/generate-api-reference.js`
|
|
21
|
+
* reads this file and emits the table the docs render, so the description a
|
|
22
|
+
* consumer sees is the one sitting next to the field. Writing that table by
|
|
23
|
+
* hand would make it a second place for the shape to drift, and prose drifts
|
|
24
|
+
* silently.
|
|
25
|
+
*/
|
|
26
|
+
export interface PublicPost {
|
|
27
|
+
/** Stable identifier. Accepted anywhere a slug is. */
|
|
28
|
+
id: number;
|
|
29
|
+
/** URL segment. Null on posts written before slugs existed. */
|
|
30
|
+
slug: string | null;
|
|
31
|
+
/** Plain text, never markup. */
|
|
32
|
+
title: string;
|
|
33
|
+
/** Short summary, if the author wrote one. */
|
|
34
|
+
excerpt: string | null;
|
|
35
|
+
/** The body, in whichever `format` this item reports. Null when `gated`: the site's access policy did not let this request read it (with the members feature, send a member session as `X-Member-Token`). */
|
|
36
|
+
content: string | null;
|
|
37
|
+
/** What `content` actually is — not what you asked for. See `?format=`. */
|
|
38
|
+
format: ContentFormat;
|
|
39
|
+
/** Who may read the body: `public`, or a level the site's access policy defines (the members feature: `members`, `paid`). */
|
|
40
|
+
visibility: string;
|
|
41
|
+
/** True when this response withholds the body because the request may not read it. */
|
|
42
|
+
gated: boolean;
|
|
43
|
+
/** Absolute URL of the featured image, or null. */
|
|
44
|
+
featured_image_url: string | null;
|
|
45
|
+
/** The author's display name. Never their address. */
|
|
46
|
+
author: string | null;
|
|
47
|
+
/** The author's profile — biography, link and avatar. Null if the account is gone. */
|
|
48
|
+
author_profile: {
|
|
49
|
+
id: number;
|
|
50
|
+
name: string;
|
|
51
|
+
slug: string | null;
|
|
52
|
+
bio: string | null;
|
|
53
|
+
website: string | null;
|
|
54
|
+
avatar_url: string | null;
|
|
55
|
+
} | null;
|
|
56
|
+
/** Every category on the post. Empty when uncategorised. */
|
|
57
|
+
categories: Array<{
|
|
58
|
+
id: number;
|
|
59
|
+
name: string;
|
|
60
|
+
slug: string;
|
|
61
|
+
}>;
|
|
62
|
+
/** Every tag on the post. Empty when untagged. */
|
|
63
|
+
tags: Array<{
|
|
64
|
+
id: number;
|
|
65
|
+
name: string;
|
|
66
|
+
slug: string;
|
|
67
|
+
}>;
|
|
68
|
+
/** Content type key: `post` for a blog post, or a custom type such as `recipe`. See `?type=` and `/api/v1/types`. */
|
|
69
|
+
type: string;
|
|
70
|
+
/** Custom field values keyed by field key, typed as the content type declares them. Empty when it has none; null when `gated`, like `content`. */
|
|
71
|
+
fields: Record<string, unknown> | null;
|
|
72
|
+
/** Custom taxonomy terms keyed by taxonomy key. Categories and tags stay in their own fields. */
|
|
73
|
+
terms: Record<string, Array<{
|
|
74
|
+
id: number;
|
|
75
|
+
name: string;
|
|
76
|
+
slug: string;
|
|
77
|
+
}>>;
|
|
78
|
+
/** SEO title override, if set. */
|
|
79
|
+
meta_title: string | null;
|
|
80
|
+
/** SEO description override, if set. */
|
|
81
|
+
meta_description: string | null;
|
|
82
|
+
/** The featured image with its dimensions, alt text and a srcset when IMAGE_TRANSFORM_URL is set. */
|
|
83
|
+
featured_image: ResponsiveImage | null;
|
|
84
|
+
/** Open Graph card: title, description and image, each falling back to the SEO fields, the excerpt and the featured image. */
|
|
85
|
+
og: SocialCard;
|
|
86
|
+
/** Twitter card, falling back to the Open Graph card. */
|
|
87
|
+
twitter: SocialCard;
|
|
88
|
+
/** Where this was first published, if somewhere else. Emit as rel=canonical. */
|
|
89
|
+
canonical_url: string | null;
|
|
90
|
+
/** True when the author asked search engines not to index this. Emit a robots noindex meta tag. */
|
|
91
|
+
noindex: boolean;
|
|
92
|
+
/** schema.org BlogPosting, ready to embed as application/ld+json. */
|
|
93
|
+
structured_data: Record<string, unknown>;
|
|
94
|
+
/** When it went live, ISO 8601. Posts are ordered by this, newest first. */
|
|
95
|
+
published_at: string;
|
|
96
|
+
/** When it last changed, ISO 8601. */
|
|
97
|
+
updated_at: string;
|
|
98
|
+
}
|
|
99
|
+
/** A social share card, with every fallback already applied. */
|
|
100
|
+
export interface SocialCard {
|
|
101
|
+
title: string;
|
|
102
|
+
description: string | null;
|
|
103
|
+
image_url: string | null;
|
|
104
|
+
}
|
|
105
|
+
/** Clamp paging so a consumer cannot ask for the whole table in one request. */
|
|
106
|
+
export declare function paging(query: Record<string, string>): {
|
|
107
|
+
page: number;
|
|
108
|
+
perPage: number;
|
|
109
|
+
offset: number;
|
|
110
|
+
};
|
|
111
|
+
/** `?format=markdown` returns the source; anything else returns rendered HTML. */
|
|
112
|
+
export declare function contentFormat(query: Record<string, string>): ContentFormat;
|
|
113
|
+
export declare const PublicContent: {
|
|
114
|
+
/**
|
|
115
|
+
* Published posts, newest first.
|
|
116
|
+
*
|
|
117
|
+
* Filtering happens in SQL rather than over the page that happened to load —
|
|
118
|
+
* filtering a page client-side gives an answer that depends on the page size,
|
|
119
|
+
* which is a bug that only shows up once there is enough content.
|
|
120
|
+
*/
|
|
121
|
+
posts(options?: {
|
|
122
|
+
page?: number;
|
|
123
|
+
perPage?: number;
|
|
124
|
+
offset?: number;
|
|
125
|
+
category?: string;
|
|
126
|
+
tag?: string;
|
|
127
|
+
author?: string;
|
|
128
|
+
search?: string;
|
|
129
|
+
format?: ContentFormat;
|
|
130
|
+
/** The reader, from `viewerOf(req)`; the access policy decides what it unlocks. */
|
|
131
|
+
viewer?: Viewer | null;
|
|
132
|
+
/** A content type key, or `any` for every public type. Defaults to `post`. */
|
|
133
|
+
type?: string;
|
|
134
|
+
/** Custom taxonomy filters, taxonomy key to term slug or id. */
|
|
135
|
+
taxonomy?: Record<string, string>;
|
|
136
|
+
}): Promise<{
|
|
137
|
+
posts: PublicPost[];
|
|
138
|
+
total: number;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* One published post, by slug or id.
|
|
142
|
+
*
|
|
143
|
+
* Slugs are nullable on posts — the column was added after the table — so a
|
|
144
|
+
* post that never got one is still reachable by id rather than invisible.
|
|
145
|
+
*/
|
|
146
|
+
post(identifier: string, format?: ContentFormat, { viewer, type }?: {
|
|
147
|
+
viewer?: Viewer | null;
|
|
148
|
+
type?: string;
|
|
149
|
+
}): Promise<PublicPost | null>;
|
|
150
|
+
/** Published pages, newest first. */
|
|
151
|
+
pages(options?: {
|
|
152
|
+
perPage?: number;
|
|
153
|
+
offset?: number;
|
|
154
|
+
format?: ContentFormat;
|
|
155
|
+
}): Promise<{
|
|
156
|
+
pages: PublicPage[];
|
|
157
|
+
total: number;
|
|
158
|
+
}>;
|
|
159
|
+
/** One published page, by slug or id. */
|
|
160
|
+
page(identifier: string, format?: ContentFormat): Promise<PublicPage | null>;
|
|
161
|
+
/**
|
|
162
|
+
* Every category, with how many published posts sit in it.
|
|
163
|
+
*
|
|
164
|
+
* Categories with no published posts are still listed, with a count of zero.
|
|
165
|
+
* A consumer building navigation wants the empty ones visible rather than
|
|
166
|
+
* having to discover them by fetching posts.
|
|
167
|
+
*/
|
|
168
|
+
categories(): Promise<PublicCategory[]>;
|
|
169
|
+
/** Tags with their published-post counts. */
|
|
170
|
+
tags(): Promise<PublicTag[]>;
|
|
171
|
+
/**
|
|
172
|
+
* Every author with something published, newest names first by post count.
|
|
173
|
+
*
|
|
174
|
+
* Only people who have published: an account with no posts is a user, not an
|
|
175
|
+
* author, and listing one exposes that the account exists to anyone who asks
|
|
176
|
+
* for the author index. Counts come from the same `published = 1` filter the
|
|
177
|
+
* post listing uses, so an archive link never leads to an empty page.
|
|
178
|
+
*/
|
|
179
|
+
authors(): Promise<PublicAuthor[]>;
|
|
180
|
+
/** One author, by slug or id. Null when they have published nothing. */
|
|
181
|
+
author(identifier: string): Promise<PublicAuthor | null>;
|
|
182
|
+
/** One media item. */
|
|
183
|
+
media(id: number): Promise<PublicMedia | null>;
|
|
184
|
+
};
|
|
185
|
+
/** A page as the content API returns it. A post without the blog machinery. */
|
|
186
|
+
export interface PublicPage {
|
|
187
|
+
/** Stable identifier. Accepted anywhere a slug is. */
|
|
188
|
+
id: number;
|
|
189
|
+
/** URL segment. Required on pages, unlike posts. */
|
|
190
|
+
slug: string;
|
|
191
|
+
/** Plain text, never markup. */
|
|
192
|
+
title: string;
|
|
193
|
+
/** The body, in whichever `format` this item reports. */
|
|
194
|
+
content: string;
|
|
195
|
+
/** What `content` actually is — not what you asked for. See `?format=`. */
|
|
196
|
+
format: ContentFormat;
|
|
197
|
+
/** Absolute URL of the featured image, or null. */
|
|
198
|
+
featured_image_url: string | null;
|
|
199
|
+
/** SEO title override, if set. */
|
|
200
|
+
meta_title: string | null;
|
|
201
|
+
/** SEO description override, if set. */
|
|
202
|
+
meta_description: string | null;
|
|
203
|
+
/** The featured image with its dimensions, alt text and a srcset when IMAGE_TRANSFORM_URL is set. */
|
|
204
|
+
featured_image: ResponsiveImage | null;
|
|
205
|
+
/** Open Graph card: title, description and image, each falling back to the SEO fields and the featured image. */
|
|
206
|
+
og: SocialCard;
|
|
207
|
+
/** Twitter card, falling back to the Open Graph card. */
|
|
208
|
+
twitter: SocialCard;
|
|
209
|
+
/** Where this was first published, if somewhere else. Emit as rel=canonical. */
|
|
210
|
+
canonical_url: string | null;
|
|
211
|
+
/** True when the author asked search engines not to index this. Emit a robots noindex meta tag. */
|
|
212
|
+
noindex: boolean;
|
|
213
|
+
/** When it was created, ISO 8601. */
|
|
214
|
+
published_at: string;
|
|
215
|
+
/** When it last changed, ISO 8601. */
|
|
216
|
+
updated_at: string;
|
|
217
|
+
}
|
|
218
|
+
/** A category, with how many published posts sit in it. */
|
|
219
|
+
export interface PublicCategory {
|
|
220
|
+
/** Stable identifier. */
|
|
221
|
+
id: number;
|
|
222
|
+
/** Display name. */
|
|
223
|
+
name: string;
|
|
224
|
+
/** URL segment. Accepted by `?category=`. */
|
|
225
|
+
slug: string;
|
|
226
|
+
/** Longer description, if one was written. */
|
|
227
|
+
description: string | null;
|
|
228
|
+
/** Published posts in this category. Zero is returned, not omitted. */
|
|
229
|
+
post_count: number;
|
|
230
|
+
}
|
|
231
|
+
/** A tag, with how many published posts carry it. */
|
|
232
|
+
export interface PublicTag {
|
|
233
|
+
/** Stable identifier. */
|
|
234
|
+
id: number;
|
|
235
|
+
/** Display name. */
|
|
236
|
+
name: string;
|
|
237
|
+
/** URL segment. Accepted by `?tag=`. */
|
|
238
|
+
slug: string;
|
|
239
|
+
/** Published posts carrying this tag. */
|
|
240
|
+
post_count: number;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* An author, as a byline and an archive page need them.
|
|
244
|
+
*
|
|
245
|
+
* The address, the role and everything else on the account stay behind the
|
|
246
|
+
* admin API. What is here is what a reader is meant to see.
|
|
247
|
+
*/
|
|
248
|
+
export interface PublicAuthor {
|
|
249
|
+
/** Stable identifier. Accepted anywhere a slug is. */
|
|
250
|
+
id: number;
|
|
251
|
+
/** Display name, as it appears on a byline. */
|
|
252
|
+
name: string;
|
|
253
|
+
/** URL segment for the author's archive. Accepted by `?author=`. */
|
|
254
|
+
slug: string | null;
|
|
255
|
+
/** The biography they wrote, if any. */
|
|
256
|
+
bio: string | null;
|
|
257
|
+
/** Their own site, if they gave one. */
|
|
258
|
+
website: string | null;
|
|
259
|
+
/** Absolute URL of their avatar, or null. */
|
|
260
|
+
avatar_url: string | null;
|
|
261
|
+
/** How many published posts they have. Never zero — unpublished authors are not listed. */
|
|
262
|
+
post_count: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A media item.
|
|
266
|
+
*
|
|
267
|
+
* `uploaded_by` and the original filename stay internal — a consumer needs the
|
|
268
|
+
* URL, the type and the alt text, not who uploaded it.
|
|
269
|
+
*/
|
|
270
|
+
export interface PublicMedia {
|
|
271
|
+
/** Stable identifier. */
|
|
272
|
+
id: number;
|
|
273
|
+
/** Absolute URL of the file. */
|
|
274
|
+
url: string;
|
|
275
|
+
/** MIME type as recorded at upload. */
|
|
276
|
+
mime_type: string;
|
|
277
|
+
/** Size in bytes. */
|
|
278
|
+
size: number;
|
|
279
|
+
/** Alt text, if an editor supplied one. */
|
|
280
|
+
alt_text: string | null;
|
|
281
|
+
/** When it was uploaded, ISO 8601. */
|
|
282
|
+
created_at: string;
|
|
283
|
+
}
|