@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.
- package/README.md +3 -5
- package/dist/sanityClient.browser.mjs +4317 -0
- package/dist/sanityClient.browser.mjs.map +7 -0
- package/dist/sanityClient.node.js +1129 -0
- package/dist/sanityClient.node.js.map +7 -0
- package/package.json +26 -6
- package/sanityClient.d.ts +3 -2
- package/src/assets/assetsClient.js +135 -0
- package/src/auth/authClient.js +17 -0
- package/src/config.js +96 -0
- package/src/data/dataMethods.js +183 -0
- package/src/data/encodeQueryString.js +18 -0
- package/src/data/listen.js +160 -0
- package/src/data/patch.js +124 -0
- package/src/data/transaction.js +106 -0
- package/src/datasets/datasetsClient.js +31 -0
- package/src/http/browserMiddleware.js +1 -0
- package/src/http/errors.js +57 -0
- package/src/http/nodeMiddleware.js +13 -0
- package/src/http/queryString.js +10 -0
- package/src/http/request.js +54 -0
- package/src/http/requestOptions.js +31 -0
- package/src/projects/projectsClient.js +17 -0
- package/src/sanityClient.js +119 -0
- package/src/users/usersClient.js +13 -0
- package/src/util/defaults.js +8 -0
- package/src/util/getSelection.js +17 -0
- package/src/util/observable.js +11 -0
- package/src/util/once.js +12 -0
- package/src/util/pick.js +9 -0
- package/src/validators.js +76 -0
- package/src/warnings.js +25 -0
- package/test/client.test.js +0 -2561
- package/test/encodeQueryString.test.js +0 -36
- package/test/fixtures/horsehead-nebula.jpg +0 -0
- package/test/fixtures/pdf-sample.pdf +0 -0
- package/test/helpers/sseServer.js +0 -26
- package/test/listen.test.js +0 -205
- package/test/warnings.test.disabled.js +0 -80
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@sanity/client)
|
|
4
4
|
|
|
5
|
-
Javascript client for Sanity. Works in node.js and modern browsers (older browsers
|
|
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', [{
|
|
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
|