Repository navigation
Add content encoding to server options - #1250
Closed
Vinicius Stock (vinistock) wants to merge 2 commits into
Closed
Vinicius Stock (vinistock) wants to merge 2 commits into
Vinicius Stock (vinistock) wants to merge 2 commits into
Conversation
Dirk Bäumer (dbaeumer)
requested changes
Jun 5, 2023
|
|
||
| export type ServerOptions = Executable | { run: Executable; debug: Executable } | { run: NodeModule; debug: NodeModule } | NodeModule | (() => Promise<ChildProcess | StreamInfo | MessageTransports | ChildProcessInfo>); | ||
| type ContentEncoding = { contentEncoder?: ContentEncoder; contentDecoder?: ContentDecoder }; | ||
| export type ServerOptions = Executable & ContentEncoding | { run: Executable; debug: Executable } & ContentEncoding | { run: NodeModule; debug: NodeModule } & ContentEncoding | NodeModule & ContentEncoding | (() => Promise<ChildProcess | StreamInfo | MessageTransports | ChildProcessInfo>); |
There was a problem hiding this comment.
I would rather extend the original interfaces / types than & types here. We should also think about the effort it would take to make this type safe since encoders / decoders can't be supported on all transport kind. At least we have to issue a warning to inform the user about it.
Side note: regardless of what we do we should think about whether we want to apply the same for the Executable setup since Node IPC doesn't make too much sense there either.
Member
|
I will close the PR for now. Please ping if you decide to continue working on this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For more context, see #553.
This PR adds allows clients to define
contentEncoderandcontentDecoderin their server options. This addition makes it easier for clients to opt-in to different content encodings, such as msgpack, without having to worry about the life cycle of the process spawned - which is necessary when passing a function.There's a simple example usage in the integration tests, which doesn't actually do anything, but demonstrates that clients will be able to hook their own content encoders and decoders.