@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/_chunks-cjs/config.cjs +6 -2
- package/dist/_chunks-cjs/config.cjs.map +1 -1
- package/dist/_chunks-es/config.js +6 -2
- package/dist/_chunks-es/config.js.map +1 -1
- package/dist/index.browser.cjs +12 -5
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +12 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +11 -3
- package/src/data/listen.ts +1 -1
- package/src/http/requestOptions.ts +1 -1
- package/src/util/shareReplayLatest.ts +4 -1
- package/src/warnings.ts +5 -0
- package/umd/sanityClient.js +19 -10
- package/umd/sanityClient.min.js +2 -2
package/dist/index.cjs
CHANGED
|
@@ -570,7 +570,7 @@ const projectHeader = "X-Sanity-Project-ID";
|
|
|
570
570
|
function requestOptions(config2, overrides = {}) {
|
|
571
571
|
const headers = {}, token = overrides.token || config2.token;
|
|
572
572
|
token && (headers.Authorization = `Bearer ${token}`), !overrides.useGlobalApi && !config2.useProjectHostname && config2.projectId && (headers[projectHeader] = config2.projectId);
|
|
573
|
-
const withCredentials = !!(typeof overrides.withCredentials > "u" ? config2.
|
|
573
|
+
const withCredentials = !!(typeof overrides.withCredentials > "u" ? config2.withCredentials : overrides.withCredentials), timeout = typeof overrides.timeout > "u" ? config2.timeout : overrides.timeout;
|
|
574
574
|
return Object.assign({}, overrides, {
|
|
575
575
|
headers: Object.assign({}, headers, overrides.headers || {}),
|
|
576
576
|
timeout: typeof timeout > "u" ? 5 * 60 * 1e3 : timeout,
|
|
@@ -882,7 +882,7 @@ function _listen(query, params, opts = {}) {
|
|
|
882
882
|
if (uri.length > MAX_URL_LENGTH)
|
|
883
883
|
return rxjs.throwError(() => new Error("Query too large for listener"));
|
|
884
884
|
const listenFor = options.events ? options.events : ["mutation"], esOptions = {};
|
|
885
|
-
return
|
|
885
|
+
return withCredentials && (esOptions.withCredentials = !0), token && (esOptions.headers = {
|
|
886
886
|
Authorization: `Bearer ${token}`
|
|
887
887
|
}), connectEventSource(() => (
|
|
888
888
|
// use polyfill if there is no global EventSource or if we need to set headers
|
|
@@ -915,7 +915,10 @@ function _shareReplayLatest(config2) {
|
|
|
915
915
|
}),
|
|
916
916
|
rxjs.share(shareConfig)
|
|
917
917
|
), emitLatest = new rxjs.Observable((subscriber) => {
|
|
918
|
-
emitted && subscriber.next(
|
|
918
|
+
emitted && subscriber.next(
|
|
919
|
+
// this cast is safe because of the emitted check which asserts that we got T from the source
|
|
920
|
+
latest
|
|
921
|
+
), subscriber.complete();
|
|
919
922
|
});
|
|
920
923
|
return rxjs.merge(wrapped, emitLatest);
|
|
921
924
|
};
|
|
@@ -1525,7 +1528,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1525
1528
|
return config.printNoDefaultExport(), createClient2(config$1);
|
|
1526
1529
|
};
|
|
1527
1530
|
}
|
|
1528
|
-
var name = "@sanity/client", version = "6.28.
|
|
1531
|
+
var name = "@sanity/client", version = "6.28.4-beta.0";
|
|
1529
1532
|
const middleware = [
|
|
1530
1533
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1531
1534
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|