UNPKG

@rep2recall/r2r-mongo

Version:
67 lines 2.55 kB
import Anki, { IMedia } from "ankisync"; import { Typegoose, Ref, InstanceType } from '@hasezoey/typegoose'; import { R2rOnline, ICondOptions, IEntry, IPagedOutput, IRender, R2rLocal, IProgress } from "@rep2recall/r2r-format"; declare class User extends Typegoose { email: string; picture?: string; secret: string; } declare class Deck extends Typegoose { name: string; user: Ref<User>; } export default class R2rMongo extends R2rOnline { user?: InstanceType<User>; private mongoUri; constructor(mongoUri: string); build(): Promise<this>; signup(email: string, password: string, options?: { picture?: string; }): Promise<string>; getSecret(): Promise<string | null>; newSecret(): Promise<string | null>; parseSecret(secret: string): Promise<boolean>; login(email: string, secret: string): Promise<boolean>; logout(): Promise<boolean>; 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>): Promise<Partial<IEntry>>; protected getOrCreateDeck(name: string): Promise<Deck>; protected getData(cardId: string): Promise<Array<{ key: string; value: any; }> | null>; protected getFront(cardId: string): Promise<string>; 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>; fromR2r(r2r: R2rLocal, options?: { filename?: string; callback?: (p: IProgress) => void; }): Promise<void>; fromAnki(anki: Anki, options?: { filename?: string; callback?: (p: { text: string; current?: number; max?: number; }) => void; }): Promise<void>; } export {}; //# sourceMappingURL=index.d.ts.map