58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
/**
|
|
* Data access layer for Easy Journey to Other Planets (EJ).
|
|
*
|
|
* 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 = "ej";
|
|
|
|
// Re-export types with book-specific names for backwards compatibility
|
|
export type EjMeta = BookMeta;
|
|
export type EjChapterEntry = { number: number; title: string };
|
|
export type EjIntroSegment = IntroSegment;
|
|
export type EjChapter = Chapter;
|
|
export type EjSidebarItem = SidebarItem;
|
|
|
|
export async function getEjMeta(): Promise<EjMeta | null> {
|
|
return getBookMeta(CODE);
|
|
}
|
|
|
|
export async function getEjIntroSegments(): Promise<EjIntroSegment[]> {
|
|
return getIntroSegments(CODE);
|
|
}
|
|
|
|
export async function getEjIntroSegment(
|
|
slug: string,
|
|
): Promise<EjIntroSegment | null> {
|
|
return getIntroSegment(CODE, slug);
|
|
}
|
|
|
|
export async function getEjChapter(
|
|
chapterNum: number,
|
|
): Promise<EjChapter | null> {
|
|
return getChapter(CODE, String(chapterNum));
|
|
}
|
|
|
|
export async function getEjContent(
|
|
slug: string,
|
|
): Promise<EjChapter | EjIntroSegment | null> {
|
|
return getContent(CODE, slug);
|
|
}
|
|
|
|
export async function getEjSidebarItems(): Promise<EjSidebarItem[]> {
|
|
return getSidebarItems(CODE);
|
|
}
|