@sna-sdk/core 0.9.11 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db/schema.js +5 -3
- package/dist/electron/index.cjs +5 -3
- package/dist/node/index.cjs +0 -1
- package/dist/server/standalone.js +5 -3
- package/package.json +1 -1
package/dist/db/schema.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
|
|
4
|
+
function getDbPath() {
|
|
5
|
+
return process.env.SNA_DB_PATH ?? path.join(process.cwd(), "data/sna.db");
|
|
6
|
+
}
|
|
5
7
|
const NATIVE_DIR = path.join(process.cwd(), ".sna/native");
|
|
6
8
|
let _db = null;
|
|
7
9
|
function loadBetterSqlite3() {
|
|
@@ -24,10 +26,10 @@ function loadBetterSqlite3() {
|
|
|
24
26
|
function getDb() {
|
|
25
27
|
if (!_db) {
|
|
26
28
|
const BetterSqlite3 = loadBetterSqlite3();
|
|
27
|
-
const dir = path.dirname(
|
|
29
|
+
const dir = path.dirname(getDbPath());
|
|
28
30
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
29
31
|
const nativeBinding = process.env.SNA_SQLITE_NATIVE_BINDING || void 0;
|
|
30
|
-
_db = nativeBinding ? new BetterSqlite3(
|
|
32
|
+
_db = nativeBinding ? new BetterSqlite3(getDbPath(), { nativeBinding }) : new BetterSqlite3(getDbPath());
|
|
31
33
|
_db.pragma("journal_mode = WAL");
|
|
32
34
|
initSchema(_db);
|
|
33
35
|
}
|
package/dist/electron/index.cjs
CHANGED
|
@@ -701,7 +701,9 @@ var import_streaming = require("hono/streaming");
|
|
|
701
701
|
var import_node_module = require("module");
|
|
702
702
|
var import_fs4 = __toESM(require("fs"), 1);
|
|
703
703
|
var import_path4 = __toESM(require("path"), 1);
|
|
704
|
-
|
|
704
|
+
function getDbPath() {
|
|
705
|
+
return process.env.SNA_DB_PATH ?? import_path4.default.join(process.cwd(), "data/sna.db");
|
|
706
|
+
}
|
|
705
707
|
var NATIVE_DIR = import_path4.default.join(process.cwd(), ".sna/native");
|
|
706
708
|
var _db = null;
|
|
707
709
|
function loadBetterSqlite3() {
|
|
@@ -724,10 +726,10 @@ function loadBetterSqlite3() {
|
|
|
724
726
|
function getDb() {
|
|
725
727
|
if (!_db) {
|
|
726
728
|
const BetterSqlite3 = loadBetterSqlite3();
|
|
727
|
-
const dir = import_path4.default.dirname(
|
|
729
|
+
const dir = import_path4.default.dirname(getDbPath());
|
|
728
730
|
if (!import_fs4.default.existsSync(dir)) import_fs4.default.mkdirSync(dir, { recursive: true });
|
|
729
731
|
const nativeBinding = process.env.SNA_SQLITE_NATIVE_BINDING || void 0;
|
|
730
|
-
_db = nativeBinding ? new BetterSqlite3(
|
|
732
|
+
_db = nativeBinding ? new BetterSqlite3(getDbPath(), { nativeBinding }) : new BetterSqlite3(getDbPath());
|
|
731
733
|
_db.pragma("journal_mode = WAL");
|
|
732
734
|
initSchema(_db);
|
|
733
735
|
}
|
package/dist/node/index.cjs
CHANGED
|
@@ -695,7 +695,6 @@ var import_streaming = require("hono/streaming");
|
|
|
695
695
|
// src/db/schema.ts
|
|
696
696
|
var import_node_module = require("module");
|
|
697
697
|
var import_path4 = __toESM(require("path"), 1);
|
|
698
|
-
var DB_PATH = process.env.SNA_DB_PATH ?? import_path4.default.join(process.cwd(), "data/sna.db");
|
|
699
698
|
var NATIVE_DIR = import_path4.default.join(process.cwd(), ".sna/native");
|
|
700
699
|
|
|
701
700
|
// src/config.ts
|
|
@@ -13,7 +13,9 @@ import { streamSSE } from "hono/streaming";
|
|
|
13
13
|
import { createRequire } from "module";
|
|
14
14
|
import fs from "fs";
|
|
15
15
|
import path from "path";
|
|
16
|
-
|
|
16
|
+
function getDbPath() {
|
|
17
|
+
return process.env.SNA_DB_PATH ?? path.join(process.cwd(), "data/sna.db");
|
|
18
|
+
}
|
|
17
19
|
var NATIVE_DIR = path.join(process.cwd(), ".sna/native");
|
|
18
20
|
var _db = null;
|
|
19
21
|
function loadBetterSqlite3() {
|
|
@@ -36,10 +38,10 @@ function loadBetterSqlite3() {
|
|
|
36
38
|
function getDb() {
|
|
37
39
|
if (!_db) {
|
|
38
40
|
const BetterSqlite3 = loadBetterSqlite3();
|
|
39
|
-
const dir = path.dirname(
|
|
41
|
+
const dir = path.dirname(getDbPath());
|
|
40
42
|
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
41
43
|
const nativeBinding = process.env.SNA_SQLITE_NATIVE_BINDING || void 0;
|
|
42
|
-
_db = nativeBinding ? new BetterSqlite3(
|
|
44
|
+
_db = nativeBinding ? new BetterSqlite3(getDbPath(), { nativeBinding }) : new BetterSqlite3(getDbPath());
|
|
43
45
|
_db.pragma("journal_mode = WAL");
|
|
44
46
|
initSchema(_db);
|
|
45
47
|
}
|