simplify setup by emiting index.js in ESM style from napi

This commit is contained in:
Nikita Sivukhin
2025-08-08 00:47:37 +04:00
parent b8f2ff293b
commit dd347fb3e3
10 changed files with 28 additions and 63 deletions

View File

@@ -34,8 +34,7 @@ function createErrorByName(name, message) {
/**
* Database represents a connection that can prepare and execute SQL statements.
*/
export class Database {
static SqliteError = SqliteError;
class Database {
db: NativeDB;
memory: boolean;
open: boolean;
@@ -97,7 +96,7 @@ export class Database {
if (!this.open) {
throw new TypeError("The database connection is not open");
}
if (!sql) {
throw new RangeError("The supplied SQL string contains no statements");
}
@@ -200,7 +199,7 @@ export class Database {
if (!this.open) {
throw new TypeError("The database connection is not open");
}
try {
this.db.batch(sql);
} catch (err) {
@@ -328,7 +327,7 @@ class Statement {
async *iterate(...bindParameters) {
this.stmt.reset();
bindParams(this.stmt, bindParameters);
while (true) {
const stepResult = this.stmt.step();
if (stepResult === STEP_IO) {
@@ -399,3 +398,5 @@ class Statement {
}
}
}
export { Database, SqliteError }