Skip to content

0.5 #344

@oscartbeaumont

Description

@oscartbeaumont

Minor:

  • Make specta_serde errors good. Include path to procedure where it broke and which type it broke on.
  • Remove BigInt warnings

Core:

  • rspc_procedure
    • Split out of rspc_core
    • Allow downcasting (DynOutput::value) a non from_*_stream type?
    • Handle invariants of DynInput::new_value. Option::None will reach havoc.
    • Make serde/related crates an optional depedency (cause Binario doesn't need it)
    • ResolverError::new forces usage of Serde for value. Can we allow dyn Any?
    • Error should have a variant for a custom error by middleware (Eg. Zer). I'm not sure we can make it generate a type but it should be able to serialize any data so a JS package could throw types back onto it later.
    • Should DynOutput have a variant for ProcedureError? We can allow manually grabbing it but it would make the serialization code in userspace much cleaner.
    • Simplify ProcedureStream's constructor code
    • ProcedureStream::from_error is broken with flushing logic. The todo!() in ProcedureStream::poll_inner
    • Make flush work
    • trait impls of ProcedureStream::map related types
    • type_name on DynOutput make it useful or remove it
    • Rename DynInput and DynOutput?
    • Drop all Any bounds cause they are implied
    • Rename - require_manual_stream -> block_streaming, stream -> unblock_streaming, etc.
    • Procedures::new
    • impl Fn() -> TCtx or TCtx: Clone. rspc_invalidation makes this annoying.
    • wait_util function similar to the Cloudflare Workers/Vercel feature. How would a CDN implement it properly?
    • Should we call it State or Data?
    • Finish Debug impls + clippy run
    • Documentation
    • Audit for erased_serde in public API

Ecosystem:

  • rspc_devtools
    • fix it
    • Should we provide a way to set CORS header. If we leave it on the user the URL being the same is a problem?
  • rspc_tracing:
    • Drop `rspc_core::Procedure::with_logger``
    • Add Logger in rspc_core
    • Allow Router::setup to inject a Logger instance for rspc-tracing
    • Logger hook should create span with procedure metadata (ensure that span is tracked for the future somehow)
    • Middleware should only add input/result to existing span.

Features

  • Zer::from_request errors handled as an rspc_core::ProcedureError??
  • rspc - cleanup module structure cause it's a mess
  • SFM's
    • What if a SFM tries to call .invalidate?? We can't queue it again without conflicting keys
    • What if a SFM calls flush?? Cause we are well past that point.
    • stream.resolved() || stream.flushable() is bad
    • Delay executing SFM queries until the batch resolves
    • Deduplicating SFM keys for rspc_invalidation
    • Prevent calling .invalidate after streaming has started. What should happen?
    • rspc_invalidation can we skip serde_json::Value?
    • rspc_invalidate Invalidate::Any
    • rspc_invalidate Invalidate::Many
  • Wire protocol
    • Allow extensions to add extra data
    • Custom streaming response format. Differentiate errors vs values and reference to which query/mutation the result is referring to.
    • Poll the runtime while waiting for the next FormData item in the input.
    • Support WebSocket upgrades too
    • Are we going to keep rspc-axum/rspc-actix-web/rspc-http. Heavily dependant on how out of control the code in userspace ends up as.
    • File will bridge AsyncWrite/AsyncBufWrite to Stream<Item = Vec<u8>> so it can reuse the existing streaming machinery. This will allow interleaving multiple file downloads in one response.
      • In pratice this is how Hyper works so as much as I hate the overhead of buffering it's gonna happen anyway.
      • Yield AsBuffer(Vec<u8>) and then we can know to set the Content-Type in the transport layer correctly.
  • New syntax
    • If TError is fixed maybe we put it on the Router cause it's a bit wierd with BaseProcedure?
    • ResolverError takes two args which should both be self and anyhow::Error is not Clone. I think we can do smart stuff with constructors to solve this.
    • rspc::Error2 is super unsafe! It lets you choose to use #[error(...)] for the repr which is a string not TError.
    • Drop rspc::Error2 in favor of Into?
    • Manual flushing option build on the ProcedureStream flushing stuff
    • ProcedureBuilder::subscription implemented
    • Type exporting (right now they are hardcoded to DataType::Unknown)
    • Support exporting statics #285
    • Improve error handling DX #305 (might require Specta major)
    • ProcedureMeta::state called within a Middleware::setup should panic when accessed as it can't be valid.
    • Correctly determine key in Procedure2::builder.
    • specta_serde integration prototype
    • Jump to definition on routers
    • IntoResponse: ! future compat warning
    • Move Procedure2 into modern::procedure or keep in root?
  • Middleware system
    • Middleware::setup and Extension::setup are overriding which is major cringe alert.
    • Extension map function working. Might need TError generic?
    • Break out into rspc_middleware - ResolverInput, ResolverOutput, Middleware, Extension and related stuff
    • Stop any of the middleware depending on rspc and instead use rspc_middleware
    • Prevent applying rspc-invalidation to mutations and subscriptions. Should we make it typesafe?
  • Handling serializer errors
    • ProcedureStreamMap error handling
    • ProcedureError::Serializer or not? If not clear out commented out stuff.
    • I suppose we hardcode an error response to send if we can't serialize the first error.
    • rspc_tauri should handle first-level serializer errors through rspc instead of throwing into Tauri.
  • Tauri
    • What's the new integration going to look like?
    • Fix @rspc/tauri with legacy system
    • Maybe copy File from rspc_http? Idk if their IPC can handle it but I suppose supporting it anyway would be worthwhile.
  • WithDate
    • trait impls
    • Generalise implementation to any Serialize?
    • Use thread_local to enable the special rspc encoding so the type doesn't mess with users other stuff.
    • Require Accept: text/x-rspc for it to use the special encoding.
  • This is blocked on TypeMap + TypeCollection specta#294 & Language in practice specta#297 & releasing specta-rust.

Breaking Changes:

  • Determine future for rspc_axum/rspc_tauri. Userspace maybe?
  • Drop rspc_legacy + old bindings format

Unsorted:

  • Improve Procedure's Arcing.
  • Should Procedure2::error being Option<DataType> or not?
  • Ability to downcast instead of Serialize on error. Similar to the regular Ok type.
  • Defining middleware that don't depend on rspc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions