Commit Graph

137 Commits

Author SHA1 Message Date
Sebastian Jeltsch 8a550438c7 Update Rust dependencies. 2026-01-23 13:35:00 +01:00
Sebastian Jeltsch 5898fc9dba Merge WASM-host implementations for HTTP/Job handlers and SQLite functions. Also extend SQLite function state life-cycle to persist and be shared. 2026-01-23 13:34:57 +01:00
Sebastian Jeltsch f23df128d0 Allow for late auth with an explicit WebSocket messages, since Browsers and NodeJS don't allow setting headers on the UPGRADE HTTP request. 2026-01-20 16:26:00 +01:00
Sebastian Jeltsch f2f21fc3b4 Update Rust dependencies. 2026-01-18 22:39:32 +01:00
Sebastian Jeltsch 0a5625bcf6 Move WS subscriptions behind the same endpoint as SSE and improve error handling. 2026-01-18 22:39:28 +01:00
Sebastian Jeltsch 9a29ce2388 Fix WebSocket realtime subscriptions by sending SSE events only for SSE subscriptions. 2026-01-18 16:13:42 +01:00
Sebastian Jeltsch ee75a7b928 Improve SSE subscription error handling and add PoC WebSocket feature. 2026-01-16 12:20:24 +01:00
Sebastian Jeltsch 90069f6c59 Update Rust dependencies. 2026-01-14 20:26:50 +01:00
Sebastian Jeltsch b0f0b84fc2 Allow re-ordering columns in the Create/Alter table UI. #191 2026-01-14 20:26:46 +01:00
Sebastian Jeltsch 414677ce13 Opportunistic cleanup of admin alter table. 2026-01-14 20:01:51 +01:00
Sebastian Jeltsch 2811a51d75 Optimization: for filtered subscriptions first before access checking and opportunistic clenaup. 2026-01-14 20:01:05 +01:00
Sebastian Jeltsch 6a6ba9dc95 Fix edge case for subscriptions getting unregistered too early and opportunistically tidy up code. 2026-01-11 22:43:27 +01:00
Sebastian Jeltsch 57930d17e4 Fix missing total_count for list queries with ?count=true&limit=0. #207 2026-01-10 22:56:21 +01:00
Sebastian Jeltsch 5baea96182 Stream WASM http response body. 2026-01-09 22:41:21 +01:00
Sebastian Jeltsch 3e9997c3d3 Further simplify WASM runtime. 2026-01-09 22:41:15 +01:00
Sebastian Jeltsch 401538963e Simplify WASM runtime integration. 2026-01-09 14:20:04 +01:00
Sebastian Jeltsch c85b01ff0b Update reqwest. 2026-01-08 09:51:06 +01:00
Sebastian Jeltsch 58838f10cc Wire serialized CREATE (TABLE|VIEW) statements through to UI. 2026-01-08 00:17:57 +01:00
Sebastian Jeltsch 89edfc9e3a Fix benchmark. 2026-01-06 10:13:28 +01:00
Sebastian Jeltsch 1ba84437f1 Update rusqlite to v0.38 and vendor serde-rusqlite. 2026-01-05 22:09:06 +01:00
Sebastian Jeltsch ba9cd131ab Only instantiate WASM executor if components are actually found. Reduces footprint on instances not using WASM. 2026-01-05 20:52:29 +01:00
Sebastian Jeltsch 5835fb93a3 Add ip-based rate limiting on all POST auth APIs.
This is an effort to improve abuse protection, e.g. sign-up bombing. Logins where already rate-limited on email address.
2026-01-05 18:27:17 +01:00
Sebastian Jeltsch dedde47f95 Disable winch on MacOS for now: https://github.com/trailbaseio/trailbase/issues/206. 2026-01-02 17:55:15 +01:00
Sebastian Jeltsch d5ff4b5dfb Make queries truly const (rather than lazy statics) wherever possible and remove indoc as dep. 2026-01-02 11:51:14 +01:00
Sebastian Jeltsch 98b87e6255 Cleanup OAuth callback handler and improve error handling. This should mostly be a noop. 2026-01-02 10:03:30 +01:00
Sebastian Jeltsch d36d36aaf0 Update Rust dependencies. 2026-01-02 09:55:22 +01:00
Takumi Mori e26721c58d Add an --spa mode for serving SPAs from --public-dir. Thanks @takumi3488.
Requests to non-root paths that don't look like asset/file requests (i.e. don't have a file extension) will fall back to `/index.html`.
2026-01-01 15:17:53 +01:00
Sebastian Jeltsch 2fa5e8ce96 Update minor Rust dependencies and major Wasmtime version. 2025-12-26 09:22:55 +01:00
Sebastian Jeltsch 91f6ca349a Add RUST_BACKTRACE=1 to example's WASM hot-reload script.
There seems to be a panic on Macs were sync sqlite-function WASM runtimes spawn a nested tokio runtime.
2025-12-26 08:55:56 +01:00
Sebastian Jeltsch c536aaf341 Peel back admin UI's login screen only when actual admin user.
IMPORTANT: this behavior was **never** a security concern. Admin APIs always required an admin user. This change merely prevents a defunct UI from being shown to non-admin users.

Adding the new JWT property broke the kotlin client, since its JSON parser was arguably set up too strict.
2025-12-18 10:11:07 +01:00
Sebastian Jeltsch 82e11f1cb1 New "user add <email> <pw>" CLI command. 2025-12-17 23:22:16 +01:00
Sebastian Jeltsch a7ca0a5f9b Allow JSON & multipart inputs for user registration (just like all the other auth endpoints). #193 2025-12-17 16:11:27 +01:00
Sebastian Jeltsch 7816988870 Disallow config changes in demo mode. 2025-12-15 15:11:51 +01:00
Sebastian Jeltsch d4c9c55469 Add a basic link/unlink UI for additional databases. 2025-12-15 14:37:09 +01:00
Sebastian Jeltsch 986545240a Fix user account pagination.
Has been broken since switching to UUIDv4 ids.
2025-12-15 12:26:17 +01:00
Sebastian Jeltsch 9b3cd82143 Be slightly more conservative with removing pre-update hooks. 2025-12-14 10:35:08 +01:00
Sebastian Jeltsch d87cdf9358 Avoid linear seek for looking up APIs optimizing for large N case. 2025-12-14 01:12:36 +01:00
Sebastian Jeltsch 2de60c2d10 Layered locking to reduce congestion and improve subscription performance. 2025-12-14 00:29:39 +01:00
Sebastian Jeltsch 1875220c67 Avoid unecessary connection cycling for >256 DBs. This could defunct "realtime" subscriptions. 2025-12-13 23:54:29 +01:00
Sebastian Jeltsch 27ce368add Introduce a connection identiy and use it to manage subscriptions more robustely.
Ultimately names don't matter. Subscriptions only works if the update_hook is installed on the very connection the record APIs use for mutations.
2025-12-13 22:35:13 +01:00
Sebastian Jeltsch 2beab0f770 Cleanup code for change subscriptions. 2025-12-13 14:54:30 +01:00
Sebastian Jeltsch 69d305e149 Update to latest Rust stable v1.92 and please linter gods. 2025-12-12 12:15:28 +01:00
Sebastian Jeltsch 84254e2fed Introduce multi-DB support, i.e. Record APIs can be powered by TABLEs/VIEWs from different DBs. This can help with physical isolation and offer a path forward when locking bottlenecks are encountered.
It's still early days, e.g. the UI doesn't yet support creating new DBs. However it allows exploring, creating and altering schemas for existing DBs. For now use the config to register new DBs.

Changes:

* Config-driven life-cycle management for "extra" DBs, i.e. creation and migration-management.
* Completely rewire connection & schema access throughout, now using a ConnectionManager abstraction.
* Update SubscriptionManager to track subscriptions across multiple DBs.
* Per-DB file management.
* Improved error handling.
* Basic e2e tests including file handling.
* Update UI:
  * Explorer: show, create and alteration of schemas on non-main DBs.
  * SQL Editor: allow control over which DBs are attached to the connection.

This change is breaking: it affects how migrations are loaded from `<traildepot>/migrations/<db>/` and switches transaction default of batch endpoint to false (cheaper).

This change does not introduce a notion of multi-tenancy, i.e. create a per-tenant/user DB on the fly based on templates and corresponding traffic routing.
2025-12-12 11:48:30 +01:00
Sebastian Jeltsch 5a912c31ea Be stricter in demo mode with respect to schema alterations/deletions. 2025-12-04 16:32:36 +01:00
Sebastian Jeltsch b7f130592b Use fully-qualified name (name + db schema) in more places.
Disambiguation and preparation for a multi-DB world.
2025-12-03 16:14:32 +01:00
Sebastian Jeltsch afee1bf79f Create a fresh connection for query executions (from the admin UI) to cleanly separate it from the internal connection and avoid any chance of meddling, e.g. drop extra databases. 2025-12-02 14:15:21 +01:00
Sebastian Jeltsch 7c06d60999 Update Rust dependencies. 2025-12-02 10:45:56 +01:00
Sebastian Jeltsch edb34e2c7c Move more of the migration loading logic from refinery into TB and allow controlling recursiveness in preparation for multi-DB migrations. This should be a noop for now.
Also, drive-by switch new migration tables to be STRICT SQlite tables.
2025-12-02 09:54:13 +01:00
Sebastian Jeltsch badd85c480 Fix docker alias to work correctly on Mac (probably Windows as well). Thanks @domibies #179. 2025-11-30 12:25:08 +01:00
Sebastian Jeltsch 8a9c944c0d Major Rust dependency update.
This update would not have been comcompatible with rustyscript->deno->swc, which is why we have to remove the V8 integration in a prior change.
2025-11-23 22:32:03 +01:00