studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
62 lines (61 loc) • 2.58 kB
TypeScript
import { Effect } from '../../../effect.js';
import { SDKCoreError } from '../errors.js';
import { SDKCore_AUTH } from './auth.js';
import { SDKCore_CONFIG, type StudioCMSSiteConfig } from './config.js';
declare const SDKCore_INIT_base: Effect.Service.Class<SDKCore_INIT, "studiocms/sdk/SDKCore/modules/init", {
readonly dependencies: readonly [import("effect/Layer").Layer<SDKCore_AUTH, never, never>, import("effect/Layer").Layer<SDKCore_CONFIG, never, never>];
readonly effect: Effect.Effect<{
/**
* Initializes the StudioCMS SiteConfig table with the provided configuration.
*
* @param config - The configuration to insert into the SiteConfig table.
* @returns A promise that resolves to the inserted site configuration.
* @throws {StudioCMS_SDK_Error} If an error occurs while creating the site configuration.
*/
siteConfig: (config: Omit<StudioCMSSiteConfig, "_config_version">) => Effect.Effect<import("./config-types.js").DynamicConfigEntry<StudioCMSSiteConfig>, SDKCoreError, never>;
/**
* Initializes the StudioCMS Ghost User.
*
* The ghost user is a default user that is used to perform actions on behalf of the system as well as to replace deleted users.
*
* @returns A promise that resolves to the ghost user record.
* @throws {StudioCMS_SDK_Error} If an error occurs while creating the ghost user.
*/
ghostUser: () => Effect.Effect<{
name: string;
password: string | null;
email: string | null;
url: string | null;
id: string;
username: string;
avatar: string | null;
updatedAt: Date | null;
createdAt: Date | null;
emailVerified: boolean;
notifications: string | null;
}, SDKCoreError, never>;
}, never, SDKCore_CONFIG | SDKCore_AUTH>;
}>;
/**
* Effectful service for initializing core StudioCMS modules.
*
* @remarks
* This service provides initialization routines for the StudioCMS system,
* including setting up the site configuration and ensuring the existence of the ghost user.
*
* @example
* ```typescript
* const init = yield* SDKCore_INIT;
* yield* init.siteConfig({ ... });
* yield* init.ghostUser();
* ```
*
* @service
* - Depends on AstroDB and SDKCore_AUTH services.
*
* @throws {StudioCMS_SDK_Error}
* Throws if database errors occur during initialization.
*/
export declare class SDKCore_INIT extends SDKCore_INIT_base {
}
export {};