Commit Graph

813 Commits

Author SHA1 Message Date
Glauber Costa
145d6eede7 Implement very basic views using DBSP
This is just the bare minimum that I needed to convince myself that this
approach will work. The only views that we support are slices of the
main table: no aggregations, no joins, no projections.

drop view is implemented.
view population is implemented.
deletes, inserts and updates are implemented.

much like indexes before, a flag must be passed to enable views.
2025-08-10 23:34:04 -05:00
Pekka Enberg
81da795a66 Turso 0.1.4-pre.6 2025-08-08 16:50:24 +03:00
Pekka Enberg
ba88d17f29 Turso 0.1.4-pre.5 2025-08-08 13:49:06 +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
Nikita Sivukhin
9b892828eb fix package.json 2025-08-08 01:01:40 +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
04b40b4cf5 Impl copy_to for Database impl in JS bindings 2025-08-07 16:27:08 -04:00
Nikita Sivukhin
b8f2ff293b set more fresh lib version 2025-08-07 18:21:29 +04:00
Nikita Sivukhin
7d235953bb add open field 2025-08-07 16:28:02 +04:00
Nikita Sivukhin
e11184ff1d fix re-exports 2025-08-07 16:28:02 +04:00
Nikita Sivukhin
d1cd294e94 setup dual publish for commonjs/esm modules and properly route browser/node usages to the correct napi binary entrypoint 2025-08-07 16:28:02 +04:00
Nikita Sivukhin
1a2a1a9ca4 adjust javascript turso bindings for reuse in turso-sync-js package 2025-08-07 16:28:02 +04:00
Pekka Enberg
ab7b0dd1aa bindings/javascript: Implement Statement.iterate() 2025-08-07 14:28:34 +03:00
Pekka Enberg
b603ee7062 Merge 'JavaScript improvements' from Pekka Enberg
Closes #2467
2025-08-07 14:01:07 +03:00
Pekka Enberg
fa6c925751 bindings/javascript: Switch from RefCell to Cell 2025-08-07 07:47:10 +03:00
Nikita Sivukhin
b612259a3a more friendly copmletely runtime agnostic turso-sync-engine crate 2025-08-06 19:26:55 +04:00
Pekka Enberg
2913dc4dd4 Turso 0.1.4-pre.2 2025-08-06 10:52:32 +03:00
Pekka Enberg
6ad50f4581 bindings/javascript: Fix prepare() error message format 2025-08-06 09:13:22 +03:00
Pekka Enberg
9ae96838ab testing/javascript: Improve exec() after close() error 2025-08-06 08:07:15 +03:00
Pekka Enberg
79412ea2cc bindings/javascript: Improve error when prepare() called after close() 2025-08-06 07:48:15 +03:00
PThorpe92
f6a68cffc2 Remove RefCell from IO and Page apis 2025-08-05 16:24:49 -04:00
Pere Diaz Bou
2392ea1b55 bindings/rust: add with_mvcc option 2025-08-05 11:40:23 +02:00
Nikita Sivukhin
2e23230e79 extend raw WAL API with few more methods
- try_wal_watermark_read_page - try to read page from the DB with given WAL watermark value
- wal_changed_pages_after - return set of unique pages changed after watermark WAL position
2025-08-04 16:55:50 +04:00
Nikita Sivukhin
0adb40534c hind dangerous methods behind conn_raw_api feature 2025-08-04 12:40:28 +04:00
Diego Reis
31eb4403ad Add integration tests for query_row and get 2025-08-01 16:00:32 -03:00
Diego Reis
8a47b9d5a4 Address PR's comments 2025-08-01 16:00:32 -03:00
Diego Reis
572d3bd4ce Simplify Rust API verbosity by implementing Row.get() and
Statement.query_row()
2025-08-01 16:00:32 -03:00
Diego Reis
adb81dd6ce Separate Row and Rows in its own file 2025-08-01 16:00:32 -03:00
Pekka Enberg
9a1ead44f1 Merge 'bindings/javascript: Reduce VM/native crossing overhead' from Pekka Enberg
Before:
```
penberg@vonneumann perf % node perf-turso.js
cpu: Apple M1
runtime: node v22.16.0 (arm64-darwin)

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'525 ns/iter   (1'482 ns … 1'720 ns)  1'534 ns  1'662 ns  1'720 ns

summary for Statement
  Statement.get() bind parameters
penberg@vonneumann perf % bun perf-turso.js
cpu: Apple M1
runtime: bun 1.2.15 (arm64-darwin)

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'198 ns/iter   (1'157 ns … 1'495 ns)  1'189 ns  1'456 ns  1'495 ns

summary for Statement
  Statement.get() bind parameters
```
After:
```

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'206 ns/iter   (1'180 ns … 1'402 ns)  1'208 ns  1'365 ns  1'402 ns

summary for Statement
  Statement.get() bind parameters
penberg@vonneumann perf % bun perf-turso.js
cpu: Apple M1
runtime: bun 1.2.15 (arm64-darwin)

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'019 ns/iter     (980 ns … 1'360 ns)  1'005 ns  1'270 ns  1'360 ns

summary for Statement
  Statement.get() bind parameters
```

Closes #2391
2025-08-01 19:18:33 +03:00
Pekka Enberg
f1794b6270 bindings/javascript: Add INSERT benchmark too 2025-08-01 18:17:13 +03:00
Pekka Enberg
d4633415a7 Merge 'Enable indexes by default' from Jussi Saurio
Enables indexes by default in Rust and Python bindings + the CLI, while
leaving the feature flag in place.
Comments out a single ALTER TABLE test that fails due to #2390

Closes #2389
2025-08-01 17:36:35 +03:00
Pekka Enberg
358c0bfc27 cargo fmt 2025-08-01 17:17:01 +03:00
Pekka Enberg
1db0637a5e bindings/javascript: Improve benchmark 2025-08-01 16:55:04 +03:00
Pekka Enberg
94efe9dd46 bindings/javascript: Reduce VM/native crossing overhead
Before:

```
penberg@vonneumann perf % node perf-turso.js
cpu: Apple M1
runtime: node v22.16.0 (arm64-darwin)

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'525 ns/iter   (1'482 ns … 1'720 ns)  1'534 ns  1'662 ns  1'720 ns

summary for Statement
  Statement.get() bind parameters
penberg@vonneumann perf % bun perf-turso.js
cpu: Apple M1
runtime: bun 1.2.15 (arm64-darwin)

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'198 ns/iter   (1'157 ns … 1'495 ns)  1'189 ns  1'456 ns  1'495 ns

summary for Statement
  Statement.get() bind parameters
```

After:

```

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'206 ns/iter   (1'180 ns … 1'402 ns)  1'208 ns  1'365 ns  1'402 ns

summary for Statement
  Statement.get() bind parameters
penberg@vonneumann perf % bun perf-turso.js
cpu: Apple M1
runtime: bun 1.2.15 (arm64-darwin)

benchmark                            time (avg)             (min … max)       p75       p99      p999
----------------------------------------------------------------------- -----------------------------
• Statement
----------------------------------------------------------------------- -----------------------------
Statement.get() bind parameters   1'019 ns/iter     (980 ns … 1'360 ns)  1'005 ns  1'270 ns  1'360 ns

summary for Statement
  Statement.get() bind parameters
```
2025-08-01 16:45:03 +03:00
Pekka Enberg
a51c35c979 bindings/javascript: Fix silly typo in package.json 2025-08-01 16:04:59 +03:00
Jussi Saurio
86b1232268 chore: enable indexes by default 2025-08-01 15:44:56 +03:00
Pekka Enberg
a67b0a8a1d Merge 'chore: move tx isolation fuzz test to 'tests'' from Jussi Saurio
Closes #2383
2025-08-01 13:50:04 +03:00
Pekka Enberg
994a0e0852 Turso 0.1.4-pre.1 2025-08-01 13:38:12 +03:00
Pekka Enberg
38dbf75364 Merge 'Implement JavaScript bindings with minimal Rust core' from Pekka Enberg
This rewrites the JavaScript bindings completely by exposing only
primitive operations from Rust NAPI-RS code. For example, there is
prepare(), bind(), and step(), but high level interfaces like all() and
get() are implemented in JavaScript.
We're doing this so that we can implement async interfaces in the
JavaScript layer instead of having to bring in Tokio.

Closes #2372
2025-08-01 13:35:33 +03:00
Jussi Saurio
addb067416 chore: move tx isolation fuzz test to 'tests' 2025-08-01 13:02:05 +03:00