studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
132 lines (131 loc) • 9.81 kB
TypeScript
import { Effect } from '../../effect.js';
import { AstroDB, SDKCore_Collectors, SDKCore_FolderTree, SDKCore_Generators, SDKCore_Parsers, SDKCore_Users } from './effect/index.js';
import { SDKCore_AUTH } from './modules/auth.js';
import { SDKCore_CLEAR } from './modules/clear.js';
import { SDKCore_CONFIG } from './modules/config.js';
import { SDKCore_DELETE } from './modules/delete.js';
import { SDKCore_DiffTracking } from './modules/diffTracking.js';
import { SDKCore_GET } from './modules/get.js';
import { SDKCore_INIT } from './modules/init.js';
import { SDKCore_MIDDLEWARES } from './modules/middlewares.js';
import { SDKCore_NotificationSettings } from './modules/notificationSettings.js';
import { SDKCore_PLUGINS } from './modules/plugins.js';
import { SDKCore_POST } from './modules/post.js';
import { SDKCore_ResetTokenBucket } from './modules/resetTokenBucket.js';
import { SDKCore_REST_API } from './modules/rest_api.js';
import { SDKCore_UPDATE } from './modules/update.js';
import { CacheContext } from './utils.js';
declare const SDKCore_base: Effect.Service.Class<SDKCore, "studiocms/sdk/SDKCore", {
readonly dependencies: readonly [import("effect/Layer").Layer<SDKCore_FolderTree, never, never>, import("effect/Layer").Layer<SDKCore_Generators, never, never>, import("effect/Layer").Layer<SDKCore_Parsers, never, never>, import("effect/Layer").Layer<SDKCore_Users, never, never>, import("effect/Layer").Layer<SDKCore_Collectors, never, never>, import("effect/Layer").Layer<SDKCore_CLEAR, never, CacheContext>, import("effect/Layer").Layer<SDKCore_DELETE, never, CacheContext>, import("effect/Layer").Layer<SDKCore_UPDATE, never, CacheContext>, import("effect/Layer").Layer<SDKCore_POST, never, CacheContext>, import("effect/Layer").Layer<SDKCore_REST_API, never, never>, import("effect/Layer").Layer<SDKCore_GET, never, CacheContext>, import("effect/Layer").Layer<SDKCore_ResetTokenBucket, never, CacheContext>, import("effect/Layer").Layer<SDKCore_DiffTracking, never, never>, import("effect/Layer").Layer<SDKCore_NotificationSettings, never, never>, import("effect/Layer").Layer<SDKCore_AUTH, never, never>, import("effect/Layer").Layer<SDKCore_INIT, never, never>, import("effect/Layer").Layer<AstroDB, never, never>, import("effect/Layer").Layer<SDKCore_MIDDLEWARES, never, CacheContext>, import("effect/Layer").Layer<SDKCore_PLUGINS, never, CacheContext>, import("effect/Layer").Layer<SDKCore_CONFIG, never, never>];
readonly effect: Effect.Effect<{
db: import("@astrojs/db/runtime").Database;
dbService: AstroDB;
getFullPath: (tree: import("./types/index.js").FolderNode[], path: string[]) => Effect.Effect<string[], import("./errors.js").SDKCoreError, never>;
findNodeByPath: (tree: import("./types/index.js").FolderNode[], path: string[]) => Effect.Effect<import("./types/index.js").FolderNode | null, import("./errors.js").SDKCoreError, never>;
findNodesAlongPath: (tree: import("./types/index.js").FolderNode[], path: string[]) => Effect.Effect<import("./types/index.js").FolderNode[], import("./errors.js").SDKCoreError, never>;
findNodesAlongPathToId: (tree: import("./types/index.js").FolderNode[], id: string) => Effect.Effect<import("./types/index.js").FolderNode[], import("./errors.js").SDKCoreError, never>;
findNodeById: (tree: import("./types/index.js").FolderNode[], id: string) => Effect.Effect<import("./types/index.js").FolderNode | null, import("./errors.js").SDKCoreError, never>;
addPageToFolderTree: (tree: import("./types/index.js").FolderNode[], folderId: string, newPage: import("./types/index.js").FolderNode) => Effect.Effect<import("./types/index.js").FolderNode[], import("./errors.js").SDKCoreError, never>;
generateRandomIDNumber: (length: number) => Effect.Effect<number, import("./errors.js").SDKCoreError, never>;
generateRandomPassword: (length: number) => Effect.Effect<string, import("./errors.js").SDKCoreError, never>;
generateToken: (userId: string, noExpire?: boolean) => Effect.Effect<string, import("./errors.js").SDKCoreError, never>;
testToken: (token: string) => Effect.Effect<import("./effect/lib/jwt-generator.js").JwtVerificationResult, import("./errors.js").SDKCoreError, never>;
parseIdNumberArray: (ids: unknown) => Effect.Effect<number[], import("./errors.js").SDKCoreError, never>;
parseIdStringArray: (ids: unknown) => Effect.Effect<string[], import("./errors.js").SDKCoreError, never>;
combineRanks: (rank: string, users: import("./types/tableDefs.js").SingleRank[]) => Effect.Effect<import("./types/tableDefs.js").CombinedRank[], import("./errors.js").SDKCoreError, never>;
verifyRank: (users: import("./types/tsAlias.js").tsUsersSelect[], permissions: import("./types/tsAlias.js").tsPermissionsSelect[], rank: string) => Effect.Effect<import("./types/tableDefs.js").SingleRank[], import("./errors.js").SDKCoreError, never>;
buildFolderTree: Effect.Effect<import("./types/index.js").FolderNode[], import("@withstudiocms/effect/drizzle").LibSQLClientError | import("./errors.js").SDKCoreError, never>;
getAvailableFolders: Effect.Effect<import("./types/index.js").FolderListItem[], import("@withstudiocms/effect/drizzle").LibSQLClientError, never>;
clearUserReferences: (userId: string) => Effect.Effect<boolean, import("./errors.js").SDKCoreError, never>;
collectCategories: (categoryIds: number[]) => Effect.Effect<{
name: string;
description: string;
slug: string;
id: number;
parent: number | null;
meta: unknown;
}[], import("@withstudiocms/effect/drizzle").LibSQLClientError, never>;
collectTags: (tagIds: number[]) => Effect.Effect<{
name: string;
description: string;
slug: string;
id: number;
meta: unknown;
}[], import("@withstudiocms/effect/drizzle").LibSQLClientError, never>;
collectPageData: {
(page: import("./types/tsAlias.js").tsPageDataSelect, tree: import("./types/index.js").FolderNode[]): Effect.Effect<import("./types/index.js").CombinedPageData, import("./errors.js").SDKCoreError, never>;
(page: import("./types/tsAlias.js").tsPageDataSelect, tree: import("./types/index.js").FolderNode[], metaOnly: boolean): Effect.Effect<import("./types/index.js").MetaOnlyPageData, import("./errors.js").SDKCoreError, never>;
};
collectUserData: (user: import("./types/tsAlias.js").tsUsersSelect) => Effect.Effect<import("./types/index.js").CombinedUserData, import("./errors.js").SDKCoreError, never>;
resetTokenBucket: SDKCore_ResetTokenBucket;
diffTracking: SDKCore_DiffTracking;
notificationSettings: SDKCore_NotificationSettings;
CLEAR: SDKCore_CLEAR;
DELETE: SDKCore_DELETE;
REST_API: SDKCore_REST_API;
POST: SDKCore_POST;
UPDATE: SDKCore_UPDATE;
GET: SDKCore_GET;
AUTH: SDKCore_AUTH;
INIT: SDKCore_INIT;
MIDDLEWARES: SDKCore_MIDDLEWARES;
PLUGINS: SDKCore_PLUGINS;
CONFIG: SDKCore_CONFIG;
}, never, AstroDB | SDKCore_CONFIG | SDKCore_FolderTree | SDKCore_Generators | SDKCore_Parsers | SDKCore_Users | SDKCore_Collectors | SDKCore_CLEAR | SDKCore_DELETE | SDKCore_UPDATE | SDKCore_GET | SDKCore_POST | SDKCore_REST_API | SDKCore_ResetTokenBucket | SDKCore_DiffTracking | SDKCore_NotificationSettings | SDKCore_AUTH | SDKCore_INIT | SDKCore_MIDDLEWARES | SDKCore_PLUGINS>;
}>;
/**
* The `SDKCore` class serves as the central service aggregator for the StudioCMS SDK.
* It extends `Effect.Service` and provides a unified interface to various sub-services
* such as folder tree management, generators, parsers, user management, collectors,
* database operations, REST API handlers, authentication, notification settings, and more.
*
* @remarks
* - All dependencies are injected and made available through the service.
* - The returned object from the effect contains all core SDK functions and sub-services.
* - Static members `Provide` and `Cache` are available for effect provisioning and caching context.
*
* @example
* ```typescript
* const sdk = yield* Effect.service(SDKCore);
* const pageData = yield* sdk.collectPageData(...);
* ```
*
* @property {Function} Provide - Static method to provide the default SDKCore service.
* @property {CacheContext} Cache - Static cache context for SDKCore-related data.
*
* @see Effect.Service
* @see CacheContext
*/
export declare class SDKCore extends SDKCore_base {
/**
* Provides the default dependencies to an Effect.
*
* This static property uses `Effect.provide` with the default configuration (`this.Default`),
* allowing consumers to inject the standard dependencies required by the SDK core.
*
* @remarks
* Typically used to wrap effects that require the default environment or services.
*
* @see {@link Effect.provide}
* @see {@link Default}
*/
static Provide: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, CacheContext | Exclude<R, SDKCore>>;
/**
* Provides a static cache context containing various site-related data.
*
* @remarks
* The cache includes pages, folder lists, folder trees, page-folder trees,
* site configuration, and version information. It is created using
* `CacheContext.makeProvide` for efficient access throughout the SDK.
*
* @see CacheContext
* @see pages
* @see FolderList
* @see folderTree
* @see pageFolderTree
* @see siteConfig
* @see version
*/
static Cache: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, CacheContext>>;
}
export {};