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 ValidationError = require('./validations.js').ValidationError;
var debug = require('debug')('loopback:relations'); var debug = require('debug')('loopback:relations');
exports.Relation = Relation;
exports.RelationDefinition = RelationDefinition;
var RelationTypes = { var RelationTypes = {
belongsTo: 'belongsTo', belongsTo: 'belongsTo',
hasMany: 'hasMany', hasMany: 'hasMany',
@ -24,16 +21,6 @@ var RelationTypes = {
embedsMany: 'embedsMany' 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 = { var RelationClasses = {
belongsTo: BelongsTo, belongsTo: BelongsTo,
hasMany: HasMany, hasMany: HasMany,
@ -45,6 +32,21 @@ var RelationClasses = {
embedsMany: EmbedsMany 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) { function normalizeType(type) {
if (!type) { if (!type) {
return type; return type;