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