@sanity/client 6.22.3 → 6.22.5-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.cjs CHANGED
@@ -116,8 +116,7 @@ function defineHttpRequest(envMiddleware) {
116
116
  ]);
117
117
  }
118
118
  function shouldRetry(err, attempt, options) {
119
- if (options.maxRetries === 0)
120
- return !1;
119
+ if (options.maxRetries === 0) return !1;
121
120
  const isSafe = options.method === "GET" || options.method === "HEAD", isQuery = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);
122
121
  return (isSafe || isQuery) && isRetriableResponse ? !0 : middleware$1.retry.shouldRetry(err, attempt, options);
123
122
  }
@@ -912,7 +911,7 @@ function _listen(query, params, opts = {}) {
912
911
  shouldEmitReconnect && observer.next({ type: "reconnect" });
913
912
  }
914
913
  async function getEventSource() {
915
- const { default: EventSource2 } = await import("@sanity/eventsource");
914
+ const { EventSource: EventSource2 } = await import("eventsource");
916
915
  if (unsubscribed)
917
916
  return;
918
917
  const evs = new EventSource2(uri, esOptions);
@@ -1010,7 +1009,7 @@ class LiveClient {
1010
1009
  }
1011
1010
  }
1012
1011
  async function getEventSource() {
1013
- const EventSourceImplementation = typeof EventSource > "u" || esOptions.headers || esOptions.withCredentials ? (await import("@sanity/eventsource")).default : EventSource;
1012
+ const EventSourceImplementation = typeof EventSource > "u" || esOptions.headers || esOptions.withCredentials ? (await import("eventsource")).EventSource : EventSource;
1014
1013
  if (unsubscribed)
1015
1014
  return;
1016
1015
  try {
@@ -1568,7 +1567,7 @@ function defineDeprecatedCreateClient(createClient2) {
1568
1567
  return printNoDefaultExport(), createClient2(config);
1569
1568
  };
1570
1569
  }
1571
- var name = "@sanity/client", version = "6.22.3";
1570
+ var name = "@sanity/client", version = "6.22.5-beta.0";
1572
1571
  const middleware = [
1573
1572
  middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
1574
1573
  middleware$1.headers({ "User-Agent": `${name} ${version}` }),