@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.js
CHANGED
|
@@ -4229,7 +4229,40 @@ const documentInstructionStatus = sanity.defineType({
|
|
|
4229
4229
|
}]
|
|
4230
4230
|
})]
|
|
4231
4231
|
});
|
|
4232
|
-
|
|
4232
|
+
function excludeComments(type) {
|
|
4233
|
+
var _a, _b, _c;
|
|
4234
|
+
const existingRender = (_a = type == null ? void 0 : type.components) == null ? void 0 : _a.field;
|
|
4235
|
+
return {
|
|
4236
|
+
...type,
|
|
4237
|
+
...("components" in type ? {
|
|
4238
|
+
components: {
|
|
4239
|
+
...type.components,
|
|
4240
|
+
field: props => {
|
|
4241
|
+
const newProps = {
|
|
4242
|
+
...props,
|
|
4243
|
+
...{
|
|
4244
|
+
__internal_comments: void 0
|
|
4245
|
+
}
|
|
4246
|
+
};
|
|
4247
|
+
if (typeof existingRender === "function") {
|
|
4248
|
+
return existingRender(newProps);
|
|
4249
|
+
}
|
|
4250
|
+
return props.renderDefault(newProps);
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
} : {}),
|
|
4254
|
+
...("fields" in type ? {
|
|
4255
|
+
// recursively disable comments in fields
|
|
4256
|
+
fields: (_b = type.fields) == null ? void 0 : _b.map(field => excludeComments(field))
|
|
4257
|
+
} : {}),
|
|
4258
|
+
...("of" in type ? {
|
|
4259
|
+
// recursively disable comments in array items
|
|
4260
|
+
of: (_c = type.of) == null ? void 0 : _c.map(arrayItemType => excludeComments(arrayItemType))
|
|
4261
|
+
} : {})
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4264
|
+
const instructionForm = [fieldInstructions, instruction, fieldReference, prompt, userInput, promptContext].map(excludeComments);
|
|
4265
|
+
const schemaTypes = [...instructionForm, assistDocumentSchema, documentInstructionStatus, instructionTask, contextDocumentSchema];
|
|
4233
4266
|
function useAssistSupported(path, schemaType) {
|
|
4234
4267
|
return react.useMemo(() => isAssistSupported(schemaType), [schemaType]);
|
|
4235
4268
|
}
|