datasource: support connectors without `getTypes`

Asking connectors to provide `getTypes` function is a breaking
change, connectors working with loopback 1.3 no longer works
in newer versions.
This commit is contained in:
Miroslav Bajtoš 2014-07-25 11:32:40 +02:00
parent c92575c292
commit ebd0bc62ee
1 changed files with 2 additions and 1 deletions

View File

@ -647,7 +647,8 @@ DataSource.prototype.getModelDefinition = function (name) {
* ['rest'], or ['db', 'rdbms', 'mysql']
*/
DataSource.prototype.getTypes = function () {
var types = this.connector && this.connector.getTypes() || [];
var getTypes = this.connector && this.connector.getTypes;
var types = getTypes && getTypes() || [];
if (typeof types === 'string') {
types = types.split(/[\s,\/]+/);
}