@sanity/client 6.21.0 → 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.
@@ -19,17 +19,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
19
19
  mod
20
20
  ));
21
21
  Object.defineProperty(exports, "__esModule", { value: !0 });
22
- var getIt = require("get-it"), middleware = require("get-it/middleware"), rxjs = require("rxjs"), operators = require("rxjs/operators"), stegaClean = require("./_chunks-cjs/stegaClean.cjs"), __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);
22
+ var getIt = require("get-it"), middleware = require("get-it/middleware"), rxjs = require("rxjs"), stegaClean = require("./_chunks-cjs/stegaClean.cjs"), operators = require("rxjs/operators");
23
23
  class ClientError extends Error {
24
+ response;
25
+ statusCode = 400;
26
+ responseBody;
27
+ details;
24
28
  constructor(res) {
25
29
  const props = extractErrorProps(res);
26
- super(props.message), __publicField$3(this, "response"), __publicField$3(this, "statusCode", 400), __publicField$3(this, "responseBody"), __publicField$3(this, "details"), Object.assign(this, props);
30
+ super(props.message), Object.assign(this, props);
27
31
  }
28
32
  }
29
33
  class ServerError extends Error {
34
+ response;
35
+ statusCode = 500;
36
+ responseBody;
37
+ details;
30
38
  constructor(res) {
31
39
  const props = extractErrorProps(res);
32
- super(props.message), __publicField$3(this, "response"), __publicField$3(this, "statusCode", 500), __publicField$3(this, "responseBody"), __publicField$3(this, "details"), Object.assign(this, props);
40
+ super(props.message), Object.assign(this, props);
33
41
  }
34
42
  }
35
43
  function extractErrorProps(res) {
@@ -43,10 +51,7 @@ function extractErrorProps(res) {
43
51
  if (body.error && body.message)
44
52
  return props.message = `${body.error} - ${body.message}`, props;
45
53
  if (isMutationError(body) || isActionError(body)) {
46
- const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => {
47
- var _a;
48
- return (_a = item.error) == null ? void 0 : _a.description;
49
- }).filter(Boolean);
54
+ const allItems = body.error.items || [], items = allItems.slice(0, 5).map((item) => item.error?.description).filter(Boolean);
50
55
  let itemsStr = items.length ? `:
51
56
  - ${items.join(`
52
57
  - `)}` : "";
@@ -162,17 +167,11 @@ const VALID_ASSET_TYPES = ["image", "file"], VALID_INSERT_LOCATIONS = ["before",
162
167
  );
163
168
  return tag;
164
169
  };
165
- 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) => {
166
- if (!member.has(obj))
167
- throw TypeError("Cannot " + msg);
168
- }, __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) => {
169
- if (member.has(obj))
170
- throw TypeError("Cannot add the same private member more than once");
171
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
172
- }, __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
173
170
  class BasePatch {
171
+ selection;
172
+ operations;
174
173
  constructor(selection, operations = {}) {
175
- __publicField$2(this, "selection"), __publicField$2(this, "operations"), this.selection = selection, this.operations = operations;
174
+ this.selection = selection, this.operations = operations;
176
175
  }
177
176
  /**
178
177
  * Sets the given attributes to the document. Does NOT merge objects.
@@ -303,62 +302,52 @@ class BasePatch {
303
302
  return this._assign(op, props, !1);
304
303
  }
305
304
  }
306
- var _client$6;
307
- const _ObservablePatch = class _ObservablePatch2 extends BasePatch {
305
+ class ObservablePatch extends BasePatch {
306
+ #client;
308
307
  constructor(selection, operations, client) {
309
- super(selection, operations), __privateAdd$7(this, _client$6, void 0), __privateSet$7(this, _client$6, client);
308
+ super(selection, operations), this.#client = client;
310
309
  }
311
310
  /**
312
311
  * Clones the patch
313
312
  */
314
313
  clone() {
315
- return new _ObservablePatch2(this.selection, { ...this.operations }, __privateGet$7(this, _client$6));
314
+ return new ObservablePatch(this.selection, { ...this.operations }, this.#client);
316
315
  }
317
316
  commit(options) {
318
- if (!__privateGet$7(this, _client$6))
317
+ if (!this.#client)
319
318
  throw new Error(
320
319
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
321
320
  );
322
321
  const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);
323
- return __privateGet$7(this, _client$6).mutate({ patch: this.serialize() }, opts);
322
+ return this.#client.mutate({ patch: this.serialize() }, opts);
324
323
  }
325
- };
326
- _client$6 = /* @__PURE__ */ new WeakMap();
327
- let ObservablePatch = _ObservablePatch;
328
- var _client2$5;
329
- const _Patch = class _Patch2 extends BasePatch {
324
+ }
325
+ class Patch extends BasePatch {
326
+ #client;
330
327
  constructor(selection, operations, client) {
331
- super(selection, operations), __privateAdd$7(this, _client2$5, void 0), __privateSet$7(this, _client2$5, client);
328
+ super(selection, operations), this.#client = client;
332
329
  }
333
330
  /**
334
331
  * Clones the patch
335
332
  */
336
333
  clone() {
337
- return new _Patch2(this.selection, { ...this.operations }, __privateGet$7(this, _client2$5));
334
+ return new Patch(this.selection, { ...this.operations }, this.#client);
338
335
  }
339
336
  commit(options) {
340
- if (!__privateGet$7(this, _client2$5))
337
+ if (!this.#client)
341
338
  throw new Error(
342
339
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
343
340
  );
344
341
  const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);
345
- return __privateGet$7(this, _client2$5).mutate({ patch: this.serialize() }, opts);
342
+ return this.#client.mutate({ patch: this.serialize() }, opts);
346
343
  }
347
- };
348
- _client2$5 = /* @__PURE__ */ new WeakMap();
349
- let Patch = _Patch;
350
- 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) => {
351
- if (!member.has(obj))
352
- throw TypeError("Cannot " + msg);
353
- }, __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) => {
354
- if (member.has(obj))
355
- throw TypeError("Cannot add the same private member more than once");
356
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
357
- }, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
344
+ }
358
345
  const defaultMutateOptions = { returnDocuments: !1 };
359
346
  class BaseTransaction {
347
+ operations;
348
+ trxId;
360
349
  constructor(operations = [], transactionId) {
361
- __publicField$1(this, "operations"), __publicField$1(this, "trxId"), this.operations = operations, this.trxId = transactionId;
350
+ this.operations = operations, this.trxId = transactionId;
362
351
  }
363
352
  /**
364
353
  * 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.
@@ -423,23 +412,23 @@ class BaseTransaction {
423
412
  return this.operations.push(mut), this;
424
413
  }
425
414
  }
426
- var _client$5;
427
- const _Transaction = class _Transaction2 extends BaseTransaction {
415
+ class Transaction extends BaseTransaction {
416
+ #client;
428
417
  constructor(operations, client, transactionId) {
429
- super(operations, transactionId), __privateAdd$6(this, _client$5, void 0), __privateSet$6(this, _client$5, client);
418
+ super(operations, transactionId), this.#client = client;
430
419
  }
431
420
  /**
432
421
  * Clones the transaction
433
422
  */
434
423
  clone() {
435
- return new _Transaction2([...this.operations], __privateGet$6(this, _client$5), this.trxId);
424
+ return new Transaction([...this.operations], this.#client, this.trxId);
436
425
  }
437
426
  commit(options) {
438
- if (!__privateGet$6(this, _client$5))
427
+ if (!this.#client)
439
428
  throw new Error(
440
429
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
441
430
  );
442
- return __privateGet$6(this, _client$5).mutate(
431
+ return this.#client.mutate(
443
432
  this.serialize(),
444
433
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
445
434
  );
@@ -449,33 +438,31 @@ const _Transaction = class _Transaction2 extends BaseTransaction {
449
438
  if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof Patch)
450
439
  return this._add({ patch: patchOrDocumentId.serialize() });
451
440
  if (isBuilder) {
452
- const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$6(this, _client$5)));
441
+ const patch = patchOps(new Patch(patchOrDocumentId, {}, this.#client));
453
442
  if (!(patch instanceof Patch))
454
443
  throw new Error("function passed to `patch()` must return the patch");
455
444
  return this._add({ patch: patch.serialize() });
456
445
  }
457
446
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
458
447
  }
459
- };
460
- _client$5 = /* @__PURE__ */ new WeakMap();
461
- let Transaction = _Transaction;
462
- var _client2$4;
463
- const _ObservableTransaction = class _ObservableTransaction2 extends BaseTransaction {
448
+ }
449
+ class ObservableTransaction extends BaseTransaction {
450
+ #client;
464
451
  constructor(operations, client, transactionId) {
465
- super(operations, transactionId), __privateAdd$6(this, _client2$4, void 0), __privateSet$6(this, _client2$4, client);
452
+ super(operations, transactionId), this.#client = client;
466
453
  }
467
454
  /**
468
455
  * Clones the transaction
469
456
  */
470
457
  clone() {
471
- return new _ObservableTransaction2([...this.operations], __privateGet$6(this, _client2$4), this.trxId);
458
+ return new ObservableTransaction([...this.operations], this.#client, this.trxId);
472
459
  }
473
460
  commit(options) {
474
- if (!__privateGet$6(this, _client2$4))
461
+ if (!this.#client)
475
462
  throw new Error(
476
463
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
477
464
  );
478
- return __privateGet$6(this, _client2$4).mutate(
465
+ return this.#client.mutate(
479
466
  this.serialize(),
480
467
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
481
468
  );
@@ -485,16 +472,14 @@ const _ObservableTransaction = class _ObservableTransaction2 extends BaseTransac
485
472
  if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof ObservablePatch)
486
473
  return this._add({ patch: patchOrDocumentId.serialize() });
487
474
  if (isBuilder) {
488
- const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$6(this, _client2$4)));
475
+ const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, this.#client));
489
476
  if (!(patch instanceof ObservablePatch))
490
477
  throw new Error("function passed to `patch()` must return the patch");
491
478
  return this._add({ patch: patch.serialize() });
492
479
  }
493
480
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
494
481
  }
495
- };
496
- _client2$4 = /* @__PURE__ */ new WeakMap();
497
- let ObservableTransaction = _ObservableTransaction;
482
+ }
498
483
  const BASE_URL = "https://www.sanity.io/help/";
499
484
  function generateHelpUrl(slug) {
500
485
  return BASE_URL + slug;
@@ -609,13 +594,13 @@ const encodeQueryString = ({
609
594
  params = {},
610
595
  options = {}
611
596
  }) => {
612
- const searchParams = new URLSearchParams(), { tag, returnQuery, ...opts } = options;
597
+ const searchParams = new URLSearchParams(), { tag, includeMutations, returnQuery, ...opts } = options;
613
598
  tag && searchParams.append("tag", tag), searchParams.append("query", query);
614
599
  for (const [key, value] of Object.entries(params))
615
600
  searchParams.append(`$${key}`, JSON.stringify(value));
616
601
  for (const [key, value] of Object.entries(opts))
617
602
  value && searchParams.append(key, `${value}`);
618
- return returnQuery === !1 && searchParams.append("returnQuery", "false"), `?${searchParams}`;
603
+ return returnQuery === !1 && searchParams.append("returnQuery", "false"), includeMutations === !1 && searchParams.append("includeMutations", "false"), `?${searchParams}`;
619
604
  }, excludeFalsey = (param, defValue) => param === !1 ? void 0 : typeof param > "u" ? defValue : param, getMutationQuery = (options = {}) => ({
620
605
  dryRun: options.dryRun,
621
606
  returnIds: !0,
@@ -751,12 +736,11 @@ function _create(client, httpRequest, doc, op, options = {}) {
751
736
  return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
752
737
  }
753
738
  function _requestObservable(client, httpRequest, options) {
754
- var _a, _b;
755
739
  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;
756
- let useCdn = ((_a = options.useCdn) != null ? _a : config.useCdn) && canUseCdn;
740
+ let useCdn = (options.useCdn ?? config.useCdn) && canUseCdn;
757
741
  const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
758
742
  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) {
759
- const resultSourceMap = (_b = options.resultSourceMap) != null ? _b : config.resultSourceMap;
743
+ const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
760
744
  resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
761
745
  const perspective = options.perspective || config.perspective;
762
746
  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 });
@@ -800,36 +784,29 @@ function _withAbortSignal(signal) {
800
784
  }
801
785
  const isDomExceptionSupported = !!globalThis.DOMException;
802
786
  function _createAbortError(signal) {
803
- var _a, _b;
804
787
  if (isDomExceptionSupported)
805
- return new DOMException((_a = signal == null ? void 0 : signal.reason) != null ? _a : "The operation was aborted.", "AbortError");
806
- const error = new Error((_b = signal == null ? void 0 : signal.reason) != null ? _b : "The operation was aborted.");
788
+ return new DOMException(signal?.reason ?? "The operation was aborted.", "AbortError");
789
+ const error = new Error(signal?.reason ?? "The operation was aborted.");
807
790
  return error.name = "AbortError", error;
808
791
  }
809
- var __accessCheck$5 = (obj, member, msg) => {
810
- if (!member.has(obj))
811
- throw TypeError("Cannot " + msg);
812
- }, __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) => {
813
- if (member.has(obj))
814
- throw TypeError("Cannot add the same private member more than once");
815
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
816
- }, __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value), _client$4, _httpRequest$4;
817
792
  class ObservableAssetsClient {
793
+ #client;
794
+ #httpRequest;
818
795
  constructor(client, httpRequest) {
819
- __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);
796
+ this.#client = client, this.#httpRequest = httpRequest;
820
797
  }
821
798
  upload(assetType, body, options) {
822
- return _upload(__privateGet$5(this, _client$4), __privateGet$5(this, _httpRequest$4), assetType, body, options);
799
+ return _upload(this.#client, this.#httpRequest, assetType, body, options);
823
800
  }
824
801
  }
825
- _client$4 = /* @__PURE__ */ new WeakMap(), _httpRequest$4 = /* @__PURE__ */ new WeakMap();
826
- var _client2$3, _httpRequest2$4;
827
802
  class AssetsClient {
803
+ #client;
804
+ #httpRequest;
828
805
  constructor(client, httpRequest) {
829
- __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);
806
+ this.#client = client, this.#httpRequest = httpRequest;
830
807
  }
831
808
  upload(assetType, body, options) {
832
- const observable = _upload(__privateGet$5(this, _client2$3), __privateGet$5(this, _httpRequest2$4), assetType, body, options);
809
+ const observable = _upload(this.#client, this.#httpRequest, assetType, body, options);
833
810
  return rxjs.lastValueFrom(
834
811
  observable.pipe(
835
812
  operators.filter((event) => event.type === "response"),
@@ -840,7 +817,6 @@ class AssetsClient {
840
817
  );
841
818
  }
842
819
  }
843
- _client2$3 = /* @__PURE__ */ new WeakMap(), _httpRequest2$4 = /* @__PURE__ */ new WeakMap();
844
820
  function _upload(client, httpRequest, assetType, body, opts = {}) {
845
821
  validateAssetType(assetType);
846
822
  let meta = opts.extract || void 0;
@@ -876,6 +852,7 @@ var defaults = (obj, defaults2) => Object.keys(defaults2).concat(Object.keys(obj
876
852
  const pick = (obj, props) => props.reduce((selection, prop) => (typeof obj[prop] > "u" || (selection[prop] = obj[prop]), selection), {}), MAX_URL_LENGTH = 14800, possibleOptions = [
877
853
  "includePreviousRevision",
878
854
  "includeResult",
855
+ "includeMutations",
879
856
  "visibility",
880
857
  "effectFormat",
881
858
  "tag"
@@ -948,30 +925,22 @@ function cooerceError(err) {
948
925
  function extractErrorMessage(err) {
949
926
  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";
950
927
  }
951
- var __accessCheck$4 = (obj, member, msg) => {
952
- if (!member.has(obj))
953
- throw TypeError("Cannot " + msg);
954
- }, __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) => {
955
- if (member.has(obj))
956
- throw TypeError("Cannot add the same private member more than once");
957
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
958
- }, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
959
928
  const requiredApiVersion = "2021-03-26";
960
- var _client$3;
961
929
  class LiveClient {
930
+ #client;
962
931
  constructor(client) {
963
- __privateAdd$4(this, _client$3, void 0), __privateSet$4(this, _client$3, client);
932
+ this.#client = client;
964
933
  }
965
934
  /**
966
935
  * Requires `apiVersion` to be `2021-03-26` or later.
967
936
  */
968
937
  events() {
969
- const apiVersion = __privateGet$4(this, _client$3).config().apiVersion.replace(/^v/, "");
938
+ const apiVersion = this.#client.config().apiVersion.replace(/^v/, "");
970
939
  if (apiVersion !== "X" && apiVersion < requiredApiVersion)
971
940
  throw new Error(
972
941
  `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.`
973
942
  );
974
- const path = _getDataUrl(__privateGet$4(this, _client$3), "live/events"), url = new URL(__privateGet$4(this, _client$3).getUrl(path, !1)), listenFor = ["restart", "message"];
943
+ const path = _getDataUrl(this.#client, "live/events"), url = new URL(this.#client.getUrl(path, !1)), listenFor = ["restart", "message"];
975
944
  return new rxjs.Observable((observer) => {
976
945
  let es, reconnectTimer, stopped = !1, unsubscribed = !1;
977
946
  open();
@@ -1020,7 +989,6 @@ class LiveClient {
1020
989
  });
1021
990
  }
1022
991
  }
1023
- _client$3 = /* @__PURE__ */ new WeakMap();
1024
992
  function parseEvent(event) {
1025
993
  try {
1026
994
  const data = event.data && JSON.parse(event.data) || {};
@@ -1029,17 +997,11 @@ function parseEvent(event) {
1029
997
  return err;
1030
998
  }
1031
999
  }
1032
- var __accessCheck$3 = (obj, member, msg) => {
1033
- if (!member.has(obj))
1034
- throw TypeError("Cannot " + msg);
1035
- }, __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) => {
1036
- if (member.has(obj))
1037
- throw TypeError("Cannot add the same private member more than once");
1038
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1039
- }, __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value), _client$2, _httpRequest$3;
1040
1000
  class ObservableDatasetsClient {
1001
+ #client;
1002
+ #httpRequest;
1041
1003
  constructor(client, httpRequest) {
1042
- __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);
1004
+ this.#client = client, this.#httpRequest = httpRequest;
1043
1005
  }
1044
1006
  /**
1045
1007
  * Create a new dataset with the given name
@@ -1048,7 +1010,7 @@ class ObservableDatasetsClient {
1048
1010
  * @param options - Options for the dataset
1049
1011
  */
1050
1012
  create(name, options) {
1051
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PUT", name, options);
1013
+ return _modify(this.#client, this.#httpRequest, "PUT", name, options);
1052
1014
  }
1053
1015
  /**
1054
1016
  * Edit a dataset with the given name
@@ -1057,7 +1019,7 @@ class ObservableDatasetsClient {
1057
1019
  * @param options - New options for the dataset
1058
1020
  */
1059
1021
  edit(name, options) {
1060
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PATCH", name, options);
1022
+ return _modify(this.#client, this.#httpRequest, "PATCH", name, options);
1061
1023
  }
1062
1024
  /**
1063
1025
  * Delete a dataset with the given name
@@ -1065,23 +1027,23 @@ class ObservableDatasetsClient {
1065
1027
  * @param name - Name of the dataset to delete
1066
1028
  */
1067
1029
  delete(name) {
1068
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "DELETE", name);
1030
+ return _modify(this.#client, this.#httpRequest, "DELETE", name);
1069
1031
  }
1070
1032
  /**
1071
1033
  * Fetch a list of datasets for the configured project
1072
1034
  */
1073
1035
  list() {
1074
- return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
1036
+ return _request(this.#client, this.#httpRequest, {
1075
1037
  uri: "/datasets",
1076
1038
  tag: null
1077
1039
  });
1078
1040
  }
1079
1041
  }
1080
- _client$2 = /* @__PURE__ */ new WeakMap(), _httpRequest$3 = /* @__PURE__ */ new WeakMap();
1081
- var _client2$2, _httpRequest2$3;
1082
1042
  class DatasetsClient {
1043
+ #client;
1044
+ #httpRequest;
1083
1045
  constructor(client, httpRequest) {
1084
- __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);
1046
+ this.#client = client, this.#httpRequest = httpRequest;
1085
1047
  }
1086
1048
  /**
1087
1049
  * Create a new dataset with the given name
@@ -1091,7 +1053,7 @@ class DatasetsClient {
1091
1053
  */
1092
1054
  create(name, options) {
1093
1055
  return rxjs.lastValueFrom(
1094
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PUT", name, options)
1056
+ _modify(this.#client, this.#httpRequest, "PUT", name, options)
1095
1057
  );
1096
1058
  }
1097
1059
  /**
@@ -1102,7 +1064,7 @@ class DatasetsClient {
1102
1064
  */
1103
1065
  edit(name, options) {
1104
1066
  return rxjs.lastValueFrom(
1105
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PATCH", name, options)
1067
+ _modify(this.#client, this.#httpRequest, "PATCH", name, options)
1106
1068
  );
1107
1069
  }
1108
1070
  /**
@@ -1111,18 +1073,17 @@ class DatasetsClient {
1111
1073
  * @param name - Name of the dataset to delete
1112
1074
  */
1113
1075
  delete(name) {
1114
- return rxjs.lastValueFrom(_modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "DELETE", name));
1076
+ return rxjs.lastValueFrom(_modify(this.#client, this.#httpRequest, "DELETE", name));
1115
1077
  }
1116
1078
  /**
1117
1079
  * Fetch a list of datasets for the configured project
1118
1080
  */
1119
1081
  list() {
1120
1082
  return rxjs.lastValueFrom(
1121
- _request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), { uri: "/datasets", tag: null })
1083
+ _request(this.#client, this.#httpRequest, { uri: "/datasets", tag: null })
1122
1084
  );
1123
1085
  }
1124
1086
  }
1125
- _client2$2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$3 = /* @__PURE__ */ new WeakMap();
1126
1087
  function _modify(client, httpRequest, method, name, options) {
1127
1088
  return dataset(name), _request(client, httpRequest, {
1128
1089
  method,
@@ -1131,21 +1092,15 @@ function _modify(client, httpRequest, method, name, options) {
1131
1092
  tag: null
1132
1093
  });
1133
1094
  }
1134
- var __accessCheck$2 = (obj, member, msg) => {
1135
- if (!member.has(obj))
1136
- throw TypeError("Cannot " + msg);
1137
- }, __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) => {
1138
- if (member.has(obj))
1139
- throw TypeError("Cannot add the same private member more than once");
1140
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1141
- }, __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value), _client$1, _httpRequest$2;
1142
1095
  class ObservableProjectsClient {
1096
+ #client;
1097
+ #httpRequest;
1143
1098
  constructor(client, httpRequest) {
1144
- __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);
1099
+ this.#client = client, this.#httpRequest = httpRequest;
1145
1100
  }
1146
1101
  list(options) {
1147
- const uri = (options == null ? void 0 : options.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
1148
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri });
1102
+ const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1103
+ return _request(this.#client, this.#httpRequest, { uri });
1149
1104
  }
1150
1105
  /**
1151
1106
  * Fetch a project by project ID
@@ -1153,18 +1108,18 @@ class ObservableProjectsClient {
1153
1108
  * @param projectId - ID of the project to fetch
1154
1109
  */
1155
1110
  getById(projectId2) {
1156
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri: `/projects/${projectId2}` });
1111
+ return _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId2}` });
1157
1112
  }
1158
1113
  }
1159
- _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */ new WeakMap();
1160
- var _client2$1, _httpRequest2$2;
1161
1114
  class ProjectsClient {
1115
+ #client;
1116
+ #httpRequest;
1162
1117
  constructor(client, httpRequest) {
1163
- __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);
1118
+ this.#client = client, this.#httpRequest = httpRequest;
1164
1119
  }
1165
1120
  list(options) {
1166
- const uri = (options == null ? void 0 : options.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
1167
- return rxjs.lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri }));
1121
+ const uri = options?.includeMembers === !1 ? "/projects?includeMembers=false" : "/projects";
1122
+ return rxjs.lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
1168
1123
  }
1169
1124
  /**
1170
1125
  * Fetch a project by project ID
@@ -1173,22 +1128,15 @@ class ProjectsClient {
1173
1128
  */
1174
1129
  getById(projectId2) {
1175
1130
  return rxjs.lastValueFrom(
1176
- _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: `/projects/${projectId2}` })
1131
+ _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId2}` })
1177
1132
  );
1178
1133
  }
1179
1134
  }
1180
- _client2$1 = /* @__PURE__ */ new WeakMap(), _httpRequest2$2 = /* @__PURE__ */ new WeakMap();
1181
- var __accessCheck$1 = (obj, member, msg) => {
1182
- if (!member.has(obj))
1183
- throw TypeError("Cannot " + msg);
1184
- }, __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) => {
1185
- if (member.has(obj))
1186
- throw TypeError("Cannot add the same private member more than once");
1187
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1188
- }, __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value), _client, _httpRequest$1;
1189
1135
  class ObservableUsersClient {
1136
+ #client;
1137
+ #httpRequest;
1190
1138
  constructor(client, httpRequest) {
1191
- __privateAdd$1(this, _client, void 0), __privateAdd$1(this, _httpRequest$1, void 0), __privateSet$1(this, _client, client), __privateSet$1(this, _httpRequest$1, httpRequest);
1139
+ this.#client = client, this.#httpRequest = httpRequest;
1192
1140
  }
1193
1141
  /**
1194
1142
  * Fetch a user by user ID
@@ -1197,17 +1145,17 @@ class ObservableUsersClient {
1197
1145
  */
1198
1146
  getById(id) {
1199
1147
  return _request(
1200
- __privateGet$1(this, _client),
1201
- __privateGet$1(this, _httpRequest$1),
1148
+ this.#client,
1149
+ this.#httpRequest,
1202
1150
  { uri: `/users/${id}` }
1203
1151
  );
1204
1152
  }
1205
1153
  }
1206
- _client = /* @__PURE__ */ new WeakMap(), _httpRequest$1 = /* @__PURE__ */ new WeakMap();
1207
- var _client2, _httpRequest2$1;
1208
1154
  class UsersClient {
1155
+ #client;
1156
+ #httpRequest;
1209
1157
  constructor(client, httpRequest) {
1210
- __privateAdd$1(this, _client2, void 0), __privateAdd$1(this, _httpRequest2$1, void 0), __privateSet$1(this, _client2, client), __privateSet$1(this, _httpRequest2$1, httpRequest);
1158
+ this.#client = client, this.#httpRequest = httpRequest;
1211
1159
  }
1212
1160
  /**
1213
1161
  * Fetch a user by user ID
@@ -1216,39 +1164,44 @@ class UsersClient {
1216
1164
  */
1217
1165
  getById(id) {
1218
1166
  return rxjs.lastValueFrom(
1219
- _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {
1167
+ _request(this.#client, this.#httpRequest, {
1220
1168
  uri: `/users/${id}`
1221
1169
  })
1222
1170
  );
1223
1171
  }
1224
1172
  }
1225
- _client2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$1 = /* @__PURE__ */ new WeakMap();
1226
- var __defProp2 = Object.defineProperty, __defNormalProp = (obj, key, value) => key in obj ? __defProp2(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) => {
1227
- if (!member.has(obj))
1228
- throw TypeError("Cannot " + msg);
1229
- }, __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => {
1230
- if (member.has(obj))
1231
- throw TypeError("Cannot add the same private member more than once");
1232
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1233
- }, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value), _clientConfig, _httpRequest;
1234
- const _ObservableSanityClient = class _ObservableSanityClient2 {
1173
+ class ObservableSanityClient {
1174
+ assets;
1175
+ datasets;
1176
+ live;
1177
+ projects;
1178
+ users;
1179
+ /**
1180
+ * Private properties
1181
+ */
1182
+ #clientConfig;
1183
+ #httpRequest;
1184
+ /**
1185
+ * Instance properties
1186
+ */
1187
+ listen = _listen;
1235
1188
  constructor(httpRequest, config = defaultConfig) {
1236
- __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));
1189
+ 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);
1237
1190
  }
1238
1191
  /**
1239
1192
  * Clone the client - returns a new instance
1240
1193
  */
1241
1194
  clone() {
1242
- return new _ObservableSanityClient2(__privateGet(this, _httpRequest), this.config());
1195
+ return new ObservableSanityClient(this.#httpRequest, this.config());
1243
1196
  }
1244
1197
  config(newConfig) {
1245
1198
  if (newConfig === void 0)
1246
- return { ...__privateGet(this, _clientConfig) };
1247
- if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === !1)
1199
+ return { ...this.#clientConfig };
1200
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === !1)
1248
1201
  throw new Error(
1249
1202
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1250
1203
  );
1251
- return __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {})), this;
1204
+ return this.#clientConfig = initConfig(newConfig, this.#clientConfig || {}), this;
1252
1205
  }
1253
1206
  /**
1254
1207
  * Clone the client with a new (partial) configuration.
@@ -1257,20 +1210,20 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1257
1210
  */
1258
1211
  withConfig(newConfig) {
1259
1212
  const thisConfig = this.config();
1260
- return new _ObservableSanityClient2(__privateGet(this, _httpRequest), {
1213
+ return new ObservableSanityClient(this.#httpRequest, {
1261
1214
  ...thisConfig,
1262
1215
  ...newConfig,
1263
1216
  stega: {
1264
1217
  ...thisConfig.stega || {},
1265
- ...typeof (newConfig == null ? void 0 : newConfig.stega) == "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}
1218
+ ...typeof newConfig?.stega == "boolean" ? { enabled: newConfig.stega } : newConfig?.stega || {}
1266
1219
  }
1267
1220
  });
1268
1221
  }
1269
1222
  fetch(query, params, options) {
1270
1223
  return _fetch(
1271
1224
  this,
1272
- __privateGet(this, _httpRequest),
1273
- __privateGet(this, _clientConfig).stega,
1225
+ this.#httpRequest,
1226
+ this.#clientConfig.stega,
1274
1227
  query,
1275
1228
  params,
1276
1229
  options
@@ -1283,7 +1236,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1283
1236
  * @param options - Request options
1284
1237
  */
1285
1238
  getDocument(id, options) {
1286
- return _getDocument(this, __privateGet(this, _httpRequest), id, options);
1239
+ return _getDocument(this, this.#httpRequest, id, options);
1287
1240
  }
1288
1241
  /**
1289
1242
  * Fetch multiple documents in one request.
@@ -1295,22 +1248,22 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1295
1248
  * @param options - Request options
1296
1249
  */
1297
1250
  getDocuments(ids, options) {
1298
- return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);
1251
+ return _getDocuments(this, this.#httpRequest, ids, options);
1299
1252
  }
1300
1253
  create(document, options) {
1301
- return _create(this, __privateGet(this, _httpRequest), document, "create", options);
1254
+ return _create(this, this.#httpRequest, document, "create", options);
1302
1255
  }
1303
1256
  createIfNotExists(document, options) {
1304
- return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);
1257
+ return _createIfNotExists(this, this.#httpRequest, document, options);
1305
1258
  }
1306
1259
  createOrReplace(document, options) {
1307
- return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);
1260
+ return _createOrReplace(this, this.#httpRequest, document, options);
1308
1261
  }
1309
1262
  delete(selection, options) {
1310
- return _delete(this, __privateGet(this, _httpRequest), selection, options);
1263
+ return _delete(this, this.#httpRequest, selection, options);
1311
1264
  }
1312
1265
  mutate(operations, options) {
1313
- return _mutate(this, __privateGet(this, _httpRequest), operations, options);
1266
+ return _mutate(this, this.#httpRequest, operations, options);
1314
1267
  }
1315
1268
  /**
1316
1269
  * Create a new buildable patch of operations to perform
@@ -1337,7 +1290,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1337
1290
  * @param options - Action options
1338
1291
  */
1339
1292
  action(operations, options) {
1340
- return _action(this, __privateGet(this, _httpRequest), operations, options);
1293
+ return _action(this, this.#httpRequest, operations, options);
1341
1294
  }
1342
1295
  /**
1343
1296
  * Perform an HTTP request against the Sanity API
@@ -1345,7 +1298,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1345
1298
  * @param options - Request options
1346
1299
  */
1347
1300
  request(options) {
1348
- return _request(this, __privateGet(this, _httpRequest), options);
1301
+ return _request(this, this.#httpRequest, options);
1349
1302
  }
1350
1303
  /**
1351
1304
  * Get a Sanity API URL for the URI provided
@@ -1365,28 +1318,43 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1365
1318
  getDataUrl(operation, path) {
1366
1319
  return _getDataUrl(this, operation, path);
1367
1320
  }
1368
- };
1369
- _clientConfig = /* @__PURE__ */ new WeakMap(), _httpRequest = /* @__PURE__ */ new WeakMap();
1370
- let ObservableSanityClient = _ObservableSanityClient;
1371
- var _clientConfig2, _httpRequest2;
1372
- const _SanityClient = class _SanityClient2 {
1321
+ }
1322
+ class SanityClient {
1323
+ assets;
1324
+ datasets;
1325
+ live;
1326
+ projects;
1327
+ users;
1328
+ /**
1329
+ * Observable version of the Sanity client, with the same configuration as the promise-based one
1330
+ */
1331
+ observable;
1332
+ /**
1333
+ * Private properties
1334
+ */
1335
+ #clientConfig;
1336
+ #httpRequest;
1337
+ /**
1338
+ * Instance properties
1339
+ */
1340
+ listen = _listen;
1373
1341
  constructor(httpRequest, config = defaultConfig) {
1374
- __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);
1342
+ 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);
1375
1343
  }
1376
1344
  /**
1377
1345
  * Clone the client - returns a new instance
1378
1346
  */
1379
1347
  clone() {
1380
- return new _SanityClient2(__privateGet(this, _httpRequest2), this.config());
1348
+ return new SanityClient(this.#httpRequest, this.config());
1381
1349
  }
1382
1350
  config(newConfig) {
1383
1351
  if (newConfig === void 0)
1384
- return { ...__privateGet(this, _clientConfig2) };
1385
- if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === !1)
1352
+ return { ...this.#clientConfig };
1353
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === !1)
1386
1354
  throw new Error(
1387
1355
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1388
1356
  );
1389
- return this.observable && this.observable.config(newConfig), __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {})), this;
1357
+ return this.observable && this.observable.config(newConfig), this.#clientConfig = initConfig(newConfig, this.#clientConfig || {}), this;
1390
1358
  }
1391
1359
  /**
1392
1360
  * Clone the client with a new (partial) configuration.
@@ -1395,12 +1363,12 @@ const _SanityClient = class _SanityClient2 {
1395
1363
  */
1396
1364
  withConfig(newConfig) {
1397
1365
  const thisConfig = this.config();
1398
- return new _SanityClient2(__privateGet(this, _httpRequest2), {
1366
+ return new SanityClient(this.#httpRequest, {
1399
1367
  ...thisConfig,
1400
1368
  ...newConfig,
1401
1369
  stega: {
1402
1370
  ...thisConfig.stega || {},
1403
- ...typeof (newConfig == null ? void 0 : newConfig.stega) == "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}
1371
+ ...typeof newConfig?.stega == "boolean" ? { enabled: newConfig.stega } : newConfig?.stega || {}
1404
1372
  }
1405
1373
  });
1406
1374
  }
@@ -1408,8 +1376,8 @@ const _SanityClient = class _SanityClient2 {
1408
1376
  return rxjs.lastValueFrom(
1409
1377
  _fetch(
1410
1378
  this,
1411
- __privateGet(this, _httpRequest2),
1412
- __privateGet(this, _clientConfig2).stega,
1379
+ this.#httpRequest,
1380
+ this.#clientConfig.stega,
1413
1381
  query,
1414
1382
  params,
1415
1383
  options
@@ -1423,7 +1391,7 @@ const _SanityClient = class _SanityClient2 {
1423
1391
  * @param options - Request options
1424
1392
  */
1425
1393
  getDocument(id, options) {
1426
- return rxjs.lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));
1394
+ return rxjs.lastValueFrom(_getDocument(this, this.#httpRequest, id, options));
1427
1395
  }
1428
1396
  /**
1429
1397
  * Fetch multiple documents in one request.
@@ -1435,28 +1403,28 @@ const _SanityClient = class _SanityClient2 {
1435
1403
  * @param options - Request options
1436
1404
  */
1437
1405
  getDocuments(ids, options) {
1438
- return rxjs.lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));
1406
+ return rxjs.lastValueFrom(_getDocuments(this, this.#httpRequest, ids, options));
1439
1407
  }
1440
1408
  create(document, options) {
1441
1409
  return rxjs.lastValueFrom(
1442
- _create(this, __privateGet(this, _httpRequest2), document, "create", options)
1410
+ _create(this, this.#httpRequest, document, "create", options)
1443
1411
  );
1444
1412
  }
1445
1413
  createIfNotExists(document, options) {
1446
1414
  return rxjs.lastValueFrom(
1447
- _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)
1415
+ _createIfNotExists(this, this.#httpRequest, document, options)
1448
1416
  );
1449
1417
  }
1450
1418
  createOrReplace(document, options) {
1451
1419
  return rxjs.lastValueFrom(
1452
- _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)
1420
+ _createOrReplace(this, this.#httpRequest, document, options)
1453
1421
  );
1454
1422
  }
1455
1423
  delete(selection, options) {
1456
- return rxjs.lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));
1424
+ return rxjs.lastValueFrom(_delete(this, this.#httpRequest, selection, options));
1457
1425
  }
1458
1426
  mutate(operations, options) {
1459
- return rxjs.lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));
1427
+ return rxjs.lastValueFrom(_mutate(this, this.#httpRequest, operations, options));
1460
1428
  }
1461
1429
  /**
1462
1430
  * Create a new buildable patch of operations to perform
@@ -1484,7 +1452,7 @@ const _SanityClient = class _SanityClient2 {
1484
1452
  * @param options - Action options
1485
1453
  */
1486
1454
  action(operations, options) {
1487
- return rxjs.lastValueFrom(_action(this, __privateGet(this, _httpRequest2), operations, options));
1455
+ return rxjs.lastValueFrom(_action(this, this.#httpRequest, operations, options));
1488
1456
  }
1489
1457
  /**
1490
1458
  * Perform a request against the Sanity API
@@ -1494,7 +1462,7 @@ const _SanityClient = class _SanityClient2 {
1494
1462
  * @returns Promise resolving to the response body
1495
1463
  */
1496
1464
  request(options) {
1497
- return rxjs.lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));
1465
+ return rxjs.lastValueFrom(_request(this, this.#httpRequest, options));
1498
1466
  }
1499
1467
  /**
1500
1468
  * Perform an HTTP request a `/data` sub-endpoint
@@ -1507,7 +1475,7 @@ const _SanityClient = class _SanityClient2 {
1507
1475
  * @internal
1508
1476
  */
1509
1477
  dataRequest(endpoint, body, options) {
1510
- return rxjs.lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));
1478
+ return rxjs.lastValueFrom(_dataRequest(this, this.#httpRequest, endpoint, body, options));
1511
1479
  }
1512
1480
  /**
1513
1481
  * Get a Sanity API URL for the URI provided
@@ -1527,9 +1495,7 @@ const _SanityClient = class _SanityClient2 {
1527
1495
  getDataUrl(operation, path) {
1528
1496
  return _getDataUrl(this, operation, path);
1529
1497
  }
1530
- };
1531
- _clientConfig2 = /* @__PURE__ */ new WeakMap(), _httpRequest2 = /* @__PURE__ */ new WeakMap();
1532
- let SanityClient = _SanityClient;
1498
+ }
1533
1499
  function defineCreateClientExports(envMiddleware2, ClassConstructor) {
1534
1500
  const defaultRequester = defineHttpRequest(envMiddleware2);
1535
1501
  return { requester: defaultRequester, createClient: (config) => new ClassConstructor(