Commit Graph

7300 Commits

Author SHA1 Message Date
Nikita Sivukhin
4595d5b7a3 fix Cargo.toml 2025-08-08 15:44:42 +04:00
Nikita Sivukhin
5788e654b7 fix APP_NAME 2025-08-08 15:44:42 +04:00
Nikita Sivukhin
50588c5edf cargo fmt 2025-08-08 15:44:42 +04:00
Nikita Sivukhin
54879a36ba add publish workflow 2025-08-08 15:44:42 +04:00
Nikita Sivukhin
572a910c52 add simple example 2025-08-08 15:44:42 +04:00
Nikita Sivukhin
3c181939ad adjust js package 2025-08-08 15:44:42 +04:00
Nikita Sivukhin
e6a3ee59d2 turso-sync-js package 2025-08-08 15:44:41 +04:00
Nikita Sivukhin
405e7f56a6 small adjustments in the sync-engine 2025-08-08 15:40:57 +04:00
Pekka Enberg
ba88d17f29 Turso 0.1.4-pre.5 2025-08-08 13:49:06 +03:00
Pekka Enberg
2f77b5867a Merge 'Rename JavaScript package to ' from Pekka Enberg
Reviewed-by: Nikita Sivukhin (@sivukhin)

Closes #2508
2025-08-08 13:47:51 +03:00
Pekka Enberg
f2b2e4d4d8 Rename JavaScript package to @tursodatabase/database 2025-08-08 13:22:10 +03:00
Pekka Enberg
ad70157e74 Turso 0.1.4-pre.4 2025-08-08 11:54:26 +03:00
Pekka Enberg
5b578dd790 bindings/javascript: Fix "npm publish" to build the package 2025-08-08 11:53:58 +03:00
Pekka Enberg
8d5fb41f5d Turso 0.1.4-pre.3 2025-08-08 10:42:41 +03:00
Pekka Enberg
f7eb6c2cee Turso v0.1.4-pre.3 2025-08-08 10:42:38 +03:00
Pekka Enberg
7a09eb0d4c Merge 'Fix JavaScript bindings packaging' from Nikita Sivukhin
This PR configure `#entry-point` import alias for javascript bindings in
order to use `browser.js` napi-rs generated file in browser context.
Also, this PR forces napi-rs to emit `index.js` entrypoint using ESM and
also use typescript for writing our wrapper code around napi-rs
bindings.
In order to make behaviour consistent when lib is imported through ESM
or CommonJS this PR also replace default export of `Database` by named
on. The problem is that `export default Database` will be logically
equivalent to `modules.export.default = Database` which is not the same
thing as `modules.export = Database` and this will need to access
additional `.default` field with CommonJs style imports (e.g. `new
require('@tursodatabase/turso').default(...)`). In order to remove this
difference - I just replaced default export with named one.

Closes #2488
2025-08-08 10:42:21 +03:00
Nikita Sivukhin
eec679b00b fix package.json one more time 2025-08-08 10:34:11 +04:00
Pekka Enberg
d32b63d135 bindings/javascript: Update yarn lock file 2025-08-08 09:23:19 +03:00
Pekka Enberg
5ef58db941 bindings/javascript: Fix npm run build
Fixes the following error:

```
                This is not the tsc command you are looking for

To get access to the TypeScript compiler, tsc, from the command line either:

- Use npm install typescript to first add TypeScript to your project before using npx
- Use yarn to avoid accidentally running code from un-installed packages
```
2025-08-08 09:22:31 +03:00
Nikita Sivukhin
ba6bf7057e fix package.json 2025-08-08 09:59:52 +04:00
Pekka Enberg
e9f15bfac7 Merge 'Add query only pragma' from bit-aloo
This PR adds support for the PRAGMA `query_only` pragma, which enables
or disables write operations on a database connection. It allows
applications to mark the connection as read-only at runtime.

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #2498
2025-08-08 08:33:29 +03:00
Pekka Enberg
0f9d0cf519 Merge branch 'main' into 2025-08-07-add-query-only-pragma 2025-08-08 07:41:38 +03:00
bit-aloo
c7f7ae32e3 review fixes 2025-08-08 08:43:15 +05:30
Preston Thorpe
850ee8fe62 Merge 'bench/insert: fix expected return value from pragma' from Jussi Saurio
CI did not fail when this panicked :]

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #2489
2025-08-07 21:34:13 -04:00
Preston Thorpe
7a793b818d Merge 'perf: a few small insert optimizations' from Jussi Saurio
1. We spend a lot of time in `cell_get_raw_region` in the balancing
routine, and especially calling `contents.page_type()` there a lot, so
extract a version that can take some precomputed arguments so those
don't have to be redundantly computed multiple times for successive
calls where those values are going to be the same
2. Avoid calling `self.usable_space()` in a loop in
`insert_into_page()`.
3. Avoid accessing `pages_in_frames` lock if we're not going to modify
it
main improvement is to the "insert 100 rows" bench which ends up doing
balancing a lot:
```
Insert rows in batches/limbo_insert_1_rows
                        time:   [22.856 µs 24.342 µs 27.496 µs]
                        change: [-3.3579% +15.495% +67.671%] (p = 0.62 > 0.05)
                        No change in performance detected.

Benchmarking Insert rows in batches/limbo_insert_10_rows: Collecting 100 samples in estim
Insert rows in batches/limbo_insert_10_rows
                        time:   [32.196 µs 32.604 µs 32.981 µs]
                        change: [+1.3253% +2.9177% +4.5863%] (p = 0.00 < 0.05)
                        Performance has regressed.

Insert rows in batches/limbo_insert_100_rows
                        time:   [89.425 µs 92.105 µs 96.304 µs]
                        change: [-18.317% -13.605% -9.1022%] (p = 0.00 < 0.05)
                        Performance has improved.
```

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #2483
2025-08-07 21:33:30 -04:00
Preston Thorpe
6b266e7e84 Merge 'Direct schema mutation – add instruction' from Levy A.
<img width="960" height="205" alt="image" src="https://github.com/user-
attachments/assets/f60a2133-dfe4-4411-9a7c-7283eb073875" />
<img width="944" height="504" alt="image" src="https://github.com/user-
attachments/assets/9383c8e2-4d8d-40b9-8ace-825ca3cf8682" />
```
`ALTER TABLE _ ADD COLUMN _`/limbo_add_column/
                        time:   [2.1199 ms 2.1921 ms 2.2756 ms]
                        change: [-85.983% -85.416% -84.716%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  6 (6.00%) high mild
  7 (7.00%) high severe
`ALTER TABLE _ ADD COLUMN _`/sqlite_add_column/
                        time:   [10.358 ms 10.404 ms 10.469 ms]
                        change: [-6.2566% -2.3515% +0.2046%] (p = 0.21 > 0.05)
                        No change in performance detected.
Found 14 outliers among 100 measurements (14.00%)
  2 (2.00%) high mild
  12 (12.00%) high severe
  ```

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #2482
2025-08-07 21:31:49 -04:00
Preston Thorpe
88d49e402f Merge 'javascript: Organize test cases better' from Pekka Enberg
Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #2490
2025-08-07 21:28:27 -04:00
Preston Thorpe
fbc8a5650a Merge 'Add .clone CLI command to copy database files' from Preston Thorpe
This PR adds support for the  `.clone file.db` sqlite3 CLI command

Closes #2437
2025-08-07 20:20:49 -04:00
bit-aloo
6ffd4215a2 sort Pragma names in lexicographical order 2025-08-08 02:52:45 +05:30
Nikita Sivukhin
cbe0a7708e update tests 2025-08-08 01:21:37 +04:00
PThorpe92
bcadcb2014 Remove RefCell from copy_to method in io trait 2025-08-07 17:07:53 -04:00
Nikita Sivukhin
9b892828eb fix package.json 2025-08-08 01:01:40 +04:00
Nikita Sivukhin
cb84a75ddc remove unnecessary file 2025-08-08 01:00:32 +04:00
Nikita Sivukhin
92f95f2580 update example 2025-08-08 00:48:20 +04:00
Nikita Sivukhin
dd347fb3e3 simplify setup by emiting index.js in ESM style from napi 2025-08-08 00:47:37 +04:00
PThorpe92
98f4e5cd2d Add comment/TODO about method we use to copy the db file 2025-08-07 16:27:08 -04:00
PThorpe92
b131331673 Add shell .py tests for .clone cli command 2025-08-07 16:27:08 -04:00
PThorpe92
e32d04ea97 Use ephemeral PlatformIO for clone method to support memory io 2025-08-07 16:27:08 -04:00
PThorpe92
04b40b4cf5 Impl copy_to for Database impl in JS bindings 2025-08-07 16:27:08 -04:00
PThorpe92
f75eaee886 Rename .copy -> .clone 2025-08-07 16:27:07 -04:00
PThorpe92
7e42b97b93 Add .help output for copying db file cmd 2025-08-07 16:27:07 -04:00
PThorpe92
837278c2d0 Add .help output for copying db file cmd 2025-08-07 16:27:07 -04:00
PThorpe92
736f78de64 Add .copy CLI command 2025-08-07 16:27:07 -04:00
PThorpe92
039fe22405 Add copy_to to io::File trait to support copying DB files 2025-08-07 16:27:02 -04:00
Preston Thorpe
e23637b6ad Merge 'only allow multiples of 64 for performance in arena bitmap' from Preston Thorpe
Trying to support this is unnecessary and just adds branches and bit ops
when we could just round the allocation up or down

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #2497
2025-08-07 14:25:11 -04:00
bit-aloo
ee483ce4e9 update compat.md with query_only pragma 2025-08-07 23:50:18 +05:30
bit-aloo
aaeec4d4f3 Implement PRAGMA query_only logic 2025-08-07 23:49:07 +05:30
bit-aloo
2cf7f66a02 Enforce query_only in write operations 2025-08-07 23:46:00 +05:30
bit-aloo
ef084af42f Add getter and setter methods 2025-08-07 23:44:54 +05:30
bit-aloo
697eb35ca9 Add query_only field to Connection 2025-08-07 23:44:29 +05:30