@sanity/assist 1.2.12 → 1.2.13
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.esm.js +34 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/schemas/index.ts +45 -6
package/dist/index.esm.js
CHANGED
|
@@ -4216,7 +4216,40 @@ const documentInstructionStatus = defineType({
|
|
|
4216
4216
|
}]
|
|
4217
4217
|
})]
|
|
4218
4218
|
});
|
|
4219
|
-
|
|
4219
|
+
function excludeComments(type) {
|
|
4220
|
+
var _a, _b, _c;
|
|
4221
|
+
const existingRender = (_a = type == null ? void 0 : type.components) == null ? void 0 : _a.field;
|
|
4222
|
+
return {
|
|
4223
|
+
...type,
|
|
4224
|
+
...("components" in type ? {
|
|
4225
|
+
components: {
|
|
4226
|
+
...type.components,
|
|
4227
|
+
field: props => {
|
|
4228
|
+
const newProps = {
|
|
4229
|
+
...props,
|
|
4230
|
+
...{
|
|
4231
|
+
__internal_comments: void 0
|
|
4232
|
+
}
|
|
4233
|
+
};
|
|
4234
|
+
if (typeof existingRender === "function") {
|
|
4235
|
+
return existingRender(newProps);
|
|
4236
|
+
}
|
|
4237
|
+
return props.renderDefault(newProps);
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
} : {}),
|
|
4241
|
+
...("fields" in type ? {
|
|
4242
|
+
// recursively disable comments in fields
|
|
4243
|
+
fields: (_b = type.fields) == null ? void 0 : _b.map(field => excludeComments(field))
|
|
4244
|
+
} : {}),
|
|
4245
|
+
...("of" in type ? {
|
|
4246
|
+
// recursively disable comments in array items
|
|
4247
|
+
of: (_c = type.of) == null ? void 0 : _c.map(arrayItemType => excludeComments(arrayItemType))
|
|
4248
|
+
} : {})
|
|
4249
|
+
};
|
|
4250
|
+
}
|
|
4251
|
+
const instructionForm = [fieldInstructions, instruction, fieldReference, prompt, userInput, promptContext].map(excludeComments);
|
|
4252
|
+
const schemaTypes = [...instructionForm, assistDocumentSchema, documentInstructionStatus, instructionTask, contextDocumentSchema];
|
|
4220
4253
|
function useAssistSupported(path, schemaType) {
|
|
4221
4254
|
return useMemo(() => isAssistSupported(schemaType), [schemaType]);
|
|
4222
4255
|
}
|