Comparing version 0.3.10 to 0.3.11
44
index.js
@@ -11,14 +11,19 @@ "use strict"; | ||
let target = currentTarget(); | ||
// Workaround for Bun, which reports a musl target, but really wants glibc... | ||
if (familySync() == GLIBC) { | ||
switch (target) { | ||
case "linux-x64-musl": | ||
target = "linux-x64-gnu"; | ||
break; | ||
case "linux-arm64-musl": | ||
target = "linux-arm64-gnu"; | ||
break; | ||
function requireNative() { | ||
if (process.env.LIBSQL_JS_DEV) { | ||
return load(__dirname) | ||
} | ||
let target = currentTarget(); | ||
// Workaround for Bun, which reports a musl target, but really wants glibc... | ||
if (familySync() == GLIBC) { | ||
switch (target) { | ||
case "linux-x64-musl": | ||
target = "linux-x64-gnu"; | ||
break; | ||
case "linux-arm64-musl": | ||
target = "linux-arm64-gnu"; | ||
break; | ||
} | ||
} | ||
return require(`@libsql/${target}`); | ||
} | ||
@@ -43,6 +48,13 @@ | ||
rowsNext, | ||
} = require(`@libsql/${target}`); | ||
} = requireNative(); | ||
const SqliteError = require("./sqlite-error"); | ||
function convertError(err) { | ||
if (err.libsqlError) { | ||
return new SqliteError(err.message, err.code, err.rawCode); | ||
} | ||
return err; | ||
} | ||
/** | ||
@@ -106,3 +118,3 @@ * Database represents a connection that can prepare and execute SQL statements. | ||
} catch (err) { | ||
throw new SqliteError(err.message, err.code, err.rawCode); | ||
throw convertError(err); | ||
} | ||
@@ -208,3 +220,3 @@ } | ||
} catch (err) { | ||
throw new SqliteError(err.message, err.code, err.rawCode); | ||
throw convertError(err); | ||
} | ||
@@ -265,5 +277,5 @@ } | ||
return statementRun.call(this.stmt, bindParameters.flat()); | ||
} | ||
} | ||
} catch (err) { | ||
throw new SqliteError(err.message, err.code, err.rawCode); | ||
throw convertError(err); | ||
} | ||
@@ -270,0 +282,0 @@ } |
{ | ||
"name": "libsql", | ||
"version": "0.3.10", | ||
"version": "0.3.11", | ||
"description": "A better-sqlite3 compatible API for libSQL that supports Bun, Deno, and Node", | ||
@@ -24,3 +24,6 @@ "os": [ | ||
"exports": { | ||
".": "./index.js", | ||
".": { | ||
"types": "./types/index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"./promise": "./promise.js" | ||
@@ -71,10 +74,10 @@ }, | ||
"optionalDependencies": { | ||
"@libsql/darwin-arm64": "0.3.10", | ||
"@libsql/darwin-x64": "0.3.10", | ||
"@libsql/linux-arm64-gnu": "0.3.10", | ||
"@libsql/linux-arm64-musl": "0.3.10", | ||
"@libsql/linux-x64-gnu": "0.3.10", | ||
"@libsql/linux-x64-musl": "0.3.10", | ||
"@libsql/win32-x64-msvc": "0.3.10" | ||
"@libsql/darwin-arm64": "0.3.11", | ||
"@libsql/darwin-x64": "0.3.11", | ||
"@libsql/linux-arm64-gnu": "0.3.11", | ||
"@libsql/linux-arm64-musl": "0.3.11", | ||
"@libsql/linux-x64-gnu": "0.3.11", | ||
"@libsql/linux-x64-musl": "0.3.11", | ||
"@libsql/win32-x64-msvc": "0.3.11" | ||
} | ||
} |
@@ -12,2 +12,28 @@ "use strict"; | ||
function convertError(err) { | ||
if (err.libsqlError) { | ||
return new SqliteError(err.message, err.code, err.rawCode); | ||
} | ||
return err; | ||
} | ||
function requireNative() { | ||
if (process.env.LIBSQL_JS_DEV) { | ||
return load(__dirname) | ||
} | ||
let target = currentTarget(); | ||
// Workaround for Bun, which reports a musl target, but really wants glibc... | ||
if (familySync() == GLIBC) { | ||
switch (target) { | ||
case "linux-x64-musl": | ||
target = "linux-x64-gnu"; | ||
break; | ||
case "linux-arm64-musl": | ||
target = "linux-arm64-gnu"; | ||
break; | ||
} | ||
} | ||
return require(`@libsql/${target}`); | ||
} | ||
const { | ||
@@ -30,3 +56,3 @@ databaseOpen, | ||
rowsNext, | ||
} = require(`@libsql/${currentTarget()}`); | ||
} = requireNative(); | ||
@@ -90,3 +116,3 @@ /** | ||
}).catch((err) => { | ||
throw new SqliteError(err.message, err.code, err.rawCode); | ||
throw convertError(err); | ||
}); | ||
@@ -190,3 +216,3 @@ } | ||
return databaseExecAsync.call(this.db, sql).catch((err) => { | ||
throw new SqliteError(err.message, err.code, err.rawCode); | ||
throw convertError(err); | ||
}); | ||
@@ -248,3 +274,3 @@ } | ||
} catch (err) { | ||
throw new SqliteError(err.message, err.code, err.rawCode); | ||
throw convertError(err); | ||
} | ||
@@ -251,0 +277,0 @@ } |
# libSQL API for JavaScript/TypeScript | ||
[![npm](https://badge.fury.io/js/libsql.svg)](https://badge.fury.io/js/libsql) | ||
[![Ask AI](https://img.shields.io/badge/Phorm-Ask_AI-%23F2777A.svg?&logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNSIgaGVpZ2h0PSI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxwYXRoIGQ9Ik00LjQzIDEuODgyYTEuNDQgMS40NCAwIDAgMS0uMDk4LjQyNmMtLjA1LjEyMy0uMTE1LjIzLS4xOTIuMzIyLS4wNzUuMDktLjE2LjE2NS0uMjU1LjIyNmExLjM1MyAxLjM1MyAwIDAgMS0uNTk1LjIxMmMtLjA5OS4wMTItLjE5Mi4wMTQtLjI3OS4wMDZsLTEuNTkzLS4xNHYtLjQwNmgxLjY1OGMuMDkuMDAxLjE3LS4xNjkuMjQ2LS4xOTFhLjYwMy42MDMgMCAwIDAgLjItLjEwNi41MjkuNTI5IDAgMCAwIC4xMzgtLjE3LjY1NC42NTQgMCAwIDAgLjA2NS0uMjRsLjAyOC0uMzJhLjkzLjkzIDAgMCAwLS4wMzYtLjI0OS41NjcuNTY3IDAgMCAwLS4xMDMtLjIuNTAyLjUwMiAwIDAgMC0uMTY4LS4xMzguNjA4LjYwOCAwIDAgMC0uMjQtLjA2N0wyLjQzNy43MjkgMS42MjUuNjcxYS4zMjIuMzIyIDAgMCAwLS4yMzIuMDU4LjM3NS4zNzUgMCAwIDAtLjExNi4yMzJsLS4xMTYgMS40NS0uMDU4LjY5Ny0uMDU4Ljc1NEwuNzA1IDRsLS4zNTctLjA3OUwuNjAyLjkwNkM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CAwIDEgLjU0NS40NDhjLjA2MS4wOTUuMTA5LjE5My4xNDQuMjk1YTEuNDA2IDEuNDA2IDAgMCAxIC4wNzcuNTgzbC0uMDI4LjMyMloiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=)](https://www.phorm.ai/query?projectId=3c9a471f-4a47-469f-81f6-4ea1ff9ab418) | ||
@@ -5,0 +6,0 @@ [libSQL](https://github.com/libsql/libsql) is an open source, open contribution fork of SQLite. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
34260
781
164
4