@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.js CHANGED
@@ -4,7 +4,7 @@ export { adapter as unstable__adapter, environment as unstable__environment } fr
4
4
  import { Observable, lastValueFrom } from 'rxjs';
5
5
  import { map, filter } from 'rxjs/operators';
6
6
  var name = "@sanity/client";
7
- var version = "6.4.12";
7
+ var version = "6.5.0";
8
8
  const middleware = [debug({
9
9
  verbose: true,
10
10
  namespace: "sanity:client"
@@ -24,26 +24,12 @@ agent({
24
24
  maxSockets: 30,
25
25
  maxTotalSockets: 256
26
26
  })];
27
- var __defProp$3 = Object.defineProperty;
28
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
29
- enumerable: true,
30
- configurable: true,
31
- writable: true,
32
- value
33
- }) : obj[key] = value;
34
- var __publicField$3 = (obj, key, value) => {
35
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
36
- return value;
37
- };
38
27
  const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
39
28
  class ClientError extends Error {
40
29
  constructor(res) {
41
30
  const props = extractErrorProps(res);
42
31
  super(props.message);
43
- __publicField$3(this, "response");
44
- __publicField$3(this, "statusCode", 400);
45
- __publicField$3(this, "responseBody");
46
- __publicField$3(this, "details");
32
+ this.statusCode = 400;
47
33
  Object.assign(this, props);
48
34
  }
49
35
  }
@@ -51,10 +37,7 @@ class ServerError extends Error {
51
37
  constructor(res) {
52
38
  const props = extractErrorProps(res);
53
39
  super(props.message);
54
- __publicField$3(this, "response");
55
- __publicField$3(this, "statusCode", 500);
56
- __publicField$3(this, "responseBody");
57
- __publicField$3(this, "details");
40
+ this.statusCode = 500;
58
41
  Object.assign(this, props);
59
42
  }
60
43
  }
@@ -389,17 +372,6 @@ const encodeQueryString = _ref2 => {
389
372
  }
390
373
  return "?".concat(searchParams);
391
374
  };
392
- var __defProp$2 = Object.defineProperty;
393
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
394
- enumerable: true,
395
- configurable: true,
396
- writable: true,
397
- value
398
- }) : obj[key] = value;
399
- var __publicField$2 = (obj, key, value) => {
400
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
401
- return value;
402
- };
403
375
  var __accessCheck$6 = (obj, member, msg) => {
404
376
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
405
377
  };
@@ -420,8 +392,6 @@ var _client$5, _client2$5;
420
392
  class BasePatch {
421
393
  constructor(selection) {
422
394
  let operations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
423
- __publicField$2(this, "selection");
424
- __publicField$2(this, "operations");
425
395
  this.selection = selection;
426
396
  this.operations = operations;
427
397
  }
@@ -635,17 +605,6 @@ const _Patch = class _Patch extends BasePatch {
635
605
  };
636
606
  _client2$5 = new WeakMap();
637
607
  let Patch = _Patch;
638
- var __defProp$1 = Object.defineProperty;
639
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
640
- enumerable: true,
641
- configurable: true,
642
- writable: true,
643
- value
644
- }) : obj[key] = value;
645
- var __publicField$1 = (obj, key, value) => {
646
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
647
- return value;
648
- };
649
608
  var __accessCheck$5 = (obj, member, msg) => {
650
609
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
651
610
  };
@@ -670,8 +629,6 @@ class BaseTransaction {
670
629
  constructor() {
671
630
  let operations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
672
631
  let transactionId = arguments.length > 1 ? arguments[1] : undefined;
673
- __publicField$1(this, "operations");
674
- __publicField$1(this, "trxId");
675
632
  this.operations = operations;
676
633
  this.trxId = transactionId;
677
634
  }
@@ -1024,7 +981,7 @@ function _requestObservable(client, httpRequest, options) {
1024
981
  const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
1025
982
  let useCdn = config.useCdn && canUseCdn;
1026
983
  const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
1027
- if (tag) {
984
+ if (tag && options.tag !== null) {
1028
985
  options.query = {
1029
986
  tag: requestTag(tag),
1030
987
  ...options.query
@@ -1411,7 +1368,8 @@ class ObservableDatasetsClient {
1411
1368
  */
1412
1369
  list() {
1413
1370
  return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
1414
- uri: "/datasets"
1371
+ uri: "/datasets",
1372
+ tag: null
1415
1373
  });
1416
1374
  }
1417
1375
  }
@@ -1455,7 +1413,8 @@ class DatasetsClient {
1455
1413
  */
1456
1414
  list() {
1457
1415
  return lastValueFrom(_request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), {
1458
- uri: "/datasets"
1416
+ uri: "/datasets",
1417
+ tag: null
1459
1418
  }));
1460
1419
  }
1461
1420
  }
@@ -1466,7 +1425,8 @@ function _modify(client, httpRequest, method, name, options) {
1466
1425
  return _request(client, httpRequest, {
1467
1426
  method,
1468
1427
  uri: "/datasets/".concat(name),
1469
- body: options
1428
+ body: options,
1429
+ tag: null
1470
1430
  });
1471
1431
  }
1472
1432
  var __accessCheck$2 = (obj, member, msg) => {
@@ -1595,17 +1555,6 @@ class UsersClient {
1595
1555
  }
1596
1556
  _client2 = new WeakMap();
1597
1557
  _httpRequest2$1 = new WeakMap();
1598
- var __defProp = Object.defineProperty;
1599
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
1600
- enumerable: true,
1601
- configurable: true,
1602
- writable: true,
1603
- value
1604
- }) : obj[key] = value;
1605
- var __publicField = (obj, key, value) => {
1606
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
1607
- return value;
1608
- };
1609
1558
  var __accessCheck = (obj, member, msg) => {
1610
1559
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
1611
1560
  };
@@ -1626,10 +1575,6 @@ var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
1626
1575
  const _ObservableSanityClient = class _ObservableSanityClient {
1627
1576
  constructor(httpRequest) {
1628
1577
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
1629
- __publicField(this, "assets");
1630
- __publicField(this, "datasets");
1631
- __publicField(this, "projects");
1632
- __publicField(this, "users");
1633
1578
  /**
1634
1579
  * Private properties
1635
1580
  */
@@ -1638,7 +1583,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1638
1583
  /**
1639
1584
  * Instance properties
1640
1585
  */
1641
- __publicField(this, "listen", _listen);
1586
+ this.listen = _listen;
1642
1587
  this.config(config);
1643
1588
  __privateSet(this, _httpRequest, httpRequest);
1644
1589
  this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
@@ -1766,14 +1711,6 @@ let ObservableSanityClient = _ObservableSanityClient;
1766
1711
  const _SanityClient = class _SanityClient {
1767
1712
  constructor(httpRequest) {
1768
1713
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConfig;
1769
- __publicField(this, "assets");
1770
- __publicField(this, "datasets");
1771
- __publicField(this, "projects");
1772
- __publicField(this, "users");
1773
- /**
1774
- * Observable version of the Sanity client, with the same configuration as the promise-based one
1775
- */
1776
- __publicField(this, "observable");
1777
1714
  /**
1778
1715
  * Private properties
1779
1716
  */
@@ -1782,7 +1719,7 @@ const _SanityClient = class _SanityClient {
1782
1719
  /**
1783
1720
  * Instance properties
1784
1721
  */
1785
- __publicField(this, "listen", _listen);
1722
+ this.listen = _listen;
1786
1723
  this.config(config);
1787
1724
  __privateSet(this, _httpRequest2, httpRequest);
1788
1725
  this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));