fork of hey-api/openapi-ts because I need some additional things

feat: bundle axios client

Lubos ​ 2d7dc55c 4ff2aed3

+55 -748
-263
packages/client-axios/CHANGELOG.md
··· 1 - # @hey-api/client-axios 2 - 3 - ## 0.9.1 4 - 5 - ### Patch Changes 6 - 7 - - [#2165](https://github.com/hey-api/openapi-ts/pull/2165) [`f23f3ae`](https://github.com/hey-api/openapi-ts/commit/f23f3ae874385e758eb8d43bb4e274c9858a4e40) Thanks [@mrlubos](https://github.com/mrlubos)! - fix(client): do not serialize path param name in url 8 - 9 - ## 0.9.0 10 - 11 - ### Minor Changes 12 - 13 - - [#2148](https://github.com/hey-api/openapi-ts/pull/2148) [`10d2e03`](https://github.com/hey-api/openapi-ts/commit/10d2e03b8295e4e887fab8d023aa823699efbae8) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: export `buildClientParams` function 14 - 15 - ## 0.8.0 16 - 17 - ### Minor Changes 18 - 19 - - [#2094](https://github.com/hey-api/openapi-ts/pull/2094) [`8152aaf`](https://github.com/hey-api/openapi-ts/commit/8152aaf4892c48b79fd3dc486eb3c0ea333dc3e6) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: accept responses/errors map instead of union 20 - 21 - **BREAKING**: Update `@hey-api/openapi-ts` to the latest version. 22 - 23 - ## 0.7.1 24 - 25 - ### Patch Changes 26 - 27 - - [#2039](https://github.com/hey-api/openapi-ts/pull/2039) [`565e0b8`](https://github.com/hey-api/openapi-ts/commit/565e0b89fbab4556ecdc63dfe08250942681140e) Thanks [@Le0Developer](https://github.com/Le0Developer)! - fix(clients): fix query string encoding with empty lists/objects 28 - 29 - ## 0.7.0 30 - 31 - ### Minor Changes 32 - 33 - - [#1889](https://github.com/hey-api/openapi-ts/pull/1889) [`67c385b`](https://github.com/hey-api/openapi-ts/commit/67c385bf6289a79726b0cdd85fd81ca501cf2248) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: add @hey-api/openapi-ts to peer dependencies 34 - 35 - ## 0.6.3 36 - 37 - ### Patch Changes 38 - 39 - - [#1850](https://github.com/hey-api/openapi-ts/pull/1850) [`fe43b88`](https://github.com/hey-api/openapi-ts/commit/fe43b889c20a2001f56e259f93f64851a1caa1d1) Thanks [@kelnos](https://github.com/kelnos)! - feat: add support for cookies auth 40 - 41 - ## 0.6.2 42 - 43 - ### Patch Changes 44 - 45 - - [#1774](https://github.com/hey-api/openapi-ts/pull/1774) [`c0b36b9`](https://github.com/hey-api/openapi-ts/commit/c0b36b95645d484034c3af145c5554867568979b) Thanks [@mrlubos](https://github.com/mrlubos)! - docs: announce Hey API platform 46 - 47 - ## 0.6.1 48 - 49 - ### Patch Changes 50 - 51 - - [#1674](https://github.com/hey-api/openapi-ts/pull/1674) [`7f0f4a7`](https://github.com/hey-api/openapi-ts/commit/7f0f4a76b06c8fafb33581b522faf8efc6fd85ac) Thanks [@ale18V](https://github.com/ale18V)! - Return a string from urlSearchParamsBodySerializer instead of a URLSearchParams object. 52 - This is due to some runtimes not being able to handle the URLSearchParams object as fetch body. 53 - 54 - ## 0.6.0 55 - 56 - ### Minor Changes 57 - 58 - - [#1661](https://github.com/hey-api/openapi-ts/pull/1661) [`bb6d46a`](https://github.com/hey-api/openapi-ts/commit/bb6d46ae119ce4e7e3a2ab3fded74ac4fb4cdff2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: make createConfig, CreateClientConfig, and Config accept ClientOptions generic 59 - 60 - ### Added `ClientOptions` interface 61 - 62 - The `Config` interface now accepts an optional generic extending `ClientOptions` instead of `boolean` type `ThrowOnError`. 63 - 64 - ```ts 65 - type Foo = Config<false>; // [!code --] 66 - type Foo = Config<{ throwOnError: false }>; // [!code ++] 67 - ``` 68 - 69 - ## 0.5.3 70 - 71 - ### Patch Changes 72 - 73 - - [#1637](https://github.com/hey-api/openapi-ts/pull/1637) [`2dc380e`](https://github.com/hey-api/openapi-ts/commit/2dc380eabc17c723654beb04ecd7bce6d33d3b49) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update keywords in package.json 74 - 75 - - [#1649](https://github.com/hey-api/openapi-ts/pull/1649) [`603541e`](https://github.com/hey-api/openapi-ts/commit/603541e307dc2953da7dddd300176865629b50bb) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: handle BigInt in JSON body serializer 76 - 77 - - [#1646](https://github.com/hey-api/openapi-ts/pull/1646) [`2cbffeb`](https://github.com/hey-api/openapi-ts/commit/2cbffeb2cdd6c6143cd68cac68369584879dda31) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: remove client from Options interface 78 - 79 - - [#1646](https://github.com/hey-api/openapi-ts/pull/1646) [`2cbffeb`](https://github.com/hey-api/openapi-ts/commit/2cbffeb2cdd6c6143cd68cac68369584879dda31) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export TDataShape interface 80 - 81 - ## 0.5.2 82 - 83 - ### Patch Changes 84 - 85 - - [#1626](https://github.com/hey-api/openapi-ts/pull/1626) [`8eba19d`](https://github.com/hey-api/openapi-ts/commit/8eba19d4092fc0903572ab9fdadf0b4c26928ba2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export CreateClientConfig type 86 - 87 - ## 0.5.1 88 - 89 - ### Patch Changes 90 - 91 - - [#1600](https://github.com/hey-api/openapi-ts/pull/1600) [`0432418`](https://github.com/hey-api/openapi-ts/commit/0432418d72c94ef94865f8216ed2f723ad5191f9) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: bundle clients from compiled index file 92 - 93 - - [#1596](https://github.com/hey-api/openapi-ts/pull/1596) [`4784727`](https://github.com/hey-api/openapi-ts/commit/47847276e8bc854045044dd414382080270dd779) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: add null to valid bodySerializer types 94 - 95 - ## 0.5.0 96 - 97 - ### Minor Changes 98 - 99 - - [#1568](https://github.com/hey-api/openapi-ts/pull/1568) [`465410c`](https://github.com/hey-api/openapi-ts/commit/465410c201eb19e737e3143ad53a146e95f80107) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: change the default parser 100 - 101 - ## 0.4.0 102 - 103 - ### Minor Changes 104 - 105 - - **BREAKING**: rename exported Security interface to Auth 106 - 107 - - **BREAKING**: remove support for passing auth to Axios instance 108 - 109 - - **BREAKING**: please update `@hey-api/openapi-ts` to the latest version 110 - 111 - feat: replace accessToken and apiKey functions with auth 112 - 113 - ### Added `auth` option 114 - 115 - Client package functions `accessToken` and `apiKey` were replaced with a single `auth` function for fetching auth tokens. If your API supports multiple auth mechanisms, you can use the `auth` argument to return the appropriate token. 116 - 117 - ```js 118 - import { client } from 'client/sdk.gen'; 119 - 120 - client.setConfig({ 121 - accessToken: () => '<my_token>', // [!code --] 122 - apiKey: () => '<my_token>', // [!code --] 123 - auth: (auth) => '<my_token>', // [!code ++] 124 - }); 125 - ``` 126 - 127 - Due to conflict with the Axios native `auth` option, we removed support for configuring Axios auth. Please let us know if you require this feature added back. 128 - 129 - ## 0.3.4 130 - 131 - ### Patch Changes 132 - 133 - - [#1468](https://github.com/hey-api/openapi-ts/pull/1468) [`20d7497`](https://github.com/hey-api/openapi-ts/commit/20d7497acb6c046f6a4206c2d8137414e17b2263) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: handle indexed access checks 134 - 135 - - [#1471](https://github.com/hey-api/openapi-ts/pull/1471) [`f86d293`](https://github.com/hey-api/openapi-ts/commit/f86d293f18f133ef6dd2f4864d037611b81edd26) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: add links to the experimental parser callouts 136 - 137 - - [#1470](https://github.com/hey-api/openapi-ts/pull/1470) [`458ef50`](https://github.com/hey-api/openapi-ts/commit/458ef500a18127a618dd1e14e14e20014027e77d) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: handle special Axios keywords when merging headers 138 - 139 - ## 0.3.3 140 - 141 - ### Patch Changes 142 - 143 - - [#1452](https://github.com/hey-api/openapi-ts/pull/1452) [`ba56424`](https://github.com/hey-api/openapi-ts/commit/ba5642486cdd5461c2372c34b63019c02bc6874e) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export Security interface 144 - 145 - ## 0.3.2 146 - 147 - ### Patch Changes 148 - 149 - - [#1430](https://github.com/hey-api/openapi-ts/pull/1430) [`9cec9e8`](https://github.com/hey-api/openapi-ts/commit/9cec9e8582c12a8c041b922d9587e16f6f19782a) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: add responseValidator option 150 - 151 - ## 0.3.1 152 - 153 - ### Patch Changes 154 - 155 - - [#1424](https://github.com/hey-api/openapi-ts/pull/1424) [`cbf4e84`](https://github.com/hey-api/openapi-ts/commit/cbf4e84db7f3a47f19d8c3eaa87c71b27912c1a2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: assign axios to variable before sending requests 156 - 157 - ## 0.3.0 158 - 159 - ### Minor Changes 160 - 161 - - [#1420](https://github.com/hey-api/openapi-ts/pull/1420) [`8010dbb`](https://github.com/hey-api/openapi-ts/commit/8010dbb1ab8b91d1d49d5cf16276183764a63ff3) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: handle parameter styles the same way fetch client does if paramsSerializer is undefined 162 - 163 - ### Patch Changes 164 - 165 - - [#1420](https://github.com/hey-api/openapi-ts/pull/1420) [`8010dbb`](https://github.com/hey-api/openapi-ts/commit/8010dbb1ab8b91d1d49d5cf16276183764a63ff3) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: add buildUrl method to Axios client API 166 - 167 - - [#1409](https://github.com/hey-api/openapi-ts/pull/1409) [`646064d`](https://github.com/hey-api/openapi-ts/commit/646064d1aecea988d2b4df73bd24b2ee83394ae0) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: support oauth2 and apiKey security schemes 168 - 169 - ## 0.2.12 170 - 171 - ### Patch Changes 172 - 173 - - [#1394](https://github.com/hey-api/openapi-ts/pull/1394) [`ec48d32`](https://github.com/hey-api/openapi-ts/commit/ec48d323d80de8e6a47ce7ecd732288f0a47e17a) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: disallow additional query parameters in experimental parser output 174 - 175 - ## 0.2.11 176 - 177 - ### Patch Changes 178 - 179 - - [#1333](https://github.com/hey-api/openapi-ts/pull/1333) [`734a62d`](https://github.com/hey-api/openapi-ts/commit/734a62dd8d594b8266964fe16766a481d37eb7df) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: experimental parser generates url inside data types 180 - 181 - ## 0.2.10 182 - 183 - ### Patch Changes 184 - 185 - - [#1253](https://github.com/hey-api/openapi-ts/pull/1253) [`01dee3d`](https://github.com/hey-api/openapi-ts/commit/01dee3df879232939e43355231147b3d910fb482) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update sponsorship links 186 - 187 - ## 0.2.9 188 - 189 - ### Patch Changes 190 - 191 - - [#1151](https://github.com/hey-api/openapi-ts/pull/1151) [`587791d`](https://github.com/hey-api/openapi-ts/commit/587791dfede0167fbed229281467e4c4875936f5) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update website domain, add license documentation 192 - 193 - ## 0.2.8 194 - 195 - ### Patch Changes 196 - 197 - - [#1145](https://github.com/hey-api/openapi-ts/pull/1145) [`a0a5551`](https://github.com/hey-api/openapi-ts/commit/a0a55510d30a1a8dea0ade4908b5b13d51b5f9e6) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update license field in package.json to match the license, revert client packages license to MIT 198 - 199 - ## 0.2.7 200 - 201 - ### Patch Changes 202 - 203 - - [#1092](https://github.com/hey-api/openapi-ts/pull/1092) [`7f986c2`](https://github.com/hey-api/openapi-ts/commit/7f986c2c7726ed8fbf16f8b235b7769c7d990502) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export RequestResult type 204 - 205 - ## 0.2.6 206 - 207 - ### Patch Changes 208 - 209 - - [#1083](https://github.com/hey-api/openapi-ts/pull/1083) [`fe743c2`](https://github.com/hey-api/openapi-ts/commit/fe743c2d41c23bf7e1706bceedd6319299131197) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export client-facing types again 210 - 211 - ## 0.2.5 212 - 213 - ### Patch Changes 214 - 215 - - [#1075](https://github.com/hey-api/openapi-ts/pull/1075) [`11a276a`](https://github.com/hey-api/openapi-ts/commit/11a276a1e35dde0735363e892d8142016fd87eec) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: properly handle dual publishing and type generation 216 - 217 - ## 0.2.4 218 - 219 - ### Patch Changes 220 - 221 - - [#1057](https://github.com/hey-api/openapi-ts/pull/1057) [`7ae2b1d`](https://github.com/hey-api/openapi-ts/commit/7ae2b1db047f3b6efe917a8b43ac7c851fb86c8f) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: allow responseTransformer property with body and headers 222 - 223 - - [#1064](https://github.com/hey-api/openapi-ts/pull/1064) [`2079c6e`](https://github.com/hey-api/openapi-ts/commit/2079c6e83a6b71e157c8e7ea56260b4e9ff8411d) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: encode path params 224 - 225 - ## 0.2.3 226 - 227 - ### Patch Changes 228 - 229 - - [#901](https://github.com/hey-api/openapi-ts/pull/901) [`7825a2f`](https://github.com/hey-api/openapi-ts/commit/7825a2fba566a76c63775172ef0569ef375406b6) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export more types to resolve TypeScript errors 230 - 231 - ## 0.2.2 232 - 233 - ### Patch Changes 234 - 235 - - [#895](https://github.com/hey-api/openapi-ts/pull/895) [`44de8d8`](https://github.com/hey-api/openapi-ts/commit/44de8d89556b3abf48acc4e23c9b9c198059c757) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: define ThrowOnError generic as the last argument 236 - 237 - ## 0.2.1 238 - 239 - ### Patch Changes 240 - 241 - - [#864](https://github.com/hey-api/openapi-ts/pull/864) [`ec6bfc8`](https://github.com/hey-api/openapi-ts/commit/ec6bfc8292cce7663dfc6e0fcd89b44c56f08bb4) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: infer response shape based on throwOnError option value 242 - 243 - - [#873](https://github.com/hey-api/openapi-ts/pull/873) [`a73da1c`](https://github.com/hey-api/openapi-ts/commit/a73da1c854503246b6c58f1abea5dd77727eedca) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: export RequestOptionsBase interface 244 - 245 - ## 0.2.0 246 - 247 - ### Minor Changes 248 - 249 - - [#830](https://github.com/hey-api/openapi-ts/pull/830) [`babf11a`](https://github.com/hey-api/openapi-ts/commit/babf11ae082af642ac71cfee9c523cc976132a50) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: remove default client export (see migration docs) 250 - 251 - - [#830](https://github.com/hey-api/openapi-ts/pull/830) [`babf11a`](https://github.com/hey-api/openapi-ts/commit/babf11ae082af642ac71cfee9c523cc976132a50) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: add `setConfig()` method 252 - 253 - ## 0.1.1 254 - 255 - ### Patch Changes 256 - 257 - - [#811](https://github.com/hey-api/openapi-ts/pull/811) [`f8e0b7b`](https://github.com/hey-api/openapi-ts/commit/f8e0b7b7ab5cbd673ca13a21fd1180194558c7f5) Thanks [@chirino](https://github.com/chirino)! - fix: declare axios body to be unknown so that it can be set to anything 258 - 259 - ## 0.1.0 260 - 261 - ### Minor Changes 262 - 263 - - [#613](https://github.com/hey-api/openapi-ts/pull/613) [`b3786dc`](https://github.com/hey-api/openapi-ts/commit/b3786dc6749d8d4ae26bb63322e124663f881741) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: initial release
-21
packages/client-axios/LICENSE.md
··· 1 - MIT License 2 - 3 - Copyright (c) Hey API 4 - 5 - Permission is hereby granted, free of charge, to any person obtaining a copy 6 - of this software and associated documentation files (the "Software"), to deal 7 - in the Software without restriction, including without limitation the rights 8 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 - copies of the Software, and to permit persons to whom the Software is 10 - furnished to do so, subject to the following conditions: 11 - 12 - The above copyright notice and this permission notice shall be included in all 13 - copies or substantial portions of the Software. 14 - 15 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 - SOFTWARE.
-101
packages/client-axios/README.md
··· 1 - <div align="center"> 2 - <img alt="Hey API logo" height="150" src="https://heyapi.dev/images/logo-300w.png" width="150"> 3 - <h1 align="center"><b>Axios Client</b></h1> 4 - <p align="center">🚀 Axios client for `@hey-api/openapi-ts` codegen.</p> 5 - </div> 6 - 7 - [Live demo](https://stackblitz.com/edit/hey-api-client-axios-example?file=openapi-ts.config.ts,src%2Fclient%2Fschemas.gen.ts,src%2Fclient%2Fsdk.gen.ts,src%2Fclient%2Ftypes.gen.ts,src%2FApp.tsx) 8 - 9 - ## Features 10 - 11 - - seamless integration with `@hey-api/openapi-ts` ecosystem 12 - - type-safe response data and errors 13 - - response data validation and transformation 14 - - access to the original request and response 15 - - granular request and response customization options 16 - - minimal learning curve thanks to extending the underlying technology 17 - - support bundling inside the generated output 18 - - [platform](https://heyapi.dev/openapi-ts/integrations) for automating codegen builds 19 - 20 - ## Dashboard 21 - 22 - Hey API is an ecosystem of products helping you build better APIs. Superpower your codegen and APIs with our platform. 23 - 24 - [Sign In](https://app.heyapi.dev) to Hey API platform. 25 - 26 - ## Documentation 27 - 28 - Please visit our [website](https://heyapi.dev) for documentation, guides, migrating, and more. 29 - 30 - ## Sponsors 31 - 32 - Love Hey API? Become our [sponsor](https://github.com/sponsors/hey-api). 33 - 34 - <h3 align="center">Gold</h3> 35 - 36 - <table align="center" style="justify-content: center;align-items: center;display: flex;"> 37 - <tbody> 38 - <tr> 39 - <td align="center"> 40 - <p></p> 41 - <p> 42 - <a href="https://kutt.it/pkEZyc" target="_blank"> 43 - <picture height="50px"> 44 - <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/images/stainless-logo-wordmark-480w.jpeg"> 45 - <img alt="Stainless logo" height="50px" src="https://heyapi.dev/images/stainless-logo-wordmark-480w.jpeg"> 46 - </picture> 47 - </a> 48 - <br/> 49 - Generate best-in-class SDKs. 50 - <br/> 51 - <a href="https://kutt.it/pkEZyc" style="text-decoration:none;" target="_blank"> 52 - stainless.com 53 - </a> 54 - </p> 55 - <p></p> 56 - </td> 57 - </tr> 58 - </tbody> 59 - </table> 60 - 61 - <h3 align="center">Silver</h3> 62 - 63 - <table align="center" style="justify-content: center;align-items: center;display: flex;"> 64 - <tbody> 65 - <tr> 66 - <td align="center"> 67 - <a href="https://kutt.it/skQUVd" target="_blank"> 68 - <picture height="40px"> 69 - <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/images/scalar-logo-wordmark-480w.jpeg"> 70 - <img alt="Scalar logo" height="40px" src="https://heyapi.dev/images/scalar-logo-wordmark-480w.jpeg"> 71 - </picture> 72 - </a> 73 - <br/> 74 - <a href="https://kutt.it/skQUVd" style="text-decoration:none;" target="_blank"> 75 - scalar.com 76 - </a> 77 - </td> 78 - </tr> 79 - </tbody> 80 - </table> 81 - 82 - <h3 align="center">Bronze</h3> 83 - 84 - <table align="center" style="justify-content: center;align-items: center;display: flex;"> 85 - <tbody> 86 - <tr> 87 - <td align="center"> 88 - <a href="https://kutt.it/YpaKsX" target="_blank"> 89 - <picture height="34px"> 90 - <source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/images/kinde-logo-wordmark-dark-480w.webp"> 91 - <img alt="Kinde logo" height="34px" src="https://heyapi.dev/images/kinde-logo-wordmark-480w.jpeg"> 92 - </picture> 93 - </a> 94 - </td> 95 - </tr> 96 - </tbody> 97 - </table> 98 - 99 - ## Migration Guides 100 - 101 - [OpenAPI Typescript Codegen](https://heyapi.dev/openapi-ts/migrating#openapi-typescript-codegen)
-78
packages/client-axios/package.json
··· 1 - { 2 - "name": "@hey-api/client-axios", 3 - "version": "0.9.1", 4 - "description": "🚀 Axios client for `@hey-api/openapi-ts` codegen.", 5 - "homepage": "https://heyapi.dev/", 6 - "repository": { 7 - "type": "git", 8 - "url": "git+https://github.com/hey-api/openapi-ts.git" 9 - }, 10 - "bugs": { 11 - "url": "https://github.com/hey-api/openapi-ts/issues" 12 - }, 13 - "license": "MIT", 14 - "author": { 15 - "email": "lubos@heyapi.dev", 16 - "name": "Hey API", 17 - "url": "https://heyapi.dev" 18 - }, 19 - "funding": "https://github.com/sponsors/hey-api", 20 - "keywords": [ 21 - "axios", 22 - "client", 23 - "codegen", 24 - "http", 25 - "javascript", 26 - "openapi", 27 - "react", 28 - "rest", 29 - "svelte", 30 - "swagger", 31 - "typescript", 32 - "vue" 33 - ], 34 - "type": "module", 35 - "main": "./dist/index.cjs", 36 - "module": "./dist/index.js", 37 - "types": "./dist/index.d.ts", 38 - "exports": { 39 - ".": { 40 - "import": { 41 - "types": "./dist/index.d.ts", 42 - "default": "./dist/index.js" 43 - }, 44 - "require": { 45 - "types": "./dist/index.d.cts", 46 - "default": "./dist/index.cjs" 47 - } 48 - }, 49 - "./package.json": "./package.json" 50 - }, 51 - "sideEffects": false, 52 - "files": [ 53 - "dist", 54 - "LICENSE.md", 55 - "src" 56 - ], 57 - "scripts": { 58 - "build": "tsup && rollup -c && pnpm check-exports", 59 - "check-exports": "attw --pack .", 60 - "dev": "tsup --watch", 61 - "prepublishOnly": "pnpm build", 62 - "test:coverage": "vitest run --coverage", 63 - "test:update": "vitest watch --update", 64 - "test:watch": "vitest watch", 65 - "test": "vitest run", 66 - "typecheck": "vitest --typecheck --watch=false" 67 - }, 68 - "peerDependencies": { 69 - "@hey-api/openapi-ts": "< 2", 70 - "axios": ">= 1.0.0 < 2" 71 - }, 72 - "devDependencies": { 73 - "@config/vite-base": "workspace:*", 74 - "@hey-api/client-core": "workspace:*", 75 - "@hey-api/openapi-ts": "workspace:*", 76 - "axios": "1.8.2" 77 - } 78 - }
-30
packages/client-axios/rollup.config.mjs
··· 1 - import path from 'node:path'; 2 - 3 - import { defineConfig } from 'rollup'; 4 - import dts from 'rollup-plugin-dts'; 5 - 6 - const files = ['index.d.ts', 'index.d.cts']; 7 - 8 - export default files.map((file) => 9 - defineConfig({ 10 - external: (id) => { 11 - const normalizedId = id.split(path.sep).join('/'); 12 - if (normalizedId === '@hey-api/client-core') { 13 - return false; 14 - } 15 - return ( 16 - !normalizedId.startsWith('/') && !/^[a-zA-Z]:\//.test(normalizedId) 17 - ); 18 - }, 19 - input: `./dist/${file}`, 20 - output: { 21 - file: `./dist/${file}`, 22 - format: 'es', 23 - }, 24 - plugins: [ 25 - dts({ 26 - respectExternal: true, 27 - }), 28 - ], 29 - }), 30 - );
packages/client-axios/src/__tests__/client.test.ts packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/client.test.ts
packages/client-axios/src/__tests__/utils.test.ts packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/utils.test.ts
packages/client-axios/src/client.ts packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts
-20
packages/client-axios/src/index.ts
··· 1 - export { createClient } from './client'; 2 - export type { 3 - Client, 4 - ClientOptions, 5 - Config, 6 - CreateClientConfig, 7 - Options, 8 - OptionsLegacyParser, 9 - RequestOptions, 10 - RequestResult, 11 - TDataShape, 12 - } from './types'; 13 - export { createConfig } from './utils'; 14 - export type { Auth, QuerySerializerOptions } from '@hey-api/client-core'; 15 - export { 16 - buildClientParams, 17 - formDataBodySerializer, 18 - jsonBodySerializer, 19 - urlSearchParamsBodySerializer, 20 - } from '@hey-api/client-core';
+6 -5
packages/client-axios/src/types.ts packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/types.ts
··· 1 - import type { 2 - Auth, 3 - Client as CoreClient, 4 - Config as CoreConfig, 5 - } from '@hey-api/client-core'; 6 1 import type { 7 2 AxiosError, 8 3 AxiosInstance, ··· 10 5 AxiosStatic, 11 6 CreateAxiosDefaults, 12 7 } from 'axios'; 8 + 9 + import type { Auth } from '../../client-core/bundle/auth'; 10 + import type { 11 + Client as CoreClient, 12 + Config as CoreConfig, 13 + } from '../../client-core/bundle/types'; 13 14 14 15 export interface Config<T extends ClientOptions = ClientOptions> 15 16 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>,
+4 -5
packages/client-axios/src/utils.ts packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/utils.ts
··· 1 + import { getAuthToken } from '../../client-core/bundle/auth'; 1 2 import type { 2 - ArraySeparatorStyle, 3 3 QuerySerializer, 4 4 QuerySerializerOptions, 5 - } from '@hey-api/client-core'; 5 + } from '../../client-core/bundle/bodySerializer'; 6 + import type { ArraySeparatorStyle } from '../../client-core/bundle/pathSerializer'; 6 7 import { 7 - getAuthToken, 8 8 serializeArrayParam, 9 9 serializeObjectParam, 10 10 serializePrimitiveParam, 11 - } from '@hey-api/client-core'; 12 - 11 + } from '../../client-core/bundle/pathSerializer'; 13 12 import type { Client, ClientOptions, Config, RequestOptions } from './types'; 14 13 15 14 interface PathSerializer {
-14
packages/client-axios/tsconfig.base.json
··· 1 - { 2 - "compilerOptions": { 3 - "declaration": true, 4 - "esModuleInterop": true, 5 - "module": "ESNext", 6 - "moduleResolution": "Bundler", 7 - "noImplicitOverride": true, 8 - "noUncheckedIndexedAccess": true, 9 - "noUnusedLocals": true, 10 - "strict": true, 11 - "target": "ES2022", 12 - "useUnknownInCatchVariables": false 13 - } 14 - }
-7
packages/client-axios/tsconfig.json
··· 1 - { 2 - "extends": "./tsconfig.base.json", 3 - "compilerOptions": { 4 - "declaration": false, 5 - "esModuleInterop": true 6 - } 7 - }
-12
packages/client-axios/tsup.config.ts
··· 1 - import { defineConfig } from 'tsup'; 2 - 3 - export default defineConfig((options) => ({ 4 - clean: true, 5 - dts: true, 6 - entry: ['src/index.ts'], 7 - format: ['cjs', 'esm'], 8 - minify: !options.watch, 9 - shims: false, 10 - sourcemap: true, 11 - treeshake: true, 12 - }));
-10
packages/client-axios/vitest.config.ts
··· 1 - import { fileURLToPath } from 'node:url'; 2 - 3 - import { createVitestConfig } from '@config/vite-base'; 4 - 5 - export default createVitestConfig( 6 - fileURLToPath(new URL('./', import.meta.url)), 7 - { 8 - // Add specific configuration here if needed 9 - }, 10 - );
-38
packages/client-core/CHANGELOG.md
··· 1 - # @hey-api/client-core 2 - 3 - ## 0.2.1 4 - 5 - ### Patch Changes 6 - 7 - - [#2165](https://github.com/hey-api/openapi-ts/pull/2165) [`f23f3ae`](https://github.com/hey-api/openapi-ts/commit/f23f3ae874385e758eb8d43bb4e274c9858a4e40) Thanks [@mrlubos](https://github.com/mrlubos)! - fix(client): do not serialize path param name in url 8 - 9 - ## 0.2.0 10 - 11 - ### Minor Changes 12 - 13 - - [#2148](https://github.com/hey-api/openapi-ts/pull/2148) [`10d2e03`](https://github.com/hey-api/openapi-ts/commit/10d2e03b8295e4e887fab8d023aa823699efbae8) Thanks [@mrlubos](https://github.com/mrlubos)! - feat: export `buildClientParams` function 14 - 15 - ## 0.1.4 16 - 17 - ### Patch Changes 18 - 19 - - [#1850](https://github.com/hey-api/openapi-ts/pull/1850) [`fe43b88`](https://github.com/hey-api/openapi-ts/commit/fe43b889c20a2001f56e259f93f64851a1caa1d1) Thanks [@kelnos](https://github.com/kelnos)! - feat: add support for cookies auth 20 - 21 - ## 0.1.3 22 - 23 - ### Patch Changes 24 - 25 - - [#1674](https://github.com/hey-api/openapi-ts/pull/1674) [`7f0f4a7`](https://github.com/hey-api/openapi-ts/commit/7f0f4a76b06c8fafb33581b522faf8efc6fd85ac) Thanks [@ale18V](https://github.com/ale18V)! - Return a string from urlSearchParamsBodySerializer instead of a URLSearchParams object. 26 - This is due to some runtimes not being able to handle the URLSearchParams object as fetch body. 27 - 28 - ## 0.1.2 29 - 30 - ### Patch Changes 31 - 32 - - [#1151](https://github.com/hey-api/openapi-ts/pull/1151) [`587791d`](https://github.com/hey-api/openapi-ts/commit/587791dfede0167fbed229281467e4c4875936f5) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: update website domain, add license documentation 33 - 34 - ## 0.1.1 35 - 36 - ### Patch Changes 37 - 38 - - [#823](https://github.com/hey-api/openapi-ts/pull/823) [`23c9dcd`](https://github.com/hey-api/openapi-ts/commit/23c9dcd5de19de62d745cc539674c815b2588cd2) Thanks [@mrlubos](https://github.com/mrlubos)! - fix: correctly process body parameter for OpenAPI 2.0 specs
-21
packages/client-core/LICENSE.md
··· 1 - MIT License 2 - 3 - Copyright (c) Hey API 4 - 5 - Permission is hereby granted, free of charge, to any person obtaining a copy 6 - of this software and associated documentation files (the "Software"), to deal 7 - in the Software without restriction, including without limitation the rights 8 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 - copies of the Software, and to permit persons to whom the Software is 10 - furnished to do so, subject to the following conditions: 11 - 12 - The above copyright notice and this permission notice shall be included in all 13 - copies or substantial portions of the Software. 14 - 15 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 - SOFTWARE.
-57
packages/client-core/package.json
··· 1 - { 2 - "name": "@hey-api/client-core", 3 - "version": "0.2.1", 4 - "private": true, 5 - "description": "Core utilities for type-safe @hey-api/openapi-ts clients", 6 - "homepage": "https://heyapi.dev/", 7 - "repository": { 8 - "type": "git", 9 - "url": "git+https://github.com/hey-api/openapi-ts.git" 10 - }, 11 - "bugs": { 12 - "url": "https://github.com/hey-api/openapi-ts/issues" 13 - }, 14 - "license": "MIT", 15 - "author": { 16 - "email": "lubos@heyapi.dev", 17 - "name": "Hey API", 18 - "url": "https://heyapi.dev" 19 - }, 20 - "type": "module", 21 - "main": "./dist/index.cjs", 22 - "module": "./dist/index.js", 23 - "types": "./dist/index.d.ts", 24 - "exports": { 25 - ".": { 26 - "import": { 27 - "types": "./dist/index.d.ts", 28 - "default": "./dist/index.js" 29 - }, 30 - "require": { 31 - "types": "./dist/index.d.cts", 32 - "default": "./dist/index.cjs" 33 - } 34 - }, 35 - "./package.json": "./package.json" 36 - }, 37 - "sideEffects": false, 38 - "files": [ 39 - "dist", 40 - "LICENSE.md", 41 - "src" 42 - ], 43 - "scripts": { 44 - "build": "tsup && pnpm check-exports", 45 - "check-exports": "attw --pack .", 46 - "dev": "tsup --watch", 47 - "prepublishOnly": "pnpm build", 48 - "test:coverage": "vitest run --coverage", 49 - "test:update": "vitest watch --update", 50 - "test:watch": "vitest watch", 51 - "test": "vitest run", 52 - "typecheck": "vitest --typecheck --watch=false" 53 - }, 54 - "devDependencies": { 55 - "@config/vite-base": "workspace:*" 56 - } 57 - }
+1 -1
packages/client-core/src/__tests__/auth.test.ts packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/auth.test.ts
··· 1 1 import { describe, expect, it, vi } from 'vitest'; 2 2 3 - import { getAuthToken } from '../auth'; 3 + import { getAuthToken } from '../bundle/auth'; 4 4 5 5 describe('getAuthToken', () => { 6 6 it('returns bearer token', async () => {
+2 -2
packages/client-core/src/__tests__/params.test.ts packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/params.test.ts
··· 1 1 import { describe, expect, it } from 'vitest'; 2 2 3 - import type { FieldsConfig } from '../params'; 4 - import { buildClientParams } from '../params'; 3 + import type { FieldsConfig } from '../bundle/params'; 4 + import { buildClientParams } from '../bundle/params'; 5 5 6 6 describe('buildClientParams', () => { 7 7 const scenarios: ReadonlyArray<{
-14
packages/client-core/tsconfig.base.json
··· 1 - { 2 - "compilerOptions": { 3 - "declaration": true, 4 - "esModuleInterop": true, 5 - "module": "ESNext", 6 - "moduleResolution": "Bundler", 7 - "noImplicitOverride": true, 8 - "noUncheckedIndexedAccess": true, 9 - "noUnusedLocals": true, 10 - "strict": true, 11 - "target": "ES2022", 12 - "useUnknownInCatchVariables": false 13 - } 14 - }
-7
packages/client-core/tsconfig.json
··· 1 - { 2 - "extends": "./tsconfig.base.json", 3 - "compilerOptions": { 4 - "declaration": false, 5 - "esModuleInterop": true 6 - } 7 - }
-12
packages/client-core/tsup.config.ts
··· 1 - import { defineConfig } from 'tsup'; 2 - 3 - export default defineConfig((options) => ({ 4 - clean: true, 5 - dts: true, 6 - entry: ['src/index.ts'], 7 - format: ['cjs', 'esm'], 8 - minify: !options.watch, 9 - shims: false, 10 - sourcemap: true, 11 - treeshake: true, 12 - }));
-10
packages/client-core/vitest.config.ts
··· 1 - import { fileURLToPath } from 'node:url'; 2 - 3 - import { createVitestConfig } from '@config/vite-base'; 4 - 5 - export default createVitestConfig( 6 - fileURLToPath(new URL('./', import.meta.url)), 7 - { 8 - // Add specific configuration here if needed 9 - }, 10 - );
+1 -1
packages/openapi-ts-tests/test/openapi-ts.config.ts
··· 97 97 { 98 98 // baseUrl: false, 99 99 // exportFromIndex: true, 100 - // name: '@hey-api/client-fetch', 100 + name: '@hey-api/client-axios', 101 101 // name: 'legacy/fetch', 102 102 // strictBaseUrl: true, 103 103 },
-15
packages/openapi-ts/src/generate/client.ts
··· 61 61 }, 62 62 } satisfies Record<string, ImportExportItemObject>; 63 63 64 - const replaceCoreImports = (filePath: string) => { 65 - let content = fs.readFileSync(filePath, 'utf8'); 66 - // Replace '../../client-core/bundle' with '../core' 67 - content = content.replace( 68 - /from ['"]\.\.\/\.\.\/client-core\/bundle/g, 69 - "from '../core", 70 - ); 71 - fs.writeFileSync(filePath, content, 'utf8'); 72 - }; 73 - 74 64 /** 75 65 * Creates a `client` folder containing the same modules as the client package. 76 66 */ ··· 99 89 clientDistFolderName, 100 90 ); 101 91 fs.cpSync(clientDistPath, clientOutputPath, { recursive: true }); 102 - // replace core imports in client bundle 103 - const clientFiles = fs.readdirSync(clientOutputPath); 104 - for (const file of clientFiles) { 105 - replaceCoreImports(path.resolve(clientOutputPath, file)); 106 - } 107 92 return; 108 93 } 109 94
+21
packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/index.ts
··· 1 + export type { Auth } from '../../client-core/bundle/auth'; 2 + export type { QuerySerializerOptions } from '../../client-core/bundle/bodySerializer'; 3 + export { 4 + formDataBodySerializer, 5 + jsonBodySerializer, 6 + urlSearchParamsBodySerializer, 7 + } from '../../client-core/bundle/bodySerializer'; 8 + export { buildClientParams } from '../../client-core/bundle/params'; 9 + export { createClient } from './client'; 10 + export type { 11 + Client, 12 + ClientOptions, 13 + Config, 14 + CreateClientConfig, 15 + Options, 16 + OptionsLegacyParser, 17 + RequestOptions, 18 + RequestResult, 19 + TDataShape, 20 + } from './types'; 21 + export { createConfig } from './utils';
+1 -1
packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts
··· 1 1 import { describe, expect, it } from 'vitest'; 2 2 3 - import { createClient } from '../client/client'; 3 + import { createClient } from '../bundle/client'; 4 4 5 5 describe('buildUrl', () => { 6 6 const client = createClient();
+2 -2
packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/utils.test.ts
··· 1 1 import type { Auth } from '@hey-api/client-core'; 2 2 import { describe, expect, it, vi } from 'vitest'; 3 3 4 - import type { Client } from '../client/types'; 5 - import { buildUrl, getParseAs, setAuthParams } from '../client/utils'; 4 + import type { Client } from '../bundle/types'; 5 + import { buildUrl, getParseAs, setAuthParams } from '../bundle/utils'; 6 6 7 7 describe('buildUrl', () => { 8 8 const scenarios: Array<{
+17 -1
packages/openapi-ts/tsup.config.ts
··· 3 3 4 4 import { defineConfig } from 'tsup'; 5 5 6 + const replaceCoreImports = (filePath: string) => { 7 + let content = fs.readFileSync(filePath, 'utf8'); 8 + // Replace '../../client-core/bundle' with '../core' 9 + content = content.replace( 10 + /from ['"]\.\.\/\.\.\/client-core\/bundle/g, 11 + "from '../core", 12 + ); 13 + fs.writeFileSync(filePath, content, 'utf8'); 14 + }; 15 + 6 16 export default defineConfig((options) => ({ 7 17 banner(ctx) { 8 18 /** ··· 23 33 onSuccess: async () => { 24 34 // Copy client files to dist folder for runtime access 25 35 const pluginNames = [ 26 - // 'client-axios', 36 + 'client-axios', 27 37 'client-core', 28 38 'client-fetch', 29 39 // 'client-next', ··· 47 57 if (fs.existsSync(srcPath)) { 48 58 fs.mkdirSync(path.dirname(destPath), { recursive: true }); 49 59 fs.cpSync(srcPath, destPath, { recursive: true }); 60 + 61 + // replace core imports in client bundle 62 + const clientFiles = fs.readdirSync(destPath); 63 + for (const file of clientFiles) { 64 + replaceCoreImports(path.resolve(destPath, file)); 65 + } 50 66 } 51 67 } 52 68 },