Files
spsays-training/lib/owk.ts
T
2026-05-10 00:35:14 +05:30

58 lines
1.3 KiB
TypeScript

/**
* Data access layer for On the Way to Kṛṣṇa (OWK).
*
* 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 = "owk";
// Re-export types with book-specific names for backwards compatibility
export type OwkMeta = BookMeta;
export type OwkChapterEntry = { number: number; title: string };
export type OwkIntroSegment = IntroSegment;
export type OwkChapter = Chapter;
export type OwkSidebarItem = SidebarItem;
export async function getOwkMeta(): Promise<OwkMeta | null> {
return getBookMeta(CODE);
}
export async function getOwkIntroSegments(): Promise<OwkIntroSegment[]> {
return getIntroSegments(CODE);
}
export async function getOwkIntroSegment(
slug: string,
): Promise<OwkIntroSegment | null> {
return getIntroSegment(CODE, slug);
}
export async function getOwkChapter(
chapterNum: number,
): Promise<OwkChapter | null> {
return getChapter(CODE, String(chapterNum));
}
export async function getOwkContent(
slug: string,
): Promise<OwkChapter | OwkIntroSegment | null> {
return getContent(CODE, slug);
}
export async function getOwkSidebarItems(): Promise<OwkSidebarItem[]> {
return getSidebarItems(CODE);
}