不要怂,就是干,撸起袖子干!

Commit a1bf8b02 by Sushant Committed by GitHub

Deprecate stuff / Update critical libs (#6945)

* using internal utils to deprecate / warn

* update to validator@6.2.0

* updated wkx@0.4.1
1 parent 4aa0a93a
......@@ -10,6 +10,7 @@ const warnings = {};
const Validator = require('./utils/validator-extras').validator;
const momentTz = require('moment-timezone');
const moment = require('moment');
const Utils = require('./utils');
/**
* A convenience class holding commonly used data types. The datatypes are used when defining a new model using `Sequelize.define`, like this:
......@@ -69,7 +70,7 @@ ABSTRACT.prototype.toSql = function toSql() {
ABSTRACT.warn = function warn(link, text) {
if (!warnings[text]) {
warnings[text] = true;
console.warn('>> WARNING:', text, '\n>> Check:', link);
Utils.warn(`${text}, '\n>> Check:', ${link}`);
}
};
ABSTRACT.prototype.stringify = function stringify(value, options) {
......
......@@ -109,7 +109,7 @@ class AbstractQuery {
*/
checkLoggingOption() {
if (this.options.logging === true) {
console.log('DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log');
Utils.deprecate('The logging-option should be either a function or false. Default: console.log');
this.options.logging = console.log;
}
}
......
......@@ -1068,7 +1068,7 @@ class Sequelize {
if (options.logging) {
if (options.logging === true) {
console.log('DEPRECATION WARNING: The logging-option should be either a function or false. Default: console.log');
Utils.deprecate('The logging-option should be either a function or false. Default: console.log');
options.logging = console.log;
}
......
......@@ -2,6 +2,7 @@
const _ = require('lodash');
const util = require('util');
const Utils = require('../utils');
function validateDeprecation(value, expectation, options) {
if (!options.deprecated) {
......@@ -12,8 +13,7 @@ function validateDeprecation(value, expectation, options) {
if (valid) {
const message = `${util.inspect(value)} should not be of type "${options.deprecated.name}"`;
console.log('DEPRECATION WARNING:', options.deprecationWarning || message);
Utils.deprecate(options.deprecationWarning || message);
}
return valid;
......
......@@ -81,9 +81,13 @@ validator.notNull = function() {
throw new Error('Warning "notNull" validation has been deprecated in favor of Schema based "allowNull"');
};
// https://github.com/chriso/validator.js/blob/1.5.0/lib/validators.js
// https://github.com/chriso/validator.js/blob/6.2.0/validator.js
_.forEach(extensions, (extend, key) => {
validator[key] = extend;
});
// map isNull to isEmpty
// https://github.com/chriso/validator.js/commit/e33d38a26ee2f9666b319adb67c7fc0d3dea7125
validator.isNull = validator.isEmpty;
exports.validator = validator;
......@@ -47,13 +47,13 @@
"lodash": "^4.17.1",
"moment": "^2.13.0",
"moment-timezone": "^0.5.4",
"uuid": "^3.0.0",
"retry-as-promised": "^2.0.0",
"semver": "^5.0.1",
"terraformer-wkt-parser": "^1.1.2",
"toposort-class": "^1.0.1",
"validator": "^5.6.0",
"wkx": "^0.3.0"
"uuid": "^3.0.0",
"validator": "^6.2.0",
"wkx": "^0.4.1"
},
"devDependencies": {
"chai": "^3.5.0",
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!