Skip to content

Releases: specta-rs/rspc

v0.3.1 - General fixes

03 Dec 15:31
Compare
Choose a tag to compare

Fixes:

Thanks to @yuezk, @marcocondrache and @espeon for their contributions!

v0.3.0 - Tauri v2 Support!

20 Nov 16:53
Compare
Choose a tag to compare

Changes:

  • Upgrade dependencies - Including support for Tauri v2!
  • This version requires Specta =2.0.0-rc.20
  • Remove a lot of rspc::internal exports to prepare for major changes to the internals.

v0.2.0

17 Mar 17:06
Compare
Choose a tag to compare

This release comes with a bunch of breaking changes to prepare existing rspc projects for the upcoming 0.3.0 release.

This release is only possible due to the support of my sponsors!

A huge thanks to @scottwey, @michael-dm and @TmLev for supporting me. If you are using rspc and you or your company is able to support the project it would be greatly appreciated as it ensures the product is sustainable long-term!

tldr of changes

  • Fix websocket when using the Axum integration which I broke in the 0.1.4 release earlier today
  • Drop httpz from rspc core. I have deprecated this crate as I don't think it's serving it's purpose very well. All integrations are moving into rspc_* crates.
  • Remove Specta reexports and Specta features from the rspc crate
  • Restart subscriptions and in-progress requests when the websocket connection reconnects.
  • Websocket support is now optional and requires the ws feature to be enabled on the rspc_axum crate.
  • Expose AppHandle to Tauri context function as the first argument - fixes #244

These changes should hopefully fix the most comments issues I hear when talking with people about rspc.

Upgrade Guide:

Bump dependency versions

# Backend
cargo add [email protected]

# Frontend
pnpm install @rspc/[email protected]
pnpm install @rspc/[email protected]
pnpm install @rspc/[email protected]
pnpm install @rspc/[email protected]

Removal of rspc::Type

rspc::Type is currently a reexport of specta::Type and to make versioning easier we have removed it in this rspc release. To upgrade:

Make sure you have Specta installed in your project.

cargo add specta

Then replace all rspc::Type imports with specta::Type.

Removal of many features from rspc crate

This release drops a lot of features from the rspc crate. I have documented them by category below:

Specta-related flags

This includes uuid, chrono, time, bigdecimal, rust_decimal, indexmap, ipnetwork, mac_address, bit-vec and bson.

You should instead move the feature onto the specta crate.

Eg.

- rspc = { version = "0.1.4", features = ["chrono"] }
+ rspc = "0.2.0"
+ specta = { version = "1", features = ["chrono"] }

Webservers

This includes httpz, tauri, axum, lambda, workers. You should follow the guide for your integration under the next heading.

Break out integrations into dedicated crates

This is going to make versioning significantly easier which would mean more frequent bug fixes and depedency upgrades.

This included removing .endpoint and the rspc::integrations module in favor of splitting the logic over multiple crates.

Follow the guide below based on your chosen integration:

Axum

First, remove the old feature flag and add the new rspc_axum crate.

- rspc = { version = "0.1.4", features = ["axum"] }
+ rspc = "0.2.0"
+ rspc_axum = { version = "0.1.1", features = ["ws"] } # Websocket support is now optional

Next, upgrade the code in your project:

let app = axum::Router::new()
        .route("/", get(|| async { "Hello 'rspc'!" }))
        .nest(
            "/rspc",
-           router
-                .clone()
-                .endpoint(|| { ... })
-                .axum(),
+            rspc_axum::endpoint(router.clone(), | | { ... }),
        )
        .layer(cors);

Tauri

First, remove the old feature flag and add the new rspc_tauri crate.

- rspc = { version = "0.1.4", features = ["tauri"] }
+ rspc = "0.2.0"
+ rspc_tauri = { version = "0.0.1" }

Next, upgrade the code in your project:

tauri::Builder::default()
-    .plugin(rspc::integrations::tauri::plugin(router.arced(), || { ... }))
+    .plugin(rspc_tauri:plugin(router.arced(), |_| { ... }))

Lambda

This feature has been removed. It's recommend you use the Axum integration with cargo-lambda like this example.

Workers

This feature has been removed. It currently has no direct replacement but will be brought back in the near future.

If you are actively using it, please contact me on the rspc/PCR Discord and we can get something sorted.

Tanstack Query v5

This release requires you upgrade to Tanstack Query v5. You can follow their upgrade guide here.

Solid Query

Solid Query has changed the way its arguments are parsed upstream so we decided to copy this. You will need to update all of your createQuery, createMutation, etc hooks to the new syntax.

For queries you will need to make the following changes:

rspc.createQuery(
-  () => ["echo", "somevalue"],
-  () => ({
-    enabled: true,
-  })
+ () => ({
+  queryKey: ["echo", "somevalue"],
+  enabled: true
+ })
);

For mutations, you will need to use the mutationKey property to choice the mutation is the same style.

Usage with Prisma Client Rust

If your using Prisma Client Rust 0.6.x you can use the rspc-0.2.0 branch:

prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", rev = "8faf98013d0d2c7fab68fad387305a55979e777d" }
prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", rev = "8faf98013d0d2c7fab68fad387305a55979e777d" }

v0.1.4

17 Mar 05:36
Compare
Choose a tag to compare

Changes:

  • Support Axum 0.7
  • Fix rspc Tauri can only handle one request at a time - #260 - Thanks @campbellcole

Using Axum 0.7

To use Axum 0.7 you must use the rspc_axum crate. You will need to install it by running:

and then make the following changes:

let app = axum::Router::new()
        .route("/", get(|| async { "Hello 'rspc'!" }))
        .nest(
            "/rspc",
-           router
-                .clone()
-                .endpoint(|| { ... })
-                .axum(),
+            rspc_axum::endpoint(router.clone().endpoint(|| { ... })),
        )
        .layer(cors);

Warning

I noticed after publishing this release, it's got a major bug with Websockets due to mistake on my end. If you are using websockets please jump straight to 0.2.0 instead, sorry for the inconvenience!

I also forgot to publish to npm for this release.

😊

v1.0.0-rc.4

19 Jul 17:27
Compare
Choose a tag to compare

Foreshadowing: I really hope no more bugs exist.

v1.0.0-rc.3

19 Jul 15:15
Compare
Choose a tag to compare

The bugs just don't stop coming.

v1.0.0-rc.2

19 Jul 09:43
Compare
Choose a tag to compare

Bug fixes

v1.0.0-rc.1

19 Jul 05:43
Compare
Choose a tag to compare

Right now this release is undocumented and comes with many breaking changes.

If your feeling brave referring to Spacedrive upgrade 1 & 2 will give you an idea of changes required.

Docs are coming soon! Join the Discord for updates!

v0.1.3

05 Mar 14:48
Compare
Choose a tag to compare

Fixes:

Changes

  • Specta has been relocated from the specta subdirectory to oscartbeaumont/specta
  • Specta has been upgraded to v1.0.0
  • Support for Axum v0.6
  • Multithreaded Tauri executor
  • Upgraded all Rust and backend deps
  • Remove async-stream dependency

Breaking changes

Axum integration

When upgrading you will get the error expected struct "MethodRouter", found struct "axum::Router". To fix this you need to update your code as follows:

+ use rspc::integrations::httpz::Request;

-  .route(
    "/rspc/:id",
+  .nest(
    "/rspc",
    router
-        .endpoint(|path: Path<String>| {
-            println!("Client requested operation '{}'", *path);
+        .endpoint(|req: Request| {
+            println!("Client requested operation '{}'", req.uri().path());
            ()
        })
        .axum(),
)

If you were using a full Axum extractor, support for them has been deprecated as Axum 0.6 has broken the way it works. Please refer to this example for the workaround to use an Axum extractor. This workaround will be removed in the future so please open a GitHub issue to let me know your usecases for it!

Merge behavior

The behavior .merge has changed. If you want to restore the old behavior rename .merge to .legacy_merge. I am going to drop .legacy_merge in a future update so please open a GitHub Issue if you have a use case that doesn't work with .merge.

Other Dependencies

You may be required to upgrade over dependencies such as:

  • Tokio
  • Axum

I would highly recommend installing cargo-edit and running cargo upgrade --compatible --recursive to upgrade everything.

v0.1.2

01 Oct 16:41
Compare
Choose a tag to compare

Fixes:

  • Fix Typescript types for client.subscription function.

Features:

  • Undocumented helpers for building custom hooks on top of rspc