/// /// import { Database } from "sql.js"; declare type Ptr = number; declare type int = number; interface sqlite3_vtab { pModule: Ptr; nRef: int; zErrMsg: Ptr; } declare type SqliteStatus = int; interface sqlite3_index_info { } interface sqlite3_vtab_cursor { pVtab: Ptr; } interface sqlite3_context { } interface sqlite3_value { } export interface sqlite3_module { iVersion: int; xCreate?(conn: Ptr<"sqliteconn">, pAux: Ptr, argc: int, argv: Ptr, ppVTab: Ptr, pzErr: Ptr): SqliteStatus; xConnect(conn: Ptr<"sqliteconn">, pAux: Ptr, argc: int, argv: Ptr, ppVTab: Ptr, pzErr: Ptr): SqliteStatus; xBestIndex(pVTab: Ptr, sqlite3_index_info: Ptr): SqliteStatus; xDisconnect(pVTab: Ptr): SqliteStatus; xDestroy?(pVTab: Ptr): SqliteStatus; xOpen(pVTab: Ptr, ppCursor: Ptr): SqliteStatus; xClose(sqlite3_vtab_cursor: Ptr): SqliteStatus; xFilter(sqlite3_vtab_cursor: Ptr, idxNum: int, idxStr: Ptr, argc: int, argv: Ptr): SqliteStatus; xNext(sqlite3_vtab_cursor: Ptr): SqliteStatus; xEof(sqlite3_vtab_cursor: Ptr): SqliteStatus; xColumn(sqlite3_vtab_cursor: Ptr, sqlite3_context: Ptr, int: int): SqliteStatus; xRowid(sqlite3_vtab_cursor: Ptr, pRowid: Ptr): SqliteStatus; xUpdate?(vtab: Ptr, argc: int, argv: Ptr, pRowid: Ptr): SqliteStatus; xBegin?(pVTab: Ptr): SqliteStatus; xSync?(pVTab: Ptr): SqliteStatus; xCommit?(pVTab: Ptr): SqliteStatus; xRollback?(pVTab: Ptr): SqliteStatus; xFindFunction?(pVtab: Ptr, nArg: int, zName: Ptr, pxFunc: Ptr<(sqlite3_context: Ptr, argc: int, argv: Ptr) => void>, ppArg: Ptr): SqliteStatus; xRename?(pVtab: Ptr, zNew: Ptr): SqliteStatus; xSavepoint?(pVTab: Ptr, int: int): SqliteStatus; xRelease?(pVTab: Ptr, int: int): SqliteStatus; xRollbackTo?(pVTab: Ptr, int: int): SqliteStatus; xShadowName?(str: Ptr): SqliteStatus; } export interface SqljsEmscriptenModuleType extends EmscriptenModule { ccall: typeof ccall; setValue: typeof setValue; getValue: typeof getValue; UTF8ToString: typeof UTF8ToString; stringToUTF8: typeof stringToUTF8; lengthBytesUTF8: typeof lengthBytesUTF8; addFunction: typeof addFunction; extract_value: (ptr: Ptr) => null | string | number; set_return_value: (ptr: Ptr, value: string | number | boolean | null) => void; sqlite3_malloc: (size: int) => Ptr; } declare type Cursor = { elements: ArrayLike; querySelector: string; index: number; }; export interface DomRow { idx: number; id: string | null; tagName: string; textContent: string; innerHTML: string; outerHTML: string; className: string | null; parent: string | null; selector: string; } export declare type MainThreadRequest = { type: "select"; selector: string; columns: (keyof DomRow)[]; } | { type: "delete"; selector: string; } | { type: "update"; value: Partial; } | { type: "insert"; value: Partial; }; export declare class SeriesVtab implements sqlite3_module { private module; private db; name: string; iVersion: number; cursors: Map; constructor(module: SqljsEmscriptenModuleType, db: Database); getCursor(cursor: Ptr): Cursor; xConnect(conn: Ptr<"sqliteconn">, pAux: Ptr, argc: int, argv: Ptr, ppVTab: Ptr>, pzErr: Ptr): SqliteStatus; xDisconnect(pVTab: Ptr): SqliteStatus; xOpen(pVTab: Ptr, ppCursor: Ptr>): SqliteStatus; xClose(sqlite3_vtab_cursor: Ptr): SqliteStatus; xBestIndex(pVTab: Ptr, info: Ptr): SqliteStatus; xFilter(cursorPtr: Ptr, idxNum: int, idxStr: Ptr, argc: int, argv: Ptr): SqliteStatus; xNext(cursorPtr: Ptr): SqliteStatus; xEof(cursorPtr: Ptr): SqliteStatus; xColumn(cursorPtr: Ptr, ctx: Ptr, column: int): SqliteStatus; setVtabError(vtab: Ptr, err: string): void; xUpdate(vtab: Ptr, argc: int, argv: Ptr, pRowid: Ptr): SqliteStatus; xRowid(sqlite3_vtab_cursor: Ptr, pRowid: Ptr): SqliteStatus; xFindFunction(pVtab: Ptr, nArg: int, zName: Ptr, pxFunc: Ptr<(sqlite3_context: Ptr, argc: int, argv: Ptr) => void>, ppArg: Ptr): SqliteStatus; } export {};