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:
parent
c92575c292
commit
ebd0bc62ee
|
@ -647,7 +647,8 @@ DataSource.prototype.getModelDefinition = function (name) {
|
||||||
* ['rest'], or ['db', 'rdbms', 'mysql']
|
* ['rest'], or ['db', 'rdbms', 'mysql']
|
||||||
*/
|
*/
|
||||||
DataSource.prototype.getTypes = function () {
|
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') {
|
if (typeof types === 'string') {
|
||||||
types = types.split(/[\s,\/]+/);
|
types = types.split(/[\s,\/]+/);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue