@tursodatabase/database 0.7.2 → 0.8.0-pre.10

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.
@@ -43,16 +43,18 @@ test('exec multiple statements', async () => {
43
43
  const rows = stmt.all();
44
44
  expect(rows).toEqual([{ x: 1 }, { x: 2 }]);
45
45
  });
46
- test('expanded rows preserve positional values for duplicate column names', () => {
46
+ test('expanded rows collapse duplicate column names like better-sqlite3', () => {
47
47
  const db = new Database(":memory:");
48
48
  db.exec("CREATE TABLE role(path TEXT); CREATE TABLE org_unit(path TEXT)");
49
49
  db.exec("INSERT INTO role VALUES ('/Employee'); INSERT INTO org_unit VALUES ('/')");
50
- const row = db.prepare("SELECT role.path, org_unit.path FROM role JOIN org_unit").get();
50
+ const stmt = db.prepare("SELECT role.path, org_unit.path FROM role JOIN org_unit");
51
+ const row = stmt.get();
51
52
  expect(Object.keys(row)).toEqual(["path"]);
52
53
  expect(row.path).toBe("/");
53
- expect(row[0]).toBe("/Employee");
54
- expect(row[1]).toBe("/");
54
+ expect(row[0]).toBe(undefined);
55
+ expect(row[1]).toBe(undefined);
55
56
  expect(row).toEqual({ path: "/" });
57
+ expect(stmt.raw(true).get()).toEqual(["/Employee", "/"]);
56
58
  });
57
59
  test('readonly-db', () => {
58
60
  const path = `test-${(Math.random() * 10000) | 0}.db`;
@@ -29,6 +29,53 @@ test('in-memory-db-async', async () => {
29
29
  const rows = await stmt.all([1]);
30
30
  expect(rows).toEqual([{ x: 1 }, { x: 3 }]);
31
31
  });
32
+ test('busy timeout gives up on time when the write lock is never released', async () => {
33
+ const path = `test-${(Math.random() * 10000) | 0}.db`;
34
+ try {
35
+ const conn1 = await connect(path);
36
+ await conn1.exec("CREATE TABLE t(x)");
37
+ const conn2 = await connect(path, { timeout: 200 });
38
+ await conn1.exec("BEGIN");
39
+ await conn1.exec("INSERT INTO t VALUES (1)");
40
+ // conn1 never commits, so conn2 must retry for the whole 200ms budget
41
+ // and then surface the busy error — not fail fast, not hang. The
42
+ // backoff sleeps add up to exactly 200ms (measured ~205ms with timer
43
+ // slop); the upper bound only leaves room for slow CI timers.
44
+ const start = performance.now();
45
+ await expect(conn2.exec("INSERT INTO t VALUES (2)")).rejects.toThrow(/locked/);
46
+ const elapsed = performance.now() - start;
47
+ expect(elapsed).toBeGreaterThanOrEqual(190);
48
+ expect(elapsed).toBeLessThan(500);
49
+ await conn1.exec("ROLLBACK");
50
+ }
51
+ finally {
52
+ unlinkSync(path);
53
+ unlinkSync(`${path}-wal`);
54
+ }
55
+ });
56
+ test('busy timeout sleeps instead of blocking the event loop', async () => {
57
+ const path = `test-${(Math.random() * 10000) | 0}.db`;
58
+ try {
59
+ const conn1 = await connect(path);
60
+ await conn1.exec("CREATE TABLE t(x)");
61
+ const conn2 = await connect(path, { timeout: 5000 });
62
+ await conn1.exec("BEGIN");
63
+ await conn1.exec("INSERT INTO t VALUES (1)");
64
+ // conn2 hits conn1's write lock. Its step loop must park on a timer
65
+ // (STEP_SLEEP) and yield the event loop, or the timer below never
66
+ // fires, the lock is never released, and this test times out.
67
+ const blocked = conn2.exec("INSERT INTO t VALUES (2)");
68
+ await new Promise((resolve) => setTimeout(resolve, 100));
69
+ await conn1.exec("COMMIT");
70
+ await blocked;
71
+ const stmt = await conn1.prepare("SELECT COUNT(*) as cnt FROM t");
72
+ expect(await stmt.all()).toEqual([{ cnt: 2 }]);
73
+ }
74
+ finally {
75
+ unlinkSync(path);
76
+ unlinkSync(`${path}-wal`);
77
+ }
78
+ });
32
79
  test('exec multiple statements', async () => {
33
80
  const db = await connect(":memory:");
34
81
  await db.exec("CREATE TABLE t(x); INSERT INTO t VALUES (1); INSERT INTO t VALUES (2)");
@@ -36,16 +83,18 @@ test('exec multiple statements', async () => {
36
83
  const rows = await stmt.all();
37
84
  expect(rows).toEqual([{ x: 1 }, { x: 2 }]);
38
85
  });
39
- test('expanded rows preserve positional values for duplicate column names', async () => {
86
+ test('expanded rows collapse duplicate column names like better-sqlite3', async () => {
40
87
  const db = await connect(":memory:");
41
88
  await db.exec("CREATE TABLE role(path TEXT); CREATE TABLE org_unit(path TEXT)");
42
89
  await db.exec("INSERT INTO role VALUES ('/Employee'); INSERT INTO org_unit VALUES ('/')");
43
90
  const [row] = await db.all("SELECT role.path, org_unit.path FROM role JOIN org_unit");
44
91
  expect(Object.keys(row)).toEqual(["path"]);
45
92
  expect(row.path).toBe("/");
46
- expect(row[0]).toBe("/Employee");
47
- expect(row[1]).toBe("/");
93
+ expect(row[0]).toBe(undefined);
94
+ expect(row[1]).toBe(undefined);
48
95
  expect(row).toEqual({ path: "/" });
96
+ const stmt = await db.prepare("SELECT role.path, org_unit.path FROM role JOIN org_unit");
97
+ expect(await stmt.raw(true).get()).toEqual(["/Employee", "/"]);
49
98
  });
50
99
  test('readonly-db', async () => {
51
100
  const path = `test-${(Math.random() * 10000) | 0}.db`;
@@ -390,3 +439,172 @@ test('transactionAsync() rejects callbacks that do not declare the handle', asyn
390
439
  expect(() => db.transactionAsync(async () => { })).toThrow(/Transaction handle/);
391
440
  expect(() => db.transactionAsync((async (...args) => { }))).toThrow(/Transaction handle/);
392
441
  });
442
+ test('batch returns per-statement details and stops at the first failure', async () => {
443
+ const db = await connect(":memory:");
444
+ const results = await db.batch([
445
+ "CREATE TABLE t_batch (id INTEGER PRIMARY KEY, name TEXT)",
446
+ { sql: "INSERT INTO t_batch (name) VALUES (?)", args: ["Alice"] },
447
+ { sql: "INSERT INTO t_batch (name) VALUES (?)", args: ["Bob"] },
448
+ "SELECT name FROM t_batch ORDER BY id",
449
+ ]);
450
+ expect(results.length).toBe(4);
451
+ expect(results[1].rowsAffected).toBe(1);
452
+ expect(results[1].lastInsertRowid).toBe(1);
453
+ expect(results[2].lastInsertRowid).toBe(2);
454
+ expect(results[3].rows).toEqual([{ name: "Alice" }, { name: "Bob" }]);
455
+ // The embedded engine does not report per-statement execution
456
+ // statistics; the serverless driver fills these from the server.
457
+ expect(results[1].rowsRead).toBeUndefined();
458
+ expect(results[1].rowsWritten).toBeUndefined();
459
+ expect(results[1].queryDurationMs).toBeUndefined();
460
+ let error = null;
461
+ try {
462
+ await db.batch([
463
+ { sql: "INSERT INTO t_batch (name) VALUES (?)", args: ["Carol"] },
464
+ "INSERT INTO no_such_table VALUES (1)",
465
+ { sql: "INSERT INTO t_batch (name) VALUES (?)", args: ["Dave"] },
466
+ ]);
467
+ }
468
+ catch (e) {
469
+ error = e;
470
+ }
471
+ expect(error).not.toBeNull();
472
+ // The error identifies the failing statement and carries one entry
473
+ // per statement: the completed first statement's ResultSet, null for
474
+ // the failing statement and the skipped one after it.
475
+ expect(error.batchIndex).toBe(1);
476
+ expect(error.batchResults.length).toBe(3);
477
+ expect(error.batchResults[0].rowsAffected).toBe(1);
478
+ expect(error.batchResults[1]).toBeNull();
479
+ expect(error.batchResults[2]).toBeNull();
480
+ // Execution stopped at the failure: Carol committed, Dave never ran.
481
+ const stmt = await db.prepare("SELECT COUNT(*) AS n FROM t_batch");
482
+ expect(await stmt.all([])).toEqual([{ n: 3 }]);
483
+ });
484
+ test('atomic batch failure rolls back and reports the failing statement', async () => {
485
+ const db = await connect(":memory:");
486
+ await db.exec("CREATE TABLE t_atomic (x)");
487
+ let error = null;
488
+ try {
489
+ await db.batch([
490
+ { sql: "INSERT INTO t_atomic VALUES (?)", args: [1] },
491
+ "INSERT INTO no_such_table VALUES (1)",
492
+ ], "immediate");
493
+ }
494
+ catch (e) {
495
+ error = e;
496
+ }
497
+ expect(error).not.toBeNull();
498
+ expect(error.batchIndex).toBe(1);
499
+ expect(error.batchResults.length).toBe(2);
500
+ const stmt = await db.prepare("SELECT COUNT(*) AS n FROM t_atomic");
501
+ expect(await stmt.all([])).toEqual([{ n: 0 }]);
502
+ });
503
+ test('batch validates every bind value before executing the first statement', async () => {
504
+ const db = await connect(":memory:");
505
+ await db.exec("CREATE TABLE t_batch_bind_validation (x)");
506
+ let error;
507
+ try {
508
+ await db.batch([
509
+ { sql: "INSERT INTO t_batch_bind_validation VALUES (?)", args: [1] },
510
+ { sql: "INSERT INTO t_batch_bind_validation VALUES (?)", args: [Number.POSITIVE_INFINITY] },
511
+ ]);
512
+ }
513
+ catch (caught) {
514
+ error = caught;
515
+ }
516
+ expect(error.batchIndex).toBe(1);
517
+ expect(error.batchResults).toEqual([]);
518
+ const stmt = await db.prepare("SELECT COUNT(*) AS n FROM t_batch_bind_validation");
519
+ expect(await stmt.all([])).toEqual([{ n: 0 }]);
520
+ });
521
+ test('batch validates every bigint before executing the first statement', async () => {
522
+ const db = await connect(":memory:");
523
+ await db.exec("CREATE TABLE t_batch_bigint_validation (x)");
524
+ let error;
525
+ try {
526
+ await db.batch([
527
+ { sql: "INSERT INTO t_batch_bigint_validation VALUES (?)", args: [1] },
528
+ { sql: "INSERT INTO t_batch_bigint_validation VALUES (?)", args: [1n << 63n] },
529
+ ]);
530
+ }
531
+ catch (caught) {
532
+ error = caught;
533
+ }
534
+ expect(error.batchIndex).toBe(1);
535
+ expect(error.batchResults).toEqual([]);
536
+ const stmt = await db.prepare("SELECT COUNT(*) AS n FROM t_batch_bigint_validation");
537
+ expect(await stmt.all([])).toEqual([{ n: 0 }]);
538
+ });
539
+ test('batch coerces bind values once during validation', async () => {
540
+ const db = await connect(":memory:");
541
+ await db.exec("CREATE TABLE t_batch_coercion (x TEXT)");
542
+ let coercions = 0;
543
+ const value = {
544
+ toString() {
545
+ coercions++;
546
+ if (coercions > 1)
547
+ throw new Error("value was coerced twice");
548
+ return "coerced";
549
+ },
550
+ };
551
+ await db.batch([
552
+ { sql: "INSERT INTO t_batch_coercion VALUES (?)", args: [value] },
553
+ ]);
554
+ expect(coercions).toBe(1);
555
+ const stmt = await db.prepare("SELECT x FROM t_batch_coercion");
556
+ expect(await stmt.all([])).toEqual([{ x: "coerced" }]);
557
+ });
558
+ test('atomic batch rejects transaction control before BEGIN', async () => {
559
+ const db = await connect(":memory:");
560
+ await db.exec("CREATE TABLE t_batch_control (x)");
561
+ const controls = [
562
+ "BEGIN",
563
+ "COMMIT",
564
+ "END",
565
+ "ROLLBACK",
566
+ "SAVEPOINT nested",
567
+ "RELEASE nested",
568
+ "\ufeffCOMMIT",
569
+ ];
570
+ for (const control of controls) {
571
+ let error;
572
+ try {
573
+ await db.batch([
574
+ "INSERT INTO t_batch_control VALUES (1)",
575
+ ` ; \n-- leading line comment\n; /* leading block comment */ ${control}`,
576
+ ], "immediate");
577
+ }
578
+ catch (caught) {
579
+ error = caught;
580
+ }
581
+ expect(error.batchIndex).toBe(1);
582
+ expect(error.batchResults).toEqual([]);
583
+ }
584
+ const stmt = await db.prepare("SELECT COUNT(*) AS n FROM t_batch_control");
585
+ expect(await stmt.all([])).toEqual([{ n: 0 }]);
586
+ });
587
+ test('atomic batch attaches a rollback failure to the primary error', async () => {
588
+ const db = await connect(":memory:");
589
+ const native = db.db;
590
+ const originalExecutor = native.executor.bind(native);
591
+ native.executor = (sql, ...args) => {
592
+ if (sql === "ROLLBACK")
593
+ throw new Error("rollback failed");
594
+ return originalExecutor(sql, ...args);
595
+ };
596
+ let error;
597
+ try {
598
+ await db.batch(["INSERT INTO no_such_batch_table VALUES (1)"], "immediate");
599
+ }
600
+ catch (caught) {
601
+ error = caught;
602
+ }
603
+ finally {
604
+ native.executor = originalExecutor;
605
+ }
606
+ expect(error).toBeInstanceOf(Error);
607
+ expect(error.message).toMatch(/no_such_batch_table/);
608
+ expect(error.rollbackError).toBeInstanceOf(Error);
609
+ expect(error.rollbackError.message).toBe("rollback failed");
610
+ });
package/index.js CHANGED
@@ -81,8 +81,8 @@ function requireNative() {
81
81
  try {
82
82
  const binding = require('@tursodatabase/database-android-arm64')
83
83
  const bindingPackageVersion = require('@tursodatabase/database-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
86
  }
87
87
  return binding
88
88
  } catch (e) {
@@ -97,8 +97,8 @@ function requireNative() {
97
97
  try {
98
98
  const binding = require('@tursodatabase/database-android-arm-eabi')
99
99
  const bindingPackageVersion = require('@tursodatabase/database-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
102
  }
103
103
  return binding
104
104
  } catch (e) {
@@ -117,8 +117,8 @@ function requireNative() {
117
117
  try {
118
118
  const binding = require('@tursodatabase/database-win32-x64-msvc')
119
119
  const bindingPackageVersion = require('@tursodatabase/database-win32-x64-msvc/package.json').version
120
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
120
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
121
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
122
122
  }
123
123
  return binding
124
124
  } catch (e) {
@@ -133,8 +133,8 @@ function requireNative() {
133
133
  try {
134
134
  const binding = require('@tursodatabase/database-win32-ia32-msvc')
135
135
  const bindingPackageVersion = require('@tursodatabase/database-win32-ia32-msvc/package.json').version
136
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
137
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
138
138
  }
139
139
  return binding
140
140
  } catch (e) {
@@ -149,8 +149,8 @@ function requireNative() {
149
149
  try {
150
150
  const binding = require('@tursodatabase/database-win32-arm64-msvc')
151
151
  const bindingPackageVersion = require('@tursodatabase/database-win32-arm64-msvc/package.json').version
152
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
153
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
154
154
  }
155
155
  return binding
156
156
  } catch (e) {
@@ -168,8 +168,8 @@ function requireNative() {
168
168
  try {
169
169
  const binding = require('@tursodatabase/database-darwin-universal')
170
170
  const bindingPackageVersion = require('@tursodatabase/database-darwin-universal/package.json').version
171
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
173
173
  }
174
174
  return binding
175
175
  } catch (e) {
@@ -184,8 +184,8 @@ function requireNative() {
184
184
  try {
185
185
  const binding = require('@tursodatabase/database-darwin-x64')
186
186
  const bindingPackageVersion = require('@tursodatabase/database-darwin-x64/package.json').version
187
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
188
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
189
189
  }
190
190
  return binding
191
191
  } catch (e) {
@@ -200,8 +200,8 @@ function requireNative() {
200
200
  try {
201
201
  const binding = require('@tursodatabase/database-darwin-arm64')
202
202
  const bindingPackageVersion = require('@tursodatabase/database-darwin-arm64/package.json').version
203
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
204
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
205
205
  }
206
206
  return binding
207
207
  } catch (e) {
@@ -220,8 +220,8 @@ function requireNative() {
220
220
  try {
221
221
  const binding = require('@tursodatabase/database-freebsd-x64')
222
222
  const bindingPackageVersion = require('@tursodatabase/database-freebsd-x64/package.json').version
223
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
224
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
225
225
  }
226
226
  return binding
227
227
  } catch (e) {
@@ -236,8 +236,8 @@ function requireNative() {
236
236
  try {
237
237
  const binding = require('@tursodatabase/database-freebsd-arm64')
238
238
  const bindingPackageVersion = require('@tursodatabase/database-freebsd-arm64/package.json').version
239
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
240
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
241
241
  }
242
242
  return binding
243
243
  } catch (e) {
@@ -257,8 +257,8 @@ function requireNative() {
257
257
  try {
258
258
  const binding = require('@tursodatabase/database-linux-x64-musl')
259
259
  const bindingPackageVersion = require('@tursodatabase/database-linux-x64-musl/package.json').version
260
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
260
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
261
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
262
262
  }
263
263
  return binding
264
264
  } catch (e) {
@@ -273,8 +273,8 @@ function requireNative() {
273
273
  try {
274
274
  const binding = require('@tursodatabase/database-linux-x64-gnu')
275
275
  const bindingPackageVersion = require('@tursodatabase/database-linux-x64-gnu/package.json').version
276
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
277
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
278
278
  }
279
279
  return binding
280
280
  } catch (e) {
@@ -291,8 +291,8 @@ function requireNative() {
291
291
  try {
292
292
  const binding = require('@tursodatabase/database-linux-arm64-musl')
293
293
  const bindingPackageVersion = require('@tursodatabase/database-linux-arm64-musl/package.json').version
294
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
296
  }
297
297
  return binding
298
298
  } catch (e) {
@@ -307,8 +307,8 @@ function requireNative() {
307
307
  try {
308
308
  const binding = require('@tursodatabase/database-linux-arm64-gnu')
309
309
  const bindingPackageVersion = require('@tursodatabase/database-linux-arm64-gnu/package.json').version
310
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
311
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
312
312
  }
313
313
  return binding
314
314
  } catch (e) {
@@ -325,8 +325,8 @@ function requireNative() {
325
325
  try {
326
326
  const binding = require('@tursodatabase/database-linux-arm-musleabihf')
327
327
  const bindingPackageVersion = require('@tursodatabase/database-linux-arm-musleabihf/package.json').version
328
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
330
  }
331
331
  return binding
332
332
  } catch (e) {
@@ -341,8 +341,8 @@ function requireNative() {
341
341
  try {
342
342
  const binding = require('@tursodatabase/database-linux-arm-gnueabihf')
343
343
  const bindingPackageVersion = require('@tursodatabase/database-linux-arm-gnueabihf/package.json').version
344
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
345
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
346
346
  }
347
347
  return binding
348
348
  } catch (e) {
@@ -359,8 +359,8 @@ function requireNative() {
359
359
  try {
360
360
  const binding = require('@tursodatabase/database-linux-riscv64-musl')
361
361
  const bindingPackageVersion = require('@tursodatabase/database-linux-riscv64-musl/package.json').version
362
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
364
  }
365
365
  return binding
366
366
  } catch (e) {
@@ -375,8 +375,8 @@ function requireNative() {
375
375
  try {
376
376
  const binding = require('@tursodatabase/database-linux-riscv64-gnu')
377
377
  const bindingPackageVersion = require('@tursodatabase/database-linux-riscv64-gnu/package.json').version
378
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
379
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
380
380
  }
381
381
  return binding
382
382
  } catch (e) {
@@ -392,8 +392,8 @@ function requireNative() {
392
392
  try {
393
393
  const binding = require('@tursodatabase/database-linux-ppc64-gnu')
394
394
  const bindingPackageVersion = require('@tursodatabase/database-linux-ppc64-gnu/package.json').version
395
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
395
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
396
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
397
397
  }
398
398
  return binding
399
399
  } catch (e) {
@@ -408,8 +408,8 @@ function requireNative() {
408
408
  try {
409
409
  const binding = require('@tursodatabase/database-linux-s390x-gnu')
410
410
  const bindingPackageVersion = require('@tursodatabase/database-linux-s390x-gnu/package.json').version
411
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
412
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
413
413
  }
414
414
  return binding
415
415
  } catch (e) {
@@ -428,8 +428,8 @@ function requireNative() {
428
428
  try {
429
429
  const binding = require('@tursodatabase/database-openharmony-arm64')
430
430
  const bindingPackageVersion = require('@tursodatabase/database-openharmony-arm64/package.json').version
431
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
432
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
432
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
433
433
  }
434
434
  return binding
435
435
  } catch (e) {
@@ -444,8 +444,8 @@ function requireNative() {
444
444
  try {
445
445
  const binding = require('@tursodatabase/database-openharmony-x64')
446
446
  const bindingPackageVersion = require('@tursodatabase/database-openharmony-x64/package.json').version
447
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
449
449
  }
450
450
  return binding
451
451
  } catch (e) {
@@ -460,8 +460,8 @@ function requireNative() {
460
460
  try {
461
461
  const binding = require('@tursodatabase/database-openharmony-arm')
462
462
  const bindingPackageVersion = require('@tursodatabase/database-openharmony-arm/package.json').version
463
- if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '0.8.0-pre.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
+ throw new Error(`Native binding package version mismatch, expected 0.8.0-pre.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
465
  }
466
466
  return binding
467
467
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tursodatabase/database",
3
- "version": "0.7.2",
3
+ "version": "0.8.0-pre.10",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tursodatabase/turso"
@@ -26,7 +26,7 @@
26
26
  "drizzle-kit": "^0.31.4",
27
27
  "drizzle-orm": "^0.45.2",
28
28
  "typescript": "^5.9.2",
29
- "vitest": "^3.2.4"
29
+ "vitest": "^3.2.7"
30
30
  },
31
31
  "scripts": {
32
32
  "napi-build": "napi build --platform --profile release-official --esm --manifest-path ../../Cargo.toml --output-dir .",
@@ -49,15 +49,15 @@
49
49
  ]
50
50
  },
51
51
  "dependencies": {
52
- "@tursodatabase/database-common": "^0.7.2"
52
+ "@tursodatabase/database-common": "^0.8.0-pre.10"
53
53
  },
54
54
  "imports": {
55
55
  "#index": "./index.js"
56
56
  },
57
57
  "optionalDependencies": {
58
- "@tursodatabase/database-linux-x64-gnu": "0.7.2",
59
- "@tursodatabase/database-win32-x64-msvc": "0.7.2",
60
- "@tursodatabase/database-darwin-arm64": "0.7.2",
61
- "@tursodatabase/database-linux-arm64-gnu": "0.7.2"
58
+ "@tursodatabase/database-linux-x64-gnu": "0.8.0-pre.10",
59
+ "@tursodatabase/database-win32-x64-msvc": "0.8.0-pre.10",
60
+ "@tursodatabase/database-darwin-arm64": "0.8.0-pre.10",
61
+ "@tursodatabase/database-linux-arm64-gnu": "0.8.0-pre.10"
62
62
  }
63
63
  }