@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.
@@ -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;
@@ -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;
@@ -949,30 +925,22 @@ function cooerceError(err) {
949
925
  function extractErrorMessage(err) {
950
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";
951
927
  }
952
- var __accessCheck$4 = (obj, member, msg) => {
953
- if (!member.has(obj))
954
- throw TypeError("Cannot " + msg);
955
- }, __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) => {
956
- if (member.has(obj))
957
- throw TypeError("Cannot add the same private member more than once");
958
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
959
- }, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
960
928
  const requiredApiVersion = "2021-03-26";
961
- var _client$3;
962
929
  class LiveClient {
930
+ #client;
963
931
  constructor(client) {
964
- __privateAdd$4(this, _client$3, void 0), __privateSet$4(this, _client$3, client);
932
+ this.#client = client;
965
933
  }
966
934
  /**
967
935
  * Requires `apiVersion` to be `2021-03-26` or later.
968
936
  */
969
937
  events() {
970
- const apiVersion = __privateGet$4(this, _client$3).config().apiVersion.replace(/^v/, "");
938
+ const apiVersion = this.#client.config().apiVersion.replace(/^v/, "");
971
939
  if (apiVersion !== "X" && apiVersion < requiredApiVersion)
972
940
  throw new Error(
973
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.`
974
942
  );
975
- 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"];
976
944
  return new rxjs.Observable((observer) => {
977
945
  let es, reconnectTimer, stopped = !1, unsubscribed = !1;
978
946
  open();
@@ -1021,7 +989,6 @@ class LiveClient {
1021
989
  });
1022
990
  }
1023
991
  }
1024
- _client$3 = /* @__PURE__ */ new WeakMap();
1025
992
  function parseEvent(event) {
1026
993
  try {
1027
994
  const data = event.data && JSON.parse(event.data) || {};
@@ -1030,17 +997,11 @@ function parseEvent(event) {
1030
997
  return err;
1031
998
  }
1032
999
  }
1033
- var __accessCheck$3 = (obj, member, msg) => {
1034
- if (!member.has(obj))
1035
- throw TypeError("Cannot " + msg);
1036
- }, __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) => {
1037
- if (member.has(obj))
1038
- throw TypeError("Cannot add the same private member more than once");
1039
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1040
- }, __privateSet$3 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value), _client$2, _httpRequest$3;
1041
1000
  class ObservableDatasetsClient {
1001
+ #client;
1002
+ #httpRequest;
1042
1003
  constructor(client, httpRequest) {
1043
- __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;
1044
1005
  }
1045
1006
  /**
1046
1007
  * Create a new dataset with the given name
@@ -1049,7 +1010,7 @@ class ObservableDatasetsClient {
1049
1010
  * @param options - Options for the dataset
1050
1011
  */
1051
1012
  create(name, options) {
1052
- 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);
1053
1014
  }
1054
1015
  /**
1055
1016
  * Edit a dataset with the given name
@@ -1058,7 +1019,7 @@ class ObservableDatasetsClient {
1058
1019
  * @param options - New options for the dataset
1059
1020
  */
1060
1021
  edit(name, options) {
1061
- 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);
1062
1023
  }
1063
1024
  /**
1064
1025
  * Delete a dataset with the given name
@@ -1066,23 +1027,23 @@ class ObservableDatasetsClient {
1066
1027
  * @param name - Name of the dataset to delete
1067
1028
  */
1068
1029
  delete(name) {
1069
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "DELETE", name);
1030
+ return _modify(this.#client, this.#httpRequest, "DELETE", name);
1070
1031
  }
1071
1032
  /**
1072
1033
  * Fetch a list of datasets for the configured project
1073
1034
  */
1074
1035
  list() {
1075
- return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
1036
+ return _request(this.#client, this.#httpRequest, {
1076
1037
  uri: "/datasets",
1077
1038
  tag: null
1078
1039
  });
1079
1040
  }
1080
1041
  }
1081
- _client$2 = /* @__PURE__ */ new WeakMap(), _httpRequest$3 = /* @__PURE__ */ new WeakMap();
1082
- var _client2$2, _httpRequest2$3;
1083
1042
  class DatasetsClient {
1043
+ #client;
1044
+ #httpRequest;
1084
1045
  constructor(client, httpRequest) {
1085
- __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;
1086
1047
  }
1087
1048
  /**
1088
1049
  * Create a new dataset with the given name
@@ -1092,7 +1053,7 @@ class DatasetsClient {
1092
1053
  */
1093
1054
  create(name, options) {
1094
1055
  return rxjs.lastValueFrom(
1095
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PUT", name, options)
1056
+ _modify(this.#client, this.#httpRequest, "PUT", name, options)
1096
1057
  );
1097
1058
  }
1098
1059
  /**
@@ -1103,7 +1064,7 @@ class DatasetsClient {
1103
1064
  */
1104
1065
  edit(name, options) {
1105
1066
  return rxjs.lastValueFrom(
1106
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PATCH", name, options)
1067
+ _modify(this.#client, this.#httpRequest, "PATCH", name, options)
1107
1068
  );
1108
1069
  }
1109
1070
  /**
@@ -1112,18 +1073,17 @@ class DatasetsClient {
1112
1073
  * @param name - Name of the dataset to delete
1113
1074
  */
1114
1075
  delete(name) {
1115
- 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));
1116
1077
  }
1117
1078
  /**
1118
1079
  * Fetch a list of datasets for the configured project
1119
1080
  */
1120
1081
  list() {
1121
1082
  return rxjs.lastValueFrom(
1122
- _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 })
1123
1084
  );
1124
1085
  }
1125
1086
  }
1126
- _client2$2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$3 = /* @__PURE__ */ new WeakMap();
1127
1087
  function _modify(client, httpRequest, method, name, options) {
1128
1088
  return dataset(name), _request(client, httpRequest, {
1129
1089
  method,
@@ -1132,21 +1092,15 @@ function _modify(client, httpRequest, method, name, options) {
1132
1092
  tag: null
1133
1093
  });
1134
1094
  }
1135
- var __accessCheck$2 = (obj, member, msg) => {
1136
- if (!member.has(obj))
1137
- throw TypeError("Cannot " + msg);
1138
- }, __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) => {
1139
- if (member.has(obj))
1140
- throw TypeError("Cannot add the same private member more than once");
1141
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1142
- }, __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value), _client$1, _httpRequest$2;
1143
1095
  class ObservableProjectsClient {
1096
+ #client;
1097
+ #httpRequest;
1144
1098
  constructor(client, httpRequest) {
1145
- __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;
1146
1100
  }
1147
1101
  list(options) {
1148
- const uri = (options == null ? void 0 : options.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
1149
- 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 });
1150
1104
  }
1151
1105
  /**
1152
1106
  * Fetch a project by project ID
@@ -1154,18 +1108,18 @@ class ObservableProjectsClient {
1154
1108
  * @param projectId - ID of the project to fetch
1155
1109
  */
1156
1110
  getById(projectId2) {
1157
- 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}` });
1158
1112
  }
1159
1113
  }
1160
- _client$1 = /* @__PURE__ */ new WeakMap(), _httpRequest$2 = /* @__PURE__ */ new WeakMap();
1161
- var _client2$1, _httpRequest2$2;
1162
1114
  class ProjectsClient {
1115
+ #client;
1116
+ #httpRequest;
1163
1117
  constructor(client, httpRequest) {
1164
- __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;
1165
1119
  }
1166
1120
  list(options) {
1167
- const uri = (options == null ? void 0 : options.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
1168
- 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 }));
1169
1123
  }
1170
1124
  /**
1171
1125
  * Fetch a project by project ID
@@ -1174,22 +1128,15 @@ class ProjectsClient {
1174
1128
  */
1175
1129
  getById(projectId2) {
1176
1130
  return rxjs.lastValueFrom(
1177
- _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: `/projects/${projectId2}` })
1131
+ _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId2}` })
1178
1132
  );
1179
1133
  }
1180
1134
  }
1181
- _client2$1 = /* @__PURE__ */ new WeakMap(), _httpRequest2$2 = /* @__PURE__ */ new WeakMap();
1182
- var __accessCheck$1 = (obj, member, msg) => {
1183
- if (!member.has(obj))
1184
- throw TypeError("Cannot " + msg);
1185
- }, __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) => {
1186
- if (member.has(obj))
1187
- throw TypeError("Cannot add the same private member more than once");
1188
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1189
- }, __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value), _client, _httpRequest$1;
1190
1135
  class ObservableUsersClient {
1136
+ #client;
1137
+ #httpRequest;
1191
1138
  constructor(client, httpRequest) {
1192
- __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;
1193
1140
  }
1194
1141
  /**
1195
1142
  * Fetch a user by user ID
@@ -1198,17 +1145,17 @@ class ObservableUsersClient {
1198
1145
  */
1199
1146
  getById(id) {
1200
1147
  return _request(
1201
- __privateGet$1(this, _client),
1202
- __privateGet$1(this, _httpRequest$1),
1148
+ this.#client,
1149
+ this.#httpRequest,
1203
1150
  { uri: `/users/${id}` }
1204
1151
  );
1205
1152
  }
1206
1153
  }
1207
- _client = /* @__PURE__ */ new WeakMap(), _httpRequest$1 = /* @__PURE__ */ new WeakMap();
1208
- var _client2, _httpRequest2$1;
1209
1154
  class UsersClient {
1155
+ #client;
1156
+ #httpRequest;
1210
1157
  constructor(client, httpRequest) {
1211
- __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;
1212
1159
  }
1213
1160
  /**
1214
1161
  * Fetch a user by user ID
@@ -1217,39 +1164,44 @@ class UsersClient {
1217
1164
  */
1218
1165
  getById(id) {
1219
1166
  return rxjs.lastValueFrom(
1220
- _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {
1167
+ _request(this.#client, this.#httpRequest, {
1221
1168
  uri: `/users/${id}`
1222
1169
  })
1223
1170
  );
1224
1171
  }
1225
1172
  }
1226
- _client2 = /* @__PURE__ */ new WeakMap(), _httpRequest2$1 = /* @__PURE__ */ new WeakMap();
1227
- 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) => {
1228
- if (!member.has(obj))
1229
- throw TypeError("Cannot " + msg);
1230
- }, __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => {
1231
- if (member.has(obj))
1232
- throw TypeError("Cannot add the same private member more than once");
1233
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1234
- }, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value), _clientConfig, _httpRequest;
1235
- 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;
1236
1188
  constructor(httpRequest, config = defaultConfig) {
1237
- __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);
1238
1190
  }
1239
1191
  /**
1240
1192
  * Clone the client - returns a new instance
1241
1193
  */
1242
1194
  clone() {
1243
- return new _ObservableSanityClient2(__privateGet(this, _httpRequest), this.config());
1195
+ return new ObservableSanityClient(this.#httpRequest, this.config());
1244
1196
  }
1245
1197
  config(newConfig) {
1246
1198
  if (newConfig === void 0)
1247
- return { ...__privateGet(this, _clientConfig) };
1248
- if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === !1)
1199
+ return { ...this.#clientConfig };
1200
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === !1)
1249
1201
  throw new Error(
1250
1202
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1251
1203
  );
1252
- return __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {})), this;
1204
+ return this.#clientConfig = initConfig(newConfig, this.#clientConfig || {}), this;
1253
1205
  }
1254
1206
  /**
1255
1207
  * Clone the client with a new (partial) configuration.
@@ -1258,20 +1210,20 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1258
1210
  */
1259
1211
  withConfig(newConfig) {
1260
1212
  const thisConfig = this.config();
1261
- return new _ObservableSanityClient2(__privateGet(this, _httpRequest), {
1213
+ return new ObservableSanityClient(this.#httpRequest, {
1262
1214
  ...thisConfig,
1263
1215
  ...newConfig,
1264
1216
  stega: {
1265
1217
  ...thisConfig.stega || {},
1266
- ...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 || {}
1267
1219
  }
1268
1220
  });
1269
1221
  }
1270
1222
  fetch(query, params, options) {
1271
1223
  return _fetch(
1272
1224
  this,
1273
- __privateGet(this, _httpRequest),
1274
- __privateGet(this, _clientConfig).stega,
1225
+ this.#httpRequest,
1226
+ this.#clientConfig.stega,
1275
1227
  query,
1276
1228
  params,
1277
1229
  options
@@ -1284,7 +1236,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1284
1236
  * @param options - Request options
1285
1237
  */
1286
1238
  getDocument(id, options) {
1287
- return _getDocument(this, __privateGet(this, _httpRequest), id, options);
1239
+ return _getDocument(this, this.#httpRequest, id, options);
1288
1240
  }
1289
1241
  /**
1290
1242
  * Fetch multiple documents in one request.
@@ -1296,22 +1248,22 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1296
1248
  * @param options - Request options
1297
1249
  */
1298
1250
  getDocuments(ids, options) {
1299
- return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);
1251
+ return _getDocuments(this, this.#httpRequest, ids, options);
1300
1252
  }
1301
1253
  create(document, options) {
1302
- return _create(this, __privateGet(this, _httpRequest), document, "create", options);
1254
+ return _create(this, this.#httpRequest, document, "create", options);
1303
1255
  }
1304
1256
  createIfNotExists(document, options) {
1305
- return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);
1257
+ return _createIfNotExists(this, this.#httpRequest, document, options);
1306
1258
  }
1307
1259
  createOrReplace(document, options) {
1308
- return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);
1260
+ return _createOrReplace(this, this.#httpRequest, document, options);
1309
1261
  }
1310
1262
  delete(selection, options) {
1311
- return _delete(this, __privateGet(this, _httpRequest), selection, options);
1263
+ return _delete(this, this.#httpRequest, selection, options);
1312
1264
  }
1313
1265
  mutate(operations, options) {
1314
- return _mutate(this, __privateGet(this, _httpRequest), operations, options);
1266
+ return _mutate(this, this.#httpRequest, operations, options);
1315
1267
  }
1316
1268
  /**
1317
1269
  * Create a new buildable patch of operations to perform
@@ -1338,7 +1290,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1338
1290
  * @param options - Action options
1339
1291
  */
1340
1292
  action(operations, options) {
1341
- return _action(this, __privateGet(this, _httpRequest), operations, options);
1293
+ return _action(this, this.#httpRequest, operations, options);
1342
1294
  }
1343
1295
  /**
1344
1296
  * Perform an HTTP request against the Sanity API
@@ -1346,7 +1298,7 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1346
1298
  * @param options - Request options
1347
1299
  */
1348
1300
  request(options) {
1349
- return _request(this, __privateGet(this, _httpRequest), options);
1301
+ return _request(this, this.#httpRequest, options);
1350
1302
  }
1351
1303
  /**
1352
1304
  * Get a Sanity API URL for the URI provided
@@ -1366,28 +1318,43 @@ const _ObservableSanityClient = class _ObservableSanityClient2 {
1366
1318
  getDataUrl(operation, path) {
1367
1319
  return _getDataUrl(this, operation, path);
1368
1320
  }
1369
- };
1370
- _clientConfig = /* @__PURE__ */ new WeakMap(), _httpRequest = /* @__PURE__ */ new WeakMap();
1371
- let ObservableSanityClient = _ObservableSanityClient;
1372
- var _clientConfig2, _httpRequest2;
1373
- 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;
1374
1341
  constructor(httpRequest, config = defaultConfig) {
1375
- __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);
1376
1343
  }
1377
1344
  /**
1378
1345
  * Clone the client - returns a new instance
1379
1346
  */
1380
1347
  clone() {
1381
- return new _SanityClient2(__privateGet(this, _httpRequest2), this.config());
1348
+ return new SanityClient(this.#httpRequest, this.config());
1382
1349
  }
1383
1350
  config(newConfig) {
1384
1351
  if (newConfig === void 0)
1385
- return { ...__privateGet(this, _clientConfig2) };
1386
- if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === !1)
1352
+ return { ...this.#clientConfig };
1353
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === !1)
1387
1354
  throw new Error(
1388
1355
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1389
1356
  );
1390
- 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;
1391
1358
  }
1392
1359
  /**
1393
1360
  * Clone the client with a new (partial) configuration.
@@ -1396,12 +1363,12 @@ const _SanityClient = class _SanityClient2 {
1396
1363
  */
1397
1364
  withConfig(newConfig) {
1398
1365
  const thisConfig = this.config();
1399
- return new _SanityClient2(__privateGet(this, _httpRequest2), {
1366
+ return new SanityClient(this.#httpRequest, {
1400
1367
  ...thisConfig,
1401
1368
  ...newConfig,
1402
1369
  stega: {
1403
1370
  ...thisConfig.stega || {},
1404
- ...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 || {}
1405
1372
  }
1406
1373
  });
1407
1374
  }
@@ -1409,8 +1376,8 @@ const _SanityClient = class _SanityClient2 {
1409
1376
  return rxjs.lastValueFrom(
1410
1377
  _fetch(
1411
1378
  this,
1412
- __privateGet(this, _httpRequest2),
1413
- __privateGet(this, _clientConfig2).stega,
1379
+ this.#httpRequest,
1380
+ this.#clientConfig.stega,
1414
1381
  query,
1415
1382
  params,
1416
1383
  options
@@ -1424,7 +1391,7 @@ const _SanityClient = class _SanityClient2 {
1424
1391
  * @param options - Request options
1425
1392
  */
1426
1393
  getDocument(id, options) {
1427
- return rxjs.lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));
1394
+ return rxjs.lastValueFrom(_getDocument(this, this.#httpRequest, id, options));
1428
1395
  }
1429
1396
  /**
1430
1397
  * Fetch multiple documents in one request.
@@ -1436,28 +1403,28 @@ const _SanityClient = class _SanityClient2 {
1436
1403
  * @param options - Request options
1437
1404
  */
1438
1405
  getDocuments(ids, options) {
1439
- return rxjs.lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));
1406
+ return rxjs.lastValueFrom(_getDocuments(this, this.#httpRequest, ids, options));
1440
1407
  }
1441
1408
  create(document, options) {
1442
1409
  return rxjs.lastValueFrom(
1443
- _create(this, __privateGet(this, _httpRequest2), document, "create", options)
1410
+ _create(this, this.#httpRequest, document, "create", options)
1444
1411
  );
1445
1412
  }
1446
1413
  createIfNotExists(document, options) {
1447
1414
  return rxjs.lastValueFrom(
1448
- _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)
1415
+ _createIfNotExists(this, this.#httpRequest, document, options)
1449
1416
  );
1450
1417
  }
1451
1418
  createOrReplace(document, options) {
1452
1419
  return rxjs.lastValueFrom(
1453
- _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)
1420
+ _createOrReplace(this, this.#httpRequest, document, options)
1454
1421
  );
1455
1422
  }
1456
1423
  delete(selection, options) {
1457
- return rxjs.lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));
1424
+ return rxjs.lastValueFrom(_delete(this, this.#httpRequest, selection, options));
1458
1425
  }
1459
1426
  mutate(operations, options) {
1460
- return rxjs.lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));
1427
+ return rxjs.lastValueFrom(_mutate(this, this.#httpRequest, operations, options));
1461
1428
  }
1462
1429
  /**
1463
1430
  * Create a new buildable patch of operations to perform
@@ -1485,7 +1452,7 @@ const _SanityClient = class _SanityClient2 {
1485
1452
  * @param options - Action options
1486
1453
  */
1487
1454
  action(operations, options) {
1488
- return rxjs.lastValueFrom(_action(this, __privateGet(this, _httpRequest2), operations, options));
1455
+ return rxjs.lastValueFrom(_action(this, this.#httpRequest, operations, options));
1489
1456
  }
1490
1457
  /**
1491
1458
  * Perform a request against the Sanity API
@@ -1495,7 +1462,7 @@ const _SanityClient = class _SanityClient2 {
1495
1462
  * @returns Promise resolving to the response body
1496
1463
  */
1497
1464
  request(options) {
1498
- return rxjs.lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));
1465
+ return rxjs.lastValueFrom(_request(this, this.#httpRequest, options));
1499
1466
  }
1500
1467
  /**
1501
1468
  * Perform an HTTP request a `/data` sub-endpoint
@@ -1508,7 +1475,7 @@ const _SanityClient = class _SanityClient2 {
1508
1475
  * @internal
1509
1476
  */
1510
1477
  dataRequest(endpoint, body, options) {
1511
- return rxjs.lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));
1478
+ return rxjs.lastValueFrom(_dataRequest(this, this.#httpRequest, endpoint, body, options));
1512
1479
  }
1513
1480
  /**
1514
1481
  * Get a Sanity API URL for the URI provided
@@ -1528,9 +1495,7 @@ const _SanityClient = class _SanityClient2 {
1528
1495
  getDataUrl(operation, path) {
1529
1496
  return _getDataUrl(this, operation, path);
1530
1497
  }
1531
- };
1532
- _clientConfig2 = /* @__PURE__ */ new WeakMap(), _httpRequest2 = /* @__PURE__ */ new WeakMap();
1533
- let SanityClient = _SanityClient;
1498
+ }
1534
1499
  function defineCreateClientExports(envMiddleware2, ClassConstructor) {
1535
1500
  const defaultRequester = defineHttpRequest(envMiddleware2);
1536
1501
  return { requester: defaultRequester, createClient: (config) => new ClassConstructor(