@gradio/client 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +4 -2
  3. package/dist/__vite-browser-external-Cgmn0awE.js +7 -0
  4. package/dist/browser.js +1672 -1902
  5. package/dist/client.d.ts +5 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/constants.d.ts +4 -0
  8. package/dist/constants.d.ts.map +1 -1
  9. package/dist/helpers/api_info.d.ts.map +1 -1
  10. package/dist/helpers/data.d.ts.map +1 -1
  11. package/dist/helpers/init_helpers.d.ts +12 -3
  12. package/dist/helpers/init_helpers.d.ts.map +1 -1
  13. package/dist/index.cjs +2274 -0
  14. package/dist/index.js +2155 -2449
  15. package/dist/index.min.js +1735 -0
  16. package/dist/types.d.ts +16 -0
  17. package/dist/types.d.ts.map +1 -1
  18. package/dist/utils/duplicate.d.ts.map +1 -1
  19. package/dist/utils/predict.d.ts.map +1 -1
  20. package/dist/utils/stream.d.ts.map +1 -1
  21. package/dist/utils/submit.d.ts.map +1 -1
  22. package/dist/utils/view_api.d.ts.map +1 -1
  23. package/package.json +11 -4
  24. package/scripts/verify_dist.mjs +46 -0
  25. package/src/client.ts +46 -7
  26. package/src/constants.ts +10 -0
  27. package/src/helpers/api_info.ts +47 -19
  28. package/src/helpers/data.ts +8 -3
  29. package/src/helpers/init_helpers.ts +61 -14
  30. package/src/test/api_info.test.ts +105 -12
  31. package/src/test/data.test.ts +26 -3
  32. package/src/test/init.test.ts +21 -3
  33. package/src/test/init_helpers.test.ts +94 -1
  34. package/src/test/post_data.test.ts +21 -0
  35. package/src/test/refresh.test.ts +31 -0
  36. package/src/test/submit.test.ts +14 -0
  37. package/src/types.ts +16 -0
  38. package/src/utils/duplicate.ts +5 -1
  39. package/src/utils/post_data.ts +1 -1
  40. package/src/utils/predict.ts +34 -19
  41. package/src/utils/stream.ts +17 -4
  42. package/src/utils/submit.ts +43 -10
  43. package/src/utils/upload_files.ts +1 -1
  44. package/src/utils/view_api.ts +2 -3
  45. package/vite.config.ts +20 -4
  46. package/dist/__vite-browser-external-DYxpcVy9.js +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @gradio/client
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Features
6
+
7
+ - [#13601](https://github.com/gradio-app/gradio/pull/13601) [`0ee5cc8`](https://github.com/gradio-app/gradio/commit/0ee5cc80e2915e5a1b074c892490a62f165cd80d) - Preserve browser-visible proxy origins for frontend assets and API requests, and retain app-level FastAPI root paths. Thanks @abidlabs!
8
+ - [#13657](https://github.com/gradio-app/gradio/pull/13657) [`a10b1d7`](https://github.com/gradio-app/gradio/commit/a10b1d75d5599929682b93e1296149192c0a0a58) - Fix private Space connections and error handling in the JS client: accept the deprecated `hf_token` option as an alias for `token`, raise clear errors when a Space is private or missing, tolerate malformed `/info` payloads instead of crashing with "Cannot read properties of undefined (reading 'map')", and make `predict()` reject with real `Error` objects instead of plain status objects that surface as unhandled promise rejections. Thanks @abidlabs!
9
+ - [#13620](https://github.com/gradio-app/gradio/pull/13620) [`5200235`](https://github.com/gradio-app/gradio/commit/520023532b66d6fa327da04701da3e02c554fa6e) - Fix chained events after cancellation and while the browser tab is hidden. Thanks @abidlabs!
10
+ - [#13667](https://github.com/gradio-app/gradio/pull/13667) [`2d753d0`](https://github.com/gradio-app/gradio/commit/2d753d0e86bf53e97b0094c2dce0726a265cbe3e) - oauth: let API callers supply a token for endpoints that take a `gr.OAuthToken`, via `oauth_token` on the Python and JS clients — sent only to endpoints that declare they need one. Thanks @abidlabs!
11
+
12
+ ### Fixes
13
+
14
+ - [#13656](https://github.com/gradio-app/gradio/pull/13656) [`7205856`](https://github.com/gradio-app/gradio/commit/72058560a660d4dc97e8a9948bee5e972ad80afa) - Preserve original filenames and MIME types when uploading `File`/`Blob` objects via the JS client, and use `handle_file` in the auto-generated JavaScript API snippets. Thanks @abidlabs!
15
+ - [#13655](https://github.com/gradio-app/gradio/pull/13655) [`e29c824`](https://github.com/gradio-app/gradio/commit/e29c824fd8f56a91a25846d88698750c628544bf) - Ship a real browser bundle for the documented CDN path (`dist/index.min.js`) and a CommonJS entry (`dist/index.cjs` via the `require` exports condition) for `@gradio/client`. Thanks @abidlabs!
16
+ - [#13627](https://github.com/gradio-app/gradio/pull/13627) [`3b12faa`](https://github.com/gradio-app/gradio/commit/3b12faa404660cd68ff4b3f20fbf6af3f3906670) - Keep in-flight events and generators working when an app is hot-reloaded (`gradio app.py`). Thanks @abidlabs!
17
+
18
+ ## 2.3.1
19
+
20
+ ### Fixes
21
+
22
+ - [#13588](https://github.com/gradio-app/gradio/pull/13588) [`2e80558`](https://github.com/gradio-app/gradio/commit/2e805588c8dc84a4a584898fd43b267c72209f78) - Fire `state.change()` for streaming (`.stream()`) events. Thanks @hysts!
23
+ - [#13581](https://github.com/gradio-app/gradio/pull/13581) [`461d82d`](https://github.com/gradio-app/gradio/commit/461d82df2689ec0c53e84b8722eaeae58fd2a6ae) - Use same-origin credentials in the JS client so cross-origin embeds work again. Thanks @hysts!
24
+ - [#13579](https://github.com/gradio-app/gradio/pull/13579) [`3d26f41`](https://github.com/gradio-app/gradio/commit/3d26f41c4a3bfa31ea01c4ae0d082a9fc9ed0bc7) - Make `Client.predict()` reject its returned promise on unknown endpoints so the error is catchable. Thanks @abidlabs!
25
+
3
26
  ## 2.3.0
4
27
 
5
28
  ### Features
package/README.md CHANGED
@@ -13,8 +13,10 @@ npm i @gradio/client
13
13
 
14
14
  Or, you can include it directly in your HTML via the jsDelivr CDN:
15
15
 
16
- ```shell
17
- <script src="https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js"></script>
16
+ ```html
17
+ <script type="module">
18
+ import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client/dist/index.min.js";
19
+ </script>
18
20
  ```
19
21
 
20
22
  ## Usage
@@ -0,0 +1,7 @@
1
+ import { t as e } from "./browser.js";
2
+ //#region __vite-browser-external
3
+ var t = /* @__PURE__ */ e(((e, t) => {
4
+ t.exports = {};
5
+ }));
6
+ //#endregion
7
+ export default t();