Export RelationClasses

Without this being exported, it was impossible to define custom
relation types. However, there are still limitations - not all helper
methods are public to really handle this scenario.
This commit is contained in:
Fabien Franzen 2014-09-04 21:04:55 +02:00
parent 07dbbd4224
commit 41e0efb2b0
1 changed files with 15 additions and 13 deletions

View File

@ -11,9 +11,6 @@ var applyFilter = require('./connectors/memory').applyFilter;
var ValidationError = require('./validations.js').ValidationError;
var debug = require('debug')('loopback:relations');
exports.Relation = Relation;
exports.RelationDefinition = RelationDefinition;
var RelationTypes = {
belongsTo: 'belongsTo',
hasMany: 'hasMany',
@ -24,16 +21,6 @@ var RelationTypes = {
embedsMany: 'embedsMany'
};
exports.RelationTypes = RelationTypes;
exports.HasMany = HasMany;
exports.HasManyThrough = HasManyThrough;
exports.HasOne = HasOne;
exports.HasAndBelongsToMany = HasAndBelongsToMany;
exports.BelongsTo = BelongsTo;
exports.ReferencesMany = ReferencesMany;
exports.EmbedsOne = EmbedsOne;
exports.EmbedsMany = EmbedsMany;
var RelationClasses = {
belongsTo: BelongsTo,
hasMany: HasMany,
@ -45,6 +32,21 @@ var RelationClasses = {
embedsMany: EmbedsMany
};
exports.Relation = Relation;
exports.RelationDefinition = RelationDefinition;
exports.RelationTypes = RelationTypes;
exports.RelationClasses = RelationClasses;
exports.HasMany = HasMany;
exports.HasManyThrough = HasManyThrough;
exports.HasOne = HasOne;
exports.HasAndBelongsToMany = HasAndBelongsToMany;
exports.BelongsTo = BelongsTo;
exports.ReferencesMany = ReferencesMany;
exports.EmbedsOne = EmbedsOne;
exports.EmbedsMany = EmbedsMany;
function normalizeType(type) {
if (!type) {
return type;