Replace axios and other dependencies with native counterparts, add type support for stream
#17
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.
This PR replaces NPM dependencies such as
axios
andform-data
with native counterparts, making the codebase lighter and available for different non-Node environments.We are aware of the existing pull requests for this feature (see #10, thanks @gfortaine), but this PR aims to be a more lightweight implementation (no external dependencies needed) and with a similar API to reduce migration friction.
Additionally, we have added type support for streaming, which enables TypeScript to return correct types when
stream: true
. This makes it easier for developers to work with streams in a type-safe manner.CleanShot.2023-02-23.at.15.41.18.mp4
Changelog:
axios
andform-data
dependency with a simplified call tofetch
(this is a breaking change, users w/out native Fetch support must polyfill/ponyfill)typescript-axios
template found here: https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator/src/main/resources/typescript-axios (maybe we should just apply patches instead?)ts-morph
to add proper type support forstream: true