@sanity/client 6.22.5-beta.0 → 6.22.5-beta.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.
- package/dist/index.browser.cjs +7 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +7 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/data/listen.ts +11 -9
- package/umd/sanityClient.js +7 -4
- package/umd/sanityClient.min.js +1 -1
package/dist/index.browser.cjs
CHANGED
|
@@ -885,10 +885,13 @@ function _listen(query, params, opts = {}) {
|
|
|
885
885
|
const { url, token, withCredentials, requestTagPrefix } = this.config(), tag = opts.tag && requestTagPrefix ? [requestTagPrefix, opts.tag].join(".") : opts.tag, options = { ...defaults(opts, defaultOptions), tag }, listenOpts = pick(options, possibleOptions), qs = encodeQueryString({ query, params, options: { tag, ...listenOpts } }), uri = `${url}${_getDataUrl(this, "listen", qs)}`;
|
|
886
886
|
if (uri.length > MAX_URL_LENGTH)
|
|
887
887
|
return new rxjs.Observable((observer) => observer.error(new Error("Query too large for listener")));
|
|
888
|
-
const listenFor = options.events ? options.events : ["mutation"], shouldEmitReconnect = listenFor.indexOf("reconnect") !== -1
|
|
889
|
-
return
|
|
890
|
-
|
|
891
|
-
|
|
888
|
+
const listenFor = options.events ? options.events : ["mutation"], shouldEmitReconnect = listenFor.indexOf("reconnect") !== -1;
|
|
889
|
+
return new rxjs.Observable((observer) => {
|
|
890
|
+
const esOptions = {};
|
|
891
|
+
(token || withCredentials) && (esOptions.withCredentials = !0), token && (esOptions.fetch = (esUrl, esInit) => globalThis.fetch(esUrl, {
|
|
892
|
+
...esInit,
|
|
893
|
+
headers: { ...esInit?.headers, Authorization: `Bearer ${token}` }
|
|
894
|
+
}));
|
|
892
895
|
let es, reconnectTimer, stopped = !1, unsubscribed = !1;
|
|
893
896
|
open();
|
|
894
897
|
function onError() {
|