@tursodatabase/database 0.7.0-pre.9 → 0.8.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.
- package/README.md +3 -3
- package/dist/promise.d.ts +2 -2
- package/dist/promise.d.ts.map +1 -1
- package/dist/promise.js +2 -2
- package/dist/promise.test.js +77 -1
- package/index.js +46 -46
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
This package is the Turso embedded database library for JavaScript in Node.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Turso Database runs in production today at multiple organizations. It has not yet reached 1.0, so as with any database we recommend keeping backups — see the [FAQ](https://github.com/tursodatabase/turso#faq) for where the project stands.
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
@@ -91,8 +91,8 @@ import { connect } from '@tursodatabase/database';
|
|
|
91
91
|
const db = await connect('transactions.db');
|
|
92
92
|
|
|
93
93
|
// Using transactions for atomic operations
|
|
94
|
-
const transaction = db.
|
|
95
|
-
const insert =
|
|
94
|
+
const transaction = db.transactionAsync(async (txn, users) => {
|
|
95
|
+
const insert = await txn.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
|
|
96
96
|
for (const user of users) {
|
|
97
97
|
await insert.run(user.name, user.email);
|
|
98
98
|
}
|
package/dist/promise.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabasePromise, SqliteError, DatabaseOpts } from "@tursodatabase/database-common";
|
|
1
|
+
import { DatabasePromise, SqliteError, DatabaseOpts, Transaction } from "@tursodatabase/database-common";
|
|
2
2
|
declare class Database extends DatabasePromise {
|
|
3
3
|
constructor(path: string, opts?: DatabaseOpts);
|
|
4
4
|
}
|
|
@@ -10,5 +10,5 @@ declare class Database extends DatabasePromise {
|
|
|
10
10
|
* @returns {Promise<Database>} - A promise that resolves to a Database instance.
|
|
11
11
|
*/
|
|
12
12
|
declare function connect(path: string, opts?: DatabaseOpts): Promise<Database>;
|
|
13
|
-
export { connect, Database, SqliteError };
|
|
13
|
+
export { connect, Database, SqliteError, Transaction };
|
|
14
14
|
//# sourceMappingURL=promise.d.ts.map
|
package/dist/promise.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"promise.d.ts","sourceRoot":"","sources":["../promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAkB,WAAW,EAAE,YAAY,EAAoB,WAAW,EAAE,MAAM,gCAAgC,CAAA;AAoB1I,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,WAAW,EAAE,CAAA"}
|
package/dist/promise.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DatabasePromise, SqliteError } from "@tursodatabase/database-common";
|
|
1
|
+
import { DatabasePromise, SqliteError, Transaction } from "@tursodatabase/database-common";
|
|
2
2
|
import { Database as NativeDB, EncryptionCipher as NativeEncryptionCipher } from "#index";
|
|
3
3
|
// Map string cipher names to native enum values (lazy to avoid errors if native module lacks encryption)
|
|
4
4
|
function getCipherValue(cipher) {
|
|
@@ -40,4 +40,4 @@ async function connect(path, opts = {}) {
|
|
|
40
40
|
await db.connect();
|
|
41
41
|
return db;
|
|
42
42
|
}
|
|
43
|
-
export { connect, Database, SqliteError };
|
|
43
|
+
export { connect, Database, SqliteError, Transaction };
|
package/dist/promise.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unlinkSync } from "node:fs";
|
|
2
2
|
import { expect, test } from 'vitest';
|
|
3
|
-
import { Database, connect } from './promise.js';
|
|
3
|
+
import { Database, connect, Transaction } from './promise.js';
|
|
4
4
|
import { sql } from 'drizzle-orm';
|
|
5
5
|
import { drizzle } from 'drizzle-orm/better-sqlite3';
|
|
6
6
|
test('drizzle-orm', async () => {
|
|
@@ -295,6 +295,55 @@ test('example-2', async () => {
|
|
|
295
295
|
{ name: 'Bob', email: 'bob@example.com' }
|
|
296
296
|
]);
|
|
297
297
|
});
|
|
298
|
+
// The transaction() wrapper must own the connection for the whole
|
|
299
|
+
// BEGIN..COMMIT window. Statements are only serialized individually, so a
|
|
300
|
+
// concurrent caller can currently interleave its statements into an open
|
|
301
|
+
// transaction: its BEGIN fails as nested, and its ROLLBACK then erases the
|
|
302
|
+
// first transaction's in-flight writes while later writes land in autocommit.
|
|
303
|
+
test('concurrent transaction() calls must not interleave', async () => {
|
|
304
|
+
const db = await connect(':memory:');
|
|
305
|
+
await db.exec('CREATE TABLE t(tag TEXT, i INTEGER)');
|
|
306
|
+
const insertMany = db.transactionAsync(async (txn, tag, fail) => {
|
|
307
|
+
for (let i = 0; i < 10; i++) {
|
|
308
|
+
await txn.run('INSERT INTO t VALUES (?, ?)', [tag, i]);
|
|
309
|
+
}
|
|
310
|
+
if (fail) {
|
|
311
|
+
throw new Error('abort transaction');
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
const [committed, aborted] = await Promise.allSettled([
|
|
315
|
+
insertMany('committed', false),
|
|
316
|
+
insertMany('rolled-back', true),
|
|
317
|
+
]);
|
|
318
|
+
// the first transaction commits; the second fails only with its own error
|
|
319
|
+
expect(committed).toEqual({ status: 'fulfilled', value: undefined });
|
|
320
|
+
expect(aborted.status).toBe('rejected');
|
|
321
|
+
expect(aborted.reason.message).toBe('abort transaction');
|
|
322
|
+
// atomicity: every row of the committed transaction survives and no row
|
|
323
|
+
// of the rolled-back transaction does
|
|
324
|
+
const rows = await db.all('SELECT tag, COUNT(*) AS cnt FROM t GROUP BY tag ORDER BY tag');
|
|
325
|
+
expect(rows).toEqual([{ tag: 'committed', cnt: 10 }]);
|
|
326
|
+
});
|
|
327
|
+
// Same root cause, worst manifestation: an independent autocommit statement
|
|
328
|
+
// racing with a transaction() call slips into the open BEGIN..ROLLBACK window,
|
|
329
|
+
// reports success, and is then silently erased by the transaction's rollback.
|
|
330
|
+
test('statement racing a transaction() must not be lost to its rollback', async () => {
|
|
331
|
+
const db = await connect(':memory:');
|
|
332
|
+
await db.exec('CREATE TABLE t(tag TEXT)');
|
|
333
|
+
const failing = db.transactionAsync(async (txn) => {
|
|
334
|
+
await txn.run('INSERT INTO t VALUES (?)', ['txn']);
|
|
335
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
336
|
+
throw new Error('abort transaction');
|
|
337
|
+
});
|
|
338
|
+
const [txnResult, plainResult] = await Promise.allSettled([
|
|
339
|
+
failing(),
|
|
340
|
+
db.run('INSERT INTO t VALUES (?)', ['plain']),
|
|
341
|
+
]);
|
|
342
|
+
expect(txnResult.status).toBe('rejected');
|
|
343
|
+
expect(plainResult.status).toBe('fulfilled');
|
|
344
|
+
// the transaction rolled back, but the successful independent insert must survive
|
|
345
|
+
expect(await db.all('SELECT tag FROM t')).toEqual([{ tag: 'plain' }]);
|
|
346
|
+
});
|
|
298
347
|
test('transaction.concurrent uses BEGIN CONCURRENT', async () => {
|
|
299
348
|
const db = await connect(':memory:');
|
|
300
349
|
const originalExec = db.exec;
|
|
@@ -314,3 +363,30 @@ test('transaction.concurrent uses BEGIN CONCURRENT', async () => {
|
|
|
314
363
|
await db.close();
|
|
315
364
|
}
|
|
316
365
|
});
|
|
366
|
+
test('transactionAsync.concurrent uses BEGIN CONCURRENT', async () => {
|
|
367
|
+
const db = await connect(':memory:');
|
|
368
|
+
const originalExec = Transaction.prototype.exec;
|
|
369
|
+
const calls = [];
|
|
370
|
+
Transaction.prototype.exec = async (sql) => {
|
|
371
|
+
calls.push(sql);
|
|
372
|
+
};
|
|
373
|
+
try {
|
|
374
|
+
const txn = db.transactionAsync(async (_txn) => {
|
|
375
|
+
calls.push('body');
|
|
376
|
+
}).concurrent;
|
|
377
|
+
await txn();
|
|
378
|
+
expect(calls).toEqual(['BEGIN CONCURRENT', 'body', 'COMMIT']);
|
|
379
|
+
}
|
|
380
|
+
finally {
|
|
381
|
+
Transaction.prototype.exec = originalExec;
|
|
382
|
+
await db.close();
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
// A callback that declares no parameters cannot be using the Transaction
|
|
386
|
+
// handle - it is the pre-0.8 shape whose statements would deadlock against
|
|
387
|
+
// the transaction's own lock, so it is rejected upfront.
|
|
388
|
+
test('transactionAsync() rejects callbacks that do not declare the handle', async () => {
|
|
389
|
+
const db = await connect(':memory:');
|
|
390
|
+
expect(() => db.transactionAsync(async () => { })).toThrow(/Transaction handle/);
|
|
391
|
+
expect(() => db.transactionAsync((async (...args) => { }))).toThrow(/Transaction handle/);
|
|
392
|
+
});
|
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
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
121
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
137
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
153
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
172
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
188
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
204
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
224
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
240
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
261
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
277
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
311
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
345
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
379
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
432
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 0.7.0
|
|
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.`)
|
|
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.
|
|
3
|
+
"version": "0.8.0-pre.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tursodatabase/turso"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@napi-rs/cli": "^3.1.5",
|
|
24
24
|
"@types/node": "^24.3.1",
|
|
25
|
-
"better-sqlite3": "
|
|
25
|
+
"better-sqlite3": "12.9.0",
|
|
26
26
|
"drizzle-kit": "^0.31.4",
|
|
27
27
|
"drizzle-orm": "^0.45.2",
|
|
28
28
|
"typescript": "^5.9.2",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@tursodatabase/database-common": "^0.
|
|
52
|
+
"@tursodatabase/database-common": "^0.8.0-pre.1"
|
|
53
53
|
},
|
|
54
54
|
"imports": {
|
|
55
55
|
"#index": "./index.js"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
-
"@tursodatabase/database-linux-x64-gnu": "0.
|
|
59
|
-
"@tursodatabase/database-win32-x64-msvc": "0.
|
|
60
|
-
"@tursodatabase/database-darwin-arm64": "0.
|
|
61
|
-
"@tursodatabase/database-linux-arm64-gnu": "0.
|
|
58
|
+
"@tursodatabase/database-linux-x64-gnu": "0.8.0-pre.1",
|
|
59
|
+
"@tursodatabase/database-win32-x64-msvc": "0.8.0-pre.1",
|
|
60
|
+
"@tursodatabase/database-darwin-arm64": "0.8.0-pre.1",
|
|
61
|
+
"@tursodatabase/database-linux-arm64-gnu": "0.8.0-pre.1"
|
|
62
62
|
}
|
|
63
63
|
}
|