@sanity/schema
Advanced tools
Comparing version 0.105.15 to 0.106.1
@@ -15,4 +15,2 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
exports.default = guessPreviewFields; | ||
@@ -54,27 +52,21 @@ | ||
if (!titleField && !imageField) { | ||
var _ret = function () { | ||
// last resort, pick all fields and concat them | ||
var fieldNames = fields.map(function (field) { | ||
return field.name; | ||
}); | ||
var fieldMapping = fieldNames.reduce(function (acc, fieldName) { | ||
acc[fieldName] = fieldName; | ||
return acc; | ||
}, {}); | ||
// last resort, pick all fields and concat them | ||
var fieldNames = fields.map(function (field) { | ||
return field.name; | ||
}); | ||
var fieldMapping = fieldNames.reduce(function (acc, fieldName) { | ||
acc[fieldName] = fieldName; | ||
return acc; | ||
}, {}); | ||
return { | ||
v: { | ||
select: fieldMapping, | ||
prepare: function prepare(data) { | ||
return { | ||
title: fieldNames.map(function (name) { | ||
return name + ': ' + JSON.stringify(data[name]); | ||
}).join(' / ') | ||
}; | ||
} | ||
} | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
return { | ||
select: fieldMapping, | ||
prepare: function prepare(data) { | ||
return { | ||
title: fieldNames.map(function (name) { | ||
return name + ': ' + JSON.stringify(data[name]); | ||
}).join(' / ') | ||
}; | ||
} | ||
}; | ||
} | ||
@@ -81,0 +73,0 @@ |
@@ -32,3 +32,2 @@ 'use strict'; | ||
var INHERITED_FIELDS = ['fields', 'fieldsets']; | ||
var OVERRIDABLE_FIELDS = ['jsonType', 'type', 'name', 'title', 'description', 'options']; | ||
@@ -57,5 +56,11 @@ | ||
var compiledField = { name: name, fieldset: fieldset }; | ||
var compiledField = { | ||
name: name, | ||
fieldset: fieldset | ||
}; | ||
return (0, _utils.lazyGetter)(compiledField, 'type', function () { | ||
return createMemberType(rest); | ||
return createMemberType(_extends({}, rest, { | ||
title: fieldDef.title || (0, _startCase3.default)(name) | ||
})); | ||
}); | ||
@@ -62,0 +67,0 @@ }) |
{ | ||
"name": "@sanity/schema", | ||
"version": "0.105.15", | ||
"version": "0.106.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
142699
5383