Skip to content

Commit f804663

Browse files
authored
Merge pull request #1358 from strongloop/api-doc-2
Update api documents
2 parents bf7ea4c + ef61c86 commit f804663

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

lib/datasource.js

+33-24
Original file line numberDiff line numberDiff line change
@@ -744,19 +744,19 @@ DataSource.prototype.mixin = function(ModelCtor) {
744744
});
745745
};
746746

747+
/*! Method will be deprecated in LoopBack.next
748+
*/
747749
/**
748-
*
749-
* FIXME: Deprecation notice for 4.x?
750750
* See [ModelBuilder.getModel](http://apidocs.strongloop.com/loopback-datasource-juggler/#modelbuilder-prototype-getmodel)
751751
* for details.
752752
*/
753753
DataSource.prototype.getModel = function(name, forceCreate) {
754754
return this.modelBuilder.getModel(name, forceCreate);
755755
};
756756

757+
/*! Method will be deprecated in LoopBack.next
758+
*/
757759
/**
758-
* // FIXME: Make this a link to ModelBuilder.getModelDefinition's docs!
759-
* // FIXME: Deprecation notice for 4.x?
760760
* See ModelBuilder.getModelDefinition
761761
* See [ModelBuilder.getModelDefinition](http://apidocs.strongloop.com/loopback-datasource-juggler/#modelbuilder-prototype-getmodeldefinition)
762762
* for details.
@@ -765,6 +765,8 @@ DataSource.prototype.getModelDefinition = function(name) {
765765
return this.modelBuilder.getModelDefinition(name);
766766
};
767767

768+
/*! Method will be deprecated in LoopBack.next
769+
*/
768770
/**
769771
* Get the data source types collection.
770772
* @returns {String[]} The data source type array.
@@ -773,7 +775,6 @@ DataSource.prototype.getModelDefinition = function(name) {
773775
*
774776
* Alternatively, ['rest'] would be a different type altogether, and would have
775777
* no subtype.
776-
* FIXME: Deprecation notice for 4.x?
777778
*/
778779
DataSource.prototype.getTypes = function() {
779780
var getTypes = this.connector && this.connector.getTypes;
@@ -806,14 +807,15 @@ DataSource.prototype.supportTypes = function(types) {
806807
}
807808
};
808809

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+
*/
809813
/**
810814
* Attach an existing model to a data source.
811815
* This will mixin all of the data access object functions (DAO) into your
812816
* modelClass definition.
813817
* @param {Function} modelClass The model constructor that will be enhanced by
814818
* DAO mixins.
815-
* FIXME: In future versions, this will not maintain a strict 1:1 relationship
816-
* between datasources and model classes.
817819
*/
818820

819821
DataSource.prototype.attach = function(modelClass) {
@@ -837,11 +839,12 @@ DataSource.prototype.attach = function(modelClass) {
837839
return modelClass;
838840
};
839841

842+
/*! Method will be deprecated in LoopBack.next
843+
*/
840844
/**
841845
* Define a property with name `prop` on a target `model`. See
842846
* [Properties](./Model-definition-JSON-file.html#properties) for more information
843847
* regarding valid options for `params`.
844-
* FIXME: Deprecate for 4.0?
845848
* @param {String} model Name of model
846849
* @param {String} prop Name of property
847850
* @param {Property} params Property settings
@@ -1010,8 +1013,9 @@ DataSource.prototype.discoverModelDefinitions = function(options, cb) {
10101013
return cb.promise;
10111014
};
10121015

1016+
/*! Method will be completely removed in LoopBack.next
1017+
*/
10131018
/**
1014-
* FIXME Deprecate/remove this for LB 4.0?
10151019
* The synchronous version of discoverModelDefinitions.
10161020
* @options {Object} options The options
10171021
* @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)
10711075
return cb.promise;
10721076
};
10731077

1078+
/*! Method will be completely removed in LoopBack.next
1079+
*/
10741080
/**
1075-
* FIXME: Deprecate this for LB 4.x?
10761081
* The synchronous version of discoverModelProperties
10771082
* @param {String} modelName The table/view name
10781083
* @param {Object} options The options
@@ -1123,8 +1128,9 @@ DataSource.prototype.discoverPrimaryKeys = function(modelName, options, cb) {
11231128
return cb.promise;
11241129
};
11251130

1131+
/*! Method will be completely removed in LoopBack.next
1132+
*/
11261133
/**
1127-
* FIXME: Obsolete?
11281134
* The synchronous version of discoverPrimaryKeys
11291135
* @param {String} modelName The model name
11301136
* @options {Object} options The options
@@ -1182,8 +1188,9 @@ DataSource.prototype.discoverForeignKeys = function(modelName, options, cb) {
11821188
return cb.promise;
11831189
};
11841190

1191+
/*! Method will be completely removed in LoopBack.next
1192+
*/
11851193
/**
1186-
* FIXME: Obsolete?
11871194
* The synchronous version of discoverForeignKeys
11881195
*
11891196
* @param {String} modelName The model name
@@ -1242,8 +1249,9 @@ DataSource.prototype.discoverExportedForeignKeys = function(modelName, options,
12421249
return cb.promise;
12431250
};
12441251

1252+
/*! Method will be completely removed in LoopBack.next
1253+
*/
12451254
/**
1246-
* FIXME: Obsolete?
12471255
* The synchronous version of discoverExportedForeignKeys
12481256
* @param {String} modelName The model name
12491257
* @param {Object} options The options
@@ -1564,9 +1572,10 @@ DataSource.prototype.discoverSchemas = function(tableName, options, cb) {
15641572
return cb.promise;
15651573
};
15661574

1575+
/*! Method will be completely removed in LoopBack.next
1576+
*/
15671577
/**
15681578
* Discover schema from a given table/view synchronously
1569-
* FIXME Obsolete?
15701579
* @param {String} modelName The model name
15711580
* @options {Object} [options] Options; see below.
15721581
* @property {String} owner|schema Database owner or schema name.
@@ -1749,9 +1758,10 @@ DataSource.prototype.discoverAndBuildModels = function(modelName, options, cb) {
17491758
});
17501759
};
17511760

1761+
/*! Method will be completely removed in LoopBack.next
1762+
*/
17521763
/**
17531764
* Discover and build models from the given owner/modelName synchronously.
1754-
* FIXME: Obsolete?
17551765
* @param {String} modelName The model name.
17561766
* @options {Object} [options] Options; see below.
17571767
* @property {String} owner|schema Database owner or schema name.
@@ -1835,9 +1845,7 @@ DataSource.prototype.log = function(sql, t) {
18351845

18361846
/**
18371847
* 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.
18411849
*/
18421850
DataSource.prototype.freeze = function freeze() {
18431851
if (!this.connector) {
@@ -1988,10 +1996,10 @@ DataSource.prototype.defineForeignKey = function defineForeignKey(className, key
19881996

19891997
/**
19901998
* Close connection to the DataSource.
1991-
* REVIEW: Why is this not Promisified like the connect function?
19921999
* @param {Function} [cb] The callback function. Optional.
19932000
*/
19942001
DataSource.prototype.disconnect = function disconnect(cb) {
2002+
cb = cb || utils.createPromiseCallback();
19952003
var self = this;
19962004
if (this.connected && (typeof this.connector.disconnect === 'function')) {
19972005
this.connector.disconnect(function(err, result) {
@@ -2004,6 +2012,7 @@ DataSource.prototype.disconnect = function disconnect(cb) {
20042012
cb && cb();
20052013
});
20062014
}
2015+
return cb.promise;
20072016
};
20082017

20092018
/**
@@ -2197,9 +2206,8 @@ DataSource.prototype.isRelational = function() {
21972206
/**
21982207
* Check if the data source is ready.
21992208
* 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.
22032211
*/
22042212
DataSource.prototype.ready = function(obj, args) {
22052213
var self = this;
@@ -2286,10 +2294,11 @@ DataSource.prototype.ping = function(cb) {
22862294
}
22872295
};
22882296

2297+
/*! The hidden property call is too expensive so it is not used that much
2298+
*/
22892299
/**
22902300
* 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
22932302
* @param {Object} obj The property owner
22942303
* @param {String} key The property name
22952304
* @param {Mixed} value The default value

0 commit comments

Comments
 (0)