@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/README.md
CHANGED
|
@@ -1165,13 +1165,6 @@ client.config({dataset: 'newDataset'})
|
|
|
1165
1165
|
|
|
1166
1166
|
Set client configuration. Required options are `projectId` and `dataset`.
|
|
1167
1167
|
|
|
1168
|
-
## Release new version
|
|
1169
|
-
|
|
1170
|
-
Run ["CI & Release" workflow](https://github.com/sanity-io/client/actions/workflows/ci.yml).
|
|
1171
|
-
Make sure to select the main branch and check "Release new version".
|
|
1172
|
-
|
|
1173
|
-
Semantic release will only release on configured branches, so it is safe to run release on any branch.
|
|
1174
|
-
|
|
1175
1168
|
## License
|
|
1176
1169
|
|
|
1177
1170
|
MIT © [Sanity.io](https://www.sanity.io/)
|
package/dist/index.browser.cjs
CHANGED
|
@@ -8,26 +8,12 @@ var middleware = require('get-it/middleware');
|
|
|
8
8
|
var rxjs = require('rxjs');
|
|
9
9
|
var operators = require('rxjs/operators');
|
|
10
10
|
var envMiddleware = [];
|
|
11
|
-
var __defProp$3 = Object.defineProperty;
|
|
12
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
configurable: true,
|
|
15
|
-
writable: true,
|
|
16
|
-
value
|
|
17
|
-
}) : obj[key] = value;
|
|
18
|
-
var __publicField$3 = (obj, key, value) => {
|
|
19
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
20
|
-
return value;
|
|
21
|
-
};
|
|
22
11
|
const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
|
|
23
12
|
class ClientError extends Error {
|
|
24
13
|
constructor(res) {
|
|
25
14
|
const props = extractErrorProps(res);
|
|
26
15
|
super(props.message);
|
|
27
|
-
|
|
28
|
-
__publicField$3(this, "statusCode", 400);
|
|
29
|
-
__publicField$3(this, "responseBody");
|
|
30
|
-
__publicField$3(this, "details");
|
|
16
|
+
this.statusCode = 400;
|
|
31
17
|
Object.assign(this, props);
|
|
32
18
|
}
|
|
33
19
|
}
|
|
@@ -35,10 +21,7 @@ class ServerError extends Error {
|
|
|
35
21
|
constructor(res) {
|
|
36
22
|
const props = extractErrorProps(res);
|
|
37
23
|
super(props.message);
|
|
38
|
-
|
|
39
|
-
__publicField$3(this, "statusCode", 500);
|
|
40
|
-
__publicField$3(this, "responseBody");
|
|
41
|
-
__publicField$3(this, "details");
|
|
24
|
+
this.statusCode = 500;
|
|
42
25
|
Object.assign(this, props);
|
|
43
26
|
}
|
|
44
27
|
}
|
|
@@ -373,17 +356,6 @@ const encodeQueryString = _ref2 => {
|
|
|
373
356
|
}
|
|
374
357
|
return "?".concat(searchParams);
|
|
375
358
|
};
|
|
376
|
-
var __defProp$2 = Object.defineProperty;
|
|
377
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
378
|
-
enumerable: true,
|
|
379
|
-
configurable: true,
|
|
380
|
-
writable: true,
|
|
381
|
-
value
|
|
382
|
-
}) : obj[key] = value;
|
|
383
|
-
var __publicField$2 = (obj, key, value) => {
|
|
384
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
385
|
-
return value;
|
|
386
|
-
};
|
|
387
359
|
var __accessCheck$6 = (obj, member, msg) => {
|
|
388
360
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
389
361
|
};
|
|
@@ -404,8 +376,6 @@ var _client$5, _client2$5;
|
|
|
404
376
|
class BasePatch {
|
|
405
377
|
constructor(selection) {
|
|
406
378
|
let operations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
407
|
-
__publicField$2(this, "selection");
|
|
408
|
-
__publicField$2(this, "operations");
|
|
409
379
|
this.selection = selection;
|
|
410
380
|
this.operations = operations;
|
|
411
381
|
}
|
|
@@ -619,17 +589,6 @@ const _Patch = class _Patch extends BasePatch {
|
|
|
619
589
|
};
|
|
620
590
|
_client2$5 = new WeakMap();
|
|
621
591
|
let Patch = _Patch;
|
|
622
|
-
var __defProp$1 = Object.defineProperty;
|
|
623
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
624
|
-
enumerable: true,
|
|
625
|
-
configurable: true,
|
|
626
|
-
writable: true,
|
|
627
|
-
value
|
|
628
|
-
}) : obj[key] = value;
|
|
629
|
-
var __publicField$1 = (obj, key, value) => {
|
|
630
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
631
|
-
return value;
|
|
632
|
-
};
|
|
633
592
|
var __accessCheck$5 = (obj, member, msg) => {
|
|
634
593
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
635
594
|
};
|
|
@@ -654,8 +613,6 @@ class BaseTransaction {
|
|
|
654
613
|
constructor() {
|
|
655
614
|
let operations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
656
615
|
let transactionId = arguments.length > 1 ? arguments[1] : undefined;
|
|
657
|
-
__publicField$1(this, "operations");
|
|
658
|
-
__publicField$1(this, "trxId");
|
|
659
616
|
this.operations = operations;
|
|
660
617
|
this.trxId = transactionId;
|
|
661
618
|
}
|
|
@@ -1008,7 +965,7 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1008
965
|
const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
|
|
1009
966
|
let useCdn = config.useCdn && canUseCdn;
|
|
1010
967
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
1011
|
-
if (tag) {
|
|
968
|
+
if (tag && options.tag !== null) {
|
|
1012
969
|
options.query = {
|
|
1013
970
|
tag: requestTag(tag),
|
|
1014
971
|
...options.query
|
|
@@ -1395,7 +1352,8 @@ class ObservableDatasetsClient {
|
|
|
1395
1352
|
*/
|
|
1396
1353
|
list() {
|
|
1397
1354
|
return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
|
|
1398
|
-
uri: "/datasets"
|
|
1355
|
+
uri: "/datasets",
|
|
1356
|
+
tag: null
|
|
1399
1357
|
});
|
|
1400
1358
|
}
|
|
1401
1359
|
}
|
|
@@ -1439,7 +1397,8 @@ class DatasetsClient {
|
|
|
1439
1397
|
*/
|
|
1440
1398
|
list() {
|
|
1441
1399
|
return rxjs.lastValueFrom(_request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), {
|
|
1442
|
-
uri: "/datasets"
|
|
1400
|
+
uri: "/datasets",
|
|
1401
|
+
tag: null
|
|
1443
1402
|
}));
|
|
1444
1403
|
}
|
|
1445
1404
|
}
|
|
@@ -1450,7 +1409,8 @@ function _modify(client, httpRequest, method, name, options) {
|
|
|
1450
1409
|
return _request(client, httpRequest, {
|
|
1451
1410
|
method,
|
|
1452
1411
|
uri: "/datasets/".concat(name),
|
|
1453
|
-
body: options
|
|
1412
|
+
body: options,
|
|
1413
|
+
tag: null
|
|
1454
1414
|
});
|
|
1455
1415
|
}
|
|
1456
1416
|
var __accessCheck$2 = (obj, member, msg) => {
|
|
@@ -1579,17 +1539,6 @@ class UsersClient {
|
|
|
1579
1539
|
}
|
|
1580
1540
|
_client2 = new WeakMap();
|
|
1581
1541
|
_httpRequest2$1 = new WeakMap();
|
|
1582
|
-
var __defProp = Object.defineProperty;
|
|
1583
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
1584
|
-
enumerable: true,
|
|
1585
|
-
configurable: true,
|
|
1586
|
-
writable: true,
|
|
1587
|
-
value
|
|
1588
|
-
}) : obj[key] = value;
|
|
1589
|
-
var __publicField = (obj, key, value) => {
|
|
1590
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1591
|
-
return value;
|
|
1592
|
-
};
|
|
1593
1542
|
var __accessCheck = (obj, member, msg) => {
|
|
1594
1543
|
if (!member.has(obj)) throw TypeError("Cannot " + msg);
|
|
1595
1544
|
};
|
|
@@ -1610,10 +1559,6 @@ var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
|
|
|
1610
1559
|
const _ObservableSanityClient = class _ObservableSanityClient {
|
|
1611
1560
|
constructor(httpRequest) {
|
|
1612
1561
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1613
|
-
__publicField(this, "assets");
|
|
1614
|
-
__publicField(this, "datasets");
|
|
1615
|
-
__publicField(this, "projects");
|
|
1616
|
-
__publicField(this, "users");
|
|
1617
1562
|
/**
|
|
1618
1563
|
* Private properties
|
|
1619
1564
|
*/
|
|
@@ -1622,7 +1567,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
|
|
|
1622
1567
|
/**
|
|
1623
1568
|
* Instance properties
|
|
1624
1569
|
*/
|
|
1625
|
-
|
|
1570
|
+
this.listen = _listen;
|
|
1626
1571
|
this.config(config);
|
|
1627
1572
|
__privateSet(this, _httpRequest, httpRequest);
|
|
1628
1573
|
this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
|
|
@@ -1750,14 +1695,6 @@ let ObservableSanityClient = _ObservableSanityClient;
|
|
|
1750
1695
|
const _SanityClient = class _SanityClient {
|
|
1751
1696
|
constructor(httpRequest) {
|
|
1752
1697
|
let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
|
|
1753
|
-
__publicField(this, "assets");
|
|
1754
|
-
__publicField(this, "datasets");
|
|
1755
|
-
__publicField(this, "projects");
|
|
1756
|
-
__publicField(this, "users");
|
|
1757
|
-
/**
|
|
1758
|
-
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
|
1759
|
-
*/
|
|
1760
|
-
__publicField(this, "observable");
|
|
1761
1698
|
/**
|
|
1762
1699
|
* Private properties
|
|
1763
1700
|
*/
|
|
@@ -1766,7 +1703,7 @@ const _SanityClient = class _SanityClient {
|
|
|
1766
1703
|
/**
|
|
1767
1704
|
* Instance properties
|
|
1768
1705
|
*/
|
|
1769
|
-
|
|
1706
|
+
this.listen = _listen;
|
|
1770
1707
|
this.config(config);
|
|
1771
1708
|
__privateSet(this, _httpRequest2, httpRequest);
|
|
1772
1709
|
this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
|