@sanity/data-aspects
Advanced tools
Comparing version 0.99.0 to 0.100.0
@@ -13,6 +13,2 @@ 'use strict'; | ||
var _bundledTypes = require('part:@sanity/base/bundled-types'); | ||
var _bundledTypes2 = _interopRequireDefault(_bundledTypes); | ||
var _lodash = require('lodash'); | ||
@@ -24,5 +20,3 @@ | ||
var bundledTypeNames = _bundledTypes2.default.types.map(function (baseType) { | ||
return baseType.name; | ||
}); | ||
var bundledTypeNames = ['geopoint']; | ||
@@ -52,5 +46,3 @@ var DataAspectsResolver = function () { | ||
value: function getType(typeName) { | ||
return this.schema.types.find(function (currType) { | ||
return currType.name === typeName; | ||
}); | ||
return this.schema.get(typeName); | ||
} | ||
@@ -60,14 +52,20 @@ }, { | ||
value: function getInferredTypes() { | ||
var defaultTypes = this.schema.types || []; | ||
defaultTypes = defaultTypes.filter(function (type) { | ||
var _this = this; | ||
var defaultTypes = this.schema.getTypeNames() || []; | ||
defaultTypes = defaultTypes.filter(function (typeName) { | ||
// Exclude types which come bundled with Sanity | ||
return !bundledTypeNames.includes(type.name); | ||
return !bundledTypeNames.includes(typeName); | ||
}); | ||
if (this.config.hiddenTypes) { | ||
// Exclude types which are explicitly named in hiddenTypes | ||
defaultTypes = defaultTypes.filter(function (type) { | ||
return !_dataAspects2.default.hiddenTypes.includes(type.name); | ||
defaultTypes = defaultTypes.filter(function (typeName) { | ||
return !_dataAspects2.default.hiddenTypes.includes(typeName); | ||
}); | ||
} | ||
return defaultTypes; | ||
return defaultTypes.filter(function (typeName) { | ||
var schemaType = _this.getType(typeName); | ||
return schemaType.type !== null // this is the test for whether it is an toplevel type // todo: provide a better test | ||
&& schemaType.type.name === 'object'; | ||
}); | ||
} | ||
@@ -74,0 +72,0 @@ }, { |
{ | ||
"name": "@sanity/data-aspects", | ||
"version": "0.99.0", | ||
"version": "0.100.0", | ||
"description": "Sanity plugin which controls how your data is presented", | ||
@@ -5,0 +5,0 @@ "main": "lib/DataAspectsResolver.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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
91771
142
1