UNPKG

@rep2recall/r2r-sqlite

Version:
106 lines 3.08 kB
import Anki, { IMedia } from "ankisync"; import Db, { Collection } from "liteorm"; import { R2rLocal, ICondOptions, IEntry, IPagedOutput, IRender, IProgress } from "@rep2recall/r2r-format"; declare class DbDeck { _id?: number; name: string; } declare class DbSource { _id?: number; h: string; name: string; created: Date; } declare class DbTemplate { _id?: number; name: string; sourceId?: number; front: string; back?: string; css?: string; js?: string; } declare class DbNote { _id?: number; key?: string; name: string; sourceId?: number; data: Record<string, any>; order: Record<string, number>; } declare class DbMedia { _id?: number; h?: string; sourceId?: number; name: string; data: ArrayBuffer; } declare class DbCard { _id: string; deckId: number; templateId?: number; noteId?: number; front: string; back?: string; mnemonic?: string; srsLevel?: number; nextReview?: Date; tag?: string[]; created: Date; modified?: Date; stat?: { streak: { right: number; wrong: number; }; }; } export default class R2rSqlite extends R2rLocal { db: Db; filename: string; deck: Collection<DbDeck>; card: Collection<DbCard>; source: Collection<DbSource>; template: Collection<DbTemplate>; note: Collection<DbNote>; media: Collection<DbMedia>; constructor(filename: string); build(): Promise<this>; close(): Promise<this>; reset(): Promise<this>; parseCond(q: string, options?: ICondOptions<IEntry>): Promise<IPagedOutput<Partial<IEntry>>>; insertMany(entries: IEntry[]): Promise<string[]>; updateMany(ids: string[], u: Partial<IEntry>): Promise<void>; addTags(ids: string[], tags: string[]): Promise<void>; removeTags(ids: string[], tags: string[]): Promise<void>; deleteMany(ids: string[]): Promise<void>; render(cardId: string): Promise<IRender>; protected updateSrsLevel(dSrsLevel: number, cardId: string): Promise<void>; protected transformCreateOrUpdate(cardId: string | null, u: Partial<IEntry>, timestamp?: Date): Promise<Partial<IEntry>>; protected getOrCreateDeck(name: string): Promise<number>; protected getData(cardId: string): Promise<{ key: string; value: any; }[]>; protected getFront(cardId: string): Promise<string>; fromR2r(r2r: R2rLocal, options?: { filename?: string; callback?: (p: IProgress) => void; }): Promise<void>; export(r2r: R2rLocal, q?: string, options?: { callback?: (p: IProgress) => void; }): Promise<void>; getMedia(h: string): Promise<IMedia | null>; allMedia(): Promise<IMedia[]>; createMedia(m: { name: string; data: ArrayBuffer; }): Promise<string>; deleteMedia(h: string): Promise<boolean>; fromAnki(anki: Anki, options?: { filename?: string; callback?: (p: IProgress) => void; }): Promise<void>; } export {}; //# sourceMappingURL=index.d.ts.map