@sanity/client 5.0.0-esm.7 → 5.0.0-esm.9
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 +110 -57
- package/dist/index.browser.cjs +6 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +6 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +127 -121
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/SanityClient.ts +84 -83
- package/src/assets/AssetsClient.ts +4 -3
- package/src/config.ts +1 -0
- package/src/data/dataMethods.ts +28 -26
- package/src/data/encodeQueryString.ts +4 -4
- package/src/data/listen.ts +9 -9
- package/src/data/patch.ts +18 -17
- package/src/data/transaction.ts +15 -12
- package/src/http/errors.ts +7 -7
- package/src/http/request.ts +4 -4
- package/src/http/requestOptions.ts +4 -2
- package/src/types.ts +36 -30
- package/src/util/defaults.ts +4 -2
- package/src/util/once.ts +5 -3
- package/src/util/pick.ts +4 -2
- package/src/validators.ts +4 -4
- package/src/warnings.ts +2 -1
- package/umd/sanityClient.js +4990 -5753
- package/umd/sanityClient.min.js +12 -12
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { BaseError } from 'make-error';
|
|
|
5
5
|
import { map, filter } from 'rxjs/operators';
|
|
6
6
|
import polyfilledEventSource from '@sanity/eventsource';
|
|
7
7
|
var name = "@sanity/client";
|
|
8
|
-
var version = "5.0.0-esm.
|
|
8
|
+
var version = "5.0.0-esm.9";
|
|
9
9
|
const middleware = [debug({
|
|
10
10
|
verbose: true,
|
|
11
11
|
namespace: "sanity:client"
|
|
@@ -339,7 +339,7 @@ class BasePatch {
|
|
|
339
339
|
* @param selector - Attribute or JSONPath expression for array
|
|
340
340
|
* @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
|
|
341
341
|
* @param deleteCount - An integer indicating the number of old array elements to remove.
|
|
342
|
-
* @param items - The elements to add to the array, beginning at the start index. If you don't specify
|
|
342
|
+
* @param items - The elements to add to the array, beginning at the start index. If you don't specify FIXME elements, splice() will only remove elements from the array.
|
|
343
343
|
*/
|
|
344
344
|
splice(selector, start, deleteCount, items) {
|
|
345
345
|
const delAll = typeof deleteCount === "undefined" || deleteCount === -1;
|
|
@@ -805,7 +805,9 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
805
805
|
const reqOptions = getRequestOptions(config, Object.assign({}, options, {
|
|
806
806
|
url: _getUrl(client, uri, useCdn)
|
|
807
807
|
}));
|
|
808
|
-
return new Observable(subscriber =>
|
|
808
|
+
return new Observable(subscriber =>
|
|
809
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- the typings thinks it's optional because it's not required to specify it when calling createClient, but it's always defined in practice since SanityClient provides a default
|
|
810
|
+
httpRequest(reqOptions, config.requester).subscribe(subscriber));
|
|
809
811
|
}
|
|
810
812
|
function _request(client, httpRequest, options) {
|
|
811
813
|
const observable = _requestObservable(client, httpRequest, options).pipe(filter(event => event.type === "response"), map(event => event.body));
|
|
@@ -1551,7 +1553,7 @@ const _ObservableSanityClient = class {
|
|
|
1551
1553
|
* Fetch multiple documents in one request.
|
|
1552
1554
|
* Should be used sparingly - performing a query is usually a better option.
|
|
1553
1555
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
1554
|
-
* If a
|
|
1556
|
+
* If a FIXME of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
1555
1557
|
*
|
|
1556
1558
|
* @param ids - Document IDs to fetch
|
|
1557
1559
|
* @param options - Request options
|
|
@@ -1674,7 +1676,7 @@ const _SanityClient = class {
|
|
|
1674
1676
|
* Fetch multiple documents in one request.
|
|
1675
1677
|
* Should be used sparingly - performing a query is usually a better option.
|
|
1676
1678
|
* The order/position of documents is preserved based on the original array of IDs.
|
|
1677
|
-
* If a
|
|
1679
|
+
* If a FIXME of the documents are missing, they will be replaced by a `null` entry in the returned array
|
|
1678
1680
|
*
|
|
1679
1681
|
* @param ids - Document IDs to fetch
|
|
1680
1682
|
* @param options - Request options
|