From ebd0bc62ee04eebf5583947483c0a43b44c4bd62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Fri, 25 Jul 2014 11:32:40 +0200 Subject: [PATCH] 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. --- lib/datasource.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/datasource.js b/lib/datasource.js index 774362c7..34f40e0b 100644 --- a/lib/datasource.js +++ b/lib/datasource.js @@ -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,\/]+/); }