sanity 5.7.0-next.24 → 5.7.0-next.25
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/lib/_chunks-es/package.js +1 -1
- package/lib/_chunks-es/version.js +1 -1
- package/lib/index.js +30 -18
- package/lib/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -7,7 +7,7 @@ try {
|
|
|
7
7
|
try {
|
|
8
8
|
buildVersion = buildVersion || // This is replaced by `@sanity/pkg-utils` at build time
|
|
9
9
|
// and must always be references by its full static name, e.g. no optional chaining, no `if (process && process.env)` etc.
|
|
10
|
-
"5.7.0-next.
|
|
10
|
+
"5.7.0-next.25+d517d2afdc";
|
|
11
11
|
} catch {
|
|
12
12
|
}
|
|
13
13
|
const SANITY_VERSION = buildVersion || `${version}-dev`;
|
package/lib/index.js
CHANGED
|
@@ -10698,7 +10698,8 @@ const documentRevisionCache = /* @__PURE__ */ Object.create(null);
|
|
|
10698
10698
|
function getDocumentAtRevision({
|
|
10699
10699
|
client,
|
|
10700
10700
|
documentId,
|
|
10701
|
-
revisionId
|
|
10701
|
+
revisionId,
|
|
10702
|
+
time
|
|
10702
10703
|
}) {
|
|
10703
10704
|
if (revisionId === HISTORY_CLEARED_EVENT_ID)
|
|
10704
10705
|
return of({
|
|
@@ -10706,23 +10707,34 @@ function getDocumentAtRevision({
|
|
|
10706
10707
|
loading: !1,
|
|
10707
10708
|
revisionId
|
|
10708
10709
|
});
|
|
10709
|
-
const cacheKey = `${documentId}@${revisionId}`, dataset = client.config().dataset;
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10710
|
+
const cacheKey = `${documentId}@${revisionId ? ["revisionId", revisionId].join(".") : ["time", time].join(".")}`, dataset = client.config().dataset;
|
|
10711
|
+
if (!documentRevisionCache[cacheKey]) {
|
|
10712
|
+
const searchParams = new URLSearchParams(typeof revisionId == "string" ? {
|
|
10713
|
+
revision: revisionId
|
|
10714
|
+
} : {
|
|
10715
|
+
time
|
|
10716
|
+
});
|
|
10717
|
+
documentRevisionCache[cacheKey] = client.observable.request({
|
|
10718
|
+
url: `/data/history/${dataset}/documents/${documentId}?${searchParams}`,
|
|
10719
|
+
tag: "get-document-revision"
|
|
10720
|
+
}).pipe(map((response) => {
|
|
10721
|
+
const document2 = response.documents[0];
|
|
10722
|
+
return {
|
|
10723
|
+
document: document2,
|
|
10724
|
+
loading: !1,
|
|
10725
|
+
revisionId: document2._rev
|
|
10726
|
+
};
|
|
10727
|
+
}), catchError((error) => (console.error("Error fetching document at revision", error), [{
|
|
10728
|
+
document: null,
|
|
10729
|
+
loading: !1,
|
|
10730
|
+
revisionId
|
|
10731
|
+
}])), startWith({
|
|
10732
|
+
document: null,
|
|
10733
|
+
loading: !0,
|
|
10734
|
+
revisionId
|
|
10735
|
+
}), shareReplay(1));
|
|
10736
|
+
}
|
|
10737
|
+
return documentRevisionCache[cacheKey];
|
|
10726
10738
|
}
|
|
10727
10739
|
const INITIAL_VALUE$4 = {
|
|
10728
10740
|
events: [],
|