@@ -744,19 +744,19 @@ DataSource.prototype.mixin = function(ModelCtor) {
744
744
} ) ;
745
745
} ;
746
746
747
+ /*! Method will be deprecated in LoopBack.next
748
+ */
747
749
/**
748
- *
749
- * FIXME: Deprecation notice for 4.x?
750
750
* See [ModelBuilder.getModel](http://apidocs.strongloop.com/loopback-datasource-juggler/#modelbuilder-prototype-getmodel)
751
751
* for details.
752
752
*/
753
753
DataSource . prototype . getModel = function ( name , forceCreate ) {
754
754
return this . modelBuilder . getModel ( name , forceCreate ) ;
755
755
} ;
756
756
757
+ /*! Method will be deprecated in LoopBack.next
758
+ */
757
759
/**
758
- * // FIXME: Make this a link to ModelBuilder.getModelDefinition's docs!
759
- * // FIXME: Deprecation notice for 4.x?
760
760
* See ModelBuilder.getModelDefinition
761
761
* See [ModelBuilder.getModelDefinition](http://apidocs.strongloop.com/loopback-datasource-juggler/#modelbuilder-prototype-getmodeldefinition)
762
762
* for details.
@@ -765,6 +765,8 @@ DataSource.prototype.getModelDefinition = function(name) {
765
765
return this . modelBuilder . getModelDefinition ( name ) ;
766
766
} ;
767
767
768
+ /*! Method will be deprecated in LoopBack.next
769
+ */
768
770
/**
769
771
* Get the data source types collection.
770
772
* @returns {String[] } The data source type array.
@@ -773,7 +775,6 @@ DataSource.prototype.getModelDefinition = function(name) {
773
775
*
774
776
* Alternatively, ['rest'] would be a different type altogether, and would have
775
777
* no subtype.
776
- * FIXME: Deprecation notice for 4.x?
777
778
*/
778
779
DataSource . prototype . getTypes = function ( ) {
779
780
var getTypes = this . connector && this . connector . getTypes ;
@@ -806,14 +807,15 @@ DataSource.prototype.supportTypes = function(types) {
806
807
}
807
808
} ;
808
809
810
+ /*! In future versions, this will not maintain a strict 1:1 relationship between datasources and model classes
811
+ * Moving forward, we will allow a model to be attached to a datasource. The model itself becomes a template.
812
+ */
809
813
/**
810
814
* Attach an existing model to a data source.
811
815
* This will mixin all of the data access object functions (DAO) into your
812
816
* modelClass definition.
813
817
* @param {Function } modelClass The model constructor that will be enhanced by
814
818
* DAO mixins.
815
- * FIXME: In future versions, this will not maintain a strict 1:1 relationship
816
- * between datasources and model classes.
817
819
*/
818
820
819
821
DataSource . prototype . attach = function ( modelClass ) {
@@ -837,11 +839,12 @@ DataSource.prototype.attach = function(modelClass) {
837
839
return modelClass ;
838
840
} ;
839
841
842
+ /*! Method will be deprecated in LoopBack.next
843
+ */
840
844
/**
841
845
* Define a property with name `prop` on a target `model`. See
842
846
* [Properties](./Model-definition-JSON-file.html#properties) for more information
843
847
* regarding valid options for `params`.
844
- * FIXME: Deprecate for 4.0?
845
848
* @param {String } model Name of model
846
849
* @param {String } prop Name of property
847
850
* @param {Property } params Property settings
@@ -1010,8 +1013,9 @@ DataSource.prototype.discoverModelDefinitions = function(options, cb) {
1010
1013
return cb . promise ;
1011
1014
} ;
1012
1015
1016
+ /*! Method will be completely removed in LoopBack.next
1017
+ */
1013
1018
/**
1014
- * FIXME Deprecate/remove this for LB 4.0?
1015
1019
* The synchronous version of discoverModelDefinitions.
1016
1020
* @options {Object} options The options
1017
1021
* @property {Boolean } all If true, discover all models; if false, discover only models owned by the current user.
@@ -1071,8 +1075,9 @@ DataSource.prototype.discoverModelProperties = function(modelName, options, cb)
1071
1075
return cb . promise ;
1072
1076
} ;
1073
1077
1078
+ /*! Method will be completely removed in LoopBack.next
1079
+ */
1074
1080
/**
1075
- * FIXME: Deprecate this for LB 4.x?
1076
1081
* The synchronous version of discoverModelProperties
1077
1082
* @param {String } modelName The table/view name
1078
1083
* @param {Object } options The options
@@ -1123,8 +1128,9 @@ DataSource.prototype.discoverPrimaryKeys = function(modelName, options, cb) {
1123
1128
return cb . promise ;
1124
1129
} ;
1125
1130
1131
+ /*! Method will be completely removed in LoopBack.next
1132
+ */
1126
1133
/**
1127
- * FIXME: Obsolete?
1128
1134
* The synchronous version of discoverPrimaryKeys
1129
1135
* @param {String } modelName The model name
1130
1136
* @options {Object} options The options
@@ -1182,8 +1188,9 @@ DataSource.prototype.discoverForeignKeys = function(modelName, options, cb) {
1182
1188
return cb . promise ;
1183
1189
} ;
1184
1190
1191
+ /*! Method will be completely removed in LoopBack.next
1192
+ */
1185
1193
/**
1186
- * FIXME: Obsolete?
1187
1194
* The synchronous version of discoverForeignKeys
1188
1195
*
1189
1196
* @param {String } modelName The model name
@@ -1242,8 +1249,9 @@ DataSource.prototype.discoverExportedForeignKeys = function(modelName, options,
1242
1249
return cb . promise ;
1243
1250
} ;
1244
1251
1252
+ /*! Method will be completely removed in LoopBack.next
1253
+ */
1245
1254
/**
1246
- * FIXME: Obsolete?
1247
1255
* The synchronous version of discoverExportedForeignKeys
1248
1256
* @param {String } modelName The model name
1249
1257
* @param {Object } options The options
@@ -1564,9 +1572,10 @@ DataSource.prototype.discoverSchemas = function(tableName, options, cb) {
1564
1572
return cb . promise ;
1565
1573
} ;
1566
1574
1575
+ /*! Method will be completely removed in LoopBack.next
1576
+ */
1567
1577
/**
1568
1578
* Discover schema from a given table/view synchronously
1569
- * FIXME Obsolete?
1570
1579
* @param {String } modelName The model name
1571
1580
* @options {Object} [options] Options; see below.
1572
1581
* @property {String } owner|schema Database owner or schema name.
@@ -1749,9 +1758,10 @@ DataSource.prototype.discoverAndBuildModels = function(modelName, options, cb) {
1749
1758
} ) ;
1750
1759
} ;
1751
1760
1761
+ /*! Method will be completely removed in LoopBack.next
1762
+ */
1752
1763
/**
1753
1764
* Discover and build models from the given owner/modelName synchronously.
1754
- * FIXME: Obsolete?
1755
1765
* @param {String } modelName The model name.
1756
1766
* @options {Object} [options] Options; see below.
1757
1767
* @property {String } owner|schema Database owner or schema name.
@@ -1835,9 +1845,7 @@ DataSource.prototype.log = function(sql, t) {
1835
1845
1836
1846
/**
1837
1847
* Freeze dataSource. Behavior depends on connector
1838
- * REVIEW: Raymond, can you give example of what behavior(s) are typically
1839
- * expected here? I understand that it's connector-specific, but surely there's
1840
- * a common goal here.
1848
+ * To continuously add artifacts to datasource until it is frozen, but it is not really used in loopback.
1841
1849
*/
1842
1850
DataSource . prototype . freeze = function freeze ( ) {
1843
1851
if ( ! this . connector ) {
@@ -1988,10 +1996,10 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key
1988
1996
1989
1997
/**
1990
1998
* Close connection to the DataSource.
1991
- * REVIEW: Why is this not Promisified like the connect function?
1992
1999
* @param {Function } [cb] The callback function. Optional.
1993
2000
*/
1994
2001
DataSource . prototype . disconnect = function disconnect ( cb ) {
2002
+ cb = cb || utils . createPromiseCallback ( ) ;
1995
2003
var self = this ;
1996
2004
if ( this . connected && ( typeof this . connector . disconnect === 'function' ) ) {
1997
2005
this . connector . disconnect ( function ( err , result ) {
@@ -2004,6 +2012,7 @@ DataSource.prototype.disconnect = function disconnect(cb) {
2004
2012
cb && cb ( ) ;
2005
2013
} ) ;
2006
2014
}
2015
+ return cb . promise ;
2007
2016
} ;
2008
2017
2009
2018
/**
@@ -2197,9 +2206,8 @@ DataSource.prototype.isRelational = function() {
2197
2206
/**
2198
2207
* Check if the data source is ready.
2199
2208
* Returns a Boolean value.
2200
- * REVIEW: What is "obj" supposed to represent?
2201
- * @param {Object } obj ?
2202
- * @param {Object } args ?
2209
+ * @param {Object } obj Deferred method call if the connector is not fully connected yet
2210
+ * @param {Object } args argument passing to method call.
2203
2211
*/
2204
2212
DataSource . prototype . ready = function ( obj , args ) {
2205
2213
var self = this ;
@@ -2286,10 +2294,11 @@ DataSource.prototype.ping = function(cb) {
2286
2294
}
2287
2295
} ;
2288
2296
2297
+ /*! The hidden property call is too expensive so it is not used that much
2298
+ */
2289
2299
/**
2290
2300
* Define a hidden property
2291
- * REVIEW: Why is a hidden property not writable or enumerable? What
2292
- * purpose does it serve?
2301
+ * It is an utility to define a property to the Object with info flags
2293
2302
* @param {Object } obj The property owner
2294
2303
* @param {String } key The property name
2295
2304
* @param {Mixed } value The default value
0 commit comments