@sanity/client 5.0.0-esm.13 → 5.0.0-esm.14

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/client",
3
- "version": "5.0.0-esm.13",
3
+ "version": "5.0.0-esm.14",
4
4
  "description": "Client for retrieving, creating and patching data from Sanity.io",
5
5
  "keywords": [
6
6
  "sanity",
@@ -113,7 +113,7 @@
113
113
  "nock": "^13.3.0",
114
114
  "prettier": "^2.8.3",
115
115
  "prettier-plugin-packagejson": "^2.4.0",
116
- "rimraf": "^4.1.0",
116
+ "rimraf": "^4.1.1",
117
117
  "rollup": "^3.10.0",
118
118
  "sse-channel": "^4.0.0",
119
119
  "terser": "^5.16.1",
@@ -122,6 +122,6 @@
122
122
  "vitest-github-actions-reporter": "^0.9.0"
123
123
  },
124
124
  "engines": {
125
- "node": ">=14"
125
+ "node": ">=14.18"
126
126
  }
127
127
  }
@@ -1,7 +1,6 @@
1
1
  import {lastValueFrom, Observable} from 'rxjs'
2
2
 
3
3
  import {AssetsClient, ObservableAssetsClient} from './assets/AssetsClient'
4
- import {AuthClient, ObservableAuthClient} from './auth/AuthClient'
5
4
  import {defaultConfig, initConfig} from './config'
6
5
  import * as dataMethods from './data/dataMethods'
7
6
  import {_listen} from './data/listen'
@@ -39,10 +38,8 @@ import {ObservableUsersClient, UsersClient} from './users/UsersClient'
39
38
  export type {
40
39
  _listen,
41
40
  AssetsClient,
42
- AuthClient,
43
41
  DatasetsClient,
44
42
  ObservableAssetsClient,
45
- ObservableAuthClient,
46
43
  ObservableDatasetsClient,
47
44
  ObservableProjectsClient,
48
45
  ObservableUsersClient,
@@ -53,7 +50,6 @@ export type {
53
50
  /** @public */
54
51
  export class ObservableSanityClient {
55
52
  assets: ObservableAssetsClient
56
- auth: ObservableAuthClient
57
53
  datasets: ObservableDatasetsClient
58
54
  projects: ObservableProjectsClient
59
55
  users: ObservableUsersClient
@@ -70,7 +66,6 @@ export class ObservableSanityClient {
70
66
  this.#httpRequest = httpRequest
71
67
 
72
68
  this.assets = new ObservableAssetsClient(this, this.#httpRequest)
73
- this.auth = new ObservableAuthClient(this, this.#httpRequest)
74
69
  this.datasets = new ObservableDatasetsClient(this, this.#httpRequest)
75
70
  this.projects = new ObservableProjectsClient(this, this.#httpRequest)
76
71
  this.users = new ObservableUsersClient(this, this.#httpRequest)
@@ -618,7 +613,6 @@ export class ObservableSanityClient {
618
613
  /** @public */
619
614
  export class SanityClient {
620
615
  assets: AssetsClient
621
- auth: AuthClient
622
616
  datasets: DatasetsClient
623
617
  projects: ProjectsClient
624
618
  users: UsersClient
@@ -645,7 +639,6 @@ export class SanityClient {
645
639
  this.#httpRequest = httpRequest
646
640
 
647
641
  this.assets = new AssetsClient(this, this.#httpRequest)
648
- this.auth = new AuthClient(this, this.#httpRequest)
649
642
  this.datasets = new DatasetsClient(this, this.#httpRequest)
650
643
  this.projects = new ProjectsClient(this, this.#httpRequest)
651
644
  this.users = new UsersClient(this, this.#httpRequest)
@@ -26,7 +26,7 @@ export class ObservableAssetsClient {
26
26
  /**
27
27
  * Uploads a file asset to the configured dataset
28
28
  *
29
- * @param assetType - Asset type (file/image)
29
+ * @param assetType - Asset type (file)
30
30
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
31
31
  * @param options - Options to use for the upload
32
32
  */
@@ -39,7 +39,7 @@ export class ObservableAssetsClient {
39
39
  /**
40
40
  * Uploads an image asset to the configured dataset
41
41
  *
42
- * @param assetType - Asset type (file/image)
42
+ * @param assetType - Asset type (image)
43
43
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
44
44
  * @param options - Options to use for the upload
45
45
  */
@@ -48,6 +48,18 @@ export class ObservableAssetsClient {
48
48
  body: File | Blob | Buffer | NodeJS.ReadableStream,
49
49
  options?: UploadClientConfig
50
50
  ): Observable<HttpRequestEvent<{document: SanityImageAssetDocument}>>
51
+ /**
52
+ * Uploads a file or an image asset to the configured dataset
53
+ *
54
+ * @param assetType - Asset type (file/image)
55
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
56
+ * @param options - Options to use for the upload
57
+ */
58
+ upload(
59
+ assetType: 'file' | 'image',
60
+ body: File | Blob | Buffer | NodeJS.ReadableStream,
61
+ options?: UploadClientConfig
62
+ ): Observable<HttpRequestEvent<{document: SanityAssetDocument | SanityImageAssetDocument}>>
51
63
  upload(
52
64
  assetType: 'file' | 'image',
53
65
  body: File | Blob | Buffer | NodeJS.ReadableStream,
@@ -69,7 +81,7 @@ export class AssetsClient {
69
81
  /**
70
82
  * Uploads a file asset to the configured dataset
71
83
  *
72
- * @param assetType - Asset type (file/image)
84
+ * @param assetType - Asset type (file)
73
85
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
74
86
  * @param options - Options to use for the upload
75
87
  */
@@ -81,7 +93,7 @@ export class AssetsClient {
81
93
  /**
82
94
  * Uploads an image asset to the configured dataset
83
95
  *
84
- * @param assetType - Asset type (file/image)
96
+ * @param assetType - Asset type (image)
85
97
  * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
86
98
  * @param options - Options to use for the upload
87
99
  */
@@ -90,6 +102,18 @@ export class AssetsClient {
90
102
  body: File | Blob | Buffer | NodeJS.ReadableStream,
91
103
  options?: UploadClientConfig
92
104
  ): Promise<SanityImageAssetDocument>
105
+ /**
106
+ * Uploads a file or an image asset to the configured dataset
107
+ *
108
+ * @param assetType - Asset type (file/image)
109
+ * @param body - Asset content - can be a browser File instance, a Blob, a Node.js Buffer instance or a Node.js ReadableStream.
110
+ * @param options - Options to use for the upload
111
+ */
112
+ upload(
113
+ assetType: 'file' | 'image',
114
+ body: File | Blob | Buffer | NodeJS.ReadableStream,
115
+ options?: UploadClientConfig
116
+ ): Promise<SanityAssetDocument | SanityImageAssetDocument>
93
117
  upload(
94
118
  assetType: 'file' | 'image',
95
119
  body: File | Blob | Buffer | NodeJS.ReadableStream,
package/src/data/patch.ts CHANGED
@@ -28,18 +28,6 @@ export class BasePatch {
28
28
  this.operations = operations
29
29
  }
30
30
 
31
- /**
32
- * DEPRECATED: Don't use.
33
- * The operation is added to the current patch, ready to be commited by `commit()`
34
- *
35
- * @deprecated - Don't use.
36
- * @param attrs - Attributes to replace
37
- */
38
- replace(attrs: AttributeSet): this {
39
- validateObject('replace', attrs)
40
- return this._set('set', {$: attrs})
41
- }
42
-
43
31
  /**
44
32
  * Sets the given attributes to the document. Does NOT merge objects.
45
33
  * The operation is added to the current patch, ready to be commited by `commit()`
@@ -209,19 +209,19 @@
209
209
  initMiddleware.forEach(request.use);
210
210
  return request;
211
211
  }
212
- var __accessCheck$8 = (obj, member, msg) => {
212
+ var __accessCheck$7 = (obj, member, msg) => {
213
213
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
214
214
  };
215
- var __privateGet$8 = (obj, member, getter) => {
216
- __accessCheck$8(obj, member, "read from private field");
215
+ var __privateGet$7 = (obj, member, getter) => {
216
+ __accessCheck$7(obj, member, "read from private field");
217
217
  return getter ? getter.call(obj) : member.get(obj);
218
218
  };
219
- var __privateAdd$8 = (obj, member, value) => {
219
+ var __privateAdd$7 = (obj, member, value) => {
220
220
  if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
221
221
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
222
222
  };
223
- var __privateSet$8 = (obj, member, value, setter) => {
224
- __accessCheck$8(obj, member, "write to private field");
223
+ var __privateSet$7 = (obj, member, value, setter) => {
224
+ __accessCheck$7(obj, member, "write to private field");
225
225
  setter ? setter.call(obj, value) : member.set(obj, value);
226
226
  return value;
227
227
  };
@@ -235,50 +235,50 @@
235
235
  /**
236
236
  * Private implementation details
237
237
  */
238
- __privateAdd$8(this, _method, void 0);
239
- __privateAdd$8(this, _url, void 0);
240
- __privateAdd$8(this, _resHeaders, void 0);
241
- __privateAdd$8(this, _headers, {});
242
- __privateAdd$8(this, _controller, void 0);
238
+ __privateAdd$7(this, _method, void 0);
239
+ __privateAdd$7(this, _url, void 0);
240
+ __privateAdd$7(this, _resHeaders, void 0);
241
+ __privateAdd$7(this, _headers, {});
242
+ __privateAdd$7(this, _controller, void 0);
243
243
  }
244
244
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- _async is only declared for typings compatibility
245
245
  open(method, url, _async) {
246
- __privateSet$8(this, _method, method);
247
- __privateSet$8(this, _url, url);
248
- __privateSet$8(this, _resHeaders, "");
246
+ __privateSet$7(this, _method, method);
247
+ __privateSet$7(this, _url, url);
248
+ __privateSet$7(this, _resHeaders, "");
249
249
  this.readyState = 1;
250
250
  this.onreadystatechange();
251
- __privateSet$8(this, _controller, void 0);
251
+ __privateSet$7(this, _controller, void 0);
252
252
  }
253
253
  abort() {
254
- if (__privateGet$8(this, _controller)) {
255
- __privateGet$8(this, _controller).abort();
254
+ if (__privateGet$7(this, _controller)) {
255
+ __privateGet$7(this, _controller).abort();
256
256
  }
257
257
  }
258
258
  getAllResponseHeaders() {
259
- return __privateGet$8(this, _resHeaders);
259
+ return __privateGet$7(this, _resHeaders);
260
260
  }
261
261
  setRequestHeader(name, value) {
262
- __privateGet$8(this, _headers)[name] = value;
262
+ __privateGet$7(this, _headers)[name] = value;
263
263
  }
264
264
  send(body) {
265
265
  const textBody = this.responseType !== "arraybuffer";
266
266
  const options = {
267
- method: __privateGet$8(this, _method),
268
- headers: __privateGet$8(this, _headers),
267
+ method: __privateGet$7(this, _method),
268
+ headers: __privateGet$7(this, _headers),
269
269
  signal: null,
270
270
  body
271
271
  };
272
272
  if (typeof AbortController === "function") {
273
- __privateSet$8(this, _controller, new AbortController());
274
- options.signal = __privateGet$8(this, _controller).signal;
273
+ __privateSet$7(this, _controller, new AbortController());
274
+ options.signal = __privateGet$7(this, _controller).signal;
275
275
  }
276
276
  if (typeof document !== "undefined") {
277
277
  options.credentials = this.withCredentials ? "include" : "omit";
278
278
  }
279
- fetch(__privateGet$8(this, _url), options).then(res => {
279
+ fetch(__privateGet$7(this, _url), options).then(res => {
280
280
  res.headers.forEach((value, key) => {
281
- __privateSet$8(this, _resHeaders, __privateGet$8(this, _resHeaders) + "".concat(key, ": ").concat(value, "\r\n"));
281
+ __privateSet$7(this, _resHeaders, __privateGet$7(this, _resHeaders) + "".concat(key, ": ").concat(value, "\r\n"));
282
282
  });
283
283
  this.status = res.status;
284
284
  this.statusText = res.statusText;
@@ -3367,42 +3367,29 @@
3367
3367
  return options[option] ? "".concat(qs, "&").concat(enc(option), "=").concat(enc(options[option])) : qs;
3368
3368
  }, qString);
3369
3369
  };
3370
- var __accessCheck$7 = (obj, member, msg) => {
3370
+ var __accessCheck$6 = (obj, member, msg) => {
3371
3371
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
3372
3372
  };
3373
- var __privateGet$7 = (obj, member, getter) => {
3374
- __accessCheck$7(obj, member, "read from private field");
3373
+ var __privateGet$6 = (obj, member, getter) => {
3374
+ __accessCheck$6(obj, member, "read from private field");
3375
3375
  return getter ? getter.call(obj) : member.get(obj);
3376
3376
  };
3377
- var __privateAdd$7 = (obj, member, value) => {
3377
+ var __privateAdd$6 = (obj, member, value) => {
3378
3378
  if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
3379
3379
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3380
3380
  };
3381
- var __privateSet$7 = (obj, member, value, setter) => {
3382
- __accessCheck$7(obj, member, "write to private field");
3381
+ var __privateSet$6 = (obj, member, value, setter) => {
3382
+ __accessCheck$6(obj, member, "write to private field");
3383
3383
  setter ? setter.call(obj, value) : member.set(obj, value);
3384
3384
  return value;
3385
3385
  };
3386
- var _client$6, _client2$6;
3386
+ var _client$5, _client2$5;
3387
3387
  class BasePatch {
3388
3388
  constructor(selection) {
3389
3389
  let operations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3390
3390
  this.selection = selection;
3391
3391
  this.operations = operations;
3392
3392
  }
3393
- /**
3394
- * DEPRECATED: Don't use.
3395
- * The operation is added to the current patch, ready to be commited by `commit()`
3396
- *
3397
- * @deprecated - Don't use.
3398
- * @param attrs - Attributes to replace
3399
- */
3400
- replace(attrs) {
3401
- validateObject("replace", attrs);
3402
- return this._set("set", {
3403
- $: attrs
3404
- });
3405
- }
3406
3393
  /**
3407
3394
  * Sets the given attributes to the document. Does NOT merge objects.
3408
3395
  * The operation is added to the current patch, ready to be commited by `commit()`
@@ -3556,8 +3543,8 @@
3556
3543
  const _ObservablePatch = class extends BasePatch {
3557
3544
  constructor(selection, operations, client) {
3558
3545
  super(selection, operations);
3559
- __privateAdd$7(this, _client$6, void 0);
3560
- __privateSet$7(this, _client$6, client);
3546
+ __privateAdd$6(this, _client$5, void 0);
3547
+ __privateSet$6(this, _client$5, client);
3561
3548
  }
3562
3549
  /**
3563
3550
  * Clones the patch
@@ -3565,10 +3552,10 @@
3565
3552
  clone() {
3566
3553
  return new _ObservablePatch(this.selection, {
3567
3554
  ...this.operations
3568
- }, __privateGet$7(this, _client$6));
3555
+ }, __privateGet$6(this, _client$5));
3569
3556
  }
3570
3557
  commit(options) {
3571
- if (!__privateGet$7(this, _client$6)) {
3558
+ if (!__privateGet$6(this, _client$5)) {
3572
3559
  throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");
3573
3560
  }
3574
3561
  const returnFirst = typeof this.selection === "string";
@@ -3576,18 +3563,18 @@
3576
3563
  returnFirst,
3577
3564
  returnDocuments: true
3578
3565
  }, options);
3579
- return __privateGet$7(this, _client$6).mutate({
3566
+ return __privateGet$6(this, _client$5).mutate({
3580
3567
  patch: this.serialize()
3581
3568
  }, opts);
3582
3569
  }
3583
3570
  };
3584
3571
  let ObservablePatch = _ObservablePatch;
3585
- _client$6 = new WeakMap();
3572
+ _client$5 = new WeakMap();
3586
3573
  const _Patch = class extends BasePatch {
3587
3574
  constructor(selection, operations, client) {
3588
3575
  super(selection, operations);
3589
- __privateAdd$7(this, _client2$6, void 0);
3590
- __privateSet$7(this, _client2$6, client);
3576
+ __privateAdd$6(this, _client2$5, void 0);
3577
+ __privateSet$6(this, _client2$5, client);
3591
3578
  }
3592
3579
  /**
3593
3580
  * Clones the patch
@@ -3595,10 +3582,10 @@
3595
3582
  clone() {
3596
3583
  return new _Patch(this.selection, {
3597
3584
  ...this.operations
3598
- }, __privateGet$7(this, _client2$6));
3585
+ }, __privateGet$6(this, _client2$5));
3599
3586
  }
3600
3587
  commit(options) {
3601
- if (!__privateGet$7(this, _client2$6)) {
3588
+ if (!__privateGet$6(this, _client2$5)) {
3602
3589
  throw new Error("No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method");
3603
3590
  }
3604
3591
  const returnFirst = typeof this.selection === "string";
@@ -3606,30 +3593,30 @@
3606
3593
  returnFirst,
3607
3594
  returnDocuments: true
3608
3595
  }, options);
3609
- return __privateGet$7(this, _client2$6).mutate({
3596
+ return __privateGet$6(this, _client2$5).mutate({
3610
3597
  patch: this.serialize()
3611
3598
  }, opts);
3612
3599
  }
3613
3600
  };
3614
3601
  let Patch = _Patch;
3615
- _client2$6 = new WeakMap();
3616
- var __accessCheck$6 = (obj, member, msg) => {
3602
+ _client2$5 = new WeakMap();
3603
+ var __accessCheck$5 = (obj, member, msg) => {
3617
3604
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
3618
3605
  };
3619
- var __privateGet$6 = (obj, member, getter) => {
3620
- __accessCheck$6(obj, member, "read from private field");
3606
+ var __privateGet$5 = (obj, member, getter) => {
3607
+ __accessCheck$5(obj, member, "read from private field");
3621
3608
  return getter ? getter.call(obj) : member.get(obj);
3622
3609
  };
3623
- var __privateAdd$6 = (obj, member, value) => {
3610
+ var __privateAdd$5 = (obj, member, value) => {
3624
3611
  if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
3625
3612
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
3626
3613
  };
3627
- var __privateSet$6 = (obj, member, value, setter) => {
3628
- __accessCheck$6(obj, member, "write to private field");
3614
+ var __privateSet$5 = (obj, member, value, setter) => {
3615
+ __accessCheck$5(obj, member, "write to private field");
3629
3616
  setter ? setter.call(obj, value) : member.set(obj, value);
3630
3617
  return value;
3631
3618
  };
3632
- var _client$5, _client2$5;
3619
+ var _client$4, _client2$4;
3633
3620
  const defaultMutateOptions = {
3634
3621
  returnDocuments: false
3635
3622
  };
@@ -3728,20 +3715,20 @@
3728
3715
  const _Transaction = class extends BaseTransaction {
3729
3716
  constructor(operations, client, transactionId) {
3730
3717
  super(operations, transactionId);
3731
- __privateAdd$6(this, _client$5, void 0);
3732
- __privateSet$6(this, _client$5, client);
3718
+ __privateAdd$5(this, _client$4, void 0);
3719
+ __privateSet$5(this, _client$4, client);
3733
3720
  }
3734
3721
  /**
3735
3722
  * Clones the transaction
3736
3723
  */
3737
3724
  clone() {
3738
- return new _Transaction([...this.operations], __privateGet$6(this, _client$5), this.trxId);
3725
+ return new _Transaction([...this.operations], __privateGet$5(this, _client$4), this.trxId);
3739
3726
  }
3740
3727
  commit(options) {
3741
- if (!__privateGet$6(this, _client$5)) {
3728
+ if (!__privateGet$5(this, _client$4)) {
3742
3729
  throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");
3743
3730
  }
3744
- return __privateGet$6(this, _client$5).mutate(this.serialize(), Object.assign({
3731
+ return __privateGet$5(this, _client$4).mutate(this.serialize(), Object.assign({
3745
3732
  transactionId: this.trxId
3746
3733
  }, defaultMutateOptions, options || {}));
3747
3734
  }
@@ -3754,7 +3741,7 @@
3754
3741
  });
3755
3742
  }
3756
3743
  if (isBuilder) {
3757
- const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$6(this, _client$5)));
3744
+ const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$5(this, _client$4)));
3758
3745
  if (!(patch instanceof Patch)) {
3759
3746
  throw new Error("function passed to `patch()` must return the patch");
3760
3747
  }
@@ -3771,24 +3758,24 @@
3771
3758
  }
3772
3759
  };
3773
3760
  let Transaction = _Transaction;
3774
- _client$5 = new WeakMap();
3761
+ _client$4 = new WeakMap();
3775
3762
  const _ObservableTransaction = class extends BaseTransaction {
3776
3763
  constructor(operations, client, transactionId) {
3777
3764
  super(operations, transactionId);
3778
- __privateAdd$6(this, _client2$5, void 0);
3779
- __privateSet$6(this, _client2$5, client);
3765
+ __privateAdd$5(this, _client2$4, void 0);
3766
+ __privateSet$5(this, _client2$4, client);
3780
3767
  }
3781
3768
  /**
3782
3769
  * Clones the transaction
3783
3770
  */
3784
3771
  clone() {
3785
- return new _ObservableTransaction([...this.operations], __privateGet$6(this, _client2$5), this.trxId);
3772
+ return new _ObservableTransaction([...this.operations], __privateGet$5(this, _client2$4), this.trxId);
3786
3773
  }
3787
3774
  commit(options) {
3788
- if (!__privateGet$6(this, _client2$5)) {
3775
+ if (!__privateGet$5(this, _client2$4)) {
3789
3776
  throw new Error("No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method");
3790
3777
  }
3791
- return __privateGet$6(this, _client2$5).mutate(this.serialize(), Object.assign({
3778
+ return __privateGet$5(this, _client2$4).mutate(this.serialize(), Object.assign({
3792
3779
  transactionId: this.trxId
3793
3780
  }, defaultMutateOptions, options || {}));
3794
3781
  }
@@ -3801,7 +3788,7 @@
3801
3788
  });
3802
3789
  }
3803
3790
  if (isBuilder) {
3804
- const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$6(this, _client2$5)));
3791
+ const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$5(this, _client2$4)));
3805
3792
  if (!(patch instanceof ObservablePatch)) {
3806
3793
  throw new Error("function passed to `patch()` must return the patch");
3807
3794
  }
@@ -3818,7 +3805,7 @@
3818
3805
  }
3819
3806
  };
3820
3807
  let ObservableTransaction = _ObservableTransaction;
3821
- _client2$5 = new WeakMap();
3808
+ _client2$4 = new WeakMap();
3822
3809
  const excludeFalsey = (param, defValue) => {
3823
3810
  const value = typeof param === "undefined" ? defValue : param;
3824
3811
  return param === false ? void 0 : value;
@@ -3990,50 +3977,50 @@
3990
3977
  const base = canUseCdn ? cdnUrl : url;
3991
3978
  return "".concat(base, "/").concat(uri.replace(/^\//, ""));
3992
3979
  }
3993
- var __accessCheck$5 = (obj, member, msg) => {
3980
+ var __accessCheck$4 = (obj, member, msg) => {
3994
3981
  if (!member.has(obj)) throw TypeError("Cannot " + msg);
3995
3982
  };
3996
- var __privateGet$5 = (obj, member, getter) => {
3997
- __accessCheck$5(obj, member, "read from private field");
3983
+ var __privateGet$4 = (obj, member, getter) => {
3984
+ __accessCheck$4(obj, member, "read from private field");
3998
3985
  return getter ? getter.call(obj) : member.get(obj);
3999
3986
  };
4000
- var __privateAdd$5 = (obj, member, value) => {
3987
+ var __privateAdd$4 = (obj, member, value) => {
4001
3988
  if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
4002
3989
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4003
3990
  };
4004
- var __privateSet$5 = (obj, member, value, setter) => {
4005
- __accessCheck$5(obj, member, "write to private field");
3991
+ var __privateSet$4 = (obj, member, value, setter) => {
3992
+ __accessCheck$4(obj, member, "write to private field");
4006
3993
  setter ? setter.call(obj, value) : member.set(obj, value);
4007
3994
  return value;
4008
3995
  };
4009
- var _client$4, _httpRequest$5, _client2$4, _httpRequest2$5;
3996
+ var _client$3, _httpRequest$4, _client2$3, _httpRequest2$4;
4010
3997
  class ObservableAssetsClient {
4011
3998
  constructor(client, httpRequest) {
4012
- __privateAdd$5(this, _client$4, void 0);
4013
- __privateAdd$5(this, _httpRequest$5, void 0);
4014
- __privateSet$5(this, _client$4, client);
4015
- __privateSet$5(this, _httpRequest$5, httpRequest);
3999
+ __privateAdd$4(this, _client$3, void 0);
4000
+ __privateAdd$4(this, _httpRequest$4, void 0);
4001
+ __privateSet$4(this, _client$3, client);
4002
+ __privateSet$4(this, _httpRequest$4, httpRequest);
4016
4003
  }
4017
4004
  upload(assetType, body, options) {
4018
- return _upload(__privateGet$5(this, _client$4), __privateGet$5(this, _httpRequest$5), assetType, body, options);
4005
+ return _upload(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), assetType, body, options);
4019
4006
  }
4020
4007
  }
4021
- _client$4 = new WeakMap();
4022
- _httpRequest$5 = new WeakMap();
4008
+ _client$3 = new WeakMap();
4009
+ _httpRequest$4 = new WeakMap();
4023
4010
  class AssetsClient {
4024
4011
  constructor(client, httpRequest) {
4025
- __privateAdd$5(this, _client2$4, void 0);
4026
- __privateAdd$5(this, _httpRequest2$5, void 0);
4027
- __privateSet$5(this, _client2$4, client);
4028
- __privateSet$5(this, _httpRequest2$5, httpRequest);
4012
+ __privateAdd$4(this, _client2$3, void 0);
4013
+ __privateAdd$4(this, _httpRequest2$4, void 0);
4014
+ __privateSet$4(this, _client2$3, client);
4015
+ __privateSet$4(this, _httpRequest2$4, httpRequest);
4029
4016
  }
4030
4017
  upload(assetType, body, options) {
4031
- const observable = _upload(__privateGet$5(this, _client2$4), __privateGet$5(this, _httpRequest2$5), assetType, body, options);
4018
+ const observable = _upload(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), assetType, body, options);
4032
4019
  return lastValueFrom(observable.pipe(filter(event => event.type === "response"), map(event => event.body.document)));
4033
4020
  }
4034
4021
  }
4035
- _client2$4 = new WeakMap();
4036
- _httpRequest2$5 = new WeakMap();
4022
+ _client2$3 = new WeakMap();
4023
+ _httpRequest2$4 = new WeakMap();
4037
4024
  function _upload(client, httpRequest, assetType, body) {
4038
4025
  let opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
4039
4026
  validateAssetType(assetType);
@@ -4087,77 +4074,6 @@
4087
4074
  contentType: file.type
4088
4075
  }, opts);
4089
4076
  }
4090
- var __accessCheck$4 = (obj, member, msg) => {
4091
- if (!member.has(obj)) throw TypeError("Cannot " + msg);
4092
- };
4093
- var __privateGet$4 = (obj, member, getter) => {
4094
- __accessCheck$4(obj, member, "read from private field");
4095
- return getter ? getter.call(obj) : member.get(obj);
4096
- };
4097
- var __privateAdd$4 = (obj, member, value) => {
4098
- if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
4099
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
4100
- };
4101
- var __privateSet$4 = (obj, member, value, setter) => {
4102
- __accessCheck$4(obj, member, "write to private field");
4103
- setter ? setter.call(obj, value) : member.set(obj, value);
4104
- return value;
4105
- };
4106
- var _client$3, _httpRequest$4, _client2$3, _httpRequest2$4;
4107
- class ObservableAuthClient {
4108
- constructor(client, httpRequest) {
4109
- __privateAdd$4(this, _client$3, void 0);
4110
- __privateAdd$4(this, _httpRequest$4, void 0);
4111
- __privateSet$4(this, _client$3, client);
4112
- __privateSet$4(this, _httpRequest$4, httpRequest);
4113
- }
4114
- /**
4115
- * Fetch available login providers
4116
- */
4117
- getLoginProviders() {
4118
- return _request(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), {
4119
- uri: "/auth/providers"
4120
- });
4121
- }
4122
- /**
4123
- * Revoke the configured session/token
4124
- */
4125
- logout() {
4126
- return _request(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), {
4127
- uri: "/auth/logout",
4128
- method: "POST"
4129
- });
4130
- }
4131
- }
4132
- _client$3 = new WeakMap();
4133
- _httpRequest$4 = new WeakMap();
4134
- class AuthClient {
4135
- constructor(client, httpRequest) {
4136
- __privateAdd$4(this, _client2$3, void 0);
4137
- __privateAdd$4(this, _httpRequest2$4, void 0);
4138
- __privateSet$4(this, _client2$3, client);
4139
- __privateSet$4(this, _httpRequest2$4, httpRequest);
4140
- }
4141
- /**
4142
- * Fetch available login providers
4143
- */
4144
- getLoginProviders() {
4145
- return lastValueFrom(_request(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), {
4146
- uri: "/auth/providers"
4147
- }));
4148
- }
4149
- /**
4150
- * Revoke the configured session/token
4151
- */
4152
- logout() {
4153
- return lastValueFrom(_request(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), {
4154
- uri: "/auth/logout",
4155
- method: "POST"
4156
- }));
4157
- }
4158
- }
4159
- _client2$3 = new WeakMap();
4160
- _httpRequest2$4 = new WeakMap();
4161
4077
  const BASE_URL = "https://www.sanity.io/help/";
4162
4078
  function generateHelpUrl(slug) {
4163
4079
  return BASE_URL + slug;
@@ -4663,7 +4579,6 @@
4663
4579
  this.config(config);
4664
4580
  __privateSet(this, _httpRequest, httpRequest);
4665
4581
  this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest));
4666
- this.auth = new ObservableAuthClient(this, __privateGet(this, _httpRequest));
4667
4582
  this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest));
4668
4583
  this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest));
4669
4584
  this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
@@ -4782,7 +4697,6 @@
4782
4697
  this.config(config);
4783
4698
  __privateSet(this, _httpRequest2, httpRequest);
4784
4699
  this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2));
4785
- this.auth = new AuthClient(this, __privateGet(this, _httpRequest2));
4786
4700
  this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2));
4787
4701
  this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2));
4788
4702
  this.users = new UsersClient(this, __privateGet(this, _httpRequest2));