Commit Graph

306 Commits

Author SHA1 Message Date
Pekka Enberg
5df05e05f8 Turso 0.2.0-pre.3 2025-09-12 18:40:06 +03:00
Nikita Sivukhin
99759b9efd fix wasm-runtime package.json 2025-09-12 19:28:30 +04:00
Pekka Enberg
2651b597c6 Turso 0.2.0-pre.2 2025-09-12 17:38:30 +03:00
Jussi Saurio
b5f3da100b Merge 'fix CI for apple builds' from Nikita Sivukhin
Intel MAC builds were removed in https://github.com/tursodatabase/turso/
commit/3547bd10931e030a372bedb4968404301c2936c6 but arm builds were
broken after that.
This PR returns back proper ARM builds for Apple

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

Closes #3054
2025-09-12 16:19:05 +03:00
Jussi Saurio
6559f23f85 Merge 'hack imports of wasm due to the issues in Vite and Next.js build systems' from Nikita Sivukhin
This tries to establish smooth as possible experience for browser
packages in web.
In order to do that this PR do the following tricks:
1. export `./vite` entry-point which should be used like `import {
connect } from "@tursodatabase/database-browser/vite"` for Vite bundler
   * This entrypoint has fix for the issue
https://github.com/vitejs/vite/issues/8427 which breaks package in the
dev-server mode
   * In order to overcome this we do 2 tricks:
     - Inline WASM module in order to avoid loading it from the separate
file
     - Use same file as entry-point for main thread and for the web
worker
   * Note, that we do these tricks only for `development` build and
produce build will be chunked and optimized as usual with Vite and will
treat worker and WASM modules as separate fiels
3. export `./turbopack` entry-point which should be used like `import {
connect } from @tursodatabase/database-browser/turbopack"` for Turbopack
(Next.js) bundler
   * This entrypoint has fix for the issue
https://github.com/vercel/next.js/issues/82520'
   * In order to overcome this for now we always inline WASM for Next.js
4. Bundle browser libraries in order to easily consume them without need
for bundlers:
   * e.g. `import { connect } from
"https://unpkg.com/@tursodatabase/database-browser/bundle/main.es.js";`
5. We vendor `@napi-rs/wasm-runtime` for now in order to fix runtime
errors due to accesses to `process.env.NODE_DEBUG_NATIVE` env var (not
defined in web)
   * This should be very temporary solution because I already fixed
wasm-util dependency which cause this error
(https://github.com/toyobayashi/wasm-util/issues/4) and hope that napi-
rs PR will be merged soon: https://github.com/napi-rs/napi-rs/pull/2921

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

Closes #3017
2025-09-12 16:18:47 +03:00
Nikita Sivukhin
ab6c1bd8c7 use arm target for apply builds 2025-09-12 16:50:02 +04:00
Nikita Sivukhin
4e54f9042c newlines 2025-09-12 16:25:39 +04:00
Nikita Sivukhin
5c922da61a reorder packages in the workspace 2025-09-12 15:57:07 +04:00
Nikita Sivukhin
a5fbcb11e5 fix CI 2025-09-12 15:39:38 +04:00
Nikita Sivukhin
8c48a1dc47 bundle browser packages too in order to easily consume them without bundlers 2025-09-12 15:27:40 +04:00
Nikita Sivukhin
1c38344f4f build bundles for browser libs 2025-09-12 14:15:28 +04:00
Nikita Sivukhin
b086cba669 hack imports of wasm due to the issues in Vite and Next.js build systems 2025-09-12 14:03:31 +04:00
Jussi Saurio
7ac18a6952 Merge 'Remove some traces in super hot paths in btree' from Preston Thorpe
Particularly we were tracing `ImmutableRecord` / `BTreeKey` which would
then trace the bytes of records. These are super super hot paths and I
think we can probably remove even more to under debug assertions so we
dont eat those atomics/branches all the time.
This PR also introduces the `tracing_release` feature, which turns all
`trace!` and `debug!` macro invocations to noops at compile time, and
makes that feature available for all bindings.
it also removes the unused `lru` dependency, and cleans up the makefile
a bit

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

Closes #2995
2025-09-11 13:33:25 +03:00
Pekka Enberg
ae3c1fc2a6 Turso 0.2.0-pre.1 2025-09-11 11:44:42 +03:00
Nikita Sivukhin
d54c271890 add explicit dependency 2025-09-11 00:17:58 +04:00
Nikita Sivukhin
1a4d334e47 fix clippy and remove old action yaml 2025-09-11 00:03:01 +04:00
Nikita Sivukhin
1eec8f85f4 fix CI 2025-09-10 23:40:49 +04:00
Nikita Sivukhin
9e9d5f56de yarn install 2025-09-10 23:03:17 +04:00
Nikita Sivukhin
0aa9d59438 rebuild 2025-09-10 22:48:37 +04:00
Nikita Sivukhin
d55026f84f opfs for sync in one commit! 2025-09-10 22:35:57 +04:00
PThorpe92
ba1ed72ed8 Add tracing_release feature for benchmarks to compile tracing macros to noops 2025-09-10 09:56:12 -04:00
Pekka Enberg
2131a04b7d core: Rename IO::run_once() to IO::step()
The `run_once()` name is just a historical accident. Furthermore, it now
started to appear elsewhere as well, so let's just call it IO::step() as we
should have from the beginning.
2025-09-10 14:36:02 +03:00
Pekka Enberg
e04938eaf5 Turso 0.1.5 2025-09-10 13:30:18 +03:00
Pekka Enberg
1d34122414 Turso 0.1.5-pre.5 2025-09-10 11:40:21 +03:00
Nikita Sivukhin
f3f69598c5 add missing module type for browser package 2025-09-10 03:06:34 +04:00
Pekka Enberg
77e5190113 Turso 0.1.5-pre.4 2025-09-09 19:57:31 +03:00
Nikita Sivukhin
853afbf4f9 update lock files 2025-09-09 14:33:55 +04:00
Nikita Sivukhin
f827731727 rename database-core -> database-common 2025-09-09 14:26:21 +04:00
Nikita Sivukhin
53e535f535 fix perf 2025-09-09 14:20:35 +04:00
Nikita Sivukhin
7618dfb519 final adjustments 2025-09-09 14:06:10 +04:00
Nikita Sivukhin
dfea7f0458 fix clippy again 2025-09-09 12:25:40 +04:00
Nikita Sivukhin
816aa8b2bc small fixes 2025-09-09 12:05:41 +04:00
Nikita Sivukhin
8160f4dc04 restructure js bindings 2025-09-09 11:32:38 +04:00
Nikita Sivukhin
96a595069c add browser-specific OPFS file system and few other helpers 2025-09-09 11:32:38 +04:00
Pekka Enberg
1511ad354b Turso 0.1.5-pre.3 2025-09-04 11:40:51 +03:00
Pekka Enberg
adca9e4c70 Merge 'introduce package.json for separate *-browser package (both database and sync)' from Nikita Sivukhin
This PR introduces separate `package.browser.json` file for `*-browser`
npm packages (`@tursodatabase/sync-browser` and
`@tursodatabase/database-browser`).
The packages are nearly identical and the only change is `package.json`
content (browser package mentions only WASM optional dependency which
shouldn't confuse NPM and force it to download WASM dep package instead
of native one).
Due to that, innocent "hack" is implemented which swap `package.json`
with `package.browser.json` before publish of `browser` package.

Closes #2906
2025-09-04 11:40:34 +03:00
Nikita Sivukhin
9f282cf1e0 update readme 2025-09-03 18:21:22 +04:00
Nikita Sivukhin
62e7384771 build native package for ARM64 2025-09-03 17:57:15 +04:00
Nikita Sivukhin
185392fb9d skip optional packages publish as they will be published for native package 2025-09-03 17:26:36 +04:00
Nikita Sivukhin
40dd9be201 introduce package.json for separate *-browser package (both database and sync) 2025-09-03 17:15:47 +04:00
Pekka Enberg
6c7936a016 Turso 0.1.5-pre.2 2025-09-02 12:45:41 +03:00
Pekka Enberg
d959319b42 Merge 'Use u64 for file offsets in I/O and calculate such offsets in u64' from Preston Thorpe
Using `usize` to compute file offsets caps us at ~16GB on 32-bit
systems. For example, with 4 KiB pages we can only address up to 1048576
pages; attempting the next page overflows a 32-bit usize and can wrap
the write offset, corrupting data. Switching our I/O APIs and offset
math to u64 avoids this overflow on 32-bit targets

Closes #2791
2025-09-02 09:06:49 +03:00
Pekka Enberg
3c9dbfb09e Turso 0.1.5-pre.1 2025-08-30 18:28:38 +03:00
PThorpe92
0a56d23402 Use u64 for file offsets in IO and calculate such offsets in u64 2025-08-28 09:44:00 -04:00
Avinash Sajjanshetty
9e663c7f46 Add IOContext to carry encryption/checksum ctx 2025-08-27 21:33:05 +05:30
Pekka Enberg
22c9cb6618 s/PerConnEncryptionContext/EncryptionContext/ 2025-08-24 08:17:20 +03:00
Pekka Enberg
1b89273f10 Merge 'refactor encryption module and make it configurable' from Avinash Sajjanshetty
Previously, the encryption module had hardcoded a lot of things. This
refactor makes it slightly nice and makes it configurable.
Right now cipher algorithm is assumed and hardcoded, I will make that
configurable in the upcoming PR

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

Closes #2722
2025-08-24 08:16:28 +03:00
Pekka Enberg
2c68613709 bindings/javascript: Fix blob type handling 2025-08-22 14:17:40 +03:00
Avinash Sajjanshetty
3090545167 use encryption ctx instead of encryption key 2025-08-21 22:36:32 +05:30
Pekka Enberg
c2208a542a Merge 'Initial pass to support per page encryption' from Avinash Sajjanshetty
This patch adds support for per page encryption. The code is of alpha
quality, was to test my hypothesis. All the encryption code is gated
behind a `encryption` flag. To play with it, you can do:
```sh
cargo run --features encryption -- database.db

turso> PRAGMA key='turso_test_encryption_key_123456';

turso> CREATE TABLE t(v);
```
Right now, most stuff is hard coded. We use AES GCM 256. This
information is not stored anywhere, but in future versions we will start
saving this info in the file. When writing to disk, we will generate a
cryptographically secure random salt, use that to encrypt the page. Then
we will store the authentication tag and the salt in the page itself. To
accommodate this encryption hardcodes reserved space of 28 bytes.
Once the key is set in the connection, we propagate that information to
pager and the WAL, to encrypt / decrypt when reading from disk.

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

Closes #2567
2025-08-20 11:11:24 +03:00