@sanity/client 6.4.8 → 6.4.9
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 +6 -1
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +6 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/data/dataMethods.ts +7 -1
- package/src/warnings.ts +5 -0
- package/umd/sanityClient.js +6 -1
- package/umd/sanityClient.min.js +3 -3
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export { adapter as unstable__adapter, environment as unstable__environment } fr
|
|
|
4
4
|
import { Observable, lastValueFrom } from 'rxjs';
|
|
5
5
|
import { map, filter } from 'rxjs/operators';
|
|
6
6
|
var name = "@sanity/client";
|
|
7
|
-
var version = "6.4.
|
|
7
|
+
var version = "6.4.9";
|
|
8
8
|
const middleware = [debug({
|
|
9
9
|
verbose: true,
|
|
10
10
|
namespace: "sanity:client"
|
|
@@ -241,6 +241,7 @@ once(function () {
|
|
|
241
241
|
return console.warn(message.join(" "), ...args);
|
|
242
242
|
});
|
|
243
243
|
const printCdnWarning = createWarningPrinter(["Since you haven't set a value for `useCdn`, we will deliver content using our", "global, edge-cached API-CDN. If you wish to have content delivered faster, set", "`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."]);
|
|
244
|
+
const printCdnPreviewDraftsWarning = createWarningPrinter(["The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.", "The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."]);
|
|
244
245
|
const printBrowserTokenWarning = createWarningPrinter(["You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.", "See ".concat(generateHelpUrl("js-client-browser-token"), " for more information and how to hide this warning.")]);
|
|
245
246
|
const printNoApiVersionSpecifiedWarning = createWarningPrinter(["Using the Sanity client without specifying an API version is deprecated.", "See ".concat(generateHelpUrl("js-client-api-version"))]);
|
|
246
247
|
const printNoDefaultExport = createWarningPrinter(["The default export of @sanity/client has been deprecated. Use the named export `createClient` instead."]);
|
|
@@ -1021,7 +1022,7 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1021
1022
|
const uri = options.url || options.uri;
|
|
1022
1023
|
const config = client.config();
|
|
1023
1024
|
const canUseCdn = typeof options.canUseCdn === "undefined" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/") === 0 : options.canUseCdn;
|
|
1024
|
-
|
|
1025
|
+
let useCdn = config.useCdn && canUseCdn;
|
|
1025
1026
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
1026
1027
|
if (tag) {
|
|
1027
1028
|
options.query = {
|
|
@@ -1043,6 +1044,10 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1043
1044
|
perspective,
|
|
1044
1045
|
...options.query
|
|
1045
1046
|
};
|
|
1047
|
+
if (perspective === "previewDrafts" && useCdn) {
|
|
1048
|
+
useCdn = false;
|
|
1049
|
+
printCdnPreviewDraftsWarning();
|
|
1050
|
+
}
|
|
1046
1051
|
}
|
|
1047
1052
|
}
|
|
1048
1053
|
const reqOptions = requestOptions(config, Object.assign({}, options, {
|