@sanity/client 6.22.5 → 6.23.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.browser.cjs +3 -2
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +11 -0
- package/dist/index.browser.d.ts +11 -0
- package/dist/index.browser.js +3 -2
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -12
- package/src/data/dataMethods.ts +6 -1
- package/src/types.ts +12 -0
- package/umd/sanityClient.js +3 -2
- package/umd/sanityClient.min.js +1 -1
package/dist/index.cjs
CHANGED
|
@@ -716,7 +716,7 @@ function _action(client, httpRequest, actions, options) {
|
|
|
716
716
|
);
|
|
717
717
|
}
|
|
718
718
|
function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
|
|
719
|
-
const isMutation = endpoint === "mutate", isAction = endpoint === "actions", isQuery = endpoint === "query", strQuery = isMutation || isAction ? "" : encodeQueryString(body), useGet = !isMutation && !isAction && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery, lastLiveEventId } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {
|
|
719
|
+
const isMutation = endpoint === "mutate", isAction = endpoint === "actions", isQuery = endpoint === "query", strQuery = isMutation || isAction ? "" : encodeQueryString(body), useGet = !isMutation && !isAction && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery, lastLiveEventId, cacheMode } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {
|
|
720
720
|
method: useGet ? "GET" : "POST",
|
|
721
721
|
uri,
|
|
722
722
|
json: !0,
|
|
@@ -730,6 +730,7 @@ function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
|
|
|
730
730
|
perspective: options.perspective,
|
|
731
731
|
resultSourceMap: options.resultSourceMap,
|
|
732
732
|
lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId,
|
|
733
|
+
cacheMode,
|
|
733
734
|
canUseCdn: isQuery,
|
|
734
735
|
signal: options.signal,
|
|
735
736
|
fetch: options.fetch,
|
|
@@ -766,7 +767,7 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
766
767
|
const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
|
|
767
768
|
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
|
|
768
769
|
const perspective = options.perspective || config.perspective;
|
|
769
|
-
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
|
|
770
|
+
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query }), useCdn && options.cacheMode == "noStale" && (options.query = { cacheMode: "noStale", ...options.query });
|
|
770
771
|
}
|
|
771
772
|
const reqOptions = requestOptions(
|
|
772
773
|
config,
|
|
@@ -1568,7 +1569,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1568
1569
|
return printNoDefaultExport(), createClient2(config);
|
|
1569
1570
|
};
|
|
1570
1571
|
}
|
|
1571
|
-
var name = "@sanity/client", version = "6.
|
|
1572
|
+
var name = "@sanity/client", version = "6.23.0";
|
|
1572
1573
|
const middleware = [
|
|
1573
1574
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1574
1575
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|