@minatojs/driver-sqlite
Advanced tools
Comparing version 3.3.8 to 3.3.9
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { Database, Driver, Eval, Selection } from '@minatojs/core'; | ||
@@ -29,2 +30,3 @@ import { Builder } from '@minatojs/sql-utils'; | ||
init(buffer: ArrayLike<number> | null): void; | ||
load(): Promise<Buffer | null>; | ||
start(): Promise<void>; | ||
@@ -31,0 +33,0 @@ stop(): Promise<void>; |
@@ -213,8 +213,17 @@ "use strict"; | ||
} | ||
async load() { | ||
if (this.config.path === ":memory:") | ||
return null; | ||
try { | ||
return Buffer.from(await import_fs.promises.readFile(this.config.path)); | ||
} catch { | ||
return null; | ||
} | ||
} | ||
async start() { | ||
const [sqlite, buffer] = await Promise.all([ | ||
(0, import_sql.default)({ | ||
locateFile: (file) => process.env.KOISHI_BASE ? process.env.KOISHI_BASE + "/" + file : require.resolve("@minatojs/sql.js/dist/sql-wasm.wasm") | ||
locateFile: (file) => process.env.KOISHI_BASE ? process.env.KOISHI_BASE + "/" + file : process.env.KOISHI_ENV === "browser" ? "/" + file : require.resolve("@minatojs/sql.js/dist/" + file) | ||
}), | ||
this.config.path === ":memory:" ? null : import_fs.promises.readFile(this.config.path).catch(() => null) | ||
this.load() | ||
]); | ||
@@ -221,0 +230,0 @@ this.sqlite = sqlite; |
{ | ||
"name": "@minatojs/driver-sqlite", | ||
"version": "3.3.8", | ||
"version": "3.3.9", | ||
"description": "SQLite Driver for Minato", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
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
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
39773
427
5