@sanity/client 3.3.0 → 3.4.0-beta.esm.1

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 (39) hide show
  1. package/README.md +3 -5
  2. package/dist/sanityClient.browser.mjs +4317 -0
  3. package/dist/sanityClient.browser.mjs.map +7 -0
  4. package/dist/sanityClient.node.js +1129 -0
  5. package/dist/sanityClient.node.js.map +7 -0
  6. package/package.json +26 -6
  7. package/sanityClient.d.ts +3 -2
  8. package/src/assets/assetsClient.js +135 -0
  9. package/src/auth/authClient.js +17 -0
  10. package/src/config.js +96 -0
  11. package/src/data/dataMethods.js +183 -0
  12. package/src/data/encodeQueryString.js +18 -0
  13. package/src/data/listen.js +160 -0
  14. package/src/data/patch.js +124 -0
  15. package/src/data/transaction.js +106 -0
  16. package/src/datasets/datasetsClient.js +31 -0
  17. package/src/http/browserMiddleware.js +1 -0
  18. package/src/http/errors.js +57 -0
  19. package/src/http/nodeMiddleware.js +13 -0
  20. package/src/http/queryString.js +10 -0
  21. package/src/http/request.js +54 -0
  22. package/src/http/requestOptions.js +31 -0
  23. package/src/projects/projectsClient.js +17 -0
  24. package/src/sanityClient.js +119 -0
  25. package/src/users/usersClient.js +13 -0
  26. package/src/util/defaults.js +8 -0
  27. package/src/util/getSelection.js +17 -0
  28. package/src/util/observable.js +11 -0
  29. package/src/util/once.js +12 -0
  30. package/src/util/pick.js +9 -0
  31. package/src/validators.js +76 -0
  32. package/src/warnings.js +25 -0
  33. package/test/client.test.js +0 -2561
  34. package/test/encodeQueryString.test.js +0 -36
  35. package/test/fixtures/horsehead-nebula.jpg +0 -0
  36. package/test/fixtures/pdf-sample.pdf +0 -0
  37. package/test/helpers/sseServer.js +0 -26
  38. package/test/listen.test.js +0 -205
  39. package/test/warnings.test.disabled.js +0 -80
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@sanity/client.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/client)
4
4
 
5
- Javascript client for Sanity. Works in node.js and modern browsers (older browsers needs a [Promise polyfill](https://www.sanity.io/help/js-client-promise-polyfill)).
5
+ Javascript client for Sanity. Works in node.js and modern browsers (older browsers need a [Promise polyfill](https://www.sanity.io/help/js-client-promise-polyfill)).
6
6
 
7
7
  ## Requirements
8
8
 
@@ -260,13 +260,11 @@ client
260
260
  The operations of appending and prepending to an array are so common that they have been given their own methods for better readability:
261
261
 
262
262
  ```js
263
- const {nanoid} = require('nanoid')
264
-
265
263
  client
266
264
  .patch('bike-123')
267
265
  .setIfMissing({reviews: []})
268
- .append('reviews', [{_key: nanoid(), title: 'Great bike!', stars: 5}])
269
- .commit()
266
+ .append('reviews', [{title: 'Great bike!', stars: 5}])
267
+ .commit({autoGenerateArrayKeys: true})
270
268
  ```
271
269
 
272
270
  ### Deleting an element from an array