@sanity/client 6.21.1 → 6.21.2

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
@@ -2,19 +2,26 @@ import { getIt } from "get-it";
2
2
  import { adapter, environment } from "get-it";
3
3
  import { retry, jsonRequest, jsonResponse, progress, observable, debug, headers, agent } from "get-it/middleware";
4
4
  import { Observable, from, lastValueFrom } from "rxjs";
5
- import { combineLatestWith, map, filter } from "rxjs/operators";
6
5
  import { stegaClean } from "./_chunks-es/stegaClean.js";
7
- var __defProp$3 = Object.defineProperty, __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$3 = (obj, key, value) => (__defNormalProp$3(obj, typeof key != "symbol" ? key + "" : key, value), value);
6
+ import { combineLatestWith, map, filter } from "rxjs/operators";
8
7
  class ClientError extends Error {
8
+ response;
9
+ statusCode = 400;
10
+ responseBody;
11
+ details;
9
12
  constructor(res) {
10
13
  const props = extractErrorProps(res);
11
- super(props.message), __publicField$3(this, "response"), __publicField$3(this, "statusCode", 400), __publicField$3(this, "responseBody"), __publicField$3(this, "details"), Object.assign(this, props);
14
+ super(props.message), Object.assign(this, props);
12
15
  }
13
16
  }
14
17
  class ServerError extends Error {
18
+ response;
19
+ statusCode = 500;
20
+ responseBody;
21
+ details;
15
22
  constructor(res) {
16
23
  const props = extractErrorProps(res);
17
- super(props.message), __publicField$3(this, "response"), __publicField$3(this, "statusCode", 500), __publicField$3(this, "responseBody"), __publicField$3(this, "details"), Object.assign(this, props);
24
+ super(props.message), Object.assign(this, props);
18
25
  }
19
26
  }
20
27
  function extractErrorProps(res) {
@@ -28,10 +35,7 @@ function extractErrorProps(res) {
28
35
  if (body.error && body.message)
29
36
  return props.message = `${body.error} - ${body.message}`, props;
30
37
  if (isMutationError(body) || isActionError(body)) {
31
- const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => {
32
- var _a;
33
- return (_a = item.error) == null ? void 0 : _a.description;
34
- }).filter(Boolean);
38
+ const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => item.error?.description).filter(Boolean);
35
39
  let itemsStr = items.length ? `:
36
40
  - ${items.join(`
37
41
  - `)}` : "";
@@ -147,17 +151,11 @@ const VALID_ASSET_TYPES = ["image", "file"], VALID_INSERT_LOCATIONS = ["before",
147
151
  );
148
152
  return tag;
149
153
  };
150
- var __defProp$2 = Object.defineProperty, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$2 = (obj, key, value) => (__defNormalProp$2(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$7 = (obj, member, msg) => {
151
- if (!member.has(obj))
152
- throw TypeError("Cannot " + msg);
153
- }, __privateGet$7 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$7 = (obj, member, value) => {
154
- if (member.has(obj))
155
- throw TypeError("Cannot add the same private member more than once");
156
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
157
- }, __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
158
154
  class BasePatch {
155
+ selection;
156
+ operations;
159
157
  constructor(selection, operations = {}) {
160
- __publicField$2(this, "selection"), __publicField$2(this, "operations"), this.selection = selection, this.operations = operations;
158
+ this.selection = selection, this.operations = operations;
161
159
  }
162
160
  /**
163
161
  * Sets the given attributes to the document. Does NOT merge objects.
@@ -288,62 +286,52 @@ class BasePatch {
288
286
  return this._assign(op, props, !1);
289
287
  }
290
288
  }
291
- var _client$6;
292
- const _ObservablePatch = class _ObservablePatch2 extends BasePatch {
289
+ class ObservablePatch extends BasePatch {
290
+ #client;
293
291
  constructor(selection, operations, client) {
294
- super(selection, operations), __privateAdd$7(this, _client$6, void 0), __privateSet$7(this, _client$6, client);
292
+ super(selection, operations), this.#client = client;
295
293
  }
296
294
  /**
297
295
  * Clones the patch
298
296
  */
299
297
  clone() {
300
- return new _ObservablePatch2(this.selection, { ...this.operations }, __privateGet$7(this, _client$6));
298
+ return new ObservablePatch(this.selection, { ...this.operations }, this.#client);
301
299
  }
302
300
  commit(options) {
303
- if (!__privateGet$7(this, _client$6))
301
+ if (!this.#client)
304
302
  throw new Error(
305
303
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
306
304
  );
307
305
  const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);
308
- return __privateGet$7(this, _client$6).mutate({ patch: this.serialize() }, opts);
306
+ return this.#client.mutate({ patch: this.serialize() }, opts);
309
307
  }
310
- };
311
- _client$6 = /* @__PURE__ */ new WeakMap();
312
- let ObservablePatch = _ObservablePatch;
313
- var _client2$5;
314
- const _Patch = class _Patch2 extends BasePatch {
308
+ }
309
+ class Patch extends BasePatch {
310
+ #client;
315
311
  constructor(selection, operations, client) {
316
- super(selection, operations), __privateAdd$7(this, _client2$5, void 0), __privateSet$7(this, _client2$5, client);
312
+ super(selection, operations), this.#client = client;
317
313
  }
318
314
  /**
319
315
  * Clones the patch
320
316
  */
321
317
  clone() {
322
- return new _Patch2(this.selection, { ...this.operations }, __privateGet$7(this, _client2$5));
318
+ return new Patch(this.selection, { ...this.operations }, this.#client);
323
319
  }
324
320
  commit(options) {
325
- if (!__privateGet$7(this, _client2$5))
321
+ if (!this.#client)
326
322
  throw new Error(
327
323
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
328
324
  );
329
325
  const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);
330
- return __privateGet$7(this, _client2$5).mutate({ patch: this.serialize() }, opts);
326
+ return this.#client.mutate({ patch: this.serialize() }, opts);
331
327
  }
332
- };
333
- _client2$5 = /* @__PURE__ */ new WeakMap();
334
- let Patch = _Patch;
335
- var __defProp$1 = Object.defineProperty, __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$1 = (obj, key, value) => (__defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$6 = (obj, member, msg) => {
336
- if (!member.has(obj))
337
- throw TypeError("Cannot " + msg);
338
- }, __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$6 = (obj, member, value) => {
339
- if (member.has(obj))
340
- throw TypeError("Cannot add the same private member more than once");
341
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
342
- }, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
328
+ }
343
329
  const defaultMutateOptions = { returnDocuments: !1 };
344
330
  class BaseTransaction {
331
+ operations;
332
+ trxId;
345
333
  constructor(operations = [], transactionId) {
346
- __publicField$1(this, "operations"), __publicField$1(this, "trxId"), this.operations = operations, this.trxId = transactionId;
334
+ this.operations = operations, this.trxId = transactionId;
347
335
  }
348
336
  /**
349
337
  * Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.
@@ -408,23 +396,23 @@ class BaseTransaction {
408
396
  return this.operations.push(mut), this;
409
397
  }
410
398
  }
411
- var _client$5;
412
- const _Transaction = class _Transaction2 extends BaseTransaction {
399
+ class Transaction extends BaseTransaction {
400
+ #client;
413
401
  constructor(operations, client, transactionId) {
414
- super(operations, transactionId), __privateAdd$6(this, _client$5, void 0), __privateSet$6(this, _client$5, client);
402
+ super(operations, transactionId), this.#client = client;
415
403
  }
416
404
  /**
417
405
  * Clones the transaction
418
406
  */
419
407
  clone() {
420
- return new _Transaction2([...this.operations], __privateGet$6(this, _client$5), this.trxId);
408
+ return new Transaction([...this.operations], this.#client, this.trxId);
421
409
  }
422
410
  commit(options) {
423
- if (!__privateGet$6(this, _client$5))
411
+ if (!this.#client)
424
412
  throw new Error(
425
413
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
426
414
  );
427
- return __privateGet$6(this, _client$5).mutate(
415
+ return this.#client.mutate(
428
416
  this.serialize(),
429
417
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
430
418
  );
@@ -434,33 +422,31 @@ const _Transaction = class _Transaction2 extends BaseTransaction {
434
422
  if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof Patch)
435
423
  return this._add({ patch: patchOrDocumentId.serialize() });
436
424
  if (isBuilder) {
437
- const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$6(this, _client$5)));
425
+ const patch = patchOps(new Patch(patchOrDocumentId, {}, this.#client));
438
426
  if (!(patch instanceof Patch))
439
427
  throw new Error("function passed to `patch()` must return the patch");
440
428
  return this._add({ patch: patch.serialize() });
441
429
  }
442
430
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
443
431
  }
444
- };
445
- _client$5 = /* @__PURE__ */ new WeakMap();
446
- let Transaction = _Transaction;
447
- var _client2$4;
448
- const _ObservableTransaction = class _ObservableTransaction2 extends BaseTransaction {
432
+ }
433
+ class ObservableTransaction extends BaseTransaction {
434
+ #client;
449
435
  constructor(operations, client, transactionId) {
450
- super(operations, transactionId), __privateAdd$6(this, _client2$4, void 0), __privateSet$6(this, _client2$4, client);
436
+ super(operations, transactionId), this.#client = client;
451
437
  }
452
438
  /**
453
439
  * Clones the transaction
454
440
  */
455
441
  clone() {
456
- return new _ObservableTransaction2([...this.operations], __privateGet$6(this, _client2$4), this.trxId);
442
+ return new ObservableTransaction([...this.operations], this.#client, this.trxId);
457
443
  }
458
444
  commit(options) {
459
- if (!__privateGet$6(this, _client2$4))
445
+ if (!this.#client)
460
446
  throw new Error(
461
447
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
462
448
  );
463
- return __privateGet$6(this, _client2$4).mutate(
449
+ return this.#client.mutate(
464
450
  this.serialize(),
465
451
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
466
452
  );
@@ -470,16 +456,14 @@ const _ObservableTransaction = class _ObservableTransaction2 extends BaseTransac
470
456
  if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof ObservablePatch)
471
457
  return this._add({ patch: patchOrDocumentId.serialize() });
472
458
  if (isBuilder) {
473
- const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$6(this, _client2$4)));
459
+ const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, this.#client));
474
460
  if (!(patch instanceof ObservablePatch))
475
461
  throw new Error("function passed to `patch()` must return the patch");
476
462
  return this._add({ patch: patch.serialize() });
477
463
  }
478
464
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
479
465
  }
480
- };
481
- _client2$4 = /* @__PURE__ */ new WeakMap();
482
- let ObservableTransaction = _ObservableTransaction;
466
+ }
483
467
  const BASE_URL = "https://www.sanity.io/help/";
484
468
  function generateHelpUrl(slug) {
485
469
  return BASE_URL + slug;
@@ -734,12 +718,11 @@ function _create(client, httpRequest, doc, op, options = {}) {
734
718
  return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
735
719
  }
736
720
  function _requestObservable(client, httpRequest, options) {
737
- var _a, _b;
738
721
  const uri = options.url || options.uri, config = client.config(), canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
739
- let useCdn = ((_a = options.useCdn) != null ? _a : config.useCdn) && canUseCdn;
722
+ let useCdn = (options.useCdn ?? config.useCdn) && canUseCdn;
740
723
  const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
741
724
  if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), ["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
742
- const resultSourceMap = (_b = options.resultSourceMap) != null ? _b : config.resultSourceMap;
725
+ const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
743
726
  resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
744
727
  const perspective = options.perspective || config.perspective;
745
728
  typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
@@ -783,36 +766,29 @@ function _withAbortSignal(signal) {
783
766
  }
784
767
  const isDomExceptionSupported = !!globalThis.DOMException;
785
768
  function _createAbortError(signal) {
786
- var _a, _b;
787
769
  if (isDomExceptionSupported)
788
- return new DOMException((_a = signal == null ? void 0 : signal.reason) != null ? _a : "The operation was aborted.", "AbortError");
789
- const error = new Error((_b = signal == null ? void 0 : signal.reason) != null ? _b : "The operation was aborted.");
770
+ return new DOMException(signal?.reason ?? "The operation was aborted.", "AbortError");
771
+ const error = new Error(signal?.reason ?? "The operation was aborted.");
790
772
  return error.name = "AbortError", error;
791
773
  }
792
- var __accessCheck$5 = (obj, member, msg) => {
793
- if (!member.has(obj))
794
- throw TypeError("Cannot " + msg);
795
- }, __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$5 = (obj, member, value) => {
796
- if (member.has(obj))
797
- throw TypeError("Cannot add the same private member more than once");
798
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
799
- }, __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value), _client$4, _httpRequest$4;
800
774
  class ObservableAssetsClient {
775
+ #client;
776
+ #httpRequest;
801
777
  constructor(client, httpRequest) {
802
- __privateAdd$5(this, _client$4, void 0), __privateAdd$5(this, _httpRequest$4, void 0), __privateSet$5(this, _client$4, client), __privateSet$5(this, _httpRequest$4, httpRequest);
778
+ this.#client = client, this.#httpRequest = httpRequest;
803
779
  }
804
780
  upload(assetType, body, options) {
805
- return _upload(__privateGet$5(this, _client$4), __privateGet$5(this, _httpRequest$4), assetType, body, options);
781
+ return _upload(this.#client, this.#httpRequest, assetType, body, options);
806
782
  }
807
783
  }
808
- _client$4 = /* @__PURE__ */ new WeakMap(), _httpRequest$4 = /* @__PURE__ */ new WeakMap();
809
- var _client2$3, _httpRequest2$4;
810
784
  class AssetsClient {
785
+ #client;
786
+ #httpRequest;
811
787
  constructor(client, httpRequest) {
812
- __privateAdd$5(this, _client2$3, void 0), __privateAdd$5(this, _httpRequest2$4, void 0), __privateSet$5(this, _client2$3, client), __privateSet$5(this, _httpRequest2$4, httpRequest);
788
+ this.#client = client, this.#httpRequest = httpRequest;
813
789
  }
814
790
  upload(assetType, body, options) {
815
- const observable2 = _upload(__privateGet$5(this, _client2$3), __privateGet$5(this, _httpRequest2$4), assetType, body, options);
791
+ const observable2 = _upload(this.#client, this.#httpRequest, assetType, body, options);
816
792
  return lastValueFrom(
817
793
  observable2.pipe(
818
794
  filter((event) => event.type === "response"),
@@ -823,7 +799,6 @@ class AssetsClient {
823
799
  );
824
800
  }
825
801
  }
826
- _client2$3 = /* @__PURE__ */ new WeakMap(), _httpRequest2$4 = /* @__PURE__ */ new WeakMap();
827
802
  function _upload(client, httpRequest, assetType, body, opts = {}) {
828
803
  validateAssetType(assetType);
829
804
  let meta = opts.extract || void 0;
@@ -932,30 +907,22 @@ function cooerceError(err) {
932
907
  function extractErrorMessage(err) {
933
908
  return err.error ? err.error.description ? err.error.description : typeof err.error == "string" ? err.error : JSON.stringify(err.error, null, 2) : err.message || "Unknown listener error";
934
909
  }
935
- var __accessCheck$4 = (obj, member, msg) => {
936
- if (!member.has(obj))
937
- throw TypeError("Cannot " + msg);
938
- }, __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$4 = (obj, member, value) => {
939
- if (member.has(obj))
940
- throw TypeError("Cannot add the same private member more than once");
941
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
942
- }, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
943
910
  const requiredApiVersion = "2021-03-26";
944
- var _client$3;
945
911
  class LiveClient {
912
+ #client;
946
913
  constructor(client) {
947
- __privateAdd$4(this, _client$3, void 0), __privateSet$4(this, _client$3, client);
914
+ this.#client = client;
948
915
  }
949
916
  /**
950
917
  * Requires `apiVersion` to be `2021-03-26` or later.
951
918
  */
952
919
  events() {
953
- const apiVersion = __privateGet$4(this, _client$3).config().apiVersion.replace(/^v/, "");
920
+ const apiVersion = this.#client.config().apiVersion.replace(/^v/, "");
954
921
  if (apiVersion !== "X" && apiVersion < requiredApiVersion)
955
922
  throw new Error(
956
923
  `The live events API requires API version ${requiredApiVersion} or later. The current API version is ${apiVersion}. Please update your API version to use this feature.`
957
924
  );
958
- const path = _getDataUrl(__privateGet$4(this, _client$3), "live/events"), url = new URL(__privateGet$4(this, _client$3).getUrl(path, !1)), listenFor = ["restart", "message"];
925
+ const path = _getDataUrl(this.#client, "live/events"), url = new URL(this.#client.getUrl(path, !1)), listenFor = ["restart", "message"];
959
926
  return new Observable((observer) => {
960
927
  let es, reconnectTimer, stopped = !1, unsubscribed = !1;
961
928
  open();
@@ -1004,7 +971,6 @@ class LiveClient {
1004
971
  });
1005
972
  }
1006
973
  }
1007
- _client$3 = /* @__PURE__ */ new WeakMap();
1008
974
  function parseEvent(event) {
1009
975
  try {
1010
976
  const data = event.data && JSON.parse(event.data) || {};
@@ -1013,17 +979,11 @@ function parseEvent(event) {
1013
979
  return err;
1014
980
  }
1015
981
  }
1016
- var __accessCheck$3 = (obj, member, msg) => {
1017
- if (!member.has(obj))
1018
- throw TypeError("Cannot " + msg);
1019
- }, __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$3 = (obj, member, value) => {
1020
- if (member.has(obj))
1021
- throw TypeError("Cannot add the same private member more than once");
1022
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1023
- }, __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value), _client$2, _httpRequest$3;
1024
982
  class ObservableDatasetsClient {
983
+ #client;
984
+ #httpRequest;
1025
985
  constructor(client, httpRequest) {
1026
- __privateAdd$3(this, _client$2, void 0), __privateAdd$3(this, _httpRequest$3, void 0), __privateSet$3(this, _client$2, client), __privateSet$3(this, _httpRequest$3, httpRequest);
986
+ this.#client = client, this.#httpRequest = httpRequest;
1027
987
  }
1028
988
  /**
1029
989
  * Create a new dataset with the given name
@@ -1032,7 +992,7 @@ class ObservableDatasetsClient {
1032
992
  * @param options - Options for the dataset
1033
993
  */
1034
994
  create(name2, options) {
1035
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PUT", name2, options);
995
+ return _modify(this.#client, this.#httpRequest, "PUT", name2, options);
1036
996
  }
1037
997
  /**
1038
998
  * Edit a dataset with the given name
@@ -1041,7 +1001,7 @@ class ObservableDatasetsClient {
1041
1001
  * @param options - New options for the dataset
1042
1002
  */
1043
1003
  edit(name2, options) {
1044
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PATCH", name2, options);
1004
+ return _modify(this.#client, this.#httpRequest, "PATCH", name2, options);
1045
1005
  }
1046
1006
  /**
1047
1007
  * Delete a dataset with the given name
@@ -1049,23 +1009,23 @@ class ObservableDatasetsClient {
1049
1009
  * @param name - Name of the dataset to delete
1050
1010
  */
1051
1011
  delete(name2) {
1052
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "DELETE", name2);
1012
+ return _modify(this.#client, this.#httpRequest, "DELETE", name2);
1053
1013
  }
1054
1014
  /**
1055
1015
  * Fetch a list of datasets for the configured project
1056
1016
  */
1057
1017
  list() {
1058
- return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
1018
+ return _request(this.#client, this.#httpRequest, {
1059
1019
  uri: "/datasets",
1060
1020
  tag: null
1061
1021
  });
1062
1022
  }
1063
1023
  }
1064
- _client$2 = /* @__PURE__ */ new WeakMap(), _httpRequest$3 = /* @__PURE__ */ new WeakMap();
1065
- var _client2$2, _httpRequest2$3;
1066
1024
  class DatasetsClient {
1025
+ #client;
1026
+ #httpRequest;
1067
1027
  constructor(client, httpRequest) {
1068
- __privateAdd$3(this, _client2$2, void 0), __privateAdd$3(this, _httpRequest2$3, void 0), __privateSet$3(this, _client2$2, client), __privateSet$3(this, _httpRequest2$3, httpRequest);
1028
+ this.#client = client, this.#httpRequest = httpRequest;
1069
1029
  }
1070
1030
  /**
1071
1031
  * Create a new dataset with the given name
@@ -1075,7 +1035,7 @@ class DatasetsClient {
1075
1035
  */
1076
1036
  create(name2, options) {
1077
1037
  return lastValueFrom(
1078
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PUT", name2, options)
1038
+ _modify(this.#client, this.#httpRequest, "PUT", name2, options)
1079
1039
  );
1080
1040
  }
1081
1041
  /**
@@ -1086,7 +1046,7 @@ class DatasetsClient {
1086
1046
  */
1087
1047
  edit(name2, options) {
1088
1048
  return lastValueFrom(
1089
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PATCH", name2, options)
1049
+ _modify(this.#client, this.#httpRequest, "PATCH", name2, options)
1090
1050
  );
1091
1051
  }
1092
1052
  /**
@@ -1095,18 +1055,17 @@ class DatasetsClient {
1095
1055
  * @param name - Name of the dataset to delete
1096
1056
  */
1097
1057
  delete(name2) {
1098
- return lastValueFrom(_modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "DELETE", name2));
1058
+ return lastValueFrom(_modify(this.#client, this.#httpRequest, "DELETE", name2));
1099
1059
  }
1100
1060
  /**
1101
1061
  * Fetch a list of datasets for the configured project
1102
1062
  */
1103
1063
  list() {
1104
1064
  return lastValueFrom(
1105
- _request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), { uri: "/datasets", tag: null })
1065
+ _request(this.#client, this.#httpRequest, { uri: "/datasets", tag: null })
1106
1066
  );
1107
1067
  }
1108
1068
  }
1109
- _client2$2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$3 = /* @__PURE__ */ new WeakMap();
1110
1069
  function _modify(client, httpRequest, method, name2, options) {
1111
1070
  return dataset(name2), _request(client, httpRequest, {
1112
1071
  method,
@@ -1115,21 +1074,15 @@ function _modify(client, httpRequest, method, name2, options) {
1115
1074
  tag: null
1116
1075
  });
1117
1076
  }
1118
- var __accessCheck$2 = (obj, member, msg) => {
1119
- if (!member.has(obj))
1120
- throw TypeError("Cannot " + msg);
1121
- }, __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$2 = (obj, member, value) => {
1122
- if (member.has(obj))
1123
- throw TypeError("Cannot add the same private member more than once");
1124
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1125
- }, __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value), _client$1, _httpRequest$2;
1126
1077
  class ObservableProjectsClient {
1078
+ #client;
1079
+ #httpRequest;
1127
1080
  constructor(client, httpRequest) {
1128
- __privateAdd$2(this, _client$1, void 0), __privateAdd$2(this, _httpRequest$2, void 0), __privateSet$2(this, _client$1, client), __privateSet$2(this, _httpRequest$2, httpRequest);
1081
+ this.#client = client, this.#httpRequest = httpRequest;
1129
1082
  }
1130
1083
  list(options) {
1131
- const uri = (options == null ? void 0 : options.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
1132
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri });
1084
+ const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1085
+ return _request(this.#client, this.#httpRequest, { uri });
1133
1086
  }
1134
1087
  /**
1135
1088
  * Fetch a project by project ID
@@ -1137,18 +1090,18 @@ class ObservableProjectsClient {
1137
1090
  * @param projectId - ID of the project to fetch
1138
1091
  */
1139
1092
  getById(projectId2) {
1140
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri: `/projects/${projectId2}` });
1093
+ return _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId2}` });
1141
1094
  }
1142
1095
  }
1143
- _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */ new WeakMap();
1144
- var _client2$1, _httpRequest2$2;
1145
1096
  class ProjectsClient {
1097
+ #client;
1098
+ #httpRequest;
1146
1099
  constructor(client, httpRequest) {
1147
- __privateAdd$2(this, _client2$1, void 0), __privateAdd$2(this, _httpRequest2$2, void 0), __privateSet$2(this, _client2$1, client), __privateSet$2(this, _httpRequest2$2, httpRequest);
1100
+ this.#client = client, this.#httpRequest = httpRequest;
1148
1101
  }
1149
1102
  list(options) {
1150
- const uri = (options == null ? void 0 : options.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
1151
- return lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri }));
1103
+ const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1104
+ return lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
1152
1105
  }
1153
1106
  /**
1154
1107
  * Fetch a project by project ID
@@ -1157,22 +1110,15 @@ class ProjectsClient {
1157
1110
  */
1158
1111
  getById(projectId2) {
1159
1112
  return lastValueFrom(
1160
- _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: `/projects/${projectId2}` })
1113
+ _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId2}` })
1161
1114
  );
1162
1115
  }
1163
1116
  }
1164
- _client2$1 = /* @__PURE__ */ new WeakMap(), _httpRequest2$2 = /* @__PURE__ */ new WeakMap();
1165
- var __accessCheck$1 = (obj, member, msg) => {
1166
- if (!member.has(obj))
1167
- throw TypeError("Cannot " + msg);
1168
- }, __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$1 = (obj, member, value) => {
1169
- if (member.has(obj))
1170
- throw TypeError("Cannot add the same private member more than once");
1171
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1172
- }, __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value), _client, _httpRequest$1;
1173
1117
  class ObservableUsersClient {
1118
+ #client;
1119
+ #httpRequest;
1174
1120
  constructor(client, httpRequest) {
1175
- __privateAdd$1(this, _client, void 0), __privateAdd$1(this, _httpRequest$1, void 0), __privateSet$1(this, _client, client), __privateSet$1(this, _httpRequest$1, httpRequest);
1121
+ this.#client = client, this.#httpRequest = httpRequest;
1176
1122
  }
1177
1123
  /**
1178
1124
  * Fetch a user by user ID
@@ -1181,17 +1127,17 @@ class ObservableUsersClient {
1181
1127
  */
1182
1128
  getById(id) {
1183
1129
  return _request(
1184
- __privateGet$1(this, _client),
1185
- __privateGet$1(this, _httpRequest$1),
1130
+ this.#client,
1131
+ this.#httpRequest,
1186
1132
  { uri: `/users/${id}` }
1187
1133
  );
1188
1134
  }
1189
1135
  }
1190
- _client = /* @__PURE__ */ new WeakMap(), _httpRequest$1 = /* @__PURE__ */ new WeakMap();
1191
- var _client2, _httpRequest2$1;
1192
1136
  class UsersClient {
1137
+ #client;
1138
+ #httpRequest;
1193
1139
  constructor(client, httpRequest) {
1194
- __privateAdd$1(this, _client2, void 0), __privateAdd$1(this, _httpRequest2$1, void 0), __privateSet$1(this, _client2, client), __privateSet$1(this, _httpRequest2$1, httpRequest);
1140
+ this.#client = client, this.#httpRequest = httpRequest;
1195
1141
  }
1196
1142
  /**
1197
1143
  * Fetch a user by user ID
@@ -1200,39 +1146,44 @@ class UsersClient {
1200
1146
  */
1201
1147
  getById(id) {
1202
1148
  return lastValueFrom(
1203
- _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {
1149
+ _request(this.#client, this.#httpRequest, {
1204
1150
  uri: `/users/${id}`
1205
1151
  })
1206
1152
  );
1207
1153
  }
1208
1154
  }
1209
- _client2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$1 = /* @__PURE__ */ new WeakMap();
1210
- var __defProp = Object.defineProperty, __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField = (obj, key, value) => (__defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck = (obj, member, msg) => {
1211
- if (!member.has(obj))
1212
- throw TypeError("Cannot " + msg);
1213
- }, __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => {
1214
- if (member.has(obj))
1215
- throw TypeError("Cannot add the same private member more than once");
1216
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1217
- }, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value), _clientConfig, _httpRequest;
1218
- const _ObservableSanityClient = class _ObservableSanityClient2 {
1155
+ class ObservableSanityClient {
1156
+ assets;
1157
+ datasets;
1158
+ live;
1159
+ projects;
1160
+ users;
1161
+ /**
1162
+ * Private properties
1163
+ */
1164
+ #clientConfig;
1165
+ #httpRequest;
1166
+ /**
1167
+ * Instance properties
1168
+ */
1169
+ listen = _listen;
1219
1170
  constructor(httpRequest, config = defaultConfig) {
1220
- __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "live"), __publicField(this, "projects"), __publicField(this, "users"), __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1171
+ this.config(config), this.#httpRequest = httpRequest, this.assets = new ObservableAssetsClient(this, this.#httpRequest), this.datasets = new ObservableDatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, this.#httpRequest), this.users = new ObservableUsersClient(this, this.#httpRequest);
1221
1172
  }
1222
1173
  /**
1223
1174
  * Clone the client - returns a new instance
1224
1175
  */
1225
1176
  clone() {
1226
- return new _ObservableSanityClient2(__privateGet(this, _httpRequest), this.config());
1177
+ return new ObservableSanityClient(this.#httpRequest, this.config());
1227
1178
  }
1228
1179
  config(newConfig) {
1229
1180
  if (newConfig === void 0)
1230
- return { ...__privateGet(this, _clientConfig) };
1231
- if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === !1)
1181
+ return { ...this.#clientConfig };
1182
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === !1)
1232
1183
  throw new Error(
1233
1184
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1234
1185
  );
1235
- return __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {})), this;
1186
+ return this.#clientConfig = initConfig(newConfig, this.#clientConfig || {}), this;
1236
1187
  }
1237
1188
  /**
1238
1189
  * Clone the client with a new (partial) configuration.
@@ -1241,20 +1192,20 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1241
1192
  */
1242
1193
  withConfig(newConfig) {
1243
1194
  const thisConfig = this.config();
1244
- return new _ObservableSanityClient2(__privateGet(this, _httpRequest), {
1195
+ return new ObservableSanityClient(this.#httpRequest, {
1245
1196
  ...thisConfig,
1246
1197
  ...newConfig,
1247
1198
  stega: {
1248
1199
  ...thisConfig.stega || {},
1249
- ...typeof (newConfig == null ? void 0 : newConfig.stega) == "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}
1200
+ ...typeof newConfig?.stega == "boolean" ? { enabled: newConfig.stega } : newConfig?.stega || {}
1250
1201
  }
1251
1202
  });
1252
1203
  }
1253
1204
  fetch(query, params, options) {
1254
1205
  return _fetch(
1255
1206
  this,
1256
- __privateGet(this, _httpRequest),
1257
- __privateGet(this, _clientConfig).stega,
1207
+ this.#httpRequest,
1208
+ this.#clientConfig.stega,
1258
1209
  query,
1259
1210
  params,
1260
1211
  options
@@ -1267,7 +1218,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1267
1218
  * @param options - Request options
1268
1219
  */
1269
1220
  getDocument(id, options) {
1270
- return _getDocument(this, __privateGet(this, _httpRequest), id, options);
1221
+ return _getDocument(this, this.#httpRequest, id, options);
1271
1222
  }
1272
1223
  /**
1273
1224
  * Fetch multiple documents in one request.
@@ -1279,22 +1230,22 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1279
1230
  * @param options - Request options
1280
1231
  */
1281
1232
  getDocuments(ids, options) {
1282
- return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);
1233
+ return _getDocuments(this, this.#httpRequest, ids, options);
1283
1234
  }
1284
1235
  create(document, options) {
1285
- return _create(this, __privateGet(this, _httpRequest), document, "create", options);
1236
+ return _create(this, this.#httpRequest, document, "create", options);
1286
1237
  }
1287
1238
  createIfNotExists(document, options) {
1288
- return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);
1239
+ return _createIfNotExists(this, this.#httpRequest, document, options);
1289
1240
  }
1290
1241
  createOrReplace(document, options) {
1291
- return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);
1242
+ return _createOrReplace(this, this.#httpRequest, document, options);
1292
1243
  }
1293
1244
  delete(selection, options) {
1294
- return _delete(this, __privateGet(this, _httpRequest), selection, options);
1245
+ return _delete(this, this.#httpRequest, selection, options);
1295
1246
  }
1296
1247
  mutate(operations, options) {
1297
- return _mutate(this, __privateGet(this, _httpRequest), operations, options);
1248
+ return _mutate(this, this.#httpRequest, operations, options);
1298
1249
  }
1299
1250
  /**
1300
1251
  * Create a new buildable patch of operations to perform
@@ -1321,7 +1272,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1321
1272
  * @param options - Action options
1322
1273
  */
1323
1274
  action(operations, options) {
1324
- return _action(this, __privateGet(this, _httpRequest), operations, options);
1275
+ return _action(this, this.#httpRequest, operations, options);
1325
1276
  }
1326
1277
  /**
1327
1278
  * Perform an HTTP request against the Sanity API
@@ -1329,7 +1280,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1329
1280
  * @param options - Request options
1330
1281
  */
1331
1282
  request(options) {
1332
- return _request(this, __privateGet(this, _httpRequest), options);
1283
+ return _request(this, this.#httpRequest, options);
1333
1284
  }
1334
1285
  /**
1335
1286
  * Get a Sanity API URL for the URI provided
@@ -1349,28 +1300,43 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1349
1300
  getDataUrl(operation, path) {
1350
1301
  return _getDataUrl(this, operation, path);
1351
1302
  }
1352
- };
1353
- _clientConfig = /* @__PURE__ */ new WeakMap(), _httpRequest = /* @__PURE__ */ new WeakMap();
1354
- let ObservableSanityClient = _ObservableSanityClient;
1355
- var _clientConfig2, _httpRequest2;
1356
- const _SanityClient = class _SanityClient2 {
1303
+ }
1304
+ class SanityClient {
1305
+ assets;
1306
+ datasets;
1307
+ live;
1308
+ projects;
1309
+ users;
1310
+ /**
1311
+ * Observable version of the Sanity client, with the same configuration as the promise-based one
1312
+ */
1313
+ observable;
1314
+ /**
1315
+ * Private properties
1316
+ */
1317
+ #clientConfig;
1318
+ #httpRequest;
1319
+ /**
1320
+ * Instance properties
1321
+ */
1322
+ listen = _listen;
1357
1323
  constructor(httpRequest, config = defaultConfig) {
1358
- __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "live"), __publicField(this, "projects"), __publicField(this, "users"), __publicField(this, "observable"), __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);
1324
+ this.config(config), this.#httpRequest = httpRequest, this.assets = new AssetsClient(this, this.#httpRequest), this.datasets = new DatasetsClient(this, this.#httpRequest), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, this.#httpRequest), this.users = new UsersClient(this, this.#httpRequest), this.observable = new ObservableSanityClient(httpRequest, config);
1359
1325
  }
1360
1326
  /**
1361
1327
  * Clone the client - returns a new instance
1362
1328
  */
1363
1329
  clone() {
1364
- return new _SanityClient2(__privateGet(this, _httpRequest2), this.config());
1330
+ return new SanityClient(this.#httpRequest, this.config());
1365
1331
  }
1366
1332
  config(newConfig) {
1367
1333
  if (newConfig === void 0)
1368
- return { ...__privateGet(this, _clientConfig2) };
1369
- if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === !1)
1334
+ return { ...this.#clientConfig };
1335
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === !1)
1370
1336
  throw new Error(
1371
1337
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1372
1338
  );
1373
- return this.observable && this.observable.config(newConfig), __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {})), this;
1339
+ return this.observable && this.observable.config(newConfig), this.#clientConfig = initConfig(newConfig, this.#clientConfig || {}), this;
1374
1340
  }
1375
1341
  /**
1376
1342
  * Clone the client with a new (partial) configuration.
@@ -1379,12 +1345,12 @@ const _SanityClient = class _SanityClient2 {
1379
1345
  */
1380
1346
  withConfig(newConfig) {
1381
1347
  const thisConfig = this.config();
1382
- return new _SanityClient2(__privateGet(this, _httpRequest2), {
1348
+ return new SanityClient(this.#httpRequest, {
1383
1349
  ...thisConfig,
1384
1350
  ...newConfig,
1385
1351
  stega: {
1386
1352
  ...thisConfig.stega || {},
1387
- ...typeof (newConfig == null ? void 0 : newConfig.stega) == "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}
1353
+ ...typeof newConfig?.stega == "boolean" ? { enabled: newConfig.stega } : newConfig?.stega || {}
1388
1354
  }
1389
1355
  });
1390
1356
  }
@@ -1392,8 +1358,8 @@ const _SanityClient = class _SanityClient2 {
1392
1358
  return lastValueFrom(
1393
1359
  _fetch(
1394
1360
  this,
1395
- __privateGet(this, _httpRequest2),
1396
- __privateGet(this, _clientConfig2).stega,
1361
+ this.#httpRequest,
1362
+ this.#clientConfig.stega,
1397
1363
  query,
1398
1364
  params,
1399
1365
  options
@@ -1407,7 +1373,7 @@ const _SanityClient = class _SanityClient2 {
1407
1373
  * @param options - Request options
1408
1374
  */
1409
1375
  getDocument(id, options) {
1410
- return lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));
1376
+ return lastValueFrom(_getDocument(this, this.#httpRequest, id, options));
1411
1377
  }
1412
1378
  /**
1413
1379
  * Fetch multiple documents in one request.
@@ -1419,28 +1385,28 @@ const _SanityClient = class _SanityClient2 {
1419
1385
  * @param options - Request options
1420
1386
  */
1421
1387
  getDocuments(ids, options) {
1422
- return lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));
1388
+ return lastValueFrom(_getDocuments(this, this.#httpRequest, ids, options));
1423
1389
  }
1424
1390
  create(document, options) {
1425
1391
  return lastValueFrom(
1426
- _create(this, __privateGet(this, _httpRequest2), document, "create", options)
1392
+ _create(this, this.#httpRequest, document, "create", options)
1427
1393
  );
1428
1394
  }
1429
1395
  createIfNotExists(document, options) {
1430
1396
  return lastValueFrom(
1431
- _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)
1397
+ _createIfNotExists(this, this.#httpRequest, document, options)
1432
1398
  );
1433
1399
  }
1434
1400
  createOrReplace(document, options) {
1435
1401
  return lastValueFrom(
1436
- _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)
1402
+ _createOrReplace(this, this.#httpRequest, document, options)
1437
1403
  );
1438
1404
  }
1439
1405
  delete(selection, options) {
1440
- return lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));
1406
+ return lastValueFrom(_delete(this, this.#httpRequest, selection, options));
1441
1407
  }
1442
1408
  mutate(operations, options) {
1443
- return lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));
1409
+ return lastValueFrom(_mutate(this, this.#httpRequest, operations, options));
1444
1410
  }
1445
1411
  /**
1446
1412
  * Create a new buildable patch of operations to perform
@@ -1468,7 +1434,7 @@ const _SanityClient = class _SanityClient2 {
1468
1434
  * @param options - Action options
1469
1435
  */
1470
1436
  action(operations, options) {
1471
- return lastValueFrom(_action(this, __privateGet(this, _httpRequest2), operations, options));
1437
+ return lastValueFrom(_action(this, this.#httpRequest, operations, options));
1472
1438
  }
1473
1439
  /**
1474
1440
  * Perform a request against the Sanity API
@@ -1478,7 +1444,7 @@ const _SanityClient = class _SanityClient2 {
1478
1444
  * @returns Promise resolving to the response body
1479
1445
  */
1480
1446
  request(options) {
1481
- return lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));
1447
+ return lastValueFrom(_request(this, this.#httpRequest, options));
1482
1448
  }
1483
1449
  /**
1484
1450
  * Perform an HTTP request a `/data` sub-endpoint
@@ -1491,7 +1457,7 @@ const _SanityClient = class _SanityClient2 {
1491
1457
  * @internal
1492
1458
  */
1493
1459
  dataRequest(endpoint, body, options) {
1494
- return lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));
1460
+ return lastValueFrom(_dataRequest(this, this.#httpRequest, endpoint, body, options));
1495
1461
  }
1496
1462
  /**
1497
1463
  * Get a Sanity API URL for the URI provided
@@ -1511,9 +1477,7 @@ const _SanityClient = class _SanityClient2 {
1511
1477
  getDataUrl(operation, path) {
1512
1478
  return _getDataUrl(this, operation, path);
1513
1479
  }
1514
- };
1515
- _clientConfig2 = /* @__PURE__ */ new WeakMap(), _httpRequest2 = /* @__PURE__ */ new WeakMap();
1516
- let SanityClient = _SanityClient;
1480
+ }
1517
1481
  function defineCreateClientExports(envMiddleware, ClassConstructor) {
1518
1482
  const defaultRequester = defineHttpRequest(envMiddleware);
1519
1483
  return { requester: defaultRequester, createClient: (config) => new ClassConstructor(
@@ -1531,7 +1495,7 @@ function defineDeprecatedCreateClient(createClient2) {
1531
1495
  return printNoDefaultExport(), createClient2(config);
1532
1496
  };
1533
1497
  }
1534
- var name = "@sanity/client", version = "6.21.1";
1498
+ var name = "@sanity/client", version = "6.21.2";
1535
1499
  const middleware = [
1536
1500
  debug({ verbose: !0, namespace: "sanity:client" }),
1537
1501
  headers({ "User-Agent": `${name} ${version}` }),