Find all entity types that can be created by canonical data


1- Find all canonical types

// get all types that mixes Canonical
var canonicals = Canonical.mixersIn();

2- Find all transformation types

// get for every canonical the type that can transform it
var transforms = canonicals.reduce(function(acc, canonical){
  var transforms = canonical.allTransformTypes().map(function(transform) {
    return transform.typeName;
  return acc.concat(transforms);
}, []);

3- Extract type names from the transformation types:

var typeNames = _.uniq(transforms.reduce(function(acc, transform) {
  var persistables = c3Type(transform).mixins().filter(function(type){
    return type.isPersistable();
  var typenames = {
    return persistable.typeName()
  return acc.concat(typenames);
}, []).sort(), true);


Just because there is a convention doesn’t mean it is reliable. Check the persistable mixins of the transform type instead.


Thanks @matt for the pointer, I updated the names extraction by looking for persistable types mixed by the transform.