@sanity/client 7.25.0 → 7.26.1
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/README.md +1 -1
- 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/dist/stega.browser.cjs.map +1 -1
- package/dist/stega.browser.d.cts +3 -1
- package/dist/stega.browser.d.ts +3 -1
- package/dist/stega.browser.js.map +1 -1
- package/dist/stega.cjs.map +1 -1
- package/dist/stega.d.cts +3 -1
- package/dist/stega.d.ts +3 -1
- package/dist/stega.js.map +1 -1
- package/package.json +1 -1
- package/src/data/dataMethods.ts +16 -30
- package/src/stega/stegaBrand.ts +3 -1
- package/umd/sanityClient.js +7 -20
- package/umd/sanityClient.min.js +1 -1
package/README.md
CHANGED
|
@@ -919,7 +919,7 @@ if (stegaClean(post.imageLocation) === 'left') {
|
|
|
919
919
|
}
|
|
920
920
|
```
|
|
921
921
|
|
|
922
|
-
Properties that are never stega encoded keep their plain string types: keys starting with `_` (`_id`, `_type`, `_createdAt`, `_updatedAt`, `_key`, `_ref` and friends, so narrowing unions on `_type` keeps working), `slug.current` patterns,
|
|
922
|
+
Properties that are never stega encoded keep their plain string types: keys starting with `_` (`_id`, `_type`, `_createdAt`, `_updatedAt`, `_key`, `_ref` and friends, so narrowing unions on `_type` keeps working), `slug.current` patterns, Portable Text properties like `style`, `listItem` and `marks`, and symbol-keyed properties (like TypeGen's `internalGroqTypeReferenceTo` reference marker, which only exists in the type system since JSON can't contain symbol keys). Everything else is assumed to be "poisoned", even if the stega `filter` skips it at runtime (URLs, dates and such), as a redundant `stegaClean` is harmless while a missing one is a bug.
|
|
923
923
|
|
|
924
924
|
If you type your query results manually, brand them with the `StegaBranded` helper type, or re-type already fetched data with the `stegaBrand` identity function:
|
|
925
925
|
|
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());
|