interface PaginationData { total: number; list: T[]; } interface Entity extends Record { id: string; } declare class EntityClient { #private; readonly entityName: string; constructor(lumi: LumiClient, entityName: string); /** 查询文档列表 */ list({ filter, sort, limit, skip }?: { filter?: any; sort?: Record; limit?: number; skip?: number; }): Promise>; /** 获取单个文档 */ get(id: string): Promise; /** 创建文档 */ create(data: Record): Promise; /** 批量创建文档 */ createMany(data: Record[]): Promise; /** 更新文档 */ update(id: string, data: Record): Promise; /** 删除文档 */ delete(id: string): Promise; /** 批量删除文档 */ deleteMany(ids: string[]): Promise; private uri; } declare class EntitiesClient { #private; [key: string]: EntityClient; constructor(lumi: LumiClient); } declare class EmailTool { #private; constructor(lumi: LumiClient); /** 发送邮件 */ send({ to, subject, fromName, html, text, replyTo, scheduledAt }: { to: string | string[]; subject: string; fromName?: string; html?: string; text?: string; replyTo?: string | string[]; scheduledAt?: string; }): Promise; } interface UploadItem { fileName: string; fileUrl?: string; uploadError?: string; } declare class FileTool { #private; constructor(lumi: LumiClient); /** 上传文件 */ upload(files: File[]): Promise; /** 批量删除文件 */ delete(fileUrls: string[]): Promise; } declare class ToolsClient { #private; email: EmailTool; file: FileTool; constructor(lumi: LumiClient); } interface LumiClientConfig { projectId: string; apiBaseUrl: string; authOrigin: string; } declare class LumiClient { config: LumiClientConfig; auth: LumiAuthClient; entities: EntitiesClient; tools: ToolsClient; constructor(config: LumiClientConfig); } declare function createClient(config: LumiClientConfig): LumiClient; declare enum MessageType { READY = "lumi-ready", INIT = "lumi-init", SIGN_IN = "lumi-sign-in" } interface User { userId: string; email: string; userName: string; createdTime: string; } interface MessageSignInData { projectId: string; accessToken: string; user: User; } type MessageDataReceive = { type: MessageType.READY; } | { type: MessageType.SIGN_IN; data: MessageSignInData; }; interface MessageInitData { projectId: string; icon: string | null; title: string | null; } interface MessageDataSend { type: MessageType.INIT; data: MessageInitData; } declare class LumiAuthClient { #private; constructor(lumi: LumiClient); /** 访问令牌 */ get accessToken(): string | null; set accessToken(accessToken: string | null); /** 用户 */ get user(): User | null; set user(user: User | null); get isAuthenticated(): boolean; /** 登录 */ signIn(): Promise; /** 退出登录 */ signOut(): void; /** 获取当前用户 */ refreshUser(): Promise; /** 监听登录状态变化 */ onAuthChange(callback: (args: { isAuthenticated: boolean; user: User | null; }) => void): () => void; } export { EmailTool, EntitiesClient, type Entity, EntityClient, FileTool, LumiAuthClient, LumiClient, type LumiClientConfig, type MessageDataReceive, type MessageDataSend, type MessageInitData, type MessageSignInData, ToolsClient, type UploadItem, type User, createClient };