58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
/**
|
|
* Data access layer for Rāja-vidyā: The King of Knowledge (RV).
|
|
*
|
|
* Delegates to the generic book data layer which calls the BFF API.
|
|
*/
|
|
|
|
import {
|
|
getBookMeta,
|
|
getIntroSegments,
|
|
getIntroSegment,
|
|
getChapter,
|
|
getContent,
|
|
getSidebarItems,
|
|
type BookMeta,
|
|
type IntroSegment,
|
|
type Chapter,
|
|
type SidebarItem,
|
|
} from "@/lib/books";
|
|
|
|
const CODE = "rv";
|
|
|
|
// Re-export types with book-specific names for backwards compatibility
|
|
export type RvMeta = BookMeta;
|
|
export type RvChapterEntry = { number: number; title: string };
|
|
export type RvIntroSegment = IntroSegment;
|
|
export type RvChapter = Chapter;
|
|
export type RvSidebarItem = SidebarItem;
|
|
|
|
export async function getRvMeta(): Promise<RvMeta | null> {
|
|
return getBookMeta(CODE);
|
|
}
|
|
|
|
export async function getRvIntroSegments(): Promise<RvIntroSegment[]> {
|
|
return getIntroSegments(CODE);
|
|
}
|
|
|
|
export async function getRvIntroSegment(
|
|
slug: string,
|
|
): Promise<RvIntroSegment | null> {
|
|
return getIntroSegment(CODE, slug);
|
|
}
|
|
|
|
export async function getRvChapter(
|
|
chapterNum: number,
|
|
): Promise<RvChapter | null> {
|
|
return getChapter(CODE, String(chapterNum));
|
|
}
|
|
|
|
export async function getRvContent(
|
|
slug: string,
|
|
): Promise<RvChapter | RvIntroSegment | null> {
|
|
return getContent(CODE, slug);
|
|
}
|
|
|
|
export async function getRvSidebarItems(): Promise<RvSidebarItem[]> {
|
|
return getSidebarItems(CODE);
|
|
}
|