-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client refactor #85
base: main
Are you sure you want to change the base?
Client refactor #85
Conversation
…y for easier organization This will also be useful for starting work with chaining methods in RPC
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…hod chaining (WIP)
…t only works with promises (to be fixed)
…ng errors in provided handler, added some tests
…then) on given chain of methods
…or method catcher, added client test
…al modules, either given as dynamic or static import)
… returning dynamic import This should allow proper type definitions in module option of client when provided a partial module
…rt partial modules This is useful when part of a module is available client-side and a call can be made synchronously. Now, type definitions can optionally reflect when that module is available and avoid wrapping the return result in a Promise. The default remains the same, and the Module type parameter goes through transformations to reflect the transport of function data from a remote location (wrapping it in a Promise and adding support for HTML forms). Currently, the client needs this type parameter passed explicitly (passing partial module to `.module` option alone isn't enough but I'm unsure how to work around that).
…adding tests for types Also added more options for PromisifiedModule type (types still need to be reorganized and thought out)
…terfaces (being utilized in rewritten client)
…ot full support but useful for supporting them) Iterator methods and properties given on the client can now be intercepted to potentially support generators. This would need support from both the server and client to return and transform into async generators from the server.
…ck old client tests, accidentally deleted)
…tests too (I won't even pretend to understand this one) Previously type tests stalled forever and typedoc generation failed, now it doesn't. I'm not sure which upgrade actually fixed the problem but I won't complain.
Build time for typedocs are incredibly slow and type tests are also slow but they do seem to work locally (unsure of what impact on types in IDE will be)
…ions, optimized MergeMethods type
These should be much easier to work with in the new client. The old client's utilities have been updated to make use of the new utilities in the meantime (and those temporary, old functions have been marked deprecated).
…enamed some functions
…s, experimenting with new "resolvers" for RPC
…during internal usage (to reflect defaults)
As part of the 1.0 release, the code should be easier to read, debug, and contribute. As part of this refactor, I also plan to consider what method chaining looks like in the library for the future. While this PR does not include method chaining, it should include changes that make it possible.
Changes:
New features (non-breaking):
Module
type) optionalBreaking changes (and new features):
options.module
types with providedModuleType
type parameterModuleType
is not provided or when both type parameters are provided. When only theModuleType
is provided (as in previous version), behavior remains the same.options.module
will only be reflected if options type is also provided as a generic, otherwiseModuleType
will be utilized (as expected)as const
so type parameter can pick up on selected optionsoptions.postRequest
now takes three arguments:(args, result, name) => unknown
(args have been added)