From 41e0efb2b0e30cd25db59697f94e1c5f8b1555ed Mon Sep 17 00:00:00 2001 From: Fabien Franzen Date: Thu, 4 Sep 2014 21:04:55 +0200 Subject: [PATCH] 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. --- lib/relation-definition.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/relation-definition.js b/lib/relation-definition.js index e32bd253..1bae486a 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -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;