@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.js
CHANGED
|
@@ -1160,23 +1160,13 @@ function _requestObservable(client, httpRequest, options) {
|
|
|
1160
1160
|
}, (Array.isArray(perspectiveOption) && perspectiveOption.length > 0 || // previewDrafts was renamed to drafts, but keep for backwards compat
|
|
1161
1161
|
perspectiveOption === "previewDrafts" || perspectiveOption === "drafts") && useCdn && (useCdn = !1, printCdnPreviewDraftsWarning()));
|
|
1162
1162
|
const variantOption = options.variant || config.variant;
|
|
1163
|
-
|
|
1163
|
+
typeof variantOption == "string" && (options.query = {
|
|
1164
1164
|
variant: variantOption,
|
|
1165
1165
|
...options.query
|
|
1166
|
-
}), typeof variantOption == "object"
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
console.warn(
|
|
1171
|
-
`The Sanity client's beta \`variant\` option currently only supports one condition. Dropped: ${formatter.format(variantConditions.slice(1).map(([subject]) => JSON.stringify(subject)))}.`
|
|
1172
|
-
);
|
|
1173
|
-
}
|
|
1174
|
-
options.query = {
|
|
1175
|
-
...Object.fromEntries(searchParams),
|
|
1176
|
-
...options.query
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
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 });
|
|
1166
|
+
}), typeof variantOption == "object" && (options.query = {
|
|
1167
|
+
variantCondition: variantConditionsToQueryArray(variantOption),
|
|
1168
|
+
...options.query
|
|
1169
|
+
}), 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 });
|
|
1180
1170
|
}
|
|
1181
1171
|
const reqOptions = requestOptions(
|
|
1182
1172
|
config,
|
|
@@ -1251,11 +1241,8 @@ const resourceDataBase = (config) => {
|
|
|
1251
1241
|
throw new Error(`Unsupported resource type: ${type.toString()}`);
|
|
1252
1242
|
}
|
|
1253
1243
|
};
|
|
1254
|
-
function
|
|
1255
|
-
return
|
|
1256
|
-
"variantCondition",
|
|
1257
|
-
`${condition}:${value}`
|
|
1258
|
-
]);
|
|
1244
|
+
function variantConditionsToQueryArray(variantConditions) {
|
|
1245
|
+
return Object.entries(variantConditions).map(([condition, value]) => `${condition}:${value}`).toSorted();
|
|
1259
1246
|
}
|
|
1260
1247
|
function _generate(client, httpRequest, request) {
|
|
1261
1248
|
const dataset2 = hasDataset(client.config());
|