@sanity/client 6.2.0-fetch.6 → 6.3.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.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.2.0-fetch.6";
11
+ var version = "6.3.0";
12
12
  const middleware = [middleware$1.debug({
13
13
  verbose: true,
14
14
  namespace: "sanity:client"
@@ -215,26 +215,26 @@ const validateObject = (op, val) => {
215
215
  };
216
216
  const validateDocumentId = (op, id) => {
217
217
  if (typeof id !== "string" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(id) || id.includes("..")) {
218
- throw new Error("".concat(op, "(): \"").concat(id, "\" is not a valid document ID"));
218
+ throw new Error("".concat(op, '(): "').concat(id, '" is not a valid document ID'));
219
219
  }
220
220
  };
221
221
  const requireDocumentId = (op, doc) => {
222
222
  if (!doc._id) {
223
- throw new Error("".concat(op, "() requires that the document contains an ID (\"_id\" property)"));
223
+ throw new Error("".concat(op, '() requires that the document contains an ID ("_id" property)'));
224
224
  }
225
225
  validateDocumentId(op, doc._id);
226
226
  };
227
227
  const validateInsert = (at, selector, items) => {
228
228
  const signature = "insert(at, selector, items)";
229
229
  if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) {
230
- const valid = VALID_INSERT_LOCATIONS.map(loc => "\"".concat(loc, "\"")).join(", ");
231
- throw new Error("".concat(signature, " takes an \"at\"-argument which is one of: ").concat(valid));
230
+ const valid = VALID_INSERT_LOCATIONS.map(loc => '"'.concat(loc, '"')).join(", ");
231
+ throw new Error("".concat(signature, ' takes an "at"-argument which is one of: ').concat(valid));
232
232
  }
233
233
  if (typeof selector !== "string") {
234
- throw new Error("".concat(signature, " takes a \"selector\"-argument which must be a string"));
234
+ throw new Error("".concat(signature, ' takes a "selector"-argument which must be a string'));
235
235
  }
236
236
  if (!Array.isArray(items)) {
237
- throw new Error("".concat(signature, " takes an \"items\"-argument which must be an array"));
237
+ throw new Error("".concat(signature, ' takes an "items"-argument which must be an array'));
238
238
  }
239
239
  };
240
240
  const hasDataset = config => {
@@ -919,9 +919,7 @@ function _requestObservable(client, httpRequest, options) {
919
919
  const reqOptions = requestOptions(config, Object.assign({}, options, {
920
920
  url: _getUrl(client, uri, useCdn)
921
921
  }));
922
- const request = new rxjs.Observable(subscriber =>
923
- // 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
924
- httpRequest(reqOptions, config.requester).subscribe(subscriber));
922
+ const request = new rxjs.Observable(subscriber => httpRequest(reqOptions, config.requester).subscribe(subscriber));
925
923
  return options.signal ? request.pipe(_withAbortSignal(options.signal)) : request;
926
924
  }
927
925
  function _request(client, httpRequest, options) {
@@ -1470,12 +1468,10 @@ class ObservableProjectsClient {
1470
1468
  __privateSet$2(this, _client$1, client);
1471
1469
  __privateSet$2(this, _httpRequest$2, httpRequest);
1472
1470
  }
1473
- /**
1474
- * Fetch a list of projects the authenticated user has access to
1475
- */
1476
- list() {
1471
+ list(options) {
1472
+ const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1477
1473
  return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), {
1478
- uri: "/projects"
1474
+ uri
1479
1475
  });
1480
1476
  }
1481
1477
  /**
@@ -1498,12 +1494,10 @@ class ProjectsClient {
1498
1494
  __privateSet$2(this, _client2$1, client);
1499
1495
  __privateSet$2(this, _httpRequest2$2, httpRequest);
1500
1496
  }
1501
- /**
1502
- * Fetch a list of projects the authenticated user has access to
1503
- */
1504
- list() {
1497
+ list(options) {
1498
+ const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1505
1499
  return rxjs.lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), {
1506
- uri: "/projects"
1500
+ uri
1507
1501
  }));
1508
1502
  }
1509
1503
  /**