@sanity/client 6.14.0 → 6.14.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 (35) hide show
  1. package/dist/_chunks/{browserMiddleware-nhWQI70y.js → browserMiddleware-DhUBf_19.js} +197 -358
  2. package/dist/_chunks/{browserMiddleware-nhWQI70y.js.map → browserMiddleware-DhUBf_19.js.map} +1 -1
  3. package/dist/_chunks/{browserMiddleware-B2MFFa3m.cjs → browserMiddleware-FpdqDQ1o.cjs} +197 -358
  4. package/dist/_chunks/{browserMiddleware-B2MFFa3m.cjs.map → browserMiddleware-FpdqDQ1o.cjs.map} +1 -1
  5. package/dist/_chunks/{nodeMiddleware-Me3HWLoB.js → nodeMiddleware-BSZoKrW0.js} +199 -360
  6. package/dist/_chunks/{nodeMiddleware-Me3HWLoB.js.map → nodeMiddleware-BSZoKrW0.js.map} +1 -1
  7. package/dist/_chunks/{nodeMiddleware-CfcASl-f.cjs → nodeMiddleware-DmcqX3kz.cjs} +199 -360
  8. package/dist/_chunks/{nodeMiddleware-CfcASl-f.cjs.map → nodeMiddleware-DmcqX3kz.cjs.map} +1 -1
  9. package/dist/_chunks/{resolveEditInfo-CTU2TYdi.cjs → resolveEditInfo-BB1WiUDY.cjs} +21 -21
  10. package/dist/_chunks/{resolveEditInfo-CTU2TYdi.cjs.map → resolveEditInfo-BB1WiUDY.cjs.map} +1 -1
  11. package/dist/_chunks/{resolveEditInfo-DX-6auJZ.js → resolveEditInfo-Cf8D1Agp.js} +21 -21
  12. package/dist/_chunks/{resolveEditInfo-DX-6auJZ.js.map → resolveEditInfo-Cf8D1Agp.js.map} +1 -1
  13. package/dist/_chunks/{stegaEncodeSourceMap-DTaF28aJ.cjs → stegaEncodeSourceMap-8TjLXjYU.cjs} +10 -10
  14. package/dist/_chunks/{stegaEncodeSourceMap-DTaF28aJ.cjs.map → stegaEncodeSourceMap-8TjLXjYU.cjs.map} +1 -1
  15. package/dist/_chunks/{stegaEncodeSourceMap-Do4zj2pO.cjs → stegaEncodeSourceMap-DIcuvN0P.cjs} +27 -27
  16. package/dist/_chunks/{stegaEncodeSourceMap-Do4zj2pO.cjs.map → stegaEncodeSourceMap-DIcuvN0P.cjs.map} +1 -1
  17. package/dist/_chunks/{stegaEncodeSourceMap-B6IscnhR.js → stegaEncodeSourceMap-DLon0Yls.js} +27 -27
  18. package/dist/_chunks/{stegaEncodeSourceMap-B6IscnhR.js.map → stegaEncodeSourceMap-DLon0Yls.js.map} +1 -1
  19. package/dist/_chunks/{stegaEncodeSourceMap-DS4_14pP.js → stegaEncodeSourceMap-DU95idpa.js} +10 -10
  20. package/dist/_chunks/{stegaEncodeSourceMap-DS4_14pP.js.map → stegaEncodeSourceMap-DU95idpa.js.map} +1 -1
  21. package/dist/csm.cjs +3 -3
  22. package/dist/csm.cjs.map +1 -1
  23. package/dist/csm.js +4 -4
  24. package/dist/csm.js.map +1 -1
  25. package/dist/index.browser.cjs +1 -1
  26. package/dist/index.browser.js +2 -2
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.js +2 -2
  29. package/dist/stega.browser.cjs +2 -2
  30. package/dist/stega.browser.js +3 -3
  31. package/dist/stega.cjs +2 -2
  32. package/dist/stega.js +3 -3
  33. package/package.json +8 -8
  34. package/umd/sanityClient.js +2591 -2776
  35. package/umd/sanityClient.min.js +3 -3
@@ -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 {
@@ -32,7 +32,7 @@ function extractErrorProps(res) {
32
32
  details: void 0
33
33
  };
34
34
  if (body.error && body.message) {
35
- props.message = "".concat(body.error, " - ").concat(body.message);
35
+ props.message = `${body.error} - ${body.message}`;
36
36
  return props;
37
37
  }
38
38
  if (isMutationError(body)) {
@@ -41,11 +41,13 @@ function extractErrorProps(res) {
41
41
  var _a;
42
42
  return (_a = item.error) == null ? void 0 : _a.description;
43
43
  }).filter(Boolean);
44
- let itemsStr = items.length ? ":\n- ".concat(items.join("\n- ")) : "";
44
+ let itemsStr = items.length ? `:
45
+ - ${items.join("\n- ")}` : "";
45
46
  if (allItems.length > MAX_ITEMS_IN_ERROR_MESSAGE) {
46
- itemsStr += "\n...and ".concat(allItems.length - MAX_ITEMS_IN_ERROR_MESSAGE, " more");
47
+ itemsStr += `
48
+ ...and ${allItems.length - MAX_ITEMS_IN_ERROR_MESSAGE} more`;
47
49
  }
48
- props.message = "".concat(body.error.description).concat(itemsStr);
50
+ props.message = `${body.error.description}${itemsStr}`;
49
51
  props.details = body.error;
50
52
  return props;
51
53
  }
@@ -64,8 +66,8 @@ function isPlainObject(obj) {
64
66
  return typeof obj === "object" && obj !== null && !Array.isArray(obj);
65
67
  }
66
68
  function httpErrorMessage(res) {
67
- const statusMessage = res.statusMessage ? " ".concat(res.statusMessage) : "";
68
- return "".concat(res.method, "-request to ").concat(res.url, " resulted in HTTP ").concat(res.statusCode).concat(statusMessage);
69
+ const statusMessage = res.statusMessage ? ` ${res.statusMessage}` : "";
70
+ return `${res.method}-request to ${res.url} resulted in HTTP ${res.statusCode}${statusMessage}`;
69
71
  }
70
72
  function stringifyBody(body, res) {
71
73
  const contentType = (res.headers["content-type"] || "").toLowerCase();
@@ -142,7 +144,9 @@ function getSelection(sel) {
142
144
  "* Array of document IDs",
143
145
  "* Object containing `query`"
144
146
  ].join("\n");
145
- throw new Error("Unknown selection - must be one of:\n\n".concat(selectionOpts));
147
+ throw new Error(`Unknown selection - must be one of:
148
+
149
+ ${selectionOpts}`);
146
150
  }
147
151
 
148
152
  const VALID_ASSET_TYPES = ["image", "file"];
@@ -161,36 +165,36 @@ const projectId = (id) => {
161
165
  };
162
166
  const validateAssetType = (type) => {
163
167
  if (VALID_ASSET_TYPES.indexOf(type) === -1) {
164
- throw new Error("Invalid asset type: ".concat(type, ". Must be one of ").concat(VALID_ASSET_TYPES.join(", ")));
168
+ throw new Error(`Invalid asset type: ${type}. Must be one of ${VALID_ASSET_TYPES.join(", ")}`);
165
169
  }
166
170
  };
167
171
  const validateObject = (op, val) => {
168
172
  if (val === null || typeof val !== "object" || Array.isArray(val)) {
169
- throw new Error("".concat(op, "() takes an object of properties"));
173
+ throw new Error(`${op}() takes an object of properties`);
170
174
  }
171
175
  };
172
176
  const validateDocumentId = (op, id) => {
173
177
  if (typeof id !== "string" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(id) || id.includes("..")) {
174
- throw new Error("".concat(op, '(): "').concat(id, '" is not a valid document ID'));
178
+ throw new Error(`${op}(): "${id}" is not a valid document ID`);
175
179
  }
176
180
  };
177
181
  const requireDocumentId = (op, doc) => {
178
182
  if (!doc._id) {
179
- throw new Error("".concat(op, '() requires that the document contains an ID ("_id" property)'));
183
+ throw new Error(`${op}() requires that the document contains an ID ("_id" property)`);
180
184
  }
181
185
  validateDocumentId(op, doc._id);
182
186
  };
183
187
  const validateInsert = (at, selector, items) => {
184
188
  const signature = "insert(at, selector, items)";
185
189
  if (VALID_INSERT_LOCATIONS.indexOf(at) === -1) {
186
- const valid = VALID_INSERT_LOCATIONS.map((loc) => '"'.concat(loc, '"')).join(", ");
187
- throw new Error("".concat(signature, ' takes an "at"-argument which is one of: ').concat(valid));
190
+ const valid = VALID_INSERT_LOCATIONS.map((loc) => `"${loc}"`).join(", ");
191
+ throw new Error(`${signature} takes an "at"-argument which is one of: ${valid}`);
188
192
  }
189
193
  if (typeof selector !== "string") {
190
- throw new Error("".concat(signature, ' takes a "selector"-argument which must be a string'));
194
+ throw new Error(`${signature} takes a "selector"-argument which must be a string`);
191
195
  }
192
196
  if (!Array.isArray(items)) {
193
- throw new Error("".concat(signature, ' takes an "items"-argument which must be an array'));
197
+ throw new Error(`${signature} takes an "items"-argument which must be an array`);
194
198
  }
195
199
  };
196
200
  const hasDataset = (config) => {
@@ -202,31 +206,12 @@ const hasDataset = (config) => {
202
206
  const requestTag = (tag) => {
203
207
  if (typeof tag !== "string" || !/^[a-z0-9._-]{1,75}$/i.test(tag)) {
204
208
  throw new Error(
205
- "Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long."
209
+ `Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long.`
206
210
  );
207
211
  }
208
212
  return tag;
209
213
  };
210
214
 
211
- var __accessCheck$6 = (obj, member, msg) => {
212
- if (!member.has(obj))
213
- throw TypeError("Cannot " + msg);
214
- };
215
- var __privateGet$6 = (obj, member, getter) => {
216
- __accessCheck$6(obj, member, "read from private field");
217
- return getter ? getter.call(obj) : member.get(obj);
218
- };
219
- var __privateAdd$6 = (obj, member, value) => {
220
- if (member.has(obj))
221
- throw TypeError("Cannot add the same private member more than once");
222
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
223
- };
224
- var __privateSet$6 = (obj, member, value, setter) => {
225
- __accessCheck$6(obj, member, "write to private field");
226
- setter ? setter.call(obj, value) : member.set(obj, value);
227
- return value;
228
- };
229
- var _client$5, _client2$5;
230
215
  class BasePatch {
231
216
  constructor(selection, operations = {}) {
232
217
  this.selection = selection;
@@ -307,7 +292,7 @@ class BasePatch {
307
292
  * @param items - Array of items to append to the array
308
293
  */
309
294
  append(selector, items) {
310
- return this.insert("after", "".concat(selector, "[-1]"), items);
295
+ return this.insert("after", `${selector}[-1]`, items);
311
296
  }
312
297
  /**
313
298
  * Prepend the given items to the array at the given JSONPath
@@ -316,7 +301,7 @@ class BasePatch {
316
301
  * @param items - Array of items to prepend to the array
317
302
  */
318
303
  prepend(selector, items) {
319
- return this.insert("before", "".concat(selector, "[0]"), items);
304
+ return this.insert("before", `${selector}[0]`, items);
320
305
  }
321
306
  /**
322
307
  * Change the contents of an array by removing existing elements and/or adding new elements.
@@ -331,7 +316,7 @@ class BasePatch {
331
316
  const startIndex = start < 0 ? start - 1 : start;
332
317
  const delCount = delAll ? -1 : Math.max(0, start + deleteCount);
333
318
  const delRange = startIndex < 0 && delCount >= 0 ? "" : delCount;
334
- const rangeSelector = "".concat(selector, "[").concat(startIndex, ":").concat(delRange, "]");
319
+ const rangeSelector = `${selector}[${startIndex}:${delRange}]`;
335
320
  return this.insert("replace", rangeSelector, items || []);
336
321
  }
337
322
  /**
@@ -373,76 +358,53 @@ class BasePatch {
373
358
  return this._assign(op, props, false);
374
359
  }
375
360
  }
376
- const _ObservablePatch = class _ObservablePatch extends BasePatch {
361
+ class ObservablePatch extends BasePatch {
362
+ #client;
377
363
  constructor(selection, operations, client) {
378
364
  super(selection, operations);
379
- __privateAdd$6(this, _client$5, void 0);
380
- __privateSet$6(this, _client$5, client);
365
+ this.#client = client;
381
366
  }
382
367
  /**
383
368
  * Clones the patch
384
369
  */
385
370
  clone() {
386
- return new _ObservablePatch(this.selection, { ...this.operations }, __privateGet$6(this, _client$5));
371
+ return new ObservablePatch(this.selection, { ...this.operations }, this.#client);
387
372
  }
388
373
  commit(options) {
389
- if (!__privateGet$6(this, _client$5)) {
374
+ if (!this.#client) {
390
375
  throw new Error(
391
376
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
392
377
  );
393
378
  }
394
379
  const returnFirst = typeof this.selection === "string";
395
380
  const opts = Object.assign({ returnFirst, returnDocuments: true }, options);
396
- return __privateGet$6(this, _client$5).mutate({ patch: this.serialize() }, opts);
381
+ return this.#client.mutate({ patch: this.serialize() }, opts);
397
382
  }
398
- };
399
- _client$5 = new WeakMap();
400
- let ObservablePatch = _ObservablePatch;
401
- const _Patch = class _Patch extends BasePatch {
383
+ }
384
+ class Patch extends BasePatch {
385
+ #client;
402
386
  constructor(selection, operations, client) {
403
387
  super(selection, operations);
404
- __privateAdd$6(this, _client2$5, void 0);
405
- __privateSet$6(this, _client2$5, client);
388
+ this.#client = client;
406
389
  }
407
390
  /**
408
391
  * Clones the patch
409
392
  */
410
393
  clone() {
411
- return new _Patch(this.selection, { ...this.operations }, __privateGet$6(this, _client2$5));
394
+ return new Patch(this.selection, { ...this.operations }, this.#client);
412
395
  }
413
396
  commit(options) {
414
- if (!__privateGet$6(this, _client2$5)) {
397
+ if (!this.#client) {
415
398
  throw new Error(
416
399
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
417
400
  );
418
401
  }
419
402
  const returnFirst = typeof this.selection === "string";
420
403
  const opts = Object.assign({ returnFirst, returnDocuments: true }, options);
421
- return __privateGet$6(this, _client2$5).mutate({ patch: this.serialize() }, opts);
404
+ return this.#client.mutate({ patch: this.serialize() }, opts);
422
405
  }
423
- };
424
- _client2$5 = new WeakMap();
425
- let Patch = _Patch;
406
+ }
426
407
 
427
- var __accessCheck$5 = (obj, member, msg) => {
428
- if (!member.has(obj))
429
- throw TypeError("Cannot " + msg);
430
- };
431
- var __privateGet$5 = (obj, member, getter) => {
432
- __accessCheck$5(obj, member, "read from private field");
433
- return getter ? getter.call(obj) : member.get(obj);
434
- };
435
- var __privateAdd$5 = (obj, member, value) => {
436
- if (member.has(obj))
437
- throw TypeError("Cannot add the same private member more than once");
438
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
439
- };
440
- var __privateSet$5 = (obj, member, value, setter) => {
441
- __accessCheck$5(obj, member, "write to private field");
442
- setter ? setter.call(obj, value) : member.set(obj, value);
443
- return value;
444
- };
445
- var _client$4, _client2$4;
446
408
  const defaultMutateOptions = { returnDocuments: false };
447
409
  class BaseTransaction {
448
410
  constructor(operations = [], transactionId) {
@@ -524,25 +486,25 @@ class BaseTransaction {
524
486
  return this;
525
487
  }
526
488
  }
527
- const _Transaction = class _Transaction extends BaseTransaction {
489
+ class Transaction extends BaseTransaction {
490
+ #client;
528
491
  constructor(operations, client, transactionId) {
529
492
  super(operations, transactionId);
530
- __privateAdd$5(this, _client$4, void 0);
531
- __privateSet$5(this, _client$4, client);
493
+ this.#client = client;
532
494
  }
533
495
  /**
534
496
  * Clones the transaction
535
497
  */
536
498
  clone() {
537
- return new _Transaction([...this.operations], __privateGet$5(this, _client$4), this.trxId);
499
+ return new Transaction([...this.operations], this.#client, this.trxId);
538
500
  }
539
501
  commit(options) {
540
- if (!__privateGet$5(this, _client$4)) {
502
+ if (!this.#client) {
541
503
  throw new Error(
542
504
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
543
505
  );
544
506
  }
545
- return __privateGet$5(this, _client$4).mutate(
507
+ return this.#client.mutate(
546
508
  this.serialize(),
547
509
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
548
510
  );
@@ -554,7 +516,7 @@ const _Transaction = class _Transaction extends BaseTransaction {
554
516
  return this._add({ patch: patchOrDocumentId.serialize() });
555
517
  }
556
518
  if (isBuilder) {
557
- const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$5(this, _client$4)));
519
+ const patch = patchOps(new Patch(patchOrDocumentId, {}, this.#client));
558
520
  if (!(patch instanceof Patch)) {
559
521
  throw new Error("function passed to `patch()` must return the patch");
560
522
  }
@@ -562,28 +524,26 @@ const _Transaction = class _Transaction extends BaseTransaction {
562
524
  }
563
525
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
564
526
  }
565
- };
566
- _client$4 = new WeakMap();
567
- let Transaction = _Transaction;
568
- const _ObservableTransaction = class _ObservableTransaction extends BaseTransaction {
527
+ }
528
+ class ObservableTransaction extends BaseTransaction {
529
+ #client;
569
530
  constructor(operations, client, transactionId) {
570
531
  super(operations, transactionId);
571
- __privateAdd$5(this, _client2$4, void 0);
572
- __privateSet$5(this, _client2$4, client);
532
+ this.#client = client;
573
533
  }
574
534
  /**
575
535
  * Clones the transaction
576
536
  */
577
537
  clone() {
578
- return new _ObservableTransaction([...this.operations], __privateGet$5(this, _client2$4), this.trxId);
538
+ return new ObservableTransaction([...this.operations], this.#client, this.trxId);
579
539
  }
580
540
  commit(options) {
581
- if (!__privateGet$5(this, _client2$4)) {
541
+ if (!this.#client) {
582
542
  throw new Error(
583
543
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
584
544
  );
585
545
  }
586
- return __privateGet$5(this, _client2$4).mutate(
546
+ return this.#client.mutate(
587
547
  this.serialize(),
588
548
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
589
549
  );
@@ -595,7 +555,7 @@ const _ObservableTransaction = class _ObservableTransaction extends BaseTransact
595
555
  return this._add({ patch: patchOrDocumentId.serialize() });
596
556
  }
597
557
  if (isBuilder) {
598
- const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$5(this, _client2$4)));
558
+ const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, this.#client));
599
559
  if (!(patch instanceof ObservablePatch)) {
600
560
  throw new Error("function passed to `patch()` must return the patch");
601
561
  }
@@ -603,9 +563,7 @@ const _ObservableTransaction = class _ObservableTransaction extends BaseTransact
603
563
  }
604
564
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
605
565
  }
606
- };
607
- _client2$4 = new WeakMap();
608
- let ObservableTransaction = _ObservableTransaction;
566
+ }
609
567
 
610
568
  const BASE_URL = "https://www.sanity.io/help/";
611
569
  function generateHelpUrl(slug) {
@@ -630,23 +588,23 @@ const createWarningPrinter = (message) => (
630
588
  once((...args) => console.warn(message.join(" "), ...args))
631
589
  );
632
590
  const printCdnWarning = createWarningPrinter([
633
- "Since you haven't set a value for `useCdn`, we will deliver content using our",
634
- "global, edge-cached API-CDN. If you wish to have content delivered faster, set",
635
- "`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."
591
+ `Since you haven't set a value for \`useCdn\`, we will deliver content using our`,
592
+ `global, edge-cached API-CDN. If you wish to have content delivered faster, set`,
593
+ `\`useCdn: false\` to use the Live API. Note: You may incur higher costs using the live API.`
636
594
  ]);
637
595
  const printCdnPreviewDraftsWarning = createWarningPrinter([
638
- "The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.",
639
- "The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."
596
+ `The Sanity client is configured with the \`perspective\` set to \`previewDrafts\`, which doesn't support the API-CDN.`,
597
+ `The Live API will be used instead. Set \`useCdn: false\` in your configuration to hide this warning.`
640
598
  ]);
641
599
  const printBrowserTokenWarning = createWarningPrinter([
642
600
  "You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",
643
- "See ".concat(generateHelpUrl(
601
+ `See ${generateHelpUrl(
644
602
  "js-client-browser-token"
645
- ), " for more information and how to hide this warning.")
603
+ )} for more information and how to hide this warning.`
646
604
  ]);
647
605
  const printNoApiVersionSpecifiedWarning = createWarningPrinter([
648
606
  "Using the Sanity client without specifying an API version is deprecated.",
649
- "See ".concat(generateHelpUrl("js-client-api-version"))
607
+ `See ${generateHelpUrl("js-client-api-version")}`
650
608
  ]);
651
609
  const printNoDefaultExport = createWarningPrinter([
652
610
  "The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."
@@ -702,7 +660,7 @@ const initConfig = (config, prevConfig) => {
702
660
  const projectBased = newConfig.useProjectHostname;
703
661
  if (typeof Promise === "undefined") {
704
662
  const helpUrl = generateHelpUrl("js-client-promise-polyfill");
705
- throw new Error("No native Promise-implementation found, polyfill needed - see ".concat(helpUrl));
663
+ throw new Error(`No native Promise-implementation found, polyfill needed - see ${helpUrl}`);
706
664
  }
707
665
  if (projectBased && !newConfig.projectId) {
708
666
  throw new Error("Configuration must contain `projectId`");
@@ -712,23 +670,23 @@ const initConfig = (config, prevConfig) => {
712
670
  }
713
671
  if ("encodeSourceMap" in newConfig) {
714
672
  throw new Error(
715
- "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'?"
673
+ `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'?`
716
674
  );
717
675
  }
718
676
  if ("encodeSourceMapAtPath" in newConfig) {
719
677
  throw new Error(
720
- "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'?"
678
+ `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'?`
721
679
  );
722
680
  }
723
681
  if (typeof newConfig.stega.enabled !== "boolean") {
724
- throw new Error("stega.enabled must be a boolean, received ".concat(newConfig.stega.enabled));
682
+ throw new Error(`stega.enabled must be a boolean, received ${newConfig.stega.enabled}`);
725
683
  }
726
684
  if (newConfig.stega.enabled && newConfig.stega.studioUrl === void 0) {
727
- throw new Error("stega.studioUrl must be defined when stega.enabled is true");
685
+ throw new Error(`stega.studioUrl must be defined when stega.enabled is true`);
728
686
  }
729
687
  if (newConfig.stega.enabled && typeof newConfig.stega.studioUrl !== "string" && typeof newConfig.stega.studioUrl !== "function") {
730
688
  throw new Error(
731
- "stega.studioUrl must be a string or a function, received ".concat(newConfig.stega.studioUrl)
689
+ `stega.studioUrl must be a string or a function, received ${newConfig.stega.studioUrl}`
732
690
  );
733
691
  }
734
692
  const isBrowser = typeof window !== "undefined" && window.location && window.location.hostname;
@@ -747,7 +705,7 @@ const initConfig = (config, prevConfig) => {
747
705
  if ("requestTagPrefix" in newConfig) {
748
706
  newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\.+$/, "") : void 0;
749
707
  }
750
- newConfig.apiVersion = "".concat(newConfig.apiVersion).replace(/^v/, "");
708
+ newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, "");
751
709
  newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost;
752
710
  newConfig.useCdn = newConfig.useCdn !== false && !newConfig.withCredentials;
753
711
  validateApiVersion(newConfig.apiVersion);
@@ -756,10 +714,10 @@ const initConfig = (config, prevConfig) => {
756
714
  const host = hostParts[1];
757
715
  const cdnHost = newConfig.isDefaultApi ? defaultCdnHost : host;
758
716
  if (newConfig.useProjectHostname) {
759
- newConfig.url = "".concat(protocol, "://").concat(newConfig.projectId, ".").concat(host, "/v").concat(newConfig.apiVersion);
760
- newConfig.cdnUrl = "".concat(protocol, "://").concat(newConfig.projectId, ".").concat(cdnHost, "/v").concat(newConfig.apiVersion);
717
+ newConfig.url = `${protocol}://${newConfig.projectId}.${host}/v${newConfig.apiVersion}`;
718
+ newConfig.cdnUrl = `${protocol}://${newConfig.projectId}.${cdnHost}/v${newConfig.apiVersion}`;
761
719
  } else {
762
- newConfig.url = "".concat(newConfig.apiHost, "/v").concat(newConfig.apiVersion);
720
+ newConfig.url = `${newConfig.apiHost}/v${newConfig.apiVersion}`;
763
721
  newConfig.cdnUrl = newConfig.url;
764
722
  }
765
723
  return newConfig;
@@ -770,7 +728,7 @@ function requestOptions(config, overrides = {}) {
770
728
  const headers = {};
771
729
  const token = overrides.token || config.token;
772
730
  if (token) {
773
- headers.Authorization = "Bearer ".concat(token);
731
+ headers.Authorization = `Bearer ${token}`;
774
732
  }
775
733
  if (!overrides.useGlobalApi && !config.useProjectHostname && config.projectId) {
776
734
  headers[projectHeader] = config.projectId;
@@ -816,15 +774,15 @@ const encodeQueryString = ({
816
774
  searchParams.append("tag", tag);
817
775
  searchParams.append("query", query);
818
776
  for (const [key, value] of Object.entries(params)) {
819
- searchParams.append("$".concat(key), JSON.stringify(value));
777
+ searchParams.append(`$${key}`, JSON.stringify(value));
820
778
  }
821
779
  for (const [key, value] of Object.entries(opts)) {
822
780
  if (value)
823
- searchParams.append(key, "".concat(value));
781
+ searchParams.append(key, `${value}`);
824
782
  }
825
783
  if (returnQuery === false)
826
784
  searchParams.append("returnQuery", "false");
827
- return "?".concat(searchParams);
785
+ return `?${searchParams}`;
828
786
  };
829
787
 
830
788
  const excludeFalsey = (param, defValue) => {
@@ -871,7 +829,7 @@ function _fetch(client, httpRequest, _stega, query, _params = {}, options = {})
871
829
  return stega.enabled ? $request.pipe(
872
830
  operators.combineLatestWith(
873
831
  rxjs.from(
874
- Promise.resolve().then(function () { return require('./stegaEncodeSourceMap-DTaF28aJ.cjs'); }).then(function (n) { return n.stegaEncodeSourceMap$1; }).then(
832
+ Promise.resolve().then(function () { return require('./stegaEncodeSourceMap-8TjLXjYU.cjs'); }).then(function (n) { return n.stegaEncodeSourceMap$1; }).then(
875
833
  ({ stegaEncodeSourceMap }) => stegaEncodeSourceMap
876
834
  )
877
835
  )
@@ -986,17 +944,16 @@ function _create(client, httpRequest, doc, op, options = {}) {
986
944
  return _dataRequest(client, httpRequest, "mutate", { mutations: [mutation] }, opts);
987
945
  }
988
946
  function _requestObservable(client, httpRequest, options) {
989
- var _a, _b;
990
947
  const uri = options.url || options.uri;
991
948
  const config = client.config();
992
949
  const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
993
- let useCdn = ((_a = options.useCdn) != null ? _a : config.useCdn) && canUseCdn;
950
+ let useCdn = (options.useCdn ?? config.useCdn) && canUseCdn;
994
951
  const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
995
952
  if (tag && options.tag !== null) {
996
953
  options.query = { tag: requestTag(tag), ...options.query };
997
954
  }
998
955
  if (["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
999
- const resultSourceMap = (_b = options.resultSourceMap) != null ? _b : config.resultSourceMap;
956
+ const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
1000
957
  if (resultSourceMap !== void 0 && resultSourceMap !== false) {
1001
958
  options.query = { resultSourceMap, ...options.query };
1002
959
  }
@@ -1034,14 +991,14 @@ function _request(client, httpRequest, options) {
1034
991
  function _getDataUrl(client, operation, path) {
1035
992
  const config = client.config();
1036
993
  const catalog = hasDataset(config);
1037
- const baseUri = "/".concat(operation, "/").concat(catalog);
1038
- const uri = path ? "".concat(baseUri, "/").concat(path) : baseUri;
1039
- return "/data".concat(uri).replace(/\/($|\?)/, "$1");
994
+ const baseUri = `/${operation}/${catalog}`;
995
+ const uri = path ? `${baseUri}/${path}` : baseUri;
996
+ return `/data${uri}`.replace(/\/($|\?)/, "$1");
1040
997
  }
1041
998
  function _getUrl(client, uri, canUseCdn = false) {
1042
999
  const { url, cdnUrl } = client.config();
1043
1000
  const base = canUseCdn ? cdnUrl : url;
1044
- return "".concat(base, "/").concat(uri.replace(/^\//, ""));
1001
+ return `${base}/${uri.replace(/^\//, "")}`;
1045
1002
  }
1046
1003
  function _withAbortSignal(signal) {
1047
1004
  return (input) => {
@@ -1062,56 +1019,34 @@ function _withAbortSignal(signal) {
1062
1019
  }
1063
1020
  const isDomExceptionSupported = Boolean(globalThis.DOMException);
1064
1021
  function _createAbortError(signal) {
1065
- var _a, _b;
1066
1022
  if (isDomExceptionSupported) {
1067
- return new DOMException((_a = signal == null ? void 0 : signal.reason) != null ? _a : "The operation was aborted.", "AbortError");
1023
+ return new DOMException((signal == null ? void 0 : signal.reason) ?? "The operation was aborted.", "AbortError");
1068
1024
  }
1069
- const error = new Error((_b = signal == null ? void 0 : signal.reason) != null ? _b : "The operation was aborted.");
1025
+ const error = new Error((signal == null ? void 0 : signal.reason) ?? "The operation was aborted.");
1070
1026
  error.name = "AbortError";
1071
1027
  return error;
1072
1028
  }
1073
1029
 
1074
- var __accessCheck$4 = (obj, member, msg) => {
1075
- if (!member.has(obj))
1076
- throw TypeError("Cannot " + msg);
1077
- };
1078
- var __privateGet$4 = (obj, member, getter) => {
1079
- __accessCheck$4(obj, member, "read from private field");
1080
- return getter ? getter.call(obj) : member.get(obj);
1081
- };
1082
- var __privateAdd$4 = (obj, member, value) => {
1083
- if (member.has(obj))
1084
- throw TypeError("Cannot add the same private member more than once");
1085
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1086
- };
1087
- var __privateSet$4 = (obj, member, value, setter) => {
1088
- __accessCheck$4(obj, member, "write to private field");
1089
- setter ? setter.call(obj, value) : member.set(obj, value);
1090
- return value;
1091
- };
1092
- var _client$3, _httpRequest$4, _client2$3, _httpRequest2$4;
1093
1030
  class ObservableAssetsClient {
1031
+ #client;
1032
+ #httpRequest;
1094
1033
  constructor(client, httpRequest) {
1095
- __privateAdd$4(this, _client$3, void 0);
1096
- __privateAdd$4(this, _httpRequest$4, void 0);
1097
- __privateSet$4(this, _client$3, client);
1098
- __privateSet$4(this, _httpRequest$4, httpRequest);
1034
+ this.#client = client;
1035
+ this.#httpRequest = httpRequest;
1099
1036
  }
1100
1037
  upload(assetType, body, options) {
1101
- return _upload(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), assetType, body, options);
1038
+ return _upload(this.#client, this.#httpRequest, assetType, body, options);
1102
1039
  }
1103
1040
  }
1104
- _client$3 = new WeakMap();
1105
- _httpRequest$4 = new WeakMap();
1106
1041
  class AssetsClient {
1042
+ #client;
1043
+ #httpRequest;
1107
1044
  constructor(client, httpRequest) {
1108
- __privateAdd$4(this, _client2$3, void 0);
1109
- __privateAdd$4(this, _httpRequest2$4, void 0);
1110
- __privateSet$4(this, _client2$3, client);
1111
- __privateSet$4(this, _httpRequest2$4, httpRequest);
1045
+ this.#client = client;
1046
+ this.#httpRequest = httpRequest;
1112
1047
  }
1113
1048
  upload(assetType, body, options) {
1114
- const observable = _upload(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), assetType, body, options);
1049
+ const observable = _upload(this.#client, this.#httpRequest, assetType, body, options);
1115
1050
  return rxjs.lastValueFrom(
1116
1051
  observable.pipe(
1117
1052
  operators.filter((event) => event.type === "response"),
@@ -1122,8 +1057,6 @@ class AssetsClient {
1122
1057
  );
1123
1058
  }
1124
1059
  }
1125
- _client2$3 = new WeakMap();
1126
- _httpRequest2$4 = new WeakMap();
1127
1060
  function _upload(client, httpRequest, assetType, body, opts = {}) {
1128
1061
  validateAssetType(assetType);
1129
1062
  let meta = opts.extract || void 0;
@@ -1151,7 +1084,7 @@ function _upload(client, httpRequest, assetType, body, opts = {}) {
1151
1084
  tag,
1152
1085
  method: "POST",
1153
1086
  timeout: options.timeout || 0,
1154
- uri: "/assets/".concat(assetEndpoint, "/").concat(dataset),
1087
+ uri: `/assets/${assetEndpoint}/${dataset}`,
1155
1088
  headers: options.contentType ? { "Content-Type": options.contentType } : {},
1156
1089
  query,
1157
1090
  body
@@ -1200,7 +1133,7 @@ function _listen(query, params, opts = {}) {
1200
1133
  const options = { ...defaults(opts, defaultOptions), tag };
1201
1134
  const listenOpts = pick(options, possibleOptions);
1202
1135
  const qs = encodeQueryString({ query, params, options: { tag, ...listenOpts } });
1203
- const uri = "".concat(url).concat(_getDataUrl(this, "listen", qs));
1136
+ const uri = `${url}${_getDataUrl(this, "listen", qs)}`;
1204
1137
  if (uri.length > MAX_URL_LENGTH) {
1205
1138
  return new rxjs.Observable((observer) => observer.error(new Error("Query too large for listener")));
1206
1139
  }
@@ -1212,7 +1145,7 @@ function _listen(query, params, opts = {}) {
1212
1145
  }
1213
1146
  if (token) {
1214
1147
  esOptions.headers = {
1215
- Authorization: "Bearer ".concat(token)
1148
+ Authorization: `Bearer ${token}`
1216
1149
  };
1217
1150
  }
1218
1151
  return new rxjs.Observable((observer) => {
@@ -1314,31 +1247,12 @@ function extractErrorMessage(err) {
1314
1247
  return typeof err.error === "string" ? err.error : JSON.stringify(err.error, null, 2);
1315
1248
  }
1316
1249
 
1317
- var __accessCheck$3 = (obj, member, msg) => {
1318
- if (!member.has(obj))
1319
- throw TypeError("Cannot " + msg);
1320
- };
1321
- var __privateGet$3 = (obj, member, getter) => {
1322
- __accessCheck$3(obj, member, "read from private field");
1323
- return getter ? getter.call(obj) : member.get(obj);
1324
- };
1325
- var __privateAdd$3 = (obj, member, value) => {
1326
- if (member.has(obj))
1327
- throw TypeError("Cannot add the same private member more than once");
1328
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1329
- };
1330
- var __privateSet$3 = (obj, member, value, setter) => {
1331
- __accessCheck$3(obj, member, "write to private field");
1332
- setter ? setter.call(obj, value) : member.set(obj, value);
1333
- return value;
1334
- };
1335
- var _client$2, _httpRequest$3, _client2$2, _httpRequest2$3;
1336
1250
  class ObservableDatasetsClient {
1251
+ #client;
1252
+ #httpRequest;
1337
1253
  constructor(client, httpRequest) {
1338
- __privateAdd$3(this, _client$2, void 0);
1339
- __privateAdd$3(this, _httpRequest$3, void 0);
1340
- __privateSet$3(this, _client$2, client);
1341
- __privateSet$3(this, _httpRequest$3, httpRequest);
1254
+ this.#client = client;
1255
+ this.#httpRequest = httpRequest;
1342
1256
  }
1343
1257
  /**
1344
1258
  * Create a new dataset with the given name
@@ -1347,7 +1261,7 @@ class ObservableDatasetsClient {
1347
1261
  * @param options - Options for the dataset
1348
1262
  */
1349
1263
  create(name, options) {
1350
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PUT", name, options);
1264
+ return _modify(this.#client, this.#httpRequest, "PUT", name, options);
1351
1265
  }
1352
1266
  /**
1353
1267
  * Edit a dataset with the given name
@@ -1356,7 +1270,7 @@ class ObservableDatasetsClient {
1356
1270
  * @param options - New options for the dataset
1357
1271
  */
1358
1272
  edit(name, options) {
1359
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "PATCH", name, options);
1273
+ return _modify(this.#client, this.#httpRequest, "PATCH", name, options);
1360
1274
  }
1361
1275
  /**
1362
1276
  * Delete a dataset with the given name
@@ -1364,26 +1278,24 @@ class ObservableDatasetsClient {
1364
1278
  * @param name - Name of the dataset to delete
1365
1279
  */
1366
1280
  delete(name) {
1367
- return _modify(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), "DELETE", name);
1281
+ return _modify(this.#client, this.#httpRequest, "DELETE", name);
1368
1282
  }
1369
1283
  /**
1370
1284
  * Fetch a list of datasets for the configured project
1371
1285
  */
1372
1286
  list() {
1373
- return _request(__privateGet$3(this, _client$2), __privateGet$3(this, _httpRequest$3), {
1287
+ return _request(this.#client, this.#httpRequest, {
1374
1288
  uri: "/datasets",
1375
1289
  tag: null
1376
1290
  });
1377
1291
  }
1378
1292
  }
1379
- _client$2 = new WeakMap();
1380
- _httpRequest$3 = new WeakMap();
1381
1293
  class DatasetsClient {
1294
+ #client;
1295
+ #httpRequest;
1382
1296
  constructor(client, httpRequest) {
1383
- __privateAdd$3(this, _client2$2, void 0);
1384
- __privateAdd$3(this, _httpRequest2$3, void 0);
1385
- __privateSet$3(this, _client2$2, client);
1386
- __privateSet$3(this, _httpRequest2$3, httpRequest);
1297
+ this.#client = client;
1298
+ this.#httpRequest = httpRequest;
1387
1299
  }
1388
1300
  /**
1389
1301
  * Create a new dataset with the given name
@@ -1393,7 +1305,7 @@ class DatasetsClient {
1393
1305
  */
1394
1306
  create(name, options) {
1395
1307
  return rxjs.lastValueFrom(
1396
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PUT", name, options)
1308
+ _modify(this.#client, this.#httpRequest, "PUT", name, options)
1397
1309
  );
1398
1310
  }
1399
1311
  /**
@@ -1404,7 +1316,7 @@ class DatasetsClient {
1404
1316
  */
1405
1317
  edit(name, options) {
1406
1318
  return rxjs.lastValueFrom(
1407
- _modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "PATCH", name, options)
1319
+ _modify(this.#client, this.#httpRequest, "PATCH", name, options)
1408
1320
  );
1409
1321
  }
1410
1322
  /**
@@ -1413,58 +1325,37 @@ class DatasetsClient {
1413
1325
  * @param name - Name of the dataset to delete
1414
1326
  */
1415
1327
  delete(name) {
1416
- return rxjs.lastValueFrom(_modify(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), "DELETE", name));
1328
+ return rxjs.lastValueFrom(_modify(this.#client, this.#httpRequest, "DELETE", name));
1417
1329
  }
1418
1330
  /**
1419
1331
  * Fetch a list of datasets for the configured project
1420
1332
  */
1421
1333
  list() {
1422
1334
  return rxjs.lastValueFrom(
1423
- _request(__privateGet$3(this, _client2$2), __privateGet$3(this, _httpRequest2$3), { uri: "/datasets", tag: null })
1335
+ _request(this.#client, this.#httpRequest, { uri: "/datasets", tag: null })
1424
1336
  );
1425
1337
  }
1426
1338
  }
1427
- _client2$2 = new WeakMap();
1428
- _httpRequest2$3 = new WeakMap();
1429
1339
  function _modify(client, httpRequest, method, name, options) {
1430
1340
  dataset(name);
1431
1341
  return _request(client, httpRequest, {
1432
1342
  method,
1433
- uri: "/datasets/".concat(name),
1343
+ uri: `/datasets/${name}`,
1434
1344
  body: options,
1435
1345
  tag: null
1436
1346
  });
1437
1347
  }
1438
1348
 
1439
- var __accessCheck$2 = (obj, member, msg) => {
1440
- if (!member.has(obj))
1441
- throw TypeError("Cannot " + msg);
1442
- };
1443
- var __privateGet$2 = (obj, member, getter) => {
1444
- __accessCheck$2(obj, member, "read from private field");
1445
- return getter ? getter.call(obj) : member.get(obj);
1446
- };
1447
- var __privateAdd$2 = (obj, member, value) => {
1448
- if (member.has(obj))
1449
- throw TypeError("Cannot add the same private member more than once");
1450
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1451
- };
1452
- var __privateSet$2 = (obj, member, value, setter) => {
1453
- __accessCheck$2(obj, member, "write to private field");
1454
- setter ? setter.call(obj, value) : member.set(obj, value);
1455
- return value;
1456
- };
1457
- var _client$1, _httpRequest$2, _client2$1, _httpRequest2$2;
1458
1349
  class ObservableProjectsClient {
1350
+ #client;
1351
+ #httpRequest;
1459
1352
  constructor(client, httpRequest) {
1460
- __privateAdd$2(this, _client$1, void 0);
1461
- __privateAdd$2(this, _httpRequest$2, void 0);
1462
- __privateSet$2(this, _client$1, client);
1463
- __privateSet$2(this, _httpRequest$2, httpRequest);
1353
+ this.#client = client;
1354
+ this.#httpRequest = httpRequest;
1464
1355
  }
1465
1356
  list(options) {
1466
1357
  const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1467
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri });
1358
+ return _request(this.#client, this.#httpRequest, { uri });
1468
1359
  }
1469
1360
  /**
1470
1361
  * Fetch a project by project ID
@@ -1472,21 +1363,19 @@ class ObservableProjectsClient {
1472
1363
  * @param projectId - ID of the project to fetch
1473
1364
  */
1474
1365
  getById(projectId) {
1475
- return _request(__privateGet$2(this, _client$1), __privateGet$2(this, _httpRequest$2), { uri: "/projects/".concat(projectId) });
1366
+ return _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` });
1476
1367
  }
1477
1368
  }
1478
- _client$1 = new WeakMap();
1479
- _httpRequest$2 = new WeakMap();
1480
1369
  class ProjectsClient {
1370
+ #client;
1371
+ #httpRequest;
1481
1372
  constructor(client, httpRequest) {
1482
- __privateAdd$2(this, _client2$1, void 0);
1483
- __privateAdd$2(this, _httpRequest2$2, void 0);
1484
- __privateSet$2(this, _client2$1, client);
1485
- __privateSet$2(this, _httpRequest2$2, httpRequest);
1373
+ this.#client = client;
1374
+ this.#httpRequest = httpRequest;
1486
1375
  }
1487
1376
  list(options) {
1488
1377
  const uri = (options == null ? void 0 : options.includeMembers) === false ? "/projects?includeMembers=false" : "/projects";
1489
- return rxjs.lastValueFrom(_request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri }));
1378
+ return rxjs.lastValueFrom(_request(this.#client, this.#httpRequest, { uri }));
1490
1379
  }
1491
1380
  /**
1492
1381
  * Fetch a project by project ID
@@ -1495,38 +1384,17 @@ class ProjectsClient {
1495
1384
  */
1496
1385
  getById(projectId) {
1497
1386
  return rxjs.lastValueFrom(
1498
- _request(__privateGet$2(this, _client2$1), __privateGet$2(this, _httpRequest2$2), { uri: "/projects/".concat(projectId) })
1387
+ _request(this.#client, this.#httpRequest, { uri: `/projects/${projectId}` })
1499
1388
  );
1500
1389
  }
1501
1390
  }
1502
- _client2$1 = new WeakMap();
1503
- _httpRequest2$2 = new WeakMap();
1504
1391
 
1505
- var __accessCheck$1 = (obj, member, msg) => {
1506
- if (!member.has(obj))
1507
- throw TypeError("Cannot " + msg);
1508
- };
1509
- var __privateGet$1 = (obj, member, getter) => {
1510
- __accessCheck$1(obj, member, "read from private field");
1511
- return getter ? getter.call(obj) : member.get(obj);
1512
- };
1513
- var __privateAdd$1 = (obj, member, value) => {
1514
- if (member.has(obj))
1515
- throw TypeError("Cannot add the same private member more than once");
1516
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1517
- };
1518
- var __privateSet$1 = (obj, member, value, setter) => {
1519
- __accessCheck$1(obj, member, "write to private field");
1520
- setter ? setter.call(obj, value) : member.set(obj, value);
1521
- return value;
1522
- };
1523
- var _client, _httpRequest$1, _client2, _httpRequest2$1;
1524
1392
  class ObservableUsersClient {
1393
+ #client;
1394
+ #httpRequest;
1525
1395
  constructor(client, httpRequest) {
1526
- __privateAdd$1(this, _client, void 0);
1527
- __privateAdd$1(this, _httpRequest$1, void 0);
1528
- __privateSet$1(this, _client, client);
1529
- __privateSet$1(this, _httpRequest$1, httpRequest);
1396
+ this.#client = client;
1397
+ this.#httpRequest = httpRequest;
1530
1398
  }
1531
1399
  /**
1532
1400
  * Fetch a user by user ID
@@ -1535,20 +1403,18 @@ class ObservableUsersClient {
1535
1403
  */
1536
1404
  getById(id) {
1537
1405
  return _request(
1538
- __privateGet$1(this, _client),
1539
- __privateGet$1(this, _httpRequest$1),
1540
- { uri: "/users/".concat(id) }
1406
+ this.#client,
1407
+ this.#httpRequest,
1408
+ { uri: `/users/${id}` }
1541
1409
  );
1542
1410
  }
1543
1411
  }
1544
- _client = new WeakMap();
1545
- _httpRequest$1 = new WeakMap();
1546
1412
  class UsersClient {
1413
+ #client;
1414
+ #httpRequest;
1547
1415
  constructor(client, httpRequest) {
1548
- __privateAdd$1(this, _client2, void 0);
1549
- __privateAdd$1(this, _httpRequest2$1, void 0);
1550
- __privateSet$1(this, _client2, client);
1551
- __privateSet$1(this, _httpRequest2$1, httpRequest);
1416
+ this.#client = client;
1417
+ this.#httpRequest = httpRequest;
1552
1418
  }
1553
1419
  /**
1554
1420
  * Fetch a user by user ID
@@ -1557,68 +1423,47 @@ class UsersClient {
1557
1423
  */
1558
1424
  getById(id) {
1559
1425
  return rxjs.lastValueFrom(
1560
- _request(__privateGet$1(this, _client2), __privateGet$1(this, _httpRequest2$1), {
1561
- uri: "/users/".concat(id)
1426
+ _request(this.#client, this.#httpRequest, {
1427
+ uri: `/users/${id}`
1562
1428
  })
1563
1429
  );
1564
1430
  }
1565
1431
  }
1566
- _client2 = new WeakMap();
1567
- _httpRequest2$1 = new WeakMap();
1568
1432
 
1569
- var __accessCheck = (obj, member, msg) => {
1570
- if (!member.has(obj))
1571
- throw TypeError("Cannot " + msg);
1572
- };
1573
- var __privateGet = (obj, member, getter) => {
1574
- __accessCheck(obj, member, "read from private field");
1575
- return getter ? getter.call(obj) : member.get(obj);
1576
- };
1577
- var __privateAdd = (obj, member, value) => {
1578
- if (member.has(obj))
1579
- throw TypeError("Cannot add the same private member more than once");
1580
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1581
- };
1582
- var __privateSet = (obj, member, value, setter) => {
1583
- __accessCheck(obj, member, "write to private field");
1584
- setter ? setter.call(obj, value) : member.set(obj, value);
1585
- return value;
1586
- };
1587
- var _clientConfig, _httpRequest, _clientConfig2, _httpRequest2;
1588
- const _ObservableSanityClient = class _ObservableSanityClient {
1433
+ class ObservableSanityClient {
1589
1434
  constructor(httpRequest, config = defaultConfig) {
1590
- /**
1591
- * Private properties
1592
- */
1593
- __privateAdd(this, _clientConfig, void 0);
1594
- __privateAdd(this, _httpRequest, void 0);
1595
1435
  /**
1596
1436
  * Instance properties
1597
1437
  */
1598
1438
  this.listen = _listen;
1599
1439
  this.config(config);
1600
- __privateSet(this, _httpRequest, httpRequest);
1601
- this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
1602
- this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest));
1603
- this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest));
1604
- this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1440
+ this.#httpRequest = httpRequest;
1441
+ this.assets = new ObservableAssetsClient(this, this.#httpRequest);
1442
+ this.datasets = new ObservableDatasetsClient(this, this.#httpRequest);
1443
+ this.projects = new ObservableProjectsClient(this, this.#httpRequest);
1444
+ this.users = new ObservableUsersClient(this, this.#httpRequest);
1605
1445
  }
1446
+ /**
1447
+ * Private properties
1448
+ */
1449
+ #clientConfig;
1450
+ #httpRequest;
1606
1451
  /**
1607
1452
  * Clone the client - returns a new instance
1608
1453
  */
1609
1454
  clone() {
1610
- return new _ObservableSanityClient(__privateGet(this, _httpRequest), this.config());
1455
+ return new ObservableSanityClient(this.#httpRequest, this.config());
1611
1456
  }
1612
1457
  config(newConfig) {
1613
1458
  if (newConfig === void 0) {
1614
- return { ...__privateGet(this, _clientConfig) };
1459
+ return { ...this.#clientConfig };
1615
1460
  }
1616
- if (__privateGet(this, _clientConfig) && __privateGet(this, _clientConfig).allowReconfigure === false) {
1461
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === false) {
1617
1462
  throw new Error(
1618
1463
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1619
1464
  );
1620
1465
  }
1621
- __privateSet(this, _clientConfig, initConfig(newConfig, __privateGet(this, _clientConfig) || {}));
1466
+ this.#clientConfig = initConfig(newConfig, this.#clientConfig || {});
1622
1467
  return this;
1623
1468
  }
1624
1469
  /**
@@ -1628,7 +1473,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1628
1473
  */
1629
1474
  withConfig(newConfig) {
1630
1475
  const thisConfig = this.config();
1631
- return new _ObservableSanityClient(__privateGet(this, _httpRequest), {
1476
+ return new ObservableSanityClient(this.#httpRequest, {
1632
1477
  ...thisConfig,
1633
1478
  ...newConfig,
1634
1479
  stega: {
@@ -1640,8 +1485,8 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1640
1485
  fetch(query, params, options) {
1641
1486
  return _fetch(
1642
1487
  this,
1643
- __privateGet(this, _httpRequest),
1644
- __privateGet(this, _clientConfig).stega,
1488
+ this.#httpRequest,
1489
+ this.#clientConfig.stega,
1645
1490
  query,
1646
1491
  params,
1647
1492
  options
@@ -1654,7 +1499,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1654
1499
  * @param options - Request options
1655
1500
  */
1656
1501
  getDocument(id, options) {
1657
- return _getDocument(this, __privateGet(this, _httpRequest), id, options);
1502
+ return _getDocument(this, this.#httpRequest, id, options);
1658
1503
  }
1659
1504
  /**
1660
1505
  * Fetch multiple documents in one request.
@@ -1666,22 +1511,22 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1666
1511
  * @param options - Request options
1667
1512
  */
1668
1513
  getDocuments(ids, options) {
1669
- return _getDocuments(this, __privateGet(this, _httpRequest), ids, options);
1514
+ return _getDocuments(this, this.#httpRequest, ids, options);
1670
1515
  }
1671
1516
  create(document, options) {
1672
- return _create(this, __privateGet(this, _httpRequest), document, "create", options);
1517
+ return _create(this, this.#httpRequest, document, "create", options);
1673
1518
  }
1674
1519
  createIfNotExists(document, options) {
1675
- return _createIfNotExists(this, __privateGet(this, _httpRequest), document, options);
1520
+ return _createIfNotExists(this, this.#httpRequest, document, options);
1676
1521
  }
1677
1522
  createOrReplace(document, options) {
1678
- return _createOrReplace(this, __privateGet(this, _httpRequest), document, options);
1523
+ return _createOrReplace(this, this.#httpRequest, document, options);
1679
1524
  }
1680
1525
  delete(selection, options) {
1681
- return _delete(this, __privateGet(this, _httpRequest), selection, options);
1526
+ return _delete(this, this.#httpRequest, selection, options);
1682
1527
  }
1683
1528
  mutate(operations, options) {
1684
- return _mutate(this, __privateGet(this, _httpRequest), operations, options);
1529
+ return _mutate(this, this.#httpRequest, operations, options);
1685
1530
  }
1686
1531
  /**
1687
1532
  * Create a new buildable patch of operations to perform
@@ -1707,7 +1552,7 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1707
1552
  * @param options - Request options
1708
1553
  */
1709
1554
  request(options) {
1710
- return _request(this, __privateGet(this, _httpRequest), options);
1555
+ return _request(this, this.#httpRequest, options);
1711
1556
  }
1712
1557
  /**
1713
1558
  * Get a Sanity API URL for the URI provided
@@ -1727,40 +1572,37 @@ const _ObservableSanityClient = class _ObservableSanityClient {
1727
1572
  getDataUrl(operation, path) {
1728
1573
  return _getDataUrl(this, operation, path);
1729
1574
  }
1730
- };
1731
- _clientConfig = new WeakMap();
1732
- _httpRequest = new WeakMap();
1733
- let ObservableSanityClient = _ObservableSanityClient;
1734
- const _SanityClient = class _SanityClient {
1575
+ }
1576
+ class SanityClient {
1735
1577
  constructor(httpRequest, config = defaultConfig) {
1736
- /**
1737
- * Private properties
1738
- */
1739
- __privateAdd(this, _clientConfig2, void 0);
1740
- __privateAdd(this, _httpRequest2, void 0);
1741
1578
  /**
1742
1579
  * Instance properties
1743
1580
  */
1744
1581
  this.listen = _listen;
1745
1582
  this.config(config);
1746
- __privateSet(this, _httpRequest2, httpRequest);
1747
- this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
1748
- this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2));
1749
- this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2));
1750
- this.users = new UsersClient(this, __privateGet(this, _httpRequest2));
1583
+ this.#httpRequest = httpRequest;
1584
+ this.assets = new AssetsClient(this, this.#httpRequest);
1585
+ this.datasets = new DatasetsClient(this, this.#httpRequest);
1586
+ this.projects = new ProjectsClient(this, this.#httpRequest);
1587
+ this.users = new UsersClient(this, this.#httpRequest);
1751
1588
  this.observable = new ObservableSanityClient(httpRequest, config);
1752
1589
  }
1590
+ /**
1591
+ * Private properties
1592
+ */
1593
+ #clientConfig;
1594
+ #httpRequest;
1753
1595
  /**
1754
1596
  * Clone the client - returns a new instance
1755
1597
  */
1756
1598
  clone() {
1757
- return new _SanityClient(__privateGet(this, _httpRequest2), this.config());
1599
+ return new SanityClient(this.#httpRequest, this.config());
1758
1600
  }
1759
1601
  config(newConfig) {
1760
1602
  if (newConfig === void 0) {
1761
- return { ...__privateGet(this, _clientConfig2) };
1603
+ return { ...this.#clientConfig };
1762
1604
  }
1763
- if (__privateGet(this, _clientConfig2) && __privateGet(this, _clientConfig2).allowReconfigure === false) {
1605
+ if (this.#clientConfig && this.#clientConfig.allowReconfigure === false) {
1764
1606
  throw new Error(
1765
1607
  "Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
1766
1608
  );
@@ -1768,7 +1610,7 @@ const _SanityClient = class _SanityClient {
1768
1610
  if (this.observable) {
1769
1611
  this.observable.config(newConfig);
1770
1612
  }
1771
- __privateSet(this, _clientConfig2, initConfig(newConfig, __privateGet(this, _clientConfig2) || {}));
1613
+ this.#clientConfig = initConfig(newConfig, this.#clientConfig || {});
1772
1614
  return this;
1773
1615
  }
1774
1616
  /**
@@ -1778,7 +1620,7 @@ const _SanityClient = class _SanityClient {
1778
1620
  */
1779
1621
  withConfig(newConfig) {
1780
1622
  const thisConfig = this.config();
1781
- return new _SanityClient(__privateGet(this, _httpRequest2), {
1623
+ return new SanityClient(this.#httpRequest, {
1782
1624
  ...thisConfig,
1783
1625
  ...newConfig,
1784
1626
  stega: {
@@ -1791,8 +1633,8 @@ const _SanityClient = class _SanityClient {
1791
1633
  return rxjs.lastValueFrom(
1792
1634
  _fetch(
1793
1635
  this,
1794
- __privateGet(this, _httpRequest2),
1795
- __privateGet(this, _clientConfig2).stega,
1636
+ this.#httpRequest,
1637
+ this.#clientConfig.stega,
1796
1638
  query,
1797
1639
  params,
1798
1640
  options
@@ -1806,7 +1648,7 @@ const _SanityClient = class _SanityClient {
1806
1648
  * @param options - Request options
1807
1649
  */
1808
1650
  getDocument(id, options) {
1809
- return rxjs.lastValueFrom(_getDocument(this, __privateGet(this, _httpRequest2), id, options));
1651
+ return rxjs.lastValueFrom(_getDocument(this, this.#httpRequest, id, options));
1810
1652
  }
1811
1653
  /**
1812
1654
  * Fetch multiple documents in one request.
@@ -1818,28 +1660,28 @@ const _SanityClient = class _SanityClient {
1818
1660
  * @param options - Request options
1819
1661
  */
1820
1662
  getDocuments(ids, options) {
1821
- return rxjs.lastValueFrom(_getDocuments(this, __privateGet(this, _httpRequest2), ids, options));
1663
+ return rxjs.lastValueFrom(_getDocuments(this, this.#httpRequest, ids, options));
1822
1664
  }
1823
1665
  create(document, options) {
1824
1666
  return rxjs.lastValueFrom(
1825
- _create(this, __privateGet(this, _httpRequest2), document, "create", options)
1667
+ _create(this, this.#httpRequest, document, "create", options)
1826
1668
  );
1827
1669
  }
1828
1670
  createIfNotExists(document, options) {
1829
1671
  return rxjs.lastValueFrom(
1830
- _createIfNotExists(this, __privateGet(this, _httpRequest2), document, options)
1672
+ _createIfNotExists(this, this.#httpRequest, document, options)
1831
1673
  );
1832
1674
  }
1833
1675
  createOrReplace(document, options) {
1834
1676
  return rxjs.lastValueFrom(
1835
- _createOrReplace(this, __privateGet(this, _httpRequest2), document, options)
1677
+ _createOrReplace(this, this.#httpRequest, document, options)
1836
1678
  );
1837
1679
  }
1838
1680
  delete(selection, options) {
1839
- return rxjs.lastValueFrom(_delete(this, __privateGet(this, _httpRequest2), selection, options));
1681
+ return rxjs.lastValueFrom(_delete(this, this.#httpRequest, selection, options));
1840
1682
  }
1841
1683
  mutate(operations, options) {
1842
- return rxjs.lastValueFrom(_mutate(this, __privateGet(this, _httpRequest2), operations, options));
1684
+ return rxjs.lastValueFrom(_mutate(this, this.#httpRequest, operations, options));
1843
1685
  }
1844
1686
  /**
1845
1687
  * Create a new buildable patch of operations to perform
@@ -1867,7 +1709,7 @@ const _SanityClient = class _SanityClient {
1867
1709
  * @returns Promise resolving to the response body
1868
1710
  */
1869
1711
  request(options) {
1870
- return rxjs.lastValueFrom(_request(this, __privateGet(this, _httpRequest2), options));
1712
+ return rxjs.lastValueFrom(_request(this, this.#httpRequest, options));
1871
1713
  }
1872
1714
  /**
1873
1715
  * Perform an HTTP request a `/data` sub-endpoint
@@ -1880,7 +1722,7 @@ const _SanityClient = class _SanityClient {
1880
1722
  * @internal
1881
1723
  */
1882
1724
  dataRequest(endpoint, body, options) {
1883
- return rxjs.lastValueFrom(_dataRequest(this, __privateGet(this, _httpRequest2), endpoint, body, options));
1725
+ return rxjs.lastValueFrom(_dataRequest(this, this.#httpRequest, endpoint, body, options));
1884
1726
  }
1885
1727
  /**
1886
1728
  * Get a Sanity API URL for the URI provided
@@ -1900,10 +1742,7 @@ const _SanityClient = class _SanityClient {
1900
1742
  getDataUrl(operation, path) {
1901
1743
  return _getDataUrl(this, operation, path);
1902
1744
  }
1903
- };
1904
- _clientConfig2 = new WeakMap();
1905
- _httpRequest2 = new WeakMap();
1906
- let SanityClient = _SanityClient;
1745
+ }
1907
1746
 
1908
1747
  function defineCreateClientExports(envMiddleware, ClassConstructor) {
1909
1748
  const httpRequest = defineHttpRequest(envMiddleware, {});
@@ -1919,11 +1758,11 @@ function defineCreateClientExports(envMiddleware, ClassConstructor) {
1919
1758
  }
1920
1759
 
1921
1760
  var name = "@sanity/client";
1922
- var version = "6.14.0";
1761
+ var version = "6.14.1";
1923
1762
 
1924
1763
  const middleware = [
1925
1764
  middleware$1.debug({ verbose: true, namespace: "sanity:client" }),
1926
- middleware$1.headers({ "User-Agent": "".concat(name, " ").concat(version) }),
1765
+ middleware$1.headers({ "User-Agent": `${name} ${version}` }),
1927
1766
  // Enable keep-alive, and in addition limit the number of sockets that can be opened.
1928
1767
  // This avoids opening too many connections to the server if someone tries to execute
1929
1768
  // a bunch of requests in parallel. It's recommended to have a concurrency limit
@@ -1954,4 +1793,4 @@ exports.defineCreateClientExports = defineCreateClientExports;
1954
1793
  exports.middleware = middleware;
1955
1794
  exports.printNoDefaultExport = printNoDefaultExport;
1956
1795
  exports.vercelStegaCleanAll = vercelStegaCleanAll;
1957
- //# sourceMappingURL=nodeMiddleware-CfcASl-f.cjs.map
1796
+ //# sourceMappingURL=nodeMiddleware-DmcqX3kz.cjs.map