@tursodatabase/database 0.6.0-pre.9 → 0.7.0-pre.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.
@@ -1 +1 @@
1
- {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,WAAW,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAG3G,cAAM,QAAS,SAAQ,eAAe;gBACtB,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB;CAGpD;AAED;;;;;;GAMG;AACH,iBAAe,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI/E;AAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,WAAW,EAAE,YAAY,EAAoB,MAAM,gCAAgC,CAAA;AAoB7H,cAAM,QAAS,SAAQ,eAAe;gBACtB,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB;CAUpD;AAED;;;;;;GAMG;AACH,iBAAe,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAI/E;AAED,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA"}
package/dist/promise.js CHANGED
@@ -1,8 +1,31 @@
1
1
  import { DatabasePromise, SqliteError } from "@tursodatabase/database-common";
2
- import { Database as NativeDB } from "#index";
2
+ import { Database as NativeDB, EncryptionCipher as NativeEncryptionCipher } from "#index";
3
+ // Map string cipher names to native enum values (lazy to avoid errors if native module lacks encryption)
4
+ function getCipherValue(cipher) {
5
+ if (!NativeEncryptionCipher) {
6
+ throw new Error('Encryption is not supported in this build');
7
+ }
8
+ const cipherMap = {
9
+ 'aes128gcm': NativeEncryptionCipher.Aes128Gcm,
10
+ 'aes256gcm': NativeEncryptionCipher.Aes256Gcm,
11
+ 'aegis256': NativeEncryptionCipher.Aegis256,
12
+ 'aegis256x2': NativeEncryptionCipher.Aegis256x2,
13
+ 'aegis128l': NativeEncryptionCipher.Aegis128l,
14
+ 'aegis128x2': NativeEncryptionCipher.Aegis128x2,
15
+ 'aegis128x4': NativeEncryptionCipher.Aegis128x4,
16
+ };
17
+ return cipherMap[cipher];
18
+ }
3
19
  class Database extends DatabasePromise {
4
20
  constructor(path, opts = {}) {
5
- super(new NativeDB(path, opts));
21
+ const nativeOpts = { ...opts };
22
+ if (opts.encryption) {
23
+ nativeOpts.encryption = {
24
+ cipher: getCipherValue(opts.encryption.cipher),
25
+ hexkey: opts.encryption.hexkey,
26
+ };
27
+ }
28
+ super(new NativeDB(path, nativeOpts));
6
29
  }
7
30
  }
8
31
  /**
@@ -25,14 +25,14 @@ test('in-memory-db-async', async () => {
25
25
  const db = await connect(":memory:");
26
26
  await db.exec("CREATE TABLE t(x)");
27
27
  await db.exec("INSERT INTO t VALUES (1), (2), (3)");
28
- const stmt = db.prepare("SELECT * FROM t WHERE x % 2 = ?");
28
+ const stmt = await db.prepare("SELECT * FROM t WHERE x % 2 = ?");
29
29
  const rows = await stmt.all([1]);
30
30
  expect(rows).toEqual([{ x: 1 }, { x: 3 }]);
31
31
  });
32
32
  test('exec multiple statements', async () => {
33
33
  const db = await connect(":memory:");
34
34
  await db.exec("CREATE TABLE t(x); INSERT INTO t VALUES (1); INSERT INTO t VALUES (2)");
35
- const stmt = db.prepare("SELECT * FROM t");
35
+ const stmt = await db.prepare("SELECT * FROM t");
36
36
  const rows = await stmt.all();
37
37
  expect(rows).toEqual([{ x: 1 }, { x: 2 }]);
38
38
  });
@@ -48,7 +48,7 @@ test('readonly-db', async () => {
48
48
  {
49
49
  const ro = await connect(path, { readonly: true });
50
50
  await expect(async () => await ro.exec("INSERT INTO t VALUES (2)")).rejects.toThrowError(/Resource is read-only/g);
51
- expect(await ro.prepare("SELECT * FROM t").all()).toEqual([{ x: 1 }]);
51
+ expect(await (await ro.prepare("SELECT * FROM t")).all()).toEqual([{ x: 1 }]);
52
52
  ro.close();
53
53
  }
54
54
  }
@@ -63,28 +63,28 @@ test('file-must-exist', async () => {
63
63
  });
64
64
  test('implicit connect', async () => {
65
65
  const db = new Database(':memory:');
66
- const defer = db.prepare("SELECT * FROM t");
66
+ const defer = await db.prepare("SELECT * FROM t");
67
67
  await expect(async () => await defer.all()).rejects.toThrowError(/no such table: t/);
68
- expect(() => db.prepare("SELECT * FROM t")).toThrowError(/no such table: t/);
69
- expect(await db.prepare("SELECT 1 as x").all()).toEqual([{ x: 1 }]);
68
+ await expect(async () => await db.prepare("SELECT * FROM t")).rejects.toThrowError(/no such table: t/);
69
+ expect(await (await db.prepare("SELECT 1 as x")).all()).toEqual([{ x: 1 }]);
70
70
  });
71
71
  test('zero-limit-bug', async () => {
72
72
  const db = await connect(':memory:');
73
- const create = db.prepare(`CREATE TABLE users (name TEXT NOT NULL);`);
73
+ const create = await db.prepare(`CREATE TABLE users (name TEXT NOT NULL);`);
74
74
  await create.run();
75
- const insert = db.prepare(`insert into "users" values (?), (?), (?);`);
75
+ const insert = await db.prepare(`insert into "users" values (?), (?), (?);`);
76
76
  await insert.run('John', 'Jane', 'Jack');
77
- const stmt1 = db.prepare(`select * from "users" limit ?;`);
77
+ const stmt1 = await db.prepare(`select * from "users" limit ?;`);
78
78
  expect(await stmt1.all(0)).toEqual([]);
79
79
  let rows = [{ name: 'John' }, { name: 'Jane' }, { name: 'Jack' }, { name: 'John' }, { name: 'Jane' }, { name: 'Jack' }];
80
80
  for (const limit of [0, 1, 2, 3, 4, 5, 6, 7]) {
81
- const stmt2 = db.prepare(`select * from "users" union all select * from "users" limit ?;`);
81
+ const stmt2 = await db.prepare(`select * from "users" union all select * from "users" limit ?;`);
82
82
  expect(await stmt2.all(limit)).toEqual(rows.slice(0, Math.min(limit, 6)));
83
83
  }
84
84
  });
85
85
  test('avg-bug', async () => {
86
86
  const db = await connect(':memory:');
87
- const create = db.prepare(`create table "aggregate_table" (
87
+ const create = await db.prepare(`create table "aggregate_table" (
88
88
  "id" integer primary key autoincrement not null,
89
89
  "name" text not null,
90
90
  "a" integer,
@@ -93,20 +93,20 @@ test('avg-bug', async () => {
93
93
  "null_only" integer
94
94
  );`);
95
95
  await create.run();
96
- const insert = db.prepare(`insert into "aggregate_table" ("id", "name", "a", "b", "c", "null_only") values (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null);`);
96
+ const insert = await db.prepare(`insert into "aggregate_table" ("id", "name", "a", "b", "c", "null_only") values (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null), (null, ?, ?, ?, ?, null);`);
97
97
  await insert.run('value 1', 5, 10, 20, 'value 1', 5, 20, 30, 'value 2', 10, 50, 60, 'value 3', 20, 20, null, 'value 4', null, 90, 120, 'value 5', 80, 10, null, 'value 6', null, null, 150);
98
- expect(await db.prepare(`select avg("a") from "aggregate_table";`).get()).toEqual({ 'avg (aggregate_table.a)': 24 });
99
- expect(await db.prepare(`select avg("null_only") from "aggregate_table";`).get()).toEqual({ 'avg (aggregate_table.null_only)': null });
100
- expect(await db.prepare(`select avg(distinct "b") from "aggregate_table";`).get()).toEqual({ 'avg (DISTINCT aggregate_table.b)': 42.5 });
98
+ expect(await (await db.prepare(`select avg("a") from "aggregate_table";`)).get()).toEqual({ 'avg("a")': 24 });
99
+ expect(await (await db.prepare(`select avg("null_only") from "aggregate_table";`)).get()).toEqual({ 'avg("null_only")': null });
100
+ expect(await (await db.prepare(`select avg(distinct "b") from "aggregate_table";`)).get()).toEqual({ 'avg(distinct "b")': 42.5 });
101
101
  });
102
102
  test('insert returning test', async () => {
103
103
  const db = await connect(':memory:');
104
- await db.prepare(`create table t (x);`).run();
105
- const x1 = await db.prepare(`insert into t values (1), (2) returning x`).get();
106
- const x2 = await db.prepare(`insert into t values (3), (4) returning x`).get();
104
+ await (await db.prepare(`create table t (x);`)).run();
105
+ const x1 = await (await db.prepare(`insert into t values (1), (2) returning x`)).get();
106
+ const x2 = await (await db.prepare(`insert into t values (3), (4) returning x`)).get();
107
107
  expect(x1).toEqual({ x: 1 });
108
108
  expect(x2).toEqual({ x: 3 });
109
- const all = await db.prepare(`select * from t`).all();
109
+ const all = await (await db.prepare(`select * from t`)).all();
110
110
  expect(all).toEqual([{ x: 1 }, { x: 2 }, { x: 3 }, { x: 4 }]);
111
111
  });
112
112
  test('offset-bug', async () => {
@@ -116,24 +116,24 @@ test('offset-bug', async () => {
116
116
  name TEXT NOT NULL,
117
117
  verified integer not null default 0
118
118
  );`);
119
- const insert = db.prepare(`INSERT INTO users (name) VALUES (?),(?);`);
119
+ const insert = await db.prepare(`INSERT INTO users (name) VALUES (?),(?);`);
120
120
  await insert.run('John', 'John1');
121
- const stmt = db.prepare(`SELECT * FROM users LIMIT ? OFFSET ?;`);
121
+ const stmt = await db.prepare(`SELECT * FROM users LIMIT ? OFFSET ?;`);
122
122
  expect(await stmt.all(1, 1)).toEqual([{ id: 2, name: 'John1', verified: 0 }]);
123
123
  });
124
124
  test('conflict-bug', async () => {
125
125
  const db = await connect(':memory:');
126
- const create = db.prepare(`create table "conflict_chain_example" (
126
+ const create = await db.prepare(`create table "conflict_chain_example" (
127
127
  id integer not null unique,
128
128
  name text not null,
129
129
  email text not null,
130
130
  primary key (id, name)
131
131
  )`);
132
132
  await create.run();
133
- await db.prepare(`insert into "conflict_chain_example" ("id", "name", "email") values (?, ?, ?), (?, ?, ?)`).run(1, 'John', 'john@example.com', 2, 'John Second', '2john@example.com');
134
- const insert = db.prepare(`insert into "conflict_chain_example" ("id", "name", "email") values (?, ?, ?), (?, ?, ?) on conflict ("conflict_chain_example"."id", "conflict_chain_example"."name") do update set "email" = ? on conflict ("conflict_chain_example"."id") do nothing`);
133
+ await (await db.prepare(`insert into "conflict_chain_example" ("id", "name", "email") values (?, ?, ?), (?, ?, ?)`)).run(1, 'John', 'john@example.com', 2, 'John Second', '2john@example.com');
134
+ const insert = await db.prepare(`insert into "conflict_chain_example" ("id", "name", "email") values (?, ?, ?), (?, ?, ?) on conflict ("conflict_chain_example"."id", "conflict_chain_example"."name") do update set "email" = ? on conflict ("conflict_chain_example"."id") do nothing`);
135
135
  await insert.run(1, 'John', 'john@example.com', 2, 'Anthony', 'idthief@example.com', 'john1@example.com');
136
- expect(await db.prepare("SELECT * FROM conflict_chain_example").all()).toEqual([
136
+ expect(await (await db.prepare("SELECT * FROM conflict_chain_example")).all()).toEqual([
137
137
  { id: 1, name: 'John', email: 'john1@example.com' },
138
138
  { id: 2, name: 'John Second', email: '2john@example.com' }
139
139
  ]);
@@ -144,13 +144,13 @@ test('on-disk db', async () => {
144
144
  const db1 = await connect(path);
145
145
  await db1.exec("CREATE TABLE t(x)");
146
146
  await db1.exec("INSERT INTO t VALUES (1), (2), (3)");
147
- const stmt1 = db1.prepare("SELECT * FROM t WHERE x % 2 = ?");
147
+ const stmt1 = await db1.prepare("SELECT * FROM t WHERE x % 2 = ?");
148
148
  expect(stmt1.columns()).toEqual([{ name: "x", column: null, database: null, table: null, type: null }]);
149
149
  const rows1 = await stmt1.all([1]);
150
150
  expect(rows1).toEqual([{ x: 1 }, { x: 3 }]);
151
151
  db1.close();
152
152
  const db2 = await connect(path);
153
- const stmt2 = db2.prepare("SELECT * FROM t WHERE x % 2 = ?");
153
+ const stmt2 = await db2.prepare("SELECT * FROM t WHERE x % 2 = ?");
154
154
  expect(stmt2.columns()).toEqual([{ name: "x", column: null, database: null, table: null, type: null }]);
155
155
  const rows2 = await stmt2.all([1]);
156
156
  expect(rows2).toEqual([{ x: 1 }, { x: 3 }]);
@@ -172,7 +172,7 @@ test('attach', async () => {
172
172
  await db2.exec("CREATE TABLE q(x)");
173
173
  await db2.exec("INSERT INTO q VALUES (4), (5), (6)");
174
174
  await db1.exec(`ATTACH '${path2}' as secondary`);
175
- const stmt = db1.prepare("SELECT * FROM t UNION ALL SELECT * FROM secondary.q");
175
+ const stmt = await db1.prepare("SELECT * FROM t UNION ALL SELECT * FROM secondary.q");
176
176
  expect(stmt.columns()).toEqual([{ name: "x", column: null, database: null, table: null, type: null }]);
177
177
  const rows = await stmt.all([1]);
178
178
  expect(rows).toEqual([{ x: 1 }, { x: 2 }, { x: 3 }, { x: 4 }, { x: 5 }, { x: 6 }]);
@@ -194,34 +194,70 @@ test('fts', async () => {
194
194
  CREATE INDEX documents_fts ON documents USING fts (title, body);
195
195
  `);
196
196
  // fts_match search
197
- const matchResults = await db.prepare("SELECT id, title, fts_score(title, body, 'programming language') as score FROM documents WHERE fts_match(title, body, 'programming language')").all();
197
+ const matchResults = await (await db.prepare("SELECT id, title, fts_score(title, body, 'programming language') as score FROM documents WHERE fts_match(title, body, 'programming language')")).all();
198
198
  expect(matchResults.length).toBe(2);
199
199
  expect(matchResults.map(r => r.id).sort()).toEqual([1, 2]);
200
200
  for (const row of matchResults) {
201
201
  expect(row.score).toBeGreaterThan(0);
202
202
  }
203
203
  // fts_highlight
204
- const highlightResults = await db.prepare("SELECT id, fts_highlight(title, '<b>', '</b>', 'Rust') as highlighted FROM documents WHERE fts_match(title, body, 'Rust')").all();
204
+ const highlightResults = await (await db.prepare("SELECT id, fts_highlight(title, '<b>', '</b>', 'Rust') as highlighted FROM documents WHERE fts_match(title, body, 'Rust')")).all();
205
205
  expect(highlightResults.length).toBe(1);
206
206
  expect(highlightResults[0].id).toBe(1);
207
207
  expect(highlightResults[0].highlighted).toContain('<b>');
208
208
  expect(highlightResults[0].highlighted).toContain('Rust');
209
209
  // no match
210
- const noResults = await db.prepare("SELECT * FROM documents WHERE fts_match(title, body, 'nonexistentterm')").all();
210
+ const noResults = await (await db.prepare("SELECT * FROM documents WHERE fts_match(title, body, 'nonexistentterm')")).all();
211
211
  expect(noResults.length).toBe(0);
212
212
  });
213
213
  test('blobs', async () => {
214
214
  const db = await connect(":memory:");
215
- const rows = await db.prepare("SELECT x'1020' as x").all();
215
+ const rows = await (await db.prepare("SELECT x'1020' as x")).all();
216
216
  expect(rows).toEqual([{ x: Buffer.from([16, 32]) }]);
217
217
  });
218
+ test('encryption', async () => {
219
+ const path = `test-encryption-${(Math.random() * 10000) | 0}.db`;
220
+ const hexkey = 'b1bbfda4f589dc9daaf004fe21111e00dc00c98237102f5c7002a5669fc76327';
221
+ const wrongKey = 'aaaaaaa4f589dc9daaf004fe21111e00dc00c98237102f5c7002a5669fc76327';
222
+ try {
223
+ const db = await connect(path, {
224
+ encryption: { cipher: 'aegis256', hexkey }
225
+ });
226
+ await db.exec("CREATE TABLE t(x)");
227
+ await db.exec("INSERT INTO t SELECT 'secret' FROM generate_series(1, 1024)");
228
+ await db.exec("PRAGMA wal_checkpoint(truncate)");
229
+ db.close();
230
+ // Re-open with the same key - should work
231
+ const db2 = await connect(path, {
232
+ encryption: { cipher: 'aegis256', hexkey }
233
+ });
234
+ const rows = await (await db2.prepare("SELECT COUNT(*) as cnt FROM t")).all();
235
+ expect(rows).toEqual([{ cnt: 1024 }]);
236
+ db2.close();
237
+ // Opening with wrong key MUST fail
238
+ await expect(async () => {
239
+ const db3 = await connect(path, {
240
+ encryption: { cipher: 'aegis256', hexkey: wrongKey }
241
+ });
242
+ await (await db3.prepare("SELECT * FROM t")).all();
243
+ }).rejects.toThrow();
244
+ // Opening without encryption MUST fail
245
+ await expect(async () => {
246
+ const db4 = await connect(path);
247
+ await (await db4.prepare("SELECT * FROM t")).all();
248
+ }).rejects.toThrow();
249
+ }
250
+ finally {
251
+ unlinkSync(path);
252
+ }
253
+ });
218
254
  test('example-1', async () => {
219
255
  const db = await connect(':memory:');
220
256
  await db.exec('CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)');
221
- const insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
257
+ const insert = await db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
222
258
  await insert.run('Alice', 'alice@example.com');
223
259
  await insert.run('Bob', 'bob@example.com');
224
- const users = await db.prepare('SELECT * FROM users').all();
260
+ const users = await (await db.prepare('SELECT * FROM users')).all();
225
261
  expect(users).toEqual([
226
262
  { id: 1, name: 'Alice', email: 'alice@example.com' },
227
263
  { id: 2, name: 'Bob', email: 'bob@example.com' }
@@ -232,7 +268,7 @@ test('example-2', async () => {
232
268
  await db.exec('CREATE TABLE users (name, email)');
233
269
  // Using transactions for atomic operations
234
270
  const transaction = db.transaction(async (users) => {
235
- const insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
271
+ const insert = await db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
236
272
  for (const user of users) {
237
273
  await insert.run(user.name, user.email);
238
274
  }
@@ -242,7 +278,7 @@ test('example-2', async () => {
242
278
  { name: 'Alice', email: 'alice@example.com' },
243
279
  { name: 'Bob', email: 'bob@example.com' }
244
280
  ]);
245
- const rows = await db.prepare('SELECT * FROM users').all();
281
+ const rows = await (await db.prepare('SELECT * FROM users')).all();
246
282
  expect(rows).toEqual([
247
283
  { name: 'Alice', email: 'alice@example.com' },
248
284
  { name: 'Bob', email: 'bob@example.com' }
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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
84
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
120
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
136
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
152
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
171
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
187
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
203
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
239
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
260
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
276
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
294
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
310
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
328
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
344
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
362
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
378
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
395
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
411
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
431
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
447
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.5.0-pre.20' && 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.5.0-pre.20 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
463
+ if (bindingPackageVersion !== '0.6.0-pre.18' && 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.6.0-pre.18 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.6.0-pre.9",
3
+ "version": "0.7.0-pre.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tursodatabase/turso"
@@ -24,7 +24,7 @@
24
24
  "@types/node": "^24.3.1",
25
25
  "better-sqlite3": "^12.2.0",
26
26
  "drizzle-kit": "^0.31.4",
27
- "drizzle-orm": "^0.44.5",
27
+ "drizzle-orm": "^0.45.2",
28
28
  "typescript": "^5.9.2",
29
29
  "vitest": "^3.2.4"
30
30
  },
@@ -47,15 +47,15 @@
47
47
  ]
48
48
  },
49
49
  "dependencies": {
50
- "@tursodatabase/database-common": "^0.6.0-pre.9"
50
+ "@tursodatabase/database-common": "^0.7.0-pre.1"
51
51
  },
52
52
  "imports": {
53
53
  "#index": "./index.js"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@tursodatabase/database-linux-x64-gnu": "0.6.0-pre.9",
57
- "@tursodatabase/database-win32-x64-msvc": "0.6.0-pre.9",
58
- "@tursodatabase/database-darwin-arm64": "0.6.0-pre.9",
59
- "@tursodatabase/database-linux-arm64-gnu": "0.6.0-pre.9"
56
+ "@tursodatabase/database-linux-x64-gnu": "0.7.0-pre.1",
57
+ "@tursodatabase/database-win32-x64-msvc": "0.7.0-pre.1",
58
+ "@tursodatabase/database-darwin-arm64": "0.7.0-pre.1",
59
+ "@tursodatabase/database-linux-arm64-gnu": "0.7.0-pre.1"
60
60
  }
61
61
  }