@tikoci/rosetta 0.7.7 → 0.8.0
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/package.json +1 -1
- package/src/setup.ts +7 -3
package/package.json
CHANGED
package/src/setup.ts
CHANGED
|
@@ -40,8 +40,12 @@ function dbHasData(dbPath: string): boolean {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
/** Open a DB
|
|
44
|
-
* Exported so tests can validate fixture DBs without depending on network.
|
|
43
|
+
/** Open a DB and return its key health metrics. Returns null on error.
|
|
44
|
+
* Exported so tests can validate fixture DBs without depending on network.
|
|
45
|
+
* Note: do NOT pass { readonly: true } — freshly written SQLite WAL-mode files
|
|
46
|
+
* fail to open readonly on macOS until a read-write connection initialises the
|
|
47
|
+
* WAL shared-memory file. probeDb always operates on a temp or new file so
|
|
48
|
+
* read-write access is safe. */
|
|
45
49
|
export function probeDb(dbPath: string): {
|
|
46
50
|
schemaVersion: number;
|
|
47
51
|
pages: number;
|
|
@@ -50,7 +54,7 @@ export function probeDb(dbPath: string): {
|
|
|
50
54
|
} | null {
|
|
51
55
|
try {
|
|
52
56
|
const { default: sqlite } = require("bun:sqlite");
|
|
53
|
-
const check = new sqlite(dbPath
|
|
57
|
+
const check = new sqlite(dbPath);
|
|
54
58
|
const ver = check.prepare("PRAGMA user_version").get() as { user_version: number };
|
|
55
59
|
const pages = check.prepare("SELECT COUNT(*) AS c FROM pages").get() as { c: number };
|
|
56
60
|
const cmds = check.prepare("SELECT COUNT(*) AS c FROM commands").get() as { c: number };
|