sdk-typescript
sdk-typescript copied to clipboard
[Feature Request] Support using the pure JS `Connection` to power a `Worker`
Is your feature request related to a problem? Please describe.
Currently the SDK has two separate connection classes:
NativeConnectionwhich is a JS representation of the Rust client object used to power workers.Connectiona grpc-js backed object that can only be used to power clients.
This is unnecessarily confusing and is blocking adding features such as:
- exposing the worker's connection to activity implementations.
- eager workflow start.
Describe the solution you'd like
Merge the two classes.
Connection is the preferred implementation as it supports grpc interceptors and does not require any native code making it slimmer and better suited for client applications especially in FaaS platforms where the native code what increase the function size and increase cold start times.
Abstracting the Rust client trait takes us a step forward towards compiling Rust Core to WASM, which opens up supporting other JS runtimes with great ease.
Additional context
Note that the Connection class does not record any metrics, that is a prerequisite for this issue.