studiocms 0.1.0-beta.10
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/CHANGELOG.md +501 -0
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/custom-renderers/index.ts +4 -0
- package/custom-renderers/markdocRenderers/markdocReact-components/MarkDocReactRenderer.tsx +8 -0
- package/custom-renderers/markdocRenderers/markdocReact-components/MarkDocReactWrapper.astro +13 -0
- package/custom-renderers/markdocRenderers/markdocReact.ts +56 -0
- package/dist/auth.d.js +0 -0
- package/dist/auth.d.ts +397 -0
- package/dist/cli/cmds/get-turso.d.ts +1 -0
- package/dist/cli/cmds/get-turso.js +10 -0
- package/dist/cli/cmds/init/index.d.ts +4 -0
- package/dist/cli/cmds/init/index.js +52 -0
- package/dist/cli/cmds/init/steps/data/studiocmsEnv.d.ts +3 -0
- package/dist/cli/cmds/init/steps/data/studiocmsEnv.js +71 -0
- package/dist/cli/cmds/init/steps/envBuilder.d.ts +21 -0
- package/dist/cli/cmds/init/steps/envBuilder.js +368 -0
- package/dist/cli/cmds/init/steps/nextSteps.d.ts +2 -0
- package/dist/cli/cmds/init/steps/nextSteps.js +38 -0
- package/dist/cli/cmds/init.d.ts +1 -0
- package/dist/cli/cmds/init.js +4 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +9 -0
- package/dist/cli/lib/commander.d.ts +39 -0
- package/dist/cli/lib/commander.js +87 -0
- package/dist/cli/lib/context.d.ts +28 -0
- package/dist/cli/lib/context.js +55 -0
- package/dist/cli/lib/pathUtil.d.ts +5 -0
- package/dist/cli/lib/pathUtil.js +14 -0
- package/dist/cli/lib/runExternal.d.ts +20 -0
- package/dist/cli/lib/runExternal.js +40 -0
- package/dist/cli/lib/seasonal.d.ts +5 -0
- package/dist/cli/lib/seasonal.js +88 -0
- package/dist/cli/lib/utils.d.ts +55 -0
- package/dist/cli/lib/utils.js +310 -0
- package/dist/cli/shared/intro.d.ts +2 -0
- package/dist/cli/shared/intro.js +24 -0
- package/dist/components/DefaultEditor.astro +138 -0
- package/dist/components/FormattedDate.astro +12 -0
- package/dist/components/Generator.astro +7 -0
- package/dist/components/Renderer.astro +13 -0
- package/dist/components/auth/OAuthButton.astro +21 -0
- package/dist/components/auth/OAuthButtonStack.astro +36 -0
- package/dist/components/auth/StaticAuthCheck.astro +20 -0
- package/dist/components/auth/StudioCMSLogoSVG.astro +13 -0
- package/dist/components/auth/oAuthButtonProviders.d.ts +8 -0
- package/dist/components/auth/oAuthButtonProviders.js +35 -0
- package/dist/components/dashboard/AstroCodeDiffsScript.astro +25 -0
- package/dist/components/dashboard/BaseHead.astro +41 -0
- package/dist/components/dashboard/Code.astro +23 -0
- package/dist/components/dashboard/DashboardPageHeader.astro +77 -0
- package/dist/components/dashboard/DoubleSidebar.astro +26 -0
- package/dist/components/dashboard/Footer.astro +16 -0
- package/dist/components/dashboard/MainSidebarContent.astro +317 -0
- package/dist/components/dashboard/PageHeader.astro +52 -0
- package/dist/components/dashboard/SidebarLink.astro +61 -0
- package/dist/components/dashboard/SidebarModals.astro +6 -0
- package/dist/components/dashboard/SidebarPluginLink.astro +45 -0
- package/dist/components/dashboard/SingleSidebar.astro +23 -0
- package/dist/components/dashboard/StudioCMSLogo.astro +12 -0
- package/dist/components/dashboard/ThemeManager.astro +53 -0
- package/dist/components/dashboard/component-scripts/TinyMDE.astro +6 -0
- package/dist/components/dashboard/component-scripts/dateTimeListener.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/dateTimeListener.js +14 -0
- package/dist/components/dashboard/component-scripts/dateWithTimeAndZone.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/dateWithTimeAndZone.js +12 -0
- package/dist/components/dashboard/component-scripts/makeClientRoutable.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/makeClientRoutable.js +9 -0
- package/dist/components/dashboard/component-scripts/timeAgo.d.ts +1 -0
- package/dist/components/dashboard/component-scripts/timeAgo.js +21 -0
- package/dist/components/dashboard/islands/LoginChecker.astro +52 -0
- package/dist/components/dashboard/islands/configuration/ConfigForm.astro +317 -0
- package/dist/components/dashboard/islands/configuration/LightVsDark.astro +67 -0
- package/dist/components/dashboard/islands/content-mgmt/CreateFolder.astro +118 -0
- package/dist/components/dashboard/islands/content-mgmt/CreatePage.astro +380 -0
- package/dist/components/dashboard/islands/content-mgmt/EditFolder.astro +138 -0
- package/dist/components/dashboard/islands/content-mgmt/EditPage.astro +432 -0
- package/dist/components/dashboard/islands/content-mgmt/InnerSidebarElement.astro +299 -0
- package/dist/components/dashboard/islands/content-mgmt/PageHeader.astro +455 -0
- package/dist/components/dashboard/islands/content-mgmt/PageList.astro +49 -0
- package/dist/components/dashboard/islands/content-mgmt/PluginFields.astro +29 -0
- package/dist/components/dashboard/islands/content-mgmt/TreeRenderer.astro +75 -0
- package/dist/components/dashboard/islands/content-mgmt/TreeSidebarFolder.astro +53 -0
- package/dist/components/dashboard/islands/content-mgmt/TreeSidebarLink.astro +51 -0
- package/dist/components/dashboard/islands/content-mgmt/runtime.d.ts +10 -0
- package/dist/components/dashboard/islands/content-mgmt/runtime.js +33 -0
- package/dist/components/dashboard/islands/content-mgmt/shared.d.ts +27 -0
- package/dist/components/dashboard/islands/content-mgmt/shared.js +31 -0
- package/dist/components/dashboard/islands/dashboard/DashboardGrid.astro +39 -0
- package/dist/components/dashboard/islands/dashboard/DashboardGridItem.astro +34 -0
- package/dist/components/dashboard/islands/dashboard/Test.astro +5 -0
- package/dist/components/dashboard/islands/dashboard/UserName.astro +6 -0
- package/dist/components/dashboard/islands/dashboard/shared.d.ts +2 -0
- package/dist/components/dashboard/islands/dashboard/shared.js +0 -0
- package/dist/components/dashboard/islands/plugins/SettingsRenderer.astro +29 -0
- package/dist/components/dashboard/islands/profile/APITokens.astro +306 -0
- package/dist/components/dashboard/islands/profile/BasicInfo.astro +140 -0
- package/dist/components/dashboard/islands/profile/BasicInfoFallback.astro +43 -0
- package/dist/components/dashboard/islands/profile/SocialSignin.astro +181 -0
- package/dist/components/dashboard/islands/profile/SocialSigninFallback.astro +83 -0
- package/dist/components/dashboard/islands/profile/UpdatePassword.astro +166 -0
- package/dist/components/dashboard/islands/profile/UpdatePasswordFallback.astro +47 -0
- package/dist/components/dashboard/islands/profile/oAuthButtonProviders.d.ts +8 -0
- package/dist/components/dashboard/islands/profile/oAuthButtonProviders.js +35 -0
- package/dist/components/dashboard/islands/sidebar/UserAccount.astro +23 -0
- package/dist/components/dashboard/islands/sidebar/VersionCheck.astro +127 -0
- package/dist/components/dashboard/islands/sidebar/VersionCheckChangelog.astro +107 -0
- package/dist/components/dashboard/islands/user-mgmt/InnerSidebarElement.astro +348 -0
- package/dist/components/dashboard/islands/user-mgmt/RankCheck.astro +49 -0
- package/dist/components/dashboard/islands/user-mgmt/SocialSignin.astro +109 -0
- package/dist/components/dashboard/islands/user-mgmt/UserListItem.astro +60 -0
- package/dist/components/dashboard/sidebar-modals/UserManagementModals.astro +103 -0
- package/dist/components/dashboard/sidebar-modals/VersionModal.astro +267 -0
- package/dist/components/dashboard/sidebarConfig.d.ts +32 -0
- package/dist/components/dashboard/sidebarConfig.js +88 -0
- package/dist/components/default-grid-items/Recently-created-pages.astro +91 -0
- package/dist/components/default-grid-items/Recently-signed-up.astro +71 -0
- package/dist/components/default-grid-items/Recently-updated-pages.astro +96 -0
- package/dist/components/default-grid-items/Totals.astro +107 -0
- package/dist/components/default-grid-items/utils.d.ts +17 -0
- package/dist/components/default-grid-items/utils.js +26 -0
- package/dist/components/image/CustomImage.astro +90 -0
- package/dist/components/user-quick-tools.d.ts +42 -0
- package/dist/components/user-quick-tools.js +312 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +4 -0
- package/dist/consts.d.ts +61 -0
- package/dist/consts.js +39 -0
- package/dist/core.d.js +0 -0
- package/dist/core.d.ts +226 -0
- package/dist/db/config.d.ts +4 -0
- package/dist/db/config.js +6 -0
- package/dist/db/tables.js +168 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.js +11 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +1179 -0
- package/dist/layouts/auth/AuthLayout.astro +74 -0
- package/dist/layouts/auth/FallbackCanvas.astro +123 -0
- package/dist/layouts/auth/ThemeManager.astro +53 -0
- package/dist/layouts/auth/ThreeCanvasLoader.astro +18 -0
- package/dist/layouts/dashboard/Layout.astro +64 -0
- package/dist/lib/auth/encryption.d.ts +30 -0
- package/dist/lib/auth/encryption.js +39 -0
- package/dist/lib/auth/password.d.ts +27 -0
- package/dist/lib/auth/password.js +42 -0
- package/dist/lib/auth/rate-limit.d.ts +136 -0
- package/dist/lib/auth/rate-limit.js +214 -0
- package/dist/lib/auth/session.d.ts +85 -0
- package/dist/lib/auth/session.js +93 -0
- package/dist/lib/auth/types.d.ts +83 -0
- package/dist/lib/auth/types.js +0 -0
- package/dist/lib/auth/user.d.ts +148 -0
- package/dist/lib/auth/user.js +133 -0
- package/dist/lib/dashboardGrid.d.ts +119 -0
- package/dist/lib/dashboardGrid.js +0 -0
- package/dist/lib/dynamic-sitemap/index.d.ts +42 -0
- package/dist/lib/dynamic-sitemap/index.js +45 -0
- package/dist/lib/dynamic-sitemap/sitemap-index.xml.d.ts +8 -0
- package/dist/lib/dynamic-sitemap/sitemap-index.xml.js +20 -0
- package/dist/lib/dynamic-sitemap/sitemap-index.xml.ts +45 -0
- package/dist/lib/head.d.ts +9 -0
- package/dist/lib/head.js +65 -0
- package/dist/lib/headDefaults.d.ts +18 -0
- package/dist/lib/headDefaults.js +75 -0
- package/dist/lib/i18n/LanguageSelector.astro +114 -0
- package/dist/lib/i18n/client.d.ts +591 -0
- package/dist/lib/i18n/client.js +83 -0
- package/dist/lib/i18n/config.d.ts +16 -0
- package/dist/lib/i18n/config.js +8 -0
- package/dist/lib/i18n/index.d.ts +578 -0
- package/dist/lib/i18n/index.js +63 -0
- package/dist/lib/i18n/translations/de.json +64 -0
- package/dist/lib/i18n/translations/en-us.json +238 -0
- package/dist/lib/i18n/translations/es.json +64 -0
- package/dist/lib/i18n/translations/fr.json +64 -0
- package/dist/lib/index.d.ts +7 -0
- package/dist/lib/index.js +7 -0
- package/dist/lib/jsonUtils.d.ts +2 -0
- package/dist/lib/jsonUtils.js +11 -0
- package/dist/lib/makeAPIRoute.d.ts +45 -0
- package/dist/lib/makeAPIRoute.js +16 -0
- package/dist/lib/makePublicRoute.d.ts +7 -0
- package/dist/lib/makePublicRoute.js +6 -0
- package/dist/lib/pathGenerators.d.ts +20 -0
- package/dist/lib/pathGenerators.js +66 -0
- package/dist/lib/plugins/dashboard-pages.d.ts +71 -0
- package/dist/lib/plugins/dashboard-pages.js +11 -0
- package/dist/lib/plugins/frontend-navigation.d.ts +18 -0
- package/dist/lib/plugins/frontend-navigation.js +39 -0
- package/dist/lib/plugins/index.d.ts +2 -0
- package/dist/lib/plugins/index.js +2 -0
- package/dist/lib/removeLeadingTrailingSlashes.d.ts +7 -0
- package/dist/lib/removeLeadingTrailingSlashes.js +13 -0
- package/dist/lib/renderer/astro-remark.d.ts +13 -0
- package/dist/lib/renderer/astro-remark.js +11 -0
- package/dist/lib/renderer/contentRenderer.d.ts +13 -0
- package/dist/lib/renderer/contentRenderer.js +31 -0
- package/dist/lib/renderer/errors.d.ts +5 -0
- package/dist/lib/renderer/errors.js +25 -0
- package/dist/lib/renderer/markdoc-renderers/markdocHTML.d.ts +3 -0
- package/dist/lib/renderer/markdoc-renderers/markdocHTML.js +14 -0
- package/dist/lib/renderer/markdoc-renderers/markdocReactStatic.d.ts +3 -0
- package/dist/lib/renderer/markdoc-renderers/markdocReactStatic.js +14 -0
- package/dist/lib/renderer/markdoc.d.ts +11 -0
- package/dist/lib/renderer/markdoc.js +28 -0
- package/dist/lib/renderer/mdx.d.ts +10 -0
- package/dist/lib/renderer/mdx.js +37 -0
- package/dist/lib/renderer/runtime.d.ts +8 -0
- package/dist/lib/renderer/runtime.js +30 -0
- package/dist/lib/renderer/shared.d.ts +15 -0
- package/dist/lib/renderer/shared.js +13 -0
- package/dist/lib/renderer/studiocms.d.ts +11 -0
- package/dist/lib/renderer/studiocms.js +22 -0
- package/dist/lib/renderer/types.d.ts +12 -0
- package/dist/lib/renderer/types.js +0 -0
- package/dist/lib/robots/core.d.ts +24 -0
- package/dist/lib/robots/core.js +187 -0
- package/dist/lib/robots/index.d.ts +11 -0
- package/dist/lib/robots/index.js +47 -0
- package/dist/lib/robots/types.d.ts +185 -0
- package/dist/lib/robots/types.js +0 -0
- package/dist/lib/robots/utils.d.ts +22 -0
- package/dist/lib/robots/utils.js +22 -0
- package/dist/lib/routeMap.d.ts +257 -0
- package/dist/lib/routeMap.js +249 -0
- package/dist/lib/urlGen.d.ts +11 -0
- package/dist/lib/urlGen.js +26 -0
- package/dist/lib/webVitals/checkForWebVitalsPlugin.d.ts +18 -0
- package/dist/lib/webVitals/checkForWebVitalsPlugin.js +82 -0
- package/dist/lib/webVitals/consts.d.ts +240 -0
- package/dist/lib/webVitals/consts.js +40 -0
- package/dist/lib/webVitals/dashboard-grid-items/CoreVitals.astro +66 -0
- package/dist/lib/webVitals/dashboard-grid-items/MetricCard.astro +24 -0
- package/dist/lib/webVitals/dashboard-grid-items/SummaryCard.astro +56 -0
- package/dist/lib/webVitals/dashboard-grid-items/metric.css +103 -0
- package/dist/lib/webVitals/dashboard-grid-items/shared.d.ts +29 -0
- package/dist/lib/webVitals/dashboard-grid-items/shared.js +35 -0
- package/dist/lib/webVitals/pages/analytics/body.astro +186 -0
- package/dist/lib/webVitals/pages/analytics/header.astro +42 -0
- package/dist/lib/webVitals/schemas.d.ts +78 -0
- package/dist/lib/webVitals/schemas.js +37 -0
- package/dist/lib/webVitals/types.d.ts +156 -0
- package/dist/lib/webVitals/types.js +0 -0
- package/dist/lib/webVitals/utils/buildDataObject.d.ts +8 -0
- package/dist/lib/webVitals/utils/buildDataObject.js +28 -0
- package/dist/lib/webVitals/utils/buildPageRouteDataObject.d.ts +15 -0
- package/dist/lib/webVitals/utils/buildPageRouteDataObject.js +70 -0
- package/dist/lib/webVitals/utils/buildPerPageDataObject.d.ts +23 -0
- package/dist/lib/webVitals/utils/buildPerPageDataObject.js +209 -0
- package/dist/lib/webVitals/utils/checkDate.d.ts +5 -0
- package/dist/lib/webVitals/utils/checkDate.js +19 -0
- package/dist/lib/webVitals/utils/webVitalsUtils.d.ts +24 -0
- package/dist/lib/webVitals/utils/webVitalsUtils.js +234 -0
- package/dist/lib/webVitals/webVital.d.ts +20 -0
- package/dist/lib/webVitals/webVital.js +40 -0
- package/dist/lib/webVitals/webVitalsRouteSummary.d.ts +19 -0
- package/dist/lib/webVitals/webVitalsRouteSummary.js +59 -0
- package/dist/lib/webVitals/webVitalsSummary.d.ts +19 -0
- package/dist/lib/webVitals/webVitalsSummary.js +49 -0
- package/dist/plugins.d.ts +2 -0
- package/dist/plugins.js +6 -0
- package/dist/renderer.d.js +0 -0
- package/dist/renderer.d.ts +23 -0
- package/dist/routes/api/render.astro +25 -0
- package/dist/routes/auth/api/auth0/callback.d.ts +4 -0
- package/dist/routes/auth/api/auth0/callback.js +117 -0
- package/dist/routes/auth/api/auth0/index.d.ts +4 -0
- package/dist/routes/auth/api/auth0/index.js +36 -0
- package/dist/routes/auth/api/auth0/shared.d.ts +13 -0
- package/dist/routes/auth/api/auth0/shared.js +24 -0
- package/dist/routes/auth/api/discord/callback.d.ts +4 -0
- package/dist/routes/auth/api/discord/callback.js +112 -0
- package/dist/routes/auth/api/discord/index.d.ts +4 -0
- package/dist/routes/auth/api/discord/index.js +36 -0
- package/dist/routes/auth/api/discord/shared.d.ts +12 -0
- package/dist/routes/auth/api/discord/shared.js +17 -0
- package/dist/routes/auth/api/github/callback.d.ts +4 -0
- package/dist/routes/auth/api/github/callback.js +112 -0
- package/dist/routes/auth/api/github/index.d.ts +4 -0
- package/dist/routes/auth/api/github/index.js +36 -0
- package/dist/routes/auth/api/github/shared.d.ts +13 -0
- package/dist/routes/auth/api/github/shared.js +14 -0
- package/dist/routes/auth/api/google/callback.d.ts +4 -0
- package/dist/routes/auth/api/google/callback.js +115 -0
- package/dist/routes/auth/api/google/index.d.ts +4 -0
- package/dist/routes/auth/api/google/index.js +38 -0
- package/dist/routes/auth/api/google/shared.d.ts +12 -0
- package/dist/routes/auth/api/google/shared.js +19 -0
- package/dist/routes/auth/api/login.d.ts +4 -0
- package/dist/routes/auth/api/login.js +46 -0
- package/dist/routes/auth/api/logout.d.ts +5 -0
- package/dist/routes/auth/api/logout.js +55 -0
- package/dist/routes/auth/api/register.d.ts +4 -0
- package/dist/routes/auth/api/register.js +64 -0
- package/dist/routes/auth/api/shared.d.ts +2 -0
- package/dist/routes/auth/api/shared.js +21 -0
- package/dist/routes/auth/login.astro +118 -0
- package/dist/routes/auth/logout.astro +28 -0
- package/dist/routes/auth/signup.astro +124 -0
- package/dist/routes/dashboard/[...pluginPage].astro +88 -0
- package/dist/routes/dashboard/configuration.astro +61 -0
- package/dist/routes/dashboard/content-management/createfolder.astro +83 -0
- package/dist/routes/dashboard/content-management/createpage.astro +86 -0
- package/dist/routes/dashboard/content-management/diff.astro +135 -0
- package/dist/routes/dashboard/content-management/editfolder.astro +67 -0
- package/dist/routes/dashboard/content-management/editpage.astro +71 -0
- package/dist/routes/dashboard/content-management/index.astro +91 -0
- package/dist/routes/dashboard/index.astro +56 -0
- package/dist/routes/dashboard/password-reset.astro +206 -0
- package/dist/routes/dashboard/plugins/[plugin].astro +104 -0
- package/dist/routes/dashboard/profile.astro +87 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/api-tokens.d.ts +5 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/api-tokens.js +90 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/config.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/config.js +63 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/folder.d.ts +6 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/folder.js +121 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/page.d.ts +6 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/content/page.js +258 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-reset-link.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-reset-link.js +59 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user-invite.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user-invite.js +105 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/create-user.js +100 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/partials/Editor.astro +61 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/partials/LiveRender.astro +30 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/partials/UserListItems.astro +39 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/plugins/[plugin].d.ts +2 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/plugins/[plugin].js +32 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/profile.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/profile.js +130 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/reset-password.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/reset-password.js +105 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/search-list.d.ts +4 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/search-list.js +55 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/users.d.ts +5 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/users.js +92 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/verify-session.d.ts +2 -0
- package/dist/routes/dashboard/studiocms_api/dashboard/verify-session.js +72 -0
- package/dist/routes/dashboard/user-management/edit.astro +631 -0
- package/dist/routes/dashboard/user-management/index.astro +103 -0
- package/dist/routes/error-pages/404.astro +66 -0
- package/dist/routes/firstTimeSetupRoutes/1-start.astro +253 -0
- package/dist/routes/firstTimeSetupRoutes/2-next.astro +208 -0
- package/dist/routes/firstTimeSetupRoutes/3-done.astro +95 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-1.d.ts +2 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-1.js +126 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-2.d.ts +2 -0
- package/dist/routes/firstTimeSetupRoutes/api/step-2.js +110 -0
- package/dist/routes/firstTimeSetupRoutes/components/Layout.astro +41 -0
- package/dist/routes/firstTimeSetupRoutes/components/PageHeader.astro +60 -0
- package/dist/routes/firstTimeSetupRoutes/components/TabItem.astro +44 -0
- package/dist/routes/firstTimeSetupRoutes/components/Tabs.astro +170 -0
- package/dist/routes/firstTimeSetupRoutes/snippets/opt1-astro.config.diff +14 -0
- package/dist/routes/firstTimeSetupRoutes/snippets/opt2-astro.config.diff +9 -0
- package/dist/routes/firstTimeSetupRoutes/snippets/opt2-studiocms.config.diff +5 -0
- package/dist/routes/rest/utils/auth-token.d.ts +17 -0
- package/dist/routes/rest/utils/auth-token.js +31 -0
- package/dist/routes/rest/v1/folders/[id].d.ts +6 -0
- package/dist/routes/rest/v1/folders/[id].js +106 -0
- package/dist/routes/rest/v1/folders/index.d.ts +5 -0
- package/dist/routes/rest/v1/folders/index.js +88 -0
- package/dist/routes/rest/v1/pages/[id]/history/[diffid].d.ts +4 -0
- package/dist/routes/rest/v1/pages/[id]/history/[diffid].js +55 -0
- package/dist/routes/rest/v1/pages/[id]/history/index.d.ts +4 -0
- package/dist/routes/rest/v1/pages/[id]/history/index.js +61 -0
- package/dist/routes/rest/v1/pages/[id]/index.d.ts +6 -0
- package/dist/routes/rest/v1/pages/[id]/index.js +165 -0
- package/dist/routes/rest/v1/pages/index.d.ts +5 -0
- package/dist/routes/rest/v1/pages/index.js +113 -0
- package/dist/routes/rest/v1/public/folders/[id].d.ts +4 -0
- package/dist/routes/rest/v1/public/folders/[id].js +43 -0
- package/dist/routes/rest/v1/public/folders/index.d.ts +4 -0
- package/dist/routes/rest/v1/public/folders/index.js +49 -0
- package/dist/routes/rest/v1/public/pages/[id].d.ts +4 -0
- package/dist/routes/rest/v1/public/pages/[id].js +46 -0
- package/dist/routes/rest/v1/public/pages/index.d.ts +4 -0
- package/dist/routes/rest/v1/public/pages/index.js +61 -0
- package/dist/routes/rest/v1/settings/index.d.ts +5 -0
- package/dist/routes/rest/v1/settings/index.js +75 -0
- package/dist/routes/rest/v1/users/[id].d.ts +6 -0
- package/dist/routes/rest/v1/users/[id].js +212 -0
- package/dist/routes/rest/v1/users/index.d.ts +5 -0
- package/dist/routes/rest/v1/users/index.js +138 -0
- package/dist/routes/sdk/fallback-list-pages.json.d.ts +2 -0
- package/dist/routes/sdk/fallback-list-pages.json.js +19 -0
- package/dist/routes/sdk/fallback-list-pages.json.ts +22 -0
- package/dist/routes/sdk/full-changelog.json.d.ts +16 -0
- package/dist/routes/sdk/full-changelog.json.js +170 -0
- package/dist/routes/sdk/full-changelog.json.ts +224 -0
- package/dist/routes/sdk/list-pages.d.ts +4 -0
- package/dist/routes/sdk/list-pages.js +34 -0
- package/dist/routes/sdk/update-latest-version-cache.d.ts +4 -0
- package/dist/routes/sdk/update-latest-version-cache.js +41 -0
- package/dist/runtime/AstroComponentProxy.d.ts +29 -0
- package/dist/runtime/AstroComponentProxy.js +47 -0
- package/dist/runtime/decoder/decode-codepoint.d.ts +18 -0
- package/dist/runtime/decoder/decode-codepoint.js +58 -0
- package/dist/runtime/decoder/decode-data-html.d.ts +1 -0
- package/dist/runtime/decoder/decode-data-html.js +7 -0
- package/dist/runtime/decoder/decode-data-xml.d.ts +1 -0
- package/dist/runtime/decoder/decode-data-xml.js +7 -0
- package/dist/runtime/decoder/index.d.ts +34 -0
- package/dist/runtime/decoder/index.js +18 -0
- package/dist/runtime/decoder/util.d.ts +208 -0
- package/dist/runtime/decoder/util.js +415 -0
- package/dist/schemas/config/auth.d.ts +175 -0
- package/dist/schemas/config/auth.js +65 -0
- package/dist/schemas/config/componentoverrides.d.ts +17 -0
- package/dist/schemas/config/componentoverrides.js +14 -0
- package/dist/schemas/config/dashboard.d.ts +154 -0
- package/dist/schemas/config/dashboard.js +59 -0
- package/dist/schemas/config/defaultFrontend.d.ts +125 -0
- package/dist/schemas/config/defaultFrontend.js +57 -0
- package/dist/schemas/config/developer.d.ts +15 -0
- package/dist/schemas/config/developer.js +14 -0
- package/dist/schemas/config/imageService.d.ts +13 -0
- package/dist/schemas/config/imageService.js +12 -0
- package/dist/schemas/config/index.d.ts +1153 -0
- package/dist/schemas/config/index.js +95 -0
- package/dist/schemas/config/integrations.d.ts +14 -0
- package/dist/schemas/config/integrations.js +12 -0
- package/dist/schemas/config/markdoc.d.ts +172 -0
- package/dist/schemas/config/markdoc.js +68 -0
- package/dist/schemas/config/mdx.d.ts +455 -0
- package/dist/schemas/config/mdx.js +71 -0
- package/dist/schemas/config/rendererConfig.d.ts +659 -0
- package/dist/schemas/config/rendererConfig.js +51 -0
- package/dist/schemas/config/sdk.d.ts +167 -0
- package/dist/schemas/config/sdk.js +85 -0
- package/dist/schemas/config/studiocms-markdown-remark.d.ts +292 -0
- package/dist/schemas/config/studiocms-markdown-remark.js +63 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/plugins/index.d.ts +7373 -0
- package/dist/schemas/plugins/index.js +192 -0
- package/dist/schemas/plugins/shared.d.ts +1752 -0
- package/dist/schemas/plugins/shared.js +221 -0
- package/dist/scripts/formListener.d.ts +16 -0
- package/dist/scripts/formListener.js +46 -0
- package/dist/scripts/three.d.ts +1 -0
- package/dist/scripts/three.js +278 -0
- package/dist/scripts/utils/fitModelToViewport.d.ts +8 -0
- package/dist/scripts/utils/fitModelToViewport.js +19 -0
- package/dist/sdk/StudioCMSVirtualCache.d.ts +283 -0
- package/dist/sdk/StudioCMSVirtualCache.js +685 -0
- package/dist/sdk/cache.d.ts +11 -0
- package/dist/sdk/cache.js +12 -0
- package/dist/sdk/core.d.ts +865 -0
- package/dist/sdk/core.js +1966 -0
- package/dist/sdk/errors.d.ts +21 -0
- package/dist/sdk/errors.js +11 -0
- package/dist/sdk/index.d.ts +371 -0
- package/dist/sdk/index.js +8 -0
- package/dist/sdk/lib/foldertree.d.ts +50 -0
- package/dist/sdk/lib/foldertree.js +123 -0
- package/dist/sdk/lib/generators.d.ts +30 -0
- package/dist/sdk/lib/generators.js +25 -0
- package/dist/sdk/lib/packages.d.ts +8 -0
- package/dist/sdk/lib/packages.js +14 -0
- package/dist/sdk/lib/parsers.d.ts +14 -0
- package/dist/sdk/lib/parsers.js +10 -0
- package/dist/sdk/lib/users.d.ts +19 -0
- package/dist/sdk/lib/users.js +26 -0
- package/dist/sdk/tables.d.ts +1198 -0
- package/dist/sdk/tables.js +55 -0
- package/dist/sdk/types/index.d.ts +175 -0
- package/dist/sdk/types/index.js +0 -0
- package/dist/sdk/types/tableDefs.d.ts +75 -0
- package/dist/sdk/types/tableDefs.js +0 -0
- package/dist/sdk/types/tsAlias.d.ts +155 -0
- package/dist/sdk/types/tsAlias.js +0 -0
- package/dist/sdk/utils/db.d.ts +5 -0
- package/dist/sdk/utils/db.js +15 -0
- package/dist/stubs/auth-lib.d.ts +2 -0
- package/dist/stubs/auth-lib.js +519 -0
- package/dist/stubs/auth-scripts.d.ts +2 -0
- package/dist/stubs/auth-scripts.js +29 -0
- package/dist/stubs/auth-utils.d.ts +2 -0
- package/dist/stubs/auth-utils.js +36 -0
- package/dist/stubs/changelog.d.ts +2 -0
- package/dist/stubs/changelog.js +16 -0
- package/dist/stubs/components.d.ts +2 -0
- package/dist/stubs/components.js +67 -0
- package/dist/stubs/core.d.ts +2 -0
- package/dist/stubs/core.js +49 -0
- package/dist/stubs/i18n-dts.d.ts +2 -0
- package/dist/stubs/i18n-dts.js +117 -0
- package/dist/stubs/images.d.ts +1 -0
- package/dist/stubs/images.js +30 -0
- package/dist/stubs/index.d.ts +1 -0
- package/dist/stubs/index.js +40 -0
- package/dist/stubs/lib.d.ts +2 -0
- package/dist/stubs/lib.js +123 -0
- package/dist/stubs/plugins.d.ts +2 -0
- package/dist/stubs/plugins.js +60 -0
- package/dist/stubs/proxy.d.ts +2 -0
- package/dist/stubs/proxy.js +40 -0
- package/dist/stubs/renderer-config.d.ts +2 -0
- package/dist/stubs/renderer-config.js +18 -0
- package/dist/stubs/renderer-markdownConfig.d.ts +2 -0
- package/dist/stubs/renderer-markdownConfig.js +17 -0
- package/dist/stubs/renderer.d.ts +2 -0
- package/dist/stubs/renderer.js +44 -0
- package/dist/stubs/sdk.d.ts +2 -0
- package/dist/stubs/sdk.js +202 -0
- package/dist/stubs/webVitals.d.ts +2 -0
- package/dist/stubs/webVitals.js +40 -0
- package/dist/styles/404.css +47 -0
- package/dist/styles/SyntaxFont.woff2 +0 -0
- package/dist/styles/authlayout.css +138 -0
- package/dist/styles/dashboard-base.css +493 -0
- package/dist/styles/dashboard-code.css +33 -0
- package/dist/styles/dashboard-diff.css +389 -0
- package/dist/styles/dashboard-tiny-mde.css +224 -0
- package/dist/styles/md-remark-callouts/github.css +56 -0
- package/dist/styles/md-remark-callouts/obsidian.css +66 -0
- package/dist/styles/md-remark-callouts/vitepress.css +58 -0
- package/dist/styles/md-remark-headings.css +48 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.js +0 -0
- package/dist/utils/addAPIRoutes.d.ts +9 -0
- package/dist/utils/addAPIRoutes.js +33 -0
- package/dist/utils/addIntegrationArray.d.ts +24 -0
- package/dist/utils/addIntegrationArray.js +11 -0
- package/dist/utils/addIntegrationArrayWithCheck.d.ts +11 -0
- package/dist/utils/addIntegrationArrayWithCheck.js +24 -0
- package/dist/utils/astroConfigCheck.d.ts +8 -0
- package/dist/utils/astroConfigCheck.js +31 -0
- package/dist/utils/astroEnvConfig.d.ts +45 -0
- package/dist/utils/astroEnvConfig.js +9 -0
- package/dist/utils/authEnvCheck.d.ts +38 -0
- package/dist/utils/authEnvCheck.js +82 -0
- package/dist/utils/changelog.d.ts +1 -0
- package/dist/utils/changelog.js +53 -0
- package/dist/utils/changelogLoader.d.ts +15 -0
- package/dist/utils/changelogLoader.js +104 -0
- package/dist/utils/checkENV.d.ts +27 -0
- package/dist/utils/checkENV.js +115 -0
- package/dist/utils/configManager.d.ts +22 -0
- package/dist/utils/configManager.js +98 -0
- package/dist/utils/configResolver.d.ts +283 -0
- package/dist/utils/configResolver.js +105 -0
- package/dist/utils/defineStudioCMSConfig.d.ts +165 -0
- package/dist/utils/defineStudioCMSConfig.js +6 -0
- package/dist/utils/getLabelForPermissionLevel.d.ts +2 -0
- package/dist/utils/getLabelForPermissionLevel.js +17 -0
- package/dist/utils/injectRouteArray.d.ts +19 -0
- package/dist/utils/injectRouteArray.js +75 -0
- package/dist/utils/integrationLogger.d.ts +7 -0
- package/dist/utils/integrationLogger.js +18 -0
- package/dist/utils/integrations.d.ts +4 -0
- package/dist/utils/integrations.js +32 -0
- package/dist/utils/isDashboardRoute.d.ts +7 -0
- package/dist/utils/isDashboardRoute.js +10 -0
- package/dist/utils/loginBackgrounds/studiocms-blobs-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blobs-light.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blocks-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-blocks-light.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-curves-dark.png +0 -0
- package/dist/utils/loginBackgrounds/studiocms-curves-light.png +0 -0
- package/dist/utils/makePageTitle.d.ts +3 -0
- package/dist/utils/makePageTitle.js +7 -0
- package/dist/utils/pageListPackageLabel.d.ts +4 -0
- package/dist/utils/pageListPackageLabel.js +12 -0
- package/dist/utils/readJson.d.ts +1 -0
- package/dist/utils/readJson.js +7 -0
- package/dist/utils/routeBuilder.d.ts +18 -0
- package/dist/utils/routeBuilder.js +96 -0
- package/dist/utils/safeString.d.ts +1 -0
- package/dist/utils/safeString.js +6 -0
- package/dist/utils/simpleResponse.d.ts +1 -0
- package/dist/utils/simpleResponse.js +29 -0
- package/dist/utils/validImages.d.ts +13 -0
- package/dist/utils/validImages.js +39 -0
- package/dist/virtual.d.js +0 -0
- package/dist/virtual.d.ts +9 -0
- package/package.json +219 -0
- package/studiocms-cli.mjs +13 -0
- package/ui.d.ts +291 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
function msToSeconds(ms) {
|
|
2
|
+
return ms / 1e3;
|
|
3
|
+
}
|
|
4
|
+
function calculateClsAverage(clsValues) {
|
|
5
|
+
const sum = clsValues.reduce((acc, curr) => acc + curr, 0);
|
|
6
|
+
const average = sum / clsValues.length;
|
|
7
|
+
return Math.round(average * 100) / 100;
|
|
8
|
+
}
|
|
9
|
+
const clsDataAverage = (webVitalData) => {
|
|
10
|
+
const clsData = [];
|
|
11
|
+
if (webVitalData) {
|
|
12
|
+
for (const item of webVitalData) {
|
|
13
|
+
if (item.name === "CLS") {
|
|
14
|
+
clsData.push(item.value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return calculateClsAverage(clsData);
|
|
19
|
+
};
|
|
20
|
+
function calculateClsScoreText(cls) {
|
|
21
|
+
if (cls <= 0.1) {
|
|
22
|
+
return "Excellent";
|
|
23
|
+
}
|
|
24
|
+
if (cls <= 0.25) {
|
|
25
|
+
return "Good";
|
|
26
|
+
}
|
|
27
|
+
if (cls <= 0.5) {
|
|
28
|
+
return "Fair";
|
|
29
|
+
}
|
|
30
|
+
return "Poor";
|
|
31
|
+
}
|
|
32
|
+
function calculateClsScorePercent(cls) {
|
|
33
|
+
if (cls <= 0.1) {
|
|
34
|
+
return 100;
|
|
35
|
+
}
|
|
36
|
+
if (cls <= 0.25) {
|
|
37
|
+
return Math.round(100 - (cls - 0.1) / (0.25 - 0.1) * 25);
|
|
38
|
+
}
|
|
39
|
+
if (cls <= 0.5) {
|
|
40
|
+
return Math.round(75 - (cls - 0.25) / (0.5 - 0.25) * 25);
|
|
41
|
+
}
|
|
42
|
+
return Math.round(50 - (cls - 0.5) / (1 - 0.5) * 50);
|
|
43
|
+
}
|
|
44
|
+
const progressBarClsColor = (clsData) => {
|
|
45
|
+
if (clsData <= 0.25) {
|
|
46
|
+
return "green";
|
|
47
|
+
}
|
|
48
|
+
if (clsData > 0.25 && clsData <= 0.5) {
|
|
49
|
+
return "yellow";
|
|
50
|
+
}
|
|
51
|
+
return "red";
|
|
52
|
+
};
|
|
53
|
+
const progressBarClsTrackColor = (clsData) => {
|
|
54
|
+
if (clsData <= 0.25) {
|
|
55
|
+
return "yellow";
|
|
56
|
+
}
|
|
57
|
+
if (clsData > 0.25) {
|
|
58
|
+
return "red";
|
|
59
|
+
}
|
|
60
|
+
return "red";
|
|
61
|
+
};
|
|
62
|
+
const clsTextColor = (clsData) => {
|
|
63
|
+
if (clsData <= 0.25) {
|
|
64
|
+
return "green";
|
|
65
|
+
}
|
|
66
|
+
if (clsData > 0.25 && clsData <= 0.5) {
|
|
67
|
+
return "yellow";
|
|
68
|
+
}
|
|
69
|
+
return "red";
|
|
70
|
+
};
|
|
71
|
+
function calculateLcpAverage(lcpValues) {
|
|
72
|
+
const sum = lcpValues.reduce((acc, curr) => acc + curr, 0);
|
|
73
|
+
const average = sum / lcpValues.length;
|
|
74
|
+
return Math.floor(Math.round(average * 100) / 100);
|
|
75
|
+
}
|
|
76
|
+
const lcpDataAverage = (webVitalData) => {
|
|
77
|
+
const lcpData = [];
|
|
78
|
+
if (webVitalData) {
|
|
79
|
+
for (const item of webVitalData) {
|
|
80
|
+
if (item.name === "LCP") {
|
|
81
|
+
lcpData.push(item.value);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return calculateLcpAverage(lcpData);
|
|
86
|
+
};
|
|
87
|
+
function calculateLcpScoreText(lcp) {
|
|
88
|
+
if (msToSeconds(lcp) <= 2) {
|
|
89
|
+
return "Excellent";
|
|
90
|
+
}
|
|
91
|
+
if (msToSeconds(lcp) <= 4) {
|
|
92
|
+
return "Good";
|
|
93
|
+
}
|
|
94
|
+
if (msToSeconds(lcp) <= 6) {
|
|
95
|
+
return "Fair";
|
|
96
|
+
}
|
|
97
|
+
return "Poor";
|
|
98
|
+
}
|
|
99
|
+
function calculateLcpScorePercent(lcp) {
|
|
100
|
+
if (msToSeconds(lcp) <= 2) {
|
|
101
|
+
return 100;
|
|
102
|
+
}
|
|
103
|
+
if (msToSeconds(lcp) <= 4) {
|
|
104
|
+
return Math.round(100 - (lcp - 2) / (4 - 2) * 50);
|
|
105
|
+
}
|
|
106
|
+
if (msToSeconds(lcp) <= 6) {
|
|
107
|
+
return Math.round(50 - (lcp - 4) / (6 - 4) * 50);
|
|
108
|
+
}
|
|
109
|
+
return Math.round(0 - (lcp - 6) / (10 - 6) * 50);
|
|
110
|
+
}
|
|
111
|
+
const progressBarLcpColor = (lcpData) => {
|
|
112
|
+
if (msToSeconds(lcpData) <= 2.5) {
|
|
113
|
+
return "green";
|
|
114
|
+
}
|
|
115
|
+
if (msToSeconds(lcpData) > 2.5 && lcpData <= 4) {
|
|
116
|
+
return "yellow";
|
|
117
|
+
}
|
|
118
|
+
return "red";
|
|
119
|
+
};
|
|
120
|
+
const progressBarLcpTrackColor = (lcpData) => {
|
|
121
|
+
if (msToSeconds(lcpData) <= 2.5) {
|
|
122
|
+
return "yellow";
|
|
123
|
+
}
|
|
124
|
+
if (msToSeconds(lcpData) > 2.5) {
|
|
125
|
+
return "red";
|
|
126
|
+
}
|
|
127
|
+
return "red";
|
|
128
|
+
};
|
|
129
|
+
const lcpTextColor = (lcpData) => {
|
|
130
|
+
if (msToSeconds(lcpData) <= 2.5) {
|
|
131
|
+
return "green";
|
|
132
|
+
}
|
|
133
|
+
if (msToSeconds(lcpData) > 2.5 && lcpData <= 4) {
|
|
134
|
+
return "yellow";
|
|
135
|
+
}
|
|
136
|
+
return "red";
|
|
137
|
+
};
|
|
138
|
+
function calculateInpAverage(inpValues) {
|
|
139
|
+
const sum = inpValues.reduce((acc, curr) => acc + curr, 0);
|
|
140
|
+
const average = sum / inpValues.length;
|
|
141
|
+
return Math.round(average * 100) / 100;
|
|
142
|
+
}
|
|
143
|
+
function inpDataAverage(webVitalData) {
|
|
144
|
+
const inpData = [];
|
|
145
|
+
if (webVitalData) {
|
|
146
|
+
for (const item of webVitalData) {
|
|
147
|
+
if (item.name === "INP") {
|
|
148
|
+
inpData.push(item.value);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return Math.floor(calculateInpAverage(inpData));
|
|
153
|
+
}
|
|
154
|
+
function calculateInpScoreText(inp) {
|
|
155
|
+
if (inp <= 50) {
|
|
156
|
+
return "Excellent";
|
|
157
|
+
}
|
|
158
|
+
if (inp <= 100) {
|
|
159
|
+
return "Good";
|
|
160
|
+
}
|
|
161
|
+
if (inp <= 200) {
|
|
162
|
+
return "Fair";
|
|
163
|
+
}
|
|
164
|
+
return "Poor";
|
|
165
|
+
}
|
|
166
|
+
function calculateInpScorePercent(inp) {
|
|
167
|
+
if (inp <= 50) {
|
|
168
|
+
return 100;
|
|
169
|
+
}
|
|
170
|
+
if (inp <= 100) {
|
|
171
|
+
return Math.round(100 - (inp - 50) / (100 - 50) * 50);
|
|
172
|
+
}
|
|
173
|
+
if (inp <= 200) {
|
|
174
|
+
return Math.round(50 - (inp - 100) / (200 - 100) * 50);
|
|
175
|
+
}
|
|
176
|
+
return Math.round(0 - (inp - 200) / (300 - 200) * 50);
|
|
177
|
+
}
|
|
178
|
+
const progressBarInpColor = (inpData) => {
|
|
179
|
+
if (inpData <= 100) {
|
|
180
|
+
return "green";
|
|
181
|
+
}
|
|
182
|
+
if (inpData > 100 && inpData <= 200) {
|
|
183
|
+
return "yellow";
|
|
184
|
+
}
|
|
185
|
+
return "red";
|
|
186
|
+
};
|
|
187
|
+
const progressBarInpTrackColor = (inpData) => {
|
|
188
|
+
if (inpData <= 100) {
|
|
189
|
+
return "yellow";
|
|
190
|
+
}
|
|
191
|
+
if (inpData > 100) {
|
|
192
|
+
return "red";
|
|
193
|
+
}
|
|
194
|
+
return "red";
|
|
195
|
+
};
|
|
196
|
+
const inpTextColor = (inpData) => {
|
|
197
|
+
if (inpData <= 100) {
|
|
198
|
+
return "green";
|
|
199
|
+
}
|
|
200
|
+
if (inpData > 100 && inpData <= 200) {
|
|
201
|
+
return "yellow";
|
|
202
|
+
}
|
|
203
|
+
return "red";
|
|
204
|
+
};
|
|
205
|
+
function generateLighthouseFetchUrl(url, strategy = "mobile") {
|
|
206
|
+
const baseUrl = "https://www.googleapis.com/pagespeedonline/v5/runPagespeed";
|
|
207
|
+
const fetchUrl = `${baseUrl}?url=${encodeURIComponent(url)}&fields=lighthouseResult%2Fcategories%2F*%2Fscore&prettyPrint=false&strategy=${strategy}&category=performance&category=pwa&category=best-practices&category=accessibility&category=seo`;
|
|
208
|
+
return fetchUrl;
|
|
209
|
+
}
|
|
210
|
+
export {
|
|
211
|
+
calculateClsAverage,
|
|
212
|
+
calculateClsScorePercent,
|
|
213
|
+
calculateClsScoreText,
|
|
214
|
+
calculateInpAverage,
|
|
215
|
+
calculateInpScorePercent,
|
|
216
|
+
calculateInpScoreText,
|
|
217
|
+
calculateLcpAverage,
|
|
218
|
+
calculateLcpScorePercent,
|
|
219
|
+
calculateLcpScoreText,
|
|
220
|
+
clsDataAverage,
|
|
221
|
+
clsTextColor,
|
|
222
|
+
generateLighthouseFetchUrl,
|
|
223
|
+
inpDataAverage,
|
|
224
|
+
inpTextColor,
|
|
225
|
+
lcpDataAverage,
|
|
226
|
+
lcpTextColor,
|
|
227
|
+
msToSeconds,
|
|
228
|
+
progressBarClsColor,
|
|
229
|
+
progressBarClsTrackColor,
|
|
230
|
+
progressBarInpColor,
|
|
231
|
+
progressBarInpTrackColor,
|
|
232
|
+
progressBarLcpColor,
|
|
233
|
+
progressBarLcpTrackColor
|
|
234
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GetWebVitalsData, IntermediateWebVitalsRouteSummary, MetricStats, WebVitalsMetricSummary, WebVitalsResponseItem, WebVitalsRouteSummary, WebVitalsSummary } from './types.js';
|
|
2
|
+
export type { WebVitalsResponseItem, IntermediateWebVitalsRouteSummary, MetricStats, WebVitalsMetricSummary, WebVitalsRouteSummary, WebVitalsSummary, GetWebVitalsData, };
|
|
3
|
+
/**
|
|
4
|
+
* Fetches web vitals data from the Astro database.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Promise<GetWebVitalsData>} A promise that resolves to an object containing web vitals data.
|
|
7
|
+
*
|
|
8
|
+
* The returned object contains the following properties:
|
|
9
|
+
* - `raw`: The raw web vitals data.
|
|
10
|
+
* - `routeSummary`: A summary of web vitals data by route.
|
|
11
|
+
* - `summary`: A general summary of web vitals data.
|
|
12
|
+
* - `twentyFourHours`: An object containing web vitals data for the last 24 hours, with `summary` and `routeSummary` properties.
|
|
13
|
+
* - `sevenDays`: An object containing web vitals data for the last 7 days, with `summary` and `routeSummary` properties.
|
|
14
|
+
* - `thirtyDays`: An object containing web vitals data for the last 30 days, with `summary` and `routeSummary` properties.
|
|
15
|
+
*
|
|
16
|
+
* If the web vitals metric table is not found in the Astro database, or if an error occurs, an empty return object is returned.
|
|
17
|
+
*
|
|
18
|
+
* @throws {Error} If there is an issue with fetching or processing the web vitals data.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getWebVitals(): Promise<GetWebVitalsData>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import studioCMS_SDK from "studiocms:sdk";
|
|
2
|
+
import { EmptyReturn, WEB_VITALS_METRIC_TABLE, tsMetric } from "./consts.js";
|
|
3
|
+
import { checkDate } from "./utils/checkDate.js";
|
|
4
|
+
import { processWebVitalsRouteSummary } from "./webVitalsRouteSummary.js";
|
|
5
|
+
import { processWebVitalsSummary } from "./webVitalsSummary.js";
|
|
6
|
+
async function getWebVitals() {
|
|
7
|
+
try {
|
|
8
|
+
const AstroDB = await import("astro:db");
|
|
9
|
+
if (WEB_VITALS_METRIC_TABLE in AstroDB) {
|
|
10
|
+
if (AstroDB.AstrojsWebVitals_Metric) {
|
|
11
|
+
const raw = await studioCMS_SDK.db.select().from(tsMetric);
|
|
12
|
+
const last24HoursData = raw.filter((item) => checkDate(item.timestamp).isInLast24Hours());
|
|
13
|
+
const last7DaysData = raw.filter((item) => checkDate(item.timestamp).isInLast7Days());
|
|
14
|
+
const last30DaysData = raw.filter((item) => checkDate(item.timestamp).isInLast30Days());
|
|
15
|
+
const routeSummary = processWebVitalsRouteSummary(raw);
|
|
16
|
+
const summary = processWebVitalsSummary(raw);
|
|
17
|
+
const twentyFourHours = {
|
|
18
|
+
summary: processWebVitalsSummary(last24HoursData),
|
|
19
|
+
routeSummary: processWebVitalsRouteSummary(last24HoursData)
|
|
20
|
+
};
|
|
21
|
+
const sevenDays = {
|
|
22
|
+
summary: processWebVitalsSummary(last7DaysData),
|
|
23
|
+
routeSummary: processWebVitalsRouteSummary(last7DaysData)
|
|
24
|
+
};
|
|
25
|
+
const thirtyDays = {
|
|
26
|
+
summary: processWebVitalsSummary(last30DaysData),
|
|
27
|
+
routeSummary: processWebVitalsRouteSummary(last30DaysData)
|
|
28
|
+
};
|
|
29
|
+
return { raw, routeSummary, summary, twentyFourHours, sevenDays, thirtyDays };
|
|
30
|
+
}
|
|
31
|
+
return EmptyReturn;
|
|
32
|
+
}
|
|
33
|
+
return EmptyReturn;
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return EmptyReturn;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
getWebVitals
|
|
40
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WebVitalsResponseItem, WebVitalsRouteSummary } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Processes an array of Web Vitals response items and returns a summary of web vitals for each route.
|
|
4
|
+
*
|
|
5
|
+
* @param data - An array of WebVitalsResponseItem objects representing the web vitals data.
|
|
6
|
+
* @returns An array of WebVitalsRouteSummary objects summarizing the web vitals for each route.
|
|
7
|
+
*
|
|
8
|
+
* The function performs the following steps:
|
|
9
|
+
* 1. Groups the data by route and name.
|
|
10
|
+
* 2. Processes each group separately, ensuring the sample size is at least 4.
|
|
11
|
+
* 3. Sorts the metrics within each group by rating and value.
|
|
12
|
+
* 4. Assigns quartiles to the metrics using NTILE(4) logic.
|
|
13
|
+
* 5. Identifies the end of each quartile.
|
|
14
|
+
* 6. Selects only the metrics in quartile 3 where quartile_end is true.
|
|
15
|
+
* 7. Converts the selected metrics into WebVitalsRouteSummary structures.
|
|
16
|
+
*
|
|
17
|
+
* The resulting summaries include the route, whether the route passes core web vitals, the metrics for LCP, CLS, and INP, and a score.
|
|
18
|
+
*/
|
|
19
|
+
export declare function processWebVitalsRouteSummary(data: WebVitalsResponseItem[]): WebVitalsRouteSummary[];
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function processWebVitalsRouteSummary(data) {
|
|
2
|
+
const grouped = data.reduce(
|
|
3
|
+
(acc, item) => {
|
|
4
|
+
const key = `${item.route}-${item.name}`;
|
|
5
|
+
if (!acc[key]) acc[key] = [];
|
|
6
|
+
acc[key].push(item);
|
|
7
|
+
return acc;
|
|
8
|
+
},
|
|
9
|
+
{}
|
|
10
|
+
);
|
|
11
|
+
const results = [];
|
|
12
|
+
for (const metrics of Object.values(grouped)) {
|
|
13
|
+
if (metrics.length < 4) continue;
|
|
14
|
+
metrics.sort((a, b) => a.rating.localeCompare(b.rating) || a.value - b.value);
|
|
15
|
+
const quartileSize = Math.ceil(metrics.length / 4);
|
|
16
|
+
metrics.forEach((metric, index) => {
|
|
17
|
+
metric.quartile = Math.floor(index / quartileSize) + 1;
|
|
18
|
+
});
|
|
19
|
+
metrics.forEach((metric, index, arr) => {
|
|
20
|
+
const nextItem = arr[index + 1];
|
|
21
|
+
metric.quartile_end = !nextItem || nextItem.quartile !== metric.quartile;
|
|
22
|
+
});
|
|
23
|
+
results.push(...metrics.filter((metric) => metric.quartile === 3 && metric.quartile_end));
|
|
24
|
+
}
|
|
25
|
+
const summaries = {};
|
|
26
|
+
for (const item of results) {
|
|
27
|
+
const { route, name, rating, value } = item;
|
|
28
|
+
const routeSummary = summaries[route] ||= {
|
|
29
|
+
route,
|
|
30
|
+
passingCoreWebVitals: true,
|
|
31
|
+
metrics: {},
|
|
32
|
+
score: 0
|
|
33
|
+
};
|
|
34
|
+
routeSummary.metrics[name] = {
|
|
35
|
+
rating,
|
|
36
|
+
value,
|
|
37
|
+
sampleSize: results.length
|
|
38
|
+
};
|
|
39
|
+
if (["LCP", "CLS", "INP"].includes(name) && rating !== "good") {
|
|
40
|
+
routeSummary.passingCoreWebVitals = false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return Object.values(summaries).filter(
|
|
44
|
+
(route) => Boolean(route.metrics.CLS && route.metrics.LCP && route.metrics.INP)
|
|
45
|
+
).map((route) => ({
|
|
46
|
+
...route,
|
|
47
|
+
score: simpleScore(
|
|
48
|
+
route.metrics.LCP.rating,
|
|
49
|
+
route.metrics.CLS.rating,
|
|
50
|
+
route.metrics.INP.rating
|
|
51
|
+
)
|
|
52
|
+
})).sort((a, b) => a.score - b.score);
|
|
53
|
+
}
|
|
54
|
+
const weighting = { LCP: 0.4, CLS: 0.3, INP: 0.3 };
|
|
55
|
+
const scoring = { good: 1, "needs-improvement": 0.5, poor: 0 };
|
|
56
|
+
const simpleScore = (lcpRating, clsRating, inpRating) => scoring[lcpRating] * weighting.LCP + scoring[clsRating] * weighting.CLS + scoring[inpRating] * weighting.INP;
|
|
57
|
+
export {
|
|
58
|
+
processWebVitalsRouteSummary
|
|
59
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WebVitalsResponseItem, WebVitalsSummary } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Processes an array of web vitals response items and generates a summary.
|
|
4
|
+
*
|
|
5
|
+
* @param data - An array of `WebVitalsResponseItem` objects to be processed.
|
|
6
|
+
* @returns A `WebVitalsSummary` object containing the processed summary.
|
|
7
|
+
*
|
|
8
|
+
* The function performs the following steps:
|
|
9
|
+
* 1. Groups the input data by the `name` property.
|
|
10
|
+
* 2. Processes each metric group separately.
|
|
11
|
+
* 3. Sorts the metrics within each group by `rating` and `value`.
|
|
12
|
+
* 4. Assigns quartiles to each metric.
|
|
13
|
+
* 5. Identifies the end of each rating group.
|
|
14
|
+
* 6. Computes the sample size for each metric group.
|
|
15
|
+
* 7. Computes histogram densities for each rating.
|
|
16
|
+
* 8. Computes the 75th percentile (P75) for each metric group.
|
|
17
|
+
* 9. Filters the final results based on specific conditions.
|
|
18
|
+
*/
|
|
19
|
+
export declare function processWebVitalsSummary(data: WebVitalsResponseItem[]): WebVitalsSummary;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function processWebVitalsSummary(data) {
|
|
2
|
+
const grouped = data.reduce(
|
|
3
|
+
(acc, item) => {
|
|
4
|
+
if (!acc[item.name]) acc[item.name] = [];
|
|
5
|
+
acc[item.name].push(item);
|
|
6
|
+
return acc;
|
|
7
|
+
},
|
|
8
|
+
{}
|
|
9
|
+
);
|
|
10
|
+
const summary = {};
|
|
11
|
+
for (const [metricName, metrics] of Object.entries(grouped)) {
|
|
12
|
+
if (metrics.length < 4) continue;
|
|
13
|
+
metrics.sort((a, b) => a.rating.localeCompare(b.rating) || a.value - b.value);
|
|
14
|
+
const quartileSize = Math.ceil(metrics.length / 4);
|
|
15
|
+
for (let i = 0; i < metrics.length; i++) {
|
|
16
|
+
metrics[i].quartile = Math.floor(i / quartileSize) + 1;
|
|
17
|
+
}
|
|
18
|
+
for (let i = 0; i < metrics.length; i++) {
|
|
19
|
+
const nextItem = metrics[i + 1];
|
|
20
|
+
metrics[i].rating_end = !nextItem || nextItem.rating !== metrics[i].rating;
|
|
21
|
+
}
|
|
22
|
+
const sampleSize = metrics.length;
|
|
23
|
+
const histogram = {
|
|
24
|
+
good: 0,
|
|
25
|
+
"needs-improvement": 0,
|
|
26
|
+
poor: 0
|
|
27
|
+
};
|
|
28
|
+
for (let i = 0; i < metrics.length; i++) {
|
|
29
|
+
if (metrics[i].rating_end) {
|
|
30
|
+
const ratingCount = metrics.filter((m) => m.rating === metrics[i].rating).length;
|
|
31
|
+
histogram[metrics[i].rating] = ratingCount / sampleSize;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const p75Index = Math.floor(metrics.length * 0.75);
|
|
35
|
+
const p75Metric = metrics[p75Index] || null;
|
|
36
|
+
const percentiles = p75Metric ? { p75: { value: p75Metric.value, rating: p75Metric.rating } } : {};
|
|
37
|
+
const finalMetrics = metrics.filter(
|
|
38
|
+
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
|
39
|
+
(metric) => metric.rating_end || metric.quartile * 25 === 75
|
|
40
|
+
);
|
|
41
|
+
if (finalMetrics.length > 0) {
|
|
42
|
+
summary[metricName] = { histogram, percentiles, sampleSize };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return summary;
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
processWebVitalsSummary
|
|
49
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type AvailableDashboardPages, type DashboardPage, type FinalDashboardPage, type SafePluginListType, type SettingsField, type StudioCMSPlugin, type StudioCMSPluginOptions, definePlugin } from './schemas/index.js';
|
|
2
|
+
export { type SettingsField, type SafePluginListType, type StudioCMSPlugin, type StudioCMSPluginOptions, type AvailableDashboardPages, type FinalDashboardPage, type DashboardPage, definePlugin, };
|
package/dist/plugins.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare module 'studiocms:renderer/config' {
|
|
2
|
+
const config: import('./schemas/config/rendererConfig.ts').StudioCMSRendererConfig;
|
|
3
|
+
export default config;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
declare module 'studiocms:renderer/astroMarkdownConfig' {
|
|
7
|
+
const config: import('astro').AstroConfig['markdown'];
|
|
8
|
+
export default config;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module 'studiocms:renderer' {
|
|
12
|
+
export const StudioCMSRenderer: typeof import('./components/Renderer.astro').default;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module 'studiocms:renderer/current' {
|
|
16
|
+
const deModule: typeof import('./lib/renderer/contentRenderer.js').default;
|
|
17
|
+
export default deModule;
|
|
18
|
+
export const contentRenderer: typeof import('./lib/renderer/contentRenderer.js').contentRenderer;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare module 'studiocms:component-proxy' {
|
|
22
|
+
export const componentKeys: string[];
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
export const partial = true;
|
|
3
|
+
import { StudioCMSRenderer } from 'studiocms:renderer';
|
|
4
|
+
|
|
5
|
+
type Content = string;
|
|
6
|
+
|
|
7
|
+
const queryParam = Astro.url.searchParams.get('content');
|
|
8
|
+
|
|
9
|
+
async function setContent() {
|
|
10
|
+
const jsonData: { content: string | undefined } | undefined = await Astro.request.json();
|
|
11
|
+
|
|
12
|
+
if (jsonData?.content) {
|
|
13
|
+
return jsonData.content;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (queryParam && queryParam !== 'null') {
|
|
17
|
+
return queryParam;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return 'No content to display';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const content: Content = await setContent();
|
|
24
|
+
---
|
|
25
|
+
<StudioCMSRenderer {content} />
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { createUserSession } from "studiocms:auth/lib/session";
|
|
2
|
+
import { LinkNewOAuthCookieName, createOAuthUser, getUserData } from "studiocms:auth/lib/user";
|
|
3
|
+
import { config } from "studiocms:config";
|
|
4
|
+
import { StudioCMSRoutes } from "studiocms:lib";
|
|
5
|
+
import studioCMS_SDK from "studiocms:sdk";
|
|
6
|
+
import { OAuth2RequestError } from "arctic";
|
|
7
|
+
import {
|
|
8
|
+
ProviderCookieName,
|
|
9
|
+
ProviderID,
|
|
10
|
+
auth0,
|
|
11
|
+
getClientDomain
|
|
12
|
+
} from "./shared.js";
|
|
13
|
+
const GET = async (context) => {
|
|
14
|
+
const { url, cookies, redirect } = context;
|
|
15
|
+
const code = url.searchParams.get("code");
|
|
16
|
+
const state = url.searchParams.get("state");
|
|
17
|
+
const storedState = cookies.get(ProviderCookieName)?.value ?? null;
|
|
18
|
+
const CLIENT_DOMAIN = getClientDomain();
|
|
19
|
+
if (!code || !state || !storedState || state !== storedState) {
|
|
20
|
+
return redirect(StudioCMSRoutes.authLinks.loginURL);
|
|
21
|
+
}
|
|
22
|
+
let tokens;
|
|
23
|
+
try {
|
|
24
|
+
tokens = await auth0.validateAuthorizationCode(code);
|
|
25
|
+
const auth0Response = await fetch(`${CLIENT_DOMAIN}/userinfo`, {
|
|
26
|
+
headers: {
|
|
27
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
const auth0User = await auth0Response.json();
|
|
31
|
+
const auth0UserId = auth0User.sub;
|
|
32
|
+
const auth0Username = auth0User.nickname;
|
|
33
|
+
const existingOAuthAccount = await studioCMS_SDK.AUTH.oAuth.searchProvidersForId(
|
|
34
|
+
ProviderID,
|
|
35
|
+
auth0UserId
|
|
36
|
+
);
|
|
37
|
+
if (existingOAuthAccount) {
|
|
38
|
+
const user = await studioCMS_SDK.GET.databaseEntry.users.byId(existingOAuthAccount.userId);
|
|
39
|
+
if (!user) {
|
|
40
|
+
return new Response("User not found", {
|
|
41
|
+
status: 404
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
await createUserSession(user.id, context);
|
|
45
|
+
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
|
|
46
|
+
}
|
|
47
|
+
const loggedInUser = await getUserData(context);
|
|
48
|
+
const linkNewOAuth = !!cookies.get(LinkNewOAuthCookieName)?.value;
|
|
49
|
+
if (loggedInUser.user && linkNewOAuth) {
|
|
50
|
+
const existingUser = await studioCMS_SDK.GET.databaseEntry.users.byId(loggedInUser.user.id);
|
|
51
|
+
if (existingUser) {
|
|
52
|
+
await studioCMS_SDK.AUTH.oAuth.create({
|
|
53
|
+
userId: existingUser.id,
|
|
54
|
+
provider: ProviderID,
|
|
55
|
+
providerUserId: auth0UserId
|
|
56
|
+
});
|
|
57
|
+
await createUserSession(existingUser.id, context);
|
|
58
|
+
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const newUser = await createOAuthUser(
|
|
62
|
+
{
|
|
63
|
+
id: crypto.randomUUID(),
|
|
64
|
+
username: auth0Username,
|
|
65
|
+
name: auth0User.name,
|
|
66
|
+
email: auth0User.email,
|
|
67
|
+
avatar: auth0User.picture,
|
|
68
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
69
|
+
},
|
|
70
|
+
{ provider: ProviderID, providerUserId: auth0UserId }
|
|
71
|
+
);
|
|
72
|
+
if ("error" in newUser) {
|
|
73
|
+
return new Response("Error creating user", { status: 500 });
|
|
74
|
+
}
|
|
75
|
+
if (config.dbStartPage) {
|
|
76
|
+
return redirect("/done");
|
|
77
|
+
}
|
|
78
|
+
await createUserSession(newUser.id, context);
|
|
79
|
+
return redirect(StudioCMSRoutes.mainLinks.dashboardIndex);
|
|
80
|
+
} catch (e) {
|
|
81
|
+
if (e instanceof OAuth2RequestError) {
|
|
82
|
+
const code2 = e.code;
|
|
83
|
+
return new Response(code2, {
|
|
84
|
+
status: 400
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return new Response(null, {
|
|
88
|
+
status: 500
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const OPTIONS = async () => {
|
|
93
|
+
return new Response(null, {
|
|
94
|
+
status: 204,
|
|
95
|
+
statusText: "No Content",
|
|
96
|
+
headers: {
|
|
97
|
+
Allow: "OPTIONS, GET",
|
|
98
|
+
"ALLOW-ACCESS-CONTROL-ORIGIN": "*",
|
|
99
|
+
"Cache-Control": "public, max-age=604800, immutable",
|
|
100
|
+
Date: (/* @__PURE__ */ new Date()).toUTCString()
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
const ALL = async () => {
|
|
105
|
+
return new Response(null, {
|
|
106
|
+
status: 405,
|
|
107
|
+
statusText: "Method Not Allowed",
|
|
108
|
+
headers: {
|
|
109
|
+
"ACCESS-CONTROL-ALLOW-ORIGIN": "*"
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
export {
|
|
114
|
+
ALL,
|
|
115
|
+
GET,
|
|
116
|
+
OPTIONS
|
|
117
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { setOAuthSessionTokenCookie } from "studiocms:auth/lib/session";
|
|
2
|
+
import { generateState } from "arctic";
|
|
3
|
+
import { ProviderCookieName, auth0 } from "./shared.js";
|
|
4
|
+
const GET = async (context) => {
|
|
5
|
+
const state = generateState();
|
|
6
|
+
const scopes = ["profile", "email"];
|
|
7
|
+
const url = auth0.createAuthorizationURL(state, scopes);
|
|
8
|
+
setOAuthSessionTokenCookie(context, ProviderCookieName, state);
|
|
9
|
+
return context.redirect(url.toString());
|
|
10
|
+
};
|
|
11
|
+
const OPTIONS = async () => {
|
|
12
|
+
return new Response(null, {
|
|
13
|
+
status: 204,
|
|
14
|
+
statusText: "No Content",
|
|
15
|
+
headers: {
|
|
16
|
+
Allow: "OPTIONS, GET",
|
|
17
|
+
"ALLOW-ACCESS-CONTROL-ORIGIN": "*",
|
|
18
|
+
"Cache-Control": "public, max-age=604800, immutable",
|
|
19
|
+
Date: (/* @__PURE__ */ new Date()).toUTCString()
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const ALL = async () => {
|
|
24
|
+
return new Response(null, {
|
|
25
|
+
status: 405,
|
|
26
|
+
statusText: "Method Not Allowed",
|
|
27
|
+
headers: {
|
|
28
|
+
"ACCESS-CONTROL-ALLOW-ORIGIN": "*"
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
ALL,
|
|
34
|
+
GET,
|
|
35
|
+
OPTIONS
|
|
36
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Auth0 } from 'arctic';
|
|
2
|
+
export declare const CLIENT_ID: string, CLIENT_SECRET: string, DOMAIN: string | undefined, REDIRECT_URI: string;
|
|
3
|
+
export declare const getClientDomain: () => string;
|
|
4
|
+
export declare const ProviderID = "auth0";
|
|
5
|
+
export declare const ProviderCookieName = "auth0_oauth_state";
|
|
6
|
+
export declare const auth0: Auth0;
|
|
7
|
+
export interface Auth0User {
|
|
8
|
+
sub: string;
|
|
9
|
+
name: string;
|
|
10
|
+
email: string;
|
|
11
|
+
picture: string;
|
|
12
|
+
nickname: string;
|
|
13
|
+
}
|