@sanity/client 6.11.3 → 6.11.4-canary.1

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.
Files changed (55) hide show
  1. package/README.md +4 -4
  2. package/dist/_chunks/{browserMiddleware-1MULg59S.cjs → browserMiddleware-EnEpy_gt.cjs} +247 -299
  3. package/dist/_chunks/browserMiddleware-EnEpy_gt.cjs.map +1 -0
  4. package/dist/_chunks/{browserMiddleware-heyg-fDk.js → browserMiddleware-nSeu_Rmf.js} +246 -299
  5. package/dist/_chunks/browserMiddleware-nSeu_Rmf.js.map +1 -0
  6. package/dist/_chunks/{nodeMiddleware-CHxg1-zH.cjs → nodeMiddleware-_hIIS1d7.cjs} +248 -300
  7. package/dist/_chunks/nodeMiddleware-_hIIS1d7.cjs.map +1 -0
  8. package/dist/_chunks/{nodeMiddleware-u_fUUnxa.js → nodeMiddleware-hZIb_1T_.js} +247 -300
  9. package/dist/_chunks/nodeMiddleware-hZIb_1T_.js.map +1 -0
  10. package/dist/_chunks/stegaEncodeSourceMap-4w5UCEGT.cjs +479 -0
  11. package/dist/_chunks/stegaEncodeSourceMap-4w5UCEGT.cjs.map +1 -0
  12. package/dist/_chunks/stegaEncodeSourceMap-SOgem38i.js +475 -0
  13. package/dist/_chunks/stegaEncodeSourceMap-SOgem38i.js.map +1 -0
  14. package/dist/_chunks/stegaEncodeSourceMap-Tuf6zjiN.cjs +230 -0
  15. package/dist/_chunks/stegaEncodeSourceMap-Tuf6zjiN.cjs.map +1 -0
  16. package/dist/_chunks/stegaEncodeSourceMap-zvyGxB_C.js +226 -0
  17. package/dist/_chunks/stegaEncodeSourceMap-zvyGxB_C.js.map +1 -0
  18. package/dist/index.browser.cjs +1 -1
  19. package/dist/index.browser.js +2 -2
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.ts +319 -49
  22. package/dist/index.js +2 -2
  23. package/dist/stega.browser.cjs +12 -695
  24. package/dist/stega.browser.cjs.map +1 -1
  25. package/dist/stega.browser.js +7 -690
  26. package/dist/stega.browser.js.map +1 -1
  27. package/dist/stega.cjs +12 -446
  28. package/dist/stega.cjs.js +3 -3
  29. package/dist/stega.cjs.map +1 -1
  30. package/dist/stega.d.ts +1418 -1422
  31. package/dist/stega.js +7 -441
  32. package/dist/stega.js.map +1 -1
  33. package/package.json +11 -9
  34. package/src/SanityClient.ts +152 -75
  35. package/src/assets/AssetsClient.ts +19 -10
  36. package/src/config.ts +34 -12
  37. package/src/data/dataMethods.ts +40 -14
  38. package/src/data/patch.ts +12 -10
  39. package/src/data/transaction.ts +13 -12
  40. package/src/datasets/DatasetsClient.ts +36 -16
  41. package/src/projects/ProjectsClient.ts +21 -12
  42. package/src/stega/index.browser.ts +3 -7
  43. package/src/stega/index.ts +3 -7
  44. package/src/stega/shared.ts +7 -5
  45. package/src/stega/types.ts +11 -18
  46. package/src/types.ts +107 -5
  47. package/src/users/UsersClient.ts +20 -13
  48. package/umd/sanityClient.js +3148 -2235
  49. package/umd/sanityClient.min.js +4 -3
  50. package/dist/_chunks/browserMiddleware-1MULg59S.cjs.map +0 -1
  51. package/dist/_chunks/browserMiddleware-heyg-fDk.js.map +0 -1
  52. package/dist/_chunks/nodeMiddleware-CHxg1-zH.cjs.map +0 -1
  53. package/dist/_chunks/nodeMiddleware-u_fUUnxa.js.map +0 -1
  54. package/src/stega/SanityStegaClient.ts +0 -298
  55. package/src/stega/config.ts +0 -76
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var getIt = require('get-it');
4
- var middleware$1 = require('get-it/middleware');
5
3
  var rxjs = require('rxjs');
6
4
  var operators = require('rxjs/operators');
5
+ var getIt = require('get-it');
6
+ var middleware$1 = require('get-it/middleware');
7
7
 
8
8
  const MAX_ITEMS_IN_ERROR_MESSAGE = 5;
9
9
  class ClientError extends Error {
@@ -205,25 +205,7 @@ const requestTag = (tag) => {
205
205
  return tag;
206
206
  };
207
207
 
208
- var __accessCheck$6 = (obj, member, msg) => {
209
- if (!member.has(obj))
210
- throw TypeError("Cannot " + msg);
211
- };
212
- var __privateGet$6 = (obj, member, getter) => {
213
- __accessCheck$6(obj, member, "read from private field");
214
- return getter ? getter.call(obj) : member.get(obj);
215
- };
216
- var __privateAdd$6 = (obj, member, value) => {
217
- if (member.has(obj))
218
- throw TypeError("Cannot add the same private member more than once");
219
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
220
- };
221
- var __privateSet$6 = (obj, member, value, setter) => {
222
- __accessCheck$6(obj, member, "write to private field");
223
- setter ? setter.call(obj, value) : member.set(obj, value);
224
- return value;
225
- };
226
- var _client$5, _client2$5;
208
+ const clientSymbol$5 = Symbol("#client");
227
209
  class BasePatch {
228
210
  constructor(selection, operations = {}) {
229
211
  this.selection = selection;
@@ -373,74 +355,52 @@ class BasePatch {
373
355
  const _ObservablePatch = class _ObservablePatch extends BasePatch {
374
356
  constructor(selection, operations, client) {
375
357
  super(selection, operations);
376
- __privateAdd$6(this, _client$5, void 0);
377
- __privateSet$6(this, _client$5, client);
358
+ this[clientSymbol$5] = client;
378
359
  }
379
360
  /**
380
361
  * Clones the patch
381
362
  */
382
363
  clone() {
383
- return new _ObservablePatch(this.selection, { ...this.operations }, __privateGet$6(this, _client$5));
364
+ return new _ObservablePatch(this.selection, { ...this.operations }, this[clientSymbol$5]);
384
365
  }
385
366
  commit(options) {
386
- if (!__privateGet$6(this, _client$5)) {
367
+ if (!this[clientSymbol$5]) {
387
368
  throw new Error(
388
369
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
389
370
  );
390
371
  }
391
372
  const returnFirst = typeof this.selection === "string";
392
373
  const opts = Object.assign({ returnFirst, returnDocuments: true }, options);
393
- return __privateGet$6(this, _client$5).mutate({ patch: this.serialize() }, opts);
374
+ return this[clientSymbol$5].mutate({ patch: this.serialize() }, opts);
394
375
  }
395
376
  };
396
- _client$5 = new WeakMap();
397
377
  let ObservablePatch = _ObservablePatch;
398
378
  const _Patch = class _Patch extends BasePatch {
399
379
  constructor(selection, operations, client) {
400
380
  super(selection, operations);
401
- __privateAdd$6(this, _client2$5, void 0);
402
- __privateSet$6(this, _client2$5, client);
381
+ this[clientSymbol$5] = client;
403
382
  }
404
383
  /**
405
384
  * Clones the patch
406
385
  */
407
386
  clone() {
408
- return new _Patch(this.selection, { ...this.operations }, __privateGet$6(this, _client2$5));
387
+ return new _Patch(this.selection, { ...this.operations }, this[clientSymbol$5]);
409
388
  }
410
389
  commit(options) {
411
- if (!__privateGet$6(this, _client2$5)) {
390
+ if (!this[clientSymbol$5]) {
412
391
  throw new Error(
413
392
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
414
393
  );
415
394
  }
416
395
  const returnFirst = typeof this.selection === "string";
417
396
  const opts = Object.assign({ returnFirst, returnDocuments: true }, options);
418
- return __privateGet$6(this, _client2$5).mutate({ patch: this.serialize() }, opts);
397
+ return this[clientSymbol$5].mutate({ patch: this.serialize() }, opts);
419
398
  }
420
399
  };
421
- _client2$5 = new WeakMap();
422
400
  let Patch = _Patch;
423
401
 
424
- var __accessCheck$5 = (obj, member, msg) => {
425
- if (!member.has(obj))
426
- throw TypeError("Cannot " + msg);
427
- };
428
- var __privateGet$5 = (obj, member, getter) => {
429
- __accessCheck$5(obj, member, "read from private field");
430
- return getter ? getter.call(obj) : member.get(obj);
431
- };
432
- var __privateAdd$5 = (obj, member, value) => {
433
- if (member.has(obj))
434
- throw TypeError("Cannot add the same private member more than once");
435
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
436
- };
437
- var __privateSet$5 = (obj, member, value, setter) => {
438
- __accessCheck$5(obj, member, "write to private field");
439
- setter ? setter.call(obj, value) : member.set(obj, value);
440
- return value;
441
- };
442
- var _client$4, _client2$4;
443
402
  const defaultMutateOptions = { returnDocuments: false };
403
+ const clientSymbol$4 = Symbol("#client");
444
404
  class BaseTransaction {
445
405
  constructor(operations = [], transactionId) {
446
406
  this.operations = operations;
@@ -524,22 +484,21 @@ class BaseTransaction {
524
484
  const _Transaction = class _Transaction extends BaseTransaction {
525
485
  constructor(operations, client, transactionId) {
526
486
  super(operations, transactionId);
527
- __privateAdd$5(this, _client$4, void 0);
528
- __privateSet$5(this, _client$4, client);
487
+ this[clientSymbol$4] = client;
529
488
  }
530
489
  /**
531
490
  * Clones the transaction
532
491
  */
533
492
  clone() {
534
- return new _Transaction([...this.operations], __privateGet$5(this, _client$4), this.trxId);
493
+ return new _Transaction([...this.operations], this[clientSymbol$4], this.trxId);
535
494
  }
536
495
  commit(options) {
537
- if (!__privateGet$5(this, _client$4)) {
496
+ if (!this[clientSymbol$4]) {
538
497
  throw new Error(
539
498
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
540
499
  );
541
500
  }
542
- return __privateGet$5(this, _client$4).mutate(
501
+ return this[clientSymbol$4].mutate(
543
502
  this.serialize(),
544
503
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
545
504
  );
@@ -551,7 +510,7 @@ const _Transaction = class _Transaction extends BaseTransaction {
551
510
  return this._add({ patch: patchOrDocumentId.serialize() });
552
511
  }
553
512
  if (isBuilder) {
554
- const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$5(this, _client$4)));
513
+ const patch = patchOps(new Patch(patchOrDocumentId, {}, this[clientSymbol$4]));
555
514
  if (!(patch instanceof Patch)) {
556
515
  throw new Error("function passed to `patch()` must return the patch");
557
516
  }
@@ -560,27 +519,25 @@ const _Transaction = class _Transaction extends BaseTransaction {
560
519
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
561
520
  }
562
521
  };
563
- _client$4 = new WeakMap();
564
522
  let Transaction = _Transaction;
565
523
  const _ObservableTransaction = class _ObservableTransaction extends BaseTransaction {
566
524
  constructor(operations, client, transactionId) {
567
525
  super(operations, transactionId);
568
- __privateAdd$5(this, _client2$4, void 0);
569
- __privateSet$5(this, _client2$4, client);
526
+ this[clientSymbol$4] = client;
570
527
  }
571
528
  /**
572
529
  * Clones the transaction
573
530
  */
574
531
  clone() {
575
- return new _ObservableTransaction([...this.operations], __privateGet$5(this, _client2$4), this.trxId);
532
+ return new _ObservableTransaction([...this.operations], this[clientSymbol$4], this.trxId);
576
533
  }
577
534
  commit(options) {
578
- if (!__privateGet$5(this, _client2$4)) {
535
+ if (!this[clientSymbol$4]) {
579
536
  throw new Error(
580
537
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
581
538
  );
582
539
  }
583
- return __privateGet$5(this, _client2$4).mutate(
540
+ return this[clientSymbol$4].mutate(
584
541
  this.serialize(),
585
542
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
586
543
  );
@@ -592,7 +549,7 @@ const _ObservableTransaction = class _ObservableTransaction extends BaseTransact
592
549
  return this._add({ patch: patchOrDocumentId.serialize() });
593
550
  }
594
551
  if (isBuilder) {
595
- const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$5(this, _client2$4)));
552
+ const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, this[clientSymbol$4]));
596
553
  if (!(patch instanceof ObservablePatch)) {
597
554
  throw new Error("function passed to `patch()` must return the patch");
598
555
  }
@@ -601,7 +558,6 @@ const _ObservableTransaction = class _ObservableTransaction extends BaseTransact
601
558
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
602
559
  }
603
560
  };
604
- _client2$4 = new WeakMap();
605
561
  let ObservableTransaction = _ObservableTransaction;
606
562
 
607
563
  const BASE_URL = "https://www.sanity.io/help/";
@@ -653,7 +609,8 @@ const defaultCdnHost = "apicdn.sanity.io";
653
609
  const defaultConfig = {
654
610
  apiHost: "https://api.sanity.io",
655
611
  apiVersion: "1",
656
- useProjectHostname: true
612
+ useProjectHostname: true,
613
+ stega: { enabled: false }
657
614
  };
658
615
  const LOCALHOSTS = ["localhost", "127.0.0.1", "0.0.0.0"];
659
616
  const isLocal = (host) => LOCALHOSTS.indexOf(host) !== -1;
@@ -680,11 +637,21 @@ const validateApiPerspective = function validateApiPerspective2(perspective) {
680
637
  }
681
638
  };
682
639
  const initConfig = (config, prevConfig) => {
683
- const specifiedConfig = Object.assign({}, prevConfig, config);
640
+ const specifiedConfig = {
641
+ ...prevConfig,
642
+ ...config,
643
+ stega: {
644
+ ...typeof prevConfig.stega === "boolean" ? { enabled: prevConfig.stega } : prevConfig.stega || defaultConfig.stega,
645
+ ...typeof config.stega === "boolean" ? { enabled: config.stega } : config.stega || {}
646
+ }
647
+ };
684
648
  if (!specifiedConfig.apiVersion) {
685
649
  printNoApiVersionSpecifiedWarning();
686
650
  }
687
- const newConfig = Object.assign({}, defaultConfig, specifiedConfig);
651
+ const newConfig = {
652
+ ...defaultConfig,
653
+ ...specifiedConfig
654
+ };
688
655
  const projectBased = newConfig.useProjectHostname;
689
656
  if (typeof Promise === "undefined") {
690
657
  const helpUrl = generateHelpUrl("js-client-promise-polyfill");
@@ -696,14 +663,25 @@ const initConfig = (config, prevConfig) => {
696
663
  if (typeof newConfig.perspective === "string") {
697
664
  validateApiPerspective(newConfig.perspective);
698
665
  }
699
- if ("encodeSourceMapAtPath" in newConfig || "encodeSourceMap" in newConfig || "studioUrl" in newConfig || "logger" in newConfig) {
666
+ if ("encodeSourceMap" in newConfig) {
700
667
  throw new Error(
701
- "It looks like you're using options meant for '@sanity/preview-kit/client', such as 'encodeSourceMapAtPath', 'encodeSourceMap', 'studioUrl' and 'logger'. Make sure you're using the right import."
668
+ "It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?"
702
669
  );
703
670
  }
704
- if ("stega" in newConfig && newConfig["stega"] !== void 0 && newConfig["stega"] !== false) {
671
+ if ("encodeSourceMapAtPath" in newConfig) {
672
+ throw new Error(
673
+ "It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?"
674
+ );
675
+ }
676
+ if (typeof newConfig.stega.enabled !== "boolean") {
677
+ throw new Error("stega.enabled must be a boolean, received ".concat(newConfig.stega.enabled));
678
+ }
679
+ if (newConfig.stega.enabled && newConfig.stega.studioUrl === void 0) {
680
+ throw new Error("stega.studioUrl must be defined when stega.enabled is true");
681
+ }
682
+ if (newConfig.stega.enabled && typeof newConfig.stega.studioUrl !== "string" && typeof newConfig.stega.studioUrl !== "function") {
705
683
  throw new Error(
706
- "It looks like you're using options meant for '@sanity/client/stega'. Make sure you're using the right import. Or set 'stega' in 'createClient' to 'false'."
684
+ "stega.studioUrl must be a string or a function, received ".concat(newConfig.stega.studioUrl)
707
685
  );
708
686
  }
709
687
  const isBrowser = typeof window !== "undefined" && window.location && window.location.hostname;
@@ -764,6 +742,22 @@ function requestOptions(config, overrides = {}) {
764
742
  });
765
743
  }
766
744
 
745
+ var s={0:8203,1:8204,2:8205,3:8290,4:8291,5:8288,6:65279,7:8289,8:119155,9:119156,a:119157,b:119158,c:119159,d:119160,e:119161,f:119162},c={0:8203,1:8204,2:8205,3:65279},d=new Array(4).fill(String.fromCodePoint(c[0])).join("");function E(t){let e=JSON.stringify(t);return `${d}${Array.from(e).map(r=>{let n=r.charCodeAt(0);if(n>255)throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${r} (${n})`);return Array.from(n.toString(4).padStart(4,"0")).map(o=>String.fromCodePoint(c[o])).join("")}).join("")}`}function I(t){return Number.isNaN(Number(t))?Boolean(Date.parse(t)):!1}function x(t){try{new URL(t,t.startsWith("/")?"https://acme.com":void 0);}catch{return !1}return !0}function b(t,e,r="auto"){return r===!0||r==="auto"&&(I(t)||x(t))?t:`${t}${E(e)}`}Object.fromEntries(Object.entries(c).map(t=>t.reverse()));Object.fromEntries(Object.entries(s).map(t=>t.reverse()));var S=`${Object.values(s).map(t=>`\\u{${t.toString(16)}}`).join("")}`,f=new RegExp(`[${S}]{4,}`,"gu");function X(t){var e;return {cleaned:t.replace(f,""),encoded:((e=t.match(f))==null?void 0:e[0])||""}}
746
+
747
+ function vercelStegaCleanAll(result) {
748
+ try {
749
+ return JSON.parse(
750
+ JSON.stringify(result, (key, value) => {
751
+ if (typeof value !== "string")
752
+ return value;
753
+ return X(value).cleaned;
754
+ })
755
+ );
756
+ } catch {
757
+ return result;
758
+ }
759
+ }
760
+
767
761
  const encodeQueryString = ({
768
762
  query,
769
763
  params = {},
@@ -805,21 +799,38 @@ const indexBy = (docs, attr) => docs.reduce((indexed, doc) => {
805
799
  return indexed;
806
800
  }, /* @__PURE__ */ Object.create(null));
807
801
  const getQuerySizeLimit = 11264;
808
- function _fetch(client, httpRequest, query, params, options = {}) {
809
- if ("stega" in options && options["stega"] !== void 0 && options["stega"] !== false) {
810
- throw new Error(
811
- "It looks like you're using options meant for '@sanity/client/stega'. Make sure you're using the right import. Or set 'stega' in 'fetch' to 'false'."
812
- );
813
- }
802
+ function _fetch(client, httpRequest, _stega, query, _params = {}, options = {}) {
803
+ const stega = "stega" in options ? {
804
+ ..._stega || {},
805
+ ...typeof options.stega === "boolean" ? { enabled: options.stega } : options.stega || {}
806
+ } : _stega;
807
+ const params = stega.enabled ? vercelStegaCleanAll(_params) : _params;
814
808
  const mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result;
815
809
  const { cache, next, ...opts } = {
816
810
  // Opt out of setting a `signal` on an internal `fetch` if one isn't provided.
817
811
  // This is necessary in React Server Components to avoid opting out of Request Memoization.
818
812
  useAbortSignal: typeof options.signal !== "undefined",
813
+ // Set `resultSourceMap' when stega is enabled, as it's required for encoding.
814
+ resultSourceMap: stega.enabled ? "withKeyArraySelector" : options.resultSourceMap,
819
815
  ...options
820
816
  };
821
817
  const reqOpts = typeof cache !== "undefined" || typeof next !== "undefined" ? { ...opts, fetch: { cache, next } } : opts;
822
- return _dataRequest(client, httpRequest, "query", { query, params }, reqOpts).pipe(operators.map(mapResponse));
818
+ const $request = _dataRequest(client, httpRequest, "query", { query, params }, reqOpts);
819
+ return stega.enabled ? $request.pipe(
820
+ operators.combineLatestWith(
821
+ rxjs.from(
822
+ Promise.resolve().then(function () { return require('./stegaEncodeSourceMap-Tuf6zjiN.cjs'); }).then(function (n) { return n.stegaEncodeSourceMap$1; }).then(
823
+ ({ stegaEncodeSourceMap }) => stegaEncodeSourceMap
824
+ )
825
+ )
826
+ ),
827
+ operators.map(
828
+ ([res, stegaEncodeSourceMap]) => {
829
+ const result = stegaEncodeSourceMap(res.result, res.resultSourceMap, stega);
830
+ return mapResponse({ ...res, result });
831
+ }
832
+ )
833
+ ) : $request.pipe(operators.map(mapResponse));
823
834
  }
824
835
  function _getDocument(client, httpRequest, id, opts = {}) {
825
836
  const options = { uri: _getDataUrl(client, "doc", id), json: true, tag: opts.tag };
@@ -1004,47 +1015,30 @@ function _createAbortError(signal) {
1004
1015
  return error;
1005
1016
  }
1006
1017
 
1007
- var __accessCheck$4 = (obj, member, msg) => {
1008
- if (!member.has(obj))
1009
- throw TypeError("Cannot " + msg);
1010
- };
1011
- var __privateGet$4 = (obj, member, getter) => {
1012
- __accessCheck$4(obj, member, "read from private field");
1013
- return getter ? getter.call(obj) : member.get(obj);
1014
- };
1015
- var __privateAdd$4 = (obj, member, value) => {
1016
- if (member.has(obj))
1017
- throw TypeError("Cannot add the same private member more than once");
1018
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1019
- };
1020
- var __privateSet$4 = (obj, member, value, setter) => {
1021
- __accessCheck$4(obj, member, "write to private field");
1022
- setter ? setter.call(obj, value) : member.set(obj, value);
1023
- return value;
1024
- };
1025
- var _client$3, _httpRequest$4, _client2$3, _httpRequest2$4;
1018
+ const clientSymbol$3 = Symbol("#client");
1019
+ const httpRequestSymbol$4 = Symbol("#httpRequest");
1026
1020
  class ObservableAssetsClient {
1027
1021
  constructor(client, httpRequest) {
1028
- __privateAdd$4(this, _client$3, void 0);
1029
- __privateAdd$4(this, _httpRequest$4, void 0);
1030
- __privateSet$4(this, _client$3, client);
1031
- __privateSet$4(this, _httpRequest$4, httpRequest);
1022
+ this[clientSymbol$3] = client;
1023
+ this[httpRequestSymbol$4] = httpRequest;
1032
1024
  }
1033
1025
  upload(assetType, body, options) {
1034
- return _upload(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), assetType, body, options);
1026
+ return _upload(this[clientSymbol$3], this[httpRequestSymbol$4], assetType, body, options);
1035
1027
  }
1036
1028
  }
1037
- _client$3 = new WeakMap();
1038
- _httpRequest$4 = new WeakMap();
1039
1029
  class AssetsClient {
1040
1030
  constructor(client, httpRequest) {
1041
- __privateAdd$4(this, _client2$3, void 0);
1042
- __privateAdd$4(this, _httpRequest2$4, void 0);
1043
- __privateSet$4(this, _client2$3, client);
1044
- __privateSet$4(this, _httpRequest2$4, httpRequest);
1031
+ this[clientSymbol$3] = client;
1032
+ this[httpRequestSymbol$4] = httpRequest;
1045
1033
  }
1046
1034
  upload(assetType, body, options) {
1047
- const observable = _upload(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), assetType, body, options);
1035
+ const observable = _upload(
1036
+ this[clientSymbol$3],
1037
+ this[httpRequestSymbol$4],
1038
+ assetType,
1039
+ body,
1040
+ options
1041
+ );
1048
1042
  return rxjs.lastValueFrom(
1049
1043
  observable.pipe(
1050
1044
  operators.filter((event) => event.type === "response"),
@@ -1055,8 +1049,6 @@ class AssetsClient {
1055
1049
  );
1056
1050
  }
1057
1051
  }
1058
- _client2$3 = new WeakMap();
1059
- _httpRequest2$4 = new WeakMap();
1060
1052
  function _upload(client, httpRequest, assetType, body, opts = {}) {
1061
1053
  validateAssetType(assetType);
1062
1054
  let meta = opts.extract || void 0;
@@ -1247,31 +1239,12 @@ function extractErrorMessage(err) {
1247
1239
  return typeof err.error === "string" ? err.error : JSON.stringify(err.error, null, 2);
1248
1240
  }
1249
1241
 
1250
- var __accessCheck$3 = (obj, member, msg) => {
1251
- if (!member.has(obj))
1252
- throw TypeError("Cannot " + msg);
1253
- };
1254
- var __privateGet$3 = (obj, member, getter) => {
1255
- __accessCheck$3(obj, member, "read from private field");
1256
- return getter ? getter.call(obj) : member.get(obj);
1257
- };
1258
- var __privateAdd$3 = (obj, member, value) => {
1259
- if (member.has(obj))
1260
- throw TypeError("Cannot add the same private member more than once");
1261
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1262
- };
1263
- var __privateSet$3 = (obj, member, value, setter) => {
1264
- __accessCheck$3(obj, member, "write to private field");
1265
- setter ? setter.call(obj, value) : member.set(obj, value);
1266
- return value;
1267
- };
1268
- var _client$2, _httpRequest$3, _client2$2, _httpRequest2$3;
1242
+ const clientSymbol$2 = Symbol("#client");
1243
+ const httpRequestSymbol$3 = Symbol("#httpRequest");
1269
1244
  class ObservableDatasetsClient {
1270
1245
  constructor(client, httpRequest) {
1271
- __privateAdd$3(this, _client$2, void 0);
1272
- __privateAdd$3(this, _httpRequest$3, void 0);
1273
- __privateSet$3(this, _client$2, client);
1274
- __privateSet$3(this, _httpRequest$3, httpRequest);
1246
+ this[clientSymbol$2] = client;
1247
+ this[httpRequestSymbol$3] = httpRequest;
1275
1248
  }
1276
1249
  /**
1277
1250
  * Create a new dataset with the given name
@@ -1280,7 +1253,13 @@ class ObservableDatasetsClient {
1280
1253
  * @param options - Options for the dataset
1281
1254
  */
1282
1255
  create(name, options) {
1283
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PUT", name, options);
1256
+ return _modify(
1257
+ this[clientSymbol$2],
1258
+ this[httpRequestSymbol$3],
1259
+ "PUT",
1260
+ name,
1261
+ options
1262
+ );
1284
1263
  }
1285
1264
  /**
1286
1265
  * Edit a dataset with the given name
@@ -1289,7 +1268,13 @@ class ObservableDatasetsClient {
1289
1268
  * @param options - New options for the dataset
1290
1269
  */
1291
1270
  edit(name, options) {
1292
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PATCH", name, options);
1271
+ return _modify(
1272
+ this[clientSymbol$2],
1273
+ this[httpRequestSymbol$3],
1274
+ "PATCH",
1275
+ name,
1276
+ options
1277
+ );
1293
1278
  }
1294
1279
  /**
1295
1280
  * Delete a dataset with the given name
@@ -1297,26 +1282,22 @@ class ObservableDatasetsClient {
1297
1282
  * @param name - Name of the dataset to delete
1298
1283
  */
1299
1284
  delete(name) {
1300
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "DELETE", name);
1285
+ return _modify(this[clientSymbol$2], this[httpRequestSymbol$3], "DELETE", name);
1301
1286
  }
1302
1287
  /**
1303
1288
  * Fetch a list of datasets for the configured project
1304
1289
  */
1305
1290
  list() {
1306
- return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
1291
+ return _request(this[clientSymbol$2], this[httpRequestSymbol$3], {
1307
1292
  uri: "/datasets",
1308
1293
  tag: null
1309
1294
  });
1310
1295
  }
1311
1296
  }
1312
- _client$2 = new WeakMap();
1313
- _httpRequest$3 = new WeakMap();
1314
1297
  class DatasetsClient {
1315
1298
  constructor(client, httpRequest) {
1316
- __privateAdd$3(this, _client2$2, void 0);
1317
- __privateAdd$3(this, _httpRequest2$3, void 0);
1318
- __privateSet$3(this, _client2$2, client);
1319
- __privateSet$3(this, _httpRequest2$3, httpRequest);
1299
+ this[clientSymbol$2] = client;
1300
+ this[httpRequestSymbol$3] = httpRequest;
1320
1301
  }
1321
1302
  /**
1322
1303
  * Create a new dataset with the given name
@@ -1326,7 +1307,7 @@ class DatasetsClient {
1326
1307
  */
1327
1308
  create(name, options) {
1328
1309
  return rxjs.lastValueFrom(
1329
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PUT", name, options)
1310
+ _modify(this[clientSymbol$2], this[httpRequestSymbol$3], "PUT", name, options)
1330
1311
  );
1331
1312
  }
1332
1313
  /**
@@ -1337,7 +1318,7 @@ class DatasetsClient {
1337
1318
  */
1338
1319
  edit(name, options) {
1339
1320
  return rxjs.lastValueFrom(
1340
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PATCH", name, options)
1321
+ _modify(this[clientSymbol$2], this[httpRequestSymbol$3], "PATCH", name, options)
1341
1322
  );
1342
1323
  }
1343
1324
  /**
@@ -1346,19 +1327,22 @@ class DatasetsClient {
1346
1327
  * @param name - Name of the dataset to delete
1347
1328
  */
1348
1329
  delete(name) {
1349
- return rxjs.lastValueFrom(_modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "DELETE", name));
1330
+ return rxjs.lastValueFrom(
1331
+ _modify(this[clientSymbol$2], this[httpRequestSymbol$3], "DELETE", name)
1332
+ );
1350
1333
  }
1351
1334
  /**
1352
1335
  * Fetch a list of datasets for the configured project
1353
1336
  */
1354
1337
  list() {
1355
1338
  return rxjs.lastValueFrom(
1356
- _request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), { uri: "/datasets", tag: null })
1339
+ _request(this[clientSymbol$2], this[httpRequestSymbol$3], {
1340
+ uri: "/datasets",
1341
+ tag: null
1342
+ })
1357
1343
  );
1358
1344
  }
1359
1345
  }
1360
- _client2$2 = new WeakMap();
1361
- _httpRequest2$3 = new WeakMap();
1362
1346
  function _modify(client, httpRequest, method, name, options) {
1363
1347
  dataset(name);
1364
1348
  return _request(client, httpRequest, {
@@ -1369,35 +1353,16 @@ function _modify(client, httpRequest, method, name, options) {
1369
1353
  });
1370
1354
  }
1371
1355
 
1372
- var __accessCheck$2 = (obj, member, msg) => {
1373
- if (!member.has(obj))
1374
- throw TypeError("Cannot " + msg);
1375
- };
1376
- var __privateGet$2 = (obj, member, getter) => {
1377
- __accessCheck$2(obj, member, "read from private field");
1378
- return getter ? getter.call(obj) : member.get(obj);
1379
- };
1380
- var __privateAdd$2 = (obj, member, value) => {
1381
- if (member.has(obj))
1382
- throw TypeError("Cannot add the same private member more than once");
1383
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1384
- };
1385
- var __privateSet$2 = (obj, member, value, setter) => {
1386
- __accessCheck$2(obj, member, "write to private field");
1387
- setter ? setter.call(obj, value) : member.set(obj, value);
1388
- return value;
1389
- };
1390
- var _client$1, _httpRequest$2, _client2$1, _httpRequest2$2;
1356
+ const clientSymbol$1 = Symbol("#client");
1357
+ const httpRequestSymbol$2 = Symbol("#httpRequest");
1391
1358
  class ObservableProjectsClient {
1392
1359
  constructor(client, httpRequest) {
1393
- __privateAdd$2(this, _client$1, void 0);
1394
- __privateAdd$2(this, _httpRequest$2, void 0);
1395
- __privateSet$2(this, _client$1, client);
1396
- __privateSet$2(this, _httpRequest$2, httpRequest);
1360
+ this[clientSymbol$1] = client;
1361
+ this[httpRequestSymbol$2] = httpRequest;
1397
1362
  }
1398
1363
  list(options) {
1399
1364
  const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1400
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri });
1365
+ return _request(this[clientSymbol$1], this[httpRequestSymbol$2], { uri });
1401
1366
  }
1402
1367
  /**
1403
1368
  * Fetch a project by project ID
@@ -1405,21 +1370,21 @@ class ObservableProjectsClient {
1405
1370
  * @param projectId - ID of the project to fetch
1406
1371
  */
1407
1372
  getById(projectId) {
1408
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri: "/projects/".concat(projectId) });
1373
+ return _request(this[clientSymbol$1], this[httpRequestSymbol$2], {
1374
+ uri: "/projects/".concat(projectId)
1375
+ });
1409
1376
  }
1410
1377
  }
1411
- _client$1 = new WeakMap();
1412
- _httpRequest$2 = new WeakMap();
1413
1378
  class ProjectsClient {
1414
1379
  constructor(client, httpRequest) {
1415
- __privateAdd$2(this, _client2$1, void 0);
1416
- __privateAdd$2(this, _httpRequest2$2, void 0);
1417
- __privateSet$2(this, _client2$1, client);
1418
- __privateSet$2(this, _httpRequest2$2, httpRequest);
1380
+ this[clientSymbol$1] = client;
1381
+ this[httpRequestSymbol$2] = httpRequest;
1419
1382
  }
1420
1383
  list(options) {
1421
1384
  const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1422
- return rxjs.lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri }));
1385
+ return rxjs.lastValueFrom(
1386
+ _request(this[clientSymbol$1], this[httpRequestSymbol$2], { uri })
1387
+ );
1423
1388
  }
1424
1389
  /**
1425
1390
  * Fetch a project by project ID
@@ -1428,38 +1393,19 @@ class ProjectsClient {
1428
1393
  */
1429
1394
  getById(projectId) {
1430
1395
  return rxjs.lastValueFrom(
1431
- _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: "/projects/".concat(projectId) })
1396
+ _request(this[clientSymbol$1], this[httpRequestSymbol$2], {
1397
+ uri: "/projects/".concat(projectId)
1398
+ })
1432
1399
  );
1433
1400
  }
1434
1401
  }
1435
- _client2$1 = new WeakMap();
1436
- _httpRequest2$2 = new WeakMap();
1437
1402
 
1438
- var __accessCheck$1 = (obj, member, msg) => {
1439
- if (!member.has(obj))
1440
- throw TypeError("Cannot " + msg);
1441
- };
1442
- var __privateGet$1 = (obj, member, getter) => {
1443
- __accessCheck$1(obj, member, "read from private field");
1444
- return getter ? getter.call(obj) : member.get(obj);
1445
- };
1446
- var __privateAdd$1 = (obj, member, value) => {
1447
- if (member.has(obj))
1448
- throw TypeError("Cannot add the same private member more than once");
1449
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1450
- };
1451
- var __privateSet$1 = (obj, member, value, setter) => {
1452
- __accessCheck$1(obj, member, "write to private field");
1453
- setter ? setter.call(obj, value) : member.set(obj, value);
1454
- return value;
1455
- };
1456
- var _client, _httpRequest$1, _client2, _httpRequest2$1;
1403
+ const clientSymbol = Symbol("#client");
1404
+ const httpRequestSymbol$1 = Symbol("#httpRequest");
1457
1405
  class ObservableUsersClient {
1458
1406
  constructor(client, httpRequest) {
1459
- __privateAdd$1(this, _client, void 0);
1460
- __privateAdd$1(this, _httpRequest$1, void 0);
1461
- __privateSet$1(this, _client, client);
1462
- __privateSet$1(this, _httpRequest$1, httpRequest);
1407
+ this[clientSymbol] = client;
1408
+ this[httpRequestSymbol$1] = httpRequest;
1463
1409
  }
1464
1410
  /**
1465
1411
  * Fetch a user by user ID
@@ -1468,20 +1414,16 @@ class ObservableUsersClient {
1468
1414
  */
1469
1415
  getById(id) {
1470
1416
  return _request(
1471
- __privateGet$1(this, _client),
1472
- __privateGet$1(this, _httpRequest$1),
1417
+ this[clientSymbol],
1418
+ this[httpRequestSymbol$1],
1473
1419
  { uri: "/users/".concat(id) }
1474
1420
  );
1475
1421
  }
1476
1422
  }
1477
- _client = new WeakMap();
1478
- _httpRequest$1 = new WeakMap();
1479
1423
  class UsersClient {
1480
1424
  constructor(client, httpRequest) {
1481
- __privateAdd$1(this, _client2, void 0);
1482
- __privateAdd$1(this, _httpRequest2$1, void 0);
1483
- __privateSet$1(this, _client2, client);
1484
- __privateSet$1(this, _httpRequest2$1, httpRequest);
1425
+ this[clientSymbol] = client;
1426
+ this[httpRequestSymbol$1] = httpRequest;
1485
1427
  }
1486
1428
  /**
1487
1429
  * Fetch a user by user ID
@@ -1490,68 +1432,48 @@ class UsersClient {
1490
1432
  */
1491
1433
  getById(id) {
1492
1434
  return rxjs.lastValueFrom(
1493
- _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {
1494
- uri: "/users/".concat(id)
1495
- })
1435
+ _request(
1436
+ this[clientSymbol],
1437
+ this[httpRequestSymbol$1],
1438
+ {
1439
+ uri: "/users/".concat(id)
1440
+ }
1441
+ )
1496
1442
  );
1497
1443
  }
1498
1444
  }
1499
- _client2 = new WeakMap();
1500
- _httpRequest2$1 = new WeakMap();
1501
1445
 
1502
- var __accessCheck = (obj, member, msg) => {
1503
- if (!member.has(obj))
1504
- throw TypeError("Cannot " + msg);
1505
- };
1506
- var __privateGet = (obj, member, getter) => {
1507
- __accessCheck(obj, member, "read from private field");
1508
- return getter ? getter.call(obj) : member.get(obj);
1509
- };
1510
- var __privateAdd = (obj, member, value) => {
1511
- if (member.has(obj))
1512
- throw TypeError("Cannot add the same private member more than once");
1513
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1514
- };
1515
- var __privateSet = (obj, member, value, setter) => {
1516
- __accessCheck(obj, member, "write to private field");
1517
- setter ? setter.call(obj, value) : member.set(obj, value);
1518
- return value;
1519
- };
1520
- var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
1446
+ const clientConfigSymbol = Symbol("#clientConfig");
1447
+ const httpRequestSymbol = Symbol("#httpRequest");
1521
1448
  const _ObservableSanityClient = class _ObservableSanityClient {
1522
1449
  constructor(httpRequest, config = defaultConfig) {
1523
- /**
1524
- * Private properties
1525
- */
1526
- __privateAdd(this, _clientConfig, void 0);
1527
- __privateAdd(this, _httpRequest, void 0);
1528
1450
  /**
1529
1451
  * Instance properties
1530
1452
  */
1531
1453
  this.listen = _listen;
1532
1454
  this.config(config);
1533
- __privateSet(this, _httpRequest, httpRequest);
1534
- this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
1535
- this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest));
1536
- this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest));
1537
- this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1455
+ this[httpRequestSymbol] = httpRequest;
1456
+ this.assets = new ObservableAssetsClient(this, this[httpRequestSymbol]);
1457
+ this.datasets = new ObservableDatasetsClient(this, this[httpRequestSymbol]);
1458
+ this.projects = new ObservableProjectsClient(this, this[httpRequestSymbol]);
1459
+ this.users = new ObservableUsersClient(this, this[httpRequestSymbol]);
1538
1460
  }
1539
1461
  /**
1540
1462
  * Clone the client - returns a new instance
1541
1463
  */
1542
1464
  clone() {
1543
- return new _ObservableSanityClient(__privateGet(this, _httpRequest), this.config());
1465
+ return new _ObservableSanityClient(this[httpRequestSymbol], this.config());
1544
1466
  }
1545
1467
  config(newConfig) {
1546
1468
  if (newConfig === void 0) {
1547
- return { ...__privateGet(this, _clientConfig) };
1469
+ return { ...this[clientConfigSymbol] };
1548
1470
  }
1549
- if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === false) {
1471
+ if (this[clientConfigSymbol] && this[clientConfigSymbol].allowReconfigure === false) {
1550
1472
  throw new Error(
1551
1473
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1552
1474
  );
1553
1475
  }
1554
- __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {}));
1476
+ this[clientConfigSymbol] = initConfig(newConfig, this[clientConfigSymbol] || {});
1555
1477
  return this;
1556
1478
  }
1557
1479
  /**
@@ -1560,10 +1482,25 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1560
1482
  * @param newConfig - New client configuration properties, shallowly merged with existing configuration
1561
1483
  */
1562
1484
  withConfig(newConfig) {
1563
- return new _ObservableSanityClient(__privateGet(this, _httpRequest), { ...this.config(), ...newConfig });
1485
+ const thisConfig = this.config();
1486
+ return new _ObservableSanityClient(this[httpRequestSymbol], {
1487
+ ...thisConfig,
1488
+ ...newConfig,
1489
+ stega: {
1490
+ ...thisConfig.stega || {},
1491
+ ...typeof (newConfig == null ? void 0 : newConfig.stega) === "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}
1492
+ }
1493
+ });
1564
1494
  }
1565
- fetch(query, params, options = {}) {
1566
- return _fetch(this, __privateGet(this, _httpRequest), query, params, options);
1495
+ fetch(query, params, options) {
1496
+ return _fetch(
1497
+ this,
1498
+ this[httpRequestSymbol],
1499
+ this[clientConfigSymbol].stega,
1500
+ query,
1501
+ params,
1502
+ options
1503
+ );
1567
1504
  }
1568
1505
  /**
1569
1506
  * Fetch a single document with the given ID.
@@ -1572,7 +1509,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1572
1509
  * @param options - Request options
1573
1510
  */
1574
1511
  getDocument(id, options) {
1575
- return _getDocument(this, __privateGet(this, _httpRequest), id, options);
1512
+ return _getDocument(this, this[httpRequestSymbol], id, options);
1576
1513
  }
1577
1514
  /**
1578
1515
  * Fetch multiple documents in one request.
@@ -1584,22 +1521,22 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1584
1521
  * @param options - Request options
1585
1522
  */
1586
1523
  getDocuments(ids, options) {
1587
- return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);
1524
+ return _getDocuments(this, this[httpRequestSymbol], ids, options);
1588
1525
  }
1589
1526
  create(document, options) {
1590
- return _create(this, __privateGet(this, _httpRequest), document, "create", options);
1527
+ return _create(this, this[httpRequestSymbol], document, "create", options);
1591
1528
  }
1592
1529
  createIfNotExists(document, options) {
1593
- return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);
1530
+ return _createIfNotExists(this, this[httpRequestSymbol], document, options);
1594
1531
  }
1595
1532
  createOrReplace(document, options) {
1596
- return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);
1533
+ return _createOrReplace(this, this[httpRequestSymbol], document, options);
1597
1534
  }
1598
1535
  delete(selection, options) {
1599
- return _delete(this, __privateGet(this, _httpRequest), selection, options);
1536
+ return _delete(this, this[httpRequestSymbol], selection, options);
1600
1537
  }
1601
1538
  mutate(operations, options) {
1602
- return _mutate(this, __privateGet(this, _httpRequest), operations, options);
1539
+ return _mutate(this, this[httpRequestSymbol], operations, options);
1603
1540
  }
1604
1541
  /**
1605
1542
  * Create a new buildable patch of operations to perform
@@ -1625,7 +1562,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1625
1562
  * @param options - Request options
1626
1563
  */
1627
1564
  request(options) {
1628
- return _request(this, __privateGet(this, _httpRequest), options);
1565
+ return _request(this, this[httpRequestSymbol], options);
1629
1566
  }
1630
1567
  /**
1631
1568
  * Get a Sanity API URL for the URI provided
@@ -1646,39 +1583,32 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1646
1583
  return _getDataUrl(this, operation, path);
1647
1584
  }
1648
1585
  };
1649
- _clientConfig = new WeakMap();
1650
- _httpRequest = new WeakMap();
1651
1586
  let ObservableSanityClient = _ObservableSanityClient;
1652
1587
  const _SanityClient = class _SanityClient {
1653
1588
  constructor(httpRequest, config = defaultConfig) {
1654
- /**
1655
- * Private properties
1656
- */
1657
- __privateAdd(this, _clientConfig2, void 0);
1658
- __privateAdd(this, _httpRequest2, void 0);
1659
1589
  /**
1660
1590
  * Instance properties
1661
1591
  */
1662
1592
  this.listen = _listen;
1663
1593
  this.config(config);
1664
- __privateSet(this, _httpRequest2, httpRequest);
1665
- this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
1666
- this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2));
1667
- this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2));
1668
- this.users = new UsersClient(this, __privateGet(this, _httpRequest2));
1594
+ this[httpRequestSymbol] = httpRequest;
1595
+ this.assets = new AssetsClient(this, this[httpRequestSymbol]);
1596
+ this.datasets = new DatasetsClient(this, this[httpRequestSymbol]);
1597
+ this.projects = new ProjectsClient(this, this[httpRequestSymbol]);
1598
+ this.users = new UsersClient(this, this[httpRequestSymbol]);
1669
1599
  this.observable = new ObservableSanityClient(httpRequest, config);
1670
1600
  }
1671
1601
  /**
1672
1602
  * Clone the client - returns a new instance
1673
1603
  */
1674
1604
  clone() {
1675
- return new _SanityClient(__privateGet(this, _httpRequest2), this.config());
1605
+ return new _SanityClient(this[httpRequestSymbol], this.config());
1676
1606
  }
1677
1607
  config(newConfig) {
1678
1608
  if (newConfig === void 0) {
1679
- return { ...__privateGet(this, _clientConfig2) };
1609
+ return { ...this[clientConfigSymbol] };
1680
1610
  }
1681
- if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === false) {
1611
+ if (this[clientConfigSymbol] && this[clientConfigSymbol].allowReconfigure === false) {
1682
1612
  throw new Error(
1683
1613
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1684
1614
  );
@@ -1686,7 +1616,7 @@ const _SanityClient = class _SanityClient {
1686
1616
  if (this.observable) {
1687
1617
  this.observable.config(newConfig);
1688
1618
  }
1689
- __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {}));
1619
+ this[clientConfigSymbol] = initConfig(newConfig, this[clientConfigSymbol] || {});
1690
1620
  return this;
1691
1621
  }
1692
1622
  /**
@@ -1695,10 +1625,27 @@ const _SanityClient = class _SanityClient {
1695
1625
  * @param newConfig - New client configuration properties, shallowly merged with existing configuration
1696
1626
  */
1697
1627
  withConfig(newConfig) {
1698
- return new _SanityClient(__privateGet(this, _httpRequest2), { ...this.config(), ...newConfig });
1628
+ const thisConfig = this.config();
1629
+ return new _SanityClient(this[httpRequestSymbol], {
1630
+ ...thisConfig,
1631
+ ...newConfig,
1632
+ stega: {
1633
+ ...thisConfig.stega || {},
1634
+ ...typeof (newConfig == null ? void 0 : newConfig.stega) === "boolean" ? { enabled: newConfig.stega } : (newConfig == null ? void 0 : newConfig.stega) || {}
1635
+ }
1636
+ });
1699
1637
  }
1700
- fetch(query, params, options = {}) {
1701
- return rxjs.lastValueFrom(_fetch(this, __privateGet(this, _httpRequest2), query, params, options));
1638
+ fetch(query, params, options) {
1639
+ return rxjs.lastValueFrom(
1640
+ _fetch(
1641
+ this,
1642
+ this[httpRequestSymbol],
1643
+ this[clientConfigSymbol].stega,
1644
+ query,
1645
+ params,
1646
+ options
1647
+ )
1648
+ );
1702
1649
  }
1703
1650
  /**
1704
1651
  * Fetch a single document with the given ID.
@@ -1707,7 +1654,7 @@ const _SanityClient = class _SanityClient {
1707
1654
  * @param options - Request options
1708
1655
  */
1709
1656
  getDocument(id, options) {
1710
- return rxjs.lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));
1657
+ return rxjs.lastValueFrom(_getDocument(this, this[httpRequestSymbol], id, options));
1711
1658
  }
1712
1659
  /**
1713
1660
  * Fetch multiple documents in one request.
@@ -1719,28 +1666,28 @@ const _SanityClient = class _SanityClient {
1719
1666
  * @param options - Request options
1720
1667
  */
1721
1668
  getDocuments(ids, options) {
1722
- return rxjs.lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));
1669
+ return rxjs.lastValueFrom(_getDocuments(this, this[httpRequestSymbol], ids, options));
1723
1670
  }
1724
1671
  create(document, options) {
1725
1672
  return rxjs.lastValueFrom(
1726
- _create(this, __privateGet(this, _httpRequest2), document, "create", options)
1673
+ _create(this, this[httpRequestSymbol], document, "create", options)
1727
1674
  );
1728
1675
  }
1729
1676
  createIfNotExists(document, options) {
1730
1677
  return rxjs.lastValueFrom(
1731
- _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)
1678
+ _createIfNotExists(this, this[httpRequestSymbol], document, options)
1732
1679
  );
1733
1680
  }
1734
1681
  createOrReplace(document, options) {
1735
1682
  return rxjs.lastValueFrom(
1736
- _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)
1683
+ _createOrReplace(this, this[httpRequestSymbol], document, options)
1737
1684
  );
1738
1685
  }
1739
1686
  delete(selection, options) {
1740
- return rxjs.lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));
1687
+ return rxjs.lastValueFrom(_delete(this, this[httpRequestSymbol], selection, options));
1741
1688
  }
1742
1689
  mutate(operations, options) {
1743
- return rxjs.lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));
1690
+ return rxjs.lastValueFrom(_mutate(this, this[httpRequestSymbol], operations, options));
1744
1691
  }
1745
1692
  /**
1746
1693
  * Create a new buildable patch of operations to perform
@@ -1768,7 +1715,7 @@ const _SanityClient = class _SanityClient {
1768
1715
  * @returns Promise resolving to the response body
1769
1716
  */
1770
1717
  request(options) {
1771
- return rxjs.lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));
1718
+ return rxjs.lastValueFrom(_request(this, this[httpRequestSymbol], options));
1772
1719
  }
1773
1720
  /**
1774
1721
  * Perform an HTTP request a `/data` sub-endpoint
@@ -1781,7 +1728,9 @@ const _SanityClient = class _SanityClient {
1781
1728
  * @internal
1782
1729
  */
1783
1730
  dataRequest(endpoint, body, options) {
1784
- return rxjs.lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));
1731
+ return rxjs.lastValueFrom(
1732
+ _dataRequest(this, this[httpRequestSymbol], endpoint, body, options)
1733
+ );
1785
1734
  }
1786
1735
  /**
1787
1736
  * Get a Sanity API URL for the URI provided
@@ -1802,8 +1751,6 @@ const _SanityClient = class _SanityClient {
1802
1751
  return _getDataUrl(this, operation, path);
1803
1752
  }
1804
1753
  };
1805
- _clientConfig2 = new WeakMap();
1806
- _httpRequest2 = new WeakMap();
1807
1754
  let SanityClient = _SanityClient;
1808
1755
 
1809
1756
  function defineCreateClientExports(envMiddleware, ClassConstructor) {
@@ -1820,7 +1767,7 @@ function defineCreateClientExports(envMiddleware, ClassConstructor) {
1820
1767
  }
1821
1768
 
1822
1769
  var name = "@sanity/client";
1823
- var version = "6.11.3";
1770
+ var version = "6.11.4-canary.1";
1824
1771
 
1825
1772
  const middleware = [
1826
1773
  middleware$1.debug({ verbose: true, namespace: "sanity:client" }),
@@ -1850,8 +1797,9 @@ exports.Patch = Patch;
1850
1797
  exports.SanityClient = SanityClient;
1851
1798
  exports.ServerError = ServerError;
1852
1799
  exports.Transaction = Transaction;
1853
- exports.defaultConfig = defaultConfig;
1800
+ exports.b = b;
1854
1801
  exports.defineCreateClientExports = defineCreateClientExports;
1855
1802
  exports.middleware = middleware;
1856
1803
  exports.printNoDefaultExport = printNoDefaultExport;
1857
- //# sourceMappingURL=nodeMiddleware-CHxg1-zH.cjs.map
1804
+ exports.vercelStegaCleanAll = vercelStegaCleanAll;
1805
+ //# sourceMappingURL=nodeMiddleware-_hIIS1d7.cjs.map