@sanity/client 6.4.11 → 6.5.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.
- package/README.md +0 -7
- package/dist/index.browser.cjs +11 -74
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +11 -74
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +12 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -75
- package/dist/index.js.map +1 -1
- package/package.json +17 -22
- package/src/data/dataMethods.ts +1 -1
- package/src/datasets/DatasetsClient.ts +11 -3
- package/umd/sanityClient.js +35 -98
- package/umd/sanityClient.min.js +3 -3
package/dist/index.browser.js
CHANGED
|
@@ -4,26 +4,12 @@ import { retry, jsonRequest, jsonResponse, progress, observable } from 'get-it/m
|
|
|
4
4
|
import { Observable, lastValueFrom } from 'rxjs';
|
|
5
5
|
import { map, filter } from 'rxjs/operators';
|
|
6
6
|
var envMiddleware = [];
|
|
7
|
-
var __defProp$3 = Object.defineProperty;
|
|
8
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
configurable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
value
|
|
13
|
-
}) : obj[key] = value;
|
|
14
|
-
var __publicField$3 = (obj, key, value) => {
|
|
15
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
16
|
-
return value;
|
|
17
|
-
};
|
|
18
7
|
const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
|
|
19
8
|
class ClientError extends Error {
|
|
20
9
|
constructor(res) {
|
|
21
10
|
const props = extractErrorProps(res);
|
|
22
11
|
super(props.message);
|
|
23
|
-
|
|
24
|
-
__publicField$3(this, "statusCode", 400);
|
|
25
|
-
__publicField$3(this, "responseBody");
|
|
26
|
-
__publicField$3(this, "details");
|
|
12
|
+
this.statusCode = 400;
|
|
27
13
|
Object.assign(this, props);
|
|
28
14
|
}
|
|
29
15
|
}
|
|
@@ -31,10 +17,7 @@ class ServerError extends Error {
|
|
|
31
17
|
constructor(res) {
|
|
32
18
|
const props = extractErrorProps(res);
|
|
33
19
|
super(props.message);
|
|
34
|
-
|
|
35
|
-
__publicField$3(this, "statusCode", 500);
|
|
36
|
-
__publicField$3(this, "responseBody");
|
|
37
|
-
__publicField$3(this, "details");
|
|
20
|
+
this.statusCode = 500;
|
|
38
21
|
Object.assign(this, props);
|
|
39
22
|
}
|
|
40
23
|
}
|
|
@@ -369,17 +352,6 @@ const encodeQueryString = _ref2 => {
|
|
|
369
352
|
}
|
|
370
353
|
return "?".concat(searchParams);
|
|
371
354
|
};
|
|
372
|
-
var __defProp$2 = Object.defineProperty;
|
|
373
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
374
|
-
enumerable: true,
|
|
375
|
-
configurable: true,
|
|
376
|
-
writable: true,
|
|
377
|
-
value
|
|
378
|
-
}) : obj[key] = value;
|
|
379
|
-
var __publicField$2 = (obj, key, value) => {
|
|
380
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
381
|
-
return value;
|
|
382
|
-
};
|
|
383
355
|
var __accessCheck$6 = (obj, member, msg) => {
|
|
384
356
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
385
357
|
};
|
|
@@ -400,8 +372,6 @@ var _client$5, _client2$5;
|
|
|
400
372
|
class BasePatch {
|
|
401
373
|
constructor(selection) {
|
|
402
374
|
let operations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
403
|
-
__publicField$2(this, "selection");
|
|
404
|
-
__publicField$2(this, "operations");
|
|
405
375
|
this.selection = selection;
|
|
406
376
|
this.operations = operations;
|
|
407
377
|
}
|
|
@@ -615,17 +585,6 @@ const _Patch = class _Patch extends BasePatch {
|
|
|
615
585
|
};
|
|
616
586
|
_client2$5 = new WeakMap();
|
|
617
587
|
let Patch = _Patch;
|
|
618
|
-
var __defProp$1 = Object.defineProperty;
|
|
619
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
620
|
-
enumerable: true,
|
|
621
|
-
configurable: true,
|
|
622
|
-
writable: true,
|
|
623
|
-
value
|
|
624
|
-
}) : obj[key] = value;
|
|
625
|
-
var __publicField$1 = (obj, key, value) => {
|
|
626
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
627
|
-
return value;
|
|
628
|
-
};
|
|
629
588
|
var __accessCheck$5 = (obj, member, msg) => {
|
|
630
589
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
631
590
|
};
|
|
@@ -650,8 +609,6 @@ class BaseTransaction {
|
|
|
650
609
|
constructor() {
|
|
651
610
|
let operations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
652
611
|
let transactionId = arguments.length > 1 ? arguments[1] : undefined;
|
|
653
|
-
__publicField$1(this, "operations");
|
|
654
|
-
__publicField$1(this, "trxId");
|
|
655
612
|
this.operations = operations;
|
|
656
613
|
this.trxId = transactionId;
|
|
657
614
|
}
|
|
@@ -1004,7 +961,7 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1004
961
|
const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
|
|
1005
962
|
let useCdn = config.useCdn && canUseCdn;
|
|
1006
963
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
1007
|
-
if (tag) {
|
|
964
|
+
if (tag && options.tag !== null) {
|
|
1008
965
|
options.query = {
|
|
1009
966
|
tag: requestTag(tag),
|
|
1010
967
|
...options.query
|
|
@@ -1391,7 +1348,8 @@ class ObservableDatasetsClient {
|
|
|
1391
1348
|
*/
|
|
1392
1349
|
list() {
|
|
1393
1350
|
return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
|
|
1394
|
-
uri: "/datasets"
|
|
1351
|
+
uri: "/datasets",
|
|
1352
|
+
tag: null
|
|
1395
1353
|
});
|
|
1396
1354
|
}
|
|
1397
1355
|
}
|
|
@@ -1435,7 +1393,8 @@ class DatasetsClient {
|
|
|
1435
1393
|
*/
|
|
1436
1394
|
list() {
|
|
1437
1395
|
return lastValueFrom(_request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), {
|
|
1438
|
-
uri: "/datasets"
|
|
1396
|
+
uri: "/datasets",
|
|
1397
|
+
tag: null
|
|
1439
1398
|
}));
|
|
1440
1399
|
}
|
|
1441
1400
|
}
|
|
@@ -1446,7 +1405,8 @@ function _modify(client, httpRequest, method, name, options) {
|
|
|
1446
1405
|
return _request(client, httpRequest, {
|
|
1447
1406
|
method,
|
|
1448
1407
|
uri: "/datasets/".concat(name),
|
|
1449
|
-
body: options
|
|
1408
|
+
body: options,
|
|
1409
|
+
tag: null
|
|
1450
1410
|
});
|
|
1451
1411
|
}
|
|
1452
1412
|
var __accessCheck$2 = (obj, member, msg) => {
|
|
@@ -1575,17 +1535,6 @@ class UsersClient {
|
|
|
1575
1535
|
}
|
|
1576
1536
|
_client2 = new WeakMap();
|
|
1577
1537
|
_httpRequest2$1 = new WeakMap();
|
|
1578
|
-
var __defProp = Object.defineProperty;
|
|
1579
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
1580
|
-
enumerable: true,
|
|
1581
|
-
configurable: true,
|
|
1582
|
-
writable: true,
|
|
1583
|
-
value
|
|
1584
|
-
}) : obj[key] = value;
|
|
1585
|
-
var __publicField = (obj, key, value) => {
|
|
1586
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1587
|
-
return value;
|
|
1588
|
-
};
|
|
1589
1538
|
var __accessCheck = (obj, member, msg) => {
|
|
1590
1539
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
1591
1540
|
};
|
|
@@ -1606,10 +1555,6 @@ var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
|
|
|
1606
1555
|
const _ObservableSanityClient = class _ObservableSanityClient {
|
|
1607
1556
|
constructor(httpRequest) {
|
|
1608
1557
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1609
|
-
__publicField(this, "assets");
|
|
1610
|
-
__publicField(this, "datasets");
|
|
1611
|
-
__publicField(this, "projects");
|
|
1612
|
-
__publicField(this, "users");
|
|
1613
1558
|
/**
|
|
1614
1559
|
* Private properties
|
|
1615
1560
|
*/
|
|
@@ -1618,7 +1563,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
|
|
|
1618
1563
|
/**
|
|
1619
1564
|
* Instance properties
|
|
1620
1565
|
*/
|
|
1621
|
-
|
|
1566
|
+
this.listen = _listen;
|
|
1622
1567
|
this.config(config);
|
|
1623
1568
|
__privateSet(this, _httpRequest, httpRequest);
|
|
1624
1569
|
this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
|
|
@@ -1746,14 +1691,6 @@ let ObservableSanityClient = _ObservableSanityClient;
|
|
|
1746
1691
|
const _SanityClient = class _SanityClient {
|
|
1747
1692
|
constructor(httpRequest) {
|
|
1748
1693
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1749
|
-
__publicField(this, "assets");
|
|
1750
|
-
__publicField(this, "datasets");
|
|
1751
|
-
__publicField(this, "projects");
|
|
1752
|
-
__publicField(this, "users");
|
|
1753
|
-
/**
|
|
1754
|
-
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1755
|
-
*/
|
|
1756
|
-
__publicField(this, "observable");
|
|
1757
1694
|
/**
|
|
1758
1695
|
* Private properties
|
|
1759
1696
|
*/
|
|
@@ -1762,7 +1699,7 @@ const _SanityClient = class _SanityClient {
|
|
|
1762
1699
|
/**
|
|
1763
1700
|
* Instance properties
|
|
1764
1701
|
*/
|
|
1765
|
-
|
|
1702
|
+
this.listen = _listen;
|
|
1766
1703
|
this.config(config);
|
|
1767
1704
|
__privateSet(this, _httpRequest2, httpRequest);
|
|
1768
1705
|
this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
|