@sanity/client 6.28.3 → 6.28.4-beta.0

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/dist/index.js CHANGED
@@ -555,7 +555,7 @@ const projectHeader = "X-Sanity-Project-ID";
555
555
  function requestOptions(config, overrides = {}) {
556
556
  const headers2 = {}, token = overrides.token || config.token;
557
557
  token && (headers2.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config.useProjectHostname && config.projectId && (headers2[projectHeader] = config.projectId);
558
- const withCredentials = !!(typeof overrides.withCredentials > "u" ? config.token || config.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > "u" ? config.timeout : overrides.timeout;
558
+ const withCredentials = !!(typeof overrides.withCredentials > "u" ? config.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > "u" ? config.timeout : overrides.timeout;
559
559
  return Object.assign({}, overrides, {
560
560
  headers: Object.assign({}, headers2, overrides.headers || {}),
561
561
  timeout: typeof timeout > "u" ? 5 * 60 * 1e3 : timeout,
@@ -865,7 +865,7 @@ function _listen(query, params, opts = {}) {
865
865
  if (uri.length > MAX_URL_LENGTH)
866
866
  return throwError(() => new Error("Query too large for listener"));
867
867
  const listenFor = options.events ? options.events : ["mutation"], esOptions = {};
868
- return (token || withCredentials) && (esOptions.withCredentials = !0), token && (esOptions.headers = {
868
+ return withCredentials && (esOptions.withCredentials = !0), token && (esOptions.headers = {
869
869
  Authorization: `Bearer ${token}`
870
870
  }), connectEventSource(() => (
871
871
  // use polyfill if there is no global EventSource or if we need to set headers
@@ -898,7 +898,10 @@ function _shareReplayLatest(config) {
898
898
  }),
899
899
  share(shareConfig)
900
900
  ), emitLatest = new Observable((subscriber) => {
901
- emitted && subscriber.next(latest), subscriber.complete();
901
+ emitted && subscriber.next(
902
+ // this cast is safe because of the emitted check which asserts that we got T from the source
903
+ latest
904
+ ), subscriber.complete();
902
905
  });
903
906
  return merge(wrapped, emitLatest);
904
907
  };
@@ -1508,7 +1511,7 @@ function defineDeprecatedCreateClient(createClient2) {
1508
1511
  return printNoDefaultExport(), createClient2(config);
1509
1512
  };
1510
1513
  }
1511
- var name = "@sanity/client", version = "6.28.3";
1514
+ var name = "@sanity/client", version = "6.28.4-beta.0";
1512
1515
  const middleware = [
1513
1516
  debug({ verbose: !0, namespace: "sanity:client" }),
1514
1517
  headers({ "User-Agent": `${name} ${version}` }),