You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
import type { QueryExecResult, SqlValue } from "./database";
|
|
|
|
declare module "@jlongster/sql.js" {
|
|
interface SQL {
|
|
Database: new (path: string, options?: { filename: boolean }) => AbsurdSqlDatabase;
|
|
FS: {
|
|
mkdir: (path: string) => void;
|
|
mount: (fs: any, options: any, path: string) => void;
|
|
open: (path: string, flags: string) => any;
|
|
close: (stream: any) => void;
|
|
};
|
|
register_for_idb: (fs: any) => void;
|
|
}
|
|
|
|
interface AbsurdSqlDatabase {
|
|
exec: (sql: string, params?: unknown[]) => Promise<QueryExecResult[]>;
|
|
run: (
|
|
sql: string,
|
|
params?: unknown[],
|
|
) => Promise<{ changes: number; lastId?: number }>;
|
|
}
|
|
|
|
const initSqlJs: (options?: {
|
|
locateFile?: (file: string) => string;
|
|
}) => Promise<SQL>;
|
|
|
|
export default initSqlJs;
|
|
}
|
|
|
|
declare module "absurd-sql" {
|
|
import type { SQL } from "@jlongster/sql.js";
|
|
|
|
export class SQLiteFS {
|
|
constructor(fs: any, backend: any);
|
|
}
|
|
}
|
|
|
|
declare module "absurd-sql/dist/indexeddb-backend" {
|
|
export default class IndexedDBBackend {
|
|
constructor();
|
|
}
|
|
}
|
|
|
|
declare module "absurd-sql/dist/indexeddb-main-thread" {
|
|
export interface SQLiteOptions {
|
|
filename?: string;
|
|
autoLoad?: boolean;
|
|
debug?: boolean;
|
|
}
|
|
|
|
export interface SQLiteDatabase {
|
|
exec: (sql: string, params?: unknown[]) => Promise<QueryExecResult[]>;
|
|
close: () => Promise<void>;
|
|
}
|
|
|
|
export function initSqlJs(options?: any): Promise<any>;
|
|
export function createDatabase(options?: SQLiteOptions): Promise<SQLiteDatabase>;
|
|
export function openDatabase(options?: SQLiteOptions): Promise<SQLiteDatabase>;
|
|
}
|