@sanity/client 6.17.3-canary.6 → 6.17.3

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.
@@ -159,14 +159,14 @@ const VALID_ASSET_TYPES = ["image", "file"], VALID_INSERT_LOCATIONS = ["before",
159
159
  );
160
160
  return tag;
161
161
  };
162
- var __defProp$2 = Object.defineProperty, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$2 = (obj, key, value) => (__defNormalProp$2(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$7 = (obj, member, msg) => {
162
+ var __defProp$2 = Object.defineProperty, __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$2 = (obj, key, value) => (__defNormalProp$2(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$6 = (obj, member, msg) => {
163
163
  if (!member.has(obj))
164
164
  throw TypeError("Cannot " + msg);
165
- }, __privateGet$7 = (obj, member, getter) => (__accessCheck$7(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$7 = (obj, member, value) => {
165
+ }, __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$6 = (obj, member, value) => {
166
166
  if (member.has(obj))
167
167
  throw TypeError("Cannot add the same private member more than once");
168
168
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
169
- }, __privateSet$7 = (obj, member, value, setter) => (__accessCheck$7(obj, member, "write to private field"), member.set(obj, value), value);
169
+ }, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
170
170
  class BasePatch {
171
171
  constructor(selection, operations = {}) {
172
172
  __publicField$2(this, "selection"), __publicField$2(this, "operations"), this.selection = selection, this.operations = operations;
@@ -300,58 +300,58 @@ class BasePatch {
300
300
  return this._assign(op, props, !1);
301
301
  }
302
302
  }
303
- var _client$6;
303
+ var _client$5;
304
304
  const _ObservablePatch = class _ObservablePatch2 extends BasePatch {
305
305
  constructor(selection, operations, client) {
306
- super(selection, operations), __privateAdd$7(this, _client$6, void 0), __privateSet$7(this, _client$6, client);
306
+ super(selection, operations), __privateAdd$6(this, _client$5, void 0), __privateSet$6(this, _client$5, client);
307
307
  }
308
308
  /**
309
309
  * Clones the patch
310
310
  */
311
311
  clone() {
312
- return new _ObservablePatch2(this.selection, { ...this.operations }, __privateGet$7(this, _client$6));
312
+ return new _ObservablePatch2(this.selection, { ...this.operations }, __privateGet$6(this, _client$5));
313
313
  }
314
314
  commit(options) {
315
- if (!__privateGet$7(this, _client$6))
315
+ if (!__privateGet$6(this, _client$5))
316
316
  throw new Error(
317
317
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
318
318
  );
319
319
  const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);
320
- return __privateGet$7(this, _client$6).mutate({ patch: this.serialize() }, opts);
320
+ return __privateGet$6(this, _client$5).mutate({ patch: this.serialize() }, opts);
321
321
  }
322
322
  };
323
- _client$6 = /* @__PURE__ */ new WeakMap();
323
+ _client$5 = /* @__PURE__ */ new WeakMap();
324
324
  let ObservablePatch = _ObservablePatch;
325
325
  var _client2$5;
326
326
  const _Patch = class _Patch2 extends BasePatch {
327
327
  constructor(selection, operations, client) {
328
- super(selection, operations), __privateAdd$7(this, _client2$5, void 0), __privateSet$7(this, _client2$5, client);
328
+ super(selection, operations), __privateAdd$6(this, _client2$5, void 0), __privateSet$6(this, _client2$5, client);
329
329
  }
330
330
  /**
331
331
  * Clones the patch
332
332
  */
333
333
  clone() {
334
- return new _Patch2(this.selection, { ...this.operations }, __privateGet$7(this, _client2$5));
334
+ return new _Patch2(this.selection, { ...this.operations }, __privateGet$6(this, _client2$5));
335
335
  }
336
336
  commit(options) {
337
- if (!__privateGet$7(this, _client2$5))
337
+ if (!__privateGet$6(this, _client2$5))
338
338
  throw new Error(
339
339
  "No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
340
340
  );
341
341
  const returnFirst = typeof this.selection == "string", opts = Object.assign({ returnFirst, returnDocuments: !0 }, options);
342
- return __privateGet$7(this, _client2$5).mutate({ patch: this.serialize() }, opts);
342
+ return __privateGet$6(this, _client2$5).mutate({ patch: this.serialize() }, opts);
343
343
  }
344
344
  };
345
345
  _client2$5 = /* @__PURE__ */ new WeakMap();
346
346
  let Patch = _Patch;
347
- var __defProp$1 = Object.defineProperty, __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$1 = (obj, key, value) => (__defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$6 = (obj, member, msg) => {
347
+ var __defProp$1 = Object.defineProperty, __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __publicField$1 = (obj, key, value) => (__defNormalProp$1(obj, typeof key != "symbol" ? key + "" : key, value), value), __accessCheck$5 = (obj, member, msg) => {
348
348
  if (!member.has(obj))
349
349
  throw TypeError("Cannot " + msg);
350
- }, __privateGet$6 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$6 = (obj, member, value) => {
350
+ }, __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$5 = (obj, member, value) => {
351
351
  if (member.has(obj))
352
352
  throw TypeError("Cannot add the same private member more than once");
353
353
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
354
- }, __privateSet$6 = (obj, member, value, setter) => (__accessCheck$6(obj, member, "write to private field"), member.set(obj, value), value);
354
+ }, __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value);
355
355
  const defaultMutateOptions = { returnDocuments: !1 };
356
356
  class BaseTransaction {
357
357
  constructor(operations = [], transactionId) {
@@ -420,23 +420,23 @@ class BaseTransaction {
420
420
  return this.operations.push(mut), this;
421
421
  }
422
422
  }
423
- var _client$5;
423
+ var _client$4;
424
424
  const _Transaction = class _Transaction2 extends BaseTransaction {
425
425
  constructor(operations, client, transactionId) {
426
- super(operations, transactionId), __privateAdd$6(this, _client$5, void 0), __privateSet$6(this, _client$5, client);
426
+ super(operations, transactionId), __privateAdd$5(this, _client$4, void 0), __privateSet$5(this, _client$4, client);
427
427
  }
428
428
  /**
429
429
  * Clones the transaction
430
430
  */
431
431
  clone() {
432
- return new _Transaction2([...this.operations], __privateGet$6(this, _client$5), this.trxId);
432
+ return new _Transaction2([...this.operations], __privateGet$5(this, _client$4), this.trxId);
433
433
  }
434
434
  commit(options) {
435
- if (!__privateGet$6(this, _client$5))
435
+ if (!__privateGet$5(this, _client$4))
436
436
  throw new Error(
437
437
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
438
438
  );
439
- return __privateGet$6(this, _client$5).mutate(
439
+ return __privateGet$5(this, _client$4).mutate(
440
440
  this.serialize(),
441
441
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
442
442
  );
@@ -446,7 +446,7 @@ const _Transaction = class _Transaction2 extends BaseTransaction {
446
446
  if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof Patch)
447
447
  return this._add({ patch: patchOrDocumentId.serialize() });
448
448
  if (isBuilder) {
449
- const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$6(this, _client$5)));
449
+ const patch = patchOps(new Patch(patchOrDocumentId, {}, __privateGet$5(this, _client$4)));
450
450
  if (!(patch instanceof Patch))
451
451
  throw new Error("function passed to `patch()` must return the patch");
452
452
  return this._add({ patch: patch.serialize() });
@@ -454,25 +454,25 @@ const _Transaction = class _Transaction2 extends BaseTransaction {
454
454
  return this._add({ patch: { id: patchOrDocumentId, ...patchOps } });
455
455
  }
456
456
  };
457
- _client$5 = /* @__PURE__ */ new WeakMap();
457
+ _client$4 = /* @__PURE__ */ new WeakMap();
458
458
  let Transaction = _Transaction;
459
459
  var _client2$4;
460
460
  const _ObservableTransaction = class _ObservableTransaction2 extends BaseTransaction {
461
461
  constructor(operations, client, transactionId) {
462
- super(operations, transactionId), __privateAdd$6(this, _client2$4, void 0), __privateSet$6(this, _client2$4, client);
462
+ super(operations, transactionId), __privateAdd$5(this, _client2$4, void 0), __privateSet$5(this, _client2$4, client);
463
463
  }
464
464
  /**
465
465
  * Clones the transaction
466
466
  */
467
467
  clone() {
468
- return new _ObservableTransaction2([...this.operations], __privateGet$6(this, _client2$4), this.trxId);
468
+ return new _ObservableTransaction2([...this.operations], __privateGet$5(this, _client2$4), this.trxId);
469
469
  }
470
470
  commit(options) {
471
- if (!__privateGet$6(this, _client2$4))
471
+ if (!__privateGet$5(this, _client2$4))
472
472
  throw new Error(
473
473
  "No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
474
474
  );
475
- return __privateGet$6(this, _client2$4).mutate(
475
+ return __privateGet$5(this, _client2$4).mutate(
476
476
  this.serialize(),
477
477
  Object.assign({ transactionId: this.trxId }, defaultMutateOptions, options || {})
478
478
  );
@@ -482,7 +482,7 @@ const _ObservableTransaction = class _ObservableTransaction2 extends BaseTransac
482
482
  if (typeof patchOrDocumentId != "string" && patchOrDocumentId instanceof ObservablePatch)
483
483
  return this._add({ patch: patchOrDocumentId.serialize() });
484
484
  if (isBuilder) {
485
- const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$6(this, _client2$4)));
485
+ const patch = patchOps(new ObservablePatch(patchOrDocumentId, {}, __privateGet$5(this, _client2$4)));
486
486
  if (!(patch instanceof ObservablePatch))
487
487
  throw new Error("function passed to `patch()` must return the patch");
488
488
  return this._add({ patch: patch.serialize() });
@@ -692,7 +692,7 @@ function _mutate(client, httpRequest, mutations, options) {
692
692
  return _dataRequest(client, httpRequest, "mutate", { mutations: muts, transactionId }, options);
693
693
  }
694
694
  function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
695
- const isMutation = endpoint === "mutate", isQuery = endpoint === "query", strQuery = isMutation ? "" : encodeQueryString(body), useGet = !isMutation && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery, lastLiveEventId } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {
695
+ const isMutation = endpoint === "mutate", isQuery = endpoint === "query", strQuery = isMutation ? "" : encodeQueryString(body), useGet = !isMutation && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {
696
696
  method: useGet ? "GET" : "POST",
697
697
  uri,
698
698
  json: !0,
@@ -705,7 +705,6 @@ function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
705
705
  returnQuery,
706
706
  perspective: options.perspective,
707
707
  resultSourceMap: options.resultSourceMap,
708
- lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId,
709
708
  canUseCdn: isQuery,
710
709
  signal: options.signal,
711
710
  fetch: options.fetch,
@@ -743,7 +742,7 @@ function _requestObservable(client, httpRequest, options) {
743
742
  const resultSourceMap = (_b = options.resultSourceMap) != null ? _b : config.resultSourceMap;
744
743
  resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
745
744
  const perspective = options.perspective || config.perspective;
746
- typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
745
+ typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
747
746
  }
748
747
  const reqOptions = requestOptions(
749
748
  config,
@@ -790,30 +789,30 @@ function _createAbortError(signal) {
790
789
  const error = new Error((_b = signal == null ? void 0 : signal.reason) != null ? _b : "The operation was aborted.");
791
790
  return error.name = "AbortError", error;
792
791
  }
793
- var __accessCheck$5 = (obj, member, msg) => {
792
+ var __accessCheck$4 = (obj, member, msg) => {
794
793
  if (!member.has(obj))
795
794
  throw TypeError("Cannot " + msg);
796
- }, __privateGet$5 = (obj, member, getter) => (__accessCheck$5(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$5 = (obj, member, value) => {
795
+ }, __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$4 = (obj, member, value) => {
797
796
  if (member.has(obj))
798
797
  throw TypeError("Cannot add the same private member more than once");
799
798
  member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
800
- }, __privateSet$5 = (obj, member, value, setter) => (__accessCheck$5(obj, member, "write to private field"), member.set(obj, value), value), _client$4, _httpRequest$4;
799
+ }, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value), _client$3, _httpRequest$4;
801
800
  class ObservableAssetsClient {
802
801
  constructor(client, httpRequest) {
803
- __privateAdd$5(this, _client$4, void 0), __privateAdd$5(this, _httpRequest$4, void 0), __privateSet$5(this, _client$4, client), __privateSet$5(this, _httpRequest$4, httpRequest);
802
+ __privateAdd$4(this, _client$3, void 0), __privateAdd$4(this, _httpRequest$4, void 0), __privateSet$4(this, _client$3, client), __privateSet$4(this, _httpRequest$4, httpRequest);
804
803
  }
805
804
  upload(assetType, body, options) {
806
- return _upload(__privateGet$5(this, _client$4), __privateGet$5(this, _httpRequest$4), assetType, body, options);
805
+ return _upload(__privateGet$4(this, _client$3), __privateGet$4(this, _httpRequest$4), assetType, body, options);
807
806
  }
808
807
  }
809
- _client$4 = /* @__PURE__ */ new WeakMap(), _httpRequest$4 = /* @__PURE__ */ new WeakMap();
808
+ _client$3 = /* @__PURE__ */ new WeakMap(), _httpRequest$4 = /* @__PURE__ */ new WeakMap();
810
809
  var _client2$3, _httpRequest2$4;
811
810
  class AssetsClient {
812
811
  constructor(client, httpRequest) {
813
- __privateAdd$5(this, _client2$3, void 0), __privateAdd$5(this, _httpRequest2$4, void 0), __privateSet$5(this, _client2$3, client), __privateSet$5(this, _httpRequest2$4, httpRequest);
812
+ __privateAdd$4(this, _client2$3, void 0), __privateAdd$4(this, _httpRequest2$4, void 0), __privateSet$4(this, _client2$3, client), __privateSet$4(this, _httpRequest2$4, httpRequest);
814
813
  }
815
814
  upload(assetType, body, options) {
816
- const observable = _upload(__privateGet$5(this, _client2$3), __privateGet$5(this, _httpRequest2$4), assetType, body, options);
815
+ const observable = _upload(__privateGet$4(this, _client2$3), __privateGet$4(this, _httpRequest2$4), assetType, body, options);
817
816
  return rxjs.lastValueFrom(
818
817
  observable.pipe(
819
818
  operators.filter((event) => event.type === "response"),
@@ -880,10 +879,10 @@ function _listen(query, params, opts = {}) {
880
879
  stopped || (emitReconnect(), !stopped && es.readyState === es.CLOSED && (unsubscribe(), clearTimeout(reconnectTimer), reconnectTimer = setTimeout(open, 100)));
881
880
  }
882
881
  function onChannelError(err) {
883
- observer.error(cooerceError$1(err));
882
+ observer.error(cooerceError(err));
884
883
  }
885
884
  function onMessage(evt) {
886
- const event = parseEvent$1(evt);
885
+ const event = parseEvent(evt);
887
886
  return event instanceof Error ? observer.error(event) : observer.next(event);
888
887
  }
889
888
  function onDisconnect() {
@@ -896,96 +895,29 @@ function _listen(query, params, opts = {}) {
896
895
  shouldEmitReconnect && observer.next({ type: "reconnect" });
897
896
  }
898
897
  async function getEventSource() {
899
- const { default: EventSource2 } = await import("@sanity/eventsource");
898
+ const { default: EventSource } = await import("@sanity/eventsource");
900
899
  if (unsubscribed)
901
900
  return;
902
- const evs = new EventSource2(uri, esOptions);
901
+ const evs = new EventSource(uri, esOptions);
903
902
  return evs.addEventListener("error", onError), evs.addEventListener("channelError", onChannelError), evs.addEventListener("disconnect", onDisconnect), listenFor.forEach((type) => evs.addEventListener(type, onMessage)), evs;
904
903
  }
905
904
  function open() {
906
905
  getEventSource().then((eventSource) => {
907
906
  eventSource && (es = eventSource);
908
907
  }).catch((reason) => {
909
- observer.error(reason), stop2();
908
+ observer.error(reason), stop();
910
909
  });
911
910
  }
912
- function stop2() {
911
+ function stop() {
913
912
  stopped = !0, unsubscribe(), unsubscribed = !0;
914
913
  }
915
- return stop2;
914
+ return stop;
916
915
  });
917
916
  }
918
- function parseEvent$1(event) {
919
- try {
920
- const data = event.data && JSON.parse(event.data) || {};
921
- return Object.assign({ type: event.type }, data);
922
- } catch (err) {
923
- return err;
924
- }
925
- }
926
- function cooerceError$1(err) {
927
- if (err instanceof Error)
928
- return err;
929
- const evt = parseEvent$1(err);
930
- return evt instanceof Error ? evt : new Error(extractErrorMessage$1(evt));
931
- }
932
- function extractErrorMessage$1(err) {
933
- return err.error ? err.error.description ? err.error.description : typeof err.error == "string" ? err.error : JSON.stringify(err.error, null, 2) : err.message || "Unknown listener error";
934
- }
935
- var __accessCheck$4 = (obj, member, msg) => {
936
- if (!member.has(obj))
937
- throw TypeError("Cannot " + msg);
938
- }, __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd$4 = (obj, member, value) => {
939
- if (member.has(obj))
940
- throw TypeError("Cannot add the same private member more than once");
941
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
942
- }, __privateSet$4 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value), _client$3;
943
- class LiveClient {
944
- constructor(client) {
945
- __privateAdd$4(this, _client$3, void 0), __privateSet$4(this, _client$3, client);
946
- }
947
- events() {
948
- const path = _getDataUrl(__privateGet$4(this, _client$3), "live/events"), url = new URL(__privateGet$4(this, _client$3).getUrl(path, !1)), listenFor = ["restart", "message"];
949
- return new rxjs.Observable((observer) => {
950
- let es, unsubscribed = !1;
951
- open();
952
- function onError(evt) {
953
- unsubscribed || (observer.error(cooerceError(evt)), es.readyState === es.CLOSED && unsubscribe());
954
- }
955
- function onMessage(evt) {
956
- const event = parseEvent(evt);
957
- return event instanceof Error ? observer.error(event) : observer.next(event);
958
- }
959
- function unsubscribe() {
960
- console.log("unsubscribe", { es, unsubscribed }), unsubscribed = !0, es && (console.log("teardown and es.close"), es.removeEventListener("error", onError), listenFor.forEach((type) => es.removeEventListener(type, onMessage)), es.close());
961
- }
962
- async function getEventSource() {
963
- console.log("getEventSource inner", { unsubscribed });
964
- const EventSourceImplementation = typeof EventSource > "u" ? (await import("@sanity/eventsource")).default : globalThis.EventSource;
965
- if (unsubscribed) {
966
- console.log("unsubscribed, do not setup");
967
- return;
968
- }
969
- console.log("starting EventSource", { url, unsubscribed, EventSourceImplementation });
970
- const evs = new EventSourceImplementation(url.toString());
971
- return evs.addEventListener("error", onError), listenFor.forEach((type) => evs.addEventListener(type, onMessage)), evs;
972
- }
973
- function open() {
974
- console.log("open.getEventSource", { unsubscribed }), getEventSource().then((eventSource) => {
975
- console.log("open.getEventSource.then", { eventSource, unsubscribed }), eventSource && (es = eventSource, unsubscribed && (console.log("open.getEventSource.then.unsubscribed", { unsubscribed, es }), unsubscribe()));
976
- }).catch((reason) => {
977
- observer.error(reason), stop();
978
- });
979
- }
980
- return unsubscribe;
981
- });
982
- }
983
- }
984
- _client$3 = /* @__PURE__ */ new WeakMap();
985
917
  function parseEvent(event) {
986
918
  try {
987
919
  const data = event.data && JSON.parse(event.data) || {};
988
- return { type: event.type, id: event.lastEventId, ...data };
920
+ return Object.assign({ type: event.type }, data);
989
921
  } catch (err) {
990
922
  return err;
991
923
  }
@@ -994,7 +926,7 @@ function cooerceError(err) {
994
926
  if (err instanceof Error)
995
927
  return err;
996
928
  const evt = parseEvent(err);
997
- return evt instanceof Error ? evt : new Error(extractErrorMessage(evt), { cause: evt });
929
+ return evt instanceof Error ? evt : new Error(extractErrorMessage(evt));
998
930
  }
999
931
  function extractErrorMessage(err) {
1000
932
  return err.error ? err.error.description ? err.error.description : typeof err.error == "string" ? err.error : JSON.stringify(err.error, null, 2) : err.message || "Unknown listener error";
@@ -1203,7 +1135,7 @@ var __defProp2 = Object.defineProperty, __defNormalProp = (obj, key, value) => k
1203
1135
  }, __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value), _clientConfig, _httpRequest;
1204
1136
  const _ObservableSanityClient = class _ObservableSanityClient2 {
1205
1137
  constructor(httpRequest, config = defaultConfig) {
1206
- __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "live"), __publicField(this, "projects"), __publicField(this, "users"), __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.live = new LiveClient(this), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1138
+ __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "projects"), __publicField(this, "users"), __privateAdd(this, _clientConfig, void 0), __privateAdd(this, _httpRequest, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest, httpRequest), this.assets = new ObservableAssetsClient(this, __privateGet(this, _httpRequest)), this.datasets = new ObservableDatasetsClient(this, __privateGet(this, _httpRequest)), this.projects = new ObservableProjectsClient(this, __privateGet(this, _httpRequest)), this.users = new ObservableUsersClient(this, __privateGet(this, _httpRequest));
1207
1139
  }
1208
1140
  /**
1209
1141
  * Clone the client - returns a new instance
@@ -1332,7 +1264,7 @@ let ObservableSanityClient = _ObservableSanityClient;
1332
1264
  var _clientConfig2, _httpRequest2;
1333
1265
  const _SanityClient = class _SanityClient2 {
1334
1266
  constructor(httpRequest, config = defaultConfig) {
1335
- __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "live"), __publicField(this, "projects"), __publicField(this, "users"), __publicField(this, "observable"), __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.live = new LiveClient(this), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);
1267
+ __publicField(this, "assets"), __publicField(this, "datasets"), __publicField(this, "projects"), __publicField(this, "users"), __publicField(this, "observable"), __privateAdd(this, _clientConfig2, void 0), __privateAdd(this, _httpRequest2, void 0), __publicField(this, "listen", _listen), this.config(config), __privateSet(this, _httpRequest2, httpRequest), this.assets = new AssetsClient(this, __privateGet(this, _httpRequest2)), this.datasets = new DatasetsClient(this, __privateGet(this, _httpRequest2)), this.projects = new ProjectsClient(this, __privateGet(this, _httpRequest2)), this.users = new UsersClient(this, __privateGet(this, _httpRequest2)), this.observable = new ObservableSanityClient(httpRequest, config);
1336
1268
  }
1337
1269
  /**
1338
1270
  * Clone the client - returns a new instance