@sanity/client 7.25.0 → 7.26.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 +7 -20
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +7 -20
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +8 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/data/dataMethods.ts +16 -30
- package/umd/sanityClient.js +7 -20
- package/umd/sanityClient.min.js +1 -1
package/dist/index.browser.cjs
CHANGED
|
@@ -1176,23 +1176,13 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1176
1176
|
}, (Array.isArray(perspectiveOption) && perspectiveOption.length > 0 || // previewDrafts was renamed to drafts, but keep for backwards compat
|
|
1177
1177
|
perspectiveOption === "previewDrafts" || perspectiveOption === "drafts") && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning()));
|
|
1178
1178
|
const variantOption = options.variant || config.variant;
|
|
1179
|
-
|
|
1179
|
+
typeof variantOption == "string" && (options.query = {
|
|
1180
1180
|
variant: variantOption,
|
|
1181
1181
|
...options.query
|
|
1182
|
-
}), typeof variantOption == "object"
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
console.warn(
|
|
1187
|
-
`The Sanity client's beta \`variant\` option currently only supports one condition. Dropped: ${formatter.format(variantConditions.slice(1).map(([subject]) => JSON.stringify(subject)))}.`
|
|
1188
|
-
);
|
|
1189
|
-
}
|
|
1190
|
-
options.query = {
|
|
1191
|
-
...Object.fromEntries(searchParams),
|
|
1192
|
-
...options.query
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
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 });
|
|
1182
|
+
}), typeof variantOption == "object" && (options.query = {
|
|
1183
|
+
variantCondition: variantConditionsToQueryArray(variantOption),
|
|
1184
|
+
...options.query
|
|
1185
|
+
}), 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 });
|
|
1196
1186
|
}
|
|
1197
1187
|
const reqOptions = requestOptions(
|
|
1198
1188
|
config,
|
|
@@ -1267,11 +1257,8 @@ const resourceDataBase = (config) => {
|
|
|
1267
1257
|
throw new Error(`Unsupported resource type: ${type.toString()}`);
|
|
1268
1258
|
}
|
|
1269
1259
|
};
|
|
1270
|
-
function
|
|
1271
|
-
return
|
|
1272
|
-
"variantCondition",
|
|
1273
|
-
`${condition}:${value}`
|
|
1274
|
-
]);
|
|
1260
|
+
function variantConditionsToQueryArray(variantConditions) {
|
|
1261
|
+
return Object.entries(variantConditions).map(([condition, value]) => `${condition}:${value}`).toSorted();
|
|
1275
1262
|
}
|
|
1276
1263
|
function _generate(client, httpRequest, request) {
|
|
1277
1264
|
const dataset2 = hasDataset(client.config());
|