Releases: clockworklabs/SpacetimeDB
Release v2.0.4
Hello everyone! This week's release is a small bug-fix patch with a few UX improvements 🎉
New Features
- The
spacetimeCLI now checks daily for updates. When an update is available a notice is posted telling the user to upgrade. - The
spacetime devproject initialization logic now includes a fuzzy search which makes it much easier to find and select a template.
Bug Fixes
- Fix spacetime login --token falling through to web login
- Several correctness fixes which could prevent a database from loading
What's Changed
- Migrate to Rust 2024 by @coolreader18 in #3802
- Append commit instead of individual transactions to commitlog by @kim in #4404
- feat(tanstack): add SSR prefetching for Tanstack Start by @clockwork-tien in #4519
- Make
accessorrequired for table-level index defs in typescript by @joshua-spacetime in #4525 - Fix 'unsafe attr without unsafe' error by @coolreader18 in #4534
- Add AgentSkills.io integration for AI coding assistants by @douglance in #4172
- Make accessor required for table-level index defs in C# by @joshua-spacetime in #4541
- Adds code signing to tagged windows builds by @rekhoff in #4473
- Bring typescript benchmark client to parity with rust by @coolreader18 in #4494
- Don't put invalid
Cargo.tomlfiles in our repo by @gefjon in #4536 - Expose
RawModuleDefV10via the HTTP schema route by @gefjon in #4540 - Update edition in
.rustfmt.tomland pre-commit hook by @bfops in #4543 - docs: fix TS index definition
name→accessorby @clockwork-labs-bot in #4537 - gitignore
*.localfiles by @bfops in #4544 - Wait for database to load before returning schema by @clockwork-labs-bot in #4551
- CI - Reduce when package job runs by @bfops in #4539
spacetime dev- Replace template selection with fuzzy-filterable menu by @clockwork-labs-bot in #4470- docs: self-hosted prod/test/dev Azure VM guide with key rotation, Azure Key Vault workflows, and rsync data migration pattern by @benpsnyder in #4545
- Add implicit query builder conversions from
booltoBoolExprby @joshua-spacetime in #4547 - Fix typos in comments and doc comments across crates by @Shiven0504 in #4560
- Fix stale
--project-pathflag in templates by @bfops in #4564 - Overhaul README with up-to-date content by @clockwork-labs-bot in #4500
- CLI - Notify users if there's an update available by @clockwork-labs-bot in #4363
- Improve login/logout CLI UX by @clockwork-labs-bot in #4367
- CI -
clockwork-labs-botneeds 2 approvals by @bfops in #4568 - docs: Audit HTTP API docs against code by @clockwork-labs-bot in #4569
- docs: Clarify HTTP endpoint auth is optional, not required by @clockwork-labs-bot in #4562
- CI - Simplify PR approval check by @bfops in #4578
- Fix spacetime login --token falling through to web login by @clockwork-labs-bot in #4579
- CI - Stop running Python smoketests by @bfops in #4376
- Persist host type update and honor stored value after restart by @kim in #4549
- CI - Label check always runs by @bfops in #4594
- CI -
rustfmtinstead ofcargo fmtby @bfops in #4595 - CI - Label check runs on
synchronizeevents by @bfops in #4602 - Version bump 2.0.4 by @jdetter in #4600
- Fix Bool deserialized as number in TS SDK fast path by @clockwork-labs-bot in #4596
- Better error message for semijoin predicates by @joshua-spacetime in #4605
- CI - Fix package job by @bfops in #4552
- CI - Skip PR approval check on external PRs by @bfops in #4604
- [Rust] Primary keys for query builder views by @joshua-spacetime in #4572
New Contributors
- @benpsnyder made their first contribution in #4545
- @Shiven0504 made their first contribution in #4560
Full Changelog: v2.0.3...v2.0.4
Release v2.0.3
SpacetimeDB v2.0.3
We've been getting amazing feedback on our 2.0 release. Today we have a release of small bugfixes and QoL improvements in the CLI and SDK based on some of what we've been hearing. More to come soon!
New features
spacetime logs --levelfiltering. Filter logs by severity with--level warn(that level and above) or--level info --level-exact(exact match only). Works with both text and JSON output. (#4362)
Bug fixes
- We have improved the latency for making commits durably persisted
- React: fix
useTableisReadystuck onfalse. - TanStack Start: fix
useSpacetimeDBQueryreturning untyped rows. - TypeScript: fix
toCamelCaseconversion. - Fix index truncate edge cases.
- CLI: preserve leading
..in--out-dirpaths. - CLI: fix publishing in directories with spaces.
- CLI: skip upgrade prompt when
-yis passed.
C# SDK
- Improve error messages for Views. Better diagnostics when view queries fail in the C# SDK. (#4435)
What's Changed
spacetime dev- Print feedback when client process exits by @clockwork-labs-bot in #4469- Fix publishing in directories with spaces by @drogus in #4453
- CLI - preserve leading
..in --out-dir paths by @clockwork-labs-bot in #4431 - Remove security warning from 00500-schedule-tables.md by @taotien in #4463
- C# smoketest for
IQueryviews by @joshua-spacetime in #4391 - [C#] Improve error messages for Views by @rekhoff in #4435
- Add PlanetScale configuration details to keynote README & DEVELOP by @bradleyshep in #4474
- Fix missing word 'time' in ScheduleAt tutorial docs by @clockwork-labs-bot in #4490
- Version upgrade 2.0.3 by @jdetter in #4489
- keynote-2: alpha -> 1.5, withConfirmedReads(true), remove warmup by @Centril in #4492
- Update C++ module bindings to RawModuleDefV10 by @JasonAtClockwork in #4461
- LLM benchmark tool updates by @bradleyshep in #4413
- Add missing TypeScript example in migration guide by @clockwork-labs-bot in #4508
- docs: document how to access module owner via init reducer by @clockwork-labs-bot in #4315
- Fix
useTableisReadystuck onfalsedue to stale snapshot cache by @clockwork-labs-bot in #4499 - fix index truncate edge cases by @Shubham8287 in #4501
- Upgrade prompt is skipped when
-yis passed by @jdetter in #4511 - [docs] Corrected
callcase and updatedout-dirto match part 3 by @rekhoff in #4513 - [TS] Fix toCamelCase by @coolreader18 in #4523
- Fix a misprint in the self-hosting docs by @bfops in #4524
- Use prepared statements for postgres keynote benchmark by @joshua-spacetime in #4522
- Add --level flag to spacetime logs for filtering by log level by @clockwork-labs-bot in #4362
- fix: fix useSpacetimeDBQuery returns untyped rows for TanStack Start by @clockwork-tien in #4488
New Contributors
Full Changelog: v2.0.2...v2.0.3
Release v2.0.2
SpacetimeDB v2.0.2
A bug fix and quality-of-life release following the 2.0 launch. This release focuses on CLI improvements, durability tuning, and documentation fixes.
Bug fixes
- TypeScript: fix table schema wire name lookup crash. The TypeScript SDK was using PascalCase accessor names for wire protocol lookups, causing crashes when case conversion was enabled. (#4449)
spacetime dev: fix file watcher ignoring--module-path. When--module-pathwas set via CLI flag orspacetime.json, the file watcher still watched the default directory instead. (#4464)spacetime dev: better error when module directory does not exist. Previously showed a confusing "could not detect language" error. Now shows the actual missing path. (#4467)- Fix "Press any key to exit" in templates. The prompt said "any key" but actually required Enter. Updated text and logic to match. (#4468)
- Don't save
source_configtospacetime.json. Internal build configuration was being persisted to the user-facing config file. (#4422, #4423)
Performance
- Reduce local durability fsync interval to 10ms (down from misconfigured 500ms default), improving confirmed reads latency for local (non-replicated) databases. (#4466, #4420)
- C# SDK:
ArrayPoolfor row iteration buffers.RawTableIterBase.Enumeratornow rents fromArrayPool<byte>.Sharedinstead of allocating a freshbyte[]per step, significantly reducing GC pressure. (#4385)
Documentation
- Correct unique indexes in cheat sheet to use
filter, notfind. (#4452) - Correct "table" to "view" in Zen of SpacetimeDB. (#4434)
- Update C# docs with
List<T>returns andIEnumerable<T>examples. (#4392) - Fix AI assistant rules links in
llms.txt. (#4430) - Add ARM M-series CPU note in benchmark readme. (#4426)
- Add schedule name correction for LLM rules. (#4370)
- Fix Spacerace button and rename nav item to Referrals. (#4458, #4477)
What's Changed
- durability: Default local durability sync interval to 50ms by @kim in #4420
- keynote-2: use rust client by @Centril in #4421
- Don't save source_config to spacetime.json by @drogus in #4422
- Remove source-config field from spacetime.json by @drogus in #4423
- CI - Fix smoketests running twice by @bfops in #4281
- Update
bump-versionsto support prereleases by @bfops in #4384 - Add ARM M-series CPU note in benchmark readme by @aasoni in #4426
- Fix AI assistant rules links in llms.txt by @JulienLavocat in #4430
- Correct "table" to "view" in 00250-zen-of-spacetimedb.md by @knut-egil in #4434
- [C#] Update RawTableIterBase.Enumerator to use
ArrayPoolfor buffer by @rekhoff in #4385 - TS: fix
sourceNamein table schema by @Shubham8287 in #4449 - Smoketest subscribe properly respects new confirmed behavior by @bfops in #4454
- Fix spacerace button in docs by @jdetter in #4458
- [Docs] [C#] Update docs with
List<T>returns andIEnumerable<T>tests by @rekhoff in #4392 - Correct unique indexes in cheat sheet to use
filter, notfindby @gefjon in #4452 - Add schedule name correction for LLMs by @Boegie19 in #4370
- Bump versions to 2.0.2 by @bfops in #4455
spacetime dev- Improve error when module directory does not exist by @clockwork-labs-bot in #4467- Remove 'Press any key to exit' in basic-rs and basic-cpp templates by @clockwork-labs-bot in #4468
cargo bump-versionsproperly updates the smoketests lockfile by @bfops in #4462spacetime dev- Fix file watcher ignoring--module-path/spacetime.jsonmodule_pathby @clockwork-labs-bot in #4464- Reduce fsync interval to 10ms by @joshua-spacetime in #4466
- fix(docs): Rename spacerace to referrals for nav item by @clockwork-tien in #4477
Full Changelog: v2.0.1...v2.0.2
SpacetimeDB 2.0
SpacetimeDB 2.0 is finally here! 🌟
Today we're announcing SpacetimeDB! SpacetimeDB 2.0 has some big changes, so buckle up! Get ready for web development at the speed of light!
To find out in detail how to update your applications for 2.0 see our Migration Guide.
TypeScript/JavaScript Support
In October we launched beta support for TypeScript and JavaScript, and we're happy to announce that with the release of 2.0 TypeScript support is leaving beta! We also have a bunch of updates to the API that being much needed consistency to the APIs.
Web framework integration
Along with TypeScript and JavaScript support, we've built integrations and templates with all your favorite frameworks including:
Unreal Engine/C++ Support
For all those who have been waiting for official Unreal Engine 5 support, it's here! Alongside C++ modules as well!
Incredible performance
SpacetimeDB 2.0 delivers eye watering throughput even for tiny transactions with high contention. Well over 100k transactions per second for TypeScript modules and up to 170k transactions per second for Rust modules!
See how it compares to other databases in our new keynote presentation!
A new Maincloud FREE tier and all new pricing!
With 2.0, we're also announcing a brand new, simpler pricing scheme along with a free tier for users who want to try out Maincloud!
This new simplified pricing makes it easier than ever to predict your costs. Check out our pricing calculator on the pricing page.
Spacerace Referral Program
Alongside our new pricing, we're introducing the Spacerace Referral Program where you can get up to 400x more free credits per month by referring friends to the platform.
Procedures and HTTP calls
With 2.0 your SpacetimeDB modules are getting a big boost in capability too. For the first time, your modules can now access the outside world with Procedure Functions. Procedure functions give you the ability to make HTTP calls from within your module, letting you integrate directly with external APIs. This is how easy it is to call ChatGPT's API from within your module:
export const ask_ai = spacetimedb.procedure(
{ prompt: t.string(), apiKey: t.string() },
t.string(),
(ctx, { prompt, apiKey }) => {
// Make the HTTP request to OpenAI
const response = ctx.http.fetch('https://api.openai.com/v1/chat/completions', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`,
},
body: JSON.stringify({
model: 'gpt-4',
messages: [{ role: 'user', content: prompt }],
}),
// Give it some time to think
timeout: TimeDuration.fromMillis(3000),
});
if (response.status !== 200) {
throw new SenderError(`API returned status ${response.status}`);
}
const data = response.json();
const aiResponse = data.choices?.[0]?.message?.content;
if (!aiResponse) {
throw new SenderError('Failed to parse AI response');
}
// Store the conversation in the database
ctx.withTx(txCtx => {
txCtx.db.aiMessage.insert({
user: txCtx.sender,
prompt,
response: aiResponse,
createdAt: txCtx.timestamp,
});
});
return aiResponse;
}Read more about Procedure Functions.
SpacetimeAuth (and Clerk and Auth0)
And to help you avoid needing to set up additional sidecars and services alongside SpacetimeDB we've also introduced SpacetimeAuth, our first party auth solution. SpacetimeAuth is completely free to use with SpacetimeDB Maincloud!
We've also built tutorials for how to integrate with other auth providers like Clerk and Auth0!
View Functions
In SpacetimeDB 2.0, adding sophisticated read permissions to expose portions of your data to users is as simple as creating a function:
export const players_for_level = spacetimedb.anonymousView(
{ name: 'players_for_level', public: true },
t.array(playerAndLevelRow),
(ctx) => {
const out: Array<{ id: bigint; name: string; level: bigint }> = [];
for (const playerLevel of ctx.db.playerLevels.level.filter(2n)) {
const p = ctx.db.players.id.find(playerLevel.player_id);
if (p) out.push({ id: p.id, name: p.name, level: playerLevel.level });
}
return out;
}
);You can think of view functions as a table that is backed by a reducer. From the client, they look just like any other table in your database, but in the module they're represented as a function that returns rows that you want to expose to clients. Better yet, the table is automatically parameterized by the identity of the viewing client, allowing different clients to see different data when viewing the same table.
Views can also return custom types allowing you to not only filter rows, but also columns. Views are an elegant way of solving read permissions without introducing a single new concept!
Read more about View Functions.
Typed Query Builder
In SpacetimeDB 2.0, you can kiss your stringly-typed queries goodbye! With our 2.0 SDK and code generation, we generate beautifully typed query builder APIs that allows your clients to build arbitrary queries over the data.
ctx.subscriptionBuilder().subscribe([tables.user.where(user => user.name.eq("Tyler")), tables.message]);Never worry about runtime errors with your queries again! And the strongly typed queries also help LLMs succeed more often as well.
Even better, you can access this same query builder API inside your view functions to return queries from your views so they can be optimized by our incremental evaluation query engine!
export const high_scorers = spacetimedb.anonymousView(
{ name: 'high_scorers', public: true },
t.array(players.rowType),
(ctx) => {
return ctx.from.players
.where(p => p.score.gte(1000n))
.where(p => p.name.ne('BOT'));
}
);Event Tables
Event tables are also all new in SpacetimeDB 2.0. Event tables allow you to publish short lived event information to clients without needing to clean up your tables later on. Event tables act like regular tables, but the rows are automatically deleted by SpacetimeDB at the end of a transaction. This both saves you storage costs and also bandwidth, as the database needs to synchronize less state!
Publishing an event to clients is as simple as inserting into a row into the event table, and subscribing to it like any other table.
// server
const damageEvent = table({
public: true,
event: true,
}, {
entity_id: t.identity(),
damage: t.u32(),
source: t.string(),
});
export const attack = spacetimedb.reducer(
{ target_id: t.identity(), damage: t.u32() },
(ctx, { target_id, damage }) => {
// Game logic...
// Publish the event
ctx.db.damageEvent.insert({
entity_id: target_id,
damage,
source: "melee_attack",
});
}
);
// client
conn.db.damageEvent.onInsert((ctx, event) => {
console.log(`Entity ${event.entityId} took ${event.damage} damage from ${event.source}`);
});Read more about Event Tables.
spacetime.json configuration
With 2.0, we're also introducing a new config file to make it easier to interact with your databases. Now with spacetime.json you can save all your database configuration in a single file that you check in to git, so instead of this:
spacetime generate --lang typescript --out-dir src/module_bindings
spacetime publish --server maincloud --module-path spacetimedb my-databaseYou can now just type this:
spacetime generate
spacetime publishspacetime dev
Development is getting simpler too, with our new spacetime dev command. This command is your one stop shop for development. It:
- Watches for changes in your module code
- Compiles your module
- Generates your client module bindings
- Publishes your module
- Runs your client
Now all you have to do is change your code and your whole app updates instantly!
All new dashboard and metrics
We've also added beautiful new dashboards and analytics so you can monitor your apps and data in real-time! And they update in real-time too! It's incredible to see tables updating live, trust us!
Better LLM tools and benchm...
Release v1.12.0 - Client-side Typed Query Builder
The end of 1.0 is nigh! 🤩
v1.12 will be the last minor version before we drop SpacetimeDB 2.0! SpacetimeDB 2.0 will come with code breaking changes (you may need to change your modules and clients), but it will not require a migration of the existing data directory, and include backwards compatibility with existing clients and modules, so all existing databases and modules will continue working on both Standalone deploys and Maincloud.
If you're not subscribed to our YouTube channel, you should be. Trust me on that one.
We've got some great updates today in v1.12!
Typed Query Builder
- Added a typed query builder for the TypeScript client. (#4021)
- Added a Rust client query builder. (#4003)
- Added a typed query builder for the C# client, plus additional regression coverage. (#3982, #4123)
You can now subscribe to your server's data with type safe queries from clients:
TypeScript
import { queries } from "./module_bindings";
conn.subscriptionBuilder().subscribe([queries.user.build()]);C#
conn.SubscriptionBuilder().AddQuery(ctx => ctx.From.User().Build()).Subscribe();Rust
conn.subscription_builder().add_query(|ctx| ctx.from.user().build()).subscribe();NOTE: We would like to remove the .build() for 2.0, but you can try it out with the existing API.
Other highlights
-
New front-end framework SDKs
-
Organizations support
- Introduced Organizations support. (#4087)
-
Operational tooling improvements
Developer experience & docs
- Added new authentication tutorials:
- Documentation updates and clarifications, including explaining “maincloud” context. (#4029, #4071, #4168)
Performance & internal improvements
- Multiple datastore and update-path optimizations (construction, view evaluation fast paths, layout usage, and small data-structure refinements). (#4133, #4134, #4138, #4136)
- Reduced JS worker request/reply sizes and improved data-structure choices for better cache efficiency. (#4150, #4151)
Reliability & correctness
- Fixed
Hashindices not working. (#4060) - Durability: notify waiters after lockfile drop. (#4051)
- Fixed occasional panic when a client disconnects. (#4162)
- Improved blob handling flexibility (
copy_filterand related). (#4096) - Marked
MutTxIdas!Sendto avoid incorrect cross-thread usage. (#4039) - Added support and filtering improvements around
Uuid(including React Hookwheresupport and making the newUuidtype filterable). (#4030, #3991)
New contributors
What's Changed
- Expose a couple things to enable some work in another repo by @gefjon in #3986
eval_updates_sequential: no queries? => quit early by @Centril in #4049- Fix LLM benchmark Rust wrong struct name by @Boegie19 in #4043
- durability: Notify waiters after lockfile is dropped by @kim in #4051
- In-memory DatabaseLogger by @kim in #3961
impl MemoryUsage for TxStateby @Centril in #4054- Marks MutTxId as !Send by @Shubham8287 in #4039
- CI - Fix hint for fixing llm benchmarks by @bfops in #4040
- Further misc docs changes by @cloutiertyler in #4029
- Move unity testsuite onto unity runner by @jdetter in #4061
- Add ~/.local/bin to GITHUB_PATH for llm benchmark workflow by @drogus in #4064
- Add Auth0 tutorial by @JulienLavocat in #4048
- Fix
Hashindices not working by @kistz in #4060 - fix: docs llm test. make tables that we sql query public by @Boegie19 in #4058
- Add a typed query builder for the typescript client by @jsdt in #4021
- Add Clerk tutorial by @JulienLavocat in #4062
- Support
Uuidin React Hookwhereclause by @kistz in #4030 - Fixes C# benchmark test failures caused by table naming convention mismatches by @cloutiertyler in #4059
- Empty commit basically by @cloutiertyler in #4088
- Do not block CI on llm benchmarks by @jdetter in #4095
- Rust: client query builder by @Shubham8287 in #4003
- Fix test failure in fresh checkout of repository by @douglance in #4056
- Pass --yes flag from dev command to generate command by @cloutiertyler in #4069
- Add
cargo ci dllscommand for building C# DLLs and NuGet packages by @rekhoff in #4033 copy_filter& co: make blob handling more flexible by @Centril in #4096- Add
PointerMap::{iter, merge_from}by @Centril in #4092 - Make new
Uuidtype Filterable by @kistz in #3991 - Reduce
Test Suitetest concurrency to reduce test flakes by @jdetter in #3979 - Bump to v8 145 by @coolreader18 in #4073
- Add
HashMapBlobStore::merge_fromby @Centril in #4091 - Templates naming standarization by @drogus in #4042
- fix cross reducer call TS reference by @DKormann in #4104
- Removing1.5.0 DLLs by @rekhoff in #4100
- Re-run the LLM benchmarks update by @bfops in #4110
- Make all
VmMetricsfor the reducers and views of a module inInstanceCommon::newby @Centril in #4106 - feat: create Vue framework sdk by @clockwork-tien in #4037
- Allow setting custom v8 flags by @coolreader18 in #4126
- Hide LLM benchmark files in git diffs by @bfops in #4111
- Fix the upgrade version tool by @jdetter in #4085
- CI: Fix of C# tests failures by @jdetter in #4121
- optimize datastore by using
ty.layout.fixedmore by @Centril in #4133 eval_updates_sequential: comment out tracing by @Centril in #4132- optimize
view_for_updateto do nothing when there are no views by @Centril in #4134 - define
SmallHashMapinspacetimedb_data_structuresby @Centril in #4136 - Upgrade version to 1.12.0 by @jdetter in #4084
- [TS] Implement ctx.random() by @coolreader18 in #3907
- Optimize
TxData+DatabaseUpdatefor fast construction by @Centril in #4138 - Small docs improvement by @cloutiertyler in #4071
- Define
TableNameandReducerNamebacked byEcoStringby @Centril in #4137 - C# client typed query builder by @rekhoff in #3982
- [1/3]
RawModuleDefV10definition and validation. by @Shubham8287 in #4098 - [2/3] [Rust] Host changes for
RawModuleDefV10by @Shubham8287 in #4105 - Shrink
JsWorkerReplyto 48, making replies fit in a cache line by @Centril in #4151 - Revert "Upgrade version to 1.12.0 (#4084)" by @bfops in #4147
- Skip LLM check for now by @bfops in #4152
- Add
spacetime login --no-browserby @bfops in #4142 - RLS section in
RawModuleDefV10. by @Shubham8287 in #4149 - Shrink
JsWorkerRequest& use the right HashMap/Set by @Centril in #4150 - core: Add a method to query the replica ids managed by the host controller by @kim in #4160
- add missing category specifier [Unreal] by @KirstenWF in https://github.com/clockworklabs/Spac...
Release v1.11.3 - Bug fixes + Performance improvements
We've got another one for you! A bunch of small fixes including a critical feature to spacetime dev.
spacetime dev
spacetime dev now gets an additional --template argument, just like spacetime init. This allows you to quickly get started with SpacetimeDB on the CLI.
Bug Fixes & Improvements
- Many small improvements for C# and Unreal.
What's Changed
- Additional Hex parsing checks to
ConnectionIdandIdentityby @rekhoff in #3988 - Fix C# null string serialization error + add regression coverage for Issue #3960 by @rekhoff in #3967
- Update 00300-rust.md by @cloutiertyler in #3943
- Clarify Windows installation instructions in README by @dejaime in #3923
- Combine table and index attributes in Rust example by @kistz in #3948
- CI - LLM benchmark update uses
clockworklabs-botby @bfops in #3998 - fix(codegen): Initialize UPROPERTY fields in generated Unreal C++ code by @brougkr in #3990
- CI - LLM benchmark update uses
clockwork-labs-botby @bfops in #4004 - Fix link to Blackholio demo in Unreal tutorial and update project structure in README by @homersimpsons in #3994
- Misc docs and small CLI improvements by @cloutiertyler in #3953
- CI - Decrease number of iterations for long-running UUID test by @bfops in #4014
- deadlock fix: Make procedure tx abis synchronous by @Shubham8287 in #3968
- Fixed
SERVER_MSG_COMPRESSION_TAG_*descriptions by @egormanga in #4018 - Provide a common
Indextrait & simplify and shrinkTableIndexby @Centril in #3973 --feature no-core-pinningdisables core pinning by @Centril in #3983- Time out database shutdown by @kim in #4019
- Unreal SDK failing to handle fragmented messages by @JasonAtClockwork in #4002
- fix(codegen/unreal): eliminate UObject memory leak in reducer event handlers by @brougkr in #3987
- Fixes basic issues using the basic-react template. by @cloutiertyler in #4017
- CI - "Fix" v8 error in TypeScript CI by @bfops in #4022
- Add error handling for ranged seeks on non-range compat indices by @Centril in #3974
- Make
UuidNameable by @kistz in #4011 - Docs -
insert->try_insertby @bfops in #4025 - CI - Fix
/update-llm-benchmarkgetting cancelled by @bfops in #4027 - Add Hash indices by @Centril in #3976
- Update authentication docs by @JulienLavocat in #4020
- Despecialize direct indices with too large values into B-Tree indices by @Centril in #3978
- Expand doc comment on
FilterableValuewith requirements to implement by @gefjon in #4024 - Build all of the typescript templates in CI by @jsdt in #3980
- Move
Boundstruct out ofSpacetimeDB.InternaltoSpacetimeDBandLocalout ofSpacetiemDB.Runtimeby @rekhoff in #3996 - Add Unreal Result type to support C++ and Blueprint by @JasonAtClockwork in #3834
- Enable
RefOptionreturns from Views to support Views returning a singleclassby @rekhoff in #3964 - Version bump to 1.11.3 by @jdetter in #4041
- Fix logic for ipv6 connections in is_port_available by @jdetter in #4005
- docs: Add confirmed reads configuration to SDK reference docs by @kim in #4036
- Add a feature flag
no-job-core-pinningby @Centril in #4046 - docs: fix incorrect dirName for authentication sidebar by @JulienLavocat in #4047
New Contributors
- @dejaime made their first contribution in #3923
- @brougkr made their first contribution in #3990
- @homersimpsons made their first contribution in #3994
Full Changelog: v1.11.2...v1.11.3
Release v1.11.2 - Bug fixes + Performance improvements
Hello again everyone! We have another release with more improvements.
Host
- A bunch of performance improvements related to optimizing small transactions and the time between transactions
- A critical deadlock fix
- Many small fixes
C#
- Procedures in C# are here! You can try them out now, but they're not documented, you can see an example usage here. They'll be in beta until 1.12. Please let us know if you run into issues if you try them out.
Typescript
- A performance improvement to use a new ABI function for faster index lookups
Unreal
- Several bug fixes submitted by @KirstenWF! Thank you for the contributions.
New /templates directory for sharing templates
- We've consolidated our various projects and templates into the
/templatesdirectory in the repository. We'll be adding many more templates as we go. If you want to use a template you can install one with:
spacetime init --template <the-template-name> # or
spacetime dev --template <the-template-name>What's Changed
- add missing Category = "SpacetimeDB" [UnrealSDK] by @KirstenWF in #3897
- C# implementation of Transactions for Procedures by @rekhoff in #3809
- CI - No cache-on-failure by @bfops in #3903
- Refactor typescript table iterators by @coolreader18 in #3782
- Reuse buffers in
ServerMessage<BsatnFormat>by @Centril in #2911 - Remove old documentation that was mistakenly left by @JasonAtClockwork in #3902
- Bump typescript package sizes again by @jdetter in #3906
- do not warn, if valid [UnrealSDK] by @KirstenWF in #3898
- CI - Hackily fix V8 linker errors by @bfops in #3921
- Removes C# regression test of TimestampCapabilities by @rekhoff in #3908
- Adds datastore_index_scan_point_bsatn to C# Runtime by @rekhoff in #3909
- Add missing Nameable implementations by @coolreader18 in #3920
- Refactor /docs to close in on the final form by @JasonAtClockwork in #3917
- Use table def accessorName instead of server table name to access table db view by @aceysmith in #3932
- fix view deadlock by @Shubham8287 in #3938
- Respect updates to
st_tableduring replay by @gefjon in #3937 - Fix two silly typos by @gefjon in #3925
- Cargo.toml whitespace ONLY fix by @cloutiertyler in #3941
- Bump the Typescript SDK to 1.11.2 by @jdetter in #3927
- Bump TypescriptSDK version to 1.11.3 by @jdetter in #3940
- Make /v1/database/:name/call/:func call procedures too, remove procedure route by @mamcx in #3883
- Add UUID built-in convenience type to SpacetimeDB by @mamcx in #3538
- code polish for #3938 by @Shubham8287 in #3952
- Fixed inverted
wasm-optcondition by @egormanga in #3930 - Fixed Nullable value-type fields in Views in C# module causing excessive logging by @rekhoff in #3949
- Fix rollback metrics by @joshua-spacetime in #3956
- [TS] Implement and use point scan ABI by @coolreader18 in #3918
- LLM Benchmarking by @bradleyshep in #3486
- C# bindings: add
procedure_http_requestsupport + fix HTTP BSATN wire format to matchspacetimedb_lib::httpby @rekhoff in #3944 - Use a class for ReducerCtx by @coolreader18 in #3958
- Fix CI hash save in llm quick fix summary file by @bradleyshep in #3963
- Create
db.lockfile only for persistent databases by @kim in #3912 - Implement SpacetimeType for Result<T, E> by @mamcx in #3790
- Version bump to 1.11.2 by @jdetter in #3977
- Fixes #3240, perf of indexing many rows with same key by @Centril in #3971
- Templates rework by @drogus in #3879
- fix(scheduler): Restore ReducerContext recording for scheduled reducers by @Ludv1gL in #3947
- Fix reducer errors to return message not stack trace by @rekhoff in #3965
New Contributors
- @KirstenWF made their first contribution in #3897
- @bradleyshep made their first contribution in #3486
- @Ludv1gL made their first contribution in #3947
Full Changelog: v1.11.1...v1.11.2
Release v1.11.1 - Bug Fixes + Performance Improvements
Hello again everyone! This is likely going to be our last release before the holidays. We will potentially have one more release before the end of the year but for now we hope you are all happy with these improvements 🙂
Typescript
This release includes several bug fixes and performance improvements related to Typescript:
- SpacetimeDB now processes sourcemaps included in Typescript modules, so stacktraces in both new and existing modules now show the filenames and line numbers from your source code, not from the bundled JS file.
- The UTF-8 processing of the
TextEncoderandTextDecoderclasses is now implemented in native code, meaning string de/serialization will now have less overhead. useTablein a React client now works when specifying columns with camelcase names.- Generated client code is now compatible with the
noImplicitOverrideTypescript configuration option.
What's Changed
- Some more UI tests for Views by @Shubham8287 in #3829
- Implement sourcemap handling by @coolreader18 in #3828
- client-api: Send WebSocket messages fragmented by @kim in #2931
- Update typescript package size limits by @jdetter in #3854
- client-api: Deny changing the parent of an existing database by @kim in #3837
- Rename docs dirs and files to have more digits by @gefjon in #3851
- [TS] Use 'override' when overriding class items by @coolreader18 in #3852
- Handle unknown transactions without erroring. by @jsdt in #3858
lteandgteoperators to rust query builder by @Shubham8287 in #3855- fix automigration bug with
auto_incby @Shubham8287 in #3862 filteralias for rust query builder's where method by @Shubham8287 in #3856- Don't panic in
datastore_index_scan_range_bsatnon invalid ranges by @Centril in #3746 - Add rng support to ProcedureContext on Rust by @mamcx in #3865
- add initial cargo ci by @Kasama in #3409
- wasmtime: pool async stack allocations on unix by @Centril in #3830
- CI - Use rust-toolchain-file everywhere by @bfops in #3872
- Add WASM point scan ABIs & use them in Rust bindings by @Centril in #3863
- Tighten query types by @jsdt in #3866
- Fix useReducer params by @jsdt in #3873
- Fix broken SpacetimeDB logo in docs by @JulienLavocat in #3886
- Fix CLI reference generation by @bfops in #3403
- [TS] Fix useTable casing issues by @coolreader18 in #3853
- Strip sensitive info from HTTP errors by @gefjon in #3878
- cli: Flush stdout after printing the database tree by @kim in #3888
- Ensure all-ephemeral transactions don't consume a tx offset by @kim in #3884
- Add Reducer to the end of reducer arg types to avoid collisions by @jsdt in #3889
- Add a fault-tolerant commitlog replay mode for use in debugging by @gefjon in #3887
cargo cion windows by @bfops in #3859- Async shutdown for database / durability by @kim in #3880
- Ignore system meta-descriptor rows during replay by @gefjon in #3891
- Refactor /docs into Concepts by @JasonAtClockwork in #3877
- Resolve algebraic type refs recursively for view type check by @joshua-spacetime in #3876
- Make subscribe durable by @joshua-spacetime in #3894
- client-api: Pause time in websocket timeout tests by @kim in #3896
- Bump versions to 1.11.1 by @jdetter in #3901
Full Changelog: v1.11.0...v1.11.1
⛄ 🎄 🎁 Happy Holidays everyone! 🎁 🎄 ⛄
Release v1.11.0 - Typed Query Builder
Today we've released query builders for Rust and TypeScript modules. The purpose of the query builder API is so that you can write views that will take advantage of the unique performance guarantees of SpacetimeDB's query engine, particularly for realtime subscription updates.
The query builder also now allows you to iterate or scan a table in a view, something that previously wasn't possible using only the index accessors exposed by ViewContext and AnonymousViewContext.
The query builder exposes the following query operators:
.where()
Used for filtering. Equivalent to aWHEREcondition in SQL..leftSemijoin()
Equivalent to an inner join in sql where a row is return from thelhsonly if it matches with a row on therhs..rightSemijoin()
Equivalent to an inner join in sql where a row is return from therhsonly if it matches with a row on thelhs.
Examples (Rust)
use spacetimedb::{Identity, Query, Table, ViewContext, AnonymousViewContext};
#[spacetimedb::table(name = player_state)]
pub struct PlayerState {
#[unique]
player_id: u64,
online: bool,
}
#[spacetimedb::table(name = player_internal)]
pub struct Player {
#[auto_inc]
#[primary_key]
id: u64,
#[unique]
identity: Identity,
name: String,
#[index(btree)]
age: u8,
}
#[spacetimedb::table(name = moderator_internal)]
pub struct Moderator {
#[unique]
player_id: u64,
}
/// Returns all players.
/// Equivalent to `SELECT * FROM player_internal`.
#[spacetimedb::view(name = player, public)]
fn player(ctx: &AnonymousViewContext) -> Query<Player> {
ctx.from.player_internal().build()
}
/// Returns the caller's player.
/// Equivalent to `SELECT * FROM player_internal WHERE "identity" = :sender`.
#[spacetimedb::view(name = my_player, public)]
fn my_player(ctx: &ViewContext) -> Query<Player> {
ctx.from.player_internal().r#where(|p| p.identity.eq(ctx.sender)).build()
}
/// Returns only online players.
/// Equivalent to:
/// ```sql
/// SELECT q.*
/// FROM player_state p JOIN player_internal q ON p.player_id = q.id
/// WHERE p.online
/// ```
#[spacetimedb::view(name = online_player, public)]
fn online_player(ctx: &AnonymousViewContext) -> Query<Player> {
ctx.from
.player_state()
.r#where(|p| p.online.eq(true))
.right_semijoin(ctx.from.player_internal(), |(p, q)| p.player_id.eq(q.id))
.build()
}
/// Returns only the caller's player if online.
/// Equivalent to:
/// ```sql
/// SELECT q.*
/// FROM player_state p JOIN player_internal q ON p.player_id = q.id
/// WHERE p.online AND q.identity = :sender
/// ```
#[spacetimedb::view(name = my_online_player, public)]
fn my_online_player(ctx: &ViewContext) -> Query<Player> {
ctx.from
.player_state()
.r#where(|p| p.online.eq(true))
.right_semijoin(ctx.from.player_internal(), |(p, q)| p.player_id.eq(q.id))
.r#where(|p| p.identity.eq(ctx.sender))
.build()
}
/// Returns the moderators.
/// Equivalent to:
/// ```sql
/// SELECT p.* FROM player_internal p JOIN moderator_internal m ON p.id = m.player_id
/// ```
#[spacetimedb::view(name = moderator, public)]
fn moderator(ctx: &AnonymousViewContext) -> Query<Player> {
ctx.from
.player_internal()
.left_semijoin(ctx.from.moderator_internal(), |(p, m)| p.id.eq(m.player_id))
.build()
}Examples (TypeScript)
import { schema, table, t, type RowObj } from 'spacetimedb/server';
const playerState = table('playerState', {
playerId: t.u64().unique(),
online: t.bool(),
});
const playerInternal = table('playerInternal', {
id: t.u64().primaryKey().autoInc(),
identity: t.identity().unique(),
name: t.string(),
age: t.u8().index('btree'),
});
const spacetimedb = schema(playerState, playerInternal);
spacetimedb.view(
{ name: 'my_online_player', public: true },
t.array(playerInternal.row()),
ctx => {
return ctx.from.playerState
.where(p => p.online.eq(true))
.rightSemijoin(ctx.from.playerInternal, (p, q) => p.playerId.eq(q.id))
.where(p => p.identity.eq(ctx.sender))
.build();
}
);Bug Fixes
- Fixes an issue with the
--delete-data=on-conflictflag ofspacetimedb publish - Fixes an issue where databases were returning 400/500 errors after publishing with
-c - Fixes an issue where
on_insertandon_deletewere not firing correctly for per-client (ViewContext) views
What's Changed
- Delete duplicated docs folders by @gefjon in #3780
- Fixes reported issues with the TypeScript SDK by @cloutiertyler in #3737
- Fix some typescript issues by @coolreader18 in #3775
- Split Unity and C# tests into separate jobs by @jdetter in #3779
- Update typescript package size limits by @jdetter in #3786
- Add docs for procedures by @gefjon in #3766
- Actually report reducer fuel used by @drogus in #3799
- Fix view rewrite for delta tables by @joshua-spacetime in #3801
- Remove race condition from sdk test by @joshua-spacetime in #3804
- Implement DbContext for AnonymousViewContext and ViewContext by @tamaro-skaljic in #3787
- Fixes docs links by @cloutiertyler in #3803
- C# Views - Use Name from ViewAttribute instead of Method Name by @chutch1122 in #3792
- Remove duplicate assertSql in smoke test by @mamcx in #3588
- Docs: Update docs nav height to 56px by @clockwork-tien in #3788
- [TS] Fix
developmentexports breaking NextJS by @kistz in #3796 - [TS] Call registerType for procedure params by @coolreader18 in #3806
- CI - Skip the Unity testsuite on external PRs by @bfops in #3805
- Bump versions to 1.11.0 by @bfops in #3808
- Added and tested procedure docs for Unreal C++ & Unreal Blueprint by @JasonAtClockwork in #3810
- Update view ABI to support returning queries by @jsdt in #3685
- [Rust] Module-side query builder types by @Shubham8287 in #3797
- [Rust] update module bindings to use new view abi by @joshua-spacetime in #3819
- Update wasmtime to v39 by @coolreader18 in #3818
- [Rust] Query builder Integration. by @Shubham8287 in #3823
- Store
SubscriptionMetricsforUpdate,Subscribe,UnsubscribeinModuleSubscriptionsby @Centril in #3821 - smoketests: Adjust test_enable_disable_replication test by @kim in #3822
- [TS] Implement TextEncoder/TextDecoder with native code by @coolreader18 in #3800
- Debug "stuck module" issue by @kim in #3813
- Fixes issues with
--delete-data=on-conflictby @cloutiertyler in #3730 - Add a typescript query builder for views by @jsdt in #3812
New Contributors
- @tamaro-skaljic made their first contribution in #3787
- @chutch1122 made their first contribution in #3792
- @kistz made their first contribution in #3796
Full Changelog: v1.10.0...v1.11.0
Release v1.10.0 - Procedures and HTTP Requests
Today we have an absolute game changer for SpacetimeDB. SpacetimeDB 1.10 introduces the ability for databases to perform HTTP requests to external services right from within your module! This is one of our most-requested features, and we're very excited to share it with you all.
SpacetimeDB Reducers are extremely powerful. They are atomic, transactional, pure, retryable, and replayable. The challenge was: in order to maintain these properties and guarantees, they need to be isolated from the outside world and can't be allowed to cause any observable side effects.
However, HTTP requests are inherently side-effecting, and are too useful not to have. It turns out the solution is pretty simple: keep reducers side effect free, and introduce a new kind of database function with weaker guarantees and more powers. Enter a new type of SpacetimeDB function: Procedures.
Examples
Just like a reducer, a procedure is a function defined in your module which runs inside the database. Unlike a reducer, procedures don't correspond 1-to-1 with transactions. Instead, you explicitly manage transactions inside the body of your procedure:
#[spacetimedb::procedure]
fn find_highest_level_player(ctx: &mut ProcedureContext) {
let highest_level_player = ctx.with_tx(|ctx| {
ctx.db.player().iter().max_by_key(|player| player.level)
});
match highest_level_player {
Some(player) => log::info!("Congratulations to {}", player.id),
None => log::warn!("No players..."),
}
}Being able to run code in the database without a transaction opens a lot of possibilities for new APIs we could expose. The first of these, releasing today, is HTTP requests:
#[spacetimedb::procedure]
fn get_request(ctx: &mut ProcedureContext) {
match ctx.http.get("https://example.invalid") {
Ok(response) => {
let (response, body) = response.into_parts();
log::info!(
"Got response with status {} and body {}",
response.status,
body.into_string_lossy(),
)
},
Err(error) => log::error!("Request failed: {error:?}"),
}
}Take a look at the documentation on the new procedure APIs for more details,
and join us on Discord to let us know what other side effects you want APIs for!
As of this release, only Rust and TypeScript modules can define procedures. We're hard at work adding support to C# modules, and will be releasing them soon. We'll also be cleaning up the new APIs in response to your feedback, so for now procedures are unstable and subject to breaking changes.
TypeScript fixes
In this release, we've also fixed quite a few issues which were reported in the new TypeScript SDK.
- This issue by exporting the
SubscriptionHandletype with theREMOTE_MODULEtype applied. - This issue by converting to
camelCasefor column names in code generation. - Fixes an issue where
onMyReducercallbacks were passing arguments as variadic params, while the types indicated they would be passed as an object.onMyReducer((ctx, argA, argB, argC) => {})vs onMyReducer((ctx, { argA, argB, argC}) => {})` - Fixes an issue where the table type name was used instead of the table name in code generation for constructing tables.
- Fixes issue with
ScheduleAtbeing used in non-table types. - Fixes issue where template projects do not use the correct lifecycle reducer setup
- Fixes an issue where
.insert()returns incorrect objects - Fixes an issue where
.update()causes error with.autoInc()field
We intend for TypeScript modules and clients to rapidly approach stability. The most invasive breaking changes have already been made.
What's Changed
- Disable Unreal tests by @bfops in #3711
- Added staging to allowable issuers by @cloutiertyler in #3714
- Add procedure HTTP request API for WASM modules and the Rust module bindings library by @gefjon in #3684
- CI - No discord ping for skipped checks by @bfops in #3718
- Use custom runner for building CLI by @jdetter in #3716
- HTTP followup: remove
httpdep fromspacetimedb_libby @coolreader18 in #3719 - Add C# client SDK procedures by @JasonAtClockwork in #3666
- Upgrade to version 1.9.0 by @jdetter in #3709
- Attach artifacts workflow by @jdetter in #3724
- Add Unreal client SDK procedures by @JasonAtClockwork in #3667
- Views: index readsets by @Shubham8287 in #3706
- Add metrics for subscription queries by @drogus in #3661
- Add
spacetime_worker_reducer_returned_errors_totalmetric by @drogus in #3613 - Remove the dependency on git ls-files from cli/build.rs by @drogus in #3568
- Print internal error when a procedure call fails in sdk test client by @gefjon in #3725
- Revert "Remove the dependency on git ls-files from cli/build.rs (#3568) by @bfops in #3741
- [TS] Implement basic procedure calling by @coolreader18 in #3649
- CI - CLI doc check shouldn't fail on
Cargo.lockdiff by @bfops in #3739 - CI - Clearer CTA in discord post by @bfops in #3738
- Rename the
/database/procedureroute to beunstableby @gefjon in #3723 - [TS] Http procedure API by @coolreader18 in #3731
- [TS] Anonymous transactions by @coolreader18 in #3743
- Fix realtime update for views by @joshua-spacetime in #3747
- Bump hashbrown, foldhash; Fix some compile errors in master by @Centril in #3722
- C# module bindings for Procedures by @rekhoff in #3732
- Add rust sdk tests for views by @joshua-spacetime in #3755
- Add metrics for recording HTTP requests performed by procedures. by @gefjon in #3745
- CI - Migrate off of spacetimedb-runner by @bfops in #3763
- Move docs tests to custom runner by @jdetter in #3699
- Docs: Update docs nav items font weight to 600 by @clockwork-tien in #3721
- [TS] Client-side procedure bindings by @coolreader18 in #3765
- [Typescript] Increased size limits for some deps by @jdetter in #3728
- Procedures: fix scheduling by @Centril in #3704
- First pass at reorganizing the docs and making them nice by @cloutiertyler in #3494
- Revert "Procedures: fix scheduling (#3704)" by @jdetter in #3774
- Upgrade to version 1.10.0 by @jdetter in #3769
- Disable scheduling procedures by @gefjon in #3768
- Set timeout for smoketests by @jdetter in #3772
New Contributors
- @clockwork-tien made their first contribution in #3721
Full Changelog: v1.9.0...v1.10.0
