studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
199 lines (198 loc) • 7.11 kB
TypeScript
import type uiIntegration from '@studiocms/ui';
import { type AvailablePermissionRanks } from '@withstudiocms/auth-kit/types';
import type { AstroConfig } from 'astro';
import type { RobotsConfig } from './integrations/robots/schema.js';
import type { TimeString } from './schemas/config/sdk.js';
/**
* StudioCMS Site Config Table Entry ID
*/
export declare const CMSSiteConfigId: number;
export declare const Next_SiteConfigId: string;
/**
* StudioCMS Mailer Config Table Entry ID
*/
export declare const CMSMailerConfigId: string;
export declare const Next_MailerConfigId: string;
/**
* StudioCMS Notification Settings Table Entry ID
*/
export declare const CMSNotificationSettingsId: string;
export declare const Next_NotificationSettingsId: string;
export declare const TemplateConfigId: string;
/**
* The default lifetime for cached items.
* This value is used to determine how long an item should remain in the cache before it is considered expired.
* This value is used in ./schemas/config/sdk.ts to set the default cache lifetime.
*/
export declare const defaultCacheLifeTime: TimeString;
/**
* The default lifetime for cached items in milliseconds.
* This value is used to determine how long an item should remain in the cache before it is considered expired.
*/
export declare const versionCacheLifetime: number;
/**
* Current REST API Versions
*/
export declare const currentRESTAPIVersions: readonly ["v1"];
/**
* Current REST API Versions Type
*/
export type CurrentRESTAPIVersions = (typeof currentRESTAPIVersions)[number];
/**
* REST API Directory
*
* @deprecated use new src/frontend/routes resolver functions instead
*/
export declare const routesDir: {
fts: (file: string) => string;
dashRoute: (file: string) => string;
errors: (file: string) => string;
authPage: (file: string) => string;
dashApi: (file: string) => string;
authAPI: (file: string) => string;
api: (file: string) => string;
sdk: (file: string) => string;
mailer: (file: string) => string;
v1Rest: (file: string) => string;
middleware: (file: string) => string;
};
/**
* StudioCMS Social Links Type
*/
export type StudioCMSSocials = {
github: string;
githubLicense: string;
githubContributors: string;
discord: string;
changelog: string;
releases: string;
npm: string;
};
/**
* StudioCMS Social Links
*/
export declare const studioCMSSocials: StudioCMSSocials;
/**
* Default values for a "ghost" user in StudioCMS.
* This user represents a deleted user in the system.
*/
export declare const GhostUserDefaults: {
id: string;
name: string;
username: string;
avatar: string;
};
/**
* Default values for the site Notifications configuration.
*/
export declare const NotificationSettingsDefaults: {
emailVerification: boolean;
oAuthBypassVerification: boolean;
requireEditorVerification: boolean;
requireAdminVerification: boolean;
};
/**
* Creates a standardized API route path for the dashboard.
*
* @param route - Optional additional path to append to the base dashboard API route.
* @returns A function that constructs the full API route path.
*/
export declare const dashboardAPIRoute: (route: string) => string;
/**
* Creates a standardized API route path for authentication-related endpoints.
*
* @returns A function that constructs the full API route path for authentication.
*/
export declare const authAPIRoute: (route: string) => string;
/**
* Creates a standardized API route path for the SDK.
*
* @returns A function that constructs the full API route path for the SDK.
*/
export declare const makeDashboardRoute: (route?: string) => (path: string) => string;
/**
* Default values for the StudioCMS Markdown configuration.
* This configuration is used to set up the default behavior of Markdown rendering in StudioCMS.
*/
export declare const StudioCMSMarkdownDefaults: {
flavor: "studiocms";
autoLinkHeadings: boolean;
callouts: false;
discordSubtext: boolean;
};
/**
* Partial configuration object for Astro's image settings.
*
* This constant defines allowed remote image patterns for Astro,
* specifying that images can be loaded from both 'https' and 'http' protocols.
*
* @remarks
* This is a partial type of `AstroConfig['image']`, so it can be merged with other image settings.
*
* @example
* // Usage in Astro config
* import { AstroConfigImageSettings } from './consts';
* export default {
* image: {
* ...AstroConfigImageSettings,
* // other image settings
* }
* }
*/
export declare const AstroConfigImageSettings: Partial<AstroConfig['image']>;
/**
* Partial Vite configuration settings for Astro projects.
*
* This constant customizes the Vite settings used by Astro, specifically
* excluding the 'three' package from dependency optimization. This can be
* useful if 'three' causes issues during Vite's dependency pre-bundling.
*
* @remarks
* The type is a partial of the 'vite' property from the Astro configuration,
* allowing you to override or extend only the necessary Vite options.
*
* @see https://docs.astro.build/en/reference/configuration-reference/#vite
*/
export declare const AstroConfigViteSettings: Partial<AstroConfig['vite']>;
/**
* Generates the default robots.txt configuration for StudioCMS.
*
* @param config - The Astro site configuration object.
* @param sitemapEnabled - Indicates whether the sitemap should be enabled.
* @param dashboardRoute - A function that returns the dashboard route path given a base path.
* @returns The robots.txt configuration object.
*/
export declare const StudioCMSDefaultRobotsConfig: ({ config, sitemapEnabled, dashboardRoute, }: {
config: AstroConfig;
sitemapEnabled: boolean;
dashboardRoute: (path: string) => string;
}) => RobotsConfig;
export declare const STUDIOCMS_EDITOR_CSRF_COOKIE_NAME = "studiocms-editor-csrf-token";
export declare const STUDIOCMS_THEME_COLOR = "#a581f3";
export declare const STUDIOCMS_CDN_URL = "https://cdn.studiocms.dev";
export declare const FAVICON_ASSETS: {
readonly svg: "https://cdn.studiocms.dev/favicon.svg";
readonly png: {
readonly light: "https://cdn.studiocms.dev/favicon-light.png";
readonly dark: "https://cdn.studiocms.dev/favicon-dark.png";
};
};
type UiOptions = Parameters<typeof uiIntegration>[0];
/**
* Merges user-provided UI options with default StudioCMS UI options.
*
* @param userOpts - An optional partial object containing user-specified UI options.
* @returns The merged UI options object.
*
* @remarks
* - If a user option is provided, it takes precedence over the default.
* - The `icons` property is deeply merged, combining default and user-provided icons.
*/
export declare function getUiOpts(currentFlags: Array<{
key: string;
flag: `lang-${string}`;
}>, userOpts?: Partial<UiOptions>): UiOptions;
export declare const LinkNewOAuthCookieName = "link-new-o-auth";
export declare const AuthSessionCookieName = "auth_session";
export declare const ValidRanks: ReadonlySet<AvailablePermissionRanks>;
export {};