@sanity/client 6.4.12 → 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/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 +16 -16
- 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.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var getIt = require('get-it');
|
|
|
8
8
|
var rxjs = require('rxjs');
|
|
9
9
|
var operators = require('rxjs/operators');
|
|
10
10
|
var name = "@sanity/client";
|
|
11
|
-
var version = "6.
|
|
11
|
+
var version = "6.5.0";
|
|
12
12
|
const middleware = [middleware$1.debug({
|
|
13
13
|
verbose: true,
|
|
14
14
|
namespace: "sanity:client"
|
|
@@ -28,26 +28,12 @@ middleware$1.agent({
|
|
|
28
28
|
maxSockets: 30,
|
|
29
29
|
maxTotalSockets: 256
|
|
30
30
|
})];
|
|
31
|
-
var __defProp$3 = Object.defineProperty;
|
|
32
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value
|
|
37
|
-
}) : obj[key] = value;
|
|
38
|
-
var __publicField$3 = (obj, key, value) => {
|
|
39
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
|
-
return value;
|
|
41
|
-
};
|
|
42
31
|
const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
|
|
43
32
|
class ClientError extends Error {
|
|
44
33
|
constructor(res) {
|
|
45
34
|
const props = extractErrorProps(res);
|
|
46
35
|
super(props.message);
|
|
47
|
-
|
|
48
|
-
__publicField$3(this, "statusCode", 400);
|
|
49
|
-
__publicField$3(this, "responseBody");
|
|
50
|
-
__publicField$3(this, "details");
|
|
36
|
+
this.statusCode = 400;
|
|
51
37
|
Object.assign(this, props);
|
|
52
38
|
}
|
|
53
39
|
}
|
|
@@ -55,10 +41,7 @@ class ServerError extends Error {
|
|
|
55
41
|
constructor(res) {
|
|
56
42
|
const props = extractErrorProps(res);
|
|
57
43
|
super(props.message);
|
|
58
|
-
|
|
59
|
-
__publicField$3(this, "statusCode", 500);
|
|
60
|
-
__publicField$3(this, "responseBody");
|
|
61
|
-
__publicField$3(this, "details");
|
|
44
|
+
this.statusCode = 500;
|
|
62
45
|
Object.assign(this, props);
|
|
63
46
|
}
|
|
64
47
|
}
|
|
@@ -393,17 +376,6 @@ const encodeQueryString = _ref2 => {
|
|
|
393
376
|
}
|
|
394
377
|
return "?".concat(searchParams);
|
|
395
378
|
};
|
|
396
|
-
var __defProp$2 = Object.defineProperty;
|
|
397
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
398
|
-
enumerable: true,
|
|
399
|
-
configurable: true,
|
|
400
|
-
writable: true,
|
|
401
|
-
value
|
|
402
|
-
}) : obj[key] = value;
|
|
403
|
-
var __publicField$2 = (obj, key, value) => {
|
|
404
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
405
|
-
return value;
|
|
406
|
-
};
|
|
407
379
|
var __accessCheck$6 = (obj, member, msg) => {
|
|
408
380
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
409
381
|
};
|
|
@@ -424,8 +396,6 @@ var _client$5, _client2$5;
|
|
|
424
396
|
class BasePatch {
|
|
425
397
|
constructor(selection) {
|
|
426
398
|
let operations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
427
|
-
__publicField$2(this, "selection");
|
|
428
|
-
__publicField$2(this, "operations");
|
|
429
399
|
this.selection = selection;
|
|
430
400
|
this.operations = operations;
|
|
431
401
|
}
|
|
@@ -639,17 +609,6 @@ const _Patch = class _Patch extends BasePatch {
|
|
|
639
609
|
};
|
|
640
610
|
_client2$5 = new WeakMap();
|
|
641
611
|
let Patch = _Patch;
|
|
642
|
-
var __defProp$1 = Object.defineProperty;
|
|
643
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
644
|
-
enumerable: true,
|
|
645
|
-
configurable: true,
|
|
646
|
-
writable: true,
|
|
647
|
-
value
|
|
648
|
-
}) : obj[key] = value;
|
|
649
|
-
var __publicField$1 = (obj, key, value) => {
|
|
650
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
651
|
-
return value;
|
|
652
|
-
};
|
|
653
612
|
var __accessCheck$5 = (obj, member, msg) => {
|
|
654
613
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
655
614
|
};
|
|
@@ -674,8 +633,6 @@ class BaseTransaction {
|
|
|
674
633
|
constructor() {
|
|
675
634
|
let operations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
676
635
|
let transactionId = arguments.length > 1 ? arguments[1] : undefined;
|
|
677
|
-
__publicField$1(this, "operations");
|
|
678
|
-
__publicField$1(this, "trxId");
|
|
679
636
|
this.operations = operations;
|
|
680
637
|
this.trxId = transactionId;
|
|
681
638
|
}
|
|
@@ -1028,7 +985,7 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1028
985
|
const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
|
|
1029
986
|
let useCdn = config.useCdn && canUseCdn;
|
|
1030
987
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
1031
|
-
if (tag) {
|
|
988
|
+
if (tag && options.tag !== null) {
|
|
1032
989
|
options.query = {
|
|
1033
990
|
tag: requestTag(tag),
|
|
1034
991
|
...options.query
|
|
@@ -1415,7 +1372,8 @@ class ObservableDatasetsClient {
|
|
|
1415
1372
|
*/
|
|
1416
1373
|
list() {
|
|
1417
1374
|
return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
|
|
1418
|
-
uri: "/datasets"
|
|
1375
|
+
uri: "/datasets",
|
|
1376
|
+
tag: null
|
|
1419
1377
|
});
|
|
1420
1378
|
}
|
|
1421
1379
|
}
|
|
@@ -1459,7 +1417,8 @@ class DatasetsClient {
|
|
|
1459
1417
|
*/
|
|
1460
1418
|
list() {
|
|
1461
1419
|
return rxjs.lastValueFrom(_request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), {
|
|
1462
|
-
uri: "/datasets"
|
|
1420
|
+
uri: "/datasets",
|
|
1421
|
+
tag: null
|
|
1463
1422
|
}));
|
|
1464
1423
|
}
|
|
1465
1424
|
}
|
|
@@ -1470,7 +1429,8 @@ function _modify(client, httpRequest, method, name, options) {
|
|
|
1470
1429
|
return _request(client, httpRequest, {
|
|
1471
1430
|
method,
|
|
1472
1431
|
uri: "/datasets/".concat(name),
|
|
1473
|
-
body: options
|
|
1432
|
+
body: options,
|
|
1433
|
+
tag: null
|
|
1474
1434
|
});
|
|
1475
1435
|
}
|
|
1476
1436
|
var __accessCheck$2 = (obj, member, msg) => {
|
|
@@ -1599,17 +1559,6 @@ class UsersClient {
|
|
|
1599
1559
|
}
|
|
1600
1560
|
_client2 = new WeakMap();
|
|
1601
1561
|
_httpRequest2$1 = new WeakMap();
|
|
1602
|
-
var __defProp = Object.defineProperty;
|
|
1603
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
1604
|
-
enumerable: true,
|
|
1605
|
-
configurable: true,
|
|
1606
|
-
writable: true,
|
|
1607
|
-
value
|
|
1608
|
-
}) : obj[key] = value;
|
|
1609
|
-
var __publicField = (obj, key, value) => {
|
|
1610
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1611
|
-
return value;
|
|
1612
|
-
};
|
|
1613
1562
|
var __accessCheck = (obj, member, msg) => {
|
|
1614
1563
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
1615
1564
|
};
|
|
@@ -1630,10 +1579,6 @@ var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
|
|
|
1630
1579
|
const _ObservableSanityClient = class _ObservableSanityClient {
|
|
1631
1580
|
constructor(httpRequest) {
|
|
1632
1581
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1633
|
-
__publicField(this, "assets");
|
|
1634
|
-
__publicField(this, "datasets");
|
|
1635
|
-
__publicField(this, "projects");
|
|
1636
|
-
__publicField(this, "users");
|
|
1637
1582
|
/**
|
|
1638
1583
|
* Private properties
|
|
1639
1584
|
*/
|
|
@@ -1642,7 +1587,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
|
|
|
1642
1587
|
/**
|
|
1643
1588
|
* Instance properties
|
|
1644
1589
|
*/
|
|
1645
|
-
|
|
1590
|
+
this.listen = _listen;
|
|
1646
1591
|
this.config(config);
|
|
1647
1592
|
__privateSet(this, _httpRequest, httpRequest);
|
|
1648
1593
|
this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
|
|
@@ -1770,14 +1715,6 @@ let ObservableSanityClient = _ObservableSanityClient;
|
|
|
1770
1715
|
const _SanityClient = class _SanityClient {
|
|
1771
1716
|
constructor(httpRequest) {
|
|
1772
1717
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1773
|
-
__publicField(this, "assets");
|
|
1774
|
-
__publicField(this, "datasets");
|
|
1775
|
-
__publicField(this, "projects");
|
|
1776
|
-
__publicField(this, "users");
|
|
1777
|
-
/**
|
|
1778
|
-
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1779
|
-
*/
|
|
1780
|
-
__publicField(this, "observable");
|
|
1781
1718
|
/**
|
|
1782
1719
|
* Private properties
|
|
1783
1720
|
*/
|
|
@@ -1786,7 +1723,7 @@ const _SanityClient = class _SanityClient {
|
|
|
1786
1723
|
/**
|
|
1787
1724
|
* Instance properties
|
|
1788
1725
|
*/
|
|
1789
|
-
|
|
1726
|
+
this.listen = _listen;
|
|
1790
1727
|
this.config(config);
|
|
1791
1728
|
__privateSet(this, _httpRequest2, httpRequest);
|
|
1792
1729
|
this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
|