Skip to content

Commit 6e06fe4

Browse files
authored
Merge pull request #435 from strongloop/update-deps
Drop support for Node.js 8.x + update dependencies to latest
2 parents eb72ea9 + 848f1ca commit 6e06fe4

24 files changed

+437
-463
lines changed

.mocharc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"globals": "getSchema",
3+
"timeout": "15000",
4+
"exit": true
5+
}

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: node_js
22
node_js:
3-
- "8"
43
- "10"
54
- "12"
65
- "14"
@@ -19,4 +18,4 @@ before_install:
1918
- mysql -e "use mysql; update user set authentication_string=PASSWORD('test') where User='test'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
2019
- mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;"
2120
- mysql -e "GRANT SUPER ON *.* TO 'test'@'localhost' IDENTIFIED BY 'test';FLUSH PRIVILEGES;"
22-
21+

example/app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
// License text available at https://opensource.org/licenses/MIT
55

66
'use strict';
7-
var DataSource = require('loopback-datasource-juggler').DataSource;
7+
const DataSource = require('loopback-datasource-juggler').DataSource;
88

9-
var config = require('rc')('loopback', {dev: {mysql: {}}}).dev.mysql;
9+
const config = require('rc')('loopback', {dev: {mysql: {}}}).dev.mysql;
1010

11-
var ds = new DataSource(require('../'), config);
11+
const ds = new DataSource(require('../'), config);
1212

1313
function show(err, models) {
1414
if (err) {
@@ -35,7 +35,7 @@ ds.discoverForeignKeys('inventory', show);
3535
ds.discoverExportedForeignKeys('location', show);
3636

3737
ds.discoverAndBuildModels('weapon', {owner: 'strongloop', visited: {}, associations: true}, function(err, models) {
38-
for (var m in models) {
38+
for (const m in models) {
3939
models[m].all(show);
4040
}
4141
});

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// License text available at https://opensource.org/licenses/MIT
55

66
'use strict';
7-
var SG = require('strong-globalize');
7+
const SG = require('strong-globalize');
88
SG.SetRootDir(__dirname);
99

1010
module.exports = require('./lib/mysql.js');

lib/discovery.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// License text available at https://opensource.org/licenses/MIT
55

66
'use strict';
7-
var g = require('strong-globalize')();
7+
const g = require('strong-globalize')();
88

99
module.exports = mixinDiscovery;
1010

@@ -13,20 +13,20 @@ module.exports = mixinDiscovery;
1313
* @param {Object} mysql mysql driver
1414
*/
1515
function mixinDiscovery(MySQL, mysql) {
16-
var async = require('async');
16+
const async = require('async');
1717

1818
function paginateSQL(sql, orderBy, options) {
1919
options = options || {};
20-
var limitClause = '';
20+
let limitClause = '';
2121
if (options.offset || options.skip || options.limit) {
2222
// Offset starts from 0
23-
var offset = Number(options.offset || options.skip || 0);
23+
let offset = Number(options.offset || options.skip || 0);
2424
if (isNaN(offset)) {
2525
offset = 0;
2626
}
2727
limitClause = ' LIMIT ' + offset;
2828
if (options.limit) {
29-
var limit = Number(options.limit);
29+
let limit = Number(options.limit);
3030
if (isNaN(limit)) {
3131
limit = 0;
3232
}
@@ -45,7 +45,7 @@ function mixinDiscovery(MySQL, mysql) {
4545
* @returns {String} The SQL statement
4646
*/
4747
MySQL.prototype.buildQuerySchemas = function(options) {
48-
var sql = 'SELECT catalog_name as "catalog",' +
48+
const sql = 'SELECT catalog_name as "catalog",' +
4949
' schema_name as "schema"' +
5050
' FROM information_schema.schemata';
5151
return paginateSQL(sql, 'schema_name', options);
@@ -57,8 +57,8 @@ function mixinDiscovery(MySQL, mysql) {
5757
* @returns {string} The sql statement
5858
*/
5959
MySQL.prototype.buildQueryTables = function(options) {
60-
var sqlTables = null;
61-
var schema = options.owner || options.schema;
60+
let sqlTables = null;
61+
const schema = options.owner || options.schema;
6262

6363
if (options.all && !schema) {
6464
sqlTables = paginateSQL('SELECT \'table\' AS "type",' +
@@ -87,9 +87,9 @@ function mixinDiscovery(MySQL, mysql) {
8787
* @returns {string} The sql statement
8888
*/
8989
MySQL.prototype.buildQueryViews = function(options) {
90-
var sqlViews = null;
90+
let sqlViews = null;
9191
if (options.views) {
92-
var schema = options.owner || options.schema;
92+
const schema = options.owner || options.schema;
9393

9494
if (options.all && !schema) {
9595
sqlViews = paginateSQL('SELECT \'view\' AS "type",' +
@@ -155,7 +155,7 @@ function mixinDiscovery(MySQL, mysql) {
155155
* @returns {String} The sql statement
156156
*/
157157
MySQL.prototype.buildQueryColumns = function(schema, table) {
158-
var sql = null;
158+
let sql = null;
159159
if (schema) {
160160
sql = paginateSQL('SELECT table_schema AS "owner",' +
161161
' table_name AS "tableName",' +
@@ -206,7 +206,7 @@ function mixinDiscovery(MySQL, mysql) {
206206
// http://docs.oracle.com/javase/6/docs/api/java/sql/DatabaseMetaData.html
207207
// #getPrimaryKeys(java.lang.String, java.lang.String, java.lang.String)
208208
MySQL.prototype.buildQueryPrimaryKeys = function(schema, table) {
209-
var sql = 'SELECT table_schema AS "owner",' +
209+
let sql = 'SELECT table_schema AS "owner",' +
210210
' table_name AS "tableName",' +
211211
' column_name AS "columnName",' +
212212
' ordinal_position AS "keySeq",' +
@@ -239,7 +239,7 @@ function mixinDiscovery(MySQL, mysql) {
239239
* @returns {string}
240240
*/
241241
MySQL.prototype.buildQueryForeignKeys = function(schema, table) {
242-
var sql =
242+
let sql =
243243
'SELECT table_schema AS "fkOwner",' +
244244
' constraint_name AS "fkName",' +
245245
' table_name AS "fkTableName",' +
@@ -276,7 +276,7 @@ function mixinDiscovery(MySQL, mysql) {
276276
* @returns {string}
277277
*/
278278
MySQL.prototype.buildQueryExportedForeignKeys = function(schema, table) {
279-
var sql = 'SELECT a.constraint_name AS "fkName",' +
279+
let sql = 'SELECT a.constraint_name AS "fkName",' +
280280
' a.table_schema AS "fkOwner",' +
281281
' a.table_name AS "fkTableName",' +
282282
' a.column_name AS "fkColumnName",' +
@@ -306,11 +306,11 @@ function mixinDiscovery(MySQL, mysql) {
306306
*/
307307

308308
MySQL.prototype.buildPropertyType = function(columnDefinition, options) {
309-
var mysqlType = columnDefinition.dataType;
310-
var columnType = columnDefinition.columnType;
311-
var dataLength = columnDefinition.dataLength;
309+
const mysqlType = columnDefinition.dataType;
310+
const columnType = columnDefinition.columnType;
311+
const dataLength = columnDefinition.dataLength;
312312

313-
var type = mysqlType.toUpperCase();
313+
const type = mysqlType.toUpperCase();
314314
switch (type) {
315315
case 'CHAR':
316316
if (!options.treatCHAR1AsString && columnType === 'char(1)') {
@@ -379,13 +379,13 @@ function mixinDiscovery(MySQL, mysql) {
379379
// http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html
380380
// Currently default is the inverse of the recommendation for backward compatibility.
381381
MySQL.prototype.setDefaultOptions = function(options) {
382-
var defaultOptions = {
382+
const defaultOptions = {
383383
treatCHAR1AsString: false,
384384
treatBIT1AsBit: true,
385385
treatTINYINT1AsTinyInt: true,
386386
};
387387

388-
for (var opt in defaultOptions) {
388+
for (const opt in defaultOptions) {
389389
if (defaultOptions.hasOwnProperty(opt) && !options.hasOwnProperty(opt)) {
390390
options[opt] = defaultOptions[opt];
391391
}

lib/enumFactory.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
// License text available at https://opensource.org/licenses/MIT
55

66
'use strict';
7-
var g = require('strong-globalize')();
7+
const g = require('strong-globalize')();
88

9-
var EnumFactory = function() {
9+
const EnumFactory = function() {
1010
if (arguments.length > 0) {
11-
var Enum = function Enum(arg) {
11+
const Enum = function Enum(arg) {
1212
if (typeof arg === 'number' && arg % 1 == 0) {
1313
return Enum._values[arg];
1414
} else if (Enum[arg]) {
@@ -21,11 +21,11 @@ var EnumFactory = function() {
2121
return '';
2222
}
2323
};
24-
var dxList = [];
24+
const dxList = [];
2525
// Want empty value to be at index 0 to match MySQL Enum values and
2626
// MySQL non-strict behavior.
2727
dxList.push('');
28-
for (var arg in arguments) {
28+
for (let arg in arguments) {
2929
arg = String(arguments[arg]);
3030
Object.defineProperty(Enum, arg.toUpperCase(), {
3131
configurable: false,
@@ -55,8 +55,8 @@ var EnumFactory = function() {
5555
};
5656

5757
function stringified(anEnum) {
58-
var s = [];
59-
for (var i in anEnum._values) {
58+
const s = [];
59+
for (const i in anEnum._values) {
6060
if (anEnum._values[i] != '') {
6161
s.push("'" + anEnum._values[i] + "'");
6262
}

0 commit comments

Comments
 (0)