@sanity/client 6.21.2 → 6.21.3-bundle-perspective
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/resolveEditInfo.cjs +1 -2
- package/dist/_chunks-cjs/resolveEditInfo.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaClean.cjs +1 -2
- package/dist/_chunks-cjs/stegaClean.cjs.map +1 -1
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs +1 -2
- package/dist/_chunks-cjs/stegaEncodeSourceMap.cjs.map +1 -1
- package/dist/_chunks-es/resolveEditInfo.js +1 -2
- package/dist/_chunks-es/resolveEditInfo.js.map +1 -1
- package/dist/_chunks-es/stegaClean.js +1 -2
- package/dist/_chunks-es/stegaClean.js.map +1 -1
- package/dist/_chunks-es/stegaEncodeSourceMap.js +1 -2
- package/dist/_chunks-es/stegaEncodeSourceMap.js.map +1 -1
- package/dist/csm.cjs +1 -2
- package/dist/csm.cjs.map +1 -1
- package/dist/csm.js +1 -2
- package/dist/csm.js.map +1 -1
- package/dist/index.browser.cjs +16 -6
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.cts +16 -1
- package/dist/index.browser.d.ts +16 -1
- package/dist/index.browser.js +16 -6
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +17 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/SanityClient.ts +2 -2
- package/src/data/dataMethods.ts +23 -4
- package/src/types.ts +14 -1
- package/umd/sanityClient.js +21 -12
- package/umd/sanityClient.min.js +2 -2
package/dist/index.cjs
CHANGED
|
@@ -103,8 +103,7 @@ function defineHttpRequest(envMiddleware) {
|
|
|
103
103
|
]);
|
|
104
104
|
}
|
|
105
105
|
function shouldRetry(err, attempt, options) {
|
|
106
|
-
if (options.maxRetries === 0)
|
|
107
|
-
return !1;
|
|
106
|
+
if (options.maxRetries === 0) return !1;
|
|
108
107
|
const isSafe = options.method === "GET" || options.method === "HEAD", isQuery = (options.uri || options.url).startsWith("/data/query"), isRetriableResponse = err.response && (err.response.statusCode === 429 || err.response.statusCode === 502 || err.response.statusCode === 503);
|
|
109
108
|
return (isSafe || isQuery) && isRetriableResponse ? !0 : middleware$1.retry.shouldRetry(err, attempt, options);
|
|
110
109
|
}
|
|
@@ -645,14 +644,24 @@ function _fetch(client, httpRequest, _stega, query, _params = {}, options = {})
|
|
|
645
644
|
) : $request.pipe(operators.map(mapResponse));
|
|
646
645
|
}
|
|
647
646
|
function _getDocument(client, httpRequest, id, opts = {}) {
|
|
648
|
-
const options = {
|
|
647
|
+
const options = {
|
|
648
|
+
uri: _getDataUrl(client, "doc", id),
|
|
649
|
+
json: !0,
|
|
650
|
+
tag: opts.tag,
|
|
651
|
+
signal: opts.signal
|
|
652
|
+
};
|
|
649
653
|
return _requestObservable(client, httpRequest, options).pipe(
|
|
650
654
|
operators.filter(isResponse),
|
|
651
655
|
operators.map((event) => event.body.documents && event.body.documents[0])
|
|
652
656
|
);
|
|
653
657
|
}
|
|
654
658
|
function _getDocuments(client, httpRequest, ids, opts = {}) {
|
|
655
|
-
const options = {
|
|
659
|
+
const options = {
|
|
660
|
+
uri: _getDataUrl(client, "doc", ids.join(",")),
|
|
661
|
+
json: !0,
|
|
662
|
+
tag: opts.tag,
|
|
663
|
+
signal: opts.signal
|
|
664
|
+
};
|
|
656
665
|
return _requestObservable(client, httpRequest, options).pipe(
|
|
657
666
|
operators.filter(isResponse),
|
|
658
667
|
operators.map((event) => {
|
|
@@ -705,6 +714,7 @@ function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
|
|
|
705
714
|
tag,
|
|
706
715
|
returnQuery,
|
|
707
716
|
perspective: options.perspective,
|
|
717
|
+
bundlePerspective: options.bundlePerspective,
|
|
708
718
|
resultSourceMap: options.resultSourceMap,
|
|
709
719
|
lastLiveEventId: Array.isArray(lastLiveEventId) ? lastLiveEventId[0] : lastLiveEventId,
|
|
710
720
|
canUseCdn: isQuery,
|
|
@@ -742,8 +752,8 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
742
752
|
if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), ["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && uri.indexOf("/data/query/") === 0) {
|
|
743
753
|
const resultSourceMap = options.resultSourceMap ?? config.resultSourceMap;
|
|
744
754
|
resultSourceMap !== void 0 && resultSourceMap !== !1 && (options.query = { resultSourceMap, ...options.query });
|
|
745
|
-
const perspective = options.perspective || config.perspective;
|
|
746
|
-
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 });
|
|
755
|
+
const perspective = options.perspective || config.perspective, bundlePerspective = options.bundlePerspective || config.bundlePerspective;
|
|
756
|
+
typeof perspective == "string" && perspective !== "raw" && (validateApiPerspective(perspective), options.query = { perspective, ...options.query }, perspective === "previewDrafts" && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning())), typeof bundlePerspective == "string" && (options.query = { perspective: void 0, bundlePerspective, ...options.query }), options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === !1 && (options.query = { returnQuery: "false", ...options.query });
|
|
747
757
|
}
|
|
748
758
|
const reqOptions = requestOptions(
|
|
749
759
|
config,
|
|
@@ -1513,7 +1523,7 @@ function defineDeprecatedCreateClient(createClient2) {
|
|
|
1513
1523
|
return printNoDefaultExport(), createClient2(config);
|
|
1514
1524
|
};
|
|
1515
1525
|
}
|
|
1516
|
-
var name = "@sanity/client", version = "6.21.
|
|
1526
|
+
var name = "@sanity/client", version = "6.21.3-bundle-perspective";
|
|
1517
1527
|
const middleware = [
|
|
1518
1528
|
middleware$1.debug({ verbose: !0, namespace: "sanity:client" }),
|
|
1519
1529
|
middleware$1.headers({ "User-Agent": `${name} ${version}` }),
|