@tursodatabase/database 0.5.0-pre.2 → 0.5.0-pre.20
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 +2 -2
- package/dist/compat.d.ts.map +1 -1
- package/dist/compat.js +25 -2
- package/dist/compat.test.js +38 -2
- package/dist/promise.test.js +28 -2
- package/dist/turso-sql-runner-split.test.d.ts +2 -0
- package/dist/turso-sql-runner-split.test.d.ts.map +1 -0
- package/dist/turso-sql-runner-split.test.js +56 -0
- package/index.js +48 -47
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ await transaction([
|
|
|
107
107
|
|
|
108
108
|
## API Reference
|
|
109
109
|
|
|
110
|
-
For complete API documentation, see [JavaScript API Reference](
|
|
110
|
+
For complete API documentation, see [JavaScript API Reference](https://github.com/tursodatabase/turso/blob/main/docs/javascript-api-reference.md).
|
|
111
111
|
|
|
112
112
|
## Related Packages
|
|
113
113
|
|
|
@@ -116,7 +116,7 @@ For complete API documentation, see [JavaScript API Reference](../../../../docs/
|
|
|
116
116
|
|
|
117
117
|
## License
|
|
118
118
|
|
|
119
|
-
This project is licensed under the [MIT license](
|
|
119
|
+
This project is licensed under the [MIT license](https://github.com/tursodatabase/turso/blob/main/LICENSE.md)
|
|
120
120
|
|
|
121
121
|
## Support
|
|
122
122
|
|
package/dist/compat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../compat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,WAAW,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["../compat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAkB,WAAW,EAAE,YAAY,EAAoB,MAAM,gCAAgC,CAAA;AAoB5H,cAAM,QAAS,SAAQ,cAAc;gBACrB,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB;CAUpD;AAED,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAA"}
|
package/dist/compat.js
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import { DatabaseCompat, 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 DatabaseCompat {
|
|
4
20
|
constructor(path, opts = {}) {
|
|
5
|
-
|
|
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
|
export { Database, SqliteError };
|
package/dist/compat.test.js
CHANGED
|
@@ -78,10 +78,10 @@ test('attach', () => {
|
|
|
78
78
|
const path1 = `test-${(Math.random() * 10000) | 0}.db`;
|
|
79
79
|
const path2 = `test-${(Math.random() * 10000) | 0}.db`;
|
|
80
80
|
try {
|
|
81
|
-
const db1 = new Database(path1);
|
|
81
|
+
const db1 = new Database(path1, { experimental: ["attach"] });
|
|
82
82
|
db1.exec("CREATE TABLE t(x)");
|
|
83
83
|
db1.exec("INSERT INTO t VALUES (1), (2), (3)");
|
|
84
|
-
const db2 = new Database(path2);
|
|
84
|
+
const db2 = new Database(path2, { experimental: ["attach"] });
|
|
85
85
|
db2.exec("CREATE TABLE q(x)");
|
|
86
86
|
db2.exec("INSERT INTO q VALUES (4), (5), (6)");
|
|
87
87
|
db1.exec(`ATTACH '${path2}' as secondary`);
|
|
@@ -102,3 +102,39 @@ test('blobs', () => {
|
|
|
102
102
|
const rows = db.prepare("SELECT x'1020' as x").all();
|
|
103
103
|
expect(rows).toEqual([{ x: Buffer.from([16, 32]) }]);
|
|
104
104
|
});
|
|
105
|
+
test('encryption', () => {
|
|
106
|
+
const path = `test-encryption-${(Math.random() * 10000) | 0}.db`;
|
|
107
|
+
const hexkey = 'b1bbfda4f589dc9daaf004fe21111e00dc00c98237102f5c7002a5669fc76327';
|
|
108
|
+
const wrongKey = 'aaaaaaa4f589dc9daaf004fe21111e00dc00c98237102f5c7002a5669fc76327';
|
|
109
|
+
try {
|
|
110
|
+
const db = new Database(path, {
|
|
111
|
+
encryption: { cipher: 'aegis256', hexkey }
|
|
112
|
+
});
|
|
113
|
+
db.exec("CREATE TABLE t(x)");
|
|
114
|
+
db.exec("INSERT INTO t SELECT 'secret' FROM generate_series(1, 1024)");
|
|
115
|
+
db.exec("PRAGMA wal_checkpoint(truncate)");
|
|
116
|
+
db.close();
|
|
117
|
+
// lets re-open with the same key
|
|
118
|
+
const db2 = new Database(path, {
|
|
119
|
+
encryption: { cipher: 'aegis256', hexkey }
|
|
120
|
+
});
|
|
121
|
+
const rows = db2.prepare("SELECT COUNT(*) as cnt FROM t").all();
|
|
122
|
+
expect(rows).toEqual([{ cnt: 1024 }]);
|
|
123
|
+
db2.close();
|
|
124
|
+
// opening with wrong key MUST fail
|
|
125
|
+
expect(() => {
|
|
126
|
+
const db3 = new Database(path, {
|
|
127
|
+
encryption: { cipher: 'aegis256', hexkey: wrongKey }
|
|
128
|
+
});
|
|
129
|
+
db3.prepare("SELECT * FROM t").all();
|
|
130
|
+
}).toThrow();
|
|
131
|
+
// opening without encryption MUST fail
|
|
132
|
+
expect(() => {
|
|
133
|
+
const db5 = new Database(path);
|
|
134
|
+
db5.prepare("SELECT * FROM t").all();
|
|
135
|
+
}).toThrow();
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
unlinkSync(path);
|
|
139
|
+
}
|
|
140
|
+
});
|
package/dist/promise.test.js
CHANGED
|
@@ -165,10 +165,10 @@ test('attach', async () => {
|
|
|
165
165
|
const path1 = `test-${(Math.random() * 10000) | 0}.db`;
|
|
166
166
|
const path2 = `test-${(Math.random() * 10000) | 0}.db`;
|
|
167
167
|
try {
|
|
168
|
-
const db1 = await connect(path1);
|
|
168
|
+
const db1 = await connect(path1, { experimental: ["attach"] });
|
|
169
169
|
await db1.exec("CREATE TABLE t(x)");
|
|
170
170
|
await db1.exec("INSERT INTO t VALUES (1), (2), (3)");
|
|
171
|
-
const db2 = await connect(path2);
|
|
171
|
+
const db2 = await connect(path2, { experimental: ["attach"] });
|
|
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`);
|
|
@@ -184,6 +184,32 @@ test('attach', async () => {
|
|
|
184
184
|
unlinkSync(`${path2}-wal`);
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
+
test('fts', async () => {
|
|
188
|
+
const db = await connect(":memory:", { experimental: ["index_method"] });
|
|
189
|
+
await db.exec(`
|
|
190
|
+
CREATE TABLE documents (id INTEGER PRIMARY KEY, title TEXT, body TEXT);
|
|
191
|
+
INSERT INTO documents VALUES (1, 'Introduction to Rust', 'Rust is a systems programming language focused on safety and performance');
|
|
192
|
+
INSERT INTO documents VALUES (2, 'JavaScript Guide', 'JavaScript is a dynamic programming language used for web development');
|
|
193
|
+
INSERT INTO documents VALUES (3, 'Database Internals', 'Understanding how databases store and retrieve data efficiently');
|
|
194
|
+
CREATE INDEX documents_fts ON documents USING fts (title, body);
|
|
195
|
+
`);
|
|
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();
|
|
198
|
+
expect(matchResults.length).toBe(2);
|
|
199
|
+
expect(matchResults.map(r => r.id).sort()).toEqual([1, 2]);
|
|
200
|
+
for (const row of matchResults) {
|
|
201
|
+
expect(row.score).toBeGreaterThan(0);
|
|
202
|
+
}
|
|
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();
|
|
205
|
+
expect(highlightResults.length).toBe(1);
|
|
206
|
+
expect(highlightResults[0].id).toBe(1);
|
|
207
|
+
expect(highlightResults[0].highlighted).toContain('<b>');
|
|
208
|
+
expect(highlightResults[0].highlighted).toContain('Rust');
|
|
209
|
+
// no match
|
|
210
|
+
const noResults = await db.prepare("SELECT * FROM documents WHERE fts_match(title, body, 'nonexistentterm')").all();
|
|
211
|
+
expect(noResults.length).toBe(0);
|
|
212
|
+
});
|
|
187
213
|
test('blobs', async () => {
|
|
188
214
|
const db = await connect(":memory:");
|
|
189
215
|
const rows = await db.prepare("SELECT x'1020' as x").all();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turso-sql-runner-split.test.d.ts","sourceRoot":"","sources":["../turso-sql-runner-split.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { splitStatements } from '../../turso-sql-split.mjs';
|
|
3
|
+
test('splitStatements keeps trigger body as one statement', () => {
|
|
4
|
+
const sql = `
|
|
5
|
+
CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
6
|
+
INSERT INTO log VALUES('inserted');
|
|
7
|
+
UPDATE stats SET count = count + 1;
|
|
8
|
+
END;
|
|
9
|
+
`;
|
|
10
|
+
expect(splitStatements(sql)).toEqual([
|
|
11
|
+
`CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
12
|
+
INSERT INTO log VALUES('inserted');
|
|
13
|
+
UPDATE stats SET count = count + 1;
|
|
14
|
+
END;`
|
|
15
|
+
]);
|
|
16
|
+
});
|
|
17
|
+
test('splitStatements handles trigger followed by select', () => {
|
|
18
|
+
const sql = `
|
|
19
|
+
CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
20
|
+
INSERT INTO log VALUES('inserted');
|
|
21
|
+
END;
|
|
22
|
+
SELECT 1;
|
|
23
|
+
`;
|
|
24
|
+
expect(splitStatements(sql)).toEqual([
|
|
25
|
+
`CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
26
|
+
INSERT INTO log VALUES('inserted');
|
|
27
|
+
END;`,
|
|
28
|
+
'SELECT 1;'
|
|
29
|
+
]);
|
|
30
|
+
});
|
|
31
|
+
test('splitStatements ignores END inside trigger string literal', () => {
|
|
32
|
+
const sql = `
|
|
33
|
+
CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
34
|
+
INSERT INTO log VALUES('END');
|
|
35
|
+
END;
|
|
36
|
+
`;
|
|
37
|
+
expect(splitStatements(sql)).toEqual([
|
|
38
|
+
`CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
39
|
+
INSERT INTO log VALUES('END');
|
|
40
|
+
END;`
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
test('splitStatements handles create temp trigger and explain create trigger', () => {
|
|
44
|
+
const tempTrigger = `
|
|
45
|
+
CREATE TEMP TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
46
|
+
INSERT INTO log VALUES('inserted');
|
|
47
|
+
END;
|
|
48
|
+
`;
|
|
49
|
+
const explainTrigger = `
|
|
50
|
+
EXPLAIN CREATE TRIGGER log_insert AFTER INSERT ON users BEGIN
|
|
51
|
+
INSERT INTO log VALUES('inserted');
|
|
52
|
+
END;
|
|
53
|
+
`;
|
|
54
|
+
expect(splitStatements(tempTrigger)).toHaveLength(1);
|
|
55
|
+
expect(splitStatements(explainTrigger)).toHaveLength(1);
|
|
56
|
+
});
|
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.
|
|
85
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
84
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
101
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
100
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
121
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
120
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
137
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
136
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
153
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
152
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
172
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
171
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
188
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
187
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
204
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
203
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
224
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
223
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
240
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
239
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
261
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
260
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
277
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
276
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
295
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
294
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
311
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
310
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
328
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
345
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
344
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
363
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
362
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
379
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
378
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
395
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
412
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
411
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
432
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
431
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
448
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
447
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 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.
|
|
464
|
-
throw new Error(`Native binding package version mismatch, expected 0.5.0-pre.
|
|
463
|
+
if (bindingPackageVersion !== '0.5.0-pre.13' && 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.13 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
465
465
|
}
|
|
466
466
|
return binding
|
|
467
467
|
} catch (e) {
|
|
@@ -508,7 +508,8 @@ if (!nativeBinding) {
|
|
|
508
508
|
throw new Error(`Failed to load native binding`)
|
|
509
509
|
}
|
|
510
510
|
|
|
511
|
-
const { BatchExecutor, Database, Statement } = nativeBinding
|
|
511
|
+
const { BatchExecutor, Database, Statement, EncryptionCipher } = nativeBinding
|
|
512
512
|
export { BatchExecutor }
|
|
513
513
|
export { Database }
|
|
514
514
|
export { Statement }
|
|
515
|
+
export { EncryptionCipher }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tursodatabase/database",
|
|
3
|
-
"version": "0.5.0-pre.
|
|
3
|
+
"version": "0.5.0-pre.20",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/tursodatabase/turso"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"vitest": "^3.2.4"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"napi-build": "napi build --platform --release --esm --manifest-path ../../Cargo.toml --output-dir .",
|
|
32
|
+
"napi-build": "napi build --platform --profile release-official --esm --manifest-path ../../Cargo.toml --output-dir .",
|
|
33
33
|
"napi-dirs": "napi create-npm-dirs",
|
|
34
34
|
"napi-artifacts": "napi artifacts --output-dir .",
|
|
35
35
|
"tsc-build": "npm exec tsc",
|
|
@@ -47,15 +47,15 @@
|
|
|
47
47
|
]
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@tursodatabase/database-common": "^0.5.0-pre.
|
|
50
|
+
"@tursodatabase/database-common": "^0.5.0-pre.20"
|
|
51
51
|
},
|
|
52
52
|
"imports": {
|
|
53
53
|
"#index": "./index.js"
|
|
54
54
|
},
|
|
55
55
|
"optionalDependencies": {
|
|
56
|
-
"@tursodatabase/database-linux-x64-gnu": "0.5.0-pre.
|
|
57
|
-
"@tursodatabase/database-win32-x64-msvc": "0.5.0-pre.
|
|
58
|
-
"@tursodatabase/database-darwin-arm64": "0.5.0-pre.
|
|
59
|
-
"@tursodatabase/database-linux-arm64-gnu": "0.5.0-pre.
|
|
56
|
+
"@tursodatabase/database-linux-x64-gnu": "0.5.0-pre.20",
|
|
57
|
+
"@tursodatabase/database-win32-x64-msvc": "0.5.0-pre.20",
|
|
58
|
+
"@tursodatabase/database-darwin-arm64": "0.5.0-pre.20",
|
|
59
|
+
"@tursodatabase/database-linux-arm64-gnu": "0.5.0-pre.20"
|
|
60
60
|
}
|
|
61
61
|
}
|