jsql-neo 6.9.0 → 6.9.1

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **One engine to rule them all** — a Rust-powered embedded database that speaks your language:
4
4
  > MySQL, PostgreSQL, MongoDB, Redis, SQL, TypeScript, **and the browser**.
5
5
 
6
- > **v6.9.0** — stable release · [github.com/vexify-org/JSQL-neo](https://github.com/vexify-org/JSQL-neo) · [jsql.vexify.top](https://jsql.vexify.top)
6
+ > **v6.9.1** — stable release · [github.com/vexify-org/JSQL-neo](https://github.com/vexify-org/JSQL-neo) · [jsql.vexify.top](https://jsql.vexify.top)
7
7
 
8
8
  ![Engines](https://img.shields.io/badge/engines-Native%20%7C%20WASM%20%7C%20Pure%20JS-7ee787)
9
9
  ![MySQL](https://img.shields.io/badge/protocol-MySQL%20compatible-1f6feb)
@@ -175,7 +175,9 @@ writes on exit. Every `insert` / `insertMany` / `update` / `updateById` / `remov
175
175
  writes it to the kernel before returning, so a `kill -9` loses nothing that already
176
176
  committed. `fsync` is coalesced into a short window (`walSyncInterval`, default 20 ms)
177
177
  so bulk single-row writes no longer pay one disk flush per row — set it to `0` for the
178
- strictest per-write `fsync` behaviour (roughly an order of magnitude slower).
178
+ strictest per-write `fsync` behaviour (roughly an order of magnitude slower). Each insert
179
+ still appends its own record; `db.syncWAL()` forces an immediate lightweight `fsync`
180
+ (no snapshot) when you need a durability barrier at an exact point.
179
181
  `save()` / `close()` / `stop()` checkpoint the WAL (write a full snapshot, `fsync`, then
180
182
  truncate) and always flush any pending window first.
181
183
  WAL is on by default for file mode — pass `wal: false` for the old semantics, or tune
package/index.d.ts CHANGED
@@ -361,6 +361,8 @@ declare namespace JSQLNeo {
361
361
  constructor(filePath?: string, options?: DatabaseOptions);
362
362
  createTable(name: string, schema: Schema): Promise<unknown>;
363
363
  insert(table: string, data: Record<string, unknown>): Promise<unknown>;
364
+ /** 轻量持久化屏障:只 fsync 已写入的 WAL 记录,不写全量快照。 */
365
+ syncWAL(): this;
364
366
  find(table: string, filter?: Record<string, unknown>): Promise<Row[]>;
365
367
  exists(table: string, filter?: Record<string, unknown>): boolean;
366
368
  prepare(sql: string): PreparedStatement;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * JSQL-NEO v6.9.0 — Rust-Powered Embedded Database (WASM + HTTP)
2
+ * JSQL-NEO v6.9.1 — Rust-Powered Embedded Database (WASM + HTTP)
3
3
  *
4
4
  * @example
5
5
  * const jsql = require('jsql-neo');
package/lib/database.js CHANGED
@@ -2668,6 +2668,18 @@ class Database {
2668
2668
  return this;
2669
2669
  }
2670
2670
 
2671
+ /**
2672
+ * 轻量持久化屏障:只把已写入的 WAL 记录 fsync 到磁盘,不写全量快照。
2673
+ *
2674
+ * 每条记录在写入时已单独 append 并 write() 进内核;默认 fsync 按
2675
+ * `walSyncInterval` 窗口合并。需要「此刻就必须抗掉电」时调用本方法,
2676
+ * 比 flush()/save()(全量快照)轻得多。
2677
+ */
2678
+ syncWAL() {
2679
+ if (this._walEnabled) this._syncWAL();
2680
+ return this;
2681
+ }
2682
+
2671
2683
  _resolveId(table, id) {
2672
2684
  const pk = this._pkOf(table);
2673
2685
  if (pk) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsql-neo",
3
- "version": "6.9.0",
3
+ "version": "6.9.1",
4
4
  "description": "JSQL-NEO — Rust-powered embedded database with WASM, REST API, B-Tree indexes, WAL, crash recovery",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",