@sanity/client 6.20.0 → 6.20.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 +5 -2
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +5 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/config.ts +5 -0
- package/src/warnings.ts +5 -0
- package/umd/sanityClient.js +19 -21
- package/umd/sanityClient.min.js +3 -3
package/dist/index.js
CHANGED
|
@@ -491,7 +491,10 @@ function once(fn) {
|
|
|
491
491
|
const createWarningPrinter = (message) => (
|
|
492
492
|
// eslint-disable-next-line no-console
|
|
493
493
|
once((...args) => console.warn(message.join(" "), ...args))
|
|
494
|
-
),
|
|
494
|
+
), printCdnAndWithCredentialsWarning = createWarningPrinter([
|
|
495
|
+
"Because you set `withCredentials` to true, we will override your `useCdn`",
|
|
496
|
+
"setting to be false since (cookie-based) credentials are never set on the CDN"
|
|
497
|
+
]), printCdnWarning = createWarningPrinter([
|
|
495
498
|
"Since you haven't set a value for `useCdn`, we will deliver content using our",
|
|
496
499
|
"global, edge-cached API-CDN. If you wish to have content delivered faster, set",
|
|
497
500
|
"`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."
|
|
@@ -569,7 +572,7 @@ const validateApiPerspective = function(perspective) {
|
|
|
569
572
|
`stega.studioUrl must be a string or a function, received ${newConfig.stega.studioUrl}`
|
|
570
573
|
);
|
|
571
574
|
const isBrowser = typeof window < "u" && window.location && window.location.hostname, isLocalhost = isBrowser && isLocal(window.location.hostname);
|
|
572
|
-
isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !== !0 ? printBrowserTokenWarning() : typeof newConfig.useCdn > "u" && printCdnWarning(), projectBased && projectId(newConfig.projectId), newConfig.dataset && dataset(newConfig.dataset), "requestTagPrefix" in newConfig && (newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\.+$/, "") : void 0), newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, ""), newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost, newConfig.useCdn = newConfig.useCdn !== !1 && !newConfig.withCredentials, validateApiVersion(newConfig.apiVersion);
|
|
575
|
+
isBrowser && isLocalhost && newConfig.token && newConfig.ignoreBrowserTokenWarning !== !0 ? printBrowserTokenWarning() : typeof newConfig.useCdn > "u" && printCdnWarning(), projectBased && projectId(newConfig.projectId), newConfig.dataset && dataset(newConfig.dataset), "requestTagPrefix" in newConfig && (newConfig.requestTagPrefix = newConfig.requestTagPrefix ? requestTag(newConfig.requestTagPrefix).replace(/\.+$/, "") : void 0), newConfig.apiVersion = `${newConfig.apiVersion}`.replace(/^v/, ""), newConfig.isDefaultApi = newConfig.apiHost === defaultConfig.apiHost, newConfig.useCdn === !0 && newConfig.withCredentials && printCdnAndWithCredentialsWarning(), newConfig.useCdn = newConfig.useCdn !== !1 && !newConfig.withCredentials, validateApiVersion(newConfig.apiVersion);
|
|
573
576
|
const hostParts = newConfig.apiHost.split("://", 2), protocol = hostParts[0], host = hostParts[1], cdnHost = newConfig.isDefaultApi ? defaultCdnHost : host;
|
|
574
577
|
return newConfig.useProjectHostname ? (newConfig.url = `${protocol}://${newConfig.projectId}.${host}/v${newConfig.apiVersion}`, newConfig.cdnUrl = `${protocol}://${newConfig.projectId}.${cdnHost}/v${newConfig.apiVersion}`) : (newConfig.url = `${newConfig.apiHost}/v${newConfig.apiVersion}`, newConfig.cdnUrl = newConfig.url), newConfig;
|
|
575
578
|
}, projectHeader = "X-Sanity-Project-ID";
|
|
@@ -1527,7 +1530,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1527
1530
|
return printNoDefaultExport(), createClient2(config);
|
|
1528
1531
|
};
|
|
1529
1532
|
}
|
|
1530
|
-
var name = "@sanity/client", version = "6.20.
|
|
1533
|
+
var name = "@sanity/client", version = "6.20.1";
|
|
1531
1534
|
const middleware = [
|
|
1532
1535
|
debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1533
1536
|
headers({ "User-Agent": `${name} ${version}` }),
|